/* ===== MODERN DASHBOARD STYLES ===== */
:root {
    /* Modern Light Color Palette */
    --bg-primary: #f4f4f8;
    --bg-secondary: #eeeef2;
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-card-hover: rgba(255, 255, 255, 0.95);

    /* Glassmorphism Light */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(27, 23, 255, 0.1);
    --glass-shadow: 0 8px 32px rgba(27, 23, 255, 0.08);

    /* Accent Colors */
    --accent-primary: #1b17ff;
    --accent-secondary: #4a47ff;
    --accent-gradient: linear-gradient(135deg, #1b17ff 0%, #4a47ff 50%, #6366f1 100%);
    --accent-glow: 0 0 40px rgba(27, 23, 255, 0.2);

    /* Status Colors */
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.12);
    --info: #3b82f6;
    --info-light: rgba(59, 130, 246, 0.12);

    /* Text Colors - Light Theme */
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a68;
    --text-muted: #6b6b8a;

    /* Spacing */
    --sidebar-width: 280px;
    --border-radius: 16px;
    --border-radius-sm: 12px;
    --border-radius-xs: 8px;

    /* Sidebar specific */
    --sidebar-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.85) 100%);
    --sidebar-border: rgba(27, 23, 255, 0.08);
}

/* DARK MODE OVERRIDES */
[data-theme="dark"] {
    --bg-primary: #0f1126;
    --bg-secondary: #0a0a1a;
    --bg-card: rgba(20, 22, 45, 0.6);
    --bg-card-hover: rgba(30, 35, 70, 0.8);

    --glass-bg: rgba(20, 22, 45, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);

    --sidebar-bg: linear-gradient(180deg, rgba(20, 22, 45, 0.95) 0%, rgba(15, 17, 38, 0.95) 100%);
    --sidebar-border: rgba(255, 255, 255, 0.1);

    --text-primary: #ffffff;
    --text-secondary: #e0e0e8;
    --text-muted: #9ca3af;

    --success-light: rgba(16, 185, 129, 0.2);
    --warning-light: rgba(245, 158, 11, 0.2);
    --danger-light: rgba(239, 68, 68, 0.2);
    --info-light: rgba(59, 130, 246, 0.2);
}

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

body {
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(27, 23, 255, 0.08), transparent),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(27, 23, 255, 0.05), transparent),
        radial-gradient(ellipse 50% 30% at 0% 50%, rgba(99, 102, 241, 0.04), transparent);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    display: flex;
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--sidebar-border);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-logo {
    height: 36px;
    transition: all 0.3s ease;
}

.sidebar-logo:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 0 10px rgba(27, 23, 255, 0.3));
}

.sidebar-nav {
    flex-grow: 1;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-section {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    padding: 0 1rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1.25rem;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.938rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--accent-gradient);
    border-radius: 0 4px 4px 0;
    transition: height 0.3s ease;
}

.nav-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    transform: translateX(4px);
}

.nav-item:hover::before {
    height: 24px;
}

.nav-item.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--accent-glow);
}

.nav-item.active::before {
    display: none;
}

.nav-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
    transition: transform 0.3s ease;
}

.nav-item:hover .nav-icon {
    transform: scale(1.15);
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(27, 23, 255, 0.08);
    background: rgba(27, 23, 255, 0.03);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin-bottom: 1rem;
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius-sm);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: var(--accent-glow);
    transition: all 0.3s ease;
}

.user-avatar:hover {
    transform: scale(1.05) rotate(-3deg);
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 0.938rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-email {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-badge {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #000;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.user-avatar.admin-glow {
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
    border: 2px solid #fbbf24;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.logout-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-xs);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: var(--danger-light);
    border-color: var(--danger);
    color: var(--danger);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem 2.5rem;
    min-height: 100vh;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 1.75rem;
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-8px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: var(--accent-glow);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:hover::after {
    opacity: 1;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.4s ease;
    position: relative;
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(-5deg);
}

.stat-icon.blue {
    background: var(--info-light);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

.stat-icon.green {
    background: var(--success-light);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.stat-icon.yellow {
    background: var(--warning-light);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

.stat-icon.red {
    background: var(--danger-light);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.5rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ===== CARDS ===== */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    border-color: rgba(99, 102, 241, 0.2);
}

.card-header {
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 1.75rem;
}

/* ===== CHARTS GRID ===== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-container {
    height: 280px;
    position: relative;
}

/* ===== DATA TABLE ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.data-table th {
    background: rgba(27, 23, 255, 0.04);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table tbody tr {
    transition: all 0.3s ease;
}

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

.data-table td {
    color: var(--text-secondary);
    font-size: 0.938rem;
}

.data-table td strong {
    color: var(--text-primary);
}

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50px;
    text-transform: capitalize;
}

.badge-blue {
    background: var(--info-light);
    color: var(--info);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-green {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-red {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-gray {
    background: rgba(107, 114, 128, 0.15);
    color: #9ca3af;
    border: 1px solid rgba(107, 114, 128, 0.3);
}

.badge-yellow {
    background: var(--warning-light);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-indigo {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* ===== PRIORITY DOTS ===== */
.priority-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
    animation: pulse 2s infinite;
}

.priority-haute {
    background: var(--danger);
    box-shadow: 0 0 10px var(--danger);
}

.priority-moyenne {
    background: var(--warning);
    box-shadow: 0 0 10px var(--warning);
}

.priority-basse {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    font-size: 0.938rem;
    font-weight: 600;
    border-radius: var(--border-radius-xs);
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

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

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.813rem;
}

/* ===== FORM ELEMENTS ===== */
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 0.938rem;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-xs);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba(255,255,255,0.5)'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

.form-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-text {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== ADMIN SECTION ===== */
.admin-section {
    display: none;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1), rgba(245, 158, 11, 0.05));
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.admin-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fbbf24;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

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

.stat-card {
    animation: fadeInUp 0.6s ease forwards;
}

.stat-card:nth-child(1) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.2s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.3s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.4s;
}

.card {
    animation: fadeInUp 0.6s ease forwards;
    animation-delay: 0.3s;
}

.charts-grid .card:nth-child(1) {
    animation-delay: 0.4s;
}

.charts-grid .card:nth-child(2) {
    animation-delay: 0.5s;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== MOBILE NAVIGATION ===== */

/* Burger button for tablet/mobile */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 200;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    border: none;
    background: var(--accent-gradient);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(27, 23, 255, 0.35);
    -webkit-tap-highlight-color: transparent;
}

.sidebar-toggle:active {
    transform: scale(0.92);
}

/* Sidebar overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Table responsive */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--border-radius-sm);
}

.table-responsive::-webkit-scrollbar {
    height: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 4px;
}

/* Form layout helpers */
.form-row {
    display: flex;
    gap: 1.5rem;
}

.form-row .form-group {
    flex: 1;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

/* ===== BOTTOM NAVIGATION BAR (Mobile) ===== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 150;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid var(--glass-border);
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.08);
    padding: 0.5rem 0.25rem;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}

.bottom-nav-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 500px;
    margin: 0 auto;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.4rem 0.75rem;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    transition: all 0.25s ease;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.bottom-nav-item .nav-emoji {
    font-size: 1.35rem;
    line-height: 1;
    transition: transform 0.25s ease;
}

.bottom-nav-item.active {
    color: var(--accent-primary);
}

.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--accent-gradient);
    border-radius: 0 0 4px 4px;
}

.bottom-nav-item.active .nav-emoji {
    transform: scale(1.15);
}

/* ===== DESKTOP HELPERS ===== */
.page-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-filter-group {
    display: flex;
    gap: 0.5rem;
}

.table-filter-group .form-select {
    width: auto;
    min-width: 180px;
}

/* ===== RESPONSIVE ===== */

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

@media (max-width: 1024px) {

    /* Show mobile nav elements */
    .sidebar-toggle {
        display: flex !important;
    }

    .bottom-nav {
        display: block !important;
    }

    /* Body: keep flex but allow column flow */
    body {
        flex-direction: column;
    }

    /* Main content: full width, no sidebar margin */
    .main-content {
        margin-left: 0 !important;
        padding: 1.25rem !important;
        padding-top: 4rem !important;
        padding-bottom: 5.5rem !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    /* Sidebar: hidden off-screen, acts as drawer */
    .sidebar {
        transform: translateX(-100%) !important;
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: none !important;
        width: min(300px, 82vw) !important;
    }

    .sidebar.open {
        transform: translateX(0) !important;
        box-shadow: 8px 0 60px rgba(0, 0, 0, 0.3) !important;
    }

    /* Stats: always 2 columns on tablet+ */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.875rem !important;
    }

    /* Charts: single column */
    .charts-grid {
        grid-template-columns: 1fr !important;
        gap: 0.875rem !important;
    }

    /* Table horizontal scroll */
    .data-table {
        min-width: 700px !important;
    }

    /* Header actions wrap */
    .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }

    .page-header-actions {
        width: 100% !important;
    }

    .page-header-actions .btn {
        flex: 1;
    }
}

@media (max-width: 768px) {

    /* ---- LAYOUT ---- */
    .main-content {
        padding: 0.75rem !important;
        padding-top: 3.75rem !important;
        padding-bottom: 5rem !important;
    }

    /* ---- HEADER ---- */
    .page-header {
        margin-bottom: 1.25rem !important;
    }

    .page-title {
        font-size: 1.3rem !important;
        line-height: 1.2 !important;
    }

    .page-subtitle {
        font-size: 0.8rem !important;
    }

    .page-header-actions {
        display: flex !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }

    .page-header-actions .btn {
        flex: 1 !important;
        padding: 0.65rem 0.875rem !important;
        font-size: 0.8rem !important;
    }

    .theme-toggle {
        width: 36px !important;
        height: 36px !important;
        margin-right: 0 !important;
    }

    /* ---- STATS GRID 2×2 compact ---- */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.625rem !important;
        margin-bottom: 1.25rem !important;
    }

    .stat-card {
        padding: 0.875rem !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
        border-radius: 12px !important;
    }

    .stat-card:hover {
        transform: none !important;
    }

    .stat-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 1rem !important;
        border-radius: 10px !important;
    }

    .stat-value {
        font-size: 1.5rem !important;
        line-height: 1 !important;
    }

    .stat-label {
        font-size: 0.688rem !important;
        line-height: 1.2 !important;
    }

    .stat-content {
        width: 100%;
    }

    /* ---- CARDS ---- */
    .card {
        border-radius: 12px !important;
        margin-bottom: 0.625rem !important;
    }

    .card-header {
        padding: 0.75rem !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
    }

    .card-title {
        font-size: 0.938rem !important;
    }

    .card-body {
        padding: 0.75rem !important;
    }

    .table-filter-group {
        width: 100% !important;
    }

    .table-filter-group .form-select {
        width: 100% !important;
        min-width: unset !important;
    }

    /* ---- CHARTS ---- */
    .charts-grid {
        gap: 0.625rem !important;
        margin-bottom: 0.875rem !important;
    }

    .chart-container {
        height: 180px !important;
    }

    /* ---- TABLE ---- */
    .data-table th,
    .data-table td {
        padding: 0.625rem 0.75rem !important;
        font-size: 0.75rem !important;
        white-space: nowrap !important;
    }

    .data-table th {
        font-size: 0.625rem !important;
        text-transform: uppercase !important;
        letter-spacing: 0.05em !important;
    }

    /* ---- BADGES ---- */
    .badge {
        padding: 0.2rem 0.5rem !important;
        font-size: 0.625rem !important;
    }

    /* ---- ADMIN SECTION ---- */
    .admin-section {
        padding: 0.875rem !important;
        margin-bottom: 0.875rem !important;
        border-radius: 12px !important;
    }

    .admin-grid {
        grid-template-columns: 1fr !important;
        gap: 0.625rem !important;
    }

    .admin-title {
        font-size: 0.938rem !important;
    }

    .admin-header {
        flex-direction: column !important;
        gap: 0.5rem !important;
        margin-bottom: 0.75rem !important;
    }

    /* ---- FORMS ---- */
    .form-row {
        flex-direction: column !important;
        gap: 0 !important;
    }

    .form-input,
    .form-select,
    .form-textarea {
        padding: 0.688rem 0.75rem !important;
        font-size: 0.875rem !important;
        border-radius: 10px !important;
    }

    .btn {
        padding: 0.688rem 1rem !important;
        font-size: 0.813rem !important;
        border-radius: 10px !important;
    }

    .btn-sm {
        padding: 0.4rem 0.75rem !important;
        font-size: 0.75rem !important;
    }

    /* ---- FULLCALENDAR ---- */
    .fc .fc-toolbar {
        flex-direction: column !important;
        gap: 0.5rem !important;
        align-items: stretch !important;
        margin-bottom: 0.75rem !important;
        padding: 0 !important;
    }

    .fc .fc-toolbar-title {
        font-size: 1rem !important;
        text-align: center !important;
        order: -1 !important;
    }

    .fc .fc-toolbar-chunk {
        display: flex !important;
        justify-content: center !important;
    }

    .fc .fc-button {
        padding: 0.4rem 0.625rem !important;
        font-size: 0.7rem !important;
        border-radius: 6px !important;
    }

    .fc .fc-button-group {
        border-radius: 6px !important;
        overflow: hidden !important;
    }

    .fc .fc-daygrid-day-number {
        font-size: 0.7rem !important;
        padding: 2px !important;
    }

    .fc .fc-col-header-cell-cushion {
        font-size: 0.65rem !important;
        padding: 0.3rem 0 !important;
    }

    .fc .fc-event {
        font-size: 0.6rem !important;
        padding: 1px 3px !important;
        border-radius: 3px !important;
    }

    .fc .fc-daygrid-event-dot {
        display: none !important;
    }

    .fc .fc-view-harness {
        min-height: 280px !important;
    }

    /* Filter section (calendar page) */
    .filter-section {
        flex-direction: column !important;
        gap: 0.625rem !important;
        padding: 0.75rem !important;
    }

    .calendar-card {
        padding: 0.5rem !important;
    }

    /* ---- EMPTY STATE ---- */
    .empty-state {
        padding: 1.5rem 0.875rem !important;
    }

    .empty-icon {
        font-size: 2.25rem !important;
        margin-bottom: 0.5rem !important;
    }

    .empty-title {
        font-size: 0.938rem !important;
    }

    .empty-text {
        font-size: 0.75rem !important;
    }

    /* ---- SIDEBAR DRAWER ---- */
    .sidebar-toggle {
        width: 42px !important;
        height: 42px !important;
        font-size: 1.25rem !important;
        border-radius: 11px !important;
        top: 0.5rem !important;
        left: 0.5rem !important;
    }

    .sidebar {
        width: min(280px, 80vw) !important;
    }

    .sidebar-header {
        padding: 1rem 0.875rem !important;
    }

    .sidebar-logo {
        height: 28px !important;
    }

    .sidebar-nav {
        padding: 0.75rem 0.625rem !important;
        gap: 0.2rem !important;
    }

    .nav-item {
        padding: 0.625rem 0.875rem !important;
        font-size: 0.813rem !important;
        border-radius: 8px !important;
    }

    .nav-icon {
        font-size: 1rem !important;
    }

    .sidebar-footer {
        padding: 0.875rem !important;
    }

    .user-avatar {
        width: 34px !important;
        height: 34px !important;
        font-size: 0.75rem !important;
    }

    .user-name {
        font-size: 0.75rem !important;
    }

    .user-email {
        font-size: 0.625rem !important;
    }

    .logout-btn {
        padding: 0.5rem !important;
        font-size: 0.75rem !important;
    }

    /* ---- BOTTOM NAV ---- */
    .bottom-nav-item {
        font-size: 0.6rem !important;
        padding: 0.35rem 0.5rem !important;
    }

    .bottom-nav-item .nav-emoji {
        font-size: 1.25rem !important;
    }
}

@media (max-width: 420px) {

    /* Ultra-small phones */
    .main-content {
        padding: 0.5rem !important;
        padding-top: 3.25rem !important;
        padding-bottom: 4.5rem !important;
    }

    .sidebar-toggle {
        width: 38px !important;
        height: 38px !important;
        font-size: 1.1rem !important;
        border-radius: 9px !important;
        top: 0.375rem !important;
        left: 0.375rem !important;
    }

    .page-title {
        font-size: 1.15rem !important;
    }

    .page-subtitle {
        font-size: 0.7rem !important;
    }

    .stats-grid {
        gap: 0.4rem !important;
    }

    .stat-card {
        padding: 0.625rem !important;
        gap: 0.35rem !important;
        border-radius: 10px !important;
    }

    .stat-icon {
        width: 30px !important;
        height: 30px !important;
        font-size: 0.875rem !important;
        border-radius: 8px !important;
    }

    .stat-value {
        font-size: 1.25rem !important;
    }

    .stat-label {
        font-size: 0.6rem !important;
    }

    .card {
        border-radius: 10px !important;
    }

    .card-header {
        padding: 0.625rem !important;
    }

    .card-title {
        font-size: 0.813rem !important;
    }

    .card-body {
        padding: 0.625rem !important;
    }

    .chart-container {
        height: 150px !important;
    }

    .charts-grid {
        gap: 0.4rem !important;
    }

    /* FC even smaller */
    .fc .fc-toolbar-title {
        font-size: 0.875rem !important;
    }

    .fc .fc-button {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.625rem !important;
    }

    .fc .fc-daygrid-day-number {
        font-size: 0.625rem !important;
    }

    .fc .fc-col-header-cell-cushion {
        font-size: 0.6rem !important;
    }

    /* Bottom nav even more compact */
    .bottom-nav {
        padding: 0.35rem 0.15rem !important;
    }

    .bottom-nav-item {
        font-size: 0.55rem !important;
        padding: 0.25rem 0.35rem !important;
    }

    .bottom-nav-item .nav-emoji {
        font-size: 1.1rem !important;
    }

    /* Table ultra compact */
    .data-table th,
    .data-table td {
        padding: 0.4rem 0.5rem !important;
        font-size: 0.688rem !important;
    }

    .page-header-actions .btn {
        padding: 0.5rem 0.625rem !important;
        font-size: 0.75rem !important;
    }
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
    background: none;
    border: 1px solid var(--sidebar-border);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 1rem;
}

.theme-toggle:hover {
    background: var(--bg-card-hover);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    transform: rotate(15deg);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}