/* Werkbank — eigenständiges Design-System („Werkstatt-klar") */
:root {
  --primary: #1d3e5e;
  --primary-dark: #142c44;
  --accent: #e8a13c;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --border: #dde3ea;
  --text: #1d2733;
  --text-muted: #64748b;
  --ok: #2e7d32;
  --warn: #b26a00;
  --error: #b3261e;
  --radius: 8px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 230px; flex-shrink: 0;
  background: var(--primary-dark); color: #e7edf4;
  display: flex; flex-direction: column;
}
.brand {
  padding: 16px 18px; font-size: 17px; font-weight: 700; letter-spacing: .4px;
  color: #fff; border-bottom: 1px solid rgba(255,255,255,.12);
}
.brand-mark { color: var(--accent); }
.sidebar nav { padding: 8px 0; overflow-y: auto; }
.sidebar nav a, .sidebar nav summary {
  display: block; padding: 8px 18px; color: #cdd9e5; cursor: pointer;
  font-size: 13.5px; border-left: 3px solid transparent;
}
.sidebar nav a:hover, .sidebar nav summary:hover {
  background: rgba(255,255,255,.06); color: #fff; text-decoration: none;
}
.sidebar nav details a { padding-left: 32px; font-size: 13px; }
.sidebar nav details[open] summary { color: #fff; border-left-color: var(--accent); }
.sidebar nav summary::marker { color: var(--accent); }
.sidebar nav a.muted { color: #8ba3ba; margin-top: 8px; }

/* Topbar */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 22px;
}
.global-search input {
  width: 340px; max-width: 50vw; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg);
}
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.user-chip { color: var(--text-muted); font-size: 13px; }
.quick-new { position: relative; }
.quick-new summary {
  list-style: none; cursor: pointer; background: var(--primary); color: #fff;
  padding: 8px 16px; border-radius: var(--radius); font-weight: 600;
}
.quick-new .menu {
  position: absolute; right: 0; top: 110%; z-index: 50; min-width: 160px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(16,32,48,.14); padding: 6px 0;
}
.quick-new .menu a { display: block; padding: 7px 14px; }
.quick-new .menu a:hover { background: var(--bg); text-decoration: none; }

/* Content */
.content { padding: 22px; max-width: 1500px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 20px; color: var(--primary-dark); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(16,32,48,.05);
}
.card h2, .card h3 { margin-top: 0; color: var(--primary-dark); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

/* Buttons — nur Klassenselektoren: `button.btn` (0-1-1) schlug frueher `.btn-primary`
   (0-1-0), Hauptknoepfe waren weiss statt farbig (Nachbesserung A2). font-family
   erbt, sonst zeichnet der Browser <button> in seiner eigenen Schrift. */
.btn {
  display: inline-block; padding: 8px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 13.5px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #2a1c04; font-weight: 600; }
.btn-danger { color: var(--error); border-color: #e7c2c0; }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }

/* Gefahrenbereich (A4): folgenreiche Aktionen abgesetzt, mit Abstand und Fingerhoehe 44 px */
.gefahrenbereich { margin-top: 22px; padding: 14px; border: 1px solid #e7c2c0; border-radius: var(--radius); }
.gefahrenbereich h4 { margin: 0 0 10px; color: var(--error); font-size: 13.5px; }
.gefahrenbereich .btn { min-height: 44px; min-width: 44px; }
.gefahrenbereich form + form { margin-top: 16px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; background: var(--surface); }
table.list th, table.list td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
table.list th { background: var(--bg); font-weight: 600; color: var(--text-muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .3px; white-space: nowrap; }
table.list tr:hover td { background: #f8fafc; }
table.list td.num, table.list th.num { text-align: right; white-space: nowrap; }
.filter-row input, .filter-row select { width: 100%; padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; font-size: 12.5px; }

/* Forms */
form.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 12px; }
form.form label { display: block; font-size: 12.5px; color: var(--text-muted); margin-bottom: 3px; }
/* Ein langer Eintrag darf ein Auswahlfeld nicht ueber den Bildschirm treiben —
   das Handy verkleinert sonst die ganze Seite (Nachbesserung F6). */
select { max-width: 100%; }
form.form input, form.form select, form.form textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 13.5px; background: #fff;
}
form.form textarea { min-height: 80px; resize: vertical; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 14px; padding: 12px 14px; }
legend { font-weight: 600; color: var(--primary-dark); padding: 0 6px; }

/* Status-Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--text-muted); white-space: nowrap; }
.badge-gruen { background: #e5f2e6; color: var(--ok); }
.badge-gelb { background: #fdf0dc; color: var(--warn); }
.badge-rot { background: #fbe9e7; color: var(--error); }
.badge-blau { background: #e3ecf5; color: var(--primary); }
/* Uebersicht „Neu seit der letzten Anmeldung“ (Betreiber 12.10.): kraeftig, nicht zu uebersehen. */
.badge-neu { background: #c2410c; color: #fff; }
.neu-hervorgehoben { border-left: 6px solid #c2410c; background: #fff7ed; }
.neu-summe { display: flex; flex-wrap: wrap; gap: 6px; font-size: 15px; }
.neu-summe .badge { font-size: 14px; padding: 4px 12px; }
.neu-liste li { margin: 4px 0; }

/* Flash */
.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; }
.flash-success { background: #e5f2e6; color: var(--ok); }
.flash-error { background: #fbe9e7; color: var(--error); }
.flash-warning { background: #fff3cd; color: #7a5200; }
/* Dauerhinweis Bigin-Abgleich (kein Flash: steht, solange der Zustand besteht) */
.hinweisleiste { background: #fff3cd; color: #7a5200; padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; }
.flash-message, .flash-info { background: #e3ecf5; color: var(--primary); }

/* Kanban */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { min-width: 240px; width: 240px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; flex-shrink: 0; }
.kanban-col h4 { margin: 0 0 10px; font-size: 13px; color: var(--text-muted); }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 9px 11px; margin-bottom: 8px; box-shadow: 0 1px 2px rgba(16,32,48,.06); }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi .kpi-value { font-size: 22px; font-weight: 700; color: var(--primary-dark); }
.kpi .kpi-label { font-size: 12.5px; color: var(--text-muted); }
a.kpi { display: block; color: inherit; text-decoration: none; }
a.kpi:hover, a.kpi:focus-visible { border-color: var(--primary); }

/* Login */
.login-box { max-width: 380px; margin: 12vh auto; }

/* Plantafel */
.scheduler { display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.scheduler > div { background: var(--surface); padding: 6px 8px; min-height: 34px; font-size: 12.5px; }
.scheduler .head { background: var(--bg); font-weight: 600; }
.scheduler .res { background: var(--bg); font-weight: 600; }
.scheduler .slot-termin { background: #e3ecf5; border-radius: 4px; padding: 2px 6px; margin: 1px 0; display: block; }

/* Seitentitel, Lupe und ☰ gehoeren dem Handy (A1) -- am Rechner bleibt die Kopfzeile,
   wie sie war. */
.seitentitel, .lupe, .nav-schalter { display: none; }

/* Mobile / Monteur */
@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; }
  /* Kopfzeile am Handy: Logo, Seitentitel, Lupe, ☰ -- mehr nicht. Menue und
     Kopfleiste klappen darunter auf (A1). */
  .brand { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
  .brand-titel { flex-shrink: 0; }
  .seitentitel {
    display: block; flex: 1; min-width: 0; font-size: 14px; font-weight: 400;
    color: #cdd9e5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .lupe, .nav-schalter {
    display: flex; align-items: center; justify-content: center;
    min-width: 44px; min-height: 44px; font-size: 20px; line-height: 1;
    background: none; border: 0; color: #fff; cursor: pointer; text-decoration: none;
  }
  #hauptmenue, .topbar { display: none; }
  .menue-offen #hauptmenue { display: block; }
  .menue-offen .topbar { display: flex; flex-wrap: wrap; gap: 10px; }
  .menue-offen .topbar .global-search { flex: 1 1 100%; }
  .sidebar nav a, .sidebar nav summary { padding: 11px 18px; font-size: 15px; }
  .topbar-actions { flex-wrap: wrap; gap: 10px 14px; }
  .topbar-actions .btn-link { padding: 11px 0; font-weight: 600; }
  .global-search input { width: 100%; max-width: 100%; }
}
.muted { color: var(--text-muted); }
.right { text-align: right; }
.mt { margin-top: 14px; }
.summenblock td { font-weight: 600; }

/* Bauplanung: Anwenden und Abbrechen der Vorschau -- Fingerhoehe und Abstand auf 390 px
   (Vertretung Darius am Handy, Plan A7; Gegenlesen U1-04). Keine style-Attribute (CSP). */
.plan-aktionen { display: flex; flex-wrap: wrap; align-items: center; gap: 28px; margin-top: 20px; }
.plan-aktionen .btn { min-height: 44px; min-width: 44px; }

/* Bauplanung P2b: die Formulare vor der Vorschau (Vorgang, Kalender) auf 390 px -- Knoepfe in
   Fingerhoehe, Haekchen neben ihrer Beschriftung statt von `form.form input` auf volle Breite
   gezogen, Abhaengigkeiten und Kalendertage als gestapelte Liste (Geraetepruefung Glied 08). */
.plan-formular .btn { min-height: 44px; min-width: 44px; }
form.plan-formular label.haken { display: flex; align-items: center; gap: 10px; min-height: 44px;
  font-size: 13.5px; color: var(--text); }
form.plan-formular label.haken input { width: 22px; height: 22px; flex: none; margin: 0; }
.plan-liste { list-style: none; margin: 0; padding: 0; }
.plan-liste > li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.plan-liste > li form { margin-top: 8px; }

/* Bauplanung P2c: Raster des Bauzeitenplans (ADR-026 G2-f) -- eine Tabelle, Klassen statt
   style-Attribute (CSP). Samstag schmal, arbeitsfreie Tage grau, Balken als Zellenfolge; die
   erste Spalte bleibt beim waagrechten Scrollen stehen. Dazu die Vorgangstabelle auf 390 px
   (Gegenlesen Glied 07 U1-05): Titel steht, die uebrigen Spalten scrollen einzeilig. */
table.raster { border-collapse: separate; border-spacing: 0; background: var(--surface);
  font-size: 12px; border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
table.raster th, table.raster td { padding: 0; height: 30px; text-align: center;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
table.raster td { overflow: hidden; white-space: nowrap; }
table.raster col { width: 26px; }
table.raster col.sa { width: 14px; }
table.raster thead th { background: var(--bg); color: var(--text-muted); font-weight: 600;
  white-space: nowrap; }
table.raster th.woche { padding: 0 6px; text-align: left; }
table.raster th.tag, table.raster td { min-width: 26px; }
table.raster th.sa, table.raster td.sa { min-width: 14px; width: 14px; font-size: 10px; }
table.raster th.titel { position: sticky; left: 0; z-index: 1; min-width: 20em; max-width: 24em;
  padding: 4px 8px; text-align: left; font-weight: 400; background: var(--surface); }
table.raster thead th.titel { z-index: 2; background: var(--bg); }
table.raster td.balken, .raster-legende .balken { background: #8fb0d0; color: var(--primary-dark); }
table.raster td.anfang { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
table.raster td.ende { border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
table.raster td.extern, .raster-legende .extern {
  background: repeating-linear-gradient(135deg, #8fb0d0 0 3px, #e3ecf5 3px 6px); }
table.raster td.fertig, .raster-legende .fertig { background: #a8cfab; }
table.raster td.fertig.extern {
  background: repeating-linear-gradient(135deg, #a8cfab 0 3px, #e5f2e6 3px 6px); }
table.raster td.fix { font-weight: 700; }
/* vorbei: blass -- ausser fertig (Gruen und Haken bleiben sichtbar) und ueberfaellig (vorbei,
   nicht fertig gemeldet: gestrichelter Rand in Warnfarbe; Gegenlesen u1 U1-01, U1-02) */
table.raster td.vergangen, .raster-legende .vergangen { opacity: .45; }
table.raster td.vergangen.fertig { opacity: 1; }
table.raster td.ueberfaellig, .raster-legende .ueberfaellig { opacity: 1;
  outline: 2px dashed var(--warn); outline-offset: -3px; }
table.raster th.heute, table.raster td.heute:not(.balken), .raster-legende .heute {
  background: #fdf0dc; }
table.raster th.heute { color: var(--warn); }
table.raster td.frei, table.raster th.frei, .raster-legende .frei { background: #d5dbe2; }
/* roter Rand je Tag, zwischen roten Nachbarn ohne Innenkante -- ein durchgehend unterbesetzter
   Balken bleibt ein Balken (U1-05) */
table.raster td.unterbesetzt, .raster-legende .unterbesetzt {
  box-shadow: inset 0 2px 0 var(--error), inset 0 -2px 0 var(--error),
    inset 2px 0 0 var(--error), inset -2px 0 0 var(--error); }
table.raster td.unterbesetzt + td.unterbesetzt {
  box-shadow: inset 0 2px 0 var(--error), inset 0 -2px 0 var(--error),
    inset -2px 0 0 var(--error); }
table.raster td.unterbesetzt:has(+ td.unterbesetzt) {
  box-shadow: inset 0 2px 0 var(--error), inset 0 -2px 0 var(--error),
    inset 2px 0 0 var(--error); }
table.raster td.unterbesetzt + td.unterbesetzt:has(+ td.unterbesetzt) {
  box-shadow: inset 0 2px 0 var(--error), inset 0 -2px 0 var(--error); }
.raster-legende .probe { display: inline-block; width: 18px; height: 12px; border-radius: 3px;
  vertical-align: middle; }
.raster-legende .eintrag { display: inline-block; margin-right: 14px; white-space: nowrap; }
.raster-wischen { display: none; }
@media print {
  table.raster td, table.raster th, .raster-legende .probe {
    print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
table.vorgaenge { border-collapse: separate; border-spacing: 0; }
table.vorgaenge td:first-child, table.vorgaenge th:first-child { position: sticky; left: 0;
  z-index: 1; background: var(--surface); }
table.vorgaenge th:first-child { background: var(--bg); }
@media (max-width: 860px) {
  table.raster th.titel { min-width: 8em; max-width: 8em; }
  table.raster th.titel a { display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden; line-height: 1.2; overflow-wrap: anywhere; }
  .raster-wischen { display: block; margin: 4px 0 0; font-size: 12px; }
  .raster-legende .eintrag.lang { white-space: normal; }
  table.vorgaenge td, table.vorgaenge th { white-space: nowrap; }
  table.vorgaenge td:first-child { white-space: normal; }
  table.vorgaenge td:first-child a { display: block; width: 9em; overflow-wrap: anywhere; }
}

/* Bauplanung P3a (ADR-026 Glied 10): Einsatz-Raster auf der Vorgang-Seite, Auslastung je Person
   als zweiter Rumpf im Raster des Bauzeitenplans, Bloecke 3 und 5 der Vorschau. Klassen statt
   style-Attribute (CSP); die Kaestchen haben 44 px Trefferflaeche (Vertretung am Handy). */
table.einsatz-raster { border-collapse: separate; border-spacing: 0; background: var(--surface);
  font-size: 12px; border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
table.einsatz-raster th, table.einsatz-raster td { padding: 0; min-width: 44px; height: 44px;
  text-align: center; border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border); }
table.einsatz-raster thead th { background: var(--bg); color: var(--text-muted); font-weight: 600;
  line-height: 1.2; padding: 2px 4px; }
table.einsatz-raster th.titel { position: sticky; left: 0; z-index: 1; min-width: 12em;
  padding: 4px 8px; text-align: left; font-weight: 400; background: var(--surface); }
table.einsatz-raster thead th.titel { z-index: 2; background: var(--bg); }
table.einsatz-raster label.kasten { display: flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; margin: 0; cursor: pointer; }
table.einsatz-raster label.kasten input { width: 22px; height: 22px; margin: 0; }
table.einsatz-raster .sa { background: #f3f5f8; }
table.einsatz-raster .heute { background: #fdf0dc; }
table.einsatz-raster .frei, table.einsatz-raster td.ohne, .raster-legende .frei {
  background: #d5dbe2; }
/* anderswo: blau mit gestricheltem Rand -- nicht mit dem Grau von „arbeitsfrei" und Samstag
   verwechselbar (Gegenlesen u1 U1-04) */
table.einsatz-raster td.anderswo, table.raster td.anderswo, .raster-legende .anderswo {
  background: #cfe0f1; outline: 1px dashed #5d86b0; outline-offset: -4px; }
table.raster td.hier, .raster-legende .hier { background: #8fb0d0; }
/* doppelt: satte Fuellung ohne Rahmen -- der rote Rahmen heisst oben „unterbesetzt" (U1-06) */
table.einsatz-raster td.doppelt, table.raster td.doppelt, .raster-legende .doppelt {
  background: #e79a9a; outline: none; }
table.einsatz-raster td.abwesend, table.raster td.abwesend, .raster-legende .abwesend {
  background: repeating-linear-gradient(135deg, #c4ccd6 0 3px, #eef1f4 3px 6px); }
/* eingeplant, aber abwesend: Schraffur in der Einsatzfarbe (U1-03) */
table.raster td.abwesend.hier, .raster-legende .abwesend.hier {
  background: repeating-linear-gradient(135deg, #8fb0d0 0 3px, #eef1f4 3px 6px); }
table.raster td.abwesend.anderswo, table.einsatz-raster td.abwesend.anderswo {
  background: repeating-linear-gradient(135deg, #cfe0f1 0 3px, #eef1f4 3px 6px); }
/* Samstag: halber Tag -- nur die untere Haelfte der schmalen Zelle ist gefuellt; die
   Kombinationen stehen einzeln, sonst schluege `halb` „doppelt" und „abwesend" (U1-03) */
table.raster td.halb.hier {
  background: linear-gradient(to top, #8fb0d0 50%, var(--surface) 50%); }
table.raster td.halb.anderswo {
  background: linear-gradient(to top, #cfe0f1 50%, var(--surface) 50%); }
table.raster td.halb.doppelt {
  background: linear-gradient(to top, #e79a9a 50%, var(--surface) 50%); }
table.raster td.halb.abwesend {
  background: linear-gradient(to top, transparent 50%, var(--surface) 50%),
    repeating-linear-gradient(135deg, #8fb0d0 0 3px, #eef1f4 3px 6px); }
.geduldet-zeichen { display: block; font-size: 9px; line-height: 1; color: #7a1c16;
  font-weight: 700; }
table.raster td.geduldet { color: #7a1c16; font-weight: 700; }
table.einsatz-raster .kennung, table.raster .kennung { display: inline-block; padding: 0 5px;
  border-radius: 8px; font-size: 11px; background: var(--bg); color: var(--text-muted);
  white-space: nowrap; }
table.raster tbody.auslastung tr.abschnitt th { background: var(--bg); font-weight: 600; }
table.raster tbody.auslastung tr.abschnitt td { background: var(--bg); }
.plan-einsatz { margin: 6px 0; overflow-wrap: anywhere; }
fieldset.plan-konflikt { border: 1px solid var(--border); border-radius: 6px; margin: 10px 0;
  padding: 6px 10px; }
/* Legende aus der Rahmenkerbe nehmen: am Handy bricht sie auf mehrere Zeilen (U1-08) */
fieldset.plan-konflikt legend { float: left; width: 100%; font-weight: 600; padding: 4px 0;
  overflow-wrap: anywhere; }
fieldset.plan-konflikt legend + * { clear: both; }
fieldset.plan-konflikt label.haken { display: flex; align-items: center; gap: 10px;
  min-height: 44px; font-size: 13.5px; }
fieldset.plan-konflikt input { width: 22px; height: 22px; flex: none; margin: 0; }
@media print {
  table.einsatz-raster td, table.einsatz-raster th {
    print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
@media (max-width: 860px) {
  table.einsatz-raster th.titel { min-width: 7em; max-width: 7em; overflow-wrap: anywhere; }
  /* u1 Glied 19: Kennungen in der festen Namensspalte umbrechen, nicht ueberstehen */
  table.einsatz-raster th.titel .kennung { white-space: normal; }
}

/* Bauplanung P3c (ADR-026 Glied 11): Plantafel Person × zwoelf Tage -- eine Tabelle (G2-f),
   Klassen statt style-Attribute (CSP), alle Regeln an table.plantafel gebunden (D1-12). Die
   Personenspalte bleibt beim waagrechten Wischen stehen; der Samstag ist halb so breit (halbe
   Karte). Farben aus Glied 10: hier #8fb0d0, anderswo #cfe0f1 gestrichelt, doppelt #e79a9a,
   abwesend schraffiert, arbeitsfrei #d5dbe2. */
.tafel-navigation { display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 8px 0; }
.tafel-navigation .btn { min-height: 44px; display: inline-flex; align-items: center; }
table.plantafel { border-collapse: separate; border-spacing: 0; background: var(--surface);
  font-size: 12px; border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
table.plantafel col.titel { width: 12em; }
table.plantafel col { width: 104px; }
table.plantafel col.sa { width: 52px; }
table.plantafel th, table.plantafel td { padding: 3px; text-align: left; vertical-align: top;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
table.plantafel thead th { background: var(--bg); color: var(--text-muted); font-weight: 600;
  line-height: 1.2; white-space: nowrap; }
table.plantafel th.titel { position: sticky; left: 0; z-index: 1; width: 12em;
  font-weight: 400; background: var(--surface); overflow-wrap: anywhere; }
table.plantafel thead th.titel { z-index: 2; background: var(--bg); }
table.plantafel td { height: 52px; min-width: 88px; overflow: hidden; }
table.plantafel td.sa, table.plantafel th.sa { min-width: 44px; }
table.plantafel th.titel { min-width: 10em; }
.tafel-karte select { min-height: 44px; }
table.plantafel .sa { background: #f3f5f8; }
table.plantafel th.heute, table.plantafel td.heute { background: #fdf0dc; }
table.plantafel th.heute { color: var(--warn); }
table.plantafel th.frei, table.plantafel td.frei { background: #d5dbe2; }
table.plantafel td.doppelt { background: #e79a9a; }
table.plantafel td.abwesend { background: repeating-linear-gradient(135deg, #c4ccd6 0 3px,
  #eef1f4 3px 6px); }
table.plantafel .karte { margin: 0 0 3px; padding: 2px 4px; border-radius: 4px;
  background: #8fb0d0; color: var(--primary-dark); line-height: 1.25; text-decoration: none;
  overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden; }
table.plantafel a.karte:hover, table.plantafel a.karte:focus { outline: 2px solid
  var(--primary-dark); outline-offset: -2px; }
table.plantafel .karte.anderswo { background: #cfe0f1; outline: 1px dashed #5d86b0;
  outline-offset: -2px; }
table.plantafel .abw { display: block; padding: 2px 4px; border-radius: 4px;
  background: #aab4c0; color: #1f2a36; }
table.plantafel .geduldet-zeichen { font-size: 11px; }
table.plantafel a.plus { display: flex; align-items: center; justify-content: center;
  min-height: 44px; font-size: 18px; color: var(--text-muted); text-decoration: none; }
table.plantafel a.plus:hover, table.plantafel a.plus:focus { color: var(--primary-dark);
  background: #eef3f8; }
table.plantafel td.leer { padding: 12px; color: var(--text-muted); }
.tafel-karte { border-left: 4px solid #8fb0d0; }
.luecken-typ h2 { margin-bottom: 4px; }
@media print {
  table.plantafel td, table.plantafel th, table.plantafel .karte {
    print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
@media (max-width: 860px) {
  table.plantafel col.titel, table.plantafel th.titel { width: 7em; min-width: 7em; }
}
/* Nach /gegenlesen ui Glied 11: Kennungen auch in der Plantafel (U1-01), unter dem Namen; Links
   der Luecken-Liste als Links erkennbar (U1-15); Abstand zwischen den Knoepfen der Karte und
   ein Ausgang mit 44 px (U1-10, U1-12). */
table.plantafel .kennung { display: table; margin-top: 2px; padding: 0 5px; border-radius: 8px;
  font-size: 11px; background: var(--bg); color: var(--text-muted); white-space: nowrap; }
.luecken-typ a { text-decoration: underline; }
.luecken-typ h3 { margin: 10px 0 4px; font-size: 14px; }
.tafel-karte form + form { margin-top: 12px; }
.tafel-ausgang { display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-top: 12px; }
table.plantafel tfoot th { background: var(--bg); color: var(--text-muted); font-weight: 600;
  line-height: 1.2; white-space: nowrap; }
/* Protokoll (P4a, ADR-026 Glied 12): eine Tabelle, je Anwenden ein tbody mit Kopfzeile. Alle
   Regeln an table.plan-protokoll gebunden (D1-12); Mindestbreiten statt table-layout (E157);
   erste Spalte sticky, auf 390 px wischt die Tabelle in .table-wrap. */
table.plan-protokoll { border-collapse: separate; border-spacing: 0; }
table.plan-protokoll th, table.plan-protokoll td { vertical-align: top; }
table.plan-protokoll td { min-width: 6em; }
table.plan-protokoll td:nth-last-child(2) { min-width: 14em; }
table.plan-protokoll .titel { position: sticky; left: 0; z-index: 1; min-width: 9em;
  background: var(--surface); }
table.plan-protokoll thead .titel { background: var(--bg); }
table.plan-protokoll tr.kopf th { position: static; background: var(--bg); color: var(--text);
  font-weight: 600; text-align: left; text-transform: none; letter-spacing: normal;
  border-top: 2px solid #8fb0d0; }
table.plan-protokoll td.tage { white-space: nowrap; }
table.plan-protokoll tbody.gruppe + tbody.gruppe tr.kopf th { padding-top: 10px; }
#pruefung ul { margin: 4px 0 0; }
/* Nach /gegenlesen ui Glied 12: Blaettern als Knoepfe (U1-12); unter 860 px stapeln sich die
   Zellen, jede mit ihrem Spaltennamen (U1-02) -- Vorgang und Person bleiben bei der Zeile. */
.plan-blaettern { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.plan-blaettern .btn { min-height: 44px; display: inline-flex; align-items: center; }
@media (max-width: 860px) {
  table.plan-protokoll thead { display: none; }
  table.plan-protokoll, table.plan-protokoll tbody, table.plan-protokoll tr,
  table.plan-protokoll th, table.plan-protokoll td { display: block; }
  table.plan-protokoll .titel { position: static; }
  table.plan-protokoll tbody tr:not(.kopf) { padding: 6px 0; border-bottom: 1px solid var(--border); }
  table.plan-protokoll td { min-width: 0; padding: 1px 0; border: 0; white-space: normal; }
  table.plan-protokoll td:nth-last-child(2) { min-width: 0; }
  table.plan-protokoll td.tage { white-space: normal; }
  table.plan-protokoll td:empty { display: none; }
  table.plan-protokoll td::before { content: attr(data-spalte) ": "; color: var(--text-muted);
    font-size: 12px; }
  table.plan-protokoll td.titel::before { content: none; }
  table.plan-protokoll td.titel { font-weight: 600; }
}
.plan-umschalten .btn { min-height: 44px; }
/* P5a (Glied 14): „Meine Einsaetze" und der Kasten „Geaendert" am Handy. Die Folgetage sind
   kompakte Zeilen; die Adresse ist dort der Navigations-Link -- mit einer Tippflaeche von
   44 px wie jeder Knopf der Monteur-Ansicht. */
.monteur .m-einsatz { padding: 8px 0; border-bottom: 1px solid var(--border); }
.monteur .m-einsatz-heute { border-left: 4px solid var(--primary); }
.monteur .m-einsatz-bald { font-size: 14px; margin: 14px 0 4px; }
.monteur a.m-navi { display: flex; align-items: center; min-height: 44px;
  overflow-wrap: anywhere; text-decoration: underline; }
/* Nach /gegenlesen ui Glied 14: die Heute-Karte behaelt den Abstand der Karte (G1/D1-01); der
   Verweis vom Kasten auf die Liste ist eine Tippflaeche wie ein Knopf (U1-01). */
.monteur .m-einsatz.m-einsatz-heute { padding: 12px 14px; }
.monteur a.m-zur-liste { display: flex; align-items: center; min-height: 44px;
  text-decoration: underline; }
.monteur .m-aenderungen { margin: 0; padding-left: 18px; }
.monteur .m-aenderungen li { margin: 4px 0; overflow-wrap: anywhere; }
/* P5b (Glied 16): Koordination lesend -- Kopfzeile, Plan-Karten, Wochen-Plantafel, Luecken.
   Alle Regeln an `k-`-Klassen gebunden (die Bestandsvorlage koordination.html traegt ihre
   eigenen Stile im <style>-Block, die neuen Vorlagen duerfen das nicht, A4). Tippflaechen
   44 px wie jeder Knopf der Monteur-Ansicht. */
.k-lesend { max-width: 480px; margin: 0 auto; }
.k-lesend.k-tafel { max-width: none; }
.k-lesend h1 { font-size: 20px; }
a.k-zurueck { display: inline-flex; align-items: center; min-height: 44px; }
.k-kopf { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 16px; }
a.k-kopf-link { display: flex; align-items: center; min-height: 44px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  font-weight: 600; text-decoration: none; }
.k-ruht { margin: 0; padding: 10px 12px; background: #fdf0dc; border: 1px solid #e4c48f;
  border-radius: var(--radius); font-weight: 600; }
.k-ruht .k-sub { display: block; font-weight: 400; font-size: 14px; }
.k-liste { margin: 0; padding-left: 18px; }
.k-liste li { margin: 6px 0; overflow-wrap: anywhere; }
.k-liste a { display: block; min-height: 44px; padding: 10px 0; text-decoration: underline; }
.k-gruppe { font-size: 15px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .3px; margin: 24px 0 0; }
.k-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; }
.k-hinweis { padding: 8px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); }
.k-karte { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; scroll-margin-top: 12px; }
.k-karte:target { outline: 2px solid var(--primary); }
.k-karte.k-fertig { opacity: .7; }
.k-karte.k-ende_ueberschritten { border-left: 4px solid var(--warn); }
.k-titel { font-weight: 600; overflow-wrap: anywhere; }
.k-zeitraum { color: var(--text-muted); font-size: 14px; }
.k-marken { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.k-marke { display: inline-block; padding: 1px 8px; border-radius: 10px; background: var(--bg);
  border: 1px solid var(--border); font-size: 13px; }
.k-tage { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.k-tag { margin: 3px 0; overflow-wrap: anywhere; }
.k-zeitraum-formular { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px;
  margin: 8px 0; }
.k-zeitraum-formular input { min-height: 44px; }
.k-luecken { margin: 16px 0; }
.k-luecken h2 { font-size: 16px; margin-bottom: 4px; }
/* Wochen-Plantafel: eine Woche auf 390 px (Plan 7.2) -- schmalere Spalten als die
   Bueroplantafel, die Tafel nutzt am Handy den Seitenrand mit (Gegenlesen R1-10). */
@media (max-width: 860px) {
  .k-woche { margin: 0 -16px; }
  .k-woche table.plantafel { font-size: 11px; }
  .k-woche table.plantafel th.titel { width: 6em; min-width: 6em; max-width: 6em; }
  .k-woche table.plantafel td { min-width: 52px; max-width: 52px; }
  .k-woche table.plantafel td.sa, .k-woche table.plantafel th.sa { min-width: 36px;
    max-width: 36px; }
  .k-woche table.plantafel col { width: 52px; }
  .k-woche table.plantafel col.sa { width: 36px; }
  .k-woche table.plantafel col.titel { width: 6em; }
  /* Geraetefund Glied 16: Kennungen und „отсутствует“ brechen um, statt in die
     Nachbarzelle zu ragen bzw. abgeschnitten zu werden */
  .k-woche table.plantafel .kennung { white-space: normal; overflow-wrap: anywhere; }
  .k-woche table.plantafel .abw { padding: 2px; overflow-wrap: anywhere; }
}
/* Nach /gegenlesen ui Glied 16: Listenpunkt an der ersten Zeile (U1-21), „So gewollt" klar
   abgesetzt und leiser (U1-20), Unterueberschriften, Gruende arbeitsfreier Tage sichtbar
   (U1-14), Karten auf der Wochentafel mindestens 44 px (U1-15). */
.k-unter { font-size: 14px; margin: 12px 0 4px; color: var(--text-muted); }
.k-geduldet { color: var(--text-muted); }
.k-frei-tage { margin: 6px 0; font-size: 14px; }
@media (max-width: 860px) {
  .k-woche table.plantafel a.karte { min-height: 44px; }
}

/* Bauplanung P7a1 (ADR-026 Glied 17): Koordination schreibend am Handy -- Eingabefelder und
   Auswahllisten der Formulare in Fingerhoehe, der Titel einer Plan-Karte als Link zum Vorgang
   (Plan 7.2; Klassen statt style-Attribute, A4). Haekchen und Radios ueber label.haken. */
form.k-formular label { margin-bottom: 10px; }
form.k-formular input:not([type="checkbox"]):not([type="radio"]),
form.k-formular select { min-height: 44px; }
a.k-titel-link { display: flex; align-items: center; min-height: 44px; }
/* Gerätefund Glied 17: die Titel-Links in „Vorgänger“/„Nachfolger“ waren 38 px hoch. */
.k-lesend .plan-liste > li > a { display: inline-flex; align-items: center; min-height: 44px; }
/* UI-Runde u1 (Glied 17): Links zum Aendern sichtbar unterstrichen, Grund als eigene
   Zeile, Sprung zu den Konflikten in Fingerhoehe. */
a.k-titel-link, .k-lesend .plan-liste > li > a { text-decoration: underline; }
.k-grund { display: block; color: var(--text-muted); }
a.k-sprung { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }

/* Ziehen am Rechner (P3b, ADR-026 G2-a/G2-b): Zustaende nur ueber Klassen, die
   static/js/bauplanung_ziehen.js setzt -- `ziehbar` nur mit feinem Zeiger ab Tabletbreite,
   also nie auf 390 px. Die Lage des Ziehbilds setzt das Skript per CSSOM. */
/* Greifhand nur dort, wo sich greifen laesst: Balkenzellen, Namen, Karten (u1 U1-04). */
tr.ziehbar td.balken, th.ziehbar, a.karte.ziehbar { cursor: grab; user-select: none;
  -webkit-user-select: none; }
body.zieht, body.zieht * { cursor: grabbing !important; user-select: none; }
body.wartet, body.wartet * { cursor: progress; }
.gezogen, tr.gezogen td.balken { opacity: .45; }
td.ziel, th.ziel, tr.ziel > th, tr.ziel > td.balken { outline: 2px solid var(--accent);
  outline-offset: -2px; background-color: #fbe3bf; }
.ziehbild { position: fixed; z-index: 1000; pointer-events: none; max-width: 22rem;
  padding: 4px 8px; border: 1px solid var(--primary); border-radius: 6px;
  background: var(--surface); color: var(--primary-dark); font-size: 13px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .18); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
/* Die Vorschau nach einem Drop: feste Tafel ueber dem Raster, leer unsichtbar. */
/* Breite in vw: auf 1280 px bleibt links das Raster mit der Zielspalte sichtbar (u1 U1-02,
   U1-03); Knopfzeile unten haftend, das Rad scrollt die Seite darunter nicht mit (U1-17). */
.einblendung { position: fixed; z-index: 900; top: 72px; right: 24px;
  width: clamp(26rem, 40vw, 44rem); max-height: calc(100vh - 96px); overflow: auto;
  overscroll-behavior: contain;
  padding: 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); box-shadow: 0 8px 28px rgba(0, 0, 0, .22); }
.einblendung.links { right: auto; left: 24px; }
.einblendung:empty { display: none; }
.einblendung-inhalt:focus { outline: none; }
.einblendung .plan-aktionen { position: sticky; bottom: -16px; margin-bottom: -16px;
  padding: 12px 0 16px; background: var(--bg); }
@media print { .einblendung, .ziehbild { display: none; } }

/* Versionserkennung (Online-Gang A-8): Hinweis oben im Inhalt, Fusszeile mit dem Tag. */
.versions-hinweis { display: block; width: 100%; margin-bottom: 12px; padding: 12px 14px; min-height: 44px;
  background: var(--primary); color: #fff; border: 2px solid var(--primary-dark); border-radius: var(--radius);
  font: inherit; font-size: 16px; font-weight: 600; text-align: center; cursor: pointer; white-space: pre-line; }
.versions-hinweis:hover, .versions-hinweis:focus-visible { background: var(--primary-dark); outline: 3px solid var(--accent); }
.versions-hinweis[disabled] { opacity: 0.7; cursor: progress; }
.versions-hinweis[hidden] { display: none; }
.app-fuss { padding: 8px 22px 16px; font-size: 13px; color: #475569; }

/* Zwei-Faktor (Online-Gang A-5): QR immer auf weissem Grund, auch im dunklen Modus -- sonst
   liest ihn keine Kamera. Schluessel und Codes in Festbreite, gut abschreibbar. */
/* Als Block: inline-block stand auf der Grundlinie, die Zeile "2. Diesen QR-Code scannen"
   rutschte am Desktop unter den Code (Geraetepruefung Glied 27). */
.totp-qr { display: block; width: max-content; max-width: 100%; background: #fff; padding: 8px;
  margin: 8px 0; }
.totp-qr svg { display: block; max-width: 100%; height: auto; }
.totp-schluessel { font-family: ui-monospace, Consolas, monospace; font-size: 18px;
  letter-spacing: 1px; word-spacing: 6px; overflow-wrap: anywhere; }
.schritte li { margin-bottom: 10px; }
.wiederherstellungscodes { font-family: ui-monospace, Consolas, monospace; font-size: 20px;
  line-height: 1.8; padding-left: 2.2em; }
/* Fingerflaeche auf den Zwei-Faktor-Seiten (U1-R5): Roman tippt mit Arbeitshandschuh. */
.zielgroesse .btn, .zielgroesse input { min-height: 44px; }
.zielgroesse .btn + .btn { margin-left: 12px; }
.zielgroesse .hinweis { font-weight: 600; }
/* Installation und Plattformen (Online-Gang A-10): Hinweis der Funktionspruefung statt der App,
   iPhone-Anleitung und Chrome-Hinweis an der Anmeldeseite, Rechtslinks darunter. */
.funktion-fehlt { max-width: 420px; margin: 12vh auto; }
/* Liegt ausserhalb von main.content und erbt dessen Rand nicht (am Geraet gemessen). */
@media (max-width: 460px) { .funktion-fehlt { margin: 12vh 16px; } }
.funktion-fehlt .sprachwahl { display: flex; gap: 8px; justify-content: center; }
.funktion-fehlt .sprachwahl a { display: inline-block; padding: 12px 16px; min-width: 44px;
  text-align: center; border: 1px solid var(--border); border-radius: var(--radius); }
.funktion-fehlt[hidden], .plattform-hinweis[hidden] { display: none; }
.plattform-hinweis ol { padding-left: 1.4em; line-height: 1.6; }
.plattform-hinweis li + li { margin-top: 6px; }
.plattform-hinweis .btn { display: inline-block; min-height: 44px; line-height: 28px; }
.plattform-hinweis .adresse { display: block; font-size: 17px; font-weight: 600;
  overflow-wrap: anywhere; user-select: all; }
.rechtslinks { margin-top: 8px; display: flex; gap: 8px; justify-content: center; }
.rechtslinks a { display: inline-block; padding: 12px 8px; font-size: 14px; color: #475569; }
