/* Design-Sprache angelehnt an das AppStack-Admin-Template (siehe /template
   im Projekt-Root): weiche Karten mit dezentem Schatten, große Radien,
   Nunito-Schrift, Font-Awesome-Icons. Bewusst kein Bootstrap/JS-Framework
   uebernommen - bleibt ein einzelnes, handgepflegtes Stylesheet ohne
   Build-Schritt, passend zum Rest des Projekts. */

:root {
    color-scheme: light dark;
    --bg: #f5f8fb;
    --card-bg: #ffffff;
    --card-shadow: 0 1px 2px rgba(30, 41, 59, 0.04), 0 8px 24px rgba(30, 41, 59, 0.06);
    --border: #e3e8ef;
    --fg: #3f4a5a;
    --heading: #1f2733;
    --muted: #737d8c;
    --accent: #2563eb;
    --accent-fg: #ffffff;
    --ok: #16a34a;
    --fail: #dc2626;
    --warn: #d97706;
    --radius: 12px;
    --radius-sm: 8px;
    /* Spektrumansicht (static/spectrum.js): Ziel-SSIDs 1-3, übrige Netze.
       Validiert (dataviz-Palette, all-pairs, CVD ΔE >= 9,2) gegen --card-bg
       hell/dunkel; das Aqua liegt hell unter 3:1 - deshalb direkt beschriftet. */
    --spec-1: #2a78d6;
    --spec-2: #1baf7a;
    --spec-3: #4a3aa7;
    /* Slots 4-8 nur für Linien (Verlauf, adjacent-validiert) - nicht für
       überlappende Flächen wie das Spektrum, dort bleibt es bei 1-3. */
    --spec-4: #e87ba4;
    --spec-5: #008300;
    --spec-6: #eda100;
    --spec-7: #eb6834;
    --spec-8: #e34948;
    --spec-other: #898781;
}

/* Dunkle Werte zweimal: einmal fuer "Auto" (folgt dem Betriebssystem,
   solange kein Hell erzwungen ist), einmal fuer explizit "Dunkel" per
   Umschalter in der Kopfzeile (data-theme auf <html>, siehe static/theme.js). */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #12161f;
        --card-bg: #1b212d;
        --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
        --border: #2c3341;
        --fg: #c7cfda;
        --heading: #f2f5f9;
        --muted: #8b96a6;
        --accent: #3b82f6;
        --ok: #4ade80;
        --fail: #f87171;
        --warn: #fbbf24;
        --spec-1: #3987e5;
        --spec-2: #199e70;
        --spec-3: #9085e9;
        --spec-4: #d55181;
        --spec-5: #008300;
        --spec-6: #c98500;
        --spec-7: #d95926;
        --spec-8: #e66767;
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #12161f;
    --card-bg: #1b212d;
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    --border: #2c3341;
    --fg: #c7cfda;
    --heading: #f2f5f9;
    --muted: #8b96a6;
    --accent: #3b82f6;
    --ok: #4ade80;
    --fail: #f87171;
    --warn: #fbbf24;
    --spec-1: #3987e5;
    --spec-2: #199e70;
    --spec-3: #9085e9;
    --spec-4: #d55181;
    --spec-5: #008300;
    --spec-6: #c98500;
    --spec-7: #d95926;
    --spec-8: #e66767;
}

:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }

body {
    font-family: "Nunito", -apple-system, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    line-height: 1.55;
    background: var(--bg);
    color: var(--fg);
    /* Spalte aus Kopfzeile, Inhalt und Fusszeile: main waechst, die
       Fusszeile sitzt so auch auf kurzen Seiten am unteren Rand. */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body > main {
    width: 100%;
    flex: 1 0 auto;
}

/* Schmale Fusszeile (src/templates/_footer.php): Version und Website. */
.site-footer {
    padding: 0.5rem 1.5rem;
    text-align: center;
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-footer a {
    color: inherit;
}

/* Anstehende Störungen über der Fußzeile (_footer.php) */
.inc-footer {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 0.3rem 1rem;
    padding: 0.5rem 1rem; border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--muted);
}
.inc-footer-item { display: inline-flex; align-items: center; gap: 0.35rem; color: inherit; text-decoration: none; }
a.inc-footer-item:hover { color: var(--fg); }
.inc-footer .inc-dot { width: 0.6rem; height: 0.6rem; opacity: 1; }

.site-footer a:hover {
    color: var(--fg);
}

header {
    display: flex;
    align-items: center;
    padding: 0.9rem 1.5rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.01em;
    text-decoration: none;
    color: var(--heading);
}

.brand i { color: var(--accent); font-size: 1.1em; }

/* Logo in der Kopfzeile (_nav.php); Bildzeichen fest blau, Schriftzug folgt dem Design. */
.brand-logo { display: block; height: 2rem; width: auto; }
.brand-logo-wlan { stroke: var(--heading); }
.brand-logo-mon { stroke: var(--accent); }

.header-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

.header-link:hover { color: var(--accent); }

.nav-header { flex-wrap: wrap; gap: 0.8rem; }

.main-nav {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
}

.main-nav a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-sm);
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.main-nav a:hover { color: var(--heading); background: color-mix(in srgb, var(--muted) 10%, transparent); }
.main-nav a.active { color: var(--accent-fg); background: var(--accent); }
/* Cirrus-Sync am Menüpunkt Access Points; auf dem aktiven (blauen) Punkt hellere Töne */
.main-nav .nav-cirrus-ok { color: var(--ok); }
.main-nav .nav-cirrus-stale { color: var(--fail); }   /* rot: orange steht auf der AP-Seite für die Kanalauslastung */
.main-nav a.active .nav-cirrus-ok { color: #86efac; }
.main-nav a.active .nav-cirrus-stale { color: #fecaca; }
/* Störungslage am Menüpunkt Ursachen (_nav.php) */
.main-nav .nav-inc-active { color: var(--fail); }
.main-nav .nav-inc-provisional { color: var(--warn); }
.main-nav .nav-inc-ok { color: var(--ok); }
.main-nav a.active .nav-inc-active { color: #fecaca; }
.main-nav a.active .nav-inc-provisional { color: #fde68a; }
.main-nav a.active .nav-inc-ok { color: #86efac; }
/* Menü-Knopf (Handy/Tablet, _nav.php): unter 1100px klappt die Navigation darunter auf. */
.nav-toggle {
    display: none; align-items: center; gap: 0.35rem; padding: 0.45rem 0.7rem;
    background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--fg); font-size: 1.1rem; cursor: pointer;
}
.nav-toggle:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 1100px) {
    .nav-header { gap: 0.5rem; }
    .nav-toggle { display: inline-flex; order: 2; margin-left: auto; }
    .nav-header .nav-user { order: 3; }
    .main-nav.collapsible {
        display: none; order: 10; flex: 1 0 100%; flex-direction: column; align-items: stretch;
        gap: 0.15rem; padding-top: 0.5rem; border-top: 1px solid var(--border);
    }
    .nav-header.nav-open .main-nav.collapsible { display: flex; }
    .main-nav.collapsible a { padding: 0.65rem 0.8rem; font-size: 1rem; }
    /* Benutzermenü nur als Symbol (Name und Rolle stehen im aufgeklappten Menü nicht nötig) */
    .user-menu-trigger > span { display: none; }
}
/* Verlauf der Geräteliste: antippbar, Liste der Tests als Panel (static/hist.js) */
/* Auswahl der Cirrus-Organisationen unter Integrationen */
.org-choice { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.5rem; }
.org-choice .muted { font-size: 0.8rem; }
/* kopierfertiges curl-Beispiel unter Integrationen */
code.api-example { display: block; white-space: pre-wrap; word-break: break-all; font-size: 0.78rem; padding: 0.5rem 0.6rem; }
.hist[role="button"] { cursor: pointer; border-radius: 3px; }
.hist[role="button"]:hover, .hist[role="button"]:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.hist-summary { display: block; margin-top: 0.25rem; font-size: 0.75rem; color: var(--fail); text-decoration: none; white-space: normal; }
.hist-summary:hover { text-decoration: underline; }
.hist-panel {
    position: fixed; z-index: 60; right: 1rem; bottom: 1rem; width: min(30rem, calc(100vw - 2rem)); max-height: 75vh;
    display: flex; flex-direction: column; background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--card-shadow), 0 10px 40px rgba(0, 0, 0, 0.25);
}
.hist-panel[hidden] { display: none; }
.hist-panel-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border); }
.hist-panel-head strong { flex: 1; color: var(--heading); }
.hist-panel-head button { background: none; border: 0; font-size: 1.2rem; color: var(--muted); cursor: pointer; padding: 0.2rem 0.4rem; }
.hist-panel-list { overflow-y: auto; padding: 0.3rem 0; margin: 0; list-style: none; }
.hist-panel-list li { padding: 0.45rem 0.9rem; border-bottom: 1px dashed color-mix(in srgb, var(--border) 70%, transparent); font-size: 0.85rem; }
.hist-panel-list li.is-current { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.hist-panel-list li { cursor: pointer; }
.hist-panel-list li:hover { background: color-mix(in srgb, var(--muted) 8%, transparent); }
.hist-panel-list a.hp-time { color: inherit; }
/* Test aus der Geräteliste angesprungen (#m-<id>) */
tr.row-focus > td { background: color-mix(in srgb, var(--accent) 16%, transparent); transition: background 0.4s; }
.hist-panel-list .hp-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.5rem; }
.hist-panel-list .hp-time { font-variant-numeric: tabular-nums; color: var(--muted); }
.hist-panel-list .hp-ssid { font-weight: 700; }
.hist-panel-list .hp-msg { margin-top: 0.15rem; color: var(--muted); }
.hist-panel-list .hp-links { margin-top: 0.2rem; display: flex; flex-wrap: wrap; gap: 0.2rem 0.8rem; font-size: 0.8rem; }
.hist-panel-foot { padding: 0.6rem 0.9rem; border-top: 1px solid var(--border); font-size: 0.85rem; }
.tap-tip {
    position: fixed; z-index: 61; left: 1rem; right: 1rem; bottom: 1rem; padding: 0.7rem 0.9rem; white-space: pre-line;
    background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--card-shadow); font-size: 0.85rem;
}
@media (max-width: 640px) {
    /* Auf dem Handy als Leiste von unten */
    .hist-panel { left: 0; right: 0; bottom: 0; width: auto; max-height: 80vh; border-radius: var(--radius) var(--radius) 0 0; }
}
.nav-count {
    display: inline-flex; align-items: center; justify-content: center; min-width: 1.15rem; height: 1.15rem;
    padding: 0 0.3rem; border-radius: 999px; background: var(--fail); color: #fff; font-size: 0.7rem; font-weight: 800;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: var(--muted);
    white-space: nowrap;
}

.nav-user form { display: inline-flex; }

/* Benutzermenü in der Kopfzeile (_nav.php): Hover, Klick und Tastatur. */
.user-menu { position: relative; }
.user-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.55rem;
    font: inherit;
    font-size: 0.85rem;
    color: var(--fg);
    cursor: pointer;
}
.user-menu-trigger:hover, .user-menu.open .user-menu-trigger { border-color: var(--border); background: color-mix(in srgb, var(--muted) 8%, transparent); }
.user-menu-caret { font-size: 0.65rem; color: var(--muted); transition: transform 0.15s; }
.user-menu:hover .user-menu-caret, .user-menu.open .user-menu-caret { transform: rotate(180deg); }
.user-menu-list {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    min-width: 220px;
    padding: 0.35rem 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--card-shadow);
}
/* Unsichtbare Brücke über den 6px-Abstand, damit der Hover beim Wechsel
   vom Namen ins Menü nicht abreißt. */
.user-menu-list::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
.user-menu:hover .user-menu-list,
.user-menu:focus-within .user-menu-list,
.user-menu.open .user-menu-list { display: block; }
.user-menu-list form { display: block; margin: 0; }
.user-menu-item,
.user-menu-list form button.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    margin: 0;  /* überschreibt "form button { margin-top }" beim Abmelden */
    padding: 0.5rem 0.9rem;
    border: none;
    border-radius: 0;
    background: var(--card-bg);
    color: var(--fg);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: none;
}
.user-menu-item i { width: 1rem; text-align: center; color: var(--muted); }
.user-menu-item.active { color: var(--accent); }

/* Sprachumschalter "DE | EN" (Benutzermenü bzw. Kopfzeile ohne Anmeldung). */
.user-menu-lang { cursor: default; }
.user-menu-lang .lang-switch { margin-left: auto; }
form.lang-switch { display: inline-flex; gap: 2px; margin: 0; }
form.lang-switch button {
    margin: 0;
    padding: 0.15rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: none;
    cursor: pointer;
}
form.lang-switch button:hover { color: var(--heading); border-color: var(--muted); }
form.lang-switch button.active { color: var(--accent-fg); background: var(--accent); border-color: var(--accent); }
.lang-switch-header { margin-right: 0.3rem; }
.user-menu-sep { height: 1px; margin: 0.3rem 0; background: var(--border); }
.user-menu-item:hover, .user-menu-item:focus-visible,
.user-menu-list form button.user-menu-item:hover { background: color-mix(in srgb, var(--accent) 10%, var(--card-bg)); color: var(--heading); }
.user-menu-item:hover i, .user-menu-item:focus-visible i { color: var(--accent); }

.theme-toggle {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
}

main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

.narrow-main {
    max-width: 420px;
}

/* Ersteinrichtung (/setup): wo der Einrichtungscode steht. */
.setup-hint { margin: 0.8rem 0 1.2rem; padding: 0.6rem 0.9rem; border-left: 3px solid var(--border); background: var(--card-bg); font-size: 0.92em; }
.setup-hint p { margin: 0.2rem 0; }
.setup-hint ul { margin: 0.3rem 0; padding-left: 1.2rem; }
input.mono { font-family: ui-monospace, Consolas, monospace; letter-spacing: 0.08em; text-transform: uppercase; }
input.mono-plain { font-family: ui-monospace, Consolas, monospace; letter-spacing: 0.08em; }

/* Zwei-Faktor-Anmeldung (/account/security): QR-Code immer auf Weiß, auch im dunklen Design. */
.totp-qr { display: inline-block; padding: 10px; background: #fff; border-radius: 6px; line-height: 0; }
.totp-secret { font-size: 1.05em; letter-spacing: 0.05em; word-break: break-all; }
.recovery-codes { columns: 2; padding-left: 1.2rem; margin: 0.4rem 0; }
.recovery-codes code { font-size: 1.02em; }

/* Download-Links zum Mitschnitt eines fehlgeschlagenen Tests (Testtabelle). */
.capture-links { display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; margin-top: 0.3rem; white-space: nowrap; }
.cirrus-auth-box { margin-top: 0.4rem; padding: 0.4rem 0.6rem; border-left: 3px solid var(--border); color: var(--fg); font-size: 0.9em; }
.cirrus-auth-record + .cirrus-auth-record { margin-top: 0.5rem; }

/* Textseiten (Über): angenehme Zeilenlänge statt Formularbreite. */
.text-main {
    max-width: 720px;
}

h1 {
    margin-top: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.7rem;
    color: var(--heading);
}

h2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 2rem;
    color: var(--heading);
}

h3 { color: var(--heading); }

a { color: var(--accent); }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--muted);
}

.back-link:hover { color: var(--accent); }

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

th, td {
    text-align: left;
    padding: 0.55rem 0.7rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
}

th {
    font-weight: 700;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }

.muted { color: var(--muted); font-size: 0.85em; }
/* Hinweis in einer Tabellenzelle: Größe wie .muted, Farbe Warnung (z. B. DNS-Server ohne Antwort) */
.muted.cell-warn { color: var(--warn); }
.ok { color: var(--ok); font-weight: 600; }
.fail { color: var(--fail); font-weight: 600; }
.warn { color: var(--warn); font-weight: 600; }
/* Werte wie Geraetenamen oder Zeitpunkte nicht mitten im Wort umbrechen. */
.nowrap { white-space: nowrap; }
.empty { color: var(--muted); font-style: italic; }

/* Kleine farbige Status-Pille (z.B. "Online", "Portal erkannt") -
   Pendant zu den Badges im AppStack-Vorbild. */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.pill-ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.pill-fail { background: color-mix(in srgb, var(--fail) 14%, transparent); color: var(--fail); }
.pill-warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.pill-muted { background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); }
/* mehrere Pills in einer Zelle (z. B. Standorte eines Benutzers) */
.pill-list { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; }
/* Pill als Link (Profile/SSIDs: Gerät, SSID, Profil, Standort) */
a.pill { text-decoration: none; }
/* Farbe je Typ (--pill-c aus der Palette, ohne Grün/Orange/Rot - die stehen für
   Status und Sicherheit); Schrift Richtung Überschriftenfarbe gemischt, damit auch
   helle Töne lesbar bleiben (hell dunkler, dunkel heller). */
.pill-link {
    background: color-mix(in srgb, var(--pill-c, var(--accent)) 14%, transparent);
    color: color-mix(in srgb, var(--pill-c, var(--accent)) 52%, var(--heading));
}
a.pill-link:hover { background: color-mix(in srgb, var(--pill-c, var(--accent)) 26%, transparent); }
.pill-site { --pill-c: var(--spec-3); }
.pill-ssid { --pill-c: var(--spec-4); }
.pill-device { --pill-c: var(--spec-2); }
.pill-profile { --pill-c: var(--spec-1); }
/* Sprungziel /sites#site-<id> kurz hervorheben */
tr:target > td { background: color-mix(in srgb, var(--accent) 8%, transparent); }

/* Wartungsfenster: Hinweis (Geräte, Störungen) und Formular (/maintenance) */
.maint-banner { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.6rem; margin: 0.6rem 0 1rem; padding: 0.55rem 0.9rem;
    border-left: 3px solid var(--warn); border-radius: 6px; background: color-mix(in srgb, var(--warn) 12%, transparent); }
.maint-banner > i { color: var(--warn); }
.maint-banner > span { flex: 1 1 18rem; }
.maint-new { margin: 0.6rem 0 1.4rem; }
.maint-new .cred-row + .cred-row { margin-top: 0.6rem; }
.maint-new .step i { font-size: 0.75rem; }
/* Pausieren/Fortsetzen im Gerätekopf neben "Konfiguration", Auswahl als Aufklappfeld */
h1 .pause-btn { margin-top: 0; padding: 0.4rem 0.9rem; font-size: 0.85rem; }
/* Fortsetzen-Formular: Flex statt Block, sonst sitzt der Knopf auf der Grundlinie und rutscht nach unten */
h1 > .inline-form { display: flex; }
details.pause-menu { position: relative; border: 0; background: none; padding: 0; margin: 0; border-radius: 0; font-size: 1rem; font-weight: 400; color: var(--fg); }
.pause-menu > summary { list-style: none; }
.pause-menu > summary::-webkit-details-marker { display: none; }
.pause-menu-panel {
    position: absolute; z-index: 20; left: 0; top: calc(100% + 0.35rem); width: 24rem; max-width: calc(100vw - 2rem);
    padding: 0.8rem 0.9rem; background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); box-shadow: var(--card-shadow);
}
.pause-menu-panel .inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.pause-menu-panel select { width: auto; }
.pause-menu-panel .btn-small { margin-top: 0; }
@media (max-width: 700px) {
    /* Schmal: Feld über die ganze Breite unter der Überschrift statt am Knopf */
    h1:has(> .pause-menu) { position: relative; }
    details.pause-menu { position: static; }
    .pause-menu-panel { left: 0; right: 0; width: auto; max-width: none; }
}
.pause-menu-panel .muted { margin: 0.6rem 0 0; font-size: 0.85rem; }

/* Qualitätsindex (/quality) */
.q-site {
    margin-bottom: 1.5rem;
    padding: 0.9rem 1.3rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
}
.q-site > h2:first-child { margin-top: 0; }
/* Tabellen im Standort-Block liegen schon auf dessen Karte. */
.q-site .table-card { margin: 0.4rem 0 0; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
@media (max-width: 640px) {
    .q-site { padding: 0.7rem 0.8rem 0.8rem; }
    /* Aufgeklappte Rechnung: Tabelle und Verlauf untereinander, Text linksbündig */
    .q-detail-grid { grid-template-columns: minmax(0, 1fr); }
    table.stack-mobile > tbody > tr.q-detail > td { text-align: left; }
    table.stack-mobile > tbody > tr.q-detail > td::before { content: none; }
    .q-detail-grid > * { min-width: 0; overflow-x: auto; }
    .q-calc th, .q-calc td:first-child { white-space: nowrap; }
}
.q-site h2 { gap: 0.6rem; justify-content: flex-start; }
.q-site h3 { margin: 1.1rem 0 0.4rem; font-size: 1rem; color: var(--heading); }
.q-score { min-width: 2.6rem; justify-content: center; font-weight: 800; }
.q-score-big { font-size: 1.05rem; padding: 0.2rem 0.7rem; }
.q-trend { font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.q-trend.ok { color: var(--ok); }
.q-trend.fail { color: var(--fail); }
.q-dims { display: flex; flex-wrap: wrap; gap: 0.25rem; }
/* gleiche Spalten in allen Tabellen einer Seite (SSIDs, APs, Probes) */
.q-table { table-layout: fixed; width: 100%; }
.q-table .q-col-score { width: 6.5rem; }
.q-table .q-col-name { width: 24%; }
.q-table .q-col-n { width: 7.5rem; }
.q-table .q-col-dims { width: 30%; }
.q-table td { overflow-wrap: anywhere; }
.q-dim { display: inline-flex; align-items: center; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
@media (max-width: 760px) { .q-table { table-layout: auto; } }
.q-dim.pill-ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.q-dim.pill-warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.q-dim.pill-fail { background: color-mix(in srgb, var(--fail) 14%, transparent); color: var(--fail); }
.q-penalty { display: inline-block; margin-right: 0.7rem; font-size: 0.85rem; white-space: nowrap; }
.q-penalty strong { color: var(--fail); }
.q-few .q-score { opacity: 0.6; }
.q-few td { color: var(--muted); }
.q-prelim { display: inline-block; margin-left: 0.3rem; padding: 0 0.4rem; border: 1px dashed var(--border); border-radius: 999px; font-size: 0.72rem; color: var(--muted); }
.q-score-btn { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0; border: 0; background: none; cursor: pointer; color: var(--muted); font: inherit; }
.q-score-btn:hover .q-score { filter: brightness(0.95); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.q-chev { font-size: 0.7rem; transition: transform 0.15s; }
.q-score-btn[aria-expanded="true"] .q-chev { transform: rotate(180deg); }
tr.q-detail > td { background: color-mix(in srgb, var(--accent) 4%, var(--card-bg)); padding: 0.8rem 1rem; }
.q-detail-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.2rem; align-items: start; }
@media (max-width: 1000px) { .q-detail-grid { grid-template-columns: 1fr; } }
.q-calc { width: 100%; font-size: 0.86rem; }
.q-calc th, .q-calc td { padding: 0.3rem 0.5rem; vertical-align: top; }
.q-calc tr.q-missing td { color: var(--muted); }
.q-item { margin: 0.1rem 0; }
.q-minus { color: var(--fail); margin-left: 0.3rem; }
.q-calc-note { margin: 0.4rem 0 0; font-size: 0.8rem; }
.q-chart { position: relative; height: 220px; }
.q-chart-site { height: 200px; max-width: 60rem; margin: 0.4rem 0 0.8rem; }
.q-hint { margin: -0.2rem 0 0.4rem; font-size: 0.85rem; max-width: 60rem; }
.q-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 0.3rem; }
.q-sep-label { align-self: center; font-size: 0.85rem; }
.q-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin: 0.2rem 0 1.4rem; }
.q-legend-item { display: inline-flex; align-items: center; gap: 0.4rem; }
.q-dim.q-dim-neutral { border: 1px solid var(--border); color: var(--fg); }

details {
    border: 1px solid var(--border);
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.8rem;
    margin-bottom: 0.5rem;
}

summary { cursor: pointer; font-weight: 600; }

code {
    background: color-mix(in srgb, var(--muted) 15%, transparent);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

pre {
    background: color-mix(in srgb, var(--muted) 12%, transparent);
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
}

.btn, form button, .btn-secondary, .btn-remove, .btn-small, .btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-family: inherit;
    text-decoration: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: filter 0.12s ease, transform 0.05s ease;
}

.btn:active, form button:active, .btn-secondary:active, .btn-remove:active,
.btn-danger:active { transform: translateY(1px); }

.btn:hover, form button:hover, .btn-danger:hover { filter: brightness(1.08); }
.btn-secondary:hover, .btn-remove:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }

.btn {
    font-size: 0.85rem;
    font-weight: 700;
    background: var(--accent);
    color: var(--accent-fg);
    padding: 0.45rem 0.9rem;
    vertical-align: middle;
}

.ssid-chart-block {
    margin-bottom: 1.8rem;
}

.ssid-chart-block h3 {
    margin-bottom: 0.4rem;
}

.chart-row {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.chart-col {
    flex: 1 1 320px;
    /* min() statt fester 280px: auf sehr schmalen Displays darf die Spalte
       schmaler als 280px werden, statt die Seite seitlich zu sprengen. */
    min-width: min(280px, 100%);
}

/* Volle Breite, z.B. Zeitdiagramm (Assoziation/802.1X/DHCP) in eigener Zeile */
.chart-col-wide {
    flex: 1 1 100%;
}

.chart-row + .chart-row {
    margin-top: 1.2rem;
}

.chart-label {
    margin: 0 0 0.2rem;
}

.scan-filters {
    display: flex;
    gap: 1.2rem;
    flex-wrap: wrap;
    align-items: flex-end;
    margin: 0.8rem 0 1rem;
}

.scan-filters label {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
    font-weight: 600;
    gap: 0.25rem;
}

/* Automatische Aktualisierung (Geraeteliste): rechts in der Filterleiste,
   Countdown links neben der Auswahl auf Hoehe des Feldes. */
.scan-filters .refresh-control {
    margin-left: auto;
    display: flex;
    align-items: flex-end;
    gap: 0.8rem;
}

.scan-filters .refresh-control > .muted {
    padding-bottom: 0.45rem;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* Checkbox in der Filterleiste: auf Hoehe der Eingabefelder, Text daneben. */
.scan-filters label.filter-check span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0;
    font-weight: 400;
}

.scan-filters input[type="checkbox"] {
    padding: 0;
}

.scan-filters input,
.scan-filters select {
    padding: 0.4rem 0.55rem;
    background: var(--card-bg);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.scan-block {
    margin-bottom: 0.5rem;
}

/* Sortierbare Spaltenkoepfe: Scan-Tabelle (Geraeteseite) und Geraeteliste. */
table.scan-table th[data-sort],
table.sortable th[data-sort] {
    cursor: pointer;
    user-select: none;
}

table.scan-table th[data-sort]:hover,
table.sortable th[data-sort]:hover {
    text-decoration: underline;
}

table.scan-table th[data-sort][data-dir="asc"]::after,
table.sortable th[data-sort][data-dir="asc"]::after {
    content: " \25B2";
}

table.scan-table th[data-sort][data-dir="desc"]::after,
table.sortable th[data-sort][data-dir="desc"]::after {
    content: " \25BC";
}

/* Kanalbelegung unter der Netzliste: nur 5 schmale Spalten, daher nicht
   ueber die volle Breite ziehen. */
table.survey-table { width: auto; min-width: 50%; }

/* Spektrumansicht im Scan-Tab (static/spectrum.js). */
.spectrum-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.2rem 0.6rem;
    margin: 1rem 0 1.5rem;
}
.spectrum-head { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.spectrum-bands { margin-left: auto; display: inline-flex; gap: 0.4rem; }
.spectrum-band.active { color: var(--accent-fg); background: var(--accent); border-color: var(--accent); }
.spectrum-band:disabled { opacity: 0.4; cursor: default; }
.spectrum-legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; margin: 0.6rem 0 0.2rem; font-size: 0.85rem; color: var(--fg); }
.spec-legend-item { display: inline-flex; align-items: center; gap: 0.4rem; }
.spec-key { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.spectrum-wrap { position: relative; }
#spectrumSvg { display: block; width: 100%; height: 280px; }
.spec-grid line { stroke: var(--border); stroke-width: 1; }
.spec-grid line.spec-base { stroke: var(--muted); }
.spec-axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.spec-mark { stroke-width: 2; fill-opacity: 0.12; stroke-linejoin: round; cursor: pointer; outline: none; }
.spec-other { stroke: var(--spec-other); fill: var(--spec-other); stroke-width: 1.2; fill-opacity: 0.05; stroke-opacity: 0.7; }
.spec-mark:hover, .spec-mark:focus { stroke-width: 3; fill-opacity: 0.3; stroke-opacity: 1; }
.spec-label { fill: var(--heading); font-size: 11.5px; font-weight: 700; paint-order: stroke; stroke: var(--card-bg); stroke-width: 3px; pointer-events: none; }
.spectrum-tip {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--card-shadow);
    padding: 0.45rem 0.65rem;
    font-size: 0.82rem;
    line-height: 1.4;
    white-space: nowrap;
}
.spectrum-tip strong { font-size: 0.95rem; color: var(--heading); }

/* Tab "Verlauf" (static/timeline.js). */
.timeline-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.9rem 1.1rem 0.6rem;
    margin: 0.8rem 0 1.2rem;
}
.timeline-title { font-weight: 700; color: var(--heading); margin-bottom: 0.4rem; }
.timeline-canvas { position: relative; height: 280px; }
.timeline-empty { margin: 0.5rem 0; }
/* Zeitraum: Voreinstellungen + "Zeitraum wählen" als eine Leiste, Von/Bis klappt darunter auf. */
.timeline-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin: 0.2rem 0 0.6rem; }
.range-group { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.range-group button {
    margin: 0; border: 0; border-radius: 0; background: none; color: var(--fg);
    padding: 0.4rem 0.8rem; font-size: 0.88rem; font-weight: 600; cursor: pointer;
}
.range-group button + button { border-left: 1px solid var(--border); }
.range-group button:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.range-group button.active { background: var(--accent); color: var(--accent-fg); }
.range-group button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.timeline-custom-toggle i { margin-right: 0.3rem; }
.timeline-custom-toggle[aria-expanded="true"]:not(.active) { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.timeline-current { color: var(--muted); font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.timeline-custom {
    margin: 0 0 0.8rem; padding: 0.8rem 1rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card-bg);
}
.timeline-custom[hidden] { display: none; }
.timeline-presets { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.7rem; }
.chip-btn {
    margin: 0; padding: 0.25rem 0.75rem; font-size: 0.85rem; font-weight: 600;
    border: 1px solid var(--border); border-radius: 999px; background: none; color: var(--fg); cursor: pointer;
}
.chip-btn:hover { border-color: var(--accent); color: var(--accent); }
a.chip-btn { display: inline-block; text-decoration: none; }
.chip-btn.active, .chip-btn.active:hover { border-color: var(--accent); background: var(--accent); color: var(--accent-fg); }
.timeline-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem 0.8rem; }
.timeline-fields fieldset { display: flex; gap: 0.4rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.timeline-fields legend { padding: 0; margin-bottom: 0.25rem; font-size: 0.82rem; font-weight: 700; color: var(--muted); }
.timeline-fields input[type="date"], .timeline-fields input[type="time"] { width: auto; margin: 0; font-variant-numeric: tabular-nums; }
.timeline-fields input[type="date"] { min-width: 9.5rem; }
.timeline-fields input[type="time"] { min-width: 6.5rem; }
/* Kalender-/Uhr-Symbol gedämpft wie die übrigen Icons */
form input[type="date"]::-webkit-calendar-picker-indicator,
form input[type="time"]::-webkit-calendar-picker-indicator { opacity: 0.55; cursor: pointer; }
form input[type="date"]::-webkit-calendar-picker-indicator:hover,
form input[type="time"]::-webkit-calendar-picker-indicator:hover { opacity: 0.9; }
/* Anzeigen-Knopf so hoch wie die Felder */
.timeline-fields button { margin: 0; padding: 0 1rem; min-height: 2.5rem; font-size: 0.95rem; }
.timeline-arrow { color: var(--muted); padding-bottom: 0.6rem; }
.timeline-hint { margin: 0.5rem 0 0; font-size: 0.82rem; }
.timeline-hint.fail { color: var(--fail); }
@media (max-width: 560px) { .timeline-arrow { display: none; } }

/* Roaming-Fähigkeiten in der Scan-Tabelle (11k/NR/11v/11r). */
.cap-tag {
    display: inline-block;
    padding: 0 0.35rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    white-space: nowrap;
}

form label {
    display: block;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--heading);
    margin: 1rem 0 0.35rem;
}

form input[type="text"],
form input[type="email"],
form input[type="number"],
form input[type="password"],
form input[type="date"],
form input[type="time"],
form input[type="datetime-local"],
form select {
    width: 100%;
    max-width: 360px;
    padding: 0.5rem 0.65rem;
    background: var(--card-bg);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
}

form input:focus, form select:focus, form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

form button {
    margin-top: 1.2rem;
    background: var(--accent);
    color: var(--accent-fg);
    border: none;
    padding: 0.55rem 1.3rem;
    font-size: 0.95rem;
    font-weight: 700;
}

.config-form fieldset {
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 1.2rem 0;
    padding: 0.4rem 1.2rem 1.2rem;
}

.config-form legend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 800;
    color: var(--heading);
    padding: 0 0.4rem;
}

.config-form legend i { color: var(--accent); }

/* Ziel-SSID-Karten auf der Konfigurationsseite (inkl. 802.1X-Felder) */
/* Gerät mit Profil: eigene Einstellungen bleiben sichtbar, aber abgeblendet. */
.dimmed-settings { opacity: 0.45; }
.plain-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.ssid-picker { list-style: none; padding: 0; margin: 0.5rem 0; }
.ssid-picker li { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
    padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--border); }
.ssid-picker .check-label { margin: 0; }
.ssid-move { white-space: nowrap; }
.eap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0 1.2rem;
}

/* Gruppen innerhalb einer Ziel-SSID-Karte (Captive Portal, iperf3, ...) -
   eine leichte Trennlinie + kleiner Titel statt eines eigenen fieldset,
   damit klar ist: das gilt alles nur fuer diese eine SSID. */
.target-section {
    border-top: 1px solid var(--border);
    margin-top: 0.7rem;
    padding-top: 0.6rem;
}

.target-section-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.4rem;
}

.target-section-title i { color: var(--accent); }

.eap-grid input[type="text"],
.eap-grid input[type="password"],
.eap-grid select {
    max-width: none;
}

.target-card textarea {
    display: block;
    width: 100%;
    max-width: 640px;
    box-sizing: border-box;
    background: var(--card-bg);
    color: var(--fg);
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 0.78rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

/* "Gespeicherten Wert entfernen" neben Passwortfeldern (nur schreiben, siehe device_config.php). */
.secret-clear { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0.3rem 0 0; font-size: 0.85rem; font-weight: 400; }
.secret-clear input { width: auto; margin: 0; }
/* Änderungsprotokoll (_audit_list.php). */
.audit-table td { vertical-align: top; }
.audit-table td.nowrap { white-space: nowrap; }
.audit-change { margin: 0.1rem 0; overflow-wrap: anywhere; }

/* Passwortfeld mit Anzeigen/Verbergen-Schalter */
.pw-field {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    max-width: 360px;
}

.pw-field input {
    flex: 1 1 auto;
    min-width: 0;
}

.pw-field .pw-toggle {
    margin-top: 0;
    white-space: nowrap;
}

label.check-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
    color: var(--fg);
    align-self: end;
}

.btn-secondary {
    margin-top: 0.6rem;
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 0.45rem 1rem;
    font-size: 0.88rem;
    font-weight: 700;
}

.btn-remove {
    background: transparent;
    color: var(--fail);
    border: 1px solid color-mix(in srgb, var(--fail) 50%, transparent);
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
    margin-top: 0;
}

.btn-small {
    padding: 0.3rem 0.65rem;
    font-size: 0.78rem;
}

/* Rohdaten-Link neben "Löschen" in Tabellenzeilen - dort ohne den
   sonstigen .btn-secondary-Standardabstand nach oben, sonst wirkt er
   gegenüber dem danebenstehenden .btn-remove verrutscht. */
.raw-link {
    margin-top: 0;
}

.btn-danger {
    background: var(--fail);
    color: #fff;
    border: none;
    padding: 0.55rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 700;
}

.inline-form {
    display: inline-block;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-top: 1.2rem;
}

.form-actions button {
    margin-top: 0;
}

.h2-actions {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.test-bulk-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin: 0.6rem 0;
}

.test-filter-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.test-bulk-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.test-bulk-count {
    font-size: 0.82rem;
}

.test-bulk-delete-form {
    display: none;
}

.inline-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
}

.inline-label select {
    padding: 0.3rem 0.45rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--fg);
}

/* Status-Punkt (online/offline) auf Übersichts- und Detailseite */
.status-dot {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    margin-right: 0.35rem;
    vertical-align: middle;
}

.status-online { background: var(--ok); }
.status-offline { background: var(--fail); }

/* Kennzahlen-Kacheln oben auf der Geräte-Detailseite */
/* Raster statt Flex: alle Kacheln einer Reihe gleich breit, eine einzelne
   Kachel in der letzten Zeile bleibt so breit wie die darueber (auto-fit
   streckt nur, solange alle in eine Zeile passen). */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 1rem 0 1.8rem;
}

.kpi-tile {
    background: var(--card-bg);
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.kpi-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 700;
}

.kpi-sub { display: block; margin-top: 0.3rem; font-size: 0.82rem; font-weight: 600; }
.kpi-sub.warn { color: var(--warn); }
.kpi-sub.muted { font-weight: 400; }
.kpi-label i {
    color: var(--accent);
    font-size: 0.95em;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--heading);
}

.kpi-value.fail { color: var(--fail); }
.kpi-value.warn { color: var(--warn); }

/* Mehrzeiliger Wert (z.B. mehrere IPs) etwas kleiner als eine Zahl */
.kpi-value-small { font-size: 1rem; line-height: 1.4; }

.link-cell { font-size: 0.85rem; }

/* Tabs auf der Geräte-Detailseite */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border);
    margin: 1.5rem 0 1rem;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    padding: 0.6rem 0.9rem;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
}

.tab-btn i { font-size: 0.9em; }

.tab-btn:hover { color: var(--fg); }

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-btn .status-dot { margin-right: 0; }

.tab-panel[hidden] { display: none; }

/* Breite Tabellen scrollen im Container statt die Seite zu sprengen */
.table-scroll { overflow-x: auto; }

/* Kleine Displays (Handy): engere Abstände, kleinere Überschriften,
   Tabs zum seitlichen Wischen statt umbrechen */
@media (max-width: 640px) {
    header { padding: 0.8rem 1rem; }
    main { padding: 1rem; }
    h1 { font-size: 1.4rem; }
    h2 { margin-top: 1.4rem; font-size: 1.15rem; }
    th, td { padding: 0.4rem 0.45rem; font-size: 0.85rem; }
    .kpi-row { gap: 0.6rem; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
    .kpi-tile { padding: 0.75rem 0.9rem; }
    .kpi-value { font-size: 1.2rem; }
    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .tab-btn { white-space: nowrap; padding: 0.5rem 0.7rem; }
    .scan-filters { gap: 0.7rem; }
    form input[type="text"],
    form input[type="email"],
    form input[type="number"],
    form input[type="password"],
    form select { max-width: none; }
    .pw-field { max-width: none; }
}

/* Gefahrenzone auf der Konfigurationsseite */
.danger-zone {
    margin-top: 2.5rem;
    padding: 1.1rem 1.3rem;
    background: color-mix(in srgb, var(--fail) 5%, var(--card-bg));
    border: 1px solid color-mix(in srgb, var(--fail) 35%, transparent);
    border-radius: var(--radius);
}

.danger-zone h2 {
    margin-top: 0;
    color: var(--fail);
    justify-content: flex-start;
    gap: 0.5rem;
}

.danger-zone .inline-form {
    margin-right: 0.6rem;
}

.scan-delete-form {
    margin: 0.5rem 0;
}

/* Zeile zum Cirrus-Abgleich über der Geräteliste */

/* Leiste über der Geräteliste: Suche, Knopf für weitere Filter, Aktualisierung */
.device-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 0.8rem;
    margin: 1rem 0 0.4rem;
}
.toolbar-search {
    position: relative;
    flex: 1 1 10rem;
    max-width: 17rem;
}
.toolbar-search i {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 0.8rem;
    pointer-events: none;
}
.toolbar-search input {
    width: 100%;
    padding: 0.4rem 0.6rem 0.4rem 1.9rem;
    background: transparent;
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
}
.toolbar-search input:focus { border-color: var(--accent); outline: none; background: var(--card-bg); }
.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.38rem 0.7rem;
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}
.toolbar-btn:hover, .toolbar-btn[aria-expanded="true"] { color: var(--fg); border-color: var(--muted); }
.toolbar-btn.is-active { color: var(--accent); border-color: var(--accent); }
.toolbar-btn:focus-visible, .toolbar-search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.filter-badge {
    min-width: 1.15rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-fg);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.15rem;
    text-align: center;
}
.device-toolbar .refresh-control {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.device-toolbar .refresh-control > .muted { font-size: 0.8rem; white-space: nowrap; }
.toolbar-select { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--muted); font-size: 0.8rem; }
.toolbar-select select {
    padding: 0.3rem 0.4rem;
    background: transparent;
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
}
.filter-panel[hidden] { display: none; }
.filter-panel {
    margin: 0.3rem 0 0.6rem;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
}

/* Geräteliste (Startseite): ruhig, solange alles läuft - Farbe nur für
   Abweichungen. Zahlen rechtsbündig mit gleich breiten Ziffern, Geräte
   nach Standort gruppiert (Kopfzeilen verschwinden beim Sortieren). */
.device-table th {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.82rem;
    white-space: nowrap;
}
.device-table td { vertical-align: top; font-variant-numeric: tabular-nums; }
.device-table .num { text-align: right; }
.device-table .muted { font-size: inherit; }

.device-table tr.site-row th {
    padding: 1.3rem 0.7rem 0.45rem;
    color: var(--heading);
    font-size: 0.95rem;
    font-weight: 800;
    border-bottom: 2px solid color-mix(in srgb, var(--accent) 45%, var(--border));
    cursor: default;
}
.device-table tr.site-row:first-child th { padding-top: 0.6rem; }
.device-table tr.site-row:hover { background: none; }
.device-table .site-count { margin-left: 0.6rem; color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.device-table.is-sorted tr.site-row { display: none; }
/* Tabellen der Listenseiten als Karte. Auf dem Handy tragen Tabellen mit
   stack-mobile je Zeile eine eigene Karte, dann entfällt die äußere. */
.table-card {
    margin: 1rem 0;
    padding: 0.3rem 0.6rem 0.4rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
}
.table-card > table { margin: 0; }
.table-card > table > tbody > tr:last-child > td { border-bottom: 0; }
@media (max-width: 640px) {
    .table-card:has(> table.stack-mobile) { margin: 0.6rem 0; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
}

.dev-cell { min-width: 13rem; }
.dev-name { color: var(--heading); font-weight: 700; text-decoration: none; white-space: nowrap; }
.dev-name:hover, .dev-name:focus-visible { color: var(--accent); text-decoration: underline; }
/* Kleine Plakette neben dem Gerätenamen (z.B. Modus Monitor) */
.pill.dev-badge { margin-left: 0.35rem; padding: 0.05rem 0.45rem; font-size: 0.68rem; vertical-align: 0.1em; }
/* Geräte-ID neben dem Anzeigenamen (device_label_html()) */
.dev-id { color: var(--muted); font-size: 0.75em; font-weight: 400; margin-left: 0.3em; white-space: nowrap; }
.dot-online { background: var(--ok); }
.dev-flag { margin-left: 0.5rem; font-size: 0.85rem; white-space: nowrap; }
.dev-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.9rem;
    margin: 0.15rem 0 0 0.9rem;
    color: var(--muted);
    font-size: 0.8rem;
}
.dev-if { opacity: 0.75; }

.td-sub { display: block; color: var(--muted); font-size: 0.8rem; }
.td-sub > span + span { margin-left: 0.6rem; }
.unit { margin-left: 0.1em; color: var(--muted); font-size: 0.85em; }

/* Testverlauf: ein Strich je Test, Höhe = Assoziationszeit */
.hist-cell { white-space: nowrap; }
/* Balken füllen die Spaltenbreite (die Tabelle verteilt übrigen Platz auf alle Spalten). */
.hist {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    width: 100%;
    min-width: 148px;
    height: 1.35rem;
}
.hb {
    flex: 1 1 3px;
    min-width: 3px;
    max-width: 8px;
    border-radius: 1px;
    /* Erfolgreiche Tests in der Akzentfarbe (Blau), damit Orange/Rot klar abstechen. */
    background: color-mix(in srgb, var(--accent) 75%, var(--card-bg));
}
.hb-slow { background: var(--warn); }
.hb-fail { background: var(--fail); }
.hb:hover { background: var(--heading); }

/* Nur für Screenreader sichtbarer Text */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Umschalter: Checkbox im Look eines Schiebeschalters */
.switch {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    position: relative;
    cursor: pointer;
}
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
    flex: none;
    width: 2.3rem;
    height: 1.3rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--muted) 45%, transparent);
    position: relative;
    transition: background 0.15s;
}
.switch-track::after {
    content: "";
    position: absolute;
    top: 0.15rem;
    left: 0.15rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.15s;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(1rem); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
    .switch-track, .switch-track::after { transition: none; }
}

/* Alarmierung eines Standorts: Was / Wohin / Wann / nur Anzeige */
/* Seiten hinter der Navigation sind alle gleich breit (main, 1400 px); Fließtext
   bleibt bei einer lesbaren Zeilenlänge, Eingabefelder haben eigene Maximalbreiten. */
.alert-summary, .rule-hint, .rule-text, main > p.muted { max-width: 80ch; }
.alert-page form label { margin: 0; font-size: inherit; font-weight: 400; color: inherit; display: inline-flex; }
.alert-page form button { margin-top: 0; }
.alert-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem 2rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.alert-head h1 { margin: 0; }
.alert-site { color: var(--accent); }
.alert-summary { margin: 0.3rem 0 0; color: var(--muted); }
.alert-head .switch { font-weight: 700; color: var(--heading); }
.alert-head .switch-track { width: 2.9rem; height: 1.6rem; }
.alert-head .switch-track::after { width: 1.3rem; height: 1.3rem; }
.alert-head .switch input:checked + .switch-track::after { transform: translateX(1.3rem); }

.alert-section {
    margin-top: 1rem;
    padding: 1.1rem 1.3rem 1.2rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: opacity 0.15s;
}
#siteAlertingForm.is-off .alert-section { opacity: 0.5; }
.alert-section h2 { justify-content: flex-start; margin: 0 0 0.8rem; font-size: 1.05rem; }
.step {
    display: inline-grid;
    place-items: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 800;
}

.rule {
    display: grid;
    grid-template-columns: 3.4rem 1fr;
    align-items: start;
    gap: 0.8rem;
    padding: 0.65rem 0;
    border-top: 1px solid var(--border);
}
.rule:first-of-type { border-top: none; }
.rule > .switch { margin-top: 0.3rem; }
.rule.is-disabled .rule-text, .rule.is-disabled .rule-hint { opacity: 0.55; }
.rule-fixed {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted);
}
.rule-text { margin: 0.2rem 0; line-height: 2.1; color: var(--fg); }
.os-packages { margin: 0.4rem 0; }
.os-packages table { width: auto; font-size: 0.85rem; }
.os-packages td, .os-packages th { padding: 0.15rem 0.8rem 0.15rem 0; }
.os-log { max-height: 16rem; overflow: auto; font-size: 0.78rem; white-space: pre-wrap; }
.os-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }
.os-actions form button { margin-top: 0; }
.os-actions .btn-small:not(.btn-secondary) { border: 1px solid transparent; }
.os-actions .rule-hint, .os-actions p { flex-basis: 100%; max-width: none; margin: 0; }
.rule-hint { display: block; margin: 0; color: var(--muted); font-size: 0.82rem; line-height: 1.4; }

.alert-page form input.inline-num,
.alert-page form select.inline-select {
    display: inline-block;
    width: 4.6rem;
    max-width: none;
    margin: 0 0.25rem;
    padding: 0.25rem 0.45rem;
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.alert-page form select.inline-select { width: auto; text-align: left; font-weight: 400; }
.alert-page form input.inline-num:disabled { background: transparent; border-style: dashed; }

/* E-Mail und Telegram teilen sich eine Zeile, Benutzer darunter über die volle Breite. */
.channel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 640px) {
    .channel-grid { grid-template-columns: 1fr; }
}
.channel-card {
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.channel-head { display: flex; justify-content: space-between; align-items: center; }
.channel-name { font-weight: 700; color: var(--heading); }
.alert-page form label.field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
.alert-page form label.field input { max-width: none; }
.channel-state { margin: 0; font-size: 0.82rem; color: var(--muted); }
.channel-state i { color: var(--ok); }
.channel-state.warn { color: var(--warn); font-weight: 400; }
.channel-state.warn i { color: var(--warn); }

.segmented {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.segmented label { position: relative; }
.segmented input, .chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span { display: block; padding: 0.4rem 0.9rem; cursor: pointer; font-size: 0.9rem; }
.segmented label + label span { border-left: 1px solid var(--border); }
.segmented input:checked + span { background: var(--accent); color: var(--accent-fg); }
.segmented input:focus-visible + span, .chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }

.schedule { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem 1.4rem; margin: 0.9rem 0 0.3rem; }
.schedule[hidden] { display: none; }
.day-chips { display: flex; gap: 0.3rem; }
.chip { position: relative; }
.chip span {
    display: inline-grid;
    place-items: center;
    min-width: 2.4rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.85rem;
    cursor: pointer;
}
.chip input:checked + span { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: var(--accent); color: var(--heading); font-weight: 700; }
.hours { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); }
.alert-page form .hours select { width: auto; padding: 0.3rem 0.5rem; }

.alert-actions {
    position: sticky;
    bottom: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem 0.8rem;
    margin-top: 1rem;
    padding: 0.8rem 0;
    background: var(--bg);
    border-top: 1px solid var(--border);
}
.alert-actions .muted { margin-right: auto; }
.alert-footnote { margin-top: 1.2rem; }
.section-hint { margin: -0.4rem 0 0.8rem; }

/* Zugangsdaten für die Alarmierung: Zeilen in den Kanal-Karten */
.creds-grid { margin-top: 0.4rem; align-items: start; }
/* Integrationen und Alarm-Zugangsdaten: Karten untereinander statt nebeneinander */
.channel-grid.integrations-stack { grid-template-columns: 1fr; }
.integrations-stack > .channel-card {   /* eigenständige Karten (Integrationen, Alarm-Zugangsdaten), nicht in einer alert-section */
    padding: 1.1rem 1.3rem 1.2rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
}
.cred-row { display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.4rem 0.8rem; align-items: start; }
.cred-label { padding-top: 0.45rem; font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.cred-fields { display: flex; gap: 0.5rem; min-width: 0; }
.cred-stack { flex-direction: column; }
.alert-page form .cred-fields input[type="text"],
.alert-page form .cred-fields input[type="number"],
.alert-page form .cred-fields input[type="password"] { max-width: none; }
.alert-page form .cred-fields input.port { width: 5.5rem; flex: none; }
.cred-fields .grow { flex: 1 1 auto; min-width: 0; }
/* AP-Auswahl der Ziel-SSID: Modus und Band-Haken in einer umbrechenden Zeile. */
.cred-fields.ap-select { flex-wrap: wrap; align-items: center; }
.inline-check { display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 400; white-space: nowrap; }
.inline-check input { width: auto; margin: 0; }
/* Anlegen-Seiten (Gerät, Standort): Karten wie auf der Konfigurationsseite */
.form-page .alert-section .cred-row + .cred-row { margin-top: 0.9rem; }
.alert-page form label.cred-label { display: block; padding-top: 0.45rem; font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.form-page .cred-fields input[type="text"], .form-page .cred-fields input[type="email"], .form-page .cred-fields input[type="password"], .form-page .cred-fields input[type="datetime-local"], .form-page .cred-fields select { width: 100%; max-width: 30rem; }
.form-page .check-list { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; padding-top: 0.45rem; }
.form-page .check-list label.check-label { display: inline-flex; align-items: center; gap: 0.4rem; }
.form-page .alert-section > .rule-hint { margin: -0.3rem 0 0.4rem; }
.form-page .alert-section > p:last-child { margin-bottom: 0; }
.form-page .cred-row, .form-page .contact-row { grid-template-columns: 10rem 1fr; gap: 0.4rem 0.8rem; }   /* eine Beschriftungsspalte für alle Zeilen */
@media (max-width: 640px) { .form-page .cred-row, .form-page .contact-row { grid-template-columns: 1fr; } }
.form-page .rule-hint code { font-size: 0.78rem; }
.form-page .form-actions .btn-secondary { margin-top: 0; padding: calc(0.55rem - 1px) 1.3rem; font-size: 0.95rem; line-height: normal; display: inline-flex; align-items: center; text-decoration: none; }
.alert-page .pw-field { max-width: none; }
.alert-page form label.secret-clear { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; color: var(--muted); }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.7rem; padding-top: 0.6rem; border-top: 1px solid var(--border); }
.action-result { margin: 0; font-size: 0.88rem; }
.ok-text { color: var(--ok); }
.alert-summary .warn, .alert-summary .ok-text { font-weight: 400; margin-left: 0.3rem; }
.chat-table { margin: 0; font-size: 0.85rem; }
.chat-table td, .chat-table th { padding: 0.35rem 0.5rem; }
.used-by { margin: 1rem 0 0; }

/* Gerätekonfiguration / Profile / SSIDs */
.alert-page form input.inline-text {
    display: inline-block;
    width: 11rem;
    max-width: none;
    margin: 0 0.25rem;
    padding: 0.25rem 0.45rem;
}
.alert-page form input.inline-text.short { width: 5rem; }
.alert-page form input.wide { max-width: none; width: 100%; }
.alert-page form textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 0.5rem 0.65rem;
    background: var(--card-bg);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.9rem;
}
.alert-page form .cred-fields select { width: auto; max-width: 100%; }
.alert-page form .cred-stack > input[type="text"],
.alert-page form .cred-stack > input[type="email"],
.alert-page form .cred-stack > input[type="password"],
.alert-page form .cred-stack > select { max-width: 420px; }
.profile-block { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 0.8rem; }
.profile-block[hidden] { display: none; }
.alert-page form .profile-block a.btn-small { margin: 0; }
.alert-page fieldset.plain-fieldset { border: 0; padding: 0; margin: 0; background: none; box-shadow: none; }
.to-profile { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem; margin-top: 1.2rem; }

/* Klapp-Elemente der neuen Seiten ohne den globalen Kasten-Stil von details */
details.advanced, details.tab-more, details.chart-legend { border: 0; background: none; padding: 0; border-radius: 0; margin: 0; }
details.target-card { padding: 0; margin: 0; }
details.advanced > summary { list-style: none; cursor: pointer; }
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary h2 { margin: 0; }
details.advanced > summary h2::after { content: "\25B8"; color: var(--muted); font-size: 0.9rem; transition: transform 0.15s; }
details.advanced[open] > summary h2::after { transform: rotate(90deg); }
details.advanced[open] > summary { margin-bottom: 0.8rem; }
details.advanced .cred-row { padding: 0.5rem 0; border-top: 1px solid var(--border); }
.summary-hint { font-size: 0.82rem; font-weight: 400; color: var(--muted); }

/* Ziel-SSIDs: einklappbare Zeilen (Gerät) bzw. eine offene Karte (SSID-Seite) */
.target-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.8rem; }
.target-card { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card-bg); }
.target-summary { display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 0.9rem; cursor: pointer; list-style: none; }
.target-summary::-webkit-details-marker { display: none; }
.target-chevron { color: var(--muted); font-size: 0.75rem; transition: transform 0.15s; }
details.target-card[open] .target-chevron { transform: rotate(90deg); }
.target-title { font-weight: 700; color: var(--heading); }
.target-sec { color: var(--muted); font-size: 0.85rem; }
.target-badges { display: flex; gap: 0.3rem; margin-left: auto; }
.ssid-test-badges { flex-wrap: wrap; margin-left: 0; }
.badge { padding: 0.05rem 0.45rem; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font-size: 0.72rem; }
/* Wahrscheinliche Ursache eines Fehlschlags (src/Diagnosis.php) */
.diag-badge {
    display: inline-flex; align-items: center; gap: 0.3rem; margin: 0 0.3rem 0.2rem 0;
    padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap;
    color: var(--fail); background: color-mix(in srgb, var(--fail) 12%, transparent);
}
.diag-badge.diag-rf, .diag-badge.diag-throughput { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.diag-badge.diag-config, .diag-badge.diag-infra, .diag-badge.diag-unknown { color: var(--muted); background: color-mix(in srgb, var(--muted) 14%, transparent); }
/* Abgeleitete Zuordnung ("vermutlich"): gestrichelter Rand statt Fläche */
.diag-badge.diag-maybe { background: transparent; border: 1px dashed currentColor; }
.diag-period { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0 1.2rem; }
.diag-summary { display: flex; flex-wrap: wrap; gap: 0.2rem; margin: 0.2rem 0 0.6rem; }
.diag-table td { vertical-align: top; }
.diag-table td.num, .diag-table th.num { white-space: nowrap; }
.diag-table .diag-error { max-width: 28rem; }
.diag-table .diag-devices { width: 13rem; min-width: 13rem; }
.diag-device-list { display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; }
.diag-device {
    display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.05rem 0.5rem;
    border: 1px solid var(--border); border-radius: 999px; font-size: 0.78rem; font-weight: 600;
    color: var(--fg); text-decoration: none; white-space: nowrap;
}
.diag-device i { color: var(--muted); font-size: 0.85em; }
/* Probe-Badge: Name filtert, Icon daneben öffnet die Geräteseite (diagnosis_device_badge()) */
.diag-device-pair { display: inline-flex; align-items: center; gap: 0.15rem; }
.diag-device-open { padding: 0.15rem 0.3rem; color: var(--muted); font-size: 0.75rem; text-decoration: none; border-radius: var(--radius-sm); }
.diag-device-open:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.diag-device:hover { border-color: var(--accent); color: var(--accent); }
.diag-device:hover i { color: var(--accent); }
a.diag-badge.diag-link { text-decoration: none; }
a.diag-badge.diag-link:hover { filter: brightness(1.15); text-decoration: underline; }
a.diag-ssid { font-weight: 700; color: var(--heading); text-decoration: none; }
a.diag-ssid:hover { color: var(--accent); }
/* Detailansicht der Ursachen (diagnosis_detail.php) */
.diag-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0.4rem 0 0.2rem; }
.diag-filters .diag-badge { margin: 0; }
.diag-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1rem; margin: 0.5rem 0 1rem; }
.diag-panel { padding: 0.2rem 1rem 0.8rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg); }
.diag-panel h2 { margin-top: 0.8rem; font-size: 1.05rem; }
.diag-actions { margin: 0.3rem 0 0; padding-left: 1.2rem; }
.diag-actions li { margin: 0.25rem 0; }
.diag-breakdown { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
.diag-breakdown h3 { margin: 0.2rem 0 0.4rem; font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.diag-count { font-size: 0.85rem; font-weight: 400; margin-left: 0.5rem; }
.diag-hotspot { margin: 0.8rem 0; }
.diag-breakdown .diag-device { white-space: normal; }
.diag-reason { font-size: 0.8rem; margin-top: 0.15rem; max-width: 22rem; }
.diag-files a { display: inline-block; margin-right: 0.5rem; white-space: nowrap; }
/* Störungen (src/Incidents.php): Liste auf der Ursachen-Seite, Zeitstrahl in der Detailansicht */
.inc-table td .pill { margin: 0 0.2rem 0.2rem 0; }
.inc-table tr.inc-active td:first-child { box-shadow: inset 3px 0 0 var(--fail); }
.pill.inc-sev-critical { background: var(--fail); color: #fff; }
details.inc-infra { margin: 0.8rem 0 0; }
details.inc-infra > summary .muted { font-weight: 400; font-size: 0.85rem; margin-left: 0.4rem; }
details.inc-infra .table-scroll { margin-top: 0.6rem; }
.inc-note { font-size: 0.78rem; }
.inc-ref { display: inline-block; margin-top: 0.25rem; font-size: 0.8rem; white-space: nowrap; }
.inc-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.4rem 1rem; margin: 0.8rem 0 0.4rem; }
.inc-facts dt { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.inc-facts dd { margin: 0.1rem 0 0; }
.inc-timeline { padding: 0.8rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg); }
.inc-lane { display: grid; grid-template-columns: 9rem 1fr; align-items: center; gap: 0.6rem; margin: 0.3rem 0; }
.inc-lane-label { font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.inc-lane-label { color: var(--fg); font-weight: 600; text-decoration: none; }
.inc-probes { display: flex; flex-wrap: wrap; gap: 0.3rem 0.6rem; }
a.inc-lane-label:hover { color: var(--accent); text-decoration: underline; }
.inc-track { position: relative; height: 1.4rem; border-bottom: 1px solid var(--border); }
.inc-band { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--fail) 10%, transparent); border-radius: 3px; }
.inc-dot { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 50%; }
.inc-track .inc-dot { position: absolute; top: 50%; transform: translate(-50%, -50%); }
.inc-dot-ok { background: var(--ok); opacity: 0.6; width: 0.4rem; height: 0.4rem; }
.inc-dot-failed { background: var(--warn); }
.inc-dot-incident { background: var(--fail); box-shadow: 0 0 0 2px var(--card-bg); }
.inc-axis { display: flex; justify-content: space-between; margin-left: 9.6rem; font-size: 0.75rem; color: var(--muted); }
.inc-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 0.5rem; font-size: 0.8rem; }
.inc-legend > span { display: inline-flex; align-items: center; gap: 0.3rem; }
@media (max-width: 600px) {
    .inc-lane { grid-template-columns: 1fr; gap: 0.1rem; }
    .inc-axis { margin-left: 0; }
}
.diag-table td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.alert-page form .target-summary .btn-remove { margin: 0; }
.target-body { display: flex; flex-direction: column; gap: 0.7rem; padding: 0.8rem 0.9rem 0.9rem; }
details.target-card .target-body { border-top: 1px solid var(--border); }
.target-body .cred-stack { gap: 0.4rem; }
.target-body .rule-text { margin: 0; }
@media (prefers-reduced-motion: reduce) {
    .target-chevron, details.advanced > summary h2::after { transition: none; }
}
@media (max-width: 640px) {
    .target-badges { display: none; }
}
@media (max-width: 640px) {
    .cred-row { grid-template-columns: 1fr; }
    .cred-label { padding-top: 0; }
}

/* Benutzer als Empfänger (Karte am Standort) */
.users-card { grid-column: 1 / -1; }
.user-picks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 0.1rem 1rem;
    max-height: 16rem;
    overflow-y: auto;
    padding: 0.2rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.alert-page form label.user-pick[hidden] { display: none; }
.user-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.user-chips[hidden] { display: none; }
.rule-hint[hidden] { display: none; }
.alert-page form button.user-chip {
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--heading);
    font-size: 0.82rem;
    font-weight: 700;
}
.alert-page form button.user-chip::after { content: " ×"; color: var(--muted); }
.alert-page form button.user-chip:hover { border-color: var(--fail); }
.user-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.alert-page form label.user-only { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; color: var(--muted); }
.alert-page form label.user-pick { display: flex; align-items: flex-start; gap: 0.55rem; padding: 0.3rem 0; cursor: pointer; }
.user-pick input { margin-top: 0.25rem; }
.user-pick-name { display: block; font-weight: 700; color: var(--heading); }
.user-pick-meta { display: block; color: var(--muted); font-size: 0.8rem; }
.user-pick-meta.warn { color: var(--warn); }
.user-pick-test { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.2rem; }

/* Benachrichtigungen eines Benutzers (Konto und Benutzer bearbeiten) */
.alert-contact { display: flex; flex-direction: column; gap: 1rem; margin-top: 0.6rem; }
.contact-row { display: grid; grid-template-columns: 8rem 1fr; gap: 0.4rem 1rem; align-items: start; }
.contact-label { padding-top: 0.45rem; font-weight: 700; color: var(--heading); }
.alert-contact label { display: inline-flex; margin: 0; font-size: inherit; font-weight: 400; color: inherit; }
.alert-contact .segmented label { display: block; }
.alert-contact input[type="text"] { max-width: 260px; }
.alert-contact select.contact-select { width: auto; max-width: 260px; }
.alert-contact .hours select { width: auto; padding: 0.3rem 0.5rem; }
.alert-contact .rule-hint { margin-top: 0.35rem; }
.alert-contact .schedule { margin: 0.7rem 0 0; }
@media (max-width: 640px) {
    .contact-row { grid-template-columns: 1fr; }
    .contact-label { padding-top: 0; }
}

/* Geräteseite: SSIDs, die nicht mehr getestet werden, als Gruppe in der Reiterleiste */
.tab-more { position: relative; }
.tab-more > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.6rem 0.9rem; margin-bottom: -1px; color: var(--muted); font-size: 0.95rem; font-weight: 700; border-bottom: 3px solid transparent; }
.tab-more > summary::-webkit-details-marker { display: none; }
.tab-more.active > summary { color: var(--accent); border-bottom-color: var(--accent); }
.tab-more-list {
    position: absolute;
    z-index: 20;
    top: 100%;
    left: 0;
    min-width: 12rem;
    display: flex;
    flex-direction: column;
    padding: 0.3rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--card-shadow);
}
.tab-more-list .tab-btn { justify-content: flex-start; border-bottom: 0; }
.chart-legend { margin: 0.2rem 0 0.6rem; }
.chart-legend > summary { cursor: pointer; font-size: 0.85rem; }
.chart-legend[open] > summary { margin-bottom: 0.3rem; }

/* System-Tab: Karte zum WLAN-Adapter */
.adapter-card {
    margin: 1rem 0 1.4rem; padding: 1rem 1.2rem;
    background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
}
.adapter-head { display: flex; align-items: center; gap: 0.9rem; }
.adapter-head > i { font-size: 1.3rem; color: var(--accent); width: 1.6rem; text-align: center; }
.adapter-head > div { flex: 1; min-width: 0; }
.adapter-title { font-weight: 700; color: var(--heading); font-size: 1.05rem; }
.adapter-gen {
    padding: 0.2rem 0.7rem; border-radius: 999px; font-size: 0.82rem; font-weight: 700;
    color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
    white-space: nowrap;
}
.adapter-empty { margin: 0.8rem 0 0; }
.adapter-facts {
    display: grid; grid-template-columns: max-content 1fr; gap: 0.45rem 1.4rem;
    margin: 0.9rem 0 0; padding-top: 0.9rem; border-top: 1px solid var(--border);
}
.adapter-facts dt { color: var(--muted); font-size: 0.88rem; font-weight: 600; }
.adapter-facts dd { margin: 0; overflow-wrap: anywhere; }
.adapter-facts code { font-size: 0.88rem; }
.adapter-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
/* Modus Monitor in der Gerätekonfiguration: Rollen nebeneinander, mobil untereinander */
.monitor-roles { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; }
.monitor-roles label { display: flex; flex-direction: column; gap: 0.2rem; flex: 1 1 14rem; }
/* Funk-Mitschnitt auf Abruf: Formular als Raster, mobil einspaltig */
.air-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 0.6rem 1rem; margin: 0.9rem 0 0.4rem; }
.air-form label { display: flex; flex-direction: column; gap: 0.2rem; }
.air-form label[hidden] { display: none; }
.air-plan-save { grid-column: 1 / -1; }
.air-plan-save > summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.air-plan-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem 1rem; margin-top: 0.6rem; }
.air-plan-fields label { min-width: 10rem; }
.air-sub { font-size: 1rem; margin: 1.2rem 0 0.4rem; }
.air-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.air-row-actions { white-space: nowrap; }
.air-row-actions .inline-form { display: inline; margin-left: 0.5rem; }
/* Kanal-Übersicht eines Funk-Mitschnitts (aufklappbar) */
.air-sum-row > td { background: var(--bg); padding: 0.6rem 0.8rem 0.9rem; }
.air-sum-table td, .air-sum-table th { white-space: nowrap; }
.air-sum-table td.air-top { white-space: normal; }
.air-top > span { display: inline-block; margin-right: 0.9rem; }
.air-row-actions .air-sum-toggle { margin-right: 0.5rem; }
.air-sum-table td.cell-warn { color: var(--warn); font-weight: 700; }
.air-sum-table td.cell-fail { color: var(--fail); font-weight: 700; }
.adapter-chip {
    padding: 0.05rem 0.55rem; border: 1px solid var(--border); border-radius: 999px;
    font-size: 0.85rem; font-variant-numeric: tabular-nums;
}
@media (max-width: 560px) { .adapter-facts { grid-template-columns: 1fr; gap: 0.1rem; } .adapter-facts dd { margin-bottom: 0.5rem; } }

/* Breite Tabellen als Karten auf dem Handy (class="stack-mobile", Beschriftung aus
   data-label, gesetzt von static/theme.js). Erste Zelle = Titel der Karte. */
@media (max-width: 640px) {
    .table-scroll:has(> table.stack-mobile) { overflow-x: visible; }
    table.stack-mobile, table.stack-mobile > tbody { display: block; width: 100%; }
    table.stack-mobile > thead { display: none; }
    table.stack-mobile > tbody > tr {
        display: block; margin: 0 0 0.6rem; padding: 0.5rem 0.75rem;
        border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card-bg);
    }
    table.stack-mobile > tbody > tr:hover { background: var(--card-bg); }
    table.stack-mobile > tbody > tr[hidden] { display: none; }   /* sonst gewinnt display: block oben */
    table.stack-mobile > tbody > tr > td {
        display: block; padding: 0.3rem 0; border: 0; text-align: right; min-width: 0;
        border-top: 1px dashed color-mix(in srgb, var(--border) 70%, transparent);
    }
    table.stack-mobile > tbody > tr > td::before {
        content: attr(data-label); float: left; margin-right: 0.8rem;
        color: var(--muted); font-size: 0.78rem; font-weight: 700; text-align: left;
    }
    table.stack-mobile > tbody > tr > td:first-child { text-align: left; border-top: 0; padding-top: 0; }
    table.stack-mobile > tbody > tr > td:first-child::before,
    table.stack-mobile > tbody > tr > td[data-label=""]::before { content: none; }
    table.stack-mobile > tbody > tr > td:empty { display: none; }
    table.stack-mobile .diag-device-list { align-items: flex-end; }
    table.stack-mobile .diag-error, table.stack-mobile .diag-reason { max-width: none; }
    table.stack-mobile .dev-cell { min-width: 0; }
    /* Gruppenüberschriften (Standort) ohne Kartenrahmen */
    table.stack-mobile > tbody > tr.site-row { border: 0; background: none; padding: 0.6rem 0 0.2rem; margin: 0; }
    table.stack-mobile > tbody > tr.site-row > th { display: block; padding: 0; }
    /* stack-grid: kurze Werte zweispaltig; Titel, Verlauf und letzter Test über die ganze Breite */
    table.stack-grid > tbody > tr:not(.site-row) { display: grid; grid-template-columns: 1fr 1fr; column-gap: 1.2rem; }
    table.stack-grid > tbody > tr > td:first-child,
    table.stack-grid > tbody > tr > td.hist-cell,
    table.stack-grid > tbody > tr > td.last-test { grid-column: 1 / -1; }
    table.stack-grid > tbody > tr > td.hist-cell { text-align: left; }
}
