/* =====================================================================
   EA Risk & Planning Toolkit - stylesheet
   Themed to match tradelytics.cloud. Tabular numerals everywhere.
   ===================================================================== */

/* Loaded AFTER /assets/style.css. Values mirror style.css tokens (--bg, --surface,
   --surface-2, --border, --text, --text-muted, --accent, --up, --down) so toolkit
   components sit naturally inside the site's .shell, top bar and footer. */
:root {
  --ink: #E8EEF5;
  --ink-2: #C3CFDC;
  --muted: #8FA3B8;
  --paper: #0B1420;
  --paper-2: #0E1927;
  --surface: #111E2E;
  --surface-2: #16283C;
  --rule: #223349;
  --rule-strong: #2F4661;
  --navy: #0B1420;
  --navy-2: #F0A94E;        /* accent (links, tags, chart end points) */
  --navy-ink: #E6EDF5;
  --accent: #F0A94E;
  --accent-ink: #14110A;
  --accent-hover: #F4BB6E;
  --link: #F0A94E;
  --sea: #2FB9A6;
  --sea-soft: rgba(47, 185, 166, 0.13);
  --pos: #34C77B;
  --neg: #EF5A5A;
  --amber: #F0A94E;
  --amber-soft: rgba(240, 169, 78, 0.09);
  --alert-soft: rgba(239, 90, 90, 0.10);
  --info-soft: rgba(47, 185, 166, 0.08);
  --focus: #F0A94E;
  --select: rgba(240, 169, 78, 0.10);

  --sans: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);
  --serif: var(--sans);
  --math: "Cambria Math", "STIX Two Math", Cambria, Georgia, serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 10px;
  --shadow: none;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}
main h1, main h2, main h3, main h4 { margin: 0; line-height: 1.2; }
main p { margin: 0; }
main a { text-underline-offset: 2px; }
code, pre { font-family: var(--mono); }
img, svg { max-width: 100%; }

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

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 50;
  background: var(--surface); color: var(--ink); padding: 8px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--rule-strong);
}
.skip-link:focus { top: 12px; }

.wrap { width: 100%; }   /* content already sits inside the site's .shell */

/* Toolkit sub-navigation (sits under the site top bar) */
.ea-subnav { margin: 10px 0 4px; }
.ea-subnav-inner { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.ea-subnav-inner::-webkit-scrollbar { display: none; }
.ea-subnav a { flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2); text-decoration: none; font-size: 13px; font-weight: 500; }
.ea-subnav a:hover { color: var(--ink); border-color: var(--accent); text-decoration: none; }
.ea-subnav a[aria-current="page"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); font-weight: 700; }
.ea-subnav-brand { font-weight: 700 !important; }

/* Breadcrumbs */
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--muted); }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; color: var(--rule-strong); }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--ink); text-decoration: underline; }
.breadcrumbs [aria-current="page"] { color: var(--ink-2); }

/* ---------- Home ---------- */
.ea-hero {
  margin-top: 14px; border: 1px solid var(--rule); border-radius: var(--r-lg); overflow: hidden;
  background-color: var(--surface);
  background-image:
    linear-gradient(var(--paper-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--paper-2) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: -1px -1px;
}
.hero-inner { padding: 36px 28px 32px; }
.hero-title {
  font-family: var(--serif); font-weight: 800;
  font-size: clamp(2rem, 4.2vw, 3.2rem); line-height: 1.05; letter-spacing: -0.015em;
  max-width: 22ch;
}
.hero-tagline { margin-top: 20px; font-family: var(--serif); font-size: clamp(1.1rem, 2vw, 1.45rem); color: var(--ink-2); max-width: 40ch; }
.hero-subtitle { margin-top: 10px; color: var(--muted); max-width: 60ch; }

.home-tools { padding-top: 20px; }
.tool-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.tool {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 28px; align-items: center;
  padding: 28px 32px;
}
.tool + .tool { border-top: 1px solid var(--rule); }
.tool-growth { background: linear-gradient(90deg, var(--sea-soft), transparent 55%); }
.tool-title { font-family: var(--serif); font-size: 1.45rem; font-weight: 600; }
.tool-title a { color: var(--ink); text-decoration: none; }
.tool-title a:hover { text-decoration: underline; }
.tool-growth .tool-title { font-size: 1.7rem; }
.tool-summary { margin-top: 6px; color: var(--ink-2); max-width: 52ch; }
.tool-formula { margin: 0; padding: 14px 18px; border-left: 2px solid var(--rule-strong); }
.tool-formula code { font-family: var(--math); font-size: 1.15rem; color: var(--ink); }
.tool-formula figcaption { margin-top: 4px; font-size: 13px; color: var(--muted); }

.section-title { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; }
.principles { padding-top: 48px; }
.principle-grid { margin-top: 18px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.principle { border-top: 2px solid var(--navy-2); padding-top: 14px; }
.principle h3 { font-size: 1rem; font-weight: 650; }
.principle p { margin-top: 6px; color: var(--ink-2); font-size: 14.5px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 8px 16px; border-radius: var(--r-sm);
  font: 600 14px/1.2 var(--sans); text-decoration: none; cursor: pointer;
  border: 1px solid transparent; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.btn-primary:hover { background: var(--navy-2); border-color: var(--navy-2); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--rule-strong); }
.btn-secondary:hover { border-color: var(--ink-2); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: transparent; }
.btn-ghost:hover { color: var(--ink); background: var(--paper-2); }
.btn-lg { min-height: 46px; padding: 10px 22px; font-size: 15px; }
.link-button { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--navy-2); cursor: pointer; text-align: left; }
.link-button:hover { text-decoration: underline; }

/* ---------- Calculator page ---------- */
.calc-head .wrap { padding-top: 14px; }
.calc-title { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.calc-question { margin-top: 8px; color: var(--ink); line-height: 1.7; max-width: 75ch; }

.calc-layout {
  display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start;
  padding-top: 20px; padding-bottom: 8px;
}

.ea-panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.input-panel {
  position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto;
  padding: 22px 22px 18px; scrollbar-gutter: stable;
}
.panel-title { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; margin-bottom: 14px; }

.group { border: 0; margin: 0; padding: 0; min-width: 0; }
.group + .group, .group + .advanced, .advanced + .form-actions { margin-top: 20px; }
.group > legend { padding: 0; margin-bottom: 10px; font-size: 13px; font-weight: 650; color: var(--ink-2); letter-spacing: 0.01em; }
.group-core { background: var(--surface-2); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 14px 14px 12px; }
.group-core > legend { float: left; width: 100%; margin-bottom: 12px; }
.group-core > legend + * { clear: both; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-2 + .grid-2, .grid-2 + .grid-3, .choice + div, div + .grid-3, .field + .field { margin-top: 12px; }

.field { min-width: 0; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 5px; }
.control { display: flex; align-items: stretch; border: 1px solid var(--rule-strong); border-radius: var(--r-sm); background: var(--surface); }
.control:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(240, 169, 78, 0.20); }
.control input, .control select {
  flex: 1 1 auto; min-width: 0; width: 100%; border: 0; background: transparent; color: var(--ink);
  font: 500 15px/1.3 var(--sans); font-variant-numeric: tabular-nums; padding: 9px 10px;
}
.control input:focus, .control select:focus { outline: none; }
.control select { appearance: none; padding-right: 30px; cursor: pointer; }
.control-select { position: relative; }
.control-select::after {
  content: ""; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; margin-top: -5px;
  border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted); transform: rotate(45deg); pointer-events: none;
}
.control select option { color: var(--ink); background: var(--surface); }
.affix { display: flex; align-items: center; padding: 0 10px; color: var(--muted); font-size: 13px; background: var(--surface-2); white-space: nowrap; }
.affix-pre { border-right: 1px solid var(--rule); border-radius: var(--r-sm) 0 0 var(--r-sm); }
.affix-post { border-left: 1px solid var(--rule); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
input[type="date"] { min-height: 40px; }
[aria-invalid="true"] { color: var(--neg) !important; }
.control:has([aria-invalid="true"]) { border-color: var(--neg); }
.field-hint { margin-top: 5px; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.field-error { margin-top: 5px; font-size: 12.5px; color: var(--neg); font-weight: 600; }
.derived { margin-top: 8px; font-size: 13px; color: var(--ink-2); font-weight: 600; }

.form-errors { margin-bottom: 14px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--alert-soft); border-left: 3px solid var(--neg); font-size: 13.5px; }
.form-errors ul { margin: 6px 0 0; padding-left: 18px; }
.form-errors a { color: var(--neg); }

/* Segmented radio choice */
.choice { border: 0; margin: 12px 0 0; padding: 0; min-width: 0; }
.choice legend { padding: 0; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.choice-options { display: flex; background: var(--paper-2); border-radius: var(--r-sm); padding: 3px; gap: 3px; }
.choice-options input { position: absolute; opacity: 0; pointer-events: none; }
.choice-options label {
  flex: 1 1 0; text-align: center; padding: 7px 8px; border-radius: 4px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 0;
}
.choice-options input:checked + label { background: var(--accent); color: var(--accent-ink); font-weight: 650; }
.choice-options input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 1px; }

/* Switch */
.switch-row { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; margin-top: 14px; }
.switch-row .field-hint { grid-column: 1 / -1; }
.switch-row label { font-size: 14px; font-weight: 600; cursor: pointer; }
.switch-inline { margin-top: 0; }
.switch {
  appearance: none; width: 38px; height: 22px; border-radius: 11px; margin: 0;
  background: var(--rule-strong); position: relative; cursor: pointer; transition: background 0.15s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.switch:checked { background: var(--sea); }
.switch:checked::after { transform: translateX(16px); }

/* Advanced */
.advanced { margin-top: 20px; border-top: 1px solid var(--rule); }
.advanced > summary {
  list-style: none; cursor: pointer; padding: 14px 0 4px; font-weight: 650; font-size: 14px;
  display: flex; align-items: center; gap: 8px;
}
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary::before {
  content: ""; width: 7px; height: 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(-45deg); transition: transform 0.15s; margin-right: 2px;
}
.advanced[open] > summary::before { transform: rotate(45deg); }
.advanced .group { margin-top: 18px; }

.scenario-adjust { display: grid; grid-template-columns: 1.1fr repeat(3, minmax(0, 1fr)); gap: 8px; align-items: center; margin-top: 10px; }
.sa-head { font-size: 12px; color: var(--muted); font-weight: 600; }
.sa-row { font-size: 13px; font-weight: 600; }
.sa-field { margin: 0 !important; }
.sa-field label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.sa-field input { padding: 7px 8px; }

.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.form-actions .btn-primary { flex: 1 1 auto; }
.live-hint { font-size: 13px; color: var(--muted); }
.handoff-note { margin-bottom: 14px; padding: 9px 12px; font-size: 13px; border-radius: var(--r-sm); background: var(--info-soft); color: var(--ink-2); }

.privacy-note { display: flex; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--rule); font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.privacy-icon { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.privacy-icon path { fill: none; stroke: var(--sea); stroke-width: 1.5; stroke-linejoin: round; }
.privacy-note strong { color: var(--ink-2); }

/* ---------- Results ---------- */
.results { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.results-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.results-title { font-family: var(--serif); font-size: 1.6rem; font-weight: 600; }
.estimate-badge {
  display: inline-block; margin-top: 6px; padding: 3px 9px; border-radius: 4px;
  background: var(--amber-soft); color: var(--amber); font-size: 12.5px; font-weight: 650;
  border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent);
}
.results-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stale-note { padding: 10px 14px; border-radius: var(--r-sm); background: var(--amber-soft); color: var(--ink); font-size: 14px; border-left: 3px solid var(--amber); }

.scenario-switch, .view-switch { display: inline-flex; background: var(--paper-2); border-radius: var(--r-sm); padding: 3px; gap: 3px; align-self: flex-start; flex-wrap: wrap; }
.scenario-switch button, .view-switch button {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 4px; font: 600 13.5px var(--sans); color: var(--ink-2); cursor: pointer;
}
.scenario-switch button[aria-checked="true"], .view-switch button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 650; }
.scenario-desc { font-size: 13.5px; color: var(--muted); margin-top: -8px; }

/* Metrics strip: one ledger panel with ruled cells, not a card per number */
.metrics {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px;
  background: var(--rule); border: 1px solid var(--rule); border-radius: var(--r-lg); overflow: hidden;
}
.metric { background: var(--surface); padding: 14px 16px 13px; min-width: 0; }
.metric-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.metric-value { margin-top: 4px; font-size: clamp(1.02rem, 1.5vw, 1.3rem); font-weight: 650; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.metric-note { margin-top: 2px; font-size: 12px; color: var(--muted); }
.metric-lead { grid-column: span 2; grid-row: span 2; display: flex; flex-direction: column; justify-content: center; padding: 20px 22px; background: var(--surface-2); }
.metric-lead .metric-label { font-size: 13.5px; color: var(--ink-2); }
.metric-lead .metric-value { font-family: var(--serif); font-size: clamp(1.9rem, 3.4vw, 2.7rem); font-weight: 600; color: var(--ink); line-height: 1.1; margin-top: 6px; }
.metric-lead .metric-note { font-size: 13px; margin-top: 6px; }
.metric.is-neg .metric-value { color: var(--neg); }
.metrics-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.notes { display: flex; flex-direction: column; gap: 10px; }
.notes:empty { display: none; }
.note { padding: 11px 14px; border-radius: var(--r-sm); border-left: 3px solid; font-size: 14px; color: var(--ink); }
.note-title { font-weight: 650; margin-bottom: 2px; }
.note-foot { margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.note-alert { background: var(--alert-soft); border-color: var(--neg); }
.note-caution { background: var(--amber-soft); border-color: var(--amber); }
.note-info { background: var(--info-soft); border-color: var(--navy-2); }

.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 20px 22px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 4px; }
.card-title { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; }
.card-sub { margin-top: 4px; font-size: 13px; color: var(--muted); max-width: 80ch; }
.card > .card-sub { margin-bottom: 8px; }

.narrative { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; max-width: 78ch; color: var(--ink-2); }
.narrative-caveat { color: var(--muted); font-size: 13.5px; }

/* Hero figure (risk / drawdown) */
.hero-figure { background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--navy-2); border-radius: var(--r-lg); padding: 22px 26px; }
.hero-figure-label { font-size: 14px; font-weight: 650; color: var(--ink-2); }
.hero-figure-value { font-family: var(--serif); font-size: clamp(2.3rem, 5vw, 3.4rem); font-weight: 600; line-height: 1.1; margin-top: 4px; letter-spacing: -0.01em; }
.hero-figure-note { margin-top: 6px; color: var(--ink-2); max-width: 70ch; }

.position-lead { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 10px 0 14px; }
.position-lots { font-family: var(--serif); font-size: 2rem; font-weight: 600; }
.position-caption { font-size: 13px; color: var(--muted); }
.kv-list { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.inline-warning { margin-top: 10px; font-size: 13.5px; color: var(--amber); font-weight: 600; }
.broker-note { margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.empty-state { margin-top: 8px; color: var(--ink-2); font-size: 14px; }
.context-text { margin-top: 10px; font-size: 13.5px; color: var(--ink-2); }

/* ---------- Charts ---------- */
.chart { position: relative; margin-top: 12px; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-gridline { stroke: var(--rule); stroke-width: 1; }
.chart-zero { stroke: var(--rule-strong); stroke-width: 1.2; }
.chart-tick { fill: var(--muted); font: 11px var(--sans); font-variant-numeric: tabular-nums; }
.chart-line { fill: none; stroke: var(--sea); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: var(--sea-soft); }
.chart-end { fill: var(--surface); stroke: var(--sea); stroke-width: 2; }
.chart-bar { fill: var(--sea); opacity: 0.85; }
.chart-bar-neg { fill: var(--neg); }
.chart-baseline { stroke: var(--amber); stroke-width: 1.2; stroke-dasharray: 5 4; }
.chart-baseline-label { fill: var(--amber); font: 600 11px var(--sans); }
.chart-marker-line { stroke: var(--amber); stroke-width: 1.2; stroke-dasharray: 4 4; }
.chart-marker { fill: var(--amber); stroke: var(--surface); stroke-width: 2; }
.chart-marker-label { fill: var(--ink); font: 600 12px var(--sans); }
.chart-cursor { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-dot { fill: var(--navy-2); stroke: var(--surface); stroke-width: 2; }
.chart-hit { fill: transparent; cursor: crosshair; }
.chart-hit:focus { outline: none; }
.chart-hit:focus-visible { stroke: var(--focus); stroke-width: 2; }
.chart-tip {
  position: absolute; top: 0; padding: 5px 9px; border-radius: 5px; pointer-events: none;
  background: var(--ink); color: var(--paper); font-size: 12.5px; font-weight: 600; white-space: nowrap;
}

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; margin-top: 12px; border: 1px solid var(--rule); border-radius: var(--r-md); -webkit-overflow-scrolling: touch; }
.table-scroll-tall { max-height: 72vh; overflow-y: auto; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 8px 12px; border-bottom: 1px solid var(--rule); text-align: left; white-space: nowrap; }
.data-table thead th {
  position: sticky; top: 0; z-index: 2; background: var(--surface-2); font-size: 12.5px; font-weight: 650; color: var(--ink-2);
  border-bottom: 1px solid var(--rule-strong); vertical-align: bottom; white-space: normal; min-width: 5.5rem;
}
.data-table .num { text-align: right; }
#g-scenarios { font-size: 12.5px; }
#g-scenarios th, #g-scenarios td { padding: 7px 8px; }
#g-scenarios .scen-assump { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 400; }
#g-scenarios thead th:first-child { white-space: normal; }
.data-table tbody tr:hover td, .data-table tbody tr:hover th { background: var(--surface-2); }
.data-table tbody th { font-weight: 600; }
.data-table tr.is-selected td, .data-table tr.is-selected th { background: var(--select); }
.data-table td.neg { color: var(--neg); }
.data-table td.pos { color: var(--pos); }
.data-table td.strong { font-weight: 650; }
.data-table tfoot td, .data-table tfoot th { font-weight: 700; border-top: 2px solid var(--rule-strong); border-bottom: 0; background: var(--surface-2); }
.row-tag { display: inline-block; margin-right: 8px; padding: 1px 6px; border-radius: 3px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 600; vertical-align: 1px; }
.table-note { caption-side: bottom; text-align: left; padding: 8px 12px; font-size: 12.5px; color: var(--muted); }

.projection-table { min-width: 1480px; }
.projection-table .col-index { position: sticky; left: 0; z-index: 1; width: 3.4rem; min-width: 3.4rem; background: var(--surface); color: var(--muted); text-align: right; }
.projection-table .col-month { position: sticky; left: 3.4rem; z-index: 1; min-width: 6.6rem; background: var(--surface); box-shadow: 1px 0 0 var(--rule); }
.projection-table thead .col-index, .projection-table thead .col-month { z-index: 3; background: var(--surface-2); }
.projection-table tfoot .col-index, .projection-table tfoot .col-month { background: var(--surface-2); }
.projection-table .year-row th {
  position: static; background: var(--paper); padding: 10px 12px 7px; border-bottom: 1px solid var(--rule-strong); text-align: left;
}
.projection-table .year-row th > * { position: sticky; left: 12px; }
.year-label { font-family: var(--serif); font-size: 14.5px; font-weight: 600; color: var(--ink); margin-right: 12px; }
.year-range { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.projection-table tr.row-depleted td, .projection-table tr.row-depleted th { background: var(--alert-soft); }
.projection-table tr.row-after-depletion td, .projection-table tr.row-after-cap td { color: var(--muted); }

.scenario-table th:first-child { min-width: 10rem; }

/* Assumptions & context */
.assumptions { margin: 12px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.assumption { display: grid; grid-template-columns: 12rem 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.assumption dt { color: var(--muted); }
.assumption dd { margin: 0; font-weight: 550; }
.context-list { margin: 10px 0 12px; }
.context-item { display: grid; grid-template-columns: 14rem 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.context-item dt { font-weight: 600; font-size: 14px; }
.context-item dd { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.context-value { font-weight: 650; }
.context-text { margin-top: 0; }

/* Methodology */
.methodology > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.methodology > summary::-webkit-details-marker { display: none; }
.methodology > summary::after { content: "Show"; font-size: 13px; font-weight: 600; color: var(--navy-2); }
.methodology[open] > summary::after { content: "Hide"; }
.method-body { margin-top: 14px; color: var(--ink-2); max-width: 90ch; }
.method-body > p + p, .method-body > p + .formula, .method-body > .formula + p { margin-top: 10px; }
.method-steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 16px; }
.method-steps h4, .method-body > h4 { font-size: 14.5px; font-weight: 650; color: var(--ink); margin-bottom: 6px; }
.method-body > h4 { margin-top: 20px; }
.method-limits { margin: 6px 0 0; padding-left: 20px; }
.method-limits li + li { margin-top: 4px; }
.formula {
  margin: 8px 0 0; padding: 10px 14px; background: var(--surface-2); border: 1px solid var(--rule); border-radius: var(--r-sm);
  font-size: 13px; line-height: 1.6; color: var(--ink); overflow-x: auto; white-space: pre;
}

.timestamp { font-size: 12.5px; color: var(--muted); }

/* Disclaimer */
.ea-disclaimer { margin-top: 8px; padding: 18px 22px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--rule-strong); border-top: 3px solid var(--amber); }
.ea-disclaimer h2 { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; }
.ea-disclaimer p { margin-top: 8px; font-size: 13.5px; color: var(--ink-2); max-width: 95ch; }
.ea-disclaimer .disclaimer-strong { font-weight: 700; color: var(--ink); }
.page-hub .ea-disclaimer { margin: 48px 0 56px; }

/* ---------- SEO content (server-rendered, crawlable) ---------- */
.seo-content { margin-top: 36px; display: flex; flex-direction: column; gap: 20px; }
.seo-block { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 22px 24px; }
.seo-title { font-size: 1.25rem; font-weight: 700; color: var(--ink); }
.seo-block h3 { font-size: 1rem; font-weight: 650; color: var(--ink); margin-bottom: 6px; }
.seo-block p { color: var(--ink-2); margin-top: 8px; max-width: 75ch; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px 32px; margin-top: 8px; }
.formula-line code { display: inline-block; padding: 6px 10px; background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r-sm); color: var(--ink); font-size: 13px; white-space: normal; }
.faq-item { border-top: 1px solid var(--rule); padding: 12px 0; }
.faq-item:first-of-type { margin-top: 10px; }
.faq-item summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before { content: "+"; color: var(--accent); font-weight: 700; width: 14px; flex: none; }
.faq-item[open] summary::before { content: "\2212"; }
.faq-item summary h3 { margin: 0; font-size: 15px; }
.faq-item p { margin-left: 24px; }
.related-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.related-list a { display: flex; flex-direction: column; gap: 3px; height: 100%; padding: 12px 14px; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--paper-2); text-decoration: none; }
.related-list a:hover { border-color: var(--accent); }
.related-list strong { color: var(--ink); font-size: 14.5px; }
.related-list span { color: var(--muted); font-size: 13px; }
.noscript-note { margin-top: 16px; padding: 12px 16px; border: 1px solid var(--amber); border-radius: var(--r-md); background: var(--amber-soft); color: var(--ink); }
.hero-kicker { font-size: 12.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric-lead { grid-column: span 3; grid-row: auto; }
  .assumptions { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .calc-layout { grid-template-columns: minmax(0, 1fr); }
  .input-panel { position: static; max-height: none; overflow: visible; }
  .tool { grid-template-columns: minmax(0, 1fr) auto; }
  .tool-formula { grid-column: 1 / -1; grid-row: 2; }
  .principle-grid { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .metrics, .metrics-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-lead { grid-column: span 2; }
  .tool { grid-template-columns: 1fr; padding: 22px 20px; gap: 14px; }
  .tool-formula { grid-row: auto; }
  .tool-cta { justify-self: start; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv-list { grid-template-columns: 1fr; }
  .assumption, .context-item { grid-template-columns: 1fr; gap: 2px; }
  .card { padding: 16px; }
  .input-panel { padding: 18px 16px; }
  .results-actions { width: 100%; }
  .results-actions .btn { flex: 1 1 auto; }
  .scenario-switch { width: 100%; }
  .scenario-switch button { flex: 1 1 auto; padding: 7px 8px; }
  .hero-inner { padding: 26px 18px 24px; }
  .seo-block { padding: 18px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Print ---------- */
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  :root { --paper: #fff; --surface: #fff; --surface-2: #f4f6f8; --ink: #000; --ink-2: #222; --muted: #555; --rule: #ccc; --rule-strong: #999; --accent: #8a5d0c; --navy-2: #8a5d0c; --sea: #1f7a6c; --pos: #1c6b4f; --neg: #a33a2f; --amber: #8a5d0c; --amber-soft: #fbf3e2; --alert-soft: #fbeceb; --info-soft: #eef5f4; --select: #f4efe4; --paper-2: #f4f6f8; color-scheme: light; }
  body { background: #fff; color: #000; font-size: 10pt; }
  .topbar, .site-footer, .mobile-nav-drawer, .drawer-backdrop, .ea-subnav, .breadcrumbs, .seo-content, noscript, .skip-link, .form-actions, .results-actions, .scenario-switch, .view-switch,
  .switch-inline, .stale-note, .privacy-note .privacy-icon, .chart-tip, .chart-cursor, .chart-dot, .handoff-note { display: none !important; }
  .page-growth .input-panel { display: none !important; }
  .calc-layout { display: block; padding: 0; }
  .input-panel { position: static; max-height: none; overflow: visible; box-shadow: none; margin-bottom: 12pt; break-inside: avoid; }
  .input-panel .advanced > summary { display: none; }
  .calc-head { border: 0; }
  .calc-head .wrap { padding: 0 0 8pt; }
  .wrap { max-width: none; padding: 0; }
  .card, .metrics, .hero-figure, .ea-disclaimer { box-shadow: none; break-inside: avoid; }
  .card-table { break-inside: auto; }
  .table-scroll, .table-scroll-tall { max-height: none; overflow: visible; border: 0; }
  .projection-table { min-width: 0; font-size: 7.5pt; }
  .projection-table th, .projection-table td { padding: 3px 5px; }
  .projection-table .col-index, .projection-table .col-month, .data-table thead th { position: static; box-shadow: none; }
  .data-table tr { break-inside: avoid; }
  .methodology > summary::after { content: none; }
  .metric-lead { grid-column: span 2; }
  .results { gap: 10pt; }
  a { color: inherit; text-decoration: none; }
}

/* Long figures (large projections) shrink instead of breaking mid-number */
.metric:not(.metric-lead) .metric-value.is-long { font-size: clamp(0.92rem, 1.15vw, 1.08rem); overflow-wrap: normal; word-break: break-word; }

/* Keep inputs on one line when a label in a multi-column row wraps */
.grid-2 > .field, .grid-3 > .field { display: flex; flex-direction: column; }
.grid-3 > .field > label, .input-panel .grid-2 > .field > label { min-height: 2.9em; display: flex; align-items: flex-end; }
.grid-2 > .field + .field, .grid-3 > .field + .field { margin-top: 0; }
@media (max-width: 640px) {
  .grid-2 > .field > label { min-height: 2.9em; display: flex; align-items: flex-end; }
  .grid-3 > .field > label { min-height: 3.1em; }
}

.metric-lead .metric-value.is-long { font-size: clamp(1.5rem, 2.4vw, 2.1rem); overflow-wrap: normal; word-break: break-word; }
@media print {
  .choice-options input:checked + label, .scenario-switch button[aria-checked="true"], .view-switch button[aria-checked="true"] { background: #eee; color: #000; }
}

/* ---------- Stress-testing tools ---------- */
.chart-band-outer { fill: rgba(47, 185, 166, 0.12); stroke: none; }
.chart-band-inner { fill: rgba(47, 185, 166, 0.24); stroke: none; }
.chart-sample { fill: none; stroke: rgba(232, 238, 244, 0.28); stroke-width: 1; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { display: inline-block; width: 14px; height: 10px; border-radius: 2px; }
.lg-outer { background: rgba(47, 185, 166, 0.25); }
.lg-inner { background: rgba(47, 185, 166, 0.5); }
.lg-median { background: var(--sea); height: 3px !important; }
.lg-sample { background: rgba(232, 238, 244, 0.45); height: 2px !important; }
.prob-cell { font-weight: 650; }
.prob-low { color: var(--pos); }
.prob-mid { color: var(--amber); }
.prob-high { color: var(--neg); }
.run-status { font-size: 13px; color: var(--muted); }
.run-status.is-busy::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent; animation: ea-spin 0.8s linear infinite; vertical-align: -1px; }
@keyframes ea-spin { to { transform: rotate(360deg); } }
.stress-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 10px; }
.stress-links a { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--paper-2); text-decoration: none; }
.stress-links a:hover { border-color: var(--accent); text-decoration: none; }
.stress-links strong { color: var(--ink); font-size: 14px; }
.stress-links span { color: var(--muted); font-size: 12.5px; }

/* ---------- Session volatility map ---------- */
.heatmap-wrap { overflow-x: auto; margin-top: 12px; }
.heatmap { border-collapse: separate; border-spacing: 2px; font-size: 11.5px; font-variant-numeric: tabular-nums; min-width: 640px; width: 100%; }
.heatmap th { color: var(--muted); font-weight: 600; padding: 2px 4px; text-align: center; }
.heatmap th[scope="row"] { text-align: left; padding-right: 8px; white-space: nowrap; }
.heatmap td { height: 30px; min-width: 22px; border-radius: 4px; text-align: center; color: var(--ink); background: var(--paper-2); cursor: default; }
.heatmap td.hm-empty { color: var(--rule-strong); }
.heatmap td:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.heatmap-scale { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.heatmap-scale .bar { flex: 0 0 160px; height: 10px; border-radius: 3px; background: linear-gradient(90deg, rgba(240, 169, 78, 0.08), rgba(240, 169, 78, 1)); }
.session-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-top: 12px; }
.session-card { padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--surface); }
.session-card.is-top { border-color: var(--accent); }
.session-card h3 { font-size: 14px; font-weight: 650; }
.session-card .sc-hours { font-size: 12px; color: var(--muted); margin-top: 2px; }
.session-card .sc-value { font-size: 22px; font-weight: 700; margin-top: 8px; }
.session-card .sc-note { font-size: 12px; color: var(--muted); margin-top: 2px; }
.data-status { padding: 14px 16px; border: 1px solid var(--amber); border-radius: var(--r-md); background: var(--amber-soft); color: var(--ink); margin-top: 14px; }
.data-meta { font-size: 12.5px; color: var(--muted); margin-top: 8px; }

.sim-inputs { max-width: 560px; margin-top: 12px; align-items: end; }
.sim-run { justify-content: flex-end; }
.sim-run .field-spacer { display: block; min-height: 2.9em; }
.sim-run .btn { width: 100%; }
.tool-group-title { margin-top: 10px; }
.tool-group-intro { color: var(--muted); margin: 4px 0 12px; }
.page-hub .home-tools + .home-tools { padding-top: 26px; }
.sv-controls { padding: 16px 18px; margin-top: 16px; }
.sv-controls .grid-3 { align-items: end; }
.sv-results { margin-top: 18px; }
.sv-page .results-head { margin-bottom: 12px; }
