/* Hauptmenü links und Leiste unten am Handy (Bauplan Web-App Hauptmenü H1–H5). Vorbild: NavItemRadioLightV2 und NavBaumEintrag im
   PC-Programm (MainWindow.xaml): Zeile 30 px, 8 px Rand, Ecken 3 px, Symbol 16 px, Schrift 13 px, gewählt grau mit 2 px dunkler
   Marke links und halbfett, Unterpunkte ohne Symbol an einer Führungslinie. Kein Blau (nur Hauptknopf und Fokus).
   ☠️ Stufen: Handy bis 640 px (Leiste unten, kein Menü links), Symbolleiste 641–1099 px (☰ zieht das breite Menü als Blatt
   darüber), ab 1100 px nach Wahl (gemerkt), ohne Wahl breit erst ab 1440 px. Dieselben Grenzen stehen in oo.js
   (beobachteMenueBreite). ☠️ Obere Grenzen enden bei …,98 px: eine Grenze „bis 1099 px“ neben „ab 1100 px“ ließe bei Skalierung
   (1099,2 px) beide Regeln aus, das Skript meldete trotzdem eine Stufe. */

.oo-koerper { flex: 1 1 auto; min-height: 0; display: flex; }
.oo-koerper > .oo-inhalt { flex: 1 1 auto; min-width: 0; }

/* ── Knopf ☰ im Kopfband ───────────────────────────────────────────────────── */
.oo-hm-knopf { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin-right: -10px;
  padding: 0; border: 0; border-radius: 3px; background: transparent; color: var(--nacht-text); cursor: pointer; }
.oo-hm-knopf:hover { background: rgba(255, 255, 255, .09); color: #fff; }

/* ── Menü links ────────────────────────────────────────────────────────────── */
.oo-hm-seite { --hm-breite: 232px; flex: 0 0 var(--hm-breite); width: var(--hm-breite); min-height: 0; position: relative; z-index: 12;
  background: var(--flaeche); border-right: 1px solid var(--linie); }
.oo-hm { height: 100%; display: flex; flex-direction: column; background: var(--flaeche); }
.oo-hm-baum { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 6px 0; scrollbar-width: thin; }
.oo-hm-fuss { flex: 0 0 auto; padding: 6px 0; border-top: 1px solid var(--linie); }

.oo-hm-eintrag, .oo-hm-gruppe { position: relative; display: flex; align-items: center; gap: 10px; height: 30px; margin: 1px 8px; padding: 0 10px;
  border: 0; border-radius: 3px; background: transparent; color: var(--tinte-3); font: inherit; font-size: 13px; text-align: left;
  text-decoration: none; white-space: nowrap; cursor: pointer; width: calc(100% - 16px); }
.oo-hm-eintrag .sym, .oo-hm-gruppe > .sym:first-child { flex: 0 0 16px; color: var(--tinte-5); }
.oo-hm-eintrag .name, .oo-hm-gruppe .name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.oo-hm-gruppe > .sym:last-child { flex: 0 0 14px; color: var(--tinte-6); transition: transform .12s ease; transform: rotate(-90deg); }
.oo-hm-gruppe[aria-expanded="true"] > .sym:last-child { transform: none; }
.oo-hm-eintrag:hover, .oo-hm-gruppe:hover { background: var(--flaeche-2); color: var(--tinte-1); }
.oo-hm-eintrag:hover .sym, .oo-hm-gruppe:hover > .sym:first-child { color: var(--tinte-3); }
.oo-hm-eintrag:focus-visible, .oo-hm-gruppe:focus-visible { outline-offset: -2px; }
.oo-hm-eintrag.aktiv, .oo-hm-gruppe.aktiv { background: var(--auswahl); color: var(--tinte-1); font-weight: 600; }
.oo-hm-eintrag.aktiv .sym, .oo-hm-gruppe.aktiv > .sym:first-child { color: var(--tinte-1); }
.oo-hm-eintrag.aktiv::before, .oo-hm-gruppe.aktiv::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 2px; border-radius: 1px; background: var(--tinte-1); }

/* Unterpunkte: Text bündig mit dem Gruppentitel (10 + 16 + 10 px), Führungslinie unter dem Gruppensymbol. */
.oo-hm-unter { position: relative; margin: 0 0 2px; }
.oo-hm-unter::before { content: ""; position: absolute; left: 25px; top: 2px; bottom: 2px; width: 1px; background: var(--linie); }
.oo-hm-unterpunkt { height: 28px; padding-left: 36px; color: var(--tinte-4); }
.oo-hm-unterpunkt.aktiv::before { left: 17px; }
/* Abschnitte unter „Dokumente“ wie die Überschriften der Filterleiste im PC-Programm (Verkauf, Rechnungen …): klein, grau, halbfett,
   bündig mit den Unterpunkten. ☠️ Nicht in Großbuchstaben: „Einkauf und Schriftverkehr“ passte so nicht in 232 px (abgeschnitten). */
.oo-hm-abschnitt { margin: 8px 8px 1px; padding: 0 6px 0 36px; color: var(--tinte-5); font-size: 11px; font-weight: 600; line-height: 18px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Symbolleiste (56 px): nur Symbole, Namen als Hinweis ─────────────────── *
   641–1099 px immer (außer als Blatt, hm-offen); 1100–1439 px, solange nicht „breit“ gewählt (hm-breit); ab 1440 px nur, wenn
   „Symbole“ gewählt (hm-schmal). Bei 1280 px blieben neben breitem Menü, Filterleiste und Akte sonst rund 340 px für die Liste. */
@media (min-width: 641px) and (max-width: 1099.98px) {
  .oo-app:not(.hm-offen) .oo-hm-seite { --hm-breite: 56px; }
  .oo-app:not(.hm-offen) .oo-hm .name, .oo-app:not(.hm-offen) .oo-hm-gruppe > .sym:last-child, .oo-app:not(.hm-offen) .oo-hm-unter { display: none; }
  .oo-app:not(.hm-offen) .oo-hm-eintrag, .oo-app:not(.hm-offen) .oo-hm-gruppe { justify-content: center; padding: 0; }
}
@media (min-width: 1100px) and (max-width: 1439.98px) {
  .oo-app:not(.hm-breit) .oo-hm-seite { --hm-breite: 56px; }
  .oo-app:not(.hm-breit) .oo-hm .name, .oo-app:not(.hm-breit) .oo-hm-gruppe > .sym:last-child, .oo-app:not(.hm-breit) .oo-hm-unter { display: none; }
  .oo-app:not(.hm-breit) .oo-hm-eintrag, .oo-app:not(.hm-breit) .oo-hm-gruppe { justify-content: center; padding: 0; }
}
@media (min-width: 1440px) {
  .oo-app.hm-schmal .oo-hm-seite { --hm-breite: 56px; }
  .oo-app.hm-schmal .oo-hm .name, .oo-app.hm-schmal .oo-hm-gruppe > .sym:last-child, .oo-app.hm-schmal .oo-hm-unter { display: none; }
  .oo-app.hm-schmal .oo-hm-eintrag, .oo-app.hm-schmal .oo-hm-gruppe { justify-content: center; padding: 0; }
}
@media (min-width: 1100px) {
  .oo-hm-schleier { display: none; }
}

/* ── Unter 1100 px: das breite Menü als Blatt über der Seite; die Symbolleiste hält ihren Platz ─ */
@media (min-width: 641px) and (max-width: 1099.98px) {
  .oo-app.hm-offen .oo-hm-seite { --hm-breite: 56px; z-index: 36; }
  .oo-app.hm-offen .oo-hm { position: absolute; top: 0; left: 0; bottom: 0; width: 232px; border-right: 1px solid var(--linie-stark);
    box-shadow: 14px 0 36px rgba(15, 23, 42, .16); }
  .oo-hm-schleier { z-index: 35; }
}

/* ── Handy: kein Menü links, kein ☰ (das Menü ist das Feld unten) ─────────── */
@media (max-width: 640.98px) {
  .oo-hm-seite, .oo-hm-knopf, .oo-hm-schleier { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .oo-hm-gruppe > .sym:last-child { transition: none; }
}

/* ── Handy: Leiste unten (bis 640 px) ──────────────────────────────────────── */
.oo-hl, .oo-hl-blatt, .oo-hl-schleier { display: none; }
@media (max-width: 640.98px) {
  .oo-hl { flex: 0 0 auto; position: relative; z-index: 10; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    height: calc(56px + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--flaeche); border-top: 1px solid var(--linie); }
  .oo-hl-feld { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0;
    padding: 0 2px; border: 0; background: transparent; color: var(--tinte-5); font: inherit; font-size: 11px; line-height: 1.2;
    text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .oo-hl-feld .name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .oo-hl-feld.aktiv { color: var(--tinte-1); font-weight: 600; }
  .oo-hl-feld.aktiv::before { content: ""; position: absolute; top: -1px; left: 50%; width: 28px; height: 2px; margin-left: -14px; border-radius: 0 0 1px 1px; background: var(--tinte-1); }
  .oo-hl-feld:focus-visible { outline-offset: -3px; }
  .oo-hl-menue { grid-column: 5; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

  /* Blatt „Menü“ von unten: dasselbe Menü wie links, alle Gruppen offen, darunter das Konto. */
  .oo-hl-schleier { display: block; z-index: 44; }
  .oo-hl-blatt { position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; max-height: 85dvh;
    padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--flaeche); border-top: 1px solid var(--linie-stark);
    border-radius: 6px 6px 0 0; box-shadow: 0 -14px 36px rgba(15, 23, 42, .18); overflow-y: auto; overscroll-behavior: contain; }
  .oo-hl-griff { flex: 0 0 auto; width: 36px; height: 4px; margin: 8px auto 2px; border-radius: 2px; background: var(--linie-stark); }
  .oo-hl-blatt .oo-hm { height: auto; }
  .oo-hl-blatt .oo-hm-baum { overflow: visible; }
  .oo-hl-blatt .oo-hm-eintrag, .oo-hl-blatt .oo-hm-gruppe { height: 40px; font-size: 14px; }
  .oo-hl-blatt .oo-hm-unterpunkt { height: 36px; }
  .oo-hl-konto { padding: 6px 0 8px; border-top: 1px solid var(--linie); }
  .oo-hl-konto .titel { display: block; padding: 6px 18px 4px; color: var(--tinte-5); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Meldungen stehen über der Leiste. */
  body:has(.oo-hl) .oo-meldungen { bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 12px); }
}

/* Persönliche Handy-Leiste: ruhiges Blatt mit scrollender Auswahl und fester Vorschau/Aktionsleiste. */
@media (max-width: 640.98px) {
  .oo-hl-anpassen { max-height: calc(100dvh - 16px); overflow: hidden; }
  .oo-hl-anpassen-kopf { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 14px 16px 12px; border-bottom: 1px solid var(--linie); }
  .oo-hl-anpassen h2 { margin: 0; font-size: 20px; line-height: 1.3; }
  .oo-hl-anpassen h3 { margin: 0; font-size: 14px; font-weight: 600; }
  .oo-hl-anpassen-kopf p { margin: 5px 0 0; color: var(--tinte-5); font-size: 13px; }
  .oo-hl-anpassen-inhalt { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px 18px; }
  .oo-hl-suche { display: grid; gap: 6px; font-size: 12px; color: var(--tinte-4); margin-bottom: 18px; }
  .oo-hl-suche input { min-height: 44px; width: 100%; border: 1px solid var(--linie-stark); border-radius: 4px; padding: 9px 10px; background: var(--flaeche); color: var(--tinte-1); font: inherit; font-size: 14px; }
  .oo-hl-auswahlkopf { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
  .oo-hl-auswahlkopf > span { font-size: 12px; color: var(--tinte-5); }
  .oo-hl-wahl { list-style: none; padding: 0; margin: 0 0 20px; }
  .oo-hl-wahl li { display: flex; align-items: center; gap: 8px; min-height: 48px; border-bottom: 1px solid var(--linie); }
  .oo-hl-wahl li > .sym { flex-shrink: 0; color: var(--tinte-5); }
  .oo-hl-wahl li > span { flex: 1; min-width: 0; font-size: 13px; }
  .oo-hl-wahl li .kn { min-width: 44px; min-height: 44px; padding: 0; }
  .oo-hl-optionen { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
  .oo-hl-option { display: grid; grid-template-columns: 22px 1fr 16px; gap: 8px; align-items: center; min-height: 64px; padding: 12px 10px; border: 1px solid var(--linie); border-radius: 4px; background: var(--flaeche); color: var(--tinte-3); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
  .oo-hl-option span { min-width: 0; overflow-wrap: anywhere; }
  .oo-hl-option.gewaehlt { border-color: var(--tinte-5); background: var(--auswahl); color: var(--tinte-1); }
  .oo-hl-option:disabled:not(.gewaehlt) { opacity: .5; cursor: default; }
  .oo-hl-anpassen-fuss { flex: 0 0 auto; padding: 12px 16px; border-top: 1px solid var(--linie); background: var(--flaeche); }
  .oo-hl-vorschau { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); min-height: 64px; border: 1px solid var(--linie); border-radius: 4px; background: var(--flaeche-2); }
  .oo-hl-vorschau > div { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-width: 0; padding: 8px 2px; color: var(--tinte-4); font-size: 10px; }
  .oo-hl-vorschau span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .oo-hl-vorschau .fest { border-left: 1px solid var(--linie); color: var(--tinte-1); }
  .oo-hl-vorschau .leer { color: var(--tinte-5); }
  .oo-hl-hilfe { margin: 8px 0; color: var(--tinte-5); font-size: 12px; line-height: 1.4; }
  .oo-hl-aktionen { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 10px; }
  .oo-hl-aktionen .kn { min-height: 44px; }
  .oo-hl-aktionen [data-aktion="standard"] { margin-right: auto; font-size: 12px; }
  .oo-hl-speicherfehler { color: var(--fehler, #b42318); font-size: 13px; margin: 8px 0; }
}
@media (max-width: 360px) {
  .oo-hl-aktionen { display: grid; grid-template-columns: 1fr 1fr; }
  .oo-hl-aktionen [data-aktion="standard"] { grid-column: 1 / -1; margin: 0; }
}
