/* spreadlab — tokens first; dark is its own selected palette, not a flip */
:root {
  color-scheme: light;
  --bg: #f4f3ef; --surface: #fcfcfb; --surface-2: #f0efec; --surface-3: #e6e5e0;
  --border: #e1e0da; --border-2: #cfcdc5;
  --ink: #0b0b0b; --ink-2: #52514e; --muted: #7a7974;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --pos: #0b7f0b; --neg: #c02f2f; --warn: #b07a00;
  --good: #0ca30c; --critical: #d03b3b; --warning: #fab219;
  --div-pos: #2a78d6; --div-neg: #e34948;
  --accent: #2a78d6; --accent-ink: #fff;
  --grid: rgba(0,0,0,.07); --axis: #7a7974;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
  --r: 12px; --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #111110; --surface: #1a1a19; --surface-2: #222220; --surface-3: #2c2c29;
    --border: #2c2c29; --border-2: #3a3a36;
    --ink: #f0efec; --ink-2: #c3c2b7; --muted: #8f8e86;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --pos: #3cc43c; --neg: #f06d6d; --warn: #fab219;
    --div-pos: #3987e5; --div-neg: #e66767;
    --accent: #3987e5; --accent-ink: #fff;
    --grid: rgba(255,255,255,.07); --axis: #8f8e86;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111110; --surface: #1a1a19; --surface-2: #222220; --surface-3: #2c2c29;
  --border: #2c2c29; --border-2: #3a3a36;
  --ink: #f0efec; --ink-2: #c3c2b7; --muted: #8f8e86;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --pos: #3cc43c; --neg: #f06d6d; --warn: #fab219;
  --div-pos: #3987e5; --div-neg: #e66767;
  --accent: #3987e5; --accent-ink: #fff;
  --grid: rgba(255,255,255,.07); --axis: #8f8e86;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.num, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- shell */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); }
.top-in { max-width: 1320px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 18px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.2px; white-space: nowrap; }
.brand svg { width: 22px; height: 22px; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav a { padding: 8px 9px; border-radius: 8px; font-size: 14px; color: var(--ink-2); text-decoration: none; white-space: nowrap; font-weight: 500; }
.nav a:hover { background: var(--surface-2); }
.nav a.on { background: var(--surface-3); color: var(--ink); }
.top-right { display: flex; align-items: center; gap: 8px; white-space: nowrap; margin-left: auto; }
.feeds { display: flex; gap: 4px; }
.feed { width: 8px; height: 8px; border-radius: 50%; background: var(--critical); }
.feed.ok { background: var(--good); }
.real-flag { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--critical); color: #fff; }
main { max-width: 1320px; margin: 0 auto; padding: 20px 16px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -.3px; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); max-width: 760px; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------------------------------------------------------------- building blocks */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { margin: 0 0 4px; font-size: 15px; }
.card h2 + .sub { margin: 0 0 12px; color: var(--muted); font-size: 12.5px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.stack > * + * { margin-top: 14px; }

.tile { padding: 14px 16px; }
.tile .k { color: var(--muted); font-size: 12px; font-weight: 500; }
.tile .v { font-size: 26px; font-weight: 650; letter-spacing: -.5px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .s { color: var(--ink-2); font-size: 12px; margin-top: 2px; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-2); background: var(--surface); padding: 7px 13px;
  border-radius: 9px; cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--neg); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; border-radius: 7px; }
.btn.ghost { border-color: transparent; background: none; }
.btn:disabled { opacity: .5; cursor: default; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 2px; }
.seg button { border: 0; background: none; padding: 5px 11px; border-radius: 7px; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
select, input[type=text], input[type=password], input[type=url], input:not([type]), textarea {
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 9px; padding: 7px 10px; min-width: 0; }
select:focus, input:focus, textarea:focus, .btn:focus-visible, .seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
label.f small { color: var(--muted); font-weight: 400; }
label.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.badge.paper { background: color-mix(in srgb, var(--s1) 16%, transparent); color: var(--s1); }
.badge.demo { background: color-mix(in srgb, var(--s4) 20%, transparent); color: var(--warn); }
.badge.real { background: var(--critical); color: #fff; }
.badge.ok { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--pos); }
.badge.bad { background: color-mix(in srgb, var(--critical) 16%, transparent); color: var(--neg); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.help { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; border: 1px solid var(--border-2); color: var(--muted);
  font-size: 11px; font-weight: 700; cursor: help; vertical-align: 1px; margin-left: 4px; }

table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 7px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.t td.num, .t td.r { white-space: nowrap; }
.t td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t .r { text-align: right; }
.t tbody tr.click { cursor: pointer; }
.t tbody tr.click:hover td { background: var(--surface-2); }
.scroll { overflow-x: auto; }
.empty { padding: 26px; text-align: center; color: var(--muted); }

/* ---------------------------------------------------------------- charts */
.chart { width: 100%; height: 300px; }
.chart.sm { height: 180px; }
.chart.xs { height: 64px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); margin: 2px 0 6px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: 3px; }
.legend i.box { height: 10px; width: 10px; vertical-align: -1px; }
.u-legend { display: none; }
.uplot { font-family: var(--font); }
.tip { position: absolute; pointer-events: none; z-index: 5; background: var(--surface); border: 1px solid var(--border-2); border-radius: 8px;
  padding: 7px 9px; font-size: 12px; box-shadow: var(--shadow); white-space: nowrap; display: none; }
.tip .t { color: var(--muted); margin-bottom: 3px; }
.tip .row { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.tip .row b { font-weight: 600; font-variant-numeric: tabular-nums; margin-left: 12px; }

/* ---------------------------------------------------------------- page specifics */
.verdict { font-size: 15px; line-height: 1.5; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); margin-bottom: 10px; }
.verdict b { font-weight: 650; }
.gapnow { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.gapnow .big { font-size: 28px; font-weight: 650; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.ideas { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.idea { display: flex; flex-direction: column; gap: 10px; }
.idea .rule { font-size: 14px; line-height: 1.5; }
.idea .money { display: flex; align-items: baseline; gap: 8px; }
.idea .money .v { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.4px; }
.idea .facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; font-size: 12px; color: var(--ink-2); }
.idea .facts b { display: block; color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; }
.idea .acts { display: flex; gap: 8px; margin-top: auto; }
.strats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
.strat .head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.strat .name { font-weight: 650; font-size: 15px; }
.strat .desc { color: var(--ink-2); font-size: 12.5px; margin: 6px 0 10px; line-height: 1.45; }
.strat .nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.strat .nums .k { color: var(--muted); font-size: 11.5px; }
.strat .nums .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.strat .posbox { margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font-size: 12.5px; }
.strat .posline { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 6px; }
.strat .halt { margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--critical) 14%, transparent); color: var(--neg); font-size: 12.5px; }
.strat .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.feedlist { display: flex; flex-direction: column; }
.feedlist .e { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; align-items: baseline; }
.feedlist .e:last-child { border-bottom: 0; }
.feedlist .e .when { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }

/* ---------------------------------------------------------------- dialogs, toasts */
dialog { border: 1px solid var(--border-2); border-radius: 14px; padding: 0; background: var(--surface); color: var(--ink); width: min(880px, calc(100vw - 24px));
  max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(0,0,0,.5); backdrop-filter: blur(2px); }
dialog .dh { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
dialog .dh h2 { margin: 0; font-size: 17px; }
dialog .db { padding: 16px 20px; }
dialog .df { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--surface); }
.types { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 14px; }
.type { text-align: left; border: 1px solid var(--border-2); background: var(--surface); border-radius: 10px; padding: 9px 11px; cursor: pointer; }
.type b { display: block; margin-bottom: 2px; }
.type span { font-size: 11.5px; color: var(--muted); line-height: 1.35; display: block; }
.type.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 14px; }
.form .full { grid-column: 1 / -1; }
.preview { padding: 10px 12px; border-radius: 9px; background: var(--surface-2); font-size: 13.5px; line-height: 1.5; margin: 14px 0 4px; }
.err { color: var(--neg); font-size: 13px; min-height: 18px; }
.note { padding: 10px 12px; border-radius: 9px; background: var(--surface-2); font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.note.warn { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--ink); }
details > summary { cursor: pointer; font-weight: 600; margin: 4px 0; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 10px; font-size: 13px; max-width: 380px; box-shadow: var(--shadow); }
.toast.bad { background: var(--critical); color: #fff; }
.secret { font-family: var(--mono); font-size: 12.5px; padding: 10px; border-radius: 8px; background: var(--surface-2); word-break: break-all; user-select: all; }
pre.code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); padding: 10px 12px; border-radius: 8px; overflow-x: auto; margin: 6px 0; }
.gloss dt { font-weight: 650; margin-top: 10px; }
.gloss dd { margin: 2px 0 0; color: var(--ink-2); }

/* ---------------------------------------------------------------- login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: min(380px, 100%); }
.login h1 { font-size: 20px; margin: 10px 0 4px; }
.login form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.login input { width: 100%; padding: 10px 12px; }
.login .btn { justify-content: center; padding: 10px; }

@media (max-width: 1000px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .top-in { flex-wrap: wrap; gap: 8px; padding-top: 8px; }
  .nav { order: 3; flex-basis: 100%; }
  .ideas, .strats { grid-template-columns: minmax(0, 1fr); }
  .strat .nums { grid-template-columns: repeat(2, 1fr); }
  .chart { height: 240px; }
  .tile .v { font-size: 22px; }
}
@media (forced-colors: active) { .feed, .dot, .legend i { forced-color-adjust: none; } }

/* ---------------------------------------------------------------- v2: filters, matrix, activity */
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; padding: 12px 14px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.badge.warn { background: color-mix(in srgb, var(--warning) 22%, transparent); color: var(--warn); }
.maptab { border-collapse: separate; border-spacing: 3px; font-size: 12px; width: 100%; }
.maptab th { color: var(--muted); font-weight: 500; padding: 4px 6px; white-space: nowrap; }
.mcell { text-align: center; padding: 6px 4px; border-radius: 6px; cursor: pointer; font-variant-numeric: tabular-nums; min-width: 66px; }
.mcell b { display: block; font-size: 13px; }
.mcell small { color: var(--ink-2); font-size: 10.5px; }
.mcell:hover { outline: 2px solid var(--accent); }
.mcell.thin { opacity: .5; }
.mcell.empty { background: var(--surface-2); color: var(--muted); cursor: default; }
.mcell.empty:hover { outline: 0; }
.activity { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.activity .a { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 12.5px; }
.activity .a b { display: block; font-size: 13.5px; margin-bottom: 4px; }
.activity .a .row { display: flex; justify-content: space-between; gap: 8px; color: var(--ink-2); }
.activity .a .row span:last-child { color: var(--ink); font-variant-numeric: tabular-nums; }
@media (max-width: 1000px) { .activity { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .mcell { min-width: 48px; } .maptab { font-size: 11px; } }

/* ---------------------------------------------------------------- pro chart */
.pc { outline: none; }
.pc:fullscreen { background: var(--bg); padding: 14px; overflow: auto; }
.pc-bar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-bottom: 8px; }
.pc-bar .seg button { padding: 4px 10px; font-size: 12.5px; }
.pc-bar label.check { font-size: 12.5px; color: var(--ink-2); gap: 5px; }
.pc-bar select { padding: 4px 8px; font-size: 12.5px; }
.pc-bar .btn.sm { min-width: 30px; justify-content: center; }
.pc-legend { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 12.5px; min-height: 36px; align-items: center; padding: 6px 10px;
  background: var(--surface-2); border-radius: 8px; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.pc-legend b { font-weight: 650; }
.pc-plot { position: relative; user-select: none; }
.pc-spread { border-top: 1px dashed var(--border); margin-top: 2px; }
.pc-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-2); margin-top: 6px; }
.pc-ruler { position: absolute; inset: 0; pointer-events: none; }
.pc-ruler .box { position: absolute; background: color-mix(in srgb, var(--good) 14%, transparent); border: 1px solid var(--good); border-radius: 2px; }
.pc-ruler.down .box { background: color-mix(in srgb, var(--critical) 14%, transparent); border-color: var(--critical); }
.pc-ruler .lbl { position: absolute; background: var(--surface); border: 1px solid var(--border-2); border-radius: 8px; padding: 6px 9px;
  font-size: 12px; line-height: 1.45; box-shadow: var(--shadow); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pc-live.primary { animation: none; }
@media (max-width: 700px) { .pc-presets { order: 10; } .pc-foot .muted { display: none; } }

/* ---------------------------------------------------------------- ideas table, autopilot, trainer */
.ideas-t td, .ideas-t th { padding: 9px 10px; }
.ideas-t .big { font-size: 15px; }
.ideas-t th.sortable { cursor: pointer; user-select: none; }
.ideas-t tr.detail td { background: var(--surface-2); }
.nowrap { white-space: nowrap; }
.vmark { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--muted); }
.vmark.ok { background: color-mix(in srgb, var(--good) 22%, transparent); color: var(--pos); }
.vmark.warn { background: color-mix(in srgb, var(--warning) 22%, transparent); color: var(--warn); }
.warnmark { color: var(--warn); cursor: help; }
.confbar { display: inline-block; width: 46px; height: 6px; border-radius: 3px; background: var(--surface-3); margin-right: 6px; vertical-align: 1px; overflow: hidden; }
.confbar i { display: block; height: 100%; border-radius: 3px; }
.dgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 16px; }
.dgrid .k { font-size: 11.5px; color: var(--muted); }
.dgrid .v { font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.dgrid .s { font-size: 11.5px; color: var(--ink-2); margin-top: 2px; }
.notes { max-height: 640px; overflow-y: auto; }
.note-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; align-items: start; }
.note-row:last-child { border-bottom: 0; }
.note-row .ni { font-weight: 700; text-align: center; }
.note-row .nt { font-size: 11.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.nowpos { display: flex; gap: 8px; align-items: baseline; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); margin-bottom: 6px; font-size: 13px; }
.quizq { padding: 10px 12px; border-radius: 9px; background: var(--surface-2); margin-bottom: 10px; }
.quizbtns { display: flex; gap: 10px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.big-btn { font-size: 16px; padding: 10px 22px; min-width: 150px; justify-content: center; }
.big-btn.pos { color: var(--pos); border-color: color-mix(in srgb, var(--good) 50%, transparent); }
.big-btn.neg { color: var(--neg); border-color: color-mix(in srgb, var(--critical) 50%, transparent); }
.big-btn.chosen { outline: 2px solid var(--accent); }

/* ---------------------------------------------------------------- tickets: what to place on the exchange */
.tickets { display: flex; flex-direction: column; gap: 10px; }
.ticket { border: 1px solid var(--border-2); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); }
.ticket .th { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 14px; }
.ticket .tpnl { margin-left: auto; font-size: 16px; font-variant-numeric: tabular-nums; }
.ticket .ttime { font-variant-numeric: tabular-nums; font-size: 12px; }
.tgrid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 10px 0 6px; }
.tgrid .k { font-size: 11.5px; color: var(--muted); }
.tgrid .v { font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tgrid .s { font-size: 11.5px; color: var(--ink-2); }
.tspark { width: 100%; height: 90px; display: block; }
.tsteps summary { font-size: 13px; color: var(--accent); }
.tsteps ol { margin: 6px 0; padding-left: 20px; font-size: 13px; line-height: 1.7; }
@media (max-width: 700px) { .tgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------------------------------------------------------------- radar */
.radar { display: flex; flex-direction: column; gap: 10px; }
.rrow { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.rhead { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13.5px; }
.rhead .rstate { margin-left: auto; font-size: 13px; }
.rbar { position: relative; height: 22px; border-radius: 6px; background: var(--surface-3); margin: 8px 0 6px; overflow: hidden; }
.rbar i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 6px; transition: width .4s ease, background .4s; opacity: .55; }
.rbar span { position: relative; z-index: 1; font-size: 12px; line-height: 22px; padding-left: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rmeta { margin-top: 2px; line-height: 1.5; }
.warn { color: var(--warn); }
.tacts { display: flex; justify-content: flex-end; margin-top: 6px; }
.strat.auto { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }

.ladder { margin-top: 12px; display: grid; gap: 6px; }
.lad { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.lad > div { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.lad > div.best { border-color: var(--good); box-shadow: inset 0 0 0 1px var(--good); }
.lad > div.off { opacity: .45; }
.lad .k { font-size: 11.5px; color: var(--muted); }
.lad .v { font-weight: 650; font-variant-numeric: tabular-nums; }
.lad .s { font-size: 11px; color: var(--ink-2); }
@media (max-width: 700px) { .lad { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.lead-t tr.lead-go td { background: color-mix(in srgb, var(--good) 14%, transparent); }
.delay-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin: 8px 0; }
.delay-strip > div { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.delay-strip > div.me { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.delay-strip .k { font-size: 11.5px; color: var(--muted); }
.delay-strip .v { font-weight: 650; font-variant-numeric: tabular-nums; }
.delay-strip .s { font-size: 11px; color: var(--ink-2); }
@media (max-width: 700px) { .delay-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.bet { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; background: var(--surface); }
.bet-h { display: grid; grid-template-columns: 28px 120px minmax(0, 1.6fr) repeat(4, minmax(0, 1fr)); gap: 12px; align-items: center; padding: 10px 12px; cursor: pointer; }
.bet-h:hover { background: var(--surface-2); }
.bet-n { color: var(--muted); font-variant-numeric: tabular-nums; }
.bet-coin b { font-size: 17px; display: block; }
.bet-legs { font-size: 13px; line-height: 1.6; }
.bet-num { text-align: right; font-variant-numeric: tabular-nums; }
.bet-num .big { font-size: 18px; font-weight: 700; }
.bet-body { display: none; padding: 0 12px 12px 52px; }
.bet.open .bet-body { display: block; }
.bet.open { border-color: var(--accent); }
.steps { margin: 4px 0 8px; padding-left: 18px; line-height: 1.7; }
@media (max-width: 900px) {
  .bet-h { grid-template-columns: 24px 1fr 1fr; }
  .bet-legs { grid-column: 1 / -1; }
  .bet-body { padding-left: 12px; }
}

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.plan { border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: grid; gap: 4px; }
.plan .k { color: var(--muted); font-size: 13px; }
.plan .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.plan .s { font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.reflink { display: flex; gap: 8px; align-items: center; }
.reflink input { flex: 1; min-width: 0; }

@media (max-width: 1400px) { .top-in { flex-wrap: wrap; row-gap: 0; } .nav { order: 3; flex-basis: 100%; } }

.chat-staff { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 12px; }
.inbox { padding: 6px; max-height: 70vh; overflow: auto; }
.thread { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.thread:hover { background: var(--surface-2); }
.thread.on { background: var(--surface-3); }
.thread .th { display: flex; gap: 6px; align-items: center; }
.thread .th .muted { margin-left: auto; }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat { display: flex; flex-direction: column; min-height: 60vh; }
.chat-head { display: flex; gap: 8px; align-items: center; padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.chat-head .btn { margin-left: auto; }
.msgs { flex: 1; overflow: auto; max-height: 60vh; display: flex; flex-direction: column; gap: 8px; padding: 4px; }
.msg { max-width: 75%; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); align-self: flex-start; }
.msg.mine { align-self: flex-end; background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.msg.sys { align-self: center; background: transparent; border: 1px dashed var(--border); font-size: 13px; color: var(--ink-2); }
.msg .mt { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.msg .mb { white-space: pre-wrap; word-break: break-word; }
.send { display: flex; gap: 8px; margin-top: 8px; }
.send textarea { flex: 1; resize: vertical; }
.nbadge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--critical); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; margin-left: 4px; }
.paymethods { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin: 10px 0; }
.paymethods button { text-align: left; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
.paymethods button.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.payqr { max-width: 220px; border-radius: 8px; background: #fff; padding: 6px; display: block; margin: 8px 0; }
.method-edit { border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
@media (max-width: 800px) { .chat-staff { grid-template-columns: 1fr; } .msg { max-width: 92%; } }

.nav { align-items: center; }
.nav-group { display: flex; gap: 2px; }
.nav-service { margin-left: 10px; padding-left: 10px; border-left: 1px solid var(--border); }
.nbadge.warn { background: var(--warning); color: #000; }
.umenu { position: relative; }
.umenu-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 50; display: grid; }
.umenu-pop.hidden { display: none; }
.umenu-head { padding: 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.umenu-pop a, .umenu-pop button { text-align: left; padding: 8px 10px; border-radius: 8px; background: none; border: 0; color: var(--ink); text-decoration: none; cursor: pointer; font-size: 14px; }
.umenu-pop a:hover, .umenu-pop button:hover { background: var(--surface-2); }
.umenu-pop .danger { color: var(--critical); }
section .card > h2.fold { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 8px; }
section .card > h2.fold::after { content: '▾'; font-size: 12px; color: var(--muted); margin-left: auto; transition: transform .15s; }
section .card.folded > h2.fold::after { transform: rotate(-90deg); }
section .card.folded > :not(h2) { display: none !important; }
section .card.folded > h2 { margin-bottom: 0; }

.sig-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; margin-bottom: 10px; }
.sig { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; border-left: 4px solid var(--good); }
.sig.short { border-left-color: var(--critical); }
.sig-h { display: flex; gap: 8px; align-items: baseline; font-size: 16px; flex-wrap: wrap; }
.sig-h b { white-space: nowrap; }
.sig-h .badge { margin-left: auto; }
.sig-n { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.sig-n .k { font-size: 11px; color: var(--muted); }
.xchips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.xchip { border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: 13px; font-variant-numeric: tabular-nums; }
.xchip.hot { border-color: var(--warning); background: color-mix(in srgb, var(--warning) 14%, transparent); }

/* the header's right side waits for the account to be known (the menu itself is built by the page script) */
body:not([data-role]) .top-right { visibility: hidden; }

/* ---------------------------------------------------------------- public demo */
body.demo { background: var(--bg); }
.demo-top .brand { color: var(--ink); text-decoration: none; }
.demo-top { max-width: 1100px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; }
.demo-actions { display: flex; gap: 8px; }
.demo-main { max-width: 1100px; margin: 0 auto; padding: 8px 16px 48px; }
.demo-hero h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.1; letter-spacing: -.5px; margin: 16px 0 10px; }
.demo-hero p { color: var(--ink-2); font-size: 17px; max-width: 760px; line-height: 1.5; }
.demo-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 22px 0; }
.demo-stats div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.demo-stats b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.demo-stats span { font-size: 13px; color: var(--muted); }
.demo-task { margin-bottom: 18px; }
.demo-task-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; font-size: 18px; }
.demo-q { line-height: 1.6; margin-bottom: 10px; }
.demo-task canvas { width: 100%; height: 300px; display: block; margin-bottom: 12px; }
.demo-btns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.demo-btns .btn { font-size: 17px; padding: 14px; }
.demo-btns .btn.chosen { outline: 2px solid var(--accent); }
.demo-res { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0 10px; }
.demo-res div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.demo-res span { display: block; font-size: 12px; color: var(--muted); }
.demo-res b { font-size: 18px; }
.demo-odds { line-height: 1.6; margin-bottom: 6px; }
.demo-next { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.demo-why { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 26px; }
.demo-why b { font-size: 16px; }
.demo-why p { font-size: 14px; color: var(--ink-2); margin-top: 6px; line-height: 1.45; }
.demo-cta { text-align: center; padding: 26px 0 8px; }
.demo-cta h2 { font-size: 26px; margin-bottom: 6px; }
.demo-big { margin-top: 14px; font-size: 18px; padding: 14px 30px; }
.demo-disc { text-align: center; margin-top: 18px; }
@media (max-width: 800px) {
  .demo-stats, .demo-why { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .demo-res { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- public topic pages */
.seo-crumbs { margin-top: 8px; }
.seo-crumbs a { color: var(--muted); }
.seo-sec { margin: 26px 0; }
.seo-sec h2 { font-size: 24px; margin-bottom: 10px; letter-spacing: -.2px; }
.seo-sec p, .seo-list { color: var(--ink-2); font-size: 16px; line-height: 1.6; max-width: 820px; }
.seo-list { padding-left: 20px; display: grid; gap: 8px; }
.seo-sec a { color: var(--accent); }
.seo-faq { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; background: var(--surface); }
.seo-faq summary { cursor: pointer; font-weight: 600; }
.seo-faq p { margin-top: 8px; }
.seo-gloss { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin: 18px 0; }
.seo-gloss div { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface); }
.seo-gloss dt { font-weight: 700; margin-bottom: 4px; }
.seo-gloss dd { margin: 0; color: var(--ink-2); line-height: 1.5; font-size: 15px; }
.seo-related { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.seo-related a { text-decoration: none; color: var(--ink); display: grid; gap: 6px; }
.seo-related a span { font-size: 13px; color: var(--muted); line-height: 1.45; }
.seo-related a:hover { border-color: var(--accent); }
.seo-foot { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; border-top: 1px solid var(--border); display: grid; gap: 10px; }
.seo-nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.seo-nav a { color: var(--ink-2); text-decoration: none; font-size: 14px; }
.seo-nav a[aria-current] { color: var(--ink); font-weight: 600; }
