:root {
  --bg: #f6f7f9; --card: #fff; --text: #1b2430; --muted: #5d6b7c;
  --line: #dde2e8; --accent: #0b6e4f; --accent-bg: #e6f4ee; --on-accent: #fff; --warn: #9a5b00; --warn-bg: #fff4e0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12171d; --card: #1a212a; --text: #e8edf2; --muted: #98a6b5;
    --line: #2b3541; --accent: #4cc79b; --accent-bg: #16352b; --on-accent: #0b1f17; --warn: #f0b255; --warn-bg: #3a2c12;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
header, main, footer { max-width: 960px; margin: 0 auto; padding: 0 16px; }
header { padding-top: 28px; }
h1 { margin: 0 0 4px; font-size: 1.6rem; }
header p { margin: 0 0 20px; color: var(--muted); }
main { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 800px) { main { grid-template-columns: 380px 1fr; } }

form, .card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
form { display: grid; gap: 12px; }
label { display: grid; gap: 4px; font-size: .9rem; color: var(--muted); }
input, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 0; display: grid; gap: 12px; }
legend { padding: 0 6px; font-weight: 600; font-size: .9rem; }
small { color: var(--muted); }

#results { display: grid; gap: 12px; }
.hero { background: var(--accent-bg); border-color: transparent; }
.hero .big { font-size: 1.5rem; font-weight: 700; color: var(--accent); margin: 0; }
.hero p { margin: 4px 0 0; }
.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
footer { padding: 24px 16px 40px; color: var(--muted); font-size: .8rem; }
h2 { margin: 0 0 8px; font-size: 1rem; }
.chart svg { width: 100%; height: auto; display: block; }
.grid { stroke: var(--line); stroke-width: 1; }
.tick { fill: var(--muted); font-size: 11px; }
.line { fill: none; stroke-width: 2.5; stroke-linejoin: round; }
.line.base { stroke: var(--muted); stroke-dasharray: 6 4; }
.line.scen { stroke: var(--accent); }
.legend { margin: 8px 0 0; font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
.key { display: inline-block; width: 18px; height: 0; border-top: 3px solid; margin-right: 6px; vertical-align: middle; }
.key.base { border-top: 3px dashed var(--muted); }
.key.scen { border-top-color: var(--accent); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 6px; text-align: right; border-bottom: 1px solid var(--line); }
thead th { color: var(--muted); font-weight: 600; font-size: .8rem; }
th[scope="row"], thead th:first-child { text-align: left; font-weight: 500; }
tbody tr:last-child > * { border-bottom: 0; }
td:last-child { color: var(--accent); font-weight: 600; }
[hidden] { display: none !important; }
button { font: inherit; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); cursor: pointer; }
button:hover { border-color: var(--accent); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.note { margin: 8px 0 0; font-size: .8rem; color: var(--muted); }
.info { max-width: 960px; margin: 32px auto 0; padding: 0 16px; }
.info section { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; margin-bottom: 16px; }
.info h2 { font-size: 1.15rem; margin: 0 0 8px; }
.info p { margin: 0 0 12px; }
.info p:last-child { margin-bottom: 0; }
details { border-top: 1px solid var(--line); padding: 10px 0; }
details:first-of-type { border-top: 0; }
summary { cursor: pointer; font-weight: 600; }
summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
details p { margin: 8px 0 0; color: var(--muted); }
.t { display: block; }
label.calc .t::after { content: " (calculated)"; color: var(--accent); font-weight: 600; }
label.calc input { background: var(--accent-bg); border-style: dashed; color: var(--accent); font-weight: 600; }
.warn ul { margin: 6px 0; padding-left: 20px; }
.warn p { margin: 6px 0 0; }
label.check { display: flex; gap: 8px; align-items: center; color: var(--text); }
label.check input { width: auto; margin: 0; }
main.page { display: block; }
.back { margin: 0 0 8px; font-size: .9rem; }
a { color: var(--accent); }
footer p { margin: 0 0 6px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions button { flex: 1 1 auto; }
/* Buttons: one clear primary action, a quiet destructive one */
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.quiet { background: none; border-color: transparent; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
button.quiet:hover { color: var(--text); border-color: transparent; }
input[type="checkbox"] { width: 20px; height: 20px; }
input, select { accent-color: var(--accent); }
/* Mobile summary bar */
.sticky { position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 10;
  background: var(--accent); color: var(--on-accent); padding: 12px 16px; border-radius: 12px; font-weight: 600;
  text-decoration: none; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); }
@media (min-width: 800px) { .sticky { display: none; } }
.brand { margin: 0 0 6px; font-weight: 700; font-size: .95rem; letter-spacing: .01em; }
.brand a { color: var(--accent); text-decoration: none; }
/* Guides */
.guide-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.guide-list a { font-weight: 600; }
.guide-list span { display: block; color: var(--muted); font-size: .9rem; }
.guide section { max-width: 760px; }
.guide .lead { font-size: 1.1rem; }
.guide ul { margin: 0 0 12px; padding-left: 20px; }
.guide li { margin-bottom: 6px; }
.guide table { margin-bottom: 12px; }
.guide td:last-child { color: inherit; font-weight: 400; }
a.cta { display: inline-block; background: var(--accent); color: var(--on-accent); padding: 10px 16px; border-radius: 8px; font-weight: 600; text-decoration: none; }
a.cta:hover { filter: brightness(1.08); }
.guide .guide-list { padding-left: 0; }
