/* FrontRunner — app stylesheet.
 *
 * Light-mode design system modelled on the TradingView platform aesthetic:
 * white surfaces, #E0E3EB hairline borders, TradingView blue accent, and the
 * TradingView up/down greens & reds. Inter for UI, mono tabular figures for
 * tickers and numbers. 16px base for an older family audience (WCAG AA).
 */

:root {
  --bg:             #F0F3FA;
  --surface:        #FFFFFF;
  --surface-elev:   #F8F9FD;
  --surface-hover:  #F0F3FA;
  --border:         #E0E3EB;
  --border-strong:  #D1D4DC;
  --text:           #131722;
  --text-secondary: #5C5F6B;
  --accent:         #2962FF;
  --accent-hover:   #1E53E5;
  --profit:         #089981;
  --loss:           #F23645;
  --warning:        #F59E0B;
  --live:           #089981;
  --paper:          #F59E0B;
  --backtest:       #6B7280;
  --danger:         #F23645;
  --radius:         8px;
  --radius-lg:      12px;
  --shadow-sm:      0 1px 2px rgba(19, 23, 34, 0.04);
  --shadow-md:      0 2px 8px rgba(19, 23, 34, 0.08);
  --topbar-h:       56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.num, .ticker, .brand-mark {
  font-family: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

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

.skip-link { position: absolute; left: -999px; }
.skip-link:focus {
  left: 8px; top: 8px;
  background: var(--surface);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 100;
}

/* --- Top bar --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar-brand { display: flex; align-items: baseline; gap: 8px; }
.brand-mark {
  font-weight: 700;
  letter-spacing: 0.10em;
  font-size: 17px;
  color: var(--text);
}
.brand-mark::first-letter { color: var(--accent); }

.mode-selector {
  display: flex;
  gap: 2px;
  background: var(--surface-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
}
.mode-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.mode-btn:hover { color: var(--text); }
.mode-btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.mode-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-paper, .mode-paper .mode-dot { background: var(--paper); }
.dot-live,  .mode-live  .mode-dot { background: var(--live); }
.dot-backtest, .mode-backtest .mode-dot { background: var(--backtest); }

.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 18px;
}
.topbar-icon:hover { background: var(--surface-hover); color: var(--text); }
.topbar-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
}

/* --- Layout --- */
.layout { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.sidenav {
  width: 208px;
  flex-shrink: 0;
  padding: 16px 12px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.navlink {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 15px;
  min-height: 44px;
}
.navlink:hover { background: var(--surface-hover); color: var(--text); }
.navlink.is-active {
  background: rgba(41, 98, 255, 0.08);
  color: var(--accent);
  font-weight: 600;
}
.content { flex: 1; padding: 24px 28px; max-width: 1280px; width: 100%; }

/* --- Mobile bottom tabs --- */
.bottomtabs { display: none; }

/* --- Footer --- */
.appfooter {
  padding: 14px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* --- Cards --- */
.page-title { font-size: 24px; font-weight: 700; margin: 0 0 4px; }
.page-sub { color: var(--text-secondary); font-size: 14px; margin: 0 0 20px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-head h2 { font-size: 15px; font-weight: 600; margin: 0; }
.card-link { font-size: 14px; font-weight: 500; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush .card-head { padding: 16px 18px 0; margin-bottom: 12px; }

.dash-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.dash-aside {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  align-items: start;
}

/* --- Status bar --- */
.status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.status-mode {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: 14px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-elev);
  border: 1px solid var(--border);
}
.status-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 13px;
}
.status-item .num { color: var(--text); font-size: 17px; font-weight: 600; }
.pnl-pos { color: var(--profit); }
.pnl-neg { color: var(--loss); }

/* --- Chart --- */
.chart-wrap { position: relative; }
.chart-area { height: 360px; position: relative; }
.chart-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.scale-toggle {
  display: flex;
  gap: 2px;
  background: var(--surface-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
}
.scale-btn, .universe-btn {
  min-height: 32px;
  padding: 0 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.scale-btn:hover, .universe-btn:hover { color: var(--text); }
.scale-btn.is-active, .universe-btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.chart-legend {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: none;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 8px 11px;
  min-width: 168px;
}
.chart-legend:empty { display: none; }
.legend-title { color: var(--text-secondary); }
.legend-value { font-size: 18px; font-weight: 700; color: var(--text); }
.legend-change { font-size: 12px; font-weight: 600; }

/* Rich crosshair tooltip */
.tt-date { color: var(--text-secondary); font-size: 11px; }
.tt-hold {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  margin: 2px 0;
  border-radius: 999px;
  background: rgba(41, 98, 255, 0.12);
  color: var(--accent);
}
.tt-hold.tt-cash { background: var(--surface-elev); color: var(--text-secondary); }
.tt-value { font-size: 19px; font-weight: 700; color: var(--text); }
.tt-row { font-size: 11px; color: var(--text-secondary); }

/* Holding ribbon — segments are absolutely positioned by chart.js so the
   ribbon stays locked to the equity chart's x-axis. */
.holding-ribbon {
  position: relative;
  height: 22px;
  margin-top: 10px;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.holding-ribbon:empty { display: none; }
.ribbon-seg {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  cursor: default;
}

/* Holding ribbon hover tooltip */
.ribbon-tip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  transform: translate(-50%, -100%);
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--text);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.1s ease;
}
.ribbon-tip.is-visible { opacity: 1; }

/* Chart key / legend strip */
.chart-key {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}
.key-item { display: inline-flex; align-items: center; gap: 6px; }
.key-swatch { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.key-cash { background: #5C5F6B; }
.key-line { width: 16px; height: 0; display: inline-block; }
.key-stop { border-top: 2px dashed #F7A6AE; }
.key-qqq { border-top: 2px solid #B0B4C0; }
.key-base { border-top: 2px dashed #C7CAD3; }
.key-mk { font-size: 11px; line-height: 1; }
.key-buy { color: var(--profit); }
.key-sell { color: #EA580C; }
.key-swap { color: var(--accent); }
.key-stopout { color: var(--loss); }

/* Per-symbol comparison toggles */
.symbol-toggles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}
.symbol-toggles:empty { display: none; }
.toggle-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-right: 2px;
}
.sym-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.sym-toggle:hover { background: var(--surface-hover); }
.sym-toggle.is-on { color: var(--text); border-color: var(--border-strong); }
.sym-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  opacity: 0.35;
}
.sym-toggle.is-on .sym-dot { opacity: 1; }
.range-tabs, .filter-tabs, .date-nav { display: flex; gap: 2px; }
.range-btn, .filter-btn {
  min-height: 32px;
  min-width: 44px;
  padding: 0 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.range-btn:hover, .filter-btn:hover { background: var(--surface-hover); color: var(--text); }
.range-btn.is-active, .filter-btn.is-active {
  background: rgba(41, 98, 255, 0.10);
  color: var(--accent);
  font-weight: 600;
}
.date-nav {
  align-items: center;
  background: var(--surface-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
}
.date-btn {
  min-height: 44px;
  min-width: 44px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
}
.date-btn:hover { background: var(--surface-hover); color: var(--text); }
.date-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.date-btn:disabled:hover { background: transparent; color: var(--text-secondary); }
.date-label {
  padding: 0 12px;
  align-self: center;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

/* --- Tables --- */
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { white-space: nowrap; }
.data-table td.reason-cell { white-space: normal; min-width: 240px; }
.data-table th, .data-table td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
}
.data-table thead th { border-bottom: 1px solid var(--border-strong); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-elev); }
.data-table th {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.data-table .num { text-align: right; font-family: 'JetBrains Mono', monospace; }
.col-rank { width: 48px; }
.ticker { font-family: 'JetBrains Mono', monospace; font-weight: 600; }
.side-buy, .side-sell { font-weight: 600; }
.side-buy { color: var(--profit); }
.side-sell { color: var(--loss); }
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.pill-ok { background: rgba(8, 153, 129, 0.12); color: var(--profit); }
.pill-muted { background: var(--surface-elev); color: var(--text-secondary); }
.pill-nas100 { background: rgba(41, 98, 255, 0.12); color: var(--accent); }
.pill-outlier {
  background: var(--surface-elev);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
/* Trade-log event pills */
.pill-event { letter-spacing: 0.03em; }
.pill-ev-entry { background: rgba(8, 153, 129, 0.12); color: var(--profit); }
.pill-ev-swap { background: rgba(124, 58, 237, 0.12); color: #7C3AED; }
.pill-ev-stop { background: rgba(242, 54, 69, 0.12); color: var(--loss); }
.pill-ev-gate { background: rgba(245, 158, 11, 0.14); color: #92600C; }
.pill-ev-earnings, .pill-ev-trade {
  background: var(--surface-elev); color: var(--text-secondary);
}

/* Backtest daily-ranking card */
.bt-rank-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.bt-rank-scroll { max-height: 420px; overflow-y: auto; }
.bt-rank-scroll thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

/* --- Empty states --- */
.empty-state {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

/* --- Widgets --- */
.widget-card { padding: 0; overflow: hidden; }
.widget-card .card-head { padding: 16px 18px 8px; margin-bottom: 0; }
.tradingview-widget-copyright {
  font-size: 12px;
  padding: 6px 12px;
  color: var(--text-secondary);
}
.tradingview-widget-copyright a, .tradingview-widget-copyright .blue-text {
  color: var(--text-secondary);
}

/* --- Misc --- */
.muted { color: var(--text-secondary); }
.profile-section { padding: 16px 0; border-top: 1px solid var(--border); }
.profile-section:first-of-type { border-top: none; padding-top: 4px; }
.profile-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin: 0 0 8px;
}
.role-badge {
  background: rgba(41, 98, 255, 0.10);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}
.select {
  min-height: 36px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 10px;
  font-size: 14px;
}
.control-label { font-size: 13px; color: var(--text-secondary); margin-right: 8px; }
.trade-controls { display: flex; align-items: center; }

/* --- Login --- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.login-card {
  width: 100%;
  max-width: 420px;
  padding: 40px 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  text-align: center;
}
.login-brand { font-size: 24px; margin: 0; }
.login-rule {
  width: 56px; height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin: 14px auto 22px;
}
.login-lead { color: var(--text-secondary); }
.login-foot { font-size: 13px; color: var(--text-secondary); margin: 14px 0 0; }
.login-foot-muted { font-size: 12px; }
.login-notice {
  font-size: 14px;
  color: var(--text);
  background: rgba(245, 158, 11, 0.08);
  padding: 14px;
  border: 1px solid rgba(245, 158, 11, 0.30);
  border-radius: var(--radius);
}

/* --- Toast --- */
.fr-toast {
  position: fixed;
  top: calc(var(--topbar-h) + 16px);
  right: 20px;
  z-index: 60;
  max-width: 320px;
  padding: 12px 16px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 200ms ease, transform 200ms ease;
}
.fr-toast.is-shown { opacity: 1; transform: translateY(0); }

/* --- Mode banner + per-mode chrome --- */
.mode-banner {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.mode-banner-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mode-banner[data-mode="paper"] {
  background: rgba(245, 158, 11, 0.10);
  color: #92600C;
}
.mode-banner[data-mode="paper"] .mode-banner-dot { background: var(--paper); }
.mode-banner[data-mode="live"] {
  background: rgba(8, 153, 129, 0.12);
  color: #066B5B;
}
.mode-banner[data-mode="live"] .mode-banner-dot { background: var(--live); }
.mode-banner[data-mode="backtest"] {
  background: var(--surface-elev);
  color: var(--text-secondary);
}
.mode-banner[data-mode="backtest"] .mode-banner-dot { background: var(--backtest); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 120ms ease, filter 120ms ease;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(0.94); }

/* --- Live trading-action panel --- */
.live-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.live-position, .live-autotrade { margin-bottom: 0; }
.live-position-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 12px;
}
.live-state-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.live-state-dot.dot-cash { background: var(--border-strong); }
.live-figures { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.live-fig {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--text-secondary);
}
.live-fig .num { font-size: 18px; font-weight: 700; color: var(--text); }
.live-pending {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-secondary);
}
.live-autotrade { display: flex; flex-direction: column; }
.live-arm-state {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin: 0 0 14px;
}
.live-arm-state.armed { color: var(--live); font-weight: 600; }
.live-autotrade .btn { width: 100%; }
.live-estop { margin-top: 10px; }
.live-notice {
  padding: 12px 16px;
  margin-bottom: 16px;
  background: rgba(41, 98, 255, 0.08);
  border: 1px solid rgba(41, 98, 255, 0.25);
  border-radius: var(--radius);
  font-size: 14px;
}

/* --- Backtest report --- */
.card-sub { font-size: 13px; color: var(--text-secondary); }

/* Slim hypothetical-results disclaimer */
.bt-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--surface-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.bt-note-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--backtest);
  flex-shrink: 0;
}

/* Hero summary card */
.bt-hero {
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(41, 98, 255, 0.06), transparent 60%),
    var(--surface);
}
.bt-hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.bt-eyebrow {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
}
.bt-tag {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-elev);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.bt-hero-figure {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 14px;
}
.bt-hero-value {
  font-size: 46px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text);
}
.bt-hero-delta {
  font-size: 19px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}
.bt-hero-delta.pnl-pos { background: rgba(8, 153, 129, 0.12); }
.bt-hero-delta.pnl-neg { background: rgba(242, 54, 69, 0.12); }
.bt-hero-sub {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--text-secondary);
}
.bt-hero-sub strong { font-weight: 700; }
.bt-years {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.bt-year {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 96px;
  padding: 10px 14px;
  background: var(--surface-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.bt-year-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.bt-year-value { font-size: 17px; font-weight: 700; }

/* Detail stat grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.stat-grid-8 { grid-template-columns: repeat(4, 1fr); }
.stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 16px;
  background: var(--surface);
}
.stat-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.stat-value { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.stat-hint { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* Backtest trade log — capped, scrollable, sticky header */
.bt-trades { max-height: 440px; overflow-y: auto; }
.bt-trades thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

/* --- Responsive --- */
@media (max-width: 980px) {
  .dash-aside { grid-template-columns: 1fr; }
  .stat-grid-8 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .sidenav { display: none; }
  .dash-split { grid-template-columns: 1fr; }
  .live-grid { grid-template-columns: 1fr; }
  .stat-grid-8 { grid-template-columns: 1fr 1fr; }
  .bt-hero-value { font-size: 38px; }
  .content { padding: 16px; padding-bottom: 80px; }
  .mode-btn { padding: 0 10px; }
  .bottomtabs {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 50;
  }
  .tab {
    flex: 1;
    text-align: center;
    padding: 10px 4px;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
  }
  .tab.is-active { color: var(--accent); }
}
