/* ==========================================================================
   VAJRA — instrument panel
   Warm graphite base, one signature accent (vajra gold), green/red for P&L
   only, muted cyan for informational series. Hairlines, no glass, no glow.
   ========================================================================== */

@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk-latin-wght.woff2") format("woff2");
  font-weight: 300 700; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                 U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
                 U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Neither vendored family has U+20B9 (₹). Single-glyph Inter subsets (OFL, see
   fonts/OFL-Inter.txt, scripts/build_rupee_font.py) slot in under the same family names via
   unicode-range, so DOM text and Chart.js canvas labels both get a real rupee, no system font. */
@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/rupee-wght.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+20B9;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/rupee-mono-500.woff2") format("woff2");
  font-weight: 100 800; font-style: normal; font-display: swap;
  unicode-range: U+20B9;
}
/* Σ ∞ ≤ ≥ ⌘ ▸ ✓ ✕ — dropped by the latin subsets; cut from full JetBrains Mono 2.305 */
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-symbols.woff2") format("woff2");
  font-weight: 100 800; font-style: normal; font-display: swap;
  unicode-range: U+03A3, U+221E, U+2264-2265, U+2318, U+25B8, U+2713, U+2715;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/jetbrains-mono-symbols.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+03A3, U+221E, U+2264-2265, U+2318, U+25B8, U+2713, U+2715;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin-wght.woff2") format("woff2");
  font-weight: 100 800; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                 U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
                 U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin-ext-wght.woff2") format("woff2");
  font-weight: 100 800; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
                 U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
                 U+20AD-20B8, U+20BA-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: dark;
  /* surfaces: warm graphite, hue 75 */
  --bg:        oklch(0.158 0.006 75);
  --bg-grid:   oklch(0.235 0.006 75 / 0.45);
  --panel:     oklch(0.188 0.006 75);
  --panel-2:   oklch(0.212 0.007 75);
  --raise:     oklch(0.246 0.008 75);
  --line:      oklch(0.292 0.008 75);
  --line-soft: oklch(0.245 0.007 75);
  /* ink */
  --ink:   oklch(0.948 0.008 85);
  --ink-2: oklch(0.815 0.010 82);
  --muted: oklch(0.680 0.012 80);
  --faint: oklch(0.540 0.010 80);
  /* the one accent */
  --vajra:      oklch(0.845 0.165 84);
  --vajra-deep: oklch(0.720 0.150 78);
  --vajra-ink:  oklch(0.205 0.030 84);
  --vajra-wash: oklch(0.845 0.165 84 / 0.11);
  /* semantics */
  --up:        oklch(0.800 0.160 152);
  --up-wash:   oklch(0.800 0.160 152 / 0.12);
  --down:      oklch(0.712 0.175 25);
  --down-wash: oklch(0.712 0.175 25 / 0.13);
  --info:      oklch(0.790 0.075 215);
  --info-wash: oklch(0.790 0.075 215 / 0.12);
  --serious:   oklch(0.760 0.150 55);
  --crit:      oklch(0.600 0.205 27);
  --crit-deep: oklch(0.470 0.170 27);
  --crit-wash: oklch(0.600 0.205 27 / 0.14);
  /* type */
  --f-display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  /* rhythm */
  --r: 3px;
  --pad: 14px;
  --gap: 10px;
  --cell-y: 7px;
  --hit: 36px;
  --t-fast: 120ms;
  --t-med: 260ms;
}
:root[data-density="compact"] { --pad: 10px; --gap: 8px; --cell-y: 4px; }
@media (pointer: coarse) { :root { --hit: 44px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background-color: var(--bg);
  /* 24px instrument grid, hairline, barely there */
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
  color: var(--ink);
  font: 400 14px/1.45 var(--f-display);
  font-feature-settings: "ss01", "ss04";
  -webkit-font-smoothing: antialiased;
}
:root[data-motion="reduced"] *, :root[data-motion="reduced"] *::before,
:root[data-motion="reduced"] *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

a { color: var(--ink); text-decoration-color: var(--faint); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--vajra); }
code, kbd, pre, .mono, .num { font-family: var(--f-mono); }
.num { font-variant-numeric: tabular-nums slashed-zero; font-feature-settings: "tnum", "zero"; }
code { font-size: 0.92em; padding: 0 4px; border: 1px solid var(--line); border-radius: 2px;
       background: var(--panel-2); color: var(--ink-2); }
kbd { display: inline-block; min-width: 1.6em; padding: 1px 5px; font-size: 11px; line-height: 1.4;
      text-align: center; border: 1px solid var(--line); border-bottom-width: 2px;
      border-radius: 3px; color: var(--ink-2); background: var(--panel-2); }
.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; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--ink-2); }
.muted { color: var(--muted); } .faint { color: var(--faint); } .ink2 { color: var(--ink-2); }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--vajra); outline-offset: 2px; border-radius: 2px; }

.skip { position: absolute; left: 8px; top: -60px; z-index: 100; padding: 10px 14px;
        background: var(--vajra); color: var(--vajra-ink); font-weight: 600; }
.skip:focus { top: 8px; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--hit); padding: 0 14px;
  font: 500 13px/1 var(--f-display); letter-spacing: 0.01em;
  color: var(--ink); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: var(--r); cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.btn:hover { background: var(--raise); border-color: oklch(0.36 0.01 75); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--panel-2); border-color: var(--line); color: var(--ink); }
.btn-gold { background: var(--vajra); color: var(--vajra-ink); border-color: var(--vajra); font-weight: 600; }
.btn-gold:hover { background: oklch(0.88 0.15 86); border-color: oklch(0.88 0.15 86); }
.btn-danger { background: var(--crit); border-color: var(--crit); color: oklch(0.98 0.01 27); font-weight: 600; }
.btn-danger:hover { background: oklch(0.64 0.21 27); }
.btn-sm { min-height: 28px; padding: 0 8px; font-size: 12px; }
@media (pointer: coarse) { .btn-sm { min-height: 44px; padding: 0 12px; } }

/* ---------------------------------------------------------------- statusbar */
.statusbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: stretch; gap: 0;
  min-height: 52px; padding: 0 12px;
  background: oklch(0.142 0.006 75);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding-right: 16px; margin-right: 4px;
         border-right: 1px solid var(--line-soft); text-decoration: none; }
.brand svg { width: 22px; height: 22px; color: var(--vajra); flex: none; }
.brand-word { font: 700 15px/1 var(--f-display); letter-spacing: 0.22em; }
.brand-sub { display: block; margin-top: 3px; font: 400 9.5px/1 var(--f-mono); letter-spacing: 0.08em;
             color: var(--faint); text-transform: uppercase; }
.sb-cells { display: flex; align-items: stretch; flex: 1; min-width: 0; overflow-x: auto;
            scrollbar-width: none; }
.sb-cells::-webkit-scrollbar { display: none; }
.sb-cell { display: flex; flex-direction: column; justify-content: center; gap: 3px;
           padding: 0 14px; border-right: 1px solid var(--line-soft); white-space: nowrap; }
.sb-cell:last-child { border-right: 0; }
.sb-label { font: 500 9.5px/1 var(--f-mono); letter-spacing: 0.12em; text-transform: uppercase;
            color: var(--faint); }
.sb-value { font: 500 12.5px/1.1 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.sb-clock { font-size: 15px; font-weight: 600; letter-spacing: 0.02em; }
.sb-right { display: flex; align-items: center; gap: 6px; padding-left: 12px;
            border-left: 1px solid var(--line-soft); }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px;
       vertical-align: 1px; background: var(--faint); }
.dot.ok { background: var(--up); } .dot.bad { background: var(--down); } .dot.warn { background: var(--serious); }
.dot.live { animation: beat 2.4s ease-in-out infinite; }
@keyframes beat { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px;
         font: 600 10.5px/1 var(--f-mono); letter-spacing: 0.12em; text-transform: uppercase;
         border: 1px solid var(--line); border-radius: 2px; color: var(--ink-2); }
.badge-paper { color: var(--info); border-color: oklch(0.79 0.075 215 / 0.45); background: var(--info-wash); }
.badge-live { color: oklch(0.98 0.01 27); background: var(--crit); border-color: var(--crit);
              animation: beat 1.6s ease-in-out infinite; }
.badge-halt { color: oklch(0.98 0.01 27); background: var(--crit-deep); border-color: var(--crit); }

/* session phase pill: segmented track showing the day's timeline */
.phase { display: flex; align-items: center; gap: 10px; }
.phase-name { font: 700 12px/1 var(--f-mono); letter-spacing: 0.1em; }
.phase[data-state="OPEN"] .phase-name { color: var(--up); }
.phase[data-state="PRE-OPEN"] .phase-name { color: var(--info); }
.phase[data-state="ENTRY-CUTOFF"] .phase-name,
.phase[data-state="SQUARE-OFF"] .phase-name { color: var(--vajra); }
.phase[data-state="CLOSED"] .phase-name, .phase[data-state="HOLIDAY"] .phase-name { color: var(--muted); }
.phase-track { display: flex; gap: 2px; }
.phase-track i { display: block; width: 14px; height: 4px; background: var(--line); }
.phase-track i.on { background: var(--vajra); }
.phase-track i.past { background: oklch(0.845 0.165 84 / 0.35); }

/* ---------------------------------------------------------------- layout */
.shell { max-width: 1680px; margin: 0 auto; padding: var(--gap) var(--gap) 64px; }
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; }
.span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; }
@media (max-width: 1180px) {
  .span-8, .span-7, .span-5, .span-4 { grid-column: span 12; }
}

.panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r);
         min-width: 0; scroll-margin-top: 64px; }
.panel-head { display: flex; align-items: center; gap: 10px; min-height: 40px;
              padding: 0 var(--pad); border-bottom: 1px solid var(--line-soft); }
.panel-idx { font: 500 10px/1 var(--f-mono); color: var(--vajra); letter-spacing: 0.08em; }
.panel-title { margin: 0; font: 600 12px/1 var(--f-display); letter-spacing: 0.14em; text-transform: uppercase; }
.panel-meta { margin-left: auto; display: flex; align-items: center; gap: 8px;
              font: 400 11px/1 var(--f-mono); color: var(--muted); }
.panel-body { padding: var(--pad); }
.panel-body.flush { padding: 0; }

.flash { display: flex; align-items: center; gap: 12px; margin-bottom: var(--gap);
         padding: 10px var(--pad); border: 1px solid var(--line); border-radius: var(--r);
         background: var(--panel); font-size: 13px; }
.flash.crit { border-color: var(--crit); background: var(--crit-wash); }
.flash.ok { border-color: oklch(0.80 0.16 152 / 0.5); }
.halt-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: var(--gap);
               padding: 12px var(--pad); border: 1px solid var(--crit); border-radius: var(--r);
               background: repeating-linear-gradient(-45deg, var(--crit-wash) 0 10px, transparent 10px 20px), var(--panel); }
.halt-banner strong { font: 700 12px/1 var(--f-mono); letter-spacing: 0.14em; color: var(--down); }
.stale-banner { margin-bottom: var(--gap); padding: 10px var(--pad); border: 1px dashed var(--serious);
                border-radius: var(--r); color: var(--serious); font: 500 12px/1.4 var(--f-mono); }

/* ---------------------------------------------------------------- capital */
.ledger { display: grid; grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(0, 1fr)); }
.ledger > div { padding: 12px var(--pad); border-right: 1px solid var(--line-soft); min-width: 0; }
.ledger > div:last-child { border-right: 0; }
.ledger .k { font: 500 10px/1 var(--f-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.ledger .v { margin-top: 8px; font: 500 16px/1.1 var(--f-mono); font-variant-numeric: tabular-nums; }
.ledger .sub { margin-top: 6px; font: 400 11px/1.3 var(--f-mono); color: var(--muted); }
.ledger .v-hero { font-size: 28px; font-weight: 600; letter-spacing: -0.01em; }
.hero-row { display: flex; align-items: flex-end; gap: 12px; }
.spark { width: 120px; height: 30px; flex: none; }
.spark polyline { fill: none; stroke: var(--info); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.ledger-2 { border-top: 1px solid var(--line-soft); }
@media (max-width: 720px) {
  .ledger { grid-template-columns: 1fr 1fr; }
  .ledger > div:first-child { grid-column: span 2; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .ledger > div:nth-child(3) { border-right: 0; }
  .ledger > div:nth-child(n+4) { border-top: 1px solid var(--line-soft); }
}

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg button { min-height: 26px; min-width: 38px; padding: 0 8px; border: 0; border-right: 1px solid var(--line);
              background: transparent; color: var(--muted); font: 500 11px/1 var(--f-mono); cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--vajra-wash); color: var(--vajra); }
.seg button:hover { color: var(--ink); }
@media (pointer: coarse) { .seg button { min-height: 44px; min-width: 48px; } }

.charts { padding: 6px var(--pad) var(--pad); }
.chart-eq { position: relative; height: 230px; }
.chart-dd { position: relative; height: 78px; margin-top: 4px; border-top: 1px dashed var(--line-soft); }
.chart-label { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
               gap: 6px 12px; margin: 8px 0 4px;
               font: 500 10px/1 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.chart-empty { display: grid; place-items: center; height: 100%; border: 1px dashed var(--line);
               border-radius: var(--r); text-align: center; padding: 16px; }
.chart-empty .line1 { font: 600 12px/1.3 var(--f-mono); letter-spacing: 0.08em; color: var(--ink-2); }
.chart-empty .line2 { margin-top: 6px; font-size: 12px; color: var(--muted); max-width: 46ch; }
.data-table-toggle { margin-top: 8px; font: 400 11px/1 var(--f-mono); }
.data-table-toggle summary { cursor: pointer; color: var(--muted); padding: 6px 0; }

/* ---------------------------------------------------------------- risk cluster */
.gauge-wrap { display: grid; grid-template-columns: 168px 1fr; gap: 14px; align-items: center;
              padding: var(--pad); border-bottom: 1px solid var(--line-soft); }
.gauge { width: 168px; height: 104px; }
.gauge .track { fill: none; stroke: var(--line); stroke-width: 10; }
.gauge .zone { fill: none; stroke: var(--crit-wash); stroke-width: 10; }
.gauge .fill { fill: none; stroke: var(--up); stroke-width: 10; transition: stroke-dashoffset var(--t-med), stroke var(--t-med); }
.gauge[data-level="warn"] .fill { stroke: var(--vajra); }
.gauge[data-level="crit"] .fill { stroke: var(--down); }
.gauge .tick { stroke: var(--ink-2); stroke-width: 1.5; }
.gauge .needle-label { font: 600 20px/1 var(--f-mono); fill: var(--ink); text-anchor: middle; }
.gauge .cap-label { font: 400 9px/1 var(--f-mono); fill: var(--faint); text-anchor: middle; letter-spacing: 0.08em; }
.gauge-legend .k { font: 500 10px/1 var(--f-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.gauge-legend .v { margin-top: 6px; font: 500 15px/1.2 var(--f-mono); }
.gauge-legend .sub { margin-top: 6px; font: 400 11px/1.4 var(--f-mono); color: var(--muted); }

.meters { padding: 4px var(--pad) var(--pad); }
.meter { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.meter:last-child { border-bottom: 0; }
.meter-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.meter-name { font: 500 10.5px/1 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.meter-val { font: 500 12px/1 var(--f-mono); font-variant-numeric: tabular-nums; }
.meter svg { display: block; width: 100%; height: 8px; margin-top: 8px; }
.meter .m-track { fill: var(--panel-2); stroke: var(--line); stroke-width: 1; }
.meter .m-fill { fill: var(--info); transition: width var(--t-med); }
.meter[data-level="warn"] .m-fill { fill: var(--vajra); }
.meter[data-level="crit"] .m-fill { fill: var(--down); }
.meter .m-tick { stroke: var(--ink-2); stroke-width: 1; }
.meter-sub { margin-top: 6px; font: 400 11px/1.3 var(--f-mono); color: var(--muted); }
.buckets { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.rails { border-top: 1px solid var(--line-soft); }
.rail { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center;
        padding: 8px var(--pad); border-bottom: 1px solid var(--line-soft); font: 400 12px/1.3 var(--f-mono); }
.rail:last-child { border-bottom: 0; }
.rail .rn { color: var(--ink-2); font-family: var(--f-display); font-size: 12.5px; }
.rail .rv { color: var(--ink); }
.rail .rs { min-width: 66px; text-align: right; font-size: 11px; color: var(--muted); }
.rail .rs.pass { color: var(--up); } .rail .rs.fail { color: var(--down); }

/* ---------------------------------------------------------------- stats strip */
.strip { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); }
.strip > div { padding: 12px var(--pad); border-right: 1px solid var(--line-soft); min-width: 0; }
.strip > div:last-child { border-right: 0; }
.strip .k { font: 500 10px/1 var(--f-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.strip .v { margin-top: 8px; font: 500 17px/1.1 var(--f-mono); font-variant-numeric: tabular-nums; }
.strip .sub { margin-top: 5px; font: 400 10.5px/1.3 var(--f-mono); color: var(--muted); }
@media (max-width: 1180px) { .strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .strip > div:nth-child(4) { border-right: 0; }
  .strip > div:nth-child(n+5) { border-top: 1px solid var(--line-soft); } }
@media (max-width: 560px) { .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip > div:nth-child(2n) { border-right: 0; }
  .strip > div:nth-child(n+3) { border-top: 1px solid var(--line-soft); } }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font: 400 12.5px/1.35 var(--f-mono);
             font-variant-numeric: tabular-nums slashed-zero; }
table.data th { position: sticky; top: 0; z-index: 1; padding: 8px 10px; text-align: left;
                font: 500 10px/1 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase;
                color: var(--faint); background: var(--panel); border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: var(--cell-y) 10px; border-bottom: 1px solid var(--line-soft); white-space: nowrap;
                vertical-align: middle; }
table.data td.r, table.data th.r { text-align: right; }
table.data tbody tr:hover td { background: oklch(0.205 0.007 75); }
table.data td.wrap { white-space: normal; min-width: 22ch; max-width: 70ch; }
table.data td.sym { font-weight: 600; color: var(--ink); }
table.data tr.detail td { background: var(--panel-2); white-space: normal; padding: 10px 14px 12px; }
table.data tr.detail:hover td { background: var(--panel-2); }
.scroll-y { max-height: 460px; overflow: auto; }
.expander { width: 26px; height: 26px; padding: 0; border: 1px solid transparent; border-radius: 2px;
            background: transparent; color: var(--muted); cursor: pointer; font: 500 13px/1 var(--f-mono); }
.expander:hover { border-color: var(--line); color: var(--ink); }
.expander[aria-expanded="true"] { color: var(--vajra); }
@media (pointer: coarse) { .expander { width: 44px; height: 44px; } }
pre.raw { margin: 0; max-height: 280px; overflow: auto; font: 400 11.5px/1.5 var(--f-mono); color: var(--ink-2);
          white-space: pre-wrap; word-break: break-word; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 18px; }
.kv div { font: 400 11.5px/1.4 var(--f-mono); }
.kv span { display: block; font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }

.chip { display: inline-flex; align-items: center; height: 20px; padding: 0 7px;
        font: 600 10px/1 var(--f-mono); letter-spacing: 0.1em; border-radius: 2px; border: 1px solid var(--line);
        color: var(--ink-2); text-transform: uppercase; }
.chip-allow { color: var(--up); border-color: oklch(0.80 0.16 152 / 0.4); background: var(--up-wash); }
.chip-reject { color: var(--down); border-color: oklch(0.71 0.175 25 / 0.45); background: var(--down-wash); }
.chip-halt { color: oklch(0.98 0.01 27); border-color: var(--crit); background: var(--crit-deep); }
.chip-error { color: var(--serious); border-color: oklch(0.76 0.15 55 / 0.45); }
.chip-info { color: var(--muted); }
.reason-reject { color: oklch(0.86 0.07 25); font-weight: 500; }
.tag { display: inline-block; padding: 1px 6px; font: 500 10px/1.5 var(--f-mono); letter-spacing: 0.08em;
       text-transform: uppercase; border: 1px solid var(--line); border-radius: 2px; color: var(--ink-2); }
.tag-thesis { color: var(--vajra); border-color: oklch(0.845 0.165 84 / 0.4); }
.tag-watchlist { color: var(--info); border-color: oklch(0.79 0.075 215 / 0.4); }
.tag-review { color: var(--ink); }

/* filter bar */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px var(--pad);
           border-bottom: 1px solid var(--line-soft); }
.search { flex: 1 1 220px; min-width: 0; height: var(--hit); padding: 0 10px; max-width: 360px;
          font: 400 12.5px/1 var(--f-mono); color: var(--ink); background: var(--bg);
          border: 1px solid var(--line); border-radius: var(--r); }
.search::placeholder { color: var(--faint); }
.search:focus-visible { outline-offset: 0; }
.chipbtn { min-height: 28px; padding: 0 9px; font: 600 10px/1 var(--f-mono); letter-spacing: 0.1em;
           text-transform: uppercase; color: var(--muted); background: transparent;
           border: 1px solid var(--line); border-radius: 2px; cursor: pointer; }
.chipbtn[aria-pressed="true"] { color: var(--ink); background: var(--raise); border-color: oklch(0.38 0.01 75); }
@media (pointer: coarse) { .chipbtn { min-height: 44px; } }
.count { margin-left: auto; font: 400 11px/1 var(--f-mono); color: var(--muted); }

/* SL - LTP - target range bar */
.range { display: block; width: 150px; height: 18px; }
.range .rg-track { stroke: var(--line); stroke-width: 2; }
.range .rg-sl { stroke: var(--down); stroke-width: 2; }
.range .rg-tg { stroke: var(--up); stroke-width: 2; }
.range .rg-entry { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 2 2; }
.range .rg-ltp { fill: var(--vajra); stroke: var(--panel); stroke-width: 2; }
.range-labels { display: flex; justify-content: space-between; width: 150px; font-size: 10px; color: var(--muted); }

/* designed empty states */
.empty { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center;
         padding: 18px var(--pad); }
.empty svg { width: 36px; height: 36px; color: var(--line); }
.empty .e1 { font: 600 11.5px/1.3 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.empty .e2 { margin-top: 4px; font-size: 12.5px; color: var(--muted); max-width: 64ch; }
.no-match { padding: 14px var(--pad); font: 400 12px/1 var(--f-mono); color: var(--muted); }

/* ---------------------------------------------------------------- research timeline */
.timeline { max-height: 640px; overflow: auto; }
.tl-day { position: relative; }
.tl-date { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px;
           padding: 8px var(--pad); background: var(--panel); border-bottom: 1px solid var(--line-soft);
           font: 600 10.5px/1 var(--f-mono); letter-spacing: 0.12em; color: var(--ink-2); }
.tl-date::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }
.tl-item { display: grid; grid-template-columns: 54px 1fr; gap: 10px; padding: 12px var(--pad) 12px; }
.tl-time { font: 400 11px/1.6 var(--f-mono); color: var(--faint); }
.tl-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.md { font-size: 13.5px; line-height: 1.55; color: var(--ink-2); overflow-wrap: anywhere; }
.md p, .md ul, .md ol, .md blockquote, .md pre { margin: 0 0 8px; }
.md > :last-child { margin-bottom: 0; }
.md h3, .md h4, .md h5 { margin: 4px 0 6px; font: 600 13px/1.3 var(--f-display); color: var(--ink); letter-spacing: 0.02em; }
.md ul, .md ol { padding-left: 20px; }
.md li::marker { color: var(--faint); }
.md strong { color: var(--ink); font-weight: 600; }
.md blockquote { padding: 6px 10px; background: var(--panel-2); border-radius: 2px; color: var(--muted); }
.md blockquote::before { content: "\201C\00a0"; color: var(--faint); font-family: var(--f-mono); }
.md pre { padding: 8px 10px; background: var(--bg); border: 1px solid var(--line-soft); border-radius: 2px;
          overflow-x: auto; font-size: 12px; }
.md pre code { border: 0; padding: 0; background: none; }
.md-sym { font: 600 0.92em/1 var(--f-mono); color: var(--ink); }

/* ---------------------------------------------------------------- kill switch */
.kill { border-color: oklch(0.47 0.17 27 / 0.6); }
.kill .panel-head { border-bottom-color: oklch(0.47 0.17 27 / 0.4); }
.kill .panel-idx { color: var(--down); }
.kill-body { display: grid; gap: 14px; padding: var(--pad); }
.kill-copy { font-size: 13px; color: var(--ink-2); }
.kill-copy ol { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; }
.hold {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%;
  min-height: 64px; padding: 10px 16px; cursor: pointer; user-select: none; -webkit-user-select: none;
  touch-action: none; text-align: left;
  color: oklch(0.97 0.01 27); background: var(--crit-deep);
  border: 1px solid var(--crit); border-radius: var(--r);
  font: 700 13px/1.2 var(--f-mono); letter-spacing: 0.08em;
  background-image: repeating-linear-gradient(-45deg, oklch(0 0 0 / 0.14) 0 8px, transparent 8px 16px);
}
.hold:hover { background-color: oklch(0.51 0.18 27); }
.hold .ring { width: 38px; height: 38px; flex: none; transform: rotate(-90deg); }
.hold .ring circle { fill: none; stroke-width: 3; }
.hold .ring .r-bg { stroke: oklch(1 0 0 / 0.2); }
.hold .ring .r-fg { stroke: oklch(0.98 0.01 27); stroke-dasharray: 100; stroke-dashoffset: 100; }
.hold small { display: block; margin-top: 4px; font: 400 11px/1.2 var(--f-mono); letter-spacing: 0.02em;
              color: oklch(0.92 0.03 27 / 0.85); }
.hold[data-locked="true"] { background: var(--panel-2); border-color: var(--line); color: var(--muted);
                            background-image: none; cursor: default; }
.kill-lock { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--crit); border-radius: var(--r);
             background: var(--crit-wash); font: 400 12px/1.45 var(--f-mono); }
.kill-lock b { color: var(--down); letter-spacing: 0.1em; }
.kill-reset { font: 400 12px/1.5 var(--f-mono); color: var(--muted); }

/* ---------------------------------------------------------------- dialogs */
dialog { padding: 0; color: var(--ink); background: var(--panel); border: 1px solid var(--line);
         border-radius: 4px; max-width: min(560px, calc(100vw - 24px)); width: 100%; }
dialog::backdrop { background: oklch(0.1 0.005 75 / 0.72); }
.dlg-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.dlg-head h2 { margin: 0; font: 600 13px/1 var(--f-display); letter-spacing: 0.12em; text-transform: uppercase; }
.dlg-body { padding: 16px; display: grid; gap: 12px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.dlg-danger { border-color: var(--crit); }
.dlg-danger .dlg-head h2 { color: var(--down); }
.field-label { font: 500 11px/1 var(--f-mono); letter-spacing: 0.08em; color: var(--ink-2); }
.field { width: 100%; height: 48px; padding: 0 12px; font: 600 18px/1 var(--f-mono); letter-spacing: 0.3em;
         color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); }
.field:focus-visible { outline-color: var(--crit); outline-offset: 0; }

.palette { max-width: min(620px, calc(100vw - 24px)); margin-top: 12vh; }
.palette input { width: 100%; height: 52px; padding: 0 16px; border: 0; border-bottom: 1px solid var(--line);
                 background: transparent; color: var(--ink); font: 400 15px/1 var(--f-mono); }
.palette input:focus-visible { outline: none; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow: auto; }
.palette li { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 10px;
              border-radius: 2px; cursor: pointer; font-size: 13.5px; }
.palette li[aria-selected="true"] { background: var(--raise); }
.palette li[aria-selected="true"] .pk { color: var(--vajra); }
.palette .pk { width: 12px; font: 400 12px/1 var(--f-mono); color: var(--faint); }
.palette .pg { margin-left: auto; font: 400 10.5px/1 var(--f-mono); color: var(--faint); letter-spacing: 0.08em; text-transform: uppercase; }
.palette .pempty { padding: 14px 10px; color: var(--muted); font: 400 12px/1 var(--f-mono); }

.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; align-items: center; font-size: 13px; }

/* ---------------------------------------------------------------- footer */
.foot { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 18px; padding-top: 12px;
        border-top: 1px solid var(--line-soft); font: 400 11px/1.4 var(--f-mono); color: var(--faint); }

/* ---------------------------------------------------------------- login */
.login { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; min-height: 100vh; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 4px; }
.login-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line-soft); }
.login-head svg { width: 30px; height: 30px; color: var(--vajra); }
.login-body { display: grid; gap: 14px; padding: 20px 22px 22px; }
.login-body .field { letter-spacing: 0.05em; font-weight: 400; font-size: 15px; }
.login-msg { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); font: 400 12px/1.45 var(--f-mono); }
.login-msg.err { border-color: oklch(0.71 0.175 25 / 0.5); color: oklch(0.86 0.07 25); background: var(--down-wash); }
.login-msg.lock { border-color: var(--crit); background: var(--crit-wash); color: var(--ink); }
.login-msg.warn { border-color: oklch(0.76 0.15 55 / 0.5); color: var(--serious); }
.login-foot { display: flex; justify-content: space-between; padding: 10px 22px; border-top: 1px solid var(--line-soft);
              font: 400 10.5px/1.4 var(--f-mono); color: var(--faint); letter-spacing: 0.04em; }

/* ---------------------------------------------------------------- phone */
.sb-more { display: none; }
@media (max-width: 860px) {
  .statusbar { flex-wrap: wrap; padding: 0 8px; }
  .brand { border-right: 0; padding-right: 8px; min-height: 52px; }
  .brand-sub { display: none; }
  /* compact grid instead of a sideways scroller: hairlines come from the 1px gaps */
  .sb-cells { order: 3; flex-basis: 100%; display: grid; overflow: visible; gap: 1px;
              margin: 0 -8px; background: var(--line-soft); border-top: 1px solid var(--line-soft);
              grid-template-columns: auto minmax(0, 1fr) auto;
              grid-template-areas: "mode guard clock" "phase phase next"; }
  .statusbar[data-expanded="true"] .sb-cells {
    grid-template-areas: "mode guard clock" "phase phase next" "worker broker ip"; }
  .sb-cell { min-width: 0; padding: 7px 10px; border-right: 0; background: oklch(0.142 0.006 75); }
  .sb-cell > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .sb-cell[data-cell="mode"] { grid-area: mode; }   .sb-cell[data-cell="guard"] { grid-area: guard; }
  .sb-cell[data-cell="clock"] { grid-area: clock; } .sb-cell[data-cell="phase"] { grid-area: phase; }
  .sb-cell[data-cell="next"] { grid-area: next; }   .sb-cell[data-cell="worker"] { grid-area: worker; }
  .sb-cell[data-cell="broker"] { grid-area: broker; } .sb-cell[data-cell="ip"] { grid-area: ip; }
  .sb-cell[data-cell="clock"], .sb-cell[data-cell="next"], .sb-cell[data-cell="ip"] { text-align: right; align-items: flex-end; }
  .sb-cell.optional { display: none; }
  .statusbar[data-expanded="true"] .sb-cell.optional { display: flex; }
  .sb-more { display: inline-flex; }
  .sb-right { margin-left: auto; border-left: 0; padding-left: 0; }
  .sb-right .hide-sm { display: none; }
  .gauge-wrap { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .tl-item { grid-template-columns: 1fr; gap: 2px; }
}
.mobile-kill { display: none; }
@media (max-width: 860px) {
  .mobile-kill { position: fixed; right: 12px; bottom: 12px; z-index: 25; display: inline-flex;
                 min-height: 48px; box-shadow: 0 0 0 4px var(--bg); }
}

@media (forced-colors: active) {
  .gauge .fill, .meter .m-fill { forced-color-adjust: none; }
  .chip, .badge, .btn { border: 1px solid CanvasText; }
}
.stack { display: grid; gap: var(--gap); align-content: start; min-width: 0; }
