/* Indkøb · Thomas Nordbo Andersen · v1.0 · 2026-11-19 */

:root {
  --bg: #f6f2ea;
  --surface: #fffdf8;
  --surface-2: #efe9dd;
  --ink: #1d2a22;
  --ink-2: #5b665e;
  --ink-3: #8b938c;
  --line: #e2dbcc;
  --brand: #1f5c3f;
  --brand-ink: #ffffff;
  --brand-soft: #d9eadf;
  --accent: #d9542b;      /* tilbud (fase 2) og advarsler */
  --accent-soft: #fbe3d8;
  --rema: #0f3d91;
  --netto: #c9a400;
  --ok: #2f8a57;
  --shadow: 0 1px 2px rgba(29, 42, 34, .06), 0 6px 20px rgba(29, 42, 34, .07);
  --radius: 16px;
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1612;
    --surface: #17211b;
    --surface-2: #1f2b24;
    --ink: #e9efe9;
    --ink-2: #a9b5ac;
    --ink-3: #74807a;
    --line: #2a3830;
    --brand: #5cc28c;
    --brand-ink: #08130d;
    --brand-soft: #1d3a2b;
    --accent: #ff8a5c;
    --accent-soft: #3a2219;
    --rema: #7aa2ff;
    --netto: #f0cf3a;
    --ok: #5cc28c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.4;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── top ─────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  padding: calc(env(safe-area-inset-top) + 14px) 16px 10px;
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.top.scrolled { border-bottom-color: var(--line); }
.top-row { display: flex; align-items: center; gap: 10px; }
.title {
  font-family: var(--font-display);
  font-weight: 700; font-size: 28px; letter-spacing: -.02em;
  margin: 0; flex: 1;
}
.title small { font-family: var(--font); font-size: 15px; font-weight: 600; color: var(--ink-3); margin-left: 6px; }
.net {
  font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent); display: none;
}
.net.show { display: inline-block; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 0;
  background: var(--surface-2); display: grid; place-items: center;
}

.seg {
  display: flex; gap: 4px; margin-top: 12px; padding: 4px;
  background: var(--surface-2); border-radius: 12px;
}
.seg button {
  flex: 1; border: 0; background: transparent; padding: 8px 6px; border-radius: 9px;
  font-weight: 600; font-size: 14px; color: var(--ink-2); white-space: nowrap;
  transition: background .15s, color .15s, box-shadow .15s;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg .n { font-weight: 500; color: var(--ink-3); margin-left: 3px; }

/* ── indhold ─────────────────────────────────────────── */
main { padding: 8px 16px calc(env(safe-area-inset-bottom) + 96px); max-width: 640px; margin: 0 auto; }
.view[hidden] { display: none !important; }

.add {
  display: flex; gap: 8px; margin: 6px 0 16px;
}
.add input {
  flex: 1; min-width: 0; padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface); font-size: 16px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.add input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.btn {
  border: 0; border-radius: 14px; padding: 12px 18px; font-weight: 700;
  background: var(--brand); color: var(--brand-ink);
  transition: transform .08s, filter .15s;
}
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: var(--accent-soft); color: var(--accent); }
.btn.small { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .5; }

.suggest {
  margin: -10px 0 14px; display: flex; flex-wrap: wrap; gap: 6px;
}
.suggest button {
  border: 1px solid var(--line); background: var(--surface); border-radius: 99px;
  padding: 6px 12px; font-size: 14px; font-weight: 500;
}

.group { margin-bottom: 18px; }
.group h2 {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-3); margin: 0 4px 8px;
}
.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-top: 1px solid var(--line); min-height: 58px;
  transition: background .15s, opacity .25s;
}
.row:first-child { border-top: 0; }
.row:active { background: var(--surface-2); }
.check {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--ink-3); background: transparent; display: grid; place-items: center;
  transition: background .15s, border-color .15s, transform .1s;
}
.check:active { transform: scale(.88); }
.check svg { opacity: 0; transition: opacity .15s; }
.row.done .check { background: var(--ok); border-color: var(--ok); }
.row.done .check svg { opacity: 1; }
.row.done .name { text-decoration: line-through; color: var(--ink-3); }
.row .body { flex: 1; min-width: 0; border: 0; background: none; text-align: left; padding: 0; }
.name { font-weight: 600; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { font-size: 13px; color: var(--ink-3); display: flex; gap: 8px; align-items: center; margin-top: 1px; }
p.meta, span.meta { display: block; }  /* afsnit med fed tekst må ikke blive til kolonner */
.qty {
  flex: none; min-width: 44px; padding: 6px 10px; border-radius: 10px;
  background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 15px;
  text-align: center; border: 0;
}
.pill {
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px;
  background: var(--surface-2); color: var(--ink-2); letter-spacing: .02em;
}
.pill.rema { background: color-mix(in srgb, var(--rema) 16%, transparent); color: var(--rema); }
.pill.netto { background: color-mix(in srgb, var(--netto) 22%, transparent); color: color-mix(in srgb, var(--netto) 70%, var(--ink)); }
.pill.nfc { background: var(--brand-soft); color: var(--brand); }
.pill.warn { background: var(--accent-soft); color: var(--accent); }
.pill.pending { background: var(--accent-soft); color: var(--accent); }

.empty {
  text-align: center; padding: 48px 20px; color: var(--ink-2);
}
.empty .big { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }

.done-head {
  display: flex; align-items: center; justify-content: space-between; margin: 26px 4px 8px;
}
.done-head button.link { border: 0; background: none; color: var(--ink-2); font-weight: 600; font-size: 14px; padding: 4px; }
.done-head h2 {
  margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--ink-3);
}

/* ── varer og chips ──────────────────────────────────── */
.toolbar { display: flex; gap: 8px; margin: 6px 0 14px; }
.toolbar input {
  flex: 1; min-width: 0; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); outline: none;
}
.toolbar input:focus { border-color: var(--brand); }
.tagchips { display: flex; gap: 4px; flex-wrap: wrap; }
.tagchip {
  font-family: ui-monospace, "Cascadia Mono", monospace; font-size: 12px; font-weight: 600;
  padding: 2px 7px; border-radius: 6px; background: var(--brand-soft); color: var(--brand);
}
.tagchip.free { background: var(--accent-soft); color: var(--accent); }
.mono { font-family: ui-monospace, "Cascadia Mono", monospace; }
.hint {
  font-size: 14px; color: var(--ink-2); background: var(--surface); border: 1px dashed var(--line);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 16px;
}
.hint code { font-family: ui-monospace, monospace; font-size: 13px; color: var(--ink); word-break: break-all; }

/* ── bundnavigation ──────────────────────────────────── */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center; gap: 8px;
  padding: 8px 16px calc(env(safe-area-inset-bottom) + 8px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabs button {
  flex: 1; max-width: 200px; border: 0; background: transparent; border-radius: 14px;
  padding: 8px 4px 6px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 600; color: var(--ink-3);
}
.tabs button.on { color: var(--brand); background: var(--brand-soft); }

/* ── ark (bottom sheet) ──────────────────────────────── */
.scrim {
  position: fixed; inset: 0; z-index: 40; background: rgba(10, 16, 12, .45);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.scrim.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--surface); border-radius: 22px 22px 0 0;
  padding: 10px 20px calc(env(safe-area-inset-bottom) + 20px);
  max-width: 640px; margin: 0 auto; max-height: 88dvh; overflow-y: auto;
  transform: translateY(105%); transition: transform .28s cubic-bezier(.2, .9, .3, 1);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .18);
}
.sheet.show { transform: none; }
.sheet .grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet h3 { font-family: var(--font-display); font-size: 22px; margin: 0 0 14px; letter-spacing: -.01em; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); outline: none; font-size: 16px;
}
.field input:focus, .field select:focus { border-color: var(--brand); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.switch input { width: 22px; height: 22px; accent-color: var(--brand); }
.stepper { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.stepper button {
  width: 52px; height: 52px; border-radius: 16px; border: 0; background: var(--surface-2);
  font-size: 26px; font-weight: 600;
}
.stepper input {
  flex: 1; text-align: center; font-size: 26px; font-weight: 700; padding: 8px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--bg); min-width: 0;
}
.sheet-actions { display: flex; gap: 10px; margin-top: 6px; }
.sheet-actions .btn { flex: 1; padding: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chips button {
  border: 1px solid var(--line); background: var(--bg); border-radius: 99px; padding: 7px 12px;
  font-size: 14px; font-weight: 600;
}
.chips button.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* ── madplan ─────────────────────────────────────────── */
.weeknav { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; }
.weeknav .icon-btn { font-size: 24px; font-weight: 700; flex: none; }
.weeknav .wk { flex: 1; text-align: center; display: flex; flex-direction: column; }
.weeknav .wk b { font-family: var(--font-display); font-size: 22px; letter-spacing: -.01em; }
.weeknav .wk span { font-size: 13px; color: var(--ink-3); }
.day { gap: 10px; }
.day .wd { flex: none; width: 44px; font-weight: 700; font-size: 13px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.day .wd small { display: block; font-weight: 500; letter-spacing: 0; text-transform: none; }
.day.today .wd { color: var(--brand); }
.day .dish { font-weight: 600; font-size: 17px; }
.day .dish.empty-dish { color: var(--ink-3); font-weight: 500; font-style: italic; }
.lockbtn { flex: none; width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; color: var(--ink-3); display: grid; place-items: center; }
.lockbtn.on { background: var(--brand-soft); color: var(--brand); }
.shuffle-row { display: flex; justify-content: center; margin: 16px 0 6px; }
.shuffle-row .btn { display: inline-flex; align-items: center; gap: 8px; padding: 14px 24px; font-size: 17px; }
.center { text-align: center; }
.link-btn { border: 0; background: none; color: var(--brand); font-weight: 700; font-size: 14px; padding: 4px; cursor: pointer; }
.thumb { flex: none; width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.photo-full { width: 100%; border-radius: 14px; margin-bottom: 12px; max-height: 45dvh; object-fit: contain; background: var(--surface-2); }
.rline { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.rline input[type=text] { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font-size: 16px; }
.rline select { flex: none; width: 64px; padding: 10px 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); }
.rline .x { flex: none; width: 36px; height: 36px; border: 0; border-radius: 10px; background: var(--surface-2); font-size: 18px; }
.rline.off input[type=text] { text-decoration: line-through; color: var(--ink-3); }
.sugg { font-size: 13px; margin: -4px 0 10px 4px; color: var(--ink-2); }
.sugg button { border: 1px solid var(--brand); background: transparent; color: var(--brand); border-radius: 99px; padding: 3px 10px; font-weight: 600; font-size: 13px; }
.sugg button.on { background: var(--brand); color: var(--brand-ink); }
.writer-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 12px; padding: 14px; }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.08); opacity: .7; } }

/* ── toast ───────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 86px); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 12px;
  font-weight: 600; font-size: 14px; box-shadow: var(--shadow); max-width: calc(100vw - 32px);
  transition: opacity .2s, transform .2s; display: flex; gap: 12px; align-items: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { border: 0; background: none; color: var(--brand-soft); font-weight: 700; padding: 0; }

@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ── enkeltsider (login · scan) ──────────────────────── */
.solo {
  min-height: 100dvh; display: grid; place-items: center;
  padding: calc(env(safe-area-inset-top) + 24px) 20px calc(env(safe-area-inset-bottom) + 24px);
}
.solo .panel {
  width: 100%; max-width: 400px; background: var(--surface); border-radius: 24px;
  box-shadow: var(--shadow); padding: 28px 24px; text-align: center;
}
.solo h1 { font-family: var(--font-display); font-size: 28px; margin: 8px 0 6px; letter-spacing: -.02em; }
.solo p { color: var(--ink-2); margin: 0 0 18px; }
.solo .field { text-align: left; }
.solo .btn { width: 100%; padding: 15px; font-size: 17px; }
.badge {
  width: 84px; height: 84px; border-radius: 26px; margin: 0 auto; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); animation: pop .4s ease both;
}
.badge.warn { background: var(--accent-soft); color: var(--accent); }
.err { color: var(--accent); font-weight: 600; font-size: 14px; min-height: 20px; margin: 4px 0 10px; }
.solo .sub { font-size: 14px; color: var(--ink-3); margin-top: 16px; }
.solo a { color: var(--brand); font-weight: 600; }
.pick { max-height: 40dvh; overflow-y: auto; text-align: left; margin: 10px 0 14px; border-radius: 14px; border: 1px solid var(--line); }
.pick button {
  display: block; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line);
  background: var(--surface); padding: 12px 14px; font-weight: 600;
}
.pick button:first-child { border-top: 0; }
.pick button:active { background: var(--surface-2); }
.or { font-size: 13px; color: var(--ink-3); margin: 6px 0 10px; }
