/* 资金流向 · 设计系统
 * 母题「明与暗」：主力合计 = 暗盘 + 明盘。深色实心表示暗盘，浅色描边表示明盘，
 * 红涨绿跌沿用行业语义；琥珀是唯一的界面强调色（当前态、焦点、未读）。
 * 约定：数字一律等宽对齐；动效只在「出现」时发生一次，且全部尊重 prefers-reduced-motion。 */

/* ================= 令牌 ================= */
:root {
  color-scheme: light;

  /* 温和配色系统：沐光配色 */
  --ink: #1e293b;
  --ink-2: #334155;
  --ink-3: #64748b;
  --muted: #94a3b8;
  --faint: #cbd5e1;
  --paper: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e2e8f0;
  --line: #94a3b8;
  --line-strong: #64748b;

  /* 品牌蓝 - 改为更柔和的天蓝 */
  --brand: #0891b2;
  --brand-strong: #0e7490;
  --brand-soft: #eff6ff;
  --brand-line: #bfd7e2;

  /* 涨（流入、G）与跌（流出、S）：使用行业语义红绿，但降低饱和度 */
  --rise: #dc2626;
  --rise-fill: #f87171;
  --rise-deep: #b91c1c;
  --rise-soft: #fee2e2;
  --rise-line: #fca5a5;
  --fall: #059669;
  --fall-fill: #10b981;
  --fall-deep: #055a59;
  --fall-soft: #d1fae5;
  --fall-line: #86efac;

  /* 星标与到期提醒使用温暖橙 */
  --star: #d97706;
  --star-fill: #f59e0b;
  --star-soft: #fff7ec;
  --star-line: #fbbf24;

  /* 成功/警告/错误状态 */
  --success: #059669;
  --warning: #d97706;
  --error: #dc2626;

  /* 兼容旧内联样式中的变量名 */
  --page: var(--paper);
  --action: var(--brand);
  --positive: var(--rise);
  --negative: var(--fall);
  --positive-soft: var(--rise-soft);
  --negative-soft: var(--fall-soft);
  --surface-subtle: var(--surface-2);
  --focus: #d97706;

  /* 字体 */
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", "Noto Serif SC", "STSong", "SimSun", serif;
  --font-num: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", "Roboto", "Segoe UI", system-ui, sans-serif;

  /* 间距（4px 栅格）与圆角、阴影 */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;
  --gutter: 16px;
  --r-sm: 8px; --r: 12px; --r-lg: 18px;
  --sh-1: 0 1px 2px rgba(0, 0, 0, .05);
  --sh-2: 0 4px 12px -6px rgba(0, 0, 0, .1), 0 2px 4px rgba(0, 0, 0, .04);
  --sh-3: 0 12px 30px -10px rgba(0, 0, 0, .15);

  /* 动效 */
  --ease: cubic-bezier(.25, .46, .45, .94);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
}

/* ================= 基础 ================= */
* { box-sizing: border-box; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-width: 320px;
  background: radial-gradient(1100px 380px at 50% -120px, #fff 0, rgba(255, 255, 255, 0) 70%), var(--paper);
  background-repeat: no-repeat;
  color: var(--ink); font-family: var(--font-ui); font-size: 15px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4 { line-height: 1.35; }
a { color: var(--brand); text-decoration-color: var(--line-strong); text-underline-offset: 3px; transition: text-decoration-color .15s, color .15s; }
a:hover { text-decoration-color: var(--brand); }
button, input, select, textarea { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px;
}
::selection { background: var(--brand-soft); }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92em; background: var(--surface-3); padding: 1px 6px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: var(--s3); top: -80px; z-index: 100; padding: 10px 16px; border-radius: var(--r); background: var(--ink); color: #fff; font-size: 14px; text-decoration: none; transition: top .15s; }
.skip:focus { top: var(--s3); }
.ico { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.22em; }
.ico.fill { fill: currentColor; stroke: none; }
.num, .metric-value, .quota strong, td, th { font-family: var(--font-num); font-variant-numeric: tabular-nums lining-nums; }
.positive { color: var(--rise); }
.negative { color: var(--fall); }
.neutral { color: var(--muted); }

/* ================= 页头与导航 ================= */
.app-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: var(--s3);
  min-height: 60px; padding: 0 var(--gutter);
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; text-decoration: none; }
.brand-mark { width: 26px; height: 26px; flex: none; color: var(--brand); }
.brand strong { font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: .1em; white-space: nowrap; }
.brand-sub { color: var(--muted); font-size: 12px; white-space: nowrap; padding-left: 10px; border-left: 1px solid var(--line-strong); line-height: 1.1; }
.nav-desktop { display: none; align-items: stretch; gap: var(--s1); margin-left: var(--s5); font-size: 14px; white-space: nowrap; align-self: stretch; }
.nav-desktop a { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; color: var(--ink-3); text-decoration: none; transition: color .15s; }
.nav-desktop a:hover { color: var(--brand); }
.nav-desktop a.active { color: var(--brand); font-weight: 650; }
.nav-desktop a.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand); }
.nav-right { display: flex; align-items: center; gap: var(--s2); margin-left: auto; }
.who { min-width: 0; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.bell {
  position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink); text-decoration: none;
  transition: background .15s, transform .15s var(--ease);
}
.bell:hover { background: var(--surface-3); }
.bell:active { transform: scale(.94); }
.bell .ico { width: 22px; height: 22px; }
.badge {
  position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--rise); color: #fff; font-family: var(--font-num); font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}
.app-header .link-button { min-height: 44px; display: inline-flex; align-items: center; padding: 0 8px; color: var(--ink-3); font-size: 13px; text-decoration: none; border-radius: var(--r-sm); }
.app-header .link-button:hover { color: var(--ink); background: var(--surface-3); }
.nav-toggle { width: 44px; height: 44px; padding: 0; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--ink); display: inline-grid; place-items: center; cursor: pointer; }
.mobile-nav { display: none; padding: 6px 0; border-bottom: 1px solid var(--line); background: var(--surface); }
.mobile-nav.open { display: block; animation: drop .22s var(--ease); }
.mobile-nav a, .mobile-nav .link-button { display: block; padding: 13px var(--gutter); color: var(--ink); text-decoration: none; font-size: 15px; width: 100%; text-align: left; }
.mobile-nav a:active { background: var(--surface-2); }
.mobile-nav .nav-user { padding: 8px var(--gutter) 10px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); margin: 6px 0 0; }

/* 底部 Tab（手机，用户端） */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .92); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar a { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 58px; color: var(--muted); font-size: 11px; text-decoration: none; letter-spacing: .04em; transition: color .15s; }
.tabbar a .ico { width: 23px; height: 23px; transition: transform .25s var(--ease); }
.tabbar a:active .ico { transform: scale(.9); }
.tabbar a.active { color: var(--brand); font-weight: 650; }
.tabbar a.active::before { content: ""; position: absolute; top: 0; width: 24px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }

/* ================= 版面 ================= */
main { max-width: 1160px; margin: 0 auto; padding: var(--s4) var(--gutter) calc(58px + env(safe-area-inset-bottom) + var(--s5)); }
.section-block, .card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: var(--s5) var(--s4); margin-bottom: var(--s4); box-shadow: var(--sh-1);
}
.card h2, .section-block h2 { font-size: 17px; }
.block-title { font-size: 18px; font-weight: 700; margin: 0 0 var(--s2); letter-spacing: .02em; }
.hint { font-weight: 400; color: var(--muted); font-size: 12px; }

/* ================= 表单与按钮 ================= */
label { display: block; font-weight: 600; font-size: 13px; letter-spacing: .02em; color: var(--ink-2); margin: var(--s4) 0 6px; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local], select {
  width: 100%; max-width: 30rem; min-height: 48px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--ink); font-size: 16px;
  transition: border-color .15s, box-shadow .2s;
}
input:hover { border-color: var(--faint); }
input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(23, 92, 211, .18); }
input::placeholder { color: var(--muted); opacity: .85; }
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border: 1px solid var(--brand); border-radius: var(--r);
  background: var(--brand); color: #fff; font-size: 15px; font-weight: 650; letter-spacing: .04em; line-height: 1.2;
  cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, transform .12s var(--ease), box-shadow .2s, opacity .15s;
}
button:hover:not(:disabled), .btn:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
button:active:not(:disabled), .btn:active { transform: translateY(1px) scale(.985); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.secondary, .btn.secondary, .btn-secondary { background: var(--surface); color: var(--brand); border-color: var(--brand); }
button.secondary:hover:not(:disabled), .btn.secondary:hover, .btn-secondary:hover:not(:disabled) { background: var(--brand-soft); border-color: var(--brand-strong); }
.btn-danger { background: var(--surface); color: var(--rise); border-color: var(--rise-line); }
.btn-danger:hover:not(:disabled) { background: var(--rise-soft); border-color: var(--rise); }
.link-button { display: inline; min-height: 0; padding: 0; border: 0; background: none; color: var(--brand); font: inherit; font-weight: 500; letter-spacing: 0; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.link-button:hover:not(:disabled) { background: none; text-decoration-color: var(--brand); }
.link-button:active:not(:disabled) { transform: none; }
.inline-form { display: inline; margin: 0; }

/* ================= 状态提示 ================= */
.alert-error, .alert-info {
  padding: 12px 14px; border-radius: var(--r); margin-bottom: var(--s4); font-size: 14px; line-height: 1.55;
  border: 1px solid; border-left-width: 4px;
}
.alert-error { background: var(--rise-soft); border-color: var(--rise-line); color: var(--rise); }
.alert-info { background: var(--brand-soft); border-color: var(--brand-line); border-left-color: var(--brand); color: var(--brand-strong); }
.alert-action { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.alert-action[hidden] { display: none; }
.alert-link {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  min-height: 44px; padding: 0 14px; border-radius: var(--r);
  background: var(--rise); color: #fff; font-size: 13.5px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.alert-link:hover { background: var(--rise-deep); color: #fff; }
.refresh-banner .alert-link { margin-top: var(--s2); }
.status-box:empty { display: none; }
.status-done { display: flex; align-items: center; gap: 8px; margin: 0 0 var(--s3); color: var(--muted); font-size: 12.5px; }
.status-done::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--fall-fill); }

/* ================= 首页：搜索舱 ================= */
.home { display: block; }
.home-rail { min-width: 0; }
.home-stage { min-width: 0; }
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s2); }
.title-row h1 { margin: 0; font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: .08em; }
.quota {
  display: inline-flex; align-items: baseline; gap: 4px; padding: 5px 12px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-size: 12.5px; line-height: 1.4;
}
.quota strong { color: var(--ink); font-size: 15px; font-weight: 700; }
.quota-expired { background: var(--rise-soft); border-color: var(--rise-line); color: var(--rise); }
.quota-expired strong { color: var(--rise); }
.search-label { margin: var(--s4) 0 var(--s2); color: var(--ink-2); }
.search-row { display: flex; gap: var(--s2); }
.search-row input {
  flex: 1; min-width: 0; max-width: none; min-height: 56px; padding-left: 48px; border-radius: var(--r-lg); font-size: 17px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6779' stroke-width='1.9' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m16 16 4 4'/%3E%3C/svg%3E") no-repeat 16px center / 22px;
  box-shadow: inset 0 1px 2px rgba(16, 24, 40, .06);
}
#search-btn { flex: 0 0 auto; min-height: 56px; border-radius: var(--r-lg); padding: 0 22px; }
.search-results {
  list-style: none; margin: var(--s2) 0 0; padding: 4px; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--sh-2); max-height: 360px; overflow: auto;
  animation: pop .18s var(--ease);
}
.search-results:empty { display: none; }
.search-results li { position: relative; border-radius: var(--r); }
.search-results li + li { margin-top: 2px; }
.search-results li button.sel {
  width: 100%; min-height: 52px; justify-content: flex-start; text-align: left; border: 0; border-radius: var(--r);
  background: transparent; color: var(--ink); padding: 0 56px 0 14px; font-size: 15px; font-weight: 500; letter-spacing: .01em;
}
.search-results li button.sel:hover:not(:disabled) { background: var(--surface-2); }
.search-results li[aria-selected=true] { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.search-results li[aria-selected=true] button.sel { background: transparent; }
.search-results .search-error, .search-results .search-loading { padding: 14px; color: var(--muted); font-size: 14px; }
.search-results .search-error { color: var(--rise); }
.search-add-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); min-width: 44px; min-height: 44px; width: 44px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink-3); font-size: 18px;
}
.search-add-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }
.search-add-btn:active:not(:disabled) { transform: translateY(-50%) scale(.92); }
.search-add-btn.added { color: var(--brand); }
.search-add-btn:disabled { opacity: 1; }

.confirmed-stock {
  display: flex; align-items: center; gap: var(--s3); margin-top: var(--s3); padding: 12px 14px;
  border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--r); background: var(--brand-soft);
  animation: pop .22s var(--ease);
}
.confirmed-stock[hidden] { display: none; }
.market-mark {
  flex: 0 0 34px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px;
  background: var(--brand); color: #fff; font-family: var(--font-display); font-size: 14px; font-weight: 700;
}
.confirmed-copy { min-width: 0; flex: 1; }
.confirmed-copy strong, .confirmed-copy span { display: block; }
.confirmed-copy strong { font-size: 16px; line-height: 1.3; }
.confirmed-copy span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.confirmed-check { color: var(--brand); font-size: 18px; font-weight: 700; }
.btn-primary { position: relative; overflow: hidden; width: 100%; min-height: 56px; margin-top: var(--s3); border-radius: var(--r-lg); font-size: 16px; letter-spacing: .1em; box-shadow: 0 6px 16px -6px rgba(16, 24, 40, .45); }
.btn-primary:disabled { box-shadow: none; }
.btn-primary[aria-busy=true]::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 40%; background: #fff; border-radius: 3px;
  animation: scan 1.1s var(--ease) infinite;
}

/* 空态指南：把行业术语讲清楚，同时让首屏不空 */
.guide { padding: var(--s6) var(--s5); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); background: rgba(255, 255, 255, .6); }
.guide[hidden] { display: none; }
.guide h2 { margin: 0 0 4px; font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: .06em; }
.guide > p { margin: 0 0 var(--s3); color: var(--muted); font-size: 13px; }
.guide dl { margin: var(--s5) 0 0; display: grid; gap: var(--s4); }
.guide dt { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 14px; }
.guide dd { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.tag-sample { display: inline-block; margin-right: 4px; }
.guide-tag { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 700; color: var(--brand-strong); background: var(--brand-soft); border-radius: 999px; padding: 0 8px; letter-spacing: .08em; vertical-align: 1px; }

/* ================= 结果 ================= */
#result-section { padding-top: var(--s5); }
.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.result-name { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin: 0; font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: .04em; line-height: 1.25; }
.result-code { font-family: var(--font-num); font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.result-meta { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.result-head-actions { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; justify-content: flex-end; }
.version-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 650; white-space: nowrap; letter-spacing: .06em;
}
.version-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.charge-note { margin: var(--s3) 0 0; padding: 10px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-3); font-size: 13px; }
.flow-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: var(--s3) 0 0; font-size: 12px; color: var(--muted); }
.flow-legend .in { color: var(--rise); }
.flow-legend .out { color: var(--fall); }
.data-block { margin-top: var(--s5); }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); }
.block-head h4 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: .03em; }
.block-head h4 .gs-tag { vertical-align: 2px; }
.unit { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.chart-summary { margin: var(--s3) 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.empty-note { color: var(--muted); }

/* ---- 核心指标：三格并排的纯数字（主力合计、暗盘、明盘；特大/大/中/小单四格） ---- */
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: var(--s3); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2); overflow: hidden; }
.metrics-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric { min-width: 0; padding: 16px 10px; text-align: center; }
.metric + .metric { border-left: 1px solid var(--line); }
.metric-label, .metric-value { display: block; }
.metric-label { margin-bottom: 3px; color: var(--muted); font-size: 12px; letter-spacing: .03em; }
.metric-value { font-size: 18px; font-weight: 700; line-height: 1.25; white-space: nowrap; }
.metrics-4 .metric { padding: 14px 6px; }
.metrics-4 .metric-value { font-size: 15px; }

/* ---- 四档累计 ---- */
.trend-legend { display: flex; justify-content: space-between; margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.tier-row { display: grid; grid-template-columns: 3.6em minmax(60px, 1fr) 5.4em; align-items: center; gap: var(--s2); min-height: 38px; font-variant-numeric: tabular-nums; }
.tier-label { color: var(--ink-3); font-size: 12.5px; }
.tier-track { position: relative; height: 12px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.tier-track::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: var(--line-strong); }
.tier-bar { position: absolute; top: 2px; width: var(--w); height: 8px; border-radius: 4px; animation: grow-x .7s var(--ease) both; }
.tier-bar.positive { left: 50%; background: var(--rise-fill); transform-origin: left; }
.tier-bar.negative { right: 50%; background: var(--fall-fill); transform-origin: right; }
.tier-value { font-size: 12.5px; font-weight: 650; text-align: right; white-space: nowrap; font-family: var(--font-num); }

/* ---- 30 日趋势 + GS 信号色带 ---- */
.gs-chart { margin-top: 2px; }
.gs-readout { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-height: 28px; margin: 0 0 var(--s2); font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.gs-readout strong { font-family: var(--font-num); font-size: 17px; font-weight: 600; }
.gs-frame { position: relative; }
.gs-more { display: none; }
.gs-scroll { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; padding-bottom: 2px; }
.gs-inner { min-width: 0; }
.gs-cols { display: grid; grid-template-columns: repeat(var(--n, 30), minmax(0, 1fr)); gap: 2px; }
.gs-col { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 4px; min-width: 0; min-height: 0; padding: 3px 0 4px; border: 0; border-radius: 8px; background: transparent; color: inherit; letter-spacing: 0; transition: background .12s; }
.gs-col:hover:not(:disabled), .gs-col[aria-pressed="true"] { background: var(--surface-3); border-color: transparent; }
.gs-col:active:not(:disabled) { transform: none; }
.gs-col:focus-visible { outline-offset: 0; }
.gs-plot { position: relative; display: block; height: 124px; }
.gs-plot::after { content: ""; position: absolute; left: -1px; right: -1px; top: 50%; height: 1px; background: var(--line-strong); }
.gs-bar { position: absolute; left: 14%; right: 14%; height: calc(var(--h) / 2); min-height: 1px; animation: grow-y .6s var(--ease) both; animation-delay: var(--d, 0ms); }
.gs-bar.positive { bottom: 50%; border-radius: 3px 3px 0 0; background: var(--rise-fill); transform-origin: bottom; }
.gs-bar.negative { top: 50%; border-radius: 0 0 3px 3px; background: var(--fall-fill); transform-origin: top; }
.gs-col:hover .gs-bar.positive, .gs-col[aria-pressed="true"] .gs-bar.positive { background: var(--rise); }
.gs-col:hover .gs-bar.negative, .gs-col[aria-pressed="true"] .gs-bar.negative { background: var(--fall); }
.gs-sig { display: block; height: 18px; margin: 0 1px; border-radius: 4px; background: var(--surface-3); color: #fff; font-family: var(--font-num); font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; }
.gs-sig.g { background: var(--rise-fill); }
.gs-sig.s { background: var(--fall-fill); }
.gs-sig.g.zone { background: var(--rise-soft); color: var(--rise); box-shadow: inset 0 0 0 1px var(--rise-line); }
.gs-sig.s.zone { background: var(--fall-soft); color: var(--fall); box-shadow: inset 0 0 0 1px var(--fall-line); }
.gs-sig.intraday { outline: 2px dashed #bd563d; outline-offset: 2px; }
.gs-intraday { display: inline-block; margin-left: 4px; padding: 0 7px; border: 1px dashed #bd563d; border-radius: 99px; color: #9b3f2c; background: #fff8f5; font-size: 11px; font-weight: 700; line-height: 19px; white-space: nowrap; }
.gs-comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.gs-comparison > div { min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; }
.gs-comparison > div.intraday { border: 1px dashed #bd563d; background: #fff8f5; }
.gs-comparison small { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.gs-comparison .gs-tag { margin-left: 0; }
.gs-intraday-note { color: var(--ink-3); font-size: 12px; margin: 8px 0 0; }
.gs-axis { display: flex; justify-content: space-between; margin-top: 4px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.gs-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin: var(--s3) 0 0; color: var(--muted); font-size: 11.5px; }
.gs-legend .item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.gs-legend .lg { display: inline-block; width: 18px; height: 16px; font-style: normal; border-radius: 4px; background: var(--surface-3); color: #fff; font-family: var(--font-num); font-size: 10px; font-weight: 800; line-height: 16px; text-align: center; }
.gs-legend .lg.g { background: var(--rise-fill); }
.gs-legend .lg.s { background: var(--fall-fill); }
.gs-legend .lg.g.zone { background: var(--rise-soft); color: var(--rise); box-shadow: inset 0 0 0 1px var(--rise-line); }
.gs-legend .lg.s.zone { background: var(--fall-soft); color: var(--fall); box-shadow: inset 0 0 0 1px var(--fall-line); }
.gs-legend .lg.intraday { outline: 2px dashed #bd563d; outline-offset: 1px; }
.gs-tag { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 19px; letter-spacing: .04em; white-space: nowrap; vertical-align: 1px; }
.gs-tag.g { background: var(--rise-soft); color: var(--rise); box-shadow: inset 0 0 0 1px var(--rise-line); }
.gs-tag.s { background: var(--fall-soft); color: var(--fall); box-shadow: inset 0 0 0 1px var(--fall-line); }
.gs-tag.trig { box-shadow: inset 0 0 0 2px currentColor; }
.charts-grid { display: block; }

/* ---- 每日明细 ---- */
.segmented { width: 100%; margin-bottom: var(--s3); padding: 4px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-3); display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.segment { min-height: 44px; padding: 0 8px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 650; letter-spacing: .04em; }
.segment:hover:not(:disabled) { background: rgba(255, 255, 255, .5); border-color: transparent; }
.segment.active, .segment.active:hover:not(:disabled) { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
.table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); scrollbar-color: var(--line-strong) transparent; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--surface-3); text-align: right; white-space: nowrap; }
th { background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: .06em; }
th:first-child, td:first-child { text-align: left; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
.table-wrap th:first-child, .table-wrap td:first-child { position: sticky; left: 0; z-index: 1; }
.table-wrap th:first-child { background: var(--surface-3); }
.table-wrap td:first-child { background: var(--surface); }
.detail-table td:first-child { white-space: nowrap; }
.day-link { display: inline; min-height: 0; padding: 0; border: 0; background: none; color: var(--brand); font: inherit; font-weight: 600; letter-spacing: 0; font-variant-numeric: tabular-nums; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.day-link:hover:not(:disabled) { background: none; text-decoration-color: var(--brand); }
.day-link:active:not(:disabled) { transform: none; }
.ledger-table td:nth-child(1) { white-space: nowrap; }

/* ---- 额度明细（折叠） ---- */
.ledger-details summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; cursor: pointer; list-style: none; font-size: 15px; font-weight: 650; letter-spacing: .02em; }
.ledger-details summary::-webkit-details-marker { display: none; }
.ledger-details summary::after { content: ""; width: 9px; height: 9px; margin-right: 4px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .2s var(--ease); }
.ledger-details[open] summary::after { transform: rotate(45deg); }
.ledger-details .table-wrap { margin-top: var(--s2); }

/* ================= 弹层、轻提示 ================= */
.sheet-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(16, 24, 40, .45); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); animation: fade .2s ease both; }
.sheet-backdrop[hidden], .sheet[hidden] { display: none; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 91; max-height: 86vh; overflow: auto;
  padding: var(--s5) var(--s4) calc(var(--s5) + env(safe-area-inset-bottom)); background: var(--surface);
  border-radius: 22px 22px 0 0; box-shadow: var(--sh-3); animation: sheet-up .32s var(--ease) both;
}
.sheet::before { content: ""; display: block; width: 40px; height: 4px; margin: -12px auto 14px; border-radius: 2px; background: var(--line-strong); }
.sheet h3 { margin: 0 0 4px; font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: .04em; }
.sheet .sub { margin: 0 0 var(--s3); color: var(--muted); font-size: 12.5px; }
.sheet label { margin-top: var(--s3); }
.sheet input { max-width: none; }
.sheet .row { display: flex; gap: var(--s2); align-items: center; margin-top: var(--s3); }
.sheet .row .grow { flex: 1; }
.sheet .actions { display: flex; gap: var(--s2); margin-top: var(--s5); }
.sheet .actions button { flex: 1; min-height: 48px; padding: 0 8px; }
.day-sheet .metrics { margin-top: var(--s3); }
.day-sheet .flow-legend { margin-top: var(--s2); }
.day-sheet .actions button:disabled { opacity: .4; }
.day-sheet .gs-tag { font-family: var(--font-ui); }
.toast {
  position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 95; max-width: 90vw; padding: 11px 18px;
  transform: translate(-50%, 8px); border-radius: 999px; background: var(--ink); color: #fff; font-size: 13.5px; letter-spacing: .02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: var(--sh-2);
  opacity: 0; pointer-events: none; transition: opacity .22s ease, transform .3s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ================= 自选 ================= */
.wl-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s2); }
.wl-head .block-title { margin: 0; font-family: var(--font-display); font-size: 24px; letter-spacing: .08em; }
.wl-count { color: var(--muted); font-family: var(--font-ui); font-size: 13px; font-weight: 400; letter-spacing: 0; }
.wl-count strong { color: var(--ink); }
#refresh-btn { min-height: 44px; padding: 0 18px; width: auto; }
.group-tabs { display: flex; gap: var(--s2); overflow-x: auto; padding: 4px 0 var(--s3); scrollbar-width: none; }
.group-tabs::-webkit-scrollbar { display: none; }
.group-tabs button { flex: 0 0 auto; min-height: 40px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink-3); font-size: 13px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.group-tabs button:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); }
.group-tabs button.active, .group-tabs button.active:hover:not(:disabled) { border-color: var(--brand); background: var(--brand); color: #fff; }
.group-tabs button.manage { margin-left: auto; color: var(--muted); }
.wl-group { display: flex; align-items: center; gap: var(--s2); margin: var(--s5) 0 var(--s2); color: var(--ink-3); font-size: 13px; font-weight: 700; letter-spacing: .06em; }
.wl-group .cnt { font-weight: 400; color: var(--muted); font-size: 12px; letter-spacing: 0; }
.wl-group::after { content: ""; order: 1; flex: 1; height: 1px; background: var(--line); }
.wl-group .fold { order: 2; min-height: 36px; min-width: 36px; padding: 0; border: 0; background: none; color: var(--muted); }
.wl-group .fold:hover:not(:disabled) { background: var(--surface-3); border-color: transparent; }
.wl-item {
  display: flex; align-items: stretch; justify-content: space-between; gap: var(--s2);
  margin-bottom: var(--s2); padding: 14px 8px 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface);
  box-shadow: var(--sh-1); transition: border-color .15s, box-shadow .2s, transform .2s var(--ease);
}
.wl-item.enter { animation: rise-in .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
.wl-item:hover { border-color: var(--line-strong); box-shadow: var(--sh-2); transform: translateY(-1px); }
.wl-item.folded { display: none; }
.wl-link { align-items: stretch; flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 3px; color: inherit; text-decoration: none; border-radius: var(--r); }
.wl-link:hover .wl-name { text-decoration: underline; text-decoration-color: var(--brand); text-underline-offset: 4px; }
.wl-name { font-size: 16px; font-weight: 650; line-height: 1.35; letter-spacing: .02em; }
.wl-name .note { margin-left: 8px; color: var(--muted); font-size: 12px; font-weight: 400; }
.wl-code { display: flex; align-items: center; gap: 2px; color: var(--muted); font-family: var(--font-num); font-size: 12px; }
.wl-flow { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; margin-top: 6px; font-family: var(--font-num); font-size: 12px; font-variant-numeric: tabular-nums; }
.wl-flow .f { white-space: nowrap; font-weight: 600; }
.wl-flow .wl-signal { display: inline-flex; flex-wrap: wrap; align-items: center; max-width: 100%; white-space: normal; row-gap: 3px; }
.wl-flow .f:first-child { flex-basis: 100%; font-size: 24px; font-weight: 300; line-height: 1.2; letter-spacing: -.01em; }
.wl-flow .f .k { margin-right: 4px; color: var(--muted); font-family: var(--font-ui); font-size: 11px; font-weight: 400; letter-spacing: .04em; }
.wl-flow .f:first-child .k { font-size: 12px; }
.wl-flow .f.in { color: var(--rise); }
.wl-flow .f.out { color: var(--fall); }
.wl-flow .no-result { color: var(--muted); font-family: var(--font-ui); font-weight: 400; font-size: 13px; }
.wl-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: var(--s2); }
.wl-meta { color: var(--muted); font-size: 11px; text-align: right; font-variant-numeric: tabular-nums; padding-right: 8px; }
.wl-query-status:empty { display: none; }
.wl-query-status { max-width: 132px; overflow-wrap: anywhere; }
.wl-query-status.refresh-failed { color: var(--rise); }
#retry-failed-btn { margin-top: var(--s2); }
#retry-failed-btn[hidden] { display: none; }
.wl-actions { display: flex; gap: 2px; align-items: center; justify-content: flex-end; margin: 0 !important; }
.wl-actions button { min-height: 44px; min-width: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink-3); }
.wl-actions button:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); border-color: transparent; }
.wl-actions button:disabled { opacity: .5; }
.wl-actions button[aria-busy=true] .ico { animation: spin .8s linear infinite; }
.wl-empty { padding: var(--s7) var(--s4); text-align: center; color: var(--muted); font-size: 14px; }
.wl-empty .how { margin-top: 6px; color: var(--muted); font-size: 12.5px; }
.refresh-banner { display: none; margin-top: var(--s3); padding: 10px 14px; border: 1px solid; border-left-width: 4px; border-radius: var(--r); font-size: 13px; }
.refresh-banner.show { display: block; animation: pop .22s var(--ease); }
.refresh-banner.ok { background: var(--fall-soft); border-color: var(--fall-line); color: var(--fall); }
.refresh-banner.warn { background: var(--rise-soft); border-color: var(--rise-line); color: var(--rise); }
.refresh-banner.info { background: var(--brand-soft); border-color: var(--brand-line); border-left-color: var(--brand); color: var(--brand-strong); }
.refresh-banner .line { display: block; margin: 2px 0; }
.wl-star {
  min-height: 44px; padding: 0 14px; gap: 6px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 650; letter-spacing: .02em;
}
.wl-star:hover:not(:disabled) { background: var(--brand-soft); border-color: var(--brand); }
.wl-star.added { color: var(--star); border-color: var(--star-fill); background: var(--star-soft); }
.wl-star.added .ico { fill: var(--star-fill); stroke: var(--star); animation: star-pop .5s var(--ease); }

/* ================= 通知、标签 ================= */
.notif-item { position: relative; padding: 14px 16px 14px 18px; margin-bottom: var(--s2); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.notif-item:hover { border-color: var(--line-strong); }
.notif-item.unread { background: var(--brand-soft); border-color: var(--brand-line); }
.notif-item .t { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 650; font-size: 14.5px; overflow-wrap: anywhere; }
.notif-item .t .dot { display: none; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; box-shadow: 0 0 0 3px rgba(23, 92, 211, .2); }
.notif-item.unread .t .dot { display: inline-block; }
.notif-item .b { margin-top: 4px; color: var(--ink-3); font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.notif-item .tm { margin-top: 6px; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
#ann-list .notif-item { cursor: default; }
.tag { padding: 1px 9px; border-radius: 999px; font-size: 11px; font-weight: 650; letter-spacing: .04em; white-space: nowrap; border: 1px solid transparent; }
.tag.expiry { background: var(--star-soft); color: #8a4b08; border-color: var(--star-line); }
.tag.credit { background: var(--rise-soft); color: var(--rise); border-color: var(--rise-line); }
.tag.announce { background: var(--brand-soft); color: var(--brand-strong); border-color: var(--brand-line); }
.tag.admin { background: #efeafd; color: #4c2aa0; border-color: #d7cbf6; }

/* ================= 用户中心 ================= */
.uc-user { display: flex; align-items: center; gap: var(--s4); margin-bottom: var(--s2); }
.uc-avatar { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; background: var(--brand); color: #fff; font-family: var(--font-display); font-size: 22px; font-weight: 700; text-transform: uppercase; }
.uc-user .name { font-size: 17px; font-weight: 700; letter-spacing: .02em; overflow-wrap: anywhere; }
.uc-user .pkg { margin-top: 2px; color: var(--muted); font-size: 13px; }
.uc-user .pkg strong { color: var(--ink); }
.uc-menu { margin-top: var(--s4); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.uc-menu a, .uc-menu button {
  width: 100%; min-height: 54px; display: flex; align-items: center; justify-content: flex-start; gap: var(--s3); padding: 0 var(--s4);
  border: 0; border-bottom: 1px solid var(--surface-3); border-radius: 0; background: transparent; color: var(--ink); font-size: 15px; font-weight: 500; letter-spacing: .02em; text-align: left; text-decoration: none;
}
.uc-menu a:hover, .uc-menu button:hover:not(:disabled) { background: var(--surface-2); border-color: var(--surface-3); }
.uc-menu > :last-child, .uc-menu > form:last-child button { border-bottom: 0; }
.uc-menu .ico { color: var(--ink-3); }
.uc-menu .arrow { margin-left: auto; color: var(--muted); display: inline-flex; }
.uc-menu .ub { margin-left: 4px; }
.uc-menu .ub .badge { position: static; display: inline-block; box-shadow: none; }
.uc-menu form { margin: 0; display: block; }

/* ================= 登录与验证页 ================= */
.auth { max-width: 420px; margin: 0 auto; padding-top: var(--s6); }
.auth h1 { margin: 0 0 var(--s4); font-family: var(--font-display); font-size: 32px; font-weight: 700; letter-spacing: .12em; }
.auth input { max-width: none; }
.auth .auth-submit, .plain-page .auth-submit { width: 100%; margin-top: var(--s5); min-height: 54px; border-radius: var(--r-lg); font-size: 16px; letter-spacing: .2em; }
#login-countdown { min-height: 1.5em; margin: var(--s3) 0 0; color: var(--rise); font-size: 13px; }
#login-countdown:empty { display: none; }
.plain-page { max-width: 560px; margin: 0 auto; padding-top: var(--s4); }
.plain-page h1 { font-family: var(--font-display); font-size: 26px; letter-spacing: .08em; margin-bottom: var(--s4); }
.plain-page form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s2) var(--s5) var(--s5); box-shadow: var(--sh-1); }
.plain-page input { max-width: none; }

/* ================= 管理端、文档页 ================= */
h1:not([class]) { font-family: var(--font-display); font-size: 26px; letter-spacing: .06em; margin: var(--s2) 0 var(--s4); }
main > h2 { margin: var(--s6) 0 var(--s3); font-size: 18px; }
.users-table td:last-child { white-space: normal; min-width: 280px; }
.user-actions { text-align: left; }
.user-actions summary { min-height: 44px; padding: 10px 0; cursor: pointer; font-weight: 650; overflow-wrap: anywhere; }
.user-op { min-width: 0; }
.user-op fieldset { min-width: 0; margin: var(--s3) 0; padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: var(--r); }
.user-op legend { padding: 0 6px; font-weight: 650; }
.user-op label { margin-top: 0; }
.user-op button { display: flex; width: 100%; margin-top: 10px; white-space: normal; overflow-wrap: anywhere; }
.user-op p { margin: var(--s2) 0; overflow-wrap: anywhere; }
.user-op .op-hint { font-size: 13px; color: var(--muted); }
.user-op pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.api-code { margin: var(--s3) 0; padding: var(--s4); overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; border-radius: var(--r); background: var(--ink); color: #e6edf7; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; line-height: 1.7; }
section code { overflow-wrap: anywhere; }
.section-block > h3 { margin: var(--s4) 0 var(--s2); font-size: 15px; }

.stack { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s2); }
.stack label { margin-top: var(--s2); }
.stack .end { align-self: flex-end; margin-top: var(--s3); }
textarea { width: 100%; min-height: 110px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--ink); font-size: 16px; line-height: 1.6; resize: vertical; transition: border-color .15s, box-shadow .2s; }
textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(23, 92, 211, .18); outline: none; }
.status-line { margin-top: var(--s3); font-size: 13px; }
.link-button.danger { color: var(--rise); min-height: 44px; display: inline-flex; align-items: center; padding: 0 8px; text-decoration-color: var(--rise-line); }
.wrap-cell { max-width: 24rem; word-break: break-all; white-space: normal; }
.wl-head .back { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; margin-left: -10px; border-radius: 50%; color: var(--ink-3); text-decoration: none; }
.wl-head .back:hover { background: var(--surface-3); color: var(--brand); }
.wl-head .grow { flex: 1; margin: 0; font-size: 20px; }

.users-table th, .users-table td { text-align: left; }
.stack input { max-width: 30rem; }
@media (min-width: 900px) {
  #wl-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--s4); align-items: start; }
  #wl-list > .wl-group, #wl-list > .wl-empty { grid-column: 1 / -1; }
  .wl-item { margin-bottom: var(--s3); }
}

/* ================= 动效 ================= */
@keyframes grow-x { from { transform: scaleX(0); } }
@keyframes grow-y { from { transform: scaleY(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-in { from { opacity: 0; transform: translate(-50%, -46%) scale(.97); } }
@keyframes scan { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@keyframes nudge-x { 0%, 100% { transform: translateX(0); } 40% { transform: translateX(-4px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes star-pop { 0% { transform: scale(.6) rotate(-20deg); } 55% { transform: scale(1.25) rotate(8deg); } 100% { transform: scale(1) rotate(0); } }
.reveal { animation: rise-in .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }

/* ================= 响应式 ================= */
/* 手机：明细分段 */
@media (max-width: 767px) {
  /* 30 日图在手机上默认停在最新一天：左侧还有内容时，左上角给一个「‹ 更早」提示和一道渐隐边 */
  .gs-more { position: absolute; left: 0; top: 4px; z-index: 3; display: inline-flex; align-items: center; gap: 2px; min-height: 34px; height: 34px; padding: 0 12px 0 6px; border: 1px solid var(--line-strong); border-radius: 999px; background: rgba(255, 255, 255, .94); color: var(--ink-2); font-size: 12px; font-weight: 650; letter-spacing: .04em; box-shadow: var(--sh-1); animation: nudge-x 1.6s var(--ease) 2; }
  .gs-more[hidden] { display: none; }
  .gs-more .ico { width: 16px; height: 16px; }
  .gs-more:hover:not(:disabled) { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-strong); }
  .gs-frame.has-more::before { content: ""; position: absolute; left: 0; top: 0; bottom: 22px; width: 36px; z-index: 2; pointer-events: none; background: linear-gradient(90deg, #fff 0, rgba(255, 255, 255, 0) 100%); }
  .detail-table.view-core th:nth-child(n+5), .detail-table.view-core td:nth-child(n+5) { display: none; }
  .detail-table.view-structure th:nth-child(2), .detail-table.view-structure td:nth-child(2),
  .detail-table.view-structure th:nth-child(3), .detail-table.view-structure td:nth-child(3),
  .detail-table.view-structure th:nth-child(4), .detail-table.view-structure td:nth-child(4) { display: none; }
  .detail-table { min-width: 340px; }
  .gs-inner { min-width: calc(var(--n, 30) * 24px); } /* 每列按钮 22px + 2px 间隙 */
  .ledger-table { min-width: 0; }
  .ledger-table thead { display: none; }
  .ledger-table tbody tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 8px 0; }
  .ledger-table td { border-bottom: 1px solid var(--surface-3); }
  .ledger-table td:nth-child(1) { grid-column: 1; grid-row: 1; font-weight: 600; }
  .ledger-table td:nth-child(2) { grid-column: 2; grid-row: 1; color: var(--muted); }
  .ledger-table td:nth-child(3) { grid-column: 1; grid-row: 2; }
  .ledger-table td:nth-child(4) { grid-column: 2; grid-row: 2; text-align: right; font-weight: 600; }
  .ledger-table td:nth-child(5) { display: none; }
  .users-wrap { border: 0; overflow: visible; background: transparent; }
  .users-table, .users-table tbody { display: block; width: 100%; }
  .users-table thead { display: none; }
  .users-table tr { display: block; margin-bottom: var(--s3); padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
  .users-table td { display: block; padding: 6px 0; border: 0; text-align: left; white-space: normal; overflow-wrap: anywhere; }
  .users-table td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
  .users-table td:first-child { position: static; font-size: 17px; }
  .users-table td:last-child { min-width: 0; margin-top: 6px; border-top: 1px solid var(--line); }
  .users-table tbody tr:hover td { background: transparent; }
  .user-op input { max-width: 100%; }
}
@media (max-width: 559px) {
  .who { display: none; }
}
@media (max-width: 479px) {
  :root { --gutter: 12px; }
  .brand-sub { display: none; }
  .section-block, .card { padding: var(--s5) var(--s4); border-radius: var(--r-lg); }
  .search-row input { font-size: 16px; }
  .result-name { font-size: 26px; }
  .metrics-4 .metric { padding: 12px 2px 14px; }
  .metrics-4 .metric-value { font-size: 13.5px; }
  .metrics-4 .metric-label { font-size: 11.5px; }
  .tier-row { grid-template-columns: 3.4em minmax(52px, 1fr) 5em; }
}

/* 平板与桌面 */
@media (min-width: 768px) {
  :root { --gutter: 24px; }
  main { padding-top: var(--s5); padding-bottom: var(--s7); }
  .nav-toggle, .mobile-nav { display: none !important; }
  .tabbar { display: none !important; }
  .nav-desktop { display: flex; }
  .section-block { padding: var(--s6); }
  .segmented { display: none; }
  .detail-table.view-core th:nth-child(n+5), .detail-table.view-core td:nth-child(n+5),
  .detail-table.view-structure th:nth-child(2), .detail-table.view-structure td:nth-child(2),
  .detail-table.view-structure th:nth-child(3), .detail-table.view-structure td:nth-child(3),
  .detail-table.view-structure th:nth-child(4), .detail-table.view-structure td:nth-child(4) { display: table-cell; }
  .result-name { font-size: 36px; }
  .data-block { margin-top: var(--s6); }
  .tier-row { grid-template-columns: 3.8em minmax(120px, 1fr) 6.5em; min-height: 42px; }
  .metric-value { font-size: 19px; }
  .metrics-4 .metric-value { font-size: 17px; }
  .gs-plot { height: 150px; }
  .gs-scroll { overflow: visible; }
  .gs-sig { height: 20px; line-height: 20px; }
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 480px; max-width: calc(100vw - 32px); padding: var(--s6); border-radius: 22px; transform: translate(-50%, -50%); animation: sheet-in .3s var(--ease) both; }
  .sheet::before { display: none; }
  .toast { bottom: var(--s6); }
  .wl-item { padding: 16px 12px 16px 20px; }
  .wl-flow .f:first-child { font-size: 28px; }
  .uc-menu a, .uc-menu button { min-height: 58px; }
}
@media (min-width: 1100px) {
  .home { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: var(--s6); align-items: start; }
  .home-rail { position: sticky; top: 84px; }
  .home-rail .section-block { padding: var(--s5); }
  #result-section { margin-top: 0; }
  /* 30 日图是核心，独占整行（每列约 19px）；四档累计在它下面 */
  .charts-grid { display: block; }
}

/* ================= 减少动态效果 ================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ================= 留言与公开问答 ================= */
.msg-note { margin: 0 0 var(--s3); padding: 10px 12px; border: 1px solid var(--star-line); border-radius: var(--r-sm); background: var(--star-soft); color: #8a4b08; font-size: 12.5px; }
.msg-chips { display: flex; gap: 6px; margin: var(--s3) 0; overflow-x: auto; padding-bottom: 4px; }
.msg-chip { flex: none; min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-3); font-size: 13px; }
.msg-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.faq-item { margin-bottom: var(--s2); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.faq-q { color: var(--ink); display: flex; width: 100%; gap: 8px; align-items: flex-start; justify-content: space-between; min-height: 52px; padding: 13px 16px; border: 0; border-radius: 0; background: none; text-align: left; font-size: 14.5px; font-weight: 650; }
.faq-q:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; }
.faq-q .qt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.faq-a { padding: 0 16px 14px; color: var(--ink-3); font-size: 13.5px; overflow-wrap: anywhere; }
.faq-text { white-space: pre-wrap; }
.faq-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.faq-like { margin-left: auto; min-height: 36px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink-3); font-size: 12.5px; }
.faq-like.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-strong); }
.thread-card { color: var(--ink); display: block; width: 100%; margin-bottom: var(--s2); padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); text-align: left; }
.thread-card:hover:not(:disabled) { border-color: var(--line-strong); background: var(--surface); }
.thread-card.unread { background: var(--brand-soft); border-color: var(--brand-line); }
.thread-card .row { display: flex; align-items: center; gap: 8px; }
.thread-card .ttl { margin-top: 4px; font-weight: 650; overflow-wrap: anywhere; }
.thread-card .sub { margin-top: 2px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.tag.st-pending { background: var(--star-soft); color: #8a4b08; border-color: var(--star-line); }
.tag.st-replied { background: var(--fall-soft); color: var(--fall); border-color: var(--fall-line); }
.tag.st-closed { background: var(--surface-3); color: var(--muted); border-color: var(--line); }
.bubble { max-width: 86%; margin: 6px 0; padding: 9px 12px; border-radius: 14px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble small { display: block; margin-top: 3px; font-size: 11px; opacity: .7; }
.bubble.me { margin-left: auto; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.bubble.them { background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg-reply { display: flex; gap: var(--s2); align-items: flex-end; margin-top: var(--s3); }
.msg-reply textarea { flex: 1; min-height: 48px; }
dialog.msg-dialog { width: min(520px, calc(100vw - 24px)); padding: var(--s4); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-3); }
dialog.msg-dialog::backdrop { background: rgba(16, 24, 40, .45); }
dialog.msg-dialog .actions { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s3); }
.admin-msg-grid { display: grid; gap: var(--s4); grid-template-columns: 1fr; }
@media (min-width: 900px) { .admin-msg-grid { grid-template-columns: 320px 1fr; align-items: start; } }
.admin-msg-list a { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.admin-msg-list a.sel { background: var(--brand-soft); }
.admin-msg-list a:hover { background: var(--surface-2); }
.faq-admin-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.faq-admin-row.is-hidden { opacity: .6; }

.msg-chip[hidden], #msg-root [hidden], .admin-msg-grid [hidden] { display: none !important; }

/* ================= 管理员数据看板 ================= */
.dash-strip { margin: 0 0 var(--s4); color: var(--ink-3); font-size: 13.5px; }
.dash-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 var(--s4); }
.dash-cols aside { min-width: 0; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 4px; background: var(--surface-3); color: var(--ink-3); font-size: 12px; font-weight: 600; }
.tag-warn { background: var(--star-soft); color: var(--star); }
.tag-bad { background: var(--rise-soft); color: var(--rise); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--s3); }
.chips button { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 3px 12px; font-size: 12.5px; cursor: pointer; }
.chips button:hover { background: var(--brand-soft); border-color: var(--brand-line); color: var(--ink); }
.chips button[aria-pressed="true"], .chips button[aria-pressed="true"]:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.spark { display: flex; align-items: flex-end; gap: 8px; height: 110px; }
.spark > div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.spark i { display: block; width: 100%; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--brand); }
.spark small { color: var(--muted); font-size: 11px; }
.rank { margin: 0; padding: 0; list-style: none; counter-reset: rank; }
.rank li { display: flex; justify-content: space-between; gap: var(--s3); padding: 6px 0; border-bottom: 1px solid var(--line); counter-increment: rank; }
.rank li::before { content: counter(rank); width: 22px; color: var(--faint); font-variant-numeric: tabular-nums; }
.rank li span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rank li:last-child { border-bottom: 0; }
@media (min-width: 900px) { .dash-cols { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
/* 续费套餐 */
.renewal-plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; border: 0; padding: 0; margin: 16px 0; }
.renewal-plans label { cursor: pointer; min-width: 0; }
.renewal-plans input { position: absolute; opacity: 0; }
.renewal-plans span { display: flex; flex-direction: column; gap: 5px; min-height: 106px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.renewal-plans input:checked + span { border: 2px solid var(--brand); padding: 11px; background: #f7faff; }
.renewal-plans input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.renewal-plans b { font-size: 22px; }
.renewal-plans small { color: var(--muted); }
.renewal-buy { display: inline-block; padding: 10px 16px; background: var(--brand); color: white; border-radius: 8px; text-decoration: none; }
.renewal-input { display: flex; gap: 8px; margin-top: 8px; }
.renewal-input input { flex: 1; min-width: 0; }
