:root {
  --navy-950: #0b233f;
  --navy-800: #123c69;
  --navy-700: #1b4f7e;
  --blue-100: #eaf3f8;
  --teal-700: #08766e;
  --teal-100: #dff4f0;
  --gold-700: #8a5700;
  --gold-100: #fff2cd;
  --purple-700: #6941a5;
  --ink: #17202a;
  --muted: #566574;
  --line: #cfdae3;
  --surface: #ffffff;
  --surface-soft: #f5f8fa;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --success: #176b45;
  --success-soft: #e7f6ee;
  --warning: #8a5700;
  --warning-soft: #fff4d6;
  --shadow: 0 14px 34px rgba(15, 45, 73, 0.09);
  --radius: 16px;
  --focus: 0 0 0 3px rgba(22, 119, 183, 0.28);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--surface-soft);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button, input { font: inherit; }

button { cursor: pointer; }

a { color: var(--navy-700); }

.page-shell {
  width: min(1440px, calc(100% - 40px));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  color: #fff;
  background: var(--navy-950);
  border-radius: 6px;
  transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  color: #fff;
  background: var(--navy-950);
}

.header-inner,
.footer-inner,
.toolbar,
.card-heading-row,
.results-heading,
.scenario-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.header-inner { min-height: 68px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  font-weight: 750;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--navy-950);
  background: #7fe2d5;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 850;
}

.privacy-note { color: #d9e5ed; font-size: 14px; }

.hero {
  color: #fff;
  background: linear-gradient(135deg, var(--navy-800), #0b625f);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: clamp(32px, 6vw, 84px);
  align-items: center;
  padding-block: clamp(50px, 8vw, 92px);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2, h3, p { overflow-wrap: break-word; }

h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(38px, 5.3vw, 68px);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.hero-copy {
  max-width: 700px;
  margin: 22px 0 0;
  color: #e3f2f3;
  font-size: clamp(18px, 2vw, 22px);
}

.disclaimer {
  padding: 24px;
  color: var(--navy-950);
  background: rgba(255,255,255,0.94);
  border-left: 5px solid #f4c95d;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.disclaimer h2 { margin: 0 0 8px; font-size: 19px; }
.disclaimer p { margin: 0; font-size: 14px; }

.workspace { padding-block: 34px 60px; }

.toolbar {
  margin-bottom: 24px;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.toolbar-title { margin: 0; font-weight: 800; }
.toolbar-help { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.button-group { display: flex; flex-wrap: wrap; gap: 10px; }

.button {
  min-height: 44px;
  padding: 10px 16px;
  border: 2px solid transparent;
  border-radius: 9px;
  font-weight: 750;
}

.button-primary { color: #fff; background: var(--navy-800); }
.button-primary:hover { background: var(--navy-950); }
.button-secondary { color: var(--navy-950); background: #fff; border-color: var(--line); }
.button-secondary:hover { background: var(--blue-100); border-color: var(--navy-700); }

.button:focus-visible,
.text-button:focus-visible,
input:focus-visible,
summary:focus-visible,
a:focus-visible,
.table-scroll:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(420px, 0.82fr) minmax(560px, 1.18fr);
  gap: 28px;
  align-items: start;
}

.planner-form,
.results { min-width: 0; }

.form-section,
.results,
.error-summary {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form-section {
  margin: 0 0 22px;
  padding: 24px;
}

fieldset.form-section { min-width: 0; }

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  width: 100%;
  margin: 0 0 22px;
  padding: 0;
  border: 0;
}

.section-heading h2,
.legend-title {
  display: block;
  margin: 0;
  color: var(--navy-950);
  font-size: 21px;
  font-weight: 800;
  line-height: 1.25;
}

.section-heading p,
.legend-help {
  display: block;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

.step-number {
  display: grid;
  flex: 0 0 32px;
  height: 32px;
  place-items: center;
  color: #fff;
  background: var(--navy-800);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 800;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.field-wide { grid-column: 1 / -1; }

.field label {
  display: block;
  margin-bottom: 7px;
  color: var(--navy-950);
  font-size: 14px;
  font-weight: 750;
}

.optional { color: var(--muted); font-size: 12px; font-weight: 500; }

input[type="number"],
input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid #aab9c5;
  border-radius: 8px;
}

input:hover { border-color: var(--navy-700); }

input[aria-invalid="true"] { border-color: var(--danger); background: var(--danger-soft); }

.input-prefix,
.percent-input {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1.5px solid #aab9c5;
  border-radius: 8px;
  overflow: hidden;
}

.input-prefix:focus-within,
.percent-input:focus-within { border-color: var(--navy-700); box-shadow: var(--focus); }
.input-prefix:has(input[aria-invalid="true"]) { border-color: var(--danger); background: var(--danger-soft); }

.input-prefix > span,
.percent-input > span {
  padding-inline: 11px;
  color: var(--muted);
  font-weight: 650;
}

.input-prefix input,
.percent-input input {
  min-width: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none !important;
}

.input-prefix input { padding-left: 0; }

.field-help,
.field-error {
  margin: 5px 0 0;
  font-size: 12px;
  line-height: 1.35;
}

.field-help { color: var(--muted); }
.field-error { min-height: 1.35em; color: var(--danger); font-weight: 650; }

.error-summary {
  margin-bottom: 22px;
  padding: 16px 18px;
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #f0aaa4;
  box-shadow: none;
}

.error-summary strong { display: block; margin-bottom: 4px; }
.error-summary p { margin: 0; }

.scenario-list { display: grid; gap: 14px; }

.scenario-card {
  padding: 16px;
  background: var(--surface-soft);
  border: 2px solid transparent;
  border-radius: 12px;
}

.scenario-card.active { background: #eef7fb; border-color: var(--navy-700); }
.scenario-selector { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.scenario-selector input { width: 20px; height: 20px; accent-color: var(--navy-700); }
.scenario-selector strong, .scenario-selector small { display: block; }
.scenario-selector small { color: var(--muted); }

.text-button {
  padding: 6px;
  color: var(--navy-700);
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 750;
  text-decoration: underline;
}

.assumption-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 14px;
}

.assumption-grid > label { color: var(--muted); font-size: 11px; font-weight: 750; }
.percent-input { margin-top: 5px; }
.percent-input input { min-height: 38px; padding: 7px 0 7px 8px; }
.percent-input > span { padding-inline: 5px 8px; }
.assumption-note { margin: 14px 0 0; color: var(--muted); font-size: 12px; }

.results { padding: clamp(22px, 3vw, 34px); }
.results-heading { align-items: flex-start; margin-bottom: 8px; }
.results-heading .eyebrow { color: var(--teal-700); }
.results-heading h2 { margin: 0; font-size: 29px; letter-spacing: -0.025em; }

.status-badge,
.table-status {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-on-track { color: var(--success); background: var(--success-soft); }
.status-close { color: var(--warning); background: var(--warning-soft); }
.status-shortfall { color: var(--danger); background: var(--danger-soft); }

.result-narrative { margin: 0 0 22px; color: var(--muted); }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 24px;
}

.metric {
  min-height: 126px;
  padding: 17px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.metric-featured { color: #fff; background: var(--navy-800); border-color: var(--navy-800); }
.metric-label, .metric strong, .metric small { display: block; }
.metric-label { margin-bottom: 9px; color: var(--muted); font-size: 13px; font-weight: 700; }
.metric-featured .metric-label, .metric-featured small { color: #dceaf2; }
.metric strong { font-size: clamp(24px, 3vw, 34px); line-height: 1.2; letter-spacing: -0.025em; }
.metric small { margin-top: 7px; color: var(--muted); font-size: 12px; }
.positive { color: var(--success); }
.negative { color: var(--danger); }

.chart-card,
.comparison-card,
.method-card {
  margin-top: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.card-heading-row { align-items: flex-start; }
.card-heading-row h3 { margin: 0; color: var(--navy-950); font-size: 18px; }
.card-heading-row p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }

.chart-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; font-size: 11px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 18px; height: 3px; border-radius: 2px; }
.legend-conservative { background: var(--gold-700); }
.legend-moderate { background: var(--teal-700); }
.legend-optimistic { background: var(--purple-700); }

figure { margin: 15px 0 0; }
.chart { width: 100%; min-height: 280px; overflow: hidden; }
.chart svg { display: block; width: 100%; height: auto; font-family: inherit; }

.table-scroll { margin-top: 14px; overflow-x: auto; border-radius: 8px; }
table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 9px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); background: var(--surface-soft); font-size: 11px; text-transform: uppercase; letter-spacing: 0.035em; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.active-row { background: #eef7fb; }
.scenario-name-cell strong, .scenario-name-cell small { display: block; }
.scenario-name-cell small { color: var(--muted); }

.method-card { padding: 0; }
.method-card summary { padding: 17px 20px; color: var(--navy-800); border-radius: 12px; cursor: pointer; font-weight: 800; }
.method-card summary:hover { background: var(--blue-100); }
.method-content { padding: 0 22px 18px; color: var(--muted); font-size: 14px; }
.method-content ol { padding-left: 20px; }
.method-content li + li { margin-top: 8px; }

.site-footer { color: #dce8ef; background: var(--navy-950); }
.footer-inner { align-items: flex-start; padding-block: 28px; font-size: 13px; }
.footer-inner p { max-width: 760px; margin: 0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1080px) {
  .app-grid { grid-template-columns: 1fr; }
  .results { order: 2; }
}

@media (max-width: 760px) {
  .page-shell { width: min(100% - 24px, 1440px); }
  .privacy-note { display: none; }
  .hero-grid { grid-template-columns: 1fr; padding-block: 46px; }
  .disclaimer { padding: 19px; }
  .toolbar, .footer-inner { align-items: stretch; flex-direction: column; }
  .button-group { display: grid; grid-template-columns: 1fr 1fr; }
  .button-primary { grid-column: 1 / -1; }
  .field-grid, .metric-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .form-section, .results { padding: 20px 16px; }
  .scenario-card-heading, .card-heading-row { align-items: flex-start; flex-direction: column; }
  .assumption-grid { grid-template-columns: 1fr; }
  .assumption-grid > label { font-size: 13px; }
  .chart-legend { justify-content: flex-start; }
  .chart { overflow-x: auto; }
  .chart svg { min-width: 680px; }
  .metric { min-height: 112px; }
  h1 { font-size: clamp(38px, 12vw, 54px); }
}

@media (max-width: 390px) {
  .button-group { grid-template-columns: 1fr; }
  .button-primary { grid-column: auto; }
  .results-heading { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media print {
  @page { margin: 14mm; }
  body { color: #000; background: #fff; font-size: 11pt; }
  .site-header, .toolbar, .planner-form, .button-group { display: none !important; }
  .hero { color: #000; background: #fff; }
  .hero-grid { display: block; padding: 0 0 15px; }
  .hero h1 { font-size: 28pt; }
  .hero-copy { color: #333; }
  .disclaimer { margin-top: 12px; border: 1px solid #555; box-shadow: none; }
  .workspace { padding: 0; }
  .app-grid { display: block; }
  .results { padding: 0; border: 0; box-shadow: none; }
  .metric, .chart-card, .comparison-card, .method-card { break-inside: avoid; }
  .method-card { display: none; }
  .site-footer { color: #000; background: #fff; border-top: 1px solid #888; }
  .footer-inner { padding-block: 12px; }
}
