/* ─────────────────────────────────────────────────────────
   Trading Bot Dashboard — design tokens & global styles
   Champagne / gold dark brand. Brand/accent UI = gold tokens;
   gain/loss DATA stays green/red (--pos / --neg) only.
   ───────────────────────────────────────────────────────── */

:root {
  /* Background scale — dark champagne */
  --bg-base:        #0a0a0c;
  --bg-card:        #131316;
  --bg-hover:       #1A1A1F;
  --bg-elev:        #1F1D24;
  --border:         #26241d;
  --border-strong:  #3A362C;

  /* Text scale */
  --text-1:         #f3efe4;
  --text-2:         #9b9588;
  --text-3:         #6b665b;

  /* Brand / accent — champagne gold (UI chrome only, NOT data) */
  --gold:           #cda85c;
  --gold-bright:    #e6d09a;
  --gold-deep:      #9c7a38;
  --gold-soft:      #cda85c1f;
  --gold-mid:       #cda85c40;
  --on-gold:        #1a1407;
  --gold-grad:      linear-gradient(135deg, #f6e7bb, #e3c47e, #cda85c);

  /* Data accents — gains/losses ONLY (keep green/red) */
  --pos:            #34c759;
  --pos-soft:       #34c75915;
  --pos-mid:        #34c75940;
  --neg:            #ff5a5a;
  --neg-soft:       #ff5a5a15;
  --neg-mid:        #ff5a5a40;
  /* Brand "neutral" accent now maps to gold so links/active chrome read gold.
     (Data that needs a true blue can still use this — none currently does.) */
  --neutral:        #cda85c;
  --neutral-soft:   #cda85c1f;
  --warn:           #F5B544;

  /* Type */
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Sizes (modular scale) */
  --t-12: 12px; --t-14: 14px; --t-16: 16px; --t-20: 20px;
  --t-28: 28px; --t-40: 40px; --t-56: 56px; --t-72: 72px; --t-112: 112px;

  /* Spacing */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;
  --s-12: 48px; --s-16: 64px; --s-20: 80px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg-base);
  color: var(--text-1);
  font-family: var(--sans);
  font-size: var(--t-14);
  line-height: 1.45;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* numeric default — tabular figures everywhere */
.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

a { color: inherit; }
button { font-family: inherit; }

/* page-wide fade-in on first paint */
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.app { animation: fadein 250ms ease-out both; }

/* ───────── Layout shell ───────── */

.shell {
  /* Wider on big monitors so the dashboard fills more of the window, but capped
     viewport-relative (94vw) so it never butts up against the screen edge — and
     in the live-demo that 3vw side breathing room keeps the fixed demo chrome
     (the top-left "Live demo" badge + top-right CTA) clear of the content. */
  max-width: min(1760px, 94vw);
  margin: 0 auto;
  padding: var(--s-8) var(--s-10) var(--s-20);
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: var(--s-8);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--s-16);
}
.brand { display: flex; align-items: center; gap: var(--s-3); }

.brand-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--text-1);
  outline: none;
}
.brand-logo:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
  border-radius: 4px;
}

/* ── Shared logo container ── */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  line-height: 1;
}
.logo-mark { display: block; flex-shrink: 0; }
.logo-word {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--mono);
  /* Matches the landing page's nav wordmark (1.15rem = 18.4px) so the brand
     lockup is the SAME bigger size across the marketing site AND the dashboards.
     Paired with the 28px .logo-candle mark (≥ the landing's 26px clock). */
  font-size: 18.4px;
  letter-spacing: 0.01em;
}
.logo .lw-strong { color: var(--text-1); font-weight: 600; }
.logo .lw-muted  { color: var(--text-3); font-weight: 500; }
.logo .lw-accent { color: var(--gold);   font-weight: 700; }
.logo .lw-bracket{ color: var(--gold);   font-weight: 700; font-size: 15px; }
.logo .lw-dot    { color: var(--gold);   font-weight: 700; }
/* Brand wordmark dot — gold gradient, shared verbatim with settings.html so the
   dashboard + settings render an identical "thetrading●optimizer" mark. */
.logo .lw-brand-dot {
  font-weight: 700;
  background: var(--gold-grad);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

/* ── Variant: candlesticks (now the gold clock) — square so there's no
   side-padding pushing the wordmark away from the mark ── */
.logo-candle .logo-mark { width: 28px; height: 28px; }

/* ── Variant: monogram ── */
.logo-mono .logo-mark { width: 28px; height: 28px; }

/* ── Variant: ticker chip ── */
.logo-ticker .logo-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px 5px 8px;
  border: 1px solid var(--gold);
  border-radius: 3px;
  background: var(--gold-soft);
  color: var(--gold);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  line-height: 1;
}
.logo-ticker .chip-dollar {
  color: var(--text-3);
  font-weight: 500;
}
.logo-ticker .chip-arrow {
  width: 14px; height: 10px; color: var(--gold);
}

/* ── Variant: target ── */
.logo-target .logo-mark { width: 30px; height: 30px; }
.logo-target .logo-word { font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; }

/* ── Variant: network ── */
.logo-network .logo-mark { width: 40px; height: 32px; }

/* ── Variant: bracket ── */
.logo-bracket {
  font-family: var(--mono);
  align-items: center;
}
.logo-bracket .brk {
  color: var(--gold);
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
}
.logo-bracket .brk-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 0 6px;
  gap: 2px;
}
.logo-bracket .brk-top {
  color: var(--text-3);
  font-size: 10px;
  letter-spacing: 0.18em;
}
.logo-bracket .brk-bot {
  color: var(--text-1);
  font-size: 13px;
  letter-spacing: 0.04em;
  font-weight: 600;
}

/* Bot status row — centered under the topbar line (was inline next to the
   wordmark). Two states drive the dot + label color: ACTIVE (green, mid-cycle /
   holding) and STANDING BY (red, idle). Derivation lives in botState() in
   components.jsx. */
.bot-status-row {
  display: flex;
  justify-content: center;
  margin: calc(-1 * var(--s-12)) 0 var(--s-12);
}
.bot-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
}
.bot-pill .dot {
  width: 7px; height: 7px;
  box-shadow: 0 0 0 3px var(--gold-soft);
  animation: bot-pulse 2s ease-in-out infinite;
}
/* ACTIVE = green (mid-cycle / holding). */
.bot-pill.bot-active .dot {
  background: var(--pos);
  box-shadow: 0 0 0 3px var(--pos-soft);
  animation: bot-pulse-active 2s ease-in-out infinite;
}
.bot-pill.bot-active .bot-pill-label { color: var(--pos); }
/* STANDING BY = red (idle: overnight, after-hours post-sell, pre-cron, non-market). */
.bot-pill.bot-standby .dot {
  background: var(--neg);
  box-shadow: 0 0 0 3px var(--neg-soft);
  animation: none;
}
.bot-pill.bot-standby .bot-pill-label { color: var(--text-2); }
.bot-pill-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
}
@keyframes bot-pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--gold-soft); }
  50%      { box-shadow: 0 0 0 6px rgba(205, 168, 92, 0.10); }
}
@keyframes bot-pulse-active {
  0%, 100% { box-shadow: 0 0 0 3px var(--pos-soft); }
  50%      { box-shadow: 0 0 0 6px rgba(52, 199, 89, 0.10); }
}
.brand-mark {
  width: 22px; height: 22px;
  background: var(--text-1);
  position: relative;
  clip-path: polygon(0 100%, 0 60%, 28% 60%, 28% 30%, 56% 30%, 56% 0, 100% 0, 100% 100%);
}
.brand-name {
  font-size: var(--t-14);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-sep { color: var(--text-3); margin: 0 var(--s-2); }
.brand-sub { color: var(--text-2); font-size: var(--t-14); }

.topbar-meta {
  display: flex; align-items: center; gap: var(--s-3);
  color: var(--text-2); font-size: var(--t-12);
}

/* Right side of the topbar: account controls stacked above the clock, all
   right-aligned. The controls are a SIBLING of .topbar-meta (not a child) so
   they stay visible on mobile, where .topbar-meta is hidden. */
.topbar-right {
  display: flex; flex-direction: column; align-items: flex-end; gap: var(--s-2);
}
.topbar-controls { display: flex; align-items: center; gap: var(--s-3); }
.tb-link {
  appearance: none; background: none; border: none; padding: 0; cursor: pointer;
  color: var(--text-3); font: 500 var(--t-12)/1 var(--sans);
  letter-spacing: 0.02em; text-decoration: none; transition: color .15s;
}
.tb-link:hover { color: var(--text-1); }
.tb-sep { color: var(--text-3); opacity: 0.5; user-select: none; }

/* ─── ET clock / market status boxes (top-right) ─── */
.clock-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: var(--s-3);
}
.clock-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 12px 6px;
  min-width: 180px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  line-height: 1.2;
}
.clock-label {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-3);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
}
.clock-val {
  font-size: 17px;
  color: var(--gold);
  text-align: right;
  line-height: 1.1;
  white-space: nowrap;
}
.clock-tz-inline {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-3);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-left: 4px;
}
.clock-status {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

@media (max-width: 900px) {
  .clock-stack { display: none; }
}
.topbar-meta .pill { display: flex; align-items: center; gap: var(--s-2); }
.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px #F5B54420; }
.dot.neg  { background: var(--neg);  box-shadow: 0 0 0 3px var(--neg-soft); }
.dot.mute { background: var(--text-3); box-shadow: none; }

/* ───────── Section frame ───────── */

.section { margin-bottom: var(--s-16); }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: var(--s-6);
}
.section-label {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-3);
}
.section-title {
  font-size: var(--t-28);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: var(--s-1) 0 0;
}
.section-meta {
  color: var(--text-2); font-size: 12.5px;
  font-family: var(--mono);
}

/* ───────── Hero / TODAY ───────── */

.hero {
  display: grid;
  grid-template-columns: 1.15fr 1.85fr;
  gap: var(--s-4);
}

/* In the next-day (after-hours) layout the 6-tile grid sits ABOVE the
   big AWAITING SCANNER tile, and the two highlighted tiles swap places
   so Today's Result sits where Tomorrow's Stake was, and vice versa. */
.hero.hero-next {
  grid-template-columns: 1fr;
}
.hero.hero-next .tile-hero { order: 2; }
.hero.hero-next .tile-grid { order: 1; }
.hero.hero-next .tile-grid .tile:nth-child(1) { order: 3; }
.hero.hero-next .tile-grid .tile:nth-child(2) { order: 4; }
.hero.hero-next .tile-grid .tile:nth-child(3) { order: 2; }
.hero.hero-next .tile-grid .tile:nth-child(4) { order: 1; }
.hero.hero-next .tile-grid .tile:nth-child(5) { order: 5; }
.hero.hero-next .tile-grid .tile:nth-child(6) { order: 6; }
/* ─── Tomorrow's plan details inside the slim AWAITING SCANNER tile ─── */
.next-plan-details {
  width: 100%;
}
.next-plan-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-4);
  padding-top: var(--s-3);
  border-top: 1px solid var(--border);
}
.next-plan-formula { grid-column: span 1; }
/* AWAITING-SCANNER tile type — base (mobile/tablet) sizes; the wide-desktop
   bump lives in the ≥1180px block at the end of this file so the small print
   stays proportionate to the widened shell. */
.np-label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 4px;
}
.np-value {
  font-size: 20px;
  color: var(--text-1);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
/* The stake line carries a longer string ("$22,500 × 1.5 = $33,750") than the
   bare Buy/Sell times, so it rides a touch smaller to stay on one line in its
   1-of-4 column. (Replaces the inline fontSize:14 that used to live in the JSX.) */
.next-plan-formula .np-value {
  font-size: 16px;
}
.np-sub {
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 3px;
  font-family: var(--mono);
}
.next-plan-note {
  margin-top: var(--s-4);
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.55;
}

/* ─── Today's trade tile (buy / arrow / sell) ─── */
.trade-prices {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--s-3);
  margin-top: 10px;
  margin-bottom: 10px;
}
.trade-side .np-label { margin-bottom: 3px; }
.trade-px {
  font-size: 22px;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text-1);
}
.trade-arrow {
  color: var(--text-3);
  font-size: 18px;
  font-family: var(--mono);
}

@media (max-width: 760px) {
  .next-plan-row { grid-template-columns: 1fr 1fr; }
}
.hero.hero-next .tile-hero {
  min-height: 0;
  padding: var(--s-5) var(--s-6);
}
.hero.hero-next .tile-hero-ticker.no-trade {
  font-size: var(--t-28);
  letter-spacing: -0.01em;
  margin: 6px 0 0;
}
.hero.hero-next .tile-hero-meta {
  margin-top: var(--s-3);
}

.tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: var(--s-6);
  position: relative;
  transition: background 120ms ease, border-color 120ms ease;
}
.tile:hover { background: var(--bg-hover); }

.tile-label {
  font-size: 12.5px;
  color: var(--text-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex; align-items: center; justify-content: space-between;
}
.tile-value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--t-28);
  letter-spacing: -0.02em;
  margin-top: var(--s-4);
  line-height: 1;
}
.tile-sub {
  margin-top: var(--s-3);
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.5;
}

/* Dominant ticker tile */
.tile-hero {
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 360px;
  padding: var(--s-8);
  overflow: hidden;
}
.tile-hero-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  color: var(--text-2);
  font-size: var(--t-12);
}
.badge {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 3px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-2);
}
.badge.live { color: var(--gold); border-color: var(--gold-mid); background: var(--gold-soft); }
.badge.pos  { color: var(--pos);     border-color: #1A4C3D; background: var(--pos-soft); }
.badge.neg  { color: var(--neg);     border-color: #5A2530; background: var(--neg-soft); }
.badge.mute { color: var(--text-3); }

.tile-hero-ticker {
  font-family: var(--mono);
  font-size: var(--t-112);
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin: 0;
  font-weight: 500;
}
.tile-hero-ticker.no-trade {
  font-size: var(--t-56);
  color: var(--text-2);
  font-weight: 400;
  letter-spacing: -0.02em;
}

.tile-hero-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-4);
  margin-top: var(--s-6);
}
.tile-hero-context {
  color: var(--text-1);
  font-size: var(--t-14);
  font-family: var(--mono);
}
.tile-hero-context .muted { color: var(--text-3); }

/* support tiles grid */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: var(--s-4);
}

.value-pos { color: var(--pos); }
.value-neg { color: var(--neg); }
.value-neutral { color: var(--text-1); }

/* tiny sparkline inside tiles */
.sparkline { display: block; width: 100%; height: 28px; margin-top: var(--s-3); }

/* streak chips */
.streak {
  display: flex; gap: 3px; margin-top: var(--s-3);
}
.streak span {
  width: 10px; height: 4px; border-radius: 2px;
  background: var(--border);
}
.streak span.w { background: var(--pos); }
.streak span.l { background: var(--neg); }

/* ───────── Stat row (Performance hero) ───────── */

.stats {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}
.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: var(--s-6) var(--s-8);
}
.stat .label {
  font-size: 12.5px;
  text-transform: uppercase;
  color: var(--text-2);
  letter-spacing: 0.04em;
  display: flex; justify-content: space-between; align-items: center;
}
.stat .big {
  font-family: var(--mono);
  font-size: var(--t-56);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-top: var(--s-5);
}
.stat .sub {
  margin-top: var(--s-3);
  font-family: var(--mono);
  font-size: var(--t-14);
  color: var(--text-2);
}
.stat .split {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--s-6); margin-top: var(--s-5);
}
.stat .split .col .k { color: var(--text-3); font-size: 12.5px; letter-spacing: 0.04em; text-transform: uppercase; }
.stat .split .col .v {
  font-family: var(--mono);
  font-size: var(--t-28);
  letter-spacing: -0.02em;
  margin-top: 6px;
  /* Keep the value on a single line. The unicode "−" (U+2212) used by
     fmtUSD for negative values is treated as a soft break-point by some
     browsers and would otherwise split "−$1,820.09" across two rows
     when the column is narrow. */
  white-space: nowrap;
}

/* Generic "label left, value right" row used in the today tile's context
   (Bought/Sold) panel. Each .kv-row is one full-width row. */
.kv-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  line-height: 1.6;
}
.kv-row > span { color: var(--text-3); }      /* label */
.kv-row > strong {
  font-family: var(--mono);
  color: var(--text-1);
  font-weight: 500;
  white-space: nowrap;
}

/* Today tile (closed state) — right-side panel showing Buy / Sell / Shares
   stacked vertically as label-value rows, no header, no dot separators. */
.trade-detail-grid {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 16px;
  row-gap: 4px;
  align-items: baseline;
  text-align: right;
}
.trade-detail-grid .k {
  color: var(--text-3);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  justify-self: start;
}
.trade-detail-grid .v {
  font-size: 18px;
  white-space: nowrap;
  justify-self: end;
}

/* ───────── Chart card ───────── */

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: var(--s-6);
}
.chart-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: var(--s-4);
}
.chart-title {
  font-size: var(--t-14);
  color: var(--text-2);
  font-weight: 500;
}
.chart-controls {
  display: flex; gap: var(--s-1);
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px;
}
.chart-controls button {
  background: transparent;
  border: 0;
  padding: 4px 10px;
  color: var(--text-2);
  font-family: var(--mono);
  font-size: var(--t-12);
  cursor: pointer;
  border-radius: 3px;
  letter-spacing: 0.02em;
}
.chart-controls button:hover { color: var(--text-1); }
.chart-controls button.on { background: var(--bg-elev); color: var(--text-1); }
.chart-controls button:focus-visible { outline: 1px solid var(--neutral); outline-offset: 1px; }

.chart-svg { width: 100%; display: block; }
.chart-axis text {
  fill: var(--text-3);
  font-family: var(--mono);
  /* Base (mobile/tablet) axis-label size; the wide-desktop bump to 13px lives in
     the ≥1181px block at the end of this file so the X/Y ticks read comfortably
     on the wide chart. Was 10px (too small even off-desktop). */
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.chart-grid line { stroke: var(--border); stroke-dasharray: 2 4; }
.chart-line { fill: none; stroke: var(--pos); stroke-width: 1.5; }
.chart-area { fill: url(#equityFill); }
.chart-crosshair { stroke: var(--text-3); stroke-dasharray: 2 3; }
.chart-dot { fill: var(--pos); stroke: var(--bg-base); stroke-width: 2; }

.chart-tooltip {
  position: absolute;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: var(--t-12);
  pointer-events: none;
  white-space: nowrap;
  z-index: 5;
}
.chart-tooltip .k { color: var(--text-3); margin-right: 8px; }
.chart-tooltip .v { color: var(--text-1); }
.chart-tooltip .pnl-pos { color: var(--pos); }
.chart-tooltip .pnl-neg { color: var(--neg); }

/* daily pnl bars */
.bar-card { margin-top: var(--s-4); }
.bar-bar { transition: opacity 100ms ease; }
.bar-bar:hover { opacity: 0.7; }

/* ───────── Trades table ───────── */

.trades {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: var(--s-4);
  /* Scroll a too-wide trade table INSIDE its own card rather than widening the
     whole page. Desktop counterpart to the ≤760px rule below — without it the
     11-column log (esp. with the owner's real fill times) pushes a horizontal
     scrollbar onto the entire dashboard. No CSS ::after tooltips live in here,
     so auto-overflow clips nothing. */
  overflow-x: auto;
  position: relative;
}
.trades-table tr:last-child td:first-child { border-bottom-left-radius: 5px; }
.trades-table tr:last-child td:last-child  { border-bottom-right-radius: 5px; }
.trades-head {
  padding: var(--s-5) var(--s-6);
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border);
}
.trades-table {
  width: 100%;
  border-collapse: collapse;
}
.trades-table th {
  text-align: left;
  font-weight: 500;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  padding: var(--s-3) var(--s-6);
  border-bottom: 1px solid var(--border);
  background: transparent;
}
.trades-table th.num { text-align: right; }
.trades-table td {
  padding: var(--s-4) var(--s-6);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: var(--t-14);
  font-variant-numeric: tabular-nums;
  color: var(--text-1);
}
.trades-table td.num { text-align: right; }
.trades-table tr:last-child td { border-bottom: 0; }
.trades-table tbody tr { transition: background 100ms ease; }
.trades-table tbody tr:hover { background: var(--bg-hover); }
.trades-table .ticker { letter-spacing: 0.02em; }
.trades-table .pos { color: var(--pos); }
.trades-table .neg { color: var(--neg); }
.trades-table .date { color: var(--text-2); }

/* Demo-only: blur scanner-pick / buy / sell times AND prices so the public demo
   never reveals real strategy timing or fill prices. demo-data.js also ships NO
   real values, so this is purely the visual treatment for the redacted
   placeholder. .redacted-val is the price-column alias (same rule). */
.redacted-time,
.redacted-val {
  display: inline-block;
  filter: blur(3.5px);
  color: var(--text-3);
  user-select: none;
  letter-spacing: 0.06em;
}

/* Recent-trades progressive disclosure (bank-statement style "show more") */
.trades-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-4);
  padding-top: var(--s-4);
  margin-top: var(--s-2);
  border-top: 1px solid var(--border);
}
.trades-more-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  appearance: none;
  cursor: pointer;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  color: var(--text-1);
  font: 600 13px/1 var(--sans);
  padding: 10px 18px;
  border-radius: 8px;
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
}
.trades-more-btn:hover { background: var(--bg-hover); border-color: var(--pos-mid); }
.trades-more-btn:active { transform: translateY(1px); }
.trades-more-btn .chev { opacity: 0.75; transition: transform 160ms ease; }
.trades-more-btn:hover .chev { transform: translateY(2px); }
.trades-more-btn:hover .chev-up { transform: translateY(-2px); }
.trades-more-link {
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-2);
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.02em;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-strong);
  transition: color 120ms ease;
}
.trades-more-link:hover { color: var(--text-1); }

/* ───────── About / flow ───────── */

.about {
  display: grid;
  grid-template-columns: 1.1fr 1.9fr;
  gap: var(--s-8);
}
.about p {
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0 0 var(--s-5);
  max-width: 60ch;
  text-wrap: pretty;
}
.about p strong { color: var(--text-1); font-weight: 500; }
/* The "This account is running… / backtested… returned …" footnote — kept a
   step below the body paragraphs but lifted off the old inline 13px so it stays
   legible in the wide layout. */
.about p.about-foot { font-size: 13.5px; }

.flow {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: var(--s-8);
}
.flow-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--s-2);
  position: relative;
}
.flow-step {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: var(--s-2);
  padding: var(--s-4) var(--s-3);
  border-left: 1px solid var(--border);
}
.flow-step:first-child { border-left: 0; padding-left: 0; }
.flow-time {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--neutral);
  letter-spacing: 0.04em;
}
.flow-name {
  font-size: 15.5px;
  color: var(--text-1);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.flow-desc {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.5;
}

.stack-line {
  display: flex; flex-wrap: wrap; gap: var(--s-2);
  margin-top: var(--s-5);
  font-family: var(--mono);
  font-size: var(--t-12);
  color: var(--text-2);
}
.stack-line span {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* ───────── Footer ───────── */

.foot {
  display: flex; justify-content: space-between; align-items: center;
  color: var(--text-3);
  font-size: var(--t-12);
  font-family: var(--mono);
  padding-top: var(--s-8);
  border-top: 1px solid var(--border);
}

/* ───────── Focus ───────── */

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

/* ───────── Responsive ───────── */

/* ── Wide-desktop type bump (≥1181px) ──
   Above 1180px the layout is multi-column and the shell stretches out to
   min(1760px, 94vw). At that width the base label/sub/body sizes read tiny, so
   we lift the small print on the wide canvas (and ONLY here) to keep it
   proportionate. Mobile/tablet keep the smaller base sizes set above; the
   ≤480px block stays the small end of the scale.

   This is the SECOND desktop lift — the owner reported the small print still
   read too small after the first pass (which landed these at 13.5/16.5/etc).
   Like elements move together so the scale stays consistent, hierarchy intact:
     micro-labels  13.5 → 15px    (tile/section labels, column heads, np-label)
     subtext/caps  13.5 → 15px    (np-sub/tile-sub/section-meta/flow-desc/note)
     body copy     16.5 → 17.5px  (.about p)
     footnote      14   → 15px    (.about p.about-foot)
     flow-time     13.5 → 15px
     flow-name     16.5 → 18px
     stake formula 18   → 20px,   buy/sell np-value 22 → 24px
     trade-log td  14.5 → 15.5px, next_day trade-px 24 → 26px
   Big hero numbers (tile-value/stat .big/hero ticker) are untouched, so the
   number-vs-label hierarchy stays. */
@media (min-width: 1181px) {
  /* micro-labels (kickers / column heads / tile + section labels) */
  .section-label,
  .section-meta,
  .tile-label,
  .stat .label,
  .stat .split .col .k,
  .trades-table th,
  .np-label { font-size: 15px; }

  /* subtext / captions */
  .tile-sub,
  .np-sub,
  .next-plan-note,
  .flow-desc { font-size: 15px; }

  /* body copy + footnote */
  .about p { font-size: 17.5px; }
  .about p.about-foot { font-size: 15px; }

  /* small inline values / names */
  .flow-time { font-size: 15px; }
  .flow-name { font-size: 18px; }
  .np-value { font-size: 24px; }
  .next-plan-formula .np-value { font-size: 20px; }

  /* trade-log body cells + the next_day "Today's trade" prices read a touch
     larger on the wide canvas too */
  .trades-table td { font-size: 15.5px; }
  .trade-px { font-size: 26px; }

  /* ── Portfolio chart text — desktop lift (axis ticks) ──
     The chart's own type was missed by earlier passes and read tiny on the wide
     layout. The X/Y axis labels are defined ABOVE this block, so lifting them
     here wins the cascade. The tab labels / range pills / meta line are defined
     LATER in this file (chart-tabs section), so their desktop lift lives in a
     SECOND ≥1181px block at the very end — placed after their base rules so it
     actually overrides them. Bars/lines/tooltips untouched; mobile keeps bases. */
  .chart-axis text { font-size: 13px; }                 /* May 1 … / $99.3k … ticks */
}

@media (max-width: 1180px) {
  .hero { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .about { grid-template-columns: 1fr; }
  .flow-row { grid-template-columns: repeat(3, 1fr); row-gap: var(--s-5); }
}
@media (max-width: 760px) {
  .shell { padding: var(--s-5); }
  .topbar-meta { display: none; }
  .tile-grid { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
  .stats { grid-template-columns: 1fr; }
  .tile-hero-ticker { font-size: var(--t-72); }
  .flow-row { grid-template-columns: 1fr 1fr; }
  /* The 7-column trades table is far wider than a phone — let it scroll
     horizontally inside its own card instead of widening the whole page. */
  .trades { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .trades-table { width: auto; min-width: 100%; }
}

/* ───────── Phones (≤480px) ───────── */
@media (max-width: 480px) {
  /* Scale the type + big spacing down so fixed desktop sizes (e.g. the 112px
     hero ticker) don't blow out a narrow viewport. */
  :root {
    --t-112: 52px; --t-72: 40px; --t-56: 30px; --t-40: 28px; --t-28: 21px;
    --s-16: 40px; --s-10: 28px; --s-8: 22px;
  }
  .shell { padding: var(--s-4) var(--s-3) var(--s-8); }
  /* Single column everywhere it still doubles up on phones. */
  .tile-grid { grid-template-columns: 1fr; grid-template-rows: auto; }
  .flow-row { grid-template-columns: 1fr; }
  /* When the "How it works" timeline stacks vertically, the left border +
     padding-left that act as the horizontal-timeline column DIVIDER are no
     longer dividers — they'd indent every step from the 2nd onward (Scanner,
     Buy, Sell, Log, Notify) further right than the first (Optimizer, which has
     its border/padding zeroed by :first-child). All steps are the same
     hierarchy, so reset the connector on every step here to share one flush
     left edge. (Desktop's horizontal timeline keeps its divider untouched.) */
  .flow-step { border-left: 0; padding-left: 0; }
  .account-tabs-row { grid-template-columns: 1fr; gap: var(--s-2); }
  .tile { padding: var(--s-4); }
  .tile-hero { min-height: 240px; padding: var(--s-5); }
  .section { margin-bottom: var(--s-12); }
  /* Let the topbar wrap rather than overflow if brand + status pill get tight. */
  .topbar { flex-wrap: wrap; gap: var(--s-3); row-gap: var(--s-2); }
  /* Ease the (now landing-sized 18.4px) brand wordmark + clock mark down a touch
     on phones so the lockup sits comfortably beside the Settings / Sign-out
     controls in the narrow authenticated topbar (no clip / overflow). */
  .logo-word { font-size: 15px; }
  .logo-candle .logo-mark { width: 24px; height: 24px; }

  /* AWAITING-SCANNER tile on a phone: give the stake line its own full-width
     row (Buy/Sell pair below) so the longer "$… × … = $…" formula never has to
     squeeze into a half-column, and ease the big buy/sell value down a touch. */
  .next-plan-row { grid-template-columns: 1fr 1fr; }
  .next-plan-formula { grid-column: 1 / -1; }
  .np-value { font-size: 18px; }
  .next-plan-formula .np-value { font-size: 16px; }
  .trade-px { font-size: 20px; }
}

/* ───────── Account switcher tabs ───────── */

.account-tabs {
  margin-bottom: var(--s-10);
}
.account-tabs-label {
  font-size: 12.5px;            /* match .section-label ("TODAY'S TRADING DAY") */
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: var(--s-3);
}
/* Desktop bump placed AFTER this base rule so it wins source order — the main
   micro-label @media block sits ABOVE this rule and would otherwise lose to it. */
@media (min-width: 1181px) {
  .account-tabs-label { font-size: 15px; }
}
.account-tabs-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--s-3);
}
.account-tab {
  --accent: var(--text-3);
  display: flex; flex-direction: column;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px 12px;
  color: var(--text-1);
  font-family: var(--sans);
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
  position: relative;
  /* No overflow:hidden — it would clip the data-tip tooltips, which render
     above the tile. The accent stripe below is rounded to the corner instead. */
}
.account-tab::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 120ms ease;
  border-top-left-radius: 6px;     /* follow the tile's rounded corner now that the tile no longer clips */
  border-bottom-left-radius: 6px;
}
.account-tab:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}
.account-tab.on {
  background: var(--bg-hover);
  border-color: var(--accent);
}
.account-tab.on::before { opacity: 1; }
.account-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.account-tab-top {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--s-3);
  margin-bottom: 4px;
}
.account-tab-name {
  font-size: var(--t-16);
  font-weight: 500;
  letter-spacing: -0.01em;
  flex-shrink: 0;            /* keep the account identity intact; truncate the name instead */
}
.account-tab-id {
  font-size: 10.5px;
  color: var(--text-3);
  letter-spacing: 0.03em;
  max-width: 45%;            /* the user's custom name — truncate if long */
  min-width: 0;              /* let the flex item shrink so the inner ellipsis fires */
  /* Truncation lives on .account-tab-id-text (inner) so this tooltip host does
     NOT clip its own data-tip popup (which renders above the span). */
}
.account-tab-id-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-tab-mid {
  margin-bottom: var(--s-3);
}
.account-tab-strat {
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
/* Shown only when the account has actually traded >1 strategy over time. */
.account-tab-mixed {
  display: inline-block;
  margin-left: 8px;
  font-size: 10.5px;
  font-family: var(--mono);
  letter-spacing: 0.03em;
  color: var(--warn);
  cursor: help;
}
.account-tab-bot {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px dashed var(--border);
}
.account-tab-port {
  font-size: var(--t-20);
  letter-spacing: -0.02em;
  color: var(--text-1);
}
.account-tab-day {
  font-size: 13px;
  letter-spacing: -0.01em;
}

/* Desktop: lift the account-selector tile type to read closer to the stat tiles
   below (owner request). Placed after the .account-tab base rules so it wins
   source order; mobile keeps the base sizes. */
@media (min-width: 1181px) {
  .account-tab-name  { font-size: 18px; }
  .account-tab-id    { font-size: 12.5px; }
  .account-tab-strat { font-size: 13px; }
  .account-tab-port  { font-size: 26px; }   /* balance — near the 28px stat value */
  .account-tab-day   { font-size: 15px; }   /* day P&L — matches the tile sub */
}

[data-tip] {
  position: relative;
  cursor: help;
  text-decoration: underline dotted var(--text-3) 1px;
  text-underline-offset: 3px;
}
[data-tip].no-underline { text-decoration: none; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  color: var(--text-1);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0;
  text-transform: none;
  padding: 9px 11px;
  white-space: pre-line;
  width: max-content;
  max-width: 320px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
  z-index: 999;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  text-align: left;
}
[data-tip]:hover::after,
[data-tip]:focus-visible::after { opacity: 1; }
[data-tip].tip-right::after { left: 0; transform: none; }
[data-tip].tip-left::after  { left: auto; right: 0; transform: none; }
[data-tip].tip-below::after { bottom: auto; top: calc(100% + 8px); }

/* Mobile: drop the hover tooltips entirely. On touch they fire on tap (sticky
   :hover), can clip, and there's no pointer to dismiss them — so suppress the
   popup and remove the dotted-underline / help-cursor affordance. The data-tip
   text stays in the DOM (still readable to assistive tech via the element). */
@media (max-width: 760px) {
  [data-tip]::after { content: none; }
  [data-tip] { text-decoration: none; cursor: default; }
}

/* ───────── Chart tabs (Strategy A-style) ───────── */

.chart-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: visible;
}
.chart-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-5) var(--s-6) 0;
  gap: var(--s-4);
  flex-wrap: wrap;
}
.chart-panel-title {
  font-size: var(--t-14);
  font-weight: 500;
  color: var(--text-2);
}
.chart-panel-title .accent {
  color: var(--text-1);
  margin-right: 8px;
}
.chart-tabs {
  display: flex;
  gap: 0;
  padding: var(--s-4) var(--s-6) 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.chart-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 10px 14px;
  color: var(--text-2);
  font-family: var(--sans);
  font-size: var(--t-14);
  font-weight: 500;
  cursor: pointer;
  letter-spacing: -0.005em;
  transition: color 120ms ease, border-color 120ms ease;
}
.chart-tab:hover { color: var(--text-1); }
.chart-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}
.chart-tab.active.neutral { color: var(--gold); border-bottom-color: var(--gold); }

.chart-body {
  padding: var(--s-4) var(--s-6) var(--s-6);
  position: relative;
}

/* Pan / pinch-zoom layer wrapping the actual chart */
.chart-interactive {
  position: relative;
  touch-action: none;          /* let pointer events handle pinch / pan */
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}
.chart-interactive.is-dragging { cursor: grabbing; }
.chart-interactive.is-dragging svg { pointer-events: none; }
.chart-controls.pill-row {
  display: flex;
  flex-wrap: wrap;   /* mobile: range pills wrap to a 2nd row instead of overflowing the page */
  gap: 4px;
  padding: 2px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 5px;
}
.chart-controls.pill-row button {
  background: transparent;
  border: 0;
  padding: 5px 11px;
  color: var(--text-2);
  font-family: var(--mono);
  /* Range pills (3D/7D/…/All). Base size; desktop bump to 13px in the ≥1181px
     block so they read clearly on the wide layout. */
  font-size: 12px;
  cursor: pointer;
  border-radius: 3px;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.chart-controls.pill-row button:hover { color: var(--text-1); }
.chart-controls.pill-row button.on {
  background: var(--bg-elev);
  color: var(--text-1);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.chart-meta-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--text-3);
  /* Small chart meta line ("N trading days · daily close", the "$… → $…" range,
     "drag to pan · …"). Base size; desktop bump to 13px in the ≥1181px block. */
  font-size: 11.5px;
  font-family: var(--mono);
  letter-spacing: 0.02em;
}
.chart-meta-line .legend {
  display: flex; gap: 14px; align-items: center;
}
.chart-meta-line .legend span {
  display: inline-flex; align-items: center; gap: 6px;
}
.chart-meta-line .legend i {
  width: 10px; height: 10px; border-radius: 2px; display: inline-block;
}

/* Tooltip enrichment block inside chart tooltip */
.chart-tooltip .ent {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11px;
}
.chart-tooltip .ent .name { color: var(--text-1); display: block; }
.chart-tooltip .ent .sec  { color: var(--text-3); }

/* Sector pill in trades table */
.sector-pill {
  display: inline-block;
  padding: 2px 7px;
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* ── Portfolio chart text — desktop lift (tabs / range pills / meta line) ──
   These three live in the chart-tabs section ABOVE, so this ≥1181px block is
   placed at the END of the file — AFTER their base rules — so the desktop sizes
   actually win the cascade (equal specificity → later source order wins). The
   axis-label lift rides the earlier ≥1181px block (its base is defined higher
   up). Keeps the chart's own type readable on the wide desktop layout; mobile/
   tablet keep the smaller base sizes. */
@media (min-width: 1181px) {
  .chart-tab { font-size: 15px; }                       /* Portfolio Value / Daily P&L ($) / … tabs */
  .chart-controls.pill-row button { font-size: 13px; }  /* 3D / 7D / 14D / … / All range pills */
  .chart-meta-line { font-size: 13px; }                 /* "N trading days · daily close", "$… → $…", pan hint */
}
