:root {
  color-scheme: light;
  --page: #f6f6f0;
  --surface: #fffefa;
  --ink: #152e25;
  --muted: #4c6258;
  --rule: #d9e1d6;
  --green: #176749;
  --green-dark: #184c38;
  --green-soft: #e8f0e5;
  --lime: #dcf090;
  --red: #973e2b;
  --display: Georgia, "Times New Roman", serif;
  --sans: Aptos, "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--sans); line-height: 1.45; }
h1, h2, h3, p, figure, fieldset, dl, dd { margin: 0; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .2em; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
.page-width { width: min(1240px, calc(100% - 88px)); margin-inline: auto; }

.topbar { background: var(--ink); color: var(--surface); }
.topbar-inner { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { font-weight: 650; letter-spacing: -.035em; font-size: 1.23rem; white-space: nowrap; }
.brand span { color: var(--lime); }
.topbar-link { font-size: .9rem; color: #e0eee3; }
.topbar a:focus-visible { outline-color: var(--lime); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.17fr) minmax(0, .83fr);
  gap: clamp(24px, 5vw, 88px);
  align-items: center;
  padding: 44px 0 38px;
}
.hero-label { color: var(--green-dark); font-weight: 650; font-size: .92rem; letter-spacing: .025em; }
.hero h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.65rem, 4.6vw, 4.75rem);
  letter-spacing: -.056em;
  line-height: 1.02;
  margin: 10px 0 15px;
}
.hero-copy > p:last-child { max-width: 50ch; color: var(--muted); font-size: 1.02rem; }
.hero-image { height: 234px; background: var(--green-soft); position: relative; overflow: hidden; border-radius: 3px; }
.hero-image img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 59%; display: block; }
.hero-image figcaption {
  position: absolute;
  left: 13px;
  bottom: 12px;
  padding: 4px 9px;
  border-radius: 2px;
  background: var(--ink);
  color: var(--surface);
  font-size: .78rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(290px, .85fr) minmax(0, 1.55fr);
  align-items: stretch;
  gap: clamp(24px, 4vw, 54px);
  border-top: 1px solid var(--rule);
  padding-top: 29px;
}
.scenario { min-width: 0; padding-bottom: 10px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 16px; }
.section-heading h2 { font-weight: 620; font-size: 1.27rem; letter-spacing: -.025em; }
.reset { border: 0; border-bottom: 1px solid transparent; background: none; color: var(--green-dark); padding: 5px 0; font-size: .88rem; }
.reset:hover { border-color: var(--green-dark); }
fieldset { min-inline-size: 0; border: 0; padding: 0; }
legend { font-size: .91rem; font-weight: 620; margin-bottom: 8px; padding: 0; }
.court-selection { display: flex; width: 100%; align-items: center; margin-bottom: 17px; }
.court-options { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border: 1px solid var(--rule); border-radius: 4px; }
.court-options label { position: relative; cursor: pointer; }
.court-options input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.court-options span { display: grid; width: 43px; min-height: 32px; place-items: center; border-radius: 3px; color: var(--green-dark); font-variant-numeric: tabular-nums; }
.court-options label:hover span { background: var(--green-soft); }
.court-options input:checked + span { background: var(--ink); color: var(--surface); }
.court-options input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }

.slider-group > legend {
  width: 100%;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  color: var(--green-dark);
  margin-bottom: 10px;
}
.investment-group { margin-top: 5px; }
.range-field { min-width: 0; }
.range-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.range-title label { font-size: .98rem; }
.range-title output { color: var(--green-dark); font-weight: 670; white-space: nowrap; font-variant-numeric: tabular-nums; }
.field-help { font-size: .82rem; color: var(--muted); margin-top: 1px; }
.range-field input {
  appearance: none;
  display: block;
  width: 100%;
  height: 23px;
  margin: 1px 0 7px;
  cursor: pointer;
  background: transparent;
  --track: linear-gradient(to right, var(--green) 0 var(--progress, 0%), var(--rule) var(--progress, 0%) 100%);
}
.range-field input::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: var(--track); }
.range-field input::-moz-range-track { height: 3px; border-radius: 3px; background: var(--track); }
.range-field input::-webkit-slider-thumb {
  appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -6px;
  border: 1px solid var(--green);
  border-radius: 50%;
  background: var(--green);
}
.range-field input::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 1px solid var(--green);
  border-radius: 50%;
  background: var(--green);
}
.range-field input:focus-visible { outline-offset: 1px; border-radius: 3px; }

.results {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  min-width: 0;
  padding: clamp(19px, 2.5vw, 34px);
}
.result-heading { display: flex; justify-content: space-between; align-items: start; gap: 18px; }
.result-heading h2 { font-size: 1.04rem; font-weight: 600; color: var(--muted); }
.cash {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.45rem, 5.3vw, 4.75rem);
  line-height: 1.02;
  letter-spacing: -.065em;
  color: var(--green-dark);
  margin-top: 5px;
  white-space: nowrap;
  font-variant-numeric: lining-nums tabular-nums;
}
.negative { color: var(--red) !important; }
.result-period { color: var(--muted); font-size: .81rem; text-align: right; max-width: 20ch; }
.result-period span { display: block; }
.timeline { margin-top: 25px; }
.timeline + .timeline { border-top: 1px solid var(--rule); margin-top: 20px; padding-top: 20px; }
.chart-heading { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 5px 17px; }
.chart-heading h3 { font-size: 1.07rem; font-weight: 630; }
.chart-heading p { font-size: .9rem; font-weight: 620; color: var(--green-dark); }
.chart-frame { height: clamp(198px, 18vw, 231px); margin-top: 8px; }
.time-chart { display: block; width: 100%; height: 100%; overflow: visible; }
.time-chart text { fill: var(--muted); font-size: 12px; }
.time-chart .grid { stroke: var(--rule); stroke-width: 1; }
.time-chart .zero { stroke: var(--muted); stroke-width: 1.2; }
.time-chart .curve { fill: none; stroke: var(--green); stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
.time-chart .projection { stroke: var(--green); stroke-width: 1; stroke-dasharray: 3 3; opacity: .5; }
.time-chart .threshold-mark { fill: var(--surface); stroke: var(--green); stroke-width: 1.8; }
.time-chart .endpoint { fill: var(--green); stroke: var(--surface); stroke-width: 1.2; }
.court-comparison { display: grid; gap: 12px; margin-block: 16px 13px; padding: 0; list-style: none; }
.court-comparison > li {
  display: grid;
  grid-template-columns: 4.3rem minmax(0, 1fr) 6.4rem;
  align-items: center;
  gap: 8px;
  font-size: .9rem;
}
.comparison-label { color: var(--muted); white-space: nowrap; }
.comparison-value { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.court-comparison .selected { font-weight: 650; }
.court-comparison .selected .comparison-label { color: var(--ink); }
.comparison-track { position: relative; height: 5px; background: var(--rule); }
.comparison-track::after { position: absolute; content: ""; left: 50%; top: -4px; bottom: -4px; width: 1px; background: var(--muted); opacity: .4; }
.comparison-fill { position: absolute; top: 0; height: 100%; background: var(--green); }
.comparison-fill.outflow { background: var(--red); }
.timeline figcaption { color: var(--muted); font-size: .82rem; padding-top: 2px; }

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 16px;
  border-top: 1px solid var(--rule);
  margin-top: 22px;
  padding-top: 15px;
}
.summary dt, .operating-thresholds dt { font-size: .85rem; color: var(--muted); }
.summary dd {
  margin-top: 4px;
  font-weight: 640;
  font-size: clamp(1rem, 1.65vw, 1.39rem);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.operating-thresholds { padding-top: 11px; margin-top: 15px; border-top: 1px solid var(--rule); display: grid; gap: 6px; }
.operating-thresholds div { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 3px 14px; }
.operating-thresholds dd { font-weight: 620; font-size: .96rem; font-variant-numeric: tabular-nums; }

.assumptions { margin: 30px 0 42px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.assumptions summary { padding: 16px 0; cursor: pointer; color: var(--green-dark); font-weight: 620; }
.detail-content { display: grid; grid-template-columns: 1fr 1.15fr; gap: 24px 46px; padding: 3px 0 25px; }
.details-list div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-block: 6px; border-bottom: 1px solid var(--rule); }
.details-list dd { font-weight: 620; white-space: nowrap; font-variant-numeric: tabular-nums; }
.model-notes { margin: 0; padding-left: 18px; color: var(--muted); }
.model-notes li + li { margin-top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 915px) {
  .page-width { width: calc(100% - 56px); }
  .workspace { grid-template-columns: minmax(250px, .82fr) minmax(0, 1.18fr); gap: 24px; }
  .result-heading { flex-wrap: wrap; gap: 8px; }
  .result-period { text-align: left; max-width: none; }
}
@media (max-width: 680px) {
  .page-width { width: calc(100% - 36px); }
  .hero, .workspace, .detail-content { grid-template-columns: minmax(0, 1fr); }
  .hero { gap: 20px; padding: 31px 0 25px; }
  .desktop-break { display: none; }
  .hero-image { height: 160px; }
  .workspace { padding-top: 23px; gap: 15px; }
  .section-heading { margin-bottom: 12px; }
  .results { padding: 17px; }
}
@media (pointer: coarse) {
  .range-field input { height: 37px; margin-bottom: 1px; }
  .court-options span { min-height: 40px; }
}
@media (prefers-reduced-motion: no-preference) {
  .range-field input::-webkit-slider-thumb { transition: box-shadow .13s ease; }
  .range-field input::-webkit-slider-thumb:hover { box-shadow: 0 0 0 5px var(--green-soft); }
}
