/* Essensplan 2.0 – Creme-Canvas, Foto-Karten, eine Akzentfarbe. */
:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f3eee6;
  --ink: #1c1917;
  --ink-2: #44403c;
  --muted: #7c7169;
  --line: #e9e2d8;
  --accent: #d3512f;
  --accent-ink: #b23f22;
  --accent-soft: #fbe9e3;
  --ok: #3f7d4e;
  --ok-soft: #e4f1e7;
  --warn-soft: #fff1d6;
  --warn-ink: #8a5a00;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.04), 0 8px 24px rgba(28, 25, 23, 0.06);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; font-weight: 700; }
img { max-width: 100%; display: block; }
button, input, select { font: inherit; }

/* Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 10; background: rgba(250, 247, 242, 0.92);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; }
.brand-mark { width: 26px; height: 26px; }
@media (max-width: 480px) { .brand-text { display: none; } .nav a { padding: 7px 10px; } }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 7px 12px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--ink); color: #fff; }

.page { max-width: 760px; margin: 0 auto; padding: 16px; padding-bottom: 48px; }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.footer a { text-decoration: underline; }

.flash { background: var(--ok-soft); color: var(--ok); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; font-weight: 500; }
.flash.error { background: var(--accent-soft); color: var(--accent-ink); }
.back { display: inline-block; color: var(--muted); font-weight: 500; margin-bottom: 10px; font-size: 14px; }
.page-title { font-size: 28px; font-weight: 800; margin: 6px 0 12px; }
.section-title { font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 26px 0 10px; font-weight: 700; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.empty { color: var(--muted); padding: 12px 0; }
.empty a { color: var(--accent-ink); font-weight: 600; }

/* Tageskarte */
.day-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.day-card.hero { padding: 20px; }
.day-card.is-today { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.day-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 12px; }
.day-rel { display: inline-block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent-ink); margin-bottom: 2px; }
.day-title h2 { font-size: 20px; }
.day-card.hero .day-title h2 { font-size: 26px; letter-spacing: -0.02em; }
.day-title h2 a:hover { text-decoration: underline; }
.day-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; background: var(--surface-2); color: var(--ink-2); border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip-warn { background: var(--warn-soft); color: var(--warn-ink); }
.chip-accent { background: var(--accent-soft); color: var(--accent-ink); }
.day-events { color: var(--muted); font-size: 14px; margin: 8px 0 0; }

.meal-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 14px; }
@media (min-width: 560px) { .meal-grid { grid-template-columns: 1fr 1fr; } }
.meal-tile, .recipe-card {
  display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  overflow: hidden; transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.meal-tile:hover, .recipe-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.meal-tile.status-cooked { opacity: 0.75; }
.meal-tile.status-skipped { opacity: 0.5; }
.meal-media { position: relative; aspect-ratio: 16 / 10; max-width: 100%; background: linear-gradient(135deg, #f6e7d8, #efd9c3); display: grid; place-items: center; overflow: hidden; }
.meal-media.breakfast { background: linear-gradient(135deg, #fff1cf, #f9d9a0); }
.meal-media.lunch { background: linear-gradient(135deg, #e6f2d8, #cfe4b4); }
.meal-media.dinner { background: linear-gradient(135deg, #f9dfd3, #eebcaa); }
.meal-media.other { background: linear-gradient(135deg, #e6e2f2, #cfc7e4); }
.meal-media img { width: 100%; height: 100%; object-fit: cover; }
.meal-media-emoji { font-size: 44px; filter: saturate(0.9); }
.meal-media-emoji.big { font-size: 72px; }
.meal-kind { position: absolute; left: 10px; top: 10px; background: rgba(255,255,255,0.92); color: var(--ink-2); font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.06em; }
.meal-flag { position: absolute; right: 10px; top: 10px; background: var(--ok); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.meal-flag.muted { background: var(--muted); }
.meal-body { padding: 12px 14px 14px; }
.meal-title { font-size: 17px; line-height: 1.3; }
.meal-summary { color: var(--muted); font-size: 14px; margin: 4px 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meal-meta { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 13px; margin: 8px 0 0; font-weight: 500; }
.meal-kind-inline { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }

/* Panels & Formulare */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 14px; }
.panel h3 { font-size: 16px; margin-bottom: 10px; }
.panel h4 { font-size: 14px; margin: 18px 0 8px; color: var(--ink-2); }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.panel-head h3 { margin-bottom: 0; }
.form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 6px 0; }
.form-row label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.form-col { display: flex; flex-direction: column; gap: 10px; }
.form-col label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.grow { flex: 1 1 160px; }
.inline { display: inline; }
input[type="text"], input[type="number"], input[type="search"], input[type="password"], select {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 12px; color: var(--ink); min-width: 0; max-width: 100%;
}
input[type="number"] { width: 84px; }
select { max-width: 100%; }
.btn { border: 0; background: var(--accent); color: #fff; font-weight: 700; padding: 10px 16px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--accent-ink); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-secondary { background: var(--ink); }
.btn-secondary:hover { background: #000; }
.btn-ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-ghost.danger { color: var(--accent-ink); }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.edit-meal { border-top: 1px solid var(--line); padding: 12px 0; }
.edit-meal:first-of-type { border-top: 0; }
.edit-meal-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.edit-meal-forms .form-row { margin: 4px 0; }
.edit-meal-forms select { max-width: 100%; flex: 1 1 200px; }

/* Rezept */
.recipe-media { aspect-ratio: 16 / 9; max-width: 100%; border-radius: var(--radius); overflow: hidden; display: grid; place-items: center; background: var(--surface-2); }
.recipe-media img { width: 100%; height: 100%; object-fit: cover; }
.recipe-head { padding: 16px 4px 0; }
.recipe-head h1 { font-size: 26px; letter-spacing: -0.02em; margin: 4px 0 6px; }
.lead { color: var(--ink-2); margin: 0; }
.servings-form { display: flex; align-items: center; gap: 8px; }
.servings-form label { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.servings-form input { width: 64px; }
.ingredients { list-style: none; margin: 0; padding: 0; }
.ingredients li { display: flex; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.ingredients li:first-child { border-top: 0; }
.ingredients li.pantry { color: var(--muted); }
.ing-amount { flex: 0 0 96px; font-weight: 600; text-align: right; }
.steps { padding-left: 22px; margin: 0; }
.steps li { padding: 6px 0; }
.tip { background: var(--warn-soft); color: var(--warn-ink); border-radius: var(--radius-sm); padding: 12px 14px; margin-top: 14px; font-size: 14px; }
.rating-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.rating-form input[type="text"] { flex: 1 1 180px; }
.stars { display: inline-flex; flex-direction: row-reverse; }
.stars input { position: absolute; opacity: 0; width: 0; height: 0; }
.stars label { font-size: 28px; color: var(--line); cursor: pointer; padding: 0 2px; }
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: #f0a500; }
.stars-static { color: #f0a500; letter-spacing: 1px; }
.ratings { list-style: none; margin: 12px 0 0; padding: 0; }
.ratings li { padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }

/* Rezeptbibliothek */
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; }
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 12px; }

/* Verlauf */
.history-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.history-day { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px; border-top: 1px solid var(--line); }
.history-day:first-child { border-top: 0; }
.history-date { flex: 0 0 72px; font-weight: 700; }
.history-meals { flex: 1 1 260px; display: flex; flex-direction: column; gap: 6px; }
.history-meal { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.history-meal.status-skipped { opacity: 0.5; text-decoration: line-through; }
.history-thumb { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; font-size: 18px; background: var(--surface-2); }
.history-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Einkauf */
.day-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.check { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; }
.check.on { border-color: var(--accent); background: var(--accent-soft); }
.check input { margin: 0 0 4px; accent-color: var(--accent); }
.check span { font-weight: 700; }
.check small { color: var(--muted); }
.check-inline { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check-inline input { accent-color: var(--accent); }
.cat { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 16px 0 4px; }
.shop-list { list-style: none; margin: 0; padding: 0; }
.shop-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.shop-list li.pantry { color: var(--muted); }
.shop-name { font-weight: 600; }
.shop-spec { text-align: right; color: var(--ink-2); font-weight: 500; }
.shop-recipes { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.login { max-width: 360px; margin: 40px auto; }

/* Entwurf & Planung */
.banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; background: var(--warn-soft); border: 1px solid #f3dfae; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.banner .hint { display: block; margin: 2px 0 0; color: var(--warn-ink); }
.banner-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-draft { background: var(--warn-soft); color: var(--warn-ink); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
input.small { width: 180px; max-width: 100%; }
