/* ============================================================
   Deytona Dispo - Designsystem
   Ruhiges, sachliches Betriebswerkzeug.
   Heller Arbeitscanvas, dunkle Navigationsleiste,
   ein einziger blauer Signal-Akzent als Wiedererkennung.
   Touch-taugliche Zielgroessen (iPad im Lager).
   ============================================================ */

:root {
  --canvas:      #F4F5F7;
  --surface:     #FFFFFF;
  --ink:         #17191F;   /* Text + Schalttafel */
  --ink-soft:    #23262E;
  --muted:       #656B76;
  --line:        #E4E7EC;
  --line-strong: #CDD2DA;

  --accent:      #2D6CDF;   /* sachlicher Signal-Blau (Signatur) */
  --accent-deep: #1E4FB0;
  --accent-tint: #DEE9FB;

  --ok:          #1E874B;
  --ok-tint:     #E4F3EA;
  --danger:      #C6362F;
  --danger-tint: #F7E4E3;

  /* Warn-Gelb (Ueberfaellig-Kennzeichnung in der Auftragsliste) */
  --warn-tint:        #FFF1B0;
  --warn-tint-hover:  #FFEB8F;
  --warn-strong:      #D9B62B;

  /* Auftragsart-Farben (docs/auftrag_auftragsarten_farben.md): Pastelltoene fuer Zeilen/Badges,
     "-strong" = kraeftigerer Ton fuer Abgrenzung gleichfarbiger Nachbarzeilen. */
  --auftrag-gruen-tint:   #E1F3E4;
  --auftrag-gruen-hover:  #D2EBD7;
  --auftrag-gruen-strong: #6DBB84;
  --auftrag-blau-tint:    #E3EDFC;
  --auftrag-blau-hover:   #D2E2F9;
  --auftrag-blau-strong:  #7EA7EA;
  --auftrag-lila-tint:    #EDE3F8;
  --auftrag-lila-hover:   #E1D2F3;
  --auftrag-lila-strong:  #A783D6;
  --auftrag-rot-tint:     #FADCD8;
  --auftrag-rot-hover:    #F6CBC6;
  --auftrag-rot-strong:   #E27F77;

  --radius:      10px;
  --radius-sm:   7px;
  --shadow:      0 1px 2px rgba(20,22,28,.06), 0 6px 20px rgba(20,22,28,.06);

  --sans: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", "Consolas", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--sans);
  background: var(--canvas);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Grundlayout: Schalttafel links, Canvas rechts ---------- */
.layout {
  display: grid;
  grid-template-columns: 236px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--ink);
  color: #C7CBD2;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
}
.brand-mark {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--accent);
  position: relative;
  flex: none;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 3px;
  background: #FFFFFF;
  opacity: .92;
}
.brand-name {
  font-weight: 600;
  letter-spacing: .2px;
  color: #FFFFFF;
  font-size: 15.5px;
}
.brand-sub {
  display: block;
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.nav-group { margin-top: 14px; }
.nav-group:first-of-type { margin-top: 0; }
.nav-group-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #6A707B;
  padding: 6px 10px;
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.nav-group-label::-webkit-details-marker { display: none; }
.nav-group-label::before {
  content: "";
  width: 0; height: 0;
  border-left: 4px solid currentColor;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  opacity: .6;
  flex: none;
  transition: transform .12s ease;
}
.nav-group[open] > .nav-group-label::before { transform: rotate(90deg); }
.nav-group-label:hover { color: #C7CBD2; }
.nav-group-items { display: flex; flex-direction: column; gap: 2px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: #C7CBD2;
  text-decoration: none;
  font-size: 14px;
  border-left: 2px solid transparent;
}
.nav a:hover { background: var(--ink-soft); color: #FFFFFF; }
.nav a.active {
  background: var(--ink-soft);
  color: #FFFFFF;
  border-left-color: var(--accent);
}
.nav .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; flex: none; }
.nav a.active .dot { background: var(--accent); opacity: 1; }

.sidebar-foot {
  margin-top: auto;
  font-size: 11.5px;
  color: #5C626D;
  padding: 0 10px;
}

.sidebar-version {
  margin-top: 3px;
  font-size: 10px;
  font-family: var(--mono);
  color: var(--muted);
  opacity: .7;
}

.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 0 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid #262A33;
}
.sidebar-user-name {
  font-size: 12.5px;
  font-weight: 500;
  color: #C7CBD2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user form { margin: 0; flex: none; }
.sidebar-logout {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 11.5px;
  color: #7C828C;
  cursor: pointer;
}
.sidebar-logout:hover { color: #FFFFFF; }

/* ---------- Hauptbereich ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 30px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.topbar h1 {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -.01em;
  margin: 0;
}
.topbar .crumb {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}

.content { padding: 26px 30px; }

/* ---------- Kopfzeile anheften (Pin), docs/abgearbeitet/auftrag_kopfzeile_anheften_pin.md ----------
   Klasse topbar-pinned liegt am <html> (Inline-Skript im <head> von base.html + topbar-pin.js).
   z-index 20: ueber Seiteninhalt/Dropdowns (10), aber unter .overlay (40) sowie Drawer/Fenster/
   Vollfenster (50), Hilfe-Chat (60) und Kamera-Scan (70). */
.topbar-pin {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; flex: none; padding: 0;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--muted); cursor: pointer;
}
.topbar-pin:hover { color: var(--accent); border-color: var(--line-strong); }
.topbar-pin svg { transition: transform .15s ease; }
.topbar-pin[aria-pressed="true"] { color: var(--accent); }
.topbar-pin[aria-pressed="true"] svg { fill: currentColor; transform: rotate(-35deg); }
.topbar-pin[aria-pressed="true"] svg path { fill: currentColor; }

html.topbar-pinned .topbar {
  position: sticky; top: 0; z-index: 20;
  padding: 8px 30px;
  box-shadow: 0 2px 8px rgba(20,22,28,.08);
}
html.topbar-pinned .topbar { justify-content: flex-start; gap: 10px; }
html.topbar-pinned .topbar .crumb { display: none; }
/* Titel hoechstens zwei Zeilen/240px (bei laengeren Namen Ellipsis), damit er die Aktions-Buttons
   nicht auf Spaltenbreite 0 quetscht; Aktionen ruecken linksbuendig direkt hinter Titel/Pin. */
html.topbar-pinned .topbar h1 {
  font-size: 17px; line-height: 1.25; max-width: 240px;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
html.topbar-pinned .topbar-titel { flex: 0 0 auto; }
html.topbar-pinned .topbar-actions { display: flex; flex: 1 1 0; min-width: 0; flex-wrap: wrap; justify-content: flex-start; gap: 6px; }
html.topbar-pinned .topbar-actions .btn { padding: 0 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #FFFFFF;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
}
.btn:hover { background: var(--ink-soft); }
.btn:focus-visible { outline: 3px solid var(--accent-tint); outline-offset: 1px; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-ghost:hover { background: var(--canvas); }

.btn-plus::before { content: "+"; font-size: 18px; font-weight: 600; margin-top: -1px; }

.btn-sm { min-height: 34px; padding: 0 11px; font-size: 13px; border-radius: 6px; }

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border-color: transparent;
}
.btn-danger-ghost:hover { background: var(--danger-tint); }

/* Live eingefaerbter Abschluss-Button im Material-Check-in (docs/
   2026-09-28_auftrag_checkin_abschliessen_absicherung.md) - gruen ohne Fehlmaterial, rot bei
   offener Fehlmenge (dann entstuende ein Fehlmaterial-Folgeauftrag). Bewusst dieselben
   --ok/--danger-Token wie die uebrigen Warn-/Erfolgs-Elemente (Badges, Uebermengen-Warnung),
   keine neuen Farbtoene. */
.btn-ok, .btn-warn { border-color: transparent; }
.btn-ok  { background: var(--ok); }
.btn-warn { background: var(--danger); }
.btn-ok:hover, .btn-warn:hover { filter: brightness(0.9); }

.btn-link {
  background: transparent; border-color: transparent; color: var(--ink);
}
.btn-link:hover { background: var(--canvas); }

/* ---------- Karte / Tabelle ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Optische Rahmung des aktiv bearbeitbaren Subgruppen-/Positionsbereichs auf der Auftrags-
   /Angebotsseite, damit er sich vom Rahmendaten-Formular (Kunde, Kommission, Kopf-/Fussdaten)
   abhebt (docs/auftrag_claude_code_subgruppen_verschieben_und_rahmen.md). Die uebrigen Karten
   (_kopf.html, _kunden_snapshot.html, ...) sind .card (weiss) direkt auf dem Seiten-Canvas
   (var(--canvas)) - ein Wrapper mit ebenfalls var(--canvas) waere davon nicht unterscheidbar,
   daher hier bewusst der naechstdunklere vorhandene Farbton (var(--line)) als "abgesetzter"
   Hintergrund, auf dem die einzelnen (weissen) Subgruppen-Karten sichtbar aufliegen. */
.subgruppen-rahmen {
  background: var(--line);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 16px;
}

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #FBFCFD;
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FBFBF7; }

/* Ueberfaellig-Kennzeichnung in der Auftragsliste (docs/
   auftrag_ueberfaellige_auftraege_und_rechnungsabschluss.md Teil A) - nutzt die bestehenden
   Danger-Tokens statt eines neuen Rottons. */
tr.ueberfaellig { background: var(--warn-tint); }
tr.ueberfaellig:hover { background: var(--warn-tint-hover); }

/* Auftragsart-Farben in der Auftragsliste (docs/auftrag_auftragsarten_farben.md): Pastell-
   Hintergrund je Zeile; ueberfaellig (gelb) hat Vorrang und tritt nie zusammen mit art-* auf (siehe
   jobs/_table.html). Folgen zwei Zeilen mit derselben Farbe aufeinander, trennt eine 2px-Linie im
   kraeftigeren Ton (inset box-shadow auf den Zellen - funktioniert auch mit border-collapse). */
tr.art-gruen  { background: var(--auftrag-gruen-tint); }
tr.art-gruen:hover  { background: var(--auftrag-gruen-hover); }
tr.art-blau   { background: var(--auftrag-blau-tint); }
tr.art-blau:hover   { background: var(--auftrag-blau-hover); }
tr.art-lila   { background: var(--auftrag-lila-tint); }
tr.art-lila:hover   { background: var(--auftrag-lila-hover); }
tr.art-rot    { background: var(--auftrag-rot-tint); }
tr.art-rot:hover    { background: var(--auftrag-rot-hover); }
tr.art-gruen + tr.art-gruen > td { box-shadow: inset 0 2px 0 var(--auftrag-gruen-strong); }
tr.art-blau  + tr.art-blau  > td { box-shadow: inset 0 2px 0 var(--auftrag-blau-strong); }
tr.art-lila  + tr.art-lila  > td { box-shadow: inset 0 2px 0 var(--auftrag-lila-strong); }
tr.art-rot   + tr.art-rot   > td { box-shadow: inset 0 2px 0 var(--auftrag-rot-strong); }
tr.ueberfaellig + tr.ueberfaellig > td { box-shadow: inset 0 2px 0 var(--warn-strong); }
.auftragsart-text { font-size: 12px; color: var(--muted); }

/* Auftragsart-Badge im Kopf der Auftrags-Detailseite */
.badge.art-badge { margin-left: 8px; }
.badge.art-gruen { background: var(--auftrag-gruen-tint); color: #1B6B3A; }
.badge.art-blau  { background: var(--auftrag-blau-tint);  color: #1E4FB0; }
.badge.art-lila  { background: var(--auftrag-lila-tint);  color: #5B338F; }
.badge.art-rot   { background: var(--auftrag-rot-tint);   color: #9C2A22; }

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }

/* Kompakte Auftragsliste (docs/abgearbeitet/auftrag_aufträge_tabelle_kompakt.md): geringeres
   horizontales Padding, horizontal scrollbar statt abgeschnittener Aktions-Buttons. */
.tabelle-scroll { overflow-x: auto; }
.auftraege-tabelle thead th { padding: 10px 8px; }
.auftraege-tabelle tbody td { padding: 10px 8px; }
.auftraege-tabelle .col-check { width: 30px; }
.auftraege-tabelle .nummer-zelle { text-align: left; white-space: nowrap; line-height: 1.35; }
.auftraege-tabelle .row-actions .btn { margin-left: 2px; }
.name-cell { font-weight: 500; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions .btn { margin-left: 4px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 20px;
}
.badge.on  { background: var(--ok-tint); color: var(--ok); }
.badge.off { background: var(--canvas); color: var(--muted); }
.badge.err { background: var(--danger-tint); color: var(--danger); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Subgruppen-Gesamtpreis im Kartenkopf (Nachtrag zu docs/
   auftrag_claude_code_gesamtpreis_und_mengenanzeige.md Teil B, 7. September 2026) - farblich
   hervorgehobene Pille statt reinem .hint-Text, damit der Live-Preis beim ersten Überfliegen der
   Karte nicht übersehen wird. */
.betrag-hervorgehoben {
  display: inline-block;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--accent-tint);
  color: var(--accent-deep);
}

/* ---------- Positionen/Subgruppen: Drag-and-Drop-Sortierung (docs/auftrag_artikel_reorder.md,
   docs/auftrag_claude_code_subgruppen_verschieben_und_rahmen.md) ---------- */
.drag-handle,
.subgroup-drag-handle { cursor: grab; color: var(--muted); margin-right: 2px; }
.drag-handle:active,
.subgroup-drag-handle:active { cursor: grabbing; }
.sortable-positionen .sortable-chosen,
.sortable-subgruppen .sortable-chosen { background: var(--canvas); }
.sortable-positionen .sortable-ghost,
.sortable-subgruppen .sortable-ghost { opacity: 0.4; }

/* ---------- Leerzustand ---------- */
.empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--muted);
}
.empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; font-weight: 600; }

/* ---------- Drawer (Formular) ---------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(20,22,28,.32);
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease;
  z-index: 40;
}
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh;
  width: 420px; max-width: 92vw;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 40px rgba(20,22,28,.14);
  transform: translateX(100%);
  transition: transform .2s cubic-bezier(.4,0,.2,1);
  z-index: 50;
  display: flex; flex-direction: column;
}
body.drawer-open .overlay { opacity: 1; pointer-events: auto; }
body.drawer-open .drawer { transform: translateX(0); }

/* .drawer-head/.drawer-body sind nicht direkte Kinder von .drawer, sondern liegen
   in #drawer-inhalt (base.html) - ohne diesen Flex-Kontext wirken flex-shrink/flex/
   min-height auf ihnen nicht und .drawer-body scrollt nicht intern, sondern sprengt
   bei langen Formularen den Bildschirm. */
#drawer-inhalt {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px; border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.drawer-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.drawer-close {
  background: transparent; border: none; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--muted); padding: 4px 8px;
}
.drawer-close:hover { color: var(--ink); }
.drawer-body { padding: 22px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }

/* ---------- Fenster (breites Overlay-Fenster, z. B. Artikelauswahl) ---------- */
/* Nutzt denselben .overlay-Backdrop wie der Drawer (base.html), aber einen eigenen,
   zentrierten, breiteren Container statt der schmalen Seitenspalte. */
.fenster {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -48%);
  /* Nachtrag (docs/nachtrag_artikelauswahl_verfuegbarkeit.md Abschnitt 3.1): deutlich groesser als
     die urspruengliche feste 920px-Breite, damit Verfuegbarkeits-Spalte + Detail-Panel nicht eng/
     scroll-lastig werden - verbindliche Vorgabe fuer dieses UND kuenftige grosse Fenster. */
  width: 94vw; max-width: 1600px;
  height: 92vh; max-height: 980px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(20,22,28,.25);
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 50;
  display: flex; flex-direction: column;
  overflow: hidden;
}
body.fenster-open .overlay { opacity: 1; pointer-events: auto; }
body.fenster-open .fenster { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }

/* Gleicher Flex-Grund wie #drawer-inhalt (siehe Kommentar dort) - sonst scrollt der
   zweispaltige Fensterinhalt nicht sauber innerhalb der festen Fensterhoehe. */
#fenster-inhalt { display: flex; flex-direction: column; height: 100%; min-height: 0; }

.fenster-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.fenster-head h2 { margin: 0; font-size: 17px; font-weight: 600; }

.fenster-body { display: flex; flex: 1 1 auto; min-height: 0; }

.fenster-baum {
  width: 250px; flex-shrink: 0; overflow-y: auto;
  padding: 16px 14px; border-right: 1px solid var(--line);
}
.fenster-baum details { margin-bottom: 1px; }
.fenster-baum-kinder { margin-left: 14px; }
.kategorie-knoten {
  display: block; cursor: pointer; padding: 5px 8px; border-radius: 6px;
  font-size: 13.5px; list-style: none;
}
.kategorie-knoten::-webkit-details-marker { display: none; }
.kategorie-knoten:hover { background: var(--canvas); }
.kategorie-knoten.aktiv { background: var(--accent-tint); color: var(--accent-deep); font-weight: 600; }
.kategorie-alle { margin-bottom: 8px; font-weight: 600; }

.fenster-liste-bereich { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; padding: 16px 22px; }
.fenster-suche { flex-shrink: 0; margin-bottom: 12px; }
.fenster-ergebnisse { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.fenster-tabelle { width: 100%; }
.fenster-tabelle .awf-mengenfeld { width: 90px; text-align: right; }

/* Info-Zeile (article.info_text_1) in der Artikelauswahl-Liste
   (docs/nachtrag_artikelauswahl_info_feld.md) - einzeilig mit Ellipsis, voller Text per
   title-Tooltip, damit ein langer Freitext die Zeilenhoehe der Tabelle nicht sprengt. */
.awf-info-zeile {
  display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Detail-Panel je Artikel (docs/nachtrag_artikelauswahl_verfuegbarkeit.md Abschnitt 3.4) - Zeile
   ist klickbar (ausser das Mengenfeld, siehe onclick="event.stopPropagation()" im Template),
   klappt die direkt folgende .awf-detail-zeile auf. */
.awf-artikel-zeile { cursor: pointer; }
.awf-artikel-zeile:hover { background: var(--canvas); }

/* Allgemeine klickbare Tabellenzeile (z. B. Geraete-Ansicht der Artikelliste,
   docs/SCHRITT-2-artikel-geraete-schalter.md) */
.klickbare-zeile { cursor: pointer; }
.klickbare-zeile:hover { background: var(--canvas); }
.awf-detail-zeile td { background: var(--canvas); padding: 16px 20px; }
.awf-detail-spalten { display: flex; gap: 24px; }
.awf-detail-spalte { flex: 1 1 0; min-width: 0; }
.awf-detail-spalte h4 {
  margin: 0 0 8px; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .03em; color: var(--muted);
}
.awf-detail-tabelle { width: 100%; font-size: 13px; }
.awf-kollision-zeile { cursor: pointer; }
.awf-kollision-zeile:hover { background: var(--surface); }

.fenster-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-top: 1px solid var(--line);
  flex-shrink: 0;
}

/* Check-out-Fenster (docs/auftrag_check_out_kollisionspruefung.md Punkt 2) - roter Rahmen, solange
   der Kollisionspruefung-Schalter aus ist bzw. die (Nachhol-)Pruefung fuer den Job noch offen ist,
   Zustand per JS-Klasse gesteuert (checkoutRahmenAktualisieren() in _checkout_fenster.html). */
.checkout-kollision-warnung {
  outline: 2px solid var(--danger);
  outline-offset: -2px;
  border-radius: var(--radius);
}
.fenster-tabelle .checkout-mengenfeld { width: 100px; text-align: right; }

/* Uebermengen-Warnung im Check-out (docs/auftrag_checkout_ueber_soll_warnung.md) - eigene Klassen
   statt Inline-Style, da beide sowohl serverseitig (Ist > Soll beim Rendern) als auch clientseitig
   per JS (Geraete-Checkbox/Bulk-Feld, _checkout_fenster.html) gesetzt werden. */
.checkout-position-ueber-soll { background: var(--danger-tint); }
.checkout-mengenfeld-ueber-soll { outline: 2px solid var(--danger); outline-offset: -1px; }

/* Duplikate-Vergleichsfenster (docs/SCHRITT-3-duplikate-zusammenfuehren.md Abschnitt 4) */
.duplikate-vergleich-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px 22px; }
.duplikate-vergleich-tabelle { width: 100%; border-collapse: collapse; }
.duplikate-vergleich-tabelle th, .duplikate-vergleich-tabelle td {
  padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left;
}
.duplikate-vergleich-tabelle thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.duplikate-vergleich-tabelle td.zelle-abweichend { background: #FFF6DC; }
.feld-entscheidung { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 4px 0; }
.feld-entscheidung select { min-height: 32px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line-strong); font-size: 13px; }
.feld-entscheidung .hint { margin: 0; flex-basis: 100%; }

/* ---------- Vollfenster (fast fensterfuellendes Overlay, aktuell nur Auftrag anlegen/bearbeiten) ---------- */
/* Nutzt denselben .overlay-Backdrop wie Drawer/Fenster (base.html), aber einen eigenen, deutlich
   groesseren zentrierten Container - fuer Formulare mit vielen Feldern, bei denen die schmale
   Drawer-Seitenspalte zu beengt ist. */
.vollfenster {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -48%);
  width: 96vw; max-width: 1200px;
  height: 92vh; max-height: 1000px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(20,22,28,.25);
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 50;
  display: flex; flex-direction: column;
  overflow: hidden;
}
body.vollfenster-open .overlay { opacity: 1; pointer-events: auto; }
body.vollfenster-open .vollfenster { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }

/* Gleicher Flex-Grund wie #drawer-inhalt/#fenster-inhalt (siehe Kommentar dort). */
#vollfenster-inhalt { display: flex; flex-direction: column; height: 100%; min-height: 0; }

.vollfenster-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 26px; border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.vollfenster-head h2 { margin: 0; font-size: 17px; font-weight: 600; }

/* max-width haelt einzelne Felder auch bei sehr breiten Fenstern lesbar - "fensterfuellend"
   bezieht sich auf den Dialog-Rahmen, nicht auf beliebig lang gezogene Eingabefelder. */
.vollfenster-body { padding: 26px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.vollfenster-body form { max-width: 640px; margin: 0 auto; }

/* ---------- Formular ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--ink-soft);
}
.field .hint { font-weight: 400; color: var(--muted); }
.field input[type="text"],
.field input[type="number"],
.field input[type="date"],
.field input[type="password"],
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
  background: var(--surface);
  color: var(--ink);
}
.field textarea { padding: 10px 12px; resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
/* Passwortfeld mit Sichtbar-Umschalter (Klick auf das Auge-Symbol zeigt/verbirgt die Eingabe,
   z. B. um Tippfehler beim Anlegen eines Benutzers zu bemerken). */
.passwort-feld { position: relative; }
.passwort-feld input { padding-right: 44px; }
.passwort-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  padding: 8px;
  color: var(--muted);
}
.passwort-toggle:hover { color: var(--ink); }
.field-error {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--danger);
}

/* Abweichungs-Hinweis vor manuellem PDF-Nachdruck/Rechnungserstellung, wenn der Job seit dem
   letzten Bestaetigungs-Snapshot inhaltlich geaendert wurde (_job_weicht_von_letztem_snapshot_ab(),
   Nachtrag Abweichungs-Warnung). Bewusst kein neuer Farbton - nutzt dieselben --danger-Token wie
   .field-error/.checkout-kollision-warnung, nur als Box statt reinem Text. */
.hinweisbox-abweichung {
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  background: var(--danger-tint);
  color: var(--ink);
  font-size: 13px;
}
.hinweisbox-abweichung strong { display: block; margin-bottom: 2px; color: var(--danger); }

/* Auftrag kopieren (docs/abgearbeitet/auftrag_kopieren_funktion.md): Datum aus dem Vorauftrag
   liegt ausserhalb des neuen Zeitraums. Nicht nur Farbe - Fettdruck, Unterstreichung und das
   Warnzeichen im Text bzw. der Tooltip tragen dieselbe Aussage. */
.datum-pruefen {
  color: var(--danger);
  font-weight: 600;
  text-decoration: underline wavy var(--danger);
  text-underline-offset: 3px;
}
.hinweisbox-kopie {
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-tint);
  color: var(--ink);
  font-size: 13px;
}
.field.inline {
  display: flex; align-items: center; gap: 10px;
}
.field.inline input { width: auto; min-height: auto; }
.field.inline label { margin-bottom: 0; }

/* Toggle-Switch (echter Schalter statt Checkbox, z. B. Artikel-/Geraete-Ansicht in der
   Artikelsuche, docs/SCHRITT-2-artikel-geraete-schalter.md) - technisch bleibt es eine
   Checkbox (HTML kennt keinen nativen Toggle-Typ), optisch aber als Schalter/Slider gestaltet. */
.toggle-switch { display: flex; align-items: center; gap: 10px; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--line-strong); border-radius: 999px;
  transition: background .15s ease;
}
.switch .slider::before {
  content: ""; position: absolute; left: 3px; bottom: 3px;
  height: 16px; width: 16px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 2px rgba(20,22,28,.25);
  transition: transform .15s ease;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }

.form-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  padding-top: 8px; border-top: 1px solid var(--line); margin-top: 22px;
  position: sticky; bottom: 0;
  background: var(--surface);
}

/* Zwei Felder nebeneinander */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Abschnittsueberschrift innerhalb eines langen Formulars (z. B. Kunden-Formular) */
.form-section-head {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 26px 0 14px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.form-section-head:first-child { margin-top: 0; padding-top: 0; border-top: none; }

/* ---------- Faktor-Stufen (dynamische Formularzeilen) ---------- */
.stufen-liste { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.stufe-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.stufe-row .field { margin-bottom: 0; }
.stufen-chip { font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft); }

/* ---------- Kundenauswahl (durchsuchbares Kombinationsfeld, Job-Formular) ---------- */
.kunden-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 240px;
  overflow-y: auto;
  z-index: 10;
}
.kunden-dropdown-item { padding: 10px 12px; cursor: pointer; font-size: 14px; }
.kunden-dropdown-item:hover { background: var(--canvas); }
.kunden-dropdown-empty { padding: 10px 12px; color: var(--muted); font-size: 13px; }

/* ---------- Einsatzort-Auswahl (durchsuchbares Kombinationsfeld, Job-Formular) ---------- */
.orte-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 240px;
  overflow-y: auto;
  z-index: 10;
}
.orte-dropdown-item { padding: 10px 12px; cursor: pointer; font-size: 14px; }
.orte-dropdown-item:hover { background: var(--canvas); }
.orte-dropdown-context { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.orte-dropdown-empty { padding: 10px 12px; color: var(--muted); font-size: 13px; }

/* ---------- Datumsbereich-Kalender (Eigenbau, Job-Formular Erster/Letzter Einsatztag) ---------- */
.datumsbereich { position: relative; }
.datumsbereich-feld { position: relative; }
/* Deckt das native Kalender-Icon in <input type="date"> ab, das browserabhaengig (Chrome/Edge,
   Firefox, Safari je unterschiedlich implementiert) ein eigenstaendig klickbares Element ist -
   ohne dieses Overlay oeffnete ein Klick genau auf das Icon ZUSAETZLICH den browsereigenen
   Kalender neben unserem eigenen Popover. Siehe datumsbereich.js fuer die Klick-Weiterleitung. */
.datumsbereich-overlay { position: absolute; inset: 0; cursor: pointer; z-index: 1; }
.datumsbereich-popover {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  width: 280px;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 12px;
  z-index: 10;
}
.datumsbereich-popover.offen { display: block; }
.datumsbereich-kopf { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.datumsbereich-monat { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.datumsbereich-nav {
  border: none; background: none; cursor: pointer;
  width: 26px; height: 26px; border-radius: var(--radius-sm);
  font-size: 16px; line-height: 1; color: var(--ink-soft);
}
.datumsbereich-nav:hover { background: var(--canvas); }
.datumsbereich-hinweis { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.datumsbereich-raster { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.datumsbereich-wochentag {
  font-size: 11px; font-weight: 600; color: var(--muted); text-align: center; padding-bottom: 4px;
}
.datumsbereich-tag {
  border: none; background: none; cursor: pointer;
  height: 30px; border-radius: var(--radius-sm);
  font-size: 13px; font-family: inherit; color: var(--ink);
}
.datumsbereich-tag:hover { background: var(--canvas); }
.datumsbereich-tag.ausserhalb { color: var(--muted); opacity: .55; }
.datumsbereich-tag.heute { box-shadow: inset 0 0 0 1px var(--line-strong); }
.datumsbereich-tag.im-bereich { background: var(--accent-tint); border-radius: 0; }
.datumsbereich-tag.rand { background: var(--accent); color: #fff; font-weight: 600; }

/* ---------- Tabellen-Abschnittskopf (z. B. Global / Kundenspezifisch) ---------- */
.table-section-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #FBFCFD;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Label/Wert-Paare (z. B. Mitarbeiter-Detailseite) ---------- */
.kv { margin-bottom: 16px; }
.kv .k { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.kv .v { font-size: 15px; line-height: 1.5; }

/* ---------- Dashboard-Kacheln ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--ink);
  display: block; box-shadow: var(--shadow);
}
.tile:hover { border-color: var(--line-strong); }
.tile .k { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.tile .v { font-size: 17px; font-weight: 600; margin-top: 4px; }
.tile .d { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* ---------- Neuigkeiten (Mitarbeiter-Changelog) ---------- */
.changelog-liste { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.changelog-eintrag {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
}
.changelog-datum { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.changelog-titel { font-size: 16px; font-weight: 600; margin-top: 4px; }
.changelog-text { font-size: 14px; line-height: 1.6; color: var(--ink); margin-top: 8px; }

/* ---------- Einsatzplanung (Kapazitaetsmatrix Tag x Personaltyp) ---------- */
.ep-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.ep-zeitraum { font-size: 13px; color: var(--muted); font-family: var(--mono); }
.ep-scroll { overflow-x: auto; }
.ep-matrix { min-width: 760px; }
.ep-matrix th, .ep-matrix td { text-align: center; white-space: nowrap; }
.ep-matrix th:first-child, .ep-matrix td:first-child { text-align: left; white-space: normal; }
.ep-matrix th.heute, .ep-matrix td.heute { background: var(--accent-tint); }
.ep-tag-wochentag {
  display: block; font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 2px;
}
.ep-zelle-btn {
  min-width: 32px; padding: 4px 9px; border: 1px solid var(--accent-tint); border-radius: 20px;
  background: var(--surface); color: var(--accent-deep);
  font-family: var(--mono); font-weight: 600; font-size: 13px; cursor: pointer;
}
.ep-zelle-btn:hover { background: var(--accent); color: #FFFFFF; }

/* ---------- Kalender-Sync-Banner (Fehler/Konflikte, base.html) ---------- */
.kalender-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 20px;
  background: var(--danger);
  color: #FFFFFF;
  font-size: 13.5px;
  font-weight: 500;
}
.kalender-banner a { color: #FFFFFF; text-decoration: underline; white-space: nowrap; }

/* ---------- Bearbeitungssperre (docs/spezifikation_auftrags_sperre.md) ---------- */
.sperre-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 12px 18px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  background: var(--accent-tint);
  color: var(--ink);
  font-size: 13.5px;
}
.sperre-banner.dringend { background: var(--danger-tint); }
.sperre-banner-text { flex: 1 1 260px; }
.sperre-banner-aktionen { display: flex; gap: 8px; flex-shrink: 0; }
.sperre-banner-kommentar {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
}
.sperre-banner-kommentar input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font: inherit;
}
.sperre-status { font-size: 13.5px; color: var(--muted); }
.sperre-status p { margin: 0 0 10px; }
.sperre-status-frei p { color: var(--ok); font-weight: 600; }
.sperre-status-dringend p { color: var(--danger); font-weight: 600; }

/* ---------- Mobiler Kamera-Scan (Barcode + OCR-Fallback), docs/spezifikation_mobiler_checkin_scan.md ---------- */
/* Barcode-Eingabezeile in Check-out-/Check-in-Fenster: Textfeld + Kamera-Icon-Button. Das
   Eingabefeld traegt bewusst keine .field-Klasse (siehe Docstrings der Fenster-Templates), daher
   hier die 44px-Touch-Mindesthoehe explizit statt ueber .field input zu erben. */
.scan-feld-zeile { display: flex; gap: 8px; align-items: stretch; max-width: 420px; }
.scan-feld-zeile input[type="text"] {
  flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 15px; background: var(--surface); color: var(--ink);
}
.scan-feld-zeile input[type="text"]:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint);
}
.scan-knopf { flex: none; min-width: 44px; min-height: 44px; padding: 0; justify-content: center; font-size: 18px; }
.scan-ocr-link {
  display: inline-block; margin-top: 8px; padding: 4px 0; background: none; border: none;
  color: var(--accent); font-family: inherit; font-size: 12.5px; text-decoration: underline;
  cursor: pointer;
}
.scan-ocr-link:hover { color: var(--accent-deep); }

/* Scan-Historie (letzte 10), docs/2026-09-24_auftrag_checkin_checkout_fokus_sound_historie.md
   Baustein D - neben dem Scan-Feld, auf schmalen Viewports darunter (siehe 600px-Breakpoint
   unten). */
.scan-mit-historie { display: flex; gap: 16px; align-items: flex-start; }
.scan-feld-block { flex: 1 1 auto; min-width: 0; }
.scan-historie { flex: 0 0 190px; max-height: 150px; overflow-y: auto; font-size: 12.5px; }
.scan-historie ol { margin: 0; padding-left: 18px; }
.scan-historie li { padding: 1px 0; }
.scan-historie li.scan-historie-erfolg { color: var(--ok); }
.scan-historie li.scan-historie-fehler { color: var(--danger); }

/* Kleines, eigenstaendiges Kamera-Overlay (kein .fenster/.vollfenster noetig) - liegt ueber allen
   anderen Overlays (hoeherer z-index als .fenster/.vollfenster mit 50), da es von INNERHALB eines
   bereits offenen Check-out-/Check-in-Fensters geoeffnet wird. */
.scan-kamera-overlay {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(20,22,28,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.scan-kamera-overlay[hidden] { display: none; }
.scan-kamera-box {
  width: 100%; max-width: 480px; background: var(--surface); border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(20,22,28,.35); overflow: hidden;
  display: flex; flex-direction: column;
}
.scan-kamera-kopf {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.scan-kamera-kopf h3 { margin: 0; font-size: 15px; font-weight: 600; }
#scan-kamera-video { width: 100%; max-height: 60vh; background: #000; display: block; }
.scan-kamera-fehler { margin: 14px 16px 0; color: var(--danger); font-size: 13.5px; }
.scan-kamera-fuss { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 16px; }

/* ---------- Mobiler Einstieg (lager/mobil.html): Kartenliste statt Tabelle ---------- */
.mobil-suche-form {
  display: grid; grid-template-columns: 1.4fr auto; gap: 14px; max-width: 560px;
  align-items: end; margin-bottom: 18px;
}
.karten-liste { display: flex; flex-direction: column; gap: 10px; max-width: 560px; }
.karte-auftrag {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px;
}
.karte-auftrag-kopf { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.karte-auftrag-name { font-weight: 600; margin-bottom: 4px; }
.karte-auftrag-aktionen { display: flex; gap: 10px; margin-top: 12px; }
.karte-auftrag-aktionen .btn { flex: 1 1 0; justify-content: center; }

/* ---------- Responsiv ---------- */
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; flex-wrap: wrap;
    align-items: center; gap: 8px 16px;
  }
  .sidebar .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar .nav-group { margin-top: 0; display: contents; }
  .sidebar .nav-group-items { display: contents !important; }
  .sidebar-foot, .nav-group-label { display: none; }
  .content { padding: 18px; }
  .topbar { padding: 16px 18px; }
  html.topbar-pinned .topbar { padding: 8px 18px; }
}

/* Handy-Breakpoint (docs/spezifikation_mobiler_checkin_scan.md Abschnitt 3.2) - bewusst enger als
   der obige 820px-Breakpoint, der nur die Sidebar/das Layout betrifft: hier geht es wirklich nur
   um Handy-Screens, nicht Tablets/kleine Laptops. .fenster/.vollfenster werden zum echten
   Vollbild statt schwebendem, mittig zentriertem Kasten. */
@media (max-width: 600px) {
  .fenster, .vollfenster {
    width: 100vw; max-width: none; height: 100vh; max-height: none;
    border-radius: 0; top: 0; left: 0; transform: translateY(8px);
  }
  body.fenster-open .fenster,
  body.vollfenster-open .vollfenster { transform: translateY(0); }
  .mobil-suche-form { grid-template-columns: 1fr; }
  .scan-feld-zeile { max-width: none; }
  .scan-mit-historie { flex-direction: column; }
  .scan-historie { flex: none; width: 100%; max-height: 110px; }
}

@media (prefers-reduced-motion: reduce) {
  .drawer, .overlay, .fenster, .vollfenster { transition: none; }
}

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--canvas);
}
.login-card {
  width: 100%;
  max-width: 360px;
  padding: 34px 30px 30px;
}
.login-card .brand { padding: 0; margin-bottom: 26px; }
.login-card .brand-name { color: var(--ink); }

/* ---------- Bild-Galerie (Artikelbilder/Einzelstueckbilder) ---------- */
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.galerie-bild {
  position: relative; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: var(--canvas); aspect-ratio: 1 / 1;
}
.galerie-bild img { width: 100%; height: 100%; object-fit: cover; display: block; }
.galerie-bild .galerie-aktionen {
  position: absolute; inset: auto 0 0 0; display: flex; gap: 4px; padding: 6px;
  background: linear-gradient(to top, rgba(0,0,0,.55), transparent); opacity: 0; transition: opacity .15s;
}
.galerie-bild:hover .galerie-aktionen { opacity: 1; }
.galerie-bild .galerie-aktionen .btn { background: #FFFFFF; }
.galerie-bild .galerie-hauptbild-marke {
  position: absolute; top: 6px; left: 6px; background: var(--accent); color: #FFFFFF;
  font-size: 10px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 999px;
}
.galerie-bild .galerie-note {
  position: absolute; inset: auto 0 0 0; padding: 6px 8px; font-size: 11px; color: #FFFFFF;
  background: linear-gradient(to top, rgba(0,0,0,.7), transparent); text-align: left;
}
.galerie-platzhalter {
  width: 64px; height: 64px; border-radius: var(--radius); background: var(--canvas);
  border: 1px dashed var(--line-strong); display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 10px; text-align: center; flex: none;
}

/* ---------- Geraetenotizen (asset_note) ---------- */
.notiz-liste { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.notiz-eintrag { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.notiz-meta { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.notiz-text { font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; margin-bottom: 6px; }

/* ---------- Sammelbearbeitung Bestandsliste ---------- */
.sammelleiste {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px;
  padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--canvas);
}
.sammelleiste-anzahl { font-size: 13px; font-weight: 500; margin-right: 4px; }
.sammelleiste select { min-height: 34px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line-strong); font-size: 13px; }

/* ---------- Hilfe (Anleitung + KI-Hilfe-Chat), docs/spezifikation_hilfe_anleitung_chat.md ---------- */
.hilfe-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid var(--line-strong); color: var(--muted);
  font-size: 12px; font-weight: 600; text-decoration: none; flex: none;
}
.hilfe-icon:hover { border-color: var(--accent); color: var(--accent); }

/* Rendertext der Markdown-Artikel (app/hilfe_service.py) - generisches table-Styling greift
   bereits global, hier nur Ueberschriften-/Absatz-/Listenabstand fuer lesbaren Fliesstext. */
.hilfe-artikel h2 { font-size: 17px; font-weight: 600; margin: 26px 0 10px; }
.hilfe-artikel h2:first-child { margin-top: 0; }
.hilfe-artikel h3 { font-size: 14.5px; font-weight: 600; margin: 20px 0 8px; }
.hilfe-artikel p, .hilfe-artikel ul, .hilfe-artikel ol { line-height: 1.6; margin: 0 0 14px; }
.hilfe-artikel ul, .hilfe-artikel ol { padding-left: 22px; }
.hilfe-artikel li { margin-bottom: 4px; }
.hilfe-artikel hr { border: none; border-top: 1px solid var(--line); margin: 22px 0; }
.hilfe-artikel table { margin-bottom: 14px; }
.hilfe-artikel code { background: var(--canvas); padding: 1px 5px; border-radius: 4px; font-family: var(--mono); font-size: 12.5px; }
.hilfe-artikel a { color: var(--accent); }

/* Floating Hilfe-Chat-Knopf + Panel - bewusst EIGENES Overlay, kein Drawer (base.html Abschnitt
   "KI-Hilfe-Chat"), damit ein zeitgleich offenes Bearbeiten-Formular nicht ueberschrieben wird. */
.hilfe-chat-knopf {
  position: fixed; right: 24px; bottom: 24px; z-index: 60;
  width: 52px; height: 52px; border-radius: 50%;
  border: none; background: var(--accent); color: #FFFFFF;
  font-size: 22px; line-height: 1; cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.hilfe-chat-knopf:hover { background: var(--accent-deep); }
/* Der Knopf sitzt in der gleichen Bildschirmecke wie die Speichern-Buttons von Drawer/Fenster/
   Vollfenster (.form-actions liegt dort rechtsbuendig) - bei laengeren Formularen landet der
   Speichern-Button optisch UNTER diesem Knopf, der wegen z-index:60 trotzdem alle Klicks
   abfaengt ("Klick auf Speichern tut nichts", siehe Bugreport 1. September 2026). Deshalb hier
   ausgeblendet, solange irgendein Overlay offen ist - stoert das dokumentierte "Chat parallel
   zur Fachseite offen halten" nicht, da sich das auf das bereits geoeffnete Panel bezieht, nicht
   auf den Knopf zum Oeffnen. */
body.drawer-open .hilfe-chat-knopf,
body.fenster-open .hilfe-chat-knopf,
body.vollfenster-open .hilfe-chat-knopf { display: none; }
.hilfe-chat-panel {
  position: fixed; right: 24px; bottom: 88px; z-index: 60;
  width: 360px; max-width: calc(100vw - 48px);
  height: 480px; max-height: calc(100vh - 140px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0,0,0,.18);
  opacity: 0; pointer-events: none; transform: translateY(12px);
  transition: opacity .15s ease, transform .15s ease;
}
.hilfe-chat-panel.offen { opacity: 1; pointer-events: auto; transform: translateY(0); }
/* KERN-36: Auch das geoeffnete Panel (z-index 60) lag ueber den rechtsbuendigen Speichern-Knoepfen von
   Drawer/Fenster/Vollfenster (z-index 50) und fing deren Klicks ab. Solange ein Overlay offen ist,
   rutscht es dahinter; nach dem Schliessen ist es unveraendert wieder da. */
body.drawer-open .hilfe-chat-panel,
body.fenster-open .hilfe-chat-panel,
body.vollfenster-open .hilfe-chat-panel { z-index: 40; }
.hilfe-chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line); flex: none;
}
.hilfe-chat-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.hilfe-chat-verlauf { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.hilfe-chat-nachricht { font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; padding: 8px 11px; border-radius: 10px; max-width: 88%; }
.hilfe-chat-frage { align-self: flex-end; background: var(--accent-tint); color: var(--ink); }
.hilfe-chat-antwort { align-self: flex-start; background: var(--canvas); color: var(--ink); }
.hilfe-chat-form { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); flex: none; }
.hilfe-chat-form input[type="text"] { flex: 1 1 auto; min-width: 0; }

/* Globale Fehlermeldung bei fehlgeschlagenen htmx-Anfragen (app/static/htmx-fehler.js, Code-Review
   V271) - oben mittig statt unten rechts (dort liegen die Speichern-Knoepfe der Overlays) und mit
   z-index 80 ueber Topbar (20), Overlays (40-60) und Kamera-Scan (70), damit sie auch aus einem
   offenen Vollfenster heraus sichtbar ist. */
.htmx-fehlermeldung {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 80;
  display: flex; align-items: flex-start; gap: 12px;
  width: max-content; max-width: min(560px, calc(100vw - 32px));
  padding: 12px 14px 12px 16px;
  background: var(--danger-tint); color: var(--ink);
  border: 1px solid var(--danger); border-left-width: 4px; border-radius: var(--radius-sm);
  box-shadow: 0 12px 32px rgba(0,0,0,.18);
  font-size: 14px; line-height: 1.4;
}
.htmx-fehlermeldung[hidden] { display: none; }
.htmx-fehlermeldung-text { flex: 1; }
.htmx-fehlermeldung-schliessen {
  border: none; background: none; color: var(--danger); cursor: pointer;
  font-size: 20px; line-height: 1; padding: 0 2px;
}
