:root {
    --primary: #e63946;
    --primary-dark: #c1121f;
    --secondary: #1a1a1a;
    --bg-dark: #121212;
    --bg-card: #1e1e1e;
    --bg-sidebar: #1a1a1a;
    --text-light: #ffffff;
    --text-muted: #a0a0a0;
    --border-color: #333;
    --success: #4CAF50;
    --warning: #ff9800;
    --danger: #f44336;
    --info: #2196F3;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow: hidden;
    width: 100%;
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    height: 100%;
    overflow: hidden;
    width: 100%;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

.layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

.sidebar {
    width: 270px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    left: 0;
    top: 0;
    transition: width 0.3s ease, transform 0.3s ease;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

/* Sidebar Collapse für Desktop */
.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .sidebar-header h1 span,
.sidebar.collapsed .sidebar-header .subtitle,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-badge {
    display: none;
}

/* Collapsed: Badge als kleiner Punkt-Indikator */
.sidebar.collapsed .nav-item:has(.nav-badge)::before {
    content: '';
    position: absolute;
    top: 6px;
    right: 14px;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

.sidebar.collapsed .nav-parent .arrow {
    display: none;
}

.sidebar.collapsed .sidebar-header h1 {
    justify-content: center;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px 0;
}

.sidebar.collapsed .nav-item i {
    margin-right: 0;
    font-size: 18px;
}

/* Collapsed: Section-Header ausblenden */
.sidebar.collapsed .nav-parent {
    display: none;
}

/* Collapsed: Submenus aufklappen und Items als Icons zeigen */
.sidebar.collapsed .nav-submenu {
    display: block !important;
    max-height: none !important;
    padding: 0;
}

.sidebar.collapsed .nav-submenu .nav-item {
    padding: 10px 0;
    justify-content: center;
}

.sidebar.collapsed .nav-submenu .nav-item span {
    display: none;
}

/* Collapsed: Trennlinie zwischen Sektionen subtil */
.sidebar.collapsed .nav-section {
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 4px;
    margin-bottom: 4px;
}

.sidebar.collapsed .nav-section:last-child {
    border-bottom: none;
}

/* Collapsed: Legal-Links als vertikale Icons */
.sidebar.collapsed .nav-legal {
    justify-content: center;
    gap: 0;
    flex-direction: column;
    align-items: center;
}

.sidebar.collapsed .nav-legal a[style] {
    display: none !important;
}

/* Collapsed: Hover-Tooltip */
.sidebar.collapsed .nav-item {
    position: relative;
}
.sidebar.collapsed .nav-item:hover::after {
    content: attr(title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 8px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-light);
    font-size: 12px;
    white-space: nowrap;
    z-index: 1002;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    position: absolute;
    top: 15px;
    right: -15px;
    width: 30px;
    height: 30px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.2s;
    color: var(--text-muted);
}

.sidebar-toggle:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.sidebar.collapsed .sidebar-toggle {
    right: -15px;
}

.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

/* Main Content anpassen bei collapsed sidebar */
.layout.sidebar-collapsed .main-content {
    margin-left: 70px;
    width: calc(100% - 70px);
    max-width: calc(100% - 70px);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.sidebar-header h1 {
    color: var(--primary);
    font-size: 24px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.sidebar-header .subtitle {
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-nav {
    padding: 15px 0;
}

.nav-section {
    margin-bottom: 10px;
}

.nav-section-title {
    padding: 10px 20px;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-light);
    transition: all 0.2s;
    border-left: 3px solid transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}

.nav-item:hover {
    background: rgba(230, 57, 70, 0.1);
    border-left-color: var(--primary);
    color: var(--text-light);
}

.nav-item.active {
    background: rgba(230, 57, 70, 0.15);
    border-left-color: var(--primary);
    color: var(--primary);
}

.nav-item i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Badge für Aufgaben-Anzahl */
.nav-badge {
    background: #f59e0b;
    color: #000;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: auto;
}

/* Badge für Heimspiele */
.nav-badge.home-badge {
    background: #22c55e;
    color: #fff;
}

/* Badge für E-Mails (rot) */
.nav-badge.email-badge {
    background: #ef4444;
    color: #fff;
}

.nav-submenu {
    display: none;
    background: rgba(0, 0, 0, 0.2);
}

.nav-submenu.open {
    display: block;
}

.nav-submenu .nav-item {
    padding-left: 50px;
    font-size: 14px;
}

.nav-parent {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-parent .arrow {
    transition: transform 0.2s;
}

.nav-parent.open .arrow {
    transform: rotate(90deg);
}

.main-content {
    flex: 1;
    margin-left: 270px;
    height: 100vh;
    width: calc(100% - 270px);
    max-width: calc(100% - 270px);
    overflow-y: auto;
    overflow-x: hidden;
}

.topbar {
    background: var(--bg-card);
    padding: 15px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 0;
    flex: 1;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info > div {
    display: block;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.content {
    padding: 30px;
    padding-bottom: 80px;
    max-width: 100%;
    overflow-x: hidden;
}

.page-header {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header h2 {
    font-size: 28px;
    margin-bottom: 5px;
    word-break: break-word;
}

.page-header .breadcrumb {
    color: var(--text-muted);
    font-size: 14px;
}

.page-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.card {
    background: var(--bg-card);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    max-width: 100%;
    overflow: hidden;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.card-header h3 {
    font-size: 18px;
}

.card-body {
    padding: 20px;
    overflow-x: hidden;
}

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

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 12px;
    white-space: nowrap;
}

.table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
}

.btn-secondary {
    background: var(--border-color);
    color: var(--text-light);
}

.btn-secondary:hover {
    background: #444;
    color: var(--text-light);
}

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

.btn-danger:hover {
    background: #d32f2f;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    min-height: 36px;
}

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

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-light);
    font-size: 16px;
    transition: border-color 0.2s;
    max-width: 100%;
    min-height: 44px;
    -webkit-appearance: none;
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

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

select.form-control {
    cursor: pointer;
    -webkit-appearance: menulist;
    appearance: menulist;
    background-image: none;
}

select[multiple].form-control {
    min-height: 120px;
    background-image: none;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px;
    cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: rgba(76, 175, 80, 0.2);
    color: var(--success);
}

.badge-danger {
    background: rgba(244, 67, 54, 0.2);
    color: var(--danger);
}

.badge-info {
    background: rgba(33, 150, 243, 0.2);
    color: var(--info);
}

.badge-primary {
    background: rgba(230, 57, 70, 0.2);
    color: var(--primary);
}

.alert {
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    word-break: break-word;
}

.alert-success {
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid var(--success);
    color: var(--success);
}

.alert-danger {
    background: rgba(244, 67, 54, 0.15);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.alert-warning {
    background: rgba(255, 152, 0, 0.15);
    border: 1px solid var(--warning);
    color: var(--warning);
}

.alert-info {
    background: rgba(33, 150, 243, 0.15);
    border: 1px solid var(--info);
    color: var(--info);
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--secondary) 100%);
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 15px;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border-color);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: var(--primary);
    font-size: 32px;
    margin-bottom: 5px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.version-badge {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-icon.users {
    background: rgba(230, 57, 70, 0.2);
    color: var(--primary);
}

.stat-icon.groups {
    background: rgba(33, 150, 243, 0.2);
    color: var(--info);
}

.stat-info h4 {
    font-size: 28px;
    margin-bottom: 5px;
}

.stat-info p {
    color: var(--text-muted);
    font-size: 14px;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* Mobile Menu Button & Overlay */
.mobile-menu-btn {
    display: none;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-light);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.mobile-menu-btn:active {
    background: var(--primary);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    -webkit-tap-highlight-color: transparent;
    display: none;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1100;
    padding: 20px;
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: 10px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    color: var(--text-light);
}

.permission-category {
    margin-bottom: 20px;
}

.permission-category h4 {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border-color);
}

/* Impersonate Banner */
.impersonate-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 45px;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    z-index: 1101;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(249, 115, 22, 0.3);
    padding: 0 15px;
}

.impersonate-banner-content {
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
    font-size: 14px;
    flex-wrap: wrap;
    justify-content: center;
}

.impersonate-banner-content i {
    font-size: 18px;
}

.impersonate-stop-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
}

.impersonate-stop-btn:hover {
    background: rgba(255,255,255,0.3);
    color: white;
}

.layout.has-impersonate-banner {
    margin-top: 45px;
}

.layout.has-impersonate-banner .sidebar {
    top: 45px;
    height: calc(100vh - 45px);
}

.user-avatar.impersonating {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    animation: pulse-orange 2s infinite;
}

@keyframes pulse-orange {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(249, 115, 22, 0);
    }
}

/* Warning Button */
.btn-warning {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
    border: none;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
    color: white;
}

/* Info Button */
.btn-info {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
    border: none;
}

.btn-info:hover {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: white;
}

/* ============================================
   RESPONSIVE - TABLET (max-width: 1024px)
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
    
    .main-content {
        margin-left: 220px;
        width: calc(100% - 220px);
        max-width: calc(100% - 220px);
    }
    
    .content {
        padding: 20px;
    }
    
    .page-header h2 {
        font-size: 24px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .topbar {
        padding: 12px 20px;
    }
    
    .card-header,
    .card-body {
        padding: 15px;
    }
    
    .table th,
    .table td {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .login-card {
        padding: 30px;
        max-width: 360px;
    }
    
    .form-row {
        gap: 15px;
    }
}

/* ============================================
   RESPONSIVE - MOBILE (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {
    html {
        overflow-x: hidden;
        overflow-y: auto;
        height: auto;
    }
    
    body {
        overflow-x: hidden;
        overflow-y: auto;
        height: auto;
        min-height: 100vh;
    }
    
    .layout {
        display: block;
        min-height: auto;
    }
    
    .mobile-menu-btn {
        display: flex !important;
    }
    
    .sidebar-toggle {
        display: none !important;
    }
    
    .sidebar-overlay {
        display: block !important;
        z-index: 999;
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1001;
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        height: 100dvh;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    /* Impersonate-Banner: Sidebar und Overlay müssen darüber liegen */
    .layout.has-impersonate-banner .sidebar {
        top: 40px;
        height: calc(100vh - 40px);
        height: calc(100dvh - 40px);
    }
    
    /* Impersonate-Banner: Topbar unter den Banner schieben */
    .layout.has-impersonate-banner .topbar {
        top: 40px;
    }
    
    /* Impersonate-Banner: Content braucht extra Platz (topbar 56px + banner 40px) */
    .layout.has-impersonate-banner .main-content {
        padding-top: 96px;
    }
    
    body.sidebar-open .sidebar {
        z-index: 1200;
    }
    
    body.sidebar-open .sidebar-overlay {
        z-index: 1150;
    }
    
    /* Body scroll lock wenn Sidebar offen */
    body.sidebar-open {
        overflow: hidden !important;
        touch-action: none;
        position: fixed;
        width: 100%;
    }
    
    /* Topbar hinter Sidebar + Overlay verstecken wenn Sidebar offen */
    body.sidebar-open .topbar {
        z-index: 997;
    }
    
    .sidebar .sidebar-header {
        flex-shrink: 0;
    }
    
    .sidebar .sidebar-nav {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
        height: auto;
        min-height: 100vh;
        overflow: visible;
        padding-top: 56px; /* Platz für fixed topbar */
    }
    
    .content {
        padding: 15px;
        padding-bottom: 80px;
    }
    
    .topbar {
        padding: 10px 15px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
    }
    
    .topbar-left {
        gap: 10px;
    }
    
    .topbar-title {
        font-size: 14px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 140px;
    }
    
    .topbar-right {
        gap: 8px;
    }
    
    .topbar-right .btn .btn-text {
        display: none;
    }
    
    .user-info > div:not(.user-avatar) {
        display: none;
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 20px;
    }
    
    .page-header h2 {
        font-size: 20px;
    }
    
    .page-header-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .page-header-actions .btn {
        flex: 1 1 calc(50% - 4px);
        min-width: 100px;
        justify-content: center;
        padding: 10px 8px;
        font-size: 12px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .stat-card {
        padding: 12px;
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .stat-info h4 {
        font-size: 20px;
    }
    
    .stat-info p {
        font-size: 11px;
    }
    
    .card {
        border-radius: 8px;
        margin-bottom: 15px;
    }
    
    .card-header {
        padding: 12px 15px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .card-header h3 {
        font-size: 16px;
    }
    
    .card-body {
        padding: 12px 15px;
    }
    
    /* Mobile-freundliche Tabellen als Cards */
    .table {
        display: block;
        width: 100%;
    }
    
    .table thead {
        display: none;
    }
    
    .table tbody {
        display: block;
    }
    
    .table tr {
        display: block;
        margin-bottom: 15px;
        background: var(--bg-dark);
        border-radius: 8px;
        padding: 12px;
        border: 1px solid var(--border-color);
    }
    
    .table tr:hover {
        background: var(--bg-dark);
    }
    
    .table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid var(--border-color);
        font-size: 13px;
        min-height: 40px;
    }
    
    .table td:last-child {
        border-bottom: none;
    }
    
    .table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 11px;
        text-transform: uppercase;
        margin-right: 10px;
        flex-shrink: 0;
    }
    
    .table td .action-buttons {
        justify-content: flex-end;
    }
    
    .btn {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .btn-sm {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .btn-icon {
        padding: 10px;
        min-width: 44px;
        min-height: 44px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-control {
        padding: 12px;
        font-size: 16px;
        min-height: 48px;
    }
    
    .checkbox-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .checkbox-item {
        padding: 12px;
        background: var(--bg-dark);
        border-radius: 5px;
        min-height: 48px;
    }
    
    .modal-overlay {
        padding: 10px;
    }
    
    .modal {
        max-width: 100%;
        max-height: calc(100vh - 20px);
        border-radius: 12px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 15px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    .login-page {
        padding: 15px;
    }
    
    .login-card {
        padding: 25px 20px;
        max-width: 100%;
    }
    
    .login-header h1 {
        font-size: 26px;
    }
    
    .alert {
        padding: 12px;
        font-size: 13px;
        flex-wrap: wrap;
    }
    
    .badge {
        padding: 3px 8px;
        font-size: 11px;
    }
    
    .empty-state {
        padding: 30px 15px;
    }
    
    .empty-state i {
        font-size: 36px;
    }
    
    .impersonate-banner {
        height: auto;
        min-height: 40px;
        padding: 8px 15px;
    }
    
    .impersonate-banner-content {
        font-size: 11px;
        gap: 8px;
    }
    
    .impersonate-banner-content > span {
        display: none;
    }
    
    .impersonate-stop-btn {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .layout.has-impersonate-banner {
        margin-top: 40px;
    }
    
    .layout.has-impersonate-banner .sidebar {
        top: 40px;
        height: calc(100vh - 40px);
    }
    
    .layout.has-impersonate-banner .topbar {
        top: 40px;
    }
    
    .layout.has-impersonate-banner .main-content {
        padding-top: 96px;
    }
    
    .permission-category {
        margin-bottom: 15px;
    }
    
    .action-buttons {
        gap: 5px;
    }
    
    /* Alle interaktiven Elemente klickbar machen */
    a, button, .btn, .nav-item, select, input, .checkbox-item, 
    .resource-filter, .filter-chip, .view-tab, .booking-item,
    .resource-select-item, .day-event, .week-event, .list-event {
        position: relative;
        z-index: 1;
        cursor: pointer;
    }
    
    /* Sidebar Navigation auf Mobile */
    .nav-item {
        min-height: 50px;
        display: flex;
        align-items: center;
    }
    
    .nav-submenu .nav-item {
        min-height: 48px;
    }
}

/* ============================================
   RESPONSIVE - SMALL MOBILE (max-width: 480px)
   ============================================ */
@media (max-width: 480px) {
    .content {
        padding: 10px;
    }
    
    .page-header h2 {
        font-size: 18px;
    }
    
    .page-header-actions .btn {
        flex: 1 1 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .topbar {
        padding: 8px 10px;
    }
    
    .topbar-title {
        font-size: 13px;
        max-width: 100px;
    }
    
    .sidebar {
        width: 270px;
    }
    
    .sidebar-header h1 {
        font-size: 20px;
    }
    
    .nav-item {
        padding: 12px 15px;
        font-size: 14px;
        min-height: 48px;
        display: flex;
        align-items: center;
    }
    
    .nav-submenu .nav-item {
        padding-left: 35px;
        font-size: 13px;
    }
    
    .card-header,
    .card-body {
        padding: 10px 12px;
    }
    
    .table td {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .table td::before {
        margin-right: 0;
    }
    
    .btn {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .btn-icon {
        min-width: 44px;
        min-height: 44px;
        padding: 8px;
    }
}

/* DSGVO Legal Links in Sidebar */
.nav-legal {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px !important;
}
.nav-legal a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}
.nav-legal a:hover {
    color: var(--primary);
}

/* iOS Auto-Zoom Prevention: Inputs < 16px triggern Zoom auf iOS Safari */
@media (max-width: 768px) {
    input[type="text"],
    input[type="search"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="url"],
    input[type="date"],
    input[type="time"],
    input[type="datetime-local"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

