/* ── 设计 token（沿用 tanta demo 视觉体系） ─────────────── */
:root {
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --hairline: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.08);
  --band: #2a78d6;
  --up: #d9402a;               /* 与静态页一致：红涨 */
  --down: #1a9c51;             /* 绿跌 */
  --wash: #f0efec;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 8px 24px rgba(11, 11, 11, 0.04);
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font); background: var(--page); color: var(--ink);
  font-size: 14px; line-height: 1.6; min-height: 100vh;
  display: flex; flex-direction: column; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; }
input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--band); outline-offset: 2px; border-radius: 4px; }
main { flex: 1; width: 100%; }
.wrap { width: min(1080px, calc(100% - 48px)); margin: 0 auto; }

/* ── 导航 ── */
.nav { border-bottom: 1px solid var(--hairline); background: rgba(252,252,251,.9);
  backdrop-filter: saturate(1.2) blur(8px); position: sticky; top: 0; z-index: 20; }
.nav-inner { display: flex; align-items: center; gap: 16px; height: 56px; }
.wordmark { font-size: 13px; font-weight: 650; letter-spacing: .22em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 8px; }
.wordmark::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--band); }
.nav-spacer { flex: 1; }
.nav-user { display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-size: 13px; }
.nav-user .account { color: var(--ink); font-weight: 550; }

/* ── 通用 ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 8px; font-size: 13px; font-weight: 550;
  transition: opacity .15s, background .15s; white-space: nowrap; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { opacity: .85; }
.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover { background: var(--wash); color: var(--ink); }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
  border-radius: 999px; font-size: 11px; font-weight: 550; letter-spacing: .02em;
  border: 1px solid var(--baseline); color: var(--muted); }
.chip-demo { border-style: dashed; }
.chip-up { color: #0a8a4a; border-color: rgba(10, 138, 74, 0.35); }
.chip-down { color: #d03b3b; border-color: rgba(208, 59, 59, 0.35); }
.chip-research { color: #8a5a00; border-color: #d9b36a; background: #fdf6e7; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); }

/* ── 登录 ── */
.login-main { display: flex; align-items: center; justify-content: center; padding: 10vh 24px; }
.login-card { width: 380px; padding: 36px 32px 28px; }
.login-card .wordmark { font-size: 14px; }
.login-title { font-size: 21px; font-weight: 650; margin: 22px 0 4px; letter-spacing: -0.01em; }
.login-sub { color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 550; color: var(--ink-2); margin-bottom: 6px; }
.field input { width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--baseline);
  border-radius: 8px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.field input:focus { outline: none; border-color: var(--band); box-shadow: 0 0 0 3px rgba(42,120,214,.15); }
.login-card .btn-primary { width: 100%; height: 44px; margin-top: 8px; font-size: 14px; }
.login-hint { margin-top: 16px; text-align: center; color: var(--up); font-size: 12px; min-height: 18px; }

/* ── 首页搜索（沿用 demo 交互） ── */
.hero { display: flex; flex-direction: column; align-items: center; padding: 13vh 24px 8vh; }
.hero-title { font-size: 34px; font-weight: 650; letter-spacing: -0.02em; text-align: center; }
.hero-sub { color: var(--muted); margin-top: 10px; font-size: 15px; }
.search { width: min(560px, 100%); margin-top: 44px; position: relative; }
.search-box { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 18px;
  background: var(--surface); border: 1px solid var(--baseline); border-radius: 999px;
  box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.search-box:focus-within { border-color: var(--band); box-shadow: 0 0 0 3px rgba(42,120,214,.15); }
.search-box svg { flex: none; color: var(--muted); }
.search-box input { flex: 1; border: 0; outline: none; background: none; font-size: 15px; min-width: 0; }
.search-box input::placeholder { color: var(--muted); }
.search-box .btn { height: 40px; padding: 0 22px; border-radius: 999px; }
.suggest { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  padding: 6px; display: none; z-index: 30; max-height: 320px; overflow: auto; }
.suggest.open { display: block; }
.suggest-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.suggest-item:hover, .suggest-item.active { background: var(--wash); }
.suggest-item .code { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 550; font-size: 13px; }
.suggest-item .name { color: var(--ink-2); font-size: 13px; flex: 1; }
.suggest-empty { padding: 14px 12px; color: var(--muted); text-align: center; font-size: 13px; }
.search.shake .search-box { animation: shake .3s; border-color: var(--up); }
@keyframes shake { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
.hero-tip { margin-top: 18px; color: var(--muted); font-size: 12.5px; }

/* ── Viewer ── */
.viewer-main { display: flex; flex-direction: column; gap: 16px; padding: 24px 0 48px; }
.viewer-head { padding: 18px 22px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.vh-left { display: flex; align-items: center; gap: 12px; }
.vh-left h1 { font-size: 21px; font-weight: 650; letter-spacing: -0.01em; }
.vh-right { margin-left: auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.vh-label { font-size: 12px; color: var(--muted); }
.vh-open { font-size: 13px; color: var(--muted); }
.vh-open b { color: var(--ink); font-variant-numeric: tabular-nums; font-size: 15px; }
.mini-select { appearance: none; -webkit-appearance: none; height: 32px; padding: 0 26px 0 12px;
  border: 1px solid var(--baseline); border-radius: 8px; background: var(--surface);
  color: var(--ink-2); font-size: 12.5px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23898781' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.mini-select:hover { border-color: var(--band); color: var(--ink); }
.chart-card { padding: 16px 18px 8px; }
.chart-head { display: flex; align-items: baseline; gap: 10px; padding: 2px 4px 6px; }
.chart-head h2 { font-size: 15px; font-weight: 650; }
.chart-head .sub { font-size: 12px; color: var(--muted); }
.chart { width: 100%; }
.chart-d { height: 460px; }
.chart-w { height: 420px; }
.chart-m { height: 380px; }

/* ── 页脚 ── */
.footer { border-top: 1px solid var(--hairline); padding: 18px 0 26px; }
.footer .wrap { display: flex; gap: 16px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }

/* ── 搜索页（只有搜索框） ── */
.search-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; min-height: calc(100vh - 160px); }
.search-tip { margin-top: 18px; color: var(--muted); font-size: 12.5px; }

/* ── viewer 顶部紧凑搜索（居中） ── */
.nav-search { position: relative; width: min(380px, 40vw); margin: 0 8px; }
.nav-search .search-box { height: 36px; gap: 8px; padding: 0 14px; box-shadow: none; }
.nav-search input { font-size: 13px; }
.nav-search .suggest { top: calc(100% + 6px); }
@media (max-width: 900px) { .nav-search { display: none; } }

/* ── 免责声明 ── */
.disclaimer { font-size: 12px; color: var(--muted); text-align: center; padding: 4px 12px 8px; }
.risk-note { color: #b05a00; font-weight: 600; display: block; width: 100%; text-align: center; }  /* 页脚风险提示：居中 */
.risk-strong { color: #b05a00; font-weight: 600; font-size: 12.5px; }

/* ── 403 友好提示卡 ── */
.notice-card { padding: 56px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.notice-card[hidden] { display: none !important; }   /* 防止 display:flex 覆盖 hidden 属性 */
.notice-icon { font-size: 30px; margin-bottom: 6px; }
.notice-title { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.notice-desc { font-size: 13.5px; color: var(--muted); }
.notice-card .btn { margin-top: 18px; }

/* ── 管理端（宽幅容器，覆盖 .wrap 的 1080px） ── */
.admin-main { width: min(1440px, calc(100% - 48px)); display: flex; flex-direction: column; gap: 14px; padding: 18px 0 48px; }
.admin-head { padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-head h1 { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.admin-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.admin-tools .a-q { width: 190px; height: 32px; padding: 0 12px; border: 1px solid var(--baseline);
  border-radius: 7px; background: var(--surface); font-size: 12.5px; color: var(--ink); }
.admin-tools .a-q:focus { outline: none; border-color: var(--band); }
.admin-tools .a-q::placeholder { color: var(--muted); font-size: 12.5px; }
.admin-status { width: 100%; font-size: 12px; color: var(--ink-2); min-height: 14px; margin: 0; }
.admin-table-card { padding: 4px 18px 10px; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.admin-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px;
  padding: 10px 14px 6px 0; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.admin-table td { padding: 8px 14px 8px 0; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table .mono { font-weight: 550; }
.admin-table .btn { height: 28px; padding: 0 12px; font-size: 12.5px; }
.admin-table .btn:disabled { opacity: .4; cursor: default; }
.admin-table td.ops .btn { margin-right: 6px; }
.admin-table td.ops .btn:last-child { margin-right: 0; }
.quota-cell { cursor: default; }
.quota-edit { margin-left: 6px; color: var(--muted); cursor: pointer; font-size: 12px; }
.quota-edit:hover { color: var(--band); }
.pager { display: flex; align-items: center; gap: 10px; padding: 10px 2px 4px; font-size: 12.5px; color: var(--muted); }
.pager .btn { height: 28px; padding: 0 12px; font-size: 12.5px; }
.pager .btn:disabled { opacity: .4; cursor: default; }

/* ── 登录/注册弹窗 ── */
.modal-mask { position: fixed; inset: 0; background: rgba(11, 11, 11, 0.35);
  backdrop-filter: blur(2px); display: none; align-items: center; justify-content: center; z-index: 100; }
.modal-mask.open { display: flex; }
.modal-card { position: relative; width: 380px; padding: 24px 28px 22px; }
.modal-close { position: absolute; top: 10px; right: 12px; font-size: 20px; line-height: 1;
  color: var(--muted); width: 28px; height: 28px; border-radius: 6px; }
.modal-close:hover { background: var(--wash); color: var(--ink); }
.modal-title { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.modal-sub { font-size: 12px; color: var(--muted); margin: 4px 0 14px; }
.modal-tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--hairline); }
.modal-tab { height: 34px; padding: 0 14px; font-size: 14px; font-weight: 550; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.modal-tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.modal-card .btn-primary { width: 100%; height: 42px; margin-top: 6px; font-size: 14px; }
.modal-msg { margin-top: 12px; text-align: center; color: var(--up); font-size: 12px; min-height: 16px; }
.suggest-info { padding: 8px 12px; font-size: 12px; color: var(--up);
  border-top: 1px solid var(--hairline); margin-top: 4px; }

@media (max-width: 640px) {
  .hero-title { font-size: 26px; }
  .chart-d { height: 360px; } .chart-w { height: 340px; } .chart-m { height: 300px; }
  .viewer-main { width: min(1080px, calc(100% - 24px)); }
}
