/* RX VIP Contest — dashboard styles
 * theme: Coral · layout: Command Center (fluid leaderboard + sticky detail rail)
 * type: Geist / Geist Mono · colour: oklch
 */
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap');

:root {
  /* paper */
  --color-paper: oklch(97% 0.004 80);
  --color-raised: oklch(100% 0 0);
  --color-sunken: oklch(94% 0.004 80);

  /* ink */
  --color-ink: oklch(17% 0.006 80);
  --color-ink-soft: oklch(42% 0.006 80);
  --color-ink-muted: oklch(58% 0.004 80);
  --color-ink-faint: oklch(78% 0.003 80);

  /* accent — coral */
  --color-accent: oklch(62% 0.18 30);
  --color-accent-strong: oklch(55% 0.20 30);
  --color-accent-bg: oklch(95% 0.03 30);
  --color-accent-text: oklch(50% 0.16 30);

  /* semantic */
  --color-pos: oklch(48% 0.14 155);
  --color-pos-bg: oklch(93% 0.05 155);
  --color-neg: oklch(48% 0.18 25);
  --color-neg-bg: oklch(93% 0.05 25);
  --color-warn: oklch(72% 0.14 85);
  --color-warn-bg: oklch(94% 0.04 85);

  /* metal */
  --metal-gold: oklch(88% 0.10 85);
  --metal-gold-ink: oklch(38% 0.09 85);
  --metal-silver: oklch(90% 0.01 250);
  --metal-silver-ink: oklch(38% 0.01 250);
  --metal-bronze: oklch(88% 0.08 50);
  --metal-bronze-ink: oklch(38% 0.08 50);

  /* borders */
  --color-border: oklch(89% 0.004 80);
  --color-border-strong: oklch(80% 0.006 80);

  --font-sans: 'Geist', system-ui, -apple-system, sans-serif;
  --font-mono: 'Geist Mono', 'SF Mono', 'Fira Code', monospace;

  --text-2xs: 0.625rem;
  --text-xs: 0.6875rem;
  --text-sm: 0.75rem;
  --text-base: 0.8125rem;
  --text-md: 0.875rem;
  --text-lg: 1rem;
  --text-xl: 1.125rem;
  --text-2xl: 1.375rem;
  --text-3xl: 1.75rem;

  --space-3xs: 2px;
  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  --radius-xs: 3px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-pill: 100px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 100ms;
  --dur-base: 180ms;

  --shadow-sm: 0 1px 2px oklch(0% 0 0 / 0.05);
  --shadow-md: 0 2px 8px oklch(0% 0 0 / 0.07);

  --nav-h: 56px;
}

[data-theme="dark"] {
  --color-paper: oklch(16% 0.006 80);
  --color-raised: oklch(20% 0.006 80);
  --color-sunken: oklch(13% 0.006 80);

  --color-ink: oklch(93% 0.004 80);
  --color-ink-soft: oklch(74% 0.004 80);
  --color-ink-muted: oklch(60% 0.004 80);
  --color-ink-faint: oklch(42% 0.004 80);

  --color-accent: oklch(70% 0.16 32);
  --color-accent-strong: oklch(76% 0.15 32);
  --color-accent-bg: oklch(28% 0.06 32);
  --color-accent-text: oklch(78% 0.13 32);

  --color-pos: oklch(72% 0.15 155);
  --color-pos-bg: oklch(27% 0.06 155);
  --color-neg: oklch(70% 0.17 25);
  --color-neg-bg: oklch(28% 0.07 25);
  --color-warn: oklch(78% 0.13 85);
  --color-warn-bg: oklch(30% 0.05 85);

  --color-border: oklch(28% 0.006 80);
  --color-border-strong: oklch(37% 0.006 80);

  --shadow-sm: 0 1px 2px oklch(0% 0 0 / 0.4);
  --shadow-md: 0 2px 10px oklch(0% 0 0 / 0.5);
}

/* ─── reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: clip; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--color-ink);
  background: var(--color-paper);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ─── nav ─── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: var(--color-raised);
  border-bottom: 1px solid var(--color-border-strong);
  box-shadow: var(--shadow-sm);
}
.nav-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: var(--space-sm) var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.nav-brand {
  font-weight: 700;
  font-size: var(--text-md);
  letter-spacing: -0.03em;
  white-space: nowrap;
}
.nav-brand em { font-style: normal; color: var(--color-accent); }
.nav-search {
  flex: 1;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-2xs) var(--space-sm);
  background: var(--color-sunken);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  transition: border-color var(--dur-fast) var(--ease-out);
}
.nav-search:focus-within { border-color: var(--color-accent); }
.nav-search input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-ink);
}
.nav-search input::placeholder { color: var(--color-ink-muted); }
.nav-search kbd {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  background: var(--color-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xs);
  padding: 1px 5px;
  margin-left: auto;
  color: var(--color-ink-muted);
}
.nav-search .search-clear {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-ink-muted);
  font-size: var(--text-md);
  line-height: 1;
  padding: 0 var(--space-2xs);
}
.nav-search .search-clear:hover { color: var(--color-ink); }
.nav-search.has-value .search-clear { display: block; }
.nav-search.has-value kbd { display: none; }
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-left: auto;
}
.nav-link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-ink-soft);
  padding: var(--space-2xs) var(--space-xs);
  border-radius: var(--radius-sm);
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.nav-link:hover, .nav-link.active { color: var(--color-ink); background: var(--color-sunken); }
.icon-btn {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-ink-soft);
  font-size: var(--text-md);
  line-height: 1;
  width: 28px;
  height: 26px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.icon-btn:hover { background: var(--color-sunken); color: var(--color-ink); }
.nav-live {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-pos);
  padding: var(--space-2xs) var(--space-xs);
  background: var(--color-pos-bg);
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.nav-live.stale { color: var(--color-ink-muted); background: var(--color-sunken); }
.nav-live.stale .nav-live-dot { background: var(--color-ink-muted); }
.nav-live.refreshing .nav-live-dot { animation: pulse 0.8s ease-in-out infinite; }
.nav-live-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--color-pos); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }

/* ─── layout ─── */
.page {
  max-width: 1360px;
  margin: 0 auto;
  padding: calc(var(--nav-h) + var(--space-xl)) var(--space-lg) var(--space-2xl);
}
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}
.page-title {
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.page-sub { font-size: var(--text-md); color: var(--color-ink-soft); margin-top: var(--space-2xs); }
.countdown {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-ink-soft);
  background: var(--color-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-xs) var(--space-sm);
}
.countdown strong { color: var(--color-accent-text); font-weight: 600; }

/* ─── podium ─── */
.podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-sm);
  align-items: end;
  margin-bottom: var(--space-lg);
}
.podium-col {
  background: var(--color-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-sm) var(--space-lg);
  text-align: center;
  position: relative;
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.podium-col:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.podium-col.gold { padding-top: var(--space-lg); padding-bottom: var(--space-xl); border-color: var(--metal-gold); }
.podium-col.empty { visibility: hidden; }
.podium-medal { font-size: 1.35rem; line-height: 1; }
.podium-avatar {
  width: 48px; height: 48px;
  margin: var(--space-xs) auto var(--space-xs);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--text-md);
  background: var(--color-sunken); color: var(--color-ink-soft);
}
.podium-col.gold .podium-avatar {
  width: 60px; height: 60px; font-size: var(--text-lg);
  background: var(--metal-gold); color: var(--metal-gold-ink);
}
.podium-col.silver .podium-avatar { background: var(--metal-silver); color: var(--metal-silver-ink); }
.podium-col.bronze .podium-avatar { background: var(--metal-bronze); color: var(--metal-bronze-ink); }
.podium-name {
  font-weight: 700;
  font-size: var(--text-md);
  letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.podium-col.gold .podium-name { font-size: var(--text-lg); }
.podium-meta {
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: var(--space-xs);
}
.podium-ret {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.podium-col.gold .podium-ret { font-size: var(--text-2xl); }
.podium-ret.pos { color: var(--color-pos); }
.podium-ret.neg { color: var(--color-neg); }
.podium-bal {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
  font-variant-numeric: tabular-nums;
}
.podium-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-xl);
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
  background: var(--color-raised);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
}

/* ─── stat strip ─── */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}
.stat-cell {
  background: var(--color-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
}
.stat-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-3xs);
}
.stat-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.stat-value.pos { color: var(--color-pos); }

/* ─── grid + rail ─── */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 384px;
  gap: var(--space-lg);
  align-items: start;
}
.rail {
  position: sticky;
  top: calc(var(--nav-h) + var(--space-md));
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  min-width: 0;
  /* keeps the rail clear of the fixed nav when scrolled into view on small screens */
  scroll-margin-top: calc(var(--nav-h) + var(--space-sm));
}
.rail-card {
  background: var(--color-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  min-width: 0;
}
/* The flex gap already spaces the first card, so drop the header's own margin —
   this is what lines the detail column up with the leaderboard table. */
.rail > .section-head { margin-bottom: 0; }

/* ─── section head ─── */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}
.section-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.section-action { font-size: var(--text-xs); color: var(--color-ink-muted); font-variant-numeric: tabular-nums; }

/* ─── leaderboard ─── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-raised);
}
.leaderboard { width: 100%; border-collapse: collapse; font-size: var(--text-base); table-layout: fixed; }
.leaderboard thead { background: var(--color-sunken); }
.leaderboard th {
  text-align: left;
  font-size: var(--text-2xs);
  font-weight: 600;
  color: var(--color-ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-sm) var(--space-xs);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.leaderboard th.num, .leaderboard td.num { text-align: right; font-variant-numeric: tabular-nums; }
.leaderboard td {
  padding: var(--space-sm) var(--space-xs);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
  overflow: hidden;
}
/* Fixed widths for every column except Trader, which absorbs the remainder.
   Under table-layout:fixed this guarantees the table never exceeds its container. */
.leaderboard .col-rank    { width: 44px; }
.leaderboard .col-spark   { width: 72px; }
.leaderboard .col-account { width: 88px; }
.leaderboard .col-balance { width: 100px; }
.leaderboard .col-return  { width: 74px; }
.leaderboard .col-trades  { width: 60px; }
.leaderboard .col-win     { width: 56px; }
.leaderboard .col-dd      { width: 104px; }
.leaderboard .col-status  { width: 82px; }
.leaderboard tbody tr:last-child td { border-bottom: none; }
.leaderboard tbody tr {
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.leaderboard tbody tr:hover { background: var(--color-sunken); }
.leaderboard tbody tr.selected { background: var(--color-accent-bg); box-shadow: inset 3px 0 0 var(--color-accent); }

.rank {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-ink-muted);
  width: 30px;
}
.rank.top { color: var(--color-accent-text); }
.rank-delta { display: block; font-size: 9px; font-weight: 700; line-height: 1; margin-top: 2px; }
.rank-delta.up { color: var(--color-pos); }
.rank-delta.down { color: var(--color-neg); }
.rank-delta.flat { color: var(--color-ink-faint); }

.trader { display: flex; align-items: center; gap: var(--space-sm); }
.trader-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--color-sunken);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-xs); font-weight: 600;
  color: var(--color-ink-soft);
  flex-shrink: 0;
}
.trader-avatar.gold { background: var(--metal-gold); color: var(--metal-gold-ink); }
.trader-avatar.silver { background: var(--metal-silver); color: var(--metal-silver-ink); }
.trader-avatar.bronze { background: var(--metal-bronze); color: var(--metal-bronze-ink); }
.trader-info { min-width: 0; flex: 1; }
.trader-name {
  font-weight: 600;
  font-size: var(--text-base);
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.trader-sub {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--color-ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.trader-sub .broker { color: var(--color-ink-faint); }
.acct-no {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-ink-soft);
  white-space: nowrap;
}

.spark-th, .spark-cell { width: 72px; }
.spark { display: block; }
.spark polyline { stroke: var(--color-ink-faint); }
.spark.spark-up polyline { stroke: var(--color-pos); }
.spark.spark-down polyline { stroke: var(--color-neg); }
.spark-empty { display: inline-block; width: 60px; height: 18px; }

.pnl { font-weight: 600; font-variant-numeric: tabular-nums; }
.pnl.pos { color: var(--color-pos); }
.pnl.neg { color: var(--color-neg); }

.dd-bar {
  width: 56px; height: 4px;
  background: var(--color-sunken);
  border-radius: 2px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: var(--space-xs);
}
.dd-fill { height: 100%; border-radius: 2px; background: var(--color-ink-faint); }
.dd-fill.warn { background: var(--color-warn); }
.dd-value { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--color-ink); font-weight: 500; }

.status {
  font-size: var(--text-2xs);
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.status-online { background: var(--color-pos-bg); color: var(--color-pos); }
.status-offline { background: var(--color-neg-bg); color: var(--color-neg); }

/* ─── chart ─── */
.chart-host { margin: var(--space-sm) 0 var(--space-md); }
.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}
.chart-title {
  font-size: var(--text-2xs);
  font-weight: 600;
  color: var(--color-ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.range-toggle {
  display: flex;
  gap: 2px;
  background: var(--color-sunken);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 2px;
}
.range-btn {
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-ink-muted);
  background: none;
  border: none;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.range-btn:hover { color: var(--color-ink); }
.range-btn.active { background: var(--color-raised); color: var(--color-accent-text); box-shadow: var(--shadow-sm); }

.chart-plot { position: relative; }
.chart-svg { display: block; overflow: visible; }
.chart-par { stroke: var(--color-border-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-par-label { fill: var(--color-ink-faint); font-size: 9px; font-family: var(--font-mono); }
.chart-dd { fill: var(--color-neg); opacity: 0.16; }
.eq-up-top { stop-color: var(--color-pos); stop-opacity: 0.28; }
.eq-up-bottom { stop-color: var(--color-pos); stop-opacity: 0; }
.eq-down-top { stop-color: var(--color-neg); stop-opacity: 0.28; }
.eq-down-bottom { stop-color: var(--color-neg); stop-opacity: 0; }
.chart-line {
  fill: none;
  stroke: var(--color-pos);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart-line.down { stroke: var(--color-neg); }
.chart-marker { fill: var(--color-raised); stroke: var(--color-ink-muted); stroke-width: 1.5; }
.chart-marker.peak { stroke: var(--color-pos); }
.chart-marker.trough { stroke: var(--color-neg); }
.chart-cross { stroke: var(--color-ink-faint); stroke-width: 1; stroke-dasharray: 2 2; }
.chart-dot { fill: var(--color-accent); stroke: var(--color-raised); stroke-width: 1.5; }
.chart-tip {
  position: absolute;
  pointer-events: none;
  background: var(--color-ink);
  color: var(--color-paper);
  font-size: var(--text-2xs);
  font-family: var(--font-mono);
  padding: 4px 7px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 1px;
  white-space: nowrap;
  z-index: 5;
}
.chart-tip .tip-dd { opacity: 0.7; }
/* `hidden` must win over the flex display above */
.chart-tip[hidden] { display: none; }
.chart-empty {
  padding: var(--space-xl) var(--space-sm);
  text-align: center;
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
}

.bars-wrap { margin-top: var(--space-xs); }
.bars-label {
  font-size: var(--text-2xs);
  color: var(--color-ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
.chart-bars { display: block; }
.bars-zero { stroke: var(--color-border); stroke-width: 1; }
.bar.pos { fill: var(--color-pos); }
.bar.neg { fill: var(--color-neg); }

.chart-foot {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-xs);
  font-size: var(--text-2xs);
  color: var(--color-ink-muted);
}
.chart-foot strong { color: var(--color-ink); font-weight: 600; }

/* ─── account detail ─── */
.account-card-head {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}
.account-card-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--color-accent-bg);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--text-md);
  color: var(--color-accent-text);
  flex-shrink: 0;
}
.account-card-id { min-width: 0; }
.account-card-name {
  font-weight: 700;
  font-size: var(--text-lg);
  letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.account-card-meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.account-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-sm);
  margin-top: var(--space-md);
}
.account-stat { text-align: center; min-width: 0; }
.account-stat-label {
  font-size: var(--text-2xs);
  color: var(--color-ink-soft);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1px;
}
.account-stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-md);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.account-stat-value.pos { color: var(--color-pos); }
.account-stat-value.neg { color: var(--color-neg); }
.detail-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  text-align: center;
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
}

/* ─── deals ─── */
.panel-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-sm);
}
.deals { width: 100%; border-collapse: collapse; font-size: var(--text-xs); table-layout: fixed; }
.deals th {
  text-align: left;
  font-weight: 600;
  color: var(--color-ink-muted);
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: var(--space-xs) var(--space-2xs);
  border-bottom: 1px solid var(--color-border-strong);
  white-space: nowrap;
}
.deals th.num, .deals td.num { text-align: right; font-variant-numeric: tabular-nums; }
.deals td {
  padding: var(--space-xs) var(--space-2xs);
  border-bottom: 1px solid var(--color-border);
}
/* Percentage widths + table-layout:fixed guarantee the table can never exceed
   the card — previously 6 columns x 24px padding overflowed the 334px rail.
   Symbol is omitted: the contest is XAUUSD-only. */
.deals .d-time  { width: 17%; }
.deals .d-type  { width: 17%; }
.deals .d-vol   { width: 13%; }
.deals .d-price { width: 27%; }
.deals .d-pnl   { width: 26%; }
.deals th, .deals td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deals tr:last-child td { border-bottom: none; }
.deal-type {
  font-size: var(--text-2xs);
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
}
.deal-buy { background: var(--color-pos-bg); color: var(--color-pos); }
.deal-sell { background: var(--color-neg-bg); color: var(--color-neg); }
.deals-more {
  text-align: center;
  font-size: var(--text-2xs);
  color: var(--color-ink-faint);
  padding: var(--space-xs);
}

/* ─── pagination ─── */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  flex-wrap: wrap;
  margin-top: var(--space-md);
}
.page-btn {
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--color-border);
  background: var(--color-raised);
  color: var(--color-ink-soft);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
  min-width: 36px;
  text-align: center;
}
.page-btn:hover:not(:disabled):not(.active) { background: var(--color-sunken); border-color: var(--color-border-strong); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-btn.active { background: var(--color-accent); color: oklch(100% 0 0); border-color: var(--color-accent); font-weight: 600; }
.page-dots { font-size: var(--text-sm); color: var(--color-ink-muted); padding: 0 var(--space-2xs); }
.page-info { font-size: var(--text-xs); color: var(--color-ink-muted); margin-left: auto; font-variant-numeric: tabular-nums; }

/* ─── states ─── */
.skeleton {
  background: linear-gradient(90deg, var(--color-sunken) 25%, var(--color-border) 50%, var(--color-sunken) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
  color: transparent !important;
  display: inline-block;
  min-width: 32px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.state-empty {
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
}
.state-empty.error { color: var(--color-neg); }

/* ─── modal ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: oklch(0% 0 0 / 0.45);
  backdrop-filter: blur(2px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}
.modal-backdrop.open { display: flex; }
.modal-box {
  background: var(--color-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  max-width: 520px;
  width: 100%;
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-md); }
.modal-title { font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.02em; }
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--color-ink-soft);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}
.modal-close:hover { color: var(--color-ink); background: var(--color-sunken); }
.modal-body ul { padding-left: var(--space-lg); margin-top: var(--space-xs); color: var(--color-ink-soft); font-size: var(--text-sm); }
.modal-body li { margin-bottom: var(--space-xs); }
.modal-body strong { color: var(--color-ink); }

/* ─── footer ─── */
.footer { border-top: 1px solid var(--color-border); background: var(--color-raised); margin-top: var(--space-2xl); }
.footer-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: var(--space-lg);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
}
.footer-brand { font-weight: 700; font-size: var(--text-md); letter-spacing: -0.03em; }
.footer-brand em { font-style: normal; color: var(--color-accent); }
.footer-meta { font-size: var(--text-xs); color: var(--color-ink-muted); font-family: var(--font-mono); }
.footer-links { display: flex; gap: var(--space-md); font-size: var(--text-xs); color: var(--color-ink-muted); }
.footer-links a:hover { color: var(--color-ink); }

/* ─── responsive ─── */

/* Column collapsing keeps the table inside the viewport instead of scrolling. */
@media (max-width: 1220px) {
  .leaderboard .col-trades, .leaderboard .col-win { display: none; }
}
@media (max-width: 1024px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; }
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .leaderboard .col-spark { display: none; }
}
@media (max-width: 700px) {
  .leaderboard .col-balance { display: none; }
}
@media (max-width: 560px) {
  .leaderboard .col-dd { display: none; }
  .leaderboard .col-account { width: 78px; }
  .leaderboard .col-return { width: 64px; }
  .leaderboard .col-status { width: 74px; }
}
@media (max-width: 480px) {
  .leaderboard .col-account { display: none; }
}
@media (max-width: 768px) {
  .page { padding: calc(var(--nav-h) + var(--space-lg)) var(--space-md) var(--space-2xl); }
  .nav-search { display: none; }
  .nav-links .nav-link { display: none; }
  .page-title { font-size: var(--text-2xl); }
  .podium { gap: var(--space-xs); }
  .podium-meta { display: none; }
  .stat-cell { padding: var(--space-sm) var(--space-md); }
  .stat-value { font-size: var(--text-xl); }
}
@media (max-width: 480px) {
  .nav-links { gap: var(--space-3xs); }
  .podium-medal { font-size: 1rem; }
  .podium-avatar { width: 34px; height: 34px; font-size: var(--text-xs); margin: var(--space-2xs) auto; }
  .podium-col.gold .podium-avatar { width: 44px; height: 44px; font-size: var(--text-md); }
  .podium-name, .podium-col.gold .podium-name { font-size: var(--text-sm); }
  .podium-ret, .podium-col.gold .podium-ret { font-size: var(--text-md); }
  .podium-col { padding: var(--space-sm) var(--space-2xs) var(--space-md); }
  .podium-col.gold { padding-top: var(--space-md); padding-bottom: var(--space-lg); }
  .leaderboard td, .leaderboard th { padding: var(--space-xs) var(--space-2xs); }
  .account-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rail-card { padding: var(--space-md); }
  .page-btn { padding: var(--space-2xs) var(--space-xs); min-width: 30px; }
  .page-info { margin-left: 0; width: 100%; padding-top: var(--space-2xs); }
}

/* ─── reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
