/* ---------------------------------------------------------------------------
   Tokens — reference palette (validated) with selected light & dark steps.
--------------------------------------------------------------------------- */
:root {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface-1: #1a1a19;
  --surface-2: #222220;
  --surface-3: #2c2c2a;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --ink-3: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.17);
  --bid: #3987e5;
  --ask: #e66767;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --venue-1: #3987e5;
  --venue-2: #d95926;
  --venue-3: #199e70;
  --venue-4: #c98500;
  --venue-5: #d55181;
  --venue-6: #008300;
  --venue-7: #9085e9;
  --focus: #86b6ef;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --page: #f9f9f7;
  --surface-1: #fcfcfb;
  --surface-2: #f4f3ef;
  --surface-3: #ecebe5;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --border-strong: rgba(11, 11, 11, 0.17);
  --bid: #2a78d6;
  --ask: #e34948;
  --venue-1: #2a78d6;
  --venue-2: #eb6834;
  --venue-3: #1baf7a;
  --venue-4: #eda100;
  --venue-5: #e87ba4;
  --venue-6: #008300;
  --venue-7: #6250d6;
  --focus: #2a78d6;
  --shadow: 0 18px 48px rgba(11, 11, 11, 0.12);
}

/* ---------------------------------------------------------------------------
   Base
--------------------------------------------------------------------------- */
* { box-sizing: border-box; }

html,
body { margin: 0; padding: 0; }

html { background: var(--page); }

body {
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

h1, h2, h3, p { margin: 0; }

[hidden] { display: none !important; }

button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.app {
  max-width: 1480px;
  margin: 0 auto;
  padding: 22px 28px 40px;
}

/* ---------------------------------------------------------------------------
   Top bar
--------------------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 11px; }

.brand-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--ink-2);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.brand-text h1 {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.brand-text p {
  margin-top: 1px;
  font-size: 12px;
  color: var(--ink-3);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.conn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-3);
  flex: none;
}

.conn[data-state="good"] .status-dot {
  background: var(--good);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 16%, transparent);
}

.conn[data-state="warn"] .status-dot { background: var(--warning); }
.conn[data-state="bad"] .status-dot { background: var(--critical); }
.conn[data-state="paused"] .status-dot { background: var(--ink-3); }

@media (prefers-reduced-motion: no-preference) {
  .conn[data-state="good"] .status-dot { animation: live-pulse 2.6s ease-in-out infinite; }
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.42; }
}

.btn-ghost,
.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  color: var(--ink-2);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.btn-ghost { padding: 0 11px; font-size: 12.5px; }
.btn-icon { width: 32px; justify-content: center; }

.btn-ghost:hover,
.btn-icon:hover {
  color: var(--ink);
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.btn-ghost[aria-pressed="true"] {
  color: var(--ink);
  background: var(--surface-3);
}

#pause-btn .icon-play { display: none; }
#pause-btn[aria-pressed="true"] .icon-pause { display: none; }
#pause-btn[aria-pressed="true"] .icon-play { display: block; }

.icon { display: block; flex: none; }

:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }

/* ---------------------------------------------------------------------------
   Controls
--------------------------------------------------------------------------- */
.controls {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px 26px;
  margin-top: 22px;
}

.control { display: flex; flex-direction: column; gap: 6px; }

.control-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.control-note { margin-left: auto; }

.control-note-text {
  font-size: 11.5px;
  color: var(--ink-3);
  padding-bottom: 7px;
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.segmented button {
  padding: 5px 11px;
  border-radius: 6px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: background 0.12s ease, color 0.12s ease;
}

.segmented button:hover { color: var(--ink); }

.segmented button[aria-pressed="true"] {
  color: var(--ink);
  font-weight: 550;
  background: var(--surface-3);
  box-shadow: 0 0 0 1px var(--border);
}

.segmented-sm button {
  padding: 4px 9px;
  font-size: 12px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
}

.check:hover { color: var(--ink); }

.check input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: var(--focus);
  cursor: pointer;
}

/* ---------------------------------------------------------------------------
   Notice
--------------------------------------------------------------------------- */
.notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--warning) 38%, var(--border));
  border-radius: 9px;
  background: color-mix(in srgb, var(--warning) 10%, var(--surface-1));
  color: var(--ink-2);
  font-size: 12.5px;
}

.notice .icon { color: var(--warning); }

.notice[data-kind="error"] {
  border-color: color-mix(in srgb, var(--critical) 40%, var(--border));
  background: color-mix(in srgb, var(--critical) 10%, var(--surface-1));
}

.notice[data-kind="error"] .icon { color: var(--critical); }

body.feed-down .kpis,
body.feed-down #view-root { opacity: 0.55; }

.kpis,
#view-root { transition: opacity 0.2s ease; }

/* ---------------------------------------------------------------------------
   KPI tiles
--------------------------------------------------------------------------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.kpi {
  min-width: 0;
  padding: 13px 15px 12px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.kpi-label {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.kpi-value {
  display: block;
  margin-top: 3px;
  font-size: 23px;
  font-weight: 620;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 18px;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-sub .dot { flex: none; }

.meter {
  display: flex;
  gap: 2px;
  height: 6px;
  margin-top: 9px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}

.meter-bid {
  height: 100%;
  background: var(--bid);
  border-radius: 3px 0 0 3px;
  transition: width 0.35s ease;
}

.meter-ask {
  height: 100%;
  background: var(--ask);
  border-radius: 0 3px 3px 0;
  flex: 1;
}

/* ---------------------------------------------------------------------------
   Cards & view layout
--------------------------------------------------------------------------- */
.card {
  margin-top: 12px;
  padding: 16px 18px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px 20px;
  flex-wrap: wrap;
}

.card h2 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.unit-badge {
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--ink-2);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
}

.card-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--ink-3);
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--ink-2);
}

.line-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.line-key::before {
  content: "";
  width: 14px;
  height: 2px;
  border-radius: 1px;
  background: var(--ink-3);
}

.line-key.bid::before { background: var(--bid); }
.line-key.ask::before { background: var(--ask); }

/* ---------------------------------------------------------------------------
   Depth chart (aggregated)
--------------------------------------------------------------------------- */
.depth-chart {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1000 / 280;
  margin-top: 10px;
  overflow: visible;
}

.depth-chart text { font-family: var(--font); }

.grid-line { stroke: var(--grid); stroke-width: 1; }
.axis-line { stroke: var(--axis); stroke-width: 1; }
.axis-text {
  fill: var(--ink-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.bid-line,
.ask-line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.bid-line { stroke: var(--bid); }
.ask-line { stroke: var(--ask); }

.bid-area { fill: var(--bid); opacity: 0.10; }
.ask-area { fill: var(--ask); opacity: 0.10; }

.chart-direct {
  fill: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
}

.chart-key { stroke-width: 2; stroke-linecap: round; }
.chart-key.bid { stroke: var(--bid); }
.chart-key.ask { stroke: var(--ask); }

.crosshair { stroke: var(--ink-3); stroke-width: 1; }

.cross-dot {
  stroke: var(--surface-1);
  stroke-width: 2;
}

.cross-dot.bid { fill: var(--bid); }
.cross-dot.ask { fill: var(--ask); }

.chart-empty { fill: var(--ink-3); font-size: 13px; }

.hit { cursor: crosshair; }

/* ---------------------------------------------------------------------------
   Heatmap
--------------------------------------------------------------------------- */
.heat-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.ramp-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

.ramp {
  width: 84px;
  height: 6px;
  border-radius: 3px;
}

.ramp.bid {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--bid) 6%, var(--surface-1)),
    color-mix(in srgb, var(--bid) 62%, var(--surface-1))
  );
}

.ramp.ask {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--ask) 6%, var(--surface-1)),
    color-mix(in srgb, var(--ask) 62%, var(--surface-1))
  );
}

.venue-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
}

.legend-item.is-stale { color: var(--ink-3); }
.legend-item.is-excluded { opacity: 0.5; }

.quote-chip {
  padding: 0 4px;
  font-size: 9.5px;
  line-height: 1.5;
  letter-spacing: 0.03em;
  color: var(--ink-3);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.source-chip {
  padding: 0 4px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
}

.legend-age {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.legend-cover {
  color: var(--ink-3);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-3);
}

.dot.v-1 { background: var(--venue-1); }
.dot.v-2 { background: var(--venue-2); }
.dot.v-3 { background: var(--venue-3); }
.dot.v-4 { background: var(--venue-4); }
.dot.v-5 { background: var(--venue-5); }
.dot.v-6 { background: var(--venue-6); }
.dot.v-7 { background: var(--venue-7); }

.key.v-1 { background: var(--venue-1); }
.key.v-2 { background: var(--venue-2); }
.key.v-3 { background: var(--venue-3); }
.key.v-4 { background: var(--venue-4); }
.key.v-5 { background: var(--venue-5); }
.key.v-6 { background: var(--venue-6); }
.key.v-7 { background: var(--venue-7); }

.key {
  display: inline-block;
  width: 10px;
  height: 2px;
  border-radius: 1px;
  flex: none;
  background: var(--ink-3);
}

.table-scroll {
  max-height: 620px;
  overflow: auto;
  margin-top: 4px;
  padding-bottom: 2px;
}

.heatmap thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface-1);
}

.card-footnote {
  margin-top: 10px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-3);
}

.heatmap {
  width: 100%;
  min-width: 740px;
  border-collapse: separate;
  border-spacing: 2px;
  table-layout: fixed;
}

.heatmap thead th {
  padding: 5px 7px 7px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.heatmap thead th.row-label { text-align: left; }

.heatmap thead th.total-col {
  color: var(--ink-2);
  font-weight: 600;
}

.heatmap tbody th,
.heatmap tbody td { height: 26px; }

.heatmap tbody th.row-label {
  padding: 0 8px 0 2px;
  font-size: 11.5px;
  font-weight: 450;
  color: var(--ink-2);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.heatmap td.cell {
  padding: 0 7px;
  text-align: right;
  color: var(--ink);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  border-radius: 4px;
  cursor: default;
}

.heatmap td.cell.is-empty {
  color: transparent;
  background: transparent !important;
}

.heatmap td.total {
  padding: 0 8px;
  text-align: right;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border-radius: 4px;
  cursor: default;
}

.heatmap td.total.is-empty {
  color: transparent;
  background: transparent !important;
}

.heatmap td.cell:hover,
.heatmap td.total:hover,
.heatmap td.cell:focus-visible,
.heatmap td.total:focus-visible {
  outline: 1px solid var(--ink-3);
  outline-offset: -1px;
}

.heatmap tr.section-row th {
  padding: 13px 0 3px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.side-key {
  display: inline-block;
  width: 8px;
  height: 2px;
  margin-right: 6px;
  border-radius: 1px;
  vertical-align: middle;
}

.side-key.ask { background: var(--ask); }
.side-key.bid { background: var(--bid); }

.mid-row td {
  height: 30px;
  padding: 0 10px;
  text-align: center;
  color: var(--ink-2);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  background: var(--surface-2);
  border-radius: 6px;
}

.mid-row .mid-price {
  color: var(--ink);
  font-weight: 600;
}

.mid-balance-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px 18px;
  flex-wrap: wrap;
  width: 100%;
}

.mid-balance-wrap .balance { flex: 0 1 260px; }

.mid-copy { white-space: nowrap; }

.balance {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  cursor: default;
}

.balance:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.balance-side {
  font-size: 10px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.balance-track {
  position: relative;
  flex: 1;
  display: flex;
  gap: 2px;
  height: 5px;
  min-width: 54px;
  background: var(--surface-2);
  border-radius: 3px;
}

.balance-bid {
  height: 100%;
  background: var(--bid);
  border-radius: 3px 0 0 3px;
  transition: width 0.3s ease;
}

.balance-ask {
  height: 100%;
  background: var(--ask);
  border-radius: 0 3px 3px 0;
  transition: width 0.3s ease;
}

.balance-tick {
  position: absolute;
  left: 50%;
  top: -2px;
  width: 1px;
  height: 9px;
  background: var(--ink-3);
  opacity: 0.7;
  pointer-events: none;
}

.heatmap tbody tr.balance-row th,
.heatmap tbody tr.balance-row td {
  height: 26px;
  padding: 3px 5px 4px;
  background: var(--surface-2);
  border-radius: 6px;
  vertical-align: middle;
}

.heatmap tbody tr.balance-row th.row-label {
  padding: 4px 8px 4px 2px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: right;
  white-space: nowrap;
}

.balance-cell { cursor: default; }

.balance-compact { width: 100%; }

.balance-compact .balance-track {
  width: 100%;
  min-width: 0;
  height: 5px;
}

.balance-caption {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  font-size: 9.5px;
  line-height: 1.2;
  color: var(--ink-3);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.balance-cell.is-excluded { opacity: 0.5; }

.balance-cell.total .balance-caption {
  color: var(--ink-2);
  font-weight: 600;
}

/* ---------------------------------------------------------------------------
   Independent view — venue cards
--------------------------------------------------------------------------- */
.view-note {
  margin-top: 14px;
  font-size: 12px;
  color: var(--ink-3);
}

.venue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.venue-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 14px 15px 12px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.venue-card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--ink-3);
}

.venue-card.v-1::before { background: var(--venue-1); }
.venue-card.v-2::before { background: var(--venue-2); }
.venue-card.v-3::before { background: var(--venue-3); }
.venue-card.v-4::before { background: var(--venue-4); }
.venue-card.v-5::before { background: var(--venue-5); }
.venue-card.v-6::before { background: var(--venue-6); }
.venue-card.v-7::before { background: var(--venue-7); }

.venue-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.venue-head h3 {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.pair-chip {
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.feed {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  font-size: 10.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.feed .status-dot { width: 6px; height: 6px; }
.feed[data-state="good"] .status-dot { background: var(--good); }
.feed[data-state="warn"] .status-dot { background: var(--warning); }
.feed[data-state="bad"] .status-dot { background: var(--critical); }

.venue-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: opacity 0.2s ease;
}

.venue-card.is-stale .venue-body { opacity: 0.55; }
.venue-card.is-empty .venue-body { opacity: 0.4; }

.quote-row {
  display: grid;
  grid-template-columns: 1fr 1fr 0.85fr;
  gap: 8px;
}

.q {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.q-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}

.q-value {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.q-value.is-muted { color: var(--ink-3); }

.best-tag {
  padding: 0 3px;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  line-height: 1.5;
}

.mini-depth {
  display: block;
  width: 100%;
  height: 62px;
}

.mini-bid-line,
.mini-ask-line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.mini-bid-line { stroke: var(--bid); }
.mini-ask-line { stroke: var(--ask); }

.mini-bid-area { fill: var(--bid); opacity: 0.10; }
.mini-ask-area { fill: var(--ask); opacity: 0.10; }

.mini-book {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.mini-book td {
  padding: 2.5px 0;
  white-space: nowrap;
}

.mini-book td.price {
  width: 34%;
  text-align: left;
  color: var(--ink-2);
}

.mini-book td.size {
  width: 34%;
  text-align: right;
  color: var(--ink);
  padding-left: 8px;
}

.mini-book td.bar-cell {
  width: 32%;
  padding-left: 10px;
}

.book-bar-wrap {
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}

.book-bar {
  display: block;
  height: 6px;
  border-radius: 3px;
  transition: width 0.25s ease;
}

.book-bar.ask {
  margin-left: auto;
  background: color-mix(in srgb, var(--ask) 42%, transparent);
}

.book-bar.bid {
  background: color-mix(in srgb, var(--bid) 42%, transparent);
}

.mini-divider {
  display: block;
  height: 1px;
  margin: 3px 0;
  background: var(--border-strong);
}

.mini-book tr.divider td { padding: 6px 0 5px; }

.size-value { font-variant-numeric: tabular-nums; }

.wall-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 3px;
  font-size: 8.5px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink-2);
  border: 1px solid color-mix(in srgb, var(--warning) 55%, var(--border));
  background: color-mix(in srgb, var(--warning) 14%, transparent);
  border-radius: 3px;
  vertical-align: 1px;
}

.mini-book tr.has-wall td {
  background: color-mix(in srgb, var(--warning) 7%, transparent);
}

.mini-empty {
  padding: 18px 0;
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
}

.venue-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 10.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
}

.venue-foot span {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------------------------------------------------------------------
   Footer & tooltip
--------------------------------------------------------------------------- */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  flex-wrap: wrap;
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.tooltip {
  position: fixed;
  z-index: 50;
  width: max-content;
  max-width: 340px;
  padding: 10px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  box-shadow: var(--shadow);
  pointer-events: none;
  font-size: 12px;
}

.tip-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}

.tip-head .tip-range {
  margin-left: auto;
  font-weight: 450;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.tip-value {
  margin-top: 4px;
  font-size: 20px;
  font-weight: 620;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.tip-value .unit {
  margin-left: 3px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
}

.tip-sub {
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.tip-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--border);
}

.tip-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--ink-2);
  white-space: nowrap;
}

.tip-row .name { flex: 1; }

.tip-row .val {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.tip-zoom-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.tip-zoom-head .zoom-count {
  font-weight: 450;
  letter-spacing: 0;
  text-transform: none;
}

.tip-zoom-row {
  display: grid;
  grid-template-columns: 1fr auto 42px;
  gap: 8px;
  padding: 0.5px 0;
  font-size: 11.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.tip-zoom-row > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tip-zoom-row > span:nth-child(2) {
  text-align: right;
  color: var(--ink);
}

.tip-zoom-row > span:nth-child(3) {
  text-align: right;
  color: var(--ink-3);
}

.tip-zoom-row.zoom-labels {
  margin-top: 3px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.tip-zoom-row.zoom-labels > span {
  color: var(--ink-3);
  font-weight: 500;
}

/* ---------------------------------------------------------------------------
   Responsive
--------------------------------------------------------------------------- */
@media (max-width: 1140px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .app { padding: 18px 18px 32px; }
  .control-note { display: none; }
  .depth-chart { aspect-ratio: 1000 / 320; }
}

@media (max-width: 680px) {
  .app { padding: 16px 15px 28px; }
  .topbar-right { width: 100%; justify-content: flex-start; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 19px; }
  .card { padding: 13px 13px 12px; }
  .venue-grid { grid-template-columns: 1fr; }
  .segmented button { padding: 5px 9px; font-size: 12.5px; }
  .tooltip { max-width: 260px; }
}

@media (max-width: 430px) {
  .kpi:last-child { grid-column: 1 / -1; }
  .conn { padding: 5px 9px; }
  .brand-text p { display: none; }
}
