/* Werkbeleg – robuste Oberfläche für draußen: große Tasten, hoher Kontrast, klare Phasenfarben. */

:root {
  --grund: #f4f2ee;
  --flaeche: #ffffff;
  --flaeche-2: #ece9e3;
  --linie: #dcd6cc;
  --tinte: #1d2329;
  --tinte-2: #59636d;
  --tinte-3: #87909a;
  --akzent: #e25a0c;
  --akzent-dunkel: #b8470a;
  --akzent-hell: #fde8da;
  --vorher: #2f6db3;
  --vorher-hell: #e1ecf8;
  --waehrend: #b87a00;
  --waehrend-hell: #fbf0d6;
  --nachher: #2d8a45;
  --nachher-hell: #dff2e4;
  --gefahr: #c62828;
  --gefahr-hell: #fbe3e1;
  --ok: #2d8a45;
  --schatten: 0 1px 2px rgba(29, 35, 41, .06), 0 4px 14px rgba(29, 35, 41, .07);
  --schatten-gross: 0 10px 40px rgba(29, 35, 41, .22);
  --radius: 14px;
  --radius-klein: 9px;
  --schrift: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --unten: env(safe-area-inset-bottom, 0px);
  --oben: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --grund: #121619;
    --flaeche: #1b2126;
    --flaeche-2: #252c32;
    --linie: #333c44;
    --tinte: #eef1f3;
    --tinte-2: #aab4bd;
    --tinte-3: #7d8891;
    --akzent: #ff7a2e;
    --akzent-dunkel: #ff9a5c;
    --akzent-hell: #3a2618;
    --vorher: #6ea8ee;
    --vorher-hell: #1b2b3d;
    --waehrend: #f0b63c;
    --waehrend-hell: #352a12;
    --nachher: #5cc47a;
    --nachher-hell: #16301f;
    --gefahr: #ff6b61;
    --gefahr-hell: #3b1b19;
    --schatten: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--grund);
  color: var(--tinte);
  font: 16px/1.45 var(--schrift);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
/* Symbole im Fliesstext: so gross wie die Schrift. Knoepfe, Chips usw. setzen eigene Groessen. */
svg { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }
a { color: var(--akzent-dunkel); }
[hidden] { display: none !important; }
.nur-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- Grundlayout */

.seite { max-width: 760px; margin: 0 auto; padding: 0 16px calc(120px + var(--unten)); }
.seite.breit { max-width: 1120px; }
.kopf {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--oben)) 16px 10px;
  margin: 0 -16px 8px;
  background: color-mix(in srgb, var(--grund) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--linie) 60%, transparent);
}
.kopf-titel { flex: 1; min-width: 0; }
.kopf-titel h1 {
  margin: 0; font-size: 16.5px; line-height: 1.22; letter-spacing: -.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.kopf-titel-knopf { border: 0; background: transparent; color: inherit; text-align: left; padding: 2px 0; cursor: pointer; font: inherit; -webkit-tap-highlight-color: transparent; }
@media (max-width: 480px) {
  /* Auf dem Handy braucht der Auftragstitel den Platz – Knoepfe im Kopf nur als Symbol. */
  .kopf .kopf-knopf { width: 44px; padding: 0; }
  .kopf .kopf-knopf span, .kopf .knopf > span:not(.spinner-klein) { display: none; }
  .sync-pille { padding: 6px 8px; }
}
.kopf-titel .unterzeile { font-size: 12.5px; color: var(--tinte-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }

.marke { display: flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: -.02em; font-size: 19px; }
.marke-zeichen {
  width: 32px; height: 32px; border-radius: 9px; background: var(--tinte); color: var(--grund);
  display: grid; place-items: center; flex: none;
}
.marke-zeichen svg { width: 20px; height: 20px; }

h2 { font-size: 20px; letter-spacing: -.015em; margin: 26px 0 10px; }
h3 { font-size: 16px; margin: 18px 0 8px; }
.gedaempft { color: var(--tinte-2); }
.klein { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12px; word-break: break-all; }

/* -------------------------------------------------------------------- Knöpfe */

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 14px; border-radius: 11px;
  border: 1px solid var(--linie); background: var(--flaeche); color: var(--tinte);
  font-weight: 600; font-size: 14.5px; cursor: pointer; text-decoration: none;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.knopf:active { transform: scale(.97); }
.knopf:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.knopf svg { width: 18px; height: 18px; flex: none; }
.knopf.primaer { background: var(--akzent); border-color: var(--akzent); color: #fff; }
@media (prefers-color-scheme: dark) {
  /* Helles Orange im Dunkelmodus: dunkle Schrift statt weisser, sonst zu wenig Kontrast. */
  .knopf.primaer, .aktion.sprechen { color: #1a0e06; }
}
.knopf.primaer:hover:not(:disabled) { background: var(--akzent-dunkel); border-color: var(--akzent-dunkel); }
.knopf.dunkel { background: var(--tinte); border-color: var(--tinte); color: var(--grund); }
.knopf.gefahr { color: var(--gefahr); border-color: color-mix(in srgb, var(--gefahr) 35%, var(--linie)); }
.knopf.gefahr.voll { background: var(--gefahr); color: #fff; border-color: var(--gefahr); }
.knopf.leise { background: transparent; border-color: transparent; }
.knopf.leise:hover { background: var(--flaeche-2); }
.knopf.rund { width: 40px; padding: 0; border-radius: 50%; }
.knopf.gross { min-height: 50px; font-size: 16px; border-radius: 14px; }
.knopf.knopf-klein { min-height: 34px; font-size: 13.5px; padding: 0 10px; }
.knopfreihe-kompakt { gap: 6px; }
.knopfreihe-kompakt .knopf { flex: 1 1 auto; padding: 0 12px; }
.knopf.breit { width: 100%; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.knopfreihe.rechts { justify-content: flex-end; }

/* ------------------------------------------------------------------- Karten */

.karte {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--schatten);
}
.karte + .karte { margin-top: 12px; }
.karte h3:first-child, .karte h2:first-child { margin-top: 0; }
.karte.hinweis { background: var(--akzent-hell); border-color: color-mix(in srgb, var(--akzent) 30%, var(--linie)); box-shadow: none; }
.karte.warnung { background: var(--gefahr-hell); border-color: color-mix(in srgb, var(--gefahr) 30%, var(--linie)); box-shadow: none; }
.karte.leer { text-align: center; padding: 34px 20px; color: var(--tinte-2); box-shadow: none; background: transparent; border-style: dashed; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; background: var(--flaeche-2); color: var(--tinte-2); white-space: nowrap;
}
.chip svg { width: 14px; height: 14px; }
.chip.vorher { background: var(--vorher-hell); color: var(--vorher); }
.chip.waehrend { background: var(--waehrend-hell); color: var(--waehrend); }
.chip.nachher { background: var(--nachher-hell); color: var(--nachher); }
.chip.akzent { background: var(--akzent-hell); color: var(--akzent-dunkel); }
.chip.ok { background: var(--nachher-hell); color: var(--nachher); }
.chip.gefahr { background: var(--gefahr-hell); color: var(--gefahr); }

.status { font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.status-offen { background: var(--flaeche-2); color: var(--tinte-2); }
.status-in_arbeit { background: var(--waehrend-hell); color: var(--waehrend); }
.status-protokoll { background: var(--vorher-hell); color: var(--vorher); }
.status-bestaetigt { background: var(--akzent-hell); color: var(--akzent-dunkel); }
.status-abgeschlossen { background: var(--nachher-hell); color: var(--nachher); }

/* -------------------------------------------------------------- Formulare */

.feldgruppe { display: grid; gap: 14px; }
.feldgruppe.zwei { grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .feldgruppe.zwei { grid-template-columns: 1fr; } }
label.feld { display: grid; gap: 5px; font-size: 13.5px; font-weight: 600; color: var(--tinte-2); }
.eingabe, textarea.eingabe, select.eingabe {
  width: 100%; min-height: 46px; padding: 11px 13px; border-radius: 11px;
  border: 1px solid var(--linie); background: var(--flaeche); color: var(--tinte);
  font-size: 16px; font-weight: 400; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.eingabe { resize: vertical; min-height: 90px; line-height: 1.45; }
.eingabe:focus { border-color: var(--akzent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--akzent) 20%, transparent); }
.eingabe::placeholder { color: var(--tinte-3); }
.checkbox { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.checkbox input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--akzent); flex: none; }

/* ------------------------------------------------------------------ Phasen */

.phasen {
  position: sticky; top: var(--kopf-hoehe, calc(62px + var(--oben))); z-index: 15;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  padding: 6px; margin: 0 0 12px; border-radius: 16px; background: var(--flaeche-2);
}
.phase-knopf {
  border: 0; border-radius: 12px; min-height: 52px; padding: 6px 4px; cursor: pointer;
  background: transparent; color: var(--tinte-2); font-weight: 700; font-size: 15px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  -webkit-tap-highlight-color: transparent; transition: background .15s, color .15s;
}
.phase-knopf .zahl { font-size: 12px; font-weight: 600; opacity: .8; }
.phase-knopf.aktiv { background: var(--flaeche); box-shadow: var(--schatten); }
.phase-knopf.aktiv.vorher { color: var(--vorher); box-shadow: inset 0 -3px 0 var(--vorher), var(--schatten); }
.phase-knopf.aktiv.waehrend { color: var(--waehrend); box-shadow: inset 0 -3px 0 var(--waehrend), var(--schatten); }
.phase-knopf.aktiv.nachher { color: var(--nachher); box-shadow: inset 0 -3px 0 var(--nachher), var(--schatten); }

.phase-intro { font-size: 14px; color: var(--tinte-2); margin: 2px 2px 12px; }

/* ------------------------------------------------------------- Checkliste */

.checkliste { margin-bottom: 12px; padding: 12px 14px; }
.checkliste-titel { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.checkliste ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.checkpunkt {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  background: var(--flaeche-2); font-size: 15px;
}
.checkpunkt .haken { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--tinte-3); flex: none; display: grid; place-items: center; }
.checkpunkt.erledigt .haken { background: var(--ok); border-color: var(--ok); color: #fff; }
.checkpunkt .text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.checkpunkt-stand { font-size: 12.5px; font-weight: 700; color: var(--ok); }
.checkpunkt .knopf { min-height: 36px; padding: 0 10px; font-size: 13.5px; }

/* ------------------------------------------------------------- Zeitleiste */

.zeitleiste { display: grid; gap: 10px; }
.eintrag {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 10px; box-shadow: var(--schatten); cursor: pointer; position: relative;
  -webkit-tap-highlight-color: transparent;
}
.eintrag:active { transform: scale(.995); }
.eintrag .bild {
  /* feste Groesse, sonst faellt ein noch nicht geladenes (lazy) Bild in der Grid-Spalte auf 0 zusammen */
  width: 92px; height: 92px; max-width: none; border-radius: 10px; object-fit: cover; background: var(--flaeche-2);
}
.eintrag .symbol {
  width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;
  background: var(--flaeche-2); color: var(--tinte-2);
}
.eintrag .symbol svg { width: 24px; height: 24px; }
.eintrag .symbol.sprache { background: var(--akzent-hell); color: var(--akzent-dunkel); }
.eintrag-kopf { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: center; font-size: 13px; color: var(--tinte-2); padding-right: 20px; }
.eintrag-kopf strong { color: var(--tinte); font-size: 14px; }
.eintrag-text { margin-top: 4px; font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.eintrag-text.leer { color: var(--tinte-3); font-style: italic; }
.eintrag-ki { margin-top: 4px; font-size: 13.5px; color: var(--tinte-2); }
.eintrag .sync { position: absolute; top: 8px; right: 10px; color: var(--tinte-3); }
.eintrag .sync svg { width: 16px; height: 16px; }
.eintrag .sync.wartet { color: var(--waehrend); }
.eintrag .sync.fehler { color: var(--gefahr); }
.kommentare { grid-column: 1 / -1; display: grid; gap: 6px; margin-top: 2px; }
.kommentar { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; background: var(--flaeche-2); font-size: 14px; }
.kommentar svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--tinte-2); }
.spinner-klein { display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: drehen .8s linear infinite; vertical-align: -1px; }
@keyframes drehen { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------- Aktionsleiste */

.aktionsleiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 10px 12px calc(10px + var(--unten));
  background: color-mix(in srgb, var(--flaeche) 94%, transparent);
  backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--linie);
}
.aktionsleiste-innen { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.aktionsleiste-innen.drei { grid-template-columns: 1.3fr 1.3fr 1fr; }
.aktion {
  min-height: 56px; border-radius: 15px; border: 0; cursor: pointer; font-weight: 750; font-size: 15.5px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  -webkit-tap-highlight-color: transparent; transition: transform .08s;
}
.aktion:active { transform: scale(.96); }
.aktion svg { width: 24px; height: 24px; }
.aktion.foto { background: var(--tinte); color: var(--grund); }
.aktion.sprechen { background: var(--akzent); color: #fff; }
.aktion.notiz { background: var(--flaeche-2); color: var(--tinte); }
.aktion:disabled { opacity: .4; }

.aufnahmeleiste { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; max-width: 760px; margin: 0 auto; }
.aufnahme-stopp {
  min-height: 62px; border-radius: 16px; border: 0; background: var(--gefahr); color: #fff; cursor: pointer;
  display: flex; align-items: center; gap: 14px; padding: 0 18px; font-weight: 750; font-size: 17px;
}
.aufnahme-stopp .punkt { width: 14px; height: 14px; border-radius: 3px; background: #fff; flex: none; }
.aufnahme-stopp .zeit { font-variant-numeric: tabular-nums; }
.pegel { flex: 1; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .3); overflow: hidden; }
.pegel > i { display: block; height: 100%; width: 0; background: #fff; border-radius: 4px; transition: width .08s linear; }

/* ------------------------------------------------------------ Sync-Anzeige */

.sync-pille {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; background: var(--nachher-hell); color: var(--nachher); white-space: nowrap; border: 0;
}
.sync-pille svg { width: 16px; height: 16px; }
.sync-pille.wartet { background: var(--waehrend-hell); color: var(--waehrend); }
.sync-pille.offline { background: var(--flaeche-2); color: var(--tinte-2); }
.sync-pille.fehler { background: var(--gefahr-hell); color: var(--gefahr); }

/* ------------------------------------------------------ Blatt (Bottom Sheet) */

.schleier {
  position: fixed; inset: 0; z-index: 100; background: rgba(12, 15, 18, .45);
  display: flex; align-items: flex-end; justify-content: center;
  animation: einblenden .15s ease;
}
.blatt {
  width: 100%; max-width: 640px; max-height: calc(100vh - 40px - var(--oben));
  overflow: auto; background: var(--flaeche); border-radius: 20px 20px 0 0;
  padding: 8px 18px calc(18px + var(--unten)); box-shadow: var(--schatten-gross);
  animation: hochfahren .22s cubic-bezier(.2, .9, .3, 1);
}
@media (min-width: 700px) {
  .schleier { align-items: center; }
  .blatt { border-radius: 20px; max-height: calc(100vh - 80px); }
}
.blatt-griff { width: 40px; height: 5px; border-radius: 3px; background: var(--linie); margin: 4px auto 10px; }
.blatt-kopf { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.blatt-kopf h3 { margin: 0; flex: 1; font-size: 18px; }
@keyframes einblenden { from { opacity: 0; } }
@keyframes hochfahren { from { transform: translateY(40px); opacity: .5; } }

.grossbild { width: 100%; max-height: 55vh; object-fit: contain; border-radius: 12px; background: #000; }

/* ------------------------------------------------------------------ Toast */

.toasts { position: fixed; left: 0; right: 0; top: calc(12px + var(--oben)); z-index: 200; display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; max-width: min(560px, calc(100vw - 24px)); padding: 12px 16px; border-radius: 12px;
  background: var(--tinte); color: var(--grund); font-weight: 600; font-size: 14.5px; box-shadow: var(--schatten-gross);
  animation: einblenden .15s ease;
}
.toast.fehler { background: var(--gefahr); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

/* ------------------------------------------------------------------ Kamera */

.kamera { position: fixed; inset: 0; z-index: 150; background: #000; color: #fff; display: flex; flex-direction: column; }
.kamera video { flex: 1; width: 100%; min-height: 0; object-fit: cover; background: #000; }
.kamera-oben, .kamera-unten { position: absolute; left: 0; right: 0; display: flex; align-items: center; padding: 12px 16px; gap: 12px; }
.kamera-oben { top: 0; padding-top: calc(12px + var(--oben)); background: linear-gradient(rgba(0,0,0,.55), transparent); }
.kamera-unten { bottom: 0; padding-bottom: calc(22px + var(--unten)); justify-content: space-around; background: linear-gradient(transparent, rgba(0,0,0,.65)); }
.kamera .knopf-glas {
  min-width: 52px; height: 52px; border-radius: 26px; border: 0; background: rgba(255,255,255,.18); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 14px; font-weight: 700; cursor: pointer;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.kamera .knopf-glas svg { width: 24px; height: 24px; }
.kamera .knopf-glas.aktiv { background: var(--gefahr); }
.ausloeser {
  width: 78px; height: 78px; border-radius: 50%; border: 5px solid #fff; background: rgba(255,255,255,.25); cursor: pointer;
  transition: transform .08s;
}
.ausloeser:active { transform: scale(.9); background: #fff; }
.kamera-phase { margin: 0 auto; font-weight: 800; padding: 8px 16px; border-radius: 999px; border: 0; color: #fff; cursor: pointer; font-size: 15px; }
.kamera-phase.vorher { background: var(--vorher); }
.kamera-phase.waehrend { background: #b87a00; }
.kamera-phase.nachher { background: #2d8a45; }
.kamera-zaehler { position: relative; }
.kamera-zaehler img { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; border: 2px solid #fff; }
.kamera-zaehler span { position: absolute; top: -8px; right: -8px; background: var(--akzent); color: #fff; font-size: 12px; font-weight: 800; border-radius: 999px; padding: 2px 7px; }
.blitz { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.blitz.an { animation: blitz .25s ease-out; }
@keyframes blitz { from { opacity: .85; } to { opacity: 0; } }
.kamera-hinweis { position: absolute; left: 50%; bottom: calc(130px + var(--unten)); transform: translateX(-50%); background: rgba(0,0,0,.6); padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; white-space: nowrap; }

/* ------------------------------------------------------------ Auftragsliste */

.raster { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.raster > * { min-width: 0; }
.detail-raster { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); align-items: start; }
.detail-spalte { display: grid; gap: 12px; min-width: 0; }
.detail-raster > *, .detail-spalte > * { min-width: 0; }
.detail-raster .karte + .karte, .detail-spalte .karte + .karte { margin-top: 0; }
.karte-kopf { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.karte-kopf h3 { margin: 0; }
.fortschritt-zeile { display: flex; align-items: center; gap: 10px; margin: 2px 0 10px; }
.fortschritt-mini { flex: 1; height: 8px; border-radius: 4px; background: var(--flaeche-2); overflow: hidden; }
.fortschritt-mini > i { display: block; height: 100%; border-radius: 4px; transition: width .6s ease; }
.fehlend-kurz { margin-top: 10px; padding: 8px 10px; border-radius: 10px; background: var(--akzent-hell); }
.auftragskarte { display: grid; gap: 10px; cursor: pointer; text-decoration: none; color: inherit; transition: transform .1s, box-shadow .15s; }
.auftragskarte:hover { box-shadow: 0 2px 4px rgba(29,35,41,.06), 0 10px 26px rgba(29,35,41,.1); }
.auftragskarte h3 { margin: 0; font-size: 17px; line-height: 1.25; }
.auftragskarte .zeile { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.miniaturen { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.miniaturen img, .miniaturen span { aspect-ratio: 1; width: 100%; min-width: 0; object-fit: cover; border-radius: 8px; background: var(--flaeche-2); display: block; }
.zaehler { display: flex; gap: 12px; font-size: 13.5px; color: var(--tinte-2); }
.zaehler span { display: inline-flex; gap: 4px; align-items: center; }
.zaehler svg { width: 15px; height: 15px; }

.reiter { display: flex; gap: 4px; border-bottom: 1px solid var(--linie); margin: 18px 0 14px; overflow-x: auto; }
.reiter button {
  border: 0; background: transparent; padding: 10px 14px; font-weight: 700; color: var(--tinte-2); cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.reiter button.aktiv { color: var(--tinte); border-bottom-color: var(--akzent); }

.einladung-link { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 10px; background: var(--flaeche-2); font-family: var(--mono); font-size: 12.5px; overflow: hidden; min-width: 0; }
.einladung-link span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.statistik { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.statistik div { padding: 8px 6px; border-radius: 11px; text-align: center; min-width: 0; }
.statistik b { display: block; font-size: 19px; line-height: 1.15; }
.statistik small { font-size: 12.5px; font-weight: 700; }
.statistik .vorher { background: var(--vorher-hell); color: var(--vorher); }
.statistik .waehrend { background: var(--waehrend-hell); color: var(--waehrend); }
.statistik .nachher { background: var(--nachher-hell); color: var(--nachher); }

.verlauf { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.verlauf li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--linie); font-size: 14px; }
.verlauf time { color: var(--tinte-2); font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .verlauf li { grid-template-columns: 1fr; gap: 0; } }

.anmelden { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.anmelden .karte { width: 100%; max-width: 380px; padding: 28px; }

.schritte { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-top: 16px; text-align: left; }
.schritte div { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px; padding: 14px; }
.schritte b { display: block; margin-bottom: 4px; color: var(--tinte); }

.checkeditor { display: grid; gap: 8px; }
.checkeditor .zeile { display: grid; grid-template-columns: 130px 1fr auto; gap: 8px; align-items: center; }
@media (max-width: 560px) { .checkeditor .zeile { grid-template-columns: 1fr auto; } .checkeditor .zeile select { grid-column: 1 / -1; } }

/* --------------------------------------------------------------- Protokoll */

.protokoll-status { display: grid; gap: 14px; justify-items: center; text-align: center; padding: 40px 20px; }
.grosser-spinner { width: 46px; height: 46px; border: 4px solid var(--linie); border-top-color: var(--akzent); border-radius: 50%; animation: drehen .9s linear infinite; }
.pruefliste { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; text-align: left; }
.pruefliste li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.pruefliste svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.pruefliste .ok svg { color: var(--ok); }
.pruefliste .warn svg { color: var(--waehrend); }
.pruefliste .schlecht svg { color: var(--gefahr); }

.dokument {
  background: #fff; color: #1d2329; border-radius: 6px; padding: 38px 42px; box-shadow: var(--schatten);
  font-size: 14.5px; line-height: 1.5; border: 1px solid #e4e0d8;
  --linie: #dcd6cc; --tinte-2: #59636d; --tinte-3: #87909a; --flaeche-2: #efece6; --flaeche: #fff; --tinte: #1d2329;
  --akzent: #e25a0c; --akzent-dunkel: #b8470a; --akzent-hell: #fde8da; --gefahr: #c62828; --gefahr-hell: #fbe3e1;
  --ok: #2d8a45; --nachher: #2d8a45; --nachher-hell: #dff2e4; --vorher: #2f6db3; --vorher-hell: #e1ecf8;
  --waehrend: #a06a00; --waehrend-hell: #fbf0d6;
  color-scheme: light;
}
.dokument .dok-kopf > div:first-child { flex: 1; min-width: 0; }
@media (max-width: 600px) { .dokument { padding: 22px 16px; border-radius: 0; margin: 0 -16px; border-left: 0; border-right: 0; } }
.dokument .dok-kopf { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; border-bottom: 3px solid #1d2329; padding-bottom: 14px; margin-bottom: 18px; }
.dokument .dok-art { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #e25a0c; }
.dokument h1 { margin: 4px 0 0; font-size: 24px; line-height: 1.2; letter-spacing: -.02em; }
.dokument h2 { font-size: 15.5px; margin: 26px 0 8px; padding-bottom: 5px; border-bottom: 1px solid #dcd6cc; letter-spacing: 0; display: flex; gap: 8px; }
.dokument h2 .nr { color: #87909a; font-variant-numeric: tabular-nums; }
.dokument p { margin: 0 0 8px; white-space: pre-wrap; }
.dokument .leer { color: #87909a; font-style: italic; }
.dok-meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 13.5px; margin: 0; }
.dok-meta dt { color: #59636d; }
.dok-meta dd { margin: 0; font-weight: 600; }
.dok-liste { margin: 0; padding-left: 20px; }
.dok-liste li { margin-bottom: 4px; }
.dok-tabelle { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.dok-tabelle th, .dok-tabelle td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #e4e0d8; vertical-align: top; }
.dok-tabelle th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #59636d; }
.schritt { display: grid; grid-template-columns: 28px 1fr; gap: 10px; margin-bottom: 12px; }
.schritt .nr { width: 26px; height: 26px; border-radius: 50%; background: #1d2329; color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 800; }
.schritt b { display: block; }
.fotobezug { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.fotobezug span { font-size: 11.5px; font-weight: 800; padding: 1px 7px; border-radius: 6px; background: #efece6; color: #59636d; }
.dringlichkeit { font-size: 11.5px; font-weight: 800; padding: 2px 8px; border-radius: 6px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.dringlichkeit.hoch { background: #fbe3e1; color: #c62828; }
.dringlichkeit.mittel { background: #fbf0d6; color: #a06a00; }
.dringlichkeit.niedrig { background: #e1ecf8; color: #2f6db3; }

.fotoraster { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 520px) { .fotoraster { grid-template-columns: 1fr; } }
.fotoraster figure { margin: 0; break-inside: avoid; page-break-inside: avoid; }
/* contain statt cover: auf einem Nachweisfoto darf nichts abgeschnitten werden (Hochformat!) */
.fotoraster img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; border-radius: 6px; background: #efece6; }
.fotoraster figcaption { font-size: 12.5px; margin-top: 5px; color: #1d2329; }
.fotoraster figcaption .foto-kopf { display: flex; gap: 6px; align-items: center; color: #59636d; font-weight: 600; margin-bottom: 2px; }
.fotoraster figcaption b { color: #1d2329; }
.phasen-titel { break-after: avoid; page-break-after: avoid; font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; margin: 14px 0 8px; }
.phasen-titel.vorher { color: #2f6db3; }
.phasen-titel.waehrend { color: #a06a00; }
.phasen-titel.nachher { color: #2d8a45; }

.unterschriften { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 560px) { .unterschriften { grid-template-columns: 1fr; } }
.unterschrift { border: 1px solid #dcd6cc; border-radius: 8px; padding: 12px; min-height: 150px; display: grid; align-content: space-between; gap: 8px; }
.unterschrift img { max-height: 90px; width: auto; margin: 0; }
.unterschrift .linie { border-top: 1px solid #1d2329; padding-top: 4px; font-size: 12.5px; color: #59636d; }
.unterschrift .knopf { justify-self: start; }
.dok-hinweis { font-size: 12.5px; color: #59636d; background: #f6f4f0; border-radius: 6px; padding: 10px 12px; margin-top: 10px; }
.integritaet { font-size: 11.5px; }
.integritaet td { font-size: 11px; white-space: nowrap; }
.integritaet td:last-child { font-family: var(--mono); white-space: normal; word-break: break-all; }

/* Bearbeitungsmodus im Dokument */
.dokument .eingabe { background: #fff; color: #1d2329; border-color: #dcd6cc; font-size: 15px; min-height: 40px; padding: 8px 10px; }
.dokument textarea.eingabe { min-height: 60px; }
.dokument .bearbeitbar-zeile { display: grid; gap: 6px; grid-template-columns: 1fr auto; align-items: start; margin-bottom: 8px; }
.dokument .mehrfeld { display: grid; gap: 6px; }
.dokument .mehrfeld.drei { grid-template-columns: 1fr 90px 90px; }
.dokument .mehrfeld.zwei { grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .dokument .mehrfeld.drei, .dokument .mehrfeld.zwei { grid-template-columns: 1fr; } }
.dokument .knopf { background: #fff; color: #1d2329; border-color: #dcd6cc; }
.dokument .knopf.primaer { background: #e25a0c; border-color: #e25a0c; color: #fff; }
.dokument .knopf.klein { min-height: 34px; font-size: 13.5px; padding: 0 10px; }
.dokument .knopf.klein svg { width: 16px; height: 16px; }
.speicherstand { font-size: 13px; color: var(--tinte-2); display: inline-flex; gap: 6px; align-items: center; }

.signaturfeld { width: 100%; height: 190px; border: 2px dashed var(--linie); border-radius: 12px; background: #fff; touch-action: none; display: block; cursor: crosshair; }

.qr { background: #fff; padding: 16px; border-radius: 12px; display: grid; place-items: center; }
.qr svg { width: min(280px, 70vw); height: auto; }

.fusszeile { margin-top: 40px; text-align: center; font-size: 12.5px; color: var(--tinte-3); }

/* ------------------------------------------------------------------ Druck */

@media print {
  @page { size: A4; margin: 14mm 13mm 16mm; }
  body { background: #fff; font-size: 11pt; }
  .nicht-drucken, .kopf, .aktionsleiste, .toasts, .schleier { display: none !important; }
  .seite { max-width: none; padding: 0; }
  .dokument { box-shadow: none; border: 0; padding: 0; margin: 0; border-radius: 0; font-size: 10.5pt; }
  .dokument h2 { break-after: avoid; page-break-after: avoid; }
  .fotoraster { grid-template-columns: repeat(2, 1fr); }
  .unterschriften, .integritaet-block { break-inside: avoid; page-break-inside: avoid; }
  .dokument .knopf { display: none !important; }
  a { color: inherit; text-decoration: none; }
}

/* ------------------------------------------------------- Fertig-Knopf (Fortschritt) */

.kopf-erfassung { --fortschritt-farbe: hsl(0 82% 50%); }
.fortschritt-leiste { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; pointer-events: none; }
.fortschritt-leiste > i { display: block; height: 100%; width: 0; background: var(--fortschritt-farbe); transition: width .7s cubic-bezier(.3, .8, .3, 1), background-color .6s ease; }
.fertig-knopf {
  position: relative; width: 50px; height: 50px; border-radius: 50%; border: 0; flex: none; cursor: pointer;
  display: grid; place-items: center; background: var(--flaeche); color: var(--fortschritt-farbe);
  box-shadow: var(--schatten); transition: background-color .5s ease, color .5s ease, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.fertig-knopf:active { transform: scale(.94); }
.fertig-knopf svg.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); vertical-align: 0; }
.fertig-knopf .ring-spur { fill: none; stroke: var(--linie); stroke-width: 4; }
.fertig-knopf .ring-wert { fill: none; stroke: var(--fortschritt-farbe); stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset .7s cubic-bezier(.3, .8, .3, 1), stroke .6s ease; }
.fertig-knopf > svg:not(.ring) { width: 24px; height: 24px; stroke-width: 3; position: relative; }
.fertig-knopf.komplett, .fertig-knopf.abgegeben { background: var(--fortschritt-farbe); color: #fff; }
.fertig-knopf.komplett { animation: fertig-puls 1.8s ease-in-out infinite; }
@keyframes fertig-puls {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--fortschritt-farbe) 55%, transparent); }
  60% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--fortschritt-farbe) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .fertig-knopf.komplett { animation: none; } }

.fehlliste { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fehlliste li { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 11px; background: var(--flaeche-2); }
.fehlliste .text { font-size: 14.5px; min-width: 0; overflow-wrap: anywhere; }
.fehlliste .knopf { min-height: 36px; padding: 0 10px; }
@media (max-width: 420px) { .fehlliste li { grid-template-columns: 1fr auto; } .fehlliste li .chip { grid-column: 1 / -1; justify-self: start; } }
.fertig-alles { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; background: var(--nachher-hell); color: var(--nachher); }
.fertig-alles svg { width: 28px; height: 28px; stroke-width: 3; flex: none; }
.fertig-alles b { color: var(--tinte); }

.kamera-hinweis.gross { white-space: normal; text-align: center; display: grid; gap: 12px; bottom: 42%; padding: 16px 18px; border-radius: 16px; width: min(320px, 86vw); font-size: 15px; }
.kamera-hinweis-knoepfe { display: flex; gap: 10px; justify-content: center; }

.sprach-hinweis { display: block; margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--vorher-hell); color: var(--tinte); font-weight: 600; font-size: 14px; }
.sprach-hinweis.gross { font-size: 15.5px; margin: 0; }
.auftrag-titel { font-size: 18px; font-weight: 750; line-height: 1.25; }
.auftrag-anmerkung { white-space: pre-wrap; box-shadow: none; overflow-wrap: anywhere; }
.feld-hilfe { font-weight: 400; font-size: 12.5px; color: var(--tinte-3); }

.checkphasen { display: grid; gap: 14px; }
.checkphase { display: grid; gap: 6px; }
.checkphase .phasen-titel { margin: 0; }
.checkzeile { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; }
.checkphase > .knopf { justify-self: start; }

@media (max-width: 560px) {
  .karte { padding: 14px; }
  .kopf { gap: 8px; }
  .integritaet td { white-space: normal; }
  .reiter { margin-top: 14px; }
}

/* Protokoll-Aktionen: auf dem Handy Nebenaktionen nur als Symbol, nichts zum Seitwaerts-Wischen */
.protokoll-leiste { max-width: 760px; margin: 0 auto; }
@media (max-width: 560px) {
  .protokoll-leiste .knopf > span:not(.spinner-klein) { display: none; }
  .protokoll-leiste .knopf { padding: 0 12px; }
}

/* KI-Status im Kopf: nur ein Punkt, Text beim Antippen */
.ki-status { position: relative; display: inline-flex; }
.ki-punkt { width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ki-punkt .punkt { width: 12px; height: 12px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent); }
.ki-punkt.warnung .punkt { background: var(--waehrend); box-shadow: 0 0 0 4px color-mix(in srgb, var(--waehrend) 25%, transparent); }
.ki-punkt.aus .punkt { background: var(--tinte-3); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tinte-3) 25%, transparent); }
.ki-blase {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 40; white-space: nowrap;
  background: var(--tinte); color: var(--grund); font-size: 13px; font-weight: 650; padding: 7px 11px; border-radius: 9px;
  box-shadow: var(--schatten-gross); animation: einblenden .12s ease;
}
.ki-blase.lang { white-space: normal; width: min(260px, 70vw); font-weight: 500; }

/* iOS: Datumsfelder bringen eine eigene Mindestbreite mit und ragen sonst rechts ueber die Karte hinaus */
input[type="date"].eingabe { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; display: block; }
input[type="date"].eingabe::-webkit-date-and-time-value { text-align: left; }
label.feld, .feldgruppe > * { min-width: 0; }
