/* ============================================================
   ERNA – Design System
   Light & Dark Theme, moderne schlichte Oberfläche
   ============================================================ */

/* ---- CSS Custom Properties ---- */
:root {


    /* Danger */
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-soft: rgba(239, 68, 68, 0.12);

    /* Warning */
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.12);

    /* Success */
    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, 0.12);

    /* Radii & Schatten */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08);
    --shadow: 0 4px 16px rgba(0, 0, 0, .10);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, .14);

    /* Schrift */
    --font: 'Inter', 'Segoe UI', system-ui, sans-serif;
    --font-size-base: 14px;

    /* Abstände */
    --topbar-height: 54px;
    --sidebar-width: 230px;
    --sidebar-collapsed-width: 58px;

    /* Transitions */
    --transition: .2s ease;
}

/* ---- Hell-Theme (Standard) ---- */
[data-theme="light"] {
    /* Primärfarbe */
    --accent: #193f52;
    --accent-hover: #2563eb;
    --accent-soft: rgba(59, 130, 246, 0.12);

    --bg-base: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-surface-2: #f8fafc;
    --bg-topbar: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    --bg-active: var(--accent-soft);
    --bg-input: #f8fafc;

    --border: #e2e8f0;
    --border-focus: var(--accent);

    --text-primary: #000000;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-on-accent: #ffffff;

    --divider: #e2e8f0;
    --scrollbar-thumb: #cbd5e1;
}

/* ---- Dunkel-Theme ---- */
[data-theme="dark"] {
    --accent: #f5a328;
    --accent-hover: #f0ba6a;
    --accent-soft: rgba(255, 251, 7, 0.12);

    --bg-base: #0d121a;
    --bg-surface: #212429;
    --bg-surface-2: #162032;
    --bg-topbar: #0d121a;
    --bg-sidebar: #0d121a;
    --bg-card: #1a1e24;
    --bg-hover: #273549;
    --bg-active: var(--accent-soft);
    --bg-input: #162032;

    --border: #334155;
    --border-focus: var(--accent);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-on-accent: #ffffff;

    --divider: #334155;
    --scrollbar-thumb: #475569;
}

/* ============================================================
   Reset & Basis
   ============================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: var(--font-size-base);
}

body {
    font-family: var(--font);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

ul {
    list-style: none;
}

button {
    cursor: pointer;
    font-family: inherit;
}

input,
textarea,
select {
    font-family: inherit;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

/* ============================================================
   Utility
   ============================================================ */
.hide {
    display: none !important;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    min-height: 36px;
    min-width: 36px;
}

.btn-primary {
    background: var(--accent);
    color: var(--text-on-accent);
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-primary:active {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-surface-2);
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-secondary:active {
    background: var(--bg-hover);
}

.btn-danger {
    background: var(--danger);
    color: var(--text-on-accent);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-danger:active {
    background: var(--danger-hover);
}

/* Disabled state für alle Button-Varianten */
.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.5;
    /* background: var(--text-primary) !important; */
    color: var(--text-primary) !important;
    border-color: var(--text-primary) !important;
    cursor: not-allowed !important;
    pointer-events: none;
    font-weight: 400;
    font-size: 13px;
}

.btn:disabled:hover,
.btn[aria-disabled="true"]:hover {
    background: var(--text-primary) !important;
    border-color: var(--text-primary) !important;
}

.btn-block {
    width: 100%;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    min-width: 36px;
    min-height: 36px;
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.icon-btn:active {
    background: var(--bg-hover);
    opacity: 0.8;
}

.icon-btn.active {
    background: var(--accent-soft);
    color: var(--accent);
}

/* Touch-freundliche interaktive Elemente */
@media (hover: none) and (pointer: coarse) {

    .btn,
    .icon-btn {
        min-height: 44px;
        min-width: 44px;
    }

    .icon-btn {
        width: 44px;
        height: 44px;
    }
}

/* ============================================================
   Form Controls
   ============================================================ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    resize: vertical;
    min-height: 90px;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2394a3b8' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-wrapper .input-icon {
    position: absolute;
    left: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    pointer-events: none;
}

.input-icon-wrapper .form-control {
    padding-left: 36px;
}

.input-icon-wrapper .form-control[type="password"],
.input-icon-wrapper .form-control[type="text"]:has(+ .toggle-password) {
    padding-right: 40px;
}

.toggle-password {
    position: absolute;
    right: 4px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-weight: 500;
    padding: 6px;
    display: flex;
    align-items: center;
    border-radius: var(--radius-sm);
    transition: color var(--transition);
    z-index: 1;
    cursor: pointer;
}

.toggle-password:hover {
    color: var(--text-primary);
}

/* Checkbox & Radio Gruppen */
.checkbox-group,
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.checkbox-item,
.radio-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    transition: border-color var(--transition), background var(--transition), color var(--transition);
}

.checkbox-item:hover,
.radio-item:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

/* Aktiv-Zustand wenn Radio/Checkbox gewählt */
.checkbox-item:has(input:checked),
.radio-item:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.checkbox-item input[type="checkbox"],
.radio-item input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 15px;
    height: 15px;
    border: 2px solid var(--border-strong, var(--border));
    border-radius: 50%;
    background: var(--bg-card);
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    transition: border-color var(--transition), background var(--transition);
}

.checkbox-item input[type="checkbox"] {
    border-radius: 3px;
}

.checkbox-item input[type="checkbox"]:checked,
.radio-item input[type="radio"]:checked {
    border-color: var(--accent);
    background: var(--accent);
}

.radio-item input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #fff;
}

.checkbox-item input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    color: #fff;
    line-height: 1;
}

/* Touch-friendly checkboxes on mobile */
@media (hover: none) and (pointer: coarse) {

    .checkbox-item,
    .radio-item {
        gap: 10px;
        font-size: 13px;
        padding: 8px 12px;
    }

    .checkbox-item input[type="checkbox"],
    .radio-item input[type="radio"] {
        width: 17px;
        height: 17px;
    }
}

/* Error Message */
.error-msg {
    font-size: 13px;
    color: var(--danger);
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.error-msg i {
    font-size: 13px;
}

.breadcrumb-link {
    cursor: pointer;
    text-decoration: underline;
}


/* ============================================================
   Card
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--divider);
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.erna-dm-presence-label {
    font-size: 0.75em;
    font-weight: 400;
    margin-left: 4px;
    color: var(--text-muted);
}

.erna-dm-presence-label--online {
    color: var(--success);
}

.erna-dm-presence-label--unavailable {
    color: var(--text-muted);
}

.erna-dm-presence-label--offline {
    color: var(--text-muted);
}

/* ============================================================
   Login
   ============================================================ */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-base);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.login-card {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    box-shadow: var(--shadow-lg);
}

.login-logo-img {
    width: 64px;
    height: 64px;
    margin: 0 auto;
}

@media (max-width: 600px) {
    .login-container {
        min-height: 100vh;
        justify-content: center;
        padding: 16px 12px;
        gap: 12px;
        max-width: 100%;
    }

    .login-card {
        width: 100%;
        padding: 20px 16px;
        border-radius: 10px;
    }

    .login-logo-text {
        font-size: 28px;
    }

    .login-logo-sub {
        font-size: 10px;
        margin-top: 2px;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .form-control {
        padding: 7px 9px;
        font-size: 13px;
    }

    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    .theme-toggle-btn {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-text {
    display: block;
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--accent);
}

.login-logo-sub {
    display: block;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 400;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

.login-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--danger-soft);
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 16px;
}

.demo-access {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.demo-access-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.demo-access-list {
    display: grid;
    gap: 8px;
}

.demo-access-btn {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface-2);
    color: var(--text-primary);
    text-align: left;
    padding: 9px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    transition: background var(--transition), border-color var(--transition);
}

.demo-access-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.demo-role {
    font-weight: 600;
    font-size: 13px;
}

.demo-creds {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 400;
}

.login-theme-toggle {
    display: flex;
    justify-content: center;
}

.theme-toggle-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
}

.theme-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ============================================================
   App Layout
   ============================================================ */
.app-body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* ---- Topbar ---- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-height);
    padding: 0 16px;
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 100;
    gap: 12px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--accent);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-toggle-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-weight: 500;
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: background var(--transition), color var(--transition);
}

.nav-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ---- App Container ---- */
.app-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width var(--transition);
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-logo {
    margin-top: auto;
    padding: 16px 8px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sidebar-logo img {
    width: 80px;
    max-width: 100%;
}

.sidebar.collapsed .sidebar-logo img {
    width: 32px;
}

.nav-list {
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
    position: relative;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--bg-active);
    color: var(--accent);
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    transition: color 0.3s ease;
}

/* Icon-Farben für Notfallmeldungen */
#emergency-nav-icon.icon-danger {
    color: var(--danger);
}

#emergency-nav-icon.icon-success {
    color: var(--success);
}

.nav-label {
    transition: opacity var(--transition);
    overflow: hidden;
}

.nav-chevron {
    margin-left: auto;
    font-size: 13px;
    transition: transform var(--transition), opacity var(--transition);
}

.nav-group-toggle[aria-expanded="true"] .nav-chevron {
    transform: rotate(180deg);
}

.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-chevron,
.sidebar.collapsed .nav-badge {
    opacity: 0;
    width: 0;
    pointer-events: none;
}

/* Tooltip für collapsed sidebar */
.sidebar.collapsed .nav-link {
    position: relative;
    /* justify-content: center; */
}

.sidebar.collapsed .nav-icon {
    margin: 0;
}

.sidebar.collapsed .nav-link:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    z-index: 200;
    box-shadow: var(--shadow);
    pointer-events: none;
}

/* Sub-Navigation */
.nav-sub-list {
    overflow: hidden;
    max-height: 0;
    transition: max-height .25s ease;
}

.nav-sub-list.open {
    max-height: 300px;
}

.nav-sub-link {
    padding-left: 36px;
    font-size: 13px;
}

.sidebar.collapsed .nav-sub-list {
    display: none;
}

/* Im collapsed Zustand: Unterpunkte immer als Icon-Reihe anzeigen */
.sidebar.collapsed .nav-item-group .nav-group-toggle {
    display: none;
}

.sidebar.collapsed .nav-item-group .nav-sub-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: none;
    overflow: visible;
    padding: 0;
}

.sidebar.collapsed .nav-item-group .nav-sub-list .nav-sub-link {
    padding: 9px 10px;
    justify-content: center;
}

.sidebar.collapsed .nav-item-group .nav-sub-list .nav-label {
    opacity: 0;
    width: 0;
    pointer-events: none;
}

/* ---- Main Content ---- */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
    background: var(--bg-base);
}

.content-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* Split Divider */
.split-divider {
    width: 6px;
    background: var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: col-resize;
    transition: background var(--transition);
}

.split-divider:hover {
    background: var(--accent);
}

.split-handle {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    pointer-events: none;
}

.split-divider:hover .split-handle {
    color: var(--text-on-accent);
}

/* Pane Select Bar */
.page-select-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    min-height: 44px;
}

.page-select-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.page-select-icon {
    font-size: 16px;
    color: var(--text-primary);
    flex-shrink: 0;
}

.page-select-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.page-select-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-select-breadcrumb {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-select-btns {
    display: flex;
    gap: 4px;
}

/* Page Content Inner */
.page-content-inner {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Welcome Screen */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    text-align: center;
    color: var(--text-primary);
    font-weight: 400;
    gap: 12px;
}

.welcome-icon {
    font-size: 48px;
    color: var(--border);
}

.welcome-screen h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.welcome-screen p {
    font-size: 14px;
}

/* ============================================================
   Modal / Page Selector
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
    padding: 12px;
}

/* ── ernaConfirm – Custom Bestätigungs-Modal ─────────────────────────────── */
.erna-confirm-overlay {
    z-index: 9000;
    opacity: 0;
    transition: opacity 0.18s ease;
}

.erna-confirm-overlay.erna-confirm-visible {
    opacity: 1;
}

.erna-confirm-overlay.erna-confirm-visible .erna-confirm-box {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.erna-confirm-box {
    width: min(400px, 94vw);
    padding: 28px 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 0;
    transform: translateY(-12px) scale(0.97);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.erna-confirm-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin: 0 auto 18px;
}

.erna-confirm-icon-wrap--danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.erna-confirm-icon-wrap--warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.erna-confirm-icon-wrap--primary {
    background: var(--accent-soft);
    color: var(--accent);
}

.erna-confirm-header {
    text-align: center;
    margin-bottom: 10px;
}

.erna-confirm-header .modal-title {
    font-size: 17px;
    font-weight: 700;
}

.erna-confirm-message {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.55;
    margin: 0 0 24px;
}

.erna-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.erna-confirm-actions .btn {
    min-width: 110px;
    justify-content: center;
}

.modal-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 24px;
    width: 420px;
    max-width: 95vw;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
}

.page-grid {
    display: grid;
    grid-template-columns: repeat(3, 160px);
    gap: 12px;
    justify-content: center;
}

.page-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 10px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
    cursor: pointer;
    min-height: 80px;
}

.page-grid-item i {
    font-size: 22px;
    color: var(--accent);
}

.page-grid-item:hover {
    background: var(--bg-active);
    border-color: var(--accent);
    color: var(--accent);
}

.page-grid-item:active {
    opacity: 0.9;
}

@media (max-width: 600px) {
    .modal-box {
        width: 92vw;
        max-width: 320px;
        max-height: 80vh;
        padding: 16px;
    }

    .page-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================================
   Notfallmeldung Seite
   ============================================================ */
/* page-header, page-title und breadcrumb entfernt - jetzt in page-select-bar */

/* Modul-Karten Grid */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
    margin-top: 8px;
}

.module-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
    text-align: center;
}

.module-card:hover {
    background: var(--bg-active);
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.module-card i {
    font-size: 28px;
    color: var(--accent);
}

.module-card span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Statistik-Karten */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 14px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    cursor: default;
    transition: border-color var(--transition);
}

.stat-card.clickable {
    cursor: pointer;
}

.stat-card.clickable:hover {
    border-color: var(--accent);
}

.stat-card.alert-border {
    border-color: var(--danger);
}

/* Kategorie-Farben */
.stat-card--b {
    border-top: 3px solid #e53e3e;
}

.stat-card--b .stat-icon {
    color: #e53e3e;
}

.stat-card--b .stat-number {
    color: #e53e3e;
}

.stat-card--th {
    border-top: 3px solid #3182ce;
}

.stat-card--th .stat-icon {
    color: #3182ce;
}

.stat-card--th .stat-number {
    color: #3182ce;
}

.stat-card--mn {
    border-top: 3px solid #718096;
}

.stat-card--mn .stat-icon {
    color: #718096;
}

.stat-card--mn .stat-number {
    color: #718096;
}

.stat-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
}

.stat-number {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.stat-icon {
    font-size: 20px;
    color: var(--text-primary);
    font-weight: 500;
}

.stat-label {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 600;
    text-align: center;
    width: 100%;
}

/* Enhanced Statistik-Karten mit Radial Charts */
.stats-grid-enhanced {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
    margin-top: 12px;
}

.stat-card-enhanced {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    cursor: default;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    opacity: 1;
}

/* Gradient-Hintergründe für Kategorien */
.stat-card-enhanced--mn::before {
    background: linear-gradient(90deg, #718096, #8794a8);
}

.stat-card-enhanced--b::before {
    background: linear-gradient(90deg, #e53e3e, #fc8181);
}

.stat-card-enhanced--th::before {
    background: linear-gradient(90deg, #3182ce, #63b3ed);
}

.stat-card-enhanced--sm::before {
    background: linear-gradient(90deg, #6b7280, #9ca3af);
}

/* Header der Karte */
.stat-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    min-height: 32px;
}

.stat-label-enhanced {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}

.stat-card-enhanced--mn .stat-label-enhanced {
    color: #718096;
}

.stat-card-enhanced--b .stat-label-enhanced {
    color: #e53e3e;
}

.stat-card-enhanced--th .stat-label-enhanced {
    color: #3182ce;
}

.stat-card-enhanced--sm .stat-label-enhanced {
    color: #6b7280;
}

/* Trend-Indikator */
.stat-trend {
    font-size: 13px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.stat-trend.trend-up {
    color: var(--success);
    background: var(--success-soft);
}

.stat-trend.trend-down {
    color: var(--danger);
    background: var(--danger-soft);
}

.stat-trend.trend-neutral {
    color: var(--text-primary);
    font-weight: 500;
    background: var(--bg-hover);
}

/* Radial Progress Container */
.stat-card-body {
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-radial-container {
    position: relative;
    width: 90px;
    height: 90px;
}

.stat-radial {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.stat-radial-bg {
    fill: none;
    stroke: var(--bg-hover);
    stroke-width: 6;
}

.stat-radial-progress {
    fill: none;
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dasharray 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-radial-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.stat-icon-enhanced {
    font-size: 18px;
    color: var(--text-primary);
    font-weight: 500;
}

.stat-number-enhanced {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

/* Kategorie-spezifische Icon-Farben */
.stat-card-enhanced--mn .stat-icon-enhanced {
    color: #718096;
}

.stat-card-enhanced--b .stat-icon-enhanced {
    color: #e53e3e;
}

.stat-card-enhanced--th .stat-icon-enhanced {
    color: #3182ce;
}

/* Animationen */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-number-enhanced {
    animation: countUp 0.5s ease-out;
}

/* Responsive Anpassungen */
@media (max-width: 1200px) {
    .stats-grid-enhanced {
        grid-template-columns: repeat(4, 1fr);
    }

    .stat-label-enhanced {
        font-size: 12px;
    }
}

@media (max-width: 900px) {
    .stats-grid-enhanced {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-grid-enhanced {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .stat-card-enhanced {
        padding: 12px;
    }

    .stat-radial-container {
        width: 75px;
        height: 75px;
    }

    .stat-icon-enhanced {
        font-size: 16px;
    }

    .stat-number-enhanced {
        font-size: 20px;
    }

    .stat-label-enhanced {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .stats-grid-enhanced {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Trennlinie */
.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0 12px;
    opacity: 0.7;
}

/* Gestern-Toggle Switch */
.nm-gestern-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.nm-gestern-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.nm-gestern-toggle-track {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    background: var(--border);
    border-radius: 999px;
    transition: background var(--transition);
    flex-shrink: 0;
}

.nm-gestern-toggle-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.nm-gestern-toggle input:checked+.nm-gestern-toggle-track {
    background: var(--accent);
}

.nm-gestern-toggle input:checked+.nm-gestern-toggle-track::after {
    transform: translateX(16px);
}

.nm-gestern-toggle-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nm-stats-gestern .stat-card {
    opacity: 0.85;
}

/* Section-Überschriften */
.section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-primary);
    margin-bottom: 12px;
    margin-top: 4px;
}

/* Meldungsart-Buttons */
.meldungsart-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.meldungsart-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.meldungsart-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.meldungsart-btn.active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

/* Kategorie-Farben: Brand */
.meldungsart-btn--b {
    border-left: 3px solid #e53e3e;
}

.meldungsart-btn--b:hover {
    border-color: #e53e3e;
    color: #e53e3e;
}

.meldungsart-btn--b.active {
    background: rgba(229, 62, 62, 0.1);
    border-color: #e53e3e;
    color: #e53e3e;
}

/* Kategorie-Farben: Technische Hilfe */
.meldungsart-btn--th {
    border-left: 3px solid #3182ce;
}

.meldungsart-btn--th:hover {
    border-color: #3182ce;
    color: #3182ce;
}

.meldungsart-btn--th.active {
    background: rgba(49, 130, 206, 0.1);
    border-color: #3182ce;
    color: #3182ce;
}

/* Kategorie-Farben: Medizinischer Notfall */
.meldungsart-btn--mn {
    border-left: 3px solid #718096;
}

.meldungsart-btn--mn:hover {
    border-color: #718096;
    color: #718096;
}

.meldungsart-btn--mn.active {
    background: rgba(113, 128, 150, 0.1);
    border-color: #718096;
    color: #718096;
}

/* Kategorie-Farben: Sonstige */
.meldungsart-btn--sm {
    border-left: 3px solid #6b7280;
}

.meldungsart-btn--sm:hover {
    border-color: #6b7280;
    color: #6b7280;
}

.meldungsart-btn--sm.active {
    background: rgba(107, 114, 128, 0.1);
    border-color: #6b7280;
    color: #6b7280;
}

/* Meldungsart Content Block */
.meldungsart-content {
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 4px;
}

.meldungsart-headline {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.meldungsart-content--mn .meldungsart-headline,
.meldungsart-content--mn .form-group>label,
.meldungsart-content--mn .checkbox-section-group>label {
    color: #718096;
}

.meldungsart-content--b .meldungsart-headline,
.meldungsart-content--b .form-group>label,
.meldungsart-content--b .checkbox-section-group>label {
    color: #e53e3e;
}

.meldungsart-content--th .meldungsart-headline,
.meldungsart-content--th .form-group>label,
.meldungsart-content--th .checkbox-section-group>label {
    color: #3182ce;
}

.meldungsart-content--sm .meldungsart-headline,
.meldungsart-content--sm .form-group>label,
.meldungsart-content--sm .checkbox-section-group>label {
    color: #6b7280;
}

/* Felder-Grid in Formularen */
.fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.fields-grid-2col {
    grid-template-columns: repeat(2, 1fr);
}

/* Checkbox-Sektion */
.checkbox-section {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px;
    margin: 16px 0;
}

.checkbox-section-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
}

.checkbox-section-group label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    display: block;
    margin-bottom: 10px;
}

/* Subcontainer */
.subcontainer {
    background: var(--bg-surface);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-top: 6px;
    margin-left: 22px;
    margin-bottom: 4px;
}

/* Action-Leiste unten im Formular */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--divider);
}

/* Übersichts-Tabelle */
.data-table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead {
    background: var(--bg-surface-2);
}

.data-table th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    vertical-align: middle;
}

.data-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
    text-align: left;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr.clickable-row {
    cursor: pointer;
}

.data-table tbody tr.clickable-row:hover td {
    background: var(--bg-hover);
}

.data-table tbody tr:hover td {
    background: var(--bg-hover);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .badge {
        font-size: 11px;
        padding: 2px 6px;
        gap: 2px;
    }
}

.badge-accent {
    background: var(--accent-soft);
    color: var(--accent);
}

.badge-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge-warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.badge-success {
    background: var(--success-soft);
    color: var(--success);
}

.badge-muted {
    background: var(--bg-hover);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 13px;
}

.page-demo-badge {
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 2px 8px;
}

/* Badge in Navigation */
.nav-badge {
    margin-left: auto;
    font-size: 13px;
    padding: 2px 7px;
}

/* Chat Icon in Topbar */
.topbar-chat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--success-soft);
    color: var(--success);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
    margin-right: 8px;
}

.topbar-chat-icon:hover {
    background: var(--success);
    color: #fff;
}

/* Badge in Topbar */
.topbar-emergency-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 8px;
    background: var(--danger-soft);
    color: var(--danger);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 600;
    margin-right: 12px;
}

.topbar-emergency-badge:hover {
    background: var(--danger);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

/* Grüner Badge wenn keine Notfallmeldungen */
.topbar-emergency-badge.badge-success {
    background: var(--success-soft);
    color: var(--success);
}

.topbar-emergency-badge.badge-success:hover {
    background: var(--success);
    color: white;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.topbar-emergency-badge i {
    font-size: 16px;
}

.topbar-emergency-count {
    /* font-size: 18px; */
    font-weight: 700;
}

.topbar-emergency-label {
    font-size: 13px;
    font-weight: 500;
}

.nm-table-actions {
    display: inline-flex;
    gap: 6px;
}

.nm-detail-modal-box {
    width: min(900px, 95vw);
    max-height: 88vh;
}

.nm-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.nm-formsheet {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-surface);
    padding: 14px;
}

.nm-formsheet-head {
    border-bottom: 1px solid var(--divider);
    margin-bottom: 12px;
    padding-bottom: 8px;
}

.nm-formsheet-head h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.nm-formsheet-head p {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 400;
}

.nm-kv {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-base);
}

.nm-kv span {
    font-size: 13px;
    text-transform: uppercase;
    /* color: var(--text-muted); */
    letter-spacing: 0.04em;
}

.nm-kv strong {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 600;
    white-space: pre-wrap;
    word-break: break-word;
}

.nm-kv-wide {
    grid-column: 1 / -1;
}

.nm-type-block {
    margin-top: 12px;
    border-top: 1px solid var(--divider);
    padding-top: 12px;
}

.nm-type-block h4 {
    margin: 0 0 8px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-primary);
    font-weight: 600;
}

.nm-type-form {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.nm-type-row {
    display: grid;
    grid-template-columns: 240px 1fr;
    border-bottom: 1px solid var(--border);
}

.nm-type-row:last-child {
    border-bottom: none;
}

.nm-type-label,
.nm-type-value {
    padding: 9px 10px;
    font-size: 13px;
}

.nm-type-label {
    background: var(--bg-base);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    border-right: 1px solid var(--border);
}

.nm-type-value {
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

.nm-type-empty {
    margin: 0;
    color: var(--text-primary);
    font-weight: 400;
    font-size: 13px;
}

.nm-type-edit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.nm-type-edit-grid .form-group {
    margin-bottom: 0;
}

.nm-type-json {
    margin: 0;
    max-height: 180px;
    overflow: auto;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    padding: 10px;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 400;
}

.nm-modal-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--divider);
}

@media (max-width: 760px) {
    .nm-detail-grid {
        grid-template-columns: 1fr;
    }

    .nm-type-edit-grid {
        grid-template-columns: 1fr;
    }

    .nm-type-row {
        grid-template-columns: 1fr;
    }

    .nm-type-label {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .nm-modal-actions .btn {
        width: 100%;
    }
}

@media print {
    body * {
        visibility: hidden;
    }

    #nm-detail-modal,
    #nm-detail-modal * {
        visibility: visible;
    }

    #nm-detail-modal {
        position: static;
        inset: auto;
        background: none;
        padding: 0;
        display: block;
    }

    #nm-detail-modal .modal-box {
        border: none;
        box-shadow: none;
        width: 100%;
        max-width: 100%;
        max-height: none;
        padding: 0;
    }

    #nm-detail-modal .modal-header .icon-btn,
    #nm-detail-modal .nm-modal-actions,
    #nm-detail-modal .nm-no-print {
        display: none !important;
    }

    #nm-detail-modal .modal-title {
        font-size: 18px;
        margin-bottom: 8px;
    }

    .nm-formsheet {
        border: 1px solid #777;
        padding: 12px;
    }

    .nm-kv,
    .nm-type-form,
    .nm-type-row,
    .nm-type-label,
    .nm-type-value {
        break-inside: avoid;
    }
}

/* Collapsible Sections für Statistiken */
.collapsible-section {
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    overflow: hidden;
}

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    cursor: pointer;
    transition: background var(--transition);
    user-select: none;
}

.collapsible-header:hover {
    background: var(--bg-hover);
}

.collapsible-icon {
    color: var(--text-primary);
    font-weight: 500;
    transition: transform var(--transition);
    font-size: 14px;
}

.collapsible-content {
    border-top: 1px solid var(--border);
    padding: 16px 18px;
    animation: slideDown 0.3s ease;
}

/* Reduziertes Padding für Tabellen in collapsible sections */
.collapsible-content>.data-table-wrapper:first-child {
    margin: -16px -18px;
    border: none;
    border-radius: 0;
}

.collapsible-content>.data-table-wrapper:first-child .data-table {
    border-radius: 0;
}

/* Wenn es zusätzliche Elemente vor der Tabelle gibt (z.B. Filter) */
.collapsible-content>div:first-child:not(.data-table-wrapper) {
    margin-bottom: 12px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Count Badge */
.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: var(--accent);
    color: white;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
}

/* Emergency Cards List */
.emergency-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.emergency-card {
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    cursor: pointer;
    transition: all var(--transition);
}

.emergency-card:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.emergency-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--divider);
}

.emergency-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.emergency-card-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 400;
}

.emergency-card-row i {
    width: 16px;
    text-align: center;
    color: var(--text-primary);
    font-weight: 500;
}

.emergency-card-row span {
    flex: 1;
}

/* Chart Container Anpassungen */
canvas {
    max-height: 350px;
}

/* Responsive Anpassungen für Statistiken */
@media (max-width: 768px) {
    .collapsible-header {
        padding: 12px 14px;
    }

    .collapsible-content {
        padding: 14px;
    }

    .emergency-card {
        padding: 12px;
    }

    canvas {
        max-height: 300px;
    }
}

/* ============================================================
   Toast Notifications
   ============================================================ */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    font-weight: 500;
    min-width: 240px;
    max-width: 360px;
    animation: slideIn .2s ease;
}

.toast.success {
    border-color: var(--success);
    color: var(--success);
}

.toast.error {
    border-color: var(--danger);
    color: var(--danger);
}

.toast.info {
    border-color: var(--accent);
    color: var(--accent);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================================
   Placeholder Seiten
   ============================================================ */
.placeholder-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--text-primary);
    font-weight: 400;
    gap: 12px;
    text-align: center;
}

.placeholder-page i {
    font-size: 48px;
    color: var(--border);
}

.placeholder-page h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================================
   Chat
   ============================================================ */
.chat-shell {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 16px;
    min-height: 0;
}

.chat-page {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.user-chat-shell {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 16px;
    min-height: 0;
    flex: 1;
    align-items: stretch;
}

/* ── Sidebar Card ──────────────────────────────────────────────────── */
.user-chat-sidebar-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    min-height: 0;
    height: 100%;
}

.chat-back-btn {
    display: none;
}

.chat-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.chat-sidebar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-sidebar-actions {
    display: flex;
    gap: 4px;
}

/* ── Ausklappbare Abschnitte ───────────────────────────────────────── */
.chat-section {
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    min-height: 0;
}

/* Jede offene Section übernimmt freien Platz in der Sidebar */
.chat-section:has(.chat-section-body.open) {
    flex: 1;
}

.chat-section:last-child {
    border-bottom: none;
}

.chat-section-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: color var(--transition), background var(--transition);
}

.chat-section-toggle:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.chat-section-toggle span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-section-chevron {
    font-size: 11px;
    transition: transform 0.2s ease;
}

.chat-section-chevron.open {
    transform: rotate(180deg);
}

.chat-section-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.25s ease;
    flex: 1;
    min-height: 0;
}

/* Offen: max-height groß genug für Animation, Flex begrenzt die echte Höhe */
.chat-section-body.open {
    max-height: 2000px;
    overflow-y: auto;
    min-height: 160px;
}

/* Personen-Section (letzte): füllt restlichen Raum der Sidebar */
.chat-section:last-child .chat-section-body.open {
    max-height: 2000px;
    overflow-y: auto;
    flex: 1;
    min-height: 160px;
}

/* ── Personen-Suche ───────────────────────────────────────────────── */
.chat-person-search-wrap {
    position: relative;
    padding: 10px 12px 6px;
    flex-shrink: 0;
}

.chat-person-search-icon {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
    pointer-events: none;
}

.chat-person-search-input {
    padding-left: 30px !important;
    font-size: 13px;
}

/* ── Personen-Liste ───────────────────────────────────────────────── */
.chat-person-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 8px 8px;
}

.chat-person-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: none;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: background var(--transition);
}

.chat-person-item:hover {
    background: var(--bg-hover);
}

.chat-person-item.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.chat-person-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--text-on-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: -.5px;
    position: relative;
}

.chat-person-avatar--sm {
    width: 28px;
    height: 28px;
    font-size: 11px;
}

/* Presence-Dot am Avatar */
.presence-dot {
    position: absolute;
    bottom: 24px;
    right: -4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--bg-card, #fff);
    background: #9ca3af;
    /* offline: grau */
}

.presence-dot.online {
    background: #22c55e;
}

.presence-dot.unavailable {
    background: #f59e0b;
}

.presence-dot.offline {
    background: #9ca3af;
}

.presence-dot.in_call {
    background: #f59e0b;
}

/* Presence-Dot auch in Admin-Listen */
.au-presence-wrap {
    position: relative;
    display: inline-flex;
}

.au-presence-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-card, #fff);
    background: #9ca3af;
}

.au-presence-dot.online {
    background: #22c55e;
}

.au-presence-dot.unavailable {
    background: #f59e0b;
}

.au-presence-dot.offline {
    background: #9ca3af;
}

.chat-person-name {
    font-size: 13px;
    font-weight: 500;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-person-unread {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 11px;
    background: var(--success);
    color: #fff;
    flex-shrink: 0;
}

/* ── Kleine Empty-State ───────────────────────────────────────────── */
.chat-empty-state-sm {
    min-height: 80px;
    font-size: 12px;
}

.chat-empty-state-sm i {
    font-size: 18px;
}

.user-chat-room-list-card,
.user-chat-conversation-card {
    min-width: 0;
}

.user-chat-conversation-card {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 0;
    height: 100%;
}

.chat-sidebar-panel,
.chat-main-panel {
    display: grid;
    gap: 16px;
    align-content: start;
}

.chat-card-section,
.chat-room-list-card,
.chat-conversation-card {
    min-width: 0;
}

.chat-inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chat-inline-actions-tight .btn {
    flex: 1 1 90px;
}

.chat-user-bar {
    margin-top: 12px;
}

.chat-room-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 8px 8px;
}

.chat-room-section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 10px 4px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
    user-select: none;
}

.chat-room-section-header:not(:first-child) {
    margin-top: 6px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.chat-room-item-wrap {
    display: flex;
    align-items: center;
    gap: 2px;
    border-radius: var(--radius-sm);
}

.chat-room-item-wrap:hover .chat-room-delete-btn {
    opacity: 1;
}

.chat-room-delete-btn {
    flex-shrink: 0;
    opacity: 0;
    transition: opacity var(--transition), color var(--transition);
    color: var(--text-muted);
    padding: 6px 7px;
}

.chat-room-delete-btn:hover {
    color: var(--danger);
}


.chat-room-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    text-align: left;
    padding: 8px 10px;
    border: none;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.chat-room-item:hover {
    background: var(--bg-hover);
}

.chat-room-item.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.chat-room-name {
    display: block;
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-room-ts {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.chat-room-main {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.chat-room-type-badge {
    flex-shrink: 0;
    font-size: 10px;
    padding: 2px 7px;
    width: fit-content;
}

.au-item-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.chat-room-type-icon {
    flex-shrink: 0;
    font-size: 14px;
    width: 18px;
    text-align: center;
}

.chat-room-type-icon--group {
    color: var(--accent);
}

.chat-room-type-icon--dm {
    color: #f59e0b;
}

.chat-conv-icon--group {
    color: var(--accent);
}

.chat-conv-icon--dm {
    color: #f59e0b;
}


.chat-room-unread-badge {
    flex-shrink: 0;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 13px;
    line-height: 1;
}

.chat-conversation-card {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 620px;
}

.chat-conversation-head {
    align-items: center;
    flex-wrap: wrap;
    flex-direction: row !important;
    justify-content: space-between;
}

.chat-messages {
    min-height: 280px;
    max-height: 70vh;
    overflow-y: auto;
    display: grid;
    align-content: start;
    gap: 10px;
    padding: 4px;
}

.chat-message {
    max-width: min(480px, 80%);
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-surface-2);
    box-shadow: var(--shadow-sm);
}

.chat-message.is-own {
    margin-left: auto;
    background: var(--accent-soft);
    border-color: rgba(59, 130, 246, 0.25);
    text-align: right;
}

.chat-message.is-own .chat-message-meta {
    flex-direction: row-reverse;
}

.chat-message-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 400;
}

.chat-message-body {
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-primary);
}

.chat-composer {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--divider);
}

.chat-attach-btn {
    flex-shrink: 0;
}

.chat-upload-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin-top: 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}

.chat-upload-hint {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

/* ---- Datei-Anhänge im Chat-Verlauf ---- */
.chat-file {
    display: block;
    margin-top: 4px;
}

.chat-file-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border);
}

.chat-file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 15px;
    flex-shrink: 0;
}

.chat-file-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    text-align: left;
}

.chat-file-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}

.chat-file-size {
    font-size: 12px;
    color: var(--text-secondary);
}

.chat-file-download {
    margin-left: auto;
    flex-shrink: 0;
}

.chat-file-image {
    cursor: pointer;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    max-width: 260px;
    background: var(--bg-surface-2);
}

.chat-file-image-el {
    display: block;
    width: 100%;
    max-height: 260px;
    object-fit: cover;
}

.chat-empty-state {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    color: var(--text-primary);
    font-weight: 400;
}

.chat-empty-state i {
    font-size: 28px;
    color: var(--border);
}

/* ============================================================
   Responsive
   ============================================================ */

/* ---- Tablet Landscape & Small Desktop (769px - 1024px) ---- */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 200px;
    }

    .sidebar {
        width: 200px;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .module-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .chat-shell {
        grid-template-columns: 300px minmax(0, 1fr);
    }

    .user-chat-shell {
        grid-template-columns: 280px minmax(0, 1fr);
    }
}

/* ---- Tablet Portrait (601px - 768px) ---- */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 180px;
        --sidebar-collapsed-width: 56px;
        --font-size-base: 13px;
    }

    .page-select-btns {
        display: none;
    }

    html {
        font-size: 13px;
    }

    .topbar {
        gap: 8px;
        padding: 0 12px;
    }

    .topbar-title {
        font-size: 16px;
    }

    .topbar-emergency-badge {
        padding: 5px 10px;
        gap: 6px;
        font-size: 12px;
        margin-right: 6px;
    }

    .topbar-emergency-badge i {
        font-size: 14px;
    }

    .topbar-emergency-count {
        font-size: 15px;
    }

    .topbar-emergency-label {
        display: none;
    }

    .nav-toggle-btn,
    .icon-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .sidebar {
        width: var(--sidebar-width);
        position: fixed;
        left: 0;
        top: var(--topbar-height);
        bottom: 0;
        z-index: 200;
        transform: translateX(0);
        transition: transform var(--transition), width var(--transition);
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

    .nav-list {
        padding: 8px 4px;
    }

    .nav-link {
        padding: 7px 8px;
        gap: 8px;
        font-size: 13px;
    }

    .nav-icon {
        width: 18px;
    }

    .nav-sub-link {
        padding-left: 32px;
    }

    .fields-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .fields-grid-2col {
        grid-template-columns: 1fr;
    }

    .checkbox-section {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .module-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-top: 6px;
    }

    .module-card {
        padding: 18px 12px;
    }

    .module-card i {
        font-size: 24px;
    }

    .module-card span {
        font-size: 12px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-top: 6px;
    }

    .stat-card {
        padding: 12px 10px;
    }

    .stat-number {
        font-size: 22px;
    }

    .stat-icon {
        font-size: 14px;
    }

    .stat-label {
        font-size: 11px;
    }

    .page-content-inner {
        padding: 16px 12px;
    }

    .card {
        padding: 16px;
        border-radius: 8px;
    }

    .card-header {
        margin-bottom: 12px;
        padding-bottom: 10px;
        gap: 8px;
        flex-direction: column;
        align-items: flex-start;
    }

    .card-title {
        font-size: 13px;
        gap: 6px;
    }

    .card-title i {
        font-size: 14px;
    }

    .section-title {
        font-size: 11px;
        margin-top: 16px;
        margin-bottom: 8px;
    }

    .form-group {
        gap: 4px;
        margin-bottom: 12px;
    }

    .form-group label {
        font-size: 12px;
    }

    .form-control {
        padding: 8px 10px;
        font-size: 13px;
        border-radius: 6px;
    }

    textarea.form-control {
        min-height: 80px;
    }

    .input-icon-wrapper .input-icon {
        left: 10px;
    }

    .input-icon-wrapper .form-control {
        padding-left: 32px;
    }

    .btn {
        padding: 8px 14px;
        font-size: 13px;
        border-radius: 6px;
        gap: 6px;
    }

    .meldungsart-btn {
        padding: 8px 12px;
        font-size: 12px;
        gap: 6px;
    }

    .meldungsart-content {
        padding: 14px;
        border-radius: 6px;
    }

    .meldungsart-headline {
        font-size: 13px;
        margin-bottom: 12px;
        gap: 6px;
    }

    .subcontainer {
        padding: 10px;
        border-radius: 5px;
        margin-top: 8px;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }

    .badge {
        padding: 2px 7px;
        font-size: 11px;
    }

    .modal-box {
        width: 90vw;
        
        padding: 18px;
    }

    .modal-title {
        font-size: 15px;
    }

    .page-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .page-grid-item {
        padding: 14px 8px;
        font-size: 11px;
        gap: 6px;
    }

    .page-grid-item i {
        font-size: 18px;
    }

    .form-actions {
        gap: 8px;
        margin-top: 16px;
        padding-top: 12px;
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    /* Split-Screen ausblenden auf Tablets */
    #split-toggle-btn {
        display: none;
    }

    #content-pane-right {
        display: none !important;
    }

    #split-divider {
        display: none !important;
    }

    /* Chat: View-Switch → eigener Breakpoint bei 930px */

}

.ac-mobile-back-btn {
    display: none !important;
}

/* ---- Chat & Notizen View-Switch (max 930px) ---- */
@media (max-width: 930px) {
    .chat-shell {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .user-chat-shell {
        grid-template-columns: 1fr;
        gap: 0;
    }

    /* Admin-Chat: einspaltiges Layout */
    .au-layout {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .ac-mobile-back-btn {
        display: inline-flex !important;
    }

    /* Default: Liste anzeigen, Detail verstecken */
    .au-layout .au-col-form {
        display: none;
    }

    /* Wenn Detail aktiv: Liste weg, Detail da */
    .au-layout.ac-detail-active .au-col-list {
        display: none;
    }

    .au-layout.ac-detail-active .au-col-form {
        display: block;
    }

    .chat-back-btn {
        display: inline-flex !important;
    }

    .user-chat-sidebar-card {
        height: 100%;
    }

    .user-chat-conversation-card {
        height: 100%;
        min-height: 0;
    }

    /* Default: zeige Sidebar, verstecke Konversation */
    .user-chat-shell .user-chat-conversation-card {
        display: none;
    }

    /* Wenn Konversation aktiv: verstecke Sidebar, zeige Konversation */
    .user-chat-shell.chat-conv-active .user-chat-sidebar-card {
        display: none;
    }

    .user-chat-shell.chat-conv-active .user-chat-conversation-card {
        display: flex;
        flex-direction: column;
    }

    .user-chat-shell.chat-conv-active .chat-conversation-head {
        align-items: start;
        gap: 8px;
    }

    .user-chat-shell.chat-conv-active .chat-messages {
        flex: 1;
        min-height: 0;
        max-height: none;
    }

    .user-chat-shell.chat-conv-active .chat-composer {
        grid-template-columns: 1fr auto;
        gap: 8px;
    }
}

/* ---- Smartphone (max 600px) ---- */
@media (max-width: 600px) {
    :root {
        --topbar-height: 48px;
        --sidebar-width: 160px;
        --sidebar-collapsed-width: 52px;
        --font-size-base: 12px;
    }

    html {
        font-size: 12px;
    }

    body {
        line-height: 1.4;
    }

    .topbar {
        height: 48px;
        padding: 0 10px;
        gap: 6px;
    }

    .topbar-left {
        gap: 8px;
    }

    .topbar-title {
        font-size: 14px;
        letter-spacing: -0.5px;
    }

    .topbar-right {
        gap: 2px;
    }

    .nav-toggle-btn,
    .icon-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .sidebar {
        width: var(--sidebar-width);
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
    }

    .nav-list {
        padding: 6px 4px;
    }

    .nav-link {
        padding: 6px 6px;
        gap: 6px;
        font-size: 12px;
    }

    .nav-icon {
        width: 16px;
        font-size: 14px;
    }

    .page-content-inner {
        padding: 12px 10px;
    }

    .card {
        padding: 12px;
        border-radius: 6px;
        margin-bottom: 12px;
    }

    .card-header {
        margin-bottom: 10px;
        padding-bottom: 8px;
    }

    .card-title {
        font-size: 12px;
        gap: 5px;
    }

    .card-title i {
        font-size: 12px;
    }

    .section-title {
        font-size: 10px;
        margin-top: 12px;
        margin-bottom: 6px;
    }

    .module-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .module-card {
        padding: 14px 10px;
        gap: 8px;
    }

    .module-card i {
        font-size: 20px;
    }

    .module-card span {
        font-size: 11px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 10px 8px;
    }

    .stat-number {
        font-size: 18px;
    }

    .stat-icon {
        font-size: 12px;
    }

    .stat-label {
        font-size: 10px;
    }

    .form-group {
        gap: 3px;
        margin-bottom: 10px;
    }

    .form-group label {
        font-size: 11px;
        font-weight: 600;
    }

    .form-control {
        padding: 7px 9px;
        font-size: 12px;
        border-radius: 5px;
    }

    textarea.form-control {
        min-height: 70px;
    }

    .input-icon-wrapper .form-control {
        padding-left: 30px;
    }

    .btn {
        padding: 7px 12px;
        font-size: 12px;
        border-radius: 5px;
        gap: 5px;
    }

    .meldungsart-btns {
        gap: 8px;
    }

    .meldungsart-btn {
        padding: 7px 10px;
        font-size: 11px;
        gap: 5px;
    }

    .meldungsart-content {
        padding: 12px;
        border-radius: 5px;
        margin-top: 2px;
    }

    .meldungsart-headline {
        font-size: 12px;
        margin-bottom: 10px;
        gap: 5px;
    }

    .fields-grid {
        gap: 10px;
    }

    .checkbox-section {
        gap: 10px;
    }

    .checkbox-item,
    .radio-item {
        gap: 5px;
        font-size: 12px;
    }

    .checkbox-item input[type="checkbox"],
    .radio-item input[type="radio"] {
        width: 14px;
        height: 14px;
    }

    .error-msg {
        font-size: 11px;
        gap: 4px;
    }

    .subcontainer {
        padding: 8px;
        margin-top: 6px;
    }

    .data-table {
        font-size: 11px;
    }

    .data-table th,
    .data-table td {
        padding: 6px 8px;
    }

    .badge {
        padding: 2px 6px;
        font-size: 10px;
    }

    .modal-box {
        width: 92vw;
        max-width: 320px;
        padding: 16px;
    }

    .modal-title {
        font-size: 14px;
    }

    .modal-header {
        margin-bottom: 16px;
    }

    .page-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .page-grid-item {
        padding: 10px 6px;
        font-size: 10px;
        gap: 5px;
    }

    .page-grid-item i {
        font-size: 16px;
    }

    .welcome-screen {
        gap: 8px;
        min-height: 200px;
    }

    .welcome-icon {
        font-size: 36px;
    }

    .welcome-screen h2 {
        font-size: 14px;
    }

    .welcome-screen p {
        font-size: 12px;
    }

    .placeholder-page {
        gap: 8px;
    }

    .placeholder-page i {
        font-size: 32px;
    }

    .placeholder-page h2 {
        font-size: 14px;
    }

    .form-actions {
        gap: 6px;
        margin-top: 12px;
        padding-top: 10px;
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    /* Split-Screen komplett deaktivieren */
    #split-toggle-btn {
        display: none !important;
    }

    #content-pane-right {
        display: none !important;
    }

    #split-divider {
        display: none !important;
    }

    .chat-inline-actions,
    .chat-inline-actions-tight {
        flex-direction: column;
    }

    .chat-inline-actions .btn,
    .chat-inline-actions-tight .btn {
        width: 100%;
    }

    .chat-conversation-head {
        align-items: flex-start;
    }

    .chat-messages {
        min-height: 220px;
        max-height: 45vh;
        gap: 8px;
    }

    .chat-message {
        padding: 8px 10px;
        border-radius: 10px;
    }

    .chat-message-meta {
        font-size: 11px;
        gap: 8px;
    }

    .chat-composer {
        grid-template-columns: auto 1fr auto;
        gap: 8px;
    }

    .chat-room-list {
        max-height: 200px;
    }
}

/* ---- Extra Large Devices (1200px+) ---- */
@media (min-width: 1200px) {
    :root {
        --sidebar-width: 260px;
    }

    .sidebar {
        width: 260px;
    }

    .page-content-inner {
        width: 100%;
        max-width: 1680px;
        margin: 0 auto;
    }

    .fields-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .module-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .page-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1680px) {
    .page-content-inner {
        max-width: 1820px;
        padding-left: 32px;
        padding-right: 32px;
    }
}

/* ============================================================
   Kontakte-Styles
   ============================================================ */
.kontakte-page {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.kontakte-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    min-height: 640px;
    gap: 16px;
}

.kontakte-sidebar {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 0;
    overflow: hidden;
}

.kontakte-tools {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-base) 100%);
}

.kontakte-search {
    position: relative;
}

.kontakte-search i {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 13px;
}

.kontakte-search input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text);
    padding: 10px 12px 10px 34px;
    font-size: 13px;
    transition: var(--transition);
}

.kontakte-search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.kontakte-filter-row {
    display: flex;
    gap: 8px;
}

.kontakte-chip {
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-weight: 500;
    border-radius: 999px;
    font-size: 13px;
    padding: 6px 10px;
    cursor: pointer;
    transition: var(--transition);
}

.kontakte-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.kontakte-chip.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

.kontakte-filter-row .form-control {
    height: 36px;
    padding: 6px 10px;
    font-size: 13px;
}

.kontakte-list {
    display: flex;
    flex-direction: column;
    overflow: auto;
}

.kontakte-list-empty {
    padding: 22px;
    text-align: center;
    color: var(--text-primary);
    font-weight: 400;
    font-size: 13px;
}

.kontakte-list-item {
    border: none;
    background: var(--bg-surface);
    color: var(--text);
    border-bottom: 1px solid var(--border);
    text-align: left;
    display: grid;
    grid-template-columns: 44px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: var(--transition);
}

.kontakte-list-item:hover {
    background: var(--accent-soft);
}

.kontakte-list-item.active {
    background: linear-gradient(90deg, var(--accent-soft) 0%, transparent 100%);
    box-shadow: inset 3px 0 0 var(--accent);
}

.kontakte-list-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--accent);
    position: relative;
    font-size: 15px;
}

.kontakte-status-dot {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
    background: var(--text-muted);
}

.kontakte-status-dot[data-status="online"] {
    background: var(--success);
}

.kontakte-status-dot[data-status="busy"] {
    background: var(--warning);
}

.kontakte-status-dot[data-status="offline"] {
    background: var(--text-muted);
}

.kontakte-list-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kontakte-list-main strong {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kontakte-list-main small {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kontakte-list-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 400;
}

.kontakte-type-badge {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 10px;
    color: var(--text-primary);
    font-weight: 500;
    background: var(--bg-base);
}

.kontakte-main {
    background: var(--bg-surface);
    padding: 18px;
    overflow: auto;
}

.kontakte-empty {
    min-height: 320px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 400;
    padding: 24px;
}

.kontakte-empty i {
    font-size: 44px;
    color: var(--accent);
    opacity: 0.5;
}

.kontakte-empty h3 {
    margin: 0;
    color: var(--text);
}

.kontakte-empty p {
    margin: 0;
    max-width: 540px;
}

.kontakte-detail {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.kontakte-detail-head {
    display: flex;
    align-items: center;
    gap: 14px;
}

.kontakte-avatar {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
}

.kontakte-meta h2 {
    margin: 0;
    font-size: 18px;
}

.kontakte-meta p {
    margin: 4px 0 0;
    color: var(--text-primary);
    font-weight: 400;
    font-size: 13px;
}

.kontakte-badge {
    margin-top: 7px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 9px;
    font-size: 13px;
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-weight: 500;
    background: var(--bg-base);
}

.kontakte-badge[data-status="online"] {
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.35);
    background: var(--success-soft);
}

.kontakte-badge[data-status="busy"] {
    color: #a16207;
    border-color: rgba(245, 158, 11, 0.45);
    background: var(--warning-soft);
}

.kontakte-badge[data-status="offline"] {
    color: var(--text-primary);
    font-weight: 400;
}

.kontakte-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.kontakte-info-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    background: var(--bg-base);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kontakte-info-label {
    font-size: 13px;
    text-transform: uppercase;
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.kontakte-info-value {
    font-size: 13px;
    color: var(--text);
    word-break: break-word;
}

.kontakte-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.kontakte-actions .btn {
    min-width: 160px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.kontakte-log-wrap {
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.kontakte-log-wrap h4 {
    margin: 0 0 8px;
    font-size: 13px;
}

.kontakte-log {
    margin: 0;
    padding-left: 16px;
    color: var(--text-primary);
    font-weight: 400;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}

@media (max-width: 1080px) {
    .kontakte-layout {
        grid-template-columns: 1fr;
    }

    .kontakte-sidebar {
        max-height: 380px;
    }
}

@media (max-width: 720px) {
    .kontakte-main {
        padding: 12px;
    }

    .kontakte-actions .btn {
        min-width: 0;
        width: 100%;
    }

    .kontakte-grid {
        grid-template-columns: 1fr;
    }

    .kontakte-filter-row {
        flex-wrap: wrap;
    }
}

/* ============================================================
   Wachbuch-Styles
   ============================================================ */
.wb-page {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ---- Toolbar ---- */
.wb-toolbar {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    flex-wrap: wrap;
}

.wb-toolbar-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.wb-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

.wb-toolbar-right .btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.wb-search {
    position: relative;
    max-width: 320px;
}

.wb-search i {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 13px;
}

.wb-search input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-base);
    color: var(--text);
    padding: 9px 12px 9px 34px;
    font-size: 13px;
    transition: var(--transition);
}

.wb-search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.wb-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.wb-chip {
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-weight: 500;
    border-radius: 999px;
    font-size: 13px;
    padding: 5px 11px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    opacity: 0.6;
}

.wb-chip:hover {
    opacity: 1;
}

/* Alle-Chip: bleibt beim Accent-Stil */
.wb-chip[data-wb-kat="all"] {
    opacity: 1;
    color: var(--text-primary);
    font-weight: 500;
}

.wb-chip[data-wb-kat="all"].active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 500;
}

/* Kategorie-Chips: Farbe via wb-kat-* Klassen, aktiv = volle Badge-Farbe */
.wb-chip.wb-kat-dienst.active {
    border-color: rgba(59, 130, 246, .45);
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 500;
    opacity: 1;
}

.wb-chip.wb-kat-einsatz.active {
    border-color: rgba(239, 68, 68, .45);
    background: var(--danger-soft);
    color: var(--danger);
    font-weight: 500;
    opacity: 1;
}

.wb-chip.wb-kat-meldung.active {
    border-color: rgba(124, 58, 237, .45);
    background: rgba(124, 58, 237, .1);
    color: #7c3aed;
    font-weight: 500;
    opacity: 1;
}

.wb-chip.wb-kat-technik.active {
    border-color: rgba(8, 145, 178, .45);
    background: rgba(8, 145, 178, .1);
    color: #0891b2;
    font-weight: 500;
    opacity: 1;
}

.wb-chip.wb-kat-uebergabe.active {
    border-color: rgba(245, 158, 11, .45);
    background: var(--warning-soft);
    color: #a16207;
    font-weight: 500;
    opacity: 1;
}

/* Hover-Vorschau der Kategorie-Farbe auch ohne active */
.wb-chip.wb-kat-dienst:hover {
    border-color: rgba(59, 130, 246, .35);
    color: var(--accent);
}

.wb-chip.wb-kat-einsatz:hover {
    border-color: rgba(239, 68, 68, .35);
    color: var(--danger);
}

.wb-chip.wb-kat-meldung:hover {
    border-color: rgba(124, 58, 237, .35);
    color: #7c3aed;
}

.wb-chip.wb-kat-technik:hover {
    border-color: rgba(8, 145, 178, .35);
    color: #0891b2;
}

.wb-chip.wb-kat-uebergabe:hover {
    border-color: rgba(245, 158, 11, .35);
    color: #a16207;
}

.wb-select {
    height: 36px;
    padding: 5px 10px;
    font-size: 13px;
}

/* ---- Tabelle ---- */
.wb-table-wrap {
    padding: 0;
    overflow-x: auto;
}

.wb-table {
    width: 100%;
    border-collapse: collapse;
}

.wb-table thead th {
    text-align: left;
    padding: 10px 12px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    background: var(--bg-base);
    white-space: nowrap;
}

.wb-row {
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border);
}

.wb-row:last-child {
    border-bottom: none;
}

.wb-row:hover {
    background: var(--accent-soft);
}

.wb-table td {
    padding: 10px 12px;
    font-size: 13px;
    vertical-align: top;
}

.wb-col-idx {
    color: var(--text-primary);
    font-weight: 400;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.wb-col-zeit {
    white-space: nowrap;
}

.wb-col-zeit strong {
    display: block;
    font-variant-numeric: tabular-nums;
}

.wb-col-zeit small {
    color: var(--text-primary);
    font-weight: 400;
    font-size: 13px;
}

.wb-col-betreff {
    font-weight: 500;
}

.wb-inhalt-preview {
    color: var(--text-primary);
    font-weight: 400;
    font-size: 13px;
}

.wb-col-autor {
    color: var(--text-primary);
    font-weight: 400;
    font-size: 13px;
    white-space: nowrap;
}

/* ---- Kategorie-Badges ---- */
.wb-kat-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid transparent;
}

.wb-kat-dienst {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: rgba(59, 130, 246, .25);
}

.wb-kat-einsatz {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: rgba(239, 68, 68, .25);
}

.wb-kat-meldung {
    color: #7c3aed;
    background: rgba(124, 58, 237, .1);
    border-color: rgba(124, 58, 237, .25);
}

.wb-kat-technik {
    color: #0891b2;
    background: rgba(8, 145, 178, .1);
    border-color: rgba(8, 145, 178, .25);
}

.wb-kat-uebergabe {
    color: #a16207;
    background: var(--warning-soft);
    border-color: rgba(245, 158, 11, .25);
}

/* ---- Empty State ---- */
.wb-empty {
    padding: 40px;
    text-align: center;
    color: var(--text-primary);
    font-weight: 400;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.wb-empty i {
    font-size: 40px;
    color: var(--accent);
    opacity: 0.4;
}

/* ---- Detail Modal ---- */
.modal-lg {
    max-width: 640px;
}

.wb-detail-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.wb-detail-time,
.wb-detail-autor {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 400;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.wb-detail-betreff {
    margin: 0 0 12px;
    font-size: 17px;
    color: var(--text);
}

.wb-detail-inhalt {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin: 0;
}

/* ---- Kategorie-Picker (Formular) ---- */
.wb-kat-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wb-kat-pick-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    opacity: 0.45;
}

.wb-kat-pick-btn:hover {
    opacity: 0.8;
}

.wb-kat-pick-btn.active {
    opacity: 1;
    box-shadow: var(--shadow-sm);
}

/* Farben aus den bestehenden Badge-Klassen übernehmen */
.wb-kat-pick-btn.wb-kat-dienst {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: rgba(59, 130, 246, .35);
}

.wb-kat-pick-btn.wb-kat-einsatz {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: rgba(239, 68, 68, .35);
}

.wb-kat-pick-btn.wb-kat-meldung {
    color: #7c3aed;
    background: rgba(124, 58, 237, .1);
    border-color: rgba(124, 58, 237, .35);
}

.wb-kat-pick-btn.wb-kat-technik {
    color: #0891b2;
    background: rgba(8, 145, 178, .1);
    border-color: rgba(8, 145, 178, .35);
}

.wb-kat-pick-btn.wb-kat-uebergabe {
    color: #a16207;
    background: var(--warning-soft);
    border-color: rgba(245, 158, 11, .35);
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .wb-col-inhalt {
        display: none;
    }
}

@media (max-width: 640px) {
    .wb-toolbar {
        flex-direction: column;
    }

    .wb-toolbar-right {
        width: 100%;
        justify-content: flex-end;
    }

    .wb-col-autor {
        display: none;
    }
}

/* ============================================================
   Notfallmeldung – Component Classes
   ============================================================ */

.nm-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 28px;
    margin-bottom: 12px;
}

.nm-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.nm-offene-section,
.nm-30tage-section,
.nm-monat-section,
.nm-gestern-section {
    display: none;
}

.nm-offene-section.visible,
.nm-30tage-section.visible,
.nm-monat-section.visible,
.nm-gestern-section.visible {
    display: block;
}

.nm-empty-message {
    color: var(--text-primary);
    font-weight: 400;
    text-align: center;
    padding: 20px;
}

.nm-stats-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
}

.nm-chart-container {
    padding: 20px;
}

.ac-room-success {
    display: none;
    margin-bottom: 14px;
    padding: 10px 14px;
    background: var(--success-soft);
    border: 1px solid var(--success);
    border-radius: var(--radius-sm);
    color: var(--success);
    font-size: 13px;
}

.ac-room-success.show {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* .ac-btn-refresh {
    min-width: 34px;
    padding: 7px 10px;
} */

.ac-form-submit {
    width: 100%;
}

.ac-members-card {
    display: none;
    margin-top: 14px;
}

.ac-members-card.visible {
    display: block;
}

.ac-cancel-btn {
    display: none;
}

.ac-cancel-btn.visible {
    display: inline-flex;
}

.ac-invite-container {
    display: flex;
    gap: 8px;
}

.ac-invite-picker-wrapper {
    flex: 1;
}

.ac-public-hint {
    display: none;
}

.ac-public-hint.visible {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    margin-bottom: 2px;
    padding: 8px 10px;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: var(--text-primary);
    font-weight: 400;
    font-size: 13px;
    line-height: 1.5;
}

.ac-members-list {
    margin-top: 8px;
}

.user-management-card {
    max-width: 560px;
}

.user-management-text {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 400;
    line-height: 1.6;
}

/* ============================================================
   Admin Tab Navigation (Admin Chat, Admin Users, Admin NC)
   ============================================================ */

.admin-chat-tabs {
    margin-bottom: 20px;
}

.tab-buttons {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}

.tab-btn {
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: -2px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tab-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

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

.tab-btn i {
    font-size: 14px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.2s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Admin NC Page */
.admin-nc-page {
    padding: 0;
}

/* AU Layout (Admin Users / Nextcloud) */
.au-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 16px;
    margin-top: 0;
}

/* .au-col-list {
    min-height: 500px;
}

.au-col-form {
    min-height: 500px;
} */

.au-item-list {
    max-height: 600px;
    overflow-y: auto;
    padding: 8px;
}

.au-item {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 6px;
    border: 1px solid transparent;
}

.au-item:hover {
    background: var(--bg-hover);
    border-color: var(--border);
}

.au-item.active {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.au-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.au-item-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.au-item-meta {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 400;
    margin-top: 2px;
}

.nc-rule-item,
.nc-mapping-item {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px;
    background: var(--bg-surface-2);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

/* ── Anruf-Overlay ───────────────────────────────────────────────────────── */

.erna-call-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.erna-call-overlay.hidden {
    display: none;
}

/* Globales Vollbild-Video-Overlay */
.erna-global-video-overlay {
    position: fixed;
    inset: 0;
    z-index: 2900;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.erna-global-video-overlay.hidden {
    display: none;
}

.erna-global-video-header {
    display: flex;
    align-items: center;
    gap: 18px;
    color: #fff;
    font-size: 1rem;
}

.erna-global-video-caller {
    font-weight: 600;
    font-size: 1.1rem;
}

.erna-global-video-status {
    opacity: 0.7;
    font-size: 0.85rem;
}

.erna-global-video-timer {
    font-variant-numeric: tabular-nums;
    opacity: 0.85;
}

.erna-global-video-area {
    position: relative;
    width: min(700px, 94vw);
    aspect-ratio: 16/9;
    background: #111;
    border-radius: var(--radius);
    overflow: hidden;
}

.erna-global-video-area .erna-call-video-remote {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.erna-global-video-area .erna-call-video-local {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 130px;
    height: 98px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    object-fit: cover;
    background: #111;
}

.erna-global-video-actions {
    display: flex;
    gap: 16px;
}

/* Geräte-Einstellungen Popover */
.erna-call-device-panel {
    position: fixed;
    z-index: 9500;
    background: #1a1d24;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 12px;
    padding: 14px 16px 16px;
    min-width: 240px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.erna-call-device-panel.hidden {
    display: none;
}

.erna-call-device-header {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
}

.erna-call-device-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.55);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.erna-call-device-select {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 7px;
    color: #fff;
    font-size: 12px;
    padding: 6px 8px;
    width: 100%;
    cursor: pointer;
    appearance: auto;
}

.erna-call-device-select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.32);
    background: rgba(255, 255, 255, 0.11);
}

.erna-call-device-select option {
    background: #1a1d24;
    color: #fff;
}


.erna-global-call-notify {
    position: fixed;
    top: 60px;
    right: 20px;
    z-index: 3000;
    animation: erna-call-slide-in .3s ease;
}

.erna-global-call-notify.hidden {
    display: none;
}

.erna-global-call-notify-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    padding: 14px 20px;
}

.erna-global-call-icon {
    font-size: 22px;
    color: var(--color-success);
    animation: erna-call-pulse 1s infinite;
}

.erna-global-call-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.erna-global-call-name {
    font-weight: 600;
    font-size: 14px;
}

.erna-global-call-type {
    font-size: 12px;
    color: var(--text-muted);
}

.erna-global-call-actions {
    display: flex;
    gap: 8px;
    margin-left: 8px;
}

@keyframes erna-call-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes erna-call-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* Globales aktives Anruf-Overlay (Mini-Bar oben rechts) */
.erna-global-call-active {
    position: fixed;
    top: 60px;
    right: 20px;
    z-index: 3000;
    animation: erna-call-slide-in .3s ease;
}

.erna-global-call-active.hidden {
    display: none;
}

.erna-global-call-active-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-surface);
    border: 2px solid var(--color-success);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    padding: 10px 16px;
}

.erna-global-call-active-pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-success);
    animation: erna-call-pulse 1.5s infinite;
}

.erna-global-call-active-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-success);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.erna-global-call-active-name {
    font-size: 13px;
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.erna-global-call-active-timer {
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    min-width: 40px;
}

.erna-call-ringing,
.erna-call-active {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
    padding: 32px 28px;
    min-width: 300px;
    max-width: 480px;
    width: 92vw;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.erna-call-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #fff;
}

.erna-call-info {
    text-align: center;
}

.erna-call-caller-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.erna-call-type {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.erna-call-status {
    font-size: 14px;
    color: var(--text-secondary);
}

.erna-call-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.erna-call-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s;
}

.erna-call-btn:hover {
    opacity: 0.85;
}

.erna-call-btn-accept {
    background: #22c55e;
    color: #fff;
}

.erna-call-btn-reject {
    background: #ef4444;
    color: #fff;
}

/* Video-Bereich */
.erna-call-video-area {
    position: relative;
    width: 100%;
    max-width: 640px;
    background: #000;
    border-radius: calc(var(--radius) - 2px);
    overflow: hidden;
    aspect-ratio: 16/9;
    flex-direction: row;
}

.erna-call-video-remote {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.erna-call-video-local {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 120px;
    height: 90px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    object-fit: cover;
    background: #111;
}

.erna-call-video-cam-off {
    background: #111;
}

.erna-call-btn-secondary {
    background: var(--bg-surface-2, rgba(0, 0, 0, 0.08));
    color: var(--text);
    border: 1px solid var(--border);
}

.erna-call-btn-secondary:hover {
    background: var(--bg-surface-3, rgba(0, 0, 0, 0.14));
}

/* Im Video-Overlay (dunkler Hintergrund) anders darstellen */
.erna-global-video-overlay .erna-call-btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
}

.erna-global-video-overlay .erna-call-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.25);
}

.erna-call-btn-active {
    background: rgba(239, 68, 68, 0.75) !important;
    color: #fff;
}