/**
 * SanLog v3.14.1 - Redesign CSS
 * 
 * Vertikale Sidebar-Navigation, neuer Header, Stats-Zeile
 * System-Fonts (Google Fonts nicht erlaubt durch CSP)
 * 
 * v3.14.1: Admin-Bereich breiter, weniger Umbrüche
 */

/* ==============================================
   CSS VARIABLEN (ergänzend zu styles.css)
   ============================================== */
:root {
    /* DRK Rot */
    --drk-red: #E60005;
    --drk-red-light: rgba(230, 0, 5, 0.08);
    --drk-red-hover: #cc0004;
    
    /* Layout Sizes */
    --sidebar-width: 56px;
    --header-height: 48px;
    
    /* Redesign Borders */
    --border-redesign: #e2e4e8;
    --border-subtle: #eef0f2;
    
    /* Redesign Backgrounds */
    --bg-base-redesign: #f5f6f8;
    --bg-surface-redesign: #ffffff;
    --bg-elevated: #f8f9fa;
    --bg-hover-redesign: #f0f1f3;
    
    /* Redesign Text */
    --text-primary-redesign: #1a1a2e;
    --text-secondary-redesign: #5a5a72;
    --text-muted-redesign: #9898a8;
    
    /* Radius - kompakt */
    --radius-sm: 4px;
    --radius-redesign: 6px;
    --radius-lg: 8px;
}

[data-theme="dark"] {
    --bg-base-redesign: #1a1a2e;
    --bg-surface-redesign: #252538;
    --bg-elevated: #2a2a3e;
    --bg-hover-redesign: #303045;
    --border-redesign: #3a3a4e;
    --border-subtle: #2f2f42;
    --text-primary-redesign: #e8e8ec;
    --text-secondary-redesign: #a8a8b8;
    --text-muted-redesign: #6a6a7a;
}

/* ==============================================
   APP GRID LAYOUT
   ============================================== */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    height: 100vh;
    overflow: hidden;
}

/* ==============================================
   VERTIKALE SIDEBAR
   ============================================== */
.app-sidebar {
    grid-row: 1 / -1;
    background: var(--bg-surface-redesign);
    border-right: 1px solid var(--border-redesign);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 4px;
    z-index: 100;
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: var(--drk-red);
    border-radius: var(--radius-redesign);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-bottom: 16px;
    font-weight: 700;
    font-size: 12px;
}

.sidebar-logo svg {
    width: 20px;
    height: 20px;
    stroke: white;
    fill: none;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.sidebar-nav-item {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-redesign);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted-redesign);
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    border: none;
    background: transparent;
}

.sidebar-nav-item:hover {
    background: var(--bg-hover-redesign);
    color: var(--text-secondary-redesign);
}

.sidebar-nav-item.active {
    background: var(--drk-red);
    color: white;
}

.sidebar-nav-item svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
}

/* Für gefüllte Icons (Dashboard Quadrate) */
.sidebar-nav-item svg rect,
.sidebar-nav-item svg circle {
    fill: none;
    stroke: currentColor;
}

.sidebar-nav-item .nav-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--danger, #f44336);
    border-radius: 50%;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.sidebar-spacer {
    flex: 1;
}

.sidebar-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

/* Tooltip für Sidebar-Items */
.sidebar-nav-item[title]:hover::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--text-primary-redesign);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 1000;
}

/* ==============================================
   HEADER (NEU)
   ============================================== */
.app-header {
    background: var(--bg-surface-redesign);
    border-bottom: 1px solid var(--border-redesign);
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 90;
}

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

.header-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary-redesign);
    margin: 0;
}

.lage-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-redesign);
    border-radius: var(--radius-redesign);
    font-size: 12px;
    color: var(--text-secondary-redesign);
}

.lage-dot {
    width: 6px;
    height: 6px;
    background: var(--success, #00c853);
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-redesign);
    background: transparent;
    border: 1px solid var(--border-redesign);
    color: var(--text-muted-redesign);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.header-btn:hover {
    background: var(--bg-hover-redesign);
    color: var(--text-secondary-redesign);
}

.header-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 4px;
    border-radius: var(--radius-redesign);
    cursor: pointer;
}

.user-badge:hover {
    background: var(--bg-hover-redesign);
}

.user-avatar {
    width: 28px;
    height: 28px;
    background: var(--drk-red);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    font-weight: 600;
}

.user-name {
    font-size: 12px;
    color: var(--text-secondary-redesign);
    font-weight: 500;
}

/* ==============================================
   MAIN CONTENT AREA
   ============================================== */
.app-main {
    background: var(--bg-base-redesign);
    overflow: auto;
    padding: 12px;
}

/* Override main-content styles when in app-layout */
.app-layout .main-content {
    margin: 0;
    padding: 8px;
    max-width: none;
    width: auto;
}

/* v3.14.1: Admin-Bereich volle Breite */
.app-layout .settings-content,
.app-layout #usersSubTab,
.app-layout #users-tab {
    max-width: none;
    width: 100%;
}

/* User-Tabelle breiter - weniger Umbrüche */
.user-table-container {
    width: 100%;
    max-width: none;
}

/* ==============================================
   STATS ROW (Meldungen-Tab)
   ============================================== */
.stats-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.stat-box {
    background: var(--bg-surface-redesign);
    border: 1px solid var(--border-redesign);
    border-radius: var(--radius-redesign);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 130px;
    flex: 1;
    max-width: 180px;
}

.stat-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.stat-icon.red { background: var(--drk-red-light); color: var(--drk-red); }
.stat-icon.green { background: rgba(0, 200, 83, 0.1); color: var(--success, #00c853); }
.stat-icon.yellow { background: rgba(255, 152, 0, 0.1); color: var(--warning, #ff9800); }
.stat-icon.blue { background: rgba(33, 150, 243, 0.1); color: var(--info, #2196f3); }

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    color: var(--text-primary-redesign);
}

.stat-label {
    font-size: 10px;
    color: var(--text-muted-redesign);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ==============================================
   MELDUNGEN 2-SPALTEN LAYOUT
   ============================================== */
.meldungen-layout-two-col {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 12px;
    height: 100%;
}

.meldungen-col-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.meldungen-col-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Sidebar Widgets */
.sidebar-widget {
    background: var(--bg-surface-redesign);
    border: 1px solid var(--border-redesign);
    border-radius: var(--radius-redesign);
    overflow: hidden;
}

.sidebar-widget-header {
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted-redesign);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-widget-body {
    padding: 8px;
    max-height: 300px;
    overflow-y: auto;
}

/* Quick Action Buttons */
.sidebar-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    background: transparent;
    border: 1px solid var(--border-redesign);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary-redesign);
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
    margin-bottom: 6px;
}

.sidebar-action-btn:last-child {
    margin-bottom: 0;
}

.sidebar-action-btn:hover {
    background: var(--bg-hover-redesign);
    border-color: var(--drk-red);
    color: var(--text-primary-redesign);
}

.sidebar-action-icon {
    width: 28px;
    height: 28px;
    background: var(--drk-red);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.sidebar-action-icon svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* Sidebar Patient Items */
.sidebar-patient-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 4px;
}

.sidebar-patient-item:hover {
    background: var(--bg-hover-redesign);
}

.sidebar-patient-item:last-child {
    margin-bottom: 0;
}

.sidebar-patient-sk {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.sidebar-patient-sk.sk1 { background: #E60005; }
.sidebar-patient-sk.sk2 { background: #ff9800; }
.sidebar-patient-sk.sk3 { background: #4caf50; }
.sidebar-patient-sk.sk4 { background: #2196f3; }
.sidebar-patient-sk.sk5 { background: #9c27b0; }
.sidebar-patient-sk.b { background: #607d8b; }

.sidebar-patient-info {
    flex: 1;
    min-width: 0;
}

.sidebar-patient-id {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary-redesign);
}

.sidebar-patient-diag {
    font-size: 11px;
    color: var(--text-muted-redesign);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-patient-loc {
    font-size: 10px;
    color: var(--text-muted-redesign);
    background: var(--bg-elevated);
    padding: 2px 6px;
    border-radius: 10px;
}

.sidebar-empty-state {
    text-align: center;
    padding: 20px 10px;
    color: var(--text-muted-redesign);
    font-size: 12px;
}

/* ==============================================
   RESSOURCEN ICONS (QR + Bearbeiten)
   ============================================== */
.resource-card-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.resource-action-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-redesign);
    border-radius: var(--radius-sm);
    background: var(--bg-surface-redesign);
    color: var(--text-muted-redesign);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.resource-action-btn:hover {
    background: var(--bg-hover-redesign);
    color: var(--text-primary-redesign);
    border-color: var(--drk-red);
}

.resource-action-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* ==============================================
   MELDUNGEN KOMPAKTERE SCHRIFT
   ============================================== */
.log-entry {
    font-size: 12px;
}

.log-entry .log-meta {
    font-size: 11px;
}

.log-entry .log-time {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 11px;
}

/* ==============================================
   RESPONSIVE
   ============================================== */
@media (max-width: 1100px) {
    .meldungen-layout-two-col {
        grid-template-columns: 1fr;
    }
    
    .meldungen-col-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .app-layout {
        grid-template-columns: 1fr;
    }
    
    .app-sidebar {
        position: fixed;
        left: -56px;
        top: 0;
        height: 100vh;
        transition: left 0.3s;
    }
    
    .app-sidebar.open {
        left: 0;
    }
    
    .stats-row {
        flex-wrap: wrap;
    }
    
    .stat-box {
        min-width: calc(50% - 4px);
        max-width: none;
    }
}

/* ==============================================
   VERSTECKE ALTE NAVIGATION WENN REDESIGN AKTIV
   ============================================== */
.app-layout .header-bar,
.app-layout .tab-navigation {
    display: none !important;
}

/* ==============================================
   DARK MODE ANPASSUNGEN
   ============================================== */
[data-theme="dark"] .stat-box {
    background: var(--bg-surface-redesign);
    border-color: var(--border-redesign);
}

[data-theme="dark"] .sidebar-widget {
    background: var(--bg-surface-redesign);
    border-color: var(--border-redesign);
}

[data-theme="dark"] .sidebar-action-btn {
    border-color: var(--border-redesign);
}

[data-theme="dark"] .resource-action-btn {
    background: var(--bg-surface-redesign);
    border-color: var(--border-redesign);
}

/* ==============================================
   USER-ADMINISTRATION TABELLE - D5 Design (v3.14)
   ============================================== */

/* Container */
.user-table-container {
    border: 1px solid var(--border-redesign);
    border-radius: var(--radius-lg);
    background: var(--bg-surface-redesign);
    overflow: hidden;
}

/* Tabelle */
.user-access-table.d5 {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

/* Header */
.user-access-table.d5 thead th {
    background: var(--bg-elevated);
    border-bottom: 2px solid var(--border-redesign);
    padding: 10px 12px;
    font-weight: 600;
    text-align: left;
    font-size: 12px;
    color: var(--text-secondary-redesign);
}

/* Zeilen */
.user-access-table.d5 tbody tr {
    border-bottom: 1px solid var(--border-subtle);
}

.user-access-table.d5 tbody tr:hover {
    background: var(--bg-hover-redesign);
}

.user-access-table.d5 tbody td {
    padding: 12px;
    vertical-align: top;
}

/* Benutzer-Spalte */
.user-access-table.d5 .col-user {
    width: 120px;
    min-width: 120px;
}

.user-access-table.d5 .user-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary-redesign);
    margin-bottom: 2px;
}

.user-access-table.d5 .user-meta {
    font-size: 10px;
    color: var(--text-muted-redesign);
}

/* Berechtigungen-Spalte - nimmt den Rest */
.user-access-table.d5 .col-permissions {
    width: 100%;
}

.user-access-table.d5 .permissions-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    flex-wrap: nowrap;  /* v3.14.1: Weniger Umbrüche */
}

.user-access-table.d5 .permissions-group {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    flex-wrap: wrap;
    flex-shrink: 1;
    min-width: 0;
}

.user-access-table.d5 .permissions-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.user-access-table.d5 .permissions-label {
    font-size: 9px;
    color: var(--text-muted-redesign);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding-top: 5px;
    flex-shrink: 0;
    white-space: nowrap;
}

.user-access-table.d5 .permissions-divider {
    width: 1px;
    min-height: 28px;
    background: var(--border-redesign);
    margin: 0 4px;
    align-self: stretch;
    flex-shrink: 0;
}

.user-access-table.d5 .permissions-note {
    font-size: 11px;
    color: var(--text-muted-redesign);
    margin-left: 6px;
}

/* Tags */
.user-access-table.d5 .tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 11px;
    transition: all 0.15s;
    white-space: nowrap;
}

.user-access-table.d5 .tag-rolle {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: #2e7d32;
}

.user-access-table.d5 .tag-ds {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    color: #555;
}

.user-access-table.d5 .tag-ds-admin {
    background: #fff3e0;
    border: 1px solid #ffcc80;
    color: #e65100;
}

/* Klickbare Tags */
.user-access-table.d5 .tag-ds.clickable,
.user-access-table.d5 .tag-ds-admin.clickable {
    cursor: pointer;
}

.user-access-table.d5 .tag-ds.clickable:hover {
    background: #eeeeee;
    border-color: #bdbdbd;
}

.user-access-table.d5 .tag-ds-admin.clickable:hover {
    background: #ffe0b2;
    border-color: #ffb74d;
}

.user-access-table.d5 .org-admin-tag {
    background: var(--drk-red);
    color: white;
    font-weight: 600;
    font-size: 11px;
    padding: 4px 8px;
}

.user-access-table.d5 .tag-remove {
    margin-left: 4px;
    cursor: pointer;
    opacity: 0.7;
    font-weight: bold;
    font-size: 12px;
}

.user-access-table.d5 .tag-remove:hover {
    opacity: 1;
}

.user-access-table.d5 .tag-rolle .tag-remove:hover {
    color: #1b5e20;
}

.user-access-table.d5 .tag-ds .tag-remove:hover {
    color: var(--drk-red);
}

.user-access-table.d5 .tag-ds-admin .tag-remove:hover {
    color: #bf360c;
}

/* + Button */
.user-access-table.d5 .btn-add {
    padding: 3px 8px;
    border: 1px dashed #ccc;
    border-radius: 4px;
    font-size: 12px;
    color: #888;
    cursor: pointer;
    background: none;
    transition: all 0.15s;
}

.user-access-table.d5 .btn-add:hover {
    border-color: var(--drk-red);
    color: var(--drk-red);
}

/* Dropdown */
.user-access-table.d5 .dropdown-container {
    position: relative;
    display: inline-block;
}

.user-access-table.d5 .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    min-width: 160px;
    background: var(--bg-surface-redesign);
    border: 1px solid var(--border-redesign);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-top: 4px;
}

.user-access-table.d5 .dropdown-menu.show {
    display: block;
}

.user-access-table.d5 .dropdown-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary-redesign);
    transition: background 0.15s;
}

.user-access-table.d5 .dropdown-item:hover {
    background: var(--bg-hover-redesign);
}

.user-access-table.d5 .dropdown-item:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.user-access-table.d5 .dropdown-item:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* Aktionen-Spalte */
.user-access-table.d5 .col-actions {
    width: 80px;
    min-width: 80px;
    text-align: right;
}

.user-access-table.d5 .action-buttons {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

.user-access-table.d5 .btn-action {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-redesign);
    background: var(--bg-surface-redesign);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    color: var(--text-secondary-redesign);
}

.user-access-table.d5 .btn-action:hover {
    background: var(--bg-hover-redesign);
    border-color: var(--text-secondary-redesign);
}

.user-access-table.d5 .btn-action-danger {
    color: var(--drk-red);
    border-color: #fcc;
}

.user-access-table.d5 .btn-action-danger:hover {
    background: #fff5f5;
    border-color: var(--drk-red);
}

.user-access-table.d5 .btn-action-promote {
    color: #ff9800;
    border-color: #ffe0b2;
}

.user-access-table.d5 .btn-action-promote:hover {
    background: #fff8e1;
    border-color: #ff9800;
}

/* Org-Admin Zeile */
.user-access-table.d5 .org-admin-row {
    background: #fef7f7;
}

.user-access-table.d5 .org-admin-row:hover {
    background: #fef0f0;
}

/* Dark Mode */
[data-theme="dark"] .user-table-container {
    background: var(--bg-surface-redesign);
    border-color: var(--border-redesign);
}

[data-theme="dark"] .user-access-table.d5 thead th {
    background: var(--bg-elevated);
    border-color: var(--border-redesign);
}

[data-theme="dark"] .user-access-table.d5 .tag-rolle {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.4);
    color: #81c784;
}

[data-theme="dark"] .user-access-table.d5 .tag-ds {
    background: #3a3a4e;
    border-color: #4a4a5e;
    color: #ccc;
}

[data-theme="dark"] .user-access-table.d5 .tag-ds-admin {
    background: rgba(255, 152, 0, 0.2);
    border-color: rgba(255, 152, 0, 0.4);
    color: #ffb74d;
}

[data-theme="dark"] .user-access-table.d5 .tag-ds.clickable:hover {
    background: #4a4a5e;
    border-color: #666;
}

[data-theme="dark"] .user-access-table.d5 .tag-ds-admin.clickable:hover {
    background: rgba(255, 152, 0, 0.3);
    border-color: rgba(255, 152, 0, 0.5);
}

[data-theme="dark"] .user-access-table.d5 .btn-add {
    border-color: #4a4a5e;
    color: #888;
}

[data-theme="dark"] .user-access-table.d5 .btn-add:hover {
    border-color: var(--drk-red);
    color: var(--drk-red);
}

[data-theme="dark"] .user-access-table.d5 .dropdown-menu {
    background: var(--bg-elevated);
    border-color: var(--border-redesign);
}

[data-theme="dark"] .user-access-table.d5 .btn-action {
    background: var(--bg-surface-redesign);
    border-color: var(--border-redesign);
}

[data-theme="dark"] .user-access-table.d5 .org-admin-row {
    background: rgba(230, 0, 5, 0.05);
}

[data-theme="dark"] .user-access-table.d5 .org-admin-row:hover {
    background: rgba(230, 0, 5, 0.1);
}

/* ==============================================
   v3.14.1: MELDUNGEN VERBESSERUNGEN
   ============================================== */

/* Reset-Button größer */
.btn-reset-compact {
    width: 32px !important;
    height: 32px !important;
    font-size: 18px !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Meldungen Einträge - v3.14.1: NUR Haupttext (.log-text) kleiner */
.log-entry .log-text {
    font-size: 13px !important;
    line-height: 1.4;
}

/* ==============================================
   v3.14.1: ANALOGE UHR WIDGET
   ============================================== */

.sidebar-clock-widget {
    padding: 12px !important;
    display: flex;
    align-items: center;
    gap: 12px;
}

.analog-clock {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.clock-face {
    width: 100%;
    height: 100%;
    border: 2px solid var(--border-redesign);
    border-radius: 50%;
    position: relative;
    background: var(--bg-surface-redesign);
}

.clock-hand {
    position: absolute;
    bottom: 50%;
    left: 50%;
    transform-origin: bottom center;
    background: var(--text-primary-redesign);
    border-radius: 2px;
}

.hour-hand {
    width: 3px;
    height: 18px;
    margin-left: -1.5px;
}

.minute-hand {
    width: 2px;
    height: 24px;
    margin-left: -1px;
}

.second-hand {
    width: 1px;
    height: 26px;
    margin-left: -0.5px;
    background: var(--drk-red);
}

.clock-center {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: var(--drk-red);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.clock-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.digital-time {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary-redesign);
}

.digital-date {
    font-size: 11px;
    color: var(--text-muted-redesign);
}

/* ==============================================
   v3.14.1: ONLINE USER WIDGET
   ============================================== */

.online-user-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
}

.online-user-item:last-child {
    margin-bottom: 0;
}

.online-user-dot {
    width: 8px;
    height: 8px;
    background: var(--success, #00c853);
    border-radius: 50%;
    flex-shrink: 0;
}

.online-user-name {
    font-size: 12px;
    color: var(--text-primary-redesign);
    flex: 1;
}

.online-user-function {
    font-size: 10px;
    color: var(--text-muted-redesign);
    background: var(--bg-elevated);
    padding: 2px 6px;
    border-radius: 10px;
}

/* ==============================================
   v3.14.1: PATIENTEN KLICKBAR
   ============================================== */

.sidebar-patient-item {
    cursor: pointer;
}

.sidebar-patient-item:hover {
    background: var(--bg-hover-redesign);
}

/* ==============================================
   v3.14.1: MOBILE RESPONSIVE - SIDEBAR
   ============================================== */

@media (max-width: 480px) {
    /* Sidebar als Bottom-Nav auf Mobile */
    .app-layout {
        grid-template-columns: 1fr;
        grid-template-rows: var(--header-height) 1fr 56px;
    }
    
    .app-sidebar {
        grid-row: 3;
        grid-column: 1;
        flex-direction: row;
        justify-content: space-around;
        padding: 8px 0;
        border-right: none;
        border-top: 1px solid var(--border-redesign);
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 56px;
        z-index: 100;
    }
    
    .sidebar-logo {
        display: none;
    }
    
    .sidebar-nav {
        flex-direction: row;
        width: auto;
    }
    
    .sidebar-spacer {
        display: none;
    }
    
    .sidebar-bottom {
        flex-direction: row;
    }
    
    .sidebar-nav-item[title]:hover::after {
        display: none;
    }
    
    /* Main Content Padding für Bottom-Nav */
    .app-main {
        padding-bottom: 68px;
    }
    
    /* Rechte Sidebar verstecken auf Mobile */
    .meldungen-col-sidebar {
        display: none !important;
    }
}

/* ==============================================
   v3.14.1: CHAT NOTIFICATION BELL
   ============================================== */

.chat-notification-bell {
    font-size: 14px;
    margin-left: 4px;
    animation: bell-shake 0.5s ease-in-out infinite;
}

@keyframes bell-shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(15deg); }
    50% { transform: rotate(0deg); }
    75% { transform: rotate(-15deg); }
}

/* Badge neben Glocke */
.sidebar-action-btn .badge-compact {
    background: var(--drk-red);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* ==============================================
   v3.14.1: EINSATZ-KARTEN KOMPAKTER
   ============================================== */

.einsatz-card {
    padding: 10px !important;
}

.einsatz-card-header {
    padding-bottom: 4px !important;
    margin-bottom: 4px !important;
}

.einsatz-card-body {
    font-size: 12px;
}

.einsatz-card-info {
    gap: 4px !important;
    font-size: 12px;
}

.einsatz-card-info > div {
    padding: 2px 0;
}

/* Ressourcen-Zeilen kompakter */
.einsatz-ressource-row {
    padding: 4px 8px !important;
    margin-bottom: 4px !important;
    font-size: 12px;
}

/* Protokoll/Chat Bereich */
.einsatz-protokoll-chat {
    gap: 8px !important;
    font-size: 11px;
}

.einsatz-protokoll-chat > div {
    padding: 6px !important;
}

/* Patienten-Zeile */
.einsatz-patienten-row {
    padding-top: 6px !important;
    margin-top: 6px !important;
    font-size: 12px;
}

/* Action-Buttons */
.einsatz-card-actions {
    gap: 6px !important;
    padding-top: 6px !important;
}

.einsatz-card-actions .btn {
    padding: 4px 10px !important;
    font-size: 12px !important;
}

/* Max-Width für bessere Nutzung */
.einsaetze-list {
    max-width: 900px;
}

/* ==============================================
   v3.14.1: KLINIK-TABELLE VERBESSERUNGEN
   ============================================== */

/* Kapazitäts-Zelle mit Balken + Prozent */
.capacity-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}

.capacity-percent {
    font-size: 11px;
    color: var(--text-secondary-redesign, #5a5a72);
    min-width: 35px;
    text-align: right;
}

/* Trennzeile vor Gesamt mit rotem Strich */
.klinik-row-separator {
    height: 0;
    padding: 0 !important;
}

.klinik-separator-line {
    padding: 0 !important;
    height: 2px;
    background: var(--drk-red, #E60005);
}

/* Gesamt-Zeile hervorgehoben */
.klinik-row-gesamt {
    background: linear-gradient(to right, #f0f9ff, #e8f4fd) !important;
}

.klinik-row-gesamt td {
    font-weight: 600;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
}

/* Tabelle braucht border-collapse */
.klinik-table,
#klinikUebersichtTableWrapper {
    border-collapse: collapse;
}

[data-theme="dark"] .klinik-row-gesamt {
    background: linear-gradient(to right, #1a2a3a, #1f2f40) !important;
}

[data-theme="dark"] .klinik-separator-line {
    background: var(--drk-red, #E60005);
}

/* ==============================================
   v3.14.1: TRANSPORT-FARB-LEGENDE
   ============================================== */

.transport-legende {
    display: flex;
    gap: 16px;
    padding: 8px 12px;
    background: var(--bg-elevated, #f8f9fa);
    border-radius: var(--radius-sm, 4px);
    font-size: 11px;
    color: var(--text-secondary-redesign, #5a5a72);
    margin-bottom: 12px;
}

.transport-legende-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.transport-legende-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.1);
}

.transport-legende-color.offen {
    background: #fff3cd;
    border-color: #ffc107;
}

.transport-legende-color.aktiv {
    background: #d4edda;
    border-color: #28a745;
}

.transport-legende-color.done {
    background: #e9ecef;
    border-color: #6c757d;
}

[data-theme="dark"] .transport-legende {
    background: var(--bg-elevated, #2a2a3e);
}

/* ==============================================
   v3.14.1: BEREICHS-KARTEN (Layout B)
   ============================================== */

.bereich-cards {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.bereich-card {
    flex: 1;
    background: var(--bg-surface-redesign, #ffffff);
    border: 2px solid var(--border-redesign, #e2e4e8);
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bereich-card:hover {
    border-color: var(--text-secondary-redesign, #5a5a72);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.bereich-card.active {
    background: linear-gradient(135deg, rgba(230, 0, 5, 0.08) 0%, rgba(230, 0, 5, 0.03) 100%);
    border-color: var(--drk-red, #E60005);
    box-shadow: 0 4px 16px rgba(230, 0, 5, 0.15);
}

.bereich-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.bereich-card-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated, #f8f9fa);
    color: var(--text-secondary-redesign, #5a5a72);
}

.bereich-card.active .bereich-card-icon {
    background: var(--drk-red, #E60005);
    color: white;
}

.bereich-card-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary-redesign, #5a5a72);
}

.bereich-card.active .bereich-card-label {
    color: var(--text-primary-redesign, #1a1a2e);
}

/* 2er-Grid für Zähler (v3.15.0: Summe entfernt) */
.bereich-card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.bereich-stat {
    text-align: center;
    padding: 6px 4px;
    border-radius: 6px;
    background: var(--bg-elevated, #f8f9fa);
}

.bereich-stat.aktiv {
    background: rgba(230, 0, 5, 0.08);
}

.bereich-stat.fertig {
    background: rgba(40, 167, 69, 0.08);
}

.bereich-stat.gesamt {
    background: var(--bg-elevated, #f8f9fa);
}

.bereich-stat-value {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

.bereich-stat.aktiv .bereich-stat-value {
    color: var(--drk-red, #E60005);
}

.bereich-stat.fertig .bereich-stat-value {
    color: #28a745;
}

.bereich-stat.gesamt .bereich-stat-value {
    color: var(--text-secondary-redesign, #5a5a72);
}

.bereich-stat-label {
    font-size: 10px;
    color: var(--text-muted-redesign, #9898a8);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Dark Mode */
[data-theme="dark"] .bereich-card {
    background: var(--bg-surface-redesign, #252538);
    border-color: var(--border-redesign, #3a3a4e);
}

[data-theme="dark"] .bereich-card.active {
    background: linear-gradient(135deg, rgba(230, 0, 5, 0.15) 0%, rgba(230, 0, 5, 0.05) 100%);
}

[data-theme="dark"] .bereich-card-icon {
    background: var(--bg-elevated, #2a2a3e);
}

[data-theme="dark"] .bereich-stat {
    background: var(--bg-elevated, #2a2a3e);
}

[data-theme="dark"] .bereich-stat.aktiv {
    background: rgba(230, 0, 5, 0.15);
}

[data-theme="dark"] .bereich-stat.fertig {
    background: rgba(40, 167, 69, 0.15);
}

[data-theme="dark"] .bereich-card-label {
    color: var(--text-secondary-redesign, #a0a0b0);
}

[data-theme="dark"] .bereich-card.active .bereich-card-label {
    color: white;
}

/* Mobile */
@media (max-width: 768px) {
    .bereich-cards {
        flex-direction: column;
        gap: 8px;
    }
    
    .bereich-card {
        padding: 10px 12px;
    }
    
    .bereich-stat-value {
        font-size: 16px;
    }
}
