:root {
  --paper: #F3F6F4;
  --surface: #FFFFFF;
  --ink: #15302A;
  --muted: #5B6D67;
  --line: #D8E0DC;
  --radish: #C2305B;
  --radish-soft: #F7DCE5;
  --leaf: #2C7650;
  --leaf-soft: #DCEFE4;
  --tile: #E6ECE8;
  --ah: #009FE0;
  --jumbo: #E9AE00;
  --display: "Gabarito", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --r-sheet: 22px;
  --r-ctl: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0E1916; --surface: #15221E; --ink: #E7EFEB; --muted: #95A8A1; --line: #293A34;
    --radish: #F0698F; --radish-soft: #3A1D27; --leaf: #62C493; --leaf-soft: #17352A; --tile: #1E2E29;
    --ah: #3BB8EE; --jumbo: #F5C431; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0E1916; --surface: #15221E; --ink: #E7EFEB; --muted: #95A8A1; --line: #293A34;
  --radish: #F0698F; --radish-soft: #3A1D27; --leaf: #62C493; --leaf-soft: #17352A; --tile: #1E2E29;
  --ah: #3BB8EE; --jumbo: #F5C431; color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  background: var(--paper); color: var(--ink);
  font: 400 16px/1.45 var(--body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 24px 0;
}
button, a { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--radish); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }


/* ---------- de app ---------- */
.app { background: var(--surface); border: 1px solid var(--line); border-radius: 28px; overflow: clip; display: flex; flex-direction: column; min-width: 0; }
@media (max-width: 900px) { .app { border-radius: 22px; } }

.recipe { padding: 22px 20px 8px; display: grid; gap: 6px; }
.recipe h1 { font: 800 1.75rem/1.1 var(--display); letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
.recipe .by { color: var(--muted); font-size: .9rem; margin: 0; }

.controls { padding: 10px 20px 4px; display: grid; gap: 14px; }
.row-ctl { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.label { font-size: .9rem; color: var(--muted); }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; }
.stepper button { width: 40px; height: 40px; border: 0; background: none; font: 700 1.2rem/1 var(--display); border-radius: 999px; }
.stepper button:disabled { opacity: .35; cursor: default; }
.stepper output { min-width: 5.5em; text-align: center; font: 700 1rem var(--display); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: none; border-radius: 999px; padding: 7px 13px; font-size: .9rem; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* De weegschaal: het ene opvallende element */
.scale { margin: 14px 12px 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-radius: var(--r-sheet); background: var(--paper); padding: 5px; position: relative; }
.scale button { border: 0; background: none; border-radius: 18px; padding: 12px 12px 12px; text-align: left; display: grid; gap: 2px; position: relative; z-index: 1; }
.scale button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 0 var(--line), 0 6px 18px -10px color-mix(in srgb, var(--ink) 40%, transparent); }
.store-name { display: flex; align-items: center; gap: 7px; font-size: .9rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.ah { background: var(--ah); } .dot.jumbo { background: var(--jumbo); }
.store-total { font: 800 1.9rem/1.05 var(--display); letter-spacing: -0.02em; }
.store-note { font-size: .82rem; color: var(--muted); min-height: 1.2em; }
.store-note.win { color: var(--leaf); font-weight: 700; }

/* opbrengst */
.yield { margin: 10px 12px 0; padding: 14px 16px; border-radius: 18px; background: var(--leaf-soft); display: grid; gap: 4px; }
.yield .big { font: 700 1.05rem/1.3 var(--display); text-wrap: balance; }
.yield .small { font-size: .85rem; color: var(--muted); }
.est { display: inline-block; font-size: .75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; margin-left: 4px; }

/* lijst */
.list { padding: 6px 0 12px; }
.group { padding: 14px 20px 4px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.group h2 { font: 700 1.05rem var(--display); margin: 0; }
.group .sub { font-size: .85rem; color: var(--muted); }
.item { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 20px; border-top: 1px solid var(--line); }
.item.off { opacity: .55; }
.tile { width: 48px; height: 48px; border-radius: 12px; background: var(--tile); display: grid; place-items: center; font: 800 1.15rem var(--display); color: var(--muted); }
.need { font-size: .82rem; color: var(--muted); }
.prod { font-weight: 700; line-height: 1.25; }
.meta { font-size: .85rem; color: var(--muted); }
.why { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.left { display: inline-block; font-size: .78rem; margin-top: 5px; color: var(--muted); border: 1px dashed var(--line); border-radius: 6px; padding: 1px 6px; }
.promo { display: inline-block; font-size: .78rem; font-weight: 700; color: var(--radish); background: var(--radish-soft); border-radius: 6px; padding: 1px 6px; margin-top: 5px; }
.price { text-align: right; display: grid; gap: 6px; justify-items: end; }
.price .amt { font: 700 1.05rem var(--display); }
.price .packs { font-size: .8rem; color: var(--muted); }
.link-btn { border: 0; background: none; padding: 2px 0; font-size: .85rem; font-weight: 700; color: var(--radish); text-decoration: underline; text-underline-offset: 3px; }
.toggle { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 11px; font-size: .82rem; }
.toggle[aria-pressed="true"] { border-color: var(--leaf); color: var(--leaf); background: var(--leaf-soft); }

.gap { border-top: 1px solid var(--line); padding: 12px 20px 14px; display: grid; gap: 8px; }
.gap .head { display: flex; gap: 12px; align-items: start; }
.gap .tile { color: var(--radish); background: var(--radish-soft); }
.gap-choices { display: flex; gap: 6px; flex-wrap: wrap; padding-left: 60px; }
.gap-choices .chip { font-size: .85rem; text-align: left; }

/* kassabalk */
.bar { position: sticky; bottom: 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--line); padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px)); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.bar .tot { font: 800 1.35rem/1 var(--display); }
.bar .pp { font-size: .82rem; color: var(--muted); }
.order { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; background: var(--radish); color: #fff; border-radius: 999px; padding: 13px 18px; font: 700 1rem var(--display); white-space: nowrap; }
.order[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.bar .fine { grid-column: 1 / -1; font-size: .78rem; color: var(--muted); margin: 0; }

/* wissel-sheet */
dialog { border: 0; padding: 0; width: min(430px, 100vw - 24px); border-radius: var(--r-sheet); background: var(--surface); color: var(--ink); }
dialog::backdrop { background: color-mix(in srgb, var(--ink) 45%, transparent); }
.sheet { padding: 20px; display: grid; gap: 12px; }
.sheet h3 { font: 700 1.2rem var(--display); margin: 0; }
.opt { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; text-align: left; background: none; border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 12px; }
.opt[aria-current="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.opt .amt { font: 700 1rem var(--display); text-align: right; }
.sheet .actions { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.plain { border: 1px solid var(--line); background: none; border-radius: 999px; padding: 9px 14px; }

@media (prefers-reduced-motion: no-preference) {
  .scale button, .chip, .toggle { transition: background-color .15s, color .15s, box-shadow .15s; }
  .store-total { transition: color .2s; }
}

/* ---------- app-schil ---------- */
html, body { min-height: 100%; }
body { padding-block: 0; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--paper); }
.shell { max-width: 520px; margin: 0 auto; padding-block: max(16px, env(safe-area-inset-top, 0px)) 24px; display: grid; gap: 16px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font: 800 1.35rem/1 var(--display); letter-spacing: -0.01em; text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; gap: 8px; }
.brand svg { width: 26px; height: 26px; }
.iconbtn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; width: 40px; height: 40px; display: grid; place-items: center; }
.iconbtn svg { width: 20px; height: 20px; }
.view[hidden] { display: none; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sheet); padding: 18px; display: grid; gap: 12px; min-width: 0; }
.card h1 { font: 800 1.6rem/1.15 var(--display); margin: 0; text-wrap: balance; }
.card p { margin: 0; }
.muted { color: var(--muted); }
textarea, input[type="text"], input[type="password"] { width: 100%; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-ctl); padding: 12px 14px; resize: vertical; }
textarea { min-height: 96px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.primary { border: 0; background: var(--radish); color: #fff; border-radius: 999px; padding: 13px 20px; font: 700 1rem var(--display); }
.primary:disabled { opacity: .5; cursor: default; }
.err { color: var(--radish); font-size: .9rem; }
.recent { display: grid; gap: 0; }
.recent a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 12px 2px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.recent a:first-child { border-top: 0; }
.recent .t { font-weight: 700; overflow-wrap: anywhere; }
.recent .s { font-size: .82rem; color: var(--muted); }
.pill { font-size: .78rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--tile); color: var(--muted); align-self: start; white-space: nowrap; }
.pill.klaar { background: var(--leaf-soft); color: var(--leaf); }
.pill.fout { background: var(--radish-soft); color: var(--radish); }

/* verwerking */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.steps li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; }
.steps .mark { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); }
.steps li.done .mark { background: var(--leaf); border-color: var(--leaf); }
.steps li.now .mark { border-color: var(--radish); border-top-color: transparent; }
@media (prefers-reduced-motion: no-preference) { .steps li.now .mark { animation: spin .8s linear infinite; } }
@keyframes spin { to { transform: rotate(360deg); } }
.steps li.skip { color: var(--muted); }
.steps .sec { font-size: .85rem; color: var(--muted); }
.elapsed { font: 800 2.2rem/1 var(--display); letter-spacing: -0.02em; }

/* mandje in de app */
.app { border-radius: var(--r-sheet); }
.tile img { width: 100%; height: 100%; object-fit: contain; border-radius: 12px; background: #fff; }
details.recipe-text { padding: 4px 20px 14px; }
details.recipe-text summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
details.recipe-text ol, details.recipe-text ul { padding-left: 20px; margin: 6px 0; }
.timing { font-size: .8rem; color: var(--muted); padding: 0 20px 14px; }
.backrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.link { color: var(--radish); font-weight: 700; text-underline-offset: 3px; }

details.diet-box summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
details.diet-box summary::-webkit-details-marker { display: none; }
details.diet-box summary .val { font-weight: 700; font-size: .9rem; text-align: right; }
details.diet-box summary .val::after { content: " ▾"; color: var(--muted); }
details.diet-box[open] summary .val::after { content: " ▴"; }
details.diet-box .chips { margin-top: 10px; }
