:root {
  color-scheme: light;
  --bg: #f6f6f4;
  --surface-1: #fcfcfb;
  --surface-2: #f0efec;
  --border: #e2e1dc;
  --grid: #e9e8e4;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #77766f;
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --pos: #2a78d6; --neg: #e34948;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface-1: #1a1a19; --surface-2: #242422; --border: #33332f; --grid: #2b2b28;
    --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #94938a;
    --accent: #3987e5;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --pos: #3987e5; --neg: #e66767;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface-1: #1a1a19; --surface-2: #242422; --border: #33332f; --grid: #2b2b28;
  --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #94938a;
  --accent: #3987e5;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --pos: #3987e5; --neg: #e66767;
  --shadow: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 120px; }
body {
  margin: 0; background: var(--bg); color: var(--text-primary);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: clamp(28px, 5vw, 44px); letter-spacing: -.01em; }
h2 { font-size: clamp(22px, 3.2vw, 28px); }
h3 { font-size: 17px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface-1) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; gap: 16px; height: 56px; }
.brand { font-weight: 700; color: var(--text-primary); text-decoration: none; white-space: nowrap; }
.nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav a { color: var(--text-secondary); text-decoration: none; padding: 6px 10px; border-radius: 8px; white-space: nowrap; font-size: 14px; }
.nav a:hover { background: var(--surface-2); color: var(--text-primary); }
.top-tools { display: flex; gap: 8px; align-items: center; }
.lang { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.lang button { border: 0; background: transparent; color: var(--text-secondary); padding: 5px 9px; font: inherit; font-size: 13px; cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.icon-btn { border: 1px solid var(--border); background: transparent; color: var(--text-primary); border-radius: 8px; width: 34px; height: 30px; cursor: pointer; font-size: 16px; }

/* Hero */
.hero { padding: 48px 0 28px; }
.lead { font-size: 18px; color: var(--text-secondary); max-width: 760px; margin: 0; }

/* Filter bar */
.filterbar { position: sticky; top: 56px; z-index: 15; background: var(--bg); border-bottom: 1px solid var(--border); }
.filter-inner { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-top: 10px; padding-bottom: 10px; }
.filter-label { font-size: 13px; color: var(--text-muted); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--text-secondary); font: inherit; font-size: 14px; padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.seg button[aria-checked="true"] { background: var(--surface-1); color: var(--text-primary); font-weight: 600; box-shadow: var(--shadow); }
.seg.small button { font-size: 13px; padding: 4px 10px; }
.sel select { font: inherit; font-size: 14px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary); }
.sel select:disabled { opacity: .45; }
.crumb { font-size: 13px; color: var(--text-muted); margin-left: auto; }

/* Sections & cards */
.section { padding: 36px 0 8px; }
.desc { color: var(--text-secondary); max-width: 780px; margin: 0 0 16px; }
.desc.small, .note { font-size: 14px; }
.note { color: var(--text-muted); margin: 8px 0 0; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h3 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 .card { margin-bottom: 0; }
.grid2 + .card { margin-top: 16px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

.viz { position: relative; height: 300px; }
.viz.tall { height: 380px; }
.viz-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.badge { font-size: 12px; color: var(--text-secondary); background: var(--surface-2); border-radius: 999px; padding: 2px 10px; }
.link-btn { border: 0; background: none; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; padding: 2px 0; }
.data-table { margin-top: 10px; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-secondary); font-weight: 600; background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.kpi { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .k-label { font-size: 13px; color: var(--text-secondary); }
.kpi .k-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 2px 0; }
.kpi .k-delta { font-size: 13px; color: var(--text-muted); }
.kpi .up::before { content: "▲ "; color: var(--good); }
.kpi .down::before { content: "▼ "; color: var(--critical); }

/* Outlook table */
.table-wrap { overflow-x: auto; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.outlook td { white-space: normal; }
.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--grid); display: inline-block; }
.dots i.on { background: var(--series-1); }
.dots.risk i.on { background: var(--text-secondary); }
.score-num { font-size: 12px; color: var(--text-muted); margin-left: 6px; }
.trend { font-size: 13px; white-space: nowrap; }
.trend.t2::before { content: "⬆ "; color: var(--good); }
.trend.t1::before { content: "↗ "; color: var(--good); }
.trend.t0::before { content: "→ "; color: var(--text-muted); }
.trend.t-1::before { content: "↘ "; color: var(--critical); }
.tag { display: inline-block; font-size: 12px; background: var(--surface-2); color: var(--text-secondary); border-radius: 6px; padding: 1px 7px; margin: 2px 4px 2px 0; }

/* Matcher */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 14px; user-select: none; }
.chip input { accent-color: var(--accent); }
.chip:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.btn { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 9px 16px; font: inherit; font-size: 15px; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.match-result { margin-top: 16px; display: grid; gap: 10px; }
.match-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.match-item h4 { margin: 0 0 6px; font-size: 16px; display: flex; justify-content: space-between; gap: 10px; }
.bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin: 4px 0 8px; }
.bar span { display: block; height: 100%; background: var(--series-1); border-radius: 3px; }

/* Feedback */
.fb { display: grid; gap: 12px; max-width: 720px; }
.fb label { display: grid; gap: 4px; font-size: 14px; color: var(--text-secondary); }
.fb textarea, .fb input, .fb select { font: inherit; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary); width: 100%; }
.fb-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.fb ul { font-size: 14px; color: var(--text-secondary); }

.links { padding-left: 18px; margin: 0; }
.links li { margin: 4px 0; }

.footer { margin-top: 40px; padding: 24px 0 40px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 14px; }

@media (max-width: 640px) {
  .nav { display: none; }
  .topbar-inner { justify-content: space-between; }
  .crumb { margin-left: 0; width: 100%; }
  .viz { height: 260px; } .viz.tall { height: 340px; }
  .hero { padding: 32px 0 20px; }
}
