/* Montageprotokoll – mobil zuerst, Farben nach der Vorlage (Orange / Blaugrau) und dem Seith-Logo */
:root {
  --navy: #26336b;
  --navy-hell: #e8ebf5;
  --orange: #f79646;
  --orange-hell: #fff1e5;
  --orange-text: #9a4a0b;
  --blaugrau: #6c80a0;
  --text: #1d2230;
  --leise: #586072;
  --linie: #d5d9e2;
  --grund: #f2f4f8;
  --karte: #ffffff;
  --rot: #b3261e;
  --rot-hell: #fdeceb;
  --gruen: #1d7a3a;
  --gruen-hell: #e6f4ea;
  --radius: 10px;
  --schatten: 0 1px 2px rgba(20, 30, 60, .08), 0 2px 8px rgba(20, 30, 60, .05);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--grund); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
h1 { font-size: 1.45rem; margin: .4rem 0 .8rem; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
a { color: var(--navy); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Kopfleiste */
.kopfleiste {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem;
  padding: .5rem 1rem; padding-top: max(.5rem, env(safe-area-inset-top));
  background: #fff; border-bottom: 3px solid var(--orange); box-shadow: var(--schatten);
}
.marke { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--text); min-width: 0; }
.marke img { height: 34px; width: auto; }
.marke span { font-weight: 700; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 1px solid var(--linie); padding-left: .7rem; }
.kopf-rechts { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.netz { font-size: .78rem; padding: .2rem .6rem; border-radius: 99px; background: var(--gruen-hell); color: var(--gruen); white-space: nowrap; font-weight: 600; }
.netz.aus { background: #eceef2; color: var(--leise); }
.netz.wartet { background: var(--orange-hell); color: var(--orange-text); }
.netz.problem { background: var(--rot-hell); color: var(--rot); }
.nutzer {
  width: 2.25rem; height: 2.25rem; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--navy); color: #fff; text-decoration: none; font-weight: 700; font-size: .85rem;
}
@media (max-width: 480px) { .marke span { display: none; } }

main { max-width: 920px; margin: 0 auto; padding: 1rem 1rem 6rem; }
main:focus { outline: none; }
.laden, .leer { color: var(--leise); text-align: center; padding: 2rem 0; }
.leise { color: var(--leise); font-size: .9rem; }
.zurueck { display: inline-block; margin-bottom: .3rem; text-decoration: none; font-weight: 600; padding: .3rem 0; }

/* Karten & Abschnitte */
.karte { background: var(--karte); border-radius: var(--radius); box-shadow: var(--schatten); padding: 1rem; margin-bottom: 1rem; }
.abschnitt { background: var(--karte); border-radius: var(--radius); box-shadow: var(--schatten); margin-bottom: 1rem; overflow: hidden; }
.balken { background: var(--blaugrau); color: #fff; font-size: .95rem; font-weight: 700; padding: .55rem 1rem; margin: 0; }
.abschnitt { scroll-margin-top: 70px; }
.balken:has(.klapp) { padding: 0; }
.klapp {
  display: flex; align-items: center; gap: .6rem; width: 100%; min-height: 52px; padding: .55rem 1rem;
  background: none; border: 0; color: #fff; font: inherit; font-weight: 700; text-align: left; cursor: pointer;
}
.klapp:hover { background: rgba(255, 255, 255, .08); }
.klapp:focus-visible { outline: 3px solid var(--orange); outline-offset: -3px; }
.klapp-titel { flex: 1; min-width: 0; }
.klapp-status {
  font-size: .78rem; font-weight: 600; padding: .15rem .55rem; border-radius: 99px; background: rgba(255, 255, 255, .2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%;
}
.klapp-status:empty { display: none; }
.klapp-status.ok { background: #e6f4ea; color: var(--gruen); }
.klapp-status.warn { background: #fff1e5; color: var(--orange-text); }
.klapp-pfeil { width: .7rem; height: .7rem; border-right: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: rotate(45deg); margin: -.3rem .2rem 0; transition: transform .15s; flex: none; }
.klapp[aria-expanded="true"] .klapp-pfeil { transform: rotate(-135deg); margin-top: .3rem; }
.klapp-leiste { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; margin-bottom: .6rem; flex-wrap: wrap; }
.klapp-leiste .leise { margin-right: auto; }
.schritt-nav { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .8rem 1rem; border-top: 1px solid var(--linie); background: var(--grund); }
.schritt-nav .knopf { min-width: 7.5rem; }
.schritt-zahl { color: var(--leise); font-size: .85rem; text-align: center; }
.pflicht { color: var(--rot); font-weight: 700; }
.feldfehler { color: var(--rot); font-size: .85rem; font-weight: 600; }
.feld [aria-invalid="true"] { border-color: var(--rot) !important; background: var(--rot-hell); }
.unterbalken { background: var(--orange); color: #3a1d05; font-size: .9rem; font-weight: 600; padding: .4rem 1rem; margin: 0; }
.karte-innen { padding: 1rem; }
.raster2 { display: grid; grid-template-columns: 1fr; gap: .8rem 1rem; }
@media (min-width: 640px) { .raster2 { grid-template-columns: 1fr 1fr; } .raster2 .breit { grid-column: 1 / -1; } }

/* Formularfelder */
.feld { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; font-weight: 600; color: var(--leise); border: 0; padding: 0; margin: 0; min-width: 0; }
.feld legend { padding: 0; margin-bottom: .3rem; }
.feld input, .feld select, .feld textarea, .patchfeld input, .stepper input, .beschriftung {
  width: 100%; min-height: 46px; padding: .55rem .7rem; border: 1.5px solid var(--linie); border-radius: 8px;
  background: #fff; color: var(--text); font-weight: 500; font-size: 1rem;
}
.feld textarea { min-height: 70px; resize: vertical; }
.feld input:focus, .feld select:focus, .feld textarea:focus, .patchfeld input:focus, .stepper input:focus { border-color: var(--navy); outline: none; box-shadow: 0 0 0 3px var(--navy-hell); }
.janein { flex-direction: row; flex-wrap: wrap; align-items: center; }
.janein legend { width: 100%; }
.janein label { flex: 1; position: relative; }
.feld.janein input { position: absolute; inset: 0; width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.janein span {
  display: block; text-align: center; padding: .6rem; border: 1.5px solid var(--linie); border-radius: 8px;
  color: var(--text); font-weight: 600; cursor: pointer; background: #fff; min-height: 46px;
}
.janein label:first-of-type span { border-radius: 8px 0 0 8px; }
.janein label:last-of-type span { border-radius: 0 8px 8px 0; border-left: 0; }
.janein input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.janein input:focus-visible + span { outline: 3px solid var(--orange); outline-offset: 2px; }
.patchfeld { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; }
.patchfeld label { display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; }

.aufmass-zeile { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding: .6rem 0; border-bottom: 1px solid var(--linie); }
.aufmass-zeile:last-child { border-bottom: 0; }
.aufmass-text { flex: 1 1 220px; }
.pos { display: inline-block; font-weight: 700; color: var(--navy); min-width: 3.4rem; }
.stepper { display: flex; align-items: center; gap: .3rem; }
.stepper input { width: 4.5rem; text-align: center; }
.stepper button { width: 46px; height: 46px; border-radius: 8px; border: 1.5px solid var(--linie); background: #fff; font-size: 1.3rem; cursor: pointer; }
.einheit { color: var(--leise); font-size: .9rem; min-width: 2.2rem; }

/* Knöpfe */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 46px; padding: .55rem 1.1rem;
  border-radius: 8px; border: 1.5px solid transparent; font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.knopf.haupt { background: var(--navy); color: #fff; }
.knopf.haupt:hover { background: #1b2552; }
.knopf.zweit { background: #fff; color: var(--navy); border-color: #b9c1d6; }
.knopf.zweit:hover { background: var(--navy-hell); }
.knopf.gefahr { color: var(--rot); border-color: #e3b4b0; }
.knopf.haupt.gefahr-haupt { background: var(--rot); }
.knopf.haupt.gefahr-haupt:hover { background: #8f1d17; }
.warnung-gross { font-size: 1rem; line-height: 1.5; }
.papierkorb-karte { border-left-color: var(--rot); opacity: .92; }
.knopf.klein { min-height: 38px; padding: .3rem .75rem; font-size: .88rem; }
.knopf.breit { width: 100%; }
.knopf:disabled { opacity: .5; cursor: not-allowed; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.abstand { flex: 1; }
.aktionen { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Marken & Hinweise */
[class^="marke-"] { display: inline-block; font-size: .78rem; font-weight: 700; padding: .15rem .55rem; border-radius: 99px; }
.marke-gruen { background: var(--gruen-hell); color: var(--gruen); }
.marke-grau { background: #eceef2; color: var(--leise); }
.marke-orange { background: var(--orange-hell); color: var(--orange-text); }
.marke-rot { background: var(--rot-hell); color: var(--rot); border-radius: 6px !important; }
.banner { border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; border-left: 5px solid; }
.banner.orange { background: var(--orange-hell); border-color: var(--orange); }
.banner.blau { background: var(--navy-hell); border-color: var(--navy); }
.banner.rot { background: var(--rot-hell); border-color: var(--rot); }
.banner.grau { background: #eceef2; border-color: var(--leise); }
.banner .knopf { margin-left: .5rem; }
.hinweis-box { background: #eceef2; border-radius: 8px; padding: .5rem .8rem; font-size: .9rem; }
.fehlertext { color: var(--rot); font-weight: 600; margin: .3rem 0; }

/* Übersicht */
.liste-kopf { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.filter { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.filter .suche { grid-column: 1 / -1; }
@media (min-width: 760px) { .filter { grid-template-columns: 2fr 1fr 1fr 1fr; } .filter .suche { grid-column: auto; } }
.protokoll-liste, .lokal-liste, .benutzer-liste, .versionen { list-style: none; padding: 0; margin: 0; }
.protokoll-karte { display: block; text-decoration: none; color: inherit; margin-bottom: .7rem; border-left: 5px solid var(--blaugrau); }
.protokoll-karte:hover { box-shadow: 0 2px 12px rgba(20, 30, 60, .14); }
.zeile1 { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; margin-bottom: .25rem; }
.zeile2 { font-weight: 600; }
.lokal { border-left: 5px solid var(--orange); }
.lokal-liste li, .benutzer-liste li, .versionen li { display: flex; justify-content: space-between; gap: .8rem; flex-wrap: wrap; padding: .7rem 0; border-bottom: 1px solid var(--linie); }
.lokal-liste li:last-child, .versionen li:last-child { border-bottom: 0; }
.benutzer-liste li { padding: 1rem; border: 0; }
.benutzer-liste li.inaktiv { opacity: .65; }

/* Detail */
.detail-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.detail-kopf h1 { margin-bottom: .1rem; }
.ansicht-zeile { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px dashed var(--linie); }
.ansicht-zeile:last-child { border-bottom: 0; }
.ansicht-zeile span { color: var(--leise); }
.ansicht-zeile strong { text-align: right; white-space: pre-wrap; word-break: break-word; }
.tabelle { width: 100%; border-collapse: collapse; }
.tabelle th { background: var(--orange); color: #3a1d05; text-align: left; font-weight: 600; padding: .45rem .8rem; font-size: .9rem; }
.tabelle td { padding: .5rem .8rem; border-bottom: 1px solid var(--linie); }
.tabelle .zahl { text-align: right; font-weight: 700; white-space: nowrap; }
.nachweis-block { padding: 1rem; border-bottom: 1px solid var(--linie); }
.nachweis-block:last-child { border-bottom: 0; }
.nachweis-block .text { white-space: pre-wrap; margin: 0 0 .6rem; }
.foto-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .7rem; margin: .4rem 0 .6rem; }
.foto-raster figure { margin: 0; position: relative; display: flex; flex-direction: column; gap: .35rem; }
.foto-raster figcaption { font-size: .85rem; color: var(--leise); }
.foto { padding: 0; border: 0; background: #e5e8ee; border-radius: 8px; overflow: hidden; cursor: zoom-in; aspect-ratio: 4 / 3; display: block; width: 100%; }
.foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-markierung { position: absolute; top: .4rem; left: .4rem; background: var(--orange); color: #3a1d05; font-size: .72rem; font-weight: 700; padding: .1rem .45rem; border-radius: 99px; }
.beschriftung { min-height: 40px !important; font-size: .9rem !important; padding: .35rem .55rem !important; }
.foto-aktionen { display: flex; gap: .3rem; flex-wrap: wrap; }
.foto-aktionen .knopf { flex: 1; padding: .25rem .4rem; }
.foto-knoepfe { display: flex; gap: .5rem; flex-wrap: wrap; }
.foto-knoepfe .knopf { flex: 1 1 160px; }
/* Dateifeld nur optisch verstecken – nicht display:none (Safari/iPhone). */
.datei-knopf { position: relative; overflow: hidden; }
.datei-feld { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.foto-hinweis { margin: .2rem 0 .6rem; padding: .5rem .8rem; border-radius: 8px; background: var(--navy-hell); color: var(--navy); font-weight: 600; }
.unterschriften { display: grid; grid-template-columns: 1fr; gap: 0; }
@media (min-width: 640px) { .unterschriften { grid-template-columns: 1fr 1fr; } }
.unterschrift-box { padding: 1rem; border-bottom: 1px solid var(--linie); }
.unterschrift-box.ungueltig { background: var(--rot-hell); }
.unterschrift-bild { max-width: 100%; max-height: 110px; display: block; background: #fff; border: 1px solid var(--linie); border-radius: 6px; padding: .3rem; margin-bottom: .3rem; }
.versionen li.aktiv { background: var(--navy-hell); margin: 0 -1rem; padding: .7rem 1rem; }
.versionen { padding: 0 1rem .5rem; }
.diff:empty { display: none; }
.aenderungen { list-style: none; padding: 0; margin: .5rem 0; display: grid; gap: .4rem; }
.aenderungen li { display: grid; grid-template-columns: 1fr auto 1fr; gap: .2rem .5rem; align-items: center; background: var(--grund); border-radius: 6px; padding: .45rem .6rem; font-size: .9rem; }
.aenderungen li strong { grid-column: 1 / -1; }
.aenderungen .alt { color: var(--rot); text-decoration: line-through; word-break: break-word; }
.aenderungen .neu { color: var(--gruen); font-weight: 700; word-break: break-word; }

/* Fußleiste im Formular */
.fussleiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; justify-content: flex-end; gap: .7rem;
  padding: .7rem 1rem; padding-bottom: max(.7rem, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .96); border-top: 1px solid var(--linie); box-shadow: 0 -2px 10px rgba(20, 30, 60, .08);
}
.fussleiste .knopf { flex: 1; max-width: 240px; }

/* Dialoge */
.dialog { border: 0; border-radius: 14px; padding: 1.2rem; width: min(560px, calc(100vw - 1.5rem)); max-height: calc(100vh - 2rem); box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.dialog::backdrop { background: rgba(15, 20, 40, .55); }
.dialog h2 { font-size: 1.15rem; }
.export-wahl { display: grid; gap: .7rem; margin: 1rem 0 0; }
.export-option { text-align: left; padding: 1rem; border: 2px solid var(--linie); border-radius: 10px; background: #fff; cursor: pointer; display: flex; flex-direction: column; gap: .25rem; }
.export-option:hover, .export-option:focus-visible { border-color: var(--navy); background: var(--navy-hell); }
.export-option strong { color: var(--navy); font-size: 1.05rem; }
.export-option span { color: var(--leise); font-size: .9rem; }
.dialog-unterschrift { width: min(760px, calc(100vw - 1rem)); }
.unterschrift-flaeche { position: relative; border: 2px dashed #b9c1d6; border-radius: 10px; background: #fff; height: 220px; margin-bottom: .8rem; }
.unterschrift-flaeche canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.unterschrift-flaeche .linie { position: absolute; left: 8%; right: 8%; bottom: 28%; border-bottom: 1px solid #c9cfdd; pointer-events: none; }
.hinweis { color: var(--leise); margin-top: 0; }

/* Zeichner */
.zeichner { border: 0; padding: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; background: #111; color: #fff; display: flex; flex-direction: column; }
.zeichner:not([open]) { display: none; }
.zeichner-leiste { display: flex; flex-wrap: wrap; gap: .4rem .8rem; padding: .5rem; padding-top: max(.5rem, env(safe-area-inset-top)); background: #1d1f26; justify-content: center; }
.zeichner-leiste .gruppe { display: flex; gap: .3rem; }
.zeichner-leiste button { width: 44px; height: 44px; border-radius: 8px; border: 2px solid transparent; background: #2c2f3a; color: #fff; font-size: 1.2rem; cursor: pointer; }
.zeichner-leiste button.an { border-color: var(--orange); background: #3b3f4d; }
.zeichner-leiste .farbe { background: var(--c); border-color: #555; }
.zeichner-leiste .farbe.an { background: var(--c); border-color: #fff; box-shadow: 0 0 0 2px var(--orange); }
.staerke span { display: block; margin: auto; background: #fff; border-radius: 99px; width: 22px; }
.s-duenn { height: 2px; } .s-mittel { height: 5px; } .s-dick { height: 9px; }
.zeichner-flaeche { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: .5rem; }
.zeichner-flaeche canvas { max-width: 100%; max-height: 100%; touch-action: none; cursor: crosshair; }
.zeichner-fuss { display: flex; justify-content: flex-end; gap: .7rem; padding: .6rem; padding-bottom: max(.6rem, env(safe-area-inset-bottom)); background: #1d1f26; }
.zeichner-fuss .knopf { flex: 1; max-width: 220px; }

/* Foto-Großansicht */
.lightbox { border: 0; padding: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; background: #0c0d10; color: #fff; }
.lightbox[open] { display: flex; flex-direction: column; }
.lb-leiste { display: flex; align-items: center; gap: .4rem; padding: .5rem; padding-top: max(.5rem, env(safe-area-inset-top)); background: #1d1f26; flex-wrap: wrap; }
.lb-titel { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 50vw; }
.lb-leiste button { min-width: 44px; height: 42px; border-radius: 8px; border: 0; background: #2c2f3a; color: #fff; font-weight: 600; padding: 0 .8rem; cursor: pointer; }
.lb-flaeche { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; touch-action: pinch-zoom pan-x pan-y; }
.lb-flaeche img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-flaeche.gezoomt { display: block; }
.lb-flaeche.gezoomt img { max-width: none; max-height: none; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; border: 0; border-radius: 8px; background: rgba(40, 42, 52, .75); color: #fff; font-size: 2rem; cursor: pointer; }
.lb-nav.vor { left: .5rem; } .lb-nav.nach { right: .5rem; }

/* Anmeldung, Meldungen */
.anmeldung { max-width: 420px; margin: 2rem auto; display: grid; gap: .9rem; }
#toast {
  position: fixed; left: 50%; bottom: 5.5rem; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 100;
  background: #1d2230; color: #fff; padding: .7rem 1.1rem; border-radius: 10px; max-width: calc(100vw - 2rem); transition: .2s; font-weight: 600;
}
#toast.sichtbar { opacity: 1; transform: translate(-50%, 0); }
#toast.ok { background: var(--gruen); }
#toast.fehler { background: var(--rot); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
