/* KFD Ambulance — Flottenportal.
   Palette gemessen aus dem Kundenlogo (design/DESIGN-SYSTEM.md):
   Navy #252B76, Orange #E86A03. Statusfarben bewusst NICHT aus der Marke —
   das Orange ist die Aktion, nicht die Warnung.                             */

:root {
  --navy:        #252B76;
  --navy-2:      #1B2059;
  --navy-luft:   #343C93;
  --accent:      #E86A03;
  --accent-dark: #C25703;
  --surface:     #F6F7FB;
  --card:        #FFFFFF;
  --line:        #E2E5EF;
  --line-stark:  #C9CFE0;
  --text:        #1A1D2B;
  --text-muted:  #646B85;

  --ok:   #15803D;  --ok-bg:   #E7F5EC;
  --warn: #B45309;  --warn-bg: #FDF1E1;
  --stop: #B91C1C;  --stop-bg: #FCEDED;
  --info: #2A5CAA;  --info-bg: #EAF0FA;

  /* Radienleiter 10/14/20/999 — Felder, Karten, grosse Flaechen, Knoepfe */
  --r-feld: 10px;  --r-karte: 14px;  --r-flaeche: 20px;  --r-knopf: 999px;

  --schatten: 0 1px 2px rgba(26, 29, 43, .06), 0 6px 16px -8px rgba(26, 29, 43, .18);
  --leiste: 264px;
}

* { box-sizing: border-box; }

/* MUSS vor jeder Regel mit eigenem display stehen und !important tragen:
   ein Autorenstil wie `.anmeldeseite { display: grid }` schlaegt den
   Browser-Standard `[hidden] { display: none }` unabhaengig von der
   Spezifitaet — die versteckte Ansicht bleibt dann sichtbar. Genau das ist
   am 02.09.2026 in der Abnahme passiert (Anmeldemaske ueber dem Portal).  */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { color: var(--navy); font-weight: 650; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 21px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p  { margin: 0; }
a  { color: var(--info); }

svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75;
      stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ── Ladeschirm ───────────────────────────────────────────────────────────── */

.ladeschirm {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  gap: 10px; color: var(--text-muted);
}
.ladepunkt {
  width: 10px; height: 10px; border-radius: var(--r-knopf); background: var(--accent);
  animation: pulsieren 1.2s ease-in-out infinite;
}
@keyframes pulsieren { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ladepunkt { animation: none; } }

/* ── Anmeldung ────────────────────────────────────────────────────────────── */

.anmeldeseite {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 58%, #12163d 100%);
}
.anmeldekarte {
  width: 100%; max-width: 380px; background: var(--card); padding: 30px 28px 28px;
  border-radius: var(--r-flaeche); box-shadow: 0 24px 48px -20px rgba(0, 0, 0, .5);
  display: grid; gap: 6px;
}
.anmeldelogo { margin: 0 auto 6px; display: block; }
.anmeldekarte h1 { text-align: center; font-size: 20px; }
.anmeldehinweis { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }
.anmeldekarte label { font-size: 13px; font-weight: 600; margin-top: 8px; }
.anmeldekarte button { margin-top: 18px; }

/* ── Felder ───────────────────────────────────────────────────────────────── */

input, select, textarea {
  width: 100%; padding: 11px 12px; font: inherit; color: var(--text);
  background: var(--card); border: 1px solid var(--line-stark); border-radius: var(--r-feld);
  transition: border-color .12s, box-shadow .12s;
  min-height: 44px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input:hover, select:hover, textarea:hover { border-color: #9AA3BE; }
input:focus, select:focus, textarea:focus {
  border-color: var(--navy); box-shadow: 0 0 0 3px rgba(37, 43, 118, .12); outline: none;
}
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] {
  border-color: var(--stop); box-shadow: 0 0 0 3px rgba(185, 28, 28, .1);
}
input:disabled, select:disabled, textarea:disabled {
  background: #F2F3F8; color: var(--text-muted); cursor: not-allowed;
}
label { display: block; }
.feldfehler { color: var(--stop); font-size: 13px; margin-top: 6px; }
.feldhinweis { color: var(--text-muted); font-size: 12.5px; margin-top: 4px; }

/* ── Knöpfe ───────────────────────────────────────────────────────────────── */

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; font: inherit; font-weight: 600;
  border: 1px solid transparent; border-radius: var(--r-knopf); cursor: pointer;
  background: var(--card); color: var(--navy); border-color: var(--line-stark);
  transition: background-color .12s, border-color .12s, color .12s;
}
.knopf:hover { background: #EEF0F7; }
.knopf.primaer { background: var(--accent); border-color: var(--accent); color: #fff; }
.knopf.primaer:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.knopf.leise { background: transparent; border-color: transparent; color: inherit; }
.knopf.leise:hover { background: rgba(255, 255, 255, .12); }
.knopf.gefahr { color: var(--stop); border-color: #EBC4C4; background: var(--stop-bg); }
.knopf.gefahr:hover { background: #F8DCDC; }
.knopf.klein { min-height: 36px; padding: 0 13px; font-size: 13.5px; position: relative; }
/* Der kleine Knopf DARF 36 px hoch aussehen — treffbar muss er 44 px sein.
   Die Flaeche waechst als ::after, damit sich das Layout nicht verschiebt
   (DESIGN.md §5). Geprueft wird sie mit elementFromPoint, nicht am Kasten.  */
.knopf.klein::after { content: ''; position: absolute; inset: -6px; border-radius: inherit; }
.knopf.breit { width: 100%; }
.knopf:disabled { opacity: .55; cursor: not-allowed; }
.knopf svg { width: 18px; height: 18px; }

/* ── Portal-Gerüst ────────────────────────────────────────────────────────── */

.portal { display: grid; grid-template-columns: var(--leiste) 1fr; min-height: 100dvh; }

.seitenleiste {
  background: var(--navy); color: #fff; display: flex; flex-direction: column;
  padding: 18px 14px; gap: 18px; position: sticky; top: 0; height: 100dvh;
}
.marke { display: flex; align-items: center; gap: 10px; padding: 4px 6px; font-size: 15px; }
.marke img { border-radius: 8px; background: #fff; padding: 2px; }
.marke strong { font-weight: 750; }

.menu { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.menupunkt {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; min-height: 44px;
  color: rgba(255, 255, 255, .82); text-decoration: none; border-radius: var(--r-feld);
  font-size: 14.5px; font-weight: 550;
  transition: background-color .12s, color .12s;
}
.menupunkt:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.menupunkt[aria-current="page"] { background: var(--navy-luft); color: #fff; }
.menupunkt[aria-current="page"] svg { color: var(--accent); }
.menupunkt.gesperrt { color: rgba(255, 255, 255, .38); cursor: default; }
.menupunkt.gesperrt:hover { background: transparent; color: rgba(255, 255, 255, .38); }
.menutrenner {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: rgba(255, 255, 255, .42); padding: 16px 12px 4px; font-weight: 600;
}
.menuzahl {
  margin-left: auto; background: rgba(255, 255, 255, .18); color: #fff;
  font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: var(--r-knopf);
  font-variant-numeric: tabular-nums;
}
.menuzahl.warnzahl { background: var(--accent); }

.seitenfuss { border-top: 1px solid rgba(255, 255, 255, .14); padding-top: 14px; }
.benutzerzeile {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13.5px; color: rgba(255, 255, 255, .9); margin-bottom: 10px; padding: 0 4px;
}
.rollenchip {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
  background: rgba(255, 255, 255, .16); padding: 2px 7px; border-radius: var(--r-knopf);
}
.seitenfuss .knopf { color: #fff; border-color: rgba(255, 255, 255, .22); }

.hauptteil { min-width: 0; display: flex; flex-direction: column; }

.kopfzeile {
  display: flex; align-items: center; gap: 14px; padding: 18px 26px;
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.kopftitel { min-width: 0; flex: 1; }
.kopfunter { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.kopfaktion { display: flex; gap: 13px; flex-wrap: wrap; justify-content: flex-end; }

.demobanner {
  margin: 0; padding: 9px 26px; background: var(--warn-bg); color: #7A3B06;
  font-size: 13px; border-bottom: 1px solid #F0DCC2;
}
.demobanner strong { font-weight: 700; }

.inhalt { padding: 22px 26px 60px; max-width: 1400px; width: 100%; }

/* ── Karten & Raster ──────────────────────────────────────────────────────── */

.karte {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-karte);
  box-shadow: var(--schatten);
}
.kartenkopf {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.kartenkopf h2 { flex: 1; min-width: 0; }
.kartenkopf .zahlklein { color: var(--text-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.kartenkoerper { padding: 16px; }
.kartenkoerper.eng { padding: 0; }

.raster { display: grid; gap: 16px; }
.raster.zwei { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); align-items: start; }
.raster.drei { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.raster > * { min-width: 0; }

.stapel { display: grid; gap: 16px; }
.zeile { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; }
.zeile.rechts { justify-content: flex-end; }
.wachsen { flex: 1; min-width: 0; }

/* ── Flottenstreifen (Lagebild) ───────────────────────────────────────────── */

.streifen { display: flex; height: 12px; border-radius: var(--r-knopf); overflow: hidden; gap: 2px; }
.streifen span { display: block; }
.streifen .s-ok   { background: var(--ok); }
.streifen .s-warn { background: var(--warn); }
.streifen .s-stop { background: var(--stop); }
.streifenlegende { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.legendenpunkt { display: flex; align-items: baseline; gap: 7px; font-size: 13.5px; }
.legendenpunkt b { font-size: 17px; font-variant-numeric: tabular-nums; color: var(--navy); }
.legendenpunkt i {
  width: 9px; height: 9px; border-radius: 3px; display: block; align-self: center;
}
.legendenpunkt i.s-ok { background: var(--ok); }
.legendenpunkt i.s-warn { background: var(--warn); }
.legendenpunkt i.s-stop { background: var(--stop); }

/* ── Chips ────────────────────────────────────────────────────────────────── */

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: var(--r-knopf); font-size: 12.5px; font-weight: 650; white-space: nowrap;
}
.chip svg { width: 13px; height: 13px; stroke-width: 2.2; }
.chip.ton-ok   { background: var(--ok-bg);   color: var(--ok); }
.chip.ton-warn { background: var(--warn-bg); color: var(--warn); }
.chip.ton-stop { background: var(--stop-bg); color: var(--stop); }
.chip.ton-info { background: var(--info-bg); color: var(--info); }

/* ── Tabellen ─────────────────────────────────────────────────────────────── */

.tabellenrahmen { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); font-weight: 700; padding: 10px 14px; white-space: nowrap;
  background: #FAFBFE; border-bottom: 1px solid var(--line); position: sticky; top: 0;
}
tbody td { padding: 0 14px; height: 48px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.klickbar { cursor: pointer; }
tbody tr.klickbar:hover { background: #F7F9FE; }
tbody tr.gedaempft td { color: var(--text-muted); }
td.zahl, th.zahl { text-align: right; font-variant-numeric: tabular-nums; }
td.knapp { white-space: nowrap; }
.kennzeichen { font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.untertext { color: var(--text-muted); font-size: 12.5px; }

/* ── Listen ───────────────────────────────────────────────────────────────── */

.liste { list-style: none; margin: 0; padding: 0; }
.liste > li { padding: 13px 16px; border-bottom: 1px solid var(--line); }
.liste > li:last-child { border-bottom: none; }
.liste > li.klickbar { cursor: pointer; }
.liste > li.klickbar:hover { background: #F7F9FE; }
.listenkopf { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.listentext { margin-top: 4px; color: var(--text-muted); font-size: 13.5px; }

/* ── Zustände ─────────────────────────────────────────────────────────────── */

.leer { padding: 34px 20px; text-align: center; color: var(--text-muted); }
.leer svg { width: 30px; height: 30px; margin-bottom: 10px; color: var(--line-stark); }
.leer p { font-size: 14px; }
.leer .knopf { margin-top: 14px; }

.fehlerkarte {
  border: 1px solid #EBC4C4; background: var(--stop-bg); color: #7F1D1D;
  border-radius: var(--r-karte); padding: 16px;
}
.fehlerkarte h2 { color: #7F1D1D; margin-bottom: 6px; }

.skelett { display: grid; gap: 10px; }
.skelettzeile {
  height: 48px; border-radius: var(--r-feld);
  background: linear-gradient(90deg, #EDEFF6 0%, #F6F7FB 50%, #EDEFF6 100%);
  background-size: 200% 100%; animation: wandern 1.3s linear infinite;
}
@keyframes wandern { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skelettzeile { animation: none; } }

/* ── Toasts ───────────────────────────────────────────────────────────────── */

.toasts {
  position: fixed; top: 16px; right: 16px; z-index: 200;
  display: grid; gap: 8px; max-width: min(380px, calc(100vw - 32px));
}
.toast {
  background: var(--navy); color: #fff; padding: 12px 15px; border-radius: var(--r-feld);
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .5); font-size: 14px;
  display: flex; gap: 10px; align-items: flex-start;
}
.toast.t-ok   { background: #14532D; }
.toast.t-stop { background: #7F1D1D; }

/* ── Dialog ───────────────────────────────────────────────────────────────── */

.dialog {
  border: none; border-radius: var(--r-flaeche); padding: 0; max-width: min(560px, calc(100vw - 32px));
  width: 100%; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .5); color: var(--text);
}
/* Nur im geoeffneten Zustand flex — sonst schlaegt der Autorenstil das
   `display: none`, das der Browser einem dialog ohne [open] gibt (dieselbe
   Falle wie bei [hidden], gefunden 02.09.2026).
   Der Fuss bleibt stehen, der Koerper rollt: auf dem Telefon war der Knopf
   "Meldung senden" sonst unter dem Bildschirmrand.                        */
dialog.dialog[open] {
  display: flex; flex-direction: column; max-height: calc(100dvh - 32px);
}
.dialog .dialogkoerper { overflow-y: auto; }
.dialog .dialogfuss { border-top: 1px solid var(--line); background: var(--card);
                      border-radius: 0 0 var(--r-flaeche) var(--r-flaeche); }
.dialog::backdrop { background: rgba(19, 22, 45, .55); }
.dialogkopf { padding: 20px 22px 0; }
.dialogkoerper { padding: 14px 22px; display: grid; gap: 12px; }
.dialogfuss {
  padding: 14px 22px 20px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
}

/* ── Formularraster ───────────────────────────────────────────────────────── */

.formraster { display: grid; gap: 14px; }
.formraster.paare { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.formraster label { font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.formfeld { min-width: 0; }
.formfeld.voll { grid-column: 1 / -1; }

.fotofeld { display: grid; gap: 8px; }
/* Das Systemfeld sagt "Choose File" — in einer deutschen App unbrauchbar.
   Es bleibt bedienbar (Label davor), sichtbar ist unser eigener Knopf.    */
.fotoeingabe {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.fotoknopf { justify-content: flex-start; }
.fotoname { color: var(--text-muted); font-size: 13px; }
.fotovorschau {
  max-height: 220px; border-radius: var(--r-feld); border: 1px solid var(--line);
  object-fit: cover; width: 100%;
}
.meldungsfoto {
  width: 100%; max-width: 420px; border-radius: var(--r-feld); border: 1px solid var(--line);
  display: block;
}

/* ── Verlauf ──────────────────────────────────────────────────────────────── */

.verlauf { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.verlauf li { display: grid; grid-template-columns: 128px 1fr; gap: 12px; padding: 9px 0;
              border-bottom: 1px solid var(--line); font-size: 13.5px; }
.verlauf li:last-child { border-bottom: none; }
.verlaufzeit { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.verlauf b { font-weight: 650; }

/* ── Filterleiste ─────────────────────────────────────────────────────────── */

.filterleiste {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px;
}
.filterleiste select, .filterleiste input { width: auto; min-width: 150px; }
.filterleiste .suche { flex: 1; min-width: 200px; max-width: 320px; }

.nurmobil { display: none; }

/* ── Telefon ──────────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .portal { grid-template-columns: 1fr; }
  .nurmobil { display: inline-flex; }

  .seitenleiste {
    position: fixed; inset: 0 auto 0 0; width: min(290px, 84vw); z-index: 60;
    transform: translateX(-102%); transition: transform .2s ease;
  }
  .seitenleiste.offen { transform: none; }
  @media (prefers-reduced-motion: reduce) { .seitenleiste { transition: none; } }

  .seitenschatten { position: fixed; inset: 0; background: rgba(19, 22, 45, .5); z-index: 50; }

  .kopfzeile { padding: 12px 16px; }
  .inhalt { padding: 16px 16px 80px; }
  .demobanner { padding: 9px 16px; }

  /* Tabellen brechen zu Karten um — der Fahrer meldet vom Telefon, das ist
     kein Nebenfall (DESIGN-APP §3).                                        */
  table.umbrechend thead { display: none; }
  table.umbrechend tbody tr {
    display: grid; gap: 6px; padding: 13px 14px; border-bottom: 1px solid var(--line);
  }
  table.umbrechend tbody td {
    display: flex; justify-content: space-between; gap: 14px; height: auto;
    padding: 0; border: none; align-items: baseline;
  }
  table.umbrechend tbody td::before {
    content: attr(data-spalte); color: var(--text-muted); font-size: 12.5px; font-weight: 600;
    flex: 0 0 auto;
  }
  table.umbrechend tbody td.zahl { text-align: left; }
  table.umbrechend .knopf.klein { min-height: 44px; width: 100%; }
  table.umbrechend .knopf.klein::after { content: none; }
  table.umbrechend tbody td[data-spalte=""]::before { content: none; }

  .verlauf li { grid-template-columns: 1fr; gap: 2px; }
  .toasts { top: auto; bottom: 16px; left: 16px; right: 16px; max-width: none; }
}

@media (prefers-contrast: more) {
  :root { --line: #9AA3BE; --line-stark: #6B7594; --text-muted: #454B60; }
  .knopf { border-width: 2px; }
  :focus-visible { outline-width: 3px; }
}
