/* ===========================================================================
   AV-Board — PPS · css/sidebar.css
   Seitenleiste der Bereiche. Rumpf aus dem Gerüst (Lauf 10, P-00) — gefüllt von Lauf 10 · P-02.
   Bis dahin leer: Die Datei steht schon in index.html und deploy.sh, damit
   kein Paket diese gemeinsamen Dateien anfassen muss. verify_deploy.sh
   meldet Dateien unter 400 Byte als verdächtig klein — daher dieser Kopf.
   =========================================================================== */

/* Raster: --sb-w ist die Breite, die die Seite links freihält (siehe style.css). */
body[data-sb="voll"]      { --sb-w: 216px; }   /* UI-Standard 1.4 §3: Band 176–216 px */
body[data-sb="schiene"]   { --sb-w: 56px; }
body[data-sb="schublade"] { --sb-w: 0px; }

#sidebar {
    position: fixed; top: var(--hdr-h); left: 0; bottom: 0; z-index: var(--z-leiste);
    width: 216px; overflow-y: auto; overflow-x: hidden;
    background: var(--surface); border-right: 1px solid var(--line);
    padding: var(--sp-2) var(--sp-2) var(--sp-5); font-size: var(--fs-3);
}
/* Bewegung nur, wenn die Person selbst umschaltet (body.sb-animiert, sidebar.js).
   Ein Moduswechsel aus Größenänderung oder Seitenwechsel springt: Sonst liegt die
   Leiste 160–240 ms breiter über dem schon verschobenen Inhalt — und eine
   Ganzseiten-Aufnahme (Puppeteer setzt das Fenster dafür kurz auf 1 × 1 px)
   fängt genau diesen Zwischenstand ein (Sichtprüfung 03.10.2026, 1.600 px). */
body.sb-animiert #sidebar { transition: width var(--motion), transform var(--motion-l); }

/* Die Leiste steht fest im Fenster; der Streifen dahinter läuft über die ganze
   Seitenhöhe — im Hintergrund des Körpers, damit auch eine lange Seite (und ihr
   Ganzseitenbild) links nicht nach dem ersten Bildschirm endet. */
body[data-sb="voll"], body[data-sb="schiene"] {
    background-image: linear-gradient(to right, var(--surface) calc(var(--sb-w) - 1px),
        var(--line) calc(var(--sb-w) - 1px), var(--line) var(--sb-w), transparent var(--sb-w));
}
#sidebar:empty { display: none; }
/* AP-11 (G-7′): Die Leiste ist eine Spalte; die Gruppe System steht abgesetzt am unteren Rand (wie das Lernsystem im HDR). */
#sidebar { display: flex; flex-direction: column; }
#sidebar > .sb-umschalter { flex: none; }
.sb-gruppe { margin-top: var(--sp-3); flex: none; }
.sb-gruppe[data-sb-gruppe="system"] { margin-top: auto; padding-top: var(--sp-2); border-top: 1px solid var(--line); }
#sidebar > .sb-umschalter + .sb-gruppe[data-sb-gruppe="arbeit"] { margin-top: var(--sp-2); }
/* Arbeit oben in etwas größerer Schrift (Tageswerkzeug), die übrigen Gruppen in Grundgröße. */
.sb-gruppe[data-sb-gruppe="arbeit"] .sb-punkt { font-size: var(--fs-4); padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
.sb-gruppe[data-sb-gruppe="arbeit"] .sb-zahl { font-size: var(--fs-1); }
/* AP-1 (HDR-Niveau): Gruppennamen in normaler Schreibung, Grundschrift halbfett 13 px statt Versal-Mono. */
.sb-gruppenname { font-family: var(--font-body); font-size: var(--fs-2); font-weight: 600; line-height: 1.3;
    color: var(--muted); padding: 0 var(--sp-2) var(--sp-1); }
.sb-punkt { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-2); border-radius: var(--radius-s);
    color: var(--ink); text-decoration: none; line-height: 1.25; }
.sb-punkt:hover { background: var(--surface-2); }
.sb-punkt.aktiv { background: var(--primary-soft); color: var(--primary-strong); font-weight: 600;
    box-shadow: inset 3px 0 0 var(--primary); }
/* Unterseite (Kunde, Vorgang, Artikelblatt): nur der Balken — die Seite selbst ist nicht dieser Punkt (UB-02). */
.sb-punkt.aktiv.unterseite { background: transparent; color: var(--ink); font-weight: 400; }
.sb-zeichen { flex: none; }
/* Pfeil „öffnet außerhalb“ (Kennzeichnung, Produktions-Monitor). */
.sb-extern { flex: none; margin-left: -2px; color: var(--subtle); }
/* Ein Name, eine Zeile (AP-1): lange Namen enden mit „…“ statt umzubrechen; der volle Name steht im Tooltip der Schiene. */
.sb-text { min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; hyphens: none; }
.sb-unter { padding-left: var(--sp-6); font-size: var(--fs-2); }
.sb-bald { color: var(--subtle); }
.sb-bald .sb-zeichen { opacity: .65; }
.sb-hinweis { font-size: var(--fs-1); color: var(--subtle); white-space: nowrap; }
.sb-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid var(--subtle); box-sizing: border-box; }
.sb-zahl { min-width: 18px; padding: 0 var(--sp-1); border-radius: var(--radius); background: var(--accent-fill-hover); color: var(--on-accent-fill); /* weißes Zeichen ≥ 5,3:1 (axe color-contrast) */
    font-size: var(--fs-1); font-weight: 600; text-align: center; line-height: 18px; }
.sb-zahl[hidden] { display: none; }
/* AP-2 (AL 09.10.): Der Umschalter bleibt beim Scrollen der Leiste stehen. Das Leisten-padding
   (10 px oben, 8 px seitlich) gleicht der negative Rand aus, damit nichts durchscheint. */
.sb-umschalter { display: flex; align-items: center; justify-content: flex-end; position: sticky; top: 0; z-index: var(--z-kleber);
    width: calc(100% + 16px); min-height: 40px; margin: -10px -8px 0; padding: var(--sp-1) var(--sp-4) var(--sp-1) var(--sp-2);
    border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--surface); color: var(--ink);
    cursor: pointer; font-family: var(--font-mono); font-size: var(--fs-4); font-weight: 600; line-height: 1; }
.sb-umschalter > span { display: inline-flex; align-items: center; justify-content: center; min-width: var(--ctl-h); min-height: var(--ctl-h);
    border-radius: var(--radius-s); }
.sb-umschalter:hover > span { background: var(--surface-2); }
.sb-umschalter:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.sb-knopf { display: none; }

/* Schiene: nur Zeichen; offen als Überlagerung über dem Inhalt (Raster bleibt bei 56 px). */
body[data-sb="schiene"] #sidebar { width: 56px; }
body[data-sb="schiene"] #sidebar .sb-text,
body[data-sb="schiene"] #sidebar .sb-hinweis,
body[data-sb="schiene"] #sidebar .sb-dot,
body[data-sb="schiene"] #sidebar .sb-unter,
body[data-sb="schiene"] #sidebar .sb-extern,
body[data-sb="schiene"] #sidebar .sb-gruppenname { display: none; }
body[data-sb="schiene"] #sidebar .sb-umschalter { justify-content: center; padding: var(--sp-1) 0; }
/* UB-03 (AP-11): In der Schiene steht die Zahl rechts neben dem Zeichen (Zeichen 18–38 px, Zahl ab 38 px), nicht darauf. */
body[data-sb="schiene"] #sidebar .sb-zahl { position: absolute; top: 5px; right: 1px; margin: 0; min-width: 16px; padding: 0 var(--sp-1); line-height: 16px; font-size: var(--fs-1); }
body[data-sb="schiene"] #sidebar .sb-punkt { position: relative; justify-content: center; padding: var(--sp-2) 0; }
body[data-sb="schiene"] #sidebar .sb-gruppe { margin-top: var(--sp-1); border-top: 1px solid var(--line); padding-top: var(--sp-1); }
body[data-sb="schiene"] #sidebar .sb-gruppe[data-sb-gruppe="system"] { margin-top: auto; }
body[data-sb="schiene"] #sidebar .sb-gruppe[data-sb-gruppe="arbeit"] .sb-punkt { font-size: inherit; }
body[data-sb="schiene"].sb-auf #sidebar { width: 216px; box-shadow: var(--shadow-l); }
body[data-sb="schiene"].sb-auf #sidebar .sb-text,
body[data-sb="schiene"].sb-auf #sidebar .sb-hinweis,
body[data-sb="schiene"].sb-auf #sidebar .sb-dot,
body[data-sb="schiene"].sb-auf #sidebar .sb-unter,
body[data-sb="schiene"].sb-auf #sidebar .sb-extern,
body[data-sb="schiene"].sb-auf #sidebar .sb-gruppenname { display: revert; }
body[data-sb="schiene"].sb-auf #sidebar .sb-punkt { justify-content: flex-start; padding: var(--sp-2) var(--sp-2); }
body[data-sb="schiene"].sb-auf #sidebar .sb-zahl { position: static; margin: 0; min-width: 18px; line-height: 18px; font-size: var(--fs-1); }

/* Schublade unter 1.180 px */
body[data-sb="schublade"] #sidebar { width: 216px; max-width: 86vw; transform: translateX(-105%); box-shadow: none; visibility: hidden; }
body[data-sb="schublade"].sb-auf #sidebar { transform: none; box-shadow: var(--shadow-l); visibility: visible; }
body[data-sb="schublade"] .sb-knopf { display: inline-flex; }
body[data-sb="schublade"] .sb-umschalter { display: none; }
body[data-sb="schublade"].sb-auf::after { content: ''; position: fixed; inset: var(--hdr-h) 0 0 0; background: var(--overlay); z-index: var(--z-schleier); }

/* Platzhalter, bis /einstellungen/ich geantwortet hat: gleiche Zeilen wie die fertige Leiste, kein Springen. */
.sb-skelett { display: block; border-radius: var(--radius-s); background: var(--surface-2); }
.sb-skelett-name { width: 58px; height: 12px; }
.sb-skelett-zeichen { flex: none; width: 20px; height: 20px; }
.sb-skelett-text { width: 72%; height: 12px; }
.sb-platzhalter .sb-punkt:hover { background: transparent; }
@media (prefers-reduced-motion: no-preference) {
    .sb-skelett { animation: sb-atmen 1.4s ease-in-out infinite alternate; }
}
@keyframes sb-atmen { from { opacity: .55; } to { opacity: 1; } }

.export-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.export-zeile input { width: 9ch; }
.export-zeile [aria-disabled="true"] { opacity: .5; pointer-events: none; }

@media (prefers-reduced-motion: reduce) { #sidebar { transition: none; } }
@media print { #sidebar { display: none; } }

/* FB-129: Datenexport als Kacheln mit Zeichen. */
.export-kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-4); }
.export-kachel { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-4); background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius); }
.export-kachel-kopf { display: flex; align-items: center; gap: var(--sp-2); }
.export-kachel-kopf h2 { margin: 0; font-size: var(--fs-4); }
.export-zeichen { color: var(--primary-strong); flex: none; }
.export-kachel p { margin: 0; color: var(--muted); font-size: var(--fs-3); }
.export-kachel-fuss { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); }
.export-kachel a.btn { text-decoration: none; }
.export-kachel label { font-size: var(--fs-3); color: var(--muted); }

/* Kopf und Fuß: seit AP-11 in style.css (Abschnitt „Kopf und Fuß“). */

/* Ganz unten: „development by SiegAI“ (UI-Standard 1.4 §3, G-10) — dezent, kleinste Schriftstufe (12 px), Zweittext, Klickziel ≥ 24 px; eingeklappt nur das Zeichen.
   Muster: /shared/osp-seitenleiste.v2.css (.osl-siegai). Die Marke setzt sidebar.js aus /shared/osp-marken.v1.js (fill-Attribut, kein style). */
#sidebar .sb-siegai {
    flex: none; display: flex; align-items: center; gap: var(--sp-2); min-height: 32px; margin-top: var(--sp-2); padding: var(--sp-1) var(--sp-2);
    border-radius: var(--radius-s); color: var(--muted); font-size: var(--fs-1); text-decoration: none; white-space: nowrap;
}
#sidebar .sb-siegai:hover { background: var(--surface-2); color: var(--ink); }
#sidebar .sb-siegai-marke { display: inline-flex; flex: 0 0 auto; width: 24px; height: 24px; }
#sidebar .sb-siegai-marke svg { width: 24px; height: 24px; }
#sidebar .sb-siegai-marke .osp-marke-knoten { fill: var(--osp-marke-knoten, #11995A); }
body[data-sb="schiene"] #sidebar .sb-siegai { justify-content: center; padding: var(--sp-1) 0; }
body[data-sb="schiene"].sb-auf #sidebar .sb-siegai { justify-content: flex-start; padding: var(--sp-1) var(--sp-2); }
@media print { #sidebar .sb-siegai { display: none; } }

/* Niedrige Fenster (Pflichtmaß 1640 × 650): Die Leiste der Verwaltung (12 Punkte + SiegAI) scrollt nicht — Zeilen der Gruppen außer „Arbeit“ enger
   (Zeile 28 px, Klickziel bleibt ≥ 24 px). Die Leiste für Bearbeiter (5 Punkte) hat Platz und bleibt unverändert. */
@media (max-height: 700px) {
    .sb-gruppe:not([data-sb-gruppe="arbeit"]) .sb-punkt { padding-top: var(--sp-1); padding-bottom: var(--sp-1); }
    #sidebar { padding-bottom: var(--sp-2); }
}
