:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #627066;
  --paper: #f7f5ef;
  --panel: #ffffff;
  --line: #d8ded5;
  --green: #206b4c;
  --green-dark: #164d38;
  --gold: #d9a441;
  --blue: #2f6f9f;
  --red: #a34135;
  --shadow: 0 20px 60px rgba(32, 45, 38, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(32, 107, 76, 0.12), transparent 36%),
    radial-gradient(circle at 84% 10%, rgba(217, 164, 65, 0.18), transparent 26%),
    var(--paper);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1380px, calc(100% - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto 32px;
  display: grid;
  grid-template-columns: minmax(360px, 0.92fr) minmax(420px, 1.08fr);
  gap: 18px;
}

.home-hero {
  width: min(1380px, calc(100% - 32px));
  margin: 16px auto 18px;
  padding: 24px 28px 34px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(243, 248, 245, 0.86)),
    linear-gradient(90deg, rgba(47, 111, 159, 0.1), rgba(217, 164, 65, 0.14));
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
}

.brand,
.nav-link,
.hero-action {
  color: var(--green-dark);
  font-weight: 900;
  text-decoration: none;
}

.brand {
  font-size: 1.05rem;
}

.nav-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-link {
  font-size: 0.9rem;
}

.hero-content {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(300px, 0.82fr);
  gap: 28px;
  align-items: end;
}

.hero-copy h1 {
  margin-bottom: 14px;
  font-size: clamp(3.5rem, 8vw, 8.2rem);
  line-height: 0.86;
  letter-spacing: 0;
}

.hero-lede {
  max-width: 760px;
  color: #3f4b43;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.45;
}

.hero-action {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  margin-top: 8px;
  padding: 0 18px;
  border-radius: 7px;
  color: #fff;
  background: var(--green);
}

.hero-action:hover {
  background: var(--green-dark);
}

.hero-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #d9e7df;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.season-line {
  display: grid;
  grid-template-columns: 64px minmax(90px, 1fr);
  gap: 4px 12px;
  align-items: baseline;
  padding: 14px;
  border-radius: 7px;
  background: #f7faf6;
  border-left: 5px solid var(--green);
}

.season-line span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.season-line strong {
  font-size: 1.35rem;
}

.season-line small {
  grid-column: 2;
  color: var(--muted);
  font-weight: 750;
}

.retirement-season {
  border-left-color: var(--gold);
}

.advantage-section {
  width: min(1380px, calc(100% - 32px));
  margin: 0 auto 18px;
  padding: 28px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.section-kicker {
  max-width: 880px;
  margin-bottom: 18px;
}

.section-kicker h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 3rem);
  line-height: 1.03;
}

.advantage-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.advantage {
  padding: 16px;
  border: 1px solid #dde6dc;
  border-radius: 8px;
  background: #ffffff;
}

.advantage h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.advantage p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.content-hero,
.content-page {
  width: min(980px, calc(100% - 32px));
  margin: 16px auto;
}

.content-hero {
  padding: 24px 28px 34px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
}

.content-heading h1 {
  max-width: 920px;
  font-size: clamp(2.6rem, 6vw, 5.8rem);
}

.content-page {
  display: grid;
  gap: 14px;
  margin-bottom: 32px;
}

.content-block {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.content-block h2 {
  margin-bottom: 10px;
  font-size: clamp(1.4rem, 2.5vw, 2.2rem);
}

.content-block p {
  color: #3f4b43;
  line-height: 1.65;
}

.content-block a {
  color: var(--green-dark);
  font-weight: 850;
}

.workspace,
.results {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.workspace {
  padding: 28px;
}

.results {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.intro {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 10px;
  font-size: clamp(2.15rem, 4vw, 4.7rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.intro h2 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 3vw, 3.4rem);
  line-height: 0.98;
}

.subtitle,
.section-heading p {
  color: var(--muted);
  line-height: 1.55;
}

.calculator {
  display: grid;
  gap: 16px;
}

.panel {
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

legend,
.section-heading h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 850;
}

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

.returns-panel,
.retirement-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.data-note {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.data-note a {
  color: var(--green-dark);
  font-weight: 800;
}

input:disabled {
  color: #7b857d;
  background: #eef1ed;
}

.historical-control[hidden],
.allocation-control[hidden],
.allocation-percent-control[hidden],
.static-bond-control[hidden],
.stock-only-note[hidden],
.stock-bond-note[hidden],
.bond-return-control[hidden],
.retirement-control[hidden],
.inflation-result[hidden],
.inflation-control[hidden] {
  display: none;
}

.checkbox-label {
  grid-template-columns: 18px 1fr;
  align-items: center;
  align-content: center;
  min-height: 44px;
  gap: 10px;
  padding-top: 20px;
}

.checkbox-label input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--green);
}

.graph-options {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: -8px;
}

.inline-checkbox {
  display: inline-grid;
  grid-template-columns: 18px max-content;
  align-items: center;
  min-height: 32px;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.inline-checkbox input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--green);
}

.compact-rate {
  width: 150px;
}

label {
  display: grid;
  gap: 7px;
  color: #3f4b43;
  font-size: 0.82rem;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cbd3ca;
  border-radius: 7px;
  padding: 10px 12px;
  background: #fbfcfb;
  color: var(--ink);
}

input:focus,
select:focus {
  outline: 3px solid rgba(47, 111, 159, 0.2);
  border-color: var(--blue);
}

.suffix-input {
  position: relative;
}

.suffix-input input {
  padding-right: 38px;
}

.suffix-input span {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 850;
}

.section-heading,
.result-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading p {
  margin: 5px 0 0;
  font-size: 0.88rem;
}

.icon-button,
.remove-period {
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  font-weight: 900;
}

.icon-button {
  width: 42px;
  height: 42px;
  color: #fff;
  background: var(--green);
  font-size: 1.35rem;
}

.period-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.period-row {
  display: grid;
  grid-template-columns: 0.8fr 0.8fr 1fr 0.9fr 38px;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid #e3e7e1;
  border-radius: 8px;
  background: #f9faf7;
}

.remove-period {
  width: 38px;
  height: 44px;
  color: var(--red);
  background: #f3e5e2;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-action,
.secondary-action {
  min-height: 46px;
  border-radius: 7px;
  border: 1px solid transparent;
  padding: 0 18px;
  font-weight: 850;
}

.primary-action {
  color: #fff;
  background: var(--green);
}

.primary-action:hover,
.icon-button:hover {
  background: var(--green-dark);
}

.secondary-action {
  background: #fff;
  border-color: var(--line);
  color: var(--green-dark);
}

.result-topline {
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

#results-title {
  margin: 0;
  font-size: clamp(2.3rem, 5vw, 5.1rem);
  line-height: 0.95;
}

.target-age {
  min-width: 128px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 50%;
  border: 8px solid rgba(217, 164, 65, 0.38);
  background: #fffaf0;
}

.target-age span {
  font-size: 2rem;
  font-weight: 900;
}

.target-age small {
  color: var(--muted);
  font-weight: 800;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 10px;
}

.metric {
  min-height: 92px;
  padding: 16px;
  border-radius: 8px;
  background: #f3f8f5;
  border: 1px solid #d9e7df;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.05rem, 2vw, 1.45rem);
}

.chart-wrap {
  min-height: 310px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f6f8f4);
}

canvas {
  display: block;
  width: 100%;
  height: 300px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf0eb;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

.error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(163, 65, 53, 0.16);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .hero-content,
  .advantage-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0;
  }

  .home-hero,
  .advantage-section {
    width: 100%;
    margin: 0;
    border-left: 0;
    border-right: 0;
    padding: 20px;
  }

  .topbar {
    margin-bottom: 24px;
  }

  .nav-group {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .hero-copy h1 {
    font-size: 4rem;
  }

  .content-hero,
  .content-page {
    width: 100%;
    margin: 0;
  }

  .content-hero,
  .content-block {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    padding: 20px;
  }

  .workspace,
  .results {
    border-left: 0;
    border-right: 0;
    padding: 20px;
  }

  .basics,
  .returns-panel,
  .retirement-panel,
  .metric-grid,
  .period-row {
    grid-template-columns: 1fr;
  }

  .remove-period {
    width: 100%;
  }

  .result-topline {
    align-items: flex-start;
  }

  .target-age {
    min-width: 96px;
  }

  .graph-options {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}
