/* ══════════════════════════════════════════════════════════════════════════
   ALPHA — Autonomous Learning & Portfolio Handling Architecture
   Monochrome financial control center.

   Design system is taken verbatim from the brief: pure black canvas, near-black
   surfaces, white typography, restrained grayscale. State is communicated with
   line weight, opacity, dash patterns, contrast and motion — never with colour.
   Geist Sans carries understanding; Geist Mono carries measurement.
   ══════════════════════════════════════════════════════════════════════════ */

/* Geist is used when the operator drops the woff2 files into ui/fonts/.
   Every rule below falls back cleanly to the platform stack if they're absent,
   so the dashboard is fully self-contained and works offline either way. */
@font-face {
  font-family: 'Geist Sans Local';
  src: url('/fonts/Geist-Variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono Local';
  src: url('/fonts/GeistMono-Variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* ── Palette ─────────────────────────────────────────────────────────── */
  --bg: #000000;
  --card: #0a0a0a;
  --elevated: #111111;
  --border: #242424;
  --border-soft: #1a1a1a;
  --text: #ffffff;
  --text-2: #a3a3a3;
  --text-3: #666666;
  --strong: #f5f5f5;
  --reserve: #404040;

  /* ── Type ────────────────────────────────────────────────────────────── */
  --sans: 'Geist Sans Local', 'Geist Sans', Geist, Inter, -apple-system,
    BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'Geist Mono Local', 'Geist Mono', 'IBM Plex Mono', ui-monospace,
    'SF Mono', 'Cascadia Mono', Menlo, Consolas, 'Liberation Mono', monospace;

  /* ── Rhythm ──────────────────────────────────────────────────────────── */
  --gap: 10px;
  --pad: 16px;
  --radius: 3px;
  --sidebar: 208px;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}

/* Numerals never reflow as they tick. */
.mono, .hero, .metric-v, .stat-v, .num, .tbl td.num, .chart-metric,
.riskscore-v, .sys-list dd { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ══ Shell ═══════════════════════════════════════════════════════════════ */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

/* ══ Sidebar ═════════════════════════════════════════════════════════════ */

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 14px;
  border-right: 1px solid var(--border);
  background: var(--bg);
}

.brand { display: flex; gap: 10px; align-items: flex-start; }
.brand-mark { width: 24px; height: auto; flex: none; margin-top: 1px; }
.brand-text { min-width: 0; }
/* The supplied wordmark. Sized by width so its aspect ratio is preserved. */
.brand-logo { display: block; width: 118px; height: auto; }
.brand-logo.sm { width: 92px; }
.brand-name { font-size: 19px; font-weight: 600; letter-spacing: .16em; }
.brand-name.sm { font-size: 15px; }
.brand-tagline {
  font-size: 9.5px; font-weight: 400; color: var(--text-3);
  letter-spacing: .04em; line-height: 1.35; margin-top: 2px;
}
.brand-tagline.sm { font-size: 9px; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  font-size: 11px; font-weight: 500; letter-spacing: .09em;
  color: var(--text-3); text-decoration: none;
  border-left: 2px solid transparent;
  transition: color .15s, background .15s, border-color .15s;
}
.nav-item:hover { color: var(--text-2); background: var(--card); }
.nav-item.is-active {
  color: var(--text); background: var(--elevated); border-left-color: var(--text);
}
.nav-ico { font-size: 11px; width: 12px; text-align: center; opacity: .8; }

.sys-card {
  margin-top: auto;
  border: 1px solid var(--border);
  background: var(--card);
  padding: 12px;
}
.sys-head {
  display: flex; align-items: center; gap: 7px;
  font-size: 10px; font-weight: 500; letter-spacing: .12em; color: var(--text-3);
}
.sys-state { font-size: 15px; font-weight: 600; letter-spacing: .04em; margin-top: 8px; }
.sys-sub { font-size: 10.5px; color: var(--text-3); }
.sys-list { margin: 12px 0 0; display: grid; gap: 7px; }
.sys-list > div { display: flex; justify-content: space-between; gap: 8px; }
.sys-list dt { font-size: 9.5px; letter-spacing: .1em; color: var(--text-3); }
.sys-list dd { margin: 0; font-size: 10.5px; font-weight: 500; color: var(--text-2); }

/* The system heartbeat — the one piece of ambient motion. */
.pulse {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text); flex: none;
  animation: pulse 2.4s ease-in-out infinite;
}
.pulse[data-state='idle'] { background: var(--text-3); animation: none; }
.pulse[data-state='stale'] { background: var(--text-2); animation: pulse 1s steps(2) infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255,255,255,.35); }
  50% { opacity: .55; box-shadow: 0 0 0 5px rgba(255,255,255,0); }
}

/* ══ Main ════════════════════════════════════════════════════════════════ */

.main { min-width: 0; max-width: 100%; padding: 0 14px 14px; display: flex; flex-direction: column; gap: var(--gap); }
/* Wide content (tables, charts) scrolls inside its own box — the page body
   itself must never scroll sideways. */
.main > section { min-width: 0; }

/* ── Top system bar ─────────────────────────────────────────────────────── */

.sysbar {
  position: sticky; top: 0; z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 24px;
  padding: 12px 4px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.sysbar-brand { display: none; }
.sysbar-stats { display: flex; gap: 0; flex-wrap: wrap; min-width: 0; }
.sysbar-right { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; min-width: 0; }

.stat { display: flex; flex-direction: column; gap: 2px; padding: 0 20px 0 0; margin-right: 20px; border-right: 1px solid var(--border); }
.stat:last-child { border-right: 0; }
.stat.align-r { align-items: flex-end; text-align: right; border-right: 0; }
.stat-l { font-size: 9.5px; font-weight: 500; letter-spacing: .12em; color: var(--text-3); }
.stat-v { font-size: 15px; font-weight: 600; letter-spacing: .01em; display: flex; align-items: center; gap: 6px; }
.stat-s { font-size: 9.5px; font-weight: 400; color: var(--text-3); font-family: var(--mono); }

.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text); animation: pulse 2.4s ease-in-out infinite; }
.dot[data-state='idle'] { background: var(--text-3); animation: none; }
.dot[data-state='stale'] { background: var(--text-2); }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px;
  border: 1px solid var(--border); background: var(--elevated);
  color: var(--text); text-decoration: none;
  font-size: 10.5px; font-weight: 500; letter-spacing: .1em;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #1a1a1a; border-color: var(--text-3); }

/* ── Cards & grids ──────────────────────────────────────────────────────── */

.grid { display: grid; gap: var(--gap); align-items: stretch; }
.grid-hero      { grid-template-columns: minmax(280px, 1.05fr) minmax(0, 2.1fr) minmax(230px, .95fr); }
.grid-primary   { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.25fr) minmax(280px, .85fr); }
.grid-secondary { grid-template-columns: minmax(0, .9fr) minmax(0, 1fr) minmax(0, 1.35fr) minmax(230px, .85fr); }
.grid-trading   { grid-template-columns: minmax(0, .95fr) minmax(0, 1.1fr) minmax(0, .95fr) minmax(280px, 1.1fr); }
.grid-intel     { grid-template-columns: minmax(0, 1.2fr) minmax(0, .85fr) minmax(0, .85fr) minmax(0, 1.1fr); }
.grid-quality   { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-bottom    { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }

.card {
  display: flex; flex-direction: column;
  border: 1px solid var(--border);
  background: var(--card);
  padding: var(--pad);
  min-width: 0;
  border-radius: var(--radius);
}

/* Heads must be able to wrap: a long title plus a six-button range selector
   otherwise sets a min-content width that pushes the whole card wider than a
   phone viewport and scrolls the page sideways. */
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px 12px; margin-bottom: 12px; min-height: 22px; min-width: 0;
}
.card-head h2 {
  margin: 0; display: flex; align-items: center; gap: 8px; min-width: 0;
  font-size: 11.5px; font-weight: 600; letter-spacing: .11em; color: var(--strong);
}
.idx {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px;
  border: 1px solid var(--border); color: var(--text-3);
  font-family: var(--mono); font-size: 9px; font-weight: 500;
}
.head-note { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; color: var(--text-3); }
.head-note.live { color: var(--text-2); }
.head-note.live::before {
  content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 5px;
  border-radius: 50%; background: var(--text); animation: pulse 2.4s ease-in-out infinite;
}
.card-label { font-size: 9.5px; font-weight: 500; letter-spacing: .13em; color: var(--text-3); }
.sub-label {
  font-size: 9px; font-weight: 500; letter-spacing: .13em; color: var(--text-3);
  margin: 10px 0 4px;
}

/* ── Hero metric ────────────────────────────────────────────────────────── */

.card-hero { position: relative; overflow: hidden; justify-content: space-between; }
.hero {
  font-size: clamp(30px, 3.1vw, 44px); font-weight: 600;
  letter-spacing: -.02em; line-height: 1.05; margin-top: 8px;
}
.hero-sub { display: flex; gap: 10px; align-items: baseline; font-family: var(--mono); font-size: 12px; font-weight: 600; margin-top: 6px; }
.hero-sub .muted { color: var(--text-2); font-weight: 500; }
.hero-note { font-size: 9.5px; color: var(--text-3); font-family: var(--mono); margin-top: 2px; }
.hero-spark { height: 62px; margin: 10px -4px -4px; min-width: 0; }
.hero-spark svg, .status-ring svg, .alloc-ring svg { display: block; width: 100%; height: 100%; }

.metrics-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
.metric { padding: 0 18px; border-right: 1px solid var(--border-soft); display: flex; flex-direction: column; justify-content: center; }
.metric:first-child { padding-left: 0; }
.metric:last-child { border-right: 0; }
.metric-v { font-size: clamp(20px, 2.1vw, 30px); font-weight: 600; letter-spacing: -.01em; margin-top: 6px; }
.metric-s { font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--text-2); margin-top: 4px; }

.card-status { justify-content: center; }
.status-row { display: flex; align-items: center; gap: 16px; margin-top: 10px; min-width: 0; }
.status-row > div { min-width: 0; }
.status-ring { width: 62px; height: 62px; flex: none; }
.status-v { font-size: 20px; font-weight: 600; letter-spacing: .02em; }
/* Allocation reasons are full sentences from the reserve engine — clamp them
   so a long explanation can never spill across the ring. */
.status-s {
  font-size: 10.5px; color: var(--text-3); margin-top: 2px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; overflow-wrap: anywhere;
}

/* ── Charts ─────────────────────────────────────────────────────────────── */

.chart { width: 100%; min-width: 0; }
.chart-xs { height: 42px; }
.chart-sm { height: 96px; }
.chart-md { height: 148px; }
.chart-lg { height: 208px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }

.chart-metric { font-size: 22px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 6px; display: flex; align-items: baseline; gap: 8px; }
.chart-metric-s { font-family: var(--sans); font-size: 9.5px; font-weight: 500; letter-spacing: .12em; color: var(--text-3); }
.chart-foot { font-family: var(--mono); font-size: 9.5px; color: var(--text-3); margin-top: 6px; letter-spacing: .04em; }

.ranges { display: flex; gap: 1px; flex-wrap: wrap; }
.ranges button {
  padding: 3px 7px; min-width: 28px;
  background: transparent; border: 1px solid transparent; color: var(--text-3);
  font-family: var(--mono); font-size: 9.5px; font-weight: 500; letter-spacing: .06em;
  cursor: pointer; transition: color .12s, background .12s, border-color .12s;
}
.ranges button:hover { color: var(--text-2); }
.ranges button.is-active { color: var(--text); background: var(--elevated); border-color: var(--border); }

/* §6 performance strip — the six numbers that answer "are we beating the market". */
.perf-strip {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px; background: var(--border);
  border: 1px solid var(--border); margin-bottom: 10px;
}
.perf-cell { background: var(--card); padding: 7px 9px; min-width: 0; }
.perf-l { font-size: 8.5px; font-weight: 500; letter-spacing: .1em; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.perf-v { font-family: var(--mono); font-size: 14px; font-weight: 600; margin-top: 2px; }
@media (max-width: 900px) { .perf-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 2px 0 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 9.5px; letter-spacing: .05em; color: var(--text-2); }
.legend i { display: inline-block; width: 16px; height: 0; border-top-style: solid; }

/* Axis + grid inside SVG charts. */
.ax { font-family: var(--mono); font-size: 9px; fill: var(--text-3); letter-spacing: .04em; }
.grid-line { stroke: var(--border); stroke-width: 1; }
.zero-line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 3; }
.series-primary { fill: none; stroke: var(--text); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.series-secondary { fill: none; stroke: var(--text-2); stroke-width: 2; stroke-dasharray: 6 4; }
.series-tertiary { fill: none; stroke: var(--text-3); stroke-width: 2; stroke-dasharray: 2 4; }
.series-support { fill: none; stroke: var(--text-2); stroke-width: 1.5; }
.series-dd { fill: none; stroke: var(--text-2); stroke-width: 2; }
.crosshair { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 2 3; }

/* First paint draws the primary line on, so the system reads as "live". */
@media (prefers-reduced-motion: no-preference) {
  .draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1s ease-out forwards; }
  @keyframes draw { to { stroke-dashoffset: 0; } }
}

.tip {
  position: fixed; z-index: 60; pointer-events: none;
  padding: 7px 9px; border: 1px solid var(--border); background: #000;
  font-family: var(--mono); font-size: 10.5px; white-space: nowrap;
}
.tip b { display: block; font-weight: 600; font-size: 11.5px; }
.tip span { color: var(--text-3); font-size: 9.5px; }

/* ── Allocation ─────────────────────────────────────────────────────────── */

.alloc { display: flex; align-items: center; gap: 18px; flex: 1; }
.alloc-ring { width: 132px; height: 132px; flex: none; }
.alloc-legend { display: grid; gap: 14px; min-width: 0; }
.alloc-legend > div { display: grid; grid-template-columns: 10px 1fr; gap: 9px; align-items: start; }
.alloc-swatch { width: 10px; height: 10px; margin-top: 3px; }
.alloc-name { font-size: 9.5px; font-weight: 500; letter-spacing: .12em; color: var(--text-3); }
.alloc-pct { font-family: var(--mono); font-size: 15px; font-weight: 600; }
.alloc-abs { font-family: var(--mono); font-size: 10.5px; color: var(--text-2); }

/* ── Tables ─────────────────────────────────────────────────────────────── */

.table-wrap { min-width: 0; overflow-x: auto; flex: 1; }
.table-wrap.scroll { overflow-y: auto; max-height: 210px; }
.table-wrap.scroll.sm { max-height: 132px; }
.table-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border); }
.table-wrap::-webkit-scrollbar-track { background: transparent; }

.tbl { width: 100%; border-collapse: collapse; white-space: nowrap; }
.tbl th {
  position: sticky; top: 0; z-index: 1;
  padding: 0 10px 7px 0; text-align: left; background: var(--card);
  font-size: 9px; font-weight: 500; letter-spacing: .12em; color: var(--text-3);
  border-bottom: 1px solid var(--border);
}
.tbl td {
  padding: 7px 10px 7px 0;
  font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--text-2);
  border-bottom: 1px solid var(--border-soft);
}
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.sym, .tbl td.strong { color: var(--text); font-weight: 600; }
.tbl th.num, .tbl td.num { text-align: right; padding-right: 0; }
.tbl-dense td { padding: 5px 10px 5px 0; font-size: 10.5px; }
.tbl tbody tr:hover td { background: var(--elevated); }
.tbl .time { color: var(--text-3); font-size: 10px; }

/* A newly-arrived execution row flashes once — activity you can see. */
@media (prefers-reduced-motion: no-preference) {
  .row-new { animation: flash 1.4s ease-out; }
  @keyframes flash {
    0% { background: rgba(255,255,255,.14); }
    100% { background: transparent; }
  }

  /* §6: a metric whose value actually changed flashes to full contrast and
     settles. Applied only on real changes, never on a no-op repaint. */
  .is-updated { animation: settle 380ms ease-out; }
  @keyframes settle {
    0% { color: #fff; text-shadow: 0 0 12px rgba(255, 255, 255, .55); }
    100% { text-shadow: none; }
  }
}

/* Reduced motion: no pulse, no draw-on, no flash — layout stays identical. */
@media (prefers-reduced-motion: reduce) {
  .pulse, .dot, .head-note.live::before { animation: none !important; }
  .row-new, .is-updated { animation: none !important; }
  * { scroll-behavior: auto !important; }
}

/* State chips: contrast and weight, never colour. */
.chip {
  display: inline-block; padding: 2px 7px; min-width: 52px; text-align: center;
  font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: .1em;
  border: 1px solid var(--border); color: var(--text-2);
}
.chip[data-s='PASS']     { color: var(--text); border-color: var(--text-3); }
.chip[data-s='WATCH']    { color: var(--text-2); border-color: var(--text-2); border-style: dashed; }
.chip[data-s='BLOCKED']  { color: #000; background: var(--text-2); border-color: var(--text-2); }
.chip[data-s='CRITICAL'] { color: #000; background: var(--text); border-color: var(--text); font-weight: 700; }
.chip[data-s='BUY']      { color: var(--text); border-color: var(--text); }
.chip[data-s='HOLD']     { color: var(--text-2); }
.chip[data-s='WATCH_ACT']{ color: var(--text-3); border-style: dashed; }
.chip[data-s='SELL']     { color: var(--text-2); border-style: dashed; border-color: var(--text-2); }

/* Positive = solid white; negative = muted grey. No red/green anywhere. */
.pos { color: var(--text); }
.neg { color: var(--text-3); }
.flat { color: var(--text-2); }

/* ── Trade activity ─────────────────────────────────────────────────────── */

.activity { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; flex: 1; }
.activity-list { margin: 0; display: grid; gap: 8px; text-align: right; }
.activity-list > div { display: grid; gap: 1px; }
.activity-list dt { font-family: var(--mono); font-size: 17px; font-weight: 600; }
.activity-list dd { margin: 0; font-size: 9px; font-weight: 500; letter-spacing: .12em; color: var(--text-3); }
.activity-list > div.total dt { font-size: 26px; }

/* ── Net P&L attribution ────────────────────────────────────────────────── */

.netpnl { display: grid; gap: 5px; margin-bottom: 10px; }
.netpnl-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.netpnl-l { font-size: 9.5px; font-weight: 500; letter-spacing: .1em; color: var(--text-3); }
.netpnl-v { font-family: var(--mono); font-size: 12px; font-weight: 500; }
.netpnl-row.total { border-top: 1px solid var(--border); padding-top: 6px; margin-top: 2px; }
.netpnl-row.total .netpnl-l { color: var(--strong); font-weight: 600; }
.netpnl-row.total .netpnl-v { font-size: 20px; font-weight: 600; }
.netpnl-note { font-family: var(--mono); font-size: 9px; color: var(--text-3); letter-spacing: .04em; }

/* ── Loss attribution ───────────────────────────────────────────────────── */

.loss-analysis { display: grid; gap: 6px; margin-bottom: 10px; }
.loss-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.loss-head { display: flex; justify-content: space-between; font-size: 10px; }
.loss-name { font-size: 10px; font-weight: 500; color: var(--text-2); }
.loss-amt { font-family: var(--mono); font-size: 10.5px; color: var(--text-3); }
/* Share bar: length encodes proportion, no colour needed. */
.loss-bar { grid-column: 1 / -1; height: 3px; background: var(--border); }
.loss-bar i { display: block; height: 100%; background: var(--text); }
.loss-rec {
  font-size: 10px; color: var(--text-3); line-height: 1.45;
  border-top: 1px solid var(--border-soft); padding-top: 7px; margin-top: 2px;
}

/* ── Risk command center ────────────────────────────────────────────────── */

.card-riskcenter { justify-content: space-between; }
.gauges { display: grid; gap: 5px; }
.gauge { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; }
.gauge-l { font-size: 9.5px; font-weight: 500; letter-spacing: .1em; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }
.gauge-d { font-family: var(--mono); font-size: 10px; color: var(--text-2); text-align: right; }

.riskscore { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.riskscore-head { display: flex; justify-content: space-between; align-items: center; }
.riskscore-head span:last-child { font-family: var(--mono); font-size: 9.5px; font-weight: 600; letter-spacing: .1em; }
.riskscore-row { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.riskscore-v { font-size: 30px; font-weight: 600; line-height: 1; }
.riskscore-v::after { content: ' / 100'; font-size: 11px; font-weight: 400; color: var(--text-3); }
.riskscore-bar { flex: 1; min-width: 0; }
.riskscore-track { position: relative; height: 1px; background: var(--border); margin: 8px 0 5px; }
.riskscore-track i {
  position: absolute; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px;
  background: var(--text); border-radius: 50%; transition: left .5s cubic-bezier(.4,0,.2,1);
}
.riskscore-ends { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 8.5px; letter-spacing: .1em; color: var(--text-3); }

/* ── Decision engine ────────────────────────────────────────────────────── */

.decision { display: grid; gap: 10px; flex: 1; }
.decision-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  font-family: var(--mono); font-size: 15px; font-weight: 600; letter-spacing: .02em;
}
.decision-grid { display: grid; gap: 4px; }
.decision-grid > div { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.decision-grid dt, .decision-k { font-size: 10px; color: var(--text-3); }
.decision-v { font-family: var(--mono); font-size: 10.5px; font-weight: 500; color: var(--text-2); }
.decision-v.strong { color: var(--text); font-weight: 600; }
.decision-rationale {
  font-size: 10.5px; color: var(--text-3); line-height: 1.5;
  border-top: 1px solid var(--border-soft); padding-top: 8px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.link-btn {
  margin-top: 10px; padding: 7px 0;
  background: transparent; border: 0; border-top: 1px solid var(--border);
  color: var(--text-3); font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em;
  text-align: left; cursor: pointer; width: 100%; transition: color .15s;
}
.link-btn:hover { color: var(--text); }

/* ── System health / audit tiles ────────────────────────────────────────── */

.health { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); }
.health-tile { background: var(--card); padding: 9px 8px; text-align: center; }
.health-l { font-size: 8.5px; font-weight: 500; letter-spacing: .1em; color: var(--text-3); }
.health-v { font-family: var(--mono); font-size: 15px; font-weight: 600; margin-top: 3px; }
.health-sub { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; margin-top: 12px; }
.health-sub > div { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; }
.health-sub dt, .health-sub .k { color: var(--text-3); }
.health-sub .v { font-family: var(--mono); font-weight: 500; color: var(--text-2); }

.audit { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); margin-bottom: 12px; }
.audit-tile { background: var(--card); padding: 9px 6px; text-align: center; }
.audit-v { font-family: var(--mono); font-size: 17px; font-weight: 600; }
.audit-l { font-size: 8.5px; font-weight: 500; letter-spacing: .1em; color: var(--text-3); margin-top: 2px; }
.audit-tile[data-alert='true'] .audit-v { color: #000; }
.audit-tile[data-alert='true'] { background: var(--text); }
.audit-tile[data-alert='true'] .audit-l { color: #333; }

/* ── History & next session ─────────────────────────────────────────────── */

.search {
  flex: 1; max-width: 320px; min-width: 0;
  padding: 6px 10px;
  background: var(--elevated); border: 1px solid var(--border); color: var(--text);
  font-family: var(--mono); font-size: 10.5px;
}
.search::placeholder { color: var(--text-3); }
.search:focus { outline: none; border-color: var(--text-3); }

.tabs { display: flex; gap: 1px; margin-bottom: 10px; border-bottom: 1px solid var(--border); }
.tabs button {
  padding: 6px 12px; background: transparent; border: 0; border-bottom: 2px solid transparent;
  color: var(--text-3); font-family: var(--mono); font-size: 9.5px; font-weight: 500; letter-spacing: .1em;
  cursor: pointer; transition: color .15s, border-color .15s;
}
.tabs button:hover { color: var(--text-2); }
.tabs button.is-active { color: var(--text); border-bottom-color: var(--text); }

.next { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; flex: 1; }
.next-col h3 { margin: 0 0 8px; font-size: 9.5px; font-weight: 600; letter-spacing: .12em; color: var(--text-3); }
.next-col ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.next-col li { font-size: 10.5px; color: var(--text-2); line-height: 1.45; padding-left: 11px; position: relative; }
.next-col li::before { content: '•'; position: absolute; left: 0; color: var(--text-3); }

.empty { padding: 18px 0; font-family: var(--mono); font-size: 10.5px; color: var(--text-3); letter-spacing: .04em; }

/* A deliberate no-trade session is a RESULT, not an absence — it gets the
   same visual weight as a feed, with the reason the gate gave. */
.nofeed { padding: 14px 0; display: grid; gap: 4px; }
.nofeed-h {
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .08em;
  color: var(--text);
}
.nofeed-s { font-family: var(--mono); font-size: 9.5px; color: var(--text-2); }
.nofeed-r {
  font-family: var(--mono); font-size: 9.5px; color: var(--text-3);
  padding-left: 10px; position: relative; white-space: normal;
}
.nofeed-r::before { content: '›'; position: absolute; left: 0; }

/* ── §5.9 Capital allocation map ────────────────────────────────────────── */

/* A left-to-right flow: TOTAL → RESERVE → INVESTED → POSITIONS. Bar length
   encodes the share of capital; no colour is needed to read it. */
.capital-flow { display: grid; gap: 7px; }
.flow-step { display: grid; grid-template-columns: 74px 1fr auto; gap: 9px; align-items: center; }
.flow-l { font-size: 8.5px; font-weight: 500; letter-spacing: .1em; color: var(--text-3); }
.flow-bar { height: 8px; background: var(--elevated); border: 1px solid var(--border); position: relative; }
.flow-bar i { position: absolute; inset: 0 auto 0 0; background: var(--text); }
.flow-bar i.reserve { background: var(--reserve); }
.flow-bar .target {
  position: absolute; top: -2px; bottom: -2px; width: 1px; background: var(--text-2);
}
.flow-v { font-family: var(--mono); font-size: 10.5px; font-weight: 500; }
.flow-sub {
  display: grid; grid-template-columns: 74px 1fr; gap: 9px;
  font-family: var(--mono); font-size: 9.5px; color: var(--text-3);
}
.flow-pos { display: flex; flex-wrap: wrap; gap: 4px 10px; }

/* ── §5.12 Decision timeline ────────────────────────────────────────────── */

.chain { display: grid; gap: 0; }
.chain-step {
  display: grid; grid-template-columns: 62px 12px 1fr auto; gap: 8px; align-items: start;
  font-family: var(--mono); font-size: 9.5px; padding: 3px 0;
}
.chain-time { color: var(--text-3); }
/* The connector line makes the sequence read as a chain, not a list. */
.chain-mark { position: relative; height: 100%; min-height: 14px; }
.chain-mark::before {
  content: ''; position: absolute; left: 4px; top: 8px; bottom: -3px; width: 1px; background: var(--border);
}
.chain-step:last-child .chain-mark::before { display: none; }
.chain-mark::after {
  content: ''; position: absolute; left: 1px; top: 4px;
  width: 7px; height: 7px; border: 1px solid var(--text-2); background: #000;
}
.chain-step.is-final .chain-mark::after { background: var(--text); border-color: var(--text); }
.chain-step.is-blocked .chain-mark::after { background: var(--text-3); border-color: var(--text-3); }
.chain-stage { color: var(--text); letter-spacing: .06em; }
.chain-detail { color: var(--text-3); font-size: 9px; }
.chain-offset { color: var(--text-3); }
.chain-head {
  display: flex; justify-content: space-between; gap: 10px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 600; margin-bottom: 6px;
}

/* ── §5.18 Execution quality ────────────────────────────────────────────── */

.exq {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px; background: var(--border); border: 1px solid var(--border);
}
.exq-tile { background: var(--card); padding: 9px 8px; text-align: center; }
.exq-v { font-family: var(--mono); font-size: 15px; font-weight: 600; }
.exq-l { font-size: 8.5px; font-weight: 500; letter-spacing: .1em; color: var(--text-3); margin-top: 2px; }
.exq-sub { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 14px; margin-top: 11px; }
.exq-sub > div { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; }
.exq-sub .k { color: var(--text-3); }
.exq-sub .v { font-family: var(--mono); font-weight: 500; color: var(--text-2); }

/* ── §5.19 Market coverage ──────────────────────────────────────────────── */

.coverage { display: grid; gap: 6px; }
.coverage > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.coverage .k { font-size: 9.5px; font-weight: 500; letter-spacing: .1em; color: var(--text-3); }
.coverage .v { font-family: var(--mono); font-size: 14px; font-weight: 600; }

/* Attention matrix: opacity encodes score, border encodes actionability. */
.matrix { display: flex; flex-wrap: wrap; gap: 4px; }
.matrix-cell {
  min-width: 52px; padding: 5px 6px; text-align: center;
  border: 1px solid var(--border); background: var(--elevated);
  font-family: var(--mono); font-size: 9px; letter-spacing: .04em;
}
.matrix-cell b { display: block; font-size: 10.5px; font-weight: 600; color: var(--text); }
.matrix-cell.is-actionable { border-color: var(--text); }
.matrix-cell.is-held { background: #1c1c1c; }
.matrix-score { color: var(--text-3); }

/* ── §5.17 Ranking scores ───────────────────────────────────────────────── */

.signals { display: grid; gap: 5px; }
.signal-row { display: grid; grid-template-columns: 82px 1fr 34px; gap: 8px; align-items: center; }
.signal-l { font-size: 9px; letter-spacing: .08em; color: var(--text-3); text-transform: uppercase; }
.signal-track { height: 5px; background: var(--elevated); border: 1px solid var(--border); position: relative; }
.signal-track i { position: absolute; inset: 0 auto 0 0; background: var(--text-2); }
.signal-track i.strong { background: var(--text); }
/* Neutral (50) reference — a signal at its placeholder value reads as inert. */
.signal-track .mid { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--text-3); }
.signal-v { font-family: var(--mono); font-size: 9.5px; text-align: right; color: var(--text-2); }

/* ── §5.24 Global search ────────────────────────────────────────────────── */

.search-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .82);
  display: flex; justify-content: center; padding: 10vh 16px 16px;
}
/* A class-level `display` beats the UA's `[hidden] { display: none }`, so the
   hidden state has to be restated here or the overlay renders open on load. */
.search-overlay[hidden] { display: none; }
.search-panel {
  width: min(760px, 100%); max-height: 74vh; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border); box-shadow: 0 24px 80px rgba(0, 0, 0, .9);
}
.search-bar {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.search-icon { font-size: 15px; color: var(--text-3); }
.search-bar input {
  flex: 1; min-width: 0; background: transparent; border: 0; color: var(--text);
  font-family: var(--mono); font-size: 14px;
}
.search-bar input:focus { outline: none; }
.search-bar input::placeholder { color: var(--text-3); }
.search-kbd {
  font-family: var(--mono); font-size: 9px; letter-spacing: .08em; color: var(--text-3);
  border: 1px solid var(--border); padding: 2px 5px;
}
.search-results { overflow-y: auto; flex: 1; }
.search-group-l {
  padding: 8px 14px 4px; font-size: 8.5px; font-weight: 600; letter-spacing: .14em;
  color: var(--text-3); background: var(--bg); position: sticky; top: 0;
}
.search-hit {
  display: grid; grid-template-columns: 62px 66px 1fr auto; gap: 10px; align-items: baseline;
  padding: 6px 14px; border-bottom: 1px solid var(--border-soft);
  font-family: var(--mono); font-size: 10.5px; color: var(--text-2);
}
.search-hit:hover { background: var(--elevated); }
.search-hit .sym { color: var(--text); font-weight: 600; }
.search-hit .when { color: var(--text-3); font-size: 9.5px; }
.search-hit .val { color: var(--text); }
.search-hit mark { background: var(--text); color: #000; padding: 0 1px; }
.search-foot {
  padding: 8px 14px; border-top: 1px solid var(--border);
  font-family: var(--mono); font-size: 9px; color: var(--text-3); letter-spacing: .04em;
}
.btn-search { gap: 6px; }

/* ══ §10 Module states ═══════════════════════════════════════════════════ */

/* LOADING — skeletons sized to the card so nothing shifts when data lands. */
body:not([data-loaded]) .hero,
body:not([data-loaded]) .metric-v,
body:not([data-loaded]) .chart,
body:not([data-loaded]) .stat-v {
  background: linear-gradient(90deg, var(--elevated) 25%, #161616 50%, var(--elevated) 75%);
  background-size: 200% 100%;
  color: transparent !important;
  border-radius: 2px;
  min-height: 12px;
}
@media (prefers-reduced-motion: no-preference) {
  body:not([data-loaded]) .hero,
  body:not([data-loaded]) .metric-v,
  body:not([data-loaded]) .chart,
  body:not([data-loaded]) .stat-v { animation: shimmer 1.4s linear infinite; }
  @keyframes shimmer { to { background-position: -200% 0; } }
}

/* ERROR — confined to the failing card; the grid and every sibling survive. */
.card[data-module-state='error'] { border-color: var(--text-3); }
.module-error {
  margin-top: 10px; padding: 10px;
  border: 1px dashed var(--text-3); background: var(--elevated);
}
.module-error-h {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  letter-spacing: .1em; color: var(--text);
}
.module-error-s {
  font-family: var(--mono); font-size: 9.5px; color: var(--text-3);
  margin-top: 3px; overflow-wrap: anywhere;
}

/* STALE — inverted bar; impossible to mistake for live data. */
.stale-badge {
  position: fixed; top: 0; left: 0; right: 0; z-index: 95;
  padding: 6px 14px; background: var(--text); color: #000;
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-align: center;
}
/* Everything dims while stale, so a glance cannot read it as current. */
body[data-freshness='stale'] .main { opacity: .82; }

/* PARTIAL — names the unavailable sources rather than hiding the gap. */
.partial-notice {
  display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline;
  padding: 7px 10px; border: 1px dashed var(--border); background: var(--card);
}
/* A class-level `display` outranks the UA's `[hidden] { display: none }`, so
   the hidden state must be restated or the empty notice renders as a bare
   dashed strip. Same trap as .search-overlay and .drawer. */
.partial-notice[hidden] { display: none; }
.partial-h {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: .1em; color: var(--text-2);
}
.partial-r { font-family: var(--mono); font-size: 9.5px; color: var(--text-3); }

/* ══ §7.2 Allocation split bar ═══════════════════════════════════════════ */

.alloc-split {
  position: relative; display: flex; height: 10px; margin-top: 12px;
  border: 1px solid var(--border); background: var(--reserve);
}
.alloc-split-invested { display: block; height: 100%; background: var(--text); }
/* The target marker: where 70% invested would sit. */
.alloc-split-target {
  position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--text-2);
}
.alloc-split-l {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em;
  color: var(--text-2); margin-top: 5px;
}

/* ══ Drawers (§7.22 audit, §7.13/§7.20 detail) ═══════════════════════════ */

.drawer {
  position: fixed; inset: 0; z-index: 98;
  background: rgba(0, 0, 0, .82); display: flex; justify-content: flex-end;
}
.drawer[hidden] { display: none; }
.drawer-panel {
  width: min(720px, 100%); height: 100%; display: flex; flex-direction: column;
  background: var(--card); border-left: 1px solid var(--border);
}
.drawer-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; border-bottom: 1px solid var(--border);
}
.drawer-head h2 {
  margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .12em; color: var(--strong);
  white-space: nowrap;
}
.drawer-close {
  background: transparent; border: 1px solid var(--border); color: var(--text-2);
  /* 44px touch target on mobile (§11). */
  min-width: 32px; min-height: 32px; cursor: pointer; font-size: 12px;
}
.drawer-close:hover { color: var(--text); border-color: var(--text-3); }
.drawer-tiles {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px; background: var(--border); border-bottom: 1px solid var(--border);
}
.drawer-body { flex: 1; overflow-y: auto; }

.audit-row {
  display: grid; grid-template-columns: 92px 150px 1fr 70px;
  gap: 10px; align-items: baseline; padding: 7px 14px;
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--mono); font-size: 10.5px; color: var(--text-2);
  cursor: pointer; width: 100%; text-align: left; background: transparent; border-left: 0; border-right: 0; border-top: 0;
}
.audit-row:hover { background: var(--elevated); }
.audit-row .t { color: var(--text-3); font-size: 9.5px; }
.audit-row .e { color: var(--text); font-weight: 600; }
.audit-row .l { text-align: right; font-size: 9px; letter-spacing: .08em; }
.audit-detail {
  padding: 8px 14px 12px; background: var(--elevated);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono); font-size: 10px; color: var(--text-2);
  white-space: pre-wrap; overflow-wrap: anywhere;
}

.detail-section { padding: 12px 14px; border-bottom: 1px solid var(--border-soft); }
.detail-section h3 {
  margin: 0 0 8px; font-size: 9.5px; font-weight: 600; letter-spacing: .13em; color: var(--text-3);
}
.detail-grid { display: grid; gap: 5px; }
.detail-grid > div { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.detail-k { font-size: 10.5px; color: var(--text-3); }
.detail-v { font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--text); }

.link-inline {
  background: transparent; border: 0; color: var(--text-3); cursor: pointer;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em;
}
.link-inline:hover { color: var(--text); }

/* Rows that open a detail view read as interactive. */
.tbl tbody tr[data-clickable] { cursor: pointer; }
.tbl tbody tr[data-clickable]:hover td:first-child { box-shadow: inset 2px 0 0 var(--text); }

@media (max-width: 900px) {
  .drawer-panel { width: 100%; }
  .drawer-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .audit-row { grid-template-columns: 78px 1fr; row-gap: 2px; }
  .audit-row .l { text-align: left; }
  /* §11: 44px minimum touch targets on mobile. */
  .drawer-close, .ranges button, .tabs button, .link-btn, .link-inline { min-height: 44px; }
  .nav-item { min-height: 44px; }
}

/* ══ Sign-in ═════════════════════════════════════════════════════════════ */

.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 32px 20px; background: var(--bg);
}
.login {
  width: min(560px, 100%); display: flex; flex-direction: column; align-items: stretch;
  text-align: center;
}
/* The supplied wordmark, sized by width so its aspect ratio is preserved. */
.login-logo {
  width: min(400px, 76%); height: auto; margin: 0 auto 40px;
  /* logo.svg is currentColor; as an <img> it renders with its own fill, so the
     asset itself carries white via the fill attribute. */
  filter: none;
}
.login-h1 {
  margin: 0; font-size: clamp(30px, 4.4vw, 42px); font-weight: 600;
  letter-spacing: -.02em; color: var(--text);
}
.login-sub {
  margin: 10px 0 34px; font-size: 15px; font-weight: 400; color: var(--text-2);
}
.login-form { display: flex; flex-direction: column; gap: 18px; text-align: left; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field-l { font-size: 14px; font-weight: 600; color: var(--text); }
.field-box {
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px; min-height: 58px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  transition: border-color .15s;
}
.field-box:focus-within { border-color: var(--text-3); }
.field-ico {
  width: 21px; height: 21px; flex: none; color: var(--text-2);
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.field-box input {
  flex: 1; min-width: 0; background: transparent; border: 0; color: var(--text);
  font-family: var(--sans); font-size: 15px; padding: 16px 0;
}
.field-box input:focus { outline: none; }
.field-box input::placeholder { color: var(--text-3); }
/* Chrome's autofill repaints the input with its own background; keep ours. */
.field-box input:-webkit-autofill,
.field-box input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--card) inset;
  caret-color: var(--text);
}
.field-eye {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: none;
  background: transparent; border: 0; cursor: pointer; color: var(--text-3);
}
.field-eye svg {
  width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.field-eye:hover, .field-eye.is-on { color: var(--text); }

.login-btn {
  margin-top: 8px; min-height: 58px;
  background: var(--strong); color: #000; border: 0; border-radius: 10px;
  font-family: var(--sans); font-size: 16px; font-weight: 600; cursor: pointer;
  transition: background .15s, opacity .15s;
}
.login-btn:hover { background: #fff; }
.login-btn:disabled { opacity: .6; cursor: default; }

.login-link {
  margin: 22px auto 0; background: transparent; border: 0; cursor: pointer;
  color: var(--text-2); font-family: var(--sans); font-size: 14px;
}
.login-link:hover { color: var(--text); }

/* Errors are typographic and high-contrast — never red (§2). */
.login-error {
  margin: 0; padding: 11px 13px;
  border: 1px solid var(--text-3); background: var(--elevated);
  font-family: var(--mono); font-size: 12px; color: var(--text);
}
.login-help {
  margin: 14px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--text-3);
  border-top: 1px solid var(--border-soft); padding-top: 14px; text-align: left;
}
.login-help code {
  font-family: var(--mono); font-size: 11.5px; color: var(--text-2);
}
.login-foot {
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin-top: 44px; padding-top: 16px; border-top: 1px solid var(--border);
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em; color: var(--text-3);
}
/* A live-money instance says so, in inverted type, at the point of sign-in. */
.login-foot [data-mode='LIVE'] {
  background: var(--text); color: #000; padding: 1px 6px; font-weight: 700;
}

@media (max-width: 520px) {
  .login-h1 { font-size: 30px; }
  .login-logo { margin-bottom: 30px; }
  .field-box, .login-btn { min-height: 52px; }
}

/* ── Accessibility ──────────────────────────────────────────────────────── */

/* A visible 1px white focus ring everywhere, per the spec's non-negotiables. */
:focus-visible {
  outline: 1px solid var(--text);
  outline-offset: 2px;
}

/* ── Footer & banner ────────────────────────────────────────────────────── */

.foot {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 4px; border-top: 1px solid var(--border);
  font-family: var(--mono); font-size: 9.5px; color: var(--text-3); letter-spacing: .05em;
}

.banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90;
  padding: 7px 14px; background: var(--text); color: #000;
  font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .06em;
  text-align: center;
}

/* ══ Responsive ══════════════════════════════════════════════════════════ */

@media (max-width: 1500px) {
  .grid-secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-trading   { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-intel     { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1280px) {
  .grid-quality { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1180px) {
  .grid-hero    { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .card-status  { grid-column: 1 / -1; }
  .grid-primary { grid-template-columns: minmax(0, 1fr); }
  .grid-bottom  { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  :root { --sidebar: 0px; --pad: 13px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .sysbar-brand { display: block; }
  .sysbar { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 12px 0 10px; }
  .sysbar-stats { gap: 0; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .sysbar-stats::-webkit-scrollbar { display: none; }
  .stat { padding-right: 14px; margin-right: 14px; }
  .sysbar-right { justify-content: space-between; }
  .main { padding: 0 12px 12px; }

  .grid-hero, .grid-secondary, .grid-trading, .grid-intel, .grid-quality { grid-template-columns: minmax(0, 1fr); }
  .exq { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exq-sub { grid-template-columns: minmax(0, 1fr); }
  .search-overlay { padding: 4vh 10px 10px; }
  .search-hit { grid-template-columns: 56px 1fr; row-gap: 2px; }
  .metrics-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 0; }
  .metric { padding: 0 12px; }
  .metric:nth-child(2n) { border-right: 0; }
  .metric:nth-child(odd) { padding-left: 0; }
  .next { grid-template-columns: minmax(0, 1fr); }
  .health { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .audit { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .activity { grid-template-columns: minmax(0, 1fr); }
  .activity-list { text-align: left; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chart-lg { height: 176px; }
  .alloc { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 520px) {
  .hero { font-size: 32px; }
  .audit { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media print {
  .sidebar, .sysbar-right, .ranges, .link-btn, .tabs, .search { display: none; }
  .card { break-inside: avoid; }
}
