/* ═══════════════════════════════════════════════════════════════════════════
   Autonomous Crypto AI Trader — dashboard
   ═══════════════════════════════════════════════════════════════════════════

   Dark-only and deliberately so: this is a monitoring surface read in long
   sessions, and every colour is chosen against the dark chart surface rather
   than flipped from a light palette. The three categorical hues pass all-pairs
   CVD and normal-vision separation on this surface; status hues are fixed and
   always paired with a label, never carrying meaning by colour alone.

   Responsive strategy: one column under 960px; data tables become stacked
   cards under 720px using the ::before / data-label technique, because a
   horizontally scrolling table is unusable on a phone.
   ══════════════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;

  /* ── surfaces: a real elevation ladder, not arbitrary greys ───────────── */
  --plane:      #070a0f;
  --surface-1:  #0d1117;
  --surface-2:  #131a23;
  --surface-3:  #1a222d;
  --surface-4:  #212b38;

  /* ── ink ──────────────────────────────────────────────────────────────── */
  --ink:        #f4f7fa;
  --ink-2:      #aeb9c6;
  --ink-3:      #74808f;
  --ink-4:      #4d5765;

  /* ── chrome ───────────────────────────────────────────────────────────── */
  --line:       rgba(255, 255, 255, 0.07);
  --line-2:     rgba(255, 255, 255, 0.12);
  --grid:       rgba(255, 255, 255, 0.05);
  --axis:       rgba(255, 255, 255, 0.14);
  /* A 1px top highlight is what makes a dark card read as a raised object
     rather than a flat rectangle. Used on every elevated surface. */
  --sheen:      linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0) 42%);

  /* ── series: validated all-pairs on this surface ──────────────────────── */
  --s1:         #3987e5;   /* blue   — equity, primary series */
  --s2:         #d95926;   /* orange — fast cycles */
  --s3:         #199e70;   /* aqua   — research cycles */

  /* ── status: fixed, never themed, never alone ─────────────────────────── */
  --good:       #0ca30c;
  --good-ink:   #3fd63f;
  --warn:       #fab219;
  --serious:    #ec835a;
  --bad:        #d03b3b;
  --bad-ink:    #f07575;

  /* ── geometry ─────────────────────────────────────────────────────────── */
  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;
  --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.16, 0.7, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(1100px 520px at 18% -12%, rgba(57,135,229,0.09), transparent 70%),
    radial-gradient(900px 460px at 88% -6%, rgba(25,158,112,0.06), transparent 70%),
    var(--plane);
  color: var(--ink);
  font: 400 14px/1.55 var(--sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.014em; }
a { color: var(--s1); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ══ top bar ═════════════════════════════════════════════════════════════ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) clamp(var(--sp-4), 3vw, var(--sp-5));
  padding-top: max(var(--sp-3), env(safe-area-inset-top));
  background: rgba(13, 17, 23, 0.82);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.mark {
  position: relative; flex: none;
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(140deg, var(--s1), var(--s3));
  box-shadow: 0 2px 10px rgba(57,135,229,0.32), inset 0 1px 0 rgba(255,255,255,0.28);
}
.mark::after {
  content: ""; position: absolute; inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.4), transparent 55%);
}
.brand-text { min-width: 0; }
.brand h1 { font-size: 0.94rem; white-space: nowrap; }
.brand p {
  margin: 1px 0 0; font-size: 0.7rem; color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-right {
  display: flex; align-items: center; gap: var(--sp-2);
  flex-wrap: wrap; justify-content: flex-end;
}

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 0.65rem/1 var(--sans);
  letter-spacing: 0.075em; text-transform: uppercase;
  padding: 7px 10px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--ink-2);
  background: var(--surface-3);
  white-space: nowrap;
}
.tag-live {
  color: #fff; border-color: transparent;
  background: linear-gradient(180deg, #e04a4a, var(--bad));
  box-shadow: 0 1px 8px rgba(208,59,59,0.4), inset 0 1px 0 rgba(255,255,255,0.24);
}
.tag-paper { color: var(--ink); }
.tag-kill {
  color: #fff; border-color: transparent; background: var(--bad);
  animation: pulse-bad 1.9s ease-in-out infinite;
}
.is-hidden { display: none !important; }

.link-stat {
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 0.72rem/1 var(--sans); color: var(--ink-2);
  padding: 6px 8px; border-radius: var(--r-sm);
}
.dot { position: relative; width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dot-ok  { background: var(--good); }
.dot-ok::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1px solid var(--good); opacity: 0.5;
  animation: ripple 2.4s var(--ease) infinite;
}
.dot-bad { background: var(--bad); box-shadow: 0 0 0 3px rgba(208,59,59,0.18); }
.dot-idle { background: var(--ink-4); }

@keyframes ripple {
  0%   { transform: scale(0.7); opacity: 0.55; }
  70%  { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}
@keyframes pulse-bad {
  0%, 100% { box-shadow: 0 0 0 0 rgba(208,59,59,0.55); }
  50%      { box-shadow: 0 0 0 7px rgba(208,59,59,0); }
}

/* ══ layout ══════════════════════════════════════════════════════════════ */
main {
  max-width: 1560px; margin: 0 auto;
  padding: clamp(var(--sp-4), 2.4vw, var(--sp-5));
  padding-bottom: calc(var(--sp-6) + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: clamp(var(--sp-4), 2vw, var(--sp-5));
}
.row-2 {
  display: grid; gap: clamp(var(--sp-4), 2vw, var(--sp-5));
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  /* stretch, not start: the chart grows into the height its taller neighbour
     defines, instead of leaving a dead band beneath it */
  align-items: stretch;
}
.row-2-even {
  display: grid; gap: clamp(var(--sp-4), 2vw, var(--sp-5));
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

/* ══ hero ════════════════════════════════════════════════════════════════ */
.hero {
  position: relative; overflow: hidden;
  display: grid; gap: var(--sp-5);
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  align-items: center;
  padding: clamp(var(--sp-4), 2.4vw, var(--sp-5));
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface-1);
  box-shadow: 0 1px 2px rgba(0,0,0,0.4), 0 12px 34px -18px rgba(0,0,0,0.85);
}
.hero::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 46%;
  background: var(--sheen); pointer-events: none;
}
.hero-main { position: relative; min-width: 0; }
.eyebrow {
  display: block; margin-bottom: 6px;
  font: 500 0.66rem/1 var(--sans); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-3);
}
.hero-figure {
  display: flex; align-items: baseline; gap: var(--sp-3); flex-wrap: wrap;
}
.hero-value {
  font: 600 clamp(2rem, 5.2vw, 2.9rem)/1 var(--sans);
  letter-spacing: -0.032em;
  font-variant-numeric: tabular-nums;
}
.delta {
  display: inline-flex; align-items: center; gap: 5px;
  font: 600 0.86rem/1 var(--sans);
  padding: 5px 9px; border-radius: 999px;
  background: var(--surface-3); color: var(--ink-2);
}
.delta-up   { color: var(--good-ink); background: rgba(12,163,12,0.13); }
.delta-down { color: var(--bad-ink);  background: rgba(208,59,59,0.14); }
.delta::before { font-size: 0.76em; }
.delta-up::before   { content: "▲"; }
.delta-down::before { content: "▼"; }
.hero-sub { margin: 8px 0 0; font-size: 0.79rem; color: var(--ink-3); }

/* metric strip inside the hero */
.metrics {
  display: grid; gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
  background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden;
}
.metric {
  padding: var(--sp-3) var(--sp-3);
  background: var(--surface-2);
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.metric-k {
  font: 500 0.63rem/1.2 var(--sans); letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--ink-3);
}
.metric-v {
  font: 600 1.02rem/1.2 var(--sans); letter-spacing: -0.015em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.metric-x {
  font: 400 0.68rem/1.25 var(--sans); color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.bar {
  height: 3px; border-radius: 999px; background: var(--surface-4);
  overflow: hidden; margin-top: 3px;
}
.bar > i {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: var(--s1); transition: width 0.5s var(--ease), background 0.3s;
}

/* ══ panels ══════════════════════════════════════════════════════════════ */
.panel {
  position: relative;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface-1);
  box-shadow: 0 1px 2px rgba(0,0,0,0.35), 0 10px 28px -20px rgba(0,0,0,0.8);
  display: flex; flex-direction: column; min-width: 0;
}
.panel::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 40px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: var(--sheen); pointer-events: none;
}
.panel-head {
  position: relative;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line);
}
.panel-head h2 {
  font-size: 0.8rem; letter-spacing: 0.01em;
  display: flex; align-items: center; gap: 8px;
}
.panel-head h2::before {
  content: ""; width: 3px; height: 13px; border-radius: 2px;
  background: var(--s1); flex: none;
}
.panel-head.accent-2 h2::before { background: var(--s2); }
.panel-head.accent-3 h2::before { background: var(--s3); }
.note { font: 400 0.71rem/1.3 var(--sans); color: var(--ink-3); }
.panel-body { padding: var(--sp-4); flex: 1 1 auto; min-width: 0; }
.panel-body.flush { padding: 0; }
.panel-body.chart-host { display: flex; flex-direction: column; }

/* segmented control */
.seg {
  display: inline-flex; gap: 2px; padding: 2px;
  background: var(--surface-3); border-radius: 8px;
  border: 1px solid var(--line);
}
.seg button {
  appearance: none; border: 0; cursor: pointer;
  background: transparent; color: var(--ink-2);
  font: 500 0.72rem/1 var(--sans);
  padding: 7px 11px; border-radius: 6px;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
  min-height: 32px;
}
.seg button:hover { color: var(--ink); background: rgba(255,255,255,0.05); }
.seg button.on {
  background: var(--surface-1); color: var(--ink);
  box-shadow: 0 1px 3px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.07);
}

/* ══ charts ══════════════════════════════════════════════════════════════ */
.chart { width: 100%; height: 272px; min-height: 240px; flex: 1 1 auto; }
.chart-sm { height: 156px; min-height: 156px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.gridline { stroke: var(--grid); stroke-width: 1; }
.axisline { stroke: var(--axis); stroke-width: 1; }
.tick { fill: var(--ink-4); font: 400 10px var(--mono); }
.line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.crosshair { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 4; }
.knob { stroke: var(--surface-1); stroke-width: 2.5; }
.spark { fill: none; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }

/* ══ tables → cards on small screens ═════════════════════════════════════ */
.t-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
thead th {
  position: sticky; top: 0; z-index: 1;
  text-align: right; padding: 10px var(--sp-3);
  font: 500 0.64rem/1 var(--sans); letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--ink-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
thead th:first-child, tbody td:first-child { text-align: left; }
tbody td {
  padding: 11px var(--sp-3); text-align: right;
  border-bottom: 1px solid var(--grid); white-space: nowrap;
}
tbody tr { transition: background 0.14s var(--ease); }
tbody tr:hover { background: rgba(255,255,255,0.022); }
tbody tr:last-child td { border-bottom: 0; }
.sym { font: 600 0.79rem var(--mono); letter-spacing: -0.03em; }
/* Kraken's symbol is the canonical id but unreadable as a name (XBT is
   Bitcoin), so the base currency leads and the symbol follows, quietly. */
.sym-sub {
  font: 500 0.66rem var(--mono); color: var(--ink-4);
  letter-spacing: -0.02em; margin-left: 5px;
}
.mono { font-family: var(--mono); }
.up   { color: var(--good-ink); }
.down { color: var(--bad-ink); }
.mute { color: var(--ink-3); }
.free { white-space: normal; text-align: left; color: var(--ink-2); font-size: 0.77rem; }

/* value that changed since last render */
@keyframes flash-up   { from { background: rgba(12,163,12,0.24); } to { background: transparent; } }
@keyframes flash-down { from { background: rgba(208,59,59,0.24); } to { background: transparent; } }
.tick-up   { animation: flash-up 0.65s var(--ease); border-radius: 3px; }
.tick-down { animation: flash-down 0.65s var(--ease); border-radius: 3px; }

/* ══ pills & chips ═══════════════════════════════════════════════════════ */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font: 600 0.62rem/1 var(--sans); letter-spacing: 0.07em;
  text-transform: uppercase; padding: 5px 8px; border-radius: 5px; flex: none;
}
.pill-deep { background: rgba(25,158,112,0.16);  color: #4cd8a4; }
.pill-fast { background: rgba(217,89,38,0.16);   color: #f08a5d; }
.pill-err  { background: rgba(208,59,59,0.18);   color: var(--bad-ink); }

.st {
  font: 600 0.61rem/1 var(--sans); letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 7px; border-radius: 4px; white-space: nowrap;
}
.st-submitted, .st-filled { background: rgba(12,163,12,0.17);  color: var(--good-ink); }
.st-proposed             { background: rgba(57,135,229,0.17); color: #82b6f1; }
.st-rejected             { background: rgba(208,59,59,0.17);  color: var(--bad-ink); }
.st-skipped              { background: var(--surface-3);      color: var(--ink-3); }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font: 500 0.73rem/1 var(--mono);
}
.chip strong { font-family: var(--sans); font-size: 0.75rem; }
.chip-long    { border-color: rgba(12,163,12,0.4);  background: rgba(12,163,12,0.06); }
.chip-short   { border-color: rgba(208,59,59,0.4);  background: rgba(208,59,59,0.06); }
.chip-avoid   { border-color: rgba(250,178,25,0.4); background: rgba(250,178,25,0.05); }
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.lv { display: inline-flex; flex-wrap: wrap; gap: 5px; }
.lv i {
  font: 500 0.69rem var(--mono); font-style: normal;
  padding: 3px 6px; border-radius: 4px;
  background: var(--surface-3); color: var(--ink-2);
}

/* ══ position cards ══════════════════════════════════════════════════════ */
.pos-grid {
  display: grid; gap: var(--sp-3);
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}
.pos {
  border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--surface-2); overflow: hidden;
}
.pos-top {
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
  padding: var(--sp-3); border-bottom: 1px solid var(--line);
  background: var(--surface-3);
}
.pos-side {
  font: 600 0.62rem/1 var(--sans); letter-spacing: 0.07em; text-transform: uppercase;
  padding: 4px 7px; border-radius: 4px;
}
.pos-side.long  { background: rgba(12,163,12,0.18);  color: var(--good-ink); }
.pos-side.short { background: rgba(208,59,59,0.18);  color: var(--bad-ink); }
.pos-pnl { margin-left: auto; font: 600 0.92rem/1 var(--sans); }
.pos-kv {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: var(--sp-3); padding: var(--sp-3);
}
.pos-kv div { min-width: 0; }
.pos-kv dt {
  font: 500 0.61rem/1.2 var(--sans); letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 3px;
}
.pos-kv dd {
  margin: 0; font: 500 0.83rem var(--mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pos-ai { padding: 0 var(--sp-3) var(--sp-3); }
.pos-ai p { margin: 0 0 6px; font-size: 0.78rem; color: var(--ink-2); }
.pos-ai p:last-child { margin-bottom: 0; }
.pos-ai b {
  display: block; font: 500 0.61rem/1.2 var(--sans); letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 2px;
}
.guard {
  display: flex; gap: var(--sp-2); flex-wrap: wrap;
  padding: var(--sp-2) var(--sp-3) var(--sp-3);
}
.guard span {
  display: inline-flex; align-items: center; gap: 5px;
  font: 500 0.71rem/1 var(--mono);
  padding: 5px 8px; border-radius: var(--r-sm);
  background: var(--surface-3); border: 1px solid var(--line);
}
.guard .g-stop { color: var(--bad-ink);  border-color: rgba(208,59,59,0.32); }
.guard .g-tp   { color: var(--good-ink); border-color: rgba(12,163,12,0.32); }
.guard .g-none { color: var(--warn);     border-color: rgba(250,178,25,0.32); }

/* ══ decision cards ══════════════════════════════════════════════════════ */
.cards { display: flex; flex-direction: column; gap: var(--sp-3); }
.card {
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface-2); overflow: hidden;
  transition: border-color 0.16s var(--ease);
}
.card:hover { border-color: var(--line-2); }
.card-top {
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
  padding: var(--sp-3); border-bottom: 1px solid var(--grid);
}
.card-why { color: var(--ink-2); font-size: 0.78rem; flex: 1 1 14ch; min-width: 0; }
.card-meta {
  margin-left: auto; color: var(--ink-3);
  font: 400 0.7rem var(--mono); white-space: nowrap;
}
.card-body { padding: var(--sp-3); }
.say {
  margin: 0; font-size: 0.82rem; color: var(--ink);
  white-space: pre-line;
}
.acts { display: flex; flex-direction: column; gap: 6px; margin-top: var(--sp-3); }
.act {
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
  padding: 9px 11px; border-radius: var(--r-sm);
  background: var(--surface-3); font-size: 0.78rem;
}
.act-k {
  font: 600 0.65rem/1 var(--sans); letter-spacing: 0.06em; text-transform: uppercase;
}
.act-why { flex: 1 1 100%; color: var(--ink-3); font-size: 0.74rem; }

/* ══ brief ═══════════════════════════════════════════════════════════════ */
.brief { display: flex; flex-direction: column; gap: var(--sp-4); }
.brief section { min-width: 0; }
.brief b {
  display: block; margin-bottom: 5px;
  font: 500 0.63rem/1 var(--sans); letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-3);
}
.brief p { margin: 0; font-size: 0.82rem; color: var(--ink-2); }
.brief .regime {
  font: 600 1rem/1.35 var(--sans); color: var(--ink); letter-spacing: -0.015em;
}
.srcs { display: flex; flex-direction: column; gap: 7px; }
.srcs a {
  display: flex; gap: 7px; font-size: 0.77rem; color: var(--ink-2);
  padding: 7px 9px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line);
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.srcs a:hover { color: var(--ink); border-color: var(--line-2); text-decoration: none; }
.srcs a::before { content: "↗"; color: var(--s1); flex: none; }

/* ══ empty & skeleton ════════════════════════════════════════════════════ */
.empty {
  margin: 0; padding: var(--sp-5) var(--sp-3);
  text-align: center; color: var(--ink-3); font-size: 0.82rem;
}
.empty strong { display: block; color: var(--ink-2); margin-bottom: 4px; font-weight: 500; }
.skel {
  height: 12px; border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-4) 50%, var(--surface-3) 75%);
  background-size: 240% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }

/* ══ tooltip ═════════════════════════════════════════════════════════════ */
.tip {
  position: fixed; z-index: 60; pointer-events: none;
  opacity: 0; transform: translateY(3px);
  transition: opacity 0.11s var(--ease), transform 0.11s var(--ease);
  background: var(--surface-4); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: 9px 11px; font: 400 0.75rem/1.5 var(--mono);
  box-shadow: 0 12px 32px rgba(0,0,0,0.6);
  white-space: nowrap; max-width: min(88vw, 340px);
}
.tip.on { opacity: 1; transform: translateY(0); }
.tip k { color: var(--ink-3); font-style: normal; }

/* ══ footer ══════════════════════════════════════════════════════════════ */
footer {
  max-width: 1560px; margin: 0 auto;
  padding: var(--sp-4) clamp(var(--sp-4), 3vw, var(--sp-5));
  padding-bottom: calc(var(--sp-5) + env(safe-area-inset-bottom));
  display: flex; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap;
  color: var(--ink-4); font-size: 0.71rem;
  border-top: 1px solid var(--line);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1100px) {
  .row-2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .row-2-even { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
  .brand p { display: none; }
  .chart { height: 216px; }
}

@media (max-width: 720px) {
  body { font-size: 13.5px; }
  main { gap: var(--sp-4); }
  .panel-body { padding: var(--sp-3); }
  .pos-grid { grid-template-columns: minmax(0, 1fr); }
  .card-meta { margin-left: 0; flex: 1 1 100%; }

  /* The brand and the status cluster cannot both fit on one line at phone
     widths -- the title ends up clipped under the mode tag. Give each its own
     row instead of shrinking the title into illegibility. */
  .topbar {
    flex-wrap: wrap; row-gap: var(--sp-2);
    padding-left: var(--sp-3); padding-right: var(--sp-3);
  }
  .brand { flex: 1 1 100%; }
  .brand h1 {
    font-size: 0.88rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .topbar-right { flex: 1 1 100%; justify-content: flex-start; }
  .link-stat { padding: 6px 8px; }

  /* Two columns holds the strip to a readable height; one column turned the
     hero into most of the first screen. */
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { padding: 10px var(--sp-3); }
  /* the topbar wraps to two rows here, so the tab bar must clear more */
  .tabs { top: 88px; }
  .tabs button { padding: 10px 12px; font-size: 0.76rem; }
  .metric-v { font-size: 0.96rem; }
  /* Five metrics in a two-column grid leaves the last one beside a blank
     cell; let it run the full width instead. */
  .metric:nth-child(5) { grid-column: 1 / -1; }

  /* Data tables become stacked cards. A table that scrolls sideways on a
     phone hides exactly the columns you came to read, so each row is
     re-flowed into a labelled block instead. */
  table.rf thead { display: none; }
  table.rf, table.rf tbody, table.rf tr, table.rf td { display: block; width: 100%; }
  table.rf tr {
    border: 1px solid var(--line-2); border-radius: var(--r);
    background: var(--surface-2); margin-bottom: var(--sp-3); padding: 4px 0;
  }
  table.rf tr:hover { background: var(--surface-2); }
  table.rf td {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: var(--sp-4); text-align: right !important;
    padding: 8px var(--sp-3); border-bottom: 1px solid var(--grid);
    white-space: normal;
  }
  table.rf tr td:last-child { border-bottom: 0; }
  table.rf td::before {
    content: attr(data-label);
    font: 500 0.63rem/1.4 var(--sans); letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--ink-3);
    text-align: left; flex: 0 0 auto;
  }
  /* the symbol cell reads as the card's heading */
  table.rf td[data-label="Symbol"] {
    background: var(--surface-3); border-radius: 7px 7px 0 0;
    padding-top: 10px; padding-bottom: 10px;
  }
  table.rf td[data-label="Symbol"]::before { display: none; }
  table.rf td.sparkcell { display: none; }   /* too small to read here */
}

@media (max-width: 420px) {
  .hero-value { font-size: 1.9rem; }
  .seg button { padding: 7px 9px; font-size: 0.69rem; }
  .panel-head { padding: var(--sp-3); }
  .pos-kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Only genuinely tiny screens lose the two-up metric strip. */
@media (max-width: 330px) {
  .metrics { grid-template-columns: minmax(0, 1fr); }
}

/* Respect the reader who has asked for less movement. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ══ view switcher ═══════════════════════════════════════════════════════
   The page was one long scroll; five tabbed views keep each one to roughly a
   screen. The hero stays above the tabs because it is the summary you always
   want, whichever section you are reading.                                */
.tabs {
  display: flex; gap: 2px; padding: 3px;
  background: var(--surface-1); border: 1px solid var(--line);
  border-radius: var(--r); overflow-x: auto;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
  position: sticky; top: 62px; z-index: 20;
  box-shadow: 0 6px 18px -14px rgba(0,0,0,0.9);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  appearance: none; border: 0; cursor: pointer; white-space: nowrap;
  background: transparent; color: var(--ink-3);
  font: 500 0.8rem/1 var(--sans);
  padding: 10px 14px; border-radius: 7px; min-height: 40px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: color 0.16s var(--ease), background 0.16s var(--ease);
}
.tabs button:hover { color: var(--ink-2); background: rgba(255,255,255,0.04); }
.tabs button.on {
  background: var(--surface-3); color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07);
}
.badge-n {
  font: 600 0.65rem/1 var(--mono);
  padding: 3px 6px; border-radius: 999px;
  background: var(--surface-4); color: var(--ink-2);
}
.tabs button.on .badge-n { background: var(--s1); color: #fff; }
.badge-n:empty { display: none; }

.view { display: flex; flex-direction: column; gap: clamp(var(--sp-4), 2vw, var(--sp-5)); }
.view.is-hidden { display: none; }

.head-tools { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }

/* ══ pagination ══════════════════════════════════════════════════════════ */
.panel-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.panel-foot:empty { display: none; }
.pager { display: inline-flex; align-items: center; gap: var(--sp-2); }
.pager button {
  appearance: none; cursor: pointer;
  background: var(--surface-3); color: var(--ink-2);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  font: 500 0.75rem/1 var(--sans); padding: 8px 12px; min-height: 34px;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.pager button:hover:not(:disabled) { color: var(--ink); border-color: var(--ink-4); }
.pager button:disabled { opacity: 0.35; cursor: default; }
.pager-at { font: 500 0.75rem/1 var(--mono); color: var(--ink-3); min-width: 9ch; text-align: center; }
.foot-note { font: 400 0.73rem/1.3 var(--sans); color: var(--ink-3); }

/* venue rows the AI is not following read quieter than the ones it is */
tbody tr.dim-row td:not(:first-child) { opacity: 0.62; }
.follow-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  margin-right: 6px; flex: none; vertical-align: 1px;
}
.follow-held { background: var(--good); }
.follow-on   { background: var(--s1); }
.follow-off  { background: var(--ink-4); }
