/* =====================================================================
   Mealplanner – Designsystem
   Klare Linie: ruhige Flaechen, eine Markenfarbe (Smaragd), Farbe als
   Orientierung (Mahlzeiten, Warenkategorien). Mobile zuerst, ab 900 px
   Seitenleiste, ab 1280 px Wochenraster mit 7 Spalten.
   ===================================================================== */

:root {
  color-scheme: light;
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #f0f2ef;
  --surface-3: #e7ebe7;
  --text: #17201c;
  --muted: #67716c;
  --border: #e2e6e2;
  --brand: #0e9f6e;
  --brand-strong: #0a7d56;
  --brand-soft: #e2f4eb;
  --brand-contrast: #ffffff;
  --danger: #d93f3f;
  --danger-soft: #fdeaea;
  --success: #0e9f6e;
  --warning-soft: #fff6dd;

  --morgen: #e8930c;   --morgen-soft: #fff1d6;
  --mittag: #e5603f;   --mittag-soft: #fde7e0;
  --abend: #5b5ff0;    --abend-soft: #e8e8fe;

  --cat-0: #2fa84f; --cat-1: #c98a2b; --cat-2: #d9534f; --cat-3: #3f8fd9;
  --cat-4: #9a6bd1; --cat-5: #36b3c9; --cat-6: #e07b39; --cat-7: #7b8794; --cat-8: #a3aaa6;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(18, 30, 24, .06);
  --shadow: 0 1px 2px rgba(18, 30, 24, .05), 0 4px 16px rgba(18, 30, 24, .06);
  --shadow-lg: 0 12px 40px rgba(18, 30, 24, .18);
  --tap: 44px;
  --nav-h: 64px;
  --top-h: 60px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #101413;
    --surface: #181d1b;
    --surface-2: #1f2522;
    --surface-3: #29302d;
    --text: #e9eeeb;
    --muted: #96a19b;
    --border: #2b3330;
    --brand: #22c08a;
    --brand-strong: #4fd6a5;
    --brand-soft: #173a2d;
    --brand-contrast: #06231a;
    --danger: #f06a6a;
    --danger-soft: #3a1d1d;
    --warning-soft: #3a311b;
    --morgen-soft: #3a2c12; --mittag-soft: #3b211a; --abend-soft: #23243f;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 20px rgba(0, 0, 0, .3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
  }
}

/* ------------------------------------------------------------ Basis */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; font-weight: 750; }
h2 { font-size: 1.1rem; font-weight: 700; }
h3 { font-size: .95rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--brand-strong); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .82rem; }
.center { text-align: center; }
.spacer { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 8px; }

.icon { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: middle; }

/* ------------------------------------------------------------ Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px;
  border: 1px solid transparent; border-radius: 999px;
  font-weight: 650; font-size: .95rem; line-height: 1;
  background: var(--surface-2); color: var(--text);
  transition: background-color .15s, color .15s, transform .08s, box-shadow .15s;
  white-space: nowrap; text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--brand); color: var(--brand-contrast); box-shadow: 0 2px 8px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-soft { background: var(--brand-soft); color: var(--brand-strong); }
.btn-soft:hover { background: color-mix(in srgb, var(--brand-soft) 80%, var(--brand) 20%); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-success { background: var(--success); color: var(--brand-contrast); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: .88rem; }
.btn-lg { min-height: 52px; padding: 0 24px; font-size: 1rem; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: var(--tap); height: var(--tap); flex: none;
  border: 0; border-radius: 999px; background: var(--surface-2); color: var(--text);
  transition: background-color .15s;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn.subtle { background: transparent; color: var(--muted); }
.icon-btn.subtle:hover { background: var(--surface-2); color: var(--danger); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm .icon { width: 16px; height: 16px; }
.icon-btn.lg { width: 52px; height: 52px; }

/* ------------------------------------------------------------ Formulare */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: .85rem; font-weight: 600; color: var(--muted); }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 220px; }
.field-row > .field-narrow { flex: 0 0 110px; }
input:not([type=hidden]), select, textarea {
  width: 100%; min-height: var(--tap);
  padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-size: 16px; /* verhindert Zoom auf iOS */
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.5; }
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}
::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { flex: 1; }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: .92rem; margin-bottom: 12px; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--brand-soft); color: var(--brand-strong); }

/* ------------------------------------------------------------ Pills & Chips */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  font-size: .8rem; font-weight: 600; white-space: nowrap;
}
.pill .icon { width: 14px; height: 14px; }
.pill-brand { background: var(--brand); color: var(--brand-contrast); }
.pill-soft { background: var(--brand-soft); color: var(--brand-strong); }
.pill-link { background: var(--surface-2); color: var(--brand-strong); }
.pill-xs { padding: 2px 8px; font-size: .72rem; }
.chips { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 12px; border-radius: 999px; background: var(--surface-2); font-weight: 600; font-size: .9rem; }
.chip form { display: contents; }
.chip-remove { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); }
.chip-remove:hover { background: var(--danger-soft); color: var(--danger); }
.chip-remove .icon { width: 14px; height: 14px; }

.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 44px; height: 44px; border-radius: 14px;
  font-weight: 750; font-size: 1.1rem; color: #fff;
}
.avatar.sm { width: 32px; height: 32px; border-radius: 10px; font-size: .9rem; }
.avatar.lg { width: 56px; height: 56px; border-radius: 18px; font-size: 1.4rem; }
.avatar.c0 { background: #0e9f6e; } .avatar.c1 { background: #e5603f; } .avatar.c2 { background: #5b5ff0; }
.avatar.c3 { background: #e8930c; } .avatar.c4 { background: #2b8fd6; } .avatar.c5 { background: #c14d9a; }

/* ------------------------------------------------------------ App-Geruest */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 750; font-size: 1.05rem; }
.brand-mark { width: 32px; height: 32px; }
.brand-mark.lg { width: 56px; height: 56px; }
.household-switch { display: flex; align-items: center; gap: 8px; min-width: 0; }
.select-pill {
  position: relative; display: flex; align-items: center; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.select-pill > .icon:first-child { position: absolute; left: 12px; width: 18px; height: 18px; color: var(--brand); pointer-events: none; }
.select-pill > .icon:last-child { position: absolute; right: 10px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.select-pill select {
  min-height: 40px; max-width: 46vw; padding: 0 32px 0 38px;
  border: 0; background: transparent; box-shadow: none;
  font-weight: 650; font-size: .92rem; text-overflow: ellipsis;
}
.select-pill select:focus { box-shadow: none; }
.household-switch .icon-btn { width: 40px; height: 40px; background: var(--surface); border: 1px solid var(--border); }

.main { padding: 16px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: 6px 8px env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-top: 1px solid var(--border);
}
.nav-link {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: .72rem; font-weight: 650; border-radius: 14px;
}
.nav-icon { position: relative; display: grid; place-items: center; width: 56px; height: 30px; border-radius: 999px; transition: background-color .2s; }
.nav-icon .icon { width: 22px; height: 22px; }
.nav-link.is-active { color: var(--brand-strong); }
.nav-link.is-active .nav-icon { background: var(--brand-soft); }
.nav-badge {
  position: absolute; top: -2px; right: 8px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--mittag); color: #fff; font-size: .7rem; line-height: 18px; text-align: center;
}

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 16px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 8px -6px; color: var(--muted); font-weight: 600; font-size: .92rem; min-height: 36px; }
.back-link .icon { width: 18px; height: 18px; }

.card { background: var(--surface); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card > h2 { margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head h2 .icon { color: var(--brand); }
.subhead { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }

.banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; margin-bottom: 14px; border-radius: var(--radius);
  background: var(--warning-soft); border: 1px solid color-mix(in srgb, var(--morgen) 35%, transparent);
}
.banner-text { display: flex; align-items: center; gap: 10px; }
.banner-text .icon { color: var(--morgen); }
.banner-actions { display: flex; gap: 8px; margin-left: auto; }
.banner-link { color: var(--text); flex-wrap: nowrap; }
.banner-link > .icon { color: var(--muted); flex: none; }

.empty-state { text-align: center; padding: 48px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty-state p { color: var(--muted); max-width: 34ch; }
.empty-art { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 28px; background: var(--brand-soft); color: var(--brand); margin-bottom: 4px; }
.empty-art .icon { width: 40px; height: 40px; }
.empty-inline { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 32px 0; color: var(--muted); }

/* ------------------------------------------------------------ Wochenplan */
.week-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 14px; padding: 6px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm);
}
.week-nav .icon-btn { background: transparent; }
.week-nav .icon-btn:hover { background: var(--surface-2); }
.week-label { display: flex; flex-direction: column; align-items: center; text-align: center; font-size: .95rem; }
.link-small { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; }
.link-small .icon { width: 16px; height: 16px; }

.days { display: grid; gap: 12px; }
.day { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; border: 1px solid transparent; }
.day.is-today { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent), var(--shadow); }
.day.is-past { opacity: .72; }
.day-head { display: flex; align-items: baseline; gap: 8px; padding: 14px 16px 6px; }
.day-name { font-weight: 750; font-size: 1.02rem; }
.day-name .short { display: none; }
.day-date { color: var(--muted); font-size: .88rem; font-weight: 600; }
.day-head .pill { margin-left: auto; align-self: center; }

.meal { display: flex; align-items: stretch; gap: 6px; padding: 4px 8px 4px 0; position: relative; }
.meal::before { content: ""; width: 4px; border-radius: 0 4px 4px 0; background: var(--meal-color); flex: none; margin: 8px 0; }
.meal + .meal { border-top: 1px solid var(--border); }
.meal:last-child { padding-bottom: 8px; }
.meal-morgen { --meal-color: var(--morgen); --meal-soft: var(--morgen-soft); }
.meal-mittag { --meal-color: var(--mittag); --meal-soft: var(--mittag-soft); }
.meal-abend  { --meal-color: var(--abend);  --meal-soft: var(--abend-soft); }
.meal-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 8px 10px; border: 0; border-radius: 12px; background: transparent; text-align: left;
}
.meal-main:hover { background: var(--surface-2); }
.meal-label { flex: none; width: 58px; font-size: .78rem; font-weight: 700; color: var(--meal-color); text-transform: uppercase; letter-spacing: .04em; }
.meal-text { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 600; }
.meal-text > span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.meal-text .icon { width: 16px; height: 16px; color: var(--meal-color); }
.meal-empty { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .9rem; opacity: .7; }
.meal-empty .icon { width: 16px; height: 16px; }
.diners {
  flex: none; align-self: center; display: inline-flex; align-items: center; gap: 4px;
  height: 32px; padding: 0 10px; border: 0; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); font-size: .82rem; font-weight: 700;
}
.diners .icon { width: 14px; height: 14px; }
.diners.is-set { background: var(--meal-soft); color: var(--meal-color); }

/* ------------------------------------------------------------ Dialog (Bottom-Sheet) */
.sheet {
  width: 100%; max-width: 520px; margin: auto auto 0; padding: 0;
  border: 0; border-radius: 24px 24px 0 0;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  max-height: 92vh;
}
.sheet[open] { animation: sheet-up .22s ease-out; }
.sheet::backdrop { background: rgba(10, 16, 13, .45); backdrop-filter: blur(2px); }
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-form { display: flex; flex-direction: column; gap: 14px; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { font-size: 1.15rem; }
.sheet-head .icon-btn { width: 36px; height: 36px; }
.sheet-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding-top: 4px; }
.sheet-actions .btn { padding: 0 14px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.stepper { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 8px 0; }
.stepper input { width: 96px; text-align: center; font-size: 1.6rem; font-weight: 750; min-height: 56px; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Suche im Mahlzeiten-Dialog */
.sheet-form .search { display: block; margin: 0; }
.sheet-form .search input { box-shadow: none; background: var(--surface-2); border-color: transparent; }
.sheet-form .search input:focus { background: var(--surface); border-color: var(--brand); }
.picked {
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px;
  border-radius: var(--radius); background: var(--brand-soft); color: var(--brand-strong); font-weight: 650;
}
.picked.is-hidden { display: none; }
.picked .picked-title { flex: 1; min-width: 0; color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked .chip-remove { color: var(--brand-strong); }
.meal-results { display: flex; flex-direction: column; gap: 6px; max-height: 38vh; overflow-y: auto; margin: -4px -4px 0; padding: 4px; overscroll-behavior: contain; }
.meal-results:empty { display: none; }
.results-title { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 2px; }
.result-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.result {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px; min-height: 48px;
  border: 0; border-radius: 12px; background: transparent; text-align: left;
}
.result:hover, .result:focus-visible { background: var(--surface-2); }
.result > .icon { margin-left: auto; color: var(--brand); width: 18px; height: 18px; }
.result-text { display: flex; flex-direction: column; min-width: 0; }
.result-text strong { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-text small { color: var(--muted); font-size: .8rem; }
.chip-btn { border: 0; padding: 8px 14px; cursor: pointer; }
.chip-btn:hover { background: var(--surface-3); }
.meal-results .chips { margin-bottom: 0; }

/* ------------------------------------------------------------ Hinweise */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  max-width: 480px; padding: 12px 18px; border-radius: 14px;
  background: var(--text); color: var(--bg); font-weight: 600; font-size: .92rem; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s;
}
.toast.is-visible { opacity: 1; transform: none; }
.toast-error { background: var(--danger); color: #fff; }

/* ------------------------------------------------------------ Rezepte */
.search { position: relative; margin-bottom: 14px; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; }
.search input { padding-left: 42px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm); }
.recipe-grid { display: grid; gap: 10px; }
.recipe-card {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); color: var(--text);
  transition: box-shadow .15s, transform .08s;
}
.recipe-card:hover { box-shadow: var(--shadow); }
.recipe-card:active { transform: scale(.99); }
.recipe-card > .icon { color: var(--muted); margin-left: auto; }
.recipe-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; align-items: flex-start; }
.recipe-info strong { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.recipe-info small { color: var(--muted); font-size: .82rem; }
.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); z-index: 25;
  display: grid; place-items: center; width: 58px; height: 58px; border-radius: 20px;
  background: var(--brand); color: var(--brand-contrast); box-shadow: 0 8px 24px color-mix(in srgb, var(--brand) 45%, transparent);
}
.fab .icon { width: 26px; height: 26px; }

.recipe-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.recipe-head h1 { font-size: 1.8rem; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; }
.recipe-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.recipe-actions form { display: contents; }
.ingredients { list-style: none; margin: 0; padding: 0; }
.ingredients li { display: flex; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.ingredients li:last-child { border-bottom: 0; }
.ingredients .amount { flex: none; min-width: 72px; font-weight: 700; color: var(--brand-strong); font-variant-numeric: tabular-nums; }
.ingredients .name { flex: 1; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 4px 0 14px 44px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px;
  background: var(--brand-soft); color: var(--brand-strong); font-weight: 750; font-size: .9rem;
}

.ingredients-edit { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.ing-row {
  display: grid; gap: 8px;
  grid-template-columns: 76px 84px 1fr 44px;
  grid-template-areas: "name name name remove" "qty unit cat cat";
  padding-bottom: 10px; border-bottom: 1px dashed var(--border);
}
.ing-qty { grid-area: qty; } .ing-unit { grid-area: unit; } .ing-name { grid-area: name; }
.ing-cat { grid-area: cat; } .ing-remove { grid-area: remove; align-self: center; }
.form-actions {
  position: sticky; bottom: calc(var(--nav-h) + 8px + env(safe-area-inset-bottom)); z-index: 5;
  display: flex; justify-content: flex-end; gap: 8px; padding: 10px; margin-top: 8px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-radius: 999px; box-shadow: var(--shadow);
}

/* ------------------------------------------------------------ Einkaufsliste */
.live { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm); font-size: .8rem; font-weight: 700; color: var(--muted); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live[data-state=live] { color: var(--brand-strong); }
.live[data-state=live] i { background: var(--brand); box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 60%, transparent); animation: pulse 2s infinite; }
.live[data-state=offline] { color: var(--danger); }
.live[data-state=offline] i { background: var(--danger); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 55%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.add-bar {
  display: grid; gap: 8px; margin-bottom: 16px; padding: 10px;
  grid-template-columns: 1fr 1fr 1.4fr 44px; grid-template-areas: "name name name btn" "qty unit cat cat";
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.add-name { grid-area: name; } .add-qty { grid-area: qty; } .add-unit { grid-area: unit; }
.add-cat { grid-area: cat; } .add-btn { grid-area: btn; padding: 0; width: 44px; border-radius: 14px; }
.add-btn .icon { width: 22px; height: 22px; }
.add-bar input, .add-bar select { background: var(--surface-2); border-color: transparent; }

.shop-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.shop-group { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 6px 6px 8px; }
.shop-group ul { list-style: none; margin: 0; padding: 0; }
.shop-group-title { display: flex; align-items: center; gap: 8px; padding: 10px 12px 6px; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.shop-group-title .count { margin-left: auto; font-weight: 700; background: var(--surface-2); border-radius: 999px; padding: 1px 8px; }
.shop-group-title .icon { width: 16px; height: 16px; color: var(--brand); }
.cat-dot { width: 10px; height: 10px; border-radius: 4px; background: var(--cat); flex: none; }
.cat-0 { --cat: var(--cat-0); } .cat-1 { --cat: var(--cat-1); } .cat-2 { --cat: var(--cat-2); }
.cat-3 { --cat: var(--cat-3); } .cat-4 { --cat: var(--cat-4); } .cat-5 { --cat: var(--cat-5); }
.cat-6 { --cat: var(--cat-6); } .cat-7 { --cat: var(--cat-7); } .cat-8 { --cat: var(--cat-8); }
.ingredients .cat-dot { align-self: center; }

.shop-item { display: flex; align-items: center; gap: 4px; border-radius: 14px; }
.shop-item + .shop-item { border-top: 1px solid var(--border); }
.shop-item form { display: contents; }
.shop-toggle {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 8px 10px; border: 0; border-radius: 12px; background: transparent; text-align: left;
}
.shop-toggle:hover { background: var(--surface-2); }
.check {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 9px;
  border: 2px solid color-mix(in srgb, var(--muted) 55%, transparent); color: transparent;
  transition: background-color .15s, border-color .15s, color .15s;
}
.check .icon { width: 16px; height: 16px; }
.shop-text { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; min-width: 0; }
.shop-name { font-weight: 600; overflow-wrap: anywhere; }
.shop-amount { color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.shop-toggle .pill { margin-left: auto; }
.shop-item.is-checked .check { background: var(--brand); border-color: var(--brand); color: var(--brand-contrast); }
.shop-item.is-checked .shop-name { text-decoration: line-through; color: var(--muted); }
.shop-group.is-hidden, .empty-inline.is-hidden { display: none; }
.pending-dot { display: none; width: 8px; height: 8px; border-radius: 50%; background: var(--morgen); flex: none; margin-left: auto; }
.shop-item.is-pending .pending-dot { display: inline-block; }
.shop-item.is-pending .shop-toggle .pill { margin-left: 0; }
.live[data-state=pending] { color: var(--morgen); }
.live[data-state=pending] i { background: var(--morgen); }
.shop-group.is-done { background: transparent; box-shadow: none; border: 1px dashed var(--border); }
.shop-group.is-done .btn { margin-top: 8px; }

.plan-import { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.plan-import-text { display: flex; flex-direction: column; gap: 6px; flex: 1 1 260px; }
.week-mini { display: flex; align-items: center; gap: 6px; font-size: .88rem; font-weight: 600; color: var(--muted); }

/* ------------------------------------------------------------ Konto */
.account-grid { display: grid; gap: 0 14px; }
.profile { display: flex; align-items: center; gap: 14px; }
.profile-text { display: flex; flex-direction: column; flex: 1; }
.profile-text strong { font-size: 1.1rem; }
.member-list { list-style: none; margin: 0; padding: 0; }
.member-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.member-list li:last-child { border-bottom: 0; }
.member-list form { margin-left: auto; }
.member-name { font-weight: 600; }
.disclosure summary { cursor: pointer; font-weight: 650; color: var(--brand-strong); min-height: 36px; display: flex; align-items: center; }
.disclosure[open] summary { margin-bottom: 10px; }
.needs-attention { border-color: var(--morgen); box-shadow: 0 0 0 3px color-mix(in srgb, var(--morgen) 22%, transparent); }
.danger-zone summary { cursor: pointer; font-weight: 700; color: var(--danger); min-height: 32px; display: flex; align-items: center; }
.danger-zone details[open] summary { margin-bottom: 10px; }
.danger-zone .inline-form { margin-top: 12px; flex-wrap: wrap; }

/* ------------------------------------------------------------ Login */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--abend) 14%, transparent), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; padding: 28px 24px; background: var(--surface); border-radius: 28px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 18px; }
.auth-card > h1 { text-align: center; }
.auth-card > p { color: var(--muted); }
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.auth-logo p { font-size: .92rem; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 999px; background: var(--surface-2); }
.segmented a { text-align: center; padding: 9px 0; border-radius: 999px; color: var(--muted); font-weight: 650; font-size: .92rem; }
.segmented a.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ------------------------------------------------------------ Groessere Bildschirme */
@media (min-width: 640px) {
  .main { padding-left: 24px; padding-right: 24px; }
  .days { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recipe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sheet { margin: auto; border-radius: 24px; }
  .sheet-form { padding-bottom: 20px; }
  .add-bar { grid-template-columns: 1fr 96px 96px 190px 44px; grid-template-areas: "name qty unit cat btn"; }
  .ing-row { grid-template-columns: 84px 96px 1fr 190px 44px; grid-template-areas: "qty unit name cat remove"; border-bottom: 0; padding-bottom: 0; }
}

@media (min-width: 900px) {
  body.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100vh; }
  .topbar { grid-column: 1 / -1; padding-left: 20px; padding-right: 24px; }
  .nav {
    position: sticky; top: var(--top-h); align-self: start; height: auto; z-index: 10;
    flex-direction: column; justify-content: flex-start; gap: 4px; padding: 16px 12px;
    background: transparent; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .nav-link { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; font-size: .95rem; border-radius: 14px; }
  .nav-link:hover { background: var(--surface-2); }
  .nav-icon { width: 24px; height: 24px; background: transparent !important; }
  .nav-link.is-active { background: var(--brand-soft); }
  .nav-badge { right: -8px; top: -6px; }
  .main { max-width: 1240px; width: 100%; margin: 0; padding: 24px 32px 48px; }
  .toasts { bottom: 24px; }
  .fab { display: none; }
  .form-actions { bottom: 16px; }
  .select-pill select { max-width: 280px; }
  .recipe-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .recipe-body { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 14px; align-items: start; }
  .recipe-body .card { margin-bottom: 0; }
  .recipe-body + .card { margin-top: 14px; }
  .account-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .account-grid > .profile { grid-column: 1 / -1; }
  .shopping-columns { display: grid; }
}
@media (max-width: 899px) { .hide-mobile { display: none; } }
@media (max-width: 430px) { .brand-name { display: none; } .select-pill select { max-width: 62vw; } }

@media (min-width: 1280px) {
  .days { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
  .day-head { flex-direction: column; align-items: flex-start; gap: 0; padding: 12px 12px 6px; position: relative; }
  .day-head .pill { position: absolute; top: 12px; right: 10px; }
  .day-name .long { display: none; }
  .day-name .short { display: inline; font-size: 1.15rem; }
  .meal { flex-direction: column; align-items: stretch; gap: 2px; padding: 6px 8px 8px 8px; }
  .meal::before { display: none; }
  .meal-main { flex-direction: column; align-items: flex-start; gap: 4px; min-height: 64px; padding: 8px; background: var(--meal-soft); }
  .meal-main:hover { background: color-mix(in srgb, var(--meal-soft) 70%, var(--meal-color) 12%); }
  .meal-label { width: auto; font-size: .7rem; }
  .meal-text { font-size: .9rem; align-items: flex-start; }
  .meal-text .icon { margin-top: 2px; }
  .diners { align-self: flex-end; height: 26px; font-size: .75rem; }
  .meal + .meal { border-top: 0; }
}

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