/* ──────────────────────────────────────────────────────────────────────────
   theme-retro-light.css — Retro Light theme (monochrome light chrome).
   Activates on body[data-theme="retro-light"]. Two-tier tokens per axis.

   DESIGN DIRECTIVES (S61 operator-ratified):
     • OVERALL TONE leveled DOWN — palette ceiling shifted ~24 hex units
       darker. No near-white anywhere. (Old --bg4 #f0f0f0 → new #d8d8d8.)
     • CHROME drained to monochrome light greys.
     • STATUS (--success / --warning / --danger) preserves FUNCTIONAL
       red/green/orange. NOT drained.
   ────────────────────────────────────────────────────────────────────────── */

body[data-theme="retro-light"] {

  /* Browser-native widget color scheme (number-input spinners, scrollbars, autofill) */
  color-scheme: light;

  /* ─────── TIER 1: PRIMITIVES ─────── */

  /* Neutral scale (light → dark, leveled-down ceiling) */
  --neutral-50:  #d8d8d8;
  --neutral-100: #d0d0d0;
  --neutral-150: #c8c8c8;
  --neutral-200: #c0c0c0;
  --neutral-250: #b8b8b8;
  --neutral-300: #aaaaaa;
  --neutral-400: #999999;
  --neutral-500: #777777;
  --neutral-600: #5a5a5a;
  --neutral-700: #555555;
  --neutral-800: #444444;
  --neutral-900: #000000;

  /* Brand & status (functional colors preserved per S61 directive) */
  --brand-base:     #09B040;
  --brand-emphasis: #F57D27;
  --success: #09B040;
  --warning: #F57D27;
  --danger:  #B01212;

  /* Per-strategy badge palette */
  --strategy-1: #2dc98a;
  --strategy-2: #6ba3f5;
  --strategy-3: #f57c2a;
  --strategy-4: #f06292;
  --strategy-5: #ffd23f;

  /* Monochrome chrome accent (intentional Retro Light vibe) */
  --accent-grey: #444444;

  /* ─────── TIER 2: SEMANTICS ─────── */

  /* Surfaces (page → card → drawer; card sits below drawer per S61 directive;
     S69 Stratum 1 — added --surface-recessed for forms + stat cells + intel
     rows (was bypassing semantic via raw --neutral-300); added --surface-action
     for action buttons + badge bg (was raw #2a2a2a in 8+ component rules). */
  --surface-base:     var(--neutral-200);   /* page bg */
  --surface-raised:   var(--neutral-150);   /* cards */
  --surface-recessed: var(--neutral-300);   /* form fields + stat cells + intel rows (S69) */
  --surface-elevated: var(--neutral-100);   /* drawers */
  --surface-overlay:  var(--neutral-50);    /* highest layer */
  --surface-action:   #2a2a2a;              /* action buttons + matches per-theme --badge-bg override (S69) */

  /* Borders */
  --border-subtle:   var(--neutral-300);
  --border-default:  var(--neutral-300);
  --border-emphasis: var(--neutral-400);

  /* Text */
  --text-primary:   var(--neutral-900);
  --text-secondary: var(--neutral-700);
  --text-muted:     var(--neutral-600);
  --text-on-accent: var(--neutral-50);

  /* Accent (monochrome dark grey — Retro Light identity) */
  --accent:          var(--accent-grey);
  --accent-emphasis: var(--accent-grey);

  /* Status text (functional) */
  --text-success: var(--success);
  --text-warning: var(--warning);
  --text-danger:  var(--danger);

  /* Status background tints */
  --bg-success: rgba(9,176,64,0.18);
  --bg-warning: rgba(245,125,39,0.18);
  --bg-danger:  rgba(176,18,18,0.18);

  /* Form inputs */
  --input-bg:     var(--neutral-150);
  --input-border: var(--border-emphasis);
  --input-text:   var(--text-primary);

  /* Action buttons */
  --button-primary-bg:   var(--surface-action);   /* S69 Stratum 2 — was neutral-900 #000 (out of sync with actual #2a2a2a render) */
  --button-primary-text: #ffffff;                 /* S69 Stratum 2 — was --neutral-50 (out of sync with actual #fff render) */
  --btn-add-bg:          transparent;   /* S66 operator-deferred fix (c) — transparent-fill on Retro Light */

  /* Effects */
  --overlay: rgba(0,0,0,0.4);
  --shadow:  rgba(0,0,0,0.18);

  /* ─────── TRANSITIONAL ALIASES (component CSS migration pending Phase D) ─────── */

  --bg:      var(--neutral-200);   /* leveled down from #d8d8d8 */
  --bg2:     var(--neutral-150);   /* leveled down from #e0e0e0 */
  --bg3:     var(--neutral-100);   /* leveled down from #e8e8e8 */
  --bg4:     var(--neutral-50);    /* leveled down from #f0f0f0 */
  --card-bg: var(--neutral-150);

  --border:  var(--neutral-300);
  --border2: var(--neutral-400);

  --text:  var(--neutral-900);
  --text2: var(--neutral-700);
  --text3: var(--neutral-600);

  --green:  var(--success);
  --red:    var(--danger);
  --yellow: var(--warning);

  /* S68 C2 — per-theme --global-green override for legibility against light bg
     (operator-specified #12823B; supersedes Tier 0 #1BA84F for Retro Light only).
     Affects all CSS var(--global-green) consumers. Chart.js LEVEL_COLORS.TP is
     hardcoded #1BA84F and does NOT inherit — chart canvas keeps Tier 0 green
     in Retro Light. Future C-item if needed. */
  --global-green: #12823B;

  /* S69 Stratum 4 — per-theme --badge-bg override (Retro Light softer charcoal
     per S68 C1; dark themes keep Tier 0 default #1a1a1a). Same per-theme
     override pattern as --global-green above. */
  --badge-bg: #2a2a2a;

  /* S69 Stratum 5 — names the intentional Retro Light white-topbar choice
     (S67 R8). Applied to .topbar bg below. */
  --chrome-topbar-bg: #ffffff;
}

/* ──────────────────────────────────────────────────────────────────────────
   COMPONENT OVERRIDES (preserved from prior inline retro-light block;
   colors that referenced near-white tones leveled down accordingly)
   ────────────────────────────────────────────────────────────────────────── */

/* S69 Stratum 5 — logo text color routed through --text-primary (was raw #000000). */
body[data-theme="retro-light"] .logo span { color: var(--text-primary) !important; }

/* S69 Stratum 3 — label color routed through --text-secondary (was off-scale raw #505050). */
body[data-theme="retro-light"] .et-param-label { color: var(--text-secondary); }

/* S69 Stratum 5 — Top bar uses --chrome-topbar-bg token (was raw #ffffff);
   tabs row uses --surface-overlay (was raw Tier 1 --neutral-50 direct ref). */
body[data-theme="retro-light"] .topbar { background: var(--chrome-topbar-bg); border-bottom-color: var(--neutral-300); }
body[data-theme="retro-light"] .tabs   { background: var(--surface-overlay); border-bottom-color: var(--neutral-300); }
body[data-theme="retro-light"] .logomark { filter: invert(1); }  /* black-bg logomark → white-bg + black-C for light topbar */

/* Top stat cells + intel-drawer use the recessed surface for green-text legibility
   (operator-direction S65); intel rows alternate between recessed and --neutral-250
   to mirror the alternating-row pattern other themes use. S69 Stratum 1 — was
   raw var(--neutral-300) Tier 1 direct refs; now routed through --surface-recessed. */
body[data-theme="retro-light"] .sc-cell { background: var(--surface-recessed); }
body[data-theme="retro-light"] .id-th { background: var(--surface-recessed); }
body[data-theme="retro-light"] .id-tr:nth-child(odd)  { background: var(--surface-recessed); }
body[data-theme="retro-light"] .id-tr:nth-child(even) { background: var(--neutral-250); }
body[data-theme="retro-light"] .id-stat-row-dark .sc-cell { background: var(--surface-recessed); }
body[data-theme="retro-light"] .id-stat-row-mid  .sc-cell { background: var(--neutral-250); }

/* S69 Stratum 1 — perf + EDGE cards align to --surface-raised (same as trade cards;
   was --neutral-100 #d0d0d0 = drawer tone, an audit-flagged inconsistency). */
body[data-theme="retro-light"] .perf-stat-cell,
body[data-theme="retro-light"] .perf-card,
body[data-theme="retro-light"] .perf-chart-wrap,
body[data-theme="retro-light"] .perf-strategy-cell,
body[data-theme="retro-light"] .perf-close-reason { background: var(--surface-raised); }

body[data-theme="retro-light"] .edge-card { background: var(--surface-raised); }

body[data-theme="retro-light"] #app { background: var(--surface-base); }

/* S69 Stratum 2 — Primary CTA + Danger label.
   .btn-primary routed through --surface-action (was raw #2a2a2a).
   .btn-danger uses --global-red (was off-scale #dddddd). */
body[data-theme="retro-light"] .btn-primary { background: var(--surface-action); color: #ffffff; border-color: var(--surface-action); }
body[data-theme="retro-light"] .btn-danger  { color: var(--global-red); }

/* S69 Stratum 2 — T1 ACTION tier (primary + actions + intel toggles +
   LIVE/PAPER/SHADOW toggle-active). All collapse into one uniform visual:
   --surface-action bg + white text + matching border. Resolves the
   operator-flagged "two visual languages for engaged controls" mess
   (the prior #888888 lp-btn active was the outlier). */
body[data-theme="retro-light"] .btn-action,
body[data-theme="retro-light"] .btn-add,
body[data-theme="retro-light"] .card-link-pill,
body[data-theme="retro-light"] .tc-intel-btn,
body[data-theme="retro-light"] .edge-intel-btn,
body[data-theme="retro-light"] .lp-btn.live-active,
body[data-theme="retro-light"] .lp-btn.paper-active,
body[data-theme="retro-light"] .lp-btn.shadow-active { background: var(--surface-action) !important; color: #ffffff !important; border-color: var(--surface-action) !important; }

/* S69 Stratum 2 — Uniform hover via filter:brightness(1.15) across every action-tier
   button. Replaces prior per-tier raw #3a3a3a override. Same pattern as the
   .tc-group-badge:hover precedent. */
body[data-theme="retro-light"] .btn-primary:hover,
body[data-theme="retro-light"] .btn-action:hover,
body[data-theme="retro-light"] .btn-add:hover,
body[data-theme="retro-light"] .card-link-pill:hover,
body[data-theme="retro-light"] .tc-intel-btn:hover,
body[data-theme="retro-light"] .edge-intel-btn:hover,
body[data-theme="retro-light"] .lp-btn.live-active:hover,
body[data-theme="retro-light"] .lp-btn.paper-active:hover,
body[data-theme="retro-light"] .lp-btn.shadow-active:hover { filter: brightness(1.15); }

/* S69 Stratum 2 — dropped the separate #555555 border accent on .btn-add +
   .edge-enter-btn (visual uniformity over micro-affordance; border now matches
   the action-surface bg per the unified tier rule above). */

/* S69 Stratum 5 — Footer rewires.
   Footer text routes through --text-muted (was off-scale raw #aaaaaa — visibly
   darker/more legible on light bg). Footer links unify to --global-blue per S67
   universal link-blue convention (was inconsistent #ffffff for landing CTA +
   #888888 for app footer). .footer-x-link rule removed — dead since S68 A4
   (selector class no longer rendered in either footer span). */
body[data-theme="retro-light"] .landing-footer { color: var(--text-muted); }
body[data-theme="retro-light"] .landing-footer span { color: var(--text-muted); }
body[data-theme="retro-light"] .landing-footer a,
body[data-theme="retro-light"] .landing-footer a:visited { color: var(--global-blue) !important; }
body[data-theme="retro-light"] .app-footer-link { color: var(--global-blue) !important; }

/* S69 Stratum 2 — .tc-intel-btn + .edge-intel-btn rule removed; selectors
   absorbed into the T1 ACTION consolidated rule above. */

/* S69 Stratum 4 — universal badge chrome routed through Tier 0 tokens
   (--badge-bg / --badge-border / --badge-text). Retro Light's --badge-bg
   override (#2a2a2a) is set in the body block above; dark themes use the
   Tier 0 default #1a1a1a from theme-shared.css. Strategy badge text colors
   stay var(--badge-strategy-N) — see .badge-s1..s5 in index.html. */
body[data-theme="retro-light"] .badge        { background: var(--badge-bg); border-color: var(--badge-border); }
body[data-theme="retro-light"] .badge-live,
body[data-theme="retro-light"] .badge-closed,
body[data-theme="retro-light"] .badge-paper  { background: var(--badge-bg) !important; border-color: var(--badge-border) !important; color: var(--badge-text); }
body[data-theme="retro-light"] .badge.badge-inactive { color: var(--badge-text) !important; }
body[data-theme="retro-light"] .tc-group-badge { background: var(--badge-bg) !important; border-color: var(--badge-border) !important; color: var(--badge-text) !important; }

/* S66 — retired the grey active-border override; .et-strat-card.active now
   uses the universal --global-green via the base rule, consistent with other
   themes per operator-deferred fix (d) resolution. */

/* S69 Stratum 5 — Copy-CA icon color routed through --text-secondary (was raw #555555). */
body[data-theme="retro-light"] button[title="Copy CA"] { color: var(--text-secondary) !important; }

/* S69 Stratum 2 hygiene — removed dead duplicate .card-link-pill rule (audit
   I-12). The T1 ACTION rule above governs .card-link-pill rendering via
   !important; this duplicate was effectively unreachable. */

/* S69 Stratum 3 — Form field REST state. Trade-tab containers + inputs use
   --surface-recessed (was raw Tier 1 --neutral-300 direct ref); border via
   --border-emphasis; text via --input-text (resolves to --text-primary). */
body[data-theme="retro-light"] .et-param-block,
body[data-theme="retro-light"] .et-wallet-row,
body[data-theme="retro-light"] .et-strat-card,
body[data-theme="retro-light"] .et-ca-input,
body[data-theme="retro-light"] .form-input,
body[data-theme="retro-light"] .form-select,
body[data-theme="retro-light"] .et-param-select { background: var(--surface-recessed); border-color: var(--border-emphasis); color: var(--input-text); }

/* S69 Stratum 3 — Form field FOCUS state (NEW for Retro Light). Blue border per
   S67 universal link-blue convention; bg unchanged. Adds the interaction signal
   the theme was missing. */
body[data-theme="retro-light"] .et-ca-input:focus,
body[data-theme="retro-light"] .form-input:focus,
body[data-theme="retro-light"] .form-select:focus,
body[data-theme="retro-light"] .et-param-select:focus { border-color: var(--global-blue); outline: none; }

/* S69 Stratum 3 — Form field DISABLED state codified. Was informal; bg recedes to
   page surface, text muted. */
body[data-theme="retro-light"] .form-input:disabled,
body[data-theme="retro-light"] .form-select:disabled,
body[data-theme="retro-light"] .et-param-select:disabled,
body[data-theme="retro-light"] .et-ca-input:disabled { background: var(--surface-base); color: var(--text-muted); }

/* S69 Stratum 3 — Wallet SELECTED state. Green outline rewired to Tier 0
   --global-green (resolves to per-theme #12823B in Retro Light per S68 C2).
   Was legacy var(--green) → --success #09B040 alias (audit I-9 Tier 0 drift). */
body[data-theme="retro-light"] .et-wallet-row.selected { border-color: var(--global-green); }

/* Settings drawer gear toggle (.rp-toggle) — relocated S66 Phase D iter1
   from settings-drawer.css component CSS. Original spec used near-white
   #f0f0f0 / #e0e0e0 lifted bg, which is out-of-palette for the S65 leveled-
   down Retro Light scheme (no near-white). Rewritten using leveled
   semantics — operator visual-verify the contrast is acceptable. */
body[data-theme="retro-light"] .rp-toggle {
  background: var(--surface-overlay);   /* lightest leveled tint (#d8d8d8) */
  color: var(--text-muted);
}
body[data-theme="retro-light"] .rp-toggle:hover {
  background: var(--surface-elevated);  /* one step down on hover */
  color: var(--text-primary);
}

/* Toolbox host + drawer overrides — relocated S66 Phase D iter3 from
   toolbox.css component CSS. Original used near-white #f0f0f0 / #cccccc /
   #e0e0e0 / #333333 — out-of-palette for the leveled Retro Light scheme.
   Rewritten using leveled semantics; operator visual-verify contrast. */
body[data-theme="retro-light"] .ct-toolbox-host {
  background: var(--surface-overlay);
  border-top-color: var(--border-default);
}
body[data-theme="retro-light"] .ct-toolbox-toggle {
  background: var(--surface-overlay);
  color: var(--text-secondary);
}
body[data-theme="retro-light"] .ct-toolbox-toggle:hover {
  background: var(--surface-elevated);
  color: var(--text-primary);
}
body[data-theme="retro-light"] .ct-drawer {
  background: var(--surface-overlay);
  border-top-color: var(--border-default);
}
