:root {
  --bg: #14171c;
  --panel: #1c2128;
  --panel-2: #232a33;
  --line: #2d3640;
  --text: #e6ebf0;
  --muted: #8a949f;
  --accent: #e8b04b;
  --accent-d: #c8902f;
  --green: #3fb950;
  --red: #e5534b;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 15px;
}
header {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 24px; background: var(--panel); border-bottom: 1px solid var(--line);
}
header h1 { font-size: 18px; margin: 0; }
header h1 .acc { color: var(--accent); }
nav {
  display: flex; gap: 4px; padding: 0 24px; background: var(--panel);
  border-bottom: 1px solid var(--line);
}
nav button {
  background: none; border: none; color: var(--muted); padding: 12px 16px;
  cursor: pointer; font-size: 14px; border-bottom: 2px solid transparent;
}
nav button.active { color: var(--accent); border-bottom-color: var(--accent); }
main { padding: 24px; max-width: 1100px; margin: 0 auto; }
.tab { display: none; }
.tab.active { display: block; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 18px;
}
.card h2 { margin: 0 0 14px; font-size: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input, select {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 9px 11px; font-size: 14px; width: 100%;
}
.field { flex: 1; min-width: 140px; }
button.btn {
  background: var(--accent); color: #1a1d22; border: none; border-radius: 8px;
  padding: 9px 16px; font-weight: 600; cursor: pointer; font-size: 14px;
}
button.btn:hover { background: var(--accent-d); }
button.btn:disabled { opacity: .4; cursor: not-allowed; background: var(--accent); }
button.ghost {
  background: transparent; border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 7px 12px; cursor: pointer; font-size: 13px;
}
button.ghost:hover { border-color: var(--accent); }
button.danger { color: var(--red); border-color: #4a2b2b; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
.sortth { background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
  color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; }
.sortth:hover { color: var(--text); }
.pill { padding: 2px 9px; border-radius: 999px; font-size: 12px; background: var(--panel-2); color: var(--muted); }
.pill.debt { background: #3a2a18; color: var(--accent); }
.pill.ok { background: #16301c; color: var(--green); }
.pill.out { background: #3a1c1a; color: var(--red); }
.product.is-out .pimg, .product.is-out .icon { filter: grayscale(1); opacity: .55; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.product {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-align: center;
}
.product .icon { font-size: 42px; line-height: 1; height: 110px; display: flex; align-items: center; justify-content: center; }
/* contain (nicht cover): zeigt das ganze 220x220-Bild, nichts wird abgeschnitten
   — wie auf dem Display. Weisser Hintergrund passend zum weissen Rand der Bilder. */
.product .pimg { width: 100%; height: 110px; object-fit: contain; border-radius: 8px; background: #fff; }
.product .prow { display: flex; gap: 6px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.product .name { font-weight: 600; margin: 8px 0 4px; }
.product .price { color: var(--accent); font-size: 18px; font-weight: 700; }
.product .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* Umschalter Kacheln/Liste */
.viewtoggle button.active { border-color: var(--accent); color: var(--accent); }
/* Listenansicht des Katalogs */
.catalog-list td:first-child, .catalog-list th:first-child { width: 56px; }
.lthumb { width: 44px; height: 44px; object-fit: contain; background: #fff; border-radius: 6px; display: block; }
.licon { font-size: 26px; }
.notice {
  background: #3a2a18; border: 1px solid var(--accent-d); color: var(--accent);
  padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px;
}
.muted { color: var(--muted); }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); padding: 12px 18px;
  border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.err { border-color: var(--red); color: #ffb3ae; }
dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; min-width: 320px;
}
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h3 { margin: 0 0 14px; }
#qrimg { display: block; margin: 14px auto; background: #fff; padding: 10px; border-radius: 8px; }
.edit-img { width: 180px; height: 180px; object-fit: contain; background: #fff; border-radius: 10px; }
.img-fig { margin: 0; text-align: center; }
.img-fig figcaption { font-size: 11px; margin-top: 4px; }
/* Vorschlag dezent als „neu" hervorheben */
#editCandFig .edit-img { box-shadow: 0 0 0 2px var(--accent); }
#editCandFig figcaption { color: var(--accent); }
#editDialog { width: 380px; max-width: 92vw; }
#historyDialog { width: 560px; max-width: 92vw; }
/* Abstand zwischen Betrag (€, rechtsbündig) und Scrollbalken */
#historyDialog th:last-child, #historyDialog td:last-child { padding-right: 18px; }
#loginOverlay {
  position: fixed; inset: 0; background: var(--bg); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
/* Untereinander mit festem Abstand statt einzelner Ränder. Passwort- und
   Codefeld stehen immer beide da (kein nachträgliches Einblenden mehr — das
   hat die Felder überlappen lassen); ohne eingerichtete 2FA ignoriert der
   Server den Code. */
.login-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px; width: 320px; max-width: 90vw; text-align: center;
  display: flex; flex-direction: column; gap: 8px;
}
.login-card h2 { margin: 0; }
.login-card > p.muted { margin: 0 0 4px; }
.login-card input { margin: 0; }
.login-card button { margin-top: 2px; width: 100%; }
/* Trennlinie zwischen Pocket-ID-Knopf und Passwort-Login: ──── oder mit Passwort ──── */
.login-card p.login-or { margin: 12px 0 4px; font-size: 13px; display: flex; align-items: center; gap: 10px; }
.login-card p.login-or::before,
.login-card p.login-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
#loginErr { color: #ffb3ae; min-height: 18px; margin: 0; }
/* Sicherheitsnetz: Ein verstecktes Feld darf nie Platz beanspruchen, auch wenn
   eine spätere Regel display setzen sollte. */
.login-card [hidden] { display: none !important; }
header #logoutBtn { margin-left: 12px; }

/* Kopfzeile = Name der Anlage, daneben der Stift zum Ändern. Der Stift bleibt
   dezent, bis die Maus darüber steht — er soll die Kopfzeile nicht dominieren. */
header h1 { display: flex; align-items: center; gap: 8px; }
header h1 .unnamed { color: var(--muted); }   /* kein Name vergeben -> Standardtitel als Platzhalter */
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0;
  background: none; border: 1px solid transparent; border-radius: 6px;
  color: var(--muted); cursor: pointer; opacity: .65;
}
.iconbtn:hover { color: var(--accent); border-color: var(--line); opacity: 1; }
.iconbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Eingabefeld steht an der Stelle der Überschrift (gleiche Zeile, gleiche Höhe). */
#nameForm { display: flex; align-items: center; gap: 8px; }
#nameForm input { width: 260px; max-width: 48vw; }
@media (max-width: 720px) { #nameForm input { width: 150px; } }

/* Nutzer-Reiter: Stift neben dem Namen. Immer sichtbar, aber zurückhaltend —
   versteckt auf Hover wäre auf einem Touchgerät nicht auffindbar. */
td[data-namecell] .iconbtn { width: 22px; height: 22px; vertical-align: middle; opacity: .45; }
tr:hover td[data-namecell] .iconbtn { opacity: .75; }
td[data-namecell] .iconbtn:hover { opacity: 1; }
td[data-namecell] .uname { margin-right: 6px; }
/* Eingabefeld an Ort und Stelle: die Zeile soll beim Öffnen nicht springen. */
.name-edit { display: flex; align-items: center; gap: 6px; }
.name-edit input { width: 100%; min-width: 120px; padding: 4px 8px; }
.name-edit .btn, .name-edit .ghost { padding: 4px 10px; font-size: 13px; white-space: nowrap; }

/* Wochenplan-Raster (Speisekarte) */
.menuweek { border-radius: 10px; padding: 2px 0; }
/* dezente Markierung der 2 aktiven KWs (Akzentfarbe, leicht getönt) */
.menuweek.active { background: rgba(232, 176, 75, .06); border: 1px solid rgba(232, 176, 75, .28); padding: 2px 10px 10px; }
.menuweek.active > h3 { color: var(--accent); }
.menugrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.menucell { border: 1px solid var(--line, #2a2a2a); border-radius: 8px; padding: 8px; min-height: 70px; background: var(--panel-2); }
.menucell-h { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.menudish { display: block; width: 100%; text-align: left; margin: 3px 0; padding: 5px 8px; border-radius: 6px;
  border: 1px solid var(--line, #333); background: var(--panel, #1c1c1c); color: var(--text, #eee); cursor: pointer; font-size: 13px; }
.menudish:hover { border-color: var(--accent); }
@media (max-width: 720px) { .menugrid { grid-template-columns: repeat(2, 1fr); } }

/* Speisekarte: Drag & Drop der Gerichte zwischen Tages-Lanes */
.menudish { cursor: grab; }
.menudish:active { cursor: grabbing; }
.menudish.dragging { opacity: .45; }

/* Ausgeblendete Produkte: im Admin ausgegraut, am Gerät nicht vorhanden */
.is-hidden { opacity: .45; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.checkline input { width: auto; margin: 0; }
.menucell.dropok { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); background: var(--panel, #1c1c1c); }

/* Kiosk-only-Betrieb (KM_KIOSK_ONLY): kein Stripe -> "Bezahlen"-Button ausblenden */

/* ── Nutzerverwaltung im Kaffemaschine-1-Stil ───────────────────────────── */
/* CSV-Export-Link im Button-Look (wie button.ghost) */
a.btnlink {
  display: inline-block; background: transparent; border: 1px solid var(--line);
  color: var(--text); border-radius: 8px; padding: 7px 12px; cursor: pointer;
  font-size: 13px; text-decoration: none;
}
a.btnlink:hover { border-color: var(--accent); }
/* Live-Update: geänderte Zeile kurz hervorheben (KM1: row.classList.add('flash')) */
@keyframes km-flash { from { background: rgba(240, 180, 90, .28); } to { background: transparent; } }
tr.flash td { animation: km-flash 1.5s ease-out; }
/* Gesamt-Zeile */
tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
/* Kiosk-only: kein Guthaben (Prepaid ist Badge-Modus) -> Spalte + Button ausblenden */
body.kiosk-only .col-credit, body.kiosk-only [data-credit] { display: none; }
/* −/+ Zähler-Buttons wie KM1 (.cnt-btn) */
.cnt-cell { display: inline-flex; align-items: center; gap: 6px; }
.cnt-btn {
  width: 26px; height: 26px; line-height: 1; padding: 0;
  background: transparent; border: 1px solid var(--line); color: var(--text);
  border-radius: 50%; cursor: pointer; font-size: 15px; font-weight: 700;
}
.cnt-btn:hover { border-color: var(--accent); }
.cnt-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ── System-Reiter: Gerätestatus und Update-Fortschritt ──────────────────── */
.statusbox {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; margin: 12px 0 0; font-size: 13px; white-space: pre-wrap;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
}
.progress {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px;
  height: 10px; overflow: hidden; margin: 14px 0 10px;
}
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .15s linear; }

/* ── Lager ──────────────────────────────────────────────────────────────── */
/* Bestandstafel: eine Zeile je Produkt, rechts das Zählwerk. Zahlen in einer
   Monospace-Schrift, damit sie in der Spalte wie auf einer Anzeigetafel stehen. */
.stock-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 14px; }
.stock-hint { max-width: 460px; margin: 0; font-size: 13px; }
.stock-list { display: flex; flex-direction: column; gap: 8px; }
.stock-row {
  display: grid; grid-template-columns: 52px 1fr 180px auto; align-items: center; gap: 16px;
  padding: 10px 14px 10px 10px; border-radius: 10px; background: var(--panel-2);
  border-left: 4px solid transparent; transition: background .15s, border-color .15s;
}
.stock-row:hover { background: #283039; }
.stock-row.is-out { border-left-color: var(--red); background: linear-gradient(90deg, rgba(229,83,75,.12), var(--panel-2) 45%); }
.stock-row.is-low { border-left-color: var(--accent); }
.stock-row.is-inf { opacity: .8; }
.stock-row .lthumb, .stock-row .licon { grid-column: 1; }
.stock-row.is-out .lthumb { filter: grayscale(1) brightness(.7); }
.stock-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stock-name b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stock-name .muted { font-size: 12px; }
.stock-level { height: 6px; border-radius: 3px; background: #0f1216; overflow: hidden; position: relative; }
.stock-level > i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--accent); transition: width .3s ease; }
.stock-row.is-out .stock-level > i { background: var(--red); width: 100%; opacity: .35; }
.stock-row.is-inf .stock-level { background: repeating-linear-gradient(90deg, #0f1216 0 6px, transparent 6px 10px); }
.stock-ctl { display: inline-flex; align-items: center; gap: 8px; justify-self: end; }
.stock-num {
  width: 92px; height: 40px; text-align: center; font: 600 22px/40px "IBM Plex Mono", ui-monospace, Menlo, monospace;
  letter-spacing: .5px; color: var(--text); background: #0f1216; border: 1px solid var(--line); border-radius: 8px;
  -moz-appearance: textfield;
}
.stock-num::-webkit-outer-spin-button, .stock-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stock-num:focus { outline: none; border-color: var(--accent); }
.stock-row.is-out .stock-num { color: var(--red); }
.stock-inf { width: 92px; height: 40px; display: inline-grid; place-items: center; font: 500 26px/1 "IBM Plex Mono", ui-monospace, monospace; color: var(--muted); }
.stock-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); font-size: 22px; line-height: 1; cursor: pointer; transition: border-color .12s, transform .08s;
}
.stock-btn:hover { border-color: var(--accent); }
.stock-btn:active { transform: scale(.94); }
.stock-btn:disabled { opacity: .3; cursor: not-allowed; }
.stock-state { min-width: 104px; text-align: center; }
.stock-more { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; padding: 4px 6px; }
.stock-more:hover { color: var(--text); text-decoration: underline; }
.stock-row.saving .stock-num { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232,176,75,.15); }
@media (max-width: 820px) { .stock-row { grid-template-columns: 44px 1fr auto; } .stock-level { display: none; } }

/* ── Monitoring ─────────────────────────────────────────────────────────────
   Diagnose aus der Ferne. Die Farbe trägt hier Bedeutung: grün heißt in Ordnung,
   gelb heißt hinsehen, rot heißt, hier ist etwas ausgefallen. Deshalb steht neben
   jeder Farbe auch ein Wort — wer Farben schlecht unterscheidet, liest es trotzdem. */
.monstat { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin: 14px 0; }
.montile {
  background: var(--panel-2); border: 1px solid var(--line); border-left-width: 3px;
  border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px;
}
/* Beschriftung und „i" in einer Zeile: sonst rutscht das Zeichen unter den Text
   und sieht aus wie ein Schrägstrich. */
.montile-k { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.montile-v { font-size: 15px; font-weight: 600; line-height: 1.35; }
.montile.is-ok   { border-left-color: var(--green); }
.montile.is-warn { border-left-color: var(--accent); }
.montile.is-bad  { border-left-color: var(--red); }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.dot.ok { background: var(--green); }
.dot.bad { background: var(--red); }
.monauto { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin: 0; }
.monauto input { width: auto; }

.monrow {
  border: 1px solid var(--line); border-left-width: 3px; border-left-color: var(--line);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--panel-2);
}
.monrow.warn { border-left-color: var(--accent); }
.monrow.bad  { border-left-color: var(--red); }
.monrow-h { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 4px; }
/* Zeitstempel im Befundkopf: rechts heraus, bricht bei Platzmangel um. */
.monrow-h .monstamp { margin-left: auto; white-space: nowrap; font-size: 12px; }
.monbar { height: 6px; background: var(--panel); border-radius: 999px; overflow: hidden; margin: 6px 0; }
.monbar > i { display: block; height: 100%; background: var(--accent); }

.monlog { margin-top: 12px; max-height: 460px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.monline {
  display: grid; grid-template-columns: 148px 78px 1fr; gap: 10px; align-items: baseline;
  padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.monline:last-child { border-bottom: none; }
.monline.warn { background: #2a2418; }
.monline.bad  { background: #2a1b19; }
.monline-t { color: var(--muted); font-variant-numeric: tabular-nums; }
.monline-k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.monline-m { word-break: break-word; }
.monline-s { grid-column: 3; font-size: 11px; }
@media (max-width: 720px) {
  .monline { grid-template-columns: 1fr; gap: 2px; }
  .monline-s { grid-column: 1; }
}

/* ── Erklärungen am „i" ─────────────────────────────────────────────────────
   Die Blase hängt an EINER Stelle am Seitenende und wird beim Überfahren
   positioniert. Läge sie in der Zeile, schnitte der scrollende Ereigniskasten
   sie ab. */
.info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  font-size: 11px; font-weight: 700; line-height: 1; cursor: help;
  vertical-align: middle; user-select: none;
}
.info:hover, .info:focus { color: var(--accent); border-color: var(--accent); outline: none; }
.montip {
  display: none; position: fixed; z-index: 400; max-width: 380px;
  background: #0f1216; color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.5;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .55); pointer-events: none;
  white-space: pre-line;
}

/* ── Befunde ── */
.monbefund p { margin: 4px 0 0; font-size: 13px; line-height: 1.55; }
.monok {
  margin: 0; padding: 12px 14px; border-radius: 10px; font-size: 14px;
  background: #16301c; color: var(--green); border: 1px solid #1f4429;
}
.monrow.ok { border-left-color: var(--green); }
.monrow.ack { opacity: .6; }
.monsum { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 4px 0 10px; }
.monsum button { margin-left: auto; }
.monh3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 14px 0 8px; }
.monbereich { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.monrow-f { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.monrow-f:empty { display: none; }
.monq, .monstamp-k { font-size: 12px; }
.monrow-f .monstamp-k { margin-right: auto; }
button.ghost.small { padding: 3px 10px; font-size: 12px; }
.pill.ok { background: #16301c; color: var(--green); }

/* ── Telefon und Tablet ───────────────────────────────────────────────────────
   Die Verwaltung wird auch vom Telefon aus bedient (Lager nachzählen, Karte
   zuordnen, nachsehen, ob der Kiosk lebt). Drei Dinge brachen bei 390 px:
   die Reiterleiste wurde nach dem vierten Reiter stumm abgeschnitten, die
   Nutzertabelle drückte ihre Knöpfe aus dem Bild, und lange Tabellen brachen
   Zeiten über zwei Zeilen. Die Regeln hier greifen nur unterhalb von 720 px
   bzw. bei Fingerbedienung; am Rechner ändert sich nichts. */

/* Reiterleiste: waagerecht wischbar statt abgeschnitten, bleibt beim Scrollen
   oben kleben, und ein Verlauf am rechten Rand verrät, dass dort noch etwas ist. */
nav {
  position: sticky; top: 0; z-index: 20;
  overflow-x: auto; overflow-y: hidden; flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
nav::-webkit-scrollbar { display: none; }
nav button { flex: none; white-space: nowrap; }
/* Der Verlauf am rechten Rand: klebt am sichtbaren Ende der Leiste und zeigt,
   dass dahinter noch Reiter liegen. Verschwindet, wenn ganz nach rechts gewischt
   ist (dann liegt er hinter dem letzten Knopf). */
nav::after {
  content: ''; position: sticky; right: 0; flex: none; align-self: stretch;
  width: 36px; margin-left: -36px; pointer-events: none; opacity: 0; transition: opacity .15s;
  background: linear-gradient(90deg, rgba(28, 33, 40, 0), var(--panel) 70%);
}
/* Nur sichtbar, wenn rechts wirklich noch Reiter liegen (Klasse setzt app.js). */
nav.has-more::after { opacity: 1; }

@media (max-width: 720px) {
  header { padding: 12px 16px; gap: 10px; }
  header h1 { font-size: 16px; }
  nav { padding: 0 12px; }
  nav button { padding: 12px 12px; font-size: 14px; }
  main { padding: 12px; }
  .card { padding: 14px; margin-bottom: 12px; }
  .card h2 { font-size: 15px; }

  /* Tabellen: die Karte scrollt seitlich, die Zeilen bleiben einzeilig. Lieber
     wischen als Knöpfe, die aus dem Bild fallen. */
  .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th, td { white-space: nowrap; padding: 9px 6px; }
  td button, td .cnt-cell { white-space: nowrap; }

  .stock-head { flex-direction: column; gap: 8px; }
  .stock-hint { max-width: none; }
  dialog {
    width: calc(100vw - 24px) !important; max-width: none !important; min-width: 0;
    max-height: 90vh; overflow: auto; padding: 16px;
  }
  .monstat { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .monline-t { font-size: 12px; }
}

@media (max-width: 480px) {
  /* Formulare untereinander: ein Feld je Zeile, Knöpfe in voller Breite. */
  .row { gap: 8px; }
  .row .field { min-width: 100%; }
  .row > button.btn, .row > button.ghost, .row > a.btnlink { width: 100%; text-align: center; }
  .row > .monauto { width: 100%; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .product { padding: 12px; }
  .product .icon, .product .pimg { height: 90px; }
  .monstat { grid-template-columns: 1fr; }
  .stock-row { grid-template-columns: 44px 1fr; gap: 10px 12px; padding: 10px; }
  .stock-ctl { grid-column: 1 / -1; justify-self: start; }
  .login-card { padding: 22px; }
}

/* Fingerbedienung: Ziele mindestens 40 px hoch, Eingabefelder 16 px Schrift,
   sonst zoomt iOS beim Antippen in das Feld hinein. */
@media (pointer: coarse) {
  button.btn, button.ghost, a.btnlink, .viewtoggle button { min-height: 40px; }
  input, select { min-height: 42px; font-size: 16px; }
  .cnt-btn { width: 34px; height: 34px; }
  nav button { min-height: 44px; }
  .info { width: 22px; height: 22px; font-size: 12px; }
}


/* ── Reiter „Funktionen": Fließtext aus FUNKTIONEN.md ───────────────────────── */
.doc { max-width: 760px; margin-left: auto; margin-right: auto; padding: 28px 32px; line-height: 1.6; font-size: 15px; }
.doc h2 { font-size: 24px; margin: 0 0 14px; }
.doc h2 ~ h2 { margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line); }
.doc h3 { font-size: 17px; margin: 28px 0 10px; color: var(--accent); }
.doc h4 { font-size: 15px; margin: 20px 0 6px; }
.doc p { margin: 0 0 12px; }
.doc p b { color: var(--text); }
.doc ul { margin: 0 0 12px 20px; padding: 0; }
.doc li { margin: 4px 0; }
.doc table { margin: 10px 0 16px; }
.doc th, .doc td { white-space: normal; vertical-align: top; }
.doc code { background: var(--panel-2); padding: 1px 6px; border-radius: 5px; font-size: 13px; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
.doc .doc-stand { font-size: 12px; margin-top: 28px; }
@media (max-width: 720px) { .doc { padding: 16px; font-size: 15px; } .doc h2 { font-size: 20px; } }

.doc-status {
  display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; margin: 0 0 18px; font-size: 14px;
}
.doc-status b { font-weight: 600; color: var(--muted); margin-right: 4px; }
.doc-sep { color: var(--line); }
.doc-hint {
  background: #3a2a18; border: 1px solid var(--accent-d); color: var(--accent);
  border-radius: 8px; padding: 10px 14px; margin: -8px 0 18px; font-size: 14px;
}
.pill.new { background: #3a2a18; color: var(--accent); vertical-align: middle; font-weight: 500; }
.doc h4 .pill { margin-left: 6px; font-size: 11px; }
