/* Live Tab — tokens & base */
:root {
  --paper: #F2E9D0;
  --paper-2: #EADFC2;
  --paper-3: #E3D5B0;
  --ink: #1A1613;
  --ink-2: #3A332C;
  --muted: #7A6F62;
  --muted-2: #A89C89;
  --rule: rgba(26, 22, 19, 0.12);
  --rule-2: rgba(26, 22, 19, 0.06);
  --card: #F7F0DC;
  --card-inset: #EEE3C4;

  --gain: #2E7D4F;
  --gain-soft: rgba(46, 125, 79, 0.12);
  --loss: #B93424;
  --loss-soft: rgba(185, 52, 36, 0.12);

  --accent: #D97757;
  --accent-soft: rgba(217, 119, 87, 0.14);
  --accent-ink: #8A3B1F;

  --warn: #C79A2E;

  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 10px;

  --pad: 16px;
  --pad-sm: 10px;
  --pad-xs: 6px;

  --fs-xxs: 10px;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 13px;
  --fs-lg: 15px;
  --fs-xl: 20px;
  --fs-2xl: 28px;
  --fs-3xl: 40px;

  --mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --sans: 'Inter Tight', 'Inter', system-ui, -apple-system, sans-serif;
  --serif: 'Instrument Serif', 'Fraunces', Georgia, serif;
}

.density-compact {
  --pad: 10px;
  --pad-sm: 6px;
  --pad-xs: 4px;
  --fs-sm: 11px;
  --fs-md: 12px;
  --fs-lg: 14px;
}

.theme-dark {
  --paper: #15120E;
  --paper-2: #1C1915;
  --paper-3: #24201B;
  --ink: #F0E7D2;
  --ink-2: #CFC4AD;
  --muted: #8A7F6D;
  --muted-2: #5F5648;
  --rule: rgba(242, 233, 208, 0.12);
  --rule-2: rgba(242, 233, 208, 0.06);
  --card: #1F1B16;
  --card-inset: #18140F;
  --gain: #4FB47A;
  --gain-soft: rgba(79, 180, 122, 0.14);
  --loss: #E05A4B;
  --loss-soft: rgba(224, 90, 75, 0.14);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-md);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body {
  min-height: 100vh;
  overflow-x: hidden;
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.serif { font-family: var(--serif); font-weight: 400; }
.up { color: var(--gain); }
.down { color: var(--loss); }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.uppercase { text-transform: uppercase; letter-spacing: 0.08em; font-size: var(--fs-xs); color: var(--muted); }

.rule { border: 0; border-top: 1px solid var(--rule); margin: 0; }
button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }

/* Refresh bar — attached to the live pill */
.pill-refresh {
  position: relative;
  overflow: hidden;
  padding-bottom: 5px;
}
.pill-refresh__fill {
  position: absolute;
  left: 0; bottom: 0;
  height: 2px;
  background: var(--gain);
  width: 0%;
  transition: width 0.1s linear;
}
.pill-refresh__fill.pulse { animation: refreshPulse 0.6s ease-out; }
@keyframes refreshPulse {
  0% { opacity: 1; filter: brightness(1.3); }
  100% { opacity: 1; filter: brightness(1); }
}

/* ---------- Topbar ---------- */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.topbar__brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 4px;
  background: var(--ink); color: var(--paper);
  display: grid; place-items: center; font-family: var(--mono); font-size: 11px; font-weight: 700;
}
.topbar__nav { display: flex; gap: 2px; align-items: center; }
.topbar__nav a {
  font-size: var(--fs-sm);
  color: var(--ink-2);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: var(--radius);
}
.topbar__nav a.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.topbar__nav a:hover:not(.active) { background: var(--rule-2); }
.topbar__right { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }

@media (max-width: 1280px) {
  .topbar__nav a { padding: 6px 6px; font-size: 11px; }
  .clock.optional { display: none; }
}
@media (max-width: 1100px) {
  .topbar { gap: 8px; padding: 10px 14px; }
  .topbar__brand span { display: none; }
}
.clock { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: var(--fs-sm); color: var(--muted); }
.clock strong { color: var(--ink); font-weight: 600; }

/* Session pill */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid var(--rule);
  background: var(--card);
  color: var(--ink-2);
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.pill.live { color: var(--gain); border-color: var(--gain-soft); background: var(--gain-soft); }
.pill.live .dot { background: var(--gain); animation: livePulse 1.8s ease-in-out infinite; }
.pill.off { color: var(--muted); }
/* Phase 12: market countdown shown next to the .pill.off "Market Closed"
   pill in the topbar. Plain text in the mono font, muted color. */
.market-countdown {
  color: var(--muted);
  font-size: var(--fs-xs, 12px);
  letter-spacing: 0.02em;
  white-space: nowrap;
  margin-left: 4px;
}
.pill.warn { color: var(--accent-ink); background: var(--accent-soft); border-color: var(--accent-soft); }
.pill.warn .dot { background: var(--accent); }
/* PR ui-polish: stale/offline pill state -- shown when live_stats.json
   is older than 90s, meaning the publisher (and likely the bot) is not
   running. Visually distinct from .pill.live (green) and .pill.warn
   (orange/closed): muted red, no animation, no progress bar fill. */
.pill.stale {
  color: var(--loss, #b93424);
  border-color: rgba(185, 52, 36, 0.28);
  background: rgba(185, 52, 36, 0.08);
}
.pill.stale .dot {
  background: var(--loss, #b93424);
  /* no pulse animation -- bot is not live, don't fake activity */
}
@keyframes livePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.5; }
}

/* Welcome hero — two-row banner replacing the old separate Topbar.
   Row 1: live tab eyebrow + session pill + uptime + date  |  NY/LON clocks + Live refresh pill
   Row 2: 4 session schedule pills */
.welcome-hero,
.welcome-hero--compact {
  padding: 14px 24px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.welcome-hero__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 18px;
}
.welcome-hero__row--lead {
  justify-content: space-between;
}
.welcome-hero__lead {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.welcome-hero__clocks {
  display: flex;
  align-items: center;
  gap: 14px;
}
.welcome-hero__clocks .clock {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: var(--fs-sm);
}
.welcome-hero__clocks .clock span {
  font-size: var(--fs-xxs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 500;
}
.welcome-hero__clocks .clock strong {
  font-family: var(--mono);
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.welcome-hero__clocks .clock.optional {
  /* hide on narrow screens */
}
@media (max-width: 720px) {
  .welcome-hero__clocks .clock.optional { display: none; }
}
.welcome-hero .eyebrow-compact {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-weight: 500;
}
.welcome-hero .uptime-chip {
  font-size: var(--fs-sm);
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.welcome-hero .hero-date {
  /* readable + prominent — main piece of info on the lead row */
  font-size: var(--fs-xl);
  color: var(--ink);
  font-weight: 400;
  font-family: var(--serif);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
/* Bump session pill type one tier so it matches the new bigger date */
.welcome-hero__lead .pill {
  font-size: var(--fs-sm);
  padding: 4px 12px;
}
.welcome-hero__right { display: none; /* legacy — compact hero doesn't use it */ }
.hero-cell {
  padding: 14px 16px;
  border-right: 1px solid var(--rule-2);
  position: relative;
  cursor: pointer;
  transition: background 0.15s ease;
}
.hero-cell:nth-child(3n) { border-right: 0; }
.hero-cell:nth-child(-n+3) { border-bottom: 1px solid var(--rule-2); }
.hero-cell:hover { background: var(--card-inset); }
.hero-cell__label {
  font-size: var(--fs-xxs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.hero-cell__value {
  font-family: var(--mono);
  font-size: var(--fs-xl);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-top: 3px;
  line-height: 1.1;
}
.hero-cell__sub {
  font-size: var(--fs-xxs);
  color: var(--muted);
  margin-top: 3px;
  font-family: var(--mono);
}
/* reposition the hero-stat tooltip for this smaller grid */
.hero-cell .stat-tooltip {
  left: 12px; right: 12px;
}

/* ---------- Hero stat row ---------- */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.hero-stat {
  position: relative;
  padding: 16px 20px;
  border-right: 1px solid var(--rule);
  cursor: pointer;
  transition: background 0.15s ease;
}
.hero-stat:last-child { border-right: 0; }
.hero-stat:hover { background: var(--card); }
.hero-stat__label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.hero-stat__value {
  font-family: var(--mono);
  font-size: var(--fs-2xl);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-top: 4px;
  line-height: 1.1;
}
.hero-stat__sub {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-top: 4px;
  font-family: var(--mono);
  display: flex;
  gap: 8px;
  align-items: center;
}
.hero-stat__sub .chip {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.hero-stat__sub .chip.win { color: var(--gain); }
.hero-stat__sub .chip.loss { color: var(--loss); }

/* stat hover tooltip */
.stat-tooltip {
  position: absolute;
  top: calc(100% + 6px);
  left: 16px;
  right: 16px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  z-index: 50;
  min-width: 280px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}
.hero-stat:hover .stat-tooltip {
  opacity: 1;
  transform: translateY(0);
}
.stat-tooltip::before {
  content: '';
  position: absolute;
  top: -5px; left: 20px;
  width: 10px; height: 10px;
  background: var(--card);
  border-left: 1px solid var(--rule);
  border-top: 1px solid var(--rule);
  transform: rotate(45deg);
}
.stat-tooltip__row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: var(--fs-sm); }
.stat-tooltip__row + .stat-tooltip__row { border-top: 1px solid var(--rule-2); }
.stat-tooltip__row span:first-child { color: var(--muted); }
.stat-tooltip__row span:last-child { font-family: var(--mono); font-weight: 500; }

.stat-tooltip__bar {
  display: flex;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0 6px;
  background: var(--rule-2);
}
.stat-tooltip__bar .wins { background: var(--gain); }
.stat-tooltip__bar .losses { background: var(--loss); }
.stat-tooltip__bar span { display: block; height: 100%; }

/* ---------- Main grid ---------- */
.main-grid {
  display: grid;
  /* v3: single-row layout. MultiTFDelta now lives inside SignalsRail's
     div (column 1) so we don't need a row-2 area for it anymore. */
  grid-template-columns: 320px 1fr 280px;
  grid-template-rows: 1fr;
  grid-template-areas: "signals chart rail";
  min-height: max(640px, calc(100vh - 360px));
  gap: 0;
  border-bottom: 1px solid var(--rule);
}
.main-grid > .signals-rail { grid-area: signals; border-right: 1px solid var(--rule); }
.main-grid > .live-chart   { grid-area: chart; border-right: 1px solid var(--rule); }
.main-grid > .right-rail   { grid-area: rail; }

/* Variation B: focus — drops signals + MTD entirely */
.main-grid.v-focus {
  grid-template-columns: 1fr 280px;
  grid-template-rows: 1fr;
  grid-template-areas: "chart rail";
}
.main-grid.v-focus .signals-rail,
.main-grid.v-focus .mtd-card { display: none; }

/* Variation C: terminal — same shape as classic, narrower side cols */
.main-grid.v-terminal {
  grid-template-columns: 280px 1fr 260px;
}
.main-grid.v-terminal .signals-rail .signal-row { padding: 4px 10px; font-size: var(--fs-xs); }

/* ---------- Signals Rail ---------- */
.signals-rail {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  min-height: 520px;
}
.signals-rail .rail-collapsible {
  /* MTD sits immediately after the signals list (no auto-gap), so the
     collapsed chevron fills the visual hole instead of floating at the
     bottom of the column. */
  border-top: 1px solid var(--rule);
}
.signals-rail .signals-list {
  /* PR-RAIL-1 (2026-05-22): bound the list to ~15 visible rows with
     overflow scroll. Without this cap, the 48h window from PR-SIGNALS-1
     stretches the column to thousands of pixels. 480px @ ~32px per row =
     ~15 signals visible; the rest scroll within the bounded container. */
  flex: 0 1 auto;
  max-height: 480px;
  overflow-y: auto;
}
.rail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.rail-header .count {
  font-family: var(--mono);
  color: var(--ink);
  background: var(--card);
  padding: 2px 7px;
  border-radius: 999px;
  font-size: var(--fs-xxs);
  border: 1px solid var(--rule);
}
.signals-filters {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule-2);
}
.signals-filters button {
  padding: 3px 8px;
  font-size: var(--fs-xs);
  color: var(--muted);
  border-radius: 999px;
  border: 1px solid transparent;
}
.signals-filters button.active {
  background: var(--card);
  border-color: var(--rule);
  color: var(--ink);
}
.signals-list {
  flex: 1 1 auto;
  overflow-y: auto;
  /* No max-height — list fills the available rail height (which is now
     the full row 1 of main-grid, since MultiTFDelta moved to row 2). */
  min-height: 0;
}
.signal-row {
  display: grid;
  grid-template-columns: 90px 44px auto 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  border-bottom: 1px solid var(--rule-2);
  cursor: pointer;
}
.signal-row:hover { background: var(--card-inset); }
.signal-row .time { color: var(--muted); }
.signal-row .side.long { color: var(--gain); font-weight: 600; }
.signal-row .side.short { color: var(--loss); font-weight: 600; }
.signal-row .tag {
  font-size: var(--fs-xxs);
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--sans);
  font-weight: 500;
}
.signal-row .tag.approved { background: var(--gain-soft); color: var(--gain); }
.signal-row .tag.rejected { background: var(--loss-soft); color: var(--loss); }
.signal-row .tag.pending { background: var(--accent-soft); color: var(--accent-ink); }
.signal-row .muted {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ---------- Chart area ---------- */
.chart-area {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  min-width: 0;
}
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--rule);
  gap: 12px;
  flex-wrap: wrap;
}
.chart-title {
  display: flex; align-items: center; gap: 10px;
}
.chart-title .symbol {
  font-family: var(--mono);
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.chart-title select {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--ink);
}
.chart-ohlc {
  display: flex; gap: 12px;
  font-family: var(--mono); font-size: var(--fs-xs);
  color: var(--muted);
}
.chart-ohlc strong { color: var(--ink); font-weight: 500; }
.chart-tf {
  display: flex; gap: 2px;
  background: var(--card);
  padding: 2px;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
}
.chart-tf button {
  padding: 3px 9px;
  font-size: var(--fs-xs);
  font-family: var(--mono);
  border-radius: 4px;
  color: var(--muted);
}
.chart-tf button.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--rule);
}

.chart-canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 540px;
  cursor: crosshair;
}
.chart-canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.chart-last-price {
  position: absolute;
  right: 8px;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  padding: 2px 6px;
  border-radius: 3px;
  color: white;
  transform: translateY(-50%);
  pointer-events: none;
  font-weight: 500;
}
.chart-last-price.up { background: var(--gain); }
.chart-last-price.down { background: var(--loss); }

/* Volume strip under chart */
.volume-strip {
  height: 60px;
  border-top: 1px solid var(--rule);
  position: relative;
}
.volume-strip canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.volume-strip .label {
  position: absolute; top: 4px; left: 8px;
  font-family: var(--mono); font-size: var(--fs-xxs);
  color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}



/* ──────────── Crosshair + OHLC chip ──────────── */
.ohlc-chip {
  position: absolute;
  top: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-xxs);
  padding: 4px 8px;
  background: rgba(255,250,243,0.85);
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--ink);
  pointer-events: none;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.ohlc-chip .muted { color: var(--muted); margin-left: 6px; }
.ohlc-chip .muted:first-child { margin-left: 0; }
.ohlc-chip .up { color: var(--gain); font-weight: 600; }
.ohlc-chip .down { color: var(--loss); font-weight: 600; }

.crosshair-v {
  position: absolute;
  top: 0;
  width: 0;
  border-left: 1px dashed var(--ink);
  opacity: 0.4;
  pointer-events: none;
  z-index: 4;
}
.crosshair-v.vol-strip-line {
  height: 100%;
  top: 0;
}
.crosshair-h {
  position: absolute;
  left: 0;
  height: 0;
  border-top: 1px dashed var(--ink);
  opacity: 0.4;
  pointer-events: none;
  z-index: 4;
}
.crosshair-price-pill {
  position: absolute;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: var(--fs-xs);
  padding: 2px 6px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 2px;
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.crosshair-time-pill {
  position: absolute;
  transform: translate(-50%, 0);
  font-family: var(--mono);
  font-size: var(--fs-xs);
  padding: 2px 6px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 2px;
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ---------- Right Rail ---------- */
.right-rail {
  display: flex;
  flex-direction: column;
  background: var(--paper);
}
.rail-section {
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule);
}
.rail-section__title {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.session-pl {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 12px;
}
.session-pl__big {
  font-family: var(--mono);
  font-size: var(--fs-3xl);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
}
.session-pl__delta {
  font-family: var(--mono);
  font-size: var(--fs-sm);
}
.kv {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  font-size: var(--fs-sm);
  padding: 5px 0;
}
.kv + .kv { border-top: 1px solid var(--rule-2); }
.kv__k { color: var(--muted); }
.kv__v { font-family: var(--mono); font-weight: 500; }

/* Mini equity curve */
.equity-curve {
  height: 70px; width: 100%;
  position: relative;
}
.equity-curve svg { width: 100%; height: 100%; display: block; }

/* ---------- Multi-TF delta — now a small square card ---------- */
.mtd-card {
  position: absolute;
  left: 16px;
  bottom: 16px;
  width: 230px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 10px 12px 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
  z-index: 5;
}
.mtd-card__title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 6px;
}
.mtd-card__title h3 {
  margin: 0;
  font-size: var(--fs-xxs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 500;
}
.mtd-card__title .big {
  font-family: var(--mono);
  font-size: var(--fs-md);
  font-weight: 500;
}
.mtd-rows {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 3px;
}
.mtd-row {
  display: grid;
  grid-template-columns: 24px 1fr 40px;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: var(--fs-xxs);
}
.mtd-row .tf { color: var(--muted); }
.mtd-row .bar {
  position: relative;
  height: 7px;
  background: var(--rule-2);
  border-radius: 2px;
  overflow: hidden;
}
.mtd-row .bar__center {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 1px;
  background: var(--rule);
}
.mtd-row .bar__fill {
  position: absolute; top: 0; bottom: 0;
}
.mtd-row .val { text-align: right; }

/* ---------- Scroll / below-fold ---------- */
.below-fold {
  padding: 48px 22px 80px;
  background: var(--paper);
}
.scroll-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  color: var(--muted);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  border-bottom: 1px solid var(--rule);
  background: var(--paper-2);
  cursor: pointer;
}
.scroll-hint:hover { color: var(--ink); background: var(--card); }

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin: 0 0 20px;
  gap: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}
.section-header > div:first-child { min-width: 0; flex: 1; }
.section-header h2 {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1;
}
.section-header p {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-sm);
  max-width: 48ch;
}
.section + .section { margin-top: 56px; }

/* Calendar heatmap — now just the grid (no side summary) */
.cal-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 18px 20px 18px;
}
.cal-card__main { min-width: 0; }
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-nav button {
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  color: var(--muted);
}
.cal-nav button:hover { background: var(--card-inset); color: var(--ink); }
.cal-nav .label {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  padding: 0 10px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-dow {
  text-align: center;
  font-size: var(--fs-xxs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding-bottom: 6px;
}
.cal-day {
  aspect-ratio: 1.3 / 1;
  border-radius: var(--radius-sm);
  padding: 4px 5px;
  background: var(--rule-2);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 9px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  cursor: pointer;
  transition: transform 0.1s ease;
  border: 1px solid transparent;
}
.cal-day:hover { transform: scale(1.05); z-index: 2; border-color: var(--ink); }
.cal-day .dn { font-weight: 500; }
.cal-day .pl { font-size: var(--fs-xxs); opacity: 0.9; }
.cal-day.weekend { background: transparent; opacity: 0.35; }
.cal-day.empty { visibility: hidden; }
.cal-day.today { outline: 2px solid var(--accent); outline-offset: 1px; }

.cal-day.pl-1 { background: rgba(46, 125, 79, 0.18); color: var(--gain); }
.cal-day.pl-2 { background: rgba(46, 125, 79, 0.38); color: var(--gain); }
.cal-day.pl-3 { background: rgba(46, 125, 79, 0.65); color: #fff; }
.cal-day.pl-4 { background: rgba(46, 125, 79, 0.95); color: #fff; }
.cal-day.pl-n1 { background: rgba(185, 52, 36, 0.18); color: var(--loss); }
.cal-day.pl-n2 { background: rgba(185, 52, 36, 0.38); color: var(--loss); }
.cal-day.pl-n3 { background: rgba(185, 52, 36, 0.65); color: #fff; }
.cal-day.pl-n4 { background: rgba(185, 52, 36, 0.95); color: #fff; }

.cal-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-top: 16px;
  justify-content: flex-end;
}
.cal-legend__swatches { display: flex; gap: 2px; }
.cal-legend__swatches span { width: 14px; height: 14px; border-radius: 3px; }

.cal-summary {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 4px;
}
.cal-summary > div { padding: 10px 0; border-bottom: 1px solid var(--rule-2); }
.cal-summary > div:last-child { border-bottom: 0; }
.cal-summary .l { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.cal-summary .v { font-family: var(--mono); font-size: var(--fs-xl); font-weight: 500; letter-spacing: -0.02em; margin-top: 4px; }

/* Feeds */
.feeds-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.feed-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 18px 20px 8px;
  display: flex;
  flex-direction: column;
  min-height: 300px;
}
.feed-card h3 {
  margin: 0 0 14px;
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.feed-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--rule-2);
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  align-items: start;
}
.feed-item:last-child { border-bottom: 0; }
.feed-item .when {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.4;
}
.feed-item .body { font-size: var(--fs-sm); line-height: 1.45; }
.feed-item .title { color: var(--ink); font-weight: 500; }
.feed-item .desc { color: var(--muted); font-size: var(--fs-xs); margin-top: 3px; }
.feed-item .imp {
  display: inline-flex;
  gap: 2px;
  margin-right: 6px;
  vertical-align: middle;
}
.feed-item .imp span { width: 6px; height: 6px; border-radius: 50%; background: var(--rule); }
.feed-item .imp.high span { background: var(--loss); }
.feed-item .imp.med span:nth-child(-n+2) { background: var(--warn); }
.feed-item .imp.low span:first-child { background: var(--gain); }

/* Side-by-side row: calendar + hours */
.cal-hours-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}
.cal-hours-row .profile-card { margin: 0; }
.hours-stack { display: flex; flex-direction: column; gap: 18px; }

/* Two-square row for Profile & Notifications */
.profile-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.profile-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
}
.profile-card h3 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.hours-row {
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule-2);
  font-size: var(--fs-sm);
  align-items: center;
}
.hours-row:last-child { border-bottom: 0; }
.hours-row .day { color: var(--muted); }
.hours-row .time { font-family: var(--mono); font-weight: 500; }
.hours-row .time.closed { color: var(--muted-2); font-weight: 400; }
.hours-row.now { background: var(--accent-soft); margin: 0 -10px; padding: 8px 10px; border-radius: var(--radius); border-bottom: 0; }
.hours-row.now .day { color: var(--accent-ink); font-weight: 500; }

.disclaimer-text {
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.6;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--rule-2);
}

.toggle-row {
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 10px 0;
  align-items: center;
  border-bottom: 1px solid var(--rule-2);
}
.toggle-row:last-child { border-bottom: 0; }
.toggle-row .label { font-size: var(--fs-sm); }
.toggle-row .desc { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
.toggle {
  width: 32px; height: 18px;
  border-radius: 999px;
  background: var(--rule);
  position: relative;
  cursor: pointer;
  transition: background 0.18s ease;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--paper);
  transition: transform 0.18s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.toggle.on { background: var(--accent); }
.toggle.on::after { transform: translateX(14px); }

/* Tweaks panel */
.tweaks-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 300px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18), 0 4px 14px rgba(0,0,0,0.08);
  z-index: 1000;
  font-family: var(--sans);
}
.tweaks-panel h4 {
  margin: 0 0 12px;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tweak-group {
  padding: 10px 0;
  border-top: 1px solid var(--rule-2);
}
.tweak-group__label {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.tweak-seg {
  display: flex;
  gap: 2px;
  background: var(--card-inset);
  padding: 2px;
  border-radius: var(--radius);
}
.tweak-seg button {
  flex: 1;
  padding: 5px 8px;
  font-size: var(--fs-xs);
  border-radius: 4px;
  color: var(--muted);
}
.tweak-seg button.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--rule);
}
.tweak-swatches {
  display: flex;
  gap: 8px;
}
.tweak-swatch {
  width: 26px; height: 26px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.12s ease;
}
.tweak-swatch.active { border-color: var(--ink); transform: scale(1.08); }
.tweak-swatch:hover { transform: scale(1.08); }

/* Market-closed overlay */
.market-closed-banner {
  padding: 14px 20px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: var(--fs-sm);
  color: var(--accent-ink);
}
.market-closed-banner .countdown {
  margin-left: auto;
  font-family: var(--mono);
  font-weight: 500;
}

/* Session key — compact pills inside the thin welcome banner */
.session-key,
.session-key--compact {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0;
}
.session-key__item {
  display: flex;
  flex-direction: column;
  padding: 4px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--card);
  min-width: 96px;
  line-height: 1.2;
}
.session-key__item .sk-time {
  font-size: 10px !important;
}
.session-key__item.asia    { background: rgba(139,76,126,0.08); border-color: rgba(139,76,126,0.22); }
.session-key__item.london  { background: rgba(90,111,216,0.08); border-color: rgba(90,111,216,0.22); }
.session-key__item.ny      { background: rgba(217,119,87,0.10); border-color: rgba(217,119,87,0.28); }
.session-key__item .sk-label {
  font-size: var(--fs-xxs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  display: flex; align-items: center; gap: 5px;
}
.session-key__item.asia .sk-label    { color: #6B3D62; }
.session-key__item.london .sk-label  { color: #2E3A82; }
.session-key__item.ny .sk-label      { color: var(--accent-ink); }
.session-key__item .sk-time {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  font-weight: 500;
  margin-top: 2px;
}
.session-key__item .sk-sub {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-top: 1px;
}
.session-key__item .active-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: livePulse 1.8s ease-in-out infinite;
}
.session-zones {
  display: grid;
  grid-template-columns: 0.9fr 1fr 1.1fr;
  border-bottom: 1px solid var(--rule);
  background: var(--paper-2);
}
.session-zone {
  padding: 6px 12px;
  font-family: var(--mono);
  font-size: var(--fs-xxs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: flex; align-items: center; justify-content: space-between;
  border-right: 1px solid var(--rule-2);
}
.session-zone:last-child { border-right: 0; }
.session-zone.asia    { background: rgba(139,76,126,0.07); color: #6B3D62; }
.session-zone.london  { background: rgba(90,111,216,0.07); color: #2E3A82; }
.session-zone.ny      { background: rgba(217,119,87,0.09); color: var(--accent-ink); }
.session-zone .time { color: var(--muted); letter-spacing: 0; }

/* Session-by-session P&L table */
.sxs-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: var(--fs-xs); }
.sxs-table th, .sxs-table td { padding: 5px 0; text-align: right; }
.sxs-table th:first-child, .sxs-table td:first-child { text-align: left; color: var(--muted); font-weight: 400; text-transform: uppercase; letter-spacing: 0.06em; font-size: var(--fs-xxs); }
.sxs-table thead th { color: var(--muted); font-weight: 400; font-size: var(--fs-xxs); text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 1px solid var(--rule-2); }
.sxs-table tbody tr { border-bottom: 1px solid var(--rule-2); }
.sxs-table tbody tr:last-child { border-bottom: 0; }
.sxs-table .dim { color: var(--muted-2); }

/* Hourly heatmap */
.hh-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; }
.hh-cell {
  aspect-ratio: 1 / 0.75;
  border-radius: 3px;
  padding: 3px 4px;
  font-family: var(--mono);
  font-size: 9px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: var(--rule-2);
  color: var(--muted-2);
}
.hh-cell .h { font-size: 9px; }
.hh-cell .p { font-size: 8px; opacity: 0.85; }



/* (Removed the position:relative shim — MTD now sits in a real grid cell
   via grid-template-areas, no absolute positioning needed.) */

/* Responsive fallback for welcome hero */
@media (max-width: 1100px) {
  .welcome-hero { grid-template-columns: 1fr; gap: 24px; }
  .welcome-hero h1 { font-size: 44px; }
  .cal-card { grid-template-columns: 1fr; }
}

/* Variation-specific tweaks */
.v-terminal .hero-stat { padding: 10px 14px; }
.v-terminal .hero-stat__value { font-size: var(--fs-xl); }
.v-terminal .signal-row { grid-template-columns: 78px 38px auto 1fr; padding: 5px 10px; }

.v-focus .hero-stats { grid-template-columns: repeat(3, 1fr); }
.v-focus .hero-stat:nth-child(n+4) { display: none; }
.v-focus .extra-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--rule);
}

/* footer */
.pg-footer {
  padding: 28px 22px;
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: var(--muted);
  gap: 20px;
  flex-wrap: wrap;
}
.pg-footer a { color: var(--ink-2); text-decoration: none; }
.pg-footer a:hover { color: var(--accent-ink); text-decoration: underline; }


/* ─── Collapsible rail sections ───────────────────────────────── */
.rail-collapsible .rail-section__toggle {
  background: transparent;
  border: 0;
  padding: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: left;
}
.rail-collapsible .rail-section__toggle:hover {
  color: var(--ink);
}
.rail-collapsible .rail-section__toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}
.rail-collapsible .rail-section__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 0;
  padding-bottom: 4px;
}
.rail-collapsible.is-open .rail-section__title { margin-bottom: 10px; }
.rail-collapsible.is-collapsed .rail-section__title { margin-bottom: 0; padding-bottom: 0; }
.rail-collapsible.is-collapsed { padding-bottom: 12px; }
.rail-collapsible .rail-section__title-text {
  flex: 1;
}
.rail-collapsible .rail-section__controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.rail-collapsible .rail-section__chevron {
  font-size: 11px;
  color: var(--muted);
  transition: transform 0.15s ease;
  display: inline-block;
  width: 12px;
  text-align: center;
}
.rail-collapsible .rail-section__body {
  /* container for the body content; existing kv/table/etc styles still apply */
}

/* ─── Trade log table ──────────────────────────────────────────── */
.trade-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-xs);
  font-family: var(--mono);
}
.trade-log-table thead th {
  font-family: var(--sans);
  font-weight: 500;
  font-size: var(--fs-xxs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-align: left;
  padding: 4px 6px;
  border-bottom: 1px solid var(--rule);
}
.trade-log-table tbody td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--rule-2);
  vertical-align: middle;
}
.trade-log-table tbody tr:last-child td { border-bottom: 0; }
.trade-log-table .time { color: var(--muted); }
.trade-log-table .side.long { color: var(--gain); font-weight: 600; }
.trade-log-table .side.short { color: var(--loss); font-weight: 600; }
.trade-log-table .up { color: var(--gain); font-weight: 500; }
.trade-log-table .down { color: var(--loss); font-weight: 500; }
.trade-log-table .muted { color: var(--muted); }

.rail-empty {
  font-size: var(--fs-xs);
  color: var(--muted);
  padding: 12px 0 4px;
  text-align: center;
  font-family: var(--mono);
}


/* Topbar removed in v3 — local MAKEMONEYMARKETS bar was redundant
   with the main MMM nav. JSX no longer renders it; this CSS hide is
   defensive in case any older cached copy renders. */
.topbar { display: none !important; }


/* ─── Marker hover tooltip ────────────────────────────────────── */
.marker-tooltip {
  position: absolute;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 10px 12px;
  min-width: 180px;
  pointer-events: none;
  z-index: 6;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  font-size: var(--fs-xs);
  line-height: 1.4;
}
.marker-tooltip.is-long { border-left: 3px solid var(--gain); }
.marker-tooltip.is-short { border-left: 3px solid var(--loss); }
.marker-tooltip__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule-2);
}
.marker-tooltip__header .side {
  font-size: var(--fs-xxs);
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 3px;
}
.marker-tooltip__header .side.long { background: var(--gain-soft); color: var(--gain); }
.marker-tooltip__header .side.short { background: var(--loss-soft); color: var(--loss); }
.marker-tooltip__header .dec {
  font-size: var(--fs-xxs);
  font-weight: 600;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.marker-tooltip__header .time {
  margin-left: auto;
  font-size: var(--fs-xxs);
  color: var(--muted);
}
.marker-tooltip__rows .row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
}
.marker-tooltip__rows .k { color: var(--muted); }
.marker-tooltip__rows .v { color: var(--ink); font-weight: 500; }
