/* Tischlein: Tischtuch-Karo, Papier und eine Speisekarten-Überschrift. */

:root {
  color-scheme: light dark;
  --paper: #fbf6ec;
  --card: #fffdf8;
  --ink: #2a211c;
  --muted: #6f6157;
  --line: #e5dbc9;
  --red: #b93a2b;
  --red-ink: #a23022;
  --red-soft: #f8e5de;
  --green: #3d6b45;
  --green-soft: #e4eedd;
  --on-red: #fff;
  --check-a: rgba(185, 58, 43, .9);
  --check-b: rgba(185, 58, 43, .45);
  --shadow: 0 1px 2px rgba(70, 45, 25, .08), 0 8px 24px rgba(70, 45, 25, .08);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1e1916;
    --card: #2a2420;
    --ink: #f3ebdf;
    --muted: #b3a597;
    --line: #40362f;
    --red: #d9604f;
    --red-ink: #f09384;
    --red-soft: #452a24;
    --green: #93c198;
    --green-soft: #2b3a2c;
    --on-red: #1e1210;
    --check-a: rgba(217, 96, 79, .85);
    --check-b: rgba(217, 96, 79, .4);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.45 var(--sans);
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 4px; }

.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i-s { width: 18px; height: 18px; }

/* Karierter Tischtuchrand */
.cloth {
  height: calc(20px + env(safe-area-inset-top));
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg, var(--check-b) 50%, transparent 50%),
    linear-gradient(var(--check-b) 50%, transparent 50%);
  background-size: 20px 20px;
  background-position: left bottom;
  border-bottom: 1px solid var(--line);
}

main { max-width: 640px; margin: 0 auto; padding: 20px var(--gutter) 24px; outline: none; }

.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.view-head h1 { font-size: 30px; }
.sub { color: var(--muted); font-size: 14px; margin: 2px 0 0; }

/* Heute */
.today {
  display: block; width: 100%; text-align: left;
  background: var(--red); color: var(--on-red);
  border: 0; border-radius: 16px; padding: 18px 18px 16px;
  box-shadow: var(--shadow);
}
.today .label { font-size: 13px; letter-spacing: .04em; opacity: .92; display: block; }
.today .dish { font: 600 clamp(25px, 7vw, 32px)/1.12 var(--serif); margin: 6px 0 10px; display: block; text-wrap: balance; }
.today .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; }
.today .meta span { display: inline-flex; align-items: center; gap: 5px; }
.tomorrow { color: var(--muted); font-size: 14px; margin: 10px 2px 0; }
.tomorrow b { color: var(--ink); font-weight: 600; }

/* Wochen und Tage */
.week-title { font: 600 14px var(--sans); color: var(--muted); margin: 24px 2px 6px; }
.days { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.day { display: flex; align-items: stretch; border-top: 1px solid var(--line); min-height: 64px; }
.day:first-child { border-top: 0; }
.day-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 4px 10px 12px; background: none; border: 0; text-align: left; }
.date { width: 36px; flex: none; text-align: center; line-height: 1.1; color: var(--muted); }
.date small { display: block; font-size: 12px; }
.date b { display: block; font: 600 20px var(--serif); color: var(--ink); }
.day.is-today .date b, .day.is-today .date small { color: var(--red-ink); }
.dish-col { min-width: 0; }
.dish-name { display: block; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.dish-meta { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13px; margin-top: 2px; }
.dish-meta .i { width: 14px; height: 14px; }
.day.is-free .dish-name { font-weight: 400; color: var(--muted); font-style: italic; }
.day-tools { display: flex; align-items: center; padding-right: 6px; gap: 0; }
.tool { width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; border-radius: 10px; color: var(--muted); }
.tool:active { background: var(--red-soft); }
.persons { font-weight: 600; font-size: 14px; display: inline-flex; gap: 3px; width: 46px; color: var(--muted); }
.persons .i { width: 15px; height: 15px; }
.persons.more { color: var(--green); background: var(--green-soft); height: 32px; border-radius: 16px; }

/* Knöpfe */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 16px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line); font-weight: 600;
}
.btn.primary { background: var(--red); border-color: var(--red); color: var(--on-red); }
.btn.quiet { background: none; border-color: transparent; color: var(--red-ink); }
.btn.danger { color: var(--red-ink); }
.btn.block { display: flex; width: 100%; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; flex: none; }
.icon-btn[aria-pressed="true"] { color: var(--red-ink); }
.icon-btn[aria-pressed="true"] .i { fill: currentColor; }

.empty { text-align: center; padding: 34px 12px; }
.empty h2 { font-size: 26px; margin-bottom: 8px; text-wrap: balance; }
.empty p { color: var(--muted); margin: 0 auto 18px; max-width: 34ch; }
.plan-actions { margin-top: 18px; }
.nudge { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--green-soft); border-radius: 12px; padding: 10px 12px; margin-top: 14px; font-size: 14px; }

/* Auswahlreihen */
.chips { display: flex; gap: 6px; overflow-x: auto; margin: 0 calc(var(--gutter) * -1) 12px; padding: 2px var(--gutter); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 38px; padding: 6px 13px; border-radius: 19px; background: var(--card); border: 1px solid var(--line); font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 600; }

/* Ernährungsart */
.diets { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.diet { width: 100%; display: block; padding: 13px 14px; min-height: 64px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; text-align: left; }
.diet[aria-pressed="true"] { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.diet .dish-name { font: 600 19px var(--serif); }
.diet-text { display: block; color: var(--muted); font-size: 14px; margin-top: 1px; }
.diet-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; margin-top: 14px; padding: 10px 12px; background: none; border: 1px dashed var(--line); border-radius: 12px; text-align: left; font-size: 14px; }
.group .diet-row { margin-top: 0; }
.diet-change { color: var(--red-ink); font-weight: 600; flex: none; }

/* Allergien */
.allergen-list { padding: 0 0 10px; }
.swap { display: block; color: var(--green); font-size: 12px; }
.warn { background: var(--red-soft); color: var(--red-ink); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 0 0 14px; }

/* Geschäfte */
.store-form select { width: auto; flex: none; }
.store-form .btn { flex: none; }
.advice { background: var(--green-soft); border-radius: 12px; padding: 10px 12px; margin: 10px 0 4px; font-size: 14px; }
.advice p { margin: 0 0 4px; }
.advice p:last-child { margin: 0; }
.stores { list-style: none; margin: 0; padding: 0; }
.store { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.store > div { min-width: 0; }
.store .btn { min-height: 40px; padding: 6px 12px; flex: none; text-decoration: none; color: var(--ink); }
.hours { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.sheet h3 small { font: 400 13px var(--sans); color: var(--muted); }
.credit { margin-top: 16px; font-size: 12px; }
.credit a { color: inherit; }
.diet-row { text-align: left; }

/* Personenrechner */
.calc { margin-bottom: 8px; }
.calc .stepper { margin-bottom: 8px; }
.calc-quick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 6px; }
.calc-quick .chip { min-height: 44px; padding: 0; font-weight: 600; }
.calc .note { margin: 0 2px 8px; font-size: 13px; }
.aisle small { font: 400 14px var(--sans); color: var(--muted); }

/* Einkauf */
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-bottom: 14px; }
.progress div { height: 100%; background: var(--green); width: 0; transition: width .2s; }
.progress div.w-0 { width: 0 } .progress div.w-5 { width: 5% } .progress div.w-10 { width: 10% } .progress div.w-15 { width: 15% } .progress div.w-20 { width: 20% } .progress div.w-25 { width: 25% } .progress div.w-30 { width: 30% } .progress div.w-35 { width: 35% } .progress div.w-40 { width: 40% } .progress div.w-45 { width: 45% } .progress div.w-50 { width: 50% } .progress div.w-55 { width: 55% } .progress div.w-60 { width: 60% } .progress div.w-65 { width: 65% } .progress div.w-70 { width: 70% } .progress div.w-75 { width: 75% } .progress div.w-80 { width: 80% } .progress div.w-85 { width: 85% } .progress div.w-90 { width: 90% } .progress div.w-95 { width: 95% } .progress div.w-100 { width: 100% }
.aisle { font: 600 18px var(--serif); margin: 20px 2px 6px; }
.items { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.item { display: flex; align-items: stretch; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item-check { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 12px; padding: 12px; min-height: 52px; background: none; border: 0; text-align: left; }
.box { width: 24px; height: 24px; flex: none; border: 2px solid var(--muted); border-radius: 7px; display: grid; place-items: center; color: transparent; }
.box .i { width: 16px; height: 16px; stroke-width: 3; }
.item-text { min-width: 0; overflow-wrap: anywhere; }
.amount { font-weight: 600; }
.sources { display: block; color: var(--muted); font-size: 13px; margin-top: 1px; }
.item.done .box { background: var(--green); border-color: var(--green); color: var(--card); }
.item.done .item-text, .item.done .sources { text-decoration: line-through; color: var(--muted); }
.add-row { display: flex; gap: 8px; margin: 0 0 4px; }
.add-row input { flex: 1; min-width: 0; }
.pantry { margin-top: 22px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.pantry summary { padding: 13px 12px; font-weight: 600; cursor: pointer; }
.pantry p { margin: 0; padding: 0 12px 10px; color: var(--muted); font-size: 14px; }
.pantry-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 14px; }

/* Rezepte */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.field small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; margin-top: 3px; }
input[type="text"], input[type="search"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px;
}
textarea { min-height: 120px; resize: vertical; }
.search { margin-bottom: 10px; }
.recipe-list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.recipe-list li { border-top: 1px solid var(--line); }
.recipe-list li:first-child { border-top: 0; }
.recipe-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; min-height: 58px; background: none; border: 0; text-align: left; }
.recipe-row.off .dish-name { color: var(--muted); text-decoration: line-through; font-weight: 400; }
.heart { color: var(--red-ink); }
.heart .i { fill: currentColor; width: 16px; height: 16px; }
.count { color: var(--muted); font-size: 14px; margin: 0 2px 8px; }
.none { color: var(--muted); padding: 22px 12px; text-align: center; }

/* Einstellungen */
.group { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.group h2 { font-size: 20px; margin-bottom: 12px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two .field { display: flex; flex-direction: column; justify-content: space-between; }
.note { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.stack { display: grid; gap: 8px; }

/* Ausklappfenster von unten */
.sheet {
  width: 100%; max-width: 640px; max-height: 92dvh; margin: auto auto 0;
  border: 0; padding: 0; background: var(--paper); color: var(--ink);
  border-radius: 20px 20px 0 0; overflow: auto; overscroll-behavior: contain;
}
.sheet::backdrop { background: rgba(30, 20, 12, .5); }
.sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 16px var(--gutter) 10px; background: var(--paper); }
.sheet-head h2 { font-size: 24px; overflow-wrap: anywhere; }
.sheet-head .kicker { color: var(--muted); font-size: 14px; display: block; margin-bottom: 2px; }
.sheet-body { padding: 4px var(--gutter) calc(20px + env(safe-area-inset-bottom)); }
.close { background: none; border: 0; width: 44px; height: 44px; margin: -8px -10px 0 0; display: grid; place-items: center; flex: none; color: var(--muted); }
.facts { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.facts span { display: inline-flex; align-items: center; gap: 5px; }
.facts .i { width: 16px; height: 16px; }
.stepper { display: flex; align-items: center; justify-content: space-between; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px 4px 4px 12px; margin-bottom: 14px; }
.stepper .ctrl { display: flex; align-items: center; gap: 4px; }
.stepper b { min-width: 28px; text-align: center; font-size: 18px; }
.stepper button { width: 44px; height: 44px; font-size: 22px; line-height: 1; background: none; border: 0; border-radius: 10px; color: var(--red-ink); }
.stepper button:disabled { color: var(--line); }
.sheet h3 { font-size: 19px; margin: 18px 0 8px; }
.ingredients { list-style: none; margin: 0; padding: 0; }
.ingredients li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dotted var(--line); }
.ingredients .q { width: 76px; flex: none; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.steps { margin: 0; padding: 0 0 0 22px; }
.steps li { margin-bottom: 9px; }
.sheet-actions { display: grid; gap: 8px; margin-bottom: 8px; }
.pick-list { list-style: none; margin: 0; padding: 0; }
.pick-list button { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 2px; min-height: 52px; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; }
.pick-list .dish-meta { margin: 0; flex: none; }

/* Navigation unten */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 4px max(6px, calc((100vw - 640px) / 2)) calc(4px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line);
}
.tab { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px; min-height: 54px; background: none; border: 0; color: var(--muted); font-size: 12px; }
.tab[aria-current="page"] { color: var(--red-ink); font-weight: 600; }
.badge { position: absolute; top: 2px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: var(--on-red); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }

.toast {
  position: fixed; z-index: 5; left: var(--gutter); right: var(--gutter); max-width: 608px; margin: 0 auto;
  bottom: calc(72px + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--ink); color: var(--paper); border-radius: 12px; padding: 10px 14px; min-height: 48px; box-shadow: var(--shadow);
}
.toast button { background: none; border: 0; color: inherit; font-weight: 700; text-decoration: underline; min-height: 32px; padding: 0 2px; flex: none; }

@media (prefers-reduced-motion: no-preference) {
  .sheet[open] { animation: rise .2s ease-out; }
  @keyframes rise { from { transform: translateY(24px); opacity: .6; } }
}
@media (min-width: 680px) {
  .sheet { margin: auto; border-radius: 20px; }
}

/* Familie */
.member-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.check-chip { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.check-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-chip:has(input:checked) { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 600; }
.check-chip:has(input:focus-visible) { outline: 2px solid var(--red); outline-offset: 2px; }
.check-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; font-weight: 600; font-size: 15px; }
.check-row input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--red); }
.check-row small { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }
.members .dish-meta { flex: initial; display: block; }
.me { font: 400 13px var(--sans); color: var(--muted); }
.wish-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.wish-list li { padding: 6px 0; border-bottom: 1px dotted var(--line); }
.wish-list .dish-meta { display: inline; }
.rate-btns .btn[aria-pressed="true"], .btn[data-action="toggle-wish"][aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.btn[data-action="toggle-wish"][aria-pressed="true"] .i { fill: currentColor; }
.rate { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; font-weight: 600; }
.rate-btns { display: flex; gap: 6px; }
.rate-btns .btn { min-height: 40px; padding: 6px 12px; }
.rate-nudge { flex-wrap: wrap; }
.rate-nudge .rate { margin: 0; flex: 1 1 auto; justify-content: flex-end; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .04em; }
.code-big { font: 600 28px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .06em; text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 8px; margin: 10px 0 14px; overflow-wrap: anywhere; }

/* Feedback-Liste */
.feedback-list { list-style: none; margin: 0; padding: 0; }
.feedback-list li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.feedback-list li:last-child { border-bottom: 0; }
.feedback-list p { margin: 4px 0 0; overflow-wrap: anywhere; white-space: pre-line; }
.fb-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.fb-head span { color: var(--muted); font-size: 13px; }
.fb-head .tag { color: var(--green); background: var(--green-soft); border-radius: 10px; padding: 1px 8px; font-weight: 600; }
.fb-reply { background: var(--green-soft); border-radius: 10px; padding: 8px 10px; }
[data-form="feedback"] + h3 { margin-top: 20px; }
