:root {
  --bg: #eef3f8;
  --surface: #ffffff;
  --surface-soft: #f7fafd;
  --surface-strong: #eaf3ff;
  --border: #d6e0ea;
  --border-strong: #bdd0e2;
  --ink: #182838;
  --muted: #5f7285;
  --accent: #2768c9;
  --accent-strong: #174a91;
  --accent-soft: #edf4ff;
  --pension: #3e82f7;
  --isa: #f0a13a;
  --home: #2fa67f;
  --shadow: 0 12px 30px rgba(25, 50, 79, 0.08);
  --radius-lg: 24px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", sans-serif;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  font-family: "Aptos Display", "Aptos", "Segoe UI", sans-serif;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.shell {
  width: min(1280px, calc(100% - 2rem));
  margin: 0 auto;
}

.hero {
  padding: 1.4rem 0 0.9rem;
}

.eyebrow,
.panel-kicker,
.summary-kicker {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-copy,
.overview,
.answer,
.panel-card,
.results-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 1.8rem 2rem;
}

.hero h1 {
  margin-top: 0.65rem;
  font-size: clamp(2.2rem, 4vw, 3.8rem);
  line-height: 1;
  max-width: 28ch;
}

.hero-text {
  margin-top: 0.9rem;
  max-width: 72ch;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.99rem;
}

.overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  padding: 1.25rem;
}

.overview-item {
  padding: 0.25rem 0.25rem 0.1rem;
}

.overview-item span,
.results-row span,
.mix-label span,
.summary-note,
.assumptions li {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.overview-item strong {
  display: block;
  margin-top: 0.35rem;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.15;
  font-weight: 700;
}

.overview-item-wide {
  grid-column: span 1;
}

.summary-note {
  margin-top: 0.45rem;
}

.answer {
  padding: 1.5rem;
  border-color: var(--border-strong);
  background:
    linear-gradient(180deg, rgba(237, 244, 255, 0.88), rgba(255, 255, 255, 0.96));
}

.answer-heading {
  max-width: 60rem;
}

.answer-heading h2 {
  margin-top: 0.35rem;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.08;
}

.answer-copy {
  margin-top: 0.75rem;
  color: var(--muted);
  line-height: 1.6;
  font-size: 1rem;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.1rem;
}

.answer-item {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.answer-item span {
  display: block;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.answer-item strong {
  display: block;
  margin-top: 0.45rem;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.05;
}

.answer-item p {
  margin-top: 0.5rem;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.94rem;
}

.answer-item-strong strong {
  color: var(--accent-strong);
}

.timeline-note {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: rgba(24, 74, 145, 0.06);
  border: 1px solid var(--border);
}

.timeline-kicker {
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.timeline-note h3 {
  margin-top: 0.35rem;
  font-size: 1.35rem;
}

.timeline-note p:last-child {
  margin-top: 0.45rem;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.95rem;
}

.layout {
  display: grid;
  gap: 1rem;
  padding: 0.9rem 0 2.5rem;
}

.planner,
.results {
  display: grid;
  gap: 1rem;
}

.planner {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: start;
}

.results {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: start;
}

.panel-card,
.results-card {
  padding: 1.15rem 1.2rem;
}

.panel-heading {
  margin-bottom: 0.95rem;
}

.panel-heading-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.panel-heading h2 {
  margin-top: 0.25rem;
  font-size: 1.4rem;
}

.section-copy {
  margin-top: 0.45rem;
  max-width: 60ch;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.93rem;
}

.field-grid {
  display: grid;
  gap: 0.8rem 0.9rem;
}

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

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

.field {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  min-width: 0;
}

.field-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.field span {
  font-weight: 700;
  color: var(--ink);
  font-size: 0.94rem;
  line-height: 1.35;
}

.field-help {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.1rem;
}

.field-help p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.field input {
  width: 100%;
  padding: 0.72rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
  font-size: 0.97rem;
}

.field select {
  width: 100%;
  padding: 0.72rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
  font-size: 0.97rem;
}

.field input:focus-visible {
  outline: 2px solid rgba(41, 95, 122, 0.18);
  border-color: var(--accent);
}

.field select:focus-visible {
  outline: 2px solid rgba(41, 95, 122, 0.18);
  border-color: var(--accent);
}

.full-width {
  grid-column: 1 / -1;
}

.panel-card-wide {
  grid-column: 1 / -1;
}

.panel-card-half {
  grid-column: span 6;
}

.panel-card-aside {
  display: grid;
  grid-template-columns: minmax(220px, 0.92fr) minmax(0, 1.4fr);
  gap: 1rem 1.2rem;
  align-items: start;
}

.panel-card-aside .panel-heading {
  margin-bottom: 0;
}

.panel-card-aside .section-copy {
  max-width: 34ch;
}

.savings-header,
.savings-row {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) repeat(3, minmax(0, 1fr)) auto;
  gap: 0.85rem;
  align-items: end;
}

.savings-header {
  margin-bottom: 0.55rem;
  padding: 0 0.1rem;
}

.savings-header span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.savings-rows {
  display: grid;
  gap: 0.85rem;
}

.savings-row {
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-soft);
}

.secondary-button,
.remove-button {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.secondary-button {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
}

.remove-button {
  padding: 0.7rem 0.95rem;
  align-self: stretch;
}

.secondary-button:hover,
.remove-button:hover {
  border-color: var(--border-strong);
  background: var(--accent-soft);
}

.rate-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.rate-preset {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.5rem 0.8rem;
  cursor: pointer;
}

.rate-preset:hover {
  border-color: var(--border-strong);
  background: var(--accent-soft);
  color: var(--ink);
}

.rate-preset.is-active {
  border-color: rgba(39, 104, 201, 0.32);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.section-toggle,
.mini-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
}

.section-toggle input,
.mini-toggle input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.panel-card.is-disabled,
.optional-field.is-disabled {
  opacity: 0.55;
}

.range-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}

input[type="range"] {
  padding: 0;
  accent-color: var(--accent);
  background: transparent;
}

.range-field small {
  color: var(--muted);
  line-height: 1.5;
}

.results {
  margin-top: 0.5rem;
}

.results > .overview,
.results > .answer,
.results > .results-detail-grid {
  grid-column: 1 / -1;
}

.results-card h3 {
  margin-bottom: 0.8rem;
  font-size: 1.25rem;
}

.results-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.results-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}

.results-row:last-child {
  border-bottom: none;
}

.results-row strong,
.mix-label strong {
  font-size: 1.02rem;
}

.results-row.emphasis strong {
  color: var(--accent-strong);
  font-size: 1.15rem;
}

.mix-group + .mix-group {
  margin-top: 1rem;
}

.mix-label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.45rem;
}

.stack-bar {
  height: 10px;
  border-radius: 999px;
  background: #e7eef6;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  width: 0%;
  transition: width 220ms ease;
}

.pension-fill {
  background: var(--pension);
}

.isa-fill {
  background: var(--isa);
}

.savings-fill {
  background: #7f8cf6;
}

.home-fill {
  background: var(--home);
}

.charts-card {
  grid-column: span 8;
  background: linear-gradient(180deg, rgba(247, 250, 253, 0.96), rgba(255, 255, 255, 1));
}

.assumptions {
  grid-column: span 4;
}

.charts-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.chart-mode-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.chart-mode {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.6rem 0.95rem;
  cursor: pointer;
}

.chart-mode:hover {
  border-color: var(--border-strong);
  background: var(--accent-soft);
  color: var(--ink);
}

.chart-mode.is-active {
  border-color: rgba(39, 104, 201, 0.32);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.chart-frame {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
}

.chart-meta h4 {
  margin: 0;
  font-family: "Aptos Display", "Aptos", "Segoe UI", sans-serif;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
}

.chart-meta p,
.chart-note {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

.chart-stage {
  position: relative;
  margin-top: 1rem;
  padding: 0.5rem 0 0;
  overflow: hidden;
}

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

.chart-tooltip {
  position: absolute;
  min-width: 200px;
  max-width: 260px;
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(24, 40, 56, 0.96);
  color: #f5f8fc;
  box-shadow: 0 18px 28px rgba(15, 28, 42, 0.18);
  pointer-events: none;
  z-index: 5;
}

.chart-tooltip strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.98rem;
}

.chart-tooltip span {
  display: block;
  color: rgba(245, 248, 252, 0.84);
  font-size: 0.88rem;
  line-height: 1.45;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-top: 1rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.chart-axis,
.chart-gridline,
.chart-xlabel,
.chart-ylabel {
  font-family: "Aptos", "Segoe UI", sans-serif;
}

.chart-axis {
  stroke: #cfd8e3;
  stroke-width: 1;
}

.chart-gridline {
  stroke: #e5ecf4;
  stroke-width: 1;
}

.chart-xlabel,
.chart-ylabel {
  fill: #6f8194;
  font-size: 12px;
}

.chart-bar {
  transition: opacity 160ms ease, transform 160ms ease;
  transform-origin: bottom;
}

.chart-bar.is-hovered {
  opacity: 0.88;
  transform: translateY(-2px);
}

.assumptions ul {
  margin: 0.75rem 0 0;
  padding-left: 1.1rem;
  line-height: 1.6;
}

.noscript-banner {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto 2rem;
  padding: 1rem 1.2rem;
  border-radius: var(--radius-md);
  background: #fff6de;
  color: #6f571f;
}

.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: 980px) {
  .answer-grid,
  .overview,
  .results-detail-grid,
  .layout {
    grid-template-columns: 1fr;
  }

  .planner,
  .results {
    grid-template-columns: 1fr;
  }

  .panel-card-half,
  .charts-card,
  .assumptions {
    grid-column: auto;
  }

  .panel-card-aside {
    grid-template-columns: 1fr;
  }

  .charts-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 1rem, 100%);
  }

  .hero {
    padding-top: 1rem;
  }

  .hero-copy {
    padding: 1.4rem;
  }

  .overview {
    padding: 1rem;
  }

  .answer {
    padding: 1rem;
  }

  .two-up,
  .three-up {
    grid-template-columns: 1fr;
  }

  .panel-heading-top,
  .field-top,
  .charts-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .rate-presets {
    width: 100%;
  }

  .savings-header {
    display: none;
  }

  .savings-row {
    grid-template-columns: 1fr;
  }

  .range-wrap {
    flex-direction: column;
    align-items: flex-start;
  }

  .layout {
    gap: 2rem;
  }
}
