/* ==========================================================================
   星屿汐 · ICP 虚拟备案系统 - 全局样式
   设计 Token 与 IDC 控制台设计规范同源（style-guide.html），勿改色值。
   ========================================================================== */

/* ---------- 设计 Token ---------- */
:root {
  --bg-deep: #f5f5f7; --bg-mid: #f5f5f7; --bg-surface: #ffffff;
  --topbar-bg: rgba(255,255,255,.78); --sidebar-bg: rgba(255,255,255,.7);
  --line: rgba(0,0,0,.1); --line-soft: rgba(0,0,0,.06);
  --text: rgba(0,0,0,.88); --text-sub: rgba(0,0,0,.58); --text-weak: rgba(0,0,0,.38);
  --hover: rgba(0,0,0,.05); --hover-strong: rgba(0,0,0,.08); --active: rgba(0,0,0,.09);
  --card-hover: rgba(0,0,0,.02); --row-hover: rgba(0,0,0,.03);
  --thead-bg: rgba(0,0,0,.025); --track: rgba(0,0,0,.08); --dot-off: rgba(0,0,0,.3);
  --focus-border: rgba(0,0,0,.25); --border-strong: rgba(0,0,0,.16);
  --accent-soft: rgba(10,132,255,.08); --red-soft: rgba(255,59,48,.12);
  --badge-red: rgba(255,59,48,.12); --badge-orange: rgba(255,149,0,.15);
  --mask: rgba(0,0,0,.25); --shadow-pop: 0 2px 8px rgba(0,0,0,.1);
  --accent: #0a84ff; --green: #34C759; --orange: #FF9500; --red: #FF3B30; --purple: #AF52DE; --teal: #5AC8FA;
  --r-card: 10px; --r-btn: 8px; --r-sm: 6px;
  --font-sans: "Manrope Variable", "Source Han Sans SC VF", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-display: "DingTalk JinBuTi Latin", "DingTalk JinBuTi", "Manrope Variable", "Source Han Sans SC VF", -apple-system, sans-serif;
  --font-mono: "SF Mono", Menlo, Consolas, monospace;
  --font-num: "Manrope Variable", "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
}
html[data-theme="dark"] {
  --bg-deep: #1c1c1e; --bg-mid: #2c2c2e; --bg-surface: #3a3a3c;
  --topbar-bg: rgba(28,28,30,.85); --sidebar-bg: rgba(28,28,30,.8);
  --line: rgba(255,255,255,.1); --line-soft: rgba(255,255,255,.08);
  --text: rgba(255,255,255,.95); --text-sub: rgba(255,255,255,.7); --text-weak: rgba(255,255,255,.4);
  --hover: rgba(255,255,255,.05); --hover-strong: rgba(255,255,255,.08); --active: rgba(255,255,255,.1);
  --card-hover: rgba(255,255,255,.04); --row-hover: rgba(255,255,255,.04);
  --thead-bg: rgba(255,255,255,.04); --track: rgba(255,255,255,.1); --dot-off: rgba(255,255,255,.3);
  --focus-border: rgba(255,255,255,.25); --border-strong: rgba(255,255,255,.16);
  --accent-soft: rgba(10,132,255,.08); --red-soft: rgba(255,69,58,.15);
  --badge-red: rgba(255,69,58,.15); --badge-orange: rgba(255,159,10,.15);
  --mask: rgba(0,0,0,.5); --shadow-pop: 0 2px 8px rgba(0,0,0,.3);
  --accent: #0a84ff; --green: #30D158; --orange: #FF9F0A; --red: #FF453A; --purple: #BF5AF2; --teal: #64D2FF;
}

/* ---------- 基础 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-sans); font-size: 14.5px; color: var(--text); background: var(--bg-deep); transition: background-color .2s ease-out, color .2s ease-out; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }
.tabular { font-variant-numeric: tabular-nums; }
code, .code { font-family: var(--font-mono); font-size: 12px; background: var(--bg-deep); border: 1px solid var(--line-soft); padding: 2px 7px; border-radius: 5px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------- 顶栏（公共端 + 管理端共用） ---------- */
.topbar { position: sticky; top: 0; z-index: 50; height: 48px; background: var(--topbar-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; padding: 0 18px; gap: 14px; }
.brand { display: flex; align-items: baseline; gap: 9px; white-space: nowrap; }
.brand b { font-family: var(--font-display); font-size: 17.5px; font-weight: 600; letter-spacing: .3px; }
.brand span { font-size: 12px; color: var(--text-weak); padding: 2px 7px; border: 1px solid var(--line); border-radius: var(--r-sm); white-space: nowrap; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 30px; height: 30px; border-radius: var(--r-btn); display: inline-flex; align-items: center; justify-content: center; color: var(--text-sub); transition: background-color .2s ease-out, color .2s ease-out; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.th-moon { display: none; }
html[data-theme="dark"] .th-sun { display: none; }
html[data-theme="dark"] .th-moon { display: block; }

/* 公共端导航 */
.site-nav { display: flex; gap: 2px; margin-left: 18px; }
.site-nav a { padding: 6px 12px; border-radius: var(--r-btn); font-size: 13.5px; color: var(--text-sub); transition: background-color .2s ease-out, color .2s ease-out; }
.site-nav a:hover { background: var(--hover); color: var(--text); }
.site-nav a.active { background: var(--active); color: var(--text); font-weight: 600; }

/* ---------- 公共端页面骨架 ---------- */
.page { max-width: 780px; margin: 0 auto; padding: 44px 20px 72px; min-height: calc(100vh - 48px); }
.page-wide { max-width: 1080px; }
.hero { text-align: center; padding: 28px 0 8px; }
.hero h1 { font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: .3px; }
.hero p { margin-top: 8px; font-size: 14px; color: var(--text-sub); line-height: 1.7; }

/* 搜索框 */
.search-box { display: flex; gap: 10px; max-width: 560px; margin: 26px auto 0; }
.search-box input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: var(--r-btn); padding: 11px 14px; font-size: 14.5px; outline: none; background: var(--bg-surface); transition: border-color .2s ease-out; }
.search-box input:focus { border-color: var(--accent); }
.search-hint { text-align: center; font-size: 12px; color: var(--text-weak); margin-top: 10px; }

/* 公告条 */
.announce { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); border: 1px solid var(--line-soft); border-radius: var(--r-card); padding: 12px 16px; margin-top: 34px; font-size: 13.5px; color: var(--text-sub); line-height: 1.7; white-space: pre-line; }
.announce b { color: var(--accent); font-size: 13px; flex-shrink: 0; }

/* ---------- 卡片 / 区块 ---------- */
.card { background: var(--bg-surface); border: 1px solid var(--line-soft); border-radius: var(--r-card); padding: 20px; }
.card + .card { margin-top: 16px; }
.card h3 { font-size: 14.5px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card h3 small { font-weight: 400; color: var(--text-weak); font-size: 12px; margin-left: 2px; }
.section-title { font-size: 15.5px; font-weight: 600; font-family: var(--font-display); margin: 30px 0 12px; }

/* 备案号展示 */
.beian-no { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: .5px; }
.beian-meta { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; color: var(--text-sub); }
.beian-meta .row { display: flex; gap: 8px; }
.beian-meta .row b { color: var(--text); font-weight: 600; min-width: 64px; flex-shrink: 0; }

/* 对接代码块 */
.code-block { display: flex; gap: 10px; align-items: center; background: var(--bg-deep); border: 1px solid var(--line-soft); border-radius: var(--r-btn); padding: 10px 14px; margin-top: 12px; }
.code-block code { flex: 1; min-width: 0; word-break: break-all; background: none; border: none; padding: 0; font-size: 12.5px; line-height: 1.6; }
.copy-ok { color: var(--green); font-size: 12.5px; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .form-grid.two { grid-template-columns: 1fr 1fr; } }
.form-item label { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 7px; }
.form-item label .req { color: var(--red); margin-left: 2px; }
.inp, select.inp, textarea.inp { border: 1px solid var(--line); border-radius: var(--r-btn); padding: 9px 12px; font-size: 14px; outline: none; background: var(--bg-deep); color: var(--text); width: 100%; transition: border-color .2s ease-out; }
textarea.inp { resize: vertical; min-height: 88px; line-height: 1.6; }
.inp:focus, select.inp:focus, textarea.inp:focus { border-color: var(--accent); background: var(--bg-surface); }
.inp.err { border-color: var(--red); }
.field-err { font-size: 12px; color: var(--red); margin-top: 5px; display: none; }
.field-err.show { display: block; }
.form-actions { margin-top: 22px; display: flex; gap: 10px; align-items: center; }
.form-note { font-size: 12px; color: var(--text-weak); line-height: 1.7; margin-top: 10px; }

/* 选号区 */
.keyword-box { display: flex; gap: 10px; align-items: center; }
.keyword-box input { font-family: var(--font-num); font-size: 20px; font-weight: 600; letter-spacing: 3px; text-align: center; width: 210px; }
.kw-status { font-size: 12.5px; color: var(--text-weak); }
.kw-status.ok { color: var(--green); }
.kw-status.bad { color: var(--red); }
.kw-preview { margin-top: 10px; font-size: 13px; color: var(--text-sub); }
.kw-preview b { font-family: var(--font-display); font-size: 16px; color: var(--text); }

/* ---------- 按钮 / chips / pill ---------- */
.btn { padding: 7px 16px; border-radius: var(--r-btn); font-size: 13.5px; border: 1px solid var(--border-strong); background: var(--bg-surface); color: var(--text); transition: background-color .2s ease-out, border-color .2s ease-out, color .2s ease-out; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--active); border-color: var(--focus-border); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #0071e3; border-color: #0071e3; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #d6302a; border-color: #d6302a; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text-sub); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-loading { opacity: .7; pointer-events: none; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 5px 13px; border-radius: var(--r-sm); font-size: 12.5px; color: var(--text-sub); border: 1px solid var(--line); cursor: pointer; transition: background-color .2s ease-out, border-color .2s ease-out, color .2s ease-out; background: var(--bg-surface); }
.chip:hover { border-color: var(--focus-border); color: var(--text); }
.chip.sel { background: var(--accent); border-color: var(--accent); color: #fff; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-sm); font-size: 12.5px; font-weight: 500; background: var(--hover); }
.pill i { width: 5px; height: 5px; border-radius: 50%; }
.pill.run { color: var(--green); } .pill.run i { background: var(--green); }
.pill.warn { color: var(--orange); } .pill.warn i { background: var(--orange); }
.pill.stop { color: var(--text-weak); } .pill.stop i { background: var(--dot-off); }
.pill.done { color: var(--green); } .pill.done i { background: var(--green); }
.pill.doing { color: var(--accent); } .pill.doing i { background: var(--accent); }

/* ---------- 表格 ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 12px; color: var(--text-weak); font-weight: 500; padding: 9px 12px; background: var(--thead-bg); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tbody tr { transition: background-color .2s ease-out; }
.tbl tbody tr:hover { background: var(--row-hover); }
.tbl .num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

/* ---------- 管理端布局 ---------- */
.layout { display: grid; grid-template-columns: 200px 1fr; min-height: calc(100vh - 48px); }
.sidebar { position: sticky; top: 48px; height: calc(100vh - 48px); padding: 14px 10px; background: var(--sidebar-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-right: 1px solid var(--line-soft); overflow-y: auto; align-self: start; }
.side-label { font-size: 12px; color: var(--text-weak); padding: 18px 10px 7px; letter-spacing: .5px; }
.side-label:first-child { padding-top: 6px; }
.side-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-btn); color: var(--text-sub); font-size: 14.5px; margin-bottom: 3px; transition: background-color .2s ease-out, color .2s ease-out; }
.side-item:hover { background: var(--hover); color: var(--text); }
.side-item.active { background: var(--active); color: var(--text); font-weight: 600; }
.side-item .cnt { margin-left: auto; font-size: 11.5px; color: var(--text-weak); background: var(--hover); padding: 1px 7px; border-radius: 9px; }
.main { grid-column: 2; padding: 34px 36px 60px; min-width: 0; }
.page-head { margin-bottom: 26px; }
.page-head h1 { font-family: var(--font-display); font-size: 24px; font-weight: 600; }
.page-head p { margin-top: 6px; font-size: 14px; color: var(--text-sub); max-width: 640px; line-height: 1.7; }
.admin-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.admin-toolbar .inp { width: 220px; }

/* KPI 卡 */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 26px; }
.kpi { background: var(--bg-surface); border: 1px solid var(--line-soft); border-radius: var(--r-card); padding: 16px 18px; }
.kpi .k-label { font-size: 12px; color: var(--text-sub); }
.kpi .k-num { font-family: var(--font-num); font-size: 26px; font-weight: 600; margin-top: 5px; font-variant-numeric: tabular-nums; }
.kpi .k-num.green { color: var(--green); }
.kpi .k-num.orange { color: var(--orange); }
.kpi .k-num.red { color: var(--red); }
.kpi .k-num.accent { color: var(--accent); }

/* ---------- 步骤条 ---------- */
.steps { display: flex; align-items: center; width: 100%; max-width: 480px; margin: 30px auto 34px; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; }
.step .dot { width: 22px; height: 22px; border-radius: 50%; background: var(--track); color: var(--text-weak); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; transition: background-color .3s ease-out, color .3s ease-out; z-index: 1; }
.step.done .dot { background: var(--green); color: #fff; }
.step.active .dot { background: var(--accent); color: #fff; animation: pulse-ring 1.5s ease-out infinite; }
.step .label { font-size: 12px; color: var(--text-weak); white-space: nowrap; }
.step.done .label, .step.active .label { color: var(--text-sub); }
.step::after { content: ''; position: absolute; top: 11px; left: 50%; width: 100%; height: 2px; background: var(--track); z-index: 0; }
.step:last-child::after { display: none; }
.step.done::after { background: var(--green); }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(10,132,255,.4); } 70% { box-shadow: 0 0 0 8px rgba(10,132,255,0); } 100% { box-shadow: 0 0 0 0 rgba(10,132,255,0); } }

/* ---------- 结果图标 ---------- */
.result-icon { width: 52px; height: 52px; margin: 0 auto; }
.result-icon svg { width: 100%; height: 100%; }
.result-icon .circle { fill: none; stroke-width: 2.5; stroke-linecap: round; }
.result-icon .check, .result-icon .cross { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.result-icon.success .circle { stroke: var(--green); stroke-dasharray: 166; stroke-dashoffset: 166; animation: draw-circle .6s ease-out forwards; }
.result-icon.success .check { stroke: var(--green); stroke-dasharray: 48; stroke-dashoffset: 48; animation: draw-check .4s ease-out .5s forwards; }
.result-icon.error .circle { stroke: var(--red); stroke-dasharray: 166; stroke-dashoffset: 166; animation: draw-circle .6s ease-out forwards; }
.result-icon.error .cross { stroke: var(--red); stroke-dasharray: 48; stroke-dashoffset: 48; animation: draw-check .4s ease-out .5s forwards; }
@keyframes draw-circle { to { stroke-dashoffset: 0; } }
@keyframes draw-check { to { stroke-dashoffset: 0; } }
.result-block { text-align: center; padding: 26px 0 6px; }
.result-block h2 { font-family: var(--font-display); font-size: 19px; font-weight: 600; margin-top: 14px; }
.result-block p { margin-top: 8px; font-size: 13.5px; color: var(--text-sub); line-height: 1.7; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 58px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-pop); padding: 10px 16px; font-size: 13.5px; display: flex; align-items: center; gap: 8px; animation: toast-in .35s cubic-bezier(.2,.8,.2,1); }
.toast.out { animation: toast-out .3s ease-out forwards; }
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.warning { border-left: 3px solid var(--orange); }
.toast.info { border-left: 3px solid var(--accent); }
@keyframes toast-in { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toast-out { to { transform: translateX(120%); opacity: 0; } }

/* ---------- Spinner / 进度 ---------- */
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--track); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; vertical-align: -5px; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { width: 100%; height: 6px; background: var(--track); border-radius: 3px; overflow: hidden; }
.progress .bar { height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s ease-out; }

/* ---------- 模态框 ---------- */
.modal-mask { position: fixed; inset: 0; background: var(--mask); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--bg-surface); border-radius: var(--r-card); padding: 22px; width: 100%; max-width: 460px; animation: modal-in .3s cubic-bezier(.2,.8,.2,1); max-height: 86vh; overflow-y: auto; }
@keyframes modal-in { from { transform: scale(.96) translateY(10px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.modal h3 { font-size: 15.5px; font-weight: 600; margin-bottom: 14px; }
.modal .form-actions { margin-top: 18px; }

/* ---------- 空态 / 辅助 ---------- */
.empty { text-align: center; padding: 40px 0; color: var(--text-weak); font-size: 13.5px; }
.muted { color: var(--text-weak); font-size: 12px; }
.toolbar-actions { display: flex; gap: 6px; align-items: center; }
.inline-form { display: inline; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 20px; align-items: center; font-size: 13px; color: var(--text-sub); }

/* 页脚 */
.footer { max-width: 780px; margin: 0 auto; padding: 0 20px 36px; text-align: center; font-size: 12px; color: var(--text-weak); line-height: 1.8; }
.footer a { border-bottom: 1px dashed var(--line); }

/* 登录页 */
.login-wrap { min-height: calc(100vh - 48px); display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 360px; }
.login-tip { margin-top: 14px; font-size: 12px; color: var(--text-weak); line-height: 1.7; text-align: center; }

/* 移动端适配 */
@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--line-soft); display: flex; flex-wrap: wrap; gap: 2px; padding: 8px 10px; }
  .side-label { display: none; }
  .side-item { margin-bottom: 0; }
  .main { grid-column: 1; padding: 24px 16px 48px; }
  .page { padding: 28px 14px 56px; }
  .site-nav { margin-left: 8px; overflow-x: auto; }
  .hero h1 { font-size: 22px; }
  .search-box { flex-direction: column; }
  .tbl { display: block; overflow-x: auto; }
}
