/* OLWF Einsatz – Gestaltung wie OLWF Ausbildung (THW-Blau, Weiß), für den Einsatz auf dem Handy optimiert */
:root {
  --blau: #003399;
  --blau-dunkel: #00226b;
  --blau-hell: #e6ecf8;
  --blau-mittel: #c9d5ef;
  --grund: #f2f4f8;
  --karte: #ffffff;
  --text: #14213d;
  --text-2: #5a6478;
  --linie: #dde2ec;
  --gruen: #2e7d32;
  --gruen-hell: #e8f3e9;
  --gruen-voll: #8fce57;
  --gelb: #f5b800;
  --gelb-hell: #fff6d6;
  --gelb-voll: #ffe733;
  --rot: #c62828;
  --rot-hell: #fdeaea;
  --rot-voll: #e53935;
  --grau-zelle: #8a8f99;
  --radius: 12px;
  --schatten: 0 1px 2px rgba(20, 33, 61, .06), 0 2px 8px rgba(20, 33, 61, .06);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--grund); color: var(--text);
  font: 16px/1.45 "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
  min-height: 100vh; min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blau); }
[hidden] { display: none !important; }

/* Kopfbereich */
.kopf {
  position: sticky; top: 0; z-index: 20;
  background: var(--blau); color: #fff;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}
.kopf-logo { flex: none; display: block; line-height: 0; }
.kopf img { width: 40px; height: 40px; }
.kopf-text { min-width: 0; }
.kopf .titel { font-weight: 700; font-size: 18px; letter-spacing: .2px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kopf .unter { font-size: 12.5px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kopf .rechts { margin-left: auto; display: flex; gap: 6px; flex: none; }
.kopf button.icon, .kopf a.icon { background: rgba(255,255,255,.14); border: 0; color: #fff; border-radius: 10px; padding: 7px 10px; cursor: pointer; text-decoration: none; font-size: 15px; }
.druckkopf { display: none; }

main { max-width: 820px; margin: 0 auto; padding: 14px 16px calc(96px + env(safe-area-inset-bottom)); }

/* Navigation unten (im Einsatz) */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: #fff; border-top: 1px solid var(--linie);
  display: flex; justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav a {
  flex: 1; max-width: 150px; text-align: center; text-decoration: none; color: var(--text-2);
  font-size: 11.5px; padding: 8px 2px 7px; position: relative;
}
.nav a .sym { display: block; font-size: 21px; line-height: 1.1; filter: grayscale(1); opacity: .7; }
.nav a.aktiv { color: var(--blau); font-weight: 600; }
.nav a.aktiv .sym { filter: none; opacity: 1; }
.badge {
  display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--rot); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.nav .badge { position: absolute; top: 3px; left: 50%; margin-left: 6px; }

/* Karten & Listen */
.karte { background: var(--karte); border-radius: var(--radius); box-shadow: var(--schatten); padding: 14px 16px; margin-bottom: 12px; }
.karte h2, .karte h3 { margin: 0 0 8px; }
h1 { font-size: 21px; margin: 4px 0 12px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
.ueber { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--blau); margin: 20px 4px 8px; }
.leer { color: var(--text-2); text-align: center; padding: 24px 8px; }
.klein { font-size: 13px; color: var(--text-2); }
.fehler { background: var(--rot-hell); color: var(--rot); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.ok { background: var(--gruen-hell); color: var(--gruen); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.hinweis { background: var(--gelb-hell); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--blau-hell); color: var(--blau); white-space: nowrap; }
.chip.gruen { background: var(--gruen-hell); color: var(--gruen); }
.chip.gelb { background: var(--gelb-hell); color: #7a5b00; }
.chip.rot { background: var(--rot-hell); color: var(--rot); }
.chip.grau { background: #eef0f4; color: var(--text-2); }

/* Einsätze */
.einsatz {
  display: block; background: var(--karte); border-radius: var(--radius); box-shadow: var(--schatten);
  padding: 12px 14px; margin-bottom: 10px; color: inherit; text-decoration: none; border-left: 5px solid var(--blau);
}
.einsatz.beendet { border-left-color: #a6adbb; opacity: .85; }
.einsatz .zeile1 { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--text-2); }
.einsatz .stw { font-weight: 700; font-size: 17px; margin-top: 2px; overflow-wrap: anywhere; }
.einsatz .ort { color: var(--text-2); overflow-wrap: anywhere; }
.einsatz .aktion { display: flex; gap: 8px; margin-top: 10px; align-items: center; flex-wrap: wrap; }

/* Formular-Kacheln */
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.kachel {
  display: flex; gap: 12px; align-items: flex-start; background: var(--karte); border-radius: var(--radius); box-shadow: var(--schatten);
  padding: 14px; text-decoration: none; color: inherit; border: 2px solid transparent; text-align: left; cursor: pointer; width: 100%;
}
.kachel:hover { border-color: var(--blau-mittel); }
.kachel .sym { font-size: 26px; line-height: 1; flex: none; width: 34px; text-align: center; color: var(--blau); }
.kachel .t { font-weight: 700; }
.kachel .b { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.kachel .n { margin-top: 6px; }
.kachel.folgt { opacity: .55; cursor: default; }
.kachel.folgt:hover { border-color: transparent; }

/* Meldungen */
.meldung {
  display: block; background: var(--karte); border-radius: var(--radius); box-shadow: var(--schatten);
  padding: 11px 14px; margin-bottom: 8px; color: inherit; text-decoration: none; border-left: 5px solid var(--blau-mittel);
}
.meldung.a-gruen { border-left-color: var(--gruen-voll); }
.meldung.a-gelb { border-left-color: var(--gelb); }
.meldung.a-rot { border-left-color: var(--rot-voll); }
.meldung.neu { outline: 2px solid var(--blau); }
.meldung.zurueck { opacity: .55; }
.meldung.zurueck .mt { text-decoration: line-through; }
.meldung .zeile1 { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-2); }
.meldung .mt { font-weight: 700; margin-top: 2px; }
.meldung .von { font-size: 13.5px; color: var(--text-2); overflow-wrap: anywhere; }
.meldung .zf { font-size: 14px; margin-top: 3px; overflow-wrap: anywhere; }

.filter { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.filter::-webkit-scrollbar { display: none; }
.filter button {
  flex: none; border: 1px solid var(--blau-mittel); background: #fff; color: var(--blau);
  border-radius: 999px; padding: 6px 12px; font-size: 14px; cursor: pointer;
}
.filter button.an { background: var(--blau); color: #fff; border-color: var(--blau); }

/* Formulare – Grundelemente */
label, .lbl { display: block; font-size: 13.5px; font-weight: 600; margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%; border: 1px solid #c4cbd8; border-radius: 10px; padding: 10px 12px; background: #fff; font-size: 16px; min-height: 44px;
}
textarea { min-height: 84px; resize: vertical; }
textarea.klein { min-height: 52px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blau); outline-offset: 0; border-color: var(--blau); }
.reihe { display: flex; gap: 10px; flex-wrap: wrap; }
.reihe > * { flex: 1 1 160px; min-width: 0; }
.einheit-feld { display: flex; align-items: center; gap: 6px; }
.einheit-feld span { color: var(--text-2); font-size: 14px; flex: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 600; cursor: pointer;
  background: var(--blau); color: #fff; text-decoration: none; min-height: 44px;
}
.btn:active { transform: translateY(1px); }
.btn.zweit { background: var(--blau-hell); color: var(--blau); }
.btn.rot { background: var(--rot); }
.btn.gruen { background: var(--gruen); }
.btn.klein { padding: 6px 10px; min-height: 34px; font-size: 14px; }
.btn.voll { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }
.knoepfe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.textknopf { background: none; border: 0; color: var(--blau); font-weight: 600; cursor: pointer; text-decoration: underline; padding: 4px; }

/* Formular-Abschnitte */
.abschnitt { font-size: 15px; font-weight: 700; color: var(--blau); margin: 22px 0 2px; padding-top: 12px; border-top: 2px solid var(--blau-hell); }
.abschnitt:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.abschnitt-hinweis { font-size: 13px; color: var(--text-2); margin: 2px 0 6px; }

/* Auswahlknöpfe */
.optionen { display: flex; flex-wrap: wrap; gap: 6px; }
.opt {
  border: 1px solid #c4cbd8; background: #fff; border-radius: 999px; padding: 7px 13px; font-size: 14.5px; cursor: pointer; min-height: 38px;
}
.opt.an { background: var(--blau); color: #fff; border-color: var(--blau); }
.opt.mehr::before { content: '☐ '; }
.opt.mehr.an::before { content: '☑ '; }

/* Gefahr (gering / mittel / hoch) */
.gefahr { border-top: 1px solid var(--linie); padding: 10px 0; }
.gefahr .kopfz { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.gefahr .name { flex: 1 1 180px; min-width: 0; }
.gefahr .name b { display: block; }
.gefahr .name small { color: var(--text-2); font-size: 12.5px; }
.stufen { display: flex; gap: 4px; flex: none; }
.stufe { border: 1px solid #c4cbd8; background: #fff; border-radius: 8px; padding: 7px 10px; font-size: 14px; cursor: pointer; min-width: 64px; min-height: 38px; }
.stufe.s-gering.an { background: var(--gruen-voll); border-color: #6aa83a; font-weight: 700; }
.stufe.s-mittel.an { background: var(--gelb-voll); border-color: #d4b800; font-weight: 700; }
.stufe.s-hoch.an { background: var(--rot-voll); border-color: #b71c1c; color: #fff; font-weight: 700; }
.gefahr .bem { margin-top: 6px; }
.gefahr.gesetzt-hoch { background: linear-gradient(90deg, var(--rot-hell), transparent 60%); }

/* Legende */
.legende { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 13px; margin-top: 8px; }
.legende .f { font-weight: 700; padding: 2px 8px; border-radius: 6px; text-align: center; }
.f.gering, .z-gering { background: var(--gruen-voll); }
.f.mittel, .z-mittel { background: var(--gelb-voll); }
.f.hoch, .z-hoch { background: var(--rot-voll); color: #fff; }

/* Tabellen (Matrix, Wetter, Risiko) */
.tabwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 6px -4px; padding: 0 4px; }
table.raster { border-collapse: collapse; font-size: 13.5px; }
table.raster th, table.raster td { border: 1px solid #b9c1cf; padding: 4px; text-align: center; }
table.raster th.zl { text-align: left; background: #eef1f6; font-weight: 600; white-space: nowrap; position: sticky; left: 0; z-index: 1; padding: 4px 8px; }
table.raster th.gruppe { text-align: left; background: #fff; font-weight: 700; padding: 6px 8px; }
table.raster th.vert { height: 130px; vertical-align: bottom; background: #eef1f6; padding: 6px 2px; }
table.raster th.vert span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; font-weight: 600; }
table.raster td.zelle { width: 38px; height: 38px; padding: 0; }
table.raster td.zelle label { display: flex; align-items: center; justify-content: center; width: 100%; height: 38px; margin: 0; cursor: pointer; }
table.raster td.zelle input { width: 20px; height: 20px; accent-color: var(--blau); margin: 0; }
table.raster td.gesperrt { background: var(--grau-zelle); }
table.raster td.x { font-weight: 700; color: var(--blau); }
table.wetter td, table.wetter th { padding: 6px 8px; }
table.wetter td input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--blau); }

/* Messwert-Paare */
.paar { display: grid; grid-template-columns: minmax(110px, 1fr) 1fr 1fr; gap: 8px; align-items: center; margin: 6px 0; }
.paar .pl { font-size: 14px; font-weight: 600; }
.paar-kopf { font-size: 12px; color: var(--text-2); text-transform: uppercase; letter-spacing: .4px; }

/* Fläche / Stärke */
.flaeche, .staerke { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.flaeche input { width: 90px; flex: 0 0 90px; }
.staerke input { width: 70px; flex: 0 0 70px; text-align: center; }
.erg { font-weight: 700; color: var(--blau); }
.staerke .sl { font-size: 12px; color: var(--text-2); display: block; text-align: center; }
.staerke .sf { display: flex; flex-direction: column; }

/* Risiken */
.risiko { border: 1px solid var(--linie); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.risiko .kopfz { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.risiko-erg { margin-top: 8px; padding: 8px 10px; border-radius: 8px; font-weight: 700; }
.risiko-erg.leer { background: #eef0f4; color: var(--text-2); font-weight: 500; padding: 8px 10px; text-align: left; }
.risiko-erg small { display: block; font-weight: 500; }
table.rm td, table.rm th { font-size: 11.5px; padding: 4px; min-width: 64px; }
table.rm td.sel { outline: 3px solid var(--blau); outline-offset: -3px; }

/* Senden-Leiste */
.sendeleiste {
  position: sticky; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 10;
  background: #fff; border-radius: var(--radius); box-shadow: 0 -2px 12px rgba(20,33,61,.12); padding: 8px 10px 6px; margin-top: 16px;
}
.sende-zeile { display: flex; align-items: center; gap: 8px; }
.sende-zeile .an-lbl { margin: 0; flex: none; font-size: 13px; color: var(--text-2); }
.sende-zeile select { flex: 1; min-width: 0; padding: 8px 10px; font-size: 15px; }
.sende-zeile .btn { flex: none; }
.entwurf-info { font-size: 11.5px; color: var(--text-2); margin-top: 4px; }

/* Anzeige einer Meldung */
.mkopf { border-left: 5px solid var(--blau); }
.mkopf.a-gruen { border-left-color: var(--gruen-voll); }
.mkopf.a-gelb { border-left-color: var(--gelb); }
.mkopf.a-rot { border-left-color: var(--rot-voll); }
.kv { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; gap: 4px 12px; margin: 6px 0; }
.kv .k { font-size: 13px; color: var(--text-2); }
.kv .v { white-space: pre-wrap; overflow-wrap: anywhere; }
.anz-abschnitt { font-weight: 700; color: var(--blau); margin: 16px 0 4px; border-top: 1px solid var(--linie); padding-top: 10px; }
.anz-abschnitt:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.anz-gefahr { display: flex; gap: 10px; align-items: baseline; padding: 4px 0; border-bottom: 1px dashed var(--linie); }
.anz-gefahr .f { flex: none; min-width: 64px; font-size: 13px; }
.anz-gefahr .bem { color: var(--text-2); font-size: 14px; white-space: pre-wrap; }
.ampelbanner { border-radius: 10px; padding: 10px 12px; font-weight: 700; margin: 8px 0; }
.ampelbanner.rot { background: var(--rot-voll); color: #fff; }
.ampelbanner.gelb { background: var(--gelb-voll); }
.ampelbanner.gruen { background: var(--gruen-voll); }
.quittung { font-size: 14px; padding: 4px 0; }

/* Anmeldung */
.anmeldung { max-width: 440px; margin: 0 auto; }
.anmeldung .logo { text-align: center; margin: 18px 0 8px; }
.anmeldung .logo img { width: 104px; height: 104px; border-radius: 50%; background: #fff; box-shadow: var(--schatten); }
.anmeldung h1 { text-align: center; margin-bottom: 2px; color: var(--blau); }
.anmeldung .ov { text-align: center; color: var(--text-2); margin-bottom: 16px; }

/* Dialog */
.dialog-hg { position: fixed; inset: 0; background: rgba(10, 20, 45, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.dialog {
  background: #fff; width: 100%; max-width: 560px; max-height: 90vh; overflow: auto;
  border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.dialog h2 { margin: 0 0 6px; }
@media (min-width: 640px) { .dialog-hg { align-items: center; } .dialog { border-radius: 16px; } }

.toast {
  position: fixed; left: 50%; bottom: calc(82px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 60; max-width: calc(100% - 32px);
  box-shadow: 0 4px 14px rgba(0,0,0,.25); cursor: pointer;
}
.lade { text-align: center; color: var(--text-2); padding: 40px 0; }
.fuss { text-align: center; font-size: 12px; color: var(--text-2); margin-top: 20px; }
.offline { background: var(--rot); color: #fff; text-align: center; font-size: 13px; padding: 4px; position: sticky; top: 0; z-index: 30; }

/* Druck / PDF */
@media print {
  @page { margin: 14mm 12mm; }
  body { background: #fff; font-size: 11pt; }
  .kopf, .nav, .knoepfe, .toast, .keindruck, .offline { display: none !important; }
  .druckkopf { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid #003399; padding-bottom: 8px; margin-bottom: 10px; font-size: 10pt; }
  .druckkopf img { width: 44px; height: 44px; }
  main { max-width: none; padding: 0; }
  .karte { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; padding: 8px 10px; }
  .anz-gefahr, .kv > * { break-inside: avoid; }
  .tabwrap { overflow: visible; }
  .ampelbanner, .f, .z-gering, .z-mittel, .z-hoch, td.gesperrt { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
