/* Einkaufsliste – Stylesheet. Mobile first, große Tippflächen, Hell/Dunkel.
   Freundlich und rund, aber ruhig: Familien-App, kein Spielzeug. */

:root {
  --bg: #f2f6f0;
  --fg: #1f2a24;
  --muted: #68756d;
  --card: #ffffff;
  --card-2: #e9efe8;
  --border: #d8e1d6;
  --primary: #2e8b57;
  --primary-dark: #236d44;
  --primary-hover: #27794c;
  --primary-fg: #ffffff;
  --primary-soft: #dff3e6;
  --accent: #ff8a3d;
  --accent-soft: #ffe9da;
  --danger: #d9534f;
  --danger-soft: #fde8e7;
  --wish: #e5a400;
  --wish-soft: #fff6d8;
  --sky: #e6f1fb;
  --shadow: 0 2px 12px rgba(30, 60, 40, 0.08);
  --shadow-soft: 0 1px 4px rgba(30, 60, 40, 0.06);
  --radius: 16px;
  --radius-sm: 12px;
  --tap: 44px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141a17;
    --fg: #e9ede9;
    --muted: #9ba89f;
    --card: #1e2622;
    --card-2: #28322d;
    --border: #35423b;
    --primary: #4fbf7f;
    --primary-dark: #3fa86c;
    --primary-hover: #62cc90;
    --primary-fg: #0c1a11;
    --primary-soft: #1f3a2b;
    --accent: #ff9b58;
    --accent-soft: #3d2a1c;
    --danger: #ef7a76;
    --danger-soft: #3d2424;
    --wish: #f2c43d;
    --wish-soft: #3a3115;
    --sky: #1d2a36;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
    --shadow-soft: 0 1px 4px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141a17;
  --fg: #e9ede9;
  --muted: #9ba89f;
  --card: #1e2622;
  --card-2: #28322d;
  --border: #35423b;
  --primary: #4fbf7f;
  --primary-dark: #3fa86c;
  --primary-hover: #62cc90;
  --primary-fg: #0c1a11;
  --primary-soft: #1f3a2b;
  --accent: #ff9b58;
  --accent-soft: #3d2a1c;
  --danger: #ef7a76;
  --danger-soft: #3d2424;
  --wish: #f2c43d;
  --wish-soft: #3a3115;
  --sky: #1d2a36;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 1px 4px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.3;
  color: var(--fg);
  background: var(--bg);
  min-height: 100dvh;
  overscroll-behavior-y: contain;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { margin: 0 0 0.5em; line-height: 1.2; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 8px 0; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.grow { flex: 1; min-width: 0; }
.center { justify-content: center; text-align: center; }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 120px; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 4px 0 8px; }
.noscript, .boot { padding: 40px 16px; text-align: center; color: var(--muted); }
[hidden] { display: none !important; }
.emoji { font-style: normal; display: inline-block; width: 1.5em; text-align: center; }

.icon { width: 24px; height: 24px; flex-shrink: 0; }
.icon.small { width: 18px; height: 18px; }
.icon.big { width: 64px; height: 64px; color: var(--primary); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 8px 18px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--card); color: var(--fg); font-weight: 600;
  text-decoration: none; transition: transform 0.08s ease, background 0.15s ease;
}
.btn:hover { background: var(--card-2); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); box-shadow: 0 3px 0 var(--primary-dark); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.primary:active { box-shadow: 0 1px 0 var(--primary-dark); transform: translateY(2px); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-text { color: var(--danger); }
.btn.outline { border-color: var(--primary); color: var(--primary-dark); background: transparent; }
.btn.link { border: 0; background: transparent; color: var(--primary-dark); text-decoration: underline; font-weight: 500; }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: 4px 14px; font-size: 0.9rem; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); border: 0; border-radius: 50%;
  background: transparent; color: inherit; flex-shrink: 0; transition: background 0.15s ease, transform 0.08s ease;
}
.icon-btn:hover { background: var(--card-2); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.text-btn { background: none; border: 0; text-align: left; padding: 10px 4px; min-height: var(--tap); }
.text-btn:disabled { cursor: default; }

/* Formulare */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select {
  width: 100%; min-height: var(--tap); padding: 8px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); color: var(--fg);
}
input:focus-visible, select:focus-visible, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; }
input.short, select.short { width: 110px; flex: 0 0 auto; }
input.center { text-align: center; }
select.small { min-height: 36px; width: auto; padding: 4px 8px; font-size: 0.9rem; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 4px 0; cursor: pointer; }
.check-row.small { font-size: 0.82rem; color: var(--muted); padding: 0 12px; min-height: 30px; }
.check-row input { width: 22px; height: 22px; accent-color: var(--primary); }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 8px 12px; border-radius: var(--radius-sm); margin-bottom: 12px; font-size: 0.95rem; }

/* App-Rahmen */
.app { display: flex; flex-direction: column; min-height: 100dvh; }
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 4px;
  padding: calc(6px + var(--safe-top)) 8px 6px;
  background: var(--card); border-bottom: 1px solid var(--border);
}
.top::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px;
  background: linear-gradient(90deg, var(--primary) 0 40%, var(--wish) 40% 70%, var(--accent) 70%);
  opacity: 0.85;
}
.list-switch {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: var(--tap); padding: 6px 12px; border: 0; border-radius: 999px;
  background: transparent; font-weight: 800; font-size: 1.15rem; max-width: 60vw; letter-spacing: -0.01em;
}
.list-switch:hover { background: var(--card-2); }
.list-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { background: var(--accent); color: #fff; border-radius: 10px; font-size: 0.75rem; padding: 1px 7px; margin-left: 4px; }
.status { margin-left: auto; font-size: 0.8rem; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; }
.status.live .dot { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.status.offline .dot { background: var(--danger); }
.status.connecting .dot { background: var(--wish); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

.banners .banner { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 0.9rem; margin: 6px 8px 0; border-radius: var(--radius-sm); }
.banner.offline { background: var(--danger-soft); color: var(--danger); }
.banner.shopping { background: var(--sky); color: var(--fg); }
.banner.notice { background: var(--accent-soft); color: var(--fg); }
.maint-screen .auth-card { text-align: center; }
.maint-icon { font-size: 2.6rem; line-height: 1; margin-bottom: 8px; }

/* Reiter als Pillen */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 6px 8px 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0; min-height: 34px; padding: 4px 14px; border: 1.5px solid var(--border); border-radius: 999px; font-size: 0.9rem;
  background: var(--card); color: var(--muted); font-weight: 700; transition: background 0.15s ease, transform 0.08s ease;
}
.tab:active { transform: scale(0.96); }
.tab.active { color: var(--primary-fg); background: var(--primary); border-color: var(--primary); }
.auth-tabs { background: transparent; margin-bottom: 16px; padding: 0; gap: 8px; }
.auth-tabs .tab { flex: 1; }

/* Liste */
.list { flex: 1; padding: 2px 0 0; }
.list-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 12px 2px; }
.summary { color: var(--muted); font-size: 0.9rem; white-space: nowrap; font-weight: 600; }
.section { margin: 0 0 8px; }
.section h3 {
  display: flex; align-items: center; gap: 6px;
  margin: 6px 12px 3px; font-size: 0.82rem; font-weight: 800; color: var(--primary-dark);
}
.section h3 .emoji { font-size: 1.1rem; }
.section .count { background: var(--card-2); border-radius: 10px; padding: 0 8px; font-size: 0.75rem; color: var(--muted); }
.wishes h3 { color: var(--wish); }
.items { list-style: none; margin: 0; padding: 0 8px; display: flex; flex-direction: column; gap: 4px; }
.item {
  display: flex; align-items: center; gap: 4px; padding: 2px 6px 2px 2px; min-height: 52px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-soft);
  border: 1px solid transparent; transition: transform 0.08s ease;
}
.item.pending-item { opacity: 0.7; border-style: dashed; border-color: var(--border); }
.item .check {
  width: var(--tap); height: var(--tap); flex-shrink: 0; border: 0; background: transparent; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: transparent; position: relative;
  transition: transform 0.1s ease;
}
.item .check:active { transform: scale(0.85); }
.item .check::before { content: ""; position: absolute; width: 28px; height: 28px; border: 2.5px solid var(--primary); border-radius: 50%; opacity: 0.55; transition: opacity 0.15s ease, background 0.15s ease; }
.item .check:hover::before { opacity: 1; background: var(--primary-soft); }
.item .check .icon { width: 18px; height: 18px; position: relative; stroke-width: 3; }
.item.checked .check { color: var(--primary-fg); }
.item.checked .check::before { background: var(--primary); border-color: var(--primary); opacity: 1; }
.item .body { flex: 1; min-width: 0; padding: 3px 0; cursor: pointer; }
.item .name { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; word-break: break-word; font-size: 0.97rem; line-height: 1.25; }
.item.checked { background: transparent; box-shadow: none; border-color: var(--border); }
.item.checked .name { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.item .meta { font-size: 0.74rem; color: var(--muted); margin-top: 1px; display: flex; align-items: center; gap: 5px; min-width: 0; }
.item .meta .tag { flex-shrink: 0; font-size: 0.68rem; padding: 1px 7px; }
.item .meta-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; background: var(--sky); color: var(--fg); font-weight: 600; }
.wish-icon { color: var(--wish); fill: var(--wish); }
.item.wish { background: var(--wish-soft); border: 1.5px dashed var(--wish); box-shadow: none; }
.thumb { width: 38px; height: 38px; object-fit: cover; border-radius: 10px; flex-shrink: 0; cursor: zoom-in; background: var(--card-2); }
.qty { display: flex; align-items: center; flex-shrink: 0; gap: 2px; }
.qty-btn {
  width: 36px; height: var(--tap); border: 0; background: transparent; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; color: var(--primary-dark); transition: background 0.15s ease, transform 0.08s ease;
}
.qty-btn .icon { stroke-width: 2.5; }
.qty-btn:hover { background: var(--primary-soft); }
.qty-btn:active { transform: scale(0.88); }
.qty-btn:disabled { color: var(--border); cursor: default; transform: none; background: transparent; }
.qty-val {
  min-width: 52px; height: 34px; border: 0; background: var(--card-2); border-radius: 999px;
  font-weight: 700; font-size: 0.85rem; padding: 0 8px; white-space: nowrap; transition: background 0.15s ease;
}
.qty-val:hover { background: var(--primary-soft); }
.qty-static { color: var(--muted); font-size: 0.9rem; white-space: nowrap; padding-right: 6px; font-weight: 600; }
.wish-actions { display: flex; flex-direction: column; gap: 4px; }
.wish-wait { font-size: 0.75rem; color: var(--wish); text-align: right; max-width: 84px; font-weight: 600; }
.cart .cart-head {
  display: flex; align-items: center; gap: 8px; width: calc(100% - 16px); min-height: 40px; margin: 0 8px;
  padding: 4px 12px; border: 1.5px solid var(--border); border-radius: 999px; background: var(--card); color: var(--muted); font-weight: 700; text-align: left; font-size: 0.9rem;
}
.cart.open .cart-head { margin-bottom: 8px; }
.cart-actions { padding: 8px 16px; display: flex; justify-content: flex-end; }
.check-all { padding: 10px 16px 4px; display: flex; justify-content: center; }
.check-all .btn { min-height: 44px; }
.list-spacer { height: 200px; }
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty.small { padding: 28px 16px; }
.empty .big-emoji { font-size: 3.2rem; line-height: 1; display: block; margin-bottom: 10px; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.empty h2 { color: var(--fg); margin-top: 12px; }
.empty .btn { margin-top: 8px; }
.done-card {
  margin: 8px 12px 14px; padding: 16px; border-radius: var(--radius); text-align: center;
  background: linear-gradient(135deg, var(--primary-soft), var(--sky)); color: var(--fg); font-weight: 700;
}
.done-card .big-emoji { font-size: 2.2rem; display: block; margin-bottom: 4px; }

/* Eingabeleiste */
.addbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9;
  background: var(--card); border-top: 1px solid var(--border);
  padding: 6px 8px calc(8px + var(--safe-bottom));
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
}
.addbar-row { display: flex; align-items: center; gap: 6px; }
.add-form { display: flex; align-items: center; gap: 6px; flex: 1; }
.add-input { flex: 1; min-height: 46px; border-radius: 999px; padding: 8px 18px; background: var(--bg); border-color: transparent; }
.add-input:focus { background: var(--card); border-color: var(--primary); }
.wish-mode .add-input { border-color: var(--wish); background: var(--wish-soft); }
.addbar-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.addbar-tools .grow { flex: 1; }
.tool-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--card); color: var(--muted); font-size: 0.9rem; font-weight: 700;
  transition: transform 0.08s ease;
}
.tool-btn:active { transform: scale(0.95); }
.scan-btn { color: var(--primary-dark); }
.scan-btn .icon { width: 22px; height: 22px; }
.wish-toggle.active { background: var(--wish); border-color: var(--wish); color: #3a2e00; }
.wish-toggle.active .icon { fill: #3a2e00; }
.wish-toggle .icon { width: 20px; height: 20px; }
.add-btn {
  width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--primary); color: var(--primary-fg);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: 0 3px 0 var(--primary-dark);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.add-btn .icon { stroke-width: 3; }
.add-btn:hover { background: var(--primary-hover); }
.add-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--primary-dark); }

.frequent-toggle { height: 44px; border: 0; background: transparent; color: var(--muted); font-size: 0.8rem; font-weight: 700; display: inline-flex; align-items: center; gap: 2px; padding: 0 6px; }
.frequent { padding: 4px 4px 10px; }
.suggestions { display: flex; flex-direction: column; margin-bottom: 8px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--card); box-shadow: var(--shadow); }
.suggestion { display: flex; gap: 8px; align-items: center; min-height: var(--tap); padding: 6px 16px; border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: left; font-weight: 600; }
.suggestion:last-child { border-bottom: 0; }
.suggestion:hover { background: var(--primary-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.big .chip { min-width: 58px; justify-content: center; font-size: 1.05rem; }
.chip {
  min-height: 38px; padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--card); color: var(--fg); display: inline-flex; align-items: center; gap: 4px; font-weight: 600;
  transition: transform 0.08s ease, background 0.15s ease;
}
.chip:hover { background: var(--card-2); }
.chip:active { transform: scale(0.95); }
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.frequent .chip { background: var(--accent-soft); border-color: transparent; }
.frequent .chip:hover { background: var(--accent); color: #fff; }

/* Dialoge */
.dlg {
  border: 0; border-radius: 20px; padding: 0; background: var(--card); color: var(--fg);
  width: min(560px, calc(100vw - 24px)); max-width: none; max-height: calc(100dvh - 32px);
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.dlg[open] { display: flex; animation: rise 0.18s ease-out; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
.dlg::backdrop { background: rgba(20, 35, 25, 0.45); }
.dlg-head { display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 18px; border-bottom: 1px solid var(--border); }
.dlg-head h2 { flex: 1; margin: 0; font-size: 1.1rem; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-body { padding: 16px; overflow-y: auto; flex: 1; }
.dlg-actions { display: flex; gap: 8px; padding: 12px 16px calc(12px + var(--safe-bottom)); border-top: 1px solid var(--border); flex-wrap: wrap; }
.dlg-actions .btn { flex: 1; }
.dlg-actions .grow { flex: 1; }
.dlg-actions .danger-text { flex: 0 0 auto; }
@media (max-width: 480px) {
  .dlg { width: 100vw; max-height: 100dvh; border-radius: 20px 20px 0 0; margin: auto 0 0; }
}
.menu-dlg .dlg-body { padding: 8px; }
.menu { display: flex; flex-direction: column; }
.menu-item {
  display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 8px 14px;
  border: 0; border-radius: var(--radius-sm); background: transparent; text-align: left; width: 100%; font-weight: 600;
}
.menu-item:hover { background: var(--card-2); }
.menu-item.active { background: var(--primary-soft); }
.menu-item.danger { color: var(--danger); }
.menu-item .icon { color: var(--primary-dark); }
.menu-item.danger .icon { color: var(--danger); }
.menu .invites { padding: 8px 12px; }
.invite-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.choice-list { display: flex; flex-direction: column; gap: 8px; }
.notice { background: var(--primary-soft); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px; }
.members, .manage-list { list-style: none; margin: 0 0 12px; padding: 0; }
.member, .manage-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.manage-row.tpl { flex-wrap: wrap; }
.invite-form { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.tpl-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.tpl-row { padding: 8px; background: var(--card-2); border-radius: var(--radius-sm); display: flex; flex-direction: column; gap: 6px; }
.tpl-row input.short, .tpl-row select.short { width: 72px; }
.item-info { font-size: 0.85rem; margin-top: 8px; }
.photo-box { display: flex; flex-direction: column; gap: 8px; }
.photo-preview { max-width: 160px; max-height: 160px; border-radius: var(--radius-sm); object-fit: cover; }
.photo-dlg .dlg-body { padding: 0; display: flex; align-items: center; justify-content: center; background: #000; }
.photo-full { max-width: 100%; max-height: calc(100dvh - 120px); object-fit: contain; }
.qty-picker { display: flex; flex-direction: column; gap: 10px; }
.qty-current { font-size: 1.8rem; font-weight: 800; text-align: center; color: var(--primary-dark); }
.picker-label { font-size: 0.8rem; color: var(--muted); font-weight: 700; }
.new-item .dlg-body > .picker-label { margin-top: 14px; margin-bottom: 6px; }
.new-item .dlg-body > .hint { margin-top: 0; }
.new-item .field input[aria-invalid="true"] { border-color: var(--danger); }
.scan-frame { position: relative; border-radius: var(--radius-sm); overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.scan-video { display: block; width: 100%; height: 100%; object-fit: cover; }
.scan-guide { position: absolute; inset: 20% 10%; border: 2px solid rgba(255, 255, 255, 0.85); border-radius: 10px; box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.25); pointer-events: none; }
.scan-guide::after { content: ''; position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; background: #ff3b30; box-shadow: 0 0 6px #ff3b30; }
.scan-dlg .scan-manual { margin-top: 6px; }
.scan-dlg .scan-manual input { flex: 1; min-width: 0; letter-spacing: 0.05em; }
.scan-dlg .scan-manual .picker-label { display: block; margin-bottom: 6px; }.settings h3 { margin-top: 16px; display: flex; align-items: center; gap: 6px; font-weight: 800; }
.settings h3:first-child { margin-top: 0; }
.prose h3 { margin-top: 14px; }
.prose ul { padding-left: 20px; }

/* Anmeldung */
.auth-wrap { max-width: 420px; margin: 0 auto; padding: 32px 16px calc(32px + var(--safe-bottom)); }
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 20px; color: var(--primary); }
.auth-logo .icon { width: 40px; height: 40px; }
.auth-logo h1 { font-size: 1.7rem; margin: 0; color: var(--fg); font-weight: 800; }
.auth-card { background: var(--card); border-radius: 20px; padding: 22px; box-shadow: var(--shadow); }
.auth-card .btn.block { margin-top: 8px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(140px + var(--safe-bottom)); transform: translateX(-50%); z-index: 100;
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
  background: #243029; color: #fff; padding: 12px 18px; border-radius: 999px; box-shadow: var(--shadow); font-size: 0.95rem; font-weight: 600;
  animation: rise 0.18s ease-out;
}
.toast.error { background: var(--danger); }
.toast-action { border: 0; background: transparent; color: #ffd36b; font-weight: 800; min-height: var(--tap); padding: 0 6px; }
.toast.error .toast-action { color: #fff; }

/* Verspielte Zutaten: Farbkreise, Fortschritt, Hüpfer, Konfetti */
.hue-0 { --tint: #ffe3e3; --tint-fg: #9c2b2b; }
.hue-1 { --tint: #ffefd4; --tint-fg: #8a5a00; }
.hue-2 { --tint: #fff8c9; --tint-fg: #7a6500; }
.hue-3 { --tint: #dcf5e3; --tint-fg: #1f6b3d; }
.hue-4 { --tint: #dcebff; --tint-fg: #1f4f8a; }
.hue-5 { --tint: #f0e2ff; --tint-fg: #5f2f8a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hue-0 { --tint: #4a2626; --tint-fg: #ffb3b3; }
  :root:not([data-theme="light"]) .hue-1 { --tint: #4a3a1f; --tint-fg: #ffd59a; }
  :root:not([data-theme="light"]) .hue-2 { --tint: #47431c; --tint-fg: #fff0a0; }
  :root:not([data-theme="light"]) .hue-3 { --tint: #1f3d2a; --tint-fg: #a9e7bf; }
  :root:not([data-theme="light"]) .hue-4 { --tint: #1f3049; --tint-fg: #b3d2ff; }
  :root:not([data-theme="light"]) .hue-5 { --tint: #352447; --tint-fg: #dcc2ff; }
}
:root[data-theme="dark"] .hue-0 { --tint: #4a2626; --tint-fg: #ffb3b3; }
:root[data-theme="dark"] .hue-1 { --tint: #4a3a1f; --tint-fg: #ffd59a; }
:root[data-theme="dark"] .hue-2 { --tint: #47431c; --tint-fg: #fff0a0; }
:root[data-theme="dark"] .hue-3 { --tint: #1f3d2a; --tint-fg: #a9e7bf; }
:root[data-theme="dark"] .hue-4 { --tint: #1f3049; --tint-fg: #b3d2ff; }
:root[data-theme="dark"] .hue-5 { --tint: #352447; --tint-fg: #dcc2ff; }

.avatar {
  width: 34px; height: 34px; border-radius: 11px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--tint); color: var(--tint-fg); font-size: 1.1rem; font-weight: 800; line-height: 1;
  transform: rotate(-3deg); transition: transform 0.15s ease;
}
.item:nth-child(even) .avatar { transform: rotate(3deg); }
.item:hover .avatar { transform: rotate(0) scale(1.05); }
.item.checked .avatar { filter: grayscale(1); opacity: 0.6; transform: none; }
.item.wish .avatar { background: #fff; }

.dep-pill {
  display: inline-flex; align-items: center; gap: 2px; padding: 1px 10px 1px 4px; border-radius: 999px;
  background: var(--tint); color: var(--tint-fg); font-weight: 800;
}
.section h3 .dep-pill .emoji { font-size: 1rem; }

.progress { display: flex; align-items: center; gap: 8px; padding: 0 12px 6px; }
.progress-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--card-2); overflow: hidden; }
.progress-fill {
  height: 100%; border-radius: 999px; min-width: 0;
  background: linear-gradient(90deg, var(--primary), #7fd49a);
  background-size: 200% 100%; transition: width 0.4s ease;
}
.progress-fill.full { background: linear-gradient(90deg, var(--primary), var(--wish), var(--accent)); animation: shimmer 2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.progress-text { font-size: 0.75rem; color: var(--muted); font-weight: 700; white-space: nowrap; }

.item.pop .check::before { animation: pop 0.45s cubic-bezier(0.3, 1.6, 0.5, 1); }
.item.pop .avatar { animation: jump 0.5s ease; }
@keyframes pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes jump { 0% { transform: translateY(0); } 40% { transform: translateY(-10px) rotate(8deg); } 100% { transform: translateY(0); } }

.item.wish .wish-icon { animation: wiggle 3s ease-in-out infinite; transform-origin: center; }
@keyframes wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-15deg); } 90% { transform: rotate(15deg); } 95% { transform: rotate(-8deg); } }

.done-card { position: relative; overflow: hidden; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti span { position: absolute; bottom: -24px; font-size: 1.2rem; animation: floatUp 3.2s ease-in infinite; opacity: 0; }
.confetti span:nth-child(1) { left: 6%; animation-delay: 0s; }
.confetti span:nth-child(2) { left: 18%; animation-delay: 0.6s; }
.confetti span:nth-child(3) { left: 31%; animation-delay: 1.3s; }
.confetti span:nth-child(4) { left: 44%; animation-delay: 0.3s; }
.confetti span:nth-child(5) { left: 57%; animation-delay: 1.8s; }
.confetti span:nth-child(6) { left: 70%; animation-delay: 0.9s; }
.confetti span:nth-child(7) { left: 82%; animation-delay: 2.2s; }
.confetti span:nth-child(8) { left: 92%; animation-delay: 1.5s; }
@keyframes floatUp { 0% { transform: translateY(0) rotate(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-110px) rotate(25deg); opacity: 0; } }
.done-card .big-emoji { animation: bob 1.6s ease-in-out infinite; position: relative; }

.add-btn:hover .icon { animation: spin-quarter 0.3s ease; }
@keyframes spin-quarter { to { transform: rotate(90deg); } }

@media (min-width: 720px) {
  .top, .banners, .tabs, .list { max-width: 760px; margin-left: auto; margin-right: auto; width: 100%; }
  .top { position: sticky; }
  .addbar { left: 50%; transform: translateX(-50%); width: 100%; max-width: 760px; border-radius: 20px 20px 0 0; border: 1px solid var(--border); border-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Kompaktmodus: eine Textzeile pro Eintrag */
.density-compact .list-top { gap: 10px; padding: 6px 12px 4px; }
.density-compact .list-top .progress-bar { flex: 1; height: 8px; }
.density-compact .list-top .btn.small { min-height: 32px; padding: 2px 10px; font-size: 0.82rem; }
.density-compact .summary { font-size: 0.8rem; }
.density-compact .items { gap: 3px; }
.density-compact .item { min-height: 44px; padding: 0 4px 0 0; gap: 2px; }
.density-compact .item .check { width: 40px; }
.density-compact .item .check::before { width: 24px; height: 24px; border-width: 2px; }
.density-compact .item .check .icon { width: 15px; height: 15px; }
.density-compact .avatar { width: 28px; height: 28px; border-radius: 9px; font-size: 0.95rem; }
.density-compact .item .body { padding: 2px 0 2px 6px; }
.density-compact .item .name { font-size: 0.95rem; flex-wrap: nowrap; gap: 5px; line-height: 1.2; }
.density-compact .item .name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.density-compact .item .name .tag { flex-shrink: 0; font-size: 0.66rem; padding: 1px 6px; }
.density-compact .item .name .note-tag { background: var(--wish-soft); color: var(--wish); }
.density-compact .item .meta { font-size: 0.7rem; margin-top: 0; }
.density-compact .qty-btn { width: 34px; height: 40px; }
.density-compact .qty-val { min-width: 48px; height: 30px; font-size: 0.8rem; padding: 0 6px; }
.density-compact .section { margin: 0 0 6px; }
.density-compact .section h3 { margin: 4px 10px 2px; font-size: 0.78rem; }
.density-compact .dep-pill { padding: 0 8px 0 3px; }
.density-compact .section h3 .dep-pill .emoji { font-size: 0.9rem; width: 1.3em; }
.density-compact .cart .cart-head { min-height: 36px; padding: 2px 12px; font-size: 0.85rem; }
.density-compact .wish-actions { flex-direction: row; }
.density-compact .wish-actions .btn.small { min-height: 32px; padding: 2px 10px; font-size: 0.82rem; }
.density-compact .tabs { padding: 4px 8px 0; }
.density-compact .tab { min-height: 30px; padding: 2px 12px; font-size: 0.85rem; }
.density-compact .check-row.small { min-height: 26px; }
.density-compact .banners .banner { padding: 4px 12px; font-size: 0.85rem; }
.density-compact .banners .banner .btn.small { min-height: 30px; }
.density-compact .shop-label { display: none; }
.density-btn { color: var(--muted); }
.density-btn:hover { color: var(--primary-dark); }
.item .store-tag { flex-shrink: 0; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 2px; cursor: pointer; }
.density-compact .item .store-tag { font-size: 0.68rem; padding: 1px 7px; }

/* Ansicht „Schlicht“: ohne Symbole, Farben und Animationen, flache Zeilen mit Trennlinien */
.density-plain .top::after { display: none; }
.density-plain .tabs { padding-top: 6px; }
.density-plain .tab { font-weight: 600; }
.density-plain .tab.active { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.density-plain .items { gap: 0; padding: 0; background: var(--card); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.density-plain .item { min-height: 42px; border-radius: 0; box-shadow: none; border: 0; border-bottom: 1px solid var(--border); background: transparent; padding-right: 6px; }
.density-plain .item:last-child { border-bottom: 0; }
.density-plain .item.checked { background: transparent; }
.density-plain .item .body { padding-left: 2px; }
.density-plain .item .name { font-weight: 500; }
.density-plain .item .check::before { border-color: var(--muted); opacity: 0.7; }
.density-plain .item.checked .check::before { background: var(--primary); border-color: var(--primary); }
.density-plain .item.pop .check::before, .density-plain .item.pop .avatar { animation: none; }
.density-plain .item.wish { border: 0; border-bottom: 1px solid var(--border); border-left: 3px solid var(--wish); background: transparent; }
.density-plain .item.wish .wish-icon { animation: none; }
.density-plain .section { margin: 0 0 10px; }
.density-plain .section h3 { color: var(--muted); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin: 8px 12px 3px; }
.density-plain .section h3.dep-head { display: flex; align-items: center; gap: 8px; margin: 0; padding: 7px 12px 7px 10px; background: var(--card-2); border-left: 4px solid var(--primary); border-top: 1px solid var(--border); color: var(--fg); font-size: 0.82rem; font-weight: 800; letter-spacing: 0.06em; }
.density-plain .section h3.dep-head .dep-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.density-plain .section h3.dep-head .dep-count { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--primary); color: var(--bg); font-size: 0.72rem; font-weight: 700; letter-spacing: 0; text-align: center; }
.density-plain .section:has(h3.dep-head) { margin: 0; }
.density-plain .section:has(h3.dep-head) .items { border-top: 0; }
.density-plain .wishes h3 { color: var(--wish); }
.density-plain .tag { background: var(--card-2); color: var(--muted); font-weight: 600; }
.density-plain .qty-val { background: transparent; border: 1px solid var(--border); font-weight: 600; }
.density-plain .qty-btn { color: var(--fg); }
.density-plain .qty-btn:hover { background: var(--card-2); }
.density-plain .cart .cart-head { border-radius: 0; border: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--card); width: 100%; margin: 0; }
.density-plain .progress-fill, .density-plain .progress-fill.full { background: var(--primary); animation: none; }
.density-plain .done-card { background: var(--card); border: 1px solid var(--border); font-weight: 600; color: var(--muted); }
.density-plain .empty .big-emoji { display: none; }
.density-plain .btn.primary, .density-plain .add-btn { box-shadow: none; }
.density-plain .btn.primary:active, .density-plain .add-btn:active { transform: scale(0.97); box-shadow: none; }
.density-plain .add-btn:hover .icon { animation: none; }
.density-plain .add-input { background: var(--card); border-color: var(--border); }
.density-plain .frequent .chip { background: var(--card); border-color: var(--border); }
.density-plain .frequent .chip:hover { background: var(--card-2); color: inherit; }
.density-plain .chip.active { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.density-plain .banner.shopping { background: var(--card-2); }
.density-plain .list-top .btn.small { border-color: var(--border); color: var(--fg); }
.density-plain .dlg[open], .density-plain .toast { animation: none; }
/* Schlicht: jede Abteilung bekommt ihre eigene Farbe */
.density-plain .section h3.dep-head[class*="hue-"] { background: var(--tint); border-left-color: var(--tint-fg); color: var(--tint-fg); }
.density-plain .section h3.dep-head[class*="hue-"] .dep-count { background: var(--tint-fg); color: var(--card); }
/* Zusätzliche Farbtöne, damit bis zu 10 Abteilungen verschieden aussehen */
.hue-6 { --tint: #d6f3f1; --tint-fg: #12655f; }
.hue-7 { --tint: #ffe1ef; --tint-fg: #8f2459; }
.hue-8 { --tint: #e3e7ff; --tint-fg: #3a3f94; }
.hue-9 { --tint: #ece6dd; --tint-fg: #5e4a30; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hue-6 { --tint: #173d3a; --tint-fg: #9fe3dc; }
  :root:not([data-theme="light"]) .hue-7 { --tint: #47233a; --tint-fg: #ffb8d9; }
  :root:not([data-theme="light"]) .hue-8 { --tint: #262b4f; --tint-fg: #c3c8ff; }
  :root:not([data-theme="light"]) .hue-9 { --tint: #3b3328; --tint-fg: #e3d2b8; }
}
:root[data-theme="dark"] .hue-6 { --tint: #173d3a; --tint-fg: #9fe3dc; }
:root[data-theme="dark"] .hue-7 { --tint: #47233a; --tint-fg: #ffb8d9; }
:root[data-theme="dark"] .hue-8 { --tint: #262b4f; --tint-fg: #c3c8ff; }
:root[data-theme="dark"] .hue-9 { --tint: #3b3328; --tint-fg: #e3d2b8; }
/* Farbwahl für Abteilungen */
.swatch { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--tint); border: 3px solid var(--tint-fg); color: var(--tint-fg); }
.swatch .icon { width: 16px; height: 16px; stroke-width: 3; }
.swatch-btn { display: inline-flex; align-items: center; justify-content: center; flex: none; width: var(--tap); height: var(--tap); padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.swatch-btn:hover .swatch, .swatch-btn:focus-visible .swatch { transform: scale(1.12); }
.swatch-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 12px; }
.swatch-pick { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: var(--tap); padding: 8px 2px; border: 2px solid transparent; border-radius: 12px; background: var(--card-2); color: var(--fg); font: inherit; font-size: 0.78rem; cursor: pointer; }
.swatch-pick .swatch { width: 32px; height: 32px; }
.swatch-pick.active { border-color: var(--tint-fg); background: var(--tint); font-weight: 700; }
