:root {
  --bg: #f4f6f3; --card: #fff; --text: #17201a; --muted: #6b766e; --line: #e3e8e2;
  --accent: #1f8a4c; --accent-soft: #e2f3e8; --danger: #c0392b; --rewe: #cc071e; --warn: #b96a00;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #101412; --card: #1b211d; --text: #eef2ee; --muted: #98a39b; --line: #2a322c; --accent: #3fbf74; --accent-soft: #1d3527; --danger: #ff6b5b; --rewe: #ff4d5e; --warn: #f0a23a; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg);
  display: flex; flex-direction: column; overflow: hidden; max-width: 640px; margin: 0 auto;
}
header { display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top) + 12px) 16px 8px; }
h1 { font-size: 26px; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 21px; margin: 0 0 6px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 16px 6px; font-weight: 600; }
h3 small { text-transform: none; letter-spacing: 0; font-weight: 400; }
#dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); opacity: .5; }
#dot.on { background: var(--accent); opacity: 1; }
main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 24px; position: relative; }
ul, ol { list-style: none; margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }

nav { display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
nav button { flex: 1; padding: 8px 0 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); position: relative; }
nav button.active { color: var(--accent); }
nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
nav b { position: absolute; top: 3px; left: 50%; margin-left: 6px; background: var(--accent); color: #fff; border-radius: 9px; font-size: 10px; min-width: 17px; padding: 1px 4px; }

.pad { padding: 8px 16px; }
.sticky { position: sticky; top: 0; z-index: 2; background: var(--bg); }
.hint { color: var(--muted); font-size: 14px; margin: 6px 0; }
.empty { text-align: center; padding: 48px 28px; color: var(--muted); }
.empty h2 { color: var(--text); }
.empty form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

input[type=text], input[type=search], input[type=number], input[type=url], textarea, select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); font-size: 16px; -webkit-appearance: none; appearance: none;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0; }
label input, label textarea, label select { margin-top: 4px; color: var(--text); }
.cols { display: flex; gap: 10px; } .cols label { flex: 1; margin: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; padding: 12px 16px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-weight: 600; text-decoration: none; color: var(--text); min-height: 46px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.rewe-btn { color: var(--rewe); border-color: var(--rewe); }
.btn[disabled] { opacity: .4; }
.link { color: var(--accent); font-size: 14px; padding: 8px 0; }
.danger { color: var(--danger); }
.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.filebtn { position: relative; overflow: hidden; width: 100%; }
.filebtn input { position: absolute; inset: 0; opacity: 0; }

.addbar { display: flex; gap: 8px; }
.addbar .btn { width: 48px; padding: 0; font-size: 24px; flex: none; }

.group > ul, .cards { background: var(--card); border-radius: var(--radius); margin: 0 12px; overflow: hidden; }
.cards { background: none; display: flex; flex-direction: column; gap: 8px; }
.card { background: var(--card); border-radius: var(--radius); padding: 12px 14px; }
.row-card { display: flex; align-items: center; gap: 10px; }
.card-main { flex: 1; min-width: 0; }
.card-tools { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.card-tools select { width: auto; padding: 7px 10px; font-size: 14px; }
.card-tools .link { margin-left: auto; }
.t { font-weight: 600; overflow-wrap: anywhere; }
.s { color: var(--muted); font-size: 13px; margin-top: 2px; }
.amt { font-weight: 400; color: var(--muted); margin-left: 4px; white-space: nowrap; }
.pref { color: var(--accent); }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 8px; background: var(--line); color: var(--muted); font-weight: 600; }
.tag.ok { background: var(--accent-soft); color: var(--accent); }
.tag.warn { background: transparent; border: 1px solid var(--warn); color: var(--warn); }

.row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); min-height: 54px; }
.row:last-child { border-bottom: 0; }
.row .body { flex: 1; min-width: 0; }
.chk { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--muted); flex: none; color: #fff; font-size: 16px; font-weight: 700; line-height: 1; }
.row.checked .chk { background: var(--accent); border-color: var(--accent); }
.row.checked .t { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.row.checked .s, .row.checked .rewe { display: none; }
.rewe { font-size: 11px; font-weight: 800; color: var(--rewe); border: 1.5px solid var(--rewe); border-radius: 7px; padding: 4px 6px; text-decoration: none; letter-spacing: .03em; }
.pantry { opacity: .75; }

.add { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 22px; font-weight: 600; flex: none; }
.add.done { background: var(--accent); color: #fff; font-size: 17px; }
.fab { position: fixed; right: max(16px, calc(50vw - 304px)); bottom: calc(env(safe-area-inset-bottom) + 76px); width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 30px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; padding: 0 16px; }
.chips button { white-space: nowrap; padding: 6px 12px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); font-size: 14px; }
.chips button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.sug { display: inline-flex; } .sug button:first-child { border-radius: 16px 0 0 16px; } .sug button + button { border-radius: 0 16px 16px 0; border-left: 0; color: var(--muted); }
.sug button:only-child { border-radius: 16px; }

.stepper { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.stepper button { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 20px; font-weight: 600; }
.stepper.big { margin: 8px 0; font-size: 16px; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 15px; color: var(--text); margin: 4px 0 8px; }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin: 0; }

#sheet { position: fixed; inset: 0; z-index: 10; display: none; }
#sheet.open { display: block; }
.backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.panel { position: absolute; left: 0; right: 0; bottom: 0; max-width: 640px; margin: 0 auto; max-height: 90%; overflow-y: auto; background: var(--bg); border-radius: 20px 20px 0 0; padding: 22px 18px calc(env(safe-area-inset-bottom) + 22px); animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .panel { animation: none; } }
.panel h2 { padding-right: 36px; }
.panel h3 { margin: 16px 0 6px; }
.x { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; background: var(--line); font-size: 20px; color: var(--muted); }
.ing li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.ing span { width: 84px; flex: none; color: var(--muted); }
.steps { list-style: decimal; padding-left: 22px; } .steps li { margin: 6px 0; }

#toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 84px); transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 22px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 20; max-width: 90%; text-align: center; }
#toast.show { opacity: .95; transform: translate(-50%, 0); }

/* REWE-Warenkorb füllen */
.fill-list { list-style: none; margin: 12px 0 0; padding: 0; }
.fill-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.fill-row .t { font-weight: 600; margin-bottom: 6px; }
.fill-row select { width: 100%; font-size: 15px; }
progress { width: 100%; height: 8px; accent-color: var(--rewe); margin: 12px 0; }
