:root {
  color-scheme: dark;

  /* ===== Ultraviolet palette (canonical — from app tokens.ts) ============ */
  --bg:            #0c0a14;
  --bg-deep:       #08060f;
  --surface:       #181426;
  --surface-2:     #221b32;
  --surface-3:     #2a2240;
  --surface-hover: #241e38;
  --border:        #3d3460;
  --border-2:      #544e70;
  --accent:        #a78bfa;   /* violet */
  --accent-hover:  #b9a2fb;
  --accent-2:      #f472b6;   /* pink   */
  --t1:            #ece8f8;
  --t2:            #9088b0;
  --t3:            #8895aa;
  --t4:            #6b6588;
  --ok:            #2fd16b;
  --warn:          #f5c451;
  --err:           #ff5c7a;

  /* Tints */
  --accent-soft:  rgba(167, 139, 250, 0.14);
  --accent-line:  rgba(167, 139, 250, 0.45);
  --accent2-soft: rgba(244, 114, 182, 0.14);
  --accent2-line: rgba(244, 114, 182, 0.45);
  --ok-soft:      rgba(47, 209, 107, 0.14);
  --ok-line:      rgba(47, 209, 107, 0.5);
  --warn-soft:    rgba(245, 196, 81, 0.14);
  --warn-line:    rgba(245, 196, 81, 0.5);
  --err-soft:     rgba(255, 92, 122, 0.14);
  --err-line:     rgba(255, 92, 122, 0.5);

  /* UV spacing scale (4/8/12/18/24/36/48) */
  --xs: 4px; --sm: 8px; --md: 12px; --lg: 18px; --xl: 24px; --xxl: 36px; --xxxl: 48px;

  /* Radii (UV — small & calm) */
  --r-sm: 4px; --r-md: 6px; --r-lg: 8px; --r-xl: 12px; --r-pill: 999px;

  /* Type */
  --sans: 'Space Grotesk', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.35);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.30);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.45);
  --ease: 150ms cubic-bezier(0.4, 0, 0.2, 1);

  /* ===== Compatibility aliases (old name → UV token) ===================== */
  --bg-2: var(--bg-deep);
  --panel: var(--surface);
  --panel-2: var(--surface-2);
  --panel-3: var(--surface-3);
  --border-strong: var(--border-2);
  --text: var(--t1);
  --muted: var(--t2);
  --text-dim: var(--t3);
  --muted-2: var(--t4);
  --green: var(--ok);     --green-dim: #26a85a;
  --red: var(--err);      --red-dim: #e0506b;
  --yellow: var(--warn);
  --blue: var(--accent);  --pink: var(--accent-2);
  --green-soft: var(--ok-soft);     --green-line: var(--ok-line);
  --red-soft: var(--err-soft);      --red-line: var(--err-line);
  --yellow-soft: var(--warn-soft);  --yellow-line: var(--warn-line);
  --blue-soft: var(--accent-soft);  --blue-line: var(--accent-line);
  --pulse-c: var(--ok-line);

  /* legacy spacing names retained */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse 800px 600px at 12% -8%, rgba(167,139,250,0.10), transparent 60%),
    radial-gradient(ellipse 700px 500px at 92% 2%, rgba(244,114,182,0.06), transparent 70%),
    var(--bg);
  color: var(--t1);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- Topbar -------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 64px;
  padding: 0 var(--s-5);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--s-5);
  background: rgba(10, 13, 19, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 16px rgba(167, 139, 250, 0.5);
  display: grid;
  place-items: center;
  color: #0c0a14;
  font-weight: 800;
  font-size: 14px;
}
h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
h1 small { color: var(--t3); font-weight: 500; font-size: 13px; }
p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

/* Top-bar nav (one link per leaf view, underline-active) */
.topnav { display: flex; gap: 2px; align-items: center; height: 100%; }
.topnav-link {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 16px;
  color: var(--t2);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13.5px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--ease), border-color var(--ease);
}
.topnav-link:hover { color: var(--t1); }
.topnav-link.active { color: var(--accent); border-bottom-color: var(--accent); }
.topnav-sep { width: 1px; height: 22px; background: var(--border); margin: 0 10px; align-self: center; flex: none; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-left: auto;
}
.coin-picker {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.coin-select {
  min-width: 108px;
  min-height: 36px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 0 28px 0 12px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: border-color var(--ease), background var(--ease);
}
.coin-select:hover { border-color: var(--border-strong); }
.coin-select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--blue-soft); }

.top-oracle {
  min-height: 36px;
  min-width: 168px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
}
.top-oracle span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.top-oracle strong {
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.status {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 0 12px;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--yellow);
  box-shadow: 0 0 0 0 var(--yellow-line);
  animation: pulse 2s infinite;
}
.dot.live { background: var(--green); --pulse-c: var(--green-line); animation: pulse 2s infinite; }
.dot.dead { background: var(--red); animation: none; }
.dot { --pulse-c: var(--yellow-line); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--pulse-c); }
  70% { box-shadow: 0 0 0 5px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---- Layout -------------------------------------------------------------- */
.layout {
  max-width: 1640px;
  margin: 0 auto;
  padding: var(--s-5);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-4);
}

/* ---- Tabs ---------------------------------------------------------------- */
.tabs {
  grid-column: 1 / -1;
  display: flex;
  gap: var(--s-1);
}
.tab {
  min-height: 40px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: var(--r-md);
  padding: 0 18px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: color var(--ease), background var(--ease), border-color var(--ease);
}
.tab:hover { color: var(--text); background: var(--surface-hover); }
.tab.active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--t1);
}

.panel, .metric, .book {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.section-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: var(--s-2);
}
.toggle-list { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: 18px; }
.toggle {
  min-height: 32px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  border-radius: var(--r-sm);
  padding: 0 12px;
  font-weight: 700;
  cursor: pointer;
  transition: color var(--ease), border-color var(--ease);
}
.toggle.active { color: var(--text); border-color: var(--border-strong); }
.button {
  min-height: 36px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 0 14px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease), transform var(--ease);
}
.button:hover { background: var(--panel-3); border-color: var(--border-strong); }
.button:active { transform: translateY(1px); }
.button.subtle { margin-top: var(--s-3); background: var(--panel-2); }
.top-clear {
  min-width: 78px;
  min-height: 36px;
  padding: 0 16px;
}
.select {
  width: 100%;
  min-height: 36px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 0 10px;
}

/* ---- Chart panel --------------------------------------------------------- */
.chart-panel {
  grid-column: 1 / -1;
  padding: var(--s-4);
  min-width: 0;
  box-shadow: var(--shadow-md);
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.muted, .counter { color: var(--muted); font-size: 12px; }
.counter {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.chart {
  width: 100%;
  height: 520px;
  display: block;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
}
/* Hint + jump button: chart click reveals the per-venue order books */
.chart-hint {
  margin-top: var(--s-3);
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--t2);
  border-radius: var(--r-md);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  transition: var(--ease);
}
.chart-hint:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.books-flash { animation: booksFlash 1.4s ease-out; }
@keyframes booksFlash {
  0% { box-shadow: 0 0 0 0 var(--accent-line); }
  30% { box-shadow: 0 0 0 3px var(--accent-soft); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.legend { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-3); }
.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--panel-2);
  transition: opacity var(--ease);
}
.legend-item.muted-feed { opacity: 0.4; }
.swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-val {
  color: var(--text);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 600;
}

/* ---- Metric tiles -------------------------------------------------------- */
.metrics {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--s-3);
}
.metrics .statpill { padding: 10px 14px; }
.metrics .statpill .val { font-size: 18px; }
/* "Last frame" holds a venue label + age, not a number — keep it compact. */
.metrics .statpill .val#lastFrame {
  font-size: 11px;
  font-weight: 700;
  align-self: flex-start;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.oracle-card {
  min-height: 68px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--panel-2);
}
.oracle-card span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.oracle-card strong {
  display: block;
  margin-top: 8px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 17px;
}

/* ---- UV primitives: card + section label -------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: var(--lg);
}
.card.compact { padding: var(--md); }
.card-hover { transition: border-color var(--ease), transform var(--ease), box-shadow var(--ease); }
.card-hover:hover { border-color: var(--border-2); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.sec-label {
  color: var(--t2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---- Exchange venue card (graph + BBO; click → book modal) --------------- */
.ex-card { display: flex; flex-direction: column; gap: 12px; cursor: pointer; }
.ex-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ex-name { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; }
.ex-swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.ex-mid { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14px; }
.ex-card .spark { height: 38px; }
.ex-bbo {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; padding: 10px;
  border-radius: var(--r-md); background: var(--bg-deep); border: 1px solid var(--border);
}
.ex-bbo .k { color: var(--t3); font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.ex-bbo .v { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 700; margin-top: 3px; }
.ex-bbo .v.bid { color: var(--ok); }
.ex-bbo .v.ask { color: var(--err); }
.ex-foot { color: var(--t4); font-size: 9px; letter-spacing: 0.02em; }

/* ---- Order-book modal (opened from a venue card) ------------------------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8, 6, 15, 0.72);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: var(--s-5);
}
.modal-card {
  width: min(560px, 100%); max-height: 86vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: var(--s-4);
  display: flex; flex-direction: column; gap: var(--s-3);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.modal-close {
  width: 30px; height: 30px; display: grid; place-items: center; flex: none;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--t2);
  border-radius: var(--r-md); cursor: pointer; font-size: 14px;
}
.modal-close:hover { border-color: var(--border-2); color: var(--t1); }
.modal-foot { color: var(--t3); font-size: 11px; }

/* ---- Books grid ---------------------------------------------------------- */
.books {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  gap: var(--s-3);
}
.book {
  padding: 16px;
  min-width: 0;
  transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}
.book-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--s-3);
  gap: var(--s-3);
}
.book h2 { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
.book h3 { margin: 0; font-size: 12px; font-weight: 700; }
.book .price {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}
.book-head.compact { margin-bottom: var(--s-2); }

.top {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-2);
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-2);
}
.top label {
  display: block;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 800;
}
.top span {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 700;
}
.bid { color: var(--green); }
.ask { color: var(--red); }

.depth { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); margin-top: var(--s-3); }
.deribit-depth { min-height: 90px; }
.depth-title {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.row {
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
  min-height: 22px;
  align-items: center;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  padding: 0 6px;
  border-radius: 4px;
  color: #c9d3e6;
}
.row:nth-child(even) { background: rgba(255, 255, 255, 0.018); }
.depth p { color: var(--muted-2); font-size: 12px; }

/* ---- Cent ladder (UV) — full 1¢–99¢, two columns per outcome ------------- */
.ladder {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-2);
  margin-top: var(--s-2);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.ladder.ladder-empty {
  grid-template-columns: 1fr;
  place-items: center;
  min-height: 88px;
  color: var(--t3);
  font-family: var(--sans);
  font-size: 12px;
}
.ladder-col {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-deep);
}
.ladder-col-head,
.ladder-row {
  display: grid;
  grid-template-columns: 1fr 34px 1fr;
  align-items: stretch;
}
.ladder-col-head {
  background: var(--surface-2);
  color: var(--t3);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  padding: 4px 0;
  font-family: var(--sans);
}
.ladder-col-head .lh-bid { color: var(--ok); text-align: right; padding-right: 8px; }
.ladder-col-head .lh-ask { color: var(--err); text-align: left; padding-left: 8px; }
.ladder-row { height: 17px; border-top: 1px solid rgba(61, 52, 96, 0.32); font-size: 10.5px; }
.ladder-row.best { background: var(--accent-soft); }
.ladder-cell {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 7px;
  overflow: hidden;
}
.ladder-cell.bid { justify-content: flex-end; color: var(--t1); }
.ladder-cell.ask { justify-content: flex-start; color: var(--t1); }
/* full-height fill so resting size is comparable across rows at a glance */
.ladder-bar { position: absolute; top: 0; bottom: 0; border-radius: 0; opacity: 0.45; }
.ladder-bar.bid { right: 0; background: var(--ok); }
.ladder-bar.ask { left: 0; background: var(--err); }
.ladder-cell span:not(.ladder-bar) { position: relative; z-index: 1; }
.ladder-price {
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--t2);
  font-size: 10px;
  font-weight: 700;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.ladder-price.bid { color: var(--ok); }
.ladder-price.ask { color: var(--err); }

/* ---- Stat pills (UV) ----------------------------------------------------- */
.statpill-row { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.statpill {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  min-width: 96px;
  flex: 1 1 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.statpill .lab {
  color: var(--t3);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.statpill .val {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 700;
  color: var(--t1);
}
.statpill .val.ok { color: var(--ok); }
.statpill .val.err { color: var(--err); }
.statpill .val.accent { color: var(--accent); }

/* ---- Sparkline ----------------------------------------------------------- */
.spark { display: block; width: 100%; height: 40px; }
.spark-card { margin-top: var(--s-3); margin-bottom: var(--s-5); }
.spark-card .spark { height: 56px; }
.spark-card .sec-label { margin-bottom: var(--s-2); display: block; }

/* sparkline with price (y) + time (x) axis labels */
.sparkchart { display: grid; grid-template-columns: 48px 1fr; gap: 8px; align-items: stretch; }
.sparkchart-y {
  display: flex; flex-direction: column; justify-content: space-between; padding: 2px 0;
  font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 10px;
  color: var(--t3); text-align: right;
}
.sparkchart-y .mid { color: var(--t4); }
.sparkchart-plot {
  position: relative; border-left: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.sparkchart-last {
  position: absolute; top: 2px; right: 4px;
  font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 11px; font-weight: 700;
}
.sparkchart-x {
  display: flex; justify-content: space-between; margin: 3px 0 0 56px;
  color: var(--t4); font-size: 10px;
}

/* ---- Order-book section (under the Up-price sparkline) ------------------- */
.book-section {
  margin-top: var(--s-5);
  padding-top: var(--s-4);
  border-top: 1px solid var(--border);
}
.book-section > .sec-label { display: block; margin-bottom: var(--s-3); }

/* ---- Tag (UV) ------------------------------------------------------------ */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
.tag.neutral { background: var(--surface-hover); color: var(--t2); border: 1px solid var(--border); }
.tag.accent  { background: var(--accent-soft); color: var(--accent); }
.tag.accent2 { background: var(--accent2-soft); color: var(--accent-2); }
.tag.ok      { background: var(--ok-soft); color: var(--ok); }
.tag.warn    { background: var(--warn-soft); color: var(--warn); }
.tag.err     { background: var(--err-soft); color: var(--err); }
.tag.muted   { background: transparent; color: var(--t3); }
.tag .dot { width: 6px; height: 6px; border-radius: 50%; }

.book.wide { grid-column: span 2; }
.market-book { grid-column: span 2; }

/* ---- Duration / market groups -------------------------------------------- */
.market-duration-group {
  grid-column: 1 / -1;
  min-width: 0;
}
.duration-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--s-3);
  margin: var(--s-1) 0 var(--s-3);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--border);
}
.duration-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text);
}
.duration-head p { font-size: 11px; }
.duration-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  gap: var(--s-3);
}

/* ---- Polymarket catalog card (read-only Down/Up pair) -------------------- */
.event-card { display: flex; flex-direction: column; gap: 10px; cursor: pointer; }
.event-card .ec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.event-card .ec-title { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.event-card .ec-sub {
  color: var(--t3); font-family: var(--mono); font-size: 11.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.event-card .ec-foot { color: var(--t3); font-size: 11px; display: flex; align-items: center; gap: 6px; }
.wtime {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--t2);
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.wtime.current { border-color: var(--ok-line); background: var(--ok-soft); color: var(--ok); }
.wtime.future { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.updown { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ud {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0; border-radius: var(--r-md);
  font-family: var(--sans);
}
.ud em { font-style: normal; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.ud b { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 700; }
.ud.no { background: var(--err-soft); color: var(--err); }
.ud.yes { background: var(--ok-soft); color: var(--ok); }

/* ---- Freshness dot (live / stale / dead) -------------------------------- */
.fdot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.fdot.live { background: var(--ok); }
.fdot.warn { background: var(--warn); }
.fdot.dead { background: var(--err); }
/* Per-league subgroup inside a sport category section. */
.league-subgroup {
  grid-column: 1 / -1;
  min-width: 0;
  margin-top: var(--s-3);
}
.league-subhead {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  margin: 0 0 var(--s-2);
  padding-left: var(--s-1);
  border-left: 2px solid var(--border-strong);
}
.league-subhead h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim, var(--text));
}
.league-subhead .league-count {
  font-size: 10px;
  color: var(--text-dim, var(--text));
  opacity: 0.7;
}
/* Collapsible category sections. */
.duration-head[data-cat-toggle] {
  cursor: pointer;
  user-select: none;
}
.cat-toggle-chevron {
  font-size: 12px;
  line-height: 1;
  color: var(--text-dim, var(--text));
  opacity: 0.7;
  transition: transform 0.15s ease;
}
.market-duration-group.collapsed .cat-toggle-chevron {
  transform: rotate(-90deg);
}
.market-duration-group.collapsed .league-subgroup,
.market-duration-group.collapsed .league-chips {
  display: none;
}
/* Chip (pill) — shared by the league sub-category chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px;
  border: 1px solid var(--border); background: var(--surface); border-radius: var(--r-pill);
  color: var(--t2); font-family: var(--sans); font-weight: 600; font-size: 12px; cursor: pointer;
  transition: border-color var(--ease), color var(--ease), background var(--ease);
}
.chip:hover { border-color: var(--border-2); color: var(--t1); }
.chip.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--t1); }
.chip .chip-count { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--t3); }
.chip.active .chip-count { color: var(--accent); }

/* League sub-category chips inside a category section */
.league-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--s-2) 0 var(--s-3); }
.window-time {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  min-height: 22px;
  align-items: center;
  padding: 2px 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
}
.window-time.current {
  border-color: var(--green-line);
  background: var(--green-soft);
  color: var(--green);
}
.window-time.future {
  border-color: var(--blue-line);
  background: var(--blue-soft);
  color: var(--blue);
}
.window-time.past { color: var(--muted-2); }

.market-window {
  cursor: pointer;
}
.market-window:hover {
  border-color: var(--border-strong);
  background: var(--panel-2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.market-detail { grid-column: 1 / -1; box-shadow: var(--shadow-md); }
.detail-head { margin-bottom: var(--s-4); }
.detail-head p { margin: 0; color: var(--t3); font-size: 12.5px; }
.detail-head .window-time { display: inline; }
.back-button {
  min-width: 70px;
  min-height: 32px;
  padding: 0 14px;
  background: var(--panel-2);
}
.asset-pill {
  min-width: 58px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: linear-gradient(180deg, var(--panel-3), var(--panel-2));
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
}
.detail-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.market-sides {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3);
}
.market-side {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.ms-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.ms-outcome {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.ms-outcome::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--t3);
}
.ms-outcome.yes { color: var(--ok); }
.ms-outcome.yes::before { background: var(--ok); }
.ms-outcome.no { color: var(--err); }
.ms-outcome.no::before { background: var(--err); }
.hidden { display: none !important; }

/* ---- Two-level tabs ------------------------------------------------------ */
.primary-tabs { border-bottom: 0; }
.sub-tabs {
  gap: var(--s-1);
  margin-top: 2px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.subtab {
  min-height: 36px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0 14px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: color var(--ease), border-color var(--ease);
}
.subtab:hover { color: var(--text); }
.subtab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* ---- Sports view --------------------------------------------------------- */
.sport-controls {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-bottom: var(--s-1);
}
.sport-filter {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.cat-chip {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--panel);
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: border-color var(--ease), color var(--ease), background var(--ease);
}
.cat-chip:hover { border-color: var(--border-strong); color: var(--text); }
.cat-chip.active {
  border-color: var(--blue-line);
  background: var(--blue-soft);
  color: var(--text);
}
.cat-chip .cat-count {
  margin-left: 6px;
  font-size: 11px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.cat-chip.active .cat-count { color: var(--blue); }
.sport-summary { font-size: 12px; }

.sport-card { cursor: pointer; }
.sport-card:hover {
  border-color: var(--border-strong);
  background: var(--panel-2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.sport-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.league-pill, .cat-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.liq-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid var(--border);
}
.liq-badge.liq-tight, .outcome-chip.liq-tight {
  border-color: var(--green-line);
  background: var(--green-soft);
  color: var(--green);
}
.liq-badge.liq-ok, .outcome-chip.liq-ok {
  border-color: var(--yellow-line);
  background: var(--yellow-soft);
  color: var(--yellow);
}
.liq-badge.liq-wide, .outcome-chip.liq-wide {
  border-color: var(--red-line);
  background: var(--red-soft);
  color: var(--red);
}
.liq-badge.liq-none { color: var(--muted-2); }

/* Per-market No / Yes price table on a sport card */
.yn-table {
  margin-top: var(--s-2);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--panel-2);
  overflow: hidden;
}
.yn-table.empty { padding: 10px; }
.yn-trow {
  display: grid;
  grid-template-columns: 1fr 56px 56px;
  align-items: center;
  gap: var(--s-2);
  padding: 6px 10px;
  border-top: 1px solid var(--border);
}
.yn-trow:first-child { border-top: 0; }
.yn-thead {
  background: var(--panel-3);
}
.yn-thead .yn-mkt,
.yn-thead .yn-cell {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.yn-mkt {
  color: var(--text);
  font-size: 12px;
  text-transform: capitalize;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.yn-cell {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-align: right;
}
.yn-cell.no { color: var(--red); }
.yn-cell.yes { color: var(--green); }
.more-markets { color: var(--muted); font-size: 11px; margin-top: var(--s-2); text-transform: capitalize; }

/* Slate card: header row, team rows with crests + score, clock line */
.card-top { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; margin-bottom: var(--s-3); }
.card-title { margin: 0 0 var(--s-2); font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
.soon-pill {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--r-pill);
  background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent);
  font-size: 10px; font-weight: 800; letter-spacing: 0.05em;
}
.card-teams { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--s-2); }
.ct-row { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px; }
.ct-crest {
  width: 22px; height: 22px; border-radius: var(--r-sm); flex: none; display: grid; place-items: center;
  color: #0c0a14; font-weight: 800; font-size: 10px;
}
.ct-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-score {
  font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 800; font-size: 16px; color: var(--t1);
}
.ct-score.pre { color: var(--t4); }
.card-clock { margin: 0 0 var(--s-3); color: var(--t3); font-size: 11.5px; }
.card-clock.is-live { color: var(--err); font-weight: 700; }
.card-clock .live-dot { font-size: 8px; margin-right: 5px; animation: pulse 2s infinite; --pulse-c: var(--err-line); }

/* "LIVE" pill: marks cards whose game is streaming from the results feed now */
.live-now-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--red-soft);
  border: 1px solid var(--red-line);
  color: var(--red);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
}
.live-now-pill .live-dot { font-size: 8px; animation: pulse 2s infinite; --pulse-c: var(--red-line); }
/* Accent the whole card while it is live */
.sport-card.is-live-now { border-color: var(--red); }
/* "Live now" section pinned to the top of the Sports tab */
.live-group .duration-head h2 { color: var(--red); }
.live-group .duration-head h2::before {
  content: "● ";
  font-size: 0.7em;
  vertical-align: middle;
  animation: pulse 2s infinite;
  --pulse-c: var(--red-line);
}

/* ---- Event detail: back bar + pinned live scoreboard (UV) ---------------- */
.detail-topbar { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4); }
.detail-slug { color: var(--t3); font-size: 12.5px; display: inline-flex; align-items: center; gap: 8px; }

.scoreboard {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.scoreboard.live { border-color: var(--err-line); }
.sb-top {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  border-bottom: 1px solid var(--border); background: var(--bg-deep);
}
.sb-spacer { flex: 1; }
.sb-league { color: var(--t3); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.live-pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--err-soft); border: 1px solid var(--err-line); color: var(--err);
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.05em;
}
.live-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--err); }
.live-pill .dot.pulse { animation: pulse 2s infinite; --pulse-c: var(--err-line); }
.sb-body { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--s-3); padding: var(--s-4) var(--s-5); }
.sb-team { display: flex; align-items: center; gap: 12px; }
.sb-team.away { justify-content: flex-end; flex-direction: row-reverse; }
.sb-crest { width: 40px; height: 40px; border-radius: var(--r-md); flex: none; display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #0c0a14; }
.sb-name { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.sb-team.away .sb-name { text-align: right; }
.sb-center { text-align: center; min-width: 130px; }
.sb-score { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 40px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.sb-score.pre { color: var(--t3); }
.sb-score .x { color: var(--t4); margin: 0 8px; font-size: 26px; vertical-align: middle; }
.sb-clock { margin-top: 8px; color: var(--err); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.sb-clock.pre { color: var(--t2); }
.sb-sets { display: flex; gap: 28px; justify-content: center; padding: 10px 16px; border-top: 1px solid var(--border); }
.sb-sets-team { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.sb-sets-team .k { color: var(--t3); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.sets-row { display: flex; gap: 6px; }
.set-box { min-width: 30px; text-align: center; padding: 3px 6px; border-radius: var(--r-sm); background: var(--surface-3); font-family: var(--mono); font-size: 12px; font-weight: 700; }
.set-box.won { background: var(--accent-soft); color: var(--accent); }

.sb-meta { display: flex; gap: 18px; padding: 10px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.sb-meta .m { display: flex; flex-direction: column; gap: 2px; flex: 0 0 auto; white-space: nowrap; }
.sb-meta .m .k { color: var(--t3); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.sb-meta .m .v { font-family: var(--mono); font-size: 13px; font-weight: 700; text-transform: capitalize; }

/* Book-depth detail: No column (left) paired with Yes column (right) */
.depth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3);
  margin-top: var(--s-3);
}
.depth-grid-head {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding-bottom: var(--s-1);
  border-bottom: 1px solid var(--border);
}
.depth-grid-head-no { color: var(--red); }
.depth-grid-head-yes { color: var(--green); }

/* "Other" (non-binary markets: team moneylines, Even/Odd, …) */
.side-group { margin-top: var(--s-4); }
.side-group-head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.side-group-count {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--muted);
}

@media (max-width: 900px) {
  .depth-grid { grid-template-columns: 1fr; }
  .depth-grid-head { display: none; }
}

/* ---- Empty / loading states ---------------------------------------------- */
.books > .book > p:only-child,
.market-sides > p,
.depth > div > p {
  color: var(--muted);
  font-size: 13px;
}
.book > p:only-child {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  margin: 0;
  text-align: center;
}

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 1280px) {
  .books { grid-template-columns: repeat(3, minmax(240px, 1fr)); }
  .duration-grid { grid-template-columns: repeat(3, minmax(240px, 1fr)); }
}

@media (max-width: 1000px) {
  .books { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
  .duration-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: var(--s-4); }
  .chart-panel, .metrics, .books { grid-column: 1 / -1; }
  .chart { height: 380px; }
  .market-book { grid-column: span 1; }
  .market-sides { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .books { grid-template-columns: 1fr; }
  .duration-grid { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .book.wide, .market-book { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  .topbar {
    height: auto;
    padding: var(--s-3) var(--s-4);
    align-items: stretch;
    flex-direction: column;
    gap: var(--s-3);
  }
  .topbar-actions {
    align-items: stretch;
    flex-wrap: wrap;
    justify-content: space-between;
  }
  .top-oracle { min-width: 100%; }
  .ladder { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr; }
  .tab { padding: 0 12px; font-size: 13px; }
}

/* --- Bot-metrics signal panel (issue #20) --- */
/* No outer card: the Signals view sits flush on the page, letting the inner
   .bm-cat cards be the only surfaces. Overrides the .panel chrome above. */
.bot-metrics {
  grid-column: 1 / -1;
  background: none;
  border: none;
  border-radius: 0;
}
.bot-metrics .panel-header { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-3); }

/* Category section divider, matching the app's .section-title voice. */
.bm-section-title {
  grid-column: 1 / -1;
  margin: 18px 0 var(--s-2);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.bm-section-title .bm-slug { text-transform: none; letter-spacing: 0; }
.bm-poly-link {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  font-size: 11.5px;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  padding: 1px 8px;
  border-radius: var(--r-pill);
  margin-left: 6px;
  white-space: nowrap;
}
.bm-poly-link:hover { background: var(--accent); color: #0c0a14; }

/* Responsive grid of category cards, same rhythm as .books. */
.bm-cats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-3);
}

/* A category card mirrors the .book card surface (same --panel shade the other tabs'
   cards use, now that these sit directly on the page background). */
.bm-cat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--s-3);
}
.bm-cat-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  margin-bottom: var(--s-2);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.bm-health { border-color: var(--border-strong, var(--border)); }

/* One metric: label + value on top, formula underneath for quick checks. */
.bm-metric { padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
.bm-metric:last-child { border-bottom: none; padding-bottom: 0; }
.bm-metric-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-2); }
.bm-metric-label {
  font-family: var(--mono, monospace);
  font-size: 12px;
  color: var(--text);
  word-break: break-word;
}
.bm-formula {
  margin-top: 2px;
  font-size: 11px;
  font-family: var(--mono, monospace);
  color: var(--muted-2, var(--muted));
  line-height: 1.35;
}
.bm-val {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}
.bm-na { color: var(--muted); }

/* Freshness badges. */
.bm-age {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 12px;
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
}
.bm-age.fresh { color: var(--green); background: var(--green-soft); }
.bm-age.stale { color: var(--yellow); background: var(--yellow-soft); }
.bm-age.dead { color: var(--red); background: var(--red-soft); }
.bm-age.na { color: var(--muted); background: var(--panel-3); }

/* Market selector pills, grouped by window duration. */
.bm-mkt-groups { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-3); }
.bm-mkt-group { display: flex; align-items: flex-start; gap: var(--s-3); }
.bm-mkt-group-label {
  flex: 0 0 40px;
  padding-top: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}
.bm-mkt-pills { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.bm-mkt-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  font-family: var(--mono, monospace);
  font-size: 12px;
  cursor: pointer;
}
.bm-mkt-pill:hover { border-color: var(--border-strong, var(--border)); color: var(--text); }
.bm-mkt-pill.active { border-color: var(--green-line, var(--green)); color: var(--text); background: var(--green-soft); }
.bm-slug { color: var(--text); font-family: var(--mono, monospace); font-size: 12px; }
.bm-empty { padding: var(--s-3); }
