/* TRADIUM — "an exceptionally precise market instrument".
   One token set, two themes. 4 px spacing grid. Tabular numerals for every market value.
   Hierarchy comes from type, alignment and surface steps — not from colour, glow or boxes.
   Rules: 12 px is the absolute floor; one accent (jade); up/down always paired with a sign or arrow. */
@font-face {
  font-family: "Inter Var";
  src: url("/ui/fonts/inter-variable.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
:root {
  --font: "Inter Var", "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  /* type scale: metadata · dense values · controls · body · section · page */
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 18px; --fs-2xl: 22px; --fs-3xl: 26px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
  --r1: 4px; --r2: 6px; --r3: 8px;
  --top: 52px; --rail-l: 232px; --rail-r: 320px;
  --row: 40px; --card-pad: 10px;
  /* motion: feedback · standard · contextual drawers. Enter eases out; exit is shorter and eases in. */
  --dur-1: 110ms; --dur-2: 180ms; --dur-3: 240ms;
  --ease-out: cubic-bezier(.16,1,.3,1); --ease-in: cubic-bezier(.5,0,.75,0);
  --t-fast: var(--dur-1); --t-mid: var(--dur-2); --t-slow: var(--dur-3); --ease: var(--ease-out);
  /* layers */
  --z-sticky: 10; --z-rail: 20; --z-header: 30; --z-pop: 40; --z-drawer: 50; --z-dialog: 60; --z-toast: 70;
  color-scheme: dark;
  --bg: #0a0c0d; --bg-1: #101315; --bg-2: #161a1c; --bg-3: #1c2124; --bg-4: #232a2e;
  --line: #222a2e; --line-2: #2e373c;
  --tx: #e9ecea; --tx-2: #a9b1ad; --tx-3: #8d9691;
  --acc: #5cbc8b; --acc-hi: #74cfa0; --acc-ink: #04110a; --acc-weak: rgba(92,188,139,.13);
  --up: #43bd7e; --down: #e8644f; --up-weak: rgba(67,189,126,.14); --down-weak: rgba(232,100,79,.14);
  --warn: #d9a63f; --warn-weak: rgba(217,166,63,.14); --info: #7ea9c9; --info-weak: rgba(126,169,201,.14);
  --focus: #9fd9bb; --shadow: 0 8px 28px rgba(0,0,0,.45);
  --e1: 0 1px 0 rgba(255,255,255,.03) inset, 0 1px 2px rgba(0,0,0,.35); --e2: 0 10px 30px rgba(0,0,0,.5), 0 0 0 1px var(--line-2); --e3: 0 24px 60px rgba(0,0,0,.6), 0 0 0 1px var(--line-2);
  --scrim: rgba(3,5,6,.55); --tint-up: rgba(67,189,126,.20); --tint-down: rgba(232,100,79,.20);
  --chart-grid: #1a2023; --chart-text: #8d9691; --series-2: #7ea9c9; --series-3: #c9a46e;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f1f0ec; --bg-1: #f9f8f5; --bg-2: #ffffff; --bg-3: #ecebe6; --bg-4: #e2e0d9;
  --line: #dcd9d0; --line-2: #c9c5bb;
  --tx: #15181a; --tx-2: #464d49; --tx-3: #5c635f;
  --acc: #1d7a4e; --acc-hi: #16683f; --acc-ink: #ffffff; --acc-weak: rgba(29,122,78,.10);
  --up: #13703f; --down: #b3341f; --up-weak: rgba(19,112,63,.10); --down-weak: rgba(179,52,31,.10);
  --warn: #8a5a00; --warn-weak: rgba(138,90,0,.10); --info: #2d5f86; --info-weak: rgba(45,95,134,.10);
  --focus: #1d7a4e; --shadow: 0 8px 28px rgba(40,36,28,.16);
  --e1: 0 1px 2px rgba(40,36,28,.08); --e2: 0 10px 30px rgba(40,36,28,.16), 0 0 0 1px var(--line); --e3: 0 24px 60px rgba(40,36,28,.22), 0 0 0 1px var(--line);
  --scrim: rgba(30,28,24,.35); --tint-up: rgba(19,112,63,.16); --tint-down: rgba(179,52,31,.16);
  --chart-grid: #e7e4dc; --chart-text: #5c635f; --series-2: #2d5f86; --series-3: #8a5a00;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f1f0ec; --bg-1: #f9f8f5; --bg-2: #ffffff; --bg-3: #ecebe6; --bg-4: #e2e0d9;
    --line: #dcd9d0; --line-2: #c9c5bb;
    --tx: #15181a; --tx-2: #464d49; --tx-3: #5c635f;
    --acc: #1d7a4e; --acc-hi: #16683f; --acc-ink: #ffffff; --acc-weak: rgba(29,122,78,.10);
    --up: #13703f; --down: #b3341f; --up-weak: rgba(19,112,63,.10); --down-weak: rgba(179,52,31,.10);
    --warn: #8a5a00; --warn-weak: rgba(138,90,0,.10); --info: #2d5f86; --info-weak: rgba(45,95,134,.10);
    --focus: #1d7a4e; --shadow: 0 8px 28px rgba(40,36,28,.16);
  --e1: 0 1px 2px rgba(40,36,28,.08); --e2: 0 10px 30px rgba(40,36,28,.16), 0 0 0 1px var(--line); --e3: 0 24px 60px rgba(40,36,28,.22), 0 0 0 1px var(--line);
  --scrim: rgba(30,28,24,.35); --tint-up: rgba(19,112,63,.16); --tint-down: rgba(179,52,31,.16);
    --chart-grid: #e7e4dc; --chart-text: #5c635f; --series-2: #2d5f86; --series-3: #8a5a00;
  }
}
:root[data-density="comfortable"] { --row: 48px; --card-pad: 14px; }
:root[data-motion="low"] { --t-fast: 0ms; --t-mid: 0ms; --t-slow: 0ms; }
@media (prefers-reduced-motion: reduce) { :root { --t-fast: 0ms; --t-mid: 0ms; --t-slow: 0ms; } }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--tx); font: 400 var(--fs-md)/1.4 var(--font); font-feature-settings: "cv05" 1, "calt" 1; -webkit-font-smoothing: antialiased; overflow: hidden; }
/* thin, quiet scrollbars: one visual weight everywhere */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; } ::-webkit-scrollbar-track { background: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-radius: var(--r1); }
.num, .tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: -.01em; }
.muted { color: var(--tx-2); } .faint { color: var(--tx-3); }
/* Live data labels: partial coverage (decoded trades from our own stream) and provisional (processed, unconfirmed) values. */
.part { text-decoration: underline dotted var(--tx-3); text-underline-offset: 3px; }
.prov { font-style: italic; opacity: .85; }

.up { color: var(--up); } .down { color: var(--down); } .warn { color: var(--warn); }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -40px; z-index: 100; background: var(--acc); color: var(--acc-ink); padding: 8px 12px; border-radius: var(--r1); }
.skip:focus { top: 8px; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: var(--fs-xl); } h2 { font-size: var(--fs-lg); } h3 { font-size: var(--fs-md); }
p { margin: 0; }

/* ----------------------------------------------------------------- shell */
.app { display: grid; grid-template-rows: var(--top) 1fr; grid-template-columns: auto 1fr auto; grid-template-areas: "top top top" "left main right"; height: 100vh; height: 100dvh; }
.top { grid-area: top; display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s3); background: var(--bg-1); border-bottom: 1px solid var(--line); min-width: 0; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .14em; font-size: 13px; color: var(--tx); text-decoration: none; flex: none; }
.brand:hover { text-decoration: none; }
.brand svg { width: 22px; height: 22px; }
.nav { display: flex; align-items: stretch; height: 100%; gap: 2px; min-width: 0; position: relative; }
.nav a, .nav button.navbtn { display: flex; align-items: center; padding: 0 10px; color: var(--tx-2); font-weight: 500; font-size: var(--fs-md); border: 0; background: none; cursor: pointer; white-space: nowrap; text-decoration: none; position: relative; }
.nav a:hover, .nav button.navbtn:hover { color: var(--tx); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--tx); }
.nav .ind { position: absolute; bottom: -1px; height: 2px; background: var(--acc); border-radius: 2px; transition: transform var(--t-mid) var(--ease), width var(--t-mid) var(--ease); left: 0; width: 0; pointer-events: none; }
.search { flex: 1 1 200px; max-width: 360px; min-width: 120px; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r2); color: var(--tx-3); cursor: text; }
.search:hover { border-color: var(--line-2); }
.search span.label { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
svg.i { width: 16px; height: 16px; flex: none; }
.chip svg.i, .copy svg.i, .nav svg.i { width: 12px; height: 12px; }
.nav button.navbtn svg.i { margin-left: 4px; }
kbd { white-space: nowrap; font: 500 12px/1 var(--mono); padding: 3px 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; color: var(--tx-2); background: var(--bg-1); }
.status { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .02em; border: 1px solid var(--line-2); color: var(--tx-2); background: var(--bg-2); white-space: nowrap; }
.pill.paper { color: var(--acc); border-color: color-mix(in srgb, var(--acc) 45%, transparent); background: var(--acc-weak); }
.pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: var(--warn-weak); }
.pill.bad { color: var(--down); border-color: color-mix(in srgb, var(--down) 45%, transparent); background: var(--down-weak); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tx-3); flex: none; }
.dot.ok { background: var(--up); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--down); }
.iconbtn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r2); border: 1px solid transparent; background: none; color: var(--tx-2); cursor: pointer; flex: none; }
.iconbtn:hover { background: var(--bg-3); color: var(--tx); }
.iconbtn svg { width: 16px; height: 16px; }
.iconbtn[aria-pressed="true"] { color: var(--acc); }

.left { grid-area: left; width: var(--rail-l); background: var(--bg-1); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; transition: width var(--t-slow) var(--ease); overflow: hidden; }
.app[data-left="collapsed"] .left { width: 44px; }
.app[data-left="collapsed"] .left .rail-body, .app[data-left="collapsed"] .left .rail-title { display: none; }
.right { grid-area: right; width: var(--rail-r); background: var(--bg-1); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.app[data-right="collapsed"] .right { display: none; }
.app[data-right="auto"]:not([data-ws="trenches"]) .right { display: none; }
/* Trenches shows the rail automatically only when the three columns keep a usable width. */
@media (max-width: 1599px) { .app[data-right="auto"] .right { display: none; } }
.rail-head { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 6px 0 10px; border-bottom: 1px solid var(--line); flex: none; }
.rail-title { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--tx-3); flex: 1; }
.rail-body { overflow: auto; flex: 1; min-height: 0; }
.rail-sec { padding: 8px 0; border-bottom: 1px solid var(--line); }
.rail-sec > h3 { font-size: var(--fs-xs); color: var(--tx-3); text-transform: uppercase; letter-spacing: .08em; padding: 2px 10px 6px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.rail-item { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 8px; padding: 5px 10px; min-height: 34px; cursor: pointer; color: var(--tx); border: 0; background: none; width: 100%; text-align: left; }
.rail-item:hover { background: var(--bg-3); }
.rail-item .t { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: var(--fs-sm); }
.rail-item .v { text-align: right; font-size: var(--fs-xs); }
main { grid-area: main; min-width: 0; min-height: 0; overflow: auto; position: relative; background: var(--bg); }
main:focus { outline: none; }
main.fixed { overflow: hidden; display: flex; flex-direction: column; }

/* ----------------------------------------------------------------- generic */
.bar { display: flex; align-items: center; gap: var(--s2); padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--bg-1); flex-wrap: wrap; min-height: 48px; }
.bar.sticky { position: sticky; top: 0; z-index: 5; }
.bar h1 { font-size: var(--fs-lg); margin-right: 4px; }
.spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: var(--r2); border: 1px solid var(--line-2); background: var(--bg-2); color: var(--tx); font-weight: 500; font-size: var(--fs-sm); cursor: pointer; white-space: nowrap; transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.btn:hover { background: var(--bg-3); border-color: var(--tx-3); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); font-weight: 600; }
.btn.primary:hover { background: var(--acc-hi); }
.btn.buy { background: var(--up); color: #fff; border-color: var(--up); font-weight: 600; }
.btn.sell { background: var(--down); color: #fff; border-color: var(--down); font-weight: 600; }
:root[data-theme="dark"] .btn.buy, :root:not([data-theme]) .btn.buy { color: #04110a; }
.btn.ghost { background: none; border-color: transparent; color: var(--tx-2); }
.btn.ghost:hover { background: var(--bg-3); color: var(--tx); }
.btn.danger { color: var(--down); border-color: color-mix(in srgb, var(--down) 45%, transparent); background: none; }
.btn.sm { height: 26px; padding: 0 8px; font-size: var(--fs-xs); }
.btn svg { width: 14px; height: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r2); overflow: hidden; background: var(--bg-2); flex: none; }
.seg button { height: 28px; padding: 0 9px; border: 0; background: none; color: var(--tx-2); cursor: pointer; font-size: var(--fs-xs); font-weight: 600; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--tx); background: var(--bg-3); }
.seg button[aria-pressed="true"] { color: var(--tx); background: var(--bg-4); box-shadow: inset 0 -2px 0 var(--acc); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.input, select.input { height: 30px; padding: 0 8px; border-radius: var(--r2); border: 1px solid var(--line-2); background: var(--bg-2); color: var(--tx); min-width: 0; }
.input:hover { border-color: var(--tx-3); }
.input::placeholder { color: var(--tx-3); }
.field { display: grid; gap: 4px; font-size: var(--fs-xs); color: var(--tx-2); }
.field .hint { color: var(--tx-3); }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 4px 0 8px; border-radius: 999px; background: var(--acc-weak); color: var(--tx); font-size: var(--fs-xs); border: 1px solid color-mix(in srgb, var(--acc) 35%, transparent); }
.chip button { border: 0; background: none; color: var(--tx-2); cursor: pointer; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; }
.chip button:hover { background: var(--bg-3); color: var(--tx); }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px; border-radius: var(--r1); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .02em; background: var(--bg-3); color: var(--tx-2); white-space: nowrap; border: 1px solid transparent; }
.badge.ok { background: var(--up-weak); color: var(--up); } .badge.bad { background: var(--down-weak); color: var(--down); }
.badge.warn { background: var(--warn-weak); color: var(--warn); } .badge.info { background: var(--info-weak); color: var(--info); }
.badge.acc { background: var(--acc-weak); color: var(--acc); } .badge.outline { background: none; border-color: var(--line-2); }
.panel { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r2); min-width: 0; }
.panel > header { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); min-height: 40px; }
.panel > header h2 { font-size: var(--fs-md); }
.panel > .body { padding: 12px; }
.grid { display: grid; gap: 12px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: var(--fs-sm); align-items: baseline; }
.kv dt { color: var(--tx-3); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.stat { display: grid; gap: 2px; min-width: 0; }
.stat .l { font-size: var(--fs-xs); color: var(--tx-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; white-space: nowrap; }
.stat .v { font-size: var(--fs-lg); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat .s { font-size: var(--fs-xs); color: var(--tx-3); }
.empty { padding: 28px 16px; text-align: center; color: var(--tx-2); display: grid; gap: 6px; justify-items: center; }
.empty strong { color: var(--tx); font-size: var(--fs-md); }
.empty.err strong { color: var(--down); }
.note { font-size: var(--fs-xs); color: var(--tx-3); }
.callout { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: var(--r2); background: var(--bg-2); border: 1px solid var(--line); font-size: var(--fs-sm); color: var(--tx-2); }
.callout.warn { background: var(--warn-weak); border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--tx); }
.callout.sim { background: var(--acc-weak); border-color: color-mix(in srgb, var(--acc) 40%, transparent); color: var(--tx); font-weight: 600; letter-spacing: .04em; font-size: var(--fs-xs); text-transform: uppercase; align-items: center; }
.skel { background: linear-gradient(90deg, var(--bg-2), var(--bg-3), var(--bg-2)); background-size: 200% 100%; animation: sk 1.2s linear infinite; border-radius: var(--r1); height: 12px; }
@keyframes sk { to { background-position: -200% 0; } }
:root[data-motion="low"] .skel { animation: none; }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }
.ident { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; flex: none; overflow: hidden; }
.ident svg { width: 100%; height: 100%; display: block; }
.ident.sm { width: 20px; height: 20px; border-radius: 4px; }
.ident.lg { width: 36px; height: 36px; border-radius: 8px; }
.copy { border: 0; background: none; color: var(--tx-3); cursor: pointer; padding: 2px 4px; border-radius: var(--r1); display: inline-flex; align-items: center; gap: 4px; font: inherit; }
.copy:hover { color: var(--tx); background: var(--bg-3); }
.copy svg { width: 12px; height: 12px; }
.star { border: 0; background: none; cursor: pointer; color: var(--tx-3); width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: var(--r1); }
.star:hover { color: var(--tx); background: var(--bg-3); }
.star[aria-pressed="true"] { color: var(--warn); }
.star svg { width: 15px; height: 15px; }
.flash-up { animation: fu 700ms var(--ease); } .flash-down { animation: fd 700ms var(--ease); }
@keyframes fu { from { background-color: var(--up-weak); } to { background-color: transparent; } }
@keyframes fd { from { background-color: var(--down-weak); } to { background-color: transparent; } }
:root[data-motion="low"] .flash-up, :root[data-motion="low"] .flash-down { animation: none; }
@media (prefers-reduced-motion: reduce) { .flash-up, .flash-down { animation: none; } }

/* ----------------------------------------------------------------- tables */
.tbl-wrap { overflow: auto; position: relative; }
table.t { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--fs-sm); }
table.t th { position: sticky; top: 0; z-index: 2; background: var(--bg-1); color: var(--tx-3); font-weight: 600; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; text-align: left; padding: 0 10px; height: 34px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 0 10px; height: var(--row); border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
table.t td.wrap { white-space: normal; padding-top: 6px; padding-bottom: 6px; }
table.t tr:hover td { background: var(--bg-2); }
table.t .r { text-align: right; } table.t .c { text-align: center; }

/* virtual screener */
.vt { position: relative; flex: 1; min-height: 0; overflow: auto; contain: strict; }
.vt-head { position: sticky; top: 0; z-index: 3; display: flex; background: var(--bg-1); border-bottom: 1px solid var(--line); height: 36px; min-width: max-content; }
.vt-body { position: relative; min-width: max-content; }
.vt-row { position: absolute; left: 0; right: 0; display: flex; align-items: center; height: var(--row); border-bottom: 1px solid var(--line); cursor: pointer; min-width: max-content; background: var(--bg); }
.vt-row:hover, .vt-row.sel { background: var(--bg-2); }
.vt-row.sel { box-shadow: inset 2px 0 0 var(--acc); }
.vt-row:focus-visible { outline-offset: -2px; }
.vc { flex: none; padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--fs-sm); display: flex; align-items: center; gap: 6px; height: 100%; position: relative; }
.vc.r { justify-content: flex-end; text-align: right; font-variant-numeric: tabular-nums; }
.vc.pin { position: sticky; left: 0; z-index: 1; background: inherit; border-right: 1px solid var(--line); }
.vt-head .vc { font-size: var(--fs-xs); color: var(--tx-3); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; cursor: pointer; user-select: none; }
.vt-head .vc:hover { color: var(--tx); }
.vt-head .vc[aria-sort] { color: var(--tx); }
.vt-head .vc .rs { position: absolute; right: 0; top: 6px; bottom: 6px; width: 6px; cursor: col-resize; border-right: 1px solid var(--line-2); }
.vt-head .vc.pin { background: var(--bg-1); }
.tok { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tok .nm { display: grid; min-width: 0; line-height: 1.2; }
.tok .nm b { font-weight: 600; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tok .nm span { font-size: var(--fs-xs); color: var(--tx-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ----------------------------------------------------------------- trenches */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; flex: 1; min-height: 0; }
.col { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.col:last-child { border-right: 0; }
.col-head { display: grid; gap: 6px; padding: 6px 10px 8px; border-bottom: 1px solid var(--line); background: var(--bg-1); }
.col-head .ch1, .col-head .ch2 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.col-head h2 { font-size: var(--fs-sm); letter-spacing: .06em; text-transform: uppercase; }
.col-head .count { font-size: var(--fs-xs); color: var(--tx-3); }
.col-head .col-q { flex: 1 1 auto; height: 26px; font-size: var(--fs-xs); }
.col-head .iconbtn { width: 28px; height: 28px; }
.col-slots button { height: 24px; padding: 0 7px; }
.col-live .dot { background: var(--tx-3); }
.col-live[aria-pressed="true"] { color: var(--up); }
.col-live[aria-pressed="true"] .dot { background: var(--up); }
.col-body { overflow: auto; flex: 1; min-height: 0; display: block; overscroll-behavior: contain; position: relative; }
.col-body > .empty { margin: 8px; }
.col-new { height: 22px; padding: 0 8px; border: 0; border-radius: var(--r1); background: var(--acc); color: var(--acc-ink); font: 600 var(--fs-xs)/22px var(--font); cursor: pointer; white-space: nowrap; animation: popin var(--dur-2) var(--ease-out) forwards; opacity: 0; transform: translateY(-2px); }
.col-new:hover { background: var(--acc-hi); }
:root[data-motion="low"] .col-new { animation: none; opacity: 1; transform: none; }
/* Lifecycle row: fixed height, fixed slots. */
.card { --card-h: 118px; height: var(--card-h); display: grid; grid-template-columns: 60px minmax(0, 1fr); grid-template-rows: 20px 18px 18px 26px; grid-template-areas: "av r1" "av r2" "av prog" "mint r4"; column-gap: 10px; row-gap: 5px; padding: 9px 10px 9px 10px; border-bottom: 1px solid var(--line); background: var(--bg); cursor: pointer; position: relative; contain: layout paint style; }
:root[data-density="comfortable"] .card { --card-h: 132px; row-gap: 8px; padding: 12px; }
.card:hover { background: var(--bg-2); }
.card.sel, .card:focus-visible { box-shadow: inset 2px 0 0 var(--acc); outline: none; background: var(--bg-2); }
.c-av { grid-area: av; position: relative; align-self: start; }
.ident.xl { width: 60px; height: 60px; border-radius: 8px; }
.c-pos { position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%; background: var(--acc); color: var(--acc-ink); font: 700 12px/18px var(--font); text-align: center; border: 2px solid var(--bg); }
.c-mint { grid-area: mint; align-self: center; border: 0; background: none; padding: 0; color: var(--tx-3); cursor: copy; font-size: var(--fs-xs); text-align: center; white-space: nowrap; overflow: hidden; border-radius: var(--r1); }
.c-mint:hover { color: var(--tx); }
.c-r1, .c-r2, .c-r4 { display: flex; align-items: center; gap: 10px; min-width: 0; }
.c-r1 { grid-area: r1; } .c-r2 { grid-area: r2; } .c-r4 { grid-area: r4; }
.c-name { flex: 1 1 auto; display: flex; align-items: baseline; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; }
.c-name b { font-size: var(--fs-md); font-weight: 700; flex: 0 1 auto; max-width: 75%; overflow: hidden; text-overflow: ellipsis; }
.c-name span { font-size: var(--fs-xs); color: var(--tx-3); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.c-mk, .c-mk2 { flex: none; display: flex; gap: 10px; justify-content: flex-end; align-items: baseline; white-space: nowrap; font-size: var(--fs-sm); }
.c-mk { font-weight: 600; }
.c-mk2 { font-size: var(--fs-xs); color: var(--tx-2); }
.c-mk i, .c-mk2 i, .c-meta i, .c-prog i:not(.prog i) { font-style: normal; color: var(--tx-3); font-size: var(--fs-xs); font-weight: 500; margin-right: 3px; }
.c-meta { flex: 1 1 auto; display: flex; gap: 10px; align-items: center; font-size: var(--fs-xs); color: var(--tx-2); white-space: nowrap; overflow: hidden; min-width: 0; mask-image: linear-gradient(90deg, #000 90%, transparent); }
.c-meta > span { display: inline-flex; align-items: center; gap: 3px; }
.c-meta svg.i { width: 13px; height: 13px; color: var(--tx-3); }
.c-meta .acc { color: var(--acc); font-weight: 600; }
.c-prog { grid-area: prog; display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--tx-2); min-width: 0; white-space: nowrap; overflow: hidden; }
.c-prog .prog { flex: 1 1 auto; max-width: 220px; height: 4px; }
.c-prog .badge { height: 18px; }
.c-tags { flex: 1 1 auto; display: flex; gap: 4px; align-items: center; min-width: 0; overflow: hidden; mask-image: linear-gradient(90deg, #000 85%, transparent); }
.c-act { flex: none; display: flex; gap: 2px; align-items: center; }
.c-act .star, .c-act .iconbtn { width: 28px; height: 26px; }
.c-act .iconbtn svg { width: 15px; height: 15px; }
.c-paper { min-width: 72px; }
.c-paper:not(.buy) { color: var(--tx-2); }
.tag { display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 6px; border-radius: var(--r1); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; border: 1px solid var(--line-2); color: var(--tx-2); background: none; flex: none; }
.tag.ok { color: var(--up); border-color: color-mix(in srgb, var(--up) 40%, transparent); background: var(--up-weak); }
.tag.bad { color: var(--down); border-color: color-mix(in srgb, var(--down) 40%, transparent); background: var(--down-weak); }
.tag.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-weak); }
.tag.info { color: var(--info); border-color: color-mix(in srgb, var(--info) 40%, transparent); background: var(--info-weak); }
.prog { height: 4px; border-radius: 2px; background: var(--bg-4); overflow: hidden; display: block; }
.prog > i { display: block; height: 100%; background: var(--acc); transform-origin: left; }

/* screener: market strip + single-line token cell */
.mstats { display: flex; gap: 0; border-bottom: 1px solid var(--line); background: var(--bg-1); overflow-x: auto; scrollbar-width: none; flex: none; }
.mstats > div { display: flex; align-items: baseline; gap: 8px; padding: 9px 16px; border-right: 1px solid var(--line); white-space: nowrap; flex: 1 0 auto; justify-content: center; }
.mstats span { font-size: var(--fs-xs); color: var(--tx-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.mstats b { font-size: var(--fs-md); font-weight: 600; }
.bar-l { font-size: var(--fs-xs); color: var(--tx-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.bar .sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 4px; }
.tok1 { display: flex; align-items: baseline; gap: 6px; min-width: 0; width: 100%; white-space: nowrap; }
.tok1 .ident { align-self: center; }
.tok1 .rk { font-size: var(--fs-xs); color: var(--tx-3); min-width: 30px; }
.tok1 b { font-weight: 700; font-size: var(--fs-sm); flex: none; }
.tok1 .q { font-size: var(--fs-xs); color: var(--tx-3); margin-left: -4px; flex: none; }
.tok1 .nm2 { color: var(--tx-2); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1 1 auto; }
.tok1 .copy { align-self: center; opacity: 0; }
.vt-row:hover .tok1 .copy, .tok1 .copy:focus-visible { opacity: 1; }
.vc .mc { font-weight: 600; color: var(--tx); }

/* ----------------------------------------------------------------- drawer / popover / dialog / palette / toast */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; opacity: 0; animation: fadein var(--t-mid) var(--ease) forwards; }
@keyframes fadein { to { opacity: 1; } }
.drawer { position: fixed; top: var(--top); right: 0; bottom: 0; width: min(440px, 100vw); background: var(--bg-1); border-left: 1px solid var(--line-2); z-index: 41; display: flex; flex-direction: column; box-shadow: var(--shadow); transform: translateX(16px); opacity: 0; animation: drawin var(--t-slow) var(--ease) forwards; }
@keyframes drawin { to { transform: none; opacity: 1; } }
.drawer > header { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.drawer > .body { overflow: auto; padding: 12px; display: grid; gap: 12px; align-content: start; flex: 1; }
.pop { position: fixed; z-index: 50; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r2); box-shadow: var(--shadow); padding: 10px; min-width: 220px; max-width: min(380px, calc(100vw - 16px)); max-height: min(70vh, 560px); overflow: auto; transform: translateY(-4px); opacity: 0; animation: popin var(--t-mid) var(--ease) forwards; }
@keyframes popin { to { transform: none; opacity: 1; } }
.menu { display: grid; gap: 1px; }
.menu button, .menu a { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 8px; border: 0; background: none; border-radius: var(--r1); color: var(--tx); cursor: pointer; text-align: left; font-size: var(--fs-sm); text-decoration: none; }
.menu button:hover, .menu a:hover, .menu [aria-selected="true"] { background: var(--bg-3); text-decoration: none; }
.dialog { position: fixed; left: 50%; top: 12vh; transform: translateX(-50%); z-index: 60; width: min(560px, calc(100vw - 24px)); background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: var(--shadow); display: flex; flex-direction: column; max-height: 76vh; animation: fadein var(--t-mid) var(--ease); }
.dialog > header { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.dialog > .body { padding: 14px; overflow: auto; display: grid; gap: 12px; }
.dialog > footer { padding: 10px 14px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.palette .body { padding: 0; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; height: 48px; padding: 0 14px; font-size: var(--fs-lg); outline: none; }
.palette ul { list-style: none; margin: 0; padding: 6px; overflow: auto; max-height: 52vh; }
.palette li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: var(--r1); cursor: pointer; min-height: 40px; }
.palette li[aria-selected="true"] { background: var(--bg-3); }
.palette li .g { font-size: var(--fs-xs); color: var(--tx-3); text-transform: uppercase; letter-spacing: .06em; }
.toasts { position: fixed; bottom: 12px; right: 12px; z-index: 70; display: grid; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r2); padding: 10px 12px; box-shadow: var(--shadow); font-size: var(--fs-sm); max-width: 360px; display: flex; gap: 8px; align-items: flex-start; animation: popin var(--t-mid) var(--ease) forwards; transform: translateY(4px); opacity: 0; }
.toast::before { content: ""; flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--tx-3); }
.toast.ok::before { background: var(--up); } .toast.bad::before { background: var(--down); } .toast.warn::before { background: var(--warn); }

/* ----------------------------------------------------------------- terminal */
.term { display: grid; flex: 1; min-height: 0; grid-template-columns: minmax(0, 1fr) 6px var(--tick-w, 340px); grid-template-rows: auto minmax(0, 1fr) 6px var(--bottom-h, 280px); grid-template-areas: "strip strip strip" "chart gv side" "gh gh side" "bottom bottom side"; }
.term.max { grid-template-columns: minmax(0, 1fr) 0 0; grid-template-rows: auto minmax(0, 1fr) 0 0; }
.term.max .side, .term.max .bottom, .term.max .gut { display: none; }
.strip { grid-area: strip; display: flex; align-items: center; gap: 16px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--bg-1); overflow-x: auto; min-height: 56px; }
.strip .who { display: flex; align-items: center; gap: 10px; min-width: 0; flex: none; }
.strip .who .nm { display: grid; line-height: 1.2; min-width: 0; }
.strip .who b { font-size: var(--fs-lg); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.strip .stats { display: flex; gap: 18px; align-items: center; }
.chartp { grid-area: chart; display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg-1); }
.ctool { display: flex; align-items: center; gap: 4px; padding: 5px 6px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ctool .seg button { padding: 0 7px; }
.cwrap { position: relative; flex: 1; min-height: 160px; }
.cwrap .lw { position: absolute; inset: 0; }
.legend { position: absolute; left: 8px; top: 6px; z-index: 3; font-size: var(--fs-xs); pointer-events: none; display: flex; gap: 10px; flex-wrap: wrap; color: var(--tx-2); background: color-mix(in srgb, var(--bg-1) 80%, transparent); padding: 2px 6px; border-radius: var(--r1); }
.cbasis { padding: 4px 8px; border-top: 1px solid var(--line); font-size: var(--fs-xs); color: var(--tx-3); display: flex; gap: 8px; flex-wrap: wrap; }
.gut { background: var(--bg); cursor: col-resize; position: relative; }
.gut.h { cursor: row-resize; grid-area: gh; }
.gut.v { grid-area: gv; }
.gut:hover, .gut:focus-visible { background: var(--acc-weak); }
.side { grid-area: side; border-left: 1px solid var(--line); background: var(--bg-1); overflow: auto; display: flex; flex-direction: column; min-height: 0; }
.bottom { grid-area: bottom; display: flex; flex-direction: column; min-height: 0; background: var(--bg-1); border-top: 1px solid var(--line); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 6px; overflow-x: auto; flex: none; position: relative; }
.tabs button { height: 36px; padding: 0 10px; border: 0; background: none; color: var(--tx-2); font-weight: 500; font-size: var(--fs-sm); cursor: pointer; white-space: nowrap; position: relative; }
.tabs button:hover { color: var(--tx); }
.tabs button[aria-selected="true"] { color: var(--tx); box-shadow: inset 0 -2px 0 var(--acc); }
.tabpanel { overflow: auto; flex: 1; min-height: 0; }
.ticket { padding: 12px; display: grid; gap: 12px; border-bottom: 1px solid var(--line); }
.ticket .side-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--bg-2); padding: 3px; border-radius: var(--r2); }
.ticket .side-tabs button { height: 32px; border: 0; border-radius: var(--r1); background: none; color: var(--tx-2); font-weight: 600; cursor: pointer; }
.ticket .side-tabs button[aria-selected="true"].b { background: var(--up-weak); color: var(--up); }
.ticket .side-tabs button[aria-selected="true"].s { background: var(--down-weak); color: var(--down); }
.amt { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: var(--r2); background: var(--bg-2); height: 40px; padding: 0 10px; gap: 6px; }
.amt input { border: 0; background: none; outline: none; flex: 1; min-width: 0; font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.amt:focus-within { border-color: var(--acc); }
.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.qrows { display: grid; gap: 4px; font-size: var(--fs-sm); }
.qrows > div { display: flex; justify-content: space-between; gap: 8px; }
.qrows > div > span:first-child { color: var(--tx-3); }
.state { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r2); background: var(--bg-2); border: 1px solid var(--line); font-size: var(--fs-sm); }
details.adv > summary { cursor: pointer; color: var(--tx-2); font-size: var(--fs-sm); list-style: none; display: flex; align-items: center; gap: 6px; min-height: 28px; }
details.adv > summary::-webkit-details-marker { display: none; }
details.adv[open] > summary { color: var(--tx); }

/* ----------------------------------------------------------------- wire */
.feed { display: grid; }
.wi { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.wi:hover { background: var(--bg-1); }
.wi .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: var(--fs-xs); color: var(--tx-3); }
.wi .ttl { font-weight: 600; margin: 2px 0; overflow-wrap: anywhere; }
.wi .ex { color: var(--tx-2); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.wi .links { display: flex; gap: 8px; flex-wrap: wrap; font-size: var(--fs-xs); margin-top: 4px; }

/* ----------------------------------------------------------------- layout helpers */
.page { padding: 12px; display: grid; gap: 12px; align-content: start; }
.cols-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 12px; align-items: start; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r2); overflow: hidden; }
.kpis > .stat { padding: 10px 12px; box-shadow: inset -1px -1px 0 var(--line); }
.mini-chart { height: 220px; position: relative; }
.swatch { display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: center; font-size: var(--fs-xs); }
.swatch i { width: 28px; height: 20px; border-radius: 4px; border: 1px solid var(--line-2); display: block; }
.mobile-only { display: none !important; }
.term-nav { display: none; grid-area: tnav; gap: 4px; padding: 6px 8px; background: var(--bg-1); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 6; }
.term-nav button { flex: 1; }

/* ----------------------------------------------------------------- responsive */
@media (max-width: 1279px) {
  :root { --rail-r: 280px; }
  .status { min-width: 0; flex-shrink: 1; overflow-x: auto; scrollbar-width: none; }
  .status .pill.opt:not(.warn):not(.bad) { display: none; }
  .search { max-width: 240px; }
  .nav a, .nav button.navbtn { padding: 0 8px; }
  .app[data-right="auto"] .right { display: none; }
  .term { grid-template-columns: minmax(0, 1fr) 6px var(--tick-w, 300px); }
}
@media (max-width: 1023px) {
  .app { grid-template-columns: 1fr; grid-template-areas: "top" "main"; }
  .left, .right { display: none; }
  .app[data-left-open="1"] .left { display: flex; position: fixed; top: var(--top); left: 0; bottom: 0; width: min(300px, 86vw); z-index: 45; box-shadow: var(--shadow); }
  .app[data-left-open="1"] .left .rail-body, .app[data-left-open="1"] .left .rail-title { display: block; }
  .nav .lg-only { display: none; }
  .nav { position: fixed; bottom: 0; left: 0; right: 0; height: 56px; background: var(--bg-1); border-top: 1px solid var(--line); z-index: 30; justify-content: space-around; padding-bottom: env(safe-area-inset-bottom); }
  .nav a, .nav button.navbtn { flex: 1; justify-content: center; font-size: 12px; padding: 0 2px; min-height: 44px; }
  .nav .ind { bottom: auto; top: 0; }
  main { padding-bottom: 56px; }
  .mobile-only { display: inline-grid !important; }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .term { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(320px, 52vh) auto auto; grid-template-areas: "tnav" "strip" "chart" "side" "bottom"; }
  .term-nav { display: flex !important; }
  .term .gut { display: none; }
  main.fixed.term-host { overflow: auto; display: block; }
  .term .bottom { min-height: 360px; }
}
@media (max-width: 760px) {
  .search .label, .search kbd { display: none; }
  .search { flex: 0 0 44px; max-width: 44px; min-width: 44px; height: 44px; padding: 0; justify-content: center; }
  .top { gap: 6px; padding: 0 6px; }
  .brand span { display: none; }
  .brand { min-height: 44px; min-width: 44px; justify-content: center; }
  .status { min-width: 0; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
  .status::-webkit-scrollbar { display: none; }
  .status .pill { min-height: 44px; flex: none; }
  .copy { min-width: 44px; justify-content: center; }
  .status .opt { display: none; }
  .board { grid-template-columns: 1fr; }
  .board .col { display: none; border-right: 0; }
  .board .col.on { display: flex; }
  .btn, .seg button, .iconbtn, .star, .copy { min-height: 44px; }
  .iconbtn, .star { width: 44px; }
  .btn.sm { height: 44px; }
  .rail-item { min-height: 44px; }
  .tabs button { height: 44px; }
  .bar { padding: 8px; }
  .strip { flex-wrap: wrap; gap: 10px; }
  .strip .stats { flex-wrap: wrap; gap: 12px; }
}
@media (pointer: coarse) {
  .btn, .seg button, .iconbtn, .star, .tabs button, .rail-item, .menu button, .menu a { min-height: 44px; }
  .iconbtn, .star { min-width: 44px; }
}
@media (min-width: 761px) { .board-tabs { display: none !important; } }
@media (max-width: 1599px) { .hide-md { display: none; } }
@media (max-width: 760px) {
  .tok1 .rk, .tok1 .nm2 { display: none; }
  .tok1 .copy { opacity: 1; }
  .card { --card-h: 136px; grid-template-rows: 20px 18px 18px 44px; }
  .c-act .star, .c-act .iconbtn { width: 44px; height: 44px; }
  .c-mint { min-height: 44px; }
  .col-head .col-q { max-width: none; height: 44px; }
  .col-slots button { height: 44px; min-width: 44px; }
  .col-head .iconbtn { width: 44px; height: 44px; }
}

/* ================================================================= shell v2 (redesign 2026-11) */
/* capability: permanent, quiet, unambiguous */
.cap { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border-radius: var(--r1); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .03em; color: var(--acc); background: var(--acc-weak); white-space: nowrap; }
.cap-dot { width: 6px; height: 6px; border-radius: 1px; background: var(--acc); transform: rotate(45deg); }
/* data health: one control, honest levels, opens diagnostics */
.statusbtn { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; border-radius: var(--r1); border: 1px solid var(--line); background: var(--bg-1); color: var(--tx-2); font-size: var(--fs-sm); font-weight: 500; cursor: pointer; white-space: nowrap; transition: border-color var(--dur-1) var(--ease-out), background var(--dur-1) var(--ease-out); }
.statusbtn:hover { border-color: var(--line-2); color: var(--tx); }
.statusbtn .dot, .diag .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tx-3); flex: none; }
.statusbtn.ok .dot, .diag .dot.ok { background: var(--up); box-shadow: 0 0 0 3px var(--up-weak); }
.statusbtn.warn .dot, .diag .dot.warn { background: var(--warn); }
.statusbtn.bad .dot, .diag .dot.bad { background: var(--down); }
.statusbtn.warn { color: var(--warn); } .statusbtn.bad { color: var(--down); }
@media (prefers-reduced-motion: no-preference) { :root:not([data-motion="low"]) .statusbtn.ok .dot { animation: pulse 2.4s var(--ease-out) infinite; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--up-weak); } 50% { box-shadow: 0 0 0 4px var(--up-weak); } }
.iconbtn { position: relative; }
.nbadge { position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--warn); color: var(--bg); font: 700 12px/16px var(--font); text-align: center; pointer-events: none; }
/* contextual terminal tab */
.nav a.navterm { gap: 6px; }
.nav a.navterm .nt-s { font-size: var(--fs-xs); font-weight: 600; color: var(--tx-3); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 6px; border-radius: var(--r1); background: var(--bg-2); }
.nav a.navterm[aria-current="page"] .nt-s { color: var(--acc); background: var(--acc-weak); }
/* diagnostics */
.diag { width: min(400px, calc(100vw - 32px)); display: grid; gap: 12px; }
.diag .dhead { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); }
.diag .dsec { display: grid; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.diag h4 { margin: 0; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--tx-3); }
.diag .drow { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: baseline; font-size: var(--fs-sm); }
.diag .dk { color: var(--tx-2); } .diag .dv { font-variant-numeric: tabular-nums; text-align: right; color: var(--tx); }
.diag .dv.up { color: var(--up); } .diag .dv.warnt { color: var(--warn); }
.diag .dn { grid-column: 1 / -1; font-size: var(--fs-xs); color: var(--tx-3); line-height: 1.35; margin: 0; }
.diag .dlink { font-size: var(--fs-sm); justify-self: start; }
/* motion: exits are shorter than entries; layers use the z tokens */
.pop { z-index: var(--z-pop); box-shadow: var(--e2); border-color: transparent; }
.drawer { z-index: var(--z-drawer); box-shadow: var(--e3); }
.dialog { z-index: var(--z-dialog); box-shadow: var(--e3); border-color: transparent; }
.toasts { z-index: var(--z-toast); }
.toast { box-shadow: var(--e2); border-color: transparent; }
:root[data-motion="low"] .pop, :root[data-motion="low"] .drawer, :root[data-motion="low"] .toast, :root[data-motion="low"] .dialog { animation: none; opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .pop, .drawer, .toast, .dialog { animation: none !important; opacity: 1 !important; transform: none !important; } }
:root[data-motion="low"] .dialog { transform: translateX(-50%); }
@media (prefers-reduced-motion: reduce) { .dialog { transform: translateX(-50%) !important; } }
.pop:has(.diag) { max-width: min(440px, calc(100vw - 16px)); padding: 14px; }
.diag { width: 100%; min-width: min(380px, calc(100vw - 48px)); }
.pop:focus-visible { outline: none; }

/* ----------------------------------------------------------------- preview drawer + provenance (signature moments) */
.pv-drawer { width: min(460px, 100vw); }
.pv-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pv-id .nm { display: grid; min-width: 0; }
.pv-id .nm b { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-id .nm .note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv { display: grid; gap: 14px; }
.pv-tags { display: flex; gap: 6px; flex-wrap: wrap; min-height: 22px; }
.pv-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r2); overflow: hidden; }
.pv-kpis > .empty { grid-column: 1 / -1; background: var(--bg-1); margin: 0; }
.provbtn { display: grid; gap: 2px; text-align: left; padding: 10px 12px; background: var(--bg-1); border: 0; color: inherit; cursor: help; min-width: 0; transition: background var(--dur-1) var(--ease-out); }
.provbtn:hover { background: var(--bg-2); }
.provbtn .v { font-size: var(--fs-lg); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.provbtn:hover .l { color: var(--tx-2); text-decoration: underline dotted; text-underline-offset: 3px; }
.pv-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pv-actions .btn { gap: 6px; }
.pv-h { margin: 0 0 6px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--tx-3); }
.pv-tape { min-height: 120px; }
table.t.tape td { height: 30px; padding: 0 6px; font-size: var(--fs-sm); }
.side { font-weight: 600; font-size: var(--fs-sm); }
.side.up { color: var(--up); } .side.down { color: var(--down); }
.side.up::before { content: "▲ "; font-size: 0.8em; } .side.down::before { content: "▼ "; font-size: 0.8em; }
.pv-more summary { cursor: pointer; color: var(--tx-2); font-size: var(--fs-sm); padding: 4px 0; }
.pv-more[open] summary { margin-bottom: 8px; }
.prov-pop { display: grid; gap: 8px; width: min(340px, calc(100vw - 40px)); }
.prov-pop strong { font-size: var(--fs-md); }
.prov-pop .note { margin: 0; }
.prov-pop dl { margin: 0; display: grid; gap: 6px; }
.prov-pop .prow { display: grid; grid-template-columns: 96px 1fr; gap: 8px; font-size: var(--fs-sm); }
.prov-pop dt { color: var(--tx-3); } .prov-pop dd { margin: 0; color: var(--tx); overflow-wrap: anywhere; }
.err { color: var(--down); font-size: var(--fs-sm); margin: 0; }
.err:empty { display: none; }
.drawer:focus-visible, .dialog:focus-visible { outline: none; }
table.t.tape td { white-space: nowrap; }
table.t.tape td:nth-child(2) { width: 64px; }
.tolive { position: absolute; right: 70px; bottom: 34px; z-index: 4; height: 28px; padding: 0 10px; border: 0; border-radius: var(--r1); background: var(--bg-3); color: var(--tx); font: 600 var(--fs-xs)/28px var(--font); box-shadow: var(--e2); cursor: pointer; animation: popin var(--dur-2) var(--ease-out) forwards; opacity: 0; transform: translateY(4px); }
.tolive:hover { background: var(--bg-4); }
:root[data-motion="low"] .tolive { animation: none; opacity: 1; transform: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.callout.sim .note { text-transform: none; letter-spacing: 0; font-weight: 400; }
/* strategy lab overview */
.sname { display: grid; gap: 1px; min-width: 0; }
.sname b { font-weight: 600; white-space: nowrap; }
.sname .mono { font-size: var(--fs-xs); }
table.t tr.grp th { position: static; height: 30px; background: var(--bg); color: var(--tx-3); font-size: var(--fs-xs); letter-spacing: .06em; text-transform: uppercase; border-bottom: 1px solid var(--line); }
table.t tr.sel td { background: var(--bg-2); }
table.t tr.sel td:first-child { box-shadow: inset 2px 0 0 var(--acc); }
@media (max-width: 760px) {
  .statusbtn { height: 44px; min-width: 44px; padding: 0 10px; }
  .cap > span:last-child { display: none; }
  .cap { width: 28px; justify-content: center; padding: 0; }
  .pv-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pv-actions .btn, .pv-actions .star { min-height: 44px; }
  .diag .drow { grid-template-columns: 1fr; }
  .diag .dv { text-align: left; }
}
@media (max-width: 760px) { .nav a.navterm .nt-s { display: none; } .nav { overflow-x: auto; scrollbar-width: none; } }
@media (max-width: 760px) { .hide-sm { display: none !important; } }
.callout.sim { display: grid; gap: 2px; }
.callout.sim strong { letter-spacing: .04em; }
.col-head h2 { white-space: nowrap; }
.col-head .ch1 > .note { white-space: nowrap; }
.callout.sim { text-transform: none; letter-spacing: 0; font-weight: 400; }
.callout.sim strong { text-transform: uppercase; letter-spacing: .04em; font-weight: 650; }
.kpis .stat .l { white-space: normal; line-height: 1.25; }

/* ---- owner sign-in (domain mode) ---- */
body.login-page { overflow: auto; min-height: 100dvh; }
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; box-sizing: border-box; }
.login-card { width: 100%; max-width: 340px; display: grid; gap: 14px; padding: 28px 24px 22px; border: 1px solid var(--line); border-radius: var(--r2); background: var(--bg-1); box-shadow: var(--e2); }
.login-card h1 { margin: 0; font-size: var(--fs-xl); font-weight: 600; letter-spacing: -.01em; }
.login-brand { display: flex; align-items: center; gap: 10px; color: var(--acc); font-weight: 700; letter-spacing: .08em; font-size: var(--fs-sm); }
.login-card .input { height: 40px; font-size: var(--fs-md); }
.login-card #code:not(:placeholder-shown) { letter-spacing: .3em; }
.login-card #code { font-variant-numeric: tabular-nums; }
.login-card .btn.primary { height: 40px; font-size: var(--fs-md); }
.login-card .err:empty { display: none; }
.sess-row { display: flex; gap: 8px; flex-wrap: wrap; }
.login-card .input[aria-invalid="true"] { border-color: var(--down); }

/* ---- Runs scoreboard ---- */
.run-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-bottom: 14px; }
.run-card { border: 1px solid var(--line); border-radius: var(--r2); background: var(--bg-1); padding: 14px 16px; display: grid; gap: 10px; align-content: start; }
.run-card.hot { border-color: color-mix(in srgb, var(--warn, #d08700) 45%, var(--line)); }
.run-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.run-card h2 { margin: 0; font-size: var(--fs-lg); font-weight: 600; }
.run-card header .mono { font-size: var(--fs-xs); }
.run-card .note { margin: 0; }
.run-money { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.run-money > div { display: grid; gap: 2px; }
.run-money .l { font-size: var(--fs-xs); color: var(--tx-3); text-transform: uppercase; letter-spacing: .06em; }
.run-money .v { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.run-money .s { font-size: var(--fs-sm); color: var(--tx-3); }
.run-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.run-stats > div { display: grid; gap: 1px; min-width: 0; }
.run-stats b { font-size: var(--fs-md); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-stats span { font-size: var(--fs-xs); color: var(--tx-3); }
.run-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 8px; }
.run-ctl { gap: 6px; }
@media (max-width: 520px) { .run-stats { grid-template-columns: repeat(2, 1fr); } }
