/* 配色取自 dataviz 参考调色板（已用 validate_palette.js 校验 light / dark 两套）。
   图表按角色引用变量，深浅色只在这里切换。 */
.viz-root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface-1: #fcfcfb;
  --surface-2: #f3f2ee;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --accent-track: #cde2fb;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --warning: #fab219;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .viz-root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface-1: #1a1a19;
    --surface-2: #232322;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --accent-track: #184f95;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: #f9f9f7; }
@media (prefers-color-scheme: dark) { body { background: #0d0d0d; } }
.viz-root {
  min-height: 100vh;
  background: var(--page);
  color: var(--text-primary);
  font: 14px/1.55 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }

/* 头部 */
.site-header { background: var(--surface-1); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-top: 14px; flex-wrap: wrap; }
.brand h1 { font-size: 18px; margin: 0; font-weight: 650; letter-spacing: 0.01em; }
.brand .sub { margin: 2px 0 12px; color: var(--text-secondary); font-size: 12.5px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; }
.tabs a { color: var(--text-secondary); padding: 8px 12px 12px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text-primary); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--text-primary); border-bottom-color: var(--accent); font-weight: 600; }

.banner { background: var(--surface-2); border-bottom: 1px solid var(--border); }
.banner-inner { display: flex; align-items: center; gap: 12px; padding-top: 8px; padding-bottom: 8px; }

main { padding-top: 16px; padding-bottom: 32px; display: flex; flex-direction: column; gap: 16px; transition: opacity 0.15s; }
main.loading { opacity: 0.55; }
main > * { margin: 0; }
.site-footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--text-muted); font-size: 12px; padding-bottom: 28px; }

/* 筛选行：一行，放在它作用的内容上方 */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.filters .field { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 13px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface-1); }
.seg button { border: 0; background: transparent; color: var(--text-secondary); padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--text-primary); font-weight: 600; }
.seg button:hover { color: var(--text-primary); }
select, input[type="search"], input[type="text"] {
  font: inherit; font-size: 13px; color: var(--text-primary); background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; min-height: 32px;
}
input[type="search"] { min-width: 200px; }
.btn {
  font: inherit; font-size: 13px; color: var(--text-primary); background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; cursor: pointer;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.small { padding: 3px 9px; font-size: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 卡片 */
.grid { display: grid; gap: 16px; }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-2 { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h2 { font-size: 15px; margin: 0; font-weight: 600; }
.card-head .note { color: var(--text-muted); font-size: 12px; }
.card-head .actions { display: flex; gap: 8px; align-items: center; }

/* 指标卡 */
.tile .label { color: var(--text-secondary); font-size: 13px; }
.tile .value { font-size: 30px; font-weight: 600; line-height: 1.2; margin-top: 6px; }
.tile .value.hero { font-size: 48px; }
.tile .value .unit { font-size: 14px; font-weight: 500; color: var(--text-secondary); margin-left: 4px; }
.tile .delta { margin-top: 4px; color: var(--text-secondary); font-size: 13px; }
.tile .foot { margin-top: 6px; color: var(--text-muted); font-size: 12px; }

/* 披露进度 */
.progress-card h2 .tag { display: inline-block; margin-left: 8px; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--border); }
.meter { height: 8px; border-radius: 999px; background: var(--accent-track); overflow: hidden; margin: 8px 0 6px; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.meter-text { color: var(--text-secondary); font-size: 13px; }
.stat-chips { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; }
.stat-chips .chip { display: flex; align-items: baseline; gap: 6px; }
.stat-chips .chip b { font-size: 18px; font-weight: 600; }
.stat-chips .chip span { color: var(--text-secondary); font-size: 13px; }
.mv-compare { margin-top: 10px; color: var(--text-secondary); font-size: 13px; }

/* 图表 */
.chart { width: 100%; height: 340px; }
.chart.tall { height: 380px; }
.chart.short { height: 260px; }
.chart-caption { color: var(--text-muted); font-size: 12px; margin-top: 6px; }
.tt { font: 12px/1.5 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; min-width: 150px; }
.tt-title { color: var(--text-secondary); margin-bottom: 4px; }
.tt-row { display: flex; align-items: center; gap: 8px; }
.tt-row b { font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; color: var(--text-primary); font-weight: 600; }
.tt-row span { color: var(--text-secondary); }
.tt-key { display: inline-block; width: 12px; height: 2px; border-radius: 1px; flex: none; }
.tt-total { border-top: 1px solid var(--grid); margin-top: 4px; padding-top: 4px; }

/* 表格 */
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 7px 10px; border-bottom: 1px solid var(--grid); text-align: left; white-space: nowrap; }
table.data th { color: var(--text-secondary); font-weight: 500; font-size: 12.5px; position: sticky; top: 0; background: var(--surface-1); }
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--text-primary); }
table.data th .arrow { color: var(--text-muted); margin-left: 3px; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.muted { color: var(--text-muted); }
table.data tbody tr:hover { background: var(--surface-2); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; color: var(--text-secondary); font-size: 12.5px; flex-wrap: wrap; }
.pager .pages { display: flex; gap: 6px; align-items: center; }
.empty { color: var(--text-muted); padding: 24px 0; text-align: center; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary); font-size: 12px; line-height: 20px; }
.pill .sym { color: var(--text-secondary); font-size: 11px; }
.pill.dim { color: var(--text-muted); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.summary-line { color: var(--text-secondary); font-size: 13px; margin: -4px 0 10px; }
.stock-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.stock-head h2 { font-size: 22px; margin: 0; }
.stock-head .code { color: var(--text-secondary); }
.notes dt { font-weight: 600; margin-top: 12px; }
.notes dd { margin: 4px 0 0; color: var(--text-secondary); }
.callout { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; color: var(--text-secondary); font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 口径说明：紧跟在筛选行下面，三档并列，当前档高亮；点一行即切换 */
.tier-legend { display: flex; flex-direction: column; margin-top: -6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-1); overflow: hidden; }
.tier-row {
  display: grid; grid-template-columns: 8.5em minmax(0, 1fr) auto; gap: 2px 14px; align-items: baseline;
  width: 100%; text-align: left; font: inherit; font-size: 13px; color: var(--text-secondary);
  background: transparent; border: 0; border-left: 3px solid transparent; padding: 7px 14px 7px 11px; cursor: pointer;
}
.tier-row + .tier-row { border-top: 1px solid var(--grid); }
.tier-row:hover { background: var(--surface-2); }
.tier-row.on { color: var(--text-primary); background: var(--surface-2); border-left-color: var(--accent); }
.tier-name { font-weight: 600; white-space: nowrap; }
.tier-desc b { font-weight: 600; margin-right: 10px; }
.tier-row:not(.on) .tier-desc b { font-weight: 500; }
.tier-size { color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tier-row.on .tier-size { color: var(--text-secondary); }
@media (max-width: 700px) { .tier-row { grid-template-columns: minmax(0, 1fr); } }
