:root {
  --bg: #f6f7f9; --flaeche: #ffffff; --text: #1d2330; --leise: #5d6675; --linie: #e2e5ea;
  --akzent: #1f6feb; --akzent-text: #ffffff; --ok: #1a7f37; --warn: #9a6700; --fehler: #cf222e;
  --ok-bg: #dafbe1; --warn-bg: #fff8c5; --fehler-bg: #ffebe9; --zeile: #f3f5f8;
  --radius: 10px; --schatten: 0 1px 2px rgba(0,0,0,.06), 0 1px 8px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root:not(.portal-hell) {   /* Kundenseiten mit html.portal-hell bleiben hell (portal/basis.html) */
    --bg: #0f1115; --flaeche: #171a21; --text: #e6e9ef; --leise: #9aa3b2; --linie: #2a2f3a;
    --akzent: #4c8dff; --ok: #3fb950; --warn: #d29922; --fehler: #f85149;
    --ok-bg: #12261a; --warn-bg: #2a2410; --fehler-bg: #2d1416; --zeile: #1c2029;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--akzent); text-decoration: none; }
a:hover { text-decoration: underline; }
/* Kopf mit Menü immer über der Seite (auch über feststehende Seitenleisten und Karten); Seiten-Elemente bleiben unter 100 */
header { background: var(--flaeche); border-bottom: 1px solid var(--linie); position: sticky; top: 0; z-index: 1000; }
/* Sprungziele (#anker) nicht unter der festen Menüleiste verstecken – alle Seiten */
[id] { scroll-margin-top: calc(var(--kopf-hoehe, 0px) + 12px); }
.leaflet-container { isolation: isolate; z-index: 0; }   /* Karten-Ebenen (bis z-index 1000) bleiben innerhalb der Karte */
nav { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px 16px; }
nav .marke { font-weight: 700; margin-right: 8px; white-space: nowrap; }
/* Instanzname (WAESCHEREI_INSTANZ, z. B. „Hannover“) neben der Marke – nur bei gesetztem Namen, damit niemand die Instanzen verwechselt */
.instanz-schild { display: inline-flex; align-items: center; padding: 2px 10px; margin-right: 8px; border-radius: 99px;
  border: 1.5px solid var(--akzent); color: var(--akzent); background: var(--flaeche); font-size: 12px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.menue-punkte { display: contents; }
.menue-knopf { display: none; }
/* Menügruppen mit Aufklappliste */
details.menue { position: relative; }
details.menue > summary { list-style: none; padding: 10px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; min-height: 44px;
  display: inline-flex; align-items: center; gap: 4px; }
details.menue > summary::-webkit-details-marker { display: none; }
details.menue > summary::after { content: "▾"; font-size: 11px; color: var(--leise); }
details.menue > summary.aktiv, details.menue > summary:hover, details.menue[open] > summary { background: var(--zeile); }
details.menue > summary.aktiv { font-weight: 650; }
.menue-liste { position: absolute; top: calc(100% + 4px); left: 0; z-index: 20; min-width: 230px; display: flex; flex-direction: column;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0,0,0,.14); padding: 6px; }
.menue-liste a { justify-content: flex-start; }
[data-bedienung="maus"] details.menue > summary { min-height: 34px; padding: 6px 10px; }
/* Schnellsuche im Kopf */
.schnellsuche { position: relative; margin-left: 8px; }
.schnellsuche input { min-width: 0; width: 240px; }
.schnell-treffer { position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; width: min(460px, 92vw); max-height: 70vh; overflow-y: auto;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0,0,0,.14); padding: 6px; }
.schnell-treffer .gruppe { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--leise); padding: 6px 8px 2px; }
.schnell-treffer a { display: block; padding: 7px 8px; border-radius: 6px; color: var(--text); }
.schnell-treffer a:hover, .schnell-treffer a.gewaehlt { background: var(--zeile); text-decoration: none; }
@media (max-width: 760px) {
  .menue-knopf { display: inline-flex; }
  .menue-punkte { display: none; }
  nav.offen .menue-punkte { display: flex; flex-direction: column; align-items: stretch; width: 100%; order: 10; }
  nav.offen .menue-liste { position: static; box-shadow: none; border: 0; padding: 0 0 0 14px; }
  .schnellsuche { order: 5; flex: 1; } .schnellsuche input { width: 100%; }
  .bedienung-schalter, nav .abstand { display: none; }
}
nav a { padding: 10px 14px; border-radius: 8px; color: var(--text); white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; }
nav a.aktiv, nav a:hover { background: var(--zeile); text-decoration: none; }
main { max-width: 1400px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 24px; margin: 4px 0 16px; }
h2 { font-size: 18px; margin: 28px 0 10px; }
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 16px; box-shadow: var(--schatten); }
.raster { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.kz .wert { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }
.kz .label { color: var(--leise); font-size: 13px; }
.leise { color: var(--leise); }
/* Kunden- und Artikelnummern immer gut sichtbar vor dem Namen */
.nummer { display: inline-block; font-variant-numeric: tabular-nums; font-weight: 700; background: var(--zeile);
          border: 1px solid var(--linie); border-radius: 6px; padding: 0 6px; margin-right: 4px; }
.klein { font-size: 13px; }
table { width: 100%; border-collapse: collapse; background: var(--flaeche); }
.tabelle { border: 1px solid var(--linie); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--schatten); }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--linie); text-align: left; vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--leise); background: var(--zeile);
     position: sticky; top: var(--th-top, var(--kopf-hoehe, 0px)); z-index: 2; }
/* Spaltenköpfe bleiben beim Scrollen der Seite stehen: dafür darf .tabelle kein eigener Scrollbereich sein (nur am Handy) */
@media (min-width: 901px) { .tabelle { overflow: visible; } }
@media (max-width: 900px) { th { top: 0; } }   /* .tabelle scrollt hier selbst – Kopf bleibt oben im Rahmen */
.tabelle tbody tr:nth-child(even) { background: rgba(127, 127, 127, .035); }
.tabelle tbody tr:hover { background: var(--zeile); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--zeile); }
/* Lange Listen als scrollbare Unterliste (ca. 20 Zeilen sichtbar, Kopfzeile bleibt oben im Rahmen), damit Knöpfe
   unter der Liste ohne endloses Scrollen erreichbar sind. Nutzung: <div class="tabelle scrollliste"><table>…
   Die Scrollposition im Rahmen stellt position.js nach dem Speichern wieder her. */
.scrollliste, .tabelle.scrollliste { max-height: min(calc(20 * 2.65em + 2.6em), 75vh); overflow: auto;
  border: 1px solid var(--linie); border-radius: var(--radius); }
.scrollliste thead th { top: 0; z-index: 3; box-shadow: inset 0 -1px 0 var(--linie); }   /* Linie bleibt mit dem Kopf stehen */
@media (max-width: 640px) { .scrollliste, .tabelle.scrollliste { max-height: 60vh; } }
/* Zeilen in Unterlisten kompakt: Auswahlkästchen nicht auf Eingabefeld-Höhe (44 px) aufblähen, Knöpfe in Zeilen niedriger */
.scrollliste td, .scrollliste th { padding-top: 5px; padding-bottom: 5px; }
.scrollliste input[type=checkbox] { min-height: 0; width: 18px; height: 18px; padding: 0; margin: 0; vertical-align: middle; }
[data-bedienung="touch"] .scrollliste input[type=checkbox] { width: 24px; height: 24px; }
[data-bedienung="maus"] .scrollliste td .knopf, [data-bedienung="maus"] .scrollliste td button { min-height: 26px; padding: 2px 10px; }
/* Knopf-Auswahl mit vielen Einträgen (z. B. Preislisten): Kasten mit ca. 6–8 Zeilen, scrollbar, Suchfeld davor (auswahlbox.js) */
.listenwahl { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 0 0 6px; }
.wahlbox { position: relative; display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; max-height: min(19rem, 45vh); overflow: auto;
  padding: 8px; margin: 0 0 12px; border: 1px solid var(--linie); border-radius: var(--radius); background: var(--flaeche); }
.wahlbox .knopf.haupt .nummer { color: var(--text); }
.wahlbox .knopf.haupt .leise { color: inherit; opacity: .85; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tfoot td { font-weight: 650; background: var(--zeile); }
form.filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 14px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--leise); }
input, select, textarea { font: inherit; color: var(--text); background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px; padding: 10px 12px; min-height: 44px; }
input[type=search] { min-width: 260px; }
button, .knopf { font: inherit; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 10px 16px;
  border-radius: 8px; border: 1px solid var(--linie); background: var(--flaeche); color: var(--text); cursor: pointer; }
button.haupt, .knopf.haupt { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.knopf:hover { text-decoration: none; filter: brightness(.97); }
.marker { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.marker.ok { background: var(--ok-bg); color: var(--ok); }
.marker.warn { background: var(--warn-bg); color: var(--warn); }
.marker.fehler { background: var(--fehler-bg); color: var(--fehler); }
/* Kennzeichen „Annahmestelle“ (_makros.annahmestelle_marker, suchfeld.js) */
.marker.annahme { background: color-mix(in srgb, var(--akzent) 14%, transparent); color: var(--akzent); white-space: nowrap; }
a.marker.annahme:hover { text-decoration: none; filter: brightness(.95); }
.hinweis { padding: 12px 14px; border-radius: var(--radius); margin: 0 0 16px; border: 1px solid var(--linie); }
.hinweis.warn { background: var(--warn-bg); }
.feiertag-weg { float: right; margin: -4px -6px 0 8px; padding: 2px 8px; border: 0; background: none; cursor: pointer;
  font-size: 16px; line-height: 1; color: var(--leise, #666); border-radius: var(--radius); }
.feiertag-weg:hover { background: rgba(0,0,0,.08); color: inherit; }
.hinweis.ok { background: var(--ok-bg); }
.hinweis.fehler { background: var(--fehler-bg); border-color: var(--fehler); }
/* helfer.meldung(): kurze Meldung unten am Bildschirm */
.helfer-meldung { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 60; margin: 0;
  max-width: min(560px, 92vw); box-shadow: var(--schatten); background: var(--flaeche); }
.helfer-meldung.fehler { border-color: var(--fehler); }
.helfer-meldung[hidden] { display: none; }
.zwei { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
dl.daten { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
dl.daten dt { color: var(--leise); }
dl.daten dd { margin: 0; }
.balken { height: 8px; background: var(--akzent); border-radius: 4px; min-width: 2px; }
.aktionen { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.formular { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.seiten { display: flex; gap: 8px; margin-top: 12px; }
mark { background: #fff3b0; color: inherit; padding: 0 1px; border-radius: 2px; }
@media (prefers-color-scheme: dark) { :root:not(.portal-hell) mark { background: #5a4a00; } }
.inaktiv { opacity: .6; }
.inaktiv:hover { opacity: 1; }
.knopf.verlauf { min-height: 32px; padding: 4px 12px; font-size: 14px; }
[data-bedienung="touch"] .knopf.verlauf { min-height: 44px; padding: 8px 14px; font-size: 15px; }
button.gefahr, .knopf.gefahr { color: var(--fehler); border-color: var(--fehler); }
textarea { width: 100%; min-height: 0; }

/* ---------- Bedienart: Touch (Standard, große Ziele) oder Maus/Tastatur (kompakt) ---------- */
.bedienung-schalter { margin-left: auto; white-space: nowrap; }
nav a.ohne-anmeldung { font-size: .85em; color: var(--warn-text, #8a5300); }   /* statt Hinweis auf jeder Seite */
[data-bedienung="touch"] .nur-maus, [data-bedienung="maus"] .nur-touch { display: none !important; }
[data-bedienung="maus"] body { font-size: 14px; }
[data-bedienung="maus"] nav a { min-height: 34px; padding: 6px 10px; }
[data-bedienung="maus"] input, [data-bedienung="maus"] select, [data-bedienung="maus"] textarea { min-height: 32px; padding: 5px 8px; }
[data-bedienung="maus"] button, [data-bedienung="maus"] .knopf { min-height: 32px; padding: 5px 12px; }
[data-bedienung="maus"] th, [data-bedienung="maus"] td { padding: 5px 8px; }
[data-bedienung="maus"] .karte { padding: 12px; }
[data-bedienung="maus"] h1 { font-size: 21px; margin-bottom: 12px; }
[data-bedienung="maus"] .kz .wert { font-size: 22px; }

@media (max-width: 640px) { input[type=search] { min-width: 0; width: 100%; } h1 { font-size: 20px; } }

/* Hilfeblase (? neben Suchfeldern) */
.hilfe-wrap { position: relative; display: inline-block; }
.hilfe-knopf { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--linie); background: var(--flaeche);
  font-weight: 700; font-size: 13px; line-height: 1; cursor: pointer; color: inherit; padding: 0; vertical-align: middle; }
html[data-bedienung="touch"] .hilfe-knopf { width: 34px; height: 34px; font-size: 17px; }
.hilfe-blase { position: absolute; z-index: 50; top: calc(100% + 8px); left: -12px; width: min(420px, 90vw);
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten);
  padding: 10px 12px; font-size: 13px; font-weight: normal; }
.hilfe-blase::before { content: ""; position: absolute; top: -7px; left: 18px; width: 12px; height: 12px; background: var(--flaeche);
  border-left: 1px solid var(--linie); border-top: 1px solid var(--linie); transform: rotate(45deg); }
.hilfe-blase table { width: 100%; border-collapse: collapse; margin: 4px 0; }
.hilfe-blase td { padding: 3px 6px; border-top: 1px solid var(--linie); vertical-align: top; }
.hilfe-blase code { font-weight: 700; white-space: nowrap; }

/* Benutzer ohne Recht "preise": Preise/Beträge ausblenden */
[data-preise="nein"] .preis { display: none !important; }

/* ---------- Drucken: nur der Inhalt, ohne Menü, Knöpfe, Filter und Hinweis-Banner ---------- */
.nur-druck { display: none; }
@media print {
  :root { --bg: #fff; --flaeche: #fff; --text: #000; --leise: #444; --linie: #bbb; --zeile: #f0f0f0; --akzent: #000; --schatten: none; }
  header, .nicht-drucken, form.filter, .aktionen, .hilfe-wrap, .hilfe-blase, .banner, button, .knopf, .sprung, .leiste,
  .bedienung-schalter, #meldung { display: none !important; }
  .nur-druck { display: block !important; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  main { max-width: none; padding: 0 !important; }
  .karte, .tabelle { box-shadow: none; }
  .tabelle, .scrollliste, .tabelle.scrollliste { overflow: visible; border: 0; max-height: none; }
  .listenwahl, .wahlbox { display: none; }
  th { position: static; }
  thead { display: table-header-group; }
  tr, .karte { break-inside: avoid; }
  a { color: inherit; }
  .kopf-kunde { position: static !important; }
}

/* Tages-/Gruppen-Zwischenzeilen in Listen */
tr.tageszeile td { background: var(--zeile); padding-top: 10px; }
.tabelle tbody tr.tageszeile:hover { background: none; }

/* Schmale Bildschirme: Eingabezeilen umbrechen statt die Seite zu verbreitern */
@media (max-width: 640px) {
  main input, main select { min-width: 0; max-width: 100%; }
  form.filter > *, .scanzeile > * { min-width: 0; }
  main { padding-left: 10px; padding-right: 10px; }
}

/* Reiter (z. B. Einstellungen) */
nav.reiter { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--linie); margin: -4px 0 16px; padding: 0; }
nav.reiter a { padding: 10px 16px; border-radius: 8px 8px 0 0; color: var(--text); border: 1px solid transparent; border-bottom: 0;
  margin-bottom: -1px; white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; }
nav.reiter a:hover { background: var(--zeile); text-decoration: none; }
nav.reiter a.aktiv { background: var(--flaeche); border-color: var(--linie); font-weight: 650; }
[data-bedienung="maus"] nav.reiter a { min-height: 34px; padding: 6px 12px; }
@media print { nav.reiter { display: none; } }

/* Artikel-Schnellsuche: Treffer als Knopfleiste */
#suchergebnis { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; max-height: 40vh; overflow-y: auto; }
#suchergebnis > div, #suchergebnis > p { flex-basis: 100%; margin: 0; }
button.artikel-treffer { justify-content: flex-start; text-align: left; }

/* Live-Suche (static/suchfeld.js): Trefferliste, Knöpfe, mit Pfeiltasten gewählter Treffer */
.suchliste { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; max-height: 40vh; overflow-y: auto; }
#suchergebnis .suchliste { margin-top: 0; max-height: none; }
.suchliste a.artikel-treffer { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 14px;
  border: 1px solid var(--linie); border-radius: 8px; color: var(--text); background: var(--flaeche); }
.suchliste a.artikel-treffer:hover { text-decoration: none; background: var(--zeile); }
[data-bedienung="maus"] .suchliste a.artikel-treffer { min-height: 34px; padding: 5px 10px; }
.suchtreffer .gewaehlt, .suchliste .gewaehlt, .raster .karte.gewaehlt { outline: 2px solid var(--akzent); outline-offset: 1px; }

/* Lieferschein-Korrektur: Bezeichnung je Zeile änderbar */
input.bez-feld { width: 100%; min-height: 30px; padding: 3px 8px; font-size: 13px; margin-top: 4px; }

/* Testkunden (neukunde.py, Schalter „Test“): auffälliges Band auf jeder Seite des Kunden */
.test-band { background: #cc0000; color: #fff; font-weight: 800; letter-spacing: .2em; text-align: center; padding: 6px; border-radius: var(--radius); margin-bottom: 12px; }
/* Erbe von der Gesellschaft (docs/aenderungen/gesellschaft.md): leeres Filialfeld zeigt den geerbten Wert leicht grau als
   Platzhalter; überschriebene Felder haben den kleinen Knopf „↺ von Gesellschaft übernehmen“ */
input.geerbt, textarea.geerbt, select.geerbt { background: var(--zeile); border-style: dashed; }
input.geerbt::placeholder, textarea.geerbt::placeholder { color: var(--leise); opacity: .85; }
.erbe-eigen { display: flex; align-items: center; gap: 6px; font-weight: normal; color: var(--leise); }
button.erbe-zurueck { min-height: 0; padding: 2px 8px; font-size: 12px; border-radius: 99px; }

/* ---------- Menü-Position (Mein Konto → Darstellung, docs/aenderungen/menue-position.md) ----------
   oben = <body> ohne Klasse, alles wie bisher. unten/links/rechts: Klasse am <body>, gleiches Menü-HTML, nur CSS. */
.menue-wahl { display: inline-flex; align-items: center; margin: 0; }
.menue-wahl select { width: auto; padding: 2px 6px; font-size: .9em; }
/* Auswahl auf „Mein Konto“ mit kleinem Bild je Position */
.menue-auswahl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.menue-option { flex-direction: row; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--linie);
  border-radius: 8px; color: var(--text); font-size: 15px; cursor: pointer; }
.menue-option:has(input:checked) { border-color: var(--akzent); background: color-mix(in srgb, var(--akzent) 8%, transparent); }
.menue-option input { min-height: 0; width: 18px; height: 18px; margin: 0; padding: 0; flex: none; }
.menue-bild { position: relative; flex: none; width: 34px; height: 26px; border: 1.5px solid var(--leise); border-radius: 4px; overflow: hidden; }
.menue-bild i { position: absolute; background: var(--akzent); }
.menue-bild-oben i { left: 0; right: 0; top: 0; height: 6px; }
.menue-bild-unten i { left: 0; right: 0; bottom: 0; height: 6px; }
.menue-bild-links i { top: 0; bottom: 0; left: 0; width: 9px; }
.menue-bild-rechts i { top: 0; bottom: 0; right: 0; width: 9px; }

/* unten: feste Leiste am unteren Rand, Listen öffnen nach oben, Inhalt bekommt unten Platz */
body.menue-unten header { position: fixed; top: auto; bottom: 0; left: 0; right: 0; border-bottom: 0; border-top: 1px solid var(--linie);
  box-shadow: 0 -2px 10px rgba(0,0,0,.06); padding-bottom: env(safe-area-inset-bottom, 0px); }
body.menue-unten main { padding-bottom: calc(var(--menue-hoehe, 60px) + 60px); }
body.menue-unten .menue-liste, body.menue-unten .schnell-treffer { top: auto; bottom: calc(100% + 4px); }
body.menue-unten .menue-liste { max-height: calc(100vh - var(--menue-hoehe, 60px) - 16px); overflow-y: auto; }
body.menue-unten .schnell-treffer { max-height: calc(100vh - var(--menue-hoehe, 60px) - 16px); }
body.menue-unten details.menue > summary::after { content: "▴"; }
body.menue-unten .helfer-meldung { bottom: calc(var(--menue-hoehe, 60px) + 24px); }
body.menue-unten #ziffernblock { bottom: calc(var(--menue-hoehe, 60px) + 16px); }
body.menue-unten .leiste { bottom: var(--menue-hoehe, 60px); }   /* Summenleiste der Erfassung (sticky) über dem Menü */
/* Bildschirmtastatur offen: sie sitzt selbst unten -> Menü ausblenden; liegt das Feld im Menü (Schnellsuche), steht es über ihr */
body.menue-unten.tastatur-offen header:not(:focus-within) { display: none; }
body.menue-unten.tastatur-offen header:focus-within { bottom: var(--tastatur-hoehe, 400px); }
body.menue-unten.tastatur-offen .leiste { bottom: 0; }

@media (max-width: 760px) {
  .menue-wahl { display: none; }
  nav.offen .menue-wahl { display: flex; order: 6; flex-basis: 100%; }
  nav.offen .menue-wahl select { flex: 1; }
  /* Menü unten am Handy: aufgeklappte Liste über der Leiste, bei Bedarf scrollbar */
  body.menue-unten header nav.offen .menue-punkte { order: -1; }
  body.menue-unten header:has(> nav.offen) { max-height: 100vh; overflow-y: auto; }
}

/* links/rechts: senkrechte Seitenleiste, Gruppen klappen auf (schnellsuche.js), Inhalt rückt daneben.
   Unter 901 px (Handy, Tablet hochkant) gilt das nicht -> Menü wie „oben“, am Handy mit ☰. */
@media (min-width: 901px) {
  body.menue-links, body.menue-rechts { --seitenleiste: 220px; }
  body.menue-links { padding-left: var(--seitenleiste); }
  body.menue-rechts { padding-right: var(--seitenleiste); }
  body.menue-links header, body.menue-rechts header { position: fixed; top: 0; bottom: 0; width: var(--seitenleiste);
    overflow-y: auto; overscroll-behavior: contain; border-bottom: 0; }
  body.menue-links header { left: 0; border-right: 1px solid var(--linie); }
  body.menue-rechts header { right: 0; border-left: 1px solid var(--linie); }
  body.menue-links header nav, body.menue-rechts header nav { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 2px; padding: 10px; min-height: 100%; }
  body.menue-links header nav > *, body.menue-rechts header nav > * { order: 5; }
  body.menue-links header nav > .marke, body.menue-rechts header nav > .marke, body.menue-links header nav > .instanz-schild, body.menue-rechts header nav > .instanz-schild { order: 0; }
  body.menue-links header nav > .schnellsuche, body.menue-rechts header nav > .schnellsuche { order: 1; }
  body.menue-links header nav > .menue-punkte, body.menue-rechts header nav > .menue-punkte { order: 2; }
  body.menue-links header nav > .abstand, body.menue-rechts header nav > .abstand { order: 3; min-height: 12px; }
  body.menue-links header nav .marke, body.menue-rechts header nav .marke { margin-right: 0; font-size: 17px; }
  body.menue-links .instanz-schild, body.menue-rechts .instanz-schild { align-self: flex-start; margin: 0 0 4px; }
  body.menue-links .menue-punkte, body.menue-rechts .menue-punkte { display: flex; flex-direction: column; gap: 2px; }
  body.menue-links header nav a, body.menue-rechts header nav a { white-space: normal; justify-content: flex-start; }
  body.menue-links details.menue > summary, body.menue-rechts details.menue > summary { display: flex; justify-content: space-between; white-space: normal; }
  body.menue-links details.menue[open] > summary::after, body.menue-rechts details.menue[open] > summary::after { content: "▴"; }
  body.menue-links .menue-liste, body.menue-rechts .menue-liste { position: static; min-width: 0; box-shadow: none; border: 0;
    border-left: 2px solid var(--linie); border-radius: 0; padding: 2px 0 2px 6px; margin: 2px 0 6px 12px; background: transparent; }
  body.menue-links .schnellsuche, body.menue-rechts .schnellsuche { margin: 6px 0; }
  body.menue-links .schnellsuche input, body.menue-rechts .schnellsuche input { width: 100%; min-width: 0; }
  /* Treffer der Schnellsuche neben der Leiste (die Leiste selbst scrollt und würde sie abschneiden) */
  body.menue-links .schnell-treffer, body.menue-rechts .schnell-treffer { position: fixed; top: 8px;
    width: min(460px, calc(100vw - var(--seitenleiste) - 24px)); max-height: calc(100vh - 16px); }
  body.menue-links .schnell-treffer { left: calc(var(--seitenleiste) + 8px); }
  body.menue-rechts .schnell-treffer { left: auto; right: calc(var(--seitenleiste) + 8px); }
  body.menue-links .bedienung-schalter, body.menue-rechts .bedienung-schalter { margin-left: 0; justify-content: center; }
  body.menue-links .filial-wahl, body.menue-rechts .filial-wahl, body.menue-links .menue-wahl, body.menue-rechts .menue-wahl { display: flex !important; }
  body.menue-links .filial-wahl select, body.menue-rechts .filial-wahl select,
  body.menue-links .menue-wahl select, body.menue-rechts .menue-wahl select { width: 100% !important; flex: 1; }
  /* Bildschirmtastatur und Ziffernblock bleiben über bzw. neben der Leiste bedienbar */
  body.menue-links #tastatur, body.menue-rechts #tastatur { z-index: 1001; }
  body.menue-rechts #ziffernblock { right: calc(var(--seitenleiste) + 16px); }
}
@media print { body.menue-links, body.menue-rechts { padding: 0 !important; } body.menue-unten main { padding-bottom: 0; } }

/* Beleg-Positionen: aus den Anomalien angesprungener Artikel (auftrag.html, ?artikel=) */
tr.markiert td { background: rgba(255, 196, 0, .22); }
tr.markiert td:first-child { box-shadow: inset 3px 0 0 #d99a00; }

/* ---- Mengenfelder im Touch-Modus (static/mengen.js, docs/aenderungen/mengen-touch.md): großes − / Zahl / +, Zahlen-Popup
   wie in der Kassen-Demo. Nur Zeilen mit .mg-zeile (von mengen.js umgebaut); der Maus-Modus bleibt unverändert. */
[data-bedienung="touch"] .mg-zeile .stepper { gap: 8px; }
[data-bedienung="touch"] .mg-zeile .stepper .mg-pm { width: 76px; height: 68px; font-size: 36px; font-weight: 600; line-height: 1;
  flex-direction: column; justify-content: center; gap: 0; padding: 0; user-select: none; -webkit-user-select: none;
  touch-action: manipulation; -webkit-touch-callout: none; }
[data-bedienung="touch"] .mg-zeile .stepper .mg-pm small { font-size: 14px; font-weight: 650; color: var(--leise); margin-top: 2px; }
[data-bedienung="touch"] .mg-zeile .stepper .mg-pm[data-richtung="1"] { background: color-mix(in srgb, var(--akzent) 10%, var(--flaeche)); }
[data-bedienung="touch"] .mg-zeile .stepper .mg-pm.gedrueckt { background: color-mix(in srgb, var(--akzent) 28%, var(--flaeche)); }
[data-bedienung="touch"] .mg-zeile .stepper .mg-pm.mg-schnell { outline: 3px solid var(--akzent); }
[data-bedienung="touch"] .mg-zeile .stepper input[name=menge] { width: 116px; height: 68px; font-size: 30px; font-weight: 700;
  text-align: center; cursor: pointer; caret-color: transparent; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { [data-bedienung="touch"] .mg-zeile .stepper input[name=menge] { width: 96px; } }

.mg-ueberlagerung { position: fixed; inset: 0; z-index: 1150; background: rgba(0, 0, 0, .45); display: flex;
  align-items: center; justify-content: center; padding: 12px; }
.mg-ueberlagerung[hidden] { display: none; }
body.mg-offen { overflow: hidden; }
.mg-fenster { background: var(--flaeche); color: var(--text); border-radius: 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
  width: min(560px, 100%); max-height: calc(100vh - 24px); overflow: auto; padding: 16px 18px 18px; display: grid; gap: 12px; }
.mg-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.mg-titel { font-size: 20px; font-weight: 650; }
.mg-unter { font-size: 14px; color: var(--leise); }
.mg-zu { width: 52px; height: 52px; justify-content: center; padding: 0; font-size: 20px; flex: none; }
.mg-anzeige { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; background: var(--zeile);
  border-radius: 12px; padding: 10px 16px; }
.mg-wert { font-size: 44px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.05; }
.mg-wert #mgWert.frisch { background: color-mix(in srgb, var(--akzent) 20%, transparent); border-radius: 6px; padding: 0 4px; }
.mg-wert small { display: block; font-size: 13px; font-weight: 400; color: var(--leise); }
.mg-zusatz { text-align: right; font-size: 15px; color: var(--leise); }
.mg-zusatz b { display: block; font-size: 24px; color: var(--text); font-variant-numeric: tabular-nums; }
.mg-schritte { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.mg-schritte button { height: 56px; font-size: 19px; font-weight: 600; justify-content: center; padding: 0; touch-action: manipulation; }
.mg-schritte button.hell { background: color-mix(in srgb, var(--akzent) 10%, var(--flaeche)); }
.mg-block { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mg-block button { height: 58px; font-size: 26px; font-weight: 600; justify-content: center; padding: 0; user-select: none;
  touch-action: manipulation; }
.mg-block .mg-loeschen { grid-column: 1 / -1; height: 48px; font-size: 16px; color: var(--fehler); }
.mg-aktionen { display: grid; grid-template-columns: 1fr 1.4fr 1.4fr; gap: 10px; }
.mg-aktionen button { height: 60px; font-size: 17px; font-weight: 600; justify-content: center; text-align: center; padding: 0 8px; }
@media (max-height: 760px) { .mg-wert { font-size: 34px; } .mg-block button { height: 50px; } .mg-schritte button, .mg-aktionen button { height: 52px; } }
@media (max-width: 480px) { .mg-aktionen { grid-template-columns: 1fr 1fr; } .mg-aktionen [data-a="weiter"] { grid-column: 1 / -1; } }
