/* Layout: inputs on the left, live amounts on the right (stacked on phones); reference tables in one reading column. */
:root {
  --bg: #f3f5f1; --surface: #fff; --sunk: #e8ece5; --text: #181d17; --muted: #5b6658; --line: #d8dfd4;
  --accent: #6a4420; --accent-ink: #fff; --accent-soft: #f2e8dc;
  --leaf: #2f7a45; --leaf-soft: #e0f1e4; --leaf-ink: #fff;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11140f; --surface: #181c16; --sunk: #20261d; --text: #e6ebe3; --muted: #9aa696; --line: #2c3528;
    --accent: #dba56a; --accent-ink: #241404; --accent-soft: #33261a;
    --leaf: #6ccf88; --leaf-soft: #17301d; --leaf-ink: #0c2012;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11140f; --surface: #181c16; --sunk: #20261d; --text: #e6ebe3; --muted: #9aa696; --line: #2c3528;
  --accent: #dba56a; --accent-ink: #241404; --accent-soft: #33261a;
  --leaf: #6ccf88; --leaf-soft: #17301d; --leaf-ink: #0c2012;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
/* Until calc.js draws the first result, hide what sits below the calculator so nothing jumps when it appears. */
html.calc-pending .calc-layout ~ *, html.calc-pending .foot { visibility: hidden; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); }
a { color: var(--accent); }
.wrap { max-width: 1080px; margin: 0 auto; padding-inline: 16px; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.15; margin: 1.3rem 0 .6rem; letter-spacing: -.015em; text-wrap: balance; }
h2 { font-size: 1.3rem; line-height: 1.25; margin: 2rem 0 .6rem; text-wrap: balance; }
h3 { font-size: 1.05rem; margin: 1.3rem 0 .3rem; }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 72ch; }
.small { font-size: .86rem; color: var(--muted); }
.prose { max-width: 72ch; }
.crumbs { font-size: .9rem; color: var(--muted); margin-top: 1rem; }
.crumbs a { color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; min-height: 58px; padding-block: 8px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.12rem; color: var(--text); text-decoration: none; }
.mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: var(--leaf); color: var(--leaf-ink); }
nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
nav a { color: var(--text); text-decoration: none; font-weight: 500; white-space: nowrap; }
nav a:hover { color: var(--accent); }

/* ---- calculator ---- */
.calc-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; margin-bottom: 2rem; }
@media (min-width: 900px) {
  .calc-layout { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); }
  .results { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 12px); }
}
.calc { display: grid; gap: 12px; min-width: 0; }
fieldset { margin: 0; padding: 10px 14px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
legend { padding: 0 6px; font-weight: 700; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; color: var(--muted); min-width: 0; }
.pick { font-size: 1rem; font-weight: 700; color: var(--text); }
input, select, button { font: inherit; }
input, select { color: var(--text); background: var(--surface); border: 1.5px solid var(--line); border-radius: 8px; padding: .5rem .65rem; min-width: 0; width: 100%; }
input:focus, select:focus { outline: none; border-color: var(--accent); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.area { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: end; padding: 8px 0; border-top: 1px dashed var(--line); }
.area:first-child { border-top: 0; }
.remove { width: 36px; height: 38px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--sunk); color: var(--text); font-size: 1.2rem; line-height: 1; cursor: pointer; }
#areas.single .remove { visibility: hidden; }
@media (max-width: 520px) { .area { grid-template-columns: 1fr 1fr; } .area label:first-child { grid-column: 1 / -1; } #areas.single .remove { display: none; } }
.ghost { margin-top: 8px; background: transparent; border: 1.5px dashed var(--line); border-radius: 8px; padding: .45rem .9rem; color: var(--accent); font-weight: 700; cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip { font-size: .86rem; padding: .25rem .7rem; border: 1px solid var(--line); border-radius: 999px; background: var(--sunk); color: var(--text); cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }

.results { display: grid; gap: 12px; min-width: 0; }
.empty { padding: 1rem 1.2rem; border: 1.5px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.figures div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .85rem; min-width: 0; }
.figures .main { border-top: 4px solid var(--leaf); }
.figures span { display: block; font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; line-height: 1.3; }
.figures b { display: block; font-size: clamp(1.1rem, 2.4vw, 1.4rem); line-height: 1.3; font-variant-numeric: tabular-nums; white-space: nowrap; }
.figures small { color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .figures { grid-template-columns: 1fr 1fr; } .figures .main { grid-column: 1 / -1; } }
.order { margin: 0; padding: .65rem .95rem; border-radius: var(--radius); background: var(--leaf-soft); border-left: 5px solid var(--leaf); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: .6rem .9rem; min-width: 0; }
.opt.win { border-color: var(--leaf); }
.opt.win h3::after { content: "Lower cost"; margin-left: .5rem; padding: .05rem .45rem; border-radius: 999px; background: var(--leaf-soft); color: var(--leaf); font-size: .7rem; letter-spacing: 0; text-transform: none; }
.opt h3 { margin: 0 0 .2rem; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.opt .big { margin: 0; font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.opt .small { margin: 0; }

/* ---- reference ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.cards .card { display: flex; flex-direction: column; gap: 2px; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--text); }
.cards .card:hover { border-color: var(--accent); }
.cards .card span { font-size: .86rem; color: var(--muted); }
.table-wrap { overflow-x: auto; margin: .5rem 0 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.chart { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .95rem; }
.chart th, .chart td { text-align: left; padding: .5rem .8rem; border-top: 1px solid var(--line); white-space: nowrap; }
.chart thead th { border-top: 0; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--sunk); }
.chart tbody th { font-weight: 600; }
.chart small { color: var(--muted); font-weight: 400; }
.ad { margin: 1.5rem 0; min-height: 100px; }
.foot { border-top: 1px solid var(--line); margin-top: 3rem; padding-block: 1.5rem; color: var(--muted); font-size: .9rem; }

/* Phone-only result bar, so the answer stays visible while filling in the form. */
.mini { display: none; }
@media (max-width: 899px) {
  .mini:not([hidden]) { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--leaf); color: var(--leaf-ink); text-decoration: none; box-shadow: 0 -4px 16px rgba(0, 0, 0, .18); }
  .mini b { font-size: 1.1rem; }
  .mini span { font-size: .86rem; }
  .mini .go { margin-left: auto; font-weight: 700; }
  body { padding-bottom: 64px; }
}
