:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --ink: #2b2320;
  --ink-soft: #6b5f57;
  --brand: #c25e3a;
  --brand-dark: #a34a2b;
  --brand-soft: #f7e8df;
  --accent: #8a7a2f;
  --line: #e8dfd5;
  --shadow: 0 6px 24px rgba(60, 40, 25, 0.08);
  --radius: 16px;
  --font: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;   /* Header darf nie horizontalen Scroll erzeugen */
}

.container { width: min(1080px, 94vw); margin: 0 auto; }

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Topbar ---------- */
.topbar {
  background: linear-gradient(120deg, #241a14, #3a281c);
  color: #fff;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 0;
  padding: 14px 0;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 1.25rem; font-weight: 700;
  flex-shrink: 1; min-width: 0; overflow: hidden; }
.brand:hover { text-decoration: none; }
.brand-mark { font-size: 1.6rem; flex-shrink: 0; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.brand-name em { font-style: normal; color: #eab08a; }
.topnav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px;
  flex: 1 1 100%; min-width: 0; }
.topnav a { color: #f2e2d6; font-weight: 500; font-size: .95rem;
  white-space: nowrap; overflow-wrap: anywhere; }
.topnav a:hover { color: #fff; text-decoration: none; }

/* ---------- Hero ---------- */
.hero { padding: 34px 0 10px; }
.hero h1 { font-size: 2.1rem; color: var(--ink); letter-spacing: -.5px; }
.hero-sub { color: var(--ink-soft); margin: 6px 0 22px; }

.searchbar { display: flex; gap: 8px; max-width: 640px; }
.searchbar input {
  flex: 1; padding: 13px 18px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 1rem; background: var(--surface); outline: none;
}
.searchbar input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.searchbar button {
  padding: 0 22px; border: none; border-radius: 12px; background: var(--brand);
  color: #fff; font-weight: 600; cursor: pointer;
}
.searchbar button:hover { background: var(--brand-dark); }

.filter-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 14px; margin: 20px 0 6px;
}
.cats { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 15px; border-radius: 999px; background: var(--surface); color: var(--ink-soft);
  border: 1.5px solid var(--line); font-size: .88rem; font-weight: 500;
}
.chip:hover { text-decoration: none; border-color: var(--brand); color: var(--brand-dark); }
.chip-active { background: var(--brand); color: #fff; border-color: var(--brand); }
.sort { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: .9rem; }
.sort select {
  padding: 7px 12px; border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--surface); font-size: .9rem;
}

/* ---------- Grid / Cards ---------- */
.count { color: var(--ink-soft); font-size: .92rem; margin: 12px 0 16px; }
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px; margin-bottom: 28px;
}
.card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--line);
  transition: transform .18s ease, box-shadow .18s ease;
  display: block; color: inherit;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 14px 34px rgba(60,40,25,.14); text-decoration: none; }
.card-img { position: relative; aspect-ratio: 16/11; background: var(--brand-soft); overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-img-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 3rem; }
.card-badge {
  position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.55); color: #fff;
  padding: 3px 9px; border-radius: 999px; font-size: .78rem;
}
.card-body { padding: 14px 16px 16px; }
.card-cat {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--brand-dark); background: var(--brand-soft);
  padding: 3px 9px; border-radius: 999px; margin-bottom: 8px;
}
.card-title { font-size: 1.12rem; margin-bottom: 4px; }
.card-desc { color: var(--ink-soft); font-size: .88rem; margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; gap: 12px; font-size: .8rem; color: var(--ink-soft); }
.rating { color: var(--accent); font-weight: 600; }

/* ---------- Detail ---------- */
.breadcrumb { display: flex; gap: 14px; padding: 22px 0 6px; font-size: .92rem; }
.breadcrumb a { color: var(--ink-soft); }
.detail { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid var(--line); overflow: hidden; margin-bottom: 34px; }
.detail-hero { background: linear-gradient(160deg, #fdf9f3, #f5eadf); }
.detail-hero-inner { display: grid; grid-template-columns: 420px 1fr; gap: 30px; padding: 28px; }
.detail-img { border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); aspect-ratio: 4/3; }
.detail-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-img-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 5rem; background: var(--brand-soft); }
.detail-head h1 { font-size: 2rem; margin: 10px 0 8px; letter-spacing: -.5px; }
.detail-desc { color: var(--ink-soft); font-size: 1.04rem; margin-bottom: 16px; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.detail-tags span {
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px;
  padding: 6px 14px; font-size: .85rem; color: var(--ink);
}
.detail-source { color: var(--ink-soft); font-size: .88rem; }
.detail-body { padding: 28px; display: grid; grid-template-columns: 380px 1fr; gap: 34px; }
.detail-section h2 {
  font-size: 1.25rem; border-bottom: 2px solid var(--brand-soft); padding-bottom: 8px;
  margin-bottom: 16px; color: var(--brand-dark);
}
.ingredients { width: 100%; border-collapse: collapse; }
.ingredients td { padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: .96rem; }
.ingredients .amount { color: var(--brand-dark); font-weight: 600; white-space: nowrap; }

/* ---- Nährwert-Box (Schätzung je Portion, optional manuell) ---- */
.nutrition-box { margin-top: 22px; background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 14px; padding: 18px 20px; }
.nutrition-box .detail-section-head { align-items: center; gap: 10px; margin-bottom: 12px; }
.nutrition-box h2 { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.nutrition-estimated { background: var(--brand-soft); color: var(--brand-dark);
  font-size: .78rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.nutrition-per { color: var(--ink-soft); font-size: .85rem; }
.nutrition-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 0; }
.nutrition-item { background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; text-align: center; }
.nutrition-item dt { font-size: .78rem; color: var(--ink-soft); text-transform: uppercase;
  letter-spacing: .03em; margin-bottom: 4px; }
.nutrition-item dd { font-size: 1.15rem; font-weight: 700; color: var(--brand-dark); margin: 0; }
.nutrition-unknown-hint { margin: 10px 0 0; font-size: .8rem; color: var(--ink-soft); }
.nutrition-fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 640px) {
  .nutrition-grid { grid-template-columns: repeat(2, 1fr); }
  .nutrition-fields { grid-template-columns: 1fr 1fr; }
}

/* ---- Persönliche Gesamt-Statistik (nur eigener Bereich, eingeloggt) ---- */
.stats-box { margin: 22px 0 4px; background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 14px; padding: 18px 20px; }
.stats-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.stats-head h2 { margin: 0; font-size: 1.25rem; }
.stats-note { color: var(--ink-soft); font-size: .8rem; }
.stats-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stats-kpi { background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; text-align: center; min-width: 0; }
.stats-kpi-value { display: block; font-size: 1.3rem; font-weight: 700; color: var(--brand-dark);
  overflow-wrap: anywhere; }
.stats-kpi-value small { font-size: .8rem; font-weight: 600; color: var(--ink-soft); }
.stats-kpi-label { display: block; margin-top: 4px; font-size: .78rem; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: .03em; }
.stats-empty { color: var(--ink-soft); padding: 8px 0; }
.stats-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px;
  font-size: .8rem; color: var(--ink-soft); }
.stats-meta span { background: var(--brand-soft); color: var(--brand-dark);
  padding: 2px 8px; border-radius: 999px; }
.stats-cats { margin-top: 18px; }
.stats-cats h3 { font-size: .95rem; margin: 0 0 10px; }
.stats-cats ul { list-style: none; margin: 0; padding: 0; display: flex;
  flex-direction: column; gap: 8px; }
.stats-cats li { display: flex; align-items: center; gap: 10px; font-size: .88rem; }
.stats-cat-name { flex: 0 0 auto; width: 150px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.stats-cat-bar { flex: 1 1 auto; height: 10px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 999px; overflow: hidden; min-width: 60px; }
.stats-cat-bar > span { display: block; height: 100%; background: var(--brand);
  border-radius: 999px; }
.stats-cat-count { flex: 0 0 auto; min-width: 2.2em; text-align: right; font-weight: 700;
  color: var(--brand-dark); }

/* ---- Statistik-Kategorie-Filter (Feature-Teil 3) ---- */
.stats-filter {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 14px;
  margin: 14px 0 4px; padding: 12px; background: var(--bg);
  border: 1px dashed var(--line); border-radius: 10px;
}
.stats-filter-label { font-size: .85rem; font-weight: 600; color: var(--ink-soft);
  padding-top: 4px; }
.stats-filter-opts { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 auto; }
/* Kategorie-Filter als klickbare Toggle-Chips (v1.33.3):
   Checkbox bleibt funktional im Formular (unsichtbar), das Label wird zum
   Button-Chip. Aktiv-Zustand via :has(input:checked). Kein JS, kein
   Backend-Change — Klick toggelt wie bisher, Mehrfachauswahl bleibt. */
.stats-filter-item { display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; min-height: 44px; background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 999px; font-size: .88rem;
  cursor: pointer; user-select: none; -webkit-user-select: none;
  touch-action: manipulation; transition: background-color .15s ease,
    border-color .15s ease, color .15s ease; }
.stats-filter-item:hover { border-color: var(--brand); }
.stats-filter-item:active { transform: scale(.97); }
.stats-filter-item input { position: absolute; opacity: 0; width: 1px; height: 1px;
  margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Haeckchen: Platz immer reserviert (opacity statt display -> kein Layout-Springen) */
.stats-filter-item span { display: inline-flex; align-items: center; gap: 6px; }
.stats-filter-item span::before { content: "\2713"; opacity: 0; width: 1em;
  text-align: center; font-weight: 700; }
.stats-filter-item:has(input:checked) {
  background: var(--brand-soft); border-color: var(--brand);
  color: var(--brand-dark); font-weight: 600; }
.stats-filter-item:has(input:checked) span::before { opacity: 1; }
.stats-filter-item:has(input:focus-visible) { outline: 2px solid var(--brand);
  outline-offset: 2px; }
.stats-filter-actions { display: flex; gap: 8px; align-items: center;
  flex: 0 0 auto; }
.stats-active-filter { display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px; margin: 12px 0 2px; font-size: .85rem; }
.stats-active-filter > span:first-child { color: var(--ink-soft); }
.stats-active-chip { background: var(--brand-soft); color: var(--brand-dark);
  padding: 2px 10px; border-radius: 999px; font-weight: 600; }
.stats-active-clear { color: var(--brand-dark); font-weight: 600;
  text-decoration: underline; margin-left: 4px; }
.stats-filtered { margin-top: 18px; }
.stats-filtered h3 { font-size: .95rem; margin: 0 0 10px; }
.stats-filtered-list { list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 6px; }
.stats-filtered-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  font-size: .9rem; padding: 6px 10px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; }
.stats-filtered-list a { color: var(--brand-dark); font-weight: 600;
  text-decoration: none; min-width: 0; }
.stats-filtered-list a:hover { text-decoration: underline; }
.stats-filtered-cat { margin-left: auto; font-size: .78rem; color: var(--ink-soft);
  background: var(--brand-soft); padding: 2px 8px; border-radius: 999px;
  white-space: nowrap; }

/* ---- Responsivität Konto-/Statistik-Bereich (v1.33.2) ----
   WICHTIG: Media-Queries MÜSSEN nach den Basis-Regeln stehen (Cascade:
   gleiche Spezifität → spätere Regel gewinnt). Die Blöcke stehen bewusst am
   Ende des Stats-Abschnitts, damit min-height:44px / width:100% auf Mobile
   die Basis (min-height:40px, kompakt) korrekt überschreiben. */
@media (max-width: 640px) {
  .stats-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stats-kpi { padding: 10px 8px; }
  .stats-kpi-value { font-size: 1.15rem; }
  .stats-cat-name { width: auto; flex: 1 1 auto; min-width: 0; white-space: normal;
    overflow: visible; text-overflow: clip; font-size: .85rem; }
  /* Chips gelegt (flex-wrap, natürliche Breite, volle Labels) — 2-Spalten-Grid
     ist auf 360px zu eng für „Suppe & Eintopf" (ellipsiert); Zeilenumbruch
     statt Kürzung. min-height 44px = Touch-Ziel. */
  .stats-filter-opts { display: flex; flex-wrap: wrap; gap: 8px; }
  .stats-filter-item { min-height: 44px; padding: 8px 12px; gap: 8px; justify-content: flex-start; }
  .stats-filter-actions { width: 100%; }
  .stats-filter-actions .btn { width: 100%; min-height: 44px; justify-content: center; }
  .stats-meta { font-size: .9rem; gap: 6px 10px; }
  .stats-cats li { gap: 8px; }
  .stats-active-filter { font-size: .85rem; }
}

@media (max-width: 400px) {
  .stats-kpis { grid-template-columns: 1fr; }
  .stats-kpi-value { font-size: 1.25rem; }
}

/* ---- Konto-Seite: Breite ausnutzen (v1.33.2, GM-Ergänzung 08.09.2026) ----
   Auf Tablet/Desktop (>=768px) kein schmaler „Schlauch" mehr: Konto-Infos +
   Statistik nebeneinander (2 Spalten), Filter als luftiges Grid. Mobile (<=640px)
   bleibt der gestapelte, aber saubere Aufbau aus den Queries oben. */
.account-card { max-width: 1080px; }
.auth-card.account-card { max-width: 1080px; }
@media (min-width: 768px) {
  .auth-card.account-card { padding: 36px 40px; }
  .account-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 24px 36px; align-items: start; }
  .account-grid > .account-info-col { grid-column: 1; grid-row: 1; min-width: 0; }
  .account-grid > .stats-box { grid-column: 2; grid-row: 1 / span 2; min-width: 0; margin: 0; }
  .account-grid > .account-side-col { grid-column: 1; grid-row: 2; min-width: 0; }
  /* Aktionen + Logout unter dem Grid, volle Breite */
  .account-card > .auth-actions { display: flex; }
  .stats-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  /* Kategorie-Filter: luftiges Grid auf Desktop — Filter vertikal stapeln,
     damit die Opts die volle Breite bekommen (sonst nur 1 Spalte) */
  .stats-filter { flex-direction: column; align-items: stretch; }
  .stats-filter-label { padding-top: 0; }
  .stats-filter-opts { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .stats-filter-actions { width: 100%; }
  .stats-filter-item { min-height: 44px; }
  .stats-cat-name { width: auto; min-width: 0; flex: 0 0 auto; }
  .allergy-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}

/* ---- Portions-Skalierung (Zutaten) ---- */
.detail-section-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 10px 16px; margin-bottom: 16px;
}
.detail-section-head h2 { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
/* Überschrift behält ihre dekorative Linie via eigene Breite */
.detail-section-head h2 { position: relative; padding-bottom: 8px; }
.detail-section-head h2::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  border-bottom: 2px solid var(--brand-soft);
}
.servings-control {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 8px 12px;
}
.servings-label { font-size: .85rem; font-weight: 700; color: var(--brand-dark); }
.servings-input {
  width: 74px; padding: 7px 10px; font-size: 1rem; font-weight: 700;
  border: 1.5px solid var(--line); border-radius: 10px; text-align: center;
  color: var(--ink); background: #fff;
  -moz-appearance: textfield; appearance: textfield;
}
.servings-input::-webkit-outer-spin-button, .servings-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.servings-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.servings-reset:disabled { opacity: .5; cursor: default; }
.servings-hint {
  flex-basis: 100%; font-size: .78rem; color: var(--ink-soft);
}

@media (max-width: 600px) {
  .servings-control { width: 100%; justify-content: flex-start; }
  .servings-input { width: 64px; }
}

.steps { list-style: none; counter-reset: step; }
.steps li {
  display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px dashed var(--line);
  counter-increment: step;
}
.step-num {
  flex: 0 0 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.step-text { padding-top: 5px; }
.notes { grid-column: 1 / -1; background: #fdf8ee; border: 1px solid #eadfc4;
  border-radius: 12px; padding: 18px !important; }
.notes h2 { border-bottom-color: #eadfc4; }
.detail-media video { width: 100%; max-height: 480px; border-radius: 12px; }

/* ---- Galerie (weitere Bilder) + Lightbox ---- */
.detail-gallery { grid-column: 1 / -1; margin-top: 4px; }
.detail-gallery h3 { font-size: 1.1rem; color: var(--brand-dark); margin-bottom: 12px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gallery-item { margin: 0; cursor: zoom-in; }
.gallery-thumb {
  width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 12px;
  border: 1.5px solid var(--line); box-shadow: var(--shadow-sm, var(--shadow));
  transition: transform .15s ease, box-shadow .15s ease;
}
.gallery-thumb:hover { transform: scale(1.02); box-shadow: 0 6px 18px rgba(0,0,0,.15); }
.gallery-caption { font-size: .78rem; color: var(--ink-soft); padding: 4px 2px 0; }
.gallery-lightbox {
  position: fixed; inset: 0; z-index: 1000; display: none;
  align-items: center; justify-content: center; padding: 24px;
}
.gallery-lightbox.open { display: flex; }
.gallery-lightbox-backdrop {
  position: absolute; inset: 0; background: rgba(20, 16, 10, .82); backdrop-filter: blur(3px);
}
.gallery-lightbox-figure {
  position: relative; max-width: min(92vw, 1200px); max-height: 88vh; margin: 0; z-index: 1;
}
.gallery-lightbox-img {
  display: block; max-width: 100%; max-height: 84vh; object-fit: contain;
  border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.gallery-lightbox-caption { color: #fff; text-align: center; padding-top: 10px; font-size: .9rem; }
.gallery-lightbox-close {
  position: absolute; top: 8px; right: 8px; z-index: 2; width: 42px; height: 42px;
  border-radius: 50%; border: none; background: rgba(255,255,255,.92); color: #222;
  font-size: 1.6rem; line-height: 1; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.3);
}
body.lightbox-open { overflow: hidden; }

@media (max-width: 960px) {
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
}
@media (max-width: 520px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .gallery-lightbox { padding: 12px; }
}

/* ---------- Buttons & misc ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px;
  border-radius: 11px; border: 1.5px solid var(--line); background: var(--surface);
  color: var(--ink); font-weight: 600; font-size: .92rem; cursor: pointer;
}
.btn:hover { text-decoration: none; border-color: var(--brand); color: var(--brand-dark); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-danger { border-color: #d9695b; background: #fdf1ef; color: #b3402f; }
.btn-danger:hover { background: #b3402f; color: #fff; }
.btn-ghost { background: transparent; }
.btn-small { padding: 5px 10px; font-size: .82rem; border-radius: 8px; }
.btn-lg { padding: 13px 30px; font-size: 1.02rem; }
.actions { display: flex; gap: 10px; margin: 6px 0 40px; }
.empty { text-align: center; padding: 60px 0; color: var(--ink-soft); }
.empty p { margin-bottom: 18px; }
.alert { background: #fdeeee; border: 1px solid #e5b8b0; color: #a33226;
  border-radius: 11px; padding: 12px 16px; margin: 14px 0; }

/* ---------- Admin ---------- */
.admin-head { display: flex; align-items: center; justify-content: space-between; padding: 26px 0 16px; }
.admin-table { width: 100%; background: var(--surface); border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--line); border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 11px 14px; text-align: left; font-size: .92rem; }
.admin-table thead th { background: var(--brand-soft); color: var(--brand-dark);
  font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.admin-table thead th a.sortable { display: inline-flex; align-items: center; gap: 5px;
  color: inherit; text-decoration: none; }
.admin-table thead th a.sortable:hover { color: var(--brand); text-decoration: underline; }
.admin-table thead th a.sortable .sort-arrow { font-size: .7rem; }
.admin-table thead th a.sort-active { color: var(--brand); font-weight: 700; }
.admin-table tbody tr { border-top: 1px solid var(--line); }
.admin-table tbody tr:hover { background: #fdfaf6; }
.row-actions { display: flex; gap: 6px; align-items: center; }
.row-actions form { display: inline; }
/* Thumbnail VOR dem Titel (v1.33.6): Titel-Zelle = Miniatur + Titel nebeneinander */
.col-title { min-width: 220px; }
.title-cell { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.title-cell:hover .title-text { text-decoration: underline; }
.title-text { font-weight: 600; }
.admin-thumb { display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 42px; border-radius: 8px; object-fit: cover; flex: none;
  border: 1px solid var(--line); background: var(--brand-soft); overflow: hidden; }
.admin-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.admin-thumb-empty { font-size: 1.1rem; }
/* Share-Spalte direkt neben Sichtbarkeit (v1.33.6) */
.col-share { text-align: center; }
.col-share .share-slot { display: inline-flex; }
.btn-share-row { padding: 5px 8px; font-size: .9rem; line-height: 1; }
.btn-share-row:hover { border-color: var(--brand); }
/* Ausgegrauter Share-Button bei privatem Rezept — klickbar fürs Popup (v1.33.6) */
.btn-share-private { opacity: .45; cursor: not-allowed; border-color: var(--line); }
.btn-share-private:hover { border-color: var(--line); opacity: .6; }
/* Modal „öffentlich schalten" (v1.33.6) */
.make-public-dialog { border: none; border-radius: 16px; padding: 0; max-width: 420px;
  width: calc(100vw - 40px); box-shadow: 0 18px 50px rgba(0,0,0,.28); }
.make-public-dialog::backdrop { background: rgba(0,0,0,.45); }
.dialog-inner { padding: 26px 28px; }
.dialog-inner h2 { font-size: 1.15rem; color: var(--brand-dark); margin: 0 0 12px; }
.dialog-text { margin: 0 0 8px; color: var(--ink); }
.dialog-question { margin: 0 0 22px; font-weight: 600; color: var(--brand-dark); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
/* Toast (v1.33.6) */
.admin-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #2e7d32; color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: .92rem; box-shadow: 0 6px 20px rgba(0,0,0,.25); z-index: 999; }
.edit-grid { display: grid; grid-template-columns: 1fr 320px; gap: 30px; }
.edit-form { background: var(--surface); border-radius: var(--radius); padding: 26px;
  box-shadow: var(--shadow); border: 1px solid var(--line); }
.edit-form h2 { font-size: 1.1rem; color: var(--brand-dark); margin: 22px 0 12px;
  padding-bottom: 6px; border-bottom: 2px solid var(--brand-soft); }
.edit-form h2:first-child { margin-top: 0; }
.field { display: block; margin-bottom: 13px; }
.field > span { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 5px; color: var(--ink-soft); }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 13px; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: .95rem; font-family: inherit; background: var(--surface);
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.line { display: flex; gap: 8px; margin-bottom: 8px; align-items: stretch; }
.line.ing .amount { width: 110px; flex: none; }
.line input, .line textarea {
  padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 9px;
  font-size: .92rem; flex: 1; font-family: inherit;
}
.line textarea { resize: vertical; }
.step-idx {
  flex: 0 0 30px; height: 30px; background: var(--brand-soft); color: var(--brand-dark);
  border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700;
  margin-top: 6px;
}
.edit-side h2 { font-size: 1.1rem; color: var(--brand-dark); margin-bottom: 12px;
  padding-bottom: 6px; border-bottom: 2px solid var(--brand-soft); }
.edit-side h3 { font-size: .95rem; margin: 16px 0 8px; color: var(--ink-soft); }
.edit-thumb { width: 100%; border-radius: 12px; margin-bottom: 14px; box-shadow: var(--shadow); }
.media-list { list-style: none; font-size: .85rem; color: var(--ink-soft); }
.media-list li { padding: 4px 0; word-break: break-all; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ==========================================================================
   KI-Rezept: Manuelles Formular — responsive Absicherung (v1.24.0)
   Scope: NUR das manuelle KI-Formular (.manual-form). Das Admin-/Edit-Formular
   (templates/admin/edit.html) teilt .edit-grid/.field-row/.line und bleibt
   unverändert — deshalb hier KEINE generischen edit-*-Regeln anfassen.
   Problem: Eingabefelder haben ein intrinsisches Minimum (Browser-Default-
   size/cols) und Grid-/Flex-Tracks weigern sich unter min-content zu schrumpfen
   (min-width:auto) → Felder liefen auf schmalen Viewports über die Box.
   ========================================================================== */
.manual-form,
.manual-form * {
  box-sizing: border-box;
}
/* Alle Eingabefelder dürfen nie breiter als ihr Container werden */
.manual-form input,
.manual-form textarea,
.manual-form select {
  width: 100%;
  max-width: 100%;
  min-width: 0;          /* erlaubt Schrumpfen unter intrinsische size/cols */
}
/* Field-Rows: 1fr-Spalten dürfen schrumpfen; kein over-constrained Layout.
   Generische .field-row-Regel (3-spaltig bzw. 2-spaltig <=860px) bleibt,
   nur die manuelle Variante wird auf schmalen Viewports gestapelt. */
.manual-form .field-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 520px) {
  .manual-form .field-row { grid-template-columns: 1fr; }
}
/* Zutaten-/Schrittzeilen: Flex darf schrumpfen; Buttons nicht zusammendrücken */
.manual-form .line { flex-wrap: wrap; gap: 8px; }
.manual-form .line.ing .amount { width: 110px; flex: 0 0 auto; }
.manual-form .line input,
.manual-form .line textarea { flex: 1 1 200px; min-width: 0; }
.manual-form .line .btn { flex: 0 0 auto; align-self: center; }
/* Edit-Grid (Hauptbereich + Sidebar) absichern — darf nicht überlaufen */
.manual-form .edit-grid { grid-template-columns: minmax(0, 1fr) 320px; }
.manual-form .edit-main,
.manual-form .edit-side { min-width: 0; }
@media (max-width: 860px) {
  .manual-form .edit-grid { display: block; }
  .manual-form .edit-side { margin-top: 8px; }
}
/* Textareas & lange Werte: sauber umbrechen statt überlaufen */
.manual-form input,
.manual-form textarea,
.manual-form select {
  word-break: normal;
  overflow-wrap: break-word;
}
/* Aktionsleiste (Speichern-Button) darf auf schmalen Screens nicht überlaufen:
   umbrechen statt aus der Box zu drücken; Buttons decken max. die Boxbreite ab. */
.manual-form .form-actions {
  flex-wrap: wrap;
}
.manual-form .form-actions .btn {
  max-width: 100%;
  white-space: normal;
}
/* File-Inputs (Titelbild/Videos): Breite hart begrenzen, damit der eingebaute
   Browser-"Datei auswählen"-Button nicht über die Box ragt. */
.manual-form input[type="file"] {
  max-width: 100%;
}

.footer { margin-top: auto; background: #241a14; color: #cbb39f; padding: 18px 0; font-size: .85rem; }
.pagination { display: flex; gap: 8px; justify-content: center; margin-bottom: 28px; }
.pagination a { min-width: 38px; height: 38px; display: inline-flex; align-items: center;
  justify-content: center; border-radius: 10px; background: var(--surface); border: 1.5px solid var(--line); }
.pagination .page-active { background: var(--brand); color: #fff; border-color: var(--brand); }

@media (max-width: 860px) {
  .detail-hero-inner, .detail-body, .edit-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr 1fr; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
}

/* ---------- Mobile Header (bis 760px) ---------- */
@media (max-width: 760px) {
  .topbar-inner { padding: 10px 0; gap: 10px 0; }
  /* v1.19.3: Titel mobil wieder sichtbar — das zweizeilige Layout bietet Platz.
     Overflow-Schutz bereits in Basis-Regeln: .brand (overflow hidden, flex-shrink,
     min-width 0) + .brand-name (nowrap, ellipsis) kappen den Titel statt zu
     überlaufen; .lang-switch bleibt flex-shrink:0 und damit im Viewport. */
  .brand-name { display: inline; }
  .brand-mark { font-size: 1.6rem; }
  .brand { gap: 6px; min-width: 0; }
  .topnav { flex: 1 1 100%; gap: 8px 14px; }
  .topnav a { font-size: .9rem; white-space: nowrap; overflow-wrap: anywhere; }
  .nav-form { margin: 0; }
  .lang-switch { margin-left: 0; padding-left: 0; border-left: none;
    gap: 2px; flex-shrink: 0; }
  .lang-btn { padding: 2px 4px; font-size: 1rem; color: #fff; }
  .lang-btn:hover { background: rgba(255,255,255,.12); }
  .lang-btn-flag { font-size: 1.15rem; }
  .lang-btn-caret { color: rgba(255,255,255,.75); }
  .lang-btn-name { display: none; }   /* auf Mobile nur Flagge + Caret, kompakt */
  .lang-menu { min-width: 130px; }
  .hero h1 { font-size: 1.6rem; }
  .cards { grid-template-columns: 1fr; }
  .auth-card { padding: 22px; }
  .format-choice { grid-template-columns: 1fr; }
  .admin-table, .admin-table thead, .admin-table tbody, .admin-table tr, .admin-table td { display: block; }
  .admin-table thead { display: none; }   /* Kopfzeile ausblenden */
  .admin-table { box-shadow: none; border: none; background: transparent; }
  .admin-table tbody tr {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    margin-bottom: 14px;
    padding: 14px 16px;
    box-shadow: var(--shadow);
  }
  .admin-table td {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 7px 0; border: none; font-size: .9rem; text-align: right;
  }
  .admin-table td::before {
    content: attr(data-label);
    font-weight: 600; color: var(--ink-soft); font-size: .78rem;
    text-transform: uppercase; letter-spacing: .04em; flex-shrink: 0;
  }
  .admin-table .row-actions { justify-content: flex-end; }
  .admin-table .row-actions::before { content: attr(data-label); }
}
@media print {
  .topbar, .footer, .actions, .breadcrumb, .detail-share, .detail-bring { display: none; }
  .detail { box-shadow: none; border: none; }
}

/* ---------- Auth / Account ---------- */
.auth-wrap { display: flex; justify-content: center; padding: 48px 0; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 18px; padding: 32px;
  box-shadow: var(--shadow); }
.auth-card h1 { margin-bottom: 4px; font-size: 1.5rem; }
.auth-sub { color: var(--ink-soft); margin-bottom: 20px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px;
  font-size: .9rem; font-weight: 600; color: var(--ink); }
.auth-form input { padding: 11px 13px; border-radius: 10px;
  border: 1.5px solid var(--line); font-size: 1rem; background: #fff; }
.auth-form input:focus { outline: none; border-color: var(--brand); }
.auth-links { display: flex; flex-direction: column; gap: 8px;
  margin-top: 18px; font-size: .9rem; text-align: center; }
.auth-links a { color: var(--brand); }
.auth-actions { display: flex; gap: 10px; margin: 18px 0; flex-wrap: wrap; }
.account-info { width: 100%; border-collapse: collapse; margin: 10px 0; }
.account-info th, .account-info td { text-align: left; padding: 9px 4px;
  border-bottom: 1px solid var(--line); font-size: .95rem; }
.account-info th { color: var(--ink-soft); font-weight: 600; width: 45%; }
.account-info td { overflow-wrap: anywhere; word-break: break-word; min-width: 0; }
.reset-link-box { background: #fdf6ee; border: 1px dashed var(--brand);
  border-radius: 10px; padding: 12px; margin: 8px 0; word-break: break-all; font-size: .85rem; }
.auth-card h2 { font-size: 1.05rem; margin: 26px 0 12px;
  padding-top: 18px; border-top: 1px solid var(--line); }
.auth-card h2:first-of-type { margin-top: 10px; padding-top: 0; border-top: none; }
.muted { color: var(--ink-soft); font-size: .9rem; }
.inline-form { display: inline; }
.nav-form { margin-left: 8px; }
.nav-form .btn-link, .btn-link { background: none; border: none; color: var(--brand);
  cursor: pointer; font-size: .95rem; padding: 4px 2px; }
.nav-form .btn-link:hover { text-decoration: underline; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px;
  border-radius: 10px; font-size: .95rem; font-weight: 600; text-decoration: none;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; transition: all .15s; }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #aa4a2c; color: #fff; }
.btn-block { width: 100%; justify-content: center; }
.btn-ghost { background: transparent; }
.btn-danger { background: #d9534f; border-color: #d9534f; color: #fff; }
.btn-danger:hover { background: #c9302c; color: #fff; }
.nav-cta { background: var(--brand); color: #fff !important; padding: 7px 14px;
  border-radius: 8px; font-weight: 600; }

/* ---------- Teilen-Button (Rezept-Detail, nur öffentlich) ---------- */
.detail-share { margin-top: 10px; }
.btn-share { background: var(--surface); border-color: var(--line);
  font-size: .88rem; padding: 7px 14px; border-radius: 8px; }
.btn-share:hover { border-color: var(--brand); color: var(--brand); }
.btn-share .share-icon { font-size: 1rem; }
/* Teilen-Button in der Verwaltungsliste — Definition siehe oben bei .col-share (v1.33.6) */

/* ---------- Bring!-Einkaufslisten-Button (unterhalb der Zutatenliste) ---------- */
.detail-bring { margin-top: 14px; }
.btn-bring { background: #3f7f3f; border-color: #3f7f3f; color: #fff;
  font-size: .98rem; padding: 12px 20px; border-radius: 10px;
  box-shadow: 0 2px 10px rgba(63, 127, 63, .28); }
.btn-bring:hover { background: #356c35; border-color: #356c35; color: #fff;
  text-decoration: none; box-shadow: 0 3px 14px rgba(63, 127, 63, .38); }
.btn-bring:active { transform: translateY(1px); }

/* ---------- Alerts / Flash ---------- */
.flash-container { margin-bottom: 18px; }
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 12px;
  font-size: .92rem; border: 1.5px solid; }
.alert-error { background: #fdecea; color: #a93231; border-color: #f2b8b6; }
.alert-success { background: #eaf7ec; color: #2e7d32; border-color: #bfe3c4; }
.alert-info { background: #eaf3fb; color: #1967a8; border-color: #bcd9f0; }

/* ---------- Öffentlich / Privat Badges ---------- */
.card-topline { display: flex; align-items: center; justify-content: space-between; }
.badge-public, .badge-private { font-size: .85rem; padding: 2px 8px;
  border-radius: 20px; white-space: nowrap; }
.badge-public { background: #e6f4ea; color: #2e7d32; border: 1px solid #bfe3c4; }
.badge-private { background: #f3eded; color: #7a6660; border: 1px solid #e0d2cc; }
.field-check { display: flex; align-items: center; gap: 8px; flex-direction: row;
  margin: 8px 0 12px; }
.field-check input { width: 18px; height: 18px; }
.footer span em { font-style: normal; font-weight: 700; }

/* ---------- Allergien ---------- */
.allergy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px; margin-bottom: 6px; }
.allergy-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer;
  font-size: .9rem; font-weight: 500; transition: all .15s; }
.allergy-item:hover { border-color: var(--brand); }
.allergy-item input { width: 16px; height: 16px; }

/* ---------- KI-Rezept-Erstellung ---------- */
.ai-wrap { max-width: 860px; margin: 0 auto; }
.ai-card { background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 18px; padding: 26px; box-shadow: var(--shadow); margin-top: 8px; }
.ai-source-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.ai-tab { position: relative; cursor: pointer; }
.ai-tab input { position: absolute; opacity: 0; }
.ai-tab span { display: inline-block; padding: 9px 16px; border-radius: 10px;
  border: 1.5px solid var(--line); background: #fff; font-weight: 600; transition: all .15s; }
.ai-tab input:checked + span { background: var(--brand); color: #fff; border-color: var(--brand); }
.ai-input { margin-bottom: 12px; }
.ai-input label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .92rem; }
.ai-input input, .ai-input textarea { padding: 11px 13px; border-radius: 10px;
  border: 1.5px solid var(--line); font-size: 1rem; }
.ai-image-title { font-weight: 600; font-size: .92rem; margin-bottom: 8px; }
.ai-image-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.ai-image-hint { margin: 6px 0 0; }
.ai-image-preview { max-width: 100%; max-height: 320px; border-radius: 12px;
  border: 1.5px solid var(--line); margin-top: 10px; display: block; }
.ai-image-previews { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.ai-image-previews.hidden { display: none; }
.ai-image-preview-thumb { width: 84px; height: 84px; object-fit: cover; border-radius: 10px;
  border: 1.5px solid var(--line); }
/* Nur visuell versteckt, bleibt für Screenreader + Datei-Picker erreichbar */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ai-input input:focus, .ai-input textarea:focus { outline: none; border-color: var(--brand); }
.hidden { display: none !important; }
.draft-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.draft-head h2 { margin: 0; }
.feedback-form { margin-bottom: 16px; }
.feedback-row { display: flex; gap: 8px; }
.feedback-row input { flex: 1; padding: 11px 13px; border-radius: 10px;
  border: 1.5px solid var(--line); font-size: .95rem; }
.feedback-row input:focus { outline: none; border-color: var(--brand); }
.draft-box { background: #fffdf9; border: 1.5px solid var(--line); border-radius: 14px;
  padding: 20px; margin-bottom: 14px; }
.draft-box h3 { margin: 0 0 4px; font-size: 1.25rem; }
.draft-box h4 { margin: 18px 0 8px; font-size: 1rem; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: .03em; }
.draft-box .ingredients, .draft-box .steps { margin-top: 4px; }
.save-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.save-form .field-check { margin: 0; }

/* ---------- Export Seite ---------- */
.export-wrap { max-width: 720px; margin: 0 auto; }
.export-options { background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.format-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.format-choice .field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .9rem; }
.format-choice select, .format-choice input { padding: 10px 12px; border-radius: 10px;
  border: 1.5px solid var(--line); font-size: .95rem; }
.export-list { background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 14px; padding: 12px 18px; }
.export-all { display: flex; align-items: center; gap: 8px; padding: 8px 0;
  border-bottom: 1.5px solid var(--line); margin-bottom: 6px; font-size: .95rem; }
.export-item { display: flex; align-items: center; gap: 12px; padding: 8px 6px;
  border-radius: 10px; cursor: pointer; }
.export-item:hover { background: #faf6ef; }
.export-item input { width: 18px; height: 18px; }
.export-thumb { width: 46px; height: 46px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; background: #fff; flex-shrink: 0; }
.export-thumb img { width: 100%; height: 100%; object-fit: cover; }
.export-info { display: flex; flex-direction: column; }
.export-info small { color: var(--ink-soft); }

/* ---------- KI-Text-Zeichenzähler ---------- */
.char-hint { display: block; margin-top: 6px; font-size: .78rem; color: var(--ink-soft); }
.char-hint.ok { color: #4a7c3f; font-weight: 600; }

/* ---------- KI-Lade-Overlay ---------- */
.ai-loading {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(255, 248, 240, 0.9);
  display: none; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.ai-loading.show {
  display: flex; opacity: 1; pointer-events: all;
}
.ai-loading-card {
  text-align: center; background: #fff; border-radius: 20px;
  padding: 36px 44px; box-shadow: 0 10px 40px rgba(0,0,0,.18);
  max-width: 90%;
}
.ai-loading-card {
  text-align: center; background: #fff; border-radius: 24px;
  padding: 44px 56px; box-shadow: 0 18px 60px rgba(0,0,0,.22);
  max-width: 92%;
  position: relative;
  transform: translateY(0);
  animation: card-pop .35s ease-out;
}
.ai-loading-card h2 { margin: 26px 0 8px; color: var(--brand); font-size: 1.35rem; font-weight: 700; letter-spacing: .2px; }
.ai-loading-scene {
  position: relative; width: 220px; height: 170px; margin: 0 auto;
}
.pan-wrap {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  width: 120px; height: 110px;
}
.pan {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  font-size: 4.2rem; line-height: 1; filter: drop-shadow(0 8px 14px rgba(168, 68, 46, .28));
  animation: pan-wobble 1.5s ease-in-out infinite;
  transform-origin: 50% 100%;
}
.pan-steam {
  position: absolute; font-size: 1.5rem; opacity: 0; bottom: 88px;
  animation: steam-up 1.5s ease-out infinite;
}
.pan-steam.p1 { left: 18px; }
.pan-steam.p2 { left: 52px; animation-delay: .5s; }
.pan-steam.p3 { left: 84px; animation-delay: 1s; }
.float-emoji {
  position: absolute; font-size: 1.7rem; opacity: .85;
  animation: float-drift 3.2s ease-in-out infinite;
}
.float-emoji.fe1 { top: 8px; left: 0; }
.float-emoji.fe2 { top: 52px; left: 2px; animation-delay: .5s; }
.float-emoji.fe3 { top: 6px; right: 0; animation-delay: .9s; }
.float-emoji.fe4 { top: 48px; right: 4px; animation-delay: 1.4s; }
.float-emoji.fe5 { top: 94px; left: 26px; animation-delay: .2s; }

.loading-dots { display: flex; justify-content: center; gap: 9px; margin-top: 14px; }
.loading-dots span {
  width: 10px; height: 10px; border-radius: 50%;
  background: #c9a87c; display: inline-block;
  animation: dot-blink 1.4s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: .2s; }
.loading-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes card-pop {
  0% { transform: scale(.85) translateY(12px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes pan-wobble {
  0%, 100% { transform: translateX(-50%) rotate(-7deg); }
  50% { transform: translateX(-50%) rotate(7deg); }
}
@keyframes steam-up {
  0% { opacity: 0; transform: translateY(4px) scale(.6); }
  25% { opacity: .9; }
  100% { opacity: 0; transform: translateY(-34px) scale(1.25); }
}
@keyframes float-drift {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-14px) rotate(5deg); }
}
@keyframes dot-blink {
  0%, 80%, 100% { opacity: .25; transform: scale(.8); }
  40% { opacity: 1; transform: scale(1.2); }
}



/* ---------- Allergien ---------- */
.badge-allergy {
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff3e0; border: 1px solid #e8c48a; border-radius: 999px;
  font-size: .72rem; padding: 2px 8px; color: #8a5a1e;
  margin-left: 4px; vertical-align: middle;
}
.allergy-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.allergy-title { margin: 0 0 2px; font-weight: 600; font-size: .9rem; }
.allergy-title small { font-weight: 400; }
.allergy-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px solid var(--line); border-radius: 999px;
  padding: 5px 13px; cursor: pointer; user-select: none;
  background: #fff; transition: all .15s ease;
}
.allergy-chip input { display: none; }
.allergy-chip span { font-size: .85rem; color: var(--ink); }
.allergy-chip:has(input:checked) {
  background: #fff3e0; border-color: #e0a54e; color: #8a5a1e;
}
.allergy-chip:has(input:checked) span { color: #8a5a1e; font-weight: 600; }
.ai-allergies {
  margin: 14px 0 4px; padding: 14px 16px;
  background: #fdfaf4; border: 1px solid #efe3cc; border-radius: 12px;
}
.detail-allergies {
  margin-top: 12px; padding: 12px 14px;
  background: #fdfaf4; border: 1px solid #efe3cc; border-radius: 10px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.detail-allergies strong { font-size: .9rem; }
.allergy-list { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.allergy-tag {
  background: #fff3e0; border: 1px solid #e8c48a; border-radius: 999px;
  padding: 2px 10px; font-size: .78rem; color: #8a5a1e; font-weight: 600;
}

/* Badges rechtsbündig gruppiert (Karten-Zeile) */
.card-badges {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Eigene-Rezept-Badge */
.badge-own {
  display: inline-flex; align-items: center; justify-content: center;
  background: #e8f0fe; border: 1px solid #b8cdf0; border-radius: 999px;
  font-size: .72rem; padding: 2px 8px; color: #2b5aa0;
  margin-left: 0; vertical-align: middle;
}

/* Ansicht-Umschalter (Meine/Alle) */
.scope-toggle {
  display: flex; align-items: center; gap: 8px;
  margin-right: 14px; flex-shrink: 0;
}
.scope-toggle .chip {
  border: 1.5px solid var(--line); background: #fff;
}
.scope-toggle .chip-active {
  background: var(--accent); border-color: var(--accent); color: #fff;
}

/* ---------- Sprachwahl ---------- */
.lang-switch { display: inline-flex; align-items: center; gap: 4px; margin-left: 10px;
  padding-left: 10px; border-left: 1px solid var(--line); position: relative;
  flex-shrink: 0; }
.lang-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: none;
  cursor: pointer; padding: 3px 6px; font-size: .95rem; border-radius: 6px; color: var(--ink); white-space: nowrap; }
.lang-btn:hover { background: var(--brand-soft); }
.lang-btn-flag { font-size: 1.1rem; line-height: 1; }
.lang-btn-caret { font-size: .75rem; opacity: .6; }
.lang-menu { display: none; position: absolute; top: calc(100% + 6px); right: 0; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14);
  padding: 5px; min-width: 150px; z-index: 50; }
.lang-menu.lang-open { display: block; }
.lang-menu .lang-link { display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  font-size: .9rem; color: var(--ink); border-radius: 7px; }
.lang-menu .lang-link:hover { background: var(--surface); text-decoration: none; }
.lang-menu .lang-link.lang-active { background: var(--brand-soft); font-weight: 600; }
.lang-link { font-size: .95rem; text-decoration: none; padding: 2px 4px;
  border-radius: 6px; opacity: .55; filter: grayscale(.6); transition: all .15s; }
.lang-link:hover { opacity: 1; filter: none; }
.lang-link.lang-active { opacity: 1; filter: none; background: var(--brand-soft);
  box-shadow: 0 0 0 2px var(--brand-soft); }
/* Bild-Neugenerierung (ausgelagert aus dem Hauptformular, da verschachtelte Forms ungültig) */
.edit-side-regenerate { margin: -8px 0 0; padding: 0; }
.edit-side-regenerate form { display: inline-flex; }
/* Anpassungs-Rückmeldung (KI-Feedback) */
.applied-feedback { margin: 12px 0; padding: 10px 14px; border-radius: 10px;
  background: var(--brand-soft); border: 1px solid var(--brand); color: var(--ink);
  font-size: .9rem; line-height: 1.45; word-break: break-word; }
/* Desktop: exakt das bisherige Layout — alles in EINER Zeile, Flaggen am rechten Ende.
   Zwischen 761–960px gilt das kompakte zweizeilige Layout (kein Overflow). */
@media (min-width: 961px) {
  .topbar-inner { flex-wrap: nowrap; gap: 0; }
  .brand { order: 1; }
  .brand-name { display: inline; }
  .topnav { order: 2; flex: 1 1 auto; flex-wrap: nowrap; gap: 18px; }
  .topnav a { font-size: .95rem; }
  .lang-switch { order: 3; margin-left: 10px; padding-left: 10px; border-left: 1px solid var(--line); }
  .lang-btn { display: none; }
  .lang-menu { display: inline-flex; position: static; background: none; border: none;
    box-shadow: none; padding: 0; min-width: 0; }
  .lang-menu.lang-open { display: inline-flex; }
  .lang-menu .lang-link { display: inline-flex; padding: 2px 4px; }
  /* Desktop: Sprach-Namen ausblenden, nur die Flagge zeigen (kompakt) */
  .lang-name { display: none; }
  .lang-flag { font-size: 1rem; line-height: 1; }
}

/* ==========================================================================
   KI-Rezept-Anpassung (Vergleich alt ↔ neu)
   ========================================================================== */
.adjust-box { padding: 20px; margin-bottom: 24px; }
.adjust-inline { margin-top: 28px; padding: 20px; background: rgba(127, 127, 127, 0.06); border-radius: 12px; }
.adjust-inline-form .field { margin-bottom: 10px; }
.adjust-inline-form textarea { width: 100%; padding: 10px; border-radius: 8px; border: 1px solid #ccc; min-height: 70px; }
.adjust-compare { margin-top: 24px; }
.adjust-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.adjust-col { border: 1px solid #ddd; border-radius: 12px; padding: 18px; background: #fff; }
.adjust-original { border-left: 4px solid #999; }
.adjust-new { border-left: 4px solid #4a90d9; background: #f6faff; }
.adjust-col h2 { margin-top: 0; font-size: 1.1rem; }
.adjust-col h3 { margin: 12px 0 6px; font-size: 1.15rem; }
.adjust-col h4 { margin: 16px 0 6px; font-size: 0.95rem; color: #555; text-transform: uppercase; letter-spacing: 0.4px; }
.adjust-list { margin: 0; padding-left: 18px; }
.adjust-list li { margin-bottom: 4px; }
.adjust-steps { margin: 0; padding-left: 20px; }
.adjust-steps li { margin-bottom: 8px; }
.adjust-summary { background: #fffbe6; border: 1px solid #f0e0a0; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.adjust-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.adjust-actions .inline-form { margin: 0; }
.adjust-actions textarea { width: 260px; padding: 8px; border-radius: 8px; border: 1px solid #ccc; min-height: 54px; }
.btn-danger { background: #d9534f; color: #fff; }
.btn-danger:hover { background: #c9302c; }
@media (max-width: 720px) {
  .adjust-columns { grid-template-columns: 1fr; }
  .adjust-actions { flex-direction: column; }
  .adjust-actions textarea { width: 100%; }
}
