/* =========================================================
   Klar — Rezepte, Varianten, Zutaten und Behälter
   ----------------------------------------------------------
   Rezeptkarten in beiden Darstellungen, Variantendetail,
   Zutatenliste, Editor und die Behälterauswahl.

   Aus ``klar-patterns.css`` herausgelöst, damit Rezepte und
   Tagebuch nicht dieselbe Datei teilen.

   Die Maße stammen aus den wirksamen Konzeptregeln
   (``referenz/styles.css``, dann ``referenz/klar/klar.css``).
   Wo diese Datei bewusst abweicht, steht der Grund daneben —
   sonst nirgends.

   Symbolgrößen stehen **nicht** hier, sondern zentral in
   ``klar-icons.css``: eine Glyphe folgt ``font-size``, ein
   ``<svg>`` folgt ``width``. Übriggebliebene ``font-size``-Regeln
   auf ehemaligen ``<i>``-Symbolen sind deshalb entfernt und
   dürfen nicht zurückkommen.
   ========================================================= */

/* ---------------------------------------------------------- Seitenrhythmus
   Die Rezeptstrecke legt ihren Seiteninhalt in eine Hülle
   (``[data-recipe-search-page]``, ``[data-recipe-variant-detail]``,
   ``[data-recipe-editor-page]``), weil Suchskript und Editor einen
   gemeinsamen Anker brauchen. ``.app-container`` verteilt seine
   21 px aber nur zwischen **direkten** Kindern — und das war nach
   dem Einzug der Hülle genau eines. Ergebnis: Überschrift,
   Reiterband, Suchfeld und Abschnitt klebten aneinander.

   ``display: contents`` löst die Hülle als Kasten auf: ihre Kinder
   werden zu Kindern von ``.app-container`` und erben dessen
   Abstand, ohne dass der Wert hier ein zweites Mal steht. Die
   Hülle bleibt im DOM, die Skripte finden sie weiterhin. */

.app-container > [data-recipe-search-page],
.app-container > [data-recipe-variant-detail],
.app-container > [data-recipe-editor-page] {
  display: contents;
}

/* ``.app-container > *`` setzt ``min-width: 0`` — das trifft jetzt
   die aufgelöste Hülle statt ihrer Kinder. Also hier noch einmal,
   eine Ebene tiefer, sonst sprengt ein langer Rezeptname die
   Spalte. */
.app-container > [data-recipe-search-page] > *,
.app-container > [data-recipe-variant-detail] > *,
.app-container > [data-recipe-editor-page] > * {
  min-width: 0;
}

/* ---------------------------------------------------------- hidden
   Hier stand eine Zeile, die ``[hidden]`` für vier Komponenten
   dieser Datei zurückholte: ``[hidden] { display: none }`` gehört
   dem Browser, und jede Autorenregel mit ``display`` schlägt sie —
   wegen der Herkunft, nicht wegen der Spezifität. Der Bildwähler
   stand deshalb als leerer Knopf in der Seite, die Rechenzeile als
   leerer getönter Kasten, und der Endgewichtsblock blieb im
   Portionsmodus stehen.

   ``base.css`` trägt die Regel jetzt **einmal** für alle, mit
   ``!important``. Die vier Zeilen hier sind damit wirkungslos und
   weg. Wer die zentrale Regel je entfernt, holt sich alle vier
   Fehler zurück — und kein automatischer Test bemerkt es. */

/* ---------------------------------------------------------- recipe cards
   Recipes *and* variants share the toggle, so they share the
   two presentations too. */

.app-main .recipe-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.app-main .recipe-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--round);
  overflow: hidden;
  padding: 0;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

/* Rezepte und Varianten sind grün (--recipe-tint / --recipe-ink, tokens.css):
   dieselbe Farbe wie in der Lebensmittelsuche. Entwürfe bleiben grau
   (``.is-draft`` weiter unten), der Akzent gehört den Bedienelementen. */
.app-main .recipe-cover {
  height: 105px;
  background: var(--recipe-tint);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Die zwei blassen Kreise des Konzepts. Sie sind der Grund, warum
   die Kachel im Entwurf nicht wie eine leere Fläche mit Symbol
   aussieht — 1 px Linie in 16 % Rezeptgrün, mehr nicht. */
.app-main .recipe-cover::before,
.app-main .recipe-cover::after {
  content: "";
  position: absolute;
  border: 1px solid color-mix(in srgb, var(--recipe-ink) 16%, transparent);
  width: 100px;
  height: 100px;
  border-radius: 50%;
  right: -35px;
  top: -32px;
  pointer-events: none;
}

.app-main .recipe-cover::after {
  right: 30px;
  top: 50px;
  width: 85px;
  height: 85px;
}

/* Direktes Kind: das Entwurfsband im Deckel trägt sein eigenes Symbol. */
.app-main .recipe-cover > svg {
  color: var(--recipe-ink);
}

.app-main .recipe-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-main .recipe-info {
  padding: 14px 13px;
  min-width: 0;
}

.app-main .recipe-info strong {
  display: block;
  font-size: var(--text-base);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* 12 px, nicht 11: ``styles.css`` setzt ``.recipe-info small`` erst
   auf 11 px und dann ein zweites Mal auf 12 px — die spätere Regel
   gewinnt. Genau so eine Zeile ist gemeint, wenn es heißt, die
   Textgrößen stimmen nicht. */
.app-main .recipe-info small {
  display: block;
  color: var(--muted);
  font-size: var(--text-sm);
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.app-main .recipe-list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.app-main .recipe-list .recipe-card {
  flex-direction: row;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  border-radius: 0;
  padding: 10px 0;
  gap: 12px;
}

/* Der Pfeil der Listenzeile ist im Konzept ein Pseudo-Element mit
   dem Zeichen ``›``, kein Symbol aus dem Satz. Als Markup wäre er
   ein zweites, leicht anderes Zeichen an derselben Stelle — und
   das Suchskript müsste ihn beim Tippen mitbauen. */
.app-main .recipe-list .recipe-card::after {
  content: "›";
  color: var(--muted);
  font-size: 23px;
  line-height: 1;
  padding: 0 8px;
  flex-shrink: 0;
}

.app-main .recipe-list .recipe-cover {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 13px;
}

.app-main .recipe-list .recipe-cover::before,
.app-main .recipe-list .recipe-cover::after {
  display: none;
}

.app-main .recipe-list .recipe-info {
  flex: 1;
  padding: 0;
}

/* ---------------------------------------------------------- card content
   One markup for both presentations (``recipes/_overview_card.html``,
   rebuilt by ``recipe-search.js`` while somebody types); the container
   class decides:

     tile   name · kcal · macros · subline, draft state as a band on the cover
     list   [state] name … · one nutrient line · subline

   The nutrient line is written like the editor's ingredient list:
   flame and kcal, F, KH in the carbs colour, P in the protein colour. */

.app-main .recipe-name {
  display: block;
  min-width: 0;
}

/* List: the badge stands before the name, and only the name gives way.
   A shortened name is shown in full on the variant page (UIUX.md). */
.app-main .recipe-list .recipe-name--status {
  display: flex;
  align-items: center;
  gap: 7px;
}

.app-main .recipe-list .recipe-name--status strong {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow-wrap: normal;
}

/* The draft state, one look in both places: grey, white text, pencil.
   Text and symbol carry it, not the colour alone (UIUX.md). */
.app-main .recipe-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--muted);
  color: var(--surface);
  font-weight: 750;
  line-height: 1.3;
}

.app-main .recipe-status--badge {
  flex: none;
  padding: 4px 8px 4px 7px;
  border-radius: var(--radius-xs);
  font-size: var(--text-2xs);
  white-space: nowrap;
}

.app-main .recipe-status--band {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: 7px 12px;
  font-size: var(--text-xs);
}

/* Exactly one marker per presentation — which also keeps a screen
   reader from announcing the state twice. */
.app-main .recipe-grid .recipe-status--badge,
.app-main .recipe-list .recipe-status--band {
  display: none;
}

.app-main .recipe-nutrients {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-top: 6px;
  font-size: var(--text-xs);
  line-height: 1.5;
  color: var(--muted);
  white-space: nowrap;
}

.app-main .recipe-nutrients > span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.app-main .recipe-nutrients b {
  color: var(--ink);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.app-main .recipe-nutrients__carbs {
  color: var(--carbs-ink);
}

.app-main .recipe-nutrients__protein {
  color: var(--protein-ink);
}

/* ``.recipe-info small`` is the subline; the unit belongs to the line. */
.app-main .recipe-info .recipe-nutrients small {
  display: inline;
  margin: 0;
  font-size: inherit;
  color: var(--muted);
}

/* List: no unit after the kcal, as in the ingredient list — still
   there for screen readers, so "1.284" is not read without it. */
.app-main .recipe-list .recipe-nutrients__energy small,
.app-main .recipe-nutrients--bare .recipe-nutrients__energy small {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Tile: kcal on a line of its own, the macros underneath. */
.app-main .recipe-grid .recipe-nutrients {
  margin-top: 7px;
  gap: 5px 6px;
}

.app-main .recipe-grid .recipe-nutrients__energy {
  flex-basis: 100%;
  gap: 4px;
}

.app-main .recipe-grid .recipe-nutrients__energy b {
  font-size: var(--text-15);
  font-weight: 750;
  letter-spacing: -0.2px;
}

.app-main .recipe-grid .recipe-subline {
  margin-top: 9px;
}

/* ---------------------------------------------------------- drafts
   Greyed out the same way in both presentations: grey cover, grey
   name and figures. The tile adds a dashed border; a list row has no
   border to dash. A finished variant with a working copy is not a
   draft — it is the stand that gets logged — and keeps its colours. */

.app-main .recipe-card.is-draft .recipe-cover {
  background: var(--line);
}

.app-main .recipe-card.is-draft .recipe-cover::before,
.app-main .recipe-card.is-draft .recipe-cover::after {
  border-color: var(--border-strong);
}

.app-main .recipe-card.is-draft .recipe-cover > svg,
.app-main .recipe-card.is-draft .recipe-info strong,
.app-main .recipe-card.is-draft .recipe-nutrients,
.app-main .recipe-card.is-draft .recipe-nutrients b,
.app-main .recipe-card.is-draft .recipe-nutrients__carbs,
.app-main .recipe-card.is-draft .recipe-nutrients__protein {
  color: var(--muted);
}

.app-main .recipe-card.is-draft .recipe-nutrients b {
  font-weight: 600;
}

.app-main .recipe-grid .recipe-card.is-draft {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--muted) 50%, var(--surface));
}

/* ---------------------------------------------------------- list band (F1)
   Das Reiterband unter der Suche der Variantenliste: links die
   Statusfilter als Text-Reiter mit Zahlen, rechts der Sortier-Umschalter,
   darunter eine durchgezogene feine Linie über die volle Breite. Der
   gewählte Reiter trägt darauf einen kräftigen Balken in Akzent -- und ist
   zusätzlich fett und dunkel, der Zustand hängt nie nur an der Farbe.
   Die Rezeptübersicht hat keine Filter und damit kein Band; dort steht der
   Umschalter in der Statuszeile neben Kachel und Liste (``.list-bar``). */

.app-main .list-meta {
  display: flex;
  align-items: stretch;
  column-gap: 8px;
  border-bottom: 1px solid var(--line);
}

.app-main .list-tabs {
  display: flex;
  flex: 0 1 auto;
  min-width: 0;
}

.app-main .list-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.app-main .list-tab:hover,
.app-main .list-sort:hover {
  background: var(--tint);
}

.app-main .list-tab:focus-visible,
.app-main .list-sort:focus-visible {
  outline-offset: -2px;
}

.app-main .list-tab[aria-current="true"] {
  color: var(--ink);
  font-weight: 800;
}

.app-main .list-tab[aria-current="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
}

/* Text bündig mit dem Suchfeld: der erste Reiter und der Umschalter ragen
   nur mit der Trefferfläche über den Rand. */
.app-main .list-tab:first-child {
  margin-left: -10px;
}

.app-main .list-tab:first-child[aria-current="true"]::after {
  left: 10px;
}

.app-main .list-tab__count {
  font-size: var(--text-xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Sortier-Umschalter: Text in Akzentfarbe, 44 px hoch, kein Rahmen, keine
   Fläche. Steht im Band (rechts) oder in der Statuszeile (Rezepte). */
.app-main .list-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: var(--text-sm);
  font-weight: 750;
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
}

.app-main .list-sort svg {
  width: 15px;
  height: 15px;
}

.app-main .list-meta .list-sort {
  margin: 0 -4px 0 auto;
  padding: 0 4px;
}

/* Statuszeile mit Umschalter (Rezeptübersicht): Zahl links, rechts
   Sortierung und Ansicht. */
.app-main .list-bar > small {
  min-width: 0;
  line-height: 1.5;
  white-space: nowrap;
}

.app-main .list-bar__tools {
  display: flex;
  align-items: center;
  flex: none;
  gap: 4px;
}

/* Der Weg zurück im leeren Zustand steht unter dem Satz. */
.app-main [data-recipe-search-empty] > .btn {
  margin-top: 12px;
}

/* Kontrastmodus: Hintergründe entfallen, der Balken braucht eine Systemfarbe. */
@media (forced-colors: active) {
  .app-main .list-tab[aria-current="true"]::after {
    background: Highlight;
    forced-color-adjust: none;
  }
}

/* 320 bis 350 px: Reiter und Umschalter teilen sich eine enge Zeile. */
@media (max-width: 350px) {
  .app-main .list-tab {
    padding: 0 8px;
  }
  .app-main .list-tab:first-child {
    margin-left: -8px;
  }
  .app-main .list-tab:first-child[aria-current="true"]::after {
    left: 8px;
  }
  .app-main .list-bar__tools {
    gap: 0;
  }
  .app-main .list-bar__tools .list-sort {
    padding: 0 6px;
  }
}

/* ---------------------------------------------------------- recipe detail */

.app-main .detail-hero {
  padding: 25px;
  background: var(--hero);
  color: var(--hero-ink);
  border-radius: var(--round);
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.app-main .detail-hero > div {
  min-width: 0;
}

.app-main .detail-hero h2 {
  font-size: var(--text-2xl);
  overflow-wrap: anywhere;
}

.app-main .detail-hero p {
  font-size: var(--text-sm);
  margin-top: 6px;
  line-height: 1.5;
}

.app-main .ingredient {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--text-base);
  min-width: 0;
}

.app-main .ingredient:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.app-main .ingredient > span:last-child {
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.app-main .recipe-ingredient {
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
}

.app-main .recipe-ingredient > div {
  min-width: 0;
  flex: 1;
}

.app-main .recipe-ingredient strong {
  font-size: var(--text-base);
  overflow-wrap: anywhere;
}

.app-main .recipe-ingredient > span {
  font-size: var(--text-xs);
  white-space: nowrap;
  padding-top: 2px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* A plain vegetable needs no invented brand, and no empty line
   where a brand would have been. */
.app-main .ingredient-brand {
  display: block;
  font-size: var(--text-2xs);
  color: var(--muted);
  margin-top: 4px;
}

/* ------------------------------------------------- Nährwertzeile der Zutat
   Eine Komponente für Editor und Leseansichten (Entscheidung 25.09.2026,
   ``recipes/_ingredient_nutrients.html``): Flamme + kcal, dann F/KH/P, überall
   in derselben Größe und Farbe. Nur das Umbruchverhalten unterscheidet sich --
   im Editor liegt die Menge in einer festen 74-px-Box, hier darf die Zeile
   selbst umbrechen, damit die Menge als Text (z. B. „2 Scheiben (60 g)")
   daneben nicht überläuft. */

.app-main .ingredient-nutrients {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  margin-top: 9px;
  font-size: 11px;
  line-height: 1.5;
  white-space: nowrap;
}

.app-main .ingredient-nutrients > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.app-main .ingredient-nutrients b {
  color: var(--ink);
  font-weight: 650;
}

.app-main .ingredient-energy svg {
  width: 11px;
  height: 13px;
  color: var(--muted);
}

.app-main .ingredient-carbs {
  color: var(--carbs-ink);
}

.app-main .ingredient-protein {
  color: var(--protein-ink);
}

.app-main .recipe-ingredient .ingredient-nutrients {
  /* Die Lesezeile hat kein festes Feld daneben -- die Menge ist Text in
     wechselnder Länge, also darf die Nährwertzeile bei wenig Platz (320 px)
     umbrechen, statt über den Rand zu laufen. */
  flex-wrap: wrap;
}

/* ---------------------------------------------------------- recipe editor */

.app-main .editor-ingredient {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px;
  gap: 10px;
  align-items: center;
  min-height: 88px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: hidden;
  background: var(--surface);
}

/* --- Wischen nach links legt das Entfernen frei -----------------
   Swipe und Long-Press werden im Varianteneditor gemeinsam
   ausgewertet. ``touch-action: pan-y`` lässt vertikales Scrollen
   beim Browser, während horizontale Bewegungen der Zeile folgen.

   Rot ist dieser einen Aktion vorbehalten, und es erscheint erst,
   wenn die Fläche offen ist. Die Breite ist die des Tagebuchs, weil
   es dieselbe Geste ist. */

.app-main .editor-ingredient.is-open {
  background: var(--surface);
}

.app-main .editor-ingredient > *:not([data-ingredient-swipe-action]) {
  transition: transform 0.18s var(--ease);
  transform: translateX(var(--ingredient-swipe-x, 0px));
}

.app-main .editor-ingredient.is-open {
  --ingredient-swipe-x: -82px;
}

.app-main .editor-ingredient.is-swiping > *:not([data-ingredient-swipe-action]) {
  transition: none;
}

.app-main .ingredient-delete {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 82px;
  border: 0;
  background: var(--danger);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: var(--text-xs);
  visibility: hidden;
}

.app-main .editor-ingredient.is-open .ingredient-delete {
  visibility: visible;
}

/* Beim Umsortieren hebt sich die Zeile aus der Liste heraus; ein
   ``overflow: hidden`` schnitte sie dabei ab. */
.app-main .editor-ingredient.is-dragging,
.app-main [data-ingredient-list].is-reordering .editor-ingredient {
  overflow: visible;
}

.app-main .editor-ingredient:last-of-type {
  border-bottom: 0;
}

.app-main .editor-ingredient .entry-content {
  padding: 0;
  min-width: 0;
  touch-action: pan-y;
}

.app-main .editor-ingredient strong {
  font-size: 13px;
  display: block;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.app-main .editor-ingredient .ingredient-brand {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 4px;
}

/* Die Nährwertzeile selbst ist jetzt die geteilte, ungescopte Komponente
   weiter oben (Editor und Leseansichten); hier stand bis 25.09.2026 eine
   zweite, wortgleiche Fassung nur für den Editor. */

.app-main .ingredient-amount {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 74px;
  min-height: 44px;
  margin-top: 24px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg);
  position: fixed;
  right: 0;
}

.app-main .ingredient-amount:focus-within {
  border-color: var(--accent);
  box-shadow: var(--ring-accent-soft);
  /* Durchsichtiger Rahmen: forced-colors wirft box-shadow weg, malt aber
     outline in der Systemfarbe neu. */
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.app-main .ingredient-amount input:focus-visible {
  outline: none;
}

.app-main .ingredient-amount input {
  /* Genau die 16 px der Referenz, als Token: unter 16 px zoomt iOS beim
     Fokus in das Feld hinein, und ``--text-16`` wächst im Gegensatz zu
     einem harten Pixelwert mit der Textvergrößerung mit. */
  font-size: var(--text-16);
  width: 100%;
  min-width: 0;
  border: 0;
  padding: 9px 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  /* Abweichung mit Grund: das Konzept gibt dem Feld keine
     Mindesthöhe und landet bei ~39 px. UIUX.md verlangt
     Touchziele möglichst ab 44 px, und ein Mengenfeld ist das
     meistbenutzte Ziel dieser Seite. */
  min-height: 44px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.app-main .ingredient-amount > span {
  flex: 0 0 auto;
  font-size: 10px;
  color: var(--muted);
  text-align: left;
}

.app-main .editor-ingredient .ingredient-more {
  position: absolute;
  top: 0;
  right: 0;
  width: 36px;
  height: 32px;
  min-width: 36px;
  min-height: 32px;
  padding: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

/* Sichtbar 32 px wie im Konzept, anfassbar größer wie in UIUX.md:
   „Kleine visuelle Icons dürfen große unsichtbare Touchflächen
   besitzen." Die Fläche wächst über das Raster hinaus, nicht das
   Raster über das Konzept hinaus.

   39 px, nicht 44: nach rechts endet die Zeile am Knopf und wird
   seit der Wischgeste beschnitten (``overflow: hidden`` weiter
   oben), nach links liegen genau die 7 px Rasterlücke frei —
   danach begänne das Mengenfeld, und eine Fläche, die ihm Tipser
   wegnimmt, wäre schlechter als eine kleine. Senkrecht sind es die
   vollen 44 px. */
.app-main .editor-ingredient .ingredient-more::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  width: 39px;
  height: 44px;
  transform: translateY(-50%);
}

/* --- Zutaten umsortieren (langer Druck, dann schieben) ---------
   Die Gesten selbst stehen in ``recipe-variant-editor.js``. Sie
   waren nach dem Umbau ohne Wirkung: das Skript setzt
   ``--ingredient-drag-y`` auf der gezogenen Zeile, und keine Regel
   las die Variable mehr. Diese vier Regeln sind, was davon
   sichtbar ist — mehr braucht es nicht, weil die Nachbarzeilen
   ihre Verschiebung direkt als ``style.transform`` bekommen. */

.app-main .editor-ingredient {
  transform: translateY(var(--ingredient-drag-y, 0px));
}

.app-main [data-ingredient-list].is-reordering {
  user-select: none;
}

.app-main .editor-ingredient.is-dragging {
  position: relative;
  z-index: 8;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  cursor: grabbing;
}

/* Während des Ziehens darf die Seite nicht mitscrollen und der
   Text nicht markiert werden — sonst zieht man beim zweiten Versuch
   eine Auswahl statt einer Zeile. */
html.is-ingredient-reordering-active,
html.is-ingredient-reordering-active body {
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: contain;
}

/* Der Abstand des Konzepts zwischen Zutatenliste und den beiden
   Knöpfen darunter (dort als ``style="margin-top:14px"``). */
.app-main [data-ingredient-list] + .hint {
  margin: 10px 0px;
}

.app-main .panel > .action-pair {
  margin-top: 14px;
  line-height: 1.2;
}

.app-main .tare-result {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: var(--text-sm);
  background: var(--tint);
  color: var(--accent);
  padding: 13px;
  border-radius: 12px;
  margin-top: 9px;
  font-variant-numeric: tabular-nums;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------- containers */

.app-main .container-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px 0;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  color: inherit;
  text-decoration: none;
  min-height: 60px;
}

.app-main .container-row:last-child {
  border-bottom: 0;
}

.app-main .container-row > div {
  flex: 1;
  min-width: 0;
}

.app-main .container-row strong {
  font-size: var(--text-base);
  display: block;
  overflow-wrap: anywhere;
}

.app-main .container-row small {
  font-size: var(--text-xs);
  display: block;
  color: var(--muted);
  margin-top: 6px;
}

.app-main .container-photo {
  width: 66px;
  height: 64px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  flex-shrink: 0;
}

/* Kein Bild: dieselbe Fläche, ein Symbol darin statt eines Fotos.
   Der Platz bleibt gleich, damit die Liste nicht springt. */
.app-main span.container-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.app-main .container-hero {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--round);
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.app-main .container-hero img {
  width: 100%;
  max-height: 210px;
  object-fit: contain;
}

/* The container is chosen by its picture. */
.app-main .container-select {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 10px;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  font-size: var(--text-base);
  color: inherit;
  text-decoration: none;
  min-height: 70px;
}

.app-main .container-select img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  border-radius: 9px;
  flex-shrink: 0;
}

/* Der Platzhalter für „kein Bild" hat dasselbe Maß wie das Bild,
   damit Name und Leergewicht nicht je nach Behälter woanders
   beginnen. */
.app-main .container-select .container-photo {
  flex: 0 0 50px;
  width: 50px;
  height: 50px;
  border-radius: 9px;
  border: 0;
}

.app-main .container-select > span {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.app-main .container-select > svg {
  flex: 0 0 17px;
}

.app-main .container-none.is-selected {
  border-color: var(--accent);
  background: var(--tint);
  color: var(--accent);
}

.app-main .container-select small {
  display: block;
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: 5px;
}

/* ``klar-icons.css`` schiebt **jedes** ``svg`` in einer
   ``.container-select`` mit ``margin-left:auto`` ans Ende — das ist
   für den nachgestellten Pfeil richtig und für ein Ersatzbild
   falsch. Das Ersatzbild steht deshalb hier wieder an seinem
   Platz. */
.app-main .container-select .container-photo svg {
  margin-left: 0;
  width: 22px;
  height: 22px;
}

/* Die Vorschau des Editors füllt denselben Rahmen wie das
   Ersatzbild, damit die Zeile beim Wechsel des Behälters nicht
   springt. */
.app-main .container-select .container-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
}

/* Der Haken zeigt die geltende Wahl. Das Konzept kennt ihn nicht,
   weil sein Wähler keinen Zustand hat; hier ist einer gespeichert,
   und ein Wähler, der ihn verschweigt, lässt zweimal wählen. */
.app-main .container-select__check {
  visibility: hidden;
  color: var(--accent);
}

.app-main .container-select.is-selected {
  border-color: var(--accent);
}

.app-main .container-select.is-selected .container-select__check {
  visibility: visible;
}

/* ``.image-options`` ist im Konzept die Reihe der Beispielbilder.
   Produktiv steht dort die Vorschau des **echten** Uploads —
   dieselbe Form, echte Daten (UMFANG.md: keine Beispielbild-Demo
   als Uploadersatz). */
.app-main .image-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.app-main .image-options button {
  border: 2px solid transparent;
  border-radius: 12px;
  background: #fff;
  width: 70px;
  height: 66px;
  padding: 5px;
}

.app-main .image-options button.is-selected {
  border-color: var(--accent);
}

.app-main .image-options img {
  height: 100%;
  width: 100%;
  object-fit: contain;
}

/* ---------------------------------------------------------- Smart Logging (F2)
   Das Dock der Variantenliste und das Sheet „Smart Logging". Das Dock steht
   nach dem Klonen durch ``klar-action-dock.js`` ausserhalb von ``.app-main``;
   seine Regeln hängen deshalb an eigenen Klassen, nicht an einem Vorfahren. */

/* Links „Smart Logging" (5fr), rechts „+ Variante" (max-content, 3fr): die
   rechte Spalte wächst nur, wenn „Variante" sonst nicht passt (schmale
   Geräte). Die Zeile ist EIN Kind der vertikalen Dock-Gruppe und teilt sich
   selbst auf. Ohne „Variante" (keine Berechtigung) füllt der eine Knopf sie.

   Das Verhältnis war zuerst 2fr : 1fr und wurde vom Produktverantwortlichen
   am 20.09.2026 von Hand auf 5fr : 3fr gestellt — „Variante" bekommt damit
   mehr Platz. Die Zahlen stehen hier und im Test; wer eine ändert, ändert
   beide. */
.smart-dock {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(max-content, 3fr);
  gap: 8px;
  align-items: stretch;
  min-width: 0;
}

.smart-dock--single {
  grid-template-columns: minmax(0, 1fr);
}

.smart-dock .btn {
  min-width: 0;
  padding: 8px 10px;
  gap: 6px;
}

.smart-dock .btn--secondary {
  white-space: nowrap;
}

.smart-dock .btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}

/* Kacheln: Smart im Akzent, geplant oder gesperrt leise (Grundfläche mit
   feiner Kontur, damit sie auf Weiß und Karte gleich lesbar bleibt). */
.smart-tile {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.smart-tile--smart {
  background: var(--tint);
  color: var(--accent);
}

.smart-tile svg {
  width: 20px;
  height: 20px;
  color: inherit;
}

.smart-opt.is-quiet .smart-tile {
  background: var(--bg);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* Das Sheet: die Zeilen mit ihrer Falte. Markierung der gewählten Zeile:
   1,5 px Akzent-Umriss auf weisser Fläche, kein Kreis, kein Haken, keine
   Tönung. Der Fokusring der Tastatur sitzt aussen (Abstand 2 px, 3 px dick),
   so bleibt er vom Umriss der Wahl klar zu unterscheiden. */
.smart-sheet__content {
  gap: 10px;
  padding-bottom: 14px;
}

.smart-list {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.smart-row {
  display: grid;
  min-width: 0;
}

.smart-opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 56px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

/* Die echte Eingabe: unsichtbar, aber fokussierbar und für Vorleser da. */
.smart-opt__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.smart-opt:has(.smart-opt__input:checked) {
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.smart-opt:has(.smart-opt__input:focus-visible) {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Nur echte Zeiger, und nie die gewählte Zeile: Touch behält :hover nach dem Tippen. */
@media (hover: hover) {
  .smart-opt:not(:has(.smart-opt__input:checked)):hover {
    background: var(--overlay-soft);
  }
}

.smart-opt__text {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.smart-opt__text strong {
  font-size: var(--text-md);
  font-weight: 650;
  line-height: 1.3;
  overflow-wrap: break-word;
}

.smart-opt__text small {
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.4;
  overflow-wrap: break-word;
}

/* Geplant oder gesperrt: zurückgenommen, aber lesbar (Titel in --muted, AA auf Weiss). Gewählt: Titel in Ink. */
.smart-opt.is-quiet .smart-opt__text strong {
  color: var(--muted);
}

.smart-opt.is-quiet:has(.smart-opt__input:checked) .smart-opt__text strong {
  color: var(--ink);
}

@media (forced-colors: active) {
  .smart-opt:has(.smart-opt__input:checked) {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }

  .smart-opt:has(.smart-opt__input:focus-visible) {
    outline: 3px solid CanvasText;
    outline-offset: 2px;
  }
}

.smart-group {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0 10px;
  color: var(--accent);
  font-size: var(--text-sm);
  font-weight: 750;
}

.smart-group svg {
  width: 16px;
  height: 16px;
}

.smart-badge {
  flex: none;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 750;
  line-height: 1.3;
  white-space: nowrap;
}

/* Die Erklärung: kein festes Mass, die Karte ist so hoch wie ihr Text. Je
   Zeile eine Karte in einer Falte (grid-template-rows 0fr -> 1fr); die alte
   schliesst sich, während die neue aufgeht, die Zeilen darunter rücken nach.
   Offen ist die Falte der gewählten Zeile -- allein über ``:checked``, also
   auch ohne Skript; bei reduzierter Bewegung sofort. */
.smart-fold {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition:
    grid-template-rows 240ms cubic-bezier(0.2, 0, 0, 1),
    visibility 0s linear 240ms;
}

.smart-row:has(.smart-opt__input:checked) .smart-fold {
  grid-template-rows: 1fr;
  visibility: visible;
  transition:
    grid-template-rows 240ms cubic-bezier(0.2, 0, 0, 1),
    visibility 0s;
}

.smart-fold__in {
  min-height: 0;
  overflow: hidden;
}

.smart-card {
  margin-top: 6px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--ink);
  font-size: var(--text-sm);
  line-height: 1.5;
  overflow: hidden;
}

.smart-card p {
  margin: 0;
  overflow-wrap: break-word;
}

.smart-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.smart-card__head strong {
  min-width: 0;
  font-size: var(--text-base);
  font-weight: 750;
  overflow-wrap: break-word;
}

.smart-card .smart-card__why {
  margin-top: 6px;
  color: var(--ink);
  font-weight: 750;
}

@media (prefers-reduced-motion: reduce) {
  .smart-fold,
  .smart-row:has(.smart-opt__input:checked) .smart-fold {
    transition: none;
  }
}

@media (max-width: 350px) {
  .smart-opt {
    gap: 10px;
  }

  .smart-card__head {
    flex-wrap: wrap;
  }
}

@media (max-height: 760px) {
  .smart-card {
    padding: 10px 12px;
  }
}

@media (max-height: 700px) {
  .smart-opt {
    min-height: 48px;
    padding-block: 4px;
  }

  .smart-group {
    margin-top: 8px;
  }
}

/* ---------------------------------------------------------- narrow phones */

@media (max-width: 350px) {
  .app-main .detail-hero {
    padding: 18px;
    gap: 14px;
  }
  .app-main .editor-ingredient {
    grid-template-columns: minmax(0, 1fr) 54px 32px;
  }
}
