:root {
  --bg: #f6f3ec;
  --card: #ffffff;
  --ink: #1d2420;
  --muted: #69716b;
  --line: #e4dfd3;
  --brand: #1f5f45;
  --brand-ink: #ffffff;
  --brand-soft: #e3efe8;
  --accent: #e0702f;
  --accent-soft: #fbe9dc;
  --ah: #2a6fb5;
  --lidl: #c9a100;
  --danger: #b4382c;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 4px 14px rgba(20, 30, 25, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121614; --card: #1b201d; --ink: #eef1ee; --muted: #9aa49d; --line: #2c332f;
    --brand: #4fb488; --brand-ink: #0d1a14; --brand-soft: #1e3329; --accent: #f08a4b; --accent-soft: #3a2619;
    --ah: #6aa7e6; --lidl: #e3c03a; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121614; --card: #1b201d; --ink: #eef1ee; --muted: #9aa49d; --line: #2c332f;
  --brand: #4fb488; --brand-ink: #0d1a14; --brand-soft: #1e3329; --accent: #f08a4b; --accent-soft: #3a2619;
  --ah: #6aa7e6; --lidl: #e3c03a; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.2; }

.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); padding-top: env(safe-area-inset-top); }
.top-in { max-width: 640px; margin: 0 auto; padding: 14px 16px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top h1 { font-size: 26px; letter-spacing: -.02em; }
.sync { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sync::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.sync.ok::before { background: #3aa76d; }
.sync.off::before { background: var(--accent); }

main { max-width: 640px; margin: 0 auto; padding: 4px 16px 24px; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; display: flex; justify-content: center; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; max-width: 160px; background: none; border: 0; padding: 9px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabs button[aria-current="page"] { color: var(--brand); }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.pad { padding: 16px; }
.stack > * + * { margin-top: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 22px 4px 8px; }

.btn { border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 650; background: var(--brand); color: var(--brand-ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; }
.btn.ghost { background: var(--brand-soft); color: var(--brand); }
.btn.line { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); display: inline-grid; place-items: center; color: var(--muted); flex: none; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.on { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.icon-btn.up.on { background: var(--brand-soft); color: var(--brand); }
.icon-btn.down.on { background: var(--accent-soft); color: var(--accent); }

/* Samenvatting */
.summary { background: var(--brand); color: var(--brand-ink); border-radius: 20px; padding: 18px; }
.summary .big { font-size: 34px; font-weight: 750; letter-spacing: -.02em; }
.summary .sub { opacity: .85; font-size: 14px; }
.summary .chips { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.summary .chip { background: rgba(255,255,255,.16); color: inherit; }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.chip.warm { background: var(--accent-soft); color: var(--accent); }
.chip.grey { background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--muted); }

/* Diner-kaart */
.dinner { padding: 14px; display: flex; gap: 12px; align-items: flex-start; }
.dinner .day { width: 44px; flex: none; text-align: center; font-weight: 750; font-size: 13px; color: var(--muted); text-transform: uppercase; padding-top: 2px; }
.dinner .day b { display: block; font-size: 22px; color: var(--ink); }
.dinner h3 { font-size: 17px; margin-bottom: 6px; }
.dinner .meta { display: flex; gap: 6px; flex-wrap: wrap; }
.dinner .acts { display: flex; gap: 6px; margin-top: 10px; }
.dinner.locked { border-color: var(--brand); }
.link { background: none; border: 0; padding: 0; text-align: left; }

/* Lijst */
.store-head { display: flex; align-items: center; gap: 8px; margin: 22px 4px 8px; }
.store-dot { width: 12px; height: 12px; border-radius: 4px; }
.store-dot.ah { background: var(--ah); } .store-dot.lidl { background: var(--lidl); }
.items { overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .check { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line); background: transparent; flex: none; display: grid; place-items: center; }
.item .check svg { width: 16px; height: 16px; stroke: var(--brand-ink); stroke-width: 3; fill: none; opacity: 0; }
.item.done .check { background: var(--brand); border-color: var(--brand); }
.item.done .check svg { opacity: 1; }
.item.done .nm, .item.done .pr { text-decoration: line-through; color: var(--muted); }
.item .nm { font-weight: 600; }
.item .pd { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .pr { font-weight: 650; white-space: nowrap; }
.item .open { background: none; border: 0; padding: 0; text-align: left; flex: 1; min-width: 0; }
.cat { font-size: 12px; color: var(--muted); font-weight: 700; padding: 10px 14px 4px; background: color-mix(in srgb, var(--bg) 60%, var(--card)); text-transform: uppercase; letter-spacing: .05em; }
.add-row { display: flex; gap: 8px; }
.add-row input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 11px 12px; }

/* Formulieren */
.field { padding: 14px 16px; border-top: 1px solid var(--line); }
.field:first-child { border-top: 0; }
.field label, .field .lbl { font-weight: 650; display: block; margin-bottom: 8px; }
.field .hint { font-size: 13px; color: var(--muted); margin: -4px 0 8px; }
.seg { display: flex; background: color-mix(in srgb, var(--muted) 12%, transparent); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 8px 4px; font-size: 13.5px; font-weight: 600; color: var(--muted); min-height: 38px; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 20px; font-weight: 600; }
.stepper output { min-width: 36px; text-align: center; font-weight: 700; font-size: 18px; }
.chips-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.tog { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; font-weight: 550; }
.tog[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.tog.neg[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
input[type=range] { width: 100%; accent-color: var(--brand); }
.range-labels { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.cuisine { display: grid; grid-template-columns: 1fr; gap: 6px; margin-bottom: 10px; }
.text-input { width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 11px 12px; }
.code { font: 600 20px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }

/* Sheet */
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-bg { position: absolute; inset: 0; background: rgba(10, 15, 12, .45); }
.sheet-body { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow: auto; background: var(--bg); border-radius: 22px 22px 0 0; padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; animation: up .22s ease-out; }
.sheet-body .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 12px; }
@keyframes up { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.ing-list { list-style: none; margin: 0; padding: 0; }
.ing-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.ing-list li:first-child { border-top: 0; }
.steps { margin: 0; padding-left: 22px; }
.steps li { margin-bottom: 10px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }
.opt:first-child { border-top: 0; }
.opt .radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.opt[aria-pressed="true"] .radio { border: 7px solid var(--brand); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 30; max-width: calc(100% - 32px); }
.empty { text-align: center; padding: 36px 16px; }
.empty svg { width: 54px; height: 54px; stroke: var(--brand); fill: none; stroke-width: 1.6; margin-bottom: 10px; }
.search { position: sticky; top: calc(58px + env(safe-area-inset-top)); z-index: 4; padding: 4px 0 8px; background: var(--bg); }
.hscroll { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--brand-soft); border-top-color: var(--brand); animation: spin 0.8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sheet-body, .spinner { animation: none; } }

body.nohh .tabs { display: none; }
body.nohh .summary .big { font-size: 28px; line-height: 1.15; }
