/* Unsere Rezepte – mobile first, warme Küchenfarben, hell und dunkel. */

:root {
  --bg: #f7f2ec;
  --surface: #ffffff;
  --surface-2: #f2ebe3;
  --text: #2a231f;
  --muted: #776b62;
  --border: #e7ddd2;
  --brand: #e08155;
  --brand-soft: #fbe8dd;
  --brand-strong: #b4532a;
  --primary: #b4532a;
  --primary-text: #ffffff;
  --herb: #5d7a4c;
  --danger: #b42318;
  --focus: #d0703f;
  --green-bg: #e6f0df; --green-fg: #3f6330;
  --amber-bg: #fcefd4; --amber-fg: #7c5200;
  --red-bg: #fbe3e0;   --red-fg: #a3261b;
  --blue-bg: #e2ebf7;  --blue-fg: #1d4f91;
  --grey-bg: #efe9e2;  --grey-fg: #5b524b;
  --radius: 16px;
  --shadow: 0 1px 2px rgb(60 30 10 / 0.04), 0 8px 24px rgb(60 30 10 / 0.06);
  --tap: 44px;
  --tabbar: 64px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #181412;
    --surface: #221d1a;
    --surface-2: #2c2622;
    --text: #f2ebe4;
    --muted: #a99d93;
    --border: #3a322d;
    --brand: #e8875c;
    --brand-soft: #3b2a21;
    --brand-strong: #f2a17b;
    --primary: #e8875c;
    --primary-text: #1d130e;
    --herb: #a8c597;
    --danger: #f0776b;
    --focus: #f2a17b;
    --green-bg: #22321c; --green-fg: #a8d596;
    --amber-bg: #392d13; --amber-fg: #f0c66f;
    --red-bg: #3c1e1b;   --red-fg: #f29c92;
    --blue-bg: #1b2a3e;  --blue-fg: #9dc1f0;
    --grey-bg: #312a26;  --grey-fg: #c3b8af;
    --shadow: none;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { margin: 0 0 12px; line-height: 1.2; }
h1 { font-family: var(--serif); font-size: 1.75rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 8px; }
a { color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.spacer { flex: 1; }
.loading { padding: 40px 16px; text-align: center; color: var(--muted); }
.icon { width: 20px; height: 20px; flex-shrink: 0; }

/* ------------------------------------------------------------------ Marke */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--primary); color: var(--primary-text);
}
.brand-mark .icon { width: 22px; height: 22px; }
.brand-name { font-family: var(--serif); font-size: 1.2rem; letter-spacing: -0.01em; }
.brand-big .brand-mark { width: 52px; height: 52px; border-radius: 15px; }
.brand-big .brand-mark .icon { width: 32px; height: 32px; }
.brand-big .brand-name { font-size: 1.6rem; }

/* -------------------------------------------------------------- Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  height: 58px; padding: 0 16px;
}
.logo { display: flex; align-items: center; text-decoration: none; color: inherit; }
.nav-inline { display: none; margin-left: auto; gap: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 12px;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.95rem;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.active { color: var(--brand-strong); background: var(--brand-soft); }

/* Untere Navigationsleiste am Handy */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 0.7rem; font-weight: 600;
}
.tab .icon { width: 24px; height: 24px; }
.tab.active { color: var(--brand-strong); }
.tab-accent .icon {
  width: 40px; height: 30px; padding: 5px 10px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-strong);
}
.tab-accent.active .icon { background: var(--primary); color: var(--primary-text); }

@media (min-width: 900px) {
  .nav-inline { display: flex; }
  .tabbar { display: none; }
}

/* ----------------------------------------------------------------- Layout */
.content {
  max-width: 1180px; margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar) + 32px + env(safe-area-inset-bottom));
  display: grid; gap: 16px; align-content: start;
}
@media (min-width: 900px) {
  .content { padding: 28px 24px 64px; gap: 20px; }
}
.view-einstellungen, .view-import { max-width: 860px; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.page-head h1 { margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lead { font-size: 1.05rem; margin: 0; }
@media (max-width: 480px) { .hide-sm { display: none; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 12px; margin-bottom: 14px;
}
.card-head h2 { margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

details.collapsible > summary { cursor: pointer; font-weight: 600; list-style: none; min-height: 28px; color: var(--brand-strong); }
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible > summary::before { content: "+ "; }
details.collapsible[open] > summary::before { content: "− "; }
details.collapsible[open] > summary { margin-bottom: 14px; }

.info-box {
  display: flex; align-items: center; gap: 10px; margin: 0;
  padding: 12px 14px; border-radius: 12px;
  background: var(--brand-soft); color: var(--brand-strong); font-weight: 500;
}
.warn { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--amber-bg); color: var(--amber-fg); font-size: 0.92rem; }
.code {
  margin: 0; padding: 10px 12px; border-radius: 10px; overflow-x: auto;
  background: var(--surface-2); font: 0.85rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------------------------------------------------------------- Anmeldung */
.auth {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-content: center; justify-items: center; gap: 12px;
  padding: 24px 16px;
}
.auth-card { width: min(380px, calc(100vw - 32px)); display: grid; gap: 14px; padding: 28px 24px; }
.auth-logo { display: flex; justify-content: center; margin-bottom: 2px; }
.auth-sub { text-align: center; color: var(--muted); margin: -4px 0 2px; }
.auth-card h2 { margin: 4px 0 0; }
.who { justify-content: center; }
.big-chip { min-width: 120px; min-height: 48px; font-size: 1.05rem; font-weight: 600; justify-content: center; }
.visually-hidden-label {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------------------------------------------------------------- Formulare */
label, .field-label { display: grid; gap: 6px; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.field { display: grid; gap: 6px; align-content: start; }
.inline-field { display: flex; align-items: center; gap: 10px; }
.inline-field select, .inline-field input { width: auto; flex: 1; }
.check {
  display: flex; align-items: flex-start; gap: 12px; cursor: pointer;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); font-weight: 400; font-size: 0.95rem;
}
.check input { width: 20px; height: 20px; min-height: 0; margin: 2px 0 0; flex-shrink: 0; accent-color: var(--primary); }
.check > span { display: grid; gap: 2px; }

input, select, textarea {
  width: 100%; min-width: 0; min-height: var(--tap);
  font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 9px 12px;
}
textarea { resize: vertical; min-height: 0; line-height: 1.55; }
input[type="checkbox"] { width: auto; min-height: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input:focus, select:focus, textarea:focus {
  border-color: var(--focus); outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent);
}
.stack-form { display: grid; gap: 14px; }
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; }
.triple { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.triple label { font-size: 0.78rem; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0; font-weight: 400; }
.form-error { color: var(--danger); font-size: 0.9rem; margin: 0; }
.form-error:empty { display: none; }
.form-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }

/* ------------------------------------------------------------------ Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap);
  font: inherit; font-weight: 600; font-size: 0.95rem;
  padding: 8px 16px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  text-decoration: none; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--primary) 88%, black); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn.danger-text { color: var(--danger); }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: 0.9rem; border-radius: 11px; }
.btn.big { min-height: 54px; font-size: 1.05rem; }
.btn.block { width: 100%; }
.btn.icon-only { width: var(--tap); padding: 0; }
.btn.fav.active { color: #d9443b; border-color: color-mix(in srgb, #d9443b 35%, var(--border)); }
.btn.fav.active .icon { fill: currentColor; }

.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center;
  border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface); color: var(--text); font-size: 1.2rem; line-height: 1; cursor: pointer;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }

/* -------------------------------------------------------------------- Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 0.9rem; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.chip .icon { width: 16px; height: 16px; }
.chip:hover { border-color: var(--focus); }
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.small-chip { min-height: 30px; padding: 3px 10px; font-size: 0.82rem; }
.chip-sub { font-size: 0.75rem; font-weight: 500; opacity: 0.7; }

.chips.segmented {
  gap: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  flex-wrap: nowrap; background: var(--surface); width: fit-content; max-width: 100%;
}
.chips.segmented .chip { border: 0; border-radius: 0; min-height: 38px; padding: 6px 14px; justify-content: center; }
.chips.segmented .chip + .chip { border-left: 1px solid var(--border); }
.chips.segmented.wide { width: 100%; }
.chips.segmented.wide .chip { flex: 1; }

.filter-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px; scrollbar-width: none; }
.filter-chips::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .filter-chips { flex-wrap: wrap; margin: 0; padding: 0; } }

.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper-value { min-width: 30px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.servings { display: inline-flex; align-items: center; gap: 8px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.badge-green { background: var(--green-bg); color: var(--green-fg); }
.badge-amber { background: var(--amber-bg); color: var(--amber-fg); }
.badge-red { background: var(--red-bg); color: var(--red-fg); }
.badge-blue { background: var(--blue-bg); color: var(--blue-fg); }
.badge-grey { background: var(--grey-bg); color: var(--grey-fg); }
.badge-brand { background: var(--brand-soft); color: var(--brand-strong); }

/* ------------------------------------------------------------ Rezeptliste */
.search-row { display: flex; gap: 8px; }
.search {
  flex: 1; display: flex; align-items: center; gap: 8px;
  padding: 0 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  color: var(--muted);
}
.search:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.search input { border: 0; padding: 10px 0; background: transparent; box-shadow: none !important; }
.sort-select { width: auto; flex-shrink: 0; max-width: 42%; }
.result-count { margin: -6px 2px 0; }

.recipe-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .recipe-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 1000px) { .recipe-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.recipe-card {
  position: relative; display: grid; align-content: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; text-decoration: none; color: inherit; box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
}
.recipe-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgb(60 30 10 / 0.05), 0 14px 32px rgb(60 30 10 / 0.1); }
.thumb { aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.placeholder {
  display: grid; place-items: center; color: color-mix(in srgb, var(--brand) 55%, transparent);
  background: linear-gradient(135deg, var(--brand-soft), var(--surface-2));
}
.placeholder .icon { width: 42%; height: 42%; max-width: 64px; max-height: 64px; stroke-width: 1.4; }
.recipe-card-body { padding: 10px 12px 12px; display: grid; gap: 4px; }
.recipe-card h3 {
  margin: 0; font-size: 0.98rem; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.recipe-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0; color: var(--muted); font-size: 0.8rem; }
.recipe-card-meta .icon { width: 14px; height: 14px; }
.meta-tag { padding: 0 7px; border-radius: 999px; background: var(--surface-2); }
.fav-dot {
  position: absolute; top: 8px; right: 8px;
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: rgb(255 255 255 / 0.92); color: #d9443b;
}
.fav-dot .icon { width: 16px; height: 16px; fill: currentColor; }
.empty { color: var(--muted); padding: 12px 0; margin: 0; }

.empty-state { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 40px 20px; }
.empty-icon {
  display: grid; place-items: center; width: 76px; height: 76px; border-radius: 24px; margin-bottom: 8px;
  background: var(--brand-soft); color: var(--brand-strong);
}
.empty-icon .icon { width: 40px; height: 40px; }
.actions.center { justify-content: center; margin-top: 8px; }

/* ----------------------------------------------------------- Rezeptansicht */
.back-link {
  display: inline-flex; align-items: center; gap: 4px; width: fit-content;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; margin-bottom: -4px;
}
.back-link:hover { color: var(--text); }
.back-link .icon { width: 18px; height: 18px; }
.recipe { display: grid; gap: 16px; }
.recipe-head { display: grid; gap: 16px; }
.recipe-hero { border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 10; background: var(--surface-2); margin: 0 -4px; }
.recipe-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.recipe-intro { display: grid; gap: 10px; align-content: center; }
.recipe-intro h1 { margin: 0; font-size: 2rem; }
.meta-row { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; color: var(--muted); font-size: 0.92rem; }
.meta-item { display: inline-flex; align-items: center; gap: 6px; }
.meta-item .icon { width: 18px; height: 18px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.recipe-actions { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 8px; margin-top: 4px; }
.recipe-actions .btn:not(.icon-only) { padding: 8px 10px; }
@media (min-width: 560px) { .recipe-actions { display: flex; flex-wrap: wrap; } .recipe-actions .btn:not(.icon-only) { padding: 8px 16px; } }

@media (min-width: 760px) {
  .recipe-head.has-image { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: center; gap: 28px; }
  .recipe-hero { margin: 0; }
  .recipe-intro h1 { font-size: 2.3rem; }
}

.recipe-body { display: grid; gap: 16px; align-items: start; }
@media (min-width: 900px) {
  .recipe-body { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 20px; }
  .ingredients-card { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; }
}

.group-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--brand-strong); margin: 14px 0 4px; }
.group-title:first-child { margin-top: 0; }
.ingredient-list, .steps, .shop-list, .pick-list, .plan-entries { list-style: none; margin: 0; padding: 0; }
.ingredient-list li + li { border-top: 1px solid var(--border); }
.ingredient {
  width: 100%; display: grid; grid-template-columns: minmax(64px, auto) minmax(0, 1fr); gap: 12px; align-items: baseline;
  padding: 9px 2px; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.ing-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; min-width: 64px; }
.ing-name { display: grid; }
.ing-note { color: var(--muted); font-size: 0.85rem; }
.ingredient.done .ing-amount, .ingredient.done .ing-name { text-decoration: line-through; opacity: 0.45; }

.steps { display: grid; gap: 4px; counter-reset: step; }
.step {
  width: 100%; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: start;
  padding: 10px 4px; border-radius: 12px; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
  font-size: 1.02rem; line-height: 1.55;
}
.step:hover { background: var(--surface-2); }
.step-num {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-strong); font-weight: 700; font-size: 0.9rem;
}
.step.done .step-text { opacity: 0.45; }
.step.done .step-num { background: var(--green-bg); color: var(--green-fg); }
.notes { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.notes h3 { font-size: 0.85rem; margin-bottom: 4px; color: var(--muted); }
.notes p { margin: 0; white-space: pre-line; }
.recipe-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin: 16px 0 0; }
.source-link { display: inline-flex; align-items: center; gap: 6px; color: var(--brand-strong); text-decoration: none; font-weight: 600; }
.source-link .icon { width: 16px; height: 16px; }

/* ----------------------------------------------------------------- Editor */
.editor { display: grid; gap: 16px; }
.editor-main, .editor-side { display: grid; gap: 16px; align-content: start; }
@media (min-width: 900px) {
  .editor { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
  .editor-foot { grid-column: 1 / -1; }
}
.editor-foot {
  position: sticky; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); z-index: 5;
  display: grid; gap: 8px; padding: 12px 0;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
@media (min-width: 900px) { .editor-foot { bottom: 0; } }
.editor textarea { font-size: 15.5px; }
.photo-box { display: grid; gap: 10px; }
.photo-box img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; display: block; }
.photo-empty {
  display: grid; place-items: center; gap: 6px; aspect-ratio: 4 / 3; border-radius: 12px;
  border: 2px dashed var(--border); color: var(--muted); font-size: 0.9rem; text-align: center; padding: 12px;
}
.photo-empty .icon { width: 32px; height: 32px; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-suggest { margin-top: 2px; }

/* ----------------------------------------------------------------- Import */
.import-card { display: grid; gap: 16px; }
.import-panel { min-height: 120px; }
.dropzone {
  position: relative; display: grid; justify-items: center; gap: 4px; text-align: center;
  padding: 28px 16px; border: 2px dashed var(--border); border-radius: 14px; cursor: pointer;
  color: var(--text); font-weight: 400; font-size: 1rem; background: var(--surface-2);
}
.dropzone .icon { width: 34px; height: 34px; color: var(--brand-strong); }
.dropzone:hover, .dropzone.drag { border-color: var(--focus); background: var(--brand-soft); }
.dropzone.has-files { padding: 16px; }
.drop-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.shot-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.shot-grid:empty { display: none; }
.shot { position: relative; margin: 0; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot-remove {
  position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: rgb(0 0 0 / 0.6); color: #fff; cursor: pointer;
}
.shot-remove .icon { width: 16px; height: 16px; }
.import-status { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--brand-strong); font-weight: 600; }
.import-status:empty { display: none; }
.import-card.working .import-panel { opacity: 0.6; pointer-events: none; }
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 3px solid var(--brand-soft); border-top-color: var(--brand-strong);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ Essensplan */
.plan-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.week-nav { display: flex; align-items: center; gap: 6px; }
.plan-range { flex-basis: 100%; }
@media (min-width: 760px) { .plan-range { flex-basis: auto; margin-left: auto; } }

.days { display: grid; gap: 12px; }
@media (min-width: 640px) { .days { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); } }
@media (min-width: 1000px) {
  .days-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .days-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .days-7 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1500px) { .days-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.day {
  display: grid; gap: 8px; align-content: start;
  padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.day.today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand), var(--shadow); }
.day.past { opacity: 0.7; }
.day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.day-name { font-weight: 700; font-size: 1.05rem; }
.day.today .day-name { color: var(--brand-strong); }
.day-date { color: var(--muted); font-size: 0.85rem; }
.day-empty { color: var(--muted); font-size: 0.9rem; margin: 2px 0; }
.day .add { justify-self: start; color: var(--brand-strong); padding-left: 6px; }
.plan-entries { display: grid; gap: 6px; }
.plan-entry {
  width: 100%; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: center;
  padding: 6px; border-radius: 12px; border: 0; background: var(--surface-2);
  color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.plan-entry:hover { background: var(--brand-soft); }
.mini-thumb { width: 44px; height: 44px; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: var(--surface); }
.mini-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mini-thumb .icon { width: 22px; height: 22px; }
.text-entry { color: var(--muted); }
.plan-entry-main { display: grid; min-width: 0; }
.plan-entry-title { font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.plan-entry-sub { color: var(--muted); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pick-list {
  display: grid; gap: 4px; max-height: min(42vh, 360px); overflow-y: auto;
  border: 1px solid var(--border); border-radius: 12px; padding: 4px;
}
.pick {
  width: 100%; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 5px 8px 5px 5px; border-radius: 10px; border: 0; background: none;
  color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.pick:hover { background: var(--surface-2); }
.pick.active { background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand); }
.pick-title { font-weight: 600; }
.fav-icon { width: 16px; height: 16px; color: #d9443b; fill: currentColor; }
.pick-list .empty { padding: 12px; }

.day-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.day-chip { display: grid; justify-items: center; gap: 0; border-radius: 12px; padding: 6px 4px; line-height: 1.25; min-height: 50px; }

/* ------------------------------------------------------- Einkaufs-Dialog */
.bring-dialog .shop-list {
  max-height: min(46vh, 420px); overflow-y: auto;
  border: 1px solid var(--border); border-radius: 12px;
}
.shop-list li + li { border-top: 1px solid var(--border); }
.shop-item {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px 12px; cursor: pointer; color: var(--text); font-weight: 400; font-size: 0.98rem;
}
.shop-item input { width: 20px; height: 20px; margin: 0; accent-color: var(--primary); }
.shop-main { display: grid; min-width: 0; }
.shop-name { font-weight: 600; }
.shop-spec { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.shop-sources { color: var(--muted); font-size: 0.75rem; opacity: 0.85; }
.shop-badges { display: grid; gap: 4px; justify-items: end; }
.shop-item.off .shop-name, .shop-item.off .shop-spec { opacity: 0.5; }
.shop-item.off .shop-name { text-decoration: line-through; }

/* ---------------------------------------------------------- Einstellungen */
.settings-grid { display: grid; gap: 16px; }
@media (min-width: 760px) { .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 8px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ Dialog */
dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0; border: 1px solid var(--border); border-radius: 20px;
  background: var(--surface); color: var(--text);
}
dialog::backdrop { background: rgb(30 15 5 / 0.45); }
.dialog-body { display: grid; gap: 14px; padding: 20px; }
.dialog-body h2 { margin: 0; font-size: 1.2rem; }
.dialog-body > div > p { margin: 4px 0 0; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
.actions.start { justify-content: flex-start; }

@media (max-width: 560px) {
  /* Dialoge als Bottom-Sheet am Handy */
  dialog {
    width: 100%; max-width: 100%; margin: auto 0 0;
    border-radius: 20px 20px 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .dialog-body .actions { display: grid; grid-auto-flow: row; justify-content: stretch; }
  .dialog-body .actions .spacer { display: none; }
  .dialog-body .actions .btn { width: 100%; }
  .editor-foot .actions .spacer { display: none; }
}

/* -------------------------------------------------------------------- Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar) + 20px + env(safe-area-inset-bottom)); z-index: 100;
  transform: translate(-50%, 20px); opacity: 0;
  max-width: calc(100vw - 32px);
  padding: 12px 18px; border-radius: 14px;
  background: var(--text); color: var(--bg); font-weight: 600;
  box-shadow: 0 8px 28px rgb(0 0 0 / 0.2);
  transition: opacity 0.2s, transform 0.2s;
}
@media (min-width: 900px) { .toast { bottom: 28px; } }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: var(--danger); color: #fff; }
