/* 趋势看板 — design system.
   Foundation: shadcn/ui "zinc" theme tokens (ui.shadcn.com/r/themes.css) and its component specs
   (button h-9 / badge / toggle group / input / table / card / alert), applied with the Impeccable
   "Operate" rules: one sans family, fixed rem scale, restrained colour (a monochrome UI; colour only
   encodes data), border-only elevation, no side stripes, no decorative motion.

   Colour roles
     UI            background / foreground / muted / border / primary   (shadcn neutrals; primary = ink)
     data          --gold (the series under study) · --blue (context) · --orange (alert)   validated with the
                   dataviz checker on #09090b and #ffffff (CVD ΔE ≥ 22, contrast ≥ 3:1)
     meaning       寒 凉 平 温 热 → diverging blue ↔ orange with a neutral mid; always paired with the character
     text on data  --up / --down / --gold-text are darker steps where plain text needs 4.5:1 on white
   Charts read tokens at render time (tok("name")), so this file is the single source of colour. */

@font-face {
  font-family: "Geist";
  src: url("fonts/geist-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  /* shadcn / zinc, light */
  --background: hsl(0 0% 100%);
  --foreground: hsl(240 10% 3.9%);
  --card: hsl(0 0% 100%);
  --muted: hsl(240 4.8% 95.9%);
  --muted-foreground: hsl(240 3.8% 46.1%);
  --border: hsl(240 5.9% 90%);
  --input: hsl(240 5.9% 90%);
  --primary: hsl(240 5.9% 10%);
  --primary-foreground: hsl(0 0% 98%);
  --accent: hsl(240 4.8% 95.9%);
  --ring: hsl(240 5.9% 10%);
  --destructive: hsl(0 84.2% 60.2%);
  --radius: 0.5rem;

  /* data */
  --gold: #b97d00;
  --blue: #2a78d6;
  --orange: #d4501f;
  --aqua: #12966a;
  --violet: #7c4fd0;
  --gold-text: #8f6100;
  --up: #c2410c;
  --down: #1d4ed8;
  --cold: #2f66b8;
  --cool: #6d97cf;
  --flat: hsl(240 3.8% 46.1%);
  --warm: #c07a35;
  --hot: #c2441f;
  --mid: hsl(240 5% 88%);                      /* diverging neutral */
  --phase: rgba(185, 125, 0, 0.1);             /* rising-phase shading */

  /* aliases the chart code reads */
  --ink: var(--foreground);
  --ink-2: hsl(240 5% 34%);
  --ink-3: var(--muted-foreground);
  --line: hsl(240 6% 94%);                     /* gridlines: recede */
  --line-2: var(--border);
  --panel: var(--card);
  --gold-ink: var(--gold-text);

  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --scrim: hsl(240 10% 3.9% / 0.5);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: hsl(240 10% 3.9%);
  --foreground: hsl(0 0% 98%);
  --card: hsl(240 10% 3.9%);
  --muted: hsl(240 3.7% 15.9%);
  --muted-foreground: hsl(240 5% 64.9%);
  --border: hsl(240 3.7% 15.9%);
  --input: hsl(240 3.7% 15.9%);
  --primary: hsl(0 0% 98%);
  --primary-foreground: hsl(240 5.9% 10%);
  --accent: hsl(240 3.7% 15.9%);
  --ring: hsl(240 4.9% 83.9%);

  --gold: #c98500;
  --blue: #3987e5;
  --orange: #d95926;
  --aqua: #1fa675;
  --violet: #9a78e6;
  --gold-text: #e3ab35;
  --up: #e8693a;
  --down: #5b9bf0;
  --cold: #3d73c4;
  --cool: #6d97cf;
  --flat: hsl(240 5% 64.9%);
  --warm: #c07a35;
  --hot: #d9532c;
  --mid: hsl(240 4% 26%);
  --phase: rgba(201, 133, 0, 0.12);

  --ink-2: hsl(240 5% 78%);
  --line: hsl(240 4% 11%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font: 14px/1.65 var(--font);
  font-feature-settings: "tnum" 0, "calt" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* browser surfaces carry the design too */
::selection { background: var(--primary); color: var(--primary-foreground); }
input, textarea { caret-color: var(--foreground); }
input[type="checkbox"] { accent-color: var(--primary); width: 15px; height: 15px; margin: 0; cursor: pointer; }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
a { color: var(--foreground); text-decoration-line: underline; text-decoration-color: var(--muted-foreground); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: var(--foreground); }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent); border-radius: 6px; }
.num, table td, .kv td { font-variant-numeric: tabular-nums; }
h1, h2, h3 { text-wrap: balance; letter-spacing: -0.02em; margin: 0; }
p { text-wrap: pretty; }
code { font: 12.5px/1.4 ui-monospace, "SF Mono", Menlo, monospace; background: var(--muted); padding: 1px 6px; border-radius: 4px; }
.icon { flex: none; vertical-align: -0.15em; }
.dim { color: var(--muted-foreground); }
.up { color: var(--up); } .down { color: var(--down); } .flatc { color: var(--muted-foreground); }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ---------- controls (shadcn spec) ---------- */
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  height: 36px; padding: 0 16px; border-radius: 6px; border: 1px solid transparent; cursor: pointer;
  font-size: 14px; font-weight: 500; text-decoration: none; transition: background-color .15s, color .15s, border-color .15s;
  background: transparent; color: var(--foreground);
}
.btn:hover { background: var(--accent); }
.btn.outline { border-color: var(--input); background: var(--background); }
.btn.primary { background: var(--primary); color: var(--primary-foreground); }
.btn.primary:hover { background: color-mix(in srgb, var(--primary) 90%, transparent); }
.btn.sm { height: 32px; padding: 0 12px; }
.btn.icon-only { width: 36px; padding: 0; }
.btn:disabled { opacity: .5; pointer-events: none; }
.ghost { appearance: none; background: transparent; border: 0; color: inherit; cursor: pointer; border-radius: 6px; padding: 4px 10px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px;
  border: 1px solid var(--border); font-size: 12px; font-weight: 500; line-height: 1; color: var(--foreground); white-space: nowrap;
}

/* segmented control = shadcn Tabs list / toggle group */
.seg { display: inline-flex; align-items: center; height: 36px; padding: 3px; gap: 2px; border-radius: 8px; background: var(--muted); }
.seg button {
  appearance: none; border: 1px solid transparent; background: transparent; height: 100%; padding: 0 12px; border-radius: 6px; cursor: pointer;
  font-size: 13.5px; font-weight: 500; color: var(--muted-foreground); transition: background-color .15s, color .15s; white-space: nowrap;
}
.seg button:hover { color: var(--foreground); }
.seg button[aria-pressed="true"], .seg button.on { background: var(--background); color: var(--foreground); border-color: var(--border); box-shadow: 0 1px 2px rgb(0 0 0 / 0.05); }
:root[data-theme="dark"] .seg button[aria-pressed="true"], :root[data-theme="dark"] .seg button.on { background: color-mix(in srgb, var(--input) 60%, var(--background)); border-color: var(--input); box-shadow: none; }

input.search, select.search {
  height: 36px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--input); background: var(--background); color: var(--foreground);
  font-size: 14px; box-shadow: 0 1px 2px rgb(0 0 0 / 0.04); transition: border-color .15s, box-shadow .15s; min-width: 0;
}
input.search { width: 168px; }
input.search::placeholder { color: var(--muted-foreground); }
input.search:focus-visible, select.search:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 40%, transparent); border-radius: 6px; }
select.search {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.check { display: inline-flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--muted-foreground); cursor: pointer; }
.check:hover { color: var(--foreground); }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--background) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar .wrap { display: flex; align-items: center; gap: 20px; min-height: 56px; }
.brand { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; text-decoration: none; white-space: nowrap; }
.brand b { font-weight: 600; color: var(--gold-text); }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { height: 32px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 6px; color: var(--muted-foreground); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; transition: background-color .15s, color .15s; }
.nav a:hover { color: var(--foreground); background: var(--accent); }
.nav a.on { color: var(--foreground); background: var(--accent); }
.top-tools { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.asof { margin-right: 6px; }

/* ---------- pages ---------- */
main.wrap { padding-bottom: 8px; }
.opening { padding: 36px 0 4px; }
.opening h1, .page-head h1 { font-size: 28px; line-height: 1.25; font-weight: 600; letter-spacing: -0.025em; max-width: 24em; margin-bottom: 12px; }
.opening .lead, .page-head .lead { color: var(--muted-foreground); max-width: 46em; margin: 0; font-size: 15px; line-height: 1.75; }
.opening .lead b, .page-head .lead b { color: var(--foreground); font-weight: 600; }
.page-head { padding: 36px 0 4px; }
section.block { padding-top: 48px; }
section.block.tight { padding-top: 24px; }
.sec-head { margin-bottom: 16px; }
.sec-head h2 { font-size: 20px; line-height: 1.3; font-weight: 600; margin-bottom: 4px; }
.sec-head p { margin: 0; color: var(--muted-foreground); max-width: 46em; font-size: 14px; }
.sec-head p b { color: var(--foreground); font-weight: 600; }
.mt { margin-top: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* card: border only (elevation declared once) */
.panel { background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.card { padding: 20px; }
.hero { margin-top: 24px; padding: 16px 20px 16px; }
.hero-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 8px; }
.hero-head h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.hero-head .sub { color: var(--muted-foreground); font-size: 13px; }
.hero-head .tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.chart { width: 100%; height: 440px; }
.chart.tall { height: 560px; }
.chart.huge { height: 960px; }
.chart.mid { height: 340px; }
.chart.short { height: 260px; }
/* skeleton while a chart has not mounted yet */
.chart:not(:has(canvas)) { background: linear-gradient(90deg, var(--muted) 25%, color-mix(in srgb, var(--muted) 55%, var(--background)) 50%, var(--muted) 75%); background-size: 200% 100%; border-radius: 8px; animation: sk 1.4s ease-in-out infinite; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.foot { color: var(--muted-foreground); font-size: 12.5px; line-height: 1.65; margin: 8px 0 0; max-width: 72em; }
.foot b { color: var(--foreground); font-weight: 600; }
details.table-view { margin-top: 10px; font-size: 13px; }
details.table-view summary { cursor: pointer; color: var(--muted-foreground); width: fit-content; }

/* alert (callout): shadcn Alert, no side stripe */
.callout {
  position: relative; margin: 14px 0 0; padding: 10px 14px 10px 40px; border: 1px solid var(--border); border-radius: 8px;
  background: color-mix(in srgb, var(--muted) 45%, var(--background)); color: var(--muted-foreground); font-size: 13.5px; line-height: 1.7;
}
.callout b { color: var(--foreground); font-weight: 600; }
.callout::before {
  content: ""; position: absolute; left: 14px; top: 13px; width: 16px; height: 16px; background: var(--foreground);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- key figures (a table, not a hero metric) ---------- */
table.kv { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
table.kv th { text-align: left; font-weight: 500; color: var(--muted-foreground); padding: 9px 12px 9px 0; border-top: 1px solid var(--border); white-space: nowrap; width: 1%; }
table.kv td { padding: 9px 0; border-top: 1px solid var(--border); }
table.kv td b { font-weight: 600; font-size: 15px; margin-right: 8px; }
table.kv td .note { color: var(--muted-foreground); }

/* ---------- link list (home) ---------- */
ul.list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
ul.list li + li { border-top: 1px solid var(--border); }
ul.list a { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 16px; padding: 14px 18px; text-decoration: none; transition: background-color .15s; }
ul.list a:hover { background: var(--accent); }
ul.list .t1 { font-weight: 600; font-size: 15px; }
ul.list .t2 { color: var(--muted-foreground); font-size: 13.5px; grid-column: 1; }
ul.list .t3 { color: var(--muted-foreground); font-size: 12.5px; grid-column: 1; }
ul.list .chev { grid-column: 2; grid-row: 1 / span 3; color: var(--muted-foreground); }

/* ---------- board ---------- */
.board-tools { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { appearance: none; display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px 0 8px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--muted-foreground); cursor: pointer; font-size: 13.5px; transition: background-color .15s, color .15s, border-color .15s; }
.chip-btn:hover { background: var(--accent); color: var(--foreground); }
.chip-btn[aria-pressed="true"] { border-color: var(--foreground); color: var(--foreground); background: var(--accent); }
.chip-btn .t { border: 0; padding: 0; height: auto; gap: 6px; }
.board-count { margin-left: auto; font-size: 12.5px; color: var(--muted-foreground); }

/* temperature badge: a dot (colour) + the character (meaning) */
.t { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px 0 7px; border-radius: 999px; border: 1px solid var(--border); font-size: 12.5px; font-weight: 500; line-height: 1; color: var(--foreground); white-space: nowrap; }
.t::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--flat); }
.t.cold::before { background: var(--cold); } .t.cool::before { background: var(--cool); } .t.flat::before { background: var(--flat); }
.t.warm::before { background: var(--warm); } .t.hot::before { background: var(--hot); }
.tag-turn { margin-left: 6px; height: 20px; padding: 0 7px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent); color: var(--gold-text); font-size: 11.5px; font-weight: 500; display: inline-flex; align-items: center; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
table.board { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 920px; }
table.board th { position: sticky; top: 0; background: color-mix(in srgb, var(--muted) 50%, var(--background)); color: var(--muted-foreground); font-weight: 500; font-size: 12.5px; text-align: right; height: 40px; padding: 0 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.board th.l, table.board td.l { text-align: left; }
table.board th button { appearance: none; border: 0; background: none; color: inherit; cursor: pointer; font: inherit; padding: 0; }
table.board th button:hover { color: var(--foreground); }
table.board th[aria-sort="descending"] button, table.board th[aria-sort="ascending"] button { color: var(--foreground); }
table.board th[aria-sort="descending"] button::after, table.board th[aria-sort="ascending"] button::after {
  content: ""; display: inline-block; width: 12px; height: 12px; margin-left: 4px; vertical-align: -1px; background: currentColor;
}
table.board th[aria-sort="descending"] button::after { -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14'/%3E%3Cpath d='m19 12-7 7-7-7'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14'/%3E%3Cpath d='m19 12-7 7-7-7'/%3E%3C/svg%3E") center / contain no-repeat; }
table.board th[aria-sort="ascending"] button::after { -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 7-7 7 7'/%3E%3Cpath d='M12 19V5'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 7-7 7 7'/%3E%3Cpath d='M12 19V5'/%3E%3C/svg%3E") center / contain no-repeat; }
table.board td { padding: 7px 12px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
table.board tbody tr { transition: background-color .15s; }
table.board tbody tr:hover { background: color-mix(in srgb, var(--muted) 50%, transparent); }
table.board tbody tr:last-child td { border-bottom: 0; }
.city-btn { font-weight: 600; font-size: 14px; text-decoration: none; }
.city-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.rank { color: var(--muted-foreground); width: 36px; }
.strength { display: inline-flex; align-items: center; gap: 8px; }
.strength .bar { width: 56px; height: 5px; background: var(--muted); border-radius: 3px; overflow: hidden; }
.strength .bar i { display: block; height: 100%; background: var(--gold); border-radius: 3px; }
.strength span.num { width: 26px; text-align: right; }
svg.spark { width: 110px; height: 28px; display: block; margin-left: auto; overflow: visible; }
svg.micro { width: 132px; height: 22px; display: block; margin-left: auto; overflow: visible; }
tr.empty td { padding: 40px 12px; text-align: center; color: var(--muted-foreground); }
tr.empty td .btn { margin-top: 12px; }
.legend-note { margin-top: 10px; font-size: 12.5px; color: var(--muted-foreground); max-width: 72em; }

/* ---------- plain tables (scorecard, data) ---------- */
table.plain { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.plain th { color: var(--muted-foreground); font-weight: 500; font-size: 12.5px; text-align: right; height: 40px; padding: 0 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.plain td { text-align: right; padding: 8px 12px; border-bottom: 1px solid var(--border); }
table.plain th:first-child, table.plain td:first-child { text-align: left; padding-left: 0; }
table.plain th.l, table.plain td.l { text-align: left; }
table.plain tr:last-child td { border-bottom: 0; }
table.plain td.best { font-weight: 600; color: var(--gold-text); }
.verdict { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; white-space: nowrap; color: var(--foreground); }
.verdict.out { color: var(--up); }

.zones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.zone { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; font-size: 13.5px; color: var(--muted-foreground); line-height: 1.65; }
.zone h4 { margin: 0 0 4px; font-size: 14px; font-weight: 600; color: var(--foreground); }
.zone .tagz { font-size: 12px; font-weight: 500; margin-bottom: 4px; display: block; }
.src-list { columns: 2; column-gap: 32px; padding-left: 18px; margin: 8px 0 0; color: var(--muted-foreground); }
.src-list li { break-inside: avoid; margin-bottom: 6px; }
.src-list b { color: var(--foreground); font-weight: 600; }

/* facts: a data list, not tiles */
.facts { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--border); border-left: 1px solid var(--border); border-radius: 0; margin: 8px 0 16px; }
.fact { padding: 10px 14px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.fact .k { font-size: 12px; color: var(--muted-foreground); }
.fact .v { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.fact .v small { font-size: 12px; color: var(--muted-foreground); font-weight: 400; margin-left: 2px; }

/* trend view toolbar + stage */
.tv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 4px 0 6px; }
.tv-grp { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tv-grp[hidden], .tv-bar [hidden] { display: none; }
.tv-lab { font-size: 12px; color: var(--muted-foreground); white-space: nowrap; }
.tv-checks { gap: 14px; }
.tv-custom { display: inline-flex; align-items: center; gap: 6px; }
.tv-custom { flex-wrap: wrap; }
.tv-custom input[type="month"] { width: 148px; max-width: 100%; height: 32px; padding: 0 8px; border: 1px solid var(--input); border-radius: 6px; background: var(--background); color: var(--foreground); font: inherit; font-size: 13px; }
.tv-custom.on input[type="month"] { border-color: var(--foreground); }
.tv-hint { margin: 0 0 8px; font-size: 12.5px; color: var(--muted-foreground); }
.tv-stats { margin-top: 14px; }
.cmp-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 0 0 10px; }
.cmp-pick .chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.chip-btn .x { margin-left: 4px; color: var(--muted-foreground); }
.chip-btn:hover .x { color: var(--foreground); }
.tv-grp.off { opacity: 0.45; }
.ledger-entry + .ledger-entry { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--border); }
.ledger-entry h3 { margin: 0; font-size: 16px; font-weight: 600; }
.ledger-prov { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; color: var(--ink-2); }
.ledger-prov code { font-size: 12px; word-break: break-all; }
.ledger-prov summary { cursor: pointer; margin-top: 6px; color: var(--muted-foreground); }
@media (max-width: 640px) {
  .tv-bar > .tv-grp, .cmp-pick > .tv-grp, .window-bar > * { flex-direction: column; align-items: flex-start; gap: 4px; max-width: 100%; }
  .tv-bar .seg, .tv-custom { max-width: 100%; }
  .seg button { white-space: nowrap; padding-left: 10px; padding-right: 10px; }
  .tv-checks { flex-direction: row !important; }
}
.window-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 4px; }
.window-bar .note { font-size: 12.5px; color: var(--muted-foreground); }
.tv-stats:empty { display: none; }
.tv-stats-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin-bottom: 4px; font-size: 13.5px; }
table.stats th[scope="row"] { text-align: left; font-weight: 500; color: var(--foreground); font-size: 13px; padding: 8px 12px 8px 0; height: auto; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.stats tbody tr:last-child th, table.stats tbody tr:last-child td { border-bottom: 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.tv-bar [hidden], .tv-stage [hidden], .tv-key[hidden] { display: none; }
.tv-key { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 8px; font-size: 12px; color: var(--ink-2); }
.tv-key .k { display: inline-flex; align-items: center; gap: 6px; }
.tv-key .note { color: var(--ink-3); }
.sw { display: inline-block; width: 14px; height: 8px; border-radius: 2px; flex: none; }
.sw.up { background: var(--orange); } .sw.down { background: var(--blue); }
.sw.phase { background: var(--phase); border: 1px solid var(--border); }
.sw.scn { background: rgba(128, 128, 120, 0.2); }
.sw.median, .sw.band { height: 0; background: none; border-radius: 0; border-top: 2px dashed var(--gold); }
.sw.band { border-top: 2px dotted var(--gold); }
.sw.nat { height: 2px; background: var(--blue); }
.sw.new { height: 0; background: none; border-radius: 0; border-top: 2px dashed var(--aqua); }
.sw.chg { height: 8px; width: 4px; background: var(--orange); opacity: 0.6; box-shadow: 6px 0 0 var(--blue); margin-right: 6px; }
.tv-stage { position: relative; }
.tv-candle { position: relative; }
.lwc-legend { position: absolute; left: 8px; top: 6px; z-index: 3; max-width: calc(100% - 180px); font-size: 12px; line-height: 1.5; color: var(--ink-3); pointer-events: none; font-variant-numeric: tabular-nums; }
.lwc-legend .row { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; }
.lwc-legend .lg-title { font-size: 13px; font-weight: 600; color: var(--foreground); }
.lwc-legend .lg-unit { color: var(--ink-2); }
.lwc-legend .lg-time { color: var(--ink-2); margin-right: 4px; }
.lwc-legend b { font-weight: 500; color: var(--foreground); }
.lwc-legend b.up, .lwc-pane b.up { color: var(--up); } .lwc-legend b.down, .lwc-pane b.down { color: var(--down); }
.lwc-legend .sw { margin-right: 2px; }
.lwc-pane { position: absolute; left: 8px; z-index: 3; font-size: 11.5px; color: var(--ink-3); pointer-events: none; font-variant-numeric: tabular-nums; }
.lwc-pane b { font-weight: 500; }
@media (max-width: 640px) { .lwc-legend { max-width: calc(100% - 72px); } }

/* district explorer */
.dist-grid { display: grid; grid-template-columns: 240px 1fr; gap: 16px; }
.dist-list { max-height: 340px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 4px; }
.dist-item { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.dist-item:hover { background: var(--accent); }
.dist-item span:nth-of-type(1) { flex: 1; }
.city-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.city-title h1 { margin: 0; }
.city-tools { display: flex; align-items: center; gap: 12px; margin: 14px 0 4px; font-size: 13.5px; color: var(--muted-foreground); }
.city-tools a { display: inline-flex; align-items: center; gap: 4px; color: var(--muted-foreground); text-decoration: none; }
.city-tools a:hover { color: var(--foreground); }
.paper-t { font-size: 15px; line-height: 1.5; font-weight: 600; margin: 0 0 4px; }

.cirea { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 12px; }
.cirea .c { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.cirea .c .big { display: block; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; }
.cirea .c .cap { font-size: 12.5px; color: var(--muted-foreground); margin-top: 2px; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.links a { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--input); border-radius: 6px; font-size: 13.5px; font-weight: 500; text-decoration: none; transition: background-color .15s; }
.links a:hover { background: var(--accent); }

footer.site { margin-top: 64px; padding: 20px 24px 56px; border-top: 1px solid var(--border); color: var(--muted-foreground); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 6px 24px; justify-content: space-between; }

#boot-error { display: none; position: fixed; left: 50%; top: 72px; transform: translateX(-50%); z-index: 100; background: var(--background); border: 1px solid var(--destructive); padding: 10px 16px; border-radius: 8px; max-width: 90vw; font-size: 13.5px; }

@media (max-width: 900px) {
  .wrap { padding: 0 16px; }
  .topbar .wrap { flex-wrap: wrap; gap: 0 12px; padding-top: 8px; }
  .nav { order: 3; width: 100%; padding: 6px 0 8px; margin: 0 -4px; }
  .top-tools { margin-left: auto; }
  .opening h1, .page-head h1 { font-size: 24px; }
  .grid2, .zones { grid-template-columns: 1fr; }
  .cirea { grid-template-columns: 1fr 1fr; }
  .src-list { columns: 1; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .dist-grid { grid-template-columns: 1fr; }
  .dist-list { max-height: 180px; }
  .chart { height: 360px; } .chart.tall { height: 480px; } .chart.huge { height: 900px; }
  .hero { padding: 12px; }
  .card { padding: 14px; }
}
@media (max-width: 560px) {
  .asof { display: none; }
  table.kv th { white-space: normal; }
}

/* definitions list (data page) */
dl.defs { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
dl.defs > div { padding: 14px 0; border-top: 1px solid var(--border); break-inside: avoid; }
dl.defs dt { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
dl.defs dd { margin: 0; color: var(--muted-foreground); font-size: 13.5px; line-height: 1.75; }
dl.defs dd b { color: var(--foreground); font-weight: 600; }
@media (max-width: 900px) { dl.defs { grid-template-columns: 1fr; } }

.nw { white-space: nowrap; }
