/* ============================================================================
   Erdacht und programmiert von Fabian Hammer, Spessartweg 10, 84048 Mainburg, Deutschland.
   (c) 2026 Fabian Hammer - Alle Rechte vorbehalten. Geistiges Eigentum.
   ============================================================================
   Grundstil der FAH-NAS-Oberfläche: Variablen (hell/dunkel), Rahmen, Basisklassen. Handy zuerst. */

/* ------------------------------------------------------------------ Variablen */
:root {
  --fahnas-hintergrund: #f3f5f7;
  --fahnas-flaeche: #ffffff;
  --fahnas-flaeche-2: #eaeef1;
  --fahnas-text: #1b2228;
  --fahnas-text-schwach: #5b6770;
  /* Kontraste WCAG AA (≥ 4,5:1 für Text): Akzent auf Weiß 5,7:1, Akzent-Text auf Akzent 5,7:1, „auf-hell“ = Textfarbe
     auf --fahnas-akzent-hell (Plakette, aktiver Navigationspunkt); Gefahr-Text = Schrift auf Gefahr-Knöpfen. Geprüft in
     tests/einheit/ui_fixes.test.js (Kontrastrechner). */
  --fahnas-akzent: #0b7272;
  --fahnas-akzent-dunkel: #085858;
  --fahnas-akzent-hell: #d8efef;
  --fahnas-akzent-text: #ffffff;
  --fahnas-akzent-auf-hell: #085858;
  --fahnas-gefahr: #c62828;
  --fahnas-gefahr-dunkel: #a31f1f;
  --fahnas-gefahr-hell: #fbe3e3;
  --fahnas-gefahr-text: #ffffff;
  --fahnas-warnung: #8a5200;
  --fahnas-warnung-hell: #fff1d6;
  --fahnas-erfolg: #276b2b;
  --fahnas-erfolg-hell: #e1f2e2;
  --fahnas-rand: #d9dee3;
  --fahnas-radius: 12px;
  --fahnas-radius-klein: 8px;
  --fahnas-abstand: 16px;
  --fahnas-schatten: 0 1px 2px rgba(20, 30, 40, 0.06), 0 4px 14px rgba(20, 30, 40, 0.05);
  --fahnas-fokus: #0b7272;
  --fahnas-kopf-hoehe: 56px;
  --fahnas-nav-hoehe: 64px;
  --fahnas-nav-breite: 224px;
  --fahnas-schrift: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fahnas-schrift-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-design="hell"]) {
    --fahnas-hintergrund: #1c1f23;
    --fahnas-flaeche: #262a30;
    --fahnas-flaeche-2: #2f343b;
    --fahnas-text: #e8eaed;
    --fahnas-text-schwach: #a3acb5;
    --fahnas-akzent: #35b3b3;
    --fahnas-akzent-dunkel: #2a9a9a;
    --fahnas-akzent-hell: #1f3a3c;
    --fahnas-akzent-text: #0f1a1a;
    --fahnas-akzent-auf-hell: #5ad0d0;
    --fahnas-gefahr: #ef6b6b;
    --fahnas-gefahr-dunkel: #f58a8a;
    --fahnas-gefahr-hell: #3d2426;
    --fahnas-gefahr-text: #1a0b0b;
    --fahnas-warnung: #e6a23c;
    --fahnas-warnung-hell: #3c3121;
    --fahnas-erfolg: #6cc070;
    --fahnas-erfolg-hell: #223a25;
    --fahnas-rand: #3a4048;
    --fahnas-schatten: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.25);
    --fahnas-fokus: #5ad0d0;
    color-scheme: dark;
  }
}

:root[data-design="dunkel"] {
  --fahnas-hintergrund: #1c1f23;
  --fahnas-flaeche: #262a30;
  --fahnas-flaeche-2: #2f343b;
  --fahnas-text: #e8eaed;
  --fahnas-text-schwach: #a3acb5;
  --fahnas-akzent: #35b3b3;
  --fahnas-akzent-dunkel: #2a9a9a;
  --fahnas-akzent-hell: #1f3a3c;
  --fahnas-akzent-text: #0f1a1a;
  --fahnas-akzent-auf-hell: #5ad0d0;
  --fahnas-gefahr: #ef6b6b;
  --fahnas-gefahr-dunkel: #f58a8a;
  --fahnas-gefahr-hell: #3d2426;
  --fahnas-gefahr-text: #1a0b0b;
  --fahnas-warnung: #e6a23c;
  --fahnas-warnung-hell: #3c3121;
  --fahnas-erfolg: #6cc070;
  --fahnas-erfolg-hell: #223a25;
  --fahnas-rand: #3a4048;
  --fahnas-schatten: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.25);
  --fahnas-fokus: #5ad0d0;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ Grundlagen */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100%;
  font-family: var(--fahnas-schrift); font-size: 15px; line-height: 1.45;
  color: var(--fahnas-text); background: var(--fahnas-hintergrund);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0 0 8px; line-height: 1.25; font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 8px; }
a { color: var(--fahnas-akzent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg, video, canvas { max-width: 100%; }
code, pre, .mono { font-family: var(--fahnas-schrift-mono); font-size: 0.92em; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--fahnas-fokus); outline-offset: 2px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

.springen { position: absolute; left: 8px; top: -60px; z-index: 100; padding: 8px 12px; background: var(--fahnas-flaeche); border-radius: var(--fahnas-radius-klein); box-shadow: var(--fahnas-schatten); }
.springen:focus { top: 8px; }

.symbol { width: 22px; height: 22px; flex: 0 0 auto; fill: none; stroke: currentColor; vertical-align: middle; }
.symbol.klein { width: 16px; height: 16px; }
.symbol.gross { width: 44px; height: 44px; }
.symbol.riesig { width: 64px; height: 64px; }

/* ------------------------------------------------------------------ Rahmenaufbau */
.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

.kopfzeile {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: var(--fahnas-kopf-hoehe); padding: 0 var(--fahnas-abstand);
  background: var(--fahnas-flaeche); border-bottom: 1px solid var(--fahnas-rand);
}
.kopf-marke { display: flex; align-items: center; gap: 10px; color: var(--fahnas-text); font-weight: 600; min-width: 0; }
.kopf-marke:hover { text-decoration: none; }
.kopf-logo { width: 28px; height: 28px; border-radius: 7px; flex: 0 0 auto; }
.kopf-hostname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kopf-rechts { display: flex; align-items: center; gap: 4px; min-width: 0; }
.kopf-nutzer { display: flex; align-items: center; gap: 6px; color: var(--fahnas-text-schwach); padding: 0 6px; min-width: 0; }
.kopf-nutzer-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.kopf-rolle { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; padding: 1px 7px; border-radius: 999px; background: var(--fahnas-akzent-hell); color: var(--fahnas-akzent-auf-hell); }

.inhalt { flex: 1 1 auto; padding: var(--fahnas-abstand); padding-bottom: calc(var(--fahnas-nav-hoehe) + var(--fahnas-abstand) + env(safe-area-inset-bottom, 0px)); min-width: 0; outline: none; }
.ansicht { max-width: 1280px; margin: 0 auto; }
.ansicht-kopf { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: var(--fahnas-abstand); }
.ansicht-kopf h1 { margin: 0; }
.ansicht-werkzeuge { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Navigation: Handy unten */
.navigation {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--fahnas-flaeche); border-top: 1px solid var(--fahnas-rand);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.navigation-liste { list-style: none; margin: 0; padding: 0; display: flex; justify-content: space-around; }
.navigation-punkt { flex: 1 1 0; min-width: 0; }
.navigation-eintrag {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--fahnas-nav-hoehe); padding: 6px 2px; color: var(--fahnas-text-schwach); font-size: 0.7rem;
  border-radius: var(--fahnas-radius-klein);
}
.navigation-eintrag:hover { text-decoration: none; color: var(--fahnas-text); }
.navigation-eintrag[aria-current="page"] { color: var(--fahnas-akzent-auf-hell); font-weight: 600; }
.navigation-text { max-width: 100%; text-align: center; line-height: 1.05; overflow-wrap: anywhere; hyphens: auto; -webkit-hyphens: auto; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.navigation-fuss { display: none; }
/* Ungelesen-Abzeichen (Chat): am Handy oben rechts am Symbol, am Rechner rechts in der Zeile */
.navigation-eintrag { position: relative; }
.navigation-abzeichen {
  position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--fahnas-akzent); color: var(--fahnas-akzent-text); font-size: 0.68rem; font-weight: 700; line-height: 18px; text-align: center;
}
/* Gruppen (12.10.2026): am Handy Gruppenknopf mit aufklappender Liste, am Rechner Überschrift + Punkte */
.navigation-gruppe { flex: 1 1 0; min-width: 0; position: relative; }
.navigation-gruppe-titel { display: none; }
.navigation-gruppe-knopf { width: 100%; background: none; border: 0; font: inherit; font-size: 0.7rem; cursor: pointer; }
.navigation-gruppe.aktiv > .navigation-gruppe-knopf { color: var(--fahnas-akzent-auf-hell); font-weight: 600; }
.navigation-unterliste { display: none; list-style: none; margin: 0; padding: 6px; }
.navigation-gruppe.offen > .navigation-unterliste {
  display: flex; flex-direction: column; gap: 2px; position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); min-width: 172px;
  background: var(--fahnas-flaeche); border: 1px solid var(--fahnas-rand); border-radius: var(--fahnas-radius); box-shadow: var(--fahnas-schatten); z-index: 40;
}
.navigation-gruppe:first-of-type.offen > .navigation-unterliste { left: 0; transform: none; }
.navigation-gruppe:last-of-type.offen > .navigation-unterliste { left: auto; right: 0; transform: none; }
.navigation-unterliste .navigation-eintrag { flex-direction: row; justify-content: flex-start; gap: 10px; height: 44px; padding: 0 12px; font-size: 0.92rem; }
.navigation-unterliste .navigation-eintrag[aria-current="page"] { background: var(--fahnas-akzent-hell); }
/* Favoriten (13.11.2026): unter „Dateien“, aufklappbar. Handy-Leiste: nur im aufgeklappten Daten-Menü. */
.navigation-favoriten-punkt { display: none; }
.navigation-unterliste .navigation-favoriten-punkt { display: block; }
.navigation-favoriten-knopf { width: 100%; background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.navigation-favoriten .navigation-text { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; hyphens: manual; -webkit-hyphens: manual; text-align: left; }
.navigation-favoriten-pfeil { width: 14px; height: 14px; margin-left: auto; flex: none; transition: transform 0.15s ease; }
.navigation-favoriten-knopf[aria-expanded="true"] .navigation-favoriten-pfeil { transform: rotate(90deg); }
.navigation-favoriten-zahl { font-size: 0.72rem; color: var(--fahnas-text-schwach); background: var(--fahnas-rand); border-radius: 9px; padding: 0 6px; line-height: 18px; }
.navigation-favoriten-liste { list-style: none; margin: 0; padding: 0 0 2px 22px; display: flex; flex-direction: column; gap: 1px; }
.navigation-favoriten-liste[hidden] { display: none; }
.navigation-favoriten-liste .navigation-eintrag { flex-direction: row; justify-content: flex-start; gap: 10px; height: 34px; padding: 0 10px; font-size: 0.88rem; }
.navigation-favoriten-liste .navigation-eintrag .symbol { width: 16px; height: 16px; }
.navigation-favoriten-leer { padding: 6px 10px; font-size: 0.8rem; color: var(--fahnas-text-schwach); line-height: 1.3; }

body.solo .kopfzeile, body.solo .navigation { display: none; }
body.solo .inhalt { padding-bottom: var(--fahnas-abstand); display: flex; align-items: center; justify-content: center; }
.solo-ansicht { width: 100%; max-width: 440px; }
.solo-notfall { max-width: 440px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
/* Ordnerwahl (V8): Ordnerbaum, im Dateimanager und im Chat */
.dateien-baum { list-style: none; margin: 0; padding: 0; max-height: 45vh; overflow: auto; border: 1px solid var(--fahnas-rand); border-radius: var(--fahnas-radius-klein); }
.dateien-baum ul { list-style: none; margin: 0; padding-left: 18px; }
.dateien-baum-zeile { display: flex; align-items: center; gap: 4px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.dateien-baum-zeile:hover { background: var(--fahnas-flaeche-2); }
.dateien-baum-zeile[aria-selected="true"] { background: var(--fahnas-akzent-hell); font-weight: 600; }
.dateien-baum-zeile .symbol { width: 18px; height: 18px; color: var(--fahnas-akzent); }
.dateien-baum-auf { background: none; border: 0; padding: 0; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; color: var(--fahnas-text-schwach); border-radius: 4px; cursor: pointer; }
.dateien-baum-auf .symbol { width: 14px; height: 14px; color: inherit; transition: transform 0.12s; }
.dateien-baum-auf[aria-expanded="true"] .symbol { transform: rotate(90deg); }
.dateien-baum-platz { display: inline-block; width: 22px; }
.dateien-baum-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dateien-ziel { margin-top: 8px; font-size: 0.9rem; }
.ordnerwahl-gesperrt { opacity: 0.55; cursor: not-allowed; }
.ordnerwahl-gesperrt[aria-selected="true"] { background: var(--fahnas-flaeche-2); }
.ordnerwahl-hinweis { margin-top: 6px; }
/* Handy-Meldungen (V9): QR-Code für die ntfy-App */
.handy-qr { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.handy-qr-bild { display: block; width: 200px; max-width: 100%; height: auto; image-rendering: pixelated; border-radius: var(--fahnas-radius-klein); }
.handy-adresse { overflow-wrap: anywhere; font-size: 0.85rem; }
.solo-notfall .symbol { color: var(--fahnas-warnung); }

/* Zustandsleiste */
.zustandsleiste {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px var(--fahnas-abstand);
  background: var(--fahnas-warnung-hell); color: var(--fahnas-text); border-bottom: 1px solid var(--fahnas-rand);
  position: sticky; top: 0; z-index: 31;
}
.zustandsleiste .symbol { color: var(--fahnas-warnung); margin-top: 2px; }
.zustandsleiste-text { display: flex; flex-direction: column; gap: 2px; font-size: 0.92rem; }
.zustandsleiste-hinweis { color: var(--fahnas-text-schwach); }
.zustandsleiste ~ .kopfzeile { top: auto; position: relative; }

/* Laden */
.laden { display: flex; align-items: center; gap: 10px; color: var(--fahnas-text-schwach); padding: 24px 0; justify-content: center; }
.laden-kreis { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--fahnas-rand); border-top-color: var(--fahnas-akzent); animation: drehen 0.9s linear infinite; }
@keyframes drehen { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ Basisklassen */
.karte {
  background: var(--fahnas-flaeche); border: 1px solid var(--fahnas-rand); border-radius: var(--fahnas-radius);
  padding: var(--fahnas-abstand); box-shadow: var(--fahnas-schatten);
}
.karte + .karte { margin-top: var(--fahnas-abstand); }
.karte-kopf { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.karte-kopf h2, .karte-kopf h3 { margin: 0; }

.kachel {
  background: var(--fahnas-flaeche); border: 1px solid var(--fahnas-rand); border-radius: var(--fahnas-radius);
  padding: 14px var(--fahnas-abstand); box-shadow: var(--fahnas-schatten); display: flex; flex-direction: column; gap: 8px; min-width: 0;
}
.kachel-kopf { display: flex; align-items: center; gap: 8px; color: var(--fahnas-text-schwach); font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.kachel-kopf .symbol { color: var(--fahnas-akzent); width: 18px; height: 18px; }
.kachel-wert { font-size: 1.7rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kachel-neben { color: var(--fahnas-text-schwach); font-size: 0.88rem; }
.kachel-fuss { color: var(--fahnas-text-schwach); font-size: 0.85rem; margin-top: auto; }
.kachel > .leer { margin: auto 0; }
.kachel.warnung { border-color: var(--fahnas-warnung); }
.kachel.warnung .kachel-wert { color: var(--fahnas-warnung); }
.kachel.gefahr { border-color: var(--fahnas-gefahr); }
.kachel.gefahr .kachel-wert { color: var(--fahnas-gefahr); }
a.kachel { color: inherit; }
a.kachel:hover { text-decoration: none; border-color: var(--fahnas-akzent); }

.raster { display: grid; grid-template-columns: 1fr; gap: var(--fahnas-abstand); }

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--fahnas-radius-klein);
  border: 1px solid transparent; background: var(--fahnas-akzent); color: var(--fahnas-akzent-text);
  font-weight: 600; text-decoration: none; white-space: nowrap; user-select: none;
  transition: background 0.12s, border-color 0.12s;
}
.knopf:hover { background: var(--fahnas-akzent-dunkel); text-decoration: none; }
.knopf:disabled, .knopf[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.knopf .symbol { width: 18px; height: 18px; }
.knopf-zweit { background: var(--fahnas-flaeche); color: var(--fahnas-text); border-color: var(--fahnas-rand); }
.knopf-zweit:hover { background: var(--fahnas-flaeche-2); }
.knopf-gefahr { background: var(--fahnas-gefahr); color: var(--fahnas-gefahr-text); }
.knopf-gefahr:hover { background: var(--fahnas-gefahr-dunkel); filter: none; }
.knopf-zweit.knopf-gefahr { background: var(--fahnas-flaeche); color: var(--fahnas-gefahr); border-color: var(--fahnas-gefahr); }
.knopf-zweit.knopf-gefahr:hover { background: var(--fahnas-gefahr-hell); }
.knopf-klein { min-height: 32px; padding: 4px 10px; font-size: 0.88rem; }
.knopf-symbol {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0;
  border: 1px solid transparent; border-radius: var(--fahnas-radius-klein); background: transparent; color: var(--fahnas-text-schwach);
}
.knopf-symbol:hover { background: var(--fahnas-flaeche-2); color: var(--fahnas-text); }
.knopf-symbol:disabled { opacity: 0.4; cursor: not-allowed; }
.knopf-symbol.aktiv { color: var(--fahnas-akzent-auf-hell); background: var(--fahnas-akzent-hell); }
.knopf-reihe { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.feld { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.feld-beschriftung, .feld > label:first-child { font-weight: 600; font-size: 0.92rem; }
.eingabe, .feld input:not([type="checkbox"]):not([type="radio"]), .feld select, .feld textarea, select.eingabe {
  width: 100%; min-height: 40px; padding: 8px 12px; border-radius: var(--fahnas-radius-klein);
  border: 1px solid var(--fahnas-rand); background: var(--fahnas-flaeche); color: var(--fahnas-text);
}
.eingabe:focus, .feld input:focus, .feld select:focus, .feld textarea:focus { border-color: var(--fahnas-akzent); outline: 2px solid var(--fahnas-fokus); outline-offset: 0; }
.eingabe-klein { min-height: 34px; padding: 4px 10px; font-size: 0.9rem; width: auto; }
.erklaerung { color: var(--fahnas-text-schwach); font-size: 0.85rem; margin: 0; }
.feld-fehler { color: var(--fahnas-gefahr); font-size: 0.85rem; margin: 0; }

.schalter { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; margin-bottom: 14px; }
.schalter-beschriftung { font-weight: 600; font-size: 0.92rem; }
.schalter .erklaerung { grid-column: 1; }
.schalter input[type="checkbox"] { grid-column: 2; grid-row: 1 / span 2; appearance: none; width: 44px; height: 26px; margin: 0; border-radius: 999px; background: var(--fahnas-rand); position: relative; cursor: pointer; transition: background 0.15s; }
.schalter input[type="checkbox"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #ffffff; box-shadow: 0 1px 2px rgba(0,0,0,0.3); transition: transform 0.15s; }
.schalter input[type="checkbox"]:checked { background: var(--fahnas-akzent); }
.schalter input[type="checkbox"]:checked::after { transform: translateX(18px); }
.schalter input[type="checkbox"]:disabled { opacity: 0.5; cursor: not-allowed; }

.tabelle { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.tabelle th, .tabelle td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--fahnas-rand); vertical-align: middle; }
.tabelle th { color: var(--fahnas-text-schwach); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
.tabelle tbody tr:hover { background: var(--fahnas-flaeche-2); }
.tabelle tbody tr:focus-visible { outline: 2px solid var(--fahnas-fokus); outline-offset: -2px; }
.tabelle tbody tr[aria-selected="true"] { background: var(--fahnas-akzent-hell); }
.tabelle .zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabelle .schmal { width: 1%; white-space: nowrap; }
.tabelle-huelle { overflow-x: auto; }

.hinweis { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--fahnas-radius-klein); border: 1px solid var(--fahnas-rand); background: var(--fahnas-flaeche-2); margin-bottom: var(--fahnas-abstand); }
.hinweis .symbol { flex: 0 0 auto; margin-top: 1px; }
.hinweis p:last-child { margin-bottom: 0; }
.hinweis-info { background: var(--fahnas-akzent-hell); border-color: transparent; }
.hinweis-info .symbol { color: var(--fahnas-akzent); }
.hinweis-warnung { background: var(--fahnas-warnung-hell); border-color: transparent; }
.hinweis-warnung .symbol { color: var(--fahnas-warnung); }
.hinweis-fehler { background: var(--fahnas-gefahr-hell); border-color: transparent; }
.hinweis-fehler .symbol { color: var(--fahnas-gefahr); }
.noscript { margin: var(--fahnas-abstand); }

.leer { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 40px 16px; text-align: center; color: var(--fahnas-text-schwach); }
.leer .symbol { color: var(--fahnas-rand); stroke-width: 1.4; }
.leer-titel { font-weight: 600; color: var(--fahnas-text); margin: 6px 0 0; }
.leer-text { margin: 0; max-width: 420px; }

.fortschritt { position: relative; height: 8px; border-radius: 999px; background: var(--fahnas-flaeche-2); overflow: hidden; }
.fortschritt-balken { position: absolute; left: 0; top: 0; bottom: 0; width: var(--anteil, 0%); background: var(--fahnas-akzent); border-radius: 999px; transition: width 0.25s; }
.fortschritt.warnung .fortschritt-balken { background: var(--fahnas-warnung); }
.fortschritt.gefahr .fortschritt-balken { background: var(--fahnas-gefahr); }
.fortschritt.unbestimmt .fortschritt-balken { width: 30%; animation: pendeln 1.2s ease-in-out infinite alternate; }
@keyframes pendeln { from { left: 0; } to { left: 70%; } }
.fortschritt-gross { height: 12px; }

.plakette { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: var(--fahnas-flaeche-2); color: var(--fahnas-text-schwach); white-space: nowrap; }
.plakette-erfolg { background: var(--fahnas-erfolg-hell); color: var(--fahnas-erfolg); }
.plakette-warnung { background: var(--fahnas-warnung-hell); color: var(--fahnas-warnung); }
.plakette-gefahr { background: var(--fahnas-gefahr-hell); color: var(--fahnas-gefahr); }
.plakette-akzent { background: var(--fahnas-akzent-hell); color: var(--fahnas-akzent-auf-hell); }

.ampel { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--fahnas-text-schwach); flex: 0 0 auto; }
.ampel-aktiv { background: var(--fahnas-erfolg); }
.ampel-inaktiv { background: var(--fahnas-rand); border: 1px solid var(--fahnas-text-schwach); }
.ampel-fehler { background: var(--fahnas-gefahr); }

/* Dialog */
.dialog {
  border: 1px solid var(--fahnas-rand); border-radius: var(--fahnas-radius); padding: 0; background: var(--fahnas-flaeche); color: var(--fahnas-text);
  width: min(96vw, 480px); max-height: min(92vh, 92dvh); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}
.dialog-breit { width: min(96vw, 900px); }
.dialog::backdrop { background: rgba(10, 16, 20, 0.5); }
.dialog-kopf { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 8px var(--fahnas-abstand); border-bottom: 1px solid var(--fahnas-rand); }
.dialog-titel { margin: 0; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog-koerper { padding: var(--fahnas-abstand); overflow: auto; max-height: calc(92vh - 60px); }
.dialog-text { white-space: pre-line; }
.dialog-knoepfe { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dialog-form .feld:last-of-type { margin-bottom: 0; }

/* Toasts */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--fahnas-nav-hoehe) + 12px + env(safe-area-inset-bottom, 0px)); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(94vw, 460px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--fahnas-radius-klein); background: var(--fahnas-text); color: var(--fahnas-hintergrund); box-shadow: 0 6px 20px rgba(0,0,0,0.25); pointer-events: auto; animation: einblenden 0.18s ease-out; }
.toast .symbol { flex: 0 0 auto; }
.toast-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.toast-schliessen { background: transparent; border: 0; color: inherit; opacity: 0.7; padding: 4px; min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; }
.toast-schliessen:hover { opacity: 1; }
.toast-erfolg .symbol:first-child { color: var(--fahnas-erfolg); }
.toast-fehler { background: var(--fahnas-gefahr); color: var(--fahnas-gefahr-text); }
.toast-warnung .symbol:first-child { color: var(--fahnas-warnung); }
.toast-info .symbol:first-child { color: var(--fahnas-akzent); }
@keyframes einblenden { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Brotkrumen */
.brotkrumen { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; font-size: 0.95rem; min-width: 0; }
.brotkrumen li { display: flex; align-items: center; gap: 2px; min-width: 0; }
.brotkrumen a, .brotkrumen span { padding: 4px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.brotkrumen a:hover { background: var(--fahnas-flaeche-2); text-decoration: none; }
.brotkrumen [aria-current="page"] { font-weight: 600; }
.brotkrumen .symbol { width: 16px; height: 16px; color: var(--fahnas-text-schwach); }

/* Textabstufungen */
.schwach { color: var(--fahnas-text-schwach); }
.klein { font-size: 0.85rem; }
.abschneiden { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nur-lesen { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ Handy: Tabelle als Kartenliste */
@media (max-width: 719px) {
  .tabelle.tabelle-karten thead { display: none; }
  .tabelle.tabelle-karten, .tabelle.tabelle-karten tbody, .tabelle.tabelle-karten tr, .tabelle.tabelle-karten td { display: block; }
  .tabelle.tabelle-karten tr { border: 1px solid var(--fahnas-rand); border-radius: var(--fahnas-radius-klein); padding: 8px 10px; margin-bottom: 8px; background: var(--fahnas-flaeche); }
  .tabelle.tabelle-karten td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: left; }
  .tabelle.tabelle-karten td[data-label]::before { content: attr(data-label); color: var(--fahnas-text-schwach); font-size: 0.82rem; flex: 0 0 auto; }
  .tabelle.tabelle-karten td.zahl { text-align: right; }
  /* Leere Zellen (z. B. ohne Beschreibung) zeigen in der Kartenliste sonst nur ihre Beschriftung */
  .tabelle.tabelle-karten td:empty { display: none; }
  .kopf-nutzer-name { display: none; }
  .kopf-rolle { display: none; }
  /* Berührungsziele auf dem Handy: auch kleine Knöpfe mindestens 40 px hoch */
  .knopf-klein { min-height: 40px; }
}

/* ------------------------------------------------------------------ Tablet/Desktop */
@media (min-width: 720px) {
  body { font-size: 15px; }
  .app { display: grid; grid-template-columns: var(--fahnas-nav-breite) minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "zustand zustand" "kopf kopf" "nav inhalt"; min-height: 100vh; }
  .zustandsleiste { grid-area: zustand; }
  .kopfzeile { grid-area: kopf; padding: 0 20px; }
  .navigation { grid-area: nav; position: sticky; top: var(--fahnas-kopf-hoehe); align-self: start; height: calc(100vh - var(--fahnas-kopf-hoehe)); border-top: 0; border-right: 1px solid var(--fahnas-rand); padding: 12px 10px; display: flex; flex-direction: column; overflow-y: auto; }
  .navigation-liste { flex-direction: column; gap: 2px; }
  .navigation-eintrag { flex-direction: row; justify-content: flex-start; gap: 12px; height: 44px; padding: 0 12px; font-size: 0.95rem; }
  .navigation-text { text-align: left; white-space: nowrap; display: block; hyphens: manual; -webkit-hyphens: manual; text-overflow: ellipsis; }
  .navigation-eintrag[aria-current="page"] { background: var(--fahnas-akzent-hell); }
  .navigation-gruppe { flex: none; }
  .navigation-gruppe-titel { display: block; margin: 14px 12px 4px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--fahnas-text-schwach); }
  .navigation-gruppe-knopf { display: none; }
  .navigation-unterliste, .navigation-gruppe.offen > .navigation-unterliste { display: flex; flex-direction: column; gap: 2px; position: static; transform: none; min-width: 0; padding: 0; background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .navigation-unterliste .navigation-eintrag { gap: 12px; font-size: 0.95rem; }
  .navigation-fuss { display: block; margin-top: auto; padding: 12px; color: var(--fahnas-text-schwach); font-size: 0.78rem; }
  .navigation-abzeichen { position: static; margin-left: auto; }
  .navigation-favoriten-punkt { display: block; }
  .inhalt { grid-area: inhalt; padding: 24px; }
  .toasts { bottom: 20px; left: auto; right: 20px; transform: none; }
  .raster { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .schalter { grid-template-columns: 1fr auto; }
  body.solo .app { display: flex; }
}

@media (min-width: 1100px) {
  .inhalt { padding: 28px 32px; }
  .raster { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media print {
  .navigation, .kopfzeile, .toasts, .zustandsleiste { display: none !important; }
  .inhalt { padding: 0; }
}

/* Suche in der Kopfzeile (Strg+K) */
.kopf-suche { display: inline-flex; align-items: center; gap: 8px; margin: 0 auto 0 12px; min-height: 40px; padding: 0 10px; border: 1px solid var(--fahnas-rand); border-radius: 999px; background: var(--fahnas-flaeche-2); color: var(--fahnas-text-schwach); font: inherit; font-size: 0.9rem; cursor: pointer; }
.kopf-suche:hover { color: var(--fahnas-text); border-color: var(--fahnas-akzent); }
.kopf-suche-text, .kopf-suche-taste { display: none; }
.kopf-suche-taste { font: inherit; font-size: 0.75rem; padding: 1px 6px; border: 1px solid var(--fahnas-rand); border-radius: 6px; background: var(--fahnas-flaeche); }
@media (min-width: 720px) { .kopf-suche { min-width: 240px; } .kopf-suche-text { display: inline; flex: 1; text-align: left; } .kopf-suche-taste { display: inline; } }
.suche-dialog { width: min(96vw, 620px); margin-top: 10vh; }
.suche-dialog .dialog-koerper { padding-top: 10px; }
.suche-eingabe { width: 100%; font-size: 1.05rem; min-height: 44px; }
.suche-liste { list-style: none; margin: 10px 0 0; padding: 0; max-height: min(60vh, 460px); overflow-y: auto; }
.suche-treffer { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--fahnas-radius-klein); cursor: pointer; min-height: 44px; }
.suche-treffer.aktiv { background: var(--fahnas-akzent-hell); }
.suche-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.suche-titel { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suche-unter { font-size: 0.82rem; color: var(--fahnas-text-schwach); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suche-art { font-size: 0.75rem; color: var(--fahnas-text-schwach); white-space: nowrap; }
.suche-leer { padding: 12px 10px; color: var(--fahnas-text-schwach); }
.suche-hinweis { margin: 8px 0 0; font-size: 0.8rem; }
/* Sprungziel einer Suche/„Beheben“ in Listen kurz hervorheben */
.suchziel-hervorgehoben { outline: 3px solid var(--fahnas-akzent); outline-offset: 3px; border-radius: var(--fahnas-radius-klein); scroll-margin-top: calc(var(--fahnas-kopf-hoehe) + 12px); }

/* „Was tun?“ an Fehlermeldungen */
.toast-was-tun { flex: 0 0 auto; background: none; border: 1px solid currentColor; border-radius: 999px; color: inherit; font: inherit; font-size: 0.8rem; padding: 2px 10px; cursor: pointer; opacity: 0.9; }
.was-tun-meldung { font-weight: 600; }
.was-tun-titel { margin: 14px 0 4px; font-size: 0.95rem; }
.was-tun-technik { max-height: 220px; overflow: auto; font-size: 0.8rem; white-space: pre-wrap; word-break: break-word; }

/* Sprachknopf in der Kopfleiste (DE/EN) */
.kopf-sprache { font-weight: 700; font-size: 0.8rem; letter-spacing: 0.04em; min-width: 2.75rem; }

/* ============================================================================
   Darstellung je Nutzer (12.10.2026): Farbthemen aus allinone, animierte Muster, eigene Tapete
   ============================================================================ */
:root[data-theme="midnight"] {
  --fahnas-hintergrund: #07030d; --fahnas-flaeche: #1c1030; --fahnas-flaeche-2: #261640; --fahnas-rand: #3a2454;
  --fahnas-text: #f1e6ff; --fahnas-text-schwach: #b39ddb;
  --fahnas-akzent: #a855f7; --fahnas-akzent-dunkel: #c084fc; --fahnas-akzent-hell: #2d1a4a; --fahnas-akzent-text: #ffffff; --fahnas-akzent-auf-hell: #d8b4fe; --fahnas-fokus: #c084fc;
}
:root[data-theme="ocean"] {
  --fahnas-hintergrund: #0a1628; --fahnas-flaeche: #152540; --fahnas-flaeche-2: #1c3050; --fahnas-rand: #233f5e;
  --fahnas-text: #e0f2fe; --fahnas-text-schwach: #7cb9d4;
  --fahnas-akzent: #0ea5e9; --fahnas-akzent-dunkel: #38bdf8; --fahnas-akzent-hell: #12324d; --fahnas-akzent-text: #04121c; --fahnas-akzent-auf-hell: #7dd3fc; --fahnas-fokus: #38bdf8;
}
:root[data-theme="steampunk"] {
  --fahnas-hintergrund: #1a1109; --fahnas-flaeche: #2e1f0d; --fahnas-flaeche-2: #3a2812; --fahnas-rand: #4a3319;
  --fahnas-text: #f0dcb0; --fahnas-text-schwach: #c19a5b;
  --fahnas-akzent: #b87333; --fahnas-akzent-dunkel: #d08c4a; --fahnas-akzent-hell: #3d2914; --fahnas-akzent-text: #1a1109; --fahnas-akzent-auf-hell: #e0a96d; --fahnas-fokus: #d08c4a;
}
:root[data-theme="cyberpunk"] {
  --fahnas-hintergrund: #0a0a0e; --fahnas-flaeche: #18181f; --fahnas-flaeche-2: #22222c; --fahnas-rand: #3a2233;
  --fahnas-text: #f5f0e6; --fahnas-text-schwach: #9a8fae;
  --fahnas-akzent: #ff2a6d; --fahnas-akzent-dunkel: #ff5c8f; --fahnas-akzent-hell: #3a1426; --fahnas-akzent-text: #ffffff; --fahnas-akzent-auf-hell: #ff7aa2; --fahnas-fokus: #f9f002;
}

/* Muster (Circuit/Polygone) und Tapete liegen fest hinter der Oberfläche */
.fahnas-muster, .fahnas-tapete { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.fahnas-tapete video { width: 100%; height: 100%; object-fit: cover; display: block; }
.fahnas-tapete-bild { position: absolute; inset: 0; background-position: center; background-repeat: no-repeat; background-size: cover; }
/* Skalierung der Tapete (Darstellung → Tapete): Füllen = Standard; Kacheln nur bei Bildern */
:root[data-skalierung="einpassen"] .fahnas-tapete video { object-fit: contain; }
:root[data-skalierung="strecken"] .fahnas-tapete video { object-fit: fill; }
:root[data-skalierung="mitte"] .fahnas-tapete video { object-fit: none; }
:root[data-skalierung="einpassen"] .fahnas-tapete-bild { background-size: contain; }
:root[data-skalierung="strecken"] .fahnas-tapete-bild { background-size: 100% 100%; }
:root[data-skalierung="mitte"] .fahnas-tapete-bild { background-size: auto; }
:root[data-skalierung="kacheln"] .fahnas-tapete-bild { background-size: auto; background-repeat: repeat; background-position: 0 0; }
/* Automatisch: ganzes Bild, Größe/Lage setzt darstellung.js (bis 5 % gestreckt); bleibt ein Rand, füllt ihn eine unscharfe
   Kopie desselben Bildes (Bild: CSS-Hintergrund, Video: kleines Canvas) – nur dann, sonst keine Unschärfe-Ebene */
:root[data-skalierung="auto"] .fahnas-tapete video { position: absolute; left: 0; top: 0; max-width: none; object-fit: fill; }
:root[data-skalierung="auto"] .fahnas-tapete-bild { background-size: 100% 100%; }
.fahnas-tapete-unschaerfe { display: none; position: absolute; left: -60px; top: -60px; width: calc(100% + 120px); height: calc(100% + 120px); max-width: none; background-position: center; background-size: cover; filter: blur(40px); }
:root[data-skalierung="auto"]:not([data-tapete-rand="nein"]) .fahnas-tapete-unschaerfe { display: block; }
:root[data-skalierung="auto"][data-tapete-rand="seiten"] :is(.fahnas-tapete video, .fahnas-tapete-bild) {
  -webkit-mask-image: linear-gradient(to right, transparent, black 56px, black calc(100% - 56px), transparent);
  mask-image: linear-gradient(to right, transparent, black 56px, black calc(100% - 56px), transparent);
}
:root[data-skalierung="auto"][data-tapete-rand="oben"] :is(.fahnas-tapete video, .fahnas-tapete-bild) {
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 56px, black calc(100% - 56px), transparent);
  mask-image: linear-gradient(to bottom, transparent, black 56px, black calc(100% - 56px), transparent);
}
/* Zoom (100 % = wie die Skalierung es auf dem Bildschirm zeigt) zur Bildschirmmitte hin; Kacheln: Fläche um 1/Zoom
   vergrößern und zurückskalieren, damit auch beim Verkleinern der ganze Bildschirm gekachelt bleibt */
.fahnas-tapete { overflow: hidden; }
.fahnas-tapete video, .fahnas-tapete-bild { transform: scale(var(--fahnas-zoom, 1)); transform-origin: center; }
:root[data-skalierung="kacheln"] .fahnas-tapete-bild { inset: auto; left: 50%; top: 50%; width: calc(100% / var(--fahnas-zoom, 1)); height: calc(100% / var(--fahnas-zoom, 1)); transform: translate(-50%, -50%) scale(var(--fahnas-zoom, 1)); }
.fahnas-tapete::after { content: ""; position: absolute; inset: 0; background: var(--fahnas-hintergrund); opacity: var(--fahnas-abdunkeln, 0.4); }
:root[data-hintergrund="circuit"] .app, :root[data-hintergrund="polygone"] .app, :root[data-hintergrund="tapete"] .app { position: relative; z-index: 1; }
/* Glas: Kopf, Navigation, Karten und Kacheln lassen den Hintergrund leicht durchscheinen */
:root[data-hintergrund="circuit"] body, :root[data-hintergrund="polygone"] body, :root[data-hintergrund="tapete"] body { background: var(--fahnas-hintergrund); }
:root[data-hintergrund="circuit"] :is(.kopfzeile, .navigation, .karte, .kachel),
:root[data-hintergrund="polygone"] :is(.kopfzeile, .navigation, .karte, .kachel),
:root[data-hintergrund="tapete"] :is(.kopfzeile, .navigation, .karte, .kachel) {
  background: color-mix(in srgb, var(--fahnas-flaeche) 84%, transparent);
  -webkit-backdrop-filter: blur(10px) saturate(1.1); backdrop-filter: blur(10px) saturate(1.1);
}
@media (prefers-reduced-transparency: reduce) {
  :root[data-hintergrund] :is(.kopfzeile, .navigation, .karte, .kachel) { background: var(--fahnas-flaeche); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media print { .fahnas-muster, .fahnas-tapete { display: none !important; } }
/* Milchglas-Zeilen (Betreiber 15.10.2026: „schrift lässt sich je nach wallpaper schlecht sehen“): Tabellen, die direkt auf
   Tapete/Muster/Glas liegen (nicht in Karte, Kachel oder Fenster), bekommen je Zeile eine durchscheinende Fläche mit
   Unschärfe – wie Knöpfe und Felder. Hintergrund an den Zellen, weil backdrop-filter an <tr> nicht überall greift. */
:root:is([data-hintergrund="tapete"], [data-hintergrund="circuit"], [data-hintergrund="polygone"], [data-glas="an"]) .tabelle:not(:is(.karte, .kachel, .dialog, .vw-dialog) .tabelle) {
  border-collapse: separate; border-spacing: 0 4px;
}
:root:is([data-hintergrund="tapete"], [data-hintergrund="circuit"], [data-hintergrund="polygone"], [data-glas="an"]) .tabelle:not(:is(.karte, .kachel, .dialog, .vw-dialog) .tabelle) :is(td, th) {
  border-bottom: 0;
  background: color-mix(in srgb, var(--fahnas-flaeche) 74%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(1.2); backdrop-filter: blur(12px) saturate(1.2);
}
:root:is([data-hintergrund="tapete"], [data-hintergrund="circuit"], [data-hintergrund="polygone"], [data-glas="an"]) .tabelle:not(:is(.karte, .kachel, .dialog, .vw-dialog) .tabelle) :is(td, th):first-child { border-radius: var(--fahnas-radius-klein) 0 0 var(--fahnas-radius-klein); }
:root:is([data-hintergrund="tapete"], [data-hintergrund="circuit"], [data-hintergrund="polygone"], [data-glas="an"]) .tabelle:not(:is(.karte, .kachel, .dialog, .vw-dialog) .tabelle) :is(td, th):last-child { border-radius: 0 var(--fahnas-radius-klein) var(--fahnas-radius-klein) 0; }
:root:is([data-hintergrund="tapete"], [data-hintergrund="circuit"], [data-hintergrund="polygone"], [data-glas="an"]) .tabelle:not(:is(.karte, .kachel, .dialog, .vw-dialog) .tabelle) tbody tr:hover > td { background: color-mix(in srgb, var(--fahnas-flaeche-2) 86%, transparent); }
:root:is([data-hintergrund="tapete"], [data-hintergrund="circuit"], [data-hintergrund="polygone"], [data-glas="an"]) .tabelle:not(:is(.karte, .kachel, .dialog, .vw-dialog) .tabelle) tbody tr[aria-selected="true"] > td { background: color-mix(in srgb, var(--fahnas-akzent-hell) 88%, transparent); }
/* Mit Glas-Look folgen die Zeilen dem Regler „Transparenz“ (wie Karten und Fenster) */
:root[data-glas="an"] .tabelle:not(:is(.karte, .kachel, .dialog, .vw-dialog) .tabelle) :is(td, th) {
  background: color-mix(in srgb, var(--fahnas-flaeche) var(--fahnas-glas-deckung, 55%), transparent);
  -webkit-backdrop-filter: blur(var(--fahnas-glas-unschaerfe, 24px)) saturate(1.8); backdrop-filter: blur(var(--fahnas-glas-unschaerfe, 24px)) saturate(1.8);
}
:root[data-glas="an"] .tabelle:not(:is(.karte, .kachel, .dialog, .vw-dialog) .tabelle) tbody tr:hover > td { background: color-mix(in srgb, var(--fahnas-flaeche-2) min(100%, calc(var(--fahnas-glas-deckung, 55%) + 20%)), transparent); }
:root[data-glas="an"] .tabelle:not(:is(.karte, .kachel, .dialog, .vw-dialog) .tabelle) tbody tr[aria-selected="true"] > td { background: color-mix(in srgb, var(--fahnas-akzent-hell) min(100%, calc(var(--fahnas-glas-deckung, 55%) + 30%)), transparent); }
@media (prefers-reduced-transparency: reduce) {
  :root[data-hintergrund] .tabelle:not(:is(.karte, .kachel, .dialog, .vw-dialog) .tabelle) :is(td, th) { background: var(--fahnas-flaeche); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (max-width: 719px) { /* Handy: Zeilen sind dort schon eigene Karten mit Fläche */
  :root[data-hintergrund] .tabelle.tabelle-karten :is(td, th) { background: none !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; border-radius: 0 !important; }
}

/* Glas-Look (12.10.2026, wie macOS/iOS): Kopf, Navigation, Karten, Kacheln und Fenster durchscheinend mit Unschärfe.
   Deckung und Unschärfe kommen aus dem Regler „Transparenz“ (darstellung.js glasVariablen). Ohne Hintergrund liegt ein
   weicher Verlauf in der Akzentfarbe dahinter, damit das Glas etwas zum Durchscheinen hat. */
:root[data-glas="an"][data-hintergrund="aus"] body {
  background:
    radial-gradient(65vw 65vh at 10% 6%, color-mix(in srgb, var(--fahnas-akzent) 40%, transparent), transparent 70%),
    radial-gradient(55vw 60vh at 92% 22%, color-mix(in srgb, var(--fahnas-akzent-dunkel) 30%, transparent), transparent 70%),
    radial-gradient(80vw 60vh at 45% 105%, color-mix(in srgb, var(--fahnas-akzent) 26%, transparent), transparent 72%),
    var(--fahnas-hintergrund);
  background-attachment: fixed;
}
:root[data-glas="an"] :is(.kopfzeile, .navigation, .karte, .kachel, .dialog, .vw-dialog) {
  background: color-mix(in srgb, var(--fahnas-flaeche) var(--fahnas-glas-deckung, 55%), transparent);
  -webkit-backdrop-filter: blur(var(--fahnas-glas-unschaerfe, 24px)) saturate(1.8);
  backdrop-filter: blur(var(--fahnas-glas-unschaerfe, 24px)) saturate(1.8);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 22%, transparent), var(--fahnas-schatten);
}
/* Glaskante – Warn-/Fehlerkacheln behalten ihren farbigen Rand */
:root[data-glas="an"] :is(.kopfzeile, .navigation, .karte, .kachel:not(.warnung, .gefahr), .dialog, .vw-dialog) { border-color: color-mix(in srgb, var(--fahnas-text) 14%, transparent); }
:root[data-glas="an"] :is(.dialog, .vw-dialog) { box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 22%, transparent), 0 18px 50px rgba(0, 0, 0, 0.3); }
:root[data-glas="an"] :is(.dialog, .vw-dialog)::backdrop { background: rgba(10, 16, 20, 0.28); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
/* Flächen in Glas-Kacheln (Zeilen im Handlungsbedarf) scheinen mit durch */
:root[data-glas="an"] .hb-zeile { background: color-mix(in srgb, var(--fahnas-flaeche-2) var(--fahnas-glas-deckung, 55%), transparent); }
:root[data-glas="an"] .hb-zeile.hb-fehler { background: color-mix(in srgb, var(--fahnas-gefahr-hell) var(--fahnas-glas-deckung, 55%), transparent); }
:root[data-glas="an"] .hb-zeile.hb-warnung { background: color-mix(in srgb, var(--fahnas-warnung-hell) var(--fahnas-glas-deckung, 55%), transparent); }
:root[data-glas="an"] .knopf-zweit:not(:hover) { background: color-mix(in srgb, var(--fahnas-flaeche) 70%, transparent); }
/* Gerät will weniger Transparenz (macOS/iOS „Transparenz reduzieren“) → deckend wie ohne Glas */
@media (prefers-reduced-transparency: reduce) {
  :root[data-glas="an"] :is(.kopfzeile, .navigation, .karte, .kachel, .dialog, .vw-dialog, .knopf-zweit) { background: var(--fahnas-flaeche); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* Fenster „Darstellung“ */
.darstellung { display: flex; flex-direction: column; gap: 14px; min-width: min(420px, 82vw); }
.darstellung-abschnitt h3 { margin: 0 0 4px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fahnas-text-schwach); }
.darstellung-abschnitt .erklaerung { margin: 0 0 8px; }
.darstellung-reihe { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.darstellung-tupfer { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--fahnas-rand); cursor: pointer; padding: 0; box-shadow: inset 0 0 0 2px var(--fahnas-flaeche); }
.darstellung-tupfer.aktiv { border-color: var(--fahnas-akzent); outline: 2px solid var(--fahnas-akzent); outline-offset: 2px; }
.darstellung-tupfer-standard { background-image: linear-gradient(135deg, transparent 46%, var(--fahnas-text-schwach) 46%, var(--fahnas-text-schwach) 54%, transparent 54%) !important; }
.darstellung-segmente .knopf { min-width: 0; }
.darstellung-regler { display: grid; gap: 4px; margin-top: 6px; }
.darstellung-regler input[type="range"] { width: 100%; accent-color: var(--fahnas-akzent); }
.darstellung-regler.gesperrt > :is(label, input) { opacity: 0.45; }
.darstellung-regler.gesperrt input[type="range"] { cursor: not-allowed; filter: grayscale(1); }
.darstellung-stufe { margin: 0; }
.darstellung-abschnitt h4 { margin: 12px 0 4px; font-size: 0.85rem; }
.darstellung-galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin: 0 0 8px; max-height: 280px; overflow-y: auto; padding: 3px; }
.darstellung-galerie-zelle { position: relative; }
.darstellung-galerie-bild { display: block; width: 100%; aspect-ratio: 16 / 10; padding: 0; border: 2px solid var(--fahnas-rand); border-radius: var(--fahnas-radius-klein); overflow: hidden; cursor: pointer; background: var(--fahnas-flaeche-2); position: relative; }
.darstellung-galerie-bild img, .darstellung-galerie-bild video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.darstellung-galerie-bild.aktiv { border-color: var(--fahnas-akzent); outline: 2px solid var(--fahnas-akzent); outline-offset: 1px; }
.darstellung-galerie-video { position: absolute; left: 4px; bottom: 3px; font-size: 0.7rem; color: #fff; text-shadow: 0 0 3px #000; }
.darstellung-galerie-weg { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--fahnas-rand); background: var(--fahnas-flaeche); color: var(--fahnas-text); cursor: pointer; line-height: 1; padding: 0; opacity: 0; transition: opacity 0.15s; }
.darstellung-galerie-zelle:hover .darstellung-galerie-weg, .darstellung-galerie-weg:focus-visible { opacity: 1; }
@media (hover: none) { .darstellung-galerie-weg { opacity: 1; } }
.darstellung-ordnerpfad { font-family: var(--fahnas-mono, monospace); font-size: 0.85rem; word-break: break-all; margin: 0; }
.darstellung-ordnerwahl { display: grid; gap: 6px; border: 1px solid var(--fahnas-rand); border-radius: var(--fahnas-radius-klein); padding: 8px; }
.darstellung-ordnerliste { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow-y: auto; }
.darstellung-ordnerknopf { width: 100%; text-align: left; background: none; border: 0; padding: 6px 4px; color: var(--fahnas-text); cursor: pointer; border-radius: 4px; }
.darstellung-ordnerknopf:hover, .darstellung-ordnerknopf:focus-visible { background: var(--fahnas-flaeche-2); }

/* Avatare (0.22.0): Bild des Nutzers oder Anfangsbuchstabe im Kreis (public/avatar.js) – überall dieselbe Form */
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; box-sizing: border-box; width: var(--avatar-groesse, 32px); height: var(--avatar-groesse, 32px); border-radius: 50%; overflow: hidden; background: var(--avatar-farbe, #4b5563); color: #ffffff; font-size: calc(var(--avatar-groesse, 32px) * 0.45); font-weight: 700; line-height: 1; user-select: none; -webkit-user-select: none; vertical-align: middle; }
.avatar-bild { background: var(--fahnas-flaeche-2, #e5e7eb); }
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Ordnerrechte (19.10.2026): Dialog für Admins und Overlay „Nicht für dich freigegeben“ (public/ordnerrechte.js) */
.ordnerrechte-zeilen { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.ordnerrechte-zeile { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 260px); gap: 12px; align-items: start; padding: 10px 12px; border: 1px solid var(--fahnas-rand); border-radius: var(--fahnas-radius-klein); }
.ordnerrechte-zeile.eingeschraenkt { border-color: var(--fahnas-warnung); background: var(--fahnas-warnung-hell); }
.ordnerrechte-konto { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ordnerrechte-konto .plakette { align-self: flex-start; margin-top: 4px; white-space: normal; }
.ordnerrechte-name { font-weight: 600; overflow-wrap: anywhere; }
.ordnerrechte-wahl { display: flex; flex-direction: column; gap: 4px; }
.ordnerrechte-wahl select { width: 100%; }
.ordnerrechte-hinweis { margin-top: 6px; }
.ordnerrechte-gesperrt { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 8px 4px 4px; }
.ordnerrechte-gesperrt-symbol { color: var(--fahnas-text-schwach); }
@media (max-width: 560px) { .ordnerrechte-zeile { grid-template-columns: 1fr; } }
