/* ============================================================
   FF Gundernhausen – WebApp
   app/assets/app.css

   Farben + Status-System wie im internen Bereich (intern/includes/header.php):
   orange = du bist dran · blau = läuft · grün = erledigt · rot = Problem · grau = vergangen.
   Bei APP_ASSET_VERSION (includes/app.php) und CACHE (sw.js) hochzählen, wenn sich diese Datei ändert.
   ============================================================ */
:root {
  --red:        #9a0000;
  --red-dark:   #7a0000;
  --red-light:  #f8e8e8;
  --anthr:      #2c2c2c;
  --text:       #222;
  --muted:      #555;
  --bg:         #f0f0f0;
  --white:      #fff;
  --border:     #e0e0e0;
  --shadow:     0 2px 8px rgba(0,0,0,.10);
  --shadow-md:  0 4px 16px rgba(0,0,0,.14);
  --radius:     6px;
  --radius-lg:  12px;
  --font:       'Segoe UI', system-ui, -apple-system, sans-serif;

  --st-warten: #9a5200;  --st-warten-bg: #fff4dc;  --st-warten-rand: #f0a830;
  --st-laeuft: #1f4e9c;  --st-laeuft-bg: #eaf1fb;  --st-laeuft-rand: #7ea6e0;
  --st-ok:     #1a6b35;  --st-ok-bg:     #e7f5ec;  --st-ok-rand:     #6fbf8b;
  --st-problem:#a8231a;  --st-problem-bg:#fdecea;  --st-problem-rand:#e98d85;
  --st-neutral:#5b5b5b;  --st-neutral-bg:#f0f0f0;  --st-neutral-rand:#cdcdcd;

  --nav-h: 62px;
  --kopf: #8c0000;   /* EINE Farbe oben: Kopfleiste (oberer Rand), Statusleiste, Seitenhintergrund, theme-color */

  /* Textfarben getrennt von Flächenfarben – im Dark Mode brauchen rote Schrift und rote Knöpfe verschiedene Töne */
  --red-text:  var(--red);
  --titel:     var(--anthr);
  --flaeche-2: #f4f4f4;   /* zweite Flächenstufe: Kacheln im Menü, Chips, Platzhalter */
  --nav-bg:    rgba(255,255,255,.96);
  color-scheme: light;
}

/* ══ Dark Mode (folgt der Einstellung des Handys) ═══════════════
   Kopfleiste und Statusleiste bleiben rot. --white ist die Kartenfläche, --anthr bleibt dunkel (Flächen mit weißer Schrift).
   Statusfarben werden hell (Schrift auf dunklem Grund) – wo sie als Fläche dienen, steht unten dunkle Schrift. */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --red: #c62828; --red-dark: #a51f1f; --red-light: rgba(239,106,98,.16); --red-text: #ff8a80;
    --text: #e8e8e8; --muted: #a9a9a9; --titel: #f2f2f2;
    --bg: #121212; --white: #1e1e1e; --border: #363636; --flaeche-2: #2a2a2a; --nav-bg: rgba(28,28,28,.94);
    --shadow: 0 2px 8px rgba(0,0,0,.45); --shadow-md: 0 4px 16px rgba(0,0,0,.6);
    --st-warten: #ffb74d;  --st-warten-bg: #35270f;  --st-warten-rand: #a86b12;
    --st-laeuft: #9dbcf2;  --st-laeuft-bg: #172438;  --st-laeuft-rand: #4169ad;
    --st-ok:     #85d6a0;  --st-ok-bg:     #13301e;  --st-ok-rand:     #2f7d4a;
    --st-problem:#ff8a80;  --st-problem-bg:#3a1815;  --st-problem-rand:#a8433a;
    --st-neutral:#b8b8b8;  --st-neutral-bg:#262626;  --st-neutral-rand:#4c4c4c;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* iPhone: iOS färbt den Bereich hinter der Statusleiste nach der Hintergrundfarbe der Seite ein.
   Dunkelrot statt Hellgrau → sauberes Rot mit weißer Schrift statt blassem Rosa-Weiß-Verlauf.
   Der sichtbare Inhalt bleibt hellgrau (body). Kein Nachfedern, damit das Rot beim Überziehen nicht aufblitzt. */
html { -webkit-text-size-adjust: 100%; background: var(--kopf); overscroll-behavior-y: none; }
.app-statusleiste {
  position: fixed; top: 0; left: 0; right: 0; height: env(safe-area-inset-top); z-index: 150;
  background: var(--kopf); pointer-events: none;
}

body {
  font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--text);
  background: var(--bg); min-height: 100vh; min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
body.app-mit-nav { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
a { color: var(--red-text); text-decoration: none; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

/* ── Kopfleiste ─────────────────────────────────────────── */
.app-kopf {
  position: sticky; top: 0; z-index: 50; overflow: hidden; isolation: isolate;
  padding: calc(8px + env(safe-area-inset-top)) 16px 10px;
  color: #fff;
  /* Oben (hinter der Statusleiste) exakt einfarbig: iOS misst dort die Farbe für den Übergang ab.
     Darunter senkrechter Verlauf – kein Lichtschein und kein Diagonalverlauf am oberen Rand. */
  background-color: var(--kopf);
  background-image: linear-gradient(180deg, var(--kopf) 0, var(--kopf) env(safe-area-inset-top), #a0080f 100%);
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
}
/* Logo als großes, dezentes Wasserzeichen rechts */
.app-kopf::after {
  content: ''; position: absolute; z-index: -1; right: -28px; top: calc(-10px + env(safe-area-inset-top));
  width: 150px; height: 116px; opacity: .10;
  background: url('../bilder/logo-weiss.png') center / contain no-repeat;
}
.app-kopf-zeile { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.app-kopf-logo { height: 32px; width: auto; flex-shrink: 0; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }
.app-kopf-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.app-kopf-ueber { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; letter-spacing: .8px; text-transform: uppercase; opacity: .78; }
.app-kopf-titel { font-size: 19px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-kopf-zurueck {
  width: 44px; height: 44px; margin-left: -10px; flex-shrink: 0; border-radius: 50%;   /* Touch-Fläche ≥ 44 px */
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
}
.app-kopf-zurueck svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.app-kopf-zurueck:active { background: rgba(255,255,255,.18); }
.app-test-badge { background: #ffd54a; color: #5a3d00; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 10px; letter-spacing: .5px; flex-shrink: 0; }

/* Großer Kopfbereich (Startseite, Anmeldung): scrollt mit, unten abgerundet */
.app-kopf-hero { position: relative; border-radius: 0 0 26px 26px; padding-bottom: 22px; }
.app-kopf-hero::after { width: 260px; height: 200px; right: -60px; top: auto; bottom: -34px; opacity: .09; }
.app-hero { padding: 14px 2px 0; }
.app-hero-datum { font-size: 13px; opacity: .85; }
.app-hero-gruss { font-size: 26px; font-weight: 800; line-height: 1.2; margin-top: 2px; letter-spacing: -.2px; }
.app-hero-kacheln { display: flex; gap: 10px; margin-top: 16px; }
.app-hero-kachel {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 14px; color: #fff; text-decoration: none;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: flex; flex-direction: column; line-height: 1.15;
}
.app-hero-kachel strong { font-size: 24px; font-weight: 800; }
.app-hero-kachel span { font-size: 12px; opacity: .9; }
.app-hero-kachel:active { background: rgba(255,255,255,.24); }
.app-hero-kachel-warten { background: #fff; color: var(--st-warten); border-color: #fff; }
.app-hero-kachel-warten span { opacity: 1; color: var(--muted); }

/* Anmeldung: Logo groß in der Mitte, kleine Kopfzeile ausblenden */
.app-kopf-hero:has(.app-hero-login) .app-kopf-logo,
.app-kopf-hero:has(.app-hero-login) .app-kopf-ueber { display: none; }
.app-hero-login { text-align: center; padding: 6px 0 8px; }
.app-hero-logo { height: 84px; width: auto; margin: 0 auto 10px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.3)); }

.app-inhalt { max-width: 720px; margin: 0 auto; padding: 16px; }
.app-kopf-hero + .app-inhalt { padding-top: 18px; }

/* ── Untere Navigation ──────────────────────────────────── */
.app-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; background: rgba(255,255,255,.96); border-top: 1px solid var(--border);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 14px rgba(0,0,0,.07);
}
.app-nav-btn {
  flex: 1; height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: #6b6b6b; font-size: 11.5px; font-weight: 600;
}
.app-nav-icon { width: 56px; height: 30px; border-radius: 15px; display: flex; align-items: center; justify-content: center; transition: background .2s; }
.app-nav-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-nav-btn.aktiv, .app-nav-btn[aria-expanded="true"] { color: var(--red-text); }
.app-nav-btn.aktiv .app-nav-icon, .app-nav-btn[aria-expanded="true"] .app-nav-icon { background: var(--red-light); }
.app-nav-btn.aktiv .app-nav-icon svg { stroke-width: 2.2; }

/* ── Karten, Abschnitte, Texte ──────────────────────────── */
.app-karte { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.app-abschnitt { font-size: 15px; font-weight: 800; color: var(--red-text); margin: 22px 2px 10px; scroll-margin-top: 90px; }
[id] { scroll-margin-top: 90px; }
.app-klein { font-size: 13px; color: var(--muted); }
.app-leer { color: var(--muted); }
.app-alles-erledigt { color: var(--st-ok); font-weight: 700; text-align: center; }
.app-link-klein { font-size: 13px; font-weight: 600; }
.app-block-fuss { padding: 12px 16px; border-top: 1px solid var(--border); }
.app-hinweise { font-size: 13px; }
.app-ziel { font-size: 13px; color: var(--muted); white-space: nowrap; }
.app-abt { color: var(--red-text); font-weight: 700; }
.app-version { text-align: center; margin: 18px 0 4px; }

/* ── Meldungen ──────────────────────────────────────────── */
.app-meldung {
  background: var(--st-bg); color: var(--st); border-left: 4px solid var(--st-rand);
  padding: 11px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 15px; font-weight: 600;
}

/* ── Buttons ────────────────────────────────────────────── */
.app-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--white); color: var(--text); font: inherit; font-size: 15px; font-weight: 700;
  cursor: pointer; text-decoration: none; transition: background .15s, opacity .15s;
}
.app-btn:active { transform: translateY(1px); }
.app-btn-primaer { background: var(--red); border-color: var(--red); color: #fff; }
.app-btn-primaer:active { background: var(--red-dark); }
.app-btn-breit { width: 100%; }
.app-btn-klein { min-height: 44px; padding: 8px 14px; font-size: 14px; }   /* Touch-Fläche ≥ 44 px (Apple-Empfehlung) */
.app-btn-ok     { background: var(--st-ok-bg); color: var(--st-ok); border-color: var(--st-ok-rand); }
.app-btn-nein   { background: var(--st-problem-bg); color: var(--st-problem); border-color: var(--st-problem-rand); }
.app-btn-gefahr { color: var(--st-problem); border-color: var(--st-problem-rand); }
.app-btn.laedt  { opacity: .6; pointer-events: none; }
.app-inline-form { display: inline; }
/* „⋯"-Menü für seltene Aktionen in Listenzeilen (z. B. fremde Buchung ändern/stornieren) */
/* Aufgeklappt erscheinen die Knöpfe daneben im Fluss (kein schwebendes Menü: .ui-block schneidet überstehende Inhalte ab) */
.app-weitere-aktionen[open] { display: flex; flex-wrap: wrap; gap: 8px; }
/* Raster statt Umbruch: „⋯" bleibt beim Aufklappen an seinem Platz (springt nicht unter den Finger) */
.app-zeile-aktionen:has(> .app-weitere-aktionen) { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; justify-items: start; }
.app-weitere-aktionen > summary { list-style: none; min-width: 44px; padding: 8px 12px; font-size: 18px; line-height: 1; }
.app-weitere-aktionen > summary::-webkit-details-marker { display: none; }
.app-weitere-aktionen[open] > summary { background: var(--st-neutral-bg); }
.app-weitere-aktionen-liste { display: flex; flex-wrap: wrap; gap: 8px; }
.app-dialog-box p:empty { display: none; }

/* ── Formulare ──────────────────────────────────────────── */
.app-form { display: flex; flex-direction: column; gap: 14px; }
.app-feld { display: flex; flex-direction: column; gap: 5px; }
/* Feldbeschriftung: 14 px in normaler Schreibweise – lesbarer als kleine Großbuchstaben (auch mit Brille im Fahrzeug) */
.app-feld > span { font-size: 14px; font-weight: 700; color: var(--muted); }
.app-feld input, .app-feld select, .app-feld textarea {
  width: 100%; font: inherit; font-size: 16px; /* ≥16px: kein Auto-Zoom auf iOS */
  padding: 11px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--white); color: var(--text);
  min-height: 46px;
}
.app-feld input:focus, .app-feld select:focus, .app-feld textarea:focus { outline: none; border-color: var(--red); }
.app-feld-paar { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .app-feld-paar { grid-template-columns: 1fr; } }
.app-check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.app-check input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--red); flex-shrink: 0; }
.app-check > span { min-width: 0; overflow-wrap: anywhere; }
.app-check small { display: block; font-size: 13px; color: var(--muted); }
.app-check-box { background: #f5f5f5; border-radius: var(--radius); padding: 10px 12px; }
.app-form-ressource { font-size: 17px; }
.app-weitere { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.app-weitere summary { font-weight: 600; cursor: pointer; }
.app-weitere .app-check { margin-top: 10px; }
.app-weitere .app-klein { margin-top: 8px; }
.app-kalender ul { margin: 4px 0; padding-left: 18px; }
.app-kalender li { overflow-wrap: anywhere; }
.app-hinweis { background: var(--st-warten-bg); border-left: 3px solid var(--st-warten-rand); padding: 9px 12px; border-radius: 0 var(--radius) var(--radius) 0; font-size: 14px; }
.app-infotext { background: var(--st-laeuft-bg); border-left: 3px solid var(--st-laeuft-rand); padding: 9px 12px; border-radius: 0 var(--radius) var(--radius) 0; font-size: 14px; margin: 4px 0 12px; }

/* Segment-Umschalter (Zeitraum, Entscheidung) */
.app-segment { display: inline-flex; border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.app-segment a, .app-segment label span { display: block; padding: 5px 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.app-segment a + a, .app-segment label + label span { border-left: 1px solid var(--border); }
.app-segment a.aktiv { background: var(--red); color: #fff; }
.app-segment-gross { display: flex; }
.app-segment-gross label { flex: 1; cursor: pointer; }
.app-segment-gross label span { text-align: center; padding: 12px; font-size: 15px; }
.app-segment-gross input { position: absolute; opacity: 0; pointer-events: none; }
.app-segment-gross input[value="genehmigen"]:checked + span { background: var(--st-ok); color: #fff; }
.app-segment-gross input[value="ablehnen"]:checked + span { background: var(--st-problem); color: #fff; }
.app-segment-gross input:focus-visible + span { outline: 2px solid var(--anthr); outline-offset: -3px; }
/* Auswahl nicht nur über die Farbe: ◉/○ davor, gewählte Option fett mit kräftigem Rahmen */
.app-segment-gross label span::before { content: '○ '; }
.app-segment-gross input:checked + span { font-weight: 800; box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .35); }
.app-segment-gross input:checked + span::before { content: '◉ '; }

/* Daten-Liste (Antrag) */
.app-daten { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 15px; }
.app-daten dt { color: var(--muted); font-weight: 600; }
.app-bisher { text-decoration: line-through; color: var(--muted); }

/* ── Login ──────────────────────────────────────────────── */
.app-login { max-width: 420px; margin: 0 auto; }
.app-login-sub { text-align: center; color: var(--muted); font-size: 14px; margin: 4px 0 18px; }
.app-login-fuss { text-align: center; font-size: 14px; }

/* ── Ressourcen ─────────────────────────────────────────── */
.app-res-liste { display: flex; flex-direction: column; gap: 10px; }
.app-res {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow); color: var(--text);
}
.app-res:active { background: #fafafa; }
.app-res-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.app-res-name { font-weight: 800; font-size: 16px; }
.app-res-belegung { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.app-res-hinweis { font-size: 12px; color: var(--muted); }
.app-res-pfeil { font-size: 26px; color: #bbb; }
.app-punkt { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.app-punkt.frei   { background: var(--st-ok); }
.app-punkt.belegt { background: var(--st-problem); }
/* Gerade in Nutzung – Übersicht: ganze Karte markiert, Schild + Grund; „wartet" = reserviert, Freigabe offen (orange) */
.app-res.in-nutzung { --nutzung: var(--st-problem); --nutzung-bg: var(--st-problem-bg);
  background: linear-gradient(90deg, var(--nutzung-bg), var(--white) 70%); box-shadow: var(--shadow), inset 5px 0 0 var(--nutzung); }
.app-res.in-nutzung.wartet { --nutzung: var(--st-warten); --nutzung-bg: var(--st-warten-bg); }
.app-res-nutzung { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--nutzung); }
.app-res-schild { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  background: var(--nutzung); color: #fff; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; }
.app-res-schild::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: app-pulsieren 1.6s ease-in-out infinite; }
.app-res-grund { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes app-pulsieren { 50% { opacity: .35; } }
/* Gerade in Nutzung – Ressource: Hinweis oben; laufende Buchung in Listen hervorgehoben */
.app-in-nutzung { --nutzung: var(--st-problem); --nutzung-bg: var(--st-problem-bg); --nutzung-rand: var(--st-problem-rand);
  margin-bottom: 14px; padding: 12px 14px; border-radius: var(--radius-lg); background: var(--nutzung-bg);
  border: 2px solid var(--nutzung-rand); box-shadow: var(--shadow); }
.app-in-nutzung.wartet { --nutzung: var(--st-warten); --nutzung-bg: var(--st-warten-bg); --nutzung-rand: var(--st-warten-rand); }
.app-in-nutzung-kopf { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--nutzung); font-size: 15px; }
.app-in-nutzung-punkt { width: 10px; height: 10px; border-radius: 50%; background: var(--nutzung); flex-shrink: 0; animation: app-pulsieren 1.6s ease-in-out infinite; }
.app-in-nutzung-text { margin-top: 4px; font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.ui-zeile.app-laeuft-jetzt { background: var(--st-problem-bg); border-left-width: 6px; border-left-color: var(--st-problem); }
.app-laeuft-chip { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; background: var(--st-problem); color: #fff;
  font-size: 11px; font-weight: 800; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .app-res-schild::before, .app-in-nutzung-punkt { animation: none; } }

.app-res-kopf { padding: 0; overflow: hidden; }
.app-res-kopf > *:not(.app-res-bild) { margin-left: 16px; margin-right: 16px; }
.app-res-kopf > .app-btn { width: calc(100% - 32px); margin-bottom: 16px; }
.app-res-bild { height: 170px; background: #eee center / cover no-repeat; }
.app-res-kopf-text { padding: 14px 0 6px; }
.app-res-kopf-text p { margin-top: 6px; }
.app-res-typ { font-size: 14px; color: var(--muted); }

/* ── Rechnungen ─────────────────────────────────────────── */
.app-btn-gross { min-height: 54px; font-size: 16px; margin-bottom: 16px; }
.app-abstand-oben { margin-top: 10px; }
.app-karte-titel { font-size: 15px; font-weight: 800; color: var(--red-text); }
.app-karte-titel small { font-weight: 400; color: var(--muted); font-size: 13px; }
.app-summen { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.app-summe { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 12px 14px;
  border-top: 4px solid var(--st-rand); display: flex; flex-direction: column; }
.app-summe span { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.app-summe strong { font-size: 20px; color: var(--st); }
.app-summe small { font-size: 12px; color: var(--muted); }
.app-betrag { font-size: 15px; white-space: nowrap; }
.app-rechnung-kopf { border-top: 4px solid var(--st-rand); text-align: center; }
.app-rechnung-betrag { font-size: 30px; font-weight: 800; }
.app-rechnung-titel { font-size: 17px; font-weight: 700; margin: 2px 0 8px; }
.app-rechnung-kopf .app-hinweis { text-align: left; }
.app-kommentar { margin-top: 6px; padding: 8px 10px; background: #f6f6f6; border-radius: var(--radius); font-size: 14px; }

.app-beleg-knoepfe { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.app-beleg-knopf { min-height: 76px; flex-direction: column; gap: 2px; padding: 10px 8px; position: relative; }
/* Datei-Feld optisch ausgeblendet, aber fokussierbar (Tab → Enter/Leertaste öffnet Kamera bzw. Dateiauswahl) */
.app-beleg-quelle { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; opacity: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.app-beleg-knopf:has(.app-beleg-quelle:focus-visible) { outline: 3px solid var(--anthr); outline-offset: 2px; }
.app-beleg-knopf-icon { font-size: 26px; line-height: 1; }
.app-beleg-liste { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.app-beleg-liste:empty { display: none; }
.app-beleg { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius); }
.app-beleg img, .app-beleg-icon { width: 52px; height: 52px; border-radius: 4px; object-fit: cover; flex-shrink: 0;
  background: #f3f3f3; display: flex; align-items: center; justify-content: center; font-size: 26px; }
.app-beleg-name { flex: 1; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.app-beleg-weg { width: 40px; height: 40px; border: none; border-radius: 50%; background: #f3f3f3; color: var(--st-problem); font-size: 16px; cursor: pointer; flex-shrink: 0; }
.app-btn:disabled { opacity: .6; }

/* ── Konto ──────────────────────────────────────────────── */
.app-konto-kopf { display: flex; align-items: center; gap: 14px; }
.app-konto-avatar {
  width: 48px; height: 48px; border-radius: 50%; background: var(--red); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800;
}

/* ── Offline ────────────────────────────────────────────── */
.app-offline { text-align: center; }
.app-offline-icon { font-size: 48px; }
.app-offline h2 { margin: 6px 0; color: var(--red-text); }
.app-offline p { color: var(--muted); margin-bottom: 16px; }

/* ══ Status-System – gleiche Bausteine wie intern (includes/ui.php) ══ */
.st-warten  { --st: var(--st-warten);  --st-bg: var(--st-warten-bg);  --st-rand: var(--st-warten-rand); }
.st-laeuft  { --st: var(--st-laeuft);  --st-bg: var(--st-laeuft-bg);  --st-rand: var(--st-laeuft-rand); }
.st-ok      { --st: var(--st-ok);      --st-bg: var(--st-ok-bg);      --st-rand: var(--st-ok-rand); }
.st-problem { --st: var(--st-problem); --st-bg: var(--st-problem-bg); --st-rand: var(--st-problem-rand); }
.st-neutral { --st: var(--st-neutral); --st-bg: var(--st-neutral-bg); --st-rand: var(--st-neutral-rand); }

.ui-status { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 10px;
  border-radius: 12px; white-space: nowrap; background: var(--st-bg, #f0f0f0); color: var(--st, #555); border: 1px solid var(--st-rand, transparent); }
.ui-chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 4px; background: #efefef; color: #444; white-space: nowrap; }
.ui-chip-rot { background: var(--white); color: var(--red-text); border: 1px solid var(--red); }
.ui-chip-bild { display: inline-flex; align-items: center; gap: 5px; padding-left: 2px; }
.ui-zaehler { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; font-size: 12px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; background: var(--st, #777); color: #fff; }

.ui-block { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.ui-block-kopf { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 11px 16px; font-weight: 800; font-size: 15px; border-bottom: 1px solid var(--border); }
.ui-block-kopf .ui-block-aktionen { margin-left: auto; display: flex; gap: 6px; font-weight: 400; }
.ui-block:is(.st-warten,.st-laeuft,.st-ok,.st-problem,.st-neutral) > .ui-block-kopf { background: var(--st-bg); color: var(--st); border-bottom-color: var(--st-rand); }
.ui-block.ui-dringend { border: 2px solid var(--st-rand, var(--border)); box-shadow: var(--shadow-md); }
.ui-block-leer { padding: 16px; color: var(--muted); font-size: 14px; }

.ui-liste { display: flex; flex-direction: column; }
.ui-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 14px 12px 12px; border-bottom: 1px solid var(--border);
  border-left: 4px solid var(--st-rand, transparent); background: var(--white); color: inherit; }
a.ui-zeile:active { background: #fafafa; }
.ui-zeile:last-child { border-bottom: none; }
.ui-zeile.ui-vergangen .ui-titel, .ui-zeile.ui-vergangen .ui-datum { opacity: .65; }
.ui-zeile-haupt { flex: 1 1 calc(100% - 70px); min-width: 0; overflow-wrap: anywhere; }
.ui-titel { font-weight: 700; font-size: 15px; color: var(--text); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ui-meta { font-size: 13px; color: var(--muted); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 2px 12px; }
.ui-zeile-status { margin-left: 62px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.app-zeile-aktionen { margin-left: 62px; display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.app-termin .ui-zeile-haupt { flex-basis: calc(100% - 70px); }

.ui-datum { flex-shrink: 0; width: 50px; text-align: center; border-radius: 6px; border: 1px solid var(--border); overflow: hidden; background: var(--white); line-height: 1.15; }
.ui-datum-monat { display: block; background: var(--st, var(--anthr)); color: #fff; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; padding: 2px 0; }
.ui-datum-tag { display: block; font-size: 19px; font-weight: 800; padding-top: 2px; color: var(--text); }
.ui-datum-wt { display: block; font-size: 10px; color: var(--muted); padding-bottom: 3px; }
.ui-datum-leer { border: 1.5px dashed var(--border); background: none; color: var(--muted); padding-top: 6px; }
.ui-datum-leer svg { display: block; width: 22px; height: 22px; margin: 0 auto 1px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.ui-thumb { display: inline-block; flex-shrink: 0; border-radius: 50%; background: #eee center / cover no-repeat;
  border: 2px solid var(--white); box-shadow: 0 0 0 1px var(--border); vertical-align: middle; }
.ui-thumb-leer { display: inline-flex; align-items: center; justify-content: center; background: #f3f3f3; }
.ui-chip-bild .ui-thumb { border-width: 1px; }

/* Zeilen ohne Kalenderblatt (Konto, Links) */
.ui-zeile > .ui-zeile-haupt:first-child + .app-zeile-aktionen,
.ui-zeile > .ui-zeile-haupt:first-child ~ .ui-zeile-status { margin-left: 0; }
.ui-zeile > .ui-zeile-haupt:first-child { flex-basis: 0; flex-grow: 1; }
.ui-zeile > .ui-zeile-haupt:first-child + .app-zeile-aktionen { width: auto; }

/* ══ Tempo-Gefühl ══════════════════════════════════════════
   1) Fließender Seitenwechsel statt weißem Aufblitzen (View Transitions; Safari 18.2+, Chrome 126+).
      Kopfleiste und untere Leiste bleiben stehen, nur der Inhalt blendet über.
   2) Ladebalken oben, sofort beim Antippen – man sieht, dass etwas passiert. */
/* Keine View Transitions: während der Überblendung fehlt die feste rote Leiste oben als echtes Element –
   iOS 26 färbt den oberen Rand dann kurz weiß (Aufblitzen). Seitenwechsel laufen ohne Neuladen (app.js). */

.app-ladebalken {
  position: fixed; left: 0; right: 0; top: env(safe-area-inset-top); height: 3px; z-index: 100;
  pointer-events: none; overflow: hidden; opacity: 0; transition: opacity .15s;
}
/* klares Gelb ohne Weiß-Verlauf – wirkt auf dem roten Kopf als Akzent statt als Schleier */
.app-ladebalken::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 35%;
  background: #ffd54a; border-radius: 0 2px 2px 0; box-shadow: 0 0 6px rgba(255,213,74,.6);
  transform: translateX(-100%);
}
html.app-laedt .app-ladebalken { opacity: 1; }
html.app-laedt .app-ladebalken::before { animation: app-laden 1.1s cubic-bezier(.45,.05,.55,.95) infinite; }
@keyframes app-laden { from { transform: translateX(-100%); } to { transform: translateX(290%); } }

/* Tipp-Rückmeldung für alles Antippbare */
a.ui-zeile, .app-res, .app-hero-kachel, .app-nav-btn, .app-btn { transition: transform .08s, background .15s; }
a.ui-zeile:active, .app-res:active, .app-hero-kachel:active { transform: scale(.985); }
.app-nav-btn:active .app-nav-icon { background: var(--red-light); }

/* ══ Beleg zuschneiden & gerade ziehen (Vollbild-Dialog, dunkel wie eine Kamera-App) ══ */
html.app-zuschnitt-offen, html.app-zuschnitt-offen body { overflow: hidden; }
.app-zuschnitt {
  position: fixed; inset: 0; z-index: 300; display: flex; flex-direction: column;
  background: #121212; color: #fff; view-transition-name: none;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.app-zuschnitt-kopf { padding: 14px 16px 8px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.app-zuschnitt-kopf strong { font-size: 17px; }
.app-zuschnitt-kopf span { font-size: 13px; opacity: .7; }
.app-zuschnitt-buehne { position: relative; flex: 1; min-height: 0; touch-action: none; user-select: none; -webkit-user-select: none; overflow: hidden; }
.app-zuschnitt-bild { position: absolute; box-shadow: 0 4px 30px rgba(0,0,0,.5); }
.app-zuschnitt-rahmen { position: absolute; inset: 0; width: 100%; height: 100%; }
.app-zuschnitt-schatten { fill: rgba(0,0,0,.55); }
.app-zuschnitt-linie { fill: none; stroke: #ffd54a; stroke-width: 2; stroke-linejoin: round; }
.app-zuschnitt-rahmen circle { fill: rgba(255,213,74,.25); stroke: #ffd54a; stroke-width: 3; transition: r .1s; }
.app-zuschnitt-rahmen circle.aktiv { fill: rgba(255,213,74,.5); r: 18; }
.app-zuschnitt-lupe {
  position: absolute; top: 12px; right: 12px; width: 120px; height: 120px; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 4px 18px rgba(0,0,0,.6); pointer-events: none;
}
.app-zuschnitt-lupe.links { right: auto; left: 12px; }
.app-zuschnitt-arbeit {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,.8); padding: 14px 20px; border-radius: 12px; font-weight: 600;
}
.app-zuschnitt-werkzeuge { display: flex; justify-content: center; gap: 8px; padding: 10px 12px 4px; }
.app-zuschnitt-werkzeuge button { white-space: nowrap; }
.app-zuschnitt-werkzeuge button, .app-zuschnitt-fuss button {
  font: inherit; font-size: 14px; font-weight: 700; border-radius: 22px; min-height: 42px; padding: 0 14px;
  border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.1); color: #fff; cursor: pointer;
}
.app-zuschnitt-werkzeuge button:active { background: rgba(255,255,255,.22); }
.app-zuschnitt-fuss { display: grid; grid-template-columns: 1fr 1fr 1.6fr; gap: 8px; padding: 10px 16px 14px; }
.app-zuschnitt-fuss button { min-height: 50px; border-radius: 12px; font-size: 16px; }
.app-zuschnitt-ok { background: #ffd54a !important; color: #3a2800 !important; border-color: #ffd54a !important; }
.app-zuschnitt button:disabled { opacity: .5; }

/* Belegliste: Vorschaubild antippbar zum Nachbearbeiten */
.app-beleg-bild { padding: 0; border: none; background: none; cursor: pointer; flex-shrink: 0; border-radius: 4px; }
.app-beleg-bild img { display: block; }
.app-beleg-name small { display: block; color: var(--muted); font-size: 12px; }

/* ══ Termine ═══════════════════════════════════════════════ */
/* Abteilungsfilter: waagerecht wischbar statt Umbruch */
.app-filter {
  display: flex; gap: 8px; overflow-x: auto; margin: -4px -16px 14px; padding: 4px 16px 6px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.app-filter::-webkit-scrollbar { display: none; }
.app-filter-chip {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border-radius: 18px; background: var(--white); border: 1.5px solid var(--border); color: var(--text);
  font-size: 14px; font-weight: 600; white-space: nowrap; box-shadow: var(--shadow);
}
.app-filter-chip.aktiv { background: var(--red); border-color: var(--red); color: #fff; }
.app-filter-abt.aktiv { background: var(--abt); border-color: var(--abt); }
.app-filter-abt.aktiv .app-abt-punkt { background: #fff; }
.app-abt-punkt { width: 9px; height: 9px; border-radius: 50%; background: var(--abt, #888); flex-shrink: 0; display: inline-block; }
.app-abt-name { display: inline-flex; align-items: center; gap: 5px; color: var(--abt, var(--muted)); font-weight: 700; }

.app-monat-jahr { font-weight: 400; color: var(--muted); }
/* Termine: Farbstreifen links in der Abteilungsfarbe, Kalenderblatt ebenfalls */
.ui-zeile.app-termin { border-left-color: var(--abt, var(--border)); }
.app-termin .ui-datum-monat { background: var(--abt, var(--anthr)); }
.app-termin-hervor { background: #fffaf0; }
.app-sonderzeile { display: flex; gap: 10px; align-items: center; padding: 8px 14px; font-size: 13px; color: var(--muted);
  background: #fafafa; border-bottom: 1px solid var(--border); }
.app-sonder-ferien   { background: #fffbea; }
.app-sonder-feiertag { background: #fff1f1; }

.app-termin-kopf { border-top: 5px solid var(--abt, var(--red)); }
.app-termin-abt { font-size: 14px; font-weight: 700; color: var(--abt, var(--muted)); }
.app-termin-titel { font-size: 22px; line-height: 1.25; margin: 4px 0 6px; }
.app-termin-knoepfe { display: flex; flex-direction: column; gap: 10px; }

/* ══ „Mehr" ════════════════════════════════════════════════ */
.app-mehr-konto { display: flex; align-items: center; gap: 14px; color: var(--text); }
.app-mehr-konto-text { flex: 1; display: flex; flex-direction: column; }
.app-kacheln { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.app-kachel {
  display: flex; flex-direction: column; gap: 4px; padding: 14px; min-height: 128px;
  background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow); color: var(--text);
}
.app-kachel:active { transform: scale(.98); }
.app-kachel strong { font-size: 16px; }
.app-kachel span:last-child { font-size: 13px; color: var(--muted); line-height: 1.35; }
.app-kachel-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--red-light); color: var(--red-text);
  display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.app-kachel-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.app-intern-icon { font-size: 22px; width: 32px; text-align: center; flex-shrink: 0; }


/* ══ Leiste anpassen ═══════════════════════════════════════ */
.app-abschnitt-mit-link { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.app-abschnitt-mit-link .app-link-klein { font-weight: 600; }
.app-einleitung { color: var(--muted); font-size: 15px; margin: 0 2px 14px; }
.app-leiste-vorschau {
  display: flex; background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 8px 4px; margin-bottom: 16px;
}
.app-leiste-vorschau-knopf { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: #6b6b6b; }
.app-leiste-vorschau-knopf svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-leiste-vorschau-knopf.wahl { color: var(--red-text); }


/* ══ Termine bearbeiten ═════════════════════════════════════ */
.app-termin-abgesagt .ui-titel, .app-termin-abgesagt .app-termin-titel { text-decoration: line-through; opacity: .6; }
.app-termin-abgesagt .ui-datum { opacity: .5; }
.app-konflikte { border-left: 4px solid var(--st-problem-rand); }
.app-konflikte ul { margin: 0 0 4px 18px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.app-termin-knoepfe form { display: block; }
.app-termin-knoepfe .app-abschnitt { margin-bottom: 0; }

/* ══ Mitteilungen & Benachrichtigungen ═══════════════════════ */
/* Zähler (ungelesen) an Leiste und Kacheln */
.app-nav-icon, .app-kachel-icon { position: relative; }
.app-zahl, .app-kachel .app-zahl {
  position: absolute; top: -3px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--white);
}
.app-kachel .app-zahl { top: -5px; right: -5px; }

.app-segment-voll { display: flex; margin: 12px 0 16px; background: var(--white); }
.app-segment-voll a { flex: 1; text-align: center; padding: 9px 10px; font-size: 14px; }

.app-ungelesen .ui-titel { font-weight: 800; }
.app-vorschau { font-size: 14px; color: var(--text); margin: 2px 0 3px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.app-mitteilung { display: flex; flex-direction: column; gap: 10px; }
.app-mitteilung-titel { font-size: 20px; line-height: 1.25; color: var(--titel); }
.app-mitteilung-text { font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; }
.app-mitteilung-text a { color: var(--red-text); }
/* Empfangsweg: persönlich (hervorgehoben) oder über Gruppe */
.app-mitteilung-empfang { align-self: flex-start; font-size: 13px; font-weight: 600; color: var(--muted); background: #f2f2f2;
  border-radius: 999px; padding: 4px 10px; }
.app-mitteilung-empfang small { font-weight: 400; }
.app-mitteilung-persoenlich { color: var(--red-text); background: rgba(154, 0, 0, .08); }
.app-karte-innen { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.app-karte-innen + .app-karte-innen { border-top: 1px solid var(--border); }
.app-mittig { text-align: center; margin-top: 8px; }

/* Vorschau wie auf dem Sperrbildschirm */
.app-sperrbild { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; padding: 12px 14px;
  border-radius: 18px; background: rgba(40, 40, 40, .82); color: #fff; font-size: 14px; line-height: 1.35; box-shadow: var(--shadow-md); }
.app-sperrbild img { border-radius: 9px; flex-shrink: 0; }
.app-sperrbild > div { min-width: 0; flex: 1; }
.app-sperrbild-kopf { display: flex; justify-content: space-between; font-size: 12px; opacity: .75; margin-bottom: 1px; }

/* Zielgruppen-Auswahl */
.app-ziel-gruppe { display: flex; flex-direction: column; gap: 10px; }
.app-ziel-titel { font-size: 14px; font-weight: 700; color: var(--muted); margin-top: 4px; }
.app-details { border: 1.5px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.app-details > summary { cursor: pointer; font-weight: 700; font-size: 15px; list-style-position: inside; }
.app-details[open] > summary { margin-bottom: 4px; }
.app-suche { width: 100%; padding: 9px 11px; border: 1.5px solid var(--border); border-radius: var(--radius); font: inherit; font-size: 16px; }
#personen-liste { display: flex; flex-direction: column; gap: 10px; max-height: 340px; overflow-y: auto; padding: 2px; }
#personen-liste label[hidden] { display: none; }

/* Konto: Push-Status */
.app-push-status { padding: 10px 12px; border-radius: var(--radius); background: var(--st-bg); color: var(--st); border-left: 3px solid var(--st-rand); font-size: 14px; }
.app-push-themen .app-btn { align-self: flex-start; }

/* ══ Bildstreifen „Letzter Einsatz" (Startseite) ═════════════
   Schmal (88 px), damit kein Platz verloren geht: Foto mit Fokuspunkt, links dunkler Verlauf für den Text. */
.app-einsatz {
  position: relative; display: flex; align-items: flex-end; gap: 10px; height: 88px; margin-bottom: 16px;
  border-radius: var(--radius-lg); overflow: hidden; isolation: isolate; color: #fff; text-decoration: none;
  background: var(--anthr); box-shadow: var(--shadow);
}
.app-einsatz img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.app-einsatz::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgba(25, 4, 4, .86) 0%, rgba(25, 4, 4, .55) 55%, rgba(25, 4, 4, .10) 100%),
              linear-gradient(0deg, rgba(0, 0, 0, .35), transparent 60%);
}
.app-einsatz-text { flex: 1; min-width: 0; padding: 0 0 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.app-einsatz-label {
  align-self: flex-start; font-size: 10.5px; font-weight: 800; letter-spacing: .7px; text-transform: uppercase;
  background: var(--red); padding: 2px 7px; border-radius: 4px;
}
.app-einsatz-titel {
  font-size: 15.5px; font-weight: 700; line-height: 1.25; text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.app-einsatz-nr {
  flex-shrink: 0; align-self: flex-start; margin: 10px 10px 0 0; padding: 4px 9px; border-radius: 12px;
  font-size: 11.5px; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .28);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.app-einsatz-nr strong { font-size: 13px; }
.app-einsatz:active { transform: scale(.99); }

/* Anmeldung: letztes Einsatzfoto rot eingefärbt hinter dem Kopfbereich */
.app-kopf-foto {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2;
  filter: grayscale(1) contrast(1.15); mix-blend-mode: multiply; opacity: .75;
}
.app-kopf-hero:has(.app-kopf-foto)::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, var(--kopf) 0, rgba(140, 0, 0, .35) 45%, rgba(90, 0, 0, .55) 100%);
}

/* ══ Seitenwechsel: Sprungmarken & Fokus ═════════════════════
   Ziele von #sprungmarken nicht unter der festen Kopfleiste verstecken; programmatischer Fokus
   (Hauptinhalt/Zielabschnitt nach dem Seitenwechsel) ohne Rahmen, Tastaturfokus sichtbar. */
.app-inhalt [id] { scroll-margin-top: calc(env(safe-area-inset-top) + 84px); }
.app-inhalt:focus, [tabindex="-1"]:focus { outline: none; }
.app-inhalt :focus-visible { outline: 2px solid var(--anthr); outline-offset: 2px; }

/* ══ Formulare ══════════════════════════════════════════════ */
/* Zeile mit Titelbild als weichem Hintergrund rechts (ui_zeile_bild() in intern/includes/ui.php, wie intern) */
.ui-zeile.ui-zeile-bild { position: relative; isolation: isolate; }
.ui-zeile.ui-zeile-bild::before { content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 100%; z-index: -1;
  background: var(--zeile-bild) right 50% / 180% auto no-repeat; opacity: .22; pointer-events: none;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 70%); mask-image: linear-gradient(to right, transparent 0%, #000 70%); }
.ui-zeile.ui-zeile-bild .ui-zeile-status .ui-status { background-clip: padding-box; }
.app-formular-bild { height: 120px; border-radius: var(--radius-lg); margin-bottom: 14px; background: #eee center 45% / cover no-repeat; box-shadow: var(--shadow); }
.app-formular-kopf { display: flex; flex-direction: column; gap: 6px; }
.app-formular-text { font-size: 15px; line-height: 1.6; margin-top: 6px; overflow-wrap: anywhere; }
.app-formular-text img { max-width: 100%; height: auto; }
.app-formular-text a { color: var(--red-text); }
.app-pflicht { color: var(--red-text); }
.app-form-zwischen { font-size: 16px; color: var(--red-text); margin: 8px 0 0; padding-bottom: 4px; border-bottom: 2px solid var(--red-light); }
.app-feld small, .app-feld .app-klein { font-weight: 400; text-transform: none; letter-spacing: 0; }
.app-option { padding: 6px 0; }
.app-option small { display: block; }
/* Datei-Felder: einheitlich als gestrichelte Ablagefläche mit App-Knopf statt des grauen Browser-Knopfs */
.app-inhalt input[type=file]:not(.app-beleg-quelle):not([hidden]) {
  width: 100%; min-height: 56px; padding: 8px; font: inherit; font-size: 14px; color: var(--muted);
  border: 1.5px dashed var(--border); border-radius: var(--radius); background: var(--white); cursor: pointer;
}
.app-inhalt input[type=file]::file-selector-button {
  margin-right: 12px; min-height: 40px; padding: 8px 16px; border: 1px solid var(--red); border-radius: var(--radius);
  background: var(--red-light); color: var(--red-text); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.app-inhalt input[type=file]:focus-visible { outline: 2px solid var(--anthr); outline-offset: 2px; }
.app-suche-liste { margin-bottom: 12px; background: var(--white); color: var(--text); }
.app-segment-auswahl { margin-top: 2px; }
.app-segment-auswahl label { position: relative; }
.app-segment-auswahl input:checked + span { background: var(--red); color: #fff; }
.app-gruppe { display: flex; flex-direction: column; gap: 12px; }
.app-eintraege { display: flex; flex-direction: column; gap: 12px; }
.app-eintrag { border: 1px solid var(--border); border-left: 4px solid var(--red); border-radius: var(--radius); padding: 12px; background: #fcfcfc;
  display: flex; flex-direction: column; gap: 14px; }
.app-eintrag-kopf { display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.app-antwort { grid-template-columns: 1fr; gap: 2px; }
.app-antwort dt { font-size: 13px; margin-top: 8px; }
.app-antwort dd { overflow-wrap: anywhere; }
.app-antwort .app-antwort-zwischen { color: var(--red-text); font-weight: 800; margin-top: 14px; }

/* ══ Mein Profil ════════════════════════════════════════════ */
.app-profil-foto { width: 56px; height: 56px; border-radius: 50%; overflow: hidden; border: 3px solid var(--red); flex-shrink: 0; }
.app-profil-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }   /* Zoom des Bildausschnitts bleibt im Kreis */
.app-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.app-chip-funktion { background: var(--red-light); color: var(--red-text); }
.app-feld-paar-breit { grid-template-columns: 1fr 90px; }
.app-feld-paar-plz { grid-template-columns: 100px 1fr; }
@media (max-width: 420px) { .app-feld-paar-breit { grid-template-columns: 1fr 80px; } .app-feld-paar-plz { grid-template-columns: 90px 1fr; } }
.app-mehr-person { display: flex; flex-direction: column; gap: 0; padding: 0; }
.app-mehr-person .app-mehr-konto { padding: 14px 16px; }
.app-mehr-unterzeile { border-top: 1px solid var(--border); }
.app-avatar-klein { width: 36px; height: 36px; font-size: 16px; margin: 0 6px; background: var(--red-light); }

/* ══ Fehler direkt am Feld ═══════════════════════════════════ */
.app-feld-fehler { display: block; color: var(--st-problem); font-size: 13px; font-weight: 600; text-transform: none; letter-spacing: 0; }
.app-feld-fehler[hidden] { display: none; }
.app-inhalt [aria-invalid="true"]:not(.app-beleg-quelle) { border-color: var(--st-problem-rand) !important; background: var(--st-problem-bg); }
.app-beleg-knopf:has([aria-invalid="true"]) { box-shadow: 0 0 0 2px var(--st-problem-rand); }
.app-fehler-uebersicht ul { margin: 6px 0 4px 18px; display: flex; flex-direction: column; gap: 3px; }
.app-fehler-uebersicht a { color: inherit; text-decoration: underline; }
.app-fehler-uebersicht small { display: block; margin-top: 4px; }
.app-beleg-grenzen { margin: -4px 0 2px; }

/* ══ Absenden: Rückmeldung am Formular ═══════════════════════ */
.app-sende-status { margin-top: 8px; padding: 10px 12px; border-radius: var(--radius); font-size: 14px; font-weight: 600;
  background: var(--st-bg, var(--st-laeuft-bg)); color: var(--st, var(--st-laeuft)); border-left: 3px solid var(--st-rand, var(--st-laeuft-rand)); }
.app-sende-status:empty, .app-sende-status[hidden] { display: none; }

/* ══ Hinweisleiste (z. B. „Keine Verbindung") ═════════════════ */
.app-hinweisleiste {
  position: fixed; z-index: 60; left: 12px; right: 12px; max-width: 680px; margin: 0 auto;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px);
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 12px;
  background: var(--anthr); color: #fff; font-size: 14px; box-shadow: var(--shadow-md);
}
body:not(.app-mit-nav) .app-hinweisleiste { bottom: calc(env(safe-area-inset-bottom) + 12px); }
.app-hinweisleiste[hidden] { display: none; }
.app-hinweisleiste.st-problem { border-left: 4px solid var(--st-problem-rand); }
.app-hinweisleiste > span { flex: 1; }
.app-hinweisleiste button { min-height: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .4);
  background: rgba(255, 255, 255, .12); color: #fff; font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap; }
.app-hinweisleiste .app-hinweisleiste-zu { border: none; background: none; min-width: 44px; padding: 0; font-weight: 400; }

/* ══ Rückfrage-Dialog ════════════════════════════════════════ */
.app-dialog { position: fixed; inset: env(safe-area-inset-top) 0 0 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(0, 0, 0, .45); }
.app-dialog-box { width: 100%; max-width: 400px; background: var(--white); border-radius: 16px; padding: 20px; box-shadow: var(--shadow-md); }
.app-dialog-box h2 { font-size: 18px; color: var(--titel); margin-bottom: 6px; }
.app-dialog-box p { font-size: 15px; color: var(--text); margin-bottom: 16px; }
.app-dialog-knoepfe { display: flex; flex-direction: column; gap: 8px; }

/* ══ Aktualisieren: Knopf in der Kopfleiste + Herunterziehen ═ */
.app-kopf-aktualisieren { width: 44px; height: 44px; margin-right: -10px; flex-shrink: 0; border: none; border-radius: 50%;
  background: none; color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.app-kopf-aktualisieren svg, .app-ziehen svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.app-kopf-aktualisieren:active { background: rgba(255, 255, 255, .18); }
.app-kopf-aktualisieren.dreht svg { animation: app-drehen .8s linear infinite; }
@keyframes app-drehen { to { transform: rotate(360deg); } }
.app-ziehen { position: fixed; z-index: 45; top: 0; left: 50%; width: 40px; height: 40px; border-radius: 50%; opacity: 0;
  transform: translate(-50%, -60px); background: var(--white); color: var(--red-text); box-shadow: var(--shadow-md);
  display: flex; align-items: center; justify-content: center; pointer-events: none; }
.app-ziehen.bereit { background: var(--red); color: #fff; }

/* ══ App installieren / Benachrichtigungen anbieten ══════════ */
.app-installieren { position: relative; margin-bottom: 16px; padding: 14px 44px 14px 16px; border-radius: var(--radius-lg);
  background: var(--white); box-shadow: var(--shadow); border-left: 4px solid var(--red); display: flex; flex-direction: column; gap: 6px; }
.app-installieren[hidden], .app-installieren [hidden] { display: none; }
.app-installieren ol { margin-left: 18px; display: flex; flex-direction: column; gap: 3px; }
.app-installieren-zu { position: absolute; top: 4px; right: 4px; width: 44px; height: 44px; border: none; background: none;
  color: var(--muted); font-size: 16px; cursor: pointer; border-radius: 50%; }
.app-login .app-installieren { margin-top: 18px; }

/* ══ Schnellaktionen (Start) ═════════════════════════════════ */
.app-schnell { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; margin-bottom: 16px; }
.app-schnell-knopf { min-height: 64px; padding: 10px 8px; border-radius: var(--radius-lg); background: var(--white); box-shadow: var(--shadow);
  color: var(--titel); text-decoration: none; font-size: 13.5px; font-weight: 700; line-height: 1.2; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.app-schnell-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--red-light); color: var(--red-text);
  display: inline-flex; align-items: center; justify-content: center; }
.app-schnell-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.app-schnell-knopf:active { transform: scale(.98); }

/* ══ Einklappbare Listen (erledigt / abgelaufen) ═════════════ */
.app-klapp > summary { cursor: pointer; list-style: none; }
.app-klapp > summary::-webkit-details-marker { display: none; }
.app-klapp > summary::after { content: '›'; margin-left: auto; font-size: 20px; line-height: 1; transition: transform .15s; color: var(--muted); }
.app-klapp[open] > summary::after { transform: rotate(90deg); }
.app-klapp:not([open]) > summary { border-bottom: none; }
.app-klapp-summe { font-size: 13px; font-weight: 600; color: var(--muted); }

/* ══ Funktionsmenü: alle Funktionen („Mehr" in der unteren Leiste) ═══════ */
html.app-fmenue-offen, html.app-fmenue-offen body { overflow: hidden; }
/* endet über der unteren Leiste: „Mehr" bleibt sichtbar und schließt das Menü wieder */
/* top: unterhalb der Statusleiste – liegt die Abdunklung über dem oberen Rand, färbt iOS ihn grau (siehe Dateiende) */
.app-fmenue { position: fixed; top: env(safe-area-inset-top); left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); z-index: 140;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, .45); opacity: 0; transition: opacity .28s ease; }
.app-fmenue[hidden] { display: none; }
.app-fmenue.offen { opacity: 1; }
/* Hinein-/Hinausgleiten: Ruhelage unterhalb (hinter der Leiste), offen = an seinem Platz. Dauer = DAUER_MS in app.js */
.app-fmenue-box { width: 100%; max-width: 560px; max-height: calc(100% - 48px - env(safe-area-inset-top)); overflow-y: auto;
  background: var(--white); border-radius: 18px 18px 0 0; padding: 12px 16px 16px; box-shadow: var(--shadow-md);
  transform: translateY(100%); transition: transform .28s cubic-bezier(.4, 0, 1, 1); }
.app-fmenue.offen .app-fmenue-box { transform: none; transition-timing-function: cubic-bezier(.2, .8, .2, 1); }
.app-fmenue-kopf { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 16px; color: var(--titel); }
.app-fmenue-kopf button { width: 44px; height: 44px; margin-right: -10px; border: none; border-radius: 50%; background: none;
  font-size: 20px; color: var(--muted); cursor: pointer; }
.app-fmenue-raster { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.app-fmenue-kachel { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 84px;
  padding: 10px 4px; border-radius: 12px; background: #f4f4f4; color: var(--titel); font-size: 13px; font-weight: 700;
  line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.app-fmenue-kachel:active { background: #e8e8e8; }
.app-fmenue-kachel.aktiv { background: rgba(154, 0, 0, .08); color: var(--red-text); box-shadow: inset 0 0 0 2px rgba(154, 0, 0, .25); }
.app-fmenue-icon { position: relative; display: inline-flex; }
.app-fmenue-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-fmenue-icon .app-zahl { top: -6px; right: -12px; }
/* Gruppen: kleine Überschrift über je einem Kachelraster */
.app-fmenue-gruppe { margin: 14px 2px 6px; font-size: 12px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
/* Personenzeile oben: Name → Mein Profil, Glocke → Konto */
.app-fmenue-person { display: flex; align-items: stretch; gap: 8px; }
.app-fmenue-profil { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px;
  background: var(--flaeche-2); color: var(--titel); }
.app-fmenue-profil .app-avatar-klein { margin: 0; background: var(--red); color: #fff; }
.app-fmenue-profil-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.app-fmenue-profil-text strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-fmenue-profil-text small { font-size: 13px; color: var(--muted); }
.app-fmenue-konto { flex-shrink: 0; width: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 12px; background: var(--flaeche-2); color: var(--titel); font-size: 12px; font-weight: 700; }
.app-fmenue-konto svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-fmenue-profil.aktiv, .app-fmenue-konto.aktiv { box-shadow: inset 0 0 0 2px rgba(154, 0, 0, .3); color: var(--red-text); }
.app-fmenue-fuss { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; font-size: 14px; }
.app-fmenue-fuss a { display: inline-flex; align-items: center; min-height: 44px; color: var(--red-text); font-weight: 600; }
.app-fmenue { overflow: hidden; }   /* gleitet hinter der Leiste hervor, nicht darüber */
@media (min-width: 600px) {
  /* mittig: kurzes Hineingleiten von unten statt über die ganze Höhe */
  .app-fmenue { align-items: center; padding: 16px; }
  .app-fmenue-box { border-radius: 18px; padding-bottom: 16px; transform: translateY(32px) scale(.98); }
  .app-fmenue-raster { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .app-fmenue, .app-fmenue-box { transition: none; }
}

/* ══ Schulungen (schulung.php, schulung_quiz.php, schulung_ergebnis.php) ═══════ */
.app-text-problem { color: var(--st-problem); }
.app-text-warten  { color: var(--st-warten); }
.app-schulung-fortschritt { margin-bottom: 12px; }
.app-schulung-fortschritt-text { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.app-schulung-fortschritt-text span:first-child { font-weight: 700; color: var(--titel); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-schulung-fortschritt-text span:last-child { flex-shrink: 0; }
.app-schulung-balken { position: relative; height: 8px; border-radius: 4px; background: #e6e6e6; overflow: hidden; }
.app-schulung-balken > span { display: block; height: 100%; border-radius: 4px; background: var(--red); transition: width .4s; }
.app-schulung-balken-ergebnis { margin-top: 12px; overflow: visible; }
.app-schulung-balken-ergebnis > span { background: var(--st-problem); }
.app-schulung-balken-ergebnis > i { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--anthr); }
/* Inhalt aus dem Schulungs-Editor: Bilder, Tabellen und Videos dürfen nie aus der Karte ragen */
.app-schulung-inhalt { font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; }
.app-schulung-inhalt > * + * { margin-top: .8em; }
.app-schulung-inhalt h2, .app-schulung-inhalt h3, .app-schulung-inhalt h4 { color: var(--red-text); line-height: 1.3; }
.app-schulung-inhalt ul, .app-schulung-inhalt ol { padding-left: 1.4em; }
.app-schulung-inhalt img, .app-schulung-inhalt video { max-width: 100% !important; height: auto; border-radius: var(--radius); }
.app-schulung-inhalt figure { margin: 0; max-width: 100%; }
.app-schulung-inhalt figure.table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.app-schulung-inhalt table { border-collapse: collapse; min-width: 100%; font-size: 14px; }
.app-schulung-inhalt td, .app-schulung-inhalt th { border: 1px solid #ddd; padding: 6px 8px; vertical-align: top; }
.app-schulung-inhalt blockquote { border-left: 3px solid var(--red); padding-left: 12px; color: var(--muted); }
.app-schulung-inhalt a { color: var(--red-text); text-decoration: underline; }
.app-schulung-bestaetigen { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.app-schulung-frage { border: none; }
/* float: legend sonst auf dem Rahmen der Karte statt darin */
.app-schulung-frage-nr { float: left; width: 100%; font-size: 12px; font-weight: 800; color: var(--red-text); text-transform: uppercase; letter-spacing: .4px; padding: 0; }
.app-schulung-frage-nr + * { clear: both; }
.app-schulung-frage-text { font-size: 16px; font-weight: 700; color: var(--titel); line-height: 1.4; margin: 4px 0 8px; }
.app-schulung-frage-bild { max-height: 260px; width: auto; margin: 6px 0 10px; border-radius: var(--radius); }
.app-schulung-antwort { min-height: 44px; align-items: center; border-top: 1px solid #eee; padding: 8px 0; }
.app-schulung-antwort:has(input:checked) { font-weight: 700; }
.app-schulung-uhr {
  position: sticky; z-index: 40; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px);
  width: max-content; margin: 0 auto 12px; padding: 8px 16px; border-radius: 999px;
  background: var(--anthr); color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; box-shadow: var(--shadow-md);
}
.app-schulung-uhr.knapp { background: var(--st-problem); }
.app-schulung-nachweis { border-top: 5px solid var(--st-ok); text-align: center; }
.app-schulung-nachweis.abgelaufen { border-top-color: var(--st-problem); opacity: .85; }
.app-schulung-nachweis .app-daten { text-align: left; margin-top: 12px; }
.app-schulung-nachweis-kopf { font-size: 18px; font-weight: 800; color: var(--st-ok); margin-bottom: 10px; }
.app-schulung-nachweis-kopf small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.app-schulung-nachweis-name { font-size: 22px; font-weight: 800; color: var(--titel); margin: 4px 0 8px; }
.app-schulung-ergebnis-fehl { border-top: 5px solid var(--st-problem); }
.app-schulung-aufl { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; margin-top: 6px; border-radius: var(--radius);
  background: var(--st-bg); border-left: 3px solid var(--st-rand); }

/* ══ Atemschutzstrecke (atemschutz.php) ═════════════════════ */
.app-atg-gross { display: block; font-size: 17px; color: var(--text); line-height: 1.35; }
.app-atg-anfragen { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; font-size: 15px; }
.app-atg-anfragen .ui-chip { min-width: 72px; text-align: center; margin-right: 6px; }
.app-atg-chip-w { background: var(--st-ok-bg); color: var(--st-ok); }
.app-atg-chip-a { background: var(--st-laeuft-bg); color: var(--st-laeuft); }
.app-atg-aktionen { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.app-atg-termin { display: flex; align-items: center; gap: 14px; }
.app-atg-termin > div { display: flex; flex-direction: column; gap: 2px; }
.app-atg-wahl { gap: 12px; }
.app-atg-schritt { padding: 10px 12px; border-radius: var(--radius); background: var(--st-warten-bg); color: var(--st-warten); font-weight: 700; font-size: 14px; }
.app-atg-schritt.fertig { background: var(--st-ok-bg); color: var(--st-ok); }
.app-atg-karten { display: flex; flex-direction: column; gap: 8px; }
.app-atg-karte { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; text-align: left; cursor: pointer;
  background: var(--white); color: var(--text); border: 2px solid var(--border); border-radius: var(--radius); font: inherit; }
.app-atg-karte-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.app-atg-rolle { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; padding: 3px 8px; border-radius: 10px; }
.app-atg-rolle:empty { display: none; }
.app-atg-karte.ist-wunsch   { border-color: var(--st-ok-rand); background: var(--st-ok-bg); }
.app-atg-karte.ist-ausweich { border-color: var(--st-laeuft-rand); background: var(--st-laeuft-bg); }
.app-atg-karte.ist-wunsch .app-atg-rolle   { background: var(--st-ok); color: var(--white); }
.app-atg-karte.ist-ausweich .app-atg-rolle { background: var(--st-laeuft); color: var(--white); }
.app-atg-karte:focus-visible { outline: 3px solid var(--anthr); outline-offset: 2px; }

/* ══ Kontakte (kontakte.php, kontakt.php) ═══════════════════ */
.app-kontakt-zeile { flex-wrap: nowrap; gap: 10px; padding-top: 8px; padding-bottom: 8px; }
.app-kontakt-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; color: inherit; min-height: 48px; }
.app-kontakt-link .ui-zeile-haupt { display: block; flex: 1; min-width: 0; }
.app-kontakt-icon-inline svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.app-kontakt-foto { width: 46px; height: 46px; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: var(--flaeche-2);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: var(--muted); font-size: 18px; }
.app-kontakt-foto img { width: 100%; height: 100%; object-fit: cover; }
.app-kontakt-schnell { display: flex; gap: 6px; flex-shrink: 0; }
.app-kontakt-schnell a { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--red-light); color: var(--red-text); }
.app-kontakt-schnell svg, .app-kontakt-aktion svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.app-kontakt-buchstabe { padding: 4px 14px; font-size: 13px; font-weight: 800;
  color: var(--muted); background: var(--flaeche-2); border-bottom: 1px solid var(--border); }
.app-kontakt-kopf { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.app-kontakt-kopf .app-kontakt-foto { width: 96px; height: 96px; font-size: 36px; }
.app-kontakt-name { font-size: 22px; font-weight: 800; color: var(--titel); line-height: 1.2; }
.app-kontakt-aktionen { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 8px; width: 100%; margin-top: 6px; }
.app-kontakt-aktion { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px;
  background: var(--red-light); color: var(--red-text); font-size: 12.5px; font-weight: 700; }
.app-kontakt-daten a { overflow-wrap: anywhere; }

/* ══ Freigaben (freigaben.php, freigabe.php) ════════════════ */
.app-freigabe-bilder { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.app-freigabe-bilder img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); background: var(--flaeche-2); }
.app-freigabe-bilder .app-freigabe-titelbild { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.app-freigabe-text { font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.app-freigabe-text img { max-width: 100%; height: auto; }
.app-freigabe-text a { color: var(--red-text); }
.app-freigabe-knoepfe { display: flex; flex-direction: column; gap: 10px; }

/* ══ Installierte App (iOS 26) ═════════════════════════════
   Liegt oben eine feste, einfarbige Leiste (> 10 px, volle Breite), übernimmt iOS deren Farbe für den oberen Rand,
   statt Milchglas-Unschärfe über die Seite zu legen. Die Kopfleiste rückt entsprechend nach unten.
   MUSS am Dateiende stehen: sonst überschreibt die Grundregel .app-kopf { padding: … } den Abstand
   und der Schriftzug verschwindet unter der Leiste. */
@media (display-mode: standalone) {
  .app-statusleiste { height: max(14px, env(safe-area-inset-top)); z-index: 250; }
  /* Abdunklungen (Funktionsmenü, Rückfrage) beginnen unter der Statusleiste: der obere Rand bleibt einfarbig rot */
  .app-fmenue, .app-dialog { top: max(14px, env(safe-area-inset-top)); }
  .app-kopf { padding-top: calc(max(14px, env(safe-area-inset-top)) + 10px); }
}

/* Mitteilung: Empfänger zuerst „An alle" oder „Auswählen" – die Gruppen erscheinen nur bei „Auswählen"
   (ohne :has()-Unterstützung bleiben sie einfach immer sichtbar) */
.app-ziel-modus { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.app-ziel-option { position: relative; cursor: pointer; }
.app-ziel-option input { position: absolute; opacity: 0; pointer-events: none; }
.app-ziel-option span { display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: 15px; }
.app-ziel-option small { font-size: 12px; color: var(--muted); }
.app-ziel-option input:checked + span { border-color: var(--red); background: rgba(154, 0, 0, .06); box-shadow: inset 0 0 0 1px var(--red); }
.app-ziel-option input:checked + span strong::before { content: '✓ '; color: var(--red-text); }
.app-ziel-option input:focus-visible + span { outline: 2px solid var(--anthr); outline-offset: 2px; }
.app-ziel-auswahl { display: flex; flex-direction: column; gap: 12px; }
.app-ziel:not(:has(input[value="auswahl"]:checked)) .app-ziel-auswahl { display: none; }
.ui-meta .ui-chip { align-self: center; }
/* Mitteilungen: Umschalter „Ordnen: Neueste | Absender | Empfänger" */
.app-gruppierung { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.app-gruppierung .app-segment { background: var(--white); }

/* Mitteilung: Rückmeldung – große Antwort-Knöpfe; gewählte Antwort gefüllt, die anderen zurückhaltend */
.app-antwort { display: flex; flex-direction: column; gap: 10px; }
.app-antwort.st-warten { border-left: 4px solid var(--st-rand); }
.app-antwort-knoepfe { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.app-antwort-knopf { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 64px; padding: 10px 6px;
  border: 2px solid var(--st-rand); border-radius: var(--radius); background: var(--st-bg); color: var(--st); font: inherit; font-size: 15px; font-weight: 700;
  line-height: 1.2; text-align: center; cursor: pointer; }
.app-antwort-knopf span { font-size: 22px; }
.app-antwort-knopf.aktiv { background: var(--st); border-color: var(--st); color: #fff; box-shadow: var(--shadow-md); }
.app-antwort-knoepfe:has(.aktiv) .app-antwort-knopf:not(.aktiv) { opacity: .7; }
.app-antwort-knopf:focus-visible { outline: 3px solid var(--anthr); outline-offset: 2px; }
.app-rm-modus { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.app-rm-optionen { display: flex; flex-direction: column; gap: 10px; }
.app-rm:has(input[name="rm"][value=""]:checked) .app-rm-optionen { display: none; }
.app-rm:not(:has(input[name="rm"][value="zusage"]:checked)) .app-rm-vielleicht { display: none; }

/* Mitteilung: Anhänge – Fotos als Kacheln, PDFs als Zeilen; Formularfeld mit „behalten"-Haken */
.mi-anhaenge { display: flex; flex-direction: column; gap: 8px; }
.mi-anhang-bilder { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.mi-anhang-bilder a { display: block; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: #f2f2f2; }
.mi-anhang-bilder img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mi-anhang-datei { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius);
  color: var(--text); background: var(--white); min-width: 0; }
.mi-anhang-datei > span:first-child { font-size: 20px; }
.mi-anhang-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.mi-anhang-datei small { color: var(--muted); white-space: nowrap; }
.mi-anhang-zeichen { font-size: 13px; font-weight: 400; }
.mi-anhang-feld { display: flex; flex-direction: column; gap: 8px; }
.mi-anhang-behalten { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.mi-anhang-behalten input { width: 22px; height: 22px; accent-color: var(--red); flex-shrink: 0; }
.mi-anhang-behalten small, .mi-anhang-hinweis { display: block; font-size: 13px; color: var(--muted); }

/* Personalplanung (dienst.php): Dienst-Karten mit Statusstreifen, Personen als Chips bzw. für Verwalter aufklappbar */
.pp-app-absage { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.pp-app-dienst { border-left: 4px solid var(--st-rand, var(--border)); }
.pp-app-dienst-kopf { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.pp-app-dienst-kopf strong { font-size: 16px; }
.pp-app-aktion { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pp-app-person { flex-basis: 100%; border: 1.5px solid var(--st-ok-rand); background: var(--st-ok-bg); border-radius: var(--radius); }
.pp-app-person.pp-app-warte { border-style: dashed; border-color: var(--st-laeuft-rand); background: var(--st-laeuft-bg); }
.pp-app-person.pp-app-konflikt { border-color: var(--st-problem-rand); background: var(--st-problem-bg); }
.pp-app-person > summary { padding: 10px 12px; cursor: pointer; font-weight: 600; min-height: 44px; }
.pp-app-person-aktionen { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 10px; }
.pp-app-zeile { display: flex; flex-direction: column; gap: 8px; }
.pp-app-dazu > summary { cursor: pointer; color: var(--red-text); font-weight: 700; font-size: 14px; padding: 6px 0; }
.pp-app-dazu form { margin-top: 8px; }
/* Personalplanung: „Hier bist du eingetragen" – nach Tagen gegliedert, je Dienst Uhrzeit | Dienst */
.ui-liste:has(.pp-meine) { gap: 12px; padding: 12px; background: var(--st-neutral-bg); }   /* jede Veranstaltung eine eigene Karte */
.ui-zeile:has(.pp-meine) { align-items: flex-start; border: 1px solid var(--border); border-left: 4px solid var(--st-rand, var(--border)); border-radius: var(--radius); box-shadow: var(--shadow); }
.ui-zeile:has(.pp-meine):last-child { border-bottom: 1px solid var(--border); }
.ui-zeile:has(.pp-meine) .ui-titel { font-size: 16px; }
.pp-meine { flex-basis: 100%; min-width: 0; display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.pp-mein-tag-kopf { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding-bottom: 4px; margin-bottom: 6px; border-bottom: 2px solid var(--red); }
.pp-mein-tag-kopf strong { font-size: 16px; font-weight: 800; color: var(--red-text); }
.pp-mein-tag-kopf span { font-size: 13px; color: var(--muted); }
.pp-mein-tag-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pp-mein { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px 0; border-top: 1px solid var(--border); }
.pp-mein:first-child { border-top: none; }
.pp-mein-ohne-zeit { grid-template-columns: minmax(0, 1fr); }
.pp-mein-warte .ui-chip { background: var(--st-laeuft-bg); color: var(--st-laeuft); }
.pp-mein-zeit { font-size: 15px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.pp-mein-was { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; }
.pp-mein-dienst { font-size: 15px; font-weight: 600; color: var(--text); }
.pp-mein-zusatz { font-size: 13px; color: var(--muted); }
.pp-mein-was .ui-chip { margin-top: 3px; }
/* Bemerkung zu Tag, Schicht oder Dienst (z. B. Treffpunkt): dezente Zusatzzeile */
.pp-bem { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.app-abschnitt + .pp-bem { margin: -6px 2px 10px; }
.ui-block > .pp-bem { margin: 10px 16px 0; }
.pp-mein-tag-kopf + .pp-bem { margin-bottom: 6px; }
.pp-mein .pp-bem { margin-top: 2px; }
.pp-stern { color: var(--st-warten-rand); font-weight: 700; }
/* Personalplanung: Plan mit einem Feld je Platz */
.pp-app-einladung { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--red-light, #f8e8e8); color: var(--red-text); font-weight: 600; font-size: 14px; }
.pp-app-plaetze { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pp-app-plaetze form { margin: 0; }
.pp-app-plaetze .pp-app-person, .pp-app-warte-kopf { grid-column: 1 / -1; }
.pp-app-platz { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; min-height: 44px; padding: 6px 10px;
  border-radius: var(--radius); font: inherit; font-size: 14px; text-align: left; }
.pp-app-platz-belegt { background: var(--st-ok-bg); border: 1.5px solid var(--st-ok-rand); font-weight: 600; }
.pp-app-platz-belegt small { font-weight: 400; color: var(--muted); }
.pp-app-platz-belegt.pp-app-warte { background: var(--st-laeuft-bg); border-color: var(--st-laeuft-rand); border-style: dashed; }
.pp-app-platz-du { background: var(--st-ok); border-color: var(--st-ok); color: #fff; }
.pp-app-platz-weg { background: rgba(255,255,255,.25); border: none; color: inherit; width: 32px; height: 32px; border-radius: 50%; font-size: 14px; }
.pp-app-platz-frei { justify-content: flex-start; background: var(--white); border: 2px dashed var(--st-warten-rand); color: var(--st-warten); font-weight: 700; }
.pp-app-platz-frei span { font-size: 18px; }
.pp-app-platz-zu { justify-content: center; border-color: var(--border); color: var(--muted); font-weight: 400; }
.pp-app-warte-kopf { font-size: 12px; font-weight: 700; color: var(--st-laeuft); margin-top: 4px; }
/* Personalplanung: Popup nach dem Eintragen (<dialog open> – schließt ohne JavaScript über method="dialog") */
.pp-app-popup { position: fixed; inset: 0; margin: auto; z-index: 300; width: min(380px, calc(100% - 32px)); height: fit-content; border: none; border-radius: 16px;
  padding: 0; text-align: center; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45), 0 10px 40px rgba(0,0,0,.3); }
.pp-app-popup form { padding: 24px 20px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pp-app-popup-icon { font-size: 42px; width: 74px; height: 74px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--st-laeuft-bg); }
.pp-app-popup-ok .pp-app-popup-icon { background: var(--st-ok-bg); }
.pp-app-popup-fehler .pp-app-popup-icon { background: var(--st-problem-bg); }
.pp-app-popup strong { font-size: 19px; color: var(--red-text); }
.pp-app-popup-ok strong { color: var(--st-ok); }
.pp-app-popup p { margin: 0; line-height: 1.5; }
/* Personalplanung: Anmeldung („Bist du dabei?" mit Begleitpersonen) */
.pp-app-anm-status { font-size: 17px; color: var(--st-ok); margin-bottom: 12px; }
.pp-app-anm .app-hinweis { margin-top: 10px; }
.pp-app-anm-person { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.pp-app-anm-person:last-child { border-bottom: none; }
.pp-app-anm-person small { color: var(--st-ok); font-weight: 700; white-space: nowrap; }

/* ══ Dark Mode: feste Hell-Töne der einzelnen Bausteine (Tokens oben in :root) ══ */
@media (prefers-color-scheme: dark) {
  .app-nav { background: var(--nav-bg); }
  .app-nav-btn, .app-leiste-vorschau-knopf { color: #9d9d9d; }
  a.ui-zeile:active, .app-res:active { background: var(--flaeche-2); }
  .app-check-box, .app-kommentar, .app-mitteilung-empfang, .mi-anhang-bilder a,
  .app-beleg img, .app-beleg-icon, .app-beleg-weg, .ui-thumb, .ui-thumb-leer, .app-res-bild, .app-formular-bild { background-color: var(--flaeche-2); }
  .ui-chip { background: var(--flaeche-2); color: var(--text); }
  .app-fmenue-kachel { background: var(--flaeche-2); }
  .app-fmenue-kachel:active { background: #333; }
  .app-eintrag { background: var(--white); }
  .app-termin-hervor { background: #2a2416; }
  .app-sonderzeile { background: #191919; }
  .app-sonder-ferien { background: #29260f; }
  .app-sonder-feiertag { background: #2e1717; }
  .app-schulung-balken { background: #333; }
  .app-schulung-inhalt td, .app-schulung-inhalt th { border-color: var(--border); }
  .app-schulung-antwort { border-top-color: var(--border); }
  .app-hero-kachel-warten { background: var(--white); border-color: var(--white); }
  .app-hinweisleiste { background: #2f2f2f; border: 1px solid #444; }
  .pp-app-popup { background: var(--white); color: var(--text); }
  /* Statusfarbe als Fläche: helle Töne → dunkle Schrift */
  .ui-zaehler, .app-antwort-knopf.aktiv, .pp-app-platz-du, .app-res-schild, .app-laeuft-chip, .app-schulung-uhr.knapp,
  .app-segment-gross input:checked + span { color: #141414; }
  .app-res-schild::before { background: #141414; }
  .ui-datum-monat { background: var(--st, #bdbdbd); color: #141414; }
  .app-termin .ui-datum-monat { color: #fff; }   /* Abteilungsfarben sind kräftig – weiße Schrift bleibt */
  .app-abt-name { filter: brightness(1.6); }       /* Abteilungsfarbe als Schrift auf dunklem Grund aufhellen */
  .ui-zeile.ui-zeile-bild::before { opacity: .12; }
  .app-sperrbild { background: rgba(60, 60, 60, .9); }
}

/* ── Wischen in Listen (app_wisch() in includes/layout.php, Verhalten: app.js „Wischen in Listen") ── */
.app-wisch { position: relative; overflow: hidden; }
.app-wisch > .ui-zeile { position: relative; z-index: 1; touch-action: pan-y; transition: transform .22s ease; }
.app-wisch:not(:last-child) > .ui-zeile { border-bottom: 1px solid var(--border); }   /* Trennlinie trotz Hülle */
.app-wisch:has(.pp-meine) { border-radius: var(--radius); }
.app-wisch:last-child > .ui-zeile:not(:has(.pp-meine)) { border-bottom: none; }
.app-wisch-links, .app-wisch-rechts { position: absolute; top: 0; bottom: 0; z-index: 0; display: flex; visibility: hidden; }
.app-wisch-links { left: 0; }
.app-wisch-rechts { right: 0; }
.app-wisch.wischt-l > .app-wisch-links, .app-wisch.offen-l > .app-wisch-links,
.app-wisch.wischt-r > .app-wisch-rechts, .app-wisch.offen-r > .app-wisch-rechts { visibility: visible; }
.app-wisch-form { display: flex; margin: 0; }
.app-wisch-knopf { width: 86px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 4px;
  border: 0; border-radius: 0; color: #fff; font: inherit; font-size: 21px; line-height: 1; text-align: center; text-decoration: none; cursor: pointer; }
.app-wisch-knopf small { font-size: 12px; font-weight: 700; line-height: 1.2; }
.app-wisch-ok   { background: #2e7d32; }  .app-wisch-ok:active   { background: #1f5c23; }
.app-wisch-blau { background: #1f4e9c; }  .app-wisch-blau:active { background: #173b77; }
.app-wisch-warn { background: #b26a00; }  .app-wisch-warn:active { background: #8a5200; }
.app-wisch-rot  { background: #c62828; }  .app-wisch-rot:active  { background: #a31515; }
.app-wisch-knopf.laedt { opacity: .7; }
@media (prefers-reduced-motion: reduce) { .app-wisch > .ui-zeile { transition: none; } }
