/* ==========================================================
   Heimservice — Partner-Backoffice
   ========================================================== */

:root {
  --c-bg:        #f6f5f1;
  --c-surface:   #ffffff;
  --c-surface-2: #faf9f5;
  --c-ink:       #1a1f1a;
  --c-ink-soft:  #5a605a;
  --c-line:      #e6e3dc;
  --c-accent:    #9bb487;
  --c-accent-soft: #c8d8b8;
  --c-success: #5b9a6b;
  --c-warning: #d4a574;
  --c-danger:  #c47a8a;

  --r-sm: 8px;  --r-md: 12px;  --r-lg: 18px;  --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(26,31,26,.04), 0 2px 8px rgba(26,31,26,.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--c-ink);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

.bo {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ==========================
   Sidebar
   ========================== */
.bo-side {
  background: var(--c-surface);
  border-right: 1px solid var(--c-line);
  display: flex; flex-direction: column;
  padding: 20px 16px;
  position: sticky; top: 0; height: 100vh;
}
.bo-brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 20px; border-bottom: 1px solid var(--c-line); margin-bottom: 16px; }
.bo-brand__mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--c-accent), var(--c-accent-soft));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--c-accent) 35%, transparent);
}
.bo-brand strong { display: block; font-size: .95rem; font-weight: 600; }
.bo-brand small { color: var(--c-ink-soft); font-size: .8rem; }

/* overflow-y:auto — die Sidebar ist hoeher als der Bildschirm (19 Links ~890px);
   ohne diese Zeile sind die letzten Punkte auf einem 1366x768-Laptop nicht
   erreichbar. min-height:0 ist Pflicht, sonst darf ein Flex-Kind nicht
   schrumpfen und scrollt deshalb nicht. */
.bo-nav {
  display: flex; flex-direction: column; gap: 2px;
  flex: 1; min-height: 0; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.bo-nav__link {
  padding: 10px 12px;
  border-radius: var(--r-md);
  font-size: .92rem;
  color: var(--c-ink-soft);
  transition: all .15s;
}
.bo-nav__link:hover { background: var(--c-surface-2); color: var(--c-ink); }
.bo-nav__link.is-active {
  background: var(--c-ink);
  color: #fff;
}

.bo-side__foot { padding-top: 16px; border-top: 1px solid var(--c-line); }
.bo-user { padding: 8px 12px; }
.bo-user strong { display: block; font-size: .9rem; }
.bo-user small { color: var(--c-ink-soft); font-size: .78rem; }
.bo-logout { display: block; padding: 8px 12px; color: var(--c-ink-soft); font-size: .85rem; }
.bo-logout:hover { color: var(--c-danger); }

/* ==========================
   Main
   ========================== */
.bo-main { padding: 0; }
.bo-topbar {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-line);
  padding: 18px 32px;
  position: sticky; top: 0; z-index: 5;
  backdrop-filter: blur(8px);
}
.bo-topbar h1 { margin: 0; font-size: 1.4rem; font-weight: 600; letter-spacing: -.01em; }

.bo-content { padding: 32px; max-width: 1200px; }

/* ==========================
   Common Components
   ========================== */
.bo-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.bo-card h2 { margin: 0 0 16px; font-size: 1.1rem; font-weight: 600; }
.bo-card h3 { margin: 0 0 12px; font-size: 1rem; font-weight: 600; }

.bo-grid { display: grid; gap: 16px; }
.bo-grid--2 { grid-template-columns: 1fr 1fr; }
.bo-grid--3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 800px) {
  .bo-grid--2, .bo-grid--3 { grid-template-columns: 1fr; }
}

.bo-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.bo-field label { font-size: .85rem; color: var(--c-ink-soft); font-weight: 500; }
.bo-field input, .bo-field textarea, .bo-field select {
  padding: 10px 12px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--c-surface);
  font: inherit; color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.bo-field input:focus, .bo-field textarea:focus, .bo-field select:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-accent) 20%, transparent);
}
.bo-field--inline { flex-direction: row; align-items: center; gap: 12px; }
.bo-field--inline label { margin: 0; min-width: 140px; }

.bo-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 18px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font: inherit; font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.bo-btn--primary { background: var(--c-ink); color: #fff; }
.bo-btn--primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(26,31,26,.18); }
.bo-btn--ghost { background: transparent; border-color: var(--c-line); color: var(--c-ink); }
.bo-btn--ghost:hover { background: var(--c-surface-2); }
.bo-btn--danger { background: var(--c-danger); color: #fff; }
.bo-btn--small { padding: 6px 12px; font-size: .85rem; }

.bo-table { width: 100%; border-collapse: collapse; }
.bo-table th, .bo-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--c-line); font-size: .92rem; }
.bo-table th { color: var(--c-ink-soft); font-weight: 500; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.bo-table tr:hover td { background: var(--c-surface-2); }

.bo-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: .75rem;
  font-weight: 500;
  background: var(--c-surface-2);
  border: 1px solid var(--c-line);
  color: var(--c-ink-soft);
}
.bo-badge--success { background: color-mix(in srgb, var(--c-success) 15%, var(--c-surface)); color: var(--c-success); border-color: color-mix(in srgb, var(--c-success) 30%, var(--c-line)); }
.bo-badge--warning { background: color-mix(in srgb, var(--c-warning) 15%, var(--c-surface)); color: #8c6d3f; border-color: color-mix(in srgb, var(--c-warning) 30%, var(--c-line)); }
.bo-badge--danger  { background: color-mix(in srgb, var(--c-danger) 15%, var(--c-surface)); color: var(--c-danger); border-color: color-mix(in srgb, var(--c-danger) 30%, var(--c-line)); }

.bo-flash {
  padding: 12px 18px;
  border-radius: var(--r-md);
  margin-bottom: 16px;
  font-size: .92rem;
  border: 1px solid var(--c-line);
}
.bo-flash--success { background: color-mix(in srgb, var(--c-success) 8%, var(--c-surface)); color: var(--c-success); border-color: color-mix(in srgb, var(--c-success) 30%, var(--c-line)); }
.bo-flash--error   { background: color-mix(in srgb, var(--c-danger) 8%, var(--c-surface));  color: var(--c-danger);  border-color: color-mix(in srgb, var(--c-danger) 30%, var(--c-line)); }
.bo-flash--info    { background: color-mix(in srgb, var(--c-accent) 8%, var(--c-surface));  color: var(--c-ink); }

.bo-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.bo-row--end { justify-content: flex-end; }
.bo-row--between { justify-content: space-between; }

.bo-color-input {
  display: flex; align-items: center; gap: 12px;
}
.bo-color-input input[type="color"] {
  width: 60px; height: 44px; padding: 0; border: 1px solid var(--c-line); border-radius: var(--r-md); cursor: pointer; background: var(--c-surface);
}

@media (max-width: 720px) {
  .bo { grid-template-columns: 1fr; }
  .bo-side { position: relative; height: auto; padding: 16px; }
  .bo-content { padding: 20px; }
  .bo-topbar { padding: 14px 20px; }
}

/* ── Login (Operator UND Kunde) ────────────────────────────────────────────────── */
.bo-login {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: var(--c-bg);
}
.bo-login__card {
  width: 100%; max-width: 380px;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: 0 4px 16px rgba(26,31,26,.07), 0 16px 40px rgba(26,31,26,.06);
}
.bo-login__brand { font-weight: 700; font-size: 1.15rem; }
.bo-login__sub   { color: var(--c-ink-soft); font-size: .88rem; margin: 2px 0 20px; }
.bo-login__err {
  background: #fbe7e5; border: 1px solid #e7bdb8; color: #8f231c;
  border-radius: var(--r-sm); padding: 9px 12px; font-size: .87rem; margin-bottom: 14px;
}
.bo-login__ok {
  background: #e6f0e8; border: 1px solid #bcd6c4; color: #2f5d3c;
  border-radius: var(--r-sm); padding: 9px 12px; font-size: .87rem; margin-bottom: 14px;
  line-height: 1.5;
}

/* Code-Eingabe: gross, weit gesperrt, Ziffern in gleicher Breite — damit man
   sechs Ziffern auch am Handy mit einem Blick prüfen kann. */
.bo-code {
  font-size: 1.5rem; letter-spacing: .22em; text-align: center;
  font-variant-numeric: tabular-nums;
}

.bo-login__alt {
  margin-top: 14px; text-align: center;
  font-size: .85rem; color: var(--c-ink-soft);
  display: flex; gap: 6px; justify-content: center; flex-wrap: wrap;
}
.bo-login__alt a { color: var(--c-ink-soft); }
/* Als Link gestalteter Submit-Button: der Wechsel zwischen Passwort und Code
   muss ein echtes POST sein (die E-Mail soll mitgehen), soll aber nicht wie
   eine zweite Hauptaktion aussehen. */
.bo-linkbtn {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; color: var(--c-ink-soft); text-decoration: underline;
}


/* ==========================
   Übersicht (partner/index.php)
   ========================== */

/* Zahl des Tages. Die ganze Karte ist der Link — auf einem Tablet ist ein
   fingerbreites Ziel mehr wert als eine unterstrichene Zeile. */
.db-kpi {
  display: flex; flex-direction: column; gap: 4px;
  text-decoration: none; color: inherit;
  transition: transform .12s ease, box-shadow .12s ease;
}
.db-kpi:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(26,31,26,.09); }
.db-kpi__num { font-size: 2rem; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
/* Offene Bestellungen sind der einzige Wert, der zum Handeln auffordert —
   deshalb bekommt nur er Farbe, und nur wenn er nicht null ist. */
.db-kpi__num.is-attention { color: var(--c-danger); }
.db-kpi__lbl { color: var(--c-ink-soft); font-size: .86rem; }

.db-h { margin: 34px 0 4px; font-size: 1.05rem; font-weight: 600; }
.db-sub { margin: 0 0 16px; color: var(--c-ink-soft); font-size: .88rem; max-width: 62ch; line-height: 1.55; }

/* Externe Ansicht: links Beschreibung und Adresse, rechts der QR-Code. */
.db-ext { display: flex; gap: 20px; align-items: flex-start; }
.db-ext__body { flex: 1 1 auto; min-width: 0; }
.db-ext__desc { margin: 0 0 12px; color: var(--c-ink-soft); font-size: .87rem; line-height: 1.5; }
.db-url {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .8rem; color: var(--c-ink-soft);
  background: var(--c-surface-2); border: 1px solid var(--c-line);
  border-radius: var(--r-sm); padding: 8px 10px; margin-bottom: 12px;
  word-break: break-all; user-select: all;
}
.db-qr { flex: 0 0 auto; line-height: 0; }
.db-qr img, .db-qr canvas { display: block; border-radius: 4px; }
@media (max-width: 640px) {
  /* Auf dem Handy wandert der QR nach unten — abscannen tut man ihn dort ohnehin
     nicht (man ist ja schon auf dem Gerät). */
  .db-ext { flex-direction: column; }
}

/* Themen-Gruppe: Ziel plus ein Halbsatz, wofür es gut ist. */
.db-links { display: flex; flex-direction: column; }
.db-link {
  display: block; padding: 9px 10px; margin: 0 -10px;
  border-radius: var(--r-sm); text-decoration: none; color: inherit;
}
.db-link:hover { background: var(--c-surface-2); }
.db-link strong { display: block; font-size: .92rem; font-weight: 550; }
.db-link small { color: var(--c-ink-soft); font-size: .79rem; }


/* ==========================================================
   Produkte (partner/menu.php) — Liste + Detail-Dialog
   ----------------------------------------------------------
   Ersetzt die alte, komplett aufgeklappte Seite: dort stand je
   Produkt ein Bündel aus 3–5 gleichzeitig sichtbaren Formularen,
   bei 147 Produkten (Buon Gusto) also mehrere hundert Formulare
   auf einer Seite. Neu: dichte Liste, Details im <dialog>.
   ========================================================== */

/* ── Toolbar ────────────────────────────────────────────── */
/* top:61px = Höhe der .bo-topbar (18px + 1.4rem-Zeile + 18px).
   Klebt darunter, damit Suche und Filter beim Scrollen bleiben. */
.bo-toolbar {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  position: sticky; top: 61px; z-index: 4;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: 12px 16px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.bo-toolbar__search {
  flex: 1; min-width: 180px;
  padding: 9px 14px;
  border: 1px solid var(--c-line); border-radius: var(--r-pill);
  font: inherit; background: var(--c-surface-2);
}
.bo-toolbar__search:focus {
  outline: none; border-color: var(--c-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-accent) 20%, transparent);
}
.bo-toolbar select {
  padding: 8px 10px; border: 1px solid var(--c-line);
  border-radius: var(--r-md); font: inherit; background: var(--c-surface);
}
.bo-toolbar__actions { margin-left: auto; display: flex; gap: 8px; }
@media (max-width: 900px) {
  .bo-toolbar { position: static; }
  .bo-toolbar__actions { margin-left: 0; width: 100%; }
  .bo-toolbar__actions .bo-btn { flex: 1; }
}

/* ── Produktliste ───────────────────────────────────────── */
.bo-plist { display: flex; flex-direction: column; }
/* Sieben Spalten, sieben Kinder je Zeile — MwSt. steht bewusst IM Preisfeld und
   ist keine eigene Spalte. Eine achte Spalte würde den Namen unter ~160px
   drücken; und ein Kind mehr als Spalten vorhanden sind, kippt die Aktionen
   stillschweigend in eine zweite Rasterzeile. */
.bo-plist__head, .bo-plist__row {
  display: grid;
  grid-template-columns: 36px minmax(0,1fr) 96px 62px 128px 84px auto;
  gap: 12px; align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--c-line);
}
.bo-plist__head {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--c-ink-soft); padding-top: 0;
}
.bo-plist__row:hover { background: var(--c-surface-2); }
.bo-plist__row--off { opacity: .55; }
/* Innerer Schatten statt border-left: sonst verschiebt der Balken die ganze Zeile. */
.bo-plist__row--soldout { box-shadow: inset 3px 0 0 var(--c-warning); }

/* Kategorie-Trennzeile, klebt am oberen Rand des Karten-Scrollbereichs. */
.bo-plist__group {
  position: sticky; top: 0; z-index: 1;
  background: var(--c-surface-2);
  border-top: 1px solid var(--c-line);
  border-bottom: 1px solid var(--c-line);
  padding: 6px 12px; margin-top: 4px;
  font-size: .74rem; font-weight: 600; color: var(--c-ink-soft);
  text-transform: uppercase; letter-spacing: .04em;
}
.bo-plist__thumb {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  object-fit: cover; background: var(--c-surface-2);
  display: flex; align-items: center; justify-content: center;
}
.bo-plist__thumb--empty { border: 1px dashed var(--c-line); font-size: 1rem; opacity: .6; }
/* Die Zellen sind <span>. Als Rasterkind werden sie automatisch zu Blöcken, ihre
   KINDER aber nicht — ohne das display hier bleiben Name und Beschreibung inline,
   laufen in einer Zeile ineinander und text-overflow:ellipsis greift nie. */
.bo-plist__main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.bo-plist__name {
  display: block;
  font-weight: 600; font-size: .92rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bo-plist__no { color: var(--c-ink-soft); font-variant-numeric: tabular-nums; }
.bo-plist__fav { color: var(--c-accent); }
.bo-plist__desc {
  display: block;
  font-size: .78rem; color: var(--c-ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Seltene Kennzeichen (Pfand/Freipreis/Milchmisch) als stille Text-Chips statt
   als farbige Badges — sonst ist die Liste Konfetti und nichts sticht mehr heraus. */
.bo-plist__chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.bo-plist__chip {
  font-size: .68rem; color: var(--c-ink-soft);
  border: 1px solid var(--c-line); border-radius: var(--r-pill);
  padding: 1px 7px; background: var(--c-surface-2);
}
.bo-plist__price {
  display: flex; flex-direction: column; align-items: flex-end; gap: 1px;
  font-variant-numeric: tabular-nums; font-weight: 600; font-size: .92rem;
}
.bo-plist__vat, .bo-plist__opts, .bo-plist__num { font-size: .72rem; color: var(--c-ink-soft); }
.bo-plist__vat { font-weight: 400; }
.bo-plist__num { text-align: right; font-variant-numeric: tabular-nums; }
.bo-plist__opts a { text-decoration: underline; }
.bo-plist__actions { display: flex; gap: 6px; justify-content: flex-end; }
.bo-plist__actions form { display: contents; }
/* Ohne nowrap brechen „Heute aus" und „Bearbeiten" um, sobald die Spalte eng
   wird — und ziehen die ganze Zeile auf doppelte Höhe. */
.bo-plist__actions .bo-btn { white-space: nowrap; }
/* Sortierpfeile schmal halten — sie stehen neben zwei Textknöpfen. */
.bo-plist__actions button[value="prod_up"],
.bo-plist__actions button[value="prod_down"] { padding: 6px 9px; font-size: .95rem; line-height: 1; }
.bo-plist__empty { padding: 24px 12px; color: var(--c-ink-soft); font-size: .9rem; }

/* Zwischenstufe: auf schmalen Laptops und im geteilten Fenster zuerst die beiden
   Nebeninformationen opfern. Sonst frisst die Spaltensumme die Namensspalte auf
   (minmax(0,1fr) wird dann wortwörtlich 0 breit) und der Name verschwindet. */
@media (max-width: 1200px) {
  .bo-plist__head, .bo-plist__row { grid-template-columns: 36px minmax(0,1fr) 96px 84px auto; }
  .bo-plist__num, .bo-plist__opts { display: none; }
  .bo-plist__head span:nth-child(4), .bo-plist__head span:nth-child(5) { display: none; }
}

@media (max-width: 900px) {
  .bo-plist__head { display: none; }
  .bo-plist__row {
    grid-template-columns: 44px minmax(0,1fr) auto;
    grid-template-areas: "img name price" "img badge badge" "act act act";
    row-gap: 6px; padding: 12px;
  }
  .bo-plist__thumb  { grid-area: img; width: 44px; height: 44px; align-self: start; }
  .bo-plist__main   { grid-area: name; }
  .bo-plist__price  { grid-area: price; }
  .bo-plist__status { grid-area: badge; }
  .bo-plist__actions { grid-area: act; justify-content: stretch; }
  /* Fingerbreite Ziele: das Backoffice läuft am Tresen auf Tablets, und
     bo-btn--small ist dort mit 32px zu knapp zum sicheren Treffen. */
  .bo-plist__actions .bo-btn { flex: 1; padding: 10px 12px; }
  .bo-plist__desc, .bo-plist__num, .bo-plist__opts, .bo-plist__vat { display: none; }
}

/* ── Detail-Dialog ──────────────────────────────────────── */
/* <dialog> statt Overlay-<div>: „Klick daneben schließt NICHT" ist damit der
   Normalzustand, kein Feature, das man bauen (und richtig hinbekommen) muss —
   genau die Anforderung. Fokusfalle und inerter Hintergrund kommen nativ mit. */
.bo-modal {
  padding: 0; border: 0;
  width: 100%; max-width: min(880px, calc(100vw - 32px));
  /* Oben verankert statt vom Browser vertikal zentriert (<dialog>-Vorgabe ist
     margin:auto). Sonst sitzt der Kopf je nach Inhaltsmenge auf einer anderen
     Höhe und der Dialog springt beim Wechsel zwischen einem kurzen und einem
     langen Formular — beim Öffnen aus derselben Liste besonders unruhig.
     Jetzt beginnt jeder Dialog an derselben Stelle und wächst nach unten. */
  margin: 6dvh auto auto;
  max-height: 88dvh;
  border-radius: var(--r-lg);
  background: var(--c-surface); color: var(--c-ink);
  box-shadow: 0 4px 16px rgba(26,31,26,.10), 0 24px 60px rgba(26,31,26,.18);
}
/* [open] setzt display:block und würde das flex sonst überschreiben. */
.bo-modal[open] { display: flex; flex-direction: column; }
.bo-modal::backdrop { background: color-mix(in srgb, var(--c-ink) 45%, transparent); }
/* Bekannte <dialog>-Lücke: sonst scrollt die Seite hinter dem Dialog mit. */
html:has(dialog[open]) { overflow: hidden; }

.bo-modal__head {
  position: relative; flex-shrink: 0;
  padding: 18px 22px 12px; border-bottom: 1px solid var(--c-line);
}
.bo-modal__title { margin: 0; font-size: 1.15rem; font-weight: 600; padding-right: 160px; }
.bo-modal__title:focus { outline: none; }
.bo-modal__sub { color: var(--c-ink-soft); font-size: .82rem; margin-top: 3px; }
.bo-modal__links { display: flex; gap: 14px; margin-top: 8px; font-size: .82rem; flex-wrap: wrap; }
.bo-modal__links a { color: var(--c-ink-soft); text-decoration: underline; }
.bo-modal__close {
  position: absolute; top: 14px; right: 16px;
  width: 30px; height: 30px; border: 0; border-radius: 50%;
  background: var(--c-surface-2); color: var(--c-ink-soft);
  font-size: 1rem; line-height: 1; cursor: pointer;
}
.bo-modal__close:hover { background: var(--c-line); color: var(--c-ink); }
/* Eigener Braunton statt --c-warning: der Token ist ein Flächenton (#d4a574) und
   als Textfarbe auf Weiß zu blass. Gleicher Wert wie .bo-badge--warning. */
.bo-modal__dirty { position: absolute; top: 19px; right: 56px; color: #8c6d3f; font-size: .76rem; }

.bo-modal__tabs {
  flex-shrink: 0; display: flex; gap: 4px;
  padding: 0 22px; border-bottom: 1px solid var(--c-line);
}
.bo-modal__tab {
  border: 0; background: none; font: inherit; font-size: .88rem; cursor: pointer;
  padding: 10px 14px; color: var(--c-ink-soft);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.bo-modal__tab.is-active { color: var(--c-ink); font-weight: 600; border-bottom-color: var(--c-accent); }
.bo-modal__tab[disabled] { opacity: .4; cursor: not-allowed; }

.bo-modal__body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 22px; }
.bo-modal__panel { display: none; }
.bo-modal__panel.is-active { display: block; }
.bo-modal__flash { margin: -4px 0 16px; }

.bo-modal__sect + .bo-modal__sect {
  margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--c-line);
}
.bo-modal__sect-h {
  font-size: .74rem; font-weight: 600; color: var(--c-ink-soft);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 12px;
}
.bo-modal__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 16px; }
.bo-modal__grid .is-w2   { grid-column: span 2; }
.bo-modal__grid .is-w3   { grid-column: span 3; }
.bo-modal__grid .is-full { grid-column: 1 / -1; }
.bo-modal__grid textarea { min-height: 78px; resize: vertical; max-width: 70ch; }
.bo-modal__hint { font-size: .8rem; color: var(--c-ink-soft); margin: -6px 0 14px; }

/* ── Allergene / Zusatzstoffe: zwei Spalten zum Abhaken ───────────────── */
.bo-alg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 28px; }
.bo-alg__h {
  font-size: .78rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--c-ink-soft); margin-bottom: 6px;
}
.bo-alg__item {
  display: flex; align-items: baseline; gap: 8px;
  padding: 4px 6px; border-radius: var(--r-md); cursor: pointer; font-size: .88rem;
}
.bo-alg__item:hover { background: var(--c-surface-2); }
.bo-alg__item input { margin: 0; flex-shrink: 0; }
/* Feste Breite, damit die Bezeichnungen trotz „10“–„14“ untereinander fluchten. */
.bo-alg__code {
  flex-shrink: 0; width: 1.6em; text-align: center;
  font-family: ui-monospace, monospace; font-size: .8rem;
  color: var(--c-ink-soft); background: var(--c-surface-2);
  border-radius: 4px; padding: 1px 0;
}
.bo-alg__item:has(input:checked) { background: color-mix(in srgb, var(--c-accent) 10%, transparent); }
.bo-alg__item:has(input:checked) .bo-alg__code { background: var(--c-accent); color: #fff; }
.bo-alg__item:has(input:checked) .bo-alg__lbl  { font-weight: 600; }
@media (max-width: 700px) { .bo-alg { grid-template-columns: 1fr; gap: 2px; } }
/* Checkbox-Zeile mit Erklärtext darunter, statt einer Reihe nackter Haken. */
.bo-modal__check { display: block; margin-bottom: 12px; font-size: .9rem; }
.bo-modal__check input { margin-right: 8px; }
.bo-modal__check small { display: block; margin: 2px 0 0 24px; color: var(--c-ink-soft); font-size: .78rem; }

/* Fav-Sortierung erscheint erst mit gesetztem Haken — ohne eine Zeile JS. */
.bo-fav__sub { display: none; }
.bo-fav:has(input[name="pos_favorite"]:checked) .bo-fav__sub { display: flex; }
/* Pfand-Auswahl nur zeigen, wenn der Artikel KEIN Pfandartikel selbst ist. */
.bo-dep__sub { display: block; }
.bo-dep:has(input[name="is_deposit"]:checked) .bo-dep__sub { display: none; }

.bo-modal__foot {
  flex-shrink: 0; display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding: 14px 22px; border-top: 1px solid var(--c-line);
  background: var(--c-surface-2);
}
.bo-modal__foot .is-right { margin-left: auto; display: flex; gap: 8px; }
.bo-modal__foot-note { font-size: .8rem; color: var(--c-ink-soft); }

/* Zeilen-Formulare im Dialog (Zutaten, Rohstoffe) */
.bo-mini__row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; margin-bottom: 6px; }
.bo-mini__row--add  { border-top: 1px dashed var(--c-line); padding-top: 10px; margin-top: 10px; }
.bo-mini__row--copy { margin-top: 8px; }
.bo-mini__row input, .bo-mini__row select {
  padding: 6px 9px; border: 1px solid var(--c-line);
  border-radius: var(--r-sm); font: inherit; background: var(--c-surface);
}
.bo-mini__name { flex: 1; min-width: 130px; font-weight: 600; }
.bo-mini__lbl  { display: flex; flex-direction: column; gap: 2px; font-size: .72rem; color: var(--c-ink-soft); }
.bo-mini__lbl input { width: 76px; }
.bo-mini__sel  { flex: 1; min-width: 180px; }
.bo-mini__unit { font-size: .74rem; color: var(--c-ink-soft); align-self: center; }
.bo-mini__cost { font-size: .74rem; color: var(--c-ink-soft); align-self: center; min-width: 74px; text-align: right; font-variant-numeric: tabular-nums; }

/* Kalkulations-Kasten */
.bo-calc { margin-top: 16px; padding: 12px 14px; border: 1px solid var(--c-line);
  border-radius: var(--r-md); background: var(--c-surface-2); }
.bo-calc__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.bo-calc__cell { display: flex; flex-direction: column; gap: 2px; }
.bo-calc__lbl { font-size: .72rem; color: var(--c-ink-soft); }
.bo-calc__val { font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.bo-calc__val--good { color: var(--c-success); }
.bo-calc__val--warn { color: #8c6d3f; }
.bo-calc__note { font-size: .76rem; color: var(--c-ink-soft); margin-top: 8px; }
@media (max-width: 700px) { .bo-calc__grid { grid-template-columns: repeat(2, 1fr); } }

.bo-imgpick { display: flex; gap: 16px; align-items: flex-start; }
.bo-imgpick__prev {
  width: 96px; height: 96px; flex: 0 0 auto;
  border-radius: var(--r-md); object-fit: cover;
  background: var(--c-surface-2); border: 1px dashed var(--c-line);
  display: flex; align-items: center; justify-content: center; font-size: 1.8rem;
}
.bo-imgpick__body { flex: 1; min-width: 0; }

@media (max-width: 700px) {
  /* Bottom-Sheet wie in der Kunden-App (app.css). */
  .bo-modal {
    max-width: 100vw; max-height: 92dvh;
    margin: auto auto 0;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    animation: boSlideUp .22s ease;
  }
  .bo-modal__grid { grid-template-columns: repeat(2, 1fr); }
  .bo-modal__grid .is-w2, .bo-modal__grid .is-w3 { grid-column: 1 / -1; }
  .bo-modal__foot .is-right { width: 100%; }
  .bo-modal__foot .is-right .bo-btn { flex: 1; }
  .bo-imgpick { flex-direction: column; }
}
@keyframes boSlideUp { from { transform: translateY(40px); opacity: 0 } to { transform: none; opacity: 1 } }

/* ==========================================================
   Navigationsgruppen (Partner-Backoffice)
   Die Seitenleiste war eine flache Liste aus zwanzig Punkten —
   man hat gesucht statt gefunden. Dieselbe Optik wie die
   Gruppenüberschriften im Operator-Panel (.ad-navgroup), damit
   beide Oberflächen sich gleich lesen.
   ========================================================== */
.bo-navgroup {
  margin: 18px 0 4px;
  padding: 0 12px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--c-ink-soft);
  opacity: .75;
}
.bo-navgroup:first-child { margin-top: 4px; }

/* ==========================================================
   Aufklappbereiche (natives <details>)
   Für lange Einstellungsseiten: sieht aus wie eine bo-card,
   klappt aber zu. Kein JavaScript — mit gleichem name="…" hält
   der Browser von selbst nur einen Bereich offen. Ältere
   Browser ohne name-Unterstützung öffnen mehrere; das ist
   unschön, aber nicht kaputt.
   ========================================================== */
.bo-acc {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.bo-acc > summary {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 18px 24px;
  cursor: pointer;
  list-style: none;            /* Standard-Dreieck weg … */
  transition: background .15s;
}
.bo-acc > summary::-webkit-details-marker { display: none; }  /* … auch in Safari */
.bo-acc > summary:hover { background: var(--c-surface-2); }
.bo-acc__title { font-size: 1.1rem; font-weight: 600; flex: 0 0 auto; }
/* Einzeiler zum Ist-Zustand — damit man zugeklappt sieht, was drinsteht. */
.bo-acc__sum {
  flex: 1; min-width: 0;
  font-size: .84rem; color: var(--c-ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Pfeil rechts, aus Rahmenlinien statt Zeichensatz (dreht beim Öffnen). */
.bo-acc__arrow {
  flex: 0 0 auto;
  margin-left: auto;
  width: 8px; height: 8px;
  border-right: 2px solid var(--c-ink-soft);
  border-bottom: 2px solid var(--c-ink-soft);
  transform: rotate(45deg);
  transition: transform .15s;
  align-self: center;
}
.bo-acc[open] > summary .bo-acc__arrow { transform: rotate(-135deg); }
.bo-acc[open] > summary { border-bottom: 1px solid var(--c-line); }
.bo-acc__body { padding: 20px 24px 24px; }
/* Innerhalb eines Aufklappbereichs trägt der Rahmen schon die Karte —
   verschachtelte bo-cards würden doppelt rahmen. */
.bo-acc__body > .bo-card { border: 0; box-shadow: none; padding: 0; margin: 0; }
@media (max-width: 700px) {
  .bo-acc > summary { padding: 14px 16px; flex-wrap: wrap; }
  /* Zusammenfassung rutscht auf die zweite Zeile, Pfeil bleibt oben rechts. */
  .bo-acc__sum { order: 3; flex-basis: 100%; white-space: normal; }
  .bo-acc__body { padding: 16px; }
}
