:root {
  --paper: #f6f3ec;
  --raised: #fcfaf5;
  --ink: #0b0e11;
  --body: #3c423c;
  --muted: #575d55;
  --line: #ded7c8;
  --accent: #0e5a50;
  --clay: #a8481c;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.page-head, .page-foot, .layout {
  width: min(1180px, 100% - 40px);
  margin-inline: auto;
}

.page-head { padding: 48px 0 24px; }
.eyebrow {
  margin: 0 0 10px;
  font: 12px/1.4 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
h1 {
  margin: 0;
  font: 600 clamp(28px, 3.5vw, 42px)/1.18 var(--sans);
  letter-spacing: -.02em;
  max-width: 18ch;
}
.lede { margin: 16px 0 0; max-width: 62ch; color: var(--body); }

.layout {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
  padding-bottom: 40px;
}
@media (min-width: 940px) {
  .layout { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
}

.panel {
  min-width: 0; /* a wide table must scroll inside the panel, not widen the page */
  background: var(--raised);
  border: 1px solid var(--line);
  padding: 20px;
}
@media (min-width: 700px) { .panel { padding: 24px; } }

.field { margin-bottom: 26px; }
.field-title {
  margin: 0 0 8px;
  font: 12px/1.3 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.note { margin: 8px 0 0; font-size: 14px; color: var(--muted); }

.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.segmented button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 500 14px/1 var(--sans);
  cursor: pointer;
}
.segmented button:hover { border-color: #7a8078; color: var(--ink); }
.segmented button[aria-checked="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.segmented button:disabled { opacity: .45; cursor: not-allowed; }
.segmented button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.dial { margin-bottom: 24px; }
.dial .hint { margin: 0 0 10px; font-size: 14px; color: var(--muted); }

.assumptions { border-top: 1px solid var(--line); padding-top: 16px; }
.assumptions ul { margin: 0; padding-left: 1.1em; font-size: 14px; color: var(--muted); }
.assumptions li + li { margin-top: 6px; }

.status { min-height: 22px; font-size: 14px; color: var(--muted); }
.status[data-kind="error"] { color: var(--clay); }
.status[data-kind="warn"] { color: var(--clay); }

.total-block { padding: 6px 0 18px; border-bottom: 1px solid var(--line); }
.total-label {
  margin: 0;
  font: 12px/1.3 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.total {
  margin: 6px 0 0;
  font: 600 clamp(32px, 4vw, 44px)/1.15 var(--sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.total-sub { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.estimate-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 125px), 1fr));
  gap: 8px;
  margin: 16px 0 0;
}
.estimate-metrics > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.estimate-metrics dt { font-size: 13px; color: var(--muted); }
.estimate-metrics dd {
  margin: 2px 0 0;
  font-size: clamp(17px, 2.1vw, 22px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
#drivers li:first-child strong { color: var(--accent); }
.inquiry:not([hidden]) {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 14px;
  padding: 0 16px;
  background: var(--accent);
  color: white;
  font-weight: 600;
}
.inquiry:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* the four-column breakdown may scroll inside its own box on narrow screens */
.table-wrap { overflow-x: auto; }
.breakdown {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  margin: 18px 0 0;
  font-size: 14px;
}
.breakdown th {
  text-align: left;
  padding: 0 10px 8px 0;
  border-bottom: 1px solid var(--ink);
  font: 400 11px/1.3 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.breakdown td {
  padding: 10px 10px 10px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.breakdown .why { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }
.breakdown .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.breakdown tr[data-unavailable="true"] td { color: var(--clay); }
.breakdown tr[data-zero="true"] td { color: var(--muted); }

.drivers { margin-top: 20px; }
.drivers ul { margin: 0; padding-left: 1.1em; font-size: 14px; color: var(--body); }
.drivers li + li { margin-top: 4px; }

.source { margin: 18px 0 0; font: 12px/1.5 var(--mono); color: var(--muted); }

.page-foot { padding: 8px 0 48px; border-top: 1px solid var(--line); }
.page-foot p { margin: 16px 0 0; font-size: 13px; color: var(--muted); max-width: 70ch; }

/* Below 700px the four-column table becomes stacked rows: no sideways scroll,
   every value keeps its label. */
@media (max-width: 699px) {
  .table-wrap { overflow: visible; }
  .breakdown { min-width: 0; }
  .breakdown thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .breakdown,
  .breakdown tbody,
  .breakdown tr,
  .breakdown td { display: block; width: auto; }
  .breakdown tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .breakdown td { border: 0; padding: 2px 0; }
  .breakdown td[data-label] { display: flex; justify-content: space-between; gap: 16px; }
  .breakdown td[data-label]::before {
    content: attr(data-label);
    font: 11px/1.4 var(--mono);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .breakdown td.num { text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
