:root {
  color-scheme: light;
  --page: #f9f9f7; --surface: #fcfcfb; --surface-2: #f3f2ee;
  --ink: #0b0b0b; --ink-2: #52514e; --muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7; --border: rgba(11,11,11,0.10);
  --s-ema21: #2a78d6; --s-ema50: #eb6834; --s-ema200: #4a3aa7; --s-vwap: #1baf7a; --s-bb: #898781;
  --long: #0ca30c; --long-ink: #006300; --short: #d03b3b; --short-ink: #b02a2a;
  --warn: #fab219; --warn-ink: #8a5a00; --serious: #ec835a;
  --gold: #c9a227;
  --long-wash: rgba(12,163,12,0.10); --short-wash: rgba(208,59,59,0.10); --warn-wash: rgba(250,178,25,0.14); --neutral-wash: rgba(137,135,129,0.12);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321;
    --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10);
    --s-ema21: #3987e5; --s-ema50: #d95926; --s-ema200: #9085e9; --s-vwap: #199e70;
    --long-ink: #0ca30c; --short-ink: #e66767; --warn-ink: #fab219;
    --long-wash: rgba(12,163,12,0.14); --short-wash: rgba(208,59,59,0.16); --warn-wash: rgba(250,178,25,0.12);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321;
  --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10);
  --s-ema21: #3987e5; --s-ema50: #d95926; --s-ema200: #9085e9; --s-vwap: #199e70;
  --long-ink: #0ca30c; --short-ink: #e66767; --warn-ink: #fab219;
  --long-wash: rgba(12,163,12,0.14); --short-wash: rgba(208,59,59,0.16); --warn-wash: rgba(250,178,25,0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
.wrap { max-width: 1480px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
main.wrap { display: flex; flex-direction: column; gap: 14px; padding-top: 14px; padding-bottom: 24px; }
.section { scroll-margin-top: 64px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.section.grid-top, .section.grid-3, .section.grid-chart { display: grid; }
h2 { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 10px; }
h3 { font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 14px 0 6px; }
.mt { margin-top: 18px; }
.sub { color: var(--ink-2); font-size: 13px; }
.note { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.num { font-variant-numeric: tabular-nums; }
.long { color: var(--long-ink); } .short { color: var(--short-ink); } .muted { color: var(--muted); } .warn { color: var(--warn-ink); }

.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding-top: 14px; padding-bottom: 10px; }
.brand { display: flex; gap: 12px; align-items: center; }
.logo { width: 36px; height: 24px; border-radius: 4px; background: linear-gradient(135deg, #e8c75a, var(--gold)); box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.eyebrow { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.price-row { display: flex; align-items: baseline; gap: 10px; }
.price { font-size: 34px; font-weight: 700; letter-spacing: -.01em; }
.chg { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.top-right { display: flex; align-items: center; gap: 12px; }
.health { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.btn { font: inherit; border: 1px solid var(--border); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 5px 10px; cursor: pointer; }
.btn:hover { background: var(--surface-2); }
.btn.ghost { border-color: transparent; background: transparent; font-size: 18px; padding: 2px 8px; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.panel-head h2 { margin: 0; }

.banner { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; border-radius: 12px; padding: 14px 18px; border: 1px solid var(--border); background: var(--surface); border-left: 5px solid var(--muted); }
.banner.v-long { border-left-color: var(--long); background: var(--long-wash); }
.banner.v-short { border-left-color: var(--short); background: var(--short-wash); }
.banner.v-no { border-left-color: var(--short); }
.banner.v-watch { border-left-color: var(--warn); }
.verdict { font-size: 22px; font-weight: 700; }
.headline { color: var(--ink-2); margin-top: 2px; }
.regime-line { margin-top: 8px; font-size: 13px; color: var(--ink-2); } .regime-line .chip { padding: 2px 9px; font-size: 12px; } .regime-action { margin-left: 4px; } .regime-notes { margin-top: 3px; font-size: 12px; color: var(--muted); }
.perm { display: flex; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; border: 1px solid var(--border); background: var(--surface); }
.chip.ok { color: var(--long-ink); } .chip.no { color: var(--short-ink); text-decoration: line-through; text-decoration-thickness: 1.5px; }

.grid-top { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; }
.grid-chart { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(300px, 1fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 14px; }
@media (max-width: 980px) { .grid-top, .grid-chart { grid-template-columns: 1fr; } }

/* edge meter */
.edge-meter { margin-bottom: 12px; }
.meter-labels { display: flex; justify-content: space-between; font-weight: 700; font-size: 18px; margin-bottom: 6px; }
.meter { position: relative; height: 12px; border-radius: 6px; background: var(--surface-2); overflow: hidden; display: flex; gap: 2px; }
.meter .l { background: var(--long); border-radius: 6px 0 0 6px; }
.meter .s { background: var(--short); border-radius: 0 6px 6px 0; }
.meter-mid { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .5; }
.components { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.components li { display: grid; grid-template-columns: 110px 46px 1fr; gap: 8px; align-items: center; font-size: 13px; }
.cbar { position: relative; height: 8px; background: var(--surface-2); border-radius: 4px; }
.cbar i { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.cbar::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--axis); }
.cwhy { color: var(--ink-2); grid-column: 1 / -1; font-size: 12px; margin: -2px 0 4px; }

/* scenarios & vetoes */
.scen { border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; margin-bottom: 8px; }
.scen b { font-variant-numeric: tabular-nums; }
.vetoes { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.veto { border-left: 3px solid var(--warn); padding: 6px 10px; background: var(--warn-wash); border-radius: 0 8px 8px 0; font-size: 13px; }
.veto.block { border-color: var(--short); background: var(--short-wash); }
.veto .code { font-weight: 700; font-size: 12px; letter-spacing: .04em; }

/* chart */
.tabs { display: flex; gap: 2px; background: var(--surface-2); border-radius: 8px; padding: 2px; }
.tabs button { font: inherit; font-size: 12px; font-weight: 600; border: 0; background: transparent; color: var(--ink-2); padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.tabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--border); }
.chart { height: 520px; width: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.sw { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.s-ema21 { background: var(--s-ema21); } .s-ema50 { background: var(--s-ema50); } .s-ema200 { background: var(--s-ema200); }
.s-vwap { background: var(--s-vwap); } .s-bb { background: var(--s-bb); height: 1px; border-top: 1px dashed var(--s-bb); }
.s-res { background: var(--short); height: 8px; opacity: .6; } .s-sup { background: var(--long); height: 8px; opacity: .6; }

/* ladder */
.ladder { display: flex; flex-direction: column; gap: 3px; }
.rung > span { min-width: 0; }
.rung { display: grid; grid-template-columns: 74px minmax(0, 1fr) 38px; gap: 8px; align-items: center; font-size: 13px; padding: 3px 6px; border-radius: 6px; cursor: default; }
.rung:hover { background: var(--surface-2); }
.rung .p { font-variant-numeric: tabular-nums; font-weight: 600; }
.rung .src { color: var(--ink-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rung .sc { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.rung.res .p { color: var(--short-ink); } .rung.sup .p { color: var(--long-ink); }
.rung .bar { height: 4px; border-radius: 2px; margin-top: 3px; }
.rung.res .bar { background: var(--short); } .rung.sup .bar { background: var(--long); }
.now { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.now::before, .now::after { content: ""; flex: 1; height: 1px; background: var(--axis); }

/* tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.t th, .t td { text-align: right; padding: 5px 7px; border-bottom: 1px solid var(--grid); font-size: 13px; white-space: nowrap; }
.t th { color: var(--muted); font-weight: 600; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.t th:first-child, .t td:first-child { text-align: left; }
.t.small td, .t.small th { font-size: 12px; padding: 3px 6px; }
.t tr:hover td { background: var(--surface-2); }
.pullbar { display: inline-block; position: relative; width: 70px; height: 8px; background: var(--surface-2); border-radius: 4px; vertical-align: middle; }
.pullbar i { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.pullbar::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--axis); }

/* signals */
.sig { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; border-left: 4px solid var(--muted); }
.sig.long { border-left-color: var(--long); color: inherit; } .sig.short { border-left-color: var(--short); color: inherit; }
.sig .row { display: flex; gap: 14px; flex-wrap: wrap; font-variant-numeric: tabular-nums; font-size: 13px; margin: 4px 0; }
.sig .why { color: var(--ink-2); font-size: 12px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 10px; }
.stat { background: var(--surface-2); border-radius: 8px; padding: 7px 9px; }
.stat .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 18px; font-weight: 700; }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13px; }
.kv .k { color: var(--ink-2); } .kv .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.spark { width: 100%; height: 90px; }
.spark svg { width: 100%; height: 100%; overflow: visible; }

.cal { display: grid; grid-template-columns: 88px 42px 1fr; gap: 6px; font-size: 13px; padding: 4px 0; border-bottom: 1px solid var(--grid); }
.impact { font-size: 11px; font-weight: 700; }
.sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 4px 10px; font-size: 12px; }
.sources span { display: flex; align-items: center; gap: 5px; color: var(--ink-2); }
.notifier { margin-top: 12px; font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.tooltip { position: fixed; pointer-events: none; z-index: 20; background: var(--surface); color: var(--ink); border: 1px solid var(--border); box-shadow: 0 6px 22px rgba(0,0,0,.18); border-radius: 8px; padding: 7px 10px; font-size: 12px; display: none; max-width: 380px; }
:root { --dove: #2a78d6; --hold: #b8b6ae; --hawk: #e34948; }
:root[data-theme="dark"] { --dove: #3987e5; --hold: #5a5953; --hawk: #e66767; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) { --dove: #3987e5; --hold: #5a5953; --hawk: #e66767; } }
.pbar { display: flex; height: 10px; width: 120px; border-radius: 3px; overflow: hidden; gap: 1px; vertical-align: middle; }
.pbar i { display: block; height: 100%; }
.pcell { display: inline-flex; align-items: center; gap: 6px; }
.spark.tall { height: 150px; }
.dist { margin-bottom: 12px; }
.dist-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; margin-bottom: 4px; }
.dist svg { width: 100%; height: 70px; overflow: visible; }
.touch { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.recs { margin: 0; padding-left: 18px; font-size: 13px; }
.recs li { margin: 4px 0; }
.recs li.warn::marker { content: '⚠ '; }
a { color: var(--s-ema21); }
.foot { color: var(--muted); font-size: 12px; text-align: center; padding: 8px 0 20px; }
.struct-block { margin-bottom: 10px; font-size: 13px; }
.struct-block b { font-variant-numeric: tabular-nums; }

/* ---- live tape, tick flash, forecast overlay + panel ---------------------- */
:root { --s-fc: #b8860b; --s-fct: #7c6fd6; }
:root[data-theme="dark"] { --s-fc: #e0b43a; --s-fct: #9085e9; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) { --s-fc: #e0b43a; --s-fct: #9085e9; } }
.s-fc { background: var(--s-fc); } .s-fcc { background: color-mix(in srgb, var(--s-fc) 40%, transparent); outline: 1px solid var(--s-fc); } .s-fct { background: var(--s-fct); }
.fc-toggles label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.fc-toggles input { margin: 0 2px 0 0; }
#fcChartNote { font-variant-numeric: tabular-nums; }
.tape { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; flex-basis: 100%; order: 3; padding-top: 4px; }
.tape .tp b { font-weight: 600; color: var(--muted); }
.tape .tp.stale { opacity: .45; }
@keyframes tickUp { 0% { color: var(--long); } 100% { color: inherit; } }
@keyframes tickDown { 0% { color: var(--short); } 100% { color: inherit; } }
.price.tick-up { animation: tickUp .6s ease-out; }
.price.tick-down { animation: tickDown .6s ease-out; }
@media (prefers-reduced-motion: reduce) { .price.tick-up, .price.tick-down { animation: none; } }
.fc-status { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; align-items: center; }
.chip.regime-TREND_UP { color: var(--long-ink); } .chip.regime-TREND_DOWN { color: var(--short-ink); } .chip.regime-VOLATILE { color: var(--short-ink); font-weight: 700; }
tr.hl-row td { background: var(--surface-2); font-weight: 600; }

/* Price outlook (public/fan.js): forecast in gold, the model's past ranges in the "past forecasts" purple. */
.fan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; margin: 2px 0 12px; }
.fan-card { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--surface); font-size: 12.5px; line-height: 1.55; font-variant-numeric: tabular-nums; }
.fan-card-h { font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.fan-card-exp b { font-size: 17px; color: var(--ink); }
.fan-card-rng b, .fan-card-dir b { color: var(--ink); font-weight: 600; }
.fan-card-dir b.long { color: var(--long-ink); } .fan-card-dir b.short { color: var(--short-ink); } .fan-card-dir b.muted { color: var(--ink-2); }
.fan-ctx { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin: 0 0 10px; background: var(--surface-2); font-size: 12.5px; line-height: 1.5; }
.fan-ctx-h { margin-bottom: 6px; } .fan-ctx-h b { color: var(--ink); }
.fan-ctx-g { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px 14px; }
.fan-ctx-l { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.fan-ctx-v b { color: var(--ink); font-weight: 600; } .fan-ctx-v b.long { color: var(--long-ink); } .fan-ctx-v b.short { color: var(--short-ink); }
.fan-ctx-n { font-size: 12px; }
.fan-wrap { position: relative; }
.fan-svg { width: 100%; height: auto; display: block; }
.fan-grid { stroke: var(--grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.fan-tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.fan-now-lbl { fill: var(--ink-2); font-weight: 600; }
.fan-zone { fill: var(--muted); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.fan-b80 { fill: color-mix(in srgb, var(--s-fc) 24%, transparent); }
.fan-past { fill: color-mix(in srgb, var(--s-fct) 16%, transparent); }
.fan-price { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; }
.fan-med { fill: none; stroke: var(--s-fc); stroke-width: 2; stroke-dasharray: 5 4; }
.fan-now { stroke: var(--axis); stroke-width: 1; }
.fan-nowpt { fill: var(--ink); stroke: var(--surface); stroke-width: 2; }
.fan-end { fill: var(--ink-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.fan-end-med { fill: var(--ink); font-weight: 600; }
.fan-dir { font-size: 12px; font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.fan-dir.long { fill: var(--long-ink); } .fan-dir.short { fill: var(--short-ink); }
.fan-cross { stroke: var(--ink-2); stroke-width: 1; }
.fan-svg rect:focus { outline: none; }
.fan-svg rect:focus-visible { outline: 2px solid var(--s-fc); }
.fan-tip { position: absolute; z-index: 2; max-width: 340px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12); font-size: 12px; line-height: 1.5; pointer-events: none; }
.fan-tip div { white-space: nowrap; } .fan-tip span { color: var(--muted); } .fan-tip b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.fan-cap { margin-top: 4px; font-size: 12.5px; color: var(--ink-2); }
.fan-empty { padding: 36px 8px; text-align: center; }
.fan-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.fan-legend i { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.fan-legend .k80 { background: color-mix(in srgb, var(--s-fc) 30%, transparent); }
.fan-legend .kpast { background: color-mix(in srgb, var(--s-fct) 22%, transparent); }
.fan-legend .kmed { height: 0; border-top: 2px dashed var(--s-fc); border-radius: 0; vertical-align: 3px; }
.fan-legend .kprice { height: 2px; background: var(--ink); vertical-align: 3px; }
