/* ═══════════════════════════════════════════════════════════════
   Ralph Lauren Corporation — Capstone Dashboard
   Dark Navy Surface · Floating Light Cards · Gold Accents
   Typography: Cormorant Garamond + Jost
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* ── RL Brand Palette ── */
  --rl-navy: #041E42;
  --rl-navy-deep: #021430;
  --rl-navy-mid: #0B2D5B;
  --rl-navy-light: #163D6E;
  --rl-gold: #B8926A;
  --rl-gold-light: #D4B896;
  --rl-gold-pale: #E8D5BF;
  --rl-gold-deep: #8C6D4F;
  --rl-cream: #FAF8F5;
  --rl-polo-red: #C41E3A;
  --rl-white: #FFFFFF;

  /* ── Semantic Tokens (dark surface) ── */
  --page-bg: var(--rl-navy-deep);
  --surface: rgba(255, 255, 255, 0.97);
  --surface-dim: rgba(255, 255, 255, 0.92);
  --surface-subtle: rgba(255, 255, 255, 0.06);
  --ink: #1A2332;
  --ink-on-dark: rgba(255, 255, 255, 0.92);
  --muted: #7A8A9A;
  --muted-strong: #56667A;
  --muted-on-dark: rgba(255, 255, 255, 0.45);
  --border: rgba(4, 30, 66, 0.08);
  --border-gold: rgba(184, 146, 106, 0.22);
  --border-on-dark: rgba(184, 146, 106, 0.14);
  --shadow-card:
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 8px 24px rgba(0, 0, 0, 0.10),
    0 24px 48px rgba(0, 0, 0, 0.06);
  --shadow-card-hover:
    0 1px 2px rgba(0, 0, 0, 0.08),
    0 12px 32px rgba(0, 0, 0, 0.14),
    0 32px 64px rgba(0, 0, 0, 0.08);
  --shadow-gold: 0 12px 32px rgba(184, 146, 106, 0.08);

  /* ── Status ── */
  --pass: #22875E;
  --pass-bg: rgba(34, 135, 94, 0.08);
  --watch: #B07420;
  --watch-bg: rgba(176, 116, 32, 0.08);
  --fail: #C03A3A;
  --fail-bg: rgba(192, 58, 58, 0.08);

  /* ── Typography ── */
  --heading-font: "Cormorant Garamond", "Georgia", "Times New Roman", serif;
  --body-font: "Jost", "Helvetica Neue", "Arial", sans-serif;
  --mono-font: "SFMono-Regular", "Menlo", "Monaco", "Consolas", monospace;
}

* { box-sizing: border-box; }
html { color-scheme: dark light; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--ink);
  font-family: var(--body-font);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Subtle gradient atmosphere on the dark background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(11, 45, 91, 0.7), transparent 50%),
    radial-gradient(ellipse at 80% 10%, rgba(184, 146, 106, 0.06), transparent 40%),
    radial-gradient(ellipse at 50% 100%, rgba(11, 45, 91, 0.4), transparent 50%);
  pointer-events: none;
}

.page-backdrop { display: none; }

.page-shell {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 32px;
}

/* ══════════════════════════════════════════════════
   TOPBAR — On Dark Surface
   ══════════════════════════════════════════════════ */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-on-dark);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-wordmark {
  display: inline-flex;
  align-items: center;
  color: var(--rl-white);
  padding-right: 18px;
  border-right: 1px solid rgba(184, 146, 106, 0.22);
  height: 40px;
}
.brand-wordmark svg {
  height: 32px;
  width: auto;
  display: block;
}

.brand-copy h1 {
  margin: 0;
  font-family: var(--heading-font);
  font-weight: 600;
  font-size: 1.35rem;
  color: var(--rl-white);
  letter-spacing: 0.01em;
}

.brand-subline {
  margin: 3px 0 0;
  color: var(--muted-on-dark);
  font-size: 0.82rem;
  letter-spacing: 0.03em;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--rl-gold);
  font-family: var(--body-font);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

/* Eyebrow inside light cards should use the deeper gold */
.panel .eyebrow,
.metric-card .eyebrow,
.scenario-card .eyebrow,
.forecast-card .eyebrow,
.preset-card .eyebrow,
.diagnostic-card .eyebrow {
  color: var(--rl-gold-deep);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topnav {
  display: flex;
  gap: 4px;
}

.topnav a {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.55);
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  transition: all 180ms ease;
  border: 1px solid transparent;
}

.topnav a:hover {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.06);
}

.topnav a.is-active {
  color: var(--rl-gold-light);
  background: rgba(184, 146, 106, 0.10);
  border-color: rgba(184, 146, 106, 0.18);
}

.topbar-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-on-dark);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-on-dark);
  font-size: 0.8rem;
}

/* ══════════════════════════════════════════════════
   CONTENT SHELL & FLASH
   ══════════════════════════════════════════════════ */

.content-shell {
  display: grid;
  gap: 20px;
}

.flash-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.flash-card {
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  font-weight: 500;
}

.flash-card.success { border-left: 3px solid var(--pass); }
.flash-card.warning { border-left: 3px solid var(--watch); }

/* ══════════════════════════════════════════════════
   STATUS PILLS
   ══════════════════════════════════════════════════ */

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 5px 12px;
  border-radius: 999px;
  font-family: var(--body-font);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.status-pass {
  color: var(--pass);
  background: var(--pass-bg);
  border-color: rgba(34, 135, 94, 0.16);
}

.status-watch {
  color: var(--watch);
  background: var(--watch-bg);
  border-color: rgba(176, 116, 32, 0.16);
}

.status-fail {
  color: var(--fail);
  background: var(--fail-bg);
  border-color: rgba(192, 58, 58, 0.16);
}

.status-template {
  color: var(--rl-gold-deep);
  background: rgba(184, 146, 106, 0.08);
  border-color: rgba(184, 146, 106, 0.14);
}

/* On-dark overrides */
.hero-panel .status-pill.status-pass {
  color: #5fe6a6; background: rgba(95, 230, 166, 0.08); border-color: rgba(95, 230, 166, 0.18);
}
.hero-panel .status-pill.status-watch {
  color: #f0c060; background: rgba(240, 192, 96, 0.08); border-color: rgba(240, 192, 96, 0.18);
}
.hero-panel .status-pill.status-fail {
  color: #f07070; background: rgba(240, 112, 112, 0.08); border-color: rgba(240, 112, 112, 0.18);
}
.hero-panel .status-pill.status-template {
  color: var(--rl-gold-light); background: rgba(184, 146, 106, 0.10); border-color: rgba(184, 146, 106, 0.20);
}

/* ══════════════════════════════════════════════════
   CARDS — White Floating on Dark Navy
   ══════════════════════════════════════════════════ */

.panel,
.metric-card,
.preset-card,
.diagnostic-card,
.run-card,
.scenario-card,
.valuation-card,
.forecast-card,
.status-card,
.mini-stat-card,
.posture-card {
  background: var(--surface);
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
}

.panel h3,
.metric-card h3,
.scenario-card h4,
.preset-card h4,
.diagnostic-card h4 {
  margin: 0;
  font-family: var(--heading-font);
  font-weight: 600;
  color: var(--rl-navy);
}

/* ══════════════════════════════════════════════════
   HERO PANEL — Dark Navy, Gold Typography
   ══════════════════════════════════════════════════ */

.hero-panel {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 32px;
  padding: 32px 36px;
  border-radius: 20px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(11, 45, 91, 0.95) 0%, rgba(4, 30, 66, 0.98) 50%, rgba(22, 61, 110, 0.90) 100%);
  border: 1px solid rgba(184, 146, 106, 0.12);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.12),
    0 16px 48px rgba(0, 0, 0, 0.16);
  color: var(--ink-on-dark);
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 8% 30%, rgba(184, 146, 106, 0.10), transparent 50%),
    radial-gradient(ellipse at 92% 70%, rgba(184, 146, 106, 0.05), transparent 40%);
  pointer-events: none;
}

.hero-panel::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 36px;
  right: 36px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--rl-gold), transparent);
  opacity: 0.25;
}

.hero-panel.compact { padding: 26px 32px; }

.dashboard-hero { min-height: 180px; }

.hero-copy, .hero-meta { position: relative; z-index: 1; }
.hero-copy { max-width: 820px; }

.hero-copy h2 {
  margin: 0;
  font-family: var(--heading-font);
  font-size: clamp(1.8rem, 2.8vw, 2.8rem);
  line-height: 1.1;
  margin-bottom: 10px;
  color: #fff;
  font-weight: 500;
}

.hero-panel .eyebrow { color: var(--rl-gold); }

.lede { color: var(--muted); line-height: 1.7; }
.hero-panel .lede { color: var(--muted-on-dark); margin: 0; }

.hero-signal-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.signal-chip {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(184, 146, 106, 0.14);
  background: rgba(255, 255, 255, 0.05);
}

.signal-chip span { font-size: 0.75rem; }

.hero-panel .signal-chip span { color: var(--muted-on-dark); }
.hero-panel .signal-chip strong { color: var(--rl-gold-light); display: block; margin-top: 2px; font-size: 0.9rem; }

.hero-meta-stack {
  display: grid;
  gap: 10px;
  min-width: 240px;
  align-content: start;
}

.meta-block,
.summary-row,
.artifact-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.meta-block span, .summary-row span { color: var(--muted); font-size: 0.8rem; font-weight: 500; }
.meta-block strong, .summary-row strong { display: block; margin-top: 1px; color: var(--ink); font-size: 0.88rem; }

.hero-panel .meta-block span { color: var(--muted-on-dark); }
.hero-panel .meta-block strong { color: rgba(255, 255, 255, 0.88); }

/* ══════════════════════════════════════════════════
   DASHBOARD — Full Width, No Sidebar
   ══════════════════════════════════════════════════ */

.dashboard-flow {
  display: grid;
  gap: 20px;
}

/* KPI Metric Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.metric-card {
  padding: 20px 22px;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 200ms ease, transform 200ms ease;
}

.metric-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.metric-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 8px;
}

.metric-card h3 {
  font-size: clamp(1.4rem, 2vw, 2rem);
  margin-bottom: 6px;
  color: var(--rl-navy);
}

.metric-detail {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* Accent bar at top of metric cards */
.metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 22px;
  right: 22px;
  height: 2px;
  background: linear-gradient(90deg, var(--rl-gold), var(--rl-gold-pale));
  opacity: 0.5;
}

/* ── Panels ── */

.panel {
  padding: 24px;
  border-radius: 16px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
}

.panel h3 { font-size: 1.2rem; }

.panel-note {
  max-width: 400px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

/* ── Spotlight & Valuation ── */

.spotlight-valuation-row {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 14px;
}

.panel-spotlight {
  border-left: 3px solid var(--rl-gold);
}

.spotlight-main {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.spotlight-label {
  display: block;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
}

.spotlight-value {
  font-family: var(--heading-font);
  font-size: clamp(2.2rem, 3.5vw, 3.2rem);
  line-height: 1;
  color: var(--rl-navy);
  font-weight: 600;
}

.spotlight-copy {
  margin: 0;
  max-width: 56ch;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.65;
}

.mini-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.mini-stat-card {
  padding: 14px;
  border-radius: 12px;
  background: var(--rl-cream);
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow: none;
}

.mini-stat-card span { color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.mini-stat-card strong {
  display: block;
  margin: 6px 0 4px;
  font-family: var(--heading-font);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--rl-navy);
}
.mini-stat-card small { color: var(--muted); font-size: 0.78rem; line-height: 1.5; }

.valuation-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.valuation-card {
  padding: 16px;
  border-radius: 12px;
  background: var(--rl-cream);
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow: none;
}

.valuation-card span { color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.valuation-card strong {
  display: block;
  margin: 8px 0 6px;
  font-family: var(--heading-font);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--rl-navy);
}
.valuation-card small { color: var(--muted); font-size: 0.78rem; line-height: 1.5; }

/* ── Charts ── */

.chart-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 12px;
  color: var(--muted-strong);
  font-size: 0.82rem;
}

.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
}

.legend-dot.actual { background: var(--rl-navy); }
.legend-dot.forecast { background: var(--rl-gold); }
.legend-dot.muted { background: rgba(4, 30, 66, 0.28); }

.chart-shell {
  min-height: 280px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  background: var(--rl-cream);
  padding: 14px;
}

.chart-shell svg { width: 100%; height: auto; display: block; }

.chart-shell-placeholder {
  display: grid;
  place-items: center;
}

.chart-placeholder {
  max-width: 28rem;
  text-align: center;
  display: grid;
  gap: 8px;
  padding: 20px;
}

.chart-placeholder strong {
  font-family: var(--heading-font);
  font-size: 1.3rem;
  color: var(--rl-navy);
}

.chart-placeholder p { margin: 0; color: var(--muted); line-height: 1.6; font-size: 0.88rem; }
.chart-empty { margin: 0; color: var(--muted); }

.chart-label { fill: var(--muted); font-family: var(--mono-font); font-size: 11px; }
.chart-value { fill: var(--rl-navy); font-family: var(--mono-font); font-size: 11px; font-weight: 700; }
.chart-grid { stroke: rgba(4, 30, 66, 0.07); stroke-width: 1; }
.chart-divider { stroke: rgba(184, 146, 106, 0.4); stroke-width: 1.5; stroke-dasharray: 6 6; }
.chart-divider-label {
  fill: var(--rl-gold-deep);
  font-family: var(--body-font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ══════════════════════════════════════════════════
   SCENARIOS
   ══════════════════════════════════════════════════ */

.scenario-card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.scenario-card {
  padding: 20px;
  border-radius: 16px;
  transition: box-shadow 200ms ease, transform 200ms ease;
}

.scenario-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.scenario-card.is-active {
  border-color: var(--rl-gold);
  border-left: 3px solid var(--rl-gold);
  box-shadow: var(--shadow-gold), var(--shadow-card);
}

.scenario-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.scenario-card-top h4 { font-size: 1.05rem; }

.scenario-card-value {
  margin: 16px 0 14px;
  font-family: var(--heading-font);
  font-size: clamp(1.7rem, 2.4vw, 2.2rem);
  line-height: 1;
  font-weight: 600;
  color: var(--rl-navy);
}

.scenario-card-stats, .forecast-card-stats { display: grid; gap: 10px; }
.scenario-card-stats { grid-template-columns: repeat(2, 1fr); }

.scenario-card-stats span, .forecast-card-stats span { color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.scenario-card-stats strong, .forecast-card-stats strong { display: block; margin-top: 3px; color: var(--ink); }

.scenario-card-stats div, .forecast-card-stats div {
  padding-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* ── Forecast Cards ── */

.forecast-card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.forecast-card {
  padding: 20px;
  border-radius: 16px;
  transition: box-shadow 200ms ease, transform 200ms ease;
}

.forecast-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.forecast-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.forecast-card-top span { color: var(--muted); font-size: 0.75rem; font-weight: 600; }

.forecast-card-main {
  margin: 14px 0 8px;
  font-family: var(--heading-font);
  font-size: clamp(1.6rem, 2.2vw, 2rem);
  line-height: 1;
  font-weight: 600;
  color: var(--rl-navy);
}

.forecast-card-subtitle { margin: 0 0 14px; color: var(--muted); font-size: 0.85rem; line-height: 1.55; }
.forecast-card-stats { grid-template-columns: repeat(3, 1fr); }

/* ══════════════════════════════════════════════════
   BOTTOM STRIP — Compact Integration Status
   ══════════════════════════════════════════════════ */

.bottom-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.strip-card {
  background: var(--surface-subtle);
  border: 1px solid var(--border-on-dark);
  border-radius: 14px;
  padding: 20px 22px;
  color: var(--ink-on-dark);
}

.strip-card .eyebrow { color: var(--rl-gold); }
.strip-card h3 {
  margin: 0;
  font-family: var(--heading-font);
  font-weight: 600;
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.88);
  margin-bottom: 12px;
}

.strip-items {
  display: grid;
  gap: 8px;
}

.strip-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.strip-item:last-child { border-bottom: none; }
.strip-item span { color: var(--muted-on-dark); font-size: 0.8rem; }
.strip-item strong { color: rgba(255, 255, 255, 0.7); font-size: 0.85rem; }

/* ══════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════ */

.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  background: var(--rl-cream);
}

table { width: 100%; border-collapse: collapse; }

th, td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  white-space: nowrap;
}

th {
  color: var(--rl-gold-deep);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.02);
}

tbody tr:hover { background: rgba(184, 146, 106, 0.04); }

.empty-table-row td {
  color: var(--muted);
  text-align: center;
  white-space: normal;
  padding: 24px 16px;
  font-style: italic;
  font-size: 0.88rem;
}

/* ══════════════════════════════════════════════════
   FORMS & CONTROLS
   ══════════════════════════════════════════════════ */

.control-panel { position: sticky; top: 16px; }

.assumption-form, .field-grid, .shell-field-grid,
.summary-list, .note-stack, .run-stack,
.diagnostic-list, .artifact-list {
  display: grid;
  gap: 12px;
}

.field-grid { grid-template-columns: repeat(2, 1fr); }
.shell-field-grid { grid-template-columns: repeat(2, 1fr); }

.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: 0.85rem; }
.field small { color: var(--muted); font-size: 0.78rem; line-height: 1.5; }

.shell-field {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 12px;
  background: var(--rl-cream);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.shell-field span { color: var(--muted); font-weight: 600; font-size: 0.78rem; }
.shell-field strong { font-family: var(--heading-font); font-size: 1.05rem; color: var(--rl-navy); }
.shell-field small { color: var(--muted); font-size: 0.78rem; line-height: 1.5; }

input[type="text"], input[type="number"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  background: var(--rl-cream);
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

input:hover { border-color: rgba(0, 0, 0, 0.14); }
input:focus {
  outline: none;
  border-color: var(--rl-gold);
  box-shadow: 0 0 0 3px rgba(184, 146, 106, 0.10);
}

.input-with-suffix { position: relative; }
.input-with-suffix span {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-weight: 700; color: var(--muted); font-size: 0.82rem;
}
.input-with-suffix input { padding-right: 54px; }

/* ── Buttons ── */

.button-primary, .button-secondary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.button-primary {
  color: var(--rl-cream);
  background: var(--rl-navy);
  box-shadow: 0 4px 12px rgba(4, 30, 66, 0.20);
}

.button-secondary {
  color: var(--rl-navy);
  background: rgba(4, 30, 66, 0.05);
  border: 1px solid rgba(4, 30, 66, 0.10);
}

.button-primary:hover, .button-secondary:hover {
  transform: translateY(-1px);
}

.button-primary:hover { box-shadow: 0 8px 20px rgba(4, 30, 66, 0.28); }

/* ── Summary & Run Cards ── */

.summary-row {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.run-card, .preset-card, .diagnostic-card {
  border-radius: 14px;
  padding: 16px;
}

.run-card { display: flex; justify-content: space-between; gap: 12px; }
.diagnostic-top { display: flex; justify-content: space-between; gap: 12px; }

.run-card p, .run-card small, .diagnostic-card p { margin: 0; color: var(--muted); font-size: 0.85rem; }

.run-card-placeholder { background: var(--rl-cream); }

.run-meta { display: grid; justify-items: end; gap: 6px; }

/* ── Presets ── */

.preset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.preset-card {
  display: grid;
  gap: 14px;
  background: var(--surface);
}

.preset-card.is-active {
  border-color: var(--rl-gold);
  box-shadow: var(--shadow-gold);
}

.preset-metrics { display: flex; flex-wrap: wrap; gap: 6px; }
.preset-metrics span {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 9px; border-radius: 999px;
  background: var(--rl-cream); font-size: 0.78rem; font-weight: 500;
  color: var(--muted-strong);
}

/* ── Posture Grid ── */

.posture-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.posture-card {
  padding: 14px;
  border-radius: 12px;
  background: var(--rl-cream);
  box-shadow: none;
}

.posture-card span { color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.posture-card strong {
  display: block;
  margin-top: 8px;
  font-family: var(--heading-font);
  font-size: 1.5rem;
  line-height: 1;
  font-weight: 600;
  color: var(--rl-navy);
}

/* ══════════════════════════════════════════════════
   DIAGNOSTICS
   ══════════════════════════════════════════════════ */

.status-band {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.status-card {
  padding: 18px;
  border-radius: 14px;
}

.status-card span { color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.status-card strong {
  display: block;
  margin: 8px 0 6px;
  font-family: var(--heading-font);
  font-size: 1.8rem;
  line-height: 1;
  font-weight: 600;
  color: var(--rl-navy);
}
.status-card small { color: var(--muted); font-size: 0.78rem; line-height: 1.5; }

.diagnostics-layout {
  display: grid;
  grid-template-columns: 1.45fr 0.92fr;
  gap: 14px;
  align-items: start;
}

.diagnostics-layout > .panel:first-child { grid-row: 1 / span 2; }

.diagnostic-card {
  background: var(--surface);
  transition: transform 180ms ease;
}

.diagnostic-card:hover { transform: translateY(-1px); }

.diagnostic-card.pass { border-left: 3px solid var(--pass); }
.diagnostic-card.watch { border-left: 3px solid var(--watch); }
.diagnostic-card.fail { border-left: 3px solid var(--fail); }

.artifact-row {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--rl-cream);
}

.artifact-row code {
  display: inline-block;
  max-width: 66%;
  overflow-wrap: anywhere;
  color: var(--rl-navy);
  font-family: var(--mono-font);
  font-size: 0.82rem;
}

.artifact-row span { color: var(--muted); font-size: 0.8rem; }

.note-stack p { margin: 0; color: var(--muted); line-height: 1.65; font-size: 0.88rem; }

/* ══════════════════════════════════════════════════
   SCENARIO LAYOUT (scenarios page)
   ══════════════════════════════════════════════════ */

.scenario-layout {
  display: grid;
  grid-template-columns: 1.7fr 0.92fr;
  gap: 14px;
}

.scenario-main, .scenario-side { display: grid; gap: 14px; }

/* ══════════════════════════════════════════════════
   MINI PROJECTS
   ══════════════════════════════════════════════════ */

.mini-project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.mini-project-card, .notebook-panel { display: grid; gap: 14px; }

.mini-card-top, .mini-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.mini-card-actions { align-items: center; flex-wrap: wrap; }

.mini-preview {
  min-height: 260px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  background: var(--rl-cream);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.mini-chart-stack {
  display: grid;
  gap: 12px;
  width: 100%;
  padding: 16px;
}

.mini-chart-copy { display: grid; gap: 4px; }
.mini-chart-copy strong { font-family: var(--heading-font); font-size: 1.05rem; font-weight: 600; }
.mini-chart-copy p, .mini-chart-note { margin: 0; color: var(--muted); font-size: 0.82rem; line-height: 1.5; }
.mini-chart-meta { display: grid; gap: 10px; }

.mini-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted-strong);
  font-size: 0.8rem;
}

.mini-legend span { display: inline-flex; align-items: center; gap: 7px; }
.mini-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 999px; }

.module-chart-shell { min-height: 300px; }
.module-chart-shell.detail { min-height: 340px; }

.chart-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 0 10px;
}

.chart-marker-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(184, 146, 106, 0.14);
  color: var(--rl-gold-deep);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.chart-marker-chip strong {
  color: var(--rl-navy);
}

.unit-chip {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(4, 30, 66, 0.07);
  color: var(--rl-navy);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

.scenario-row-note {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.35;
}

.mini-preview img { display: block; width: 100%; height: auto; }
.mini-preview.is-html { align-items: stretch; }

.mini-preview-html {
  width: 100%;
  max-height: 300px;
  overflow: auto;
  padding: 16px;
  color: var(--ink);
}

.mini-preview-html table, .mini-preview-html .dataframe {
  width: 100%;
  display: block;
  overflow-x: auto;
}

.mini-preview-empty {
  display: grid;
  gap: 8px;
  padding: 24px;
  text-align: left;
}

.mini-preview-empty strong { font-family: var(--heading-font); font-size: 1.1rem; font-weight: 600; }
.mini-preview-empty p { margin: 0; color: var(--muted); line-height: 1.6; font-size: 0.85rem; }

.mini-metric-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.mini-metric {
  padding: 12px;
  border-radius: 10px;
  background: var(--rl-cream);
}

.mini-metric span { color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.mini-metric strong {
  display: block;
  margin-top: 4px;
  font-family: var(--heading-font);
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 600;
  color: var(--rl-navy);
}

.mini-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

.mini-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(184, 146, 106, 0.06);
  border: 1px solid rgba(184, 146, 106, 0.12);
  color: var(--rl-gold-deep);
  font-size: 0.78rem;
  font-weight: 600;
}

.mini-paths { display: grid; gap: 8px; }

.mini-path-card {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--rl-cream);
}

.mini-path-card.inline { gap: 3px; }
.mini-path-card span { color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.mini-path-card strong, .mini-path-card code { overflow-wrap: anywhere; }
.mini-path-card code {
  color: var(--rl-navy);
  font-family: var(--mono-font);
  font-size: 0.8rem;
  white-space: pre-wrap;
}

.mini-detail-layout {
  display: grid;
  grid-template-columns: 0.92fr 1.18fr;
  gap: 14px;
  align-items: start;
}

.mini-detail-side { display: grid; gap: 14px; }

.notebook-frame-shell {
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  background: var(--surface);
  overflow: hidden;
}

.notebook-iframe {
  display: block;
  width: 100%;
  min-height: 75vh;
  border: 0;
  background: transparent;
}

/* ══════════════════════════════════════════════════
   FOOTER — On Dark Surface
   ══════════════════════════════════════════════════ */

.site-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border-on-dark);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 12px 0 20px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted-on-dark);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.footer-wordmark {
  height: 16px;
  width: auto;
  color: rgba(255, 255, 255, 0.65);
  margin-right: 8px;
}

.footer-note {
  color: var(--muted-on-dark);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  font-weight: 500;
}

/* ══════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════ */

@media (max-width: 1280px) {
  .card-grid, .forecast-card-grid { grid-template-columns: repeat(2, 1fr); }
  .scenario-card-grid, .preset-grid, .status-band, .mini-project-grid { grid-template-columns: repeat(2, 1fr); }
  .spotlight-valuation-row { grid-template-columns: 1fr; }
  .bottom-strip { grid-template-columns: 1fr; }
}

@media (max-width: 1120px) {
  .scenario-layout, .diagnostics-layout, .chart-row, .mini-detail-layout { grid-template-columns: 1fr; }
  .diagnostics-layout > .panel:first-child { grid-row: auto; }
  .control-panel { position: static; }
}

@media (max-width: 900px) {
  .page-shell { padding: 16px; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .topbar-actions { width: 100%; flex-direction: column; align-items: flex-start; gap: 10px; }
  .topnav { flex-wrap: wrap; }
  .hero-panel, .hero-panel.compact { flex-direction: column; padding: 24px; }
  .panel-head { flex-direction: column; }
  .hero-copy h2 { font-size: 1.8rem; }

  .card-grid, .scenario-card-grid, .forecast-card-grid,
  .preset-grid, .status-band, .posture-grid,
  .field-grid, .shell-field-grid, .mini-stat-grid,
  .valuation-grid, .mini-project-grid, .mini-metric-row,
  .bottom-strip { grid-template-columns: 1fr; }

  .forecast-card-stats, .scenario-card-stats { grid-template-columns: 1fr; }
  .mini-card-top, .mini-card-actions { flex-direction: column; align-items: stretch; }
  .artifact-row { grid-template-columns: 1fr; }
  .artifact-row code { max-width: 100%; }
  .footer-inner { flex-direction: column; text-align: center; gap: 8px; }
}

@media (max-width: 640px) {
  .page-shell { padding: 12px; }
  .hero-panel, .panel, .metric-card { padding: 18px; }
  .brand-wordmark { height: 32px; padding-right: 12px; }
  .brand-wordmark svg { height: 24px; }
  .hero-copy h2 { font-size: 1.5rem; }
  .signal-chip, .topbar-status { width: 100%; }
  .chart-shell { padding: 10px; min-height: 220px; }
  th, td { padding: 10px; }
}

.dashboard-split {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(280px, 1fr);
  gap: 16px;
}

.dashboard-side-stack {
  display: grid;
  gap: 16px;
  align-content: start;
}

.valuation-form {
  display: grid;
  gap: 14px;
}

.top-gap {
  margin-top: 14px;
}

.summary-row.wide {
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
}

.empty-state {
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(4, 30, 66, 0.04);
  border: 1px dashed rgba(4, 30, 66, 0.15);
}

.empty-state strong {
  font-family: var(--heading-font);
  color: var(--rl-navy);
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 1080px) {
  .dashboard-split {
    grid-template-columns: 1fr;
  }
}

.command-center-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.95fr) minmax(0, 1.45fr);
  gap: 18px;
  align-items: start;
}

.assumption-studio-panel {
  position: sticky;
  top: 18px;
}

.assumption-studio-form {
  display: grid;
  gap: 18px;
}

.assumption-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(4, 30, 66, 0.025) 0%, rgba(184, 146, 106, 0.045) 100%);
  border: 1px solid rgba(4, 30, 66, 0.06);
}

.assumption-section-head h4,
.scenario-control-card h5 {
  margin: 0;
  font-family: var(--heading-font);
  color: var(--rl-navy);
}

.assumption-section-head h4 {
  font-size: 1.15rem;
}

.assumption-section-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.88rem;
}

.scenario-control-card h5 {
  font-size: 1rem;
  line-height: 1.35;
}

.scenario-control-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.field-grid.compact {
  gap: 10px;
}

.field-grid.three-up {
  grid-template-columns: repeat(3, 1fr);
}

.field-grid.two-up {
  grid-template-columns: repeat(2, 1fr);
}

.scenario-control-grid {
  display: grid;
  gap: 12px;
}

.scenario-control-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(4, 30, 66, 0.07);
}

.advanced-toggle {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(4, 30, 66, 0.08);
}

.advanced-toggle summary {
  cursor: pointer;
  color: var(--rl-navy);
  font-weight: 700;
  font-size: 0.84rem;
  letter-spacing: 0.02em;
}

.advanced-grid {
  grid-template-columns: repeat(2, 1fr);
}

.assumption-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.driver-spotlight-stack {
  display: grid;
  gap: 18px;
}

.driver-focus-note {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(4, 30, 66, 0.03) 0%, rgba(184, 146, 106, 0.08) 100%);
  border: 1px solid rgba(4, 30, 66, 0.08);
  color: var(--muted);
  line-height: 1.6;
}

.driver-focus-note strong {
  color: var(--rl-navy);
  font-family: var(--heading-font);
  margin-right: 4px;
}

.driver-logic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.driver-logic-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(4, 30, 66, 0.08);
}

.driver-logic-card.base {
  border-top: 4px solid #041E42;
}

.driver-logic-card.bear {
  border-top: 4px solid #8C4B2A;
}

.driver-logic-card.bull {
  border-top: 4px solid #1B7A52;
}

.driver-logic-card h4 {
  margin: 0;
  font-family: var(--heading-font);
  color: var(--rl-navy);
  font-size: 1.05rem;
  line-height: 1.35;
}

.driver-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.driver-stat-grid div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(4, 30, 66, 0.025);
  border: 1px solid rgba(4, 30, 66, 0.06);
}

.driver-stat-grid span {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.driver-stat-grid strong {
  color: var(--rl-navy);
  font-size: 1rem;
}

.chart-row.prominent {
  grid-template-columns: repeat(2, 1fr);
}

.spotlight-panel {
  overflow: hidden;
}

.spotlight-chart {
  min-height: 360px;
  background:
    radial-gradient(circle at top right, rgba(184, 146, 106, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(4, 30, 66, 0.015), rgba(4, 30, 66, 0.03));
  border: 1px solid rgba(4, 30, 66, 0.04);
}

.inline-override {
  display: block;
  color: var(--watch);
  font-size: 0.74rem;
  font-weight: 500;
}

.empty-state.compact {
  padding: 14px 16px;
}

@media (max-width: 1280px) {
  .command-center-grid {
    grid-template-columns: 1fr;
  }

  .assumption-studio-panel {
    position: static;
  }
}

@media (max-width: 960px) {
  .field-grid.three-up,
  .field-grid.two-up,
  .advanced-grid,
  .driver-logic-grid,
  .driver-stat-grid,
  .chart-row.prominent {
    grid-template-columns: 1fr;
  }

  .scenario-control-top,
  .assumption-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ══════════════════════════════════════════════════
   KPI STRIP — Sticky headline metrics
   ══════════════════════════════════════════════════ */

.kpi-strip {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 22px 0 28px;
  padding: 14px;
  border-radius: 20px;
  background: linear-gradient(
    180deg,
    rgba(11, 45, 91, 0.92) 0%,
    rgba(4, 30, 66, 0.92) 100%
  );
  border: 1px solid rgba(184, 146, 106, 0.22);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.28),
    0 1px 0 rgba(255, 255, 255, 0.04) inset;
  backdrop-filter: saturate(140%) blur(6px);
}

.kpi-card {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(184, 146, 106, 0.12);
  color: var(--ink-on-dark);
}

.kpi-card-accent {
  background: linear-gradient(
    135deg,
    rgba(184, 146, 106, 0.22) 0%,
    rgba(184, 146, 106, 0.08) 100%
  );
  border-color: rgba(184, 146, 106, 0.45);
}

.kpi-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--rl-gold-light);
}

.kpi-value {
  font-family: var(--heading-font);
  font-weight: 600;
  font-size: 1.55rem;
  line-height: 1.1;
  color: var(--rl-white);
  letter-spacing: 0.005em;
}

.kpi-subvalue {
  font-family: var(--heading-font);
  font-size: 0.96rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--rl-gold-light);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.kpi-card-accent .kpi-subvalue {
  color: rgba(255, 255, 255, 0.82);
}

.kpi-detail {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.02em;
}

/* ══════════════════════════════════════════════════
   ASSUMPTION STUDIO — Horizontal, full-width card
   ══════════════════════════════════════════════════ */

.assumption-studio-wide {
  display: grid;
  gap: 18px;
  margin-bottom: 24px;
}

.studio-grid-3col {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 5fr) minmax(0, 4fr);
  gap: 16px;
  align-items: start;
}

.studio-grid-3col .assumption-section {
  height: 100%;
}

.studio-col-income .slider-stack-2col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.studio-col-scenario .scenario-matrix {
  padding: 8px;
}

.studio-col-scenario .scenario-matrix-head,
.studio-col-scenario .scenario-matrix-row {
  grid-template-columns: 38px repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.studio-col-scenario .scenario-matrix-row-label {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
}

/* Matrix cells: label hidden (row + column already identify the field),
   echo becomes the big readout, number input fills the cell width. */

.scenario-matrix-cell .slider-field {
  padding: 6px 8px;
  gap: 4px;
  min-width: 0;
}

.scenario-matrix-cell .slider-field-head {
  display: block;
  overflow: hidden;
}

.scenario-matrix-cell .slider-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.scenario-matrix-cell .slider-value {
  display: block;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--rl-navy);
}

.scenario-matrix-cell .slider-foot {
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
}

.scenario-matrix-cell .slider-number {
  width: 100%;
  text-align: center;
  padding: 4px 6px;
}

.scenario-matrix-cell .slider-foot small {
  text-align: center;
  font-size: 0.64rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scenario-matrix-cell .slider-field.is-dirty .slider-value {
  color: var(--watch);
}

/* Studio footer: override chips + reset button */

.studio-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(4, 30, 66, 0.03) 0%, rgba(184, 146, 106, 0.05) 100%);
  border: 1px solid rgba(4, 30, 66, 0.07);
}

.studio-override-band {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.studio-override-band .eyebrow {
  margin: 0;
}

.studio-override-empty {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}

.studio-override-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.override-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(184, 146, 106, 0.35);
  font-size: 0.74rem;
  color: var(--rl-navy);
}

.override-chip strong {
  font-family: var(--mono-font);
  color: var(--watch);
  font-weight: 700;
}

.override-chip em {
  font-style: normal;
  color: var(--muted);
  font-size: 0.68rem;
}

.override-chip.scenario-base { border-color: #041E42; }
.override-chip.scenario-downside { border-color: #8C4B2A; }
.override-chip.scenario-upside { border-color: #1B7A52; }

.studio-reset-form {
  margin: 0;
}

.full-width-stack {
  margin-bottom: 24px;
}

/* Legacy rail classes (kept for compatibility, no-op in horizontal mode) */

.rail-reset-form { margin-top: 12px; }
.override-summary-block { margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(4, 30, 66, 0.08); }

/* ══════════════════════════════════════════════════
   SLIDER FIELD — Range + number twin with live echo
   ══════════════════════════════════════════════════ */

.slider-stack {
  display: grid;
  gap: 14px;
}

.slider-stack-2col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.slider-field {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(4, 30, 66, 0.05);
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.slider-field.is-dirty {
  background: rgba(184, 146, 106, 0.08);
  border-color: rgba(184, 146, 106, 0.55);
  box-shadow: 0 0 0 1px rgba(184, 146, 106, 0.3);
}

.slider-field-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 0.78rem;
}

.slider-label {
  font-weight: 700;
  color: var(--rl-navy);
  letter-spacing: 0.02em;
}

.slider-value {
  font-family: var(--mono-font);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--rl-gold-deep);
  letter-spacing: 0.01em;
}

.slider-field.is-dirty .slider-value {
  color: var(--watch);
}

.slider-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(4, 30, 66, 0.14) 0%,
    rgba(4, 30, 66, 0.08) 100%
  );
  outline: none;
  cursor: ew-resize;
}

.slider-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--rl-gold);
  border: 2px solid var(--rl-cream);
  box-shadow:
    0 2px 6px rgba(4, 30, 66, 0.24),
    0 0 0 1px rgba(4, 30, 66, 0.08);
  cursor: ew-resize;
  transition: transform 100ms ease, box-shadow 120ms ease;
}

.slider-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--rl-gold);
  border: 2px solid var(--rl-cream);
  box-shadow: 0 2px 6px rgba(4, 30, 66, 0.24);
  cursor: ew-resize;
}

.slider-range::-webkit-slider-thumb:hover,
.slider-range:focus-visible::-webkit-slider-thumb {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(184, 146, 106, 0.45);
}

.slider-range:focus-visible {
  outline: 2px solid rgba(184, 146, 106, 0.5);
  outline-offset: 3px;
  border-radius: 999px;
}

.slider-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.slider-number {
  width: 96px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(4, 30, 66, 0.12);
  background: var(--rl-white);
  font-family: var(--mono-font);
  font-size: 0.78rem;
  color: var(--ink);
  text-align: right;
}

.slider-number:focus {
  outline: none;
  border-color: var(--rl-gold);
  box-shadow: 0 0 0 3px rgba(184, 146, 106, 0.2);
}

.slider-foot small {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}

.slider-field-compact {
  padding: 8px 10px;
}

.slider-field-compact .slider-label {
  font-size: 0.72rem;
}

.slider-field-compact .slider-number {
  width: 82px;
  font-size: 0.72rem;
}

/* ══════════════════════════════════════════════════
   SCENARIO MATRIX — 1 row per shock × 3 scenarios
   ══════════════════════════════════════════════════ */

.scenario-matrix {
  display: grid;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(4, 30, 66, 0.07);
}

.scenario-matrix-head,
.scenario-matrix-row {
  display: grid;
  grid-template-columns: 90px repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}

.scenario-matrix-head span {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 2px 4px;
}

.scenario-matrix-head-cell.scenario-base { color: #041E42; }
.scenario-matrix-head-cell.scenario-downside { color: #8C4B2A; }
.scenario-matrix-head-cell.scenario-upside { color: #1B7A52; }

.scenario-matrix-row-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--rl-navy);
}

.scenario-matrix-cell .slider-field {
  background: var(--rl-white);
}

.advanced-scenario-block {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(4, 30, 66, 0.06);
}

.advanced-scenario-block .eyebrow {
  letter-spacing: 0.18em;
}

.advanced-scenario-block .eyebrow.scenario-base { color: #041E42; }
.advanced-scenario-block .eyebrow.scenario-downside { color: #8C4B2A; }
.advanced-scenario-block .eyebrow.scenario-upside { color: #1B7A52; }

/* ══════════════════════════════════════════════════
   APPLY BAR — Floating bottom-right commit affordance
   ══════════════════════════════════════════════════ */

.apply-bar {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #041E42 0%, #0B2D5B 100%);
  color: var(--rl-white);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(184, 146, 106, 0.32);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
}

.apply-bar.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.apply-bar[hidden] {
  display: none;
}

.apply-bar-count {
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.85);
  padding: 0 6px;
}

.apply-bar-count-value {
  font-family: var(--mono-font);
  font-size: 0.95rem;
  color: var(--rl-gold-light);
  margin-right: 4px;
}

.apply-bar .button-primary {
  background: var(--rl-gold);
  color: var(--rl-navy-deep);
  box-shadow: 0 6px 16px rgba(184, 146, 106, 0.35);
}

.apply-bar .button-primary:hover {
  background: var(--rl-gold-light);
  box-shadow: 0 8px 22px rgba(184, 146, 106, 0.5);
}

.button-ghost {
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 8px 14px;
  border-radius: 999px;
  font-family: var(--body-font);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.button-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(184, 146, 106, 0.35);
  color: var(--rl-white);
}

.button-block {
  display: block;
  width: 100%;
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(4, 30, 66, 0.08);
  border: 1px solid rgba(4, 30, 66, 0.12);
  font-family: var(--mono-font);
  font-size: 0.72rem;
  color: var(--rl-navy);
}

/* ══════════════════════════════════════════════════
   CHART INTERACTIVITY — tooltip, cursor, legend, focus
   ══════════════════════════════════════════════════ */

.chart-shell {
  position: relative;
}

.chart-hit-area {
  cursor: crosshair;
}

.chart-cursor {
  stroke: rgba(4, 30, 66, 0.35);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.chart-tooltip {
  position: absolute;
  transform: translate(14px, -4px);
  min-width: 200px;
  padding: 10px 12px 10px 12px;
  border-radius: 12px;
  background: rgba(4, 30, 66, 0.97);
  color: var(--rl-white);
  font-size: 0.76rem;
  box-shadow:
    0 18px 36px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(184, 146, 106, 0.3);
  pointer-events: none;
  z-index: 5;
  backdrop-filter: saturate(140%);
}

.chart-tooltip[hidden] {
  display: none;
}

.chart-tooltip-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 8px;
}

.chart-tooltip-label {
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--rl-gold-light);
}

.chart-tooltip-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.chart-tooltip-badge-forecast {
  background: rgba(184, 146, 106, 0.22);
  color: var(--rl-gold-light);
}

.chart-tooltip-badge-actual {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.75);
}

.chart-tooltip-row {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  transition: color 120ms ease;
}

.chart-tooltip-row i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
}

.chart-tooltip-row strong {
  font-family: var(--mono-font);
  color: var(--rl-white);
  font-weight: 600;
}

.chart-tooltip-row.is-top strong {
  color: var(--rl-gold-light);
}

.chart-tooltip-delta {
  font-family: var(--mono-font);
  font-size: 0.66rem;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.chart-tooltip-delta.is-up {
  background: rgba(34, 135, 94, 0.24);
  color: #7DDFAA;
}

.chart-tooltip-delta.is-down {
  background: rgba(192, 58, 58, 0.22);
  color: #FF9A9A;
}

.chart-area-fill {
  transition: opacity 220ms ease;
  pointer-events: none;
}

.chart-pin {
  transition: opacity 180ms ease;
  pointer-events: none;
}

.chart-line {
  transition: stroke-width 160ms ease, opacity 180ms ease;
}

.chart-series:hover .chart-line {
  stroke-width: 3.4;
}

.chart-dot {
  transition: opacity 180ms ease;
}

.chart-series {
  transition: opacity 180ms ease, stroke-width 180ms ease;
}

.chart-series.is-focused path {
  stroke-width: 4 !important;
}

.chart-series.is-focused circle {
  r: 5;
}

.chart-series.is-dimmed {
  opacity: 0.3;
}

/* Grouped-bar histogram mode — shares focus/dim with line charts above. */
.chart-bar {
  opacity: 0.9;
  transition: opacity 160ms ease, filter 160ms ease;
}

.chart-series.is-focused .chart-bar {
  opacity: 1;
  filter: drop-shadow(0 2px 4px rgba(4, 30, 66, 0.14));
}

.chart-series-bars:hover .chart-bar {
  opacity: 1;
}

/* ── Legend chips: buttons with pressed state ── */

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(4, 30, 66, 0.1);
  background: rgba(255, 255, 255, 0.6);
  color: var(--rl-navy);
  font-family: var(--body-font);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: opacity 150ms ease, background 150ms ease, border-color 150ms ease;
}

.legend-chip i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.legend-chip[aria-pressed="false"],
.legend-chip.is-off {
  opacity: 0.4;
  background: rgba(255, 255, 255, 0.3);
  text-decoration: line-through;
}

.legend-chip:hover {
  border-color: rgba(184, 146, 106, 0.4);
  background: rgba(255, 255, 255, 0.9);
}

.legend-chip:focus-visible {
  outline: 2px solid rgba(184, 146, 106, 0.55);
  outline-offset: 2px;
}

/* ── Scenario focus buttons ── */

button.scenario-focus-button {
  appearance: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: inherit;
  border: 1px solid rgba(4, 30, 66, 0.08);
  background: var(--surface);
  transition: opacity 180ms ease, transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

button.scenario-focus-button:focus-visible {
  outline: 2px solid rgba(184, 146, 106, 0.55);
  outline-offset: 3px;
}

button.scenario-focus-button.is-focused {
  box-shadow:
    0 0 0 2px rgba(184, 146, 106, 0.5),
    0 16px 36px rgba(184, 146, 106, 0.18);
  transform: translateY(-1px);
}

button.scenario-focus-button.is-dimmed {
  opacity: 0.55;
}

button.driver-logic-card {
  width: 100%;
}

/* ══════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════ */

@media (max-width: 1180px) {
  .studio-grid-3col {
    grid-template-columns: 1fr 1fr;
  }

  .studio-col-scenario {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1024px) {
  .kpi-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .studio-grid-3col {
    grid-template-columns: 1fr;
  }

  .studio-col-scenario {
    grid-column: auto;
  }

  .scenario-matrix-head,
  .scenario-matrix-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .scenario-matrix-row-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: 0.14em;
  }

  .slider-stack-2col {
    grid-template-columns: 1fr;
  }

  .studio-footer {
    grid-template-columns: 1fr;
  }

  .apply-bar {
    right: 12px;
    bottom: 12px;
    left: 12px;
    justify-content: center;
    flex-wrap: wrap;
  }
}

@media (max-width: 680px) {
  .kpi-strip {
    grid-template-columns: 1fr;
  }
}


/* ══════════════════════════════════════════════════════════
   Live macro ticker — appears above the hero when MACRO_LIVE_MODE=true
   ══════════════════════════════════════════════════════════ */
.live-macro-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
  padding: 14px 18px;
  margin: 0 0 22px 0;
  background:
    linear-gradient(135deg, rgba(4, 30, 66, 0.96) 0%, rgba(4, 30, 66, 0.78) 100%);
  border-radius: 14px;
  color: #f5efe3;
  box-shadow: 0 8px 24px rgba(4, 30, 66, 0.18);
}

.live-macro-chip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px 11px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  min-width: 188px;
  flex: 1 1 188px;
  max-width: 240px;
  position: relative;
  transition: background 160ms ease, border-color 160ms ease;
}
.live-macro-chip.fresh   { border-color: rgba(56, 193, 114, 0.38); }
.live-macro-chip.stale   { border-color: rgba(227, 179, 36, 0.45); }
.live-macro-chip.expired { border-color: rgba(198, 85, 85, 0.55); background: rgba(198, 85, 85, 0.07); }

/* Target tile gets a subtle gold accent to read as the primary output. */
.live-macro-chip.live-macro-target {
  background: rgba(184, 146, 106, 0.12);
  border-color: rgba(184, 146, 106, 0.45);
}
.live-macro-chip.live-macro-target.expired {
  background: rgba(198, 85, 85, 0.10);
  border-color: rgba(198, 85, 85, 0.5);
}

.live-macro-chip-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.live-macro-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(245, 239, 227, 0.72);
  font-weight: 500;
}
.live-macro-value {
  font-size: 18px;
  font-weight: 600;
  font-family: "Cormorant Garamond", serif;
  letter-spacing: 0.5px;
  line-height: 1.2;
}
.live-macro-target .live-macro-value {
  color: #e8d5bf;
}
.live-macro-delta {
  font-size: 11px;
  color: rgba(245, 239, 227, 0.78);
  font-variant-numeric: tabular-nums;
}
.live-macro-freshness {
  font-size: 10px;
  color: rgba(245, 239, 227, 0.55);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.live-macro-chip.fresh   .live-macro-freshness { color: rgba(56, 193, 114, 0.82); }
.live-macro-chip.stale   .live-macro-freshness { color: rgba(227, 179, 36, 0.85); }
.live-macro-chip.expired .live-macro-freshness { color: rgba(198, 85, 85, 0.92); }

.live-macro-spark {
  width: 100%;
  height: 22px;
  margin-top: 2px;
  color: rgba(232, 213, 191, 0.55);
  overflow: visible;
}
.live-macro-spark[data-trend="up"]   { color: rgba(132, 204, 168, 0.75); }
.live-macro-spark[data-trend="down"] { color: rgba(216, 140, 140, 0.75); }

.live-macro-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(227, 179, 36, 0.12);
  border: 1px solid rgba(227, 179, 36, 0.45);
  color: #f3d77a;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.live-macro-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}
.live-macro-actions form { margin: 0; }
.live-macro-actions button {
  background: rgba(184, 146, 106, 0.85);
  color: #1c1410;
  font-size: 11px;
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.live-macro-actions button:hover { background: #c9a27a; }
.live-macro-actions .button-primary { background: #b8926a; color: #fff; }
.live-macro-actions .button-primary:hover { background: #8c6d4f; }

@media (max-width: 820px) {
  .live-macro-bar { flex-direction: column; padding: 10px; }
  .live-macro-chip { min-width: 0; }
  .live-macro-actions { margin-left: 0; }
}

/* ══════════════════════════════════════════════════════════
   Reconciliation panel — BS tie-out + CFS + FMP verification
   ══════════════════════════════════════════════════════════ */
.reconciliation-panel .recon-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.reconciliation-panel .recon-table th,
.reconciliation-panel .recon-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(4, 30, 66, 0.08);
  text-align: right;
}
.reconciliation-panel .recon-table th:first-child,
.reconciliation-panel .recon-table td:first-child {
  text-align: left;
}
.reconciliation-panel .recon-table thead {
  background: rgba(4, 30, 66, 0.06);
}
.reconciliation-panel .recon-table td.neg {
  color: #8c4b2a;
}
.reconciliation-panel .recon-schedules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.reconciliation-panel .recon-schedule table {
  width: 100%;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  border-collapse: collapse;
}
.reconciliation-panel .recon-schedule table th,
.reconciliation-panel .recon-schedule table td {
  padding: 4px 6px;
  text-align: right;
  border-bottom: 1px dotted rgba(4, 30, 66, 0.1);
}
.reconciliation-panel .recon-schedule table th:first-child,
.reconciliation-panel .recon-schedule table td:first-child {
  text-align: left;
}
.reconciliation-panel .recon-schedule h4 {
  margin: 0 0 6px 0;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: 14px;
}
.reconciliation-panel .fmp-match-block {
  padding-top: 10px;
  border-top: 1px solid rgba(4, 30, 66, 0.08);
}
.reconciliation-panel details summary {
  cursor: pointer;
  font-weight: 500;
  padding: 8px 0;
  color: rgba(4, 30, 66, 0.78);
}

/* ═══════════════════════════════════════════════════════════════
   WAR MODE — dramatic black+red takeover for oil-shock analysis
   ═══════════════════════════════════════════════════════════════ */

/* Smooth crossfade between themes when toggling. */
body,
.panel,
.kpi-card,
.topbar,
.hero-panel,
.live-macro-bar {
  transition: background-color 400ms ease, color 300ms ease,
    border-color 400ms ease, box-shadow 400ms ease;
}

/* War Mode toggle button (always visible in the top bar). */
.war-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(196, 30, 58, 0.45);
  background: rgba(196, 30, 58, 0.08);
  color: var(--rl-polo-red);
  font-family: var(--body-font);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease,
    transform 180ms ease;
}
.war-toggle:hover {
  background: rgba(196, 30, 58, 0.16);
  border-color: rgba(196, 30, 58, 0.7);
  transform: translateY(-1px);
}
.war-toggle[aria-pressed="true"] {
  background: #c41e3a;
  color: #fff;
  border-color: #ff3b3b;
  box-shadow: 0 0 12px rgba(255, 59, 59, 0.55);
}
.war-toggle-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

/* F22 flyover layer — fixed full-viewport, pointer-events none. */
.war-flyover {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 9999;
  display: none;
}
.war-flyover.is-flying {
  display: block;
}
/* The formation is the single animated unit: plane + trail move together
   along the diagonal flight path. Starts off-screen bottom-left, ends
   off-screen top-right. The plane image is already visually tilted
   ~25° nose-up, so we don't rotate the image itself — only the
   translation changes, which reads as a straight diagonal climb. */
.f22-formation {
  position: absolute;
  top: 0;
  left: 0;
  width: 820px;
  height: 560px;
  transform: translate(-55vw, 75vh) scale(0.88);
  filter: drop-shadow(0 22px 32px rgba(0, 0, 0, 0.72));
  pointer-events: none;
  will-change: transform, opacity;
  opacity: 0;
}
.war-flyover.is-flying .f22-formation {
  animation: f22-flyby 4.5s cubic-bezier(0.4, 0.1, 0.6, 0.9) forwards;
}
.f22-silhouette {
  position: absolute;
  top: 0;
  left: 0;
  width: 820px;
  height: auto;
  max-width: none;
  pointer-events: none;
}
/* Afterburner trail — anchored at the plane's engine exhaust (lower-left
   of the image, since the plane is angled up-right) and extending back
   along the flight path via a fixed CSS rotation. */
.f22-trail {
  position: absolute;
  top: 315px;      /* engine exhaust y, inside formation */
  left: -240px;    /* right edge lands at the plane's engines */
  width: 470px;
  height: 42px;
  transform-origin: right center;
  transform: rotate(-22deg);
  background: linear-gradient(
    90deg,
    rgba(255, 59, 59, 0) 0%,
    rgba(255, 138, 52, 0.78) 40%,
    rgba(255, 220, 120, 0.9) 80%,
    rgba(255, 255, 255, 0.95) 100%
  );
  border-radius: 999px;
  filter: blur(8px);
  opacity: 0.9;
  pointer-events: none;
}
@keyframes f22-flyby {
  0% {
    transform: translate(-55vw, 75vh) scale(0.9);
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  92% {
    opacity: 1;
  }
  100% {
    transform: translate(160vw, -55vh) scale(1.05);
    opacity: 0;
  }
}

/* Optional full-screen red siren flash when engaging war mode. */
.war-siren {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  background: radial-gradient(
    ellipse at center,
    rgba(196, 30, 58, 0.45) 0%,
    rgba(10, 0, 0, 0.05) 55%,
    transparent 75%
  );
  opacity: 0;
}
.war-siren.is-sweeping {
  animation: war-siren 1.6s ease-out forwards;
}
@keyframes war-siren {
  0% {
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  45% {
    opacity: 0.3;
  }
  100% {
    opacity: 0;
  }
}

/* ── Theme override: applied to <html data-war-mode="on"> ── */
html[data-war-mode="on"] {
  --page-bg: #0a0000;
  --surface: rgba(22, 6, 6, 0.96);
  --surface-dim: rgba(30, 10, 10, 0.94);
  --surface-subtle: rgba(196, 30, 58, 0.12);
  --ink: #f3dcdc;
  --ink-on-dark: rgba(255, 235, 235, 0.95);
  --muted: #d07878;
  --muted-strong: #ff8080;
  --muted-on-dark: rgba(255, 130, 130, 0.55);
  --border: rgba(196, 30, 58, 0.25);
  --border-gold: rgba(196, 30, 58, 0.45);
  --border-on-dark: rgba(196, 30, 58, 0.35);
  --shadow-gold: 0 14px 34px rgba(196, 30, 58, 0.3);
  --shadow-card:
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 8px 24px rgba(196, 30, 58, 0.18),
    0 24px 48px rgba(196, 30, 58, 0.08);
  --shadow-card-hover:
    0 2px 4px rgba(0, 0, 0, 0.55),
    0 14px 34px rgba(196, 30, 58, 0.28),
    0 32px 64px rgba(196, 30, 58, 0.14);
  --rl-gold: #ff3b3b;
  --rl-gold-light: #ff6060;
  --rl-gold-pale: #ffb3b3;
  --rl-gold-deep: #a41212;
  --rl-cream: #1a0606;
  --rl-navy: #0a0000;
  --rl-navy-deep: #000000;
  --rl-navy-mid: #1e0808;
  --rl-navy-light: #300e0e;
}
html[data-war-mode="on"] body {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(120, 0, 0, 0.55), transparent 55%),
    radial-gradient(ellipse at 80% 100%, rgba(60, 0, 0, 0.35), transparent 55%),
    #0a0000;
  color: var(--ink);
}
html[data-war-mode="on"] body::before {
  background:
    radial-gradient(ellipse at 10% 0%, rgba(196, 30, 58, 0.28), transparent 55%),
    radial-gradient(ellipse at 90% 100%, rgba(60, 0, 0, 0.35), transparent 55%);
}
html[data-war-mode="on"] .page-backdrop {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(196, 30, 58, 0.025) 0 12px,
      transparent 12px 26px
    ),
    radial-gradient(ellipse at 50% -10%, rgba(196, 30, 58, 0.18), transparent 60%);
}
html[data-war-mode="on"] .panel,
html[data-war-mode="on"] .kpi-card,
html[data-war-mode="on"] .hero-panel,
html[data-war-mode="on"] .live-macro-bar,
html[data-war-mode="on"] .reconciliation-panel {
  background: rgba(26, 6, 6, 0.92);
  color: var(--ink);
  border: 1px solid rgba(196, 30, 58, 0.35);
}
html[data-war-mode="on"] .topbar {
  border-bottom: 1px solid rgba(196, 30, 58, 0.4);
}
html[data-war-mode="on"] .topbar h1,
html[data-war-mode="on"] .brand-subline,
html[data-war-mode="on"] .topnav a {
  color: #ffdada;
}
html[data-war-mode="on"] .topnav a.is-active {
  color: #ff6060;
  border-color: #ff3b3b;
}
html[data-war-mode="on"] .kpi-value,
html[data-war-mode="on"] .kpi-card-accent .kpi-value {
  color: #ff6060;
  text-shadow: 0 0 12px rgba(255, 59, 59, 0.3);
}
html[data-war-mode="on"] .status-pill.status-pass {
  background: rgba(34, 135, 94, 0.18);
  color: #6af0a8;
}
html[data-war-mode="on"] .status-pill.status-watch,
html[data-war-mode="on"] .status-pill.status-fail {
  background: rgba(255, 59, 59, 0.22);
  color: #ffb3b3;
}
html[data-war-mode="on"] .eyebrow {
  color: #ff8080 !important;
}

/* ── War Room panel (the headline oil histogram) ── */
.war-room {
  margin: 28px 0 32px;
  padding: 28px 30px 24px;
  border-radius: 18px;
  background: linear-gradient(
    160deg,
    rgba(20, 0, 0, 0.94) 0%,
    rgba(40, 0, 0, 0.92) 50%,
    rgba(18, 0, 0, 0.96) 100%
  );
  color: #f6e8e8;
  border: 1px solid rgba(196, 30, 58, 0.45);
  box-shadow:
    0 0 0 1px rgba(255, 59, 59, 0.15) inset,
    0 18px 48px rgba(0, 0, 0, 0.6),
    0 32px 80px rgba(196, 30, 58, 0.2);
  position: relative;
  overflow: hidden;
  animation: war-room-intro 520ms ease both;
}
.war-room::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(196, 30, 58, 0.05) 0 8px,
      transparent 8px 18px
    );
  opacity: 0.55;
}
.war-room[hidden] {
  display: none !important;
}
@keyframes war-room-intro {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.war-room-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.war-room-head .war-eyebrow {
  display: block;
  color: #ff8080;
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.war-room-head h2 {
  font-family: var(--heading-font);
  font-weight: 700;
  font-size: 34px;
  color: #ffecec;
  margin: 0;
  letter-spacing: 0.02em;
}
.war-tg {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.war-tg-label {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: #ff9a9a;
  text-transform: uppercase;
}
.war-tg-value {
  font-family: var(--heading-font);
  font-weight: 700;
  font-size: 40px;
  color: #ff3b3b;
  line-height: 1;
  text-shadow: 0 0 18px rgba(255, 59, 59, 0.55);
  font-variant-numeric: tabular-nums;
}
.war-tg-value.is-delta-up {
  color: #6aff9a;
  text-shadow: 0 0 16px rgba(106, 255, 154, 0.45);
}
.war-tg-value.is-delta-down {
  color: #ff4747;
  text-shadow: 0 0 18px rgba(255, 71, 71, 0.6);
}

.war-body {
  display: grid;
  grid-template-columns: minmax(0, 2.5fr) minmax(220px, 1fr);
  gap: 24px;
  margin-top: 22px;
  position: relative;
  z-index: 1;
}
@media (max-width: 960px) {
  .war-body {
    grid-template-columns: 1fr;
  }
}

.war-chart {
  background: rgba(10, 0, 0, 0.7);
  border: 1px solid rgba(196, 30, 58, 0.35);
  border-radius: 12px;
  padding: 14px 14px 6px;
  min-height: 320px;
}
.war-chart svg {
  display: block;
  width: 100%;
  height: auto;
}
.war-chart .bar {
  fill: #c41e3a;
  transition: fill 140ms ease, y 120ms ease, height 120ms ease;
  cursor: ns-resize;
}
.war-chart .bar.is-up {
  fill: #ff3b3b;
}
.war-chart .bar.is-down {
  fill: #7a1020;
}
.war-chart .bar:hover,
.war-chart .bar.is-focused {
  fill: #ff8080;
  filter: drop-shadow(0 0 6px rgba(255, 128, 128, 0.7));
}
.war-chart .bar-handle {
  fill: rgba(255, 200, 200, 0.9);
  pointer-events: none;
}
.war-chart .zero-line {
  stroke: rgba(255, 220, 220, 0.5);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.war-chart .futures-path {
  fill: none;
  stroke: rgba(255, 220, 120, 0.85);
  stroke-width: 2;
  stroke-dasharray: 6 4;
  pointer-events: none;
}
.war-chart .grid-line {
  stroke: rgba(255, 120, 120, 0.12);
  stroke-width: 1;
}
.war-chart .axis-label {
  fill: rgba(255, 200, 200, 0.7);
  font-family: var(--body-font);
  font-size: 10px;
  letter-spacing: 0.05em;
}
.war-chart .axis-tick {
  stroke: rgba(255, 180, 180, 0.3);
  stroke-width: 1;
}
.war-chart-legend {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 11px;
  color: #ffb3b3;
  letter-spacing: 0.05em;
}
.war-chart-legend .swatch {
  display: inline-block;
  width: 14px;
  height: 4px;
  vertical-align: middle;
  margin-right: 6px;
  border-radius: 2px;
}
.war-chart-legend .swatch-bar {
  background: #c41e3a;
  height: 10px;
  border-radius: 2px;
}
.war-chart-legend .swatch-futures {
  background: rgba(255, 220, 120, 0.85);
  height: 2px;
}

.war-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px;
  background: rgba(14, 0, 0, 0.65);
  border: 1px solid rgba(196, 30, 58, 0.35);
  border-radius: 12px;
}
.war-sidebar dl {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  row-gap: 10px;
  column-gap: 12px;
  align-items: baseline;
}
.war-sidebar dt {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ff9a9a;
}
.war-sidebar dd {
  margin: 0;
  font-family: var(--mono-font);
  font-size: 14px;
  color: #ffecec;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.war-sidebar dd.is-up {
  color: #6aff9a;
}
.war-sidebar dd.is-down {
  color: #ff6060;
}
.war-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.war-apply,
.war-reset {
  appearance: none;
  border: 1px solid #ff3b3b;
  background: #c41e3a;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-family: var(--body-font);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}
.war-apply:hover {
  background: #ff3b3b;
  transform: translateY(-1px);
}
.war-reset {
  background: transparent;
  color: #ff9a9a;
  border-color: rgba(255, 154, 154, 0.5);
}
.war-reset:hover {
  background: rgba(255, 59, 59, 0.12);
  color: #ffdada;
}
.war-apply[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.war-defaults-form {
  margin: 0;
}
.war-defaults-btn {
  width: 100%;
}

/* ── Market Pricing toggle + rows + explainer ── */
.war-market-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 10px;
  padding: 10px 12px;
  border: 1px solid rgba(196, 30, 58, 0.3);
  border-radius: 10px;
  background: rgba(30, 0, 0, 0.6);
  cursor: pointer;
  user-select: none;
}
.war-market-switch input {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  width: 0;
  height: 0;
}
.war-switch-track {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
  background: rgba(140, 40, 40, 0.55);
  border-radius: 999px;
  transition: background 180ms ease;
  flex: 0 0 auto;
}
.war-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffecec;
  transition: transform 180ms ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.war-market-switch input:checked + .war-switch-track {
  background: #ff3b3b;
  box-shadow: 0 0 10px rgba(255, 59, 59, 0.6);
}
.war-market-switch input:checked + .war-switch-track .war-switch-thumb {
  transform: translateX(16px);
}
.war-market-switch input:focus-visible + .war-switch-track {
  outline: 2px solid #ff8080;
  outline-offset: 2px;
}
.war-switch-label {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #ffdada;
  font-weight: 600;
}
.war-market-rows {
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px dashed rgba(196, 30, 58, 0.3);
}
.war-market-rows[hidden] {
  display: none;
}

.war-market-info {
  margin: 22px 0 6px;
  padding: 22px 28px;
  border: 1px solid rgba(196, 30, 58, 0.4);
  border-radius: 12px;
  background: rgba(14, 0, 0, 0.72);
  color: #ffdada;
  position: relative;
  z-index: 1;
  animation: war-room-intro 360ms ease both;
}
.war-market-info[hidden] {
  display: none;
}
.war-market-info h3 {
  margin: 0 0 10px;
  font-family: var(--heading-font);
  color: #ff6060;
  font-size: 24px;
  letter-spacing: 0.01em;
}
.war-market-info p {
  margin: 6px 0;
  color: #ffdada;
  line-height: 1.55;
}
.war-market-info ul {
  margin: 8px 0 14px 20px;
  padding: 0;
  color: #ffecec;
}
.war-market-info ul li {
  margin-bottom: 6px;
  line-height: 1.5;
}
.war-market-info ul li strong {
  color: #ff8080;
}
.war-market-formula {
  margin: 12px 0;
  padding: 12px 16px;
  background: rgba(30, 0, 0, 0.7);
  border-left: 3px solid #ff3b3b;
  border-radius: 4px;
  font-family: var(--mono-font);
  font-size: 12px;
  color: #ffecec;
  white-space: pre-wrap;
  line-height: 1.55;
}
.war-market-note {
  opacity: 0.82;
  margin-top: 10px !important;
  font-size: 12px;
  font-style: italic;
}

.war-hint {
  color: #ffb3b3;
  font-size: 11px;
  letter-spacing: 0.04em;
  margin-top: 8px;
}
.war-live-footer {
  margin: 6px 0 2px;
  padding: 6px 10px;
  color: #ffd8d8;
  font-family: var(--mono-font);
  font-size: 11px;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  background: rgba(196, 30, 58, 0.1);
  border: 1px solid rgba(196, 30, 58, 0.3);
  border-radius: 6px;
  display: inline-block;
}
.war-live-footer::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: #6aff9a;
  box-shadow: 0 0 6px #6aff9a;
  vertical-align: middle;
  animation: war-live-pulse 2s ease-in-out infinite;
}
@keyframes war-live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Reduced-motion respect: skip the flyby and siren, only swap the theme. */
@media (prefers-reduced-motion: reduce) {
  .war-flyover.is-flying .f22-formation,
  .war-flyover.is-flying .f22-silhouette,
  .war-flyover.is-flying .f22-trail,
  .war-siren.is-sweeping,
  .war-room {
    animation: none !important;
  }
}

/* ── War Mode "solo" layout: hide all other dashboard noise, so the
   War Room is the only thing on screen. The top bar (with the toggle)
   and the footer remain visible. ── */
html[data-war-mode="on"] .content-shell > *:not(.war-room):not(script) {
  display: none !important;
}
html[data-war-mode="on"] #apply-bar,
html[data-war-mode="on"] .live-macro-bar,
html[data-war-mode="on"] .flash-stack {
  display: none !important;
}
/* Hide primary navigation inside War Mode — the links interact badly
   with the War Room's heavy blur/shadow layering, and more importantly
   War Mode is a committed view. Users exit via the Stand Down toggle. */
html[data-war-mode="on"] .topnav {
  display: none !important;
}
html[data-war-mode="on"] .war-room {
  margin-top: 12px;
  padding: 32px 36px 28px;
}
html[data-war-mode="on"] .war-room-head h2 {
  font-size: 40px;
}
html[data-war-mode="on"] .war-tg-value {
  font-size: 56px;
}
html[data-war-mode="on"] .war-chart {
  min-height: 420px;
  padding: 20px 20px 12px;
}
html[data-war-mode="on"] .content-shell {
  min-height: 70vh;
}

/* ── Histogram bar styling ── Wider, taller bars so they actually
   read as a histogram rather than a line. ── */
.war-chart .bar {
  fill: url(#war-bar-grad);
  stroke: rgba(255, 59, 59, 0.55);
  stroke-width: 0.5;
  transition: filter 140ms ease;
  cursor: ns-resize;
}
.war-chart .bar.is-up {
  fill: url(#war-bar-grad-up);
  stroke: rgba(255, 120, 120, 0.85);
}
.war-chart .bar.is-down {
  fill: url(#war-bar-grad-down);
  stroke: rgba(140, 30, 50, 0.85);
}
.war-chart .bar:hover,
.war-chart .bar.is-focused,
.war-chart .bar:focus {
  filter: drop-shadow(0 0 8px rgba(255, 128, 128, 0.85)) brightness(1.12);
  outline: none;
}
.war-chart .bar-top {
  fill: rgba(255, 220, 220, 0.95);
  pointer-events: none;
}
.war-chart .baseline-line {
  stroke: rgba(255, 220, 220, 0.55);
  stroke-width: 1.2;
  stroke-dasharray: 6 4;
}
.war-chart .baseline-label {
  fill: rgba(255, 220, 220, 0.7);
  font-family: var(--body-font);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.war-chart .y-axis-label {
  fill: rgba(255, 200, 200, 0.72);
  font-family: var(--mono-font);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

