/* ===========================================================================
   IT-Leitwarte — Dashboard-Stylesheet
   Ruhige, datenorientierte Oberfläche: neutrale Grautöne, Kirchen-Violett als
   einziger Akzent, Haarlinien statt Schatten. Statusfarben (grün/gelb/rot)
   nur dort, wo etwas Aufmerksamkeit braucht.
   =========================================================================== */

:root {
    color-scheme: light;
    --bg: #f8f8fa;
    --surface: #ffffff;
    --surface2: #f4f4f6;
    --surface3: #ebebef;
    --border: #e6e6eb;
    --border-strong: #d5d5dc;
    --text: #17171c;
    --text-2: #3f3f48;
    --muted: #6b6b77;
    --subtle: #9e9eaa;

    --accent: #6d28d9;
    --accent-hover: #5b21b6;
    --accent-bg: #f4f0ff;
    --accent-border: #ddd3fd;
    --primary: #7c3aed;
    --primary-hover: #6d28d9;
    --ring: rgba(124, 58, 237, 0.32);

    --ok: #15803d;
    --ok-bg: #effaf3;
    --ok-border: #c8ecd5;
    --ok-dot: #22c55e;
    --warn: #b45309;
    --warn-bg: #fff8eb;
    --warn-border: #fbe2b5;
    --warn-dot: #f59e0b;
    --error: #dc2626;
    --error-bg: #fef3f2;
    --error-border: #fbd5d1;
    --error-dot: #ef4444;

    --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

    --shadow-xs: 0 1px 2px rgba(20, 20, 30, 0.05);
    --shadow-sm: 0 1px 2px rgba(20, 20, 30, 0.04), 0 2px 8px rgba(20, 20, 30, 0.04);
    --shadow-md: 0 1px 3px rgba(20, 20, 30, 0.05), 0 6px 16px rgba(20, 20, 30, 0.06);
    --shadow-lg: 0 2px 6px rgba(20, 20, 30, 0.06), 0 16px 40px rgba(20, 20, 30, 0.12);

    --radius-lg: 14px;
    --radius: 10px;
    --radius-sm: 8px;
    --radius-xs: 6px;

    --sidebar-width: 248px;
    --sidebar-collapsed-width: 68px;
    --nav-hover: #efeff2;
    --nav-active: #e9e9ee;

    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
    --dur-fast: 120ms;
    --dur-base: 180ms;
    --dur-slow: 300ms;
}

html.theme-dark {
    color-scheme: dark;
    --bg: #0b0b0e;
    --surface: #131317;
    --surface2: #1a1a1f;
    --surface3: #232329;
    --border: #25252c;
    --border-strong: #34343d;
    --text: #ececf1;
    --text-2: #c6c6d0;
    --muted: #8e8e9b;
    --subtle: #62626d;

    --accent: #b5a0fc;
    --accent-hover: #cdbfff;
    --accent-bg: rgba(139, 92, 246, 0.14);
    --accent-border: rgba(139, 92, 246, 0.36);
    --primary: #7c3aed;
    --primary-hover: #8b5cf6;
    --ring: rgba(167, 139, 250, 0.45);

    --ok: #4ade80;
    --ok-bg: rgba(34, 197, 94, 0.1);
    --ok-border: rgba(34, 197, 94, 0.26);
    --warn: #fbbf24;
    --warn-bg: rgba(245, 158, 11, 0.1);
    --warn-border: rgba(245, 158, 11, 0.28);
    --error: #f87171;
    --error-bg: rgba(239, 68, 68, 0.1);
    --error-border: rgba(239, 68, 68, 0.3);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.5), 0 20px 48px rgba(0, 0, 0, 0.5);

    --nav-hover: #18181d;
    --nav-active: #1f1f25;
}

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.45;
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'ss01' off;
}

button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-bg); color: var(--text); }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Schlanke Scrollbars, die sich ins Farbschema fügen */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ---------------------------------------------------------------------------
   Sidebar
   --------------------------------------------------------------------------- */
.sidebar {
    position: relative;
    width: var(--sidebar-width);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 14px 12px 12px;
    background: var(--bg);
    border-right: 1px solid var(--border);
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 10;
    transition: width var(--dur-base) var(--ease-out), padding var(--dur-base) var(--ease-out);
}

.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 6px 18px;
    min-height: 54px;
}
.sidebar-mark { flex-shrink: 0; display: inline-flex; width: 32px; height: 32px; }
.sidebar-mark img { width: 32px; height: 32px; border-radius: 9px; display: block; }
.sidebar-brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.sidebar-brand-name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.sidebar-brand-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }

.sidebar-collapse-btn {
    position: absolute; top: 25px; right: 10px;
    width: 28px; height: 28px; border-radius: var(--radius-sm);
    border: none; background: transparent; color: var(--subtle);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 11px;
    transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}
.sidebar-collapse-btn:hover { color: var(--text); background: var(--nav-hover); }
@media (hover: hover) {
    .sidebar .sidebar-collapse-btn { opacity: 0; }
    .sidebar:hover .sidebar-collapse-btn, .sidebar-collapse-btn:focus-visible { opacity: 1; }
}

.sidebar-links { display: flex; flex-direction: column; gap: 2px; }
.sidebar-spacer { flex: 1; min-height: 16px; }

.sidebar-nav-item, .sidebar-sub-item {
    position: relative;
    display: flex; align-items: center; gap: 10px;
    width: 100%; min-height: 34px; padding: 0 10px;
    border: none; border-radius: var(--radius-sm);
    background: transparent; color: var(--text-2);
    font-size: 14px; font-weight: 500; text-align: left; text-decoration: none;
    cursor: pointer;
    transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.sidebar-nav-item > i:first-child { width: 16px; text-align: center; font-size: 14px; color: var(--muted); flex-shrink: 0; transition: color var(--dur-fast) var(--ease-out); }
.sidebar-nav-item > span:not(.sidebar-badge) { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-nav-item:hover, .sidebar-sub-item:hover { background: var(--nav-hover); color: var(--text); }
.sidebar-nav-item:hover > i:first-child { color: var(--text-2); }
.sidebar-nav-item.is-active { background: var(--nav-active); color: var(--text); font-weight: 600; }
.sidebar-nav-item.is-active > i:first-child { color: var(--accent); }
.sidebar-nav-item[aria-pressed="true"] > i:first-child { color: var(--accent); }

.sidebar-badge {
    margin-left: auto; flex-shrink: 0;
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums;
}
.sidebar-badge[hidden] { display: none !important; }
.sidebar-badge--warn { background: var(--error-bg); color: var(--error); box-shadow: inset 0 0 0 1px var(--error-border); }

.sidebar-group { display: flex; flex-direction: column; gap: 2px; position: relative; }
.sidebar-group-chevron { margin-left: auto; font-size: 10px; color: var(--subtle); transition: transform var(--dur-base) var(--ease-out); }
.sidebar-group:not(.is-open) .sidebar-group-chevron { transform: rotate(180deg); }
.sidebar-sub {
    display: none; flex-direction: column; gap: 2px;
    margin: 0 0 2px 17px; padding-left: 11px;
    border-left: 1px solid var(--border);
}
.sidebar-group.is-open .sidebar-sub { display: flex; }
.sidebar-sub-item { min-height: 30px; font-size: 13px; color: var(--muted); }
.sidebar-sub-item > i { display: none; }
.sidebar-sub-item > span { flex: 1; }
.sidebar-sub-item::after {
    content: '\f08e'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
    font-size: 9px; color: var(--subtle); opacity: 0; transition: opacity var(--dur-fast) var(--ease-out);
}
.sidebar-sub-item:hover::after { opacity: 1; }

.sidebar-footer { display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }

.theme-seg {
    display: flex; gap: 2px; padding: 3px;
    border-radius: var(--radius-sm); background: var(--surface2);
    box-shadow: inset 0 0 0 1px var(--border);
}
.theme-seg-btn {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 28px; border: none; border-radius: var(--radius-xs);
    background: transparent; color: var(--muted);
    font-size: 12px; font-weight: 500; cursor: pointer;
    transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.theme-seg-btn i { font-size: 11px; }
.theme-seg-btn:hover { color: var(--text); }
.theme-seg-btn.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs), 0 0 0 1px var(--border); }

.sidebar-user-card {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 6px 2px 6px; margin-top: 4px;
    border-top: 1px solid var(--border);
}
.sidebar-user-avatar {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-bg); color: var(--accent);
    font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
}
.sidebar-user-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-logout {
    position: relative;
    width: 30px; height: 30px; flex-shrink: 0; border: none; border-radius: var(--radius-sm);
    background: transparent; color: var(--muted); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
    transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.sidebar-logout:hover { color: var(--error); background: var(--error-bg); }

.role-badge {
    align-self: flex-start;
    display: inline-flex; align-items: center;
    padding: 0 7px; height: 18px; border-radius: 999px;
    font-size: 11px; font-weight: 500;
    color: var(--accent); background: var(--accent-bg);
}
.role-badge:empty { display: none; }
.role-badge.invite-pending { color: var(--warn); background: var(--warn-bg); }

.brand-fallback {
    width: 64px; height: 64px; border-radius: 14px;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.brand-fallback[hidden] { display: none !important; }

/* Eingeklappte Sidebar (nur Desktop) */
@media (min-width: 769px) {
    body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-width); padding-left: 10px; padding-right: 10px; }
    body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 4px 0 6px; }
    body.sidebar-collapsed .sidebar-brand-text { display: none; }
    body.sidebar-collapsed .sidebar-collapse-btn { position: static; margin: 0 auto 10px; opacity: 1; }
    body.sidebar-collapsed .sidebar-nav-item { justify-content: center; padding: 0; min-height: 38px; }
    body.sidebar-collapsed .sidebar-nav-item > span:not(.sidebar-badge),
    body.sidebar-collapsed .sidebar-group-chevron { display: none; }
    body.sidebar-collapsed .sidebar-nav-item > i:first-child { font-size: 15px; }
    body.sidebar-collapsed .sidebar-badge {
        position: absolute; top: 3px; right: 3px;
        min-width: 16px; height: 16px; padding: 0 4px; font-size: 9px;
    }
    body.sidebar-collapsed .sidebar-group.is-open .sidebar-sub { display: none; }
    /* Eingeklappt bleibt nur der Umschalter zum jeweils anderen Schema */
    body.sidebar-collapsed .theme-seg { padding: 0; background: none; box-shadow: none; justify-content: center; }
    body.sidebar-collapsed .theme-seg-btn { flex: none; width: 38px; height: 34px; }
    body.sidebar-collapsed .theme-seg-btn span, body.sidebar-collapsed .theme-seg-btn.is-active { display: none; }
    body.sidebar-collapsed .sidebar-user-card { flex-direction: column; padding: 10px 0 0; }
    body.sidebar-collapsed .sidebar-user-meta { display: none; }

    body.sidebar-collapsed .sidebar-nav-item[data-tip]:hover::after,
    body.sidebar-collapsed .sidebar-logout[data-tip]:hover::after {
        content: attr(data-tip);
        position: absolute; left: calc(100% + 12px); top: 50%;
        transform: translateY(-50%);
        background: var(--text); color: var(--bg);
        padding: 5px 9px; border-radius: var(--radius-xs);
        font-size: 12px; font-weight: 500; white-space: nowrap;
        z-index: 100; pointer-events: none; box-shadow: var(--shadow-md);
    }
    body.sidebar-collapsed .sidebar { overflow: visible; }

    body.sidebar-collapsed .sidebar-group:hover .sidebar-sub,
    body.sidebar-collapsed .sidebar-group:focus-within .sidebar-sub {
        display: flex; position: absolute; left: calc(100% + 8px); top: 0;
        margin: 0; padding: 6px; min-width: 170px; border: 1px solid var(--border);
        border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-lg); z-index: 110;
    }
    body.sidebar-collapsed .sidebar-group:hover .sidebar-sub-item,
    body.sidebar-collapsed .sidebar-group:focus-within .sidebar-sub-item { color: var(--text-2); }
}

/* ---------------------------------------------------------------------------
   Hauptbereich + Topbar
   --------------------------------------------------------------------------- */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.main[hidden] { display: none !important; }

.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    min-height: 64px; padding: 12px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-brand { display: flex; flex-direction: column; min-width: 0; }
.topbar-title { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; color: var(--text); }
.topbar-subtitle { font-size: 13px; color: var(--muted); }

.last-refresh { font-size: 12px; color: var(--subtle); font-variant-numeric: tabular-nums; white-space: nowrap; margin-right: 4px; }

.topbar-search {
    display: inline-flex; align-items: center; gap: 8px;
    height: 34px; min-width: 220px; padding: 0 6px 0 11px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--subtle);
    font-size: 13px; cursor: pointer; box-shadow: var(--shadow-xs);
    transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.topbar-search i { font-size: 12px; }
.topbar-search-text { flex: 1; text-align: left; }
.topbar-search:hover { border-color: var(--border-strong); color: var(--muted); }
.topbar-search-kbd, .cmdk-kbd {
    font-family: var(--sans); font-size: 11px; font-weight: 500; color: var(--muted);
    background: var(--surface2); border: 1px solid var(--border); border-bottom-width: 2px;
    border-radius: 5px; padding: 1px 6px; line-height: 16px;
}

/* ---------------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------------- */
.btn-refresh, .btn-primary, .btn-block-accent, .btn-login {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 34px; padding: 0 14px;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    background: var(--primary); color: #fff;
    font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap;
    cursor: pointer; box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}
.btn-refresh:hover:not(:disabled), .btn-primary:hover, .btn-block-accent:hover, .btn-login:hover { background: var(--primary-hover); }
.btn-refresh:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-refresh i { font-size: 12px; }

/* In der Topbar ist Aktualisieren nur eine Nebenaktion (das Dashboard pollt selbst) */
.topbar .btn-refresh { background: var(--surface); color: var(--text); border-color: var(--border); }
.topbar .btn-refresh:hover:not(:disabled) { background: var(--surface2); border-color: var(--border-strong); }
.topbar .btn-refresh i { color: var(--muted); }

.btn-icon-toolbar {
    width: 34px; height: 34px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface); color: var(--muted);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: var(--shadow-xs); font-size: 13px;
    transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.btn-icon-toolbar:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface2); }
.btn-icon-toolbar.is-active { color: var(--accent); background: var(--accent-bg); border-color: var(--accent-border); }

.btn-sm-accent, .btn-sm-muted {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 28px; padding: 0 10px; border-radius: var(--radius-xs);
    font-size: 12px; font-weight: 500; white-space: nowrap; cursor: pointer;
    transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.btn-sm-accent { background: var(--primary); color: #fff; border: 1px solid transparent; }
.btn-sm-accent:hover { background: var(--primary-hover); }
.btn-sm-muted { background: var(--surface); color: var(--text-2); border: 1px solid var(--border); }
.btn-sm-muted:hover { background: var(--surface2); border-color: var(--border-strong); color: var(--text); }
.btn-danger-soft { color: var(--muted); }
.btn-danger-soft:hover { color: var(--error); background: var(--error-bg); border-color: var(--error-border); }

.btn-icon {
    width: 32px; height: 32px; border: none; border-radius: var(--radius-sm);
    background: transparent; color: var(--muted); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.btn-icon:hover { color: var(--text); background: var(--surface3); }
.btn-icon-rd:hover { color: var(--accent); background: var(--accent-bg); }
[data-action="dismiss-server-update"].btn-icon:hover { color: var(--error); background: var(--error-bg); }

.btn-block { display: flex; width: 100%; height: 38px; text-align: center; }

.input {
    width: 100%; height: 36px; padding: 0 11px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text);
    font-size: 14px; box-shadow: var(--shadow-xs);
    transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.input::placeholder { color: var(--subtle); }
.input:hover { border-color: var(--border-strong); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
select.input { padding-right: 28px; cursor: pointer; }

/* ---------------------------------------------------------------------------
   Inhalt + Panels
   --------------------------------------------------------------------------- */
.content {
    flex: 1; overflow-y: auto;
    width: 100%; max-width: 1480px; margin: 0 auto;
    padding: 24px 32px 40px;
}
.print-only { display: none; }

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    margin-bottom: 16px;
}

.status-embed-head {
    display: flex; align-items: center; gap: 12px;
    min-height: 52px; padding: 12px 20px;
    border-bottom: 1px solid var(--border);
}
.status-embed-head > :first-child { margin-right: auto; }
.status-embed-head > span:first-child {
    display: inline-flex; align-items: center; gap: 9px;
    font-size: 14px; font-weight: 600; color: var(--text); letter-spacing: -0.005em;
}
.status-embed-head > span:first-child > i { font-size: 13px; color: var(--muted); width: 14px; text-align: center; }
.status-embed-head a { font-size: 13px; font-weight: 500; color: var(--accent); text-decoration: none; }
.status-embed-head a:hover { text-decoration: underline; text-underline-offset: 3px; }

summary.status-embed-head { cursor: pointer; list-style: none; user-select: none; }
summary.status-embed-head::-webkit-details-marker { display: none; }
summary.status-embed-head:hover { background: var(--surface2); }
details:not([open]) > summary.status-embed-head { border-bottom: none; }
.status-embed-caret { font-size: 10px !important; transition: transform var(--dur-base) var(--ease-out); }
details[open] > summary .status-embed-caret { transform: rotate(90deg); }

.text-muted-sm { color: var(--muted); font-size: 12px; font-weight: 400; }

/* ---------------------------------------------------------------------------
   Kennzahlen-Kacheln (gleichzeitig Filter)
   --------------------------------------------------------------------------- */
.dashboard-stats {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px; margin-bottom: 16px;
}
.dashboard-stats[hidden] { display: none !important; }
.stat-card {
    position: relative;
    display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 8px;
    padding: 14px 16px 16px; width: 100%;
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    background: var(--surface); box-shadow: var(--shadow-xs);
    text-align: left; cursor: pointer;
    transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.stat-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.stat-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.stat-card-body { grid-column: 1; grid-row: 1; display: flex; flex-direction: column-reverse; gap: 6px; min-width: 0; }
.stat-label { font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card .stat-n { font-size: 28px; font-weight: 600; line-height: 1; letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-card-icon {
    grid-column: 2; grid-row: 1;
    width: 28px; height: 28px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.stat-online .stat-card-icon { background: var(--ok-bg); color: var(--ok-dot); font-size: 9px; }
.stat-standby .stat-card-icon { background: var(--warn-bg); color: var(--warn); }
.stat-offline .stat-card-icon { background: var(--error-bg); color: var(--error); }
.stat-critical .stat-card-icon { background: var(--error-bg); color: var(--error); }
.stat-attention .stat-card-icon { background: var(--accent-bg); color: var(--accent); }
.stat-standby .stat-n { color: var(--warn); }
.stat-offline .stat-n, .stat-critical .stat-n { color: var(--error); }
.stat-attention .stat-n { color: var(--accent); }
/* Alarm-Kachel ohne Treffer: ruhig grau, keine Signalfarbe */
.stat-card.stat-zero .stat-n { color: var(--subtle); }
.stat-card.stat-zero .stat-card-icon { background: var(--surface2); color: var(--subtle); }

/* ---------------------------------------------------------------------------
   Gerätetabelle
   --------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; contain: layout style; }
table { width: 100%; border-collapse: collapse; }
th {
    position: sticky; top: 0; z-index: 3;
    padding: 9px 16px; text-align: left; white-space: nowrap;
    font-size: 12px; font-weight: 500; color: var(--muted);
    background: var(--surface2); border-bottom: 1px solid var(--border);
}
td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }

tbody tr.pc-row {
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease-out);
    content-visibility: auto;
    contain-intrinsic-size: auto 61px;
}
tbody tr.pc-row:hover td { background: var(--surface2); }
tbody tr.pc-row:focus-visible { outline: none; }
tbody tr.pc-row:focus-visible td { background: var(--accent-bg); }
tbody tr.pc-row:focus-visible td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
tbody tr.pc-row.row-critical td:first-child { box-shadow: inset 2px 0 0 var(--error-dot); }

@keyframes row-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
tbody.is-entering tr.pc-row { animation: row-in var(--dur-slow) var(--ease-out) both; animation-delay: calc(var(--ri, 0) * 18ms); }

.pc-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pc-os {
    width: 32px; height: 32px; border-radius: var(--radius-sm); flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface2); color: var(--muted); font-size: 14px;
    box-shadow: inset 0 0 0 1px var(--border);
}
.pc-id { display: flex; flex-direction: column; min-width: 0; }
.pc-id strong { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-id small { font-family: var(--mono); font-size: 12px; color: var(--muted); }

td.col-status { width: 150px; }
td.col-seen { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
td.col-updates { white-space: nowrap; font-size: 13px; line-height: 1.35; }
td.col-security .badge { white-space: nowrap; }
th.col-health, td.col-health { text-align: left; }
th.col-action, td.col-action { width: 56px; text-align: right; }
td.col-action > .text-muted-sm { color: var(--subtle); opacity: 0.6; }

.health-cell { display: inline-flex; align-items: center; gap: 10px; }
.health-ring {
    position: relative; isolation: isolate; flex-shrink: 0;
    width: 34px; height: 34px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text);
}
.health-ring::before {
    content: ''; position: absolute; inset: 0; border-radius: 50%; z-index: -1; pointer-events: none;
    background: conic-gradient(var(--ring-color, var(--ok-dot)) calc(var(--ring-pct, 0) * 1%), var(--surface3) 0);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
}
.health-ring[data-score-color="green"] { --ring-color: var(--ok-dot); }
.health-ring[data-score-color="yellow"] { --ring-color: var(--warn-dot); }
.health-ring[data-score-color="red"] { --ring-color: var(--error-dot); color: var(--error); }
.health-spark-wrap { line-height: 0; width: 56px; height: 18px; overflow: hidden; }
.health-spark { display: block; max-width: 100%; }
.health-spark polyline { stroke: var(--subtle); }
.health-spark.spark-down polyline { stroke: var(--warn-dot); }
.health-spark.spark-up polyline { stroke: var(--ok-dot); }
.health-spark-lg { display: block; width: 100%; max-width: 480px; height: auto; }
.health-spark-lg polyline { stroke: var(--accent); }
.health-spark-lg.spark-down polyline { stroke: var(--warn-dot); }

.table-empty { text-align: center; padding: 48px 24px !important; color: var(--muted); }
.table-empty strong { display: block; margin-bottom: 6px; font-size: 15px; font-weight: 600; color: var(--text); }
.table-empty .btn-sm-muted { margin-top: 12px; }
.empty-illustration { width: 64px; height: 64px; margin: 0 auto 12px; display: block; opacity: 0.5; }

.skeleton-row td { pointer-events: none; }
.skeleton-bar {
    height: 10px; border-radius: 5px;
    background: linear-gradient(90deg, var(--surface2) 0%, var(--surface3) 45%, var(--surface2) 90%);
    background-size: 220% 100%; animation: sk-shimmer 1.3s ease-in-out infinite;
}
.skeleton-bar.short { width: 40%; }
.skeleton-bar.med { width: 65%; }
@keyframes sk-shimmer { 0% { background-position: 120% 0; } 100% { background-position: -20% 0; } }

/* ---------------------------------------------------------------------------
   Badges + Textauszeichnungen
   --------------------------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    height: 24px; padding: 0 9px; border-radius: 999px;
    font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap;
    border: 1px solid transparent;
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.b-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border); }
.b-ok .dot { background: var(--ok-dot); }
.b-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.b-warn .dot { background: var(--warn-dot); }
.b-error { background: var(--error-bg); color: var(--error); border-color: var(--error-border); }
.b-error .dot { background: var(--error-dot); }
.b-info { background: var(--surface2); color: var(--text-2); border-color: var(--border); }
.platform-badge i { font-size: 12px; }

@keyframes pulse-dot-err {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
    50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}
.col-status .b-error .dot { animation: pulse-dot-err 2.2s ease-in-out infinite; }

.fw6-muted { color: var(--muted); font-weight: 500; }
.fw6-warn { color: var(--warn); font-weight: 500; }
.fw6-ok { color: var(--ok); font-weight: 500; }
.b-error-text { color: var(--error); }
.mt-8 { margin-top: 8px; }
.badge--mt4 { margin-top: 4px; }

/* ---------------------------------------------------------------------------
   Server-Updates, Backups, Versionen, Uptime Kuma
   --------------------------------------------------------------------------- */
.dash-split {
    display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
    gap: 16px; align-items: start; margin-bottom: 16px;
}
.dash-split > .panel { margin-bottom: 0; }
body.role-not-admin .dash-split { grid-template-columns: minmax(0, 1fr); }

.server-updates-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; min-width: 0; }
.server-updates-actions .text-muted-sm { text-align: right; }
.server-updates-actions .btn-refresh { height: 30px; padding: 0 12px; font-size: 12px; }
.server-status-summary { padding: 16px 20px 0; }
.server-summary-sentence {
    margin: 0; padding: 10px 12px 10px 36px; position: relative;
    border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; line-height: 1.45;
    background: var(--surface2); color: var(--text-2);
}
.server-summary-sentence::before {
    content: '\f058'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
    position: absolute; left: 13px; top: 10px; font-size: 13px; color: var(--muted);
}
.server-overall-ok .server-summary-sentence { background: var(--ok-bg); color: var(--ok); }
.server-overall-ok .server-summary-sentence::before { color: var(--ok); }
.server-overall-attention .server-summary-sentence { background: var(--warn-bg); color: var(--warn); }
.server-overall-attention .server-summary-sentence::before { content: '\f06a'; color: var(--warn); }
.server-overall-critical .server-summary-sentence { background: var(--error-bg); color: var(--error); }
.server-overall-critical .server-summary-sentence::before { content: '\f071'; color: var(--error); }

.server-status-sections { padding: 16px 20px 4px; display: flex; flex-direction: column; gap: 16px; }
.server-section-title {
    display: flex; align-items: center; gap: 8px; margin: 0 0 8px;
    font-size: 12px; font-weight: 500; color: var(--muted);
}
.server-section-title i { font-size: 11px; width: 14px; text-align: center; }
.server-update-cards { display: grid; gap: 8px; }
.server-update-card {
    padding: 12px 14px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--surface);
}
.server-update-card.server-host-stale { border-color: var(--error-border); background: var(--error-bg); }
.server-update-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 14px; }
.server-update-card-head strong { font-weight: 600; }
.server-update-card-head i { color: var(--muted); font-size: 12px; }
.server-update-why, .server-update-impact { margin: 2px 0; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.server-update-label { font-weight: 500; color: var(--muted); }
.server-update-card .text-muted-sm { margin: 8px 0 0; }
.server-status-technical { padding: 4px 20px 14px; }
.server-status-technical summary { cursor: pointer; font-size: 13px; font-weight: 500; color: var(--muted); padding: 8px 0; }
.server-status-technical summary:hover { color: var(--text); }
.server-updates-list { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow-y: auto; }
.server-update-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.server-update-item:last-child { border-bottom: none; }
.server-update-text { font-size: 13px; white-space: pre-wrap; word-break: break-word; color: var(--text-2); }
.server-update-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.backup-status-grid { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 16px 20px 20px; }
.backup-status-card { padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.backup-status-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.backup-status-card-head strong { font-weight: 600; }
.backup-state-badge {
    display: inline-flex; align-items: center; gap: 6px;
    height: 22px; padding: 0 8px; border-radius: 999px;
    font-size: 12px; font-weight: 500; border: 1px solid transparent;
}
.backup-state-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.backup-status--ok .backup-state-badge { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-border); }
.backup-status--running .backup-state-badge { color: var(--accent); background: var(--accent-bg); border-color: var(--accent-border); }
.backup-status--error .backup-state-badge, .backup-status--missing .backup-state-badge { color: var(--error); background: var(--error-bg); border-color: var(--error-border); }
.backup-status--overdue .backup-state-badge { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-border); }
.backup-status--error, .backup-status--missing { border-color: var(--error-border); }
.backup-status--overdue { border-color: var(--warn-border); }
.backup-status-times { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 10px 0 0; font-size: 12px; }
.backup-status-times dt { color: var(--muted); }
.backup-status-times dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
.backup-status-message { margin: 8px 0 0; font-size: 12px; line-height: 1.45; color: var(--muted); overflow-wrap: anywhere; }
.backup-status-message:empty { display: none; }
.backup-status-load-error { margin: 0; color: var(--error); font-size: 13px; }

.versions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; padding: 16px 20px 20px; }
.version-tile { padding: 12px 14px; border-radius: var(--radius); background: var(--surface2); }
.version-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.version-tile strong { display: block; font-size: 15px; font-weight: 600; line-height: 1.3; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.version-tile small { display: block; margin-top: 4px; font-size: 12px; line-height: 1.4; color: var(--muted); }
.version-tile--wide { grid-column: span 2; }

.status-embed-wrap { position: relative; width: 100%; height: min(520px, 50vh); min-height: 320px; background: var(--surface2); }
.status-embed-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------------------------------------------------------------------------
   Modal + Geräte-Drawer
   --------------------------------------------------------------------------- */
.modal-bg {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: flex-start; justify-content: center;
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
    background: rgba(12, 12, 18, 0.32); backdrop-filter: blur(2px);
    overflow-y: auto; overscroll-behavior: contain;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity var(--dur-base) var(--ease-out), visibility var(--dur-base) var(--ease-out);
}
html.theme-dark .modal-bg, html.theme-dark .cmdk-overlay { background: rgba(0, 0, 0, 0.55); }
.modal-bg.open { opacity: 1; visibility: visible; pointer-events: auto; }

.modal {
    width: min(760px, 100%); max-height: min(90dvh, 860px); margin: auto 0; flex-shrink: 0;
    display: flex; flex-direction: column; min-height: 0; overflow: hidden;
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
    box-shadow: var(--shadow-lg);
    transform: translateY(12px) scale(0.98); opacity: 0;
    transition: transform var(--dur-slow) var(--ease-out), opacity var(--dur-base) var(--ease-out);
}
.modal-bg.open .modal { transform: none; opacity: 1; }

@media (min-width: 769px) {
    #modal-bg { align-items: stretch; justify-content: flex-end; padding: 8px; }
    #modal-body.modal {
        width: min(640px, 100%); height: calc(100dvh - 16px); max-height: none; margin: 0;
        opacity: 1; transform: translateX(calc(100% + 16px));
        transition: transform var(--dur-slow) var(--ease-out);
    }
    #modal-bg.open #modal-body.modal { transform: translateX(var(--drag, 0px)); }
    #modal-body.modal.drawer-dragging { transition: none; }
    #modal-body.modal .modal-head { cursor: grab; }
}
@media (max-width: 768px) {
    #modal-bg.open #modal-body.modal { transform: translateY(var(--drag, 0px)); }
    #modal-body.modal.drawer-dragging { transition: none; }
    #modal-body.modal .modal-head { position: relative; cursor: grab; padding-top: 22px; }
    #modal-body.modal .modal-head::before {
        content: ''; position: absolute; left: 50%; top: 8px; transform: translateX(-50%);
        width: 36px; height: 4px; border-radius: 999px; background: var(--border-strong);
    }
}

.modal-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    padding: 20px 24px 16px; flex-shrink: 0;
}
.modal-head h2 {
    flex: 1; min-width: 0; margin: 0;
    font-size: 20px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; word-break: break-word;
}
.modal-head-meta { display: block; margin-top: 2px; font-size: 13px; font-weight: 400; letter-spacing: 0; color: var(--muted); }
.modal-close {
    width: 32px; height: 32px; flex-shrink: 0; border: none; border-radius: var(--radius-sm);
    background: transparent; color: var(--muted); cursor: pointer; font-size: 20px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.modal-close:hover { background: var(--surface3); color: var(--text); }
.modal-body-inner { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px 24px 28px; }

.modal-tabs {
    display: flex; gap: 4px; padding: 0 20px; flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto; scrollbar-width: none;
}
.modal-tabs::-webkit-scrollbar { display: none; }
.modal-tab-btn {
    position: relative; padding: 10px 10px 12px; border: none; background: none;
    font-size: 14px; font-weight: 500; color: var(--muted); white-space: nowrap; cursor: pointer;
    transition: color var(--dur-fast) var(--ease-out);
}
.modal-tab-btn:hover { color: var(--text); }
.modal-tab-btn.active { color: var(--text); }
.modal-tab-btn.active::after {
    content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px;
    border-radius: 2px 2px 0 0; background: var(--accent);
}
.modal-tab-content { display: none; }
.modal-tab-content.active { display: block; }

/* Übersicht: IP/MAC nebeneinander, darunter alles in voller Breite */
.modal-tab-content[data-tab-content="overview"].active {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
}
.modal-tab-content[data-tab-content="overview"] > :not(.field-copy-row) { grid-column: 1 / -1; }

.field-copy-row {
    position: relative; display: flex; flex-direction: column; gap: 2px;
    padding: 10px 48px 10px 14px; margin: 0;
    border: 1px solid var(--border); border-radius: var(--radius);
}
.field-copy-label, .card-tile small, .note-author-label, .monitoring-section-title, .metric-bar-label > span:first-child {
    font-size: 12px; font-weight: 500; color: var(--muted);
}
.field-copy-value { font-family: var(--mono); font-size: 13px; font-weight: 500; word-break: break-all; }
.field-copy-row .btn-copy {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    width: 30px; height: 30px; border: none; border-radius: var(--radius-sm);
    background: transparent; color: var(--muted); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.field-copy-row .btn-copy:hover { color: var(--accent); background: var(--accent-bg); }

/* Kennwerte als ein Raster mit Haarlinien statt vieler Einzelkacheln */
.modal-grid-info {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 0;
    background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.card-tile { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; background: var(--surface); }
.card-tile--wide { grid-column: span 2; }
.card-tile strong { font-size: 14px; font-weight: 500; line-height: 1.4; word-break: break-word; }
.card-tile .mt-8 { display: flex; flex-wrap: wrap; gap: 6px; }
.disk-secondary { color: var(--muted); font-size: 12px; }
.sec-bitlocker-line { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.security-detail { margin: 6px 0 0; font-size: 12px; color: var(--warn); line-height: 1.4; }

.modal-card { padding: 16px; margin: 0 0 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.modal-tab-content[data-tab-content="overview"] .modal-card { margin: 4px 0 0; }
.modal-section-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 14px; font-weight: 600; color: var(--text); }

.rustdesk-hint { margin: -4px 0 12px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.rustdesk-row { display: flex; gap: 8px; margin-bottom: 12px; }
.rustdesk-input { flex: 1; font-family: var(--mono); font-size: 13px; }
.btn-rustdesk-copy, .btn-rustdesk-save, .btn-note-add {
    height: 36px; flex-shrink: 0; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text-2); cursor: pointer; box-shadow: var(--shadow-xs);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 500;
    transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.btn-rustdesk-copy, .btn-note-add { width: 36px; }
.btn-rustdesk-save { padding: 0 14px; white-space: nowrap; }
.btn-rustdesk-copy:hover, .btn-rustdesk-save:hover, .btn-note-add:hover { background: var(--surface2); border-color: var(--border-strong); color: var(--text); }

.modal-danger-row { display: flex; justify-content: flex-end; }

/* Monitoring-Tab */
.monitoring-section { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.monitoring-section:last-of-type { border-bottom: none; }
.monitoring-section-title { display: block; margin-bottom: 10px; }
.metric-bar-group { margin-bottom: 14px; }
.metric-bar-label { display: flex; justify-content: space-between; margin-bottom: 6px; }
.metric-bar-label .metric-value { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.metric-bar { height: 6px; border-radius: 3px; background: var(--surface3); overflow: hidden; }
.metric-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s var(--ease-out); }
.metric-bar-fill.bar-green { background: var(--ok-dot); }
.metric-bar-fill.bar-yellow { background: var(--warn-dot); }
.metric-bar-fill.bar-red { background: var(--error-dot); }
.metric-timeline-group { margin-bottom: 18px; }
.metric-timeline { display: block; width: 100%; height: 64px; margin-top: 2px; border-radius: var(--radius-sm); background: var(--surface2); }
.metric-timeline .metric-line { stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.metric-timeline .metric-area { stroke: none; opacity: 0.14; }
.metric-timeline .metric-threshold { stroke: var(--error-dot); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.4; vector-effect: non-scaling-stroke; }
.metric-timeline.metric-green .metric-line { stroke: var(--ok-dot); }
.metric-timeline.metric-green .metric-area { fill: var(--ok-dot); }
.metric-timeline.metric-yellow .metric-line { stroke: var(--warn-dot); }
.metric-timeline.metric-yellow .metric-area { fill: var(--warn-dot); }
.metric-timeline.metric-red .metric-line { stroke: var(--error-dot); }
.metric-timeline.metric-red .metric-area { fill: var(--error-dot); }
.metric-meta { display: flex; gap: 14px; margin-top: 6px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.metric-inline { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.metric-inline:last-child { border-bottom: none; }
.metric-inline-label { min-width: 150px; font-size: 13px; color: var(--muted); }
.metric-inline-value { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.monitoring-section .fw6-muted, .monitoring-section .fw6-ok { margin: 0; }

.services-list, .eventlog-list, .hotfix-list { list-style: none; margin: 0; padding: 0; }
.services-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.services-list li:last-child { border-bottom: none; }
.svc-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.svc-dot.svc-ok { background: var(--ok-dot); }
.svc-dot.svc-stopped { background: var(--error-dot); }
.eventlog-list { max-height: 220px; overflow-y: auto; }
.eventlog-item { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.eventlog-item:last-child { border-bottom: none; }
.eventlog-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }
.eventlog-source { font-weight: 600; margin: 2px 0; }
.eventlog-msg { color: var(--muted); line-height: 1.45; word-break: break-word; }
.hotfix-item { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.hotfix-item:last-child { border-bottom: none; }
.hotfix-kb { font-family: var(--mono); font-weight: 500; }
.hotfix-date { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.client-version-badge {
    display: inline-flex; align-items: center; gap: 6px; margin-top: 4px;
    height: 24px; padding: 0 10px; border-radius: 999px;
    font-size: 12px; font-weight: 500; color: var(--muted);
    background: var(--surface2); border: 1px solid var(--border);
}

/* Updates-Tab */
.updates-box { border: 1px solid var(--border); border-radius: var(--radius); max-height: 260px; overflow-y: auto; }
.updates-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.updates-row:last-child { border-bottom: none; }
.updates-id { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.updates-row-actions, .updates-row-actions .admin-only { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.updates-ignored-details { margin-top: 10px; }
.updates-ignored-details summary {
    cursor: pointer; list-style: none; text-align: center;
    padding: 9px 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
    font-size: 12px; font-weight: 500; color: var(--muted);
    transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.updates-ignored-details summary:hover { color: var(--text); background: var(--surface2); }
.updates-ignored-ul { margin: 10px 0 0; padding: 0; list-style: none; font-size: 13px; }
.ignored-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; }
.ignored-id { font-family: var(--mono); font-size: 12px; word-break: break-all; }

/* Notizen-Tab */
.notes-list-inner { border: 1px solid var(--border); border-radius: var(--radius); padding: 2px 14px; margin-bottom: 14px; }
.note-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.note-row:last-child { border-bottom: none; }
.note-row-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; margin-bottom: 2px; }
.note-row-text { font-size: 13px; line-height: 1.5; }
.note-row-text strong { font-weight: 600; }
.note-delete-btn { flex-shrink: 0; padding: 4px; border: none; background: none; color: var(--subtle); cursor: pointer; font-size: 12px; border-radius: var(--radius-xs); }
.note-delete-btn:hover { color: var(--error); background: var(--error-bg); }
.no-notes-text { color: var(--muted); font-size: 13px; margin: 10px 0; }
.note-author-label { display: block; margin-bottom: 6px; }
.select-author { margin-bottom: 10px; }
.note-actions-row { display: flex; gap: 8px; }
.input-flex { flex: 1; }

/* ---------------------------------------------------------------------------
   Benutzerverwaltung
   --------------------------------------------------------------------------- */
#users-modal-body-wrap { width: min(680px, 100%); }
#users-modal-body-wrap .modal-head { border-bottom: 1px solid var(--border); }
.user-create-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; align-items: center; }
.user-create-form .input { flex: 1 1 150px; min-width: 120px; }
.user-create-form select.input { flex: 0 1 130px; }
.user-create-form .btn-sm-accent { height: 36px; padding: 0 14px; font-size: 13px; border-radius: var(--radius-sm); }
.user-form-hint { font-size: 12px; color: var(--muted); margin: 0 0 16px; }
.users-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.user-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.user-row:last-child { border-bottom: none; }
.user-row--bootstrap { background: var(--surface2); }
.user-row .user-name { flex: 1 1 150px; min-width: 120px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.user-role-select { flex: 0 0 auto; width: auto; height: 28px; padding: 0 26px 0 8px; font-size: 12px; }
.user-active-toggle { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.user-active-toggle input { accent-color: var(--primary); }
.invite-link-box { margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--accent-border); border-radius: var(--radius); background: var(--accent-bg); }
.invite-link-head { display: flex; align-items: center; gap: 6px; font-weight: 600; margin-bottom: 8px; color: var(--accent); }
.invite-link-row { display: flex; gap: 8px; align-items: center; }
.invite-link-row .input { flex: 1; font-family: var(--mono); font-size: 12px; }
.invite-link-row .btn-sm-accent { height: 36px; }
.invite-link-note { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

/* Admin-Steuerelemente für Nicht-Admins ausblenden (Backend erzwingt zusätzlich 403). */
body.role-not-admin .admin-only { display: none !important; }

/* ---------------------------------------------------------------------------
   Aktivitätslog
   --------------------------------------------------------------------------- */
.activity-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.act-stat {
    display: flex; flex-direction: column; gap: 4px; min-width: 0;
    padding: 14px 16px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg);
    background: var(--surface); box-shadow: var(--shadow-xs);
}
.act-stat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.act-stat-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.act-stat-icon { width: 28px; height: 28px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 12px; background: var(--surface2); color: var(--muted); }
.act-stat-icon--accent, .act-stat-icon--info { background: var(--accent-bg); color: var(--accent); }
.act-stat-icon--ok { background: var(--ok-bg); color: var(--ok); }
.act-stat-icon--warn { background: var(--warn-bg); color: var(--warn); }
.act-stat-n { font-size: 28px; font-weight: 600; line-height: 1.05; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.act-stat-sub { font-size: 12px; color: var(--muted); }

.activity-panel { display: flex; flex-direction: column; }
.activity-toolbar { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.activity-search { position: relative; display: flex; align-items: center; }
.activity-search i { position: absolute; left: 12px; font-size: 12px; color: var(--subtle); pointer-events: none; }
.activity-search input {
    width: 100%; height: 36px; padding: 0 12px 0 34px; font-size: 14px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-xs);
    transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.activity-search input::placeholder { color: var(--subtle); }
.activity-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.activity-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.act-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.act-field > span { font-size: 12px; font-weight: 500; color: var(--muted); }
.act-field select, .act-field input[type="date"] {
    height: 32px; padding: 0 8px; font-size: 13px; max-width: 190px; cursor: pointer;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.act-field select:hover, .act-field input[type="date"]:hover { border-color: var(--border-strong); }
.act-field select:focus, .act-field input[type="date"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.act-field--inline { flex-direction: row; align-items: center; gap: 8px; }
.act-reset { height: 32px; }
.activity-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.activity-chips[hidden] { display: none; }
.act-chip {
    display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
    font-size: 12px; font-weight: 500; color: var(--accent); background: var(--accent-bg);
    border: 1px solid var(--accent-border); border-radius: 999px; cursor: pointer;
}
.act-chip:hover { border-color: var(--accent); }
.act-chip-k { font-weight: 400; opacity: 0.75; }
.act-chip i { font-size: 10px; }

.activity-table td { vertical-align: top; padding-top: 11px; padding-bottom: 11px; }
.activity-table tbody tr { transition: background var(--dur-fast) var(--ease-out); }
.activity-table tbody tr:hover td { background: var(--surface2); }
.act-td-time time { display: flex; flex-direction: column; gap: 1px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.act-date { font-size: 13px; font-weight: 500; }
.act-time { font-size: 12px; color: var(--muted); }
.act-actor { display: flex; align-items: center; gap: 10px; min-width: 0; }
.act-avatar {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600; background: var(--surface3); color: var(--muted);
}
.act-avatar--user { background: var(--accent-bg); color: var(--accent); }
.act-avatar--client { background: var(--ok-bg); color: var(--ok); }
.act-actor-meta { display: flex; flex-direction: column; min-width: 0; }
.act-actor-name {
    max-width: 150px; padding: 0; border: none; background: none; cursor: pointer; text-align: left;
    font-size: 13px; font-weight: 600; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.act-actor-name:hover:not(:disabled) { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.act-actor-name:disabled { cursor: default; color: var(--muted); }
.act-actor-kind { font-size: 12px; color: var(--muted); }
.act-badge {
    display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px;
    border-radius: 999px; border: 1px solid var(--border);
    font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--surface2); color: var(--text-2);
}
.act-badge i { font-size: 11px; }
.act-badge--accent, .act-badge--info { background: var(--accent-bg); color: var(--accent); border-color: var(--accent-border); }
.act-badge--ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border); }
.act-badge--warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.act-badge--error { background: var(--error-bg); color: var(--error); border-color: var(--error-border); }
.act-action-raw { display: block; margin-top: 4px; font-family: var(--mono); font-size: 11px; color: var(--subtle); }
.act-pc {
    display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px;
    font-family: var(--mono); font-size: 12px; font-weight: 500; white-space: nowrap;
    color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xs); cursor: pointer;
}
.act-pc:hover { color: var(--accent); border-color: var(--accent-border); background: var(--accent-bg); }
.act-pc i { font-size: 10px; color: var(--subtle); }
.act-td-detail { max-width: 260px; }
.act-kv { display: inline-flex; align-items: baseline; gap: 5px; margin: 0 8px 3px 0; font-size: 13px; }
.act-kv-k { font-size: 12px; color: var(--muted); }
.act-td-ip { white-space: nowrap; }
.act-ip { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.act-empty { color: var(--subtle); }
.act-state { text-align: center; padding: 40px 20px !important; color: var(--muted); }
.act-state--error { color: var(--error); }
.activity-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border); }
.act-range { font-size: 12px; color: var(--muted); }
.act-pager { display: flex; align-items: center; gap: 6px; }
.act-page-btn {
    width: 30px; height: 30px; border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--surface); color: var(--muted); cursor: pointer; font-size: 11px;
    display: inline-flex; align-items: center; justify-content: center;
}
.act-page-btn:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); background: var(--surface2); }
.act-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.act-page-info { font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; min-width: 52px; text-align: center; }

/* ---------------------------------------------------------------------------
   Befehlsmenü (Strg/⌘ K)
   --------------------------------------------------------------------------- */
.cmdk-overlay {
    position: fixed; inset: 0; z-index: 5000;
    display: flex; align-items: flex-start; justify-content: center; padding: 14vh 16px 16px;
    background: rgba(12, 12, 18, 0.32); backdrop-filter: blur(2px);
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity var(--dur-base) var(--ease-out), visibility var(--dur-base) var(--ease-out);
}
.cmdk-overlay.open { opacity: 1; visibility: visible; pointer-events: auto; }
.cmdk-panel {
    width: min(580px, 100%); overflow: hidden;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
    transform: translateY(-6px) scale(0.985); opacity: 0;
    transition: transform var(--dur-slow) var(--ease-out), opacity var(--dur-base) var(--ease-out);
}
.cmdk-overlay.open .cmdk-panel { transform: none; opacity: 1; }
.cmdk-input-wrap { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.cmdk-input-icon { color: var(--subtle); font-size: 14px; }
.cmdk-input { flex: 1; border: none; outline: none; background: transparent; font-size: 15px; }
.cmdk-input::placeholder { color: var(--subtle); }
.cmdk-list { list-style: none; margin: 0; padding: 6px; max-height: 52vh; overflow-y: auto; overscroll-behavior: contain; }
.cmdk-item { display: flex; align-items: center; gap: 12px; min-height: 38px; padding: 0 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; }
.cmdk-item.active { background: var(--surface3); }
.cmdk-item-icon { width: 16px; text-align: center; color: var(--muted); font-size: 13px; flex-shrink: 0; }
.cmdk-item.active .cmdk-item-icon { color: var(--accent); }
.cmdk-item-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.cmdk-item-hint { font-size: 12px; color: var(--subtle); flex-shrink: 0; }
.cmdk-empty { padding: 28px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------------------
   Toasts (toaster.js)
   --------------------------------------------------------------------------- */
#toast-host { position: fixed; bottom: 20px; right: 20px; z-index: 4000; width: min(360px, calc(100vw - 32px)); height: 0; pointer-events: none; }
.toast {
    position: absolute; bottom: 0; right: 0; width: 100%;
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px; border-radius: 12px;
    background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
    font-size: 13px; font-weight: 500; line-height: 1.45;
    pointer-events: auto; touch-action: pan-y;
    transform: translate3d(var(--x, 0px), var(--y, 0px), 0) scale(var(--scale, 1));
    transform-origin: bottom right;
    transition: transform var(--dur-slow) var(--ease-spring), opacity var(--dur-base) var(--ease-out);
}
.toast.toast-dragging { transition: none; cursor: grab; }
.toast.toast-in { transform: translate3d(0, 16px, 0) scale(0.96); opacity: 0; }
.toast.toast-out { transition: transform var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-out); opacity: 0 !important; transform: translate3d(var(--x, 0px), 16px, 0) scale(0.96); }
.toast-icon { font-size: 14px; line-height: 1.45; flex-shrink: 0; }
.toast-msg { min-width: 0; word-break: break-word; }
.toast.toast-ok .toast-icon { color: var(--ok-dot); }
.toast.toast-err .toast-icon { color: var(--error-dot); }
.toast.toast-warn .toast-icon { color: var(--warn-dot); }
.toast.toast-info .toast-icon { color: var(--accent); }

/* ---------------------------------------------------------------------------
   Anmeldung + Passwort-Seite
   --------------------------------------------------------------------------- */
#login-screen, body.auth-page {
    position: fixed; inset: 0; z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px; background: var(--bg);
}
body.auth-page { position: static; min-height: 100vh; width: 100%; z-index: auto; overflow: auto; }

.login-split {
    display: flex; width: 100%; max-width: 900px; min-height: min(560px, 88vh);
    overflow: hidden; border-radius: 20px;
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.login-aside { position: relative; flex: 1 1 48%; min-width: 0; overflow: hidden; background: #3b1a74; }
.login-aside-img { width: 100%; height: 100%; display: block; object-fit: cover; }
.login-aside::after {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(180deg, rgba(46, 16, 94, 0) 55%, rgba(46, 16, 94, 0.45) 100%);
}
.login-panel { flex: 1 1 52%; min-width: 0; display: flex; flex-direction: column; justify-content: center; padding: 48px 52px; }
.login-brand { display: flex; align-items: center; margin-bottom: 36px; }
.login-panel .js-brand-img { width: auto; height: 60px; margin-left: -8px; }
html.theme-dark .login-panel .js-brand-img, html.theme-dark .auth-card .js-brand-img {
    /* Das Schriftlogo ist dunkel auf transparent — im Dunkelmodus auf eine helle Plakette setzen */
    background: #fff; padding: 6px 10px; border-radius: 8px; box-sizing: content-box;
}
.login-title, .login-card h2, .auth-card h2 { margin: 0 0 6px; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; color: var(--text); }
.login-sub { margin: 0 0 24px; font-size: 14px; color: var(--muted); line-height: 1.5; }
.login-field-label, .auth-label { display: block; margin: 0 0 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.login-field {
    position: relative; display: flex; align-items: center; margin-bottom: 16px;
    height: 40px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); box-shadow: var(--shadow-xs);
    transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.login-field:hover { border-color: var(--border-strong); }
.login-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.login-field-icon { flex: none; width: 36px; text-align: center; color: var(--subtle); font-size: 13px; }
.input-login {
    flex: 1; min-width: 0; height: 100%; padding: 0 10px 0 0;
    border: none; background: transparent; font-size: 14px; color: var(--text); -webkit-appearance: none;
}
.input-login:focus { outline: none; }
.input-login::placeholder { color: var(--subtle); }
.login-eye {
    flex: none; width: 36px; height: 36px; border: none; background: transparent;
    color: var(--subtle); cursor: pointer; font-size: 13px; display: grid; place-items: center;
}
.login-eye:hover { color: var(--text); }
.btn-login { width: 100%; height: 40px; margin-top: 8px; font-size: 14px; }

#login-error, .auth-error {
    margin: 0 0 16px; padding: 10px 12px; text-align: left;
    font-size: 13px; line-height: 1.45; color: var(--error);
    background: var(--error-bg); border: 1px solid var(--error-border); border-radius: var(--radius-sm);
}
#login-error { display: none; }
.auth-error[hidden] { display: none !important; }

.login-card, .auth-card {
    width: 100%; max-width: 420px; padding: 36px 36px 32px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg);
}
.auth-card .login-brand { justify-content: flex-start; margin-bottom: 28px; }
.auth-card .js-brand-img { width: auto; height: 56px; margin-left: -6px; }
.auth-form { text-align: left; }
.auth-form .input { height: 40px; }
.auth-hint { margin: 6px 0 16px; font-size: 12px; color: var(--muted); }
.auth-form .btn-primary { width: 100%; height: 40px; margin-top: 20px; font-size: 14px; }
.auth-ok-icon { color: var(--ok-dot); margin-right: 6px; }
.auth-card .btn-block { margin-top: 8px; }

@media (max-width: 760px) {
    .login-split { flex-direction: column; max-width: 440px; min-height: 0; border-radius: 18px; }
    .login-aside { flex: none; height: 180px; }
    .login-panel { padding: 28px 24px 30px; }
    .login-brand { margin-bottom: 24px; }
}

/* ---------------------------------------------------------------------------
   Kompakt-Modus
   --------------------------------------------------------------------------- */
body.layout-compact .content { padding-top: 16px; }
body.layout-compact td { padding-top: 7px; padding-bottom: 7px; font-size: 13px; }
body.layout-compact th { padding-top: 7px; padding-bottom: 7px; }
body.layout-compact tbody tr.pc-row { contain-intrinsic-size: auto 47px; }
body.layout-compact .pc-os { width: 26px; height: 26px; font-size: 12px; }
body.layout-compact .pc-id { flex-direction: row; align-items: baseline; gap: 10px; }
body.layout-compact .health-ring { width: 28px; height: 28px; font-size: 11px; }
body.layout-compact .badge { height: 22px; }
body.layout-compact .dashboard-stats { gap: 8px; margin-bottom: 12px; }
body.layout-compact .stat-card { padding: 10px 12px 12px; }
body.layout-compact .stat-card .stat-n { font-size: 22px; }
body.layout-compact .panel, body.layout-compact .dash-split { margin-bottom: 12px; }
body.layout-compact .activity-table td { padding-top: 7px; padding-bottom: 7px; }
body.layout-compact .act-avatar { width: 24px; height: 24px; font-size: 10px; }

/* ---------------------------------------------------------------------------
   Responsiv
   --------------------------------------------------------------------------- */
@media (max-width: 1280px) {
    /* Sechs Spalten passen erst bei breitem Inhalt; die IP bleibt in Druck und CSV erhalten. */
    .act-td-ip, .activity-table thead th:nth-child(6) { display: none; }
}

@media (max-width: 1180px) {
    .dash-split { grid-template-columns: minmax(0, 1fr); }
    .topbar-search { min-width: 0; }
    .topbar-search-text, .topbar-search-kbd { display: none; }
    .topbar-search { width: 34px; padding: 0; justify-content: center; }
    .content, .topbar { padding-left: 24px; padding-right: 24px; }
}

@media (max-width: 1024px) {
    .dashboard-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .activity-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    td.col-health .health-spark-wrap { display: none; }
}

@media (max-width: 900px) {
    .act-field select, .act-field input[type="date"] { max-width: none; width: 100%; }
    .act-field { flex: 1 1 140px; }
    .act-td-detail, .act-td-ip { display: none; }
    .activity-table thead th:nth-child(5), .activity-table thead th:nth-child(6) { display: none; }
}

@media (max-width: 768px) {
    body { flex-direction: column; }

    /* Sidebar wird zur schlanken Kopfleiste: Marke + Schalter oben, Navigation darunter */
    .sidebar {
        width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 8px;
        padding: 10px 12px 8px; border-right: none; border-bottom: 1px solid var(--border);
        overflow: visible;
    }
    .sidebar-brand { order: 0; flex: 1; min-height: 0; padding: 0; }
    .sidebar-mark, .sidebar-mark img { width: 28px; height: 28px; }
    .sidebar-brand-sub { display: none; }
    .sidebar-collapse-btn, .sidebar-spacer { display: none; }
    .sidebar-footer { order: 1; flex-direction: row; align-items: center; gap: 4px; }
    .sidebar-links {
        order: 2; flex: 1 1 100%; flex-direction: row; gap: 2px;
        overflow-x: auto; scrollbar-width: none; margin: 4px -4px 0;
    }
    .sidebar-links::-webkit-scrollbar { display: none; }
    .sidebar-nav-item { width: auto; flex-shrink: 0; min-height: 34px; padding: 0 10px; gap: 7px; font-size: 13px; }
    .sidebar-nav-item.is-active { background: var(--nav-active); }
    .sidebar-badge { min-width: 18px; height: 18px; font-size: 10px; }
    .sidebar-group { display: contents; }
    .sidebar-group-toggle { display: none; }
    .sidebar-sub { display: contents !important; }
    .sidebar-sub-item { width: auto; flex-shrink: 0; min-height: 34px; padding: 0 10px; gap: 7px; font-size: 13px; color: var(--text-2); }
    .sidebar-sub-item > i { display: inline-block; width: auto; font-size: 13px; color: var(--muted); }
    .sidebar-sub-item::after { display: none; }
    .sidebar-compact { display: none; }
    .theme-seg { padding: 0; background: none; box-shadow: none; }
    .theme-seg-btn { width: 32px; height: 32px; flex: none; }
    .theme-seg-btn span, .theme-seg-btn.is-active { display: none; }
    .sidebar-user-card { padding: 0; margin: 0; border: none; gap: 2px; }
    .sidebar-user-meta { display: none; }
    .sidebar-user-avatar { width: 28px; height: 28px; font-size: 11px; }

    .topbar { min-height: 0; padding: 14px 16px 12px; }
    .topbar-title { font-size: 17px; }
    .topbar-subtitle { font-size: 12px; }
    .last-refresh { display: none; }
    .topbar-right { gap: 6px; }
    .topbar .btn-refresh { width: 34px; padding: 0; }
    .btn-refresh-text { display: none; }
    .server-updates-actions .btn-refresh span { display: inline; }
    .content { padding: 16px 16px 28px; }

    /* Kennzahlen als wischbare Reihe */
    .dashboard-stats {
        display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory;
        margin: 0 -16px 16px; padding: 0 16px 2px; scrollbar-width: none;
    }
    .dashboard-stats::-webkit-scrollbar { display: none; }
    .stat-card { flex: 0 0 136px; scroll-snap-align: start; padding: 12px 12px 14px; }
    .stat-card .stat-n { font-size: 24px; }

    /* Gerätetabelle als Kartenliste */
    .pc-table thead { display: none; }
    .pc-table, .pc-table tbody { display: block; }
    .pc-table tr.pc-row, .pc-table tr.skeleton-row {
        display: grid; grid-template-columns: auto auto 1fr auto;
        grid-template-areas: "device device device status" "health updates security seen";
        align-items: center; gap: 10px 12px; padding: 12px 16px;
        border-bottom: 1px solid var(--border); contain-intrinsic-size: auto 104px;
    }
    .pc-table tr:last-child { border-bottom: none; }
    .pc-table td { display: block; padding: 0 !important; border: none; background: none !important; }
    .pc-table td.col-device { grid-area: device; min-width: 0; }
    .pc-table td.col-status { grid-area: status; width: auto; }
    .pc-table td.col-health { grid-area: health; }
    .pc-table td.col-updates { grid-area: updates; font-size: 12px; }
    .pc-table td.col-security { grid-area: security; justify-self: start; }
    .pc-table td.col-seen { grid-area: seen; font-size: 12px; text-align: right; }
    .pc-table td.col-action { display: none; }
    .pc-table td.col-health .health-spark-wrap { display: none; }
    .pc-table .health-ring { width: 30px; height: 30px; font-size: 11px; }
    .pc-table tr.pc-row:hover { background: var(--surface2); }
    .pc-table tr.pc-row.row-critical { box-shadow: inset 2px 0 0 var(--error-dot); }
    .pc-table tr.pc-row.row-critical td:first-child { box-shadow: none; }
    .pc-table tr.skeleton-row td:nth-child(n+3) { display: none; }
    .pc-table tr.table-empty-row { display: block; }
    .pc-table tr.table-empty-row td { display: block; padding: 40px 20px !important; }
    .pc-table td.table-empty { display: flex; }
    body.layout-compact .pc-table tr.pc-row { padding: 8px 16px; }

    .dash-split { gap: 12px; margin-bottom: 12px; }
    .status-embed-head { padding: 12px 16px; flex-wrap: wrap; }
    .server-updates-actions { width: 100%; justify-content: space-between; }
    .server-updates-actions .text-muted-sm { text-align: left; }
    .server-status-summary, .server-status-sections, .server-status-technical { padding-left: 16px; padding-right: 16px; }
    .backup-status-grid, .versions-grid { padding: 12px 16px 16px; }
    .version-tile--wide { grid-column: auto; }
    .versions-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .modal-bg { padding: 0; align-items: flex-end; }
    .modal {
        width: 100%; max-width: 100%; max-height: min(92dvh, 100%);
        border-radius: 18px 18px 0 0; border-bottom: none; margin: 0;
        transform: translateY(100%);
    }
    .modal-bg.open .modal { transform: none; }
    .modal-head { padding: 16px 18px 12px; }
    .modal-tabs { padding: 0 12px; }
    .modal-body-inner { padding: 16px 16px 28px; }
    .modal-tab-content[data-tab-content="overview"].active { grid-template-columns: minmax(0, 1fr); }
    .modal-grid-info { grid-template-columns: minmax(0, 1fr); }
    .card-tile--wide { grid-column: auto; }
    .rustdesk-row { flex-wrap: wrap; }
    .rustdesk-input { flex: 1 1 100%; }
    .btn-rustdesk-save { flex: 1; }
    .metric-inline { flex-direction: column; align-items: flex-start; gap: 2px; }
    .metric-inline-label { min-width: 0; }
    .note-actions-row { flex-wrap: wrap; }
    .input-flex { flex: 1 1 100%; }

    .activity-stats { gap: 8px; }
    .act-stat { padding: 12px; }
    .act-stat-n { font-size: 22px; }
    .act-stat-icon { width: 24px; height: 24px; font-size: 11px; }
    .act-stat-sub { display: none; }
    .activity-toolbar, .activity-foot { padding-left: 16px; padding-right: 16px; }
    .topbar .btn-icon-toolbar { width: 34px; }
}

/* ---------------------------------------------------------------------------
   Druck
   --------------------------------------------------------------------------- */
@media print {
    body { background: #fff !important; color: #000 !important; overflow: visible !important; height: auto !important; display: block !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .sidebar, .status-panel, #toast-host, .cmdk-overlay, .btn-icon-toolbar, .btn-refresh, .topbar-search, .modal-bg, #login-screen { display: none !important; }
    .main { display: block !important; width: 100% !important; overflow: visible !important; }
    .main[hidden] { display: none !important; }
    .no-print { display: none !important; }
    .topbar { border-bottom: 2px solid #222 !important; background: #fff !important; }
    .topbar-right { display: none !important; }
    .content { padding: 0 !important; overflow: visible !important; max-width: none !important; }
    .panel { box-shadow: none !important; border: 1px solid #888 !important; page-break-inside: avoid; }
    .dash-split { display: block !important; }
    th { background: #f0f0f0 !important; color: #000 !important; position: static !important; }
    .print-only { display: block !important; font-size: 12px; color: #333; margin-bottom: 14px; }
    tbody tr.pc-row { content-visibility: visible; }

    /* --- Aktivitätslog auf Papier ---
       Ziel: alle Spalten sichtbar, Bildschirm-Chrome weg, viele Zeilen pro Seite. */
    .main, .content, .panel { background: #fff !important; }

    #activity-view .topbar { min-height: 0 !important; padding: 0 0 6px !important; margin-bottom: 10px !important; }
    #activity-view .topbar-title { font-size: 16pt !important; }
    #activity-view .topbar-subtitle { display: none !important; }
    #activity-print-stand { font-size: 8.5pt; color: #333; margin: 0 0 10px !important; }
    .act-print-filter { display: block; font-weight: 700; color: #000; margin-top: 2px; }

    /* Kennzahlen als schmale Kopfleiste */
    .activity-stats { display: flex !important; gap: 8px !important; margin-bottom: 10px !important; page-break-inside: avoid; page-break-after: avoid; }
    .act-stat { flex: 0 0 auto; box-shadow: none !important; border: 1px solid #999 !important; border-radius: 4px !important; padding: 5px 12px !important; gap: 0 !important; }
    .act-stat-head { display: block !important; }
    .act-stat-label { font-size: 7.5pt !important; }
    .act-stat-n { font-size: 13pt !important; }
    .act-stat-icon, .act-stat-sub { display: none !important; }

    /* Die Tabelle muss über Seiten laufen dürfen — sonst bleibt Seite 1 leer */
    .activity-panel { box-shadow: none !important; border: 1px solid #999 !important; border-radius: 0 !important; page-break-inside: auto !important; margin-bottom: 0 !important; }
    .activity-panel .table-wrap { overflow: visible !important; }
    /* Feste Spaltenbreiten: bei automatischer Breite läuft die Tabelle über den
       A4-Satzspiegel hinaus und die letzte Spalte wird abgeschnitten. */
    .activity-table { font-size: 8.5pt !important; table-layout: fixed !important; width: 100% !important; }
    .activity-table thead { display: table-header-group; }  /* Kopfzeile auf jeder Seite */
    .activity-table th { padding: 5px 6px !important; font-size: 7pt !important; background: #fff !important; border-bottom: 1.5px solid #000 !important; }
    .activity-table td { padding: 5px 6px !important; border-bottom: 1px solid #ccc !important; overflow-wrap: break-word; }
    .activity-table tbody tr { page-break-inside: avoid; }
    .activity-table th:nth-child(1), .activity-table td:nth-child(1) { width: 13% !important; }
    .activity-table th:nth-child(2), .activity-table td:nth-child(2) { width: 15% !important; }
    .activity-table th:nth-child(3), .activity-table td:nth-child(3) { width: 19% !important; min-width: 0 !important; }
    .activity-table th:nth-child(4), .activity-table td:nth-child(4) { width: 13% !important; }
    .activity-table th:nth-child(5), .activity-table td:nth-child(5) { width: 27% !important; max-width: none !important; }
    .activity-table th:nth-child(6), .activity-table td:nth-child(6) { width: 13% !important; }

    /* Die Bildschirm-Regel für schmale Fenster darf auf A4 nicht greifen */
    .act-td-detail, .act-td-ip,
    .activity-table thead th:nth-child(5), .activity-table thead th:nth-child(6) { display: table-cell !important; }

    /* Datum über Uhrzeit — einzeilig läuft der Stempel in die Akteur-Spalte */
    .act-td-time time { flex-direction: column !important; gap: 0 !important; }
    .act-date { font-size: 8pt !important; color: #000 !important; }
    .act-time { font-size: 7.5pt !important; color: #333 !important; }

    /* Avatare, Pillen und Rahmen sind Bildschirm-Deko */
    .act-avatar { display: none !important; }
    .act-actor { gap: 0 !important; }
    /* Namen umbrechen statt mit „…" abschneiden — auf Papier gibt es kein Aufklappen */
    .act-actor-name {
        font-size: 8pt !important; max-width: none !important; color: #000 !important;
        white-space: normal !important; overflow: visible !important; text-overflow: clip !important;
    }
    .act-actor-kind { font-size: 7pt !important; color: #555 !important; }
    .act-badge, .act-pc {
        display: inline !important; background: none !important; border: none !important;
        padding: 0 !important; height: auto !important; color: #000 !important; font-size: 8.5pt !important;
        white-space: normal !important;  /* auf Papier muss umbrochen werden dürfen */
    }
    .act-badge i, .act-pc i { display: none !important; }
    .act-pc { font-family: var(--mono); }
    .act-action-raw { font-size: 6.5pt !important; color: #666 !important; margin-top: 1px !important; }
    .act-kv { font-size: 7.5pt !important; margin: 0 5px 1px 0 !important; }
    .act-kv-k { font-size: 6.5pt !important; color: #666 !important; }
    .act-ip { font-size: 7.5pt !important; color: #333 !important; }
    .act-empty { color: #999 !important; }
}

/* ---------------------------------------------------------------------------
   Reduzierte Bewegung: Animationen praktisch aus, Funktion bleibt erhalten.
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
