/* ASU-Control – Einsatzoberfläche
   Nacht: Graphit-Grund, Statusfarben als einzige Sättigung.
   Tag: heller Grund, abgedunkelte Statusfarben für Sonnenlicht. */

:root {
  color-scheme: dark;
  --grund: #0f1215;
  --flaeche: #171b1f;
  --flaeche-2: #1f2429;
  --flaeche-3: #283037;
  --linie: #2c343b;
  --linie-stark: #3d4750;
  --text: #f1f4f6;
  --text-2: #a9b3bc;
  --text-3: #7d8892;

  --s-nicht: #8a959f;
  --s-nicht-grund: #232a30;
  --s-nicht-fuell: #c3cbd2;
  --s-alarm: #ffc21a;
  --s-alarm-grund: #3a2f0c;
  --s-alarm-fuell: #ffc21a;
  --s-anfahrt: #4aa8ff;
  --s-anfahrt-grund: #0f2a44;
  --s-anfahrt-fuell: #4aa8ff;
  --s-vorort: #34d27b;
  --s-vorort-grund: #0e3321;
  --s-vorort-fuell: #34d27b;
  --auf-fuell: #071009;
  --auf-alarm: #171000;

  --gefahr: #ff6b6b;
  --gefahr-fuell: #c41d26;
  --gefahr-grund: #3d1416;
  --fokus: #ffffff;
  --auswahl: #f1f4f6;

  --schatten: 0 10px 30px -8px rgb(0 0 0 / 0.6), 0 2px 6px rgb(0 0 0 / 0.35);
  --radius: 10px;
  --radius-klein: 7px;

  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ziel: 56px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="nacht"]) {
    color-scheme: light;
    --grund: #e7eaed;
    --flaeche: #ffffff;
    --flaeche-2: #f2f4f6;
    --flaeche-3: #e3e7eb;
    --linie: #d3d9de;
    --linie-stark: #aab3bb;
    --text: #0c0f12;
    --text-2: #3e4852;
    --text-3: #5d6872;
    --s-nicht: #5d6872;
    --s-nicht-grund: #e3e7eb;
    --s-nicht-fuell: #4a545d;
    --s-alarm: #946500;
    --s-alarm-grund: #fff1c7;
    --s-alarm-fuell: #ffc21a;
    --s-anfahrt: #0a64c2;
    --s-anfahrt-grund: #dcecff;
    --s-anfahrt-fuell: #0a64c2;
    --s-vorort: #08703a;
    --s-vorort-grund: #d6f5e3;
    --s-vorort-fuell: #08703a;
    --auf-fuell: #ffffff;
    --auf-alarm: #171000;
    --gefahr: #c8202a;
    --gefahr-fuell: #c41d26;
    --gefahr-grund: #fde3e4;
    --fokus: #0c0f12;
    --auswahl: #0c0f12;
    --schatten: 0 10px 28px -10px rgb(20 30 40 / 0.35), 0 2px 6px rgb(20 30 40 / 0.12);
  }
}

:root[data-theme="tag"] {
  color-scheme: light;
  --grund: #e7eaed;
  --flaeche: #ffffff;
  --flaeche-2: #f2f4f6;
  --flaeche-3: #e3e7eb;
  --linie: #d3d9de;
  --linie-stark: #aab3bb;
  --text: #0c0f12;
  --text-2: #3e4852;
  --text-3: #5d6872;
  --s-nicht: #5d6872;
  --s-nicht-grund: #e3e7eb;
  --s-nicht-fuell: #4a545d;
  --s-alarm: #946500;
  --s-alarm-grund: #fff1c7;
  --s-alarm-fuell: #ffc21a;
  --s-anfahrt: #0a64c2;
  --s-anfahrt-grund: #dcecff;
  --s-anfahrt-fuell: #0a64c2;
  --s-vorort: #08703a;
  --s-vorort-grund: #d6f5e3;
  --s-vorort-fuell: #08703a;
  --auf-fuell: #ffffff;
  --auf-alarm: #171000;
  --gefahr: #c8202a;
  --gefahr-fuell: #c41d26;
  --gefahr-grund: #fde3e4;
  --fokus: #0c0f12;
  --auswahl: #0c0f12;
  --schatten: 0 10px 28px -10px rgb(20 30 40 / 0.35), 0 2px 6px rgb(20 30 40 / 0.12);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font-family: var(--schrift);
  font-size: 17px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

::selection { background: var(--s-anfahrt-fuell); color: var(--auf-fuell); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
button:disabled { cursor: not-allowed; }

:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; }

.zahl { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

.icon { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

[hidden] { display: none !important; }

.versteckt { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

* { scrollbar-width: thin; scrollbar-color: var(--linie-stark) transparent; }

/* ------------------------------------------------------------------ Grundgerüst */

.app {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.kopf {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: stretch;
  gap: 0;
  background: var(--flaeche);
  border-bottom: 1px solid var(--linie);
  padding-top: env(safe-area-inset-top);
}

.marke {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-right: 1px solid var(--linie);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.marke-zeichen { width: 40px; height: 40px; flex: none; display: block; }

/* Lageleiste: die Zahlen, die die ASU ständig braucht */
.lage {
  display: flex;
  align-items: stretch;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.lage::-webkit-scrollbar { display: none; }

.lage-wert {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px 20px;
  border-right: 1px solid var(--linie);
  min-width: max-content;
}
.lage-wert dt { font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.lage-wert dd { margin: 0; font-size: 30px; font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; white-space: nowrap; }
.lage-wert dd small { font-size: 15px; font-weight: 700; color: var(--text-2); letter-spacing: 0; margin-left: 4px; }

.lage-wert.haupt { background: var(--s-vorort-grund); padding-inline: 24px; }
.lage-wert.haupt dt { color: var(--s-vorort); }
.lage-wert.haupt dd { font-size: 68px; line-height: 0.9; letter-spacing: -0.04em; color: var(--text); }
.lage-wert.haupt { flex-direction: row; align-items: center; gap: 14px; }
.lage-wert.haupt dt { max-width: 6.5em; white-space: normal; line-height: 1.15; font-size: 14px; }
.lage-wert.anfahrt dt { color: var(--s-anfahrt); }
.lage-wert.alarm dt { color: var(--s-alarm); }

.kopf-aktionen { display: flex; align-items: center; gap: 6px; padding: 0 12px; border-left: 1px solid var(--linie); }

.verbindung {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 99px;
  font-size: 14px; font-weight: 700; white-space: nowrap;
  color: var(--s-vorort);
}
.verbindung::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.verbindung[data-zustand="getrennt"] { color: var(--gefahr); background: var(--gefahr-grund); }
.verbindung[data-zustand="verbinde"] { color: var(--s-alarm); }
.verbindung .zeit { color: var(--text-2); font-weight: 600; }

.knopf-icon {
  width: var(--ziel); height: var(--ziel);
  display: grid; place-items: center;
  border: 1px solid transparent; border-radius: var(--radius);
  background: transparent;
}
.knopf-icon:hover { background: var(--flaeche-2); }
.knopf-icon:active { background: var(--flaeche-3); }

/* Verbindungswarnung über die ganze Breite */
.warnband {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--gefahr-fuell);
  color: #fff;
  font-weight: 700;
}
.warnband.sichtbar { display: flex; }
.warnband .icon { width: 24px; height: 24px; }

.hinweisband {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 20px;
  background: var(--flaeche-2);
  border-bottom: 1px solid var(--linie);
  color: var(--text-2);
  font-size: 15px; font-weight: 600;
}

.arbeitsflaeche {
  display: grid;
  grid-template-columns: minmax(300px, 36%) minmax(0, 1fr);
  min-height: 0;
}

/* ------------------------------------------------------------------ Fahrzeugliste */

.liste-bereich {
  min-width: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  border-right: 1px solid var(--linie);
  background: var(--flaeche);
}

.werkzeuge {
  display: grid;
  gap: 8px;
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--linie);
}

.suche { position: relative; }
.suche .icon { position: absolute; left: 16px; top: 50%; translate: 0 -50%; color: var(--text-3); pointer-events: none; }
.suche input {
  width: 100%;
  height: var(--ziel);
  padding: 0 56px 0 48px;
  border: 2px solid var(--linie-stark);
  border-radius: var(--radius);
  background: var(--grund);
  font-size: 18px;
  font-weight: 600;
}
.suche input::placeholder { color: var(--text-3); font-weight: 500; }
.suche input:focus { outline: none; border-color: var(--fokus); }
.suche input::-webkit-search-cancel-button { display: none; }
.suche-leeren {
  position: absolute; right: 0; top: 0;
  width: var(--ziel); height: var(--ziel);
  display: none; place-items: center;
  border: 0; border-radius: var(--radius-klein); background: transparent; color: var(--text-2);
}
.suche-leeren.sichtbar { display: grid; }

.filter {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--grund);
  border-radius: var(--radius);
}
.filter button {
  min-height: var(--ziel);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  padding: 4px 2px;
  border: 0; border-radius: var(--radius-klein);
  background: transparent;
  color: var(--text-2);
  font-size: 13px; font-weight: 700; line-height: 1.1;
  text-align: center;
}
.filter button .anz { font-size: 18px; font-weight: 800; color: var(--text); }
.filter button[aria-pressed="true"] { background: var(--flaeche-3); color: var(--text); box-shadow: inset 0 -3px 0 var(--f, var(--text)); }
.filter button[data-status="alarmiert"] { --f: var(--s-alarm); }
.filter button[data-status="anfahrt"] { --f: var(--s-anfahrt); }
.filter button[data-status="vor_ort"] { --f: var(--s-vorort); }
.filter button[data-status="nicht_alarmiert"] { --f: var(--s-nicht); }

.sortierung { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); font-weight: 700; }
.sortierung .gruppe { display: flex; flex: 1; gap: 2px; padding: 3px; background: var(--grund); border-radius: var(--radius-klein); }
.sortierung button {
  flex: 1; min-height: 40px; padding: 0 8px;
  border: 0; border-radius: 5px;
  background: transparent; color: var(--text-2); font-size: 14px; font-weight: 700;
}
.sortierung button[aria-pressed="true"] { background: var(--flaeche-3); color: var(--text); }

.liste {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 0 24px;
}

.gruppe-kopf {
  position: sticky; top: 0; z-index: 1;
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 14px 16px 6px;
  background: var(--flaeche);
  font-size: 14px; font-weight: 800; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.gruppe-kopf span:last-child { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--text-3); }

.zeile {
  width: 100%;
  display: grid;
  grid-template-columns: 92px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 8px 14px 8px 12px;
  border: 0;
  border-top: 1px solid var(--linie);
  background: transparent;
  text-align: left;
  position: relative;
}
.zeile:hover { background: var(--flaeche-2); }
.zeile:active { background: var(--flaeche-3); }
.zeile[aria-current="true"] { background: var(--flaeche-3); }
.zeile[aria-current="true"]::after {
  content: ""; position: absolute; inset: 0;
  border: 3px solid var(--auswahl); border-radius: 4px; pointer-events: none;
}

.zeile-name { min-width: 0; }
.zeile-name strong { display: block; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.zeile-name span { display: block; font-size: 15px; color: var(--text-2); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.zeile-agt { text-align: right; line-height: 1.1; }
.zeile-agt b { font-size: 24px; font-weight: 800; }
.zeile-agt small { display: block; font-size: 13px; color: var(--text-2); font-weight: 600; }
.zeile-agt.leer b { color: var(--text-3); }
.zeile-agt .warn { color: var(--s-alarm); }

/* Statusplakette: Farbe + Klartext, nie nur Farbe */
.plakette {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 4px 6px;
  border-radius: 6px;
  font-size: 12px; font-weight: 800; line-height: 1.05; text-transform: uppercase; letter-spacing: 0.02em;
  text-align: center;
}
.plakette[data-status="nicht_alarmiert"] { background: var(--s-nicht-grund); color: var(--text-2); box-shadow: inset 0 0 0 1.5px var(--linie-stark); }
.plakette[data-status="alarmiert"] { background: var(--s-alarm-fuell); color: var(--auf-alarm); }
.plakette[data-status="anfahrt"] { background: var(--s-anfahrt-fuell); color: var(--auf-fuell); }
.plakette[data-status="vor_ort"] { background: var(--s-vorort-fuell); color: var(--auf-fuell); }
.zeile .plakette { width: 100%; }
.plakette .icon { width: 15px; height: 15px; stroke-width: 2.6; }

.leer-zustand {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-2);
}
.leer-zustand strong { display: block; color: var(--text); font-size: 18px; margin-bottom: 6px; }
.leer-zustand button { margin-top: 14px; }

/* ------------------------------------------------------------------ Rechtes Panel */

.panel {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--grund);
}

.panel-innen { padding: 20px 24px 40px; max-width: 980px; }

.panel-kopf {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin-bottom: 20px;
}
.panel-kopf h1, .panel-kopf h2 { margin: 0; }
.titel-funk { font-size: 44px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.titel-unter { margin-top: 6px; font-size: 20px; font-weight: 700; color: var(--text-2); }
.titel-unter b { color: var(--text); }

.abschnitt { margin-top: 26px; }
.abschnitt:first-child { margin-top: 0; }
.abschnitt-titel {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin: 0 0 10px;
  font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-2);
}
.abschnitt-titel small { text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 14px; color: var(--text-3); }

/* Statusschalter: vier große Felder in Einsatzreihenfolge */
.status-schalter {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.status-knopf {
  position: relative;
  min-height: 96px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 6px;
  border: 2px solid var(--linie-stark);
  border-radius: var(--radius);
  background: var(--flaeche);
  color: var(--text);
  font-size: 17px; font-weight: 800; line-height: 1.1; text-align: center;
  transition: background-color 160ms ease-out, border-color 160ms ease-out, transform 120ms ease-out;
}
.status-knopf .icon { width: 28px; height: 28px; color: var(--sf); }
.status-knopf[data-status="nicht_alarmiert"] { --sf: var(--s-nicht); --sg: var(--s-nicht-fuell); --sa: var(--grund); }
.status-knopf[data-status="alarmiert"] { --sf: var(--s-alarm); --sg: var(--s-alarm-fuell); --sa: var(--auf-alarm); }
.status-knopf[data-status="anfahrt"] { --sf: var(--s-anfahrt); --sg: var(--s-anfahrt-fuell); --sa: var(--auf-fuell); }
.status-knopf[data-status="vor_ort"] { --sf: var(--s-vorort); --sg: var(--s-vorort-fuell); --sa: var(--auf-fuell); }
.status-knopf:hover:not(:disabled) { border-color: var(--sf); }
.status-knopf:active:not(:disabled) { transform: scale(0.97); }
.status-knopf[aria-pressed="true"] {
  background: var(--sg);
  border-color: var(--sg);
  color: var(--sa);
  box-shadow: var(--schatten);
}
.status-knopf[aria-pressed="true"] .icon { color: inherit; }
.status-knopf:disabled:not([aria-pressed="true"]) { opacity: 0.45; }
.status-knopf.laedt { opacity: 0.7; }

.status-seit { margin-top: 10px; font-size: 15px; color: var(--text-2); font-weight: 600; }
.status-seit b { color: var(--text); }

/* AGT vor Ort */
.agt-feld {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  padding: 16px;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}
.agt-anzeige { min-width: 132px; text-align: center; }
.agt-anzeige b { display: block; font-size: 72px; font-weight: 800; line-height: 0.95; letter-spacing: -0.04em; }
.agt-anzeige span { display: block; margin-top: 4px; font-size: 16px; font-weight: 700; color: var(--text-2); }

.agt-tasten {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 8px;
}
.agt-taste {
  min-height: 68px;
  border: 2px solid var(--linie-stark);
  border-radius: var(--radius);
  background: var(--flaeche-2);
  font-size: 28px; font-weight: 800;
  transition: background-color 140ms ease-out, transform 120ms ease-out;
}
.agt-taste:hover:not(:disabled) { border-color: var(--s-vorort); }
.agt-taste:active:not(:disabled) { transform: scale(0.95); }
.agt-taste[aria-pressed="true"] { background: var(--s-vorort-fuell); border-color: var(--s-vorort-fuell); color: var(--auf-fuell); }
.agt-taste:disabled:not([aria-pressed="true"]) { opacity: 0.4; }

.agt-gesperrt {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px;
  background: var(--flaeche);
  border: 1px dashed var(--linie-stark);
  border-radius: var(--radius);
  color: var(--text-2);
  font-weight: 600;
}

/* Ausstattung */
.fakten {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0;
  margin: 0;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  overflow: hidden;
}
.fakten div { padding: 12px 16px; border-right: 1px solid var(--linie); border-bottom: 1px solid var(--linie); margin: -0 -1px -1px 0; }
.fakten dt { font-size: 13px; font-weight: 700; color: var(--text-2); }
.fakten dd { margin: 2px 0 0; font-size: 24px; font-weight: 800; }
.fakten dd.nein { color: var(--text-3); }
.bemerkung { margin-top: 10px; padding: 12px 16px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); }

/* Verlauf & Meldungen */
.verlauf { list-style: none; margin: 0; padding: 0; border: 1px solid var(--linie); border-radius: var(--radius); background: var(--flaeche); overflow: hidden; }
.verlauf li { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--linie); font-size: 15px; }
.verlauf li:first-child { border-top: 0; }
.verlauf time { font-weight: 800; }
.verlauf .wer { color: var(--text-3); font-size: 13px; font-weight: 600; }
.verlauf .leer { display: block; color: var(--text-3); }

/* Einsatzübersicht */
.uebersicht-summe { margin: 0 0 10px; font-size: 17px; font-weight: 700; color: var(--text-2); }

.tabelle {
  width: 100%;
  border-collapse: separate; border-spacing: 0;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  overflow: hidden;
}
.tabelle th {
  padding: 10px 14px; text-align: left;
  font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2);
  background: var(--flaeche-2);
  border-bottom: 1px solid var(--linie);
}
.tabelle td { padding: 0; border-top: 1px solid var(--linie); font-weight: 600; }
.tabelle tbody tr:first-child td { border-top: 0; }
.tabelle td > button:not(.knopf) {
  width: 100%; min-height: 58px; padding: 8px 14px;
  display: flex; align-items: center;
  border: 0; background: transparent; text-align: left; font-weight: inherit;
}
.tabelle tbody tr:hover td { background: var(--flaeche-2); }
.tabelle .rechts, .tabelle .rechts > button:not(.knopf) { text-align: right; justify-content: flex-end; }
.tabelle .agt { font-size: 24px; font-weight: 800; }
.tabelle .funk { font-size: 18px; font-weight: 800; }
.tabelle tfoot td { padding: 12px 14px; border-top: 2px solid var(--linie-stark); background: var(--flaeche-2); font-weight: 800; font-size: 17px; }
.tabelle tfoot .agt { font-size: 28px; }

.hinweis-karte {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 10px; padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--s-alarm-grund);
  color: var(--text);
  font-weight: 600;
}
.hinweis-karte .icon { color: var(--s-alarm); width: 24px; height: 24px; }
.hinweis-karte > div { display: flex; align-items: center; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  min-height: var(--ziel); padding: 6px 14px;
  display: inline-flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--linie-stark); border-radius: var(--radius-klein);
  background: var(--flaeche); font-weight: 800; font-size: 16px;
}
.chip small { color: var(--text-2); font-weight: 600; font-size: 14px; }
.chip:hover { border-color: var(--text-2); }

.unterwegs { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.unterwegs .chip { justify-content: space-between; width: 100%; }

.leer-hinweis { padding: 18px 16px; border: 1px dashed var(--linie-stark); border-radius: var(--radius); color: var(--text-2); font-weight: 600; }

.gefahrenzone {
  margin-top: 56px; padding: 18px;
  border: 1.5px solid var(--gefahr); border-radius: var(--radius);
  background: var(--gefahr-grund);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
}
.gefahrenzone p { margin: 4px 0 0; color: var(--text-2); font-size: 15px; font-weight: 600; max-width: 52ch; }
.gefahrenzone strong { font-size: 17px; }

/* ------------------------------------------------------------------ Knöpfe */

.knopf {
  min-height: var(--ziel);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 0 20px;
  border: 2px solid var(--linie-stark);
  border-radius: var(--radius);
  background: var(--flaeche-2);
  font-weight: 800; font-size: 17px;
  white-space: nowrap;
  transition: background-color 140ms ease-out, transform 120ms ease-out;
}
.knopf:hover:not(:disabled) { background: var(--flaeche-3); }
.knopf:active:not(:disabled) { transform: scale(0.98); }
.knopf:disabled { opacity: 0.5; }
.knopf.primaer { background: var(--text); border-color: var(--text); color: var(--grund); }
.knopf.vorort { background: var(--s-vorort-fuell); border-color: var(--s-vorort-fuell); color: var(--auf-fuell); }
.knopf.gefahr { background: var(--gefahr-fuell); border-color: var(--gefahr-fuell); color: #fff; }
.knopf.gefahr-umriss { background: transparent; border-color: var(--gefahr); color: var(--gefahr); }
.knopf.gefahr-umriss:hover:not(:disabled) { background: var(--gefahr-grund); }
.knopf.primaer:hover:not(:disabled), .knopf.vorort:hover:not(:disabled), .knopf.gefahr:hover:not(:disabled) { background: var(--fb); filter: brightness(1.08); }
.knopf.primaer { --fb: var(--text); }
.knopf.vorort { --fb: var(--s-vorort-fuell); }
.knopf.gefahr { --fb: var(--gefahr-fuell); }
.knopf.klein { min-height: var(--ziel); padding: 0 16px; font-size: 15px; }

/* ------------------------------------------------------------------ Benutzermenü, Dialoge, Meldungen */

.menue {
  position: fixed; top: 76px; right: 12px; z-index: 30;
  min-width: 260px;
  padding: 8px;
  background: var(--flaeche);
  border: 1px solid var(--linie-stark);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
}
.menue[hidden] { display: none; }
.menue-wer { padding: 10px 12px 12px; border-bottom: 1px solid var(--linie); margin-bottom: 6px; }
.menue-wer b { display: block; font-size: 17px; }
.menue-wer span { color: var(--text-2); font-size: 14px; font-weight: 600; }
.menue a, .menue button {
  width: 100%; min-height: var(--ziel);
  display: flex; align-items: center; gap: 12px;
  padding: 0 12px;
  border: 0; border-radius: var(--radius-klein);
  background: transparent; color: var(--text); text-decoration: none; font-weight: 700; text-align: left;
}
.menue a:hover, .menue button:hover { background: var(--flaeche-2); }

dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--linie-stark);
  border-radius: 14px;
  background: var(--flaeche);
  color: var(--text);
  box-shadow: var(--schatten);
}
dialog::backdrop { background: rgb(0 0 0 / 0.6); }
.dialog-innen { padding: 24px; }
.dialog-innen h2 { margin: 0 0 8px; font-size: 24px; letter-spacing: -0.01em; }
.dialog-innen p { margin: 0 0 14px; color: var(--text-2); font-weight: 500; }
.dialog-aktionen { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.dialog-gefahr h2 { color: var(--gefahr); }

.feld { display: grid; gap: 6px; margin-top: 14px; }
.feld label { font-size: 14px; font-weight: 800; color: var(--text-2); }
.feld input, .feld select, .feld textarea {
  min-height: var(--ziel);
  padding: 0 14px;
  border: 2px solid var(--linie-stark);
  border-radius: var(--radius-klein);
  background: var(--grund);
  font-size: 18px; font-weight: 600;
}
.feld textarea { padding: 12px 14px; min-height: 88px; resize: vertical; }
.feld input:focus, .feld select:focus, .feld textarea:focus { outline: none; border-color: var(--fokus); }
.feld .hilfe { font-size: 14px; color: var(--text-3); font-weight: 500; }
.feld-reihe { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0 12px; }
.check { display: flex; align-items: center; gap: 12px; min-height: var(--ziel); font-weight: 700; margin-top: 14px; }
.check input { width: 28px; height: 28px; accent-color: var(--s-vorort); }

.fehlertext { color: var(--gefahr); font-weight: 700; margin-top: 12px; min-height: 1.4em; }

.meldungen {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 50;
  translate: -50% 0;
  display: grid; gap: 8px;
  width: min(640px, calc(100vw - 24px));
  pointer-events: none;
}
.meldung {
  display: flex; align-items: center; gap: 14px;
  min-height: 60px;
  padding: 8px 8px 8px 18px;
  border-radius: 12px;
  background: var(--text);
  color: var(--grund);
  font-weight: 700;
  box-shadow: var(--schatten);
  pointer-events: auto;
  animation: meldung-rein 200ms cubic-bezier(0.2, 0.9, 0.3, 1);
}
.meldung .text { flex: 1; min-width: 0; }
.meldung.fehler { background: var(--gefahr-fuell); color: #fff; }
.meldung button {
  min-height: var(--ziel); padding: 0 18px;
  border: 2px solid currentColor; border-radius: var(--radius-klein);
  background: transparent; color: inherit; font-weight: 800;
}
.meldung .mit-icon { display: inline-flex; align-items: center; gap: 8px; }
.meldung .zu { border: 0; width: var(--ziel); padding: 0; display: grid; place-items: center; }
.meldung.raus { animation: meldung-raus 160ms ease-in forwards; }
@media (min-width: 701px) {
  .app ~ .meldungen { left: auto; right: 24px; translate: none; width: min(560px, calc(58% - 48px)); }
}
@keyframes meldung-rein { from { opacity: 0; translate: 0 16px; } }
@keyframes meldung-raus { to { opacity: 0; translate: 0 8px; } }

/* Ladezustand */
.skelett { padding: 16px; display: grid; gap: 10px; }
.skelett div { height: 64px; border-radius: 8px; background: var(--flaeche-2); animation: puls 1.4s ease-in-out infinite; }
@keyframes puls { 50% { opacity: 0.5; } }

.nur-schmal { display: none !important; }
.nur-breit { display: inline; }

/* ------------------------------------------------------------------ Hochformat / kleine Geräte */

@media (max-width: 1180px) {
  .lage-wert { padding: 8px 14px; }
  .lage-wert dd { font-size: 26px; }
  .lage-wert.haupt dd { font-size: 60px; }
  .lage-wert.nebensache { display: none; }
  .verbindung .zeit { display: none; }
}

@media (max-width: 1000px) {
  .kopf { grid-template-columns: 1fr auto; }
  .marke { border-right: 0; padding: 10px 14px; }
  .lage { grid-column: 1 / -1; grid-row: 2; border-top: 1px solid var(--linie); overflow: visible; }
  .lage-wert { flex: 1 1 0; min-width: 0; }
  .lage-wert dt { white-space: normal; }
  .kopf-aktionen { border-left: 0; }
  .menue { top: 64px; }
  .arbeitsflaeche { grid-template-columns: minmax(0, 40%) minmax(0, 1fr); }
  .sortierung > span { display: none; }
  .filter button { font-size: 11.5px; padding-inline: 0; }
  .filter button .anz { font-size: 17px; }
  .zeile { grid-template-columns: 86px 1fr auto; gap: 10px; padding-inline: 10px; }
}

@media (max-width: 700px) {
  .kopf { grid-template-columns: 1fr auto; }
  .arbeitsflaeche { grid-template-columns: minmax(0, 1fr); }
  .panel { display: none; }
  .app[data-ansicht="panel"] .panel { display: block; }
  .app[data-ansicht="panel"] .liste-bereich { display: none; }
  .nur-schmal { display: inline-flex !important; margin-left: auto; }
  .nur-breit { display: none; }
  span.nur-schmal { margin-left: 0; }
  .titel-funk { font-size: 36px; }
}

@media (max-width: 560px) {
  .lage { display: grid; grid-template-columns: 1fr 1fr; }
  .lage-wert { border-bottom: 1px solid var(--linie); }
  .lage-wert.haupt { grid-column: 1 / -1; }
  .lage-wert.haupt dt { max-width: none; }
  .kopf-aktionen { gap: 0; padding: 0 4px; }
  .panel-innen { padding: 16px 14px 32px; }
  .status-schalter { grid-template-columns: repeat(2, 1fr); }
  .agt-feld { grid-template-columns: 1fr; }
  .filter button { font-size: 11.5px; }
  .zeile { grid-template-columns: 92px 1fr auto; gap: 10px; }
  .verbindung { padding: 6px 8px; font-size: 13px; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
@media (max-width: 700px) { .sortierung { flex-wrap: wrap; } }
