:root {
  --akzent: #f46e04;
  --akzent-dunkel: #c95500;
  --text: #1c2430;
  --leise: #667085;
  --linie: #e4e7ec;
  --flaeche: #f4f5f7;
  --karte: #fff;
  --ok: #15803d; --ok-bg: #e7f6ec;
  --nok: #c0262d; --nok-bg: #fdeceb;
  --warn: #a15c07; --warn-bg: #fff4e0;
  --radius: 14px;
  --sicher-unten: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text); background: var(--flaeche);
  min-height: 100dvh;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Kopfleiste */
.leiste {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
  background: var(--karte); border-bottom: 1px solid var(--linie);
}
.marke img { height: 26px; display: block; }
.sync { margin-left: auto; white-space: nowrap; border: 0; border-radius: 99px; padding: 4px 10px; font-size: 13px; font-weight: 600; background: var(--flaeche); color: var(--leise); }
.sync.offline { background: var(--warn-bg); color: var(--warn); }
.sync.fehler { background: var(--nok-bg); color: var(--nok); }
.profil { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: var(--leise); text-decoration: none; }
.sync[hidden] + .profil { margin-left: auto; }

main { padding: 16px 16px calc(110px + var(--sicher-unten)); max-width: 720px; margin: 0 auto; }

h1 { font-size: 22px; line-height: 1.2; margin: 4px 0 4px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--leise); margin: 24px 0 8px; font-weight: 600; }
.unterzeile { color: var(--leise); margin: 0 0 12px; }
.zurueck { display: inline-flex; align-items: center; gap: 4px; color: var(--leise); text-decoration: none; font-size: 15px; padding: 4px 0; }

/* Karten und Listen */
.karte { background: var(--karte); border-radius: var(--radius); border: 1px solid var(--linie); padding: 14px 16px; margin-bottom: 10px; }
.liste { background: var(--karte); border-radius: var(--radius); border: 1px solid var(--linie); overflow: hidden; }
.liste > a, .liste > div.zeile { display: flex; align-items: center; gap: 12px; padding: 13px 16px; text-decoration: none; border-top: 1px solid var(--linie); min-height: 56px; }
.liste > :first-child { border-top: 0; }
.liste .haupt { flex: 1; min-width: 0; }
.liste .titel { font-weight: 600; }
.liste .info { color: var(--leise); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.liste .pfeil { color: #b0b6c0; }
.leer { color: var(--leise); padding: 16px; text-align: center; }

.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--flaeche); color: var(--leise); white-space: nowrap; }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.nok { background: var(--nok-bg); color: var(--nok); }
.chip.akzent { background: #fff0e3; color: var(--akzent-dunkel); }

.daten { display: grid; grid-template-columns: 1fr; gap: 10px; }
.daten .label { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--leise); }
.daten .wert { white-space: pre-line; }

/* Schaltflächen */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--linie);
  background: var(--karte); font-weight: 600; text-decoration: none; cursor: pointer;
}
.knopf.primaer { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.knopf.primaer:active { background: var(--akzent-dunkel); }
.knopf.gefahr { color: var(--nok); }
.knopf.breit { width: 100%; }
.knopf:disabled { opacity: .5; cursor: default; }
.knopfreihe { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.knopfreihe > * { flex: 1; }
.fussleiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9;
  padding: 12px 16px calc(12px + var(--sicher-unten));
  background: rgba(255,255,255,.96); border-top: 1px solid var(--linie);
  backdrop-filter: blur(8px);
}
.fussleiste .innen { max-width: 720px; margin: 0 auto; display: flex; gap: 10px; }
.fussleiste .innen > * { flex: 1; }

/* Formulare */
.feld { display: block; margin-bottom: 14px; }
.feld > span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.feld small { color: var(--leise); font-weight: 400; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=search], input[type=month], input[type=number], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid #cfd4dc; border-radius: 12px; background: #fff;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--akzent); outline-offset: -1px; border-color: transparent; }
.zwei { display: grid; grid-template-columns: 110px 1fr; gap: 10px; }
.suche { margin-bottom: 8px; }

.auswahl { display: flex; flex-wrap: wrap; gap: 8px; }
.auswahl label { position: relative; }
.auswahl input { position: absolute; opacity: 0; pointer-events: none; }
.auswahl span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid #cfd4dc; background: #fff; font-weight: 500; }
.auswahl input:checked + span { background: #fff0e3; border-color: var(--akzent); color: var(--akzent-dunkel); font-weight: 600; }
.auswahl input:focus-visible + span { outline: 2px solid var(--akzent); }

/* Checkliste */
.reiter { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px 4px; scrollbar-width: none; }
.reiter a { flex: none; padding: 8px 14px; border-radius: 99px; background: var(--karte); border: 1px solid var(--linie); text-decoration: none; font-weight: 600; font-size: 15px; }
.reiter a.aktiv { background: var(--text); color: #fff; border-color: var(--text); }
.fortschritt { height: 6px; background: var(--linie); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.fortschritt > div { height: 100%; background: var(--ok); transition: width .2s; }
.gruppe-titel { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--leise); font-weight: 700; margin: 22px 0 8px; }
.punkt { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; }
.punkt.s-io { border-left: 5px solid var(--ok); }
.punkt.s-nio { border-left: 5px solid var(--nok); background: #fffafa; }
.punkt.s-entf { border-left: 5px solid #c4c9d1; }
.punkt .text { margin-bottom: 10px; }
.status-knoepfe { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.status-knoepfe button { min-height: 46px; border-radius: 10px; border: 1px solid #cfd4dc; background: #fff; font-weight: 700; font-size: 15px; }
.status-knoepfe button.an[data-status="i.O."] { background: var(--ok); border-color: var(--ok); color: #fff; }
.status-knoepfe button.an[data-status="n.i.O."] { background: var(--nok); border-color: var(--nok); color: #fff; }
.status-knoepfe button.an[data-status="entfällt"] { background: #6b7280; border-color: #6b7280; color: #fff; }
.mangel { margin-top: 10px; display: none; }
.punkt.s-nio .mangel, .punkt.hat-bemerkung .mangel { display: block; }
.mangel textarea { min-height: 64px; }
.foto-zeile { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.foto-zeile img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--linie); }
.foto-zeile .wartet { opacity: .55; }
.foto-knopf { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px dashed #b8bec8; color: var(--leise); font-weight: 600; font-size: 14px; cursor: pointer; }
.foto-knopf input { display: none; }
.notiz-link { background: none; border: 0; color: var(--leise); font-size: 14px; padding: 6px 0 0; text-decoration: underline; }

/* Ergebnis-Auswahl */
.ergebnis-wahl { display: grid; gap: 8px; }
.ergebnis-wahl label span { width: 100%; }
.ergebnis-wahl input[value="Wirksam und betriebssicher"]:checked + span { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.ergebnis-wahl input[value="Betriebssicher mit Mängeln"]:checked + span { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.ergebnis-wahl input[value="Nicht betriebssicher"]:checked + span { background: var(--nok-bg); border-color: var(--nok); color: var(--nok); }

/* Unterschrift */
.unterschrift-feld { position: relative; background: #fff; border: 1px solid #cfd4dc; border-radius: 12px; height: 200px; touch-action: none; }
.unterschrift-feld canvas { width: 100%; height: 100%; display: block; border-radius: 12px; }
.unterschrift-feld .linie { position: absolute; left: 20px; right: 20px; bottom: 44px; border-top: 1px solid #d0d5dd; pointer-events: none; }
.unterschrift-feld .hinweis { position: absolute; left: 20px; bottom: 16px; color: #98a2b3; font-size: 13px; pointer-events: none; }
.unterschrift-vorschau { max-height: 90px; display: block; margin: 6px 0; }

.hinweis-box { padding: 12px 14px; border-radius: 12px; background: var(--warn-bg); color: var(--warn); margin: 10px 0; }
.hinweis-box.ok { background: var(--ok-bg); color: var(--ok); }
.hinweis-box.nok { background: var(--nok-bg); color: var(--nok); }
.hinweis-box ul { margin: 6px 0 0; padding-left: 18px; }

.meldung { position: fixed; left: 16px; right: 16px; bottom: calc(90px + var(--sicher-unten)); z-index: 20; max-width: 520px; margin: 0 auto; padding: 12px 16px; border-radius: 12px; background: var(--text); color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.laden { color: var(--leise); text-align: center; padding: 40px 0; }

.login { max-width: 380px; margin: 8vh auto 0; }
.login img { height: 40px; margin-bottom: 18px; }
