:root {
  --linen: #f4ede0;
  --paper: #fffaf3;
  --ink: #4a3f35;
  --ink-soft: #7a6d5e;
  --sage: #7c8f6c;
  --sage-light: #dfe6d7;
  --rose: #c98a6b;
  --rust: #b5654a;
  --honey: #d4a24c;
  --border: #e4d8c3;
  --shadow: 0 4px 14px rgba(120, 100, 70, 0.12);
  --radius: 14px;
  --radius-sm: 8px;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--linen);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", "Noto Sans", Roboto, sans-serif;
  height: 100%;
}

body {
  background-image:
    radial-gradient(circle at 15% 10%, rgba(124,143,108,0.06) 0, transparent 45%),
    radial-gradient(circle at 85% 90%, rgba(201,138,107,0.08) 0, transparent 45%);
  background-attachment: fixed;
}

h1, h2, h3, h4 {
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", "Noto Serif", serif;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
  color: inherit;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 22px;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { width: 34px; height: 34px; }
.brand h1 { font-size: 1.4rem; letter-spacing: 0.2px; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#searchInput {
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--linen);
  min-width: 180px;
}
#searchInput:focus { outline: 2px solid var(--sage); outline-offset: 1px; }

.btn {
  border: 1px solid var(--border);
  background: var(--paper);
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .1s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.btn:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--sage); border-color: var(--sage); color: #fff; }
.btn-secondary { background: var(--rose); border-color: var(--rose); color: #fff; }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--rust); border-color: var(--rust); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

.mobile-only { display: none; }

.unit-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
}
.unit-toggle button {
  border: none;
  background: var(--paper);
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.unit-toggle button:first-child { border-right: 1px solid var(--border); }
.unit-toggle button.active { background: var(--sage); color: #fff; }

/* ---------- Body layout ---------- */
.app-body {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 22px;
  padding: 22px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

.sidebar-backdrop { display: none; }

.sidebar {
  width: var(--sidebar-width, 270px);
  flex-shrink: 0;
  position: sticky;
  top: 84px;
  display: flex;
  align-items: stretch;
}

.sidebar-inner {
  flex: 1;
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}

.sidebar-resizer {
  flex-shrink: 0;
  width: 10px;
  margin-left: -5px;
  cursor: col-resize;
  position: relative;
  z-index: 1;
}
.sidebar-resizer::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 0;
  bottom: 0;
  width: 2px;
  border-radius: 1px;
  background: transparent;
}
.sidebar-resizer:hover::after,
.sidebar-resizer.dragging::after {
  background: var(--sage, #8a9a7b);
}

.sidebar h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin: 18px 0 8px;
}
.sidebar h4:first-child { margin-top: 0; }

.filter-reset {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--rust);
  cursor: pointer;
  padding: 4px 0 12px;
  font-size: 0.85rem;
}

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--border);
  background: var(--linen);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--ink-soft);
}
.chip.active {
  background: var(--sage);
  border-color: var(--sage);
  color: #fff;
}
.chip.aufwand-einfach.active { background: var(--sage); border-color: var(--sage); }
.chip.aufwand-mittel.active { background: var(--honey); border-color: var(--honey); }
.chip.aufwand-aufwendig.active { background: var(--rust); border-color: var(--rust); }

.segmented { display: grid; grid-template-columns: repeat(2, 1fr); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.segmented button {
  border: none;
  background: var(--linen);
  padding: 7px 6px;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--ink-soft);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.segmented button:nth-child(2n) { border-right: none; }
.segmented button:nth-child(n+3) { border-bottom: none; }
.segmented button.active { background: var(--sage); color: #fff; }

.group-tree button.tree-item {
  display: flex;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--ink);
  font-size: 0.92rem;
}
.group-tree button.tree-item:hover { background: var(--linen); }
.group-tree button.tree-item.active { background: var(--sage-light); font-weight: 600; }
.group-tree .subtree { padding-left: 14px; }
.group-tree .count { color: var(--ink-soft); font-size: 0.78rem; }

/* ---------- Content ---------- */
.content { flex: 1; min-width: 0; }

.empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 60px 20px;
  font-size: 1.05rem;
}

details.group-section, details.subgroup-section {
  margin-bottom: 14px;
}

details.group-section > summary {
  list-style: none;
  cursor: pointer;
  font-family: Georgia, "Iowan Old Style", serif;
  font-size: 1.25rem;
  padding: 10px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px dashed var(--border);
}
details.group-section > summary img { width: 20px; height: 20px; }
details.group-section > summary::-webkit-details-marker { display: none; }
details.group-section > summary::before {
  content: "▸";
  color: var(--sage);
  transition: transform .15s ease;
  display: inline-block;
}
details.group-section[open] > summary::before { transform: rotate(90deg); }

details.subgroup-section > summary {
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  padding: 10px 6px 10px 18px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 6px;
}
details.subgroup-section > summary::-webkit-details-marker { display: none; }
details.subgroup-section > summary::before {
  content: "▸";
  color: var(--rose);
  transition: transform .15s ease;
}
details.subgroup-section[open] > summary::before { transform: rotate(90deg); }

.count {
  background: var(--linen);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin-left: 4px;
}

.group-body { padding: 4px 4px 4px 6px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  padding: 8px 2px 16px;
}

.card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease;
  position: relative;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(120,100,70,0.18); }

.card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 1.15rem;
}

.card h3 {
  font-size: 1.05rem;
  padding-right: 26px;
  margin-bottom: 8px;
  line-height: 1.3;
}

.card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.74rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--linen);
  color: var(--ink-soft);
  border: 1px solid var(--border);
}
.badge.aufwand-einfach { background: var(--sage-light); color: #43573a; border-color: var(--sage); }
.badge.aufwand-mittel { background: #f6e6c4; color: #7a5c1c; border-color: var(--honey); }
.badge.aufwand-aufwendig { background: #f2d9cf; color: #7d3c26; border-color: var(--rust); }

.card-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.card-tags .tag {
  font-size: 0.72rem;
  color: var(--rose);
  background: #f7e9e2;
  padding: 2px 8px;
  border-radius: 999px;
}
.card-tags .tag-todo {
  color: var(--rust);
  background: #f2d9cf;
  border: 1px dashed var(--rust);
  font-weight: 600;
}
/* Aufwand und Herkunft sind normale Tags, sehen aber weiter wie vorher aus. */
.card-tags .tag-aufwand { border: 1px solid transparent; font-weight: 600; }
.card-tags .tag-aufwand.aufwand-einfach { background: var(--sage-light); color: #43573a; border-color: var(--sage); }
.card-tags .tag-aufwand.aufwand-mittel { background: #f6e6c4; color: #7a5c1c; border-color: var(--honey); }
.card-tags .tag-aufwand.aufwand-aufwendig { background: #f2d9cf; color: #7d3c26; border-color: var(--rust); }
.card-tags .tag-land { background: var(--linen); color: var(--ink-soft); border: 1px solid var(--border); }

/* ---------- Fotos ---------- */
.card-foto {
  margin: -16px -16px 12px;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--linen);
}
.card-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-foto {
  margin: 4px 0 12px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  max-height: 260px;
  background: var(--linen);
}
.detail-foto img { width: 100%; max-height: 260px; object-fit: cover; display: block; }

/* ---------- Suche ---------- */
.such-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--sage-light);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: #43573a;
}
.aktiv-filter-kopf {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--sage-light);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: #43573a;
}
.aktiv-filter-label { font-weight: 600; white-space: nowrap; }
.aktiv-filter-chip { cursor: pointer; }
.aktiv-filter-kopf .btn { margin-left: auto; }
.card-treffer {
  font-size: 0.76rem;
  color: var(--sage);
  background: var(--sage-light);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  margin-bottom: 8px;
  display: inline-block;
}

/* ---------- Vorschläge ("Heute vielleicht…?") ---------- */
.vorschlag-section {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px 2px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.vorschlag-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.vorschlag-head h2 { font-size: 1.1rem; color: var(--sage); }
.vorschlag-hinweis { font-size: 0.8rem; font-weight: 400; opacity: 0.75; }
.vorschlag-section .card-grid { padding-bottom: 12px; align-items: start; }
/* Art/Teig + passende Füllung stehen als Paar in einer Spalte. */
.vorschlag-paar { display: flex; flex-direction: column; gap: 6px; }
.paar-plus {
  text-align: center;
  color: var(--rose);
  font-weight: 600;
  line-height: 1;
}

/* ---------- Portionen-Umrechner ---------- */
.portionen-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--linen);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  margin: 2px 0 10px;
  font-size: 0.85rem;
}
.portionen-label { color: var(--ink-soft); }
.portionen-wert { font-weight: 600; min-width: 74px; text-align: center; }
.portionen-stepper button[data-step] {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--paper);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
}
.portionen-stepper button[data-step]:hover { background: var(--sage-light); }
.portionen-reset {
  border: none;
  background: transparent;
  color: var(--rust);
  cursor: pointer;
  font-size: 0.8rem;
}
.portionen-reset:hover { text-decoration: underline; }
.portionen-hinweis { color: var(--ink-soft); font-size: 0.8rem; }

/* ---------- Tag-Eingabe im Formular ---------- */
.chip.chip-warn { border-color: var(--rust); color: var(--rust); }
.chip.chip-warn.active { background: var(--rust); border-color: var(--rust); color: #fff; }
.tag-input-warn { outline: 1px dashed var(--rust); outline-offset: 2px; border-radius: var(--radius-sm); }
.tag-warnung { color: var(--rust); font-size: 0.8rem; margin-top: 8px; }
.tag-vorschlag-zeile {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
}
.tag-vorschlag-titel {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  min-width: 68px;
}
.tag-vorschlag {
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.75rem;
  cursor: pointer;
}
.tag-vorschlag:hover { border-style: solid; border-color: var(--sage); color: var(--sage); }

/* ---------- Modal / Dialog ---------- */
dialog.modal {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  width: min(680px, 92vw);
  max-height: 88vh;
  background: var(--paper);
  box-shadow: 0 20px 60px rgba(60,45,25,0.35);
}
dialog.modal::backdrop { background: rgba(60,45,25,0.35); backdrop-filter: blur(1px); }

.modal-inner { padding: 22px 24px 26px; overflow-y: auto; max-height: 88vh; }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.modal-header h2 { font-size: 1.35rem; padding-right: 8px; }
.modal-close {
  border: none;
  background: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--ink-soft);
  line-height: 1;
}

.modal-actions { display: flex; gap: 8px; margin: 14px 0 6px; flex-wrap: wrap; }

.detail-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.detail-breadcrumb { color: var(--ink-soft); font-size: 0.88rem; margin-bottom: 6px; }

.detail-section { margin-top: 18px; }
.detail-section h3 {
  font-size: 1.02rem;
  border-bottom: 2px dashed var(--border);
  padding-bottom: 6px;
  margin-bottom: 10px;
}
.detail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  border-bottom: 2px dashed var(--border);
  padding-bottom: 6px;
  margin-bottom: 10px;
}
.detail-section-head h3 { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.unit-toggle-sm button { padding: 5px 11px; font-size: 0.78rem; }

.detail-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 4px;
}

.step-num {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--sage-light);
  color: #43573a;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem;
  font-weight: 600;
}

/* Vom "mit Mengen"-Umschalter eingefügte Klammer-Mengen im Schritt-Text */
.schritt-menge {
  font-style: normal;
  font-weight: 600;
  color: var(--sage);
  white-space: nowrap;
}

.uebersicht-table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.uebersicht-table th, .uebersicht-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  font-size: 0.92rem;
}
.uebersicht-table th { background: var(--sage-light); color: #43573a; }
.uebersicht-table tr:nth-child(even) td { background: var(--linen); }

.notes-box {
  background: var(--linen);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  white-space: pre-wrap;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

/* ---------- Zutaten-Matrix (Komponenten-Spalten) ---------- */
.matrix-wrap { overflow-x: auto; }
.zutaten-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.zutaten-matrix th {
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", "Noto Serif", serif;
  font-weight: 600;
  color: #43573a;
  text-align: left;
  padding: 7px 10px;
  border-bottom: 2px dashed var(--border);
  background: var(--sage-light);
}
.zutaten-matrix th:first-child { background: transparent; color: var(--ink-soft); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.zutaten-matrix td {
  padding: 7px 10px;
  border-bottom: 1px dashed var(--border);
  vertical-align: top;
}
.zutaten-matrix tr:last-child td { border-bottom: none; }
.matrix-name { font-weight: 600; white-space: nowrap; }
.matrix-cell em { color: var(--ink-soft); font-size: 0.85em; }
.matrix-empty { color: var(--border); text-align: center; }
.nach-geschmack { cursor: help; opacity: 0.75; }

/* Faustregel/Verhältnis — steht bewusst ganz oben, weil bei manchen
   Rezepten (Grießbrei, Milchreis, Streusel) das Verhältnis die eigentliche
   Information ist und der Rest sich von selbst versteht. */
.faustregel {
  background: var(--sage-light);
  border-left: 3px solid var(--sage);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 1.02rem;
  font-weight: 600;
  color: #3d5136;
  letter-spacing: 0.01em;
}
/* Dezente Variante: gleiche Position, aber ohne eigenen Kasten — sie
   gehört zum Rezepttext statt ihn zu überstrahlen. */
.faustregel-zeile {
  margin-bottom: 12px;
  font-size: 0.92rem;
  font-style: italic;
  color: var(--ink-soft, #6b6357);
}


/* Mix-Gruppen: gleiche Farbe = wird zusammen verrührt */
.mix-bg-0 { background: #e7edda; }
.mix-bg-1 { background: #f6e8c6; }
.mix-bg-2 { background: #f4dfd1; }
.mix-bg-3 { background: #dee8ec; }
.mix-bg-4 { background: #ebdfe9; }
.mix-bg-5 { background: #f1d7cc; }
.mixdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.mix-dot-0 { background: #93a97e; }
.mix-dot-1 { background: #d4a24c; }
.mix-dot-2 { background: #c98a6b; }
.mix-dot-3 { background: #7d99a8; }
.mix-dot-4 { background: #a27d9c; }
.mix-dot-5 { background: #b5654a; }
.mix-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.mix-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.detail-row[class*="mix-bg-"] { border-radius: var(--radius-sm); padding-left: 8px; padding-right: 8px; }

.subsection-label {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.72rem;
  color: var(--rose);
  margin: 10px 0 4px;
  font-weight: 600;
}
.subsection-label[data-open-basis] { cursor: pointer; }
.subsection-label[data-open-basis]:hover { text-decoration: underline; }

.badge-link { cursor: pointer; }
.badge-link:hover { text-decoration: underline; }

.hint {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: 4px 0 0;
}

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  margin-bottom: 5px;
}
.field input[type="text"], .field input[type="number"], .field select, .field textarea, .field input[type="search"] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--linen);
}
.field textarea { resize: vertical; min-height: 60px; }

.type-toggle { display: flex; gap: 8px; margin-top: 14px; }
.type-toggle button {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--linen);
  cursor: pointer;
  font-weight: 600;
}
.type-toggle button.active { background: var(--sage); color: #fff; border-color: var(--sage); }

.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--linen);
  border-radius: var(--radius-sm);
  padding: 8px;
}
.tag-input-wrap input {
  border: none;
  background: none;
  flex: 1;
  min-width: 120px;
  outline: none;
}
.tag-chip {
  background: #f7e9e2;
  color: var(--rose);
  border-radius: 999px;
  padding: 3px 6px 3px 11px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 5px;
}
.tag-chip button { border: none; background: none; cursor: pointer; color: var(--rose); font-size: 0.85rem; }

.zutat-row, .col-row, .cell-row {
  display: grid;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.zutat-row { grid-template-columns: 2fr 0.8fr 1fr 1.4fr auto; }
.zutat-item { margin-bottom: 12px; }
.zutat-item .zutat-row { margin-bottom: 4px; }
.zutat-extra {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.zutat-extra input {
  padding: 6px 10px;
  font-size: 0.85rem;
  background: var(--paper);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
}
.schritt-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: flex-start; }
.komponente-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.komponente-row input { flex: 1; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--linen); }
.schritt-row textarea { flex: 1; min-height: 44px; }
.schritt-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--sage-light); color: #43573a;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 600; flex-shrink: 0; margin-top: 6px;
}

.row-remove {
  border: none;
  background: none;
  color: var(--rust);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
}

.add-row-btn {
  border: 1px dashed var(--sage);
  background: none;
  color: var(--sage);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.88rem;
  margin-top: 4px;
}

.uebersicht-editor-cols { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.col-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--linen); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 8px;
}
.col-chip input { border: none; background: none; width: 110px; }

.uebersicht-editor-row {
  display: flex; gap: 8px; margin-bottom: 8px; align-items: center;
}
.uebersicht-editor-row input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--linen);
}

.form-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: var(--sage);
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(60,45,25,0.25);
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 100;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Sidebar ein-/ausklappen (Desktop) ---------- */
@media (min-width: 861px) {
  .sidebar.collapsed { width: 0; min-width: 0; overflow: hidden; }
  .sidebar.collapsed .sidebar-inner,
  .sidebar.collapsed .sidebar-resizer { display: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .mobile-only { display: inline-flex; }
  .app-body { flex-direction: column; padding: 14px; gap: 0; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 84vw;
    max-width: 320px;
    z-index: 50;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-inner { max-height: 100vh; height: 100%; border-radius: 0; }
  .sidebar-resizer { display: none; }
  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(30,20,10,0.35);
    z-index: 40;
  }
  .sidebar-backdrop.open { display: block; }
  .form-grid { grid-template-columns: 1fr; }
  .zutat-row { grid-template-columns: 1fr; }
  .zutat-extra { grid-template-columns: 1fr; }
  .brand h1 { font-size: 1.15rem; }
}

/* ---------- Handy-Feinschliff (PWA) ---------- */
@media (max-width: 860px) {
  /* Handy ist bewusst reine Lese-/Koch-Ansicht — Anlegen, Bearbeiten,
     Löschen, Import und Export gibt es nur am Laptop. */
  #btnNewRezept, #btnNewUebersicht, #btnImport, #btnExport,
  #btnEditRecipe, #btnDeleteRecipe { display: none; }

  .header-actions { width: 100%; }
  #searchInput { flex: 1; min-width: 0; }

  /* Detail-Ansicht als Vollbild — beim Kochen zählt Lesbarkeit */
  dialog.modal {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }
  .modal-inner { max-height: 100dvh; padding: 18px 16px 28px; }

  /* Größere Touch-Flächen */
  .btn { padding: 11px 16px; }
  .chip { padding: 8px 14px; }
  .portionen-stepper button[data-step] { width: 36px; height: 36px; }
  .unit-toggle button { padding: 10px 16px; }
  .unit-toggle-sm button { padding: 8px 13px; }
  .group-tree button.tree-item { padding: 9px 8px; }
  .detail-row { padding: 9px 4px; }
}
