/* Carlito: freie, maßgleiche Calibri-Alternative – mit der App ausgeliefert,
   damit die Schrift auf jedem Gerät (auch offline) gleich aussieht. */
@font-face { font-family: "Carlito"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/fonts/carlito-400.woff2") format("woff2"); }
@font-face { font-family: "Carlito"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("/static/fonts/carlito-400i.woff2") format("woff2"); }
@font-face { font-family: "Carlito"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/static/fonts/carlito-700.woff2") format("woff2"); }
@font-face { font-family: "Carlito"; font-style: italic; font-weight: 700; font-display: swap;
  src: url("/static/fonts/carlito-700i.woff2") format("woff2"); }

:root {
  --green: #018255; --green-dark: #016645; --bg: #ffffff; --card: #ffffff;
  --text: #1a1d1b; --muted: #50605a; --line: #d9e0dc; --danger: #b3372f;
  --soft: #f3f6f4; --radius: 14px;
  --font: "Carlito", Calibri, "Segoe UI", Roboto, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: var(--font);
  background: var(--bg); color: var(--text); font-size: 16px;
}
.content { max-width: 760px; margin: 0 auto; padding: 1rem 1rem 5.5rem; }
h1 { font-size: 1.5rem; margin: .2rem 0; }
h2 { font-size: 1.1rem; margin: 1.4rem 0 .5rem; }
a { color: var(--green); }
hr { border: none; border-top: 1px solid var(--line); margin: 1.5rem 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.ok { color: #2e8b57; } .bad { color: var(--danger); }

/* Navigation */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex;
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); z-index: 10;
}
.bottom-nav a {
  flex: 1; text-align: center; padding: .5rem 0 .4rem; text-decoration: none;
  color: var(--muted); font-size: .72rem; display: flex; flex-direction: column;
}
.bottom-nav a.active { color: var(--green); font-weight: 600; }
.bottom-nav .ico { font-size: 1.3rem; }

/* Buttons & Forms */
.btn {
  display: inline-block; padding: .55rem 1rem; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  font-size: .95rem; text-decoration: none; cursor: pointer; text-align: center;
}
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.btn.primary:active { background: var(--green-dark); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { padding: .3rem .7rem; font-size: .85rem; }
.btn.wide { display: block; width: 100%; margin-top: .8rem; }
.btn:disabled { opacity: .5; }
input, select, textarea {
  width: 100%; padding: .6rem .7rem; border: 1px solid var(--line);
  border-radius: 10px; font-size: 1rem; background: var(--card); color: var(--text);
}
input[type="checkbox"] { width: auto; }
input[type="file"] { padding: .4rem; }
label { display: block; margin: .7rem 0 0; font-size: .9rem; font-weight: 500; }
label input, label select, label textarea { margin-top: .25rem; font-weight: 400; }
.search { margin: .6rem 0; }
.row { display: flex; align-items: center; }
.row.gap { gap: .5rem; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }

.alert { padding: .7rem 1rem; border-radius: var(--radius); }
.alert.error { background: #fdecea; color: var(--danger); }
.alert.success { background: #e8f5ec; color: var(--green-dark); }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.card.pad { padding: .8rem 1rem; }
.page-head { margin-bottom: .8rem; }
.week-nav { display: flex; align-items: center; gap: .6rem; margin-top: .4rem; }
.week-label { flex: 1; text-align: center; font-weight: 600; font-size: .95rem; }
.week-label em { display: block; font-style: normal; color: var(--green); font-size: .75rem; }

/* Wochenplan */
.planned { display: flex; flex-direction: column; gap: .7rem; }
.plan-card { display: flex; }
.plan-card.cooked { opacity: .75; }
.plan-card img, .plan-card .img-placeholder {
  width: 92px; height: 92px; object-fit: cover; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 2rem;
  background: var(--soft);
}
.plan-card-body { padding: .5rem .8rem; display: flex; flex-direction: column; gap: .25rem; }
.plan-card-body .title { font-weight: 600; text-decoration: none; }

.pick-list { display: flex; flex-direction: column; gap: .4rem; }
.pick-btn {
  display: flex; align-items: center; gap: .7rem; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .4rem .7rem .4rem .4rem; font-size: 1rem; cursor: pointer; text-align: left;
}
.pick-btn.picked { border-color: var(--green); background: #eef6f0; }
.pick-btn img, .pick-btn .img-placeholder.small {
  width: 48px; height: 48px; border-radius: 10px; object-fit: cover;
  display: flex; align-items: center; justify-content: center; background: var(--soft);
}
.pick-title { flex: 1; }
.check { font-size: 1.2rem; }

/* Rezepte */
.recipe-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .7rem; margin-top: .5rem;
}
.recipe-card { text-decoration: none; color: var(--text); }
.recipe-card img, .recipe-card .img-placeholder {
  width: 100%; aspect-ratio: 4/3; object-fit: cover; display: flex;
  align-items: center; justify-content: center; font-size: 2.5rem; background: var(--soft);
}
.recipe-card-body { padding: .5rem .7rem .7rem; display: flex; flex-direction: column; }
.hero { width: 100%; max-height: 260px; object-fit: cover; border-radius: var(--radius); }
.ingredient-list { list-style: none; padding: 0; }
.ingredient-list li { padding: .45rem 0; border-bottom: 1px solid var(--line); }
.ingredient-list .amount { display: inline-block; min-width: 5.5rem; font-weight: 600; }
.instructions { line-height: 1.6; }
.danger-zone { margin-top: 2rem; }
.danger-zone summary { color: var(--muted); cursor: pointer; }
.danger-zone form { margin-top: .5rem; }

/* Zutaten-Editor */
.ing-row { display: flex; gap: .4rem; margin-bottom: .4rem; }
.ing-row input[name="ing_amount"] { width: 4.5rem; }
.ing-row input[name="ing_unit"] { width: 4.5rem; }

/* Einkaufsliste */
.shop-list { list-style: none; padding: 0; margin: .3rem 0; }
.shop-list li { padding: .4rem 0; border-bottom: 1px solid var(--line); }
.shop-list label { display: flex; gap: .6rem; font-weight: 400; margin: 0; align-items: center; }
.shop-list label.done { text-decoration: line-through; color: var(--muted); }

/* Statistik */
.bar-chart { display: flex; flex-direction: column; gap: .35rem; }
.bar-row { display: flex; align-items: center; gap: .6rem; }
.bar-label { width: 38%; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar {
  background: var(--green); color: #fff; border-radius: 6px;
  padding: .25rem .5rem; font-size: .8rem; min-width: 2.2rem; white-space: nowrap;
}
.bar.meat { background: #a04a3f; }
.bar.alt { background: #5a7d9a; }
.purchase-list { list-style: none; padding: 0; margin: .3rem 0; }
.purchase-list li { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline;
  padding: .5rem 0; border-bottom: 1px solid var(--line); }
.purchase-list li strong { white-space: nowrap; color: var(--green); }
.season-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .7rem; }
.season-grid ol { margin: .4rem 0 0; padding-left: 1.2rem; font-size: .9rem; }

/* Einstellungen */
.ingredient-table { display: flex; flex-direction: column; gap: .3rem; }
.ing-edit-row {
  display: flex; gap: .4rem; align-items: center; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: .35rem .6rem;
  font-size: .9rem;
}
.ing-edit-row select { width: 9.5rem; padding: .3rem; font-size: .85rem; }
.ing-edit-row select.unit-select { width: 6rem; }
.used-badge { font-size: .8rem; white-space: nowrap; padding: 0 .3rem; }
#ing-filter { position: sticky; top: 0; z-index: 2; background: var(--bg);
  box-shadow: 0 4px 6px -4px rgba(0,0,0,.15); }
.merge-form { flex-wrap: wrap; align-items: center; }
.merge-form select { flex: 1 1 8rem; min-width: 0; }
.merge-arrow { color: var(--muted); font-size: 1.1rem; }
.ing-edit-row.saved { background: #e8f5ec; transition: background .2s; }
.meat-check { display: flex; align-items: center; gap: .2rem; margin: 0; }
.code-big { font-size: 1.5rem; letter-spacing: .15em; }

/* Login */
.login-box { max-width: 360px; margin: 15vh auto 0; }
.login-box h1 { text-align: center; }

/* Spinner */
.spinner-box { text-align: center; margin-top: 2rem; }
.spinner {
  width: 42px; height: 42px; border: 4px solid var(--line);
  border-top-color: var(--green); border-radius: 50%;
  animation: spin 0.9s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Icons */
.icon { display: block; flex-shrink: 0; }
.label-btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; padding: .4rem; }
.btn.small.icon-btn { padding: .3rem; }
.brand { display: flex; align-items: center; gap: .5rem; }
.status { display: flex; align-items: center; gap: .45rem; }
.status .ok { color: var(--green); display: inline-flex; }
.status .bad { color: var(--danger); display: inline-flex; }
.nowrap { white-space: nowrap; }
.bottom-nav .icon { margin: 0 auto 2px; }
.alert.label-btn { display: flex; gap: .45rem; align-items: center; }
.img-placeholder { color: #b4c0ba; }
.meat-check .icon { color: var(--text); }

/* Erweiterte Zutaten-/Einheiten-Zeilen */
.ing-edit-row { flex-wrap: wrap; }
.ing-edit-row > .grow { flex: 1 1 100%; }
.unit-input { width: 6rem; }
.ing-shop { display: inline-flex; align-items: center; gap: .2rem; cursor: pointer; color: var(--green); }
.ing-shop input { width: auto; margin: 0; }
.ing-shop.off { color: var(--muted); opacity: .5; }

/* Kategorie-Filter-Chips (Rezeptliste + Kochliste) */
.cat-filter { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 .9rem; }
.cat-filter .chip {
  padding: .32rem .75rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--text); font: inherit; font-size: .85rem; cursor: pointer;
}
.cat-filter .chip.active { background: var(--green); color: #fff; border-color: var(--green); }

.switch-row { display: flex; align-items: center; gap: .6rem; margin: 0; font-weight: 500; }
.switch-row input { width: auto; transform: scale(1.3); }

/* Einstellungs-Abschnitte */
.block { margin-bottom: .9rem; }
section.card.block > h2:first-child { margin-top: 0; }
details.block > summary {
  cursor: pointer; font-size: 1.1rem; font-weight: 600;
  list-style: none; align-items: center;
}
details.block > summary::-webkit-details-marker { display: none; }
details.block > summary::after {
  content: ""; margin-left: auto; width: 8px; height: 8px; flex-shrink: 0;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .15s;
}
details.block[open] > summary::after { transform: rotate(-135deg); }
details.block[open] > summary { margin-bottom: .7rem; }
details.block h3 { font-size: .95rem; margin: 1rem 0 .4rem; }
.stack { display: flex; flex-direction: column; gap: .5rem; }
.user-block { border: 1px solid var(--line); border-radius: 10px; padding: .6rem; }

/* Bewusst immer helles Design — gute Lesbarkeit auch bei System-Dunkelmodus */
