/* Rezepte – "Küchenzettel": weißes Papier, Bleistift-Grau, Rote Bete als einzige Akzentfarbe.
   Kochbuch-Serif (Young Serif) für Gerichte und Überschriften, Atkinson Hyperlegible für alles,
   was man im Supermarkt schnell lesen muss. */
:root {
  --paper: #fbfbf8;
  --surface: #ffffff;
  --ink: #26292b;
  --pencil: #6c7276;
  --rule: #e6e6e0;
  --beet: #8e2c48;
  --beet-soft: #f6e9ee;
  --sage: #e7ede4;
  --fleisch: #a5452f;
  --fisch: #2d6a8e;
  --vegetarisch: #4c7d3a;
  --salat: #7d7a20;
  --serif: "Young Serif", Georgia, serif;
  --sans: "Atkinson Hyperlegible", -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17191a; --surface: #202325; --ink: #ecebe6; --pencil: #a2a7aa; --rule: #31353a;
    --beet: #e08aa3; --beet-soft: #3a2630; --sage: #26302a;
    --fleisch: #e0907c; --fisch: #8cc0de; --vegetarisch: #a3cf8f; --salat: #d6d17a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 17px/1.5 var(--sans);
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
a { color: var(--beet); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--beet); outline-offset: 2px; border-radius: 6px; }
.ico { flex: none; }

main { padding: 0 16px 24px; max-width: 1040px; margin: 0 auto; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; margin: 32px 0 6px; }
.hint { color: var(--pencil); font-size: .92rem; margin: 0 0 12px; }
.empty { color: var(--pencil); text-align: center; padding: 48px 16px; max-width: 34em; margin: 0 auto; }
.empty a { display: block; margin-top: 10px; }

/* Kopf einfacher Seiten */
.top { padding: calc(18px + env(safe-area-inset-top)) 16px 8px; max-width: 1040px; margin: 0 auto; }
.top h1 { margin: 0; font-size: 1.9rem; }

/* Kopf der Woche: das eine große Element der App */
.week-head { padding: calc(22px + env(safe-area-inset-top)) 16px 4px; max-width: 1040px; margin: 0 auto; }
.week-label { margin: 0; color: var(--pencil); font-size: .95rem; }
.week-range { margin: 2px 0 6px; font-size: clamp(2.3rem, 9vw, 3.6rem); line-height: 1.02; }
.week-note { margin: 0; color: var(--pencil); font-size: .95rem; }
.week-note a { margin-left: 4px; }

/* Filter: Reiter mit Unterstrich, wischbar ohne Scrollleiste */
.filters {
  position: sticky; top: 0; z-index: 4; background: var(--paper);
  display: flex; gap: 22px; overflow-x: auto; margin: 14px -16px 20px; padding: 10px 16px 0;
  border-bottom: 1px solid var(--rule);
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.filters::-webkit-scrollbar { display: none; }
.filters a {
  flex: none; padding: 4px 0 10px; color: var(--pencil); font-weight: 700; font-size: .95rem;
  border-bottom: 2.5px solid transparent; margin-bottom: -1px;
}
.filters a:hover { text-decoration: none; color: var(--ink); }
.filters a.on { color: var(--ink); border-bottom-color: var(--beet); }

/* Gerichte: Bild + Titel direkt auf dem Papier, keine Kartenrahmen */
.dishes { display: grid; gap: 34px 22px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.dish { display: flex; flex-direction: column; min-width: 0; }
.dish-img { display: block; position: relative; height: 190px; border-radius: 10px; overflow: hidden; background: var(--sage); }
.dish-img img { width: 100%; height: 190px; object-fit: cover; }
.dish-title {
  margin: 12px 0 4px; color: var(--ink); font-family: var(--serif); font-size: 1.2rem; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.dish-title:hover { text-decoration: none; color: var(--beet); }
.dish-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 12px; color: var(--pencil); font-size: .9rem; }
.dish-meta span { display: inline-flex; align-items: center; gap: 5px; }
.omit-note { color: var(--beet); }

/* Kategorie: kleines Etikett auf dem Bild */
.tag {
  display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700;
  padding: 3px 10px 3px 8px; border-radius: 999px; background: var(--surface); color: var(--ink);
}
.tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--pencil); }
.dish-img .tag { position: absolute; left: 10px; bottom: 10px; }
.tag-fleisch::before { background: var(--fleisch); }
.tag-fisch::before { background: var(--fisch); }
.tag-vegetarisch::before { background: var(--vegetarisch); }
.tag-salat::before { background: var(--salat); }

/* Aktionen: "In den Korb [2][4]" und Merken-Stern */
.actions { display: flex; align-items: center; gap: 10px; margin-top: auto; }
.actions form { margin: 0; }
.fav-form { margin-left: auto !important; }
.seg { display: inline-flex; align-items: stretch; border: 1.5px solid var(--beet); border-radius: 999px; overflow: hidden; }
.seg form { display: flex; margin: 0; }
.seg-label { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; color: var(--beet); font-weight: 700; font-size: .9rem; }
.seg button { min-width: 44px; min-height: 40px; padding: 0 12px; font-weight: 700; color: var(--beet); border-left: 1.5px solid var(--beet); }
.seg button:hover, .seg button.on { background: var(--beet); color: #fff; }
.seg.small .seg-label { padding: 0 8px 0 10px; }
.seg.small button { min-height: 36px; min-width: 40px; }
.in-basket {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px;
  border-radius: 999px; background: var(--beet); color: #fff; font-weight: 700; font-size: .9rem;
}
.fav { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--pencil); }
.fav:hover { background: var(--sage); }
.fav.on { color: #c58a0b; }

.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; background: var(--beet); color: #fff; font-weight: 700;
}
.primary.wide { display: flex; width: 100%; margin-top: 20px; min-height: 50px; font-size: 1.05rem; }

/* Rezeptseite */
.recipe { max-width: 680px; margin: 0 auto; }
.recipe .hero { width: calc(100% + 32px); max-width: none; height: 190px; object-fit: cover; margin: 0 -16px 16px; }
.recipe > .tag { background: var(--sage); }
.recipe-title { font-size: clamp(1.7rem, 6vw, 2.3rem); line-height: 1.12; margin: 10px 0 8px; }
.recipe .actions { margin: 4px 0 8px; }
.recipe section { border-top: 1px solid var(--rule); margin-top: 28px; }
.recipe h2 { margin-top: 22px; }
.ingredients { list-style: none; padding: 0; margin: 0; }
.ingredients li { padding: 9px 0; border-bottom: 1px solid var(--rule); }
.ingredients li:last-child { border-bottom: 0; }
.ingredients .omit s { color: var(--pencil); }
.ingredients .omit span { color: var(--beet); font-size: .85rem; font-weight: 700; margin-left: 6px; }
.steps-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cookmode { display: inline-flex; align-items: center; gap: 6px; color: var(--pencil); font-size: .9rem; padding: 6px 0; }
.cookmode[aria-pressed="true"] { color: var(--beet); font-weight: 700; }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 12px 0 0; }
.steps li { counter-increment: step; position: relative; padding: 0 0 18px 42px; line-height: 1.6; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -2px; font-family: var(--serif);
  font-size: 1.35rem; color: var(--beet);
}
.source { margin-top: 28px; font-size: .95rem; }
.source a { display: inline-flex; align-items: center; gap: 6px; }

/* Listen: Korb, Verlauf */
.rows { list-style: none; padding: 0; margin: 8px 0 0; }
.rows li { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.row-img { flex: none; width: 76px; height: 76px; border-radius: 8px; overflow: hidden; background: var(--sage); }
.row-img img { width: 100%; height: 100%; object-fit: cover; }
.row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.row-title { color: var(--ink); font-family: var(--serif); line-height: 1.25; }
.row-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row-actions form { margin: 0; }
.remove { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--pencil); }
.remove:hover { background: var(--sage); }

/* Mehr */
.menu { list-style: none; padding: 0; margin: 8px 0 0; border-top: 1px solid var(--rule); }
.menu li { border-bottom: 1px solid var(--rule); }
.menu a { display: block; padding: 15px 0; color: var(--ink); font-weight: 700; }
.exclusions { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.exclusions li { display: inline-flex; align-items: center; gap: 4px; padding: 5px 6px 5px 14px; border-radius: 999px; background: var(--sage); font-weight: 700; font-size: .92rem; }
.exclusions form { margin: 0; display: flex; }
.exclusions button { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--pencil); }
.inline { display: flex; gap: 8px; }
input {
  font: inherit; flex: 1; min-width: 0; min-height: 44px; padding: 0 14px;
  border: 1.5px solid var(--rule); border-radius: 999px; background: var(--surface); color: var(--ink);
}
input:focus { border-color: var(--beet); outline: none; }
.logout { margin-top: 40px; text-align: center; }

/* Einkaufsliste: großer Tippbereich, Häkchen links */
.add-extra { margin: 4px 0 6px; }
.add-extra .primary { width: 44px; padding: 0; flex: none; }
.aisle h2 { font-size: 1.15rem; margin: 26px 0 2px; color: var(--pencil); }
.shopping { list-style: none; padding: 0; margin: 0; }
.shopping li { display: flex; align-items: center; border-bottom: 1px solid var(--rule); }
.shopping label { flex: 1; display: flex; align-items: center; gap: 14px; padding: 11px 0; cursor: pointer; min-height: 52px; }
.shopping input[type=checkbox] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.shopping .box {
  flex: none; width: 26px; height: 26px; border-radius: 7px; border: 2px solid var(--pencil);
  display: inline-flex; align-items: center; justify-content: center; color: transparent;
}
.shopping input:focus-visible + .box { outline: 2px solid var(--beet); outline-offset: 2px; }
.shopping li.done .box { background: var(--beet); border-color: var(--beet); color: #fff; }
.shopping .what { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.shopping .name { font-weight: 700; }
.shopping .amount { color: var(--ink); }
.shopping .from { color: var(--pencil); font-size: .85rem; }
.shopping li.done .what { color: var(--pencil); text-decoration: line-through; }
.shopping li.done .name, .shopping li.done .amount { color: var(--pencil); }
.stock { margin-top: 28px; border-top: 1px solid var(--rule); padding-top: 14px; }
.stock summary { cursor: pointer; font-family: var(--serif); font-size: 1.15rem; }
.stock summary .hint { font-family: var(--sans); font-size: .9rem; margin-left: 6px; }
.stock p { color: var(--pencil); margin: 10px 0 0; }

/* Tab-Leiste */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex;
  background: var(--surface); border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom);
}
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 7px; font-size: .74rem; color: var(--pencil); position: relative; }
.tabs a:hover { text-decoration: none; }
.tabs a.on { color: var(--beet); font-weight: 700; }
.badge {
  position: absolute; top: 5px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--beet); color: #fff; font-size: .7rem; line-height: 18px; text-align: center;
}
.badge[hidden] { display: none; }

/* Login */
body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
body.login form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; }
body.login h1 { font-size: 2.2rem; line-height: 1.1; margin: 0 0 12px; }
.error { color: var(--beet); margin: 0; }

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