:root {
  color-scheme: light dark;
  --bg: #f4f2ee;
  --card: #ffffff;
  --ink: #1d1f1c;
  --muted: #6b6f68;
  --line: #e3e0d9;
  --accent: #1f7a5a;      /* groen: goedkoop */
  --accent-ink: #ffffff;
  --sun: #e8a317;         /* zon */
  --dear: #c4553b;        /* duur */
  --chip: #ebe8e1;
  --radius: 16px;
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 4px 16px rgb(0 0 0 / .04);
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111312;
    --card: #1b1e1c;
    --ink: #eceee9;
    --muted: #9aa097;
    --line: #2b2f2c;
    --accent: #3cc48f;
    --accent-ink: #08130e;
    --sun: #f2b84b;
    --dear: #e2735a;
    --chip: #252926;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
main { max-width: 560px; margin: 0 auto; padding: 16px 16px 48px; }
a { color: inherit; }
h1 { font-size: 1.6rem; letter-spacing: -.02em; margin: 8px 0 4px; }
h2 { font-size: 1rem; margin: 0 0 10px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.top { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .9rem; text-decoration: none; }
.top b { color: var(--ink); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; box-shadow: var(--shadow); }
.label { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; font-weight: 600; }

/* Segmented control */
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1 1 auto; min-height: 44px; border: 1px solid var(--line); background: var(--chip); color: var(--ink); border-radius: 12px; padding: 8px 12px; font: inherit; font-weight: 600; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

select, input { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row3 { display: grid; grid-template-columns: 1.1fr 1fr; gap: 8px; align-items: end; }
.mini { font-size: .85rem; color: var(--muted); margin-top: 6px; }
.mini input { width: 5.2em; min-height: 34px; padding: 4px 8px; display: inline-block; }
.prog + .prog { margin-top: 14px; }
.field { margin-top: 12px; }

/* Resultaat */
.hero { background: var(--accent); color: var(--accent-ink); border: 0; }
.hero .label { color: inherit; opacity: .8; }
.big { font-size: 2.4rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; }
.hero .meta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-weight: 600; }
.hero .meta span { opacity: .95; }
.stap { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid rgb(255 255 255 / .25); }
.stap:first-of-type { border-top: 0; }
.stap .t { font-size: 1.5rem; font-weight: 800; }
.uitstel { margin-top: 12px; padding: 12px; border-radius: 12px; background: rgb(0 0 0 / .14); font-weight: 600; }
.uitstel b { font-size: 1.15rem; }

.kv { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); }
.kv:first-of-type { border-top: 0; }
.kv span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }
.good { color: var(--accent); }

.chart svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

details { margin: 12px 0; }
details > summary { cursor: pointer; font-weight: 600; padding: 12px 0; list-style: none; }
details > summary::before { content: "▸ "; color: var(--muted); }
details[open] > summary::before { content: "▾ "; }
.inst label { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; }
.inst input[type=number] { width: 6em; }
.inst input[type=checkbox] { width: 22px; height: 22px; min-height: 0; }

.status { font-size: .82rem; color: var(--muted); text-align: center; margin-top: 18px; }
.warn { background: color-mix(in srgb, var(--sun) 18%, var(--card)); border-color: color-mix(in srgb, var(--sun) 50%, var(--line)); }
.err { background: color-mix(in srgb, var(--dear) 15%, var(--card)); border-color: var(--dear); }
.muted { color: var(--muted); }

/* Startpagina */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.tile { display: flex; flex-direction: column; gap: 8px; text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-height: 140px; box-shadow: var(--shadow); }
.tile .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); }
.tile strong { font-size: 1.05rem; }
.tile small { color: var(--muted); }
.tile.soon { opacity: .55; border-style: dashed; box-shadow: none; }
