/* Leitungsortung – für draussen: hoher Kontrast, grosse Flächen zum Antippen, hell (Sonne) und dunkel (Nacht). */
:root {
  --gelb: #f2b705;
  --gelb-dunkel: #c99400;
  --gelb-hell: #fff5cc;
  --tinte: #1d2329;
  --grund: #f4f2ee;
  --flaeche: #ffffff;
  --flaeche-2: #ebe8e2;
  --text: #1d2329;
  --text-2: #4b545c;
  --linie: #d7d2c8;
  --blau: #1f5fa8;
  --gruen: #1f7a3f;
  --rot: #b3261e;
  --orange: #b85c00;
  --schatten: 0 1px 2px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.06);
  --radius: 14px;
  --kopf: 56px;
  --leiste: 64px;
  --schrift: 17px;
  --unten: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
[data-thema="dunkel"] {
  --grund: #121619;
  --flaeche: #1c2227;
  --flaeche-2: #262d33;
  --text: #ecebe8;
  --text-2: #a9b0b6;
  --linie: #353d44;
  --gelb-hell: #3a3010;
  --blau: #7fb0ee;
  --gruen: #6cc48b;
  --rot: #ff8a80;
  --orange: #ffb15c;
  --schatten: none;
  color-scheme: dark;
}
[data-schrift="gross"] { --schrift: 19.5px; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--grund); color: var(--text);
  font: var(--schrift)/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-top: calc(var(--kopf) + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--leiste) + var(--unten) + 16px);
  -webkit-tap-highlight-color: transparent;
}
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: var(--blau); }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 1.55em; line-height: 1.2; margin: .2em 0 .3em; }
h2 { font-size: 1.22em; line-height: 1.25; margin: 1.6em 0 .5em; scroll-margin-top: calc(var(--kopf) + 12px); }
h3 { font-size: 1.05em; margin: 1.3em 0 .4em; }
p { margin: .6em 0; }
.klein { font-size: .85em; color: var(--text-2); }
.leer { color: var(--text-2); text-align: center; padding: 28px 12px; }
[hidden] { display: none !important; }

/* ---------- Kopf und Leiste */
.kopf {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  height: calc(var(--kopf) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 8px 0;
  display: flex; align-items: center; gap: 6px; background: var(--tinte); color: #fff;
}
.kopf button { background: none; border: 0; color: #fff; padding: 10px; border-radius: 10px; display: flex; align-items: center; cursor: pointer; }
.kopf button:active { background: rgba(255,255,255,.12); }
.kopf-marke { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; min-width: 0; flex: 1; padding-left: 4px; }
.kopf-marke img { border-radius: 7px; }
.kopf-marke span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kopf-status { gap: 6px; font-size: 13px; }
.kopf-status .punkt { width: 10px; height: 10px; border-radius: 50%; background: #6cc48b; }
.kopf-status.offline .punkt { background: #9aa3aa; }
.kopf-status.offen .punkt { background: var(--gelb); }
.kopf-status.fehler .punkt { background: #ff6b5e; }
.status-text:empty { display: none; }

.leiste {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex;
  background: var(--flaeche); border-top: 1px solid var(--linie);
  padding-bottom: var(--unten); height: calc(var(--leiste) + var(--unten));
}
.leiste a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11.5px; color: var(--text-2); text-decoration: none; font-weight: 600; }
.leiste a.aktiv { color: var(--text); }
.leiste a.aktiv svg { color: var(--tinte); background: var(--gelb); border-radius: 12px; padding: 3px 14px; width: 52px; height: 30px; }
[data-thema="dunkel"] .leiste a.aktiv svg { color: #111; }
.leiste svg { width: 26px; height: 26px; padding: 3px; }

main { max-width: 820px; margin: 0 auto; padding: 14px 14px 0; outline: none; }
.laden { padding: 40px; text-align: center; color: var(--text-2); }

/* ---------- Bausteine */
.karte { background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten); border: 1px solid var(--linie); padding: 14px 16px; margin: 0 0 12px; }
.knopf { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid var(--linie); background: var(--flaeche); color: var(--text); font-weight: 650; cursor: pointer; text-decoration: none; }
.knopf:active { transform: translateY(1px); }
.knopf.primaer { background: var(--gelb); border-color: var(--gelb-dunkel); color: #1d2329; }
.knopf.gefahr { color: var(--rot); }
.knopf.gross { width: 100%; min-height: 54px; font-size: 1.05em; }
.knopf.klein { min-height: 38px; padding: 6px 12px; font-size: .9em; }
.knopf svg { width: 20px; height: 20px; }
.knoepfe { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.knoepfe .knopf { flex: 1 1 auto; }

.suchfeld { position: relative; margin: 2px 0 16px; }
.suchfeld input { width: 100%; height: 56px; border-radius: 16px; border: 2px solid var(--linie); background: var(--flaeche);
  padding: 0 16px 0 50px; font-size: 1.05em; box-shadow: var(--schatten); }
.suchfeld input:focus { border-color: var(--gelb); outline: none; }
.suchfeld svg { position: absolute; left: 16px; top: 16px; color: var(--text-2); }
.suchfeld .loeschen { position: absolute; right: 8px; top: 8px; border: 0; background: none; padding: 10px; color: var(--text-2); }

.kacheln { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
@media (min-width: 640px) { .kacheln { grid-template-columns: repeat(4, 1fr); } }
.kachel { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten);
  padding: 14px; min-height: 96px; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 6px; }
.kachel b { font-size: .98em; line-height: 1.25; }
.kachel span { font-size: .8em; color: var(--text-2); line-height: 1.3; }
.kachel .ikon { width: 38px; height: 38px; border-radius: 10px; background: var(--gelb-hell); color: var(--gelb-dunkel); display: grid; place-items: center; }
[data-thema="dunkel"] .kachel .ikon { color: var(--gelb); }
.kachel.hervor { background: var(--tinte); color: #fff; border-color: var(--tinte); }
.kachel.hervor span { color: #c9cfd4; }
.kachel.hervor .ikon { background: var(--gelb); color: var(--tinte); }
[data-thema="dunkel"] .kachel.hervor { background: #2b3238; }

.abschnitt-titel { font-size: .8em; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); font-weight: 700; margin: 22px 4px 8px; }
.liste { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten); overflow: hidden; margin-bottom: 14px; }
.zeile { display: flex; gap: 12px; align-items: center; padding: 13px 14px; text-decoration: none; color: var(--text); border-top: 1px solid var(--linie); min-height: 60px; }
.zeile:first-child { border-top: 0; }
.zeile:active { background: var(--flaeche-2); }
.zeile .z-text { flex: 1; min-width: 0; }
.zeile .z-titel { font-weight: 650; line-height: 1.3; display: block; }
.zeile .z-unter { font-size: .84em; color: var(--text-2); line-height: 1.35; display: block; margin-top: 2px; }
.zeile .z-bild { width: 54px; height: 54px; border-radius: 10px; object-fit: contain; background: #fff; border: 1px solid var(--linie); flex: none; }
.zeile .pfeil { color: var(--text-2); width: 18px; height: 18px; }
.zeile mark, .treffer mark { background: var(--gelb-hell); color: inherit; border-radius: 3px; padding: 0 1px; }
.marke { display: inline-block; font-size: .72em; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--flaeche-2); color: var(--text-2); margin-right: 4px; vertical-align: 1px; }
.marke.gelb { background: var(--gelb-hell); color: var(--gelb-dunkel); }
[data-thema="dunkel"] .marke.gelb { color: var(--gelb); }
.marke.gruen { background: rgba(31,122,63,.12); color: var(--gruen); }
.marke.rot { background: rgba(179,38,30,.1); color: var(--rot); }

/* ---------- Artikel */
.artikel-kopf { margin-bottom: 8px; }
.artikel-kopf .kat { font-size: .8em; font-weight: 700; color: var(--gelb-dunkel); text-transform: uppercase; letter-spacing: .05em; text-decoration: none; }
[data-thema="dunkel"] .artikel-kopf .kat { color: var(--gelb); }
.artikel-kopf .kurz { color: var(--text-2); margin: 0 0 8px; }
.artikel-werkzeuge { display: flex; gap: 8px; margin: 10px 0 6px; flex-wrap: wrap; }
.inhalt-verz { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); margin: 10px 0 4px; }
.inhalt-verz summary { padding: 12px 14px; font-weight: 650; cursor: pointer; }
.inhalt-verz ol { margin: 0; padding: 0 14px 12px 36px; }
.inhalt-verz li { padding: 4px 0; }
.text { overflow-wrap: break-word; }
.text ul, .text ol { padding-left: 1.3em; }
.text li { margin: .3em 0; }
.text li::marker { color: var(--gelb-dunkel); font-weight: 700; }
.text ol > li { padding-left: .2em; }
.text strong { font-weight: 700; }
.text code { background: var(--flaeche-2); padding: 1px 5px; border-radius: 5px; font-size: .92em; }
.text hr { border: 0; border-top: 1px solid var(--linie); margin: 22px 0; }
.text .bild { margin: 14px 0; background: #fff; border-radius: 12px; border: 1px solid var(--linie); padding: 8px; text-align: center; cursor: zoom-in; }
.text .bild img { max-width: 100%; max-height: 360px; height: auto; display: inline-block; }
.text .bild figcaption { font-size: .82em; color: #555; margin-top: 6px; text-align: left; }
.text .tabelle { overflow-x: auto; margin: 12px 0; border: 1px solid var(--linie); border-radius: 12px; background: var(--flaeche); }
.text table { border-collapse: collapse; width: 100%; font-size: .9em; }
.text th, .text td { padding: 8px 10px; text-align: left; vertical-align: top; border-top: 1px solid var(--linie); }
.text th { background: var(--flaeche-2); border-top: 0; white-space: nowrap; }
.box { margin: 14px 0; padding: 10px 14px 10px 14px; border-radius: 12px; border-left: 5px solid; background: var(--flaeche); }
.box p { margin: .35em 0; }
.box-kopf { font-weight: 800; font-size: .78em; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.box-tipp { border-color: var(--gruen); background: rgba(31,122,63,.07); }
.box-tipp .box-kopf { color: var(--gruen); }
.box-warnung, .box-achtung { border-color: var(--rot); background: rgba(179,38,30,.07); }
.box-warnung .box-kopf, .box-achtung .box-kopf { color: var(--rot); }
.box-praxis { border-color: var(--gelb); background: var(--gelb-hell); }
.box-praxis .box-kopf { color: var(--gelb-dunkel); }
[data-thema="dunkel"] .box-praxis .box-kopf { color: var(--gelb); }
.box-info, .box-handbuch { border-color: var(--blau); background: rgba(31,95,168,.07); }
.box-info .box-kopf, .box-handbuch .box-kopf { color: var(--blau); }
.text a.intern { font-weight: 600; text-decoration-thickness: 2px; text-underline-offset: 2px; }

.erfahrungen { margin-top: 26px; border-top: 3px solid var(--gelb); padding-top: 6px; }
.notiz-karte { background: var(--flaeche); border: 1px solid var(--linie); border-left: 5px solid var(--gelb); border-radius: 12px; padding: 10px 14px; margin: 10px 0; }
.notiz-karte .nk-kopf { display: flex; justify-content: space-between; gap: 8px; font-size: .82em; color: var(--text-2); }
.notiz-karte .nk-text { white-space: pre-wrap; margin: 6px 0; }
.fotos { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.fotos img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--linie); cursor: zoom-in; background: var(--flaeche-2); }
.foto-feld { position: relative; }
.foto-feld button { position: absolute; top: -6px; right: -6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--rot); color: #fff; font-weight: 800; }

/* ---------- Formulare */
.formular label, .feld { display: block; margin: 0 0 14px; font-weight: 650; font-size: .92em; }
.formular input:not([type=checkbox]):not([type=radio]):not([type=file]), .formular select, .formular textarea, .auth-form input {
  display: block; width: 100%; margin-top: 6px; min-height: 50px; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--linie);
  background: var(--flaeche); font-weight: 400; font-size: 1.04em; }
.formular textarea { min-height: 150px; resize: vertical; line-height: 1.5; }
.formular input:focus, .formular select:focus, .formular textarea:focus, .auth-form input:focus { border-color: var(--gelb); outline: none; }
.zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; font-weight: 400; }
.chip { border: 1.5px solid var(--linie); background: var(--flaeche); border-radius: 999px; padding: 9px 14px; min-height: 44px; cursor: pointer; font-size: .95em; line-height: 1.2; text-align: left; }
.chip.an { background: var(--gelb); border-color: var(--gelb-dunkel); color: #1d2329; font-weight: 650; }
.chip small { display: block; font-size: .78em; color: var(--text-2); font-weight: 400; }
.chip.an small { color: #4a4a3a; }

/* ---------- Assistent */
.frage { margin: 0 0 18px; }
.frage h3 { margin: 0 0 4px; font-size: 1.02em; }
.frage .hilfe { font-size: .84em; color: var(--text-2); margin: 0 0 6px; }
.ergebnis { border: 2px solid var(--gelb); border-radius: var(--radius); background: var(--flaeche); padding: 4px 16px 10px; margin-top: 18px; }
.ergebnis h2 { margin-top: 14px; }
.erg-teil { padding: 10px 0; border-top: 1px solid var(--linie); }
.erg-teil:first-of-type { border-top: 0; }
.erg-teil h4 { margin: 0 0 4px; font-size: .78em; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.erg-teil ul { margin: 4px 0; padding-left: 1.2em; }
.erg-teil li { margin: 4px 0; }
.erg-haupt { font-size: 1.12em; font-weight: 700; }
.erg-teil.warn h4 { color: var(--rot); }

/* ---------- Checkliste */
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-top: 1px solid var(--linie); cursor: pointer; }
.check:first-child { border-top: 0; }
.check input { width: 26px; height: 26px; margin: 0; accent-color: var(--gelb-dunkel); flex: none; }
.check.erledigt span { color: var(--text-2); text-decoration: line-through; }

/* ---------- Reiter */
.reiter { display: flex; background: var(--flaeche-2); border-radius: 12px; padding: 4px; margin: 0 0 14px; }
.reiter button { flex: 1; border: 0; background: none; padding: 10px; border-radius: 9px; font-weight: 650; color: var(--text-2); min-height: 44px; }
.reiter button.an { background: var(--flaeche); color: var(--text); box-shadow: var(--schatten); }

.statistik { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.statistik div { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px; padding: 10px; text-align: center; }
.statistik b { display: block; font-size: 1.3em; }
.statistik span { font-size: .75em; color: var(--text-2); }

.fab { position: fixed; right: 18px; bottom: calc(var(--leiste) + var(--unten) + 16px); z-index: 15; width: 60px; height: 60px; border-radius: 18px;
  background: var(--gelb); border: 1px solid var(--gelb-dunkel); box-shadow: 0 4px 14px rgba(0,0,0,.25); display: grid; place-items: center; color: #1d2329; }
.fab svg { width: 30px; height: 30px; }

/* ---------- Lightbox, Toast */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 82vh; background: #fff; border-radius: 8px; touch-action: pinch-zoom; }
.lightbox .lb-text { color: #ddd; font-size: .9em; margin-top: 10px; max-width: 700px; text-align: center; }
.lightbox button { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); right: 12px; width: 50px; height: 50px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 30px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--leiste) + var(--unten) + 18px); z-index: 60; background: var(--tinte); color: #fff;
  padding: 12px 18px; border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.3); max-width: 90vw; font-size: .95em; }
[data-thema="dunkel"] .toast { background: #3a434b; }

/* ---------- Anmeldung */
.auth-seite { padding: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--tinte); }
.auth { width: 100%; max-width: 440px; padding: 20px; }
.auth-karte { background: var(--flaeche); border-radius: 18px; padding: 24px 22px; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.auth-logo { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.auth-logo img { border-radius: 12px; }
.auth-logo b { display: block; font-size: 1.15em; }
.auth-logo span { color: var(--text-2); font-size: .85em; }
.auth-form label { display: block; margin: 12px 0; font-weight: 650; }
.auth-form button { margin-top: 10px; }
.hinweis { padding: 10px 14px; border-radius: 10px; margin: 10px 0; }
.hinweis.warnung { background: rgba(179,38,30,.1); color: var(--rot); font-weight: 600; }
.auth-karte .knopf.gross { margin-top: 8px; }

@media print {
  .kopf, .leiste, .fab, .artikel-werkzeuge, .erfahrungen .knopf { display: none !important; }
  body { padding: 0; background: #fff; }
}
