/* ============================================================
   STOCAST DASHBOARD — Design System  ·  "Refined Terminal" (v1)
   ----------------------------------------------------------------
   Directional discipline (mock-01):
     GAIN  → verdigris / emerald green (aged-copper patina) — UP / positive
     LOSS  → copper (the brand metal, doubles as down/negative)
     COPPER → brand identity / action / active state
     VIOLET → AI / algorithm overlays — intelligence, never decoration
   Canonical directional tokens are OKLCH (--gain / --loss, tunable hue).
   Chart-read tokens (--bull-x / --bear-x) stay HEX literals because theme.js
   reads them via getComputedStyle (which does NOT resolve var()) and feeds
   them to LightweightCharts/ECharts (which do NOT parse oklch()). Keep the
   hex values in sync with the oklch tokens. See DESIGN_ITERATIONS.md.
   ============================================================ */

/* Google Fonts loaded in HTML */

:root {
  /* ---- Surfaces (deep graphite, layered) ---- */
  --bg:             #0B0F14;   /* primary background */
  --bg-elev-1:      #121821;   /* panels / panel headers */
  --bg-elev-2:      #161D27;   /* cards / inset widgets */
  --bg-3:           #1E2733;   /* chips / buttons at rest */
  --bg-hover:       #232E3C;   /* row / control hover */
  --border:         #1F2A36;   /* default dividers */
  --border-strong:  #2A3544;   /* active borders / focus rings */
  --grid-line:      #1C2530;   /* chart grid (barely visible) */

  /* ---- Text (cool gray ramp) ---- */
  --text:           #E6EDF3;
  --text-dim:       #8B9AAA;
  --text-faint:     #5A6572;
  --axis-text:      #6B7785;

  /* ---- Brand — Copper (derived directly from the stocast logo gradient).
     The logo IS a vertical candle in copper; every brand color, every bull
     candle, and the bridge to the bear tones are stops on its gradient. ---- */
  --copper-bright:  #F5D5A8;   /* above-top highlight  (hover, glass) */
  --copper:         #DEA670;   /* logo 22% — bright warm copper, UI accent */
  --copper-deep:    #9F6831;   /* logo 78% — bronze, pressed/active */
  --copper-glow:    rgba(222, 166, 112, 0.28);
  /* Diagonal accent gradient (buttons, badges) */
  --copper-gradient: linear-gradient(135deg, #F5D5A8 0%, #DEA670 50%, #9F6831 100%);
  /* The full vertical logo gradient — use for area fills, sheens, the
     active-tab glow. Five stops, sampled from the actual logo. */
  --copper-gradient-vertical: linear-gradient(180deg,
    #F0C898 0%,
    #DEA670 22%,
    #C5894F 50%,
    #9F6831 78%,
    #825526 100%);

  /* ---- Bullish / GAIN — vivid emerald (brighter "money green").
     HEX mirror of --gain (= #2EBD85); read by theme.js for candle
     up-color. Up / positive reads green at a glance. ---- */
  --bull:           #2EBD85;   /* vivid emerald — gain */
  --bull-bright:    #5FE0AB;   /* lighter emerald — highlight edge */
  --bull-glow:      rgba(46, 189, 133, 0.28);
  --bull-muted:     #1A7A57;   /* deep emerald — muted volume */

  /* ---- Bearish / LOSS — copper (the brand metal doubles as down).
     HEX mirror of --loss (= --copper); read by theme.js for candle
     down-color. Distinct from the brighter accent copper. ---- */
  --bear:           #C5894F;   /* money-copper mid — candle down body */
  --bear-bright:    #DEA670;   /* brand copper — loss highlight */
  --bear-glow:      rgba(197, 137, 79, 0.28);
  --bear-muted:     #9F6831;   /* bronze — muted volume */

  /* ---- AI / Intelligence (electric violet — sparingly) ---- */
  --ai:             #7C5CFF;
  --ai-bright:      #9D82FF;
  --ai-glow:        rgba(124, 92, 255, 0.28);

  /* ---- Emerald — canonical GAIN (vivid "money green" #2EBD85).
     Kept as the --bull hex mirror's twin; charts read --bull*. ---- */
  --emerald:        #2EBD85;
  --emerald-hi:     #5FE0AB;
  --emerald-lo:     #1A7A57;

  /* ---- Directional signal tokens (preferred in app CSS) ----
     GAIN = vivid emerald, LOSS = copper. Use these (or .pnl-pos /
     .pnl-neg) for P&L text, tags, row washes. ---- */
  --gain:           var(--emerald);
  --gain-hi:        var(--emerald-hi);
  --gain-bg:        rgba(46, 189, 133, 0.14);
  --gain-row:       rgba(46, 189, 133, 0.06);
  --loss:           var(--copper);
  --loss-bg:        rgba(222, 166, 112, 0.12);
  --loss-row:       rgba(222, 166, 112, 0.05);

  /* ---- System ---- */
  --info:           #4DA3FF;   /* desaturated blue — links, info */
  --neutral:        #7A8A9A;   /* unchanged / no signal */
  --warning:        #F0A030;   /* amber — kept from legacy */

  /* ---- Glass / Frost (chrome layer only — never on chart canvases) ---- */
  --glass-tint:             rgba(18, 24, 33, 0.72);     /* default frosted panel-bar */
  --glass-tint-strong:      rgba(31, 42, 54, 0.82);     /* header / hover */
  --glass-tint-soft:        rgba(18, 24, 33, 0.55);     /* light frost */
  --glass-highlight:        rgba(255, 255, 255, 0.05);  /* 1px glass top edge */
  --glass-highlight-strong: rgba(255, 255, 255, 0.09);  /* header top edge */
  --glass-shadow-soft:      0 1px 0 rgba(0, 0, 0, 0.45);
  --glass-shadow-card:      0 2px 14px rgba(0, 0, 0, 0.32);
  --glass-blur:             blur(14px) saturate(140%);
  --glass-blur-soft:        blur(8px) saturate(130%);

  /* ---- Semantic aliases (preferred over raw tokens in app code) ---- */
  --accent:         var(--copper);
  --accent-bright:  var(--copper-bright);
  --accent-on:      #14110A;            /* text-on-copper (buttons) */
  --success:        var(--gain);
  --danger:         var(--loss);

  /* ---- Legacy aliases — now flipped to the gain/loss palette so every
     existing var(--green)/.green consumer renders verdigris/copper. ---- */
  --green:          var(--gain);
  --red:            var(--loss);
  --amber:          var(--warning);
  --warn:           var(--warning);
  --blue:           var(--info);
  --dim:            var(--text-dim);
  --panel-head:     var(--bg-elev-1);

  /* ---- Typography — dual: mono for data/numbers, sans for labels ---- */
  --ff-mono:        'JetBrains Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  --ff-sans:        'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font:           var(--ff-mono);     /* back-compat alias */
  /* Current comfortable sizes (default density) — kept; do not shrink. */
  --fs-xs:          11px;
  --fs-sm:          12px;
  --fs-base:        13px;
  --fs-md:          14px;
  /* Mock display scale (for larger headline/symbol/price text). */
  --t-xs:           10px;
  --t-sm:           11px;
  --t-md:           12px;
  --t-lg:           14px;
  --t-xl:           18px;
  --t-2xl:          24px;
  --t-stat:         22px;     /* card headline numbers (balance / day P&L) */

  /* ---- Spacing ---- */
  --gap:            1px;                 /* hairline grid gap (load-bearing) */
  --pad-x:          14px;                /* refined-terminal cell padding */
  --pad-y:          10px;
  --row-h:          30px;
  --r-0:            2px;                 /* radii (global square-corner rule
  --r-1:            4px;                    still wins; kept for ported CSS) */
}

/* ---- Reset ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-radius: 0 !important;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

/* Square corners enforced globally; shadows are now opt-in (used by glass
   chrome layer for frosted highlights). Charts/tables stay flat by default. */

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-base);
}

body {
  display: flex;
  flex-direction: column;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); }
::-webkit-scrollbar-thumb:hover { background: var(--dim); }

/* ============================================================
   APP HEADER (32px) — frosted glass with copper sheen
   ============================================================ */
#app-header {
  position: relative;
  flex: 0 0 32px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 12px;
  background:
    linear-gradient(180deg,
      var(--glass-tint-strong) 0%,
      var(--glass-tint) 100%);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight-strong),
    var(--glass-shadow-soft);
  font-size: var(--fs-sm);
  white-space: nowrap;
  overflow: hidden;
  z-index: 10;
}
/* Subtle copper sheen leaking in from the brand-mark side — gives
   backdrop-filter actual color to soften, not just darkness. */
#app-header::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 480px 80px at 0% 50%, var(--copper-glow), transparent 65%),
    radial-gradient(ellipse 360px 70px at 100% 50%, var(--ai-glow), transparent 70%);
  opacity: 0.65;
  z-index: -1;
}
#app-header > * { position: relative; }

.header-logo {
  width: 16px;
  height: 16px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 0 4px var(--copper-glow));
  transition: filter 0.2s ease;
}
.header-logo:hover {
  filter: drop-shadow(0 0 8px var(--copper-glow));
}

.header-brand {
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.header-sep { color: var(--border); }

/* Trading mode toggle (Daily / Intraday pill) */
.mode-toggle {
  display: flex;
  background: var(--glass-tint);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.mode-toggle button {
  font-family: inherit;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 2px 10px;
  border: none;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  transition: all 0.15s;
}
.mode-toggle button:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}
.mode-toggle button.active {
  color: var(--bg);
  background: var(--copper);
}

.header-stats {
  color: var(--dim);
  font-size: var(--fs-xs);
  letter-spacing: 0.02em;
}

.header-spacer { flex: 1; }

.header-clock {
  color: var(--copper);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.header-alerts { display: flex; gap: 6px; }

.alert-tag {
  font-size: var(--fs-xs);
  padding: 1px 5px;
  border: 1px solid;
  background: var(--glass-tint-soft);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}
.alert-tag.amber { color: var(--amber); border-color: var(--amber); }

/* Live status indicator */
.status-indicator {
  font-size: var(--fs-xs);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border: 1px solid;
  background: var(--glass-tint-soft);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}

.status-live {
  color: var(--green);
  border-color: var(--green);
  animation: pulse-border 2s ease-in-out infinite;
}

.status-offline {
  color: var(--dim);
  border-color: var(--border);
}

.status-holiday {
  color: var(--warning);
  border-color: var(--warning);
}

/* Market is open but the KiteTicker isn't connected — service/credentials
   issue, NOT a calendar holiday. Uses copper-bright so it's immediately
   distinguishable from the amber HOLIDAY lamp (system problem vs. planned
   closure). Pulses to signal "something actionable". */
.status-ticker-off {
  color: var(--copper-bright);
  border-color: var(--copper-bright);
  animation: pulse-border 2s ease-in-out infinite;
}

@keyframes pulse-border {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ============================================================
   DESK BAR (24px) — light frost
   ============================================================ */
#desk-bar {
  position: relative;
  flex: 0 0 24px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 0;
  background:
    linear-gradient(180deg,
      var(--glass-tint-soft) 0%,
      rgba(11, 15, 20, 0.85) 100%);
  -webkit-backdrop-filter: var(--glass-blur-soft);
  backdrop-filter: var(--glass-blur-soft);
  border-bottom: 1px solid var(--border);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    var(--glass-shadow-soft);
  font-size: var(--fs-xs);
}

.desk-btn {
  height: 100%;
  padding: 0 10px;
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--dim);
  cursor: pointer;
  font-size: var(--fs-xs);
  font-family: var(--ff-sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.2s ease;
}

.desk-btn:hover {
  color: var(--text);
  background: var(--glass-tint-soft);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}
.desk-btn.active {
  color: var(--text);
  background: linear-gradient(180deg, var(--glass-tint-strong), var(--glass-tint));
  /* Underline picks up the cream-gold cap from the logo top so the active
     tab reads as "lit by the same metal as the brand mark above". */
  border-bottom: 2px solid var(--copper-bright);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight-strong),
    0 -10px 20px -8px var(--copper-glow);
}

.desk-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border: 1px solid var(--border);
  background: var(--glass-tint-soft);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  color: var(--dim);
  font-size: 8px;
}

.desk-focus-label { color: var(--dim); font-size: 8px; }

.desk-bar-spacer { flex: 1; }

/* ============================================================
   CONTROLS (shared, in desk-bar and panel-header)
   ============================================================ */
.ctrl-label {
  color: var(--dim);
  font-size: var(--fs-xs);
  padding: 0 4px;
  white-space: nowrap;
}

.ctrl-select {
  height: 18px;
  padding: 0 4px;
  background: linear-gradient(180deg, var(--glass-tint-strong), var(--glass-tint));
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  color: var(--text);
  font-size: var(--fs-xs);
  font-family: var(--font);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  min-width: 40px;
  transition: border-color 0.15s ease, box-shadow 0.2s ease;
}

.ctrl-input {
  height: 18px;
  padding: 0 4px;
  background: linear-gradient(180deg, var(--glass-tint-strong), var(--glass-tint));
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  color: var(--text);
  font-size: var(--fs-xs);
  font-family: var(--font);
  transition: border-color 0.15s ease, box-shadow 0.2s ease;
}

.ctrl-input:focus, .ctrl-select:focus {
  outline: none;
  border-color: var(--copper);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight-strong),
    0 0 0 2px var(--copper-glow);
}

/* Custom asset autocomplete dropdown (feature inspector) */
/* position: fixed escapes the panel's overflow:hidden */
.asset-dropdown {
  position: fixed;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-elev-1);
  border: 1px solid var(--border-strong);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
  z-index: 10000;
  font-family: var(--font);
  font-size: var(--fs-xs);
}

.asset-dropdown-item {
  padding: 3px 8px;
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  transition: background 0.08s ease, color 0.08s ease;
}

.asset-dropdown-item:last-child {
  border-bottom: none;
}

.asset-dropdown-item.is-highlight,
.asset-dropdown-item:hover {
  background: var(--copper-glow);
  color: var(--copper-bright);
}

.asset-dropdown::-webkit-scrollbar { width: 6px; }
.asset-dropdown::-webkit-scrollbar-track { background: var(--bg); }
.asset-dropdown::-webkit-scrollbar-thumb { background: var(--border-strong); }

.ctrl-btn {
  height: 18px;
  padding: 0 6px;
  background: linear-gradient(180deg, var(--glass-tint-soft), transparent);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  color: var(--dim);
  font-size: var(--fs-xs);
  font-family: var(--font);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: color 0.15s ease, border-color 0.15s ease, box-shadow 0.2s ease, background 0.15s ease;
}
.ctrl-btn:hover {
  color: var(--text);
  border-color: var(--copper);
  background: linear-gradient(180deg, var(--glass-tint), var(--glass-tint-soft));
  box-shadow:
    inset 0 1px 0 var(--glass-highlight-strong),
    0 0 10px var(--copper-glow);
}
.ctrl-btn.active {
  color: var(--copper);
  border-color: var(--copper);
  background: linear-gradient(180deg, var(--glass-tint-strong), var(--glass-tint));
  box-shadow:
    inset 0 1px 0 var(--glass-highlight-strong),
    0 0 12px var(--copper-glow);
}
.ctrl-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.ctrl-btn.btn-primary {
  background: var(--copper);
  color: var(--bg);
  border-color: var(--copper);
  font-weight: 600;
}
.ctrl-btn.btn-primary:hover {
  box-shadow: 0 0 14px var(--copper-glow);
}
.ctrl-btn.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.ctrl-btn.btn-done {
  background: transparent;
  color: var(--bull);
  border-color: var(--bull);
  opacity: 0.7;
}
.live-btn-active {
  color: var(--green) !important;
  border-color: var(--green) !important;
  box-shadow:
    inset 0 1px 0 var(--glass-highlight-strong),
    0 0 12px var(--bull-glow) !important;
  animation: pulse-border 1.5s ease-in-out infinite;
}

/* ============================================================
   DESK VIEWPORT
   ============================================================ */
#desk-viewport {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: var(--bg);
}

/* ============================================================
   PANELS
   ============================================================ */
.desk {
  width: 100%;
  height: 100%;
  gap: var(--gap);
  display: grid;
  /* Page surface the translucent .panel cards sit over: a soft top-down
     lightening + faint emerald (top-right) and copper (bottom-left) glows.
     Shows through the cards' frost and in the 1px grid gaps. */
  background:
    radial-gradient(1200px 600px at 85% -8%, rgba(46, 189, 133, 0.045), transparent 60%),
    radial-gradient(1000px 620px at -5% 110%, rgba(222, 166, 112, 0.04), transparent 60%),
    linear-gradient(180deg, #10161E 0%, var(--bg) 55%, #080B10 100%);
}

/* Keep hidden desks in DOM but invisible (x-show uses display:none) */
.desk[style*="display: none"] { display: none !important; }

.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  /* Translucent matte card: a semi-transparent tint + backdrop frost lets the
     page gradient (on .desk) show through faintly. Square corners retained. */
  background: var(--glass-tint);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  /* Glass card edge: 1px white highlight on top + soft drop shadow under.
     Charts stay solid (canvases ignore CSS shadows), chrome reads as glass. */
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    var(--glass-shadow-card);
}

.panel-header {
  flex: 0 0 28px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 6px;
  background:
    linear-gradient(180deg,
      var(--glass-tint-strong) 0%,
      var(--glass-tint) 100%);
  -webkit-backdrop-filter: var(--glass-blur-soft);
  backdrop-filter: var(--glass-blur-soft);
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  font-size: var(--fs-xs);
  white-space: nowrap;
  overflow: hidden;
}

.panel-title {
  color: var(--text);
  font-family: var(--ff-sans);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-right: 4px;
}

.panel-status {
  color: var(--dim);
  font-size: var(--fs-xs);
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.panel-body {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

/* ---- Card headline (from card-01): a big tabular primary metric + a
   directional change line. Use for a card's hero number (balance, day P&L). */
.card-stat {
  padding: 10px var(--pad-x) 8px;
}
.card-stat-label {
  font-family: var(--ff-sans);
  font-size: var(--t-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-2, var(--text-dim));
}
.card-stat-value {
  font-size: var(--t-stat);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.15;
  margin-top: 2px;
}
.card-stat-delta {
  font-size: var(--t-sm);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.card-stat-delta.gain, .card-stat-value.gain { color: var(--gain); }
.card-stat-delta.loss, .card-stat-value.loss { color: var(--loss); }

/* ---- Card overview rows (label left, tabular value right). ---- */
.card-overview { padding: 4px var(--pad-x) 8px; }
.card-overview .ov-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
}
.card-overview .ov-row:last-child { border-bottom: none; }
.card-overview .ov-k { color: var(--text-dim); }
.card-overview .ov-v { color: var(--text); font-variant-numeric: tabular-nums; }

/* ============================================================
   DESK LAYOUTS
   ============================================================ */

/* Desk 1: Live Trading */
.desk-1 {
  grid-template-columns: 1fr;
  grid-template-rows: 55fr 45fr;
  grid-template-areas:
    "livechart"
    "livepositions";
}

/* Desk 2: Replay */
.desk-2 {
  grid-template-columns: 1fr;
  grid-template-rows: 55fr 45fr;
  grid-template-areas:
    "livechart"
    "livepositions";
}

/* Desk 3: Paper Trading */
.desk-3 {
  grid-template-columns: 1fr;
  grid-template-rows: 55fr 45fr;
  grid-template-areas:
    "chart"
    "trades";
}

/* Desk 4: Admin/Maintenance */
.desk-4 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "auth    data"
    "data    data"
    "ops     ops";
  padding: 4px;
}

/* Desk 6: Personal Trader — directional P&L palette.
   Unified with the global gain/loss tokens (vivid emerald / copper). These
   --pnl-* aliases are kept only because trader_desk.js helpers + inline
   side-colors reference them; they now resolve to the global palette so the
   desk matches the rest of the app. */
.desk-6 {
  --pnl-pos:    var(--gain);
  --pnl-pos-bg: var(--gain-bg);
  --pnl-neg:    var(--loss);
  --pnl-neg-bg: var(--loss-bg);
}

/* Desk 8/9: Analysis/Focus — dormant */
.desk-8 {
  grid-template-columns: 40fr 35fr 25fr;
  grid-template-rows: 65fr 35fr;
  grid-template-areas:
    "portfolio  analysis  sweep"
    "positions  positions sweep";
}

.desk-9 {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  display: flex;
  flex-direction: column;
}

.desk-9-controls {
  flex: 0 0 28px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  background: var(--panel-head);
  border-bottom: 1px solid var(--border);
}

/* ============================================================
   LOADING OVERLAY
   ============================================================ */
.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 15, 20, 0.55);   /* matches --bg #0B0F14, lighter for blur */
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  color: var(--dim);
  font-size: var(--fs-xs);
  z-index: 5;
  pointer-events: none;
}

/* ============================================================
   DATA TABLE
   ============================================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-xs);
}

.data-table th {
  position: sticky;
  top: 0;
  background:
    linear-gradient(180deg,
      var(--glass-tint-strong) 0%,
      var(--glass-tint) 100%);
  -webkit-backdrop-filter: var(--glass-blur-soft);
  backdrop-filter: var(--glass-blur-soft);
  color: var(--dim);
  font-family: var(--ff-sans);
  font-weight: 500;
  text-align: left;
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.data-table td {
  padding: 4px 8px;                 /* airier rows (card-01 vibe) */
  color: var(--text);
  border-bottom: 1px solid var(--grid-line);
}

.data-table tr:hover td { background: var(--bg-hover); cursor: pointer; }
.data-table tr.selected td { background: var(--copper-glow); }

/* ---- Cell alignment + role helpers (use inside any .data-table variant) ----
   .txt  — left-aligned text (feature names, asset IDs, labels)
   .num  — right-aligned tabular numerics (decimal-lined automatically
           when every row has the same fractional digit count)
   .rank — muted, right-aligned row index
   .spark— per-row sparkline cell (holds an inline <svg>; see sparkSvg())
   .gain / .loss — directional value coloring (vivid emerald / copper). */
.data-table .txt { text-align: left; }
.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}
.data-table .rank { text-align: right; color: var(--text-faint); }
.data-table .spark { padding: 2px 6px; text-align: center; white-space: nowrap; }
.data-table .gain { color: var(--gain); }
.data-table .loss { color: var(--loss); }

/* ---- TIGHT modifier — content-sized table with shaded vertical
   separators. Use when you want columns to hug their content and the
   panel body to show empty space on the right instead of stretching. ---- */
.data-table.tight {
  width: 100%;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.data-table.tight th,
.data-table.tight td {
  padding: 5px 14px;
  white-space: nowrap;
}

.data-table.tight th {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Gentle shaded vertical separators: a 1px copper-tinted gradient line
   that peaks in the middle of the row and fades to transparent at top
   and bottom, so adjacent columns feel separated by "light catching a
   glass edge" rather than a hard rule.

   NOTE: only `td` cells need `position: relative` for the ::before anchor.
   `th` cells are already `position: sticky` (from the .data-table base
   rule), which itself establishes a containing block for absolutely-
   positioned children — overriding to `relative` would break sticky
   and the 2nd/3rd headers would scroll away with the body. */
.data-table.tight td:not(:first-child) {
  position: relative;
}
.data-table.tight th:not(:first-child)::before,
.data-table.tight td:not(:first-child)::before {
  content: '';
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 1px;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(245, 213, 168, 0.14) 50%,
    transparent 100%);
  pointer-events: none;
}

/* Very subtle copper zebra wash — guides the eye across wide rows
   without competing with the data. */
.data-table.tight tbody tr:nth-child(even) td {
  background: rgba(245, 213, 168, 0.022);
}

/* Row hover: the dollar-dark-green mint wash (same hue as the paper-trades
   row colors the user loves — rgba(0,196,154,0.04) resting / 0.15 selected).
   At 0.10 it sits between "resting" and "selected" — more visible than
   the zebra underneath, still softer than a full selection glow. */
.data-table.tight tbody tr:hover td {
  background: rgba(0, 196, 154, 0.10);
  cursor: pointer;
}

/* Sortable header affordance — subtle text brightening on hover, the
   click handler is wired in the Alpine template. */
.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease;
}
.data-table th.sortable:hover { color: var(--text); }

/* ============================================================
   STATS GRID (paper trades panel)
   ============================================================ */
.stats-grid { display: flex; flex-direction: column; gap: 4px; }
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; border-bottom: 1px solid var(--grid-line); }
.stat-label { color: var(--dim); font-size: var(--fs-xs); }
.stat-value { color: var(--text); font-size: var(--fs-sm); font-weight: 500; }
.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }

/* ============================================================
   STATUS BAR — frosted bottom rail
   ============================================================ */
.panel-status-bar {
  flex: 0 0 20px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 8px;
  background:
    linear-gradient(0deg,
      var(--glass-tint-strong) 0%,
      var(--glass-tint-soft) 100%);
  -webkit-backdrop-filter: var(--glass-blur-soft);
  backdrop-filter: var(--glass-blur-soft);
  border-top: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  font-size: var(--fs-xs);
  color: var(--dim);
}

/* ============================================================
   COLOR UTILITIES
   ============================================================ */
.green { color: var(--green); }
.red { color: var(--red); }
.amber { color: var(--amber); }
.dim, .data-table td.dim, .data-table th.dim { color: var(--dim); }

/* ============================================================
   LANDSCAPE PANEL
   ============================================================ */
.landscape-grid {
  display: grid;
  gap: 2px;
  padding: 2px;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.landscape-tile {
  background: var(--panel-head);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.tile-label {
  flex: 0 0 auto;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--dim);
  padding: 1px 4px;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.tile-img {
  flex: 1;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: fill;
  image-rendering: pixelated;
  min-height: 0;
}

.tile-stats {
  flex: 1;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.tile-stat {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-xs);
}

.tile-stat .stat-k {
  color: var(--dim);
}

.tile-stat .stat-v {
  color: var(--text);
  font-weight: 500;
}

/* ============================================================
   PULSE ANIMATION
   ============================================================ */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ============================================================
   SEMANTIC UTILITIES (Copper / Direction / AI)
   Use these instead of inline hex codes anywhere in HTML/JS.
   ============================================================ */

/* Direction (P&L, candles) — outcome, never identity.
   Doubled specificity so these override .data-table td { color: var(--text) }. */
.pnl-pos, .data-table td.pnl-pos, .data-table th.pnl-pos { color: var(--gain); }
.pnl-neg, .data-table td.pnl-neg, .data-table th.pnl-neg { color: var(--loss); }
.pnl-flat   { color: var(--neutral); }

/* Risk tier (ENTER recs, moderate level) — copper/cream highlight */
.tier-moderate, .data-table td.tier-moderate { color: var(--copper-bright); }

/* Brand (action / identity) */
.copper     { color: var(--copper); }
.copper-bg  { background: var(--copper); color: var(--bg); }
.copper-grad{ background: var(--copper-gradient); color: var(--bg); }

/* AI / intelligence overlay */
.ai         { color: var(--ai); }

/* Opt-in glow utilities — use filter:drop-shadow so the universal
   * { box-shadow: none } reset above does not interfere. */
.glow-copper        { filter: drop-shadow(0 0 4px var(--copper-glow)); }
.glow-copper:hover  { filter: drop-shadow(0 0 8px var(--copper-glow)); }
.glow-bull          { filter: drop-shadow(0 0 4px var(--bull-glow)); }
.glow-bear          { filter: drop-shadow(0 0 4px var(--bear-glow)); }
.glow-ai            { filter: drop-shadow(0 0 6px var(--ai-glow)); }

/* ============================================================
   CONFIRM MODAL — themed replacement for window.confirm()
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0, 0, 0, 0.65);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  animation: modalFadeIn 0.15s ease;
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.modal-card {
  background:
    linear-gradient(180deg,
      var(--glass-tint-strong) 0%,
      var(--bg) 100%);
  border: 1px solid var(--border);
  border-top-color: var(--copper);
  border-radius: 6px;
  box-shadow:
    0 0 40px rgba(0, 0, 0, 0.5),
    0 0 20px var(--copper-glow),
    inset 0 1px 0 var(--glass-highlight);
  max-width: 380px;
  width: 90%;
  padding: 24px;
  animation: modalSlideIn 0.2s ease;
}
@keyframes modalSlideIn {
  from { transform: translateY(-12px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.modal-card .modal-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  font-size: 18px;
}
.modal-card .modal-icon.danger {
  background: rgba(159, 104, 49, 0.15);
  border: 1px solid var(--bear-bright);
  color: var(--bear-bright);
}
.modal-card .modal-title {
  font-size: 13px; font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: 8px;
}
.modal-card .modal-body {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.5;
  margin-bottom: 20px;
}
.modal-actions {
  display: flex; gap: 10px; justify-content: center;
}
.modal-actions .modal-btn {
  padding: 7px 22px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.15s ease;
}
.modal-actions .modal-btn.cancel {
  background: transparent;
  color: var(--text-dim);
}
.modal-actions .modal-btn.cancel:hover {
  color: var(--text);
  border-color: var(--text-dim);
}
.modal-actions .modal-btn.confirm-danger {
  background: var(--bear-bright);
  color: var(--bg);
  border-color: var(--bear-bright);
}
.modal-actions .modal-btn.confirm-danger:hover {
  box-shadow: 0 0 12px var(--bear-glow);
}

/* Brand badge (e.g. VIRTUAL tag) — polished copper coin.
   Uses the same 5-stop logo gradient as the equity area fills, so a
   VIRTUAL badge feels like a tiny version of the live PnL curve. */
.brand-badge {
  display: inline-block;
  font-size: 7px;
  padding: 1px 4px;
  background: var(--copper-gradient-vertical);
  color: var(--bg);
  letter-spacing: 0.06em;
  font-weight: 600;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    0 1px 2px rgba(0, 0, 0, 0.4);
}

/* ─────────────────────────────────────────────────────────────────────────
 * Personal Trader Desk (RFC 0002 Phase 1)
 *   Stage badge / connection lamp / mode pill / info-state pill / decision
 *   buttons. All tokens reuse the existing palette so the desk feels native.
 * ───────────────────────────────────────────────────────────────────────── */

/* Stage badge — Stage A / B / C / D — copper-gradient capsule.
   Stage progression is forward-only so we use a single chip + color shift
   per stage rather than a stepper, keeping the header lightweight. */
.td-stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--bg-elev-2);
  border: 1px solid var(--bg-elev-2);
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.td-stage-badge.stage-A { color: var(--copper);        border-color: var(--copper); }
.td-stage-badge.stage-B { color: var(--copper-bright); border-color: var(--copper-bright); }
.td-stage-badge.stage-C { color: var(--ai);            border-color: var(--ai); }
.td-stage-badge.stage-D { color: var(--bull-bright);   border-color: var(--bull-bright);
                          box-shadow: 0 0 6px var(--bull-glow); }

/* Connection lamp — green/yellow/red dot in the desk header. */
.td-lamp {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 8px;
  color: var(--text-dim);
}
.td-lamp::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
}
.td-lamp.green::before  { background: var(--bull-bright); box-shadow: 0 0 4px var(--bull-glow); }
.td-lamp.yellow::before { background: var(--warning);     box-shadow: 0 0 4px rgba(240,160,48,.4); }
.td-lamp.red::before    { background: var(--bear-bright); box-shadow: 0 0 4px var(--bear-glow);
                          animation: td-lamp-blink 1.2s ease-in-out infinite; }
@keyframes td-lamp-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: .4; }
}

/* Mode pill — PRE_OPEN / REVIEW / LIVE / POST_CLOSE / JOURNAL. */
.td-mode-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: var(--bg-elev-2);
  color: var(--text-dim);
  border: 1px solid var(--bg-elev-2);
}
.td-mode-pill.mode-PRE_OPEN  { color: var(--copper);        border-color: var(--copper); }
.td-mode-pill.mode-REVIEW    { color: var(--copper-bright); border-color: var(--copper-bright);
                               box-shadow: 0 0 6px var(--copper-glow); }
.td-mode-pill.mode-LIVE      { color: var(--bull-bright);   border-color: var(--bull-bright); }
.td-mode-pill.mode-POST_CLOSE{ color: var(--text);          border-color: var(--text-dim); }
.td-mode-pill.mode-JOURNAL   { color: var(--ai-bright);     border-color: var(--ai); }
.td-mode-pill.mode-CLOSED    { color: var(--text-dim);      border-color: var(--bg-elev-2); }

/* Info-state bucket pill — quiet / normal / active / event / shock. */
.td-info-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.td-info-pill.bucket-quiet   { background: var(--bg-elev-2);    color: var(--text-dim); }
.td-info-pill.bucket-normal  { background: var(--bg-elev-2);    color: var(--text); }
.td-info-pill.bucket-active  { background: var(--copper);       color: var(--bg); }
.td-info-pill.bucket-event   { background: var(--warning);      color: var(--bg); }
.td-info-pill.bucket-shock   { background: var(--bear-bright);  color: var(--bg);
                               animation: td-lamp-blink 1.2s ease-in-out infinite; }

/* Decision buttons in the journal form — copper for take/approve, dim for
   skip, warning for reduce. The trader's eye should land on take/skip first. */
.td-decision-btn {
  font-family: inherit;
  font-size: 9px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 2px;
  border: 1px solid var(--bg-elev-2);
  background: var(--bg-elev-0);
  color: var(--text-dim);
  cursor: pointer;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.td-decision-btn:hover { background: var(--bg-elev-1); color: var(--text); }
.td-decision-btn.active.take    { background: var(--copper);     color: var(--bg); border-color: var(--copper); }
.td-decision-btn.active.skip    { background: var(--text-dim);   color: var(--bg); border-color: var(--text-dim); }
.td-decision-btn.active.reduce  { background: var(--warning);    color: var(--bg); border-color: var(--warning); }

/* Group separator in TODAY'S PICKS table — drawn at the top of each row
   that starts a new (pin, asof_ts, side) group. Visually distinguishes
   e.g. pin=45 longs from pin=45 shorts, and the 09:28 v3d picks from
   the 08:00 v6+v7 pre-open picks at pin=0. */
.td-group-head {
  border-top: 1px solid var(--copper, #c5894f) !important;
}

/* ALGO PICK card — combined header bar: label + date nav on the left,
   Long / Short tabs (~12.5% width each) on the right. */
.td-pick-tab {
  flex: 0 0 12.5%;            /* right-aligned, ~1/8 of card width each */
  padding: 5px 8px;
  font-family: var(--ff-sans);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}
.td-pick-tab:hover { color: var(--text); }
.td-pick-tab.active {
  color: var(--text);
  background: var(--bg-elev-2);
  border-bottom-color: var(--copper);
}

/* Circular icon nav button — square <button> per the global square-corner
   rule, but the visible "disc" is drawn inside the SVG (a circle behind the
   triangle / today dot). Stocast-tinted: muted text, copper on hover. */
.td-nav-btn {
  width: 22px;
  height: 22px;
  padding: 0;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.12s ease;
}
.td-nav-btn:hover:not(:disabled) { color: var(--copper); }
.td-nav-btn:disabled { color: var(--text-faint); cursor: not-allowed; opacity: 0.55; }
.td-nav-btn.is-today { color: var(--copper); }

/* Date input — match the dark terminal aesthetic. */
/* color-scheme: dark is load-bearing — without it the native popup calendar
   renders in OS LIGHT mode regardless of our CSS. Setting this on the input
   tells Chrome/Edge/Safari to render the popup chrome (calendar grid, nav
   arrows, month/year picker, today-highlight) in dark mode using system
   accent colors. The grid/numerals end up readable against #0F1419 — much
   closer to Stocast's #0F1419 panel background than the default white card.
   Firefox respects this partially (date edits go dark; popup less so). */
.td-date-input {
  color-scheme: dark;
  accent-color: var(--copper);              /* recolors the "today" / "selected" cell to copper on supporting browsers */
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  padding: 2px 4px;
  height: 22px;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, background 0.15s;
}
.td-date-input:hover  { border-color: var(--copper-deep); background: var(--bg-elev-1); }
.td-date-input:focus  { outline: 1px solid var(--copper); outline-offset: -1px; border-color: var(--copper); }

/* WebKit-only pseudo-elements (Chrome/Edge/Safari): the editable parts
   inside the input (the DD / MM / YYYY fields and their separators). */
.td-date-input::-webkit-datetime-edit             { color: var(--text); padding: 0; }
.td-date-input::-webkit-datetime-edit-text        { color: var(--copper-deep); padding: 0 1px; }   /* the "-" separators */
.td-date-input::-webkit-datetime-edit-day-field,
.td-date-input::-webkit-datetime-edit-month-field,
.td-date-input::-webkit-datetime-edit-year-field  {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.td-date-input::-webkit-datetime-edit-day-field:focus,
.td-date-input::-webkit-datetime-edit-month-field:focus,
.td-date-input::-webkit-datetime-edit-year-field:focus {
  background: var(--copper-glow);
  color: var(--copper-bright);
  border-radius: 2px;
}

/* The little calendar icon that opens the popup. invert() rebuilds the
   black SVG into a copper tint that matches the surrounding chip arrows. */
.td-date-input::-webkit-calendar-picker-indicator {
  filter: invert(0.65) sepia(1) saturate(2.5) hue-rotate(360deg);
  opacity: 0.7;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
}
.td-date-input::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* SELECTED-DATE display; highlight when it IS today. */
.td-sel-date {
  font-family: var(--ff-mono);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  letter-spacing: 0.02em;
}
.td-sel-date.is-today {
  color: var(--copper);
  font-weight: 600;
  text-shadow: 0 0 6px var(--copper-glow);
}

/* Stale-data dim — applies a subtle desaturation + reduced opacity to any
   panel whose source data hasn't refreshed within the staleness threshold.
   Visually says "data is frozen but not broken." */
.td-stale {
  opacity: 0.45;
  filter: saturate(0.6);
  transition: opacity .3s ease, filter .3s ease;
}

/* Countdown clock — used for next-decision-at and decision-window timer. */
.td-countdown {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--text);
}
.td-countdown.urgent  { color: var(--warning); }
.td-countdown.expired { color: var(--bear-bright); text-decoration: line-through; }

/* Tiny "epoch indicator" — flashes copper for 800ms after a WS event
   updates the corresponding panel, so the trader can SEE that data just
   moved. Applied via .td-flash class toggled by the panel. */
.td-flash {
  animation: td-flash-pulse .8s ease-out;
}
@keyframes td-flash-pulse {
  0%   { box-shadow: 0 0 0 0 var(--copper-glow); }
  60%  { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* Prevent a flash of x-show'd content before Alpine initialises. */
[x-cloak] { display: none !important; }

/* ---- Login gate (Google Sign-In) ---- */
#login-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Layered light/shadow accent: a soft warm key-light from the upper-left,
     a cool fill from the lower-right, and a vignette to seat the card. */
  background:
    radial-gradient(900px 700px at 22% 12%, rgba(222, 166, 112, 0.10) 0%, transparent 55%),
    radial-gradient(1000px 800px at 82% 92%, rgba(46, 189, 133, 0.06) 0%, transparent 55%),
    radial-gradient(1400px 1100px at 50% 50%, transparent 35%, rgba(0, 0, 0, 0.45) 100%),
    linear-gradient(160deg, #0E141B 0%, var(--bg) 60%, #080B0F 100%);
}
#login-gate .login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 64px 56px;
  min-width: 360px;
  min-height: 460px;
  justify-content: center;
  border: 1px solid var(--border);
  border-top: 2px solid var(--copper);
  border-radius: 8px;
  /* Slight top-down sheen on the card surface to echo the lighting. */
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035) 0%, transparent 22%),
    rgba(18, 26, 34, 0.90);
  backdrop-filter: blur(6px);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
#login-gate .login-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  margin-bottom: 4px;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.45));
}
#login-gate .login-brand {
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 600;
  letter-spacing: 0.22em;
  font-size: 22px;
  color: var(--text);
}
#login-gate .login-gsi {
  min-height: 44px;
  display: flex;
  justify-content: center;
  /* Extra breathing room between the STOCAST wordmark and the button. */
  margin-top: 28px;
}
#login-gate .login-err {
  font-size: 12px;
  color: #e06c75;
  max-width: 280px;
  text-align: center;
}
