:root {
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-muted: #eef5f1;
  --surface-accent: #e3f1ea;
  --text: #1a2420;
  --text-muted: #5c6b64;
  --border: #d8e3dc;
  --green: #1a6b52;
  --green-dark: #145240;
  --green-soft: #d9ebe3;
  --blue: #2f6fad;
  --amber: #c47a2c;
  --warn-bg: #fff4e8;
  --warn-text: #9a5b14;
  --ok-bg: #e8f5ee;
  --ok-text: #1a6b52;
  --radius: 14px;
  --radius-sm: 10px;
  --font: "DM Sans", system-ui, sans-serif;
  --font-display: "Instrument Serif", Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

html {
  scroll-behavior: smooth;
}

code {
  font-size: 0.9em;
  background: var(--surface-muted);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand__mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  border-radius: 10px;
}

.brand__name {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.brand__tag {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.header-note {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr minmax(260px, 300px);
  grid-template-rows: auto 1fr;
  gap: 1.25rem;
  padding: 1.25rem 2rem 2rem;
  max-width: 1440px;
  margin: 0 auto;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
}

.panel--inputs {
  grid-row: 1 / span 2;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.panel--hero {
  grid-column: 2 / span 2;
}

.panel--chart {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.panel--results {
  grid-column: 3;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  align-self: start;
}

.panel__head {
  margin-bottom: 1rem;
}

.panel__head h2,
.panel__title {
  margin: 0.15rem 0 0.35rem;
  font-family: var(--font);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.hero-card h2 {
  margin: 0.15rem 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 400;
  line-height: 1.2;
}

.panel__desc,
.hero-card__text {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green);
}

.timeline {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.hero-card {
  background: linear-gradient(135deg, var(--surface-accent) 0%, var(--surface-muted) 100%);
  border-radius: var(--radius-sm);
  padding: 1.35rem 1.5rem;
}

.hero-card__subhead {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--green-dark);
}

.hero-cta {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.55rem 1.1rem;
  background: var(--green);
  color: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  border-radius: 8px;
}

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

.hero-stats {
  display: flex;
  gap: 2rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.hero-stats__label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.hero-stats__value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--green-dark);
}

.hero-stats__sub {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.control-group {
  margin-bottom: 1.35rem;
}

.control-group:not(:first-child) {
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.control-group__title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
}

.control-group:first-child .control-group__title {
  margin-top: 0;
}

.control-grid {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.field__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.field label {
  font-size: 0.86rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.field__value {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--green);
  white-space: nowrap;
}

.field__row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field__row input[type="range"] {
  width: 100%;
}

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

.field__hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.field__foot .field__input {
  flex-shrink: 0;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--green);
  cursor: pointer;
}

.field__input {
  align-self: flex-end;
  width: 88px;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 0.82rem;
  text-align: right;
  background: var(--surface-muted);
}

.field__input:focus {
  outline: 2px solid var(--green-soft);
  border-color: var(--green);
}

.field__input--invalid {
  border-color: var(--warn-text);
  background: var(--warn-bg);
}

.age-error {
  margin-top: 0.85rem;
  padding: 0.65rem 0.85rem;
  background: var(--warn-bg);
  color: var(--warn-text);
  border-radius: 8px;
  font-size: 0.86rem;
  line-height: 1.4;
}

.chart-wrap {
  flex: 1;
  min-height: 300px;
  position: relative;
}

.narrative {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.plan-breakdown__title {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text);
}

.plan-step {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.plan-step:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.plan-step__num {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.plan-step__body > strong {
  display: block;
  font-size: 0.92rem;
  color: var(--green-dark);
  margin-bottom: 0.25rem;
}

.plan-step__body p strong {
  display: inline;
  font-weight: 600;
  color: var(--green-dark);
}

.plan-step__body p {
  margin: 0 0 0.4rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.plan-step__body p:last-child {
  margin-bottom: 0;
}

.plan-formula {
  padding: 0.5rem 0.75rem;
  background: var(--surface-muted);
  border-radius: 8px;
  font-size: 0.86rem !important;
  color: var(--text) !important;
  border-left: 3px solid var(--green);
}

.plan-note {
  font-size: 0.82rem !important;
  color: var(--text-muted) !important;
}

.results-intro {
  margin-bottom: 0.25rem;
}

.results-intro__text {
  margin: 0.35rem 0 0;
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.result-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.result-card--highlight {
  background: var(--surface-accent);
  border-color: #c5dfd2;
}

.result-card__label {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.result-card__value {
  margin: 0.25rem 0 0;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--green-dark);
}

.result-card__row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.result-card__sub {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge--warn {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.badge--ok {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.legend-card {
  padding: 0.9rem 1rem;
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  color: var(--text-muted);
}

.legend-card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.legend-card ul {
  margin: 0;
  padding-left: 1.1rem;
}

.legend-card li {
  margin-bottom: 0.3rem;
}

.footer-spacer {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 45vh;
  min-height: 360px;
  padding: 0 2rem;
}

.site-footer__disclaimer {
  text-align: center;
  padding-bottom: 1.5rem;
  font-size: 0.72rem;
  color: #8a9690;
  line-height: 1.6;
}

.site-footer__disclaimer p {
  margin: 0.2rem 0;
}

.site-footer {
  background: #1c1f1e;
  color: #b8c0bc;
  padding: 0;
  border-top: none;
}

.site-footer__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: 1440px;
  margin: 0 auto;
  padding: 1rem 2rem;
  font-size: 0.82rem;
}

.site-footer__copy {
  margin: 0;
  color: #c8d0cc;
}

.site-footer__links {
  display: flex;
  gap: 1.75rem;
  flex-wrap: wrap;
}

.site-footer__links a {
  color: #b8c0bc;
  text-decoration: none;
}

.site-footer__links a:hover {
  color: #fff;
  text-decoration: underline;
}

.legal-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem;
}

.legal-page h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2rem;
  margin: 0 0 0.5rem;
}

.legal-page h2 {
  font-size: 1rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--green-dark);
}

.legal-page p,
.legal-page li {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.legal-updated {
  font-size: 0.82rem !important;
  margin-bottom: 1.5rem !important;
}

.legal-back {
  color: var(--green);
  text-decoration: none;
  font-size: 0.88rem;
}

.legal-back:hover {
  text-decoration: underline;
}

.sitemap-list {
  padding-left: 1.25rem;
}

.sitemap-list li {
  margin-bottom: 0.65rem;
}

.sitemap-list a {
  color: var(--green-dark);
  font-weight: 600;
  text-decoration: none;
}

.sitemap-list a:hover {
  text-decoration: underline;
}

@media (max-width: 720px) {
  .site-footer__bar {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1.25rem;
  }

  .site-footer__links {
    gap: 1rem;
  }
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr 1fr;
  }

  .panel--inputs {
    grid-row: auto;
    grid-column: 1 / span 2;
    max-height: none;
  }

  .panel--hero {
    grid-column: 1 / span 2;
  }

  .panel--chart,
  .panel--results {
    grid-column: span 1;
  }
}

@media (max-width: 720px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .panel--inputs,
  .panel--hero,
  .panel--chart,
  .panel--results {
    grid-column: 1;
  }
}
