/* SiteLink – für iPhone hochkant zuerst, iPad mit breiterer Spalte.
   Farben, Schrift und Rundungen aus dem Smart-Link Design (design.css, ab 0.2) – die eigenen Namen zeigen auf die gemeinsamen.
   data-look: auto (dunkel, im hellen iPhone-Modus hell), standard, hell, cyber */
:root {
  --flaeche: var(--panel); --flaeche2: var(--panel-2); --text2: var(--muted); --linie: var(--border);
  --akzent: var(--accent); --akzent-text: var(--on-accent); --gut: var(--ok); --gefahr: var(--danger);
  --kopf: #0c0d10; --kopf-text: #e2e8f0;
  --rund: var(--r-lg); --tap: 48px;
  --oben: env(safe-area-inset-top, 0px); --unten: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 var(--font);
  padding-top: calc(56px + var(--oben)); padding-bottom: calc(64px + var(--unten)); overscroll-behavior-y: none; }
body.scan-offen { overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
.mono { font-family: var(--mono); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.klein { font-size: 13px; color: var(--text2); }
.mitte { text-align: center; }
.warn { color: var(--warn); } .gut { color: var(--gut); }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--text2); margin: 22px 4px 8px; }
h4 { font-size: 12px; color: var(--text2); margin: 12px 4px 4px; text-transform: uppercase; letter-spacing: .05em; }

/* Kopf und Leiste */
.kopf { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; gap: 4px;
  background: var(--kopf); color: var(--kopf-text); padding: var(--oben) 8px 0; height: calc(56px + var(--oben)); }
.kopf-titel { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 0 6px; }
.kopf-titel b, .kopf-titel small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kopf-titel small { font-size: 12px; opacity: .7; }
.kopf-zurueck, .kopf-knopf { width: var(--tap); height: var(--tap); border: 0; background: none; color: inherit; font-size: 30px; line-height: 1; border-radius: 10px; }
.kopf-knopf { font-size: 26px; }
.kopf-zurueck:active, .kopf-knopf:active { background: rgba(255,255,255,.12); }
.leiste { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; background: var(--flaeche); border-top: 1px solid var(--linie); padding-bottom: var(--unten); }
.leiste button { flex: 1; min-height: 60px; border: 0; background: none; color: var(--text2); font-size: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; position: relative; }
.leiste .ic, .scan-fuss .ic { width: 24px; height: 24px; display: block; }
.kopf-knopf .ic-kopf { width: 26px; height: 26px; display: block; margin: auto; }
.leiste button.aktiv { color: var(--akzent); }
.leiste .zahl { position: absolute; top: 6px; left: 55%; background: var(--gefahr); color: #fff; font-style: normal; font-size: 11px; border-radius: 9px; padding: 0 5px; min-width: 18px; }
.leiste[hidden], [hidden] { display: none !important; }

/* Inhalt */
.inhalt { max-width: 720px; margin: 0 auto; padding: 12px 16px 24px; outline: none; }
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--rund); padding: 14px; margin: 0 0 12px; overflow-wrap: anywhere; }
.karte.hinweis { border-color: var(--akzent); }
.karte ol { margin: 8px 0 0; padding-left: 20px; }
.kennzahl > div:first-child { margin-bottom: 8px; }
.typ { font-weight: 600; }
.leer { color: var(--text2); text-align: center; padding: 24px 8px; }
.balken { width: 100%; height: 6px; border: 0; border-radius: 3px; background: var(--linie); overflow: hidden; -webkit-appearance: none; appearance: none; display: block; margin-top: 6px; }
.balken::-webkit-progress-bar { background: var(--linie); border-radius: 3px; }
.balken::-webkit-progress-value { background: var(--gut); border-radius: 3px; }
.balken::-moz-progress-bar { background: var(--gut); }
.status-zeile { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; font-size: 13px; color: var(--text2); }
.status-zeile span { display: inline-flex; align-items: center; gap: 5px; }

.knopf { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; border-radius: var(--r);
  border: 1px solid var(--linie); background: var(--flaeche); color: var(--text); font-weight: 600; cursor: pointer; text-align: center; }
.knopf small { font-weight: 400; font-size: 12px; opacity: .8; }
.knopf.gross { display: flex; width: 100%; min-height: 56px; margin: 0 0 10px; font-size: 17px; }
.knopf.primaer { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.knopf.gefahr { color: var(--gefahr); border-color: var(--gefahr); }
.knopf.primaer.gefahr { background: var(--gefahr); color: #fff; }
.knopf:disabled { opacity: .45; }
.knopf:active:not(:disabled) { filter: brightness(.92); }
.inhalt > .knopf:not(.gross) { width: 100%; margin-bottom: 8px; }

.liste { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--rund); overflow: hidden; margin-bottom: 12px; }
.zeile { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--linie); background: none; text-align: left; cursor: pointer; }
.liste > .zeile:last-child, .wahl > .zeile:last-child { border-bottom: 0; }
.zeile:active { background: var(--flaeche2); }
.zeile.block { cursor: default; align-items: flex-start; }
.z-haupt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.z-haupt b { font-weight: 600; overflow-wrap: anywhere; }
.z-haupt small { color: var(--text2); font-size: 13px; overflow-wrap: anywhere; }
.z-pfeil { color: var(--text2); font-size: 22px; }
.zeile.schalter input { width: 26px; height: 26px; accent-color: var(--akzent); }
.punkt { width: 12px; height: 12px; border-radius: 50%; flex: none; display: inline-block; background: var(--st-planned); }
.st-planned { --st: var(--st-planned); } .st-mounted { --st: var(--st-mounted); } .st-learned { --st: var(--st-learned); } .st-tested { --st: var(--st-tested); }
.punkt.st-planned, .punkt.st-mounted, .punkt.st-learned, .punkt.st-tested { background: var(--st); }
.marke { font-size: 11px; font-weight: 700; color: var(--akzent); border: 1px solid var(--akzent); border-radius: 6px; padding: 0 5px; text-transform: uppercase; }
.bus { font-size: 12px; font-weight: 700; color: var(--text2); border: 1px solid var(--linie); border-radius: 6px; padding: 2px 6px; min-width: 44px; text-align: center; }
.aend { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; margin-top: 6px; overflow-wrap: anywhere; }
.aend s { color: var(--text2); }
.mini { min-width: 40px; min-height: 40px; border: 1px solid var(--linie); border-radius: var(--r-sm); background: var(--flaeche2); font-size: 18px; }
.schritte { padding-left: 20px; margin: 4px 0 12px; }

.suche input, .eingabe { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--linie); background: var(--flaeche); font-size: 17px; }
.suche { margin-bottom: 12px; }

.feld { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--rund); padding: 12px 14px; margin-bottom: 10px; }
.feld-titel { display: block; font-size: 13px; color: var(--text2); margin-bottom: 4px; }
.feld-wert { font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }
.feld-wert.leer-wert { color: var(--text2); font-weight: 400; }
.feld-knoepfe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.feld-knoepfe .knopf { flex: 1 1 auto; }
.notiz { white-space: pre-wrap; overflow-wrap: anywhere; }
.segment { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--flaeche2); border-radius: var(--r); padding: 4px; }
.segment button { min-height: 44px; border: 0; border-radius: var(--r-sm); background: none; font-size: 13px; font-weight: 600; color: var(--text2); padding: 4px 2px; }
.segment button.aktiv { background: var(--st); color: #0b0d12; }
.segment button.aktiv.st-planned { color: #fff; }       /* Weiss auf Bernstein/Grün/Blau ist zu schwach (Smart-Link Design) */

/* Meldung, Dialog, Update */
.meldung { position: fixed; left: 16px; right: 16px; bottom: calc(76px + var(--unten)); z-index: 60; background: var(--text); color: var(--bg); border-radius: 12px; padding: 12px 14px;
  font-weight: 600; transform: translateY(20px); opacity: 0; pointer-events: none; transition: .2s; max-width: 560px; margin: 0 auto; }
.meldung.sichtbar { transform: none; opacity: 1; }
.meldung.gut { background: var(--gut); color: #fff; } .meldung.fehler { background: var(--gefahr); color: #fff; }
.dialog-hg { position: fixed; inset: 0; z-index: 50; background: rgba(2, 6, 23, .55); display: flex; align-items: flex-end; justify-content: center; padding: 16px; padding-bottom: calc(16px + var(--unten)); }
.dialog { width: 100%; max-width: 520px; background: var(--flaeche); border-radius: var(--r-lg); padding: 18px; border: 1px solid var(--linie); box-shadow: var(--shadow); max-height: 85vh; overflow: auto; }
.dialog h2 { margin: 0 0 8px; font-size: 19px; }
.dialog-text p { margin: 0 0 8px; overflow-wrap: anywhere; }
.dialog .eingabe { margin: 6px 0 12px; }
.dialog textarea.eingabe { resize: vertical; }
.dialog-knoepfe { display: flex; gap: 8px; } .dialog-knoepfe .knopf { flex: 1; }
.update { position: fixed; left: 16px; right: 16px; top: calc(64px + var(--oben)); z-index: 55; background: var(--flaeche); border: 1px solid var(--akzent); border-radius: 12px; padding: 12px; display: flex; align-items: center; gap: 10px; justify-content: space-between; }

/* Scan */
.scan { position: fixed; inset: 0; z-index: 40; background: #000; color: #fff; display: flex; flex-direction: column; padding-top: var(--oben); padding-bottom: var(--unten); }
.scan-kopf { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; background: rgba(12, 13, 16, .92); }
.scan-ziel { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.scan-ziel b { font-size: 18px; overflow-wrap: anywhere; } .scan-ziel small { opacity: .75; font-size: 13px; }
.scan-zu { width: var(--tap); height: var(--tap); border: 0; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; font-size: 20px; flex: none; }
.scan-bild { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.scan-bild video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-rahmen { position: absolute; left: 10%; right: 10%; top: 25%; bottom: 25%; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); pointer-events: none; }
.scan-rahmen i { position: absolute; inset: 0; border: 3px solid var(--accent); border-radius: 14px; }
.scan-hinweis { position: absolute; left: 12px; right: 12px; bottom: 14px; text-align: center; font-weight: 600; text-shadow: 0 1px 3px #000; }
.scan-blatt { background: var(--flaeche); color: var(--text); padding: 14px 16px; max-height: 55vh; overflow: auto; border-radius: 16px 16px 0 0; }
.scan-blatt p { margin: 0 0 10px; }
.scan-blatt .knopf.gross { margin-bottom: 8px; }
.scan-blatt > .knopf:not(.gross) { width: 100%; }
.scan-blatt .zeile { border: 1px solid var(--linie); border-radius: 10px; margin-bottom: 8px; }
.wahl { max-height: 34vh; overflow: auto; margin: 8px 0; }
.wahl .zeile { min-height: 48px; }
.scan-fuss { display: flex; background: rgba(12, 13, 16, .92); }
.scan-fuss button { flex: 1; min-height: 64px; border: 0; background: none; color: #fff; font-size: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.scan-fuss button.aktiv { color: var(--highlight); }

@media (min-width: 760px) {
  .inhalt { padding: 20px 24px 32px; }
  .scan-rahmen { left: 20%; right: 20%; }
  .dialog-hg { align-items: center; }
}

/* Knopf mit Symbol links (ab 0.2) */
.knopf:has(> .ic-knopf) { flex-direction: row; gap: 8px; }
.ic-knopf { width: 20px; height: 20px; flex: none; }
.knopf.gross .ic-knopf { width: 22px; height: 22px; }

/* Auswahl in Zeilen (Aussehen) */
.wahl-klein { flex: none; max-width: 52%; min-height: 40px; padding: 0 8px; border-radius: var(--r-sm); border: 1px solid var(--linie); background: var(--flaeche2); color: var(--text); font: inherit; font-size: 15px; }

/* ---------- Aussehen «Cyberpunk» (ab 0.2, Smart-Link Design – wie TopologyLink 5.7) ---------- */
:root[data-look="cyber"] { --kopf: #0b0717; --kopf-text: #ecf7ff; }
:root[data-look="cyber"] body { letter-spacing: .01em; }
:root[data-look="cyber"] .kopf { background: linear-gradient(90deg, #0e0a1d, #160c2c 60%, #0e0a1d); border-bottom: 1px solid var(--accent-2); box-shadow: 0 0 18px rgba(255, 42, 109, .25); }
:root[data-look="cyber"] .kopf-titel b { text-transform: uppercase; letter-spacing: .12em; text-shadow: 1.5px 0 rgba(255, 42, 109, .8), -1.5px 0 rgba(0, 240, 255, .8); }
:root[data-look="cyber"] .leiste { border-top: 1px solid var(--accent); box-shadow: 0 0 18px rgba(0, 240, 255, .18); }
:root[data-look="cyber"] .leiste button.aktiv { text-shadow: 0 0 8px rgba(0, 240, 255, .9); }
:root[data-look="cyber"] h3, :root[data-look="cyber"] h4 { color: var(--highlight); letter-spacing: .14em; }
:root[data-look="cyber"] h3::before { content: '// '; color: var(--accent-2); }
:root[data-look="cyber"] .karte, :root[data-look="cyber"] .liste, :root[data-look="cyber"] .feld { border-radius: 0; clip-path: var(--cut); border-left: 2px solid var(--accent-2); }
:root[data-look="cyber"] .knopf { border-radius: 0; clip-path: var(--cut-sm); text-transform: uppercase; letter-spacing: .05em; border-color: var(--border-2); }
:root[data-look="cyber"] .knopf.primaer { background: var(--highlight); border-color: var(--highlight); color: #06040d; box-shadow: 0 0 16px rgba(252, 238, 10, .45); }
:root[data-look="cyber"] .knopf.primaer.gefahr { background: var(--danger); border-color: var(--danger); color: #fff; }
:root[data-look="cyber"] .marke, :root[data-look="cyber"] .bus, :root[data-look="cyber"] .segment, :root[data-look="cyber"] .segment button,
:root[data-look="cyber"] .eingabe, :root[data-look="cyber"] .suche input, :root[data-look="cyber"] .wahl-klein, :root[data-look="cyber"] .mini { border-radius: 0; }
:root[data-look="cyber"] .dialog { border-radius: 0; clip-path: var(--cut); border-color: var(--accent); }
:root[data-look="cyber"] .scan-rahmen i { border-radius: 0; box-shadow: 0 0 18px var(--accent), inset 0 0 18px rgba(0, 240, 255, .35); }
:root[data-look="cyber"] .balken::-webkit-progress-value { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ---- Belegfotos und Etikett-Hinweise (ab 0.3) ---- */
.belege { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 6px; }
.beleg { padding: 0; border: 1px solid var(--linie); border-radius: var(--rund); overflow: hidden; background: var(--bg); aspect-ratio: 1; }
.beleg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.beleg-gross { display: block; width: 100%; max-height: 60vh; object-fit: contain; border-radius: var(--rund); margin-bottom: 8px; }
.wahl h4.passt { color: var(--accent); }
:root[data-look="cyber"] .beleg, :root[data-look="cyber"] .beleg-gross { border-radius: 0; }
.scan-fuss button { min-width: 0; padding: 0 2px; text-align: center; line-height: 1.15; }   /* bis 6 Knöpfe auf 390 px (ab 0.3: «Text») */

/* ---- Arbeit: Arbeitslisten, Kabel, Grundriss (ab 0.4) ---- */
.segment.drei { grid-template-columns: repeat(3, 1fr); margin-bottom: 10px; }
.segment.drei button.aktiv { background: var(--akzent); color: var(--akzent-text); }
.kabel-zeile { flex-wrap: wrap; gap: 8px; }
.z-knopf { border: 0; background: none; padding: 0; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.haken-reihe { display: flex; gap: 6px; flex: none; }
.haken-reihe.gross { margin-top: 6px; }
.haken-reihe.gross .haken { flex: 1; min-height: 52px; }
.haken { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 84px; min-height: 44px; padding: 4px 8px; border: 1px solid var(--linie); border-radius: var(--r-sm); background: var(--flaeche); color: var(--text2); font-size: 12px; font-weight: 600; cursor: pointer; }
.haken small { font-weight: 400; font-size: 11px; }
.ic-haken { width: 16px; height: 16px; opacity: .25; }
.haken.an { background: var(--gut); border-color: var(--gut); color: #0b0d12; }
.haken.an .ic-haken { opacity: 1; }
h3 small.klein { font-weight: 400; color: var(--text2); }
.plan-leiste { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.plan-leiste .knopf { min-width: 48px; padding: 6px 12px; }
.plan-rahmen { position: relative; overflow: hidden; border: 1px solid var(--linie); border-radius: var(--rund); background: #fff; touch-action: none; height: 68vh; }
.plan-inhalt { position: absolute; left: 0; top: 0; width: 100%; transform-origin: 0 0; }
.plan-inhalt img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; pointer-events: none; }
.plan-geraet { position: absolute; transform: translate(-50%, -50%); border: 0; background: none; padding: 6px; cursor: pointer; display: flex; align-items: center; gap: 3px; }
.plan-geraet i { width: 14px; height: 14px; border-radius: 50%; background: var(--st); border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); display: block; flex: none; }
.plan-geraet span { display: none; font-size: 9px; line-height: 1.1; color: #111; background: rgba(255, 255, 255, .85); border-radius: 3px; padding: 1px 3px; white-space: nowrap; }
.plan-inhalt.nah .plan-geraet span { display: block; }
:root[data-look="cyber"] .haken, :root[data-look="cyber"] .plan-rahmen { border-radius: 0; }

/* ---- Formulare, Messen (ab 0.5) ---- */
.form-feld { display: block; margin: 0 0 4px; }
.form-feld > span { display: block; font-size: 13px; color: var(--text2); margin-top: 6px; }
.form-feld .eingabe { margin: 4px 0 6px; }
.dialog select.eingabe { appearance: auto; }
.mess-stand { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text2); white-space: nowrap; }
.mess-stand.gut { color: var(--gut); font-weight: 700; }
.messgeraet-zeile { border: 1px solid var(--linie); border-radius: var(--rund); margin-bottom: 10px; }

/* ---- Mängel, Abnahme, Wer arbeitet (ab 0.6) ---- */
.segment.vier { grid-template-columns: repeat(4, 1fr); margin-bottom: 10px; }
.segment.vier button.aktiv, .feld .segment.drei button.aktiv { background: var(--akzent); color: var(--akzent-text); }
.schwere { width: 12px; height: 12px; border-radius: 3px; flex: none; display: inline-block; background: var(--text2); }
.schwere.s-hoch { background: var(--gefahr); } .schwere.s-mittel { background: var(--warn); } .schwere.s-gering { background: var(--gut); }
.m-status { font-size: 12px; font-weight: 600; color: var(--text2); white-space: nowrap; }
.m-status.st-m-offen { color: var(--warn); } .m-status.st-m-geprueft { color: var(--gut); }
.marke.warn-marke { color: var(--warn); border-color: var(--warn); }
.tabelle-rahmen { overflow-x: auto; margin-bottom: 8px; }
.tabelle { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabelle th, .tabelle td { padding: 6px 6px; border-bottom: 1px solid var(--linie); text-align: left; }
.tabelle th { color: var(--text2); font-weight: 600; font-size: 12px; }
.tabelle td + td, .tabelle th + th { text-align: right; font-variant-numeric: tabular-nums; }
.teilnehmer { margin-bottom: 10px; }
.unterschrift { display: block; width: 100%; height: 140px; background: #fff; border: 1px dashed var(--linie); border-radius: var(--r-sm); touch-action: none; margin: 4px 0; }
.unterschriften { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.unterschrift-block { display: flex; flex-direction: column; border-top: 1px solid var(--text2); padding-top: 4px; }
.unterschrift-block img { width: 100%; max-height: 80px; object-fit: contain; background: #fff; }
.leer-unterschrift { height: 60px; color: var(--text2); font-size: 12px; display: flex; align-items: center; }
.protokoll-maengel { padding-left: 20px; } .protokoll-maengel li { margin-bottom: 4px; }
.wer-chip { display: block; width: 100%; margin: 0 0 10px; padding: 8px 12px; border: 1px solid var(--linie); border-radius: var(--rund); background: var(--flaeche); color: var(--text2); text-align: left; font-size: 14px; cursor: pointer; }
.wer-chip b { color: var(--text); }
:root[data-look="cyber"] .wer-chip, :root[data-look="cyber"] .unterschrift { border-radius: 0; }
@media print {
  .kopf, .leiste, .nicht-drucken, #meldung, #ebene { display: none !important; }
  body, .inhalt { background: #fff !important; color: #000 !important; padding: 0 !important; }
  .karte, .tabelle th, .tabelle td { color: #000 !important; background: #fff !important; }
}
