/* Einkaufsliste – Variante C: farbiger Strich ganz links */

:root {
  color-scheme: light;
  --bg: #F3F4F1;
  --card: #FFFFFF;
  --ink: #18201B;
  --muted: #5B6560;
  --label: #3F4842;
  --line: #ECEEEA;
  --border: #DDE0DA;
  --field: #CDD1CB;
  --pill: #F0F1EE;
  --track: #E2E4DF;
  --seg: #EEF0EC;
  --seg-on: #FFFFFF;
  --ring: #848C87;
  --dashed: #A3AAA5;
  --step: #F6F7F4;
  --danger: #B42318;
  --accent: #1F7A52;
  --on-accent: #FFFFFF;
  --accent-soft: rgba(31, 122, 82, 0.13);
  --overlay: rgba(16, 22, 18, 0.45);
  --sheet: #FFFFFF;
  --shadow: 0 1px 2px rgba(24, 32, 27, 0.06);
  --chip-on: #18201B;
  --on-chip-on: #FFFFFF;
  --banner: #E3F1EA;
  --banner-ink: #14583A;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0F1311;
  --card: #1A1F1C;
  --ink: #E9EDEA;
  --muted: #A3ADA7;
  --label: #C5CCC7;
  --line: #2A302C;
  --border: #333A36;
  --field: #444C47;
  --pill: #262C28;
  --track: #2A302C;
  --seg: #232925;
  --seg-on: #3A423D;
  --ring: #7D8781;
  --dashed: #59625C;
  --step: #222824;
  --danger: #F2867B;
  --accent: #4CC38A;
  --on-accent: #0B1A12;
  --accent-soft: rgba(76, 195, 138, 0.16);
  --overlay: rgba(0, 0, 0, 0.6);
  --sheet: #1A1F1C;
  --shadow: none;
  --chip-on: #E9EDEA;
  --on-chip-on: #0F1311;
  --banner: #173325;
  --banner-ink: #A6E3C3;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0F1311;
    --card: #1A1F1C;
    --ink: #E9EDEA;
    --muted: #A3ADA7;
    --label: #C5CCC7;
    --line: #2A302C;
    --border: #333A36;
    --field: #444C47;
    --pill: #262C28;
    --track: #2A302C;
    --seg: #232925;
    --seg-on: #3A423D;
    --ring: #7D8781;
    --dashed: #59625C;
    --step: #222824;
    --danger: #F2867B;
    --accent: #4CC38A;
    --on-accent: #0B1A12;
    --accent-soft: rgba(76, 195, 138, 0.16);
    --overlay: rgba(0, 0, 0, 0.6);
    --sheet: #1A1F1C;
    --shadow: none;
    --chip-on: #E9EDEA;
    --on-chip-on: #0F1311;
    --banner: #173325;
    --banner-ink: #A6E3C3;
  }
}

/* -- Grundlagen ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
svg { flex: none; }

/* -- Sperrbildschirm ------------------------------------------------------- */
.lock {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
  background: var(--bg);
  overflow-y: auto;
}
.lock-inner { width: 100%; max-width: 340px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lock-logo {
  width: 64px; height: 64px; border-radius: 18px;
  display: grid; place-items: center;
  background: var(--card); color: var(--ink); box-shadow: var(--shadow);
}
.lock h1 { margin: 6px 0 0; font-size: 26px; font-weight: 800; letter-spacing: -0.01em; }
.lock-msg { margin: 0; font-size: 16px; color: var(--muted); }
.dots { display: flex; gap: 14px; margin: 12px 0 0; }
.dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ring); transition: background 0.12s, border-color 0.12s; }
.dots span.on { background: var(--ink); border-color: var(--ink); }
.dots.shake { animation: shake 0.4s; }
.lock-err { min-height: 44px; margin: 0; font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--danger); text-align: center; }
.pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px 22px; }
.key {
  width: 76px; height: 76px; border-radius: 50%; border: 0;
  display: grid; place-items: center;
  background: var(--card); color: var(--ink); box-shadow: var(--shadow);
  font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.key:active { background: var(--pill); }
.key.ghost { background: transparent; box-shadow: none; }
@media (max-height: 660px) {
  .lock-logo { display: none; }
  .pad { grid-template-columns: repeat(3, 64px); gap: 10px 20px; }
  .key { width: 64px; height: 64px; font-size: 24px; }
}

/* -- Grundgerüst ----------------------------------------------------------- */
.app { position: fixed; inset: 0; }
.shell { height: 100%; max-width: 600px; margin: 0 auto; display: flex; flex-direction: column; }
.hdr { flex: none; display: flex; flex-direction: column; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) 12px 4px 20px; }
.hdr-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hdr h1 { margin: 0; min-width: 0; font-size: clamp(28px, 8vw, 36px); line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; }
.hdr-right { display: flex; align-items: center; gap: 2px; }
.count { font-size: 15px; font-weight: 600; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress { height: 6px; margin-right: 8px; border-radius: 3px; background: var(--track); overflow: hidden; }
.progress > div { width: 0; height: 100%; border-radius: 3px; background: var(--accent); transition: width 0.24s ease; }
.icon-btn {
  flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: transparent; color: var(--ink);
}
.icon-btn:active { background: var(--pill); }
.icon-btn.round { background: var(--pill); }

/* -- Hinweise -------------------------------------------------------------- */
.banners { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 12px 16px 0; }
.banners:empty { display: none; }
.banner {
  width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border: 0; border-radius: 16px;
  background: var(--banner); color: var(--banner-ink); text-align: left;
}
.banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.banner strong { font-size: 16px; font-weight: 700; }
.banner .sub { font-size: 14px; }
.banner.offline { background: var(--pill); color: var(--label); }

/* -- Markt-Filter ---------------------------------------------------------- */
.filters { flex: none; display: flex; gap: 8px; overflow-x: auto; padding: 14px 20px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 44px; display: flex; align-items: center; gap: 8px;
  padding: 0 16px 0 12px; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--card); color: var(--ink);
  font-size: 15px; font-weight: 700; white-space: nowrap;
}
.chip.plain { padding-left: 16px; }
.chip[aria-pressed="true"] { background: var(--chip-on); border-color: var(--chip-on); color: var(--on-chip-on); }
.chip .n { font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] .n { color: inherit; opacity: 0.85; }
.cbar { flex: none; width: 4px; height: 18px; border-radius: 2px; }
.chip.add { padding: 0 14px; gap: 6px; border: 2px dashed var(--dashed); background: transparent; color: var(--label); }

/* -- Liste ----------------------------------------------------------------- */
.list {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 8px; padding: 0 16px 28px;
}
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 22px; margin: 2px 4px 0; }
.sec-head.later { margin-top: 12px; }
.sec-title { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.text-btn {
  height: 44px; margin: -11px -10px -11px 0; padding: 0 10px; border: 0;
  background: transparent; color: var(--accent); font-size: 15px; font-weight: 700;
}
.card-list { list-style: none; margin: 0; padding: 0; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); }
.row { display: flex; align-items: center; gap: 2px; min-height: 54px; padding: 0 12px 0 10px; }
.row + .row { border-top: 1px solid var(--line); }
.bar { flex: none; width: 4px; height: 28px; border-radius: 2px; }
.row.done .bar { opacity: 0.35; }
.check { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border: 0; padding: 0; background: transparent; }
.ring {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--ring);
  display: grid; place-items: center; background: var(--card);
}
.row.done .ring, .ring.on { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.row-main {
  flex: 1; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 10px;
  border: 0; padding: 0; background: transparent; text-align: left;
}
.name { flex: 1; min-width: 0; font-size: 17px; font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.done .name { font-weight: 500; color: var(--muted); text-decoration: line-through; }
.qty {
  flex: none; padding: 5px 10px; border-radius: 9px; background: var(--pill);
  font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.row.done .qty { padding-right: 0; background: transparent; color: var(--muted); font-weight: 600; }
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 36px 24px; border-radius: 18px; background: var(--card); text-align: center;
}
.empty-ico { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty .t { margin: 4px 0 0; font-size: 18px; font-weight: 700; }
.empty .s { margin: 0; font-size: 15px; line-height: 1.4; color: var(--muted); }

.foot { flex: none; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--track); background: var(--bg); }

/* -- Knöpfe ---------------------------------------------------------------- */
.primary { border: 0; border-radius: 16px; background: var(--accent); color: var(--on-accent); font-weight: 700; }
.primary.big { width: 100%; height: 56px; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 17px; }
.primary:disabled { opacity: 0.45; }
.secondary {
  min-height: 48px; padding: 0 18px; border: 1.5px solid var(--field); border-radius: 14px;
  background: transparent; color: var(--ink); font-size: 15px; font-weight: 700;
}
.secondary:disabled { opacity: 0.5; }
.dark-btn {
  flex: none; height: 48px; padding: 0 18px; border: 0; border-radius: 12px;
  background: var(--chip-on); color: var(--on-chip-on); font-size: 15px; font-weight: 700;
}
.danger-btn {
  height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 14px; background: transparent; color: var(--danger); font-size: 16px; font-weight: 700;
}

/* -- Fenster von unten (Sheets) -------------------------------------------- */
.sheet-layer { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; padding: 0; background: var(--overlay); cursor: default; animation: fade 0.2s ease; }
.sheet {
  position: relative; width: 100%; max-width: 600px; max-height: 92%;
  display: flex; flex-direction: column; gap: 20px; overflow-y: auto; overscroll-behavior: contain;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0; background: var(--sheet); box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
  animation: up 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.grabber { flex: none; align-self: center; width: 40px; height: 5px; border-radius: 3px; background: var(--border); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: -6px; }
.sheet-head h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.01em; outline: none; }
.sheet .sub { margin: -12px 0 0; font-size: 15px; line-height: 1.4; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 8px; }
.label { margin: 0; font-size: 14px; font-weight: 700; color: var(--label); }
.hint { margin: 0; font-size: 14px; line-height: 1.4; color: var(--muted); }
.hint.center { text-align: center; }
.input {
  width: 100%; height: 52px; padding: 0 16px; border: 1.5px solid var(--field); border-radius: 14px;
  background: var(--card); font-size: 17px; font-weight: 600;
}
textarea.input { height: auto; min-height: 120px; padding: 12px 16px; font-weight: 500; line-height: 1.45; resize: vertical; }
.stepper { display: flex; align-items: center; height: 52px; border: 1.5px solid var(--field); border-radius: 14px; overflow: hidden; }
.stepper button { flex: none; width: 56px; height: 100%; display: grid; place-items: center; border: 0; background: var(--step); color: var(--ink); }
.stepper input {
  flex: 1; min-width: 0; height: 100%; border: 0; padding: 0 4px; background: var(--card);
  text-align: center; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; height: 48px; padding: 4px; border-radius: 14px; background: var(--seg); }
.seg button { min-width: 0; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 15px; font-weight: 700; }
.seg button[aria-pressed="true"] { background: var(--seg-on); color: var(--ink); box-shadow: 0 1px 3px rgba(16, 22, 18, 0.18); }
.chips-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.new-store { display: flex; gap: 8px; }
.new-store .input { flex: 1; min-width: 0; height: 48px; border-radius: 12px; }
.actions { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }

/* Cookidoo-Eingang */
.inbox-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 16px; }
.inbox-row { display: flex; align-items: center; gap: 4px; min-height: 62px; padding: 6px 10px 6px 4px; }
.inbox-row + .inbox-row { border-top: 1px solid var(--line); }
.inbox-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.inbox-main .name { font-size: 16px; }
.inbox-row.off .name { color: var(--muted); font-weight: 500; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.tag { padding: 1px 6px; border-radius: 6px; background: var(--pill); color: var(--label); font-size: 12px; font-weight: 700; }
.store-pick {
  position: relative; flex: none; height: 44px; display: flex; align-items: center; gap: 8px;
  padding: 0 10px; border-radius: 12px; background: var(--pill);
}
.store-pick select {
  -webkit-appearance: none; appearance: none; height: 100%; max-width: 104px;
  padding: 0 18px 0 0; border: 0; background: transparent; font-size: 15px; font-weight: 600;
}
.store-pick svg { position: absolute; right: 8px; pointer-events: none; color: var(--muted); }

/* Einstellungen */
.set-section { display: flex; flex-direction: column; gap: 10px; }
.set-section h3 { margin: 0; font-size: 14px; font-weight: 700; color: var(--label); }
.status { margin: 0; font-size: 15px; line-height: 1.4; color: var(--muted); }
.status.err { color: var(--danger); }
.plain-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 16px; }
.store-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 4px 0 16px; }
.store-row + .store-row { border-top: 1px solid var(--line); }
.store-row .name { font-size: 16px; }
.switch-row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 8px 10px 16px; }
.switch-row + .switch-row { border-top: 1px solid var(--line); }
.switch-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.switch-title { font-size: 16px; font-weight: 600; }
.switch { position: relative; flex: none; width: 60px; height: 44px; border: 0; padding: 0; background: transparent; }
.switch::before {
  content: ""; position: absolute; left: 4px; top: 6px; width: 52px; height: 32px; border-radius: 16px;
  background: var(--ring); transition: background 0.18s;
}
.switch::after {
  content: ""; position: absolute; left: 7px; top: 9px; width: 26px; height: 26px; border-radius: 50%;
  background: #FFFFFF; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.18s;
}
.switch[aria-checked="true"]::before { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

/* Kurze Meldungen */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 60;
  max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 14px; transform: translateX(-50%);
  background: var(--chip-on); color: var(--on-chip-on); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
  font-size: 15px; font-weight: 600; text-align: center;
}
.toast:empty { display: none; }

@keyframes up { from { transform: translateY(32px); opacity: 0.4; } }
@keyframes fade { from { opacity: 0; } }
@keyframes shake {
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
