/* Refresh look: bolder SaaS palette, glass cards, tighter spacing */
        body {
            background: radial-gradient(circle at 20% 20%, rgba(99,102,241,.08), transparent 35%),
                        radial-gradient(circle at 80% 0%, rgba(14,165,233,.10), transparent 30%),
                        linear-gradient(135deg, #060914 0%, #0b1220 45%, #0a0f1c 100%);
            color: var(--text-main);
            font-family: 'Inter', 'Cairo', system-ui, -apple-system, sans-serif;
        }

        .navbar {
            background: rgba(15, 23, 42, 0.75);
            backdrop-filter: blur(12px);
            border-bottom: 1px solid var(--border-subtle);
        }

        .card {
            background: linear-gradient(145deg, rgba(255,255,255,0.02), rgba(255,255,255,0.04));
            border: 1px solid var(--border-color);
            box-shadow: var(--shadow-md);
            border-radius: var(--radius-lg);
        }

        .card-header {
            background: transparent;
            border-bottom: 1px solid var(--border-subtle);
            font-weight: 700;
            letter-spacing: .01em;
            color: var(--text-main);
        }

        .btn-primary {
            background: linear-gradient(120deg, #6366f1 0%, #4f46e5 50%, #0ea5e9 100%);
            border: none;
            box-shadow: 0 10px 30px -12px rgba(79,70,229,0.8);
        }
        .btn-primary:hover {
            transform: translateY(-1px);
            box-shadow: 0 12px 36px -12px rgba(14,165,233,0.9);
        }

        .table thead {
            background: rgba(255,255,255,0.03);
            text-transform: uppercase;
            letter-spacing: .05em;
            font-size: .9rem;
        }

        .badge {
            padding: 0.4rem 0.55rem;
            border-radius: 999px;
            font-weight: 600;
            letter-spacing: .01em;
        }

        .sidebar, .offcanvas {
            background: rgba(8, 13, 26, 0.9);
            backdrop-filter: blur(8px);
            border-left: 1px solid var(--border-subtle);
        }

        .form-control, .form-select {
            background: rgba(255,255,255,0.03);
            border: 1px solid var(--border-subtle);
            color: var(--text-main);
        }
        .form-control:focus, .form-select:focus {
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
        }

        .stat-tile {
            background: linear-gradient(150deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
            border: 1px solid var(--border-color);
            border-radius: var(--radius-xl);
            padding: 18px 20px;
            display: flex;
            align-items: center;
            gap: 14px;
            box-shadow: var(--shadow-sm);
        }
        .stat-icon {
            width: 44px; height: 44px;
            border-radius: 12px;
            display: grid;
            place-items: center;
            background: var(--accent-soft);
            color: var(--accent);
            font-size: 18px;
        }

        .btn i { margin-right: 6px; margin-left: 0; }
        :root {
            --bs-primary: #6366f1;
            --bs-primary-rgb: 99, 102, 241;
            --bs-success: #10b981;
            --bs-success-rgb: 16, 185, 129;
            --bs-warning: #f59e0b;
            --bs-warning-rgb: 245, 158, 11;
            --bs-danger: #ef4444;
            --bs-danger-rgb: 239, 68, 68;
            --bs-info: #0ea5e9;
            --bs-info-rgb: 14, 165, 233;
            --bg-body: #030712;
            --bg-panel: #0b1220;
            --bg-card: #1f2937;
            --bg-card-soft: #374151;
            --bg-card-hover: #4b5563;
            --border-subtle: rgba(255, 255, 255, 0.05);
            --border-strong: rgba(255, 255, 255, 0.1);
            --border-color: rgba(255, 255, 255, 0.08);
            --text-main: #f8fafc;
            --text-muted: #94a3b8;
            --accent: #6366f1;
            --accent-soft: rgba(99, 102, 241, 0.12);
            --accent-strong: #4f46e5;
            --success: #10b981;
            --warning: #f59e0b;
            --danger: #ef4444;
            --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
            --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
            --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
            --radius-md: 12px;
            --radius-lg: 16px;
            --radius-xl: 20px;
        }
        
        * {
            scrollbar-width: thin;
            scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
        }
        
        *::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }
        
        *::-webkit-scrollbar-track {
            background: transparent;
        }
        
        *::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.1);
            border-radius: 4px;
        }
        
        *::-webkit-scrollbar-thumb:hover {
            background: rgba(255, 255, 255, 0.2);
        }
        
        body {
            font-family: 'Inter', 'Cairo', sans-serif;
            min-height: 100vh;
            background: radial-gradient(circle at top left, rgba(99, 102, 241, 0.1), transparent 40%), radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.08), transparent 40%), var(--bg-body);
            color: var(--text-main);
            letter-spacing: -0.01em;
        }

        .auth-screen {
            min-height: 100vh;
            align-items: center;
            justify-content: center;
            padding: 24px;
            background: linear-gradient(135deg, #030712 0%, #111827 100%);
            position: relative;
            overflow: hidden;
        }

        .auth-screen:not(.d-none) {
            display: flex;
        }

        .auth-screen::before {
            content: '';
            position: absolute;
            top: -20vh;
            left: -10vw;
            width: 50vw;
            height: 50vw;
            background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, rgba(0,0,0,0) 60%);
            border-radius: 50%;
            pointer-events: none;
        }

        .auth-screen::after {
            content: '';
            position: absolute;
            bottom: -20vh;
            right: -10vw;
            width: 50vw;
            height: 50vw;
            background: radial-gradient(circle, rgba(14,165,233,0.1) 0%, rgba(0,0,0,0) 60%);
            border-radius: 50%;
            pointer-events: none;
        }

        .auth-card {
            width: min(420px, 100%);
            background: rgba(17, 24, 39, 0.7);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border-radius: var(--radius-xl);
            border: 1px solid rgba(255, 255, 255, 0.08);
            padding: 40px 32px;
            box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.05);
            z-index: 10;
        }

        .auth-card .brand-mark {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 64px;
            height: 64px;
            border-radius: 16px;
            background: linear-gradient(135deg, var(--accent) 0%, #0ea5e9 100%);
            font-size: 28px;
            color: #fff;
            box-shadow: 0 8px 16px -4px rgba(99, 102, 241, 0.4);
            margin-bottom: 24px;
        }

        .auth-card .form-control {
            background: rgba(31, 41, 55, 0.6);
            border: 1px solid rgba(255, 255, 255, 0.1);
            color: #f8fafc;
            border-radius: var(--radius-md);
            padding: 14px 16px;
            font-size: 1rem;
            transition: all 0.2s ease;
        }

        .auth-card .form-control::placeholder {
            color: #64748b;
        }

        .auth-card .form-control:focus {
            background: rgba(31, 41, 55, 0.9);
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
            outline: none;
        }

        .auth-alert {
            border-radius: 14px;
            padding: 12px 16px;
            background: rgba(248, 113, 113, 0.12);
            border: 1px solid rgba(248, 113, 113, 0.25);
            color: #fecaca;
            font-size: 0.95rem;
        }

        .global-loading-overlay {
            position: fixed;
            inset: 0;
            background: rgba(15, 23, 42, 0.86);
            backdrop-filter: blur(6px);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 12px;
            z-index: 1400;
        }

        .global-loading-overlay p {
            color: #94a3b8;
            margin: 0;
        }

        .btn {
            border-radius: var(--radius-md);
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            font-weight: 600;
            padding: 10px 20px;
        }

        .btn-primary {
            background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
            border: none;
            color: #fff;
            box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3), 0 2px 4px -1px rgba(99, 102, 241, 0.15);
        }

        .btn-primary:hover, .btn-primary:focus {
            transform: translateY(-2px);
            box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4), 0 4px 6px -2px rgba(99, 102, 241, 0.2);
            background: linear-gradient(135deg, #7173f5 0%, #574feb 100%);
        }

        .btn-outline-primary {
            border-color: rgba(99, 102, 241, 0.45);
            color: var(--text-main);
        }

        .btn-outline-primary:hover {
            background: rgba(99, 102, 241, 0.12);
            color: #fff;
            border-color: rgba(99, 102, 241, 0.65);
        }

        .btn-chip, .btn-filter {
            border-radius: 999px;
            padding: 0.45rem 0.85rem;
            font-weight: 600;
            letter-spacing: 0.02em;
        }

        .btn-action {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            font-weight: 700;
        }

        .section-caption {
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.08em;
            font-size: 0.75rem;
        }

        .icon-muted {
            color: var(--text-muted);
        }

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

        .badge-soft {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            padding: 0.35rem 0.65rem;
            border-radius: 999px;
            background: rgba(99, 102, 241, 0.12);
            color: var(--text-main);
            font-weight: 700;
            letter-spacing: 0.02em;
        }

        .loading-state {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            color: var(--text-muted);
            animation: pulse 1.3s ease-in-out infinite;
        }

        .view-enter {
            opacity: 0;
            transform: translateY(8px);
        }

        .view-enter.view-enter-active {
            opacity: 1;
            transform: translateY(0);
            transition: opacity 180ms ease, transform 180ms ease;
        }

        @keyframes pulse {
            0% { opacity: 0.7; }
            50% { opacity: 1; }
            100% { opacity: 0.7; }
        }

        body[data-theme="light"] {
            --bs-body-bg: #f4f7fb;
            --card-bg: #ffffff;
            --border-color: rgba(15, 23, 42, 0.08);
            --text-muted: #64748b;
            color: #0f172a;
            background: linear-gradient(160deg, #e8f1ff 0%, #f7fbff 100%);
        }

        body[data-theme="light"] .sidebar {
            background: rgba(255, 255, 255, 0.92);
            border-right: 1px solid rgba(148, 163, 184, 0.25);
            color: #0f172a;
        }

        body[data-theme="light"] .sidebar-brand {
            color: #0f172a;
        }

        body[data-theme="light"] .sidebar-link {
            color: #334155;
        }

        body[data-theme="light"] .sidebar-link:hover {
            background: rgba(59, 130, 246, 0.12);
            color: #1e3a8a;
        }

        body[data-theme="light"] .sidebar-link.active {
            background: rgba(59, 130, 246, 0.18);
            color: #1e3a8a;
        }

        body[data-theme="light"] .content-area {
            background: #f4f7fb;
        }

        body[data-theme="light"] .main-content {
            color: #0f172a;
        }

        body[data-theme="light"] .card {
            background: var(--card-bg);
            border-color: rgba(148, 163, 184, 0.18);
            color: #0f172a;
        }

        body[data-theme="light"] .card h5,
        body[data-theme="light"] .card h6,
        body[data-theme="light"] .page-header h2,
        body[data-theme="light"] .history-category-title,
        body[data-theme="light"] .history-entry-title {
            color: #0f172a;
        }

        body[data-theme="light"] .sidebar-group-label {
            color: #475569;
        }

        body[data-theme="light"] .card .text-muted,
        body[data-theme="light"] .text-muted {
            color: var(--text-muted) !important;
        }

        body[data-theme="light"] .badge.bg-primary {
            background-color: rgba(59, 130, 246, 0.15) !important;
            color: #1d4ed8 !important;
        }

        body[data-theme="light"] .badge.bg-danger-subtle {
            background: rgba(248, 113, 113, 0.15) !important;
            color: #dc2626 !important;
        }

        body[data-theme="light"] .history-entry {
            background: rgba(255, 255, 255, 0.9);
            border-color: rgba(148, 163, 184, 0.22);
            color: #0f172a;
        }

        body[data-theme="light"] .history-entry:hover {
            border-color: rgba(59, 130, 246, 0.35);
        }

        body[data-theme="light"] .table {
            color: #1f2937;
        }

        body[data-theme="light"] .table thead th {
            color: #475569;
        }

        body[data-theme="light"] .table tbody tr {
            border-bottom-color: rgba(148, 163, 184, 0.18);
        }

        body[data-theme="light"] .table.table-dark {
            background-color: #ffffff;
            color: #0f172a;
        }

        body[data-theme="light"] .table.table-dark tbody tr {
            color: #0f172a;
        }

        body[data-theme="light"] .form-control,
        body[data-theme="light"] .form-select {
            background-color: #ffffff;
            color: #0f172a;
            border-color: rgba(148, 163, 184, 0.3);
        }

        body[data-theme="light"] .form-control:focus,
        body[data-theme="light"] .form-select:focus {
            border-color: rgba(59, 130, 246, 0.45);
            box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.08);
        }

        body[data-theme="light"] .btn-outline-secondary {
            color: #1e3a8a;
            border-color: rgba(59, 130, 246, 0.35);
        }

        body[data-theme="light"] .btn-outline-secondary:hover {
            background: rgba(59, 130, 246, 0.12);
            color: #1e3a8a;
        }

        body[data-theme="light"] .btn-outline-primary {
            border-color: rgba(37, 99, 235, 0.65);
            color: #1d4ed8;
        }

        body[data-theme="light"] .btn-outline-primary:hover {
            background: rgba(37, 99, 235, 0.12);
            color: #1d4ed8;
        }

        body[data-theme="light"] .btn-logout {
            border-color: rgba(220, 38, 38, 0.25);
            color: #b91c1c;
        }

        body[data-theme="light"] .btn-logout:hover {
            background: rgba(248, 113, 113, 0.12);
            color: #dc2626;
        }

        .app-shell {
            display: flex;
            min-height: 100vh;
            position: relative;
        }

        .sidebar {
            width: min(260px, 80vw);
            background: rgba(15, 23, 42, 0.94);
            border-right: 1px solid rgba(148, 163, 184, 0.12);
            padding: 1.75rem 1.25rem;
            display: flex;
            flex-direction: column;
            gap: 2rem;
            position: sticky;
            top: 0;
            height: 100vh;
            z-index: 1030;
            flex-shrink: 0;
            transition: width 0.25s ease, padding 0.25s ease;
            overflow-x: hidden;
        }

        .app-shell.sidebar-collapsed .sidebar {
            width: 74px;
            padding: 1.5rem 0.55rem;
            align-items: center;
        }

        .app-shell.sidebar-collapsed .sidebar-brand span.brand-text {
            display: none;
        }

        .app-shell.sidebar-collapsed .sidebar-brand .brand-mark {
            display: none;
        }

        .app-shell.sidebar-collapsed .sidebar-group-label {
            display: none;
        }

        .app-shell.sidebar-collapsed .sidebar-links {
            align-items: center;
            gap: 0.25rem;
        }

        .app-shell.sidebar-collapsed .sidebar-nav {
            align-items: center;
            gap: 1.1rem;
        }

        .app-shell.sidebar-collapsed .sidebar-group {
            align-items: center;
        }

        .app-shell.sidebar-collapsed .sidebar-link {
            justify-content: center;
            width: 48px;
            height: 48px;
            padding: 0;
            border-radius: 16px;
        }

        .app-shell.sidebar-collapsed .sidebar-link span.link-text {
            display: none;
        }

        .app-shell.sidebar-collapsed .btn-logout {
            width: 100%;
            justify-content: center;
            padding-inline: 0.75rem;
        }

        .app-shell.sidebar-collapsed .btn-logout .link-text {
            display: none;
        }

        .app-shell.sidebar-collapsed .main-content,
        .app-shell.sidebar-collapsed .content-header,
        .app-shell.sidebar-collapsed .content-area {
            padding-left: 1.5rem;
        }

        .sidebar-brand span.brand-text {
            display: inline-block;
            text-align: center;
        }

        .sidebar-header {
            display: flex;
            align-items: center;
            gap: 0.75rem;
        }

        .sidebar-brand {
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            gap: 0.65rem;
            font-weight: 700;
            font-size: 1.2rem;
            color: #f8fafc;
            letter-spacing: 0.02em;
            text-decoration: none;
        }

        .sidebar-brand .brand-mark {
            width: 40px;
            height: 40px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 12px;
            background: linear-gradient(135deg, #4f46e5 0%, #38bdf8 100%);
            color: #fff;
        }

        .sidebar-nav {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 1.75rem;
            overflow-y: auto;
            padding-right: 0.25rem;
        }

        .sidebar-group {
            display: flex;
            flex-direction: column;
            gap: 0.6rem;
        }

        .sidebar-group-label {
            font-size: 0.7rem;
            text-transform: uppercase;
            letter-spacing: 0.15em;
            color: var(--text-muted);
        }

        .sidebar-links {
            display: flex;
            flex-direction: column;
            gap: 0.35rem;
            align-items: flex-start;
            width: 100%;
        }

        .sidebar-link {
            display: inline-flex;
            align-items: center;
            gap: 0.55rem;
            padding: 0.55rem 0.9rem;
            border-radius: 10px;
            color: var(--text-muted);
            font-weight: 500;
            text-decoration: none;
            transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
            white-space: nowrap;
            width: 100%;
        }

        .sidebar-link span.link-text {
            display: inline-block;
        }

        .sidebar-link i {
            font-size: 1rem;
            opacity: 0.7;
        }

        .sidebar-link:hover {
            color: #f8fafc;
            background: rgba(79, 70, 229, 0.18);
        }

        .sidebar-link.active {
            color: #f8fafc;
            background: rgba(79, 70, 229, 0.32);
        }

        .sidebar-link.active i {
            opacity: 1;
        }

        .btn-logout {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 0.6rem;
            border-radius: 999px;
            font-weight: 600;
            padding: 0.5rem 1.2rem;
            border: 1px solid rgba(248, 113, 113, 0.6);
            color: #fecaca;
            background: transparent;
            transition: all 0.2s ease;
            text-align: center;
        }

        .btn-logout:hover {
            color: #fff;
            background: rgba(248, 113, 113, 0.2);
        }

        .btn-logout i {
            font-size: 0.9rem;
            margin-right: 0.1rem;
        }

        body.sidebar-locked {
            overflow: hidden;
        }

        .content-area {
            flex: 1;
            display: flex;
            flex-direction: column;
            min-width: 0;
            transition: padding-left 0.3s ease;
        }

        .content-header {
            background: rgba(15, 23, 42, 0.85);
            border-bottom: 1px solid rgba(148, 163, 184, 0.12);
            padding: 0.75rem 1rem;
        }

        .sidebar-toggle {
            border-radius: 10px;
        }

        .main-content {
            flex: 1;
            padding: 2rem;
            transition: padding-left 0.3s ease;
        }


        .dashboard-filter-card {
            background: linear-gradient(135deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.95));
            border: 1px solid rgba(148, 163, 184, 0.2);
            border-radius: 16px;
            padding: 0.75rem 1rem;
            box-shadow: 0 14px 30px -20px rgba(15, 23, 42, 0.6);
            display: flex;
            flex-direction: column;
            gap: 0.6rem;
        }

        .dashboard-filter-trigger {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            border-radius: 999px;
            background: rgba(15, 23, 42, 0.6);
            border: 1px solid rgba(148, 163, 184, 0.2);
            color: #e2e8f0;
            padding: 0.3rem 0.65rem;
            font-weight: 600;
            font-size: 0.8rem;
            cursor: pointer;
            position: relative;
            z-index: 1;
            min-width: 120px;
            justify-content: center;
            text-transform: uppercase;
            letter-spacing: 0.08em;
        }

        .dashboard-filter-trigger * {
            pointer-events: none;
        }

        .dashboard-filter-trigger:hover {
            border-color: rgba(99, 102, 241, 0.6);
            color: #fff;
        }

        .dashboard-filter-summary {
            font-size: 0.8rem;
            color: #94a3b8;
        }

        .dashboard-filter-card .form-label {
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: var(--text-muted);
            font-weight: 600;
        }

        .dashboard-filter-controls {
            display: grid;
            grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr);
            gap: 0.6rem 0.8rem;
            align-items: end;
        }

        .dashboard-custom-field {
            transition: opacity 0.2s ease;
        }

        .dashboard-custom-field.d-none {
            opacity: 0;
        }

        .dashboard-custom-actions .btn {
            width: 100%;
        }

        .dashboard-card {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: var(--radius-lg);
            padding: 1.5rem;
            box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.05);
            transition: transform 0.2s ease, box-shadow 0.2s ease;
            width: 100%;
            box-sizing: border-box;
        }

        .dashboard-section-title {
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            margin-bottom: 0.75rem;
        }

        .dashboard-kpi-card {
            display: flex;
            gap: 1rem;
            align-items: center;
            justify-content: space-between;
            padding: 1.25rem 1.5rem;
            border-radius: var(--radius-lg);
            border: 1px solid var(--border-color);
            background: linear-gradient(135deg, rgba(31, 41, 55, 0.6), rgba(17, 24, 39, 0.8));
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
            height: 100%;
            transition: transform 0.2s ease, box-shadow 0.2s ease;
            box-sizing: border-box;
        }

        .dashboard-kpi-icon {
            width: 46px;
            height: 46px;
            border-radius: 12px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            font-size: 1.15rem;
        }

        .dashboard-kpi-value {
            font-size: 1.6rem;
            font-weight: 700;
            line-height: 1.2;
        }

        .dashboard-kpi-label {
            margin: 0;
            font-size: 0.85rem;
            letter-spacing: 0.03em;
            text-transform: uppercase;
            color: #cbd5e1;
        }

        .dashboard-kpi-trend {
            font-size: 0.8rem;
            color: #cbd5e1;
        }

        .dashboard-kpi-card:hover,
        .dashboard-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 14px 32px -16px rgba(15, 23, 42, 0.55);
        }

        .trend-card {
            min-height: 260px;
        }

        .alerts-card .list-group-item {
            background: transparent;
            border: 0;
            padding: 0.55rem 0;
        }

        .alerts-card {
            border-left: 4px solid #f59e0b;
        }

        .severity-badge {
            border-radius: 999px;
            padding: 0.25rem 0.65rem;
            font-size: 0.75rem;
            font-weight: 600;
        }

        .severity-critical {
            background: #ef4444;
            color: #fff;
        }

        .severity-high {
            background: #f97316;
            color: #fff;
        }

        .severity-moderate {
            background: #fbbf24;
            color: #1f2937;
        }

        .mini-list-badge {
            border-radius: 10px;
            padding: 0.25rem 0.5rem;
            font-weight: 700;
        }

        .dashboard-subtile {
            color: #94a3b8;
            margin-bottom: 1rem;
        }

        .dashboard-legend {
            display: flex;
            gap: 0.75rem;
            align-items: center;
            font-size: 0.9rem;
        }

        .dashboard-legend .dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            display: inline-block;
        }

        .dashboard-table-wrapper {
            max-height: 360px;
            overflow-y: auto;
            overflow-x: hidden;
        }

        .dashboard-table {
            width: 100%;
            table-layout: fixed;
        }

        .dashboard-table th,
        .dashboard-table td {
            padding: 0.65rem 0.75rem;
            font-size: 0.95rem;
            vertical-align: middle;
        }

        .dashboard-table tbody tr:hover {
            background: rgba(148, 163, 184, 0.06);
        }

        #dashboard-period-buttons {
            background: rgba(15, 23, 42, 0.6);
            border: 1px solid rgba(148, 163, 184, 0.18);
            border-radius: 12px;
            padding: 0.2rem;
            gap: 0.2rem;
            flex-wrap: wrap;
        }

        #dashboard-period-buttons .btn {
            font-weight: 600;
            border-radius: 10px;
            border: 1px solid rgba(148, 163, 184, 0.15);
            color: #dbe3f8;
            background: transparent;
            padding: 0.32rem 0.75rem;
            font-size: 0.85rem;
        }

        #dashboard-period-buttons .btn:hover {
            background: rgba(59, 130, 246, 0.1);
            color: #e2e8f0;
        }

        #dashboard-period-buttons .btn.active {
            background: linear-gradient(135deg, #3b82f6, #6366f1);
            color: #fff;
            border-color: rgba(99, 102, 241, 0.6);
            box-shadow: 0 8px 14px -12px rgba(99, 102, 241, 0.8);
        }

        #dashboard-period-buttons .btn,
        #dashboard-period-buttons .btn.active {
            transition: background-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease, transform 0.1s ease;
        }

        #dashboard-period-buttons .btn:active {
            transform: translateY(1px);
        }

        .dashboard-date-input {
            background: rgba(15, 23, 42, 0.7);
            border: 1px solid rgba(148, 163, 184, 0.2);
            color: #e2e8f0;
        }

        .dashboard-date-input:focus {
            border-color: rgba(99, 102, 241, 0.6);
            box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.15);
        }

        #dashboard-apply-range {
            background: linear-gradient(135deg, #3b82f6, #6366f1);
            border: none;
            font-weight: 600;
        }

        #dashboard-apply-range:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        #dashboard-period-filter {
            background: rgba(15, 23, 42, 0.8);
            border: 1px solid rgba(148, 163, 184, 0.2);
            color: #e2e8f0;
            font-weight: 600;
            padding: 0.45rem 0.75rem;
        }

        .dashboard-filter-modal {
            position: fixed;
            inset: 0;
            background: rgba(15, 23, 42, 0.65);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 1055;
        }

        .dashboard-filter-modal.active {
            display: flex;
        }

        .dashboard-filter-modal .modal-card {
            width: min(560px, calc(100% - 2rem));
            background: #0f172a;
            border: 1px solid rgba(148, 163, 184, 0.2);
            border-radius: 16px;
            padding: 1rem 1.2rem;
            box-shadow: 0 24px 48px -20px rgba(15, 23, 42, 0.8);
        }

        .dashboard-filter-modal .modal-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
        }

        .dashboard-filter-modal .modal-title {
            font-weight: 700;
            font-size: 1rem;
        }

        .dashboard-filter-modal .modal-close {
            background: transparent;
            border: 1px solid rgba(148, 163, 184, 0.2);
            color: #cbd5f5;
            border-radius: 999px;
            width: 32px;
            height: 32px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        .dashboard-filter-options {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 0.6rem;
            margin-top: 1rem;
        }

        .dashboard-filter-option {
            border: 1px solid rgba(148, 163, 184, 0.2);
            border-radius: 12px;
            padding: 0.6rem 0.75rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-weight: 600;
            font-size: 0.9rem;
            color: #e2e8f0;
        }

        .dashboard-filter-option input {
            accent-color: #6366f1;
        }

        .dashboard-filter-option.active {
            border-color: rgba(99, 102, 241, 0.6);
            background: rgba(99, 102, 241, 0.12);
        }

        .dashboard-filter-modal .modal-actions {
            display: flex;
            justify-content: flex-end;
            gap: 0.6rem;
            margin-top: 1rem;
        }

        .dashboard-filter-modal .modal-actions .btn-secondary {
            background: rgba(148, 163, 184, 0.12);
            border-color: rgba(148, 163, 184, 0.2);
            color: #e2e8f0;
        }

        .dashboard-filter-hint {
            font-size: 0.8rem;
            color: #94a3b8;
        }

        .student-details-modal {
            background: #05070f;
            border: 1px solid rgba(148, 163, 184, 0.2);
            border-radius: 18px;
            padding: 1.25rem;
            box-shadow: 0 18px 36px -24px rgba(15, 23, 42, 0.75);
            position: relative;
            overflow: hidden;
        }

        .student-details-modal::after {
            content: '';
            position: absolute;
            inset: 0;
            background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.15), transparent 45%);
            pointer-events: none;
        }

        .modal-backdrop {
            background-color: #000;
        }

        .modal-backdrop.show {
            opacity: 0.78;
        }

        .student-details-modal .modal-header {
            border-bottom: 1px solid rgba(148, 163, 184, 0.15);
            position: relative;
            z-index: 1;
        }

        .student-details-modal .modal-footer {
            border-top: 1px solid rgba(148, 163, 184, 0.15);
            position: relative;
            z-index: 1;
        }

        .student-details-header {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 1rem;
            flex-wrap: wrap;
            position: relative;
            z-index: 1;
        }

        .student-details-title {
            display: flex;
            gap: 1rem;
            align-items: center;
            flex-wrap: wrap;
        }

        .student-details-title .avatar {
            width: 64px;
            height: 64px;
            border-radius: 16px;
            font-size: 1.4rem;
            background: linear-gradient(135deg, rgba(59, 130, 246, 0.4), rgba(34, 211, 238, 0.4));
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        .student-details-meta {
            color: #94a3b8;
            font-size: 0.9rem;
        }

        .student-details-badges {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            margin-top: 0.35rem;
        }

        .student-details-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
            gap: 0.6rem;
            margin-top: 0.9rem;
            position: relative;
            z-index: 1;
        }

        .student-details-insights {
            display: flex;
            flex-wrap: wrap;
            gap: 0.55rem;
            margin-top: 0.8rem;
        }

        .student-insight-pill {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            border-radius: 999px;
            padding: 0.4rem 0.8rem;
            background: rgba(30, 41, 59, 0.78);
            border: 1px solid rgba(148, 163, 184, 0.16);
            color: #cbd5e1;
            font-size: 0.8rem;
            font-weight: 500;
        }

        .student-details-metric {
            background: rgba(8, 12, 22, 0.8);
            border: 1px solid rgba(148, 163, 184, 0.12);
            border-radius: 10px;
            padding: 0.55rem 0.6rem;
        }

        .student-details-metric small {
            color: #94a3b8;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            font-size: 0.65rem;
        }

        .student-details-metric strong {
            display: block;
            font-size: 0.9rem;
            margin-top: 0.2rem;
        }

        .student-details-metric.wide {
            grid-column: span 2;
        }

        .student-details-section-title {
            font-weight: 700;
            font-size: 0.95rem;
            margin-top: 1.2rem;
            margin-bottom: 0.6rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .student-semester-grid,
        .student-details-history-summary {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 0.7rem;
            margin-top: 0.8rem;
        }

        .student-semester-card,
        .student-history-summary-card {
            background: rgba(15, 23, 42, 0.72);
            border: 1px solid rgba(148, 163, 184, 0.14);
            border-radius: 14px;
            padding: 0.9rem 1rem;
        }

        .student-semester-card small,
        .student-history-summary-card small {
            display: block;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: #94a3b8;
            font-size: 0.68rem;
            font-weight: 700;
        }

        .student-semester-card strong,
        .student-history-summary-card strong {
            display: block;
            margin-top: 0.3rem;
            font-size: 1.05rem;
            color: #f8fafc;
        }

        .student-semester-meta,
        .student-history-summary-meta {
            margin-top: 0.35rem;
            color: #94a3b8;
            font-size: 0.82rem;
            line-height: 1.4;
        }

        .student-semester-card.is-better {
            border-color: rgba(34, 197, 94, 0.32);
        }

        .student-semester-card.is-worse {
            border-color: rgba(248, 113, 113, 0.32);
        }

        .student-semester-card.is-steady {
            border-color: rgba(96, 165, 250, 0.26);
        }

        .student-details-filters {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 0.6rem;
            margin-top: 1rem;
            position: relative;
            z-index: 1;
        }

        .student-details-filters .form-label {
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: #94a3b8;
            font-weight: 600;
        }

        .student-history-list {
            display: grid;
            gap: 0.6rem;
            max-height: 420px;
            overflow-y: auto;
            padding-right: 0.2rem;
        }

        .student-history-item {
            display: flex;
            justify-content: space-between;
            gap: 1rem;
            background: rgba(15, 23, 42, 0.7);
            border: 1px solid rgba(148, 163, 184, 0.15);
            border-radius: 12px;
            padding: 0.75rem 0.9rem;
        }

        .student-history-item .history-title {
            font-weight: 600;
            font-size: 0.95rem;
        }

        .student-history-item .history-subtext {
            color: #94a3b8;
            font-size: 0.8rem;
        }

        .student-history-status {
            display: flex;
            flex-direction: column;
            gap: 0.35rem;
            align-items: flex-end;
            min-width: 120px;
        }

        .student-details-footer {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.75rem;
            flex-wrap: wrap;
            margin-top: 0.8rem;
        }

        .student-details-footer .btn {
            border-radius: 999px;
        }

        .student-details-placeholder {
            text-align: center;
            color: #94a3b8;
            padding: 1.5rem 0;
        }

        .student-card-actions {
            display: inline-flex;
            align-items: center;
            gap: 0.4rem;
        }

        .student-details-btn {
            border-radius: 10px;
        }

        @media (max-width: 992px) {
            .dashboard-filter-controls {
                grid-template-columns: 1fr;
            }
        }

        @media (max-width: 768px) {
            #dashboard-period-buttons {
                display: none;
            }
            #dashboard-period-filter {
                display: block !important;
            }
        }

        .kpi-trend {
            display: flex;
            align-items: center;
            gap: 0.45rem;
            font-size: 0.8rem;
            color: var(--text-muted);
        }

        .kpi-trend i {
            font-size: 0.9rem;
        }

        .badge.bg-danger-subtle {
            background: rgba(239, 68, 68, 0.15) !important;
            color: #f87171 !important;
        }

        .absence-trend-row {
            margin-bottom: 1.25rem;
        }

        .absence-trend-row:last-child {
            margin-bottom: 0;
        }

        .absence-trend-bar {
            position: relative;
            height: 8px;
            border-radius: 999px;
            background: rgba(99, 102, 241, 0.18);
            overflow: hidden;
        }

        .absence-trend-fill {
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            background: rgba(99, 102, 241, 0.75);
        }

        .absence-trend-fill.unjustified {
            background: rgba(239, 68, 68, 0.85);
        }

        .sidebar-backdrop {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(15, 23, 42, 0.6);
            backdrop-filter: blur(3px);
            z-index: 1025;
        }

        .sidebar-backdrop.show {
            display: block;
        }

        @media (max-width: 991.98px) {
            .app-shell {
                flex-direction: column;
            }

            .sidebar {
                position: fixed;
                height: 100%;
                transform: translateX(-100%);
                transition: transform 0.3s ease;
                box-shadow: 12px 0 30px -20px rgba(15, 23, 42, 0.9);
            }

            .sidebar.sidebar-open {
                transform: translateX(0);
            }
        }

        .card {
            background: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: 14px;
            transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
            box-shadow: var(--shadow-sm);
        }
        
        .card:hover {
            border-color: rgba(148, 163, 184, 0.25);
            box-shadow: var(--shadow-md);
            transform: translateY(-3px);
        }
        
        .card-header {
            background: transparent;
            border-bottom: 1px solid var(--border-color);
            font-weight: 600;
            padding: 1.25rem 1.5rem;
        }
        
        .card-body {
            padding: 1.5rem;
        }
        
        .card-footer {
            background: transparent;
            border-top: 1px solid var(--border-color);
            padding: 1rem 1.5rem;
        }
        
        .btn {
            border-radius: 8px;
            font-weight: 600;
            padding: 0.6rem 1.2rem;
            transition: transform 0.15s ease, box-shadow 0.15s ease;
            border: none;
        }
        
        .btn:hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow-sm);
        }
        
        .btn:active {
            transform: translateY(0);
        }
        
        .btn-primary {
            background: #4f46e5;
        }
        
        .btn-success {
            background: #14b8a6;
        }
        
        .btn-warning {
            background: #facc15;
            color: #1f2937;
        }
        
        .btn-danger {
            background: #f87171;
        }
        
        .btn-info {
            background: #38bdf8;
        }
        
        .btn-outline-primary {
            border: 2px solid var(--bs-primary);
            color: var(--bs-primary);
            background: transparent;
        }
        
        .btn-outline-primary:hover {
            background: var(--bs-primary);
            color: white;
        }

        .kpi-card {
            border-left: 4px solid var(--bs-primary);
            background: var(--card-bg);
        }
        
        .kpi-card h3 {
            font-weight: 800;
            font-size: 2.5rem;
            margin-bottom: 0.5rem;
            color: #f8fafc;
        }
        
        .kpi-card .kpi-label {
            font-size: 0.875rem;
            color: var(--text-muted);
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }
        
        .kpi-card .kpi-icon {
            font-size: 2.5rem;
            opacity: 0.15;
            position: absolute;
            right: 1.5rem;
            top: 50%;
            transform: translateY(-50%);
        }
        
        .table {
            color: var(--text-main);
            border-collapse: separate;
            border-spacing: 0;
            width: 100%;
        }
        
        .table thead th {
            border-bottom: 1px solid var(--border-strong);
            font-weight: 600;
            text-transform: uppercase;
            font-size: 0.75rem;
            letter-spacing: 0.05em;
            color: var(--text-muted);
            padding: 1.25rem 1rem;
            background: rgba(255, 255, 255, 0.02);
            border-top: none;
        }

        .table thead th:first-child {
            border-top-left-radius: var(--radius-md);
        }

        .table thead th:last-child {
            border-top-right-radius: var(--radius-md);
        }
        
        .table tbody tr {
            transition: all 0.2s ease;
        }
        
        .table tbody tr:hover {
            background: rgba(255, 255, 255, 0.03);
            transform: translateY(-1px);
            box-shadow: var(--shadow-sm);
        }
        
        .table tbody td {
            padding: 1.25rem 1rem;
            vertical-align: middle;
            border-bottom: 1px solid var(--border-color);
        }
        
        .badge {
            padding: 0.5rem 0.875rem;
            font-weight: 600;
            border-radius: 8px;
            font-size: 0.75rem;
            letter-spacing: 0.025em;
        }
        
        .badge.bg-success { background: #0d9488 !important; }
        .badge.bg-danger { background: #ef4444 !important; }
        .badge.bg-warning { background: #f59e0b !important; }
        .badge.bg-info { background: #0ea5e9 !important; }
        
        .form-control, .form-select {
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid var(--border-color);
            color: #e5e7eb;
            border-radius: 10px;
            padding: 0.75rem 1rem;
            transition: all 0.2s;
        }
        
        .form-control:focus, .form-select:focus {
            background: rgba(255, 255, 255, 0.05);
            border-color: var(--bs-primary);
            box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
            color: #fff;
        }
        
        .form-label {
            font-weight: 600;
            color: var(--text-muted);
            font-size: 0.875rem;
            margin-bottom: 0.5rem;
        }
        
        .form-check-input {
            width: 1.25rem;
            height: 1.25rem;
            border: 2px solid var(--border-color);
            background: rgba(255, 255, 255, 0.03);
            cursor: pointer;
            transition: all 0.2s;
        }
        
        .form-check-input:checked {
            background-color: var(--bs-primary);
            border-color: var(--bs-primary);
        }
        
        .form-check-label {
            margin-left: 0.5rem;
            cursor: pointer;
        }
        
        .modal-content {
            background: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            box-shadow: var(--shadow-xl);
        }

        #teacherModal .modal-content {
            background-color: var(--card-bg);
            background-image: none;
            backdrop-filter: none;
            -webkit-backdrop-filter: none;
        }
        
        .modal-header {
            border-bottom: 1px solid var(--border-color);
            padding: 1.5rem;
        }
        
        .modal-body {
            padding: 1.5rem;
        }
        
        .modal-footer {
            border-top: 1px solid var(--border-color);
            padding: 1.5rem;
        }
        
        .modal-title {
            font-weight: 700;
        }
        
        .offcanvas {
            background: var(--card-bg);
            border-left: 1px solid var(--border-color);
            width: 480px !important;
        }
        
        .offcanvas-header {
            border-bottom: 1px solid var(--border-color);
            padding: 1.5rem;
        }
        
        .offcanvas-body {
            padding: 1.5rem;
        }
        
        .offcanvas-title {
            font-weight: 700;
        }
        
        .history-timeline {
            position: relative;
            padding-left: 2.75rem;
        }
        
        .history-timeline::before {
            content: '';
            position: absolute;
            top: 0;
            bottom: 0;
            left: 1.35rem;
            width: 2px;
            background: linear-gradient(180deg, rgba(59, 130, 246, 0.45) 0%, rgba(59, 130, 246, 0) 100%);
        }
        
        .history-day {
            position: relative;
            margin-bottom: 2.5rem;
            animation: fadeIn 0.4s ease both;
        }
        
        .history-day:last-child {
            margin-bottom: 0;
        }
        
        .history-day-header {
            position: relative;
            display: flex;
            align-items: baseline;
            gap: 1rem;
            margin-bottom: 1.5rem;
        }
        
        .history-day-header::before {
            content: '';
            position: absolute;
            left: -1.85rem;
            top: 0.65rem;
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: var(--bs-primary);
            box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25);
        }
        
        .history-day-title {
            font-weight: 700;
            font-size: 1.05rem;
            text-transform: capitalize;
        }
        
        .history-day-count {
            color: var(--text-muted);
            font-size: 0.78rem;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            font-weight: 600;
        }
        
        .history-day-events {
            display: flex;
            flex-direction: column;
        }
        
        .history-entry {
            position: relative;
            display: flex;
            gap: 1.25rem;
            padding: 1.25rem 1.5rem;
            background: rgba(255, 255, 255, 0.02);
            border: 1px solid rgba(255, 255, 255, 0.05);
            border-radius: 16px;
            box-shadow: var(--shadow-sm);
            transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
        }
        
        .history-entry:not(:last-child) {
            margin-bottom: 1rem;
        }
        
        .history-entry::before {
            content: '';
            position: absolute;
            left: -1.85rem;
            top: 1.65rem;
            width: 16px;
            height: 2px;
            background: rgba(59, 130, 246, 0.35);
        }
        
        .history-entry:hover {
            transform: translateX(6px);
            border-color: rgba(59, 130, 246, 0.25);
            box-shadow: var(--shadow-md);
        }
        
        .history-entry-icon {
            width: 48px;
            height: 48px;
            border-radius: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.1rem;
            color: #fff;
            box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
        }
        
        .history-entry-icon.bg-success { background: var(--bs-success); }
        .history-entry-icon.bg-warning { background: var(--bs-warning); }
        .history-entry-icon.bg-info { background: var(--bs-info); }
        .history-entry-icon.bg-danger { background: var(--bs-danger); }
        .history-entry-icon.bg-primary { background: var(--bs-primary); }
        .history-entry-icon.bg-secondary { background: #4b5563; }
        
        .history-entry-body {
            flex: 1;
        }
        
        .history-entry-header {
            display: flex;
            align-items: baseline;
            justify-content: space-between;
            gap: 1rem;
            margin-bottom: 0.5rem;
        }
        
        .history-entry-title {
            font-weight: 600;
            font-size: 1rem;
        }
        
        .history-entry-time {
            font-size: 0.8rem;
            font-weight: 600;
            color: var(--text-muted);
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
        }
        
        .history-entry-meta {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            margin-bottom: 0.75rem;
        }
        
        .history-chip {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            border-radius: 999px;
            padding: 0.35rem 0.75rem;
            font-size: 0.7rem;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            font-weight: 600;
            border: 1px solid transparent;
        }
        
        .history-chip i {
            font-size: 0.75rem;
        }
        
        .history-chip.admin {
            background: rgba(59, 130, 246, 0.12);
            border-color: rgba(59, 130, 246, 0.35);
            color: var(--bs-primary);
        }
        
        .history-chip.teacher {
            background: rgba(6, 182, 212, 0.12);
            border-color: rgba(6, 182, 212, 0.35);
            color: var(--bs-info);
        }
        
        .history-chip.actor {
            background: rgba(255, 255, 255, 0.05);
            border-color: rgba(255, 255, 255, 0.08);
            color: #e5e7eb;
            text-transform: none;
            letter-spacing: 0;
            font-weight: 500;
        }
        
        .history-chip.actor i {
            color: rgba(255, 255, 255, 0.55);
        }
        
        .history-entry-description {
            margin-bottom: 0.75rem;
            color: #cbd5f5;
            font-size: 0.9rem;
        }
        
        .history-entry-actions {
            display: flex;
            justify-content: flex-end;
        }
        
        .history-entry-actions .btn {
            border-radius: 999px;
            font-weight: 600;
            padding-inline: 1.25rem;
        }

        /* Visual refresh overrides */
        body {
            background: radial-gradient(circle at 18% 12%, rgba(99, 102, 241, 0.08), transparent 28%), radial-gradient(circle at 82% 8%, rgba(56, 189, 248, 0.1), transparent 30%), var(--bg-body);
        }

        .content-area {
            background: linear-gradient(180deg, rgba(2, 8, 23, 0.9) 0%, rgba(11, 18, 36, 0.85) 45%, rgba(17, 28, 52, 0.8) 100%);
            backdrop-filter: blur(2px);
        }

        .main-content {
            background: transparent;
        }

        .sidebar {
            background: linear-gradient(180deg, rgba(11, 18, 36, 0.98) 0%, rgba(5, 11, 26, 0.96) 100%);
            box-shadow: 10px 0 32px -24px rgba(0, 0, 0, 0.55);
        }

        .sidebar-link {
            border: 1px solid transparent;
            letter-spacing: 0.01em;
            position: relative;
            overflow: hidden;
        }

        .sidebar-link::before {
            content: '';
            position: absolute;
            left: -12px;
            top: 10px;
            bottom: 10px;
            width: 3px;
            border-radius: 999px;
            background: transparent;
            transition: background 0.2s ease, transform 0.2s ease;
        }

        .sidebar-link:hover {
            border-color: rgba(99, 102, 241, 0.28);
            transform: translateX(1px);
        }

        .sidebar-link.active {
            border-color: rgba(99, 102, 241, 0.32);
            box-shadow: 0 10px 24px -18px rgba(99, 102, 241, 0.4);
        }

        .sidebar-link.active::before {
            background: var(--accent);
            transform: scaleY(1.05);
        }

        .sidebar-link i {
            width: 1.2rem;
            text-align: center;
        }

        .sidebar-group-label {
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.08em;
            font-size: 0.78rem;
        }

        .dashboard-card,
        .card {
            background: var(--bg-card);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-md);
            box-shadow: 0 16px 40px -28px rgba(0, 0, 0, 0.55);
        }

        .dashboard-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 18px 42px -30px rgba(0, 0, 0, 0.65);
        }

        .dashboard-kpi-card {
            background: linear-gradient(145deg, rgba(17, 24, 39, 0.95), rgba(15, 23, 42, 0.9));
            border-color: var(--border-subtle);
            border-radius: var(--radius-md);
        }

        .dashboard-section-title {
            color: #f8fafc;
            letter-spacing: 0.01em;
        }

        .dashboard-subtitle, .dashboard-subtile {
            color: var(--text-muted);
            letter-spacing: 0.02em;
        }

        .dashboard-card .card-header,
        .card .card-header {
            background: rgba(255, 255, 255, 0.02);
            border-bottom: 1px solid var(--border-subtle);
            border-top-left-radius: var(--radius-md);
            border-top-right-radius: var(--radius-md);
        }

        .dashboard-card .card-footer,
        .card .card-footer {
            border-top: 1px solid var(--border-subtle);
            background: rgba(255, 255, 255, 0.02);
        }

        .page-header {
            display: flex;
            flex-direction: column;
            gap: 0.35rem;
        }

        .page-header h2 {
            display: flex;
            align-items: center;
            gap: 0.65rem;
            font-weight: 800;
            letter-spacing: 0.01em;
        }

        .page-header p {
            color: var(--text-muted);
            margin: 0;
        }

        .table {
            color: var(--text-main);
        }

        .table thead th {
            background: rgba(255, 255, 255, 0.02);
            border-bottom: 1px solid var(--border-strong);
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--text-muted);
            font-size: 0.75rem;
            padding: 1rem;
        }

        .table tbody tr {
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .table tbody td {
            border-bottom: 1px solid var(--border-color);
            padding: 1rem;
            vertical-align: middle;
        }

        .table tbody tr:hover {
            background: rgba(255, 255, 255, 0.03);
            transform: translateY(-1px);
            box-shadow: var(--shadow-sm);
        }

        .table tbody tr:nth-child(2n) {
            background: rgba(255, 255, 255, 0.01);
        }

        .history-entry {
            border-radius: 14px;
        }

        .filter-bar {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            align-items: center;
        }

        .view-content {
            transition: opacity 0.2s ease, transform 0.2s ease;
        }

        .btn-light-glow {
            background: rgba(255, 255, 255, 0.06);
            border: 1px solid var(--border-subtle);
            color: #f8fafc;
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
        }

        .btn-light-glow:hover {
            background: rgba(255, 255, 255, 0.12);
        }

        .card-accent {
            border: 1px solid rgba(99, 102, 241, 0.25);
            box-shadow: 0 16px 42px -28px rgba(99, 102, 241, 0.45);
        }

        .pill {
            display: inline-flex;
            align-items: center;
            gap: 0.4rem;
            padding: 0.35rem 0.8rem;
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid var(--border-subtle);
            border-radius: 999px;
            font-weight: 700;
            letter-spacing: 0.02em;
            font-size: 0.78rem;
        }

        .pill.success { border-color: rgba(34, 211, 166, 0.3); color: #a7f3d0; }
        .pill.warning { border-color: rgba(251, 191, 36, 0.32); color: #fcd34d; }
        .pill.info { border-color: rgba(56, 189, 248, 0.3); color: #bae6fd; }

        .legend-pill {
            background: rgba(255, 255, 255, 0.05);
            padding: 0.35rem 0.65rem;
            border-radius: 10px;
            border: 1px solid var(--border-subtle);
            font-weight: 700;
            letter-spacing: 0.02em;
            color: var(--text-muted);
        }

        .offcanvas {
            background: rgba(15, 23, 42, 0.96);
            border-left: 1px solid var(--border-subtle);
            backdrop-filter: blur(4px);
        }

        .offcanvas-header {
            border-bottom: 1px solid var(--border-subtle);
        }

        .timeline-dot {
            width: 9px;
            height: 9px;
            border-radius: 50%;
            background: var(--accent);
            box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.15);
        }

        .list-hoverable li {
            transition: background 0.15s ease, transform 0.15s ease;
        }

        .list-hoverable li:hover {
            background: rgba(255, 255, 255, 0.03);
            transform: translateY(-1px);
        }

        .header-logo {
            width: 42px;
            height: 42px;
            border-radius: 12px;
            background: linear-gradient(135deg, var(--accent), #38bdf8);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            font-weight: 800;
            box-shadow: 0 10px 24px -16px rgba(99, 102, 241, 0.6);
        }

        .content-header {
            background: rgba(255, 255, 255, 0.02);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-md);
            padding: 0.85rem 1rem;
            margin-bottom: 1rem;
        }

        .page-header + .card,
        .page-header + .dashboard-card {
            margin-top: 0.25rem;
        }

        .toolbar {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            align-items: center;
        }

        .toolbar .btn,
        .filter-bar .btn {
            padding-inline: 0.85rem;
        }

        .filter-bar .form-select,
        .filter-bar .form-control {
            background: rgba(255, 255, 255, 0.05);
            border-color: var(--border-subtle);
            color: #e5e7eb;
        }

        .filter-bar .form-select:focus,
        .filter-bar .form-control:focus {
            border-color: rgba(99, 102, 241, 0.55);
            box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
        }

        .table-responsive {
            border-radius: var(--radius-md);
            border: 1px solid var(--border-subtle);
            overflow: hidden;
        }

        .table-wrapper-card {
            background: var(--bg-card-soft);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-md);
            padding: 1rem;
        }

        .badge-glow {
            background: rgba(99, 102, 241, 0.16);
            border: 1px solid rgba(99, 102, 241, 0.35);
            color: #e0e7ff;
            box-shadow: 0 10px 28px -18px rgba(99, 102, 241, 0.6);
        }

        .export-history-list li {
            border-radius: 12px;
            border: 1px solid transparent;
            transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
        }

        .export-history-list li:hover {
            background: rgba(255, 255, 255, 0.02);
            border-color: var(--border-subtle);
            transform: translateY(-1px);
        }

        .btn-icon {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 0.4rem;
        }

        .badge-soft-accent {
            background: var(--accent-soft);
            color: #e0e7ff;
            border: 1px solid rgba(99, 102, 241, 0.24);
        }

        .history-category {
            margin-bottom: 3rem;
            border-left: 3px solid rgba(99, 102, 241, 0.25);
            padding-left: 1.5rem;
        }

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

        .history-category-heading {
            display: flex;
            align-items: center;
            gap: 0.75rem;
        }

        .history-category-icon {
            width: 42px;
            height: 42px;
            border-radius: 12px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 1.1rem;
            color: #fff;
            background: rgba(99, 102, 241, 0.6);
            box-shadow: 0 12px 30px -20px rgba(99, 102, 241, 0.8);
        }

        .history-category-title {
            font-weight: 700;
            font-size: 1.1rem;
        }

        .history-category-count {
            color: var(--text-muted);
            font-size: 0.85rem;
        }
        
        @media (max-width: 768px) {
            .history-timeline {
                padding-left: 1.8rem;
            }
            .history-timeline::before {
                left: 0.9rem;
            }
            .history-day-header::before,
            .history-entry::before {
                left: -1.2rem;
            }
            .history-entry {
                flex-direction: column;
                padding: 1.1rem;
            }
            .history-entry-icon {
                width: 40px;
                height: 40px;
            }
            .history-entry-header {
                flex-direction: column;
                align-items: flex-start;
            }
            .history-entry-actions {
                justify-content: flex-start;
            }
        }
        
        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .animate-fade-in {
            animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
            animation-delay: var(--delay, 0s);
        }
        
        .view-content:not(.d-none) {
            animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        }
        
        .page-header h2 {
            font-weight: 700;
            font-size: 2rem;
            margin-bottom: 0.5rem;
            color: #f1f5f9;
        }
        
        .page-header p {
            color: var(--text-muted);
            font-size: 0.95rem;
        }
        
        .empty-state {
            padding: 3rem 2rem;
            text-align: center;
            color: var(--text-muted);
        }
        
        .empty-state i {
            font-size: 3rem;
            opacity: 0.3;
            margin-bottom: 1rem;
        }
        
        .avatar {
            width: 40px;
            height: 40px;
            background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-info) 100%);
            border-radius: 10px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            font-size: 0.875rem;
            margin-right: 12px;
            color: white;
        }
        
        .spinner-wrapper {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 200px;
        }
        
        .spinner-border {
            border-color: var(--bs-primary);
            border-right-color: transparent;
        }
        
        .toast {
            border-radius: 12px;
            box-shadow: var(--shadow-lg);
        }
        
        .stat-ring {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            font-size: 1.25rem;
            position: relative;
        }
        
        .stat-ring::before {
            content: '';
            position: absolute;
            inset: -4px;
            border-radius: 50%;
            padding: 4px;
            background: linear-gradient(135deg, var(--bs-primary), var(--bs-info));
            -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
            mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
            -webkit-mask-composite: xor;
            mask-composite: exclude;
        }
        
        .action-buttons {
            display: flex;
            gap: 0.5rem;
        }
        
        .btn-sm {
            padding: 0.375rem 0.75rem;
            font-size: 0.875rem;
        }

        .tag-upcoming {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0.1rem 0.5rem;
            margin-left: 0.45rem;
            border-radius: 999px;
            font-size: 0.65rem;
            font-weight: 600;
            letter-spacing: 0.03em;
            background: rgba(99, 102, 241, 0.16);
            color: rgba(199, 210, 254, 0.95);
        }

        .feature-placeholder {
            border: 1px dashed rgba(99, 102, 241, 0.35);
            background: rgba(15, 23, 42, 0.6);
            border-radius: 18px;
            padding: 3rem 1.5rem;
            text-align: center;
            color: rgba(226, 232, 240, 0.85);
        }

        .feature-placeholder .icon-stack {
            width: 72px;
            height: 72px;
            border-radius: 50%;
            margin: 0 auto 1.5rem;
            display: flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(145deg, rgba(79, 70, 229, 0.35), rgba(14, 165, 233, 0.22));
            color: #fff;
            font-size: 1.6rem;
            box-shadow: 0 18px 35px -24px rgba(79, 70, 229, 0.9);
        }

        .feature-placeholder .badge-soft {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            padding: 0.45rem 0.85rem;
            border-radius: 999px;
            font-size: 0.75rem;
            background: rgba(99, 102, 241, 0.16);
            color: rgba(202, 215, 255, 0.9);
            margin-top: 1.25rem;
        }

        .legend-pills {
            display: inline-flex;
            gap: 0.45rem;
            flex-wrap: wrap;
        }

        .legend-pill {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            font-size: 0.75rem;
            padding: 0.35rem 0.65rem;
            border-radius: 999px;
            background: rgba(148, 163, 184, 0.16);
            color: var(--text-muted);
        }

        .legend-pill::before {
            content: '';
            display: inline-block;
            width: 10px;
            height: 10px;
            border-radius: 999px;
        }

        .legend-pill.total::before {
            background: rgba(99, 102, 241, 0.75);
        }

        .legend-pill.unjustified::before {
            background: rgba(248, 113, 113, 0.85);
        }

        .trend-chart {
            min-height: 210px;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }

        .trend-bars {
            display: flex;
            gap: 0.75rem;
            align-items: flex-end;
            width: 100%;
            padding: 0.5rem 0;
            overflow-x: auto;
        }

        .trend-bars::-webkit-scrollbar {
            height: 6px;
        }

        .trend-bars::-webkit-scrollbar-thumb {
            background: rgba(99, 102, 241, 0.25);
            border-radius: 999px;
        }

        .trend-bar {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.3rem;
            min-width: 38px;
        }

        .trend-bar .bar-wrapper {
            width: 100%;
            position: relative;
            display: flex;
            align-items: flex-end;
            justify-content: center;
        }

        .trend-bar .bar-total {
            width: 20px;
            border-radius: 8px 8px 0 0;
            background: linear-gradient(180deg, rgba(99, 102, 241, 0.88), rgba(99, 102, 241, 0.25));
            display: flex;
            align-items: flex-end;
            justify-content: center;
            overflow: hidden;
            position: relative;
        }

        .trend-bar .bar-unjustified {
            width: 100%;
            background: linear-gradient(180deg, rgba(248, 113, 113, 0.95), rgba(248, 113, 113, 0.35));
            border-radius: 8px 8px 0 0;
        }

        .trend-bar .bar-hint {
            position: absolute;
            top: -1.5rem;
            font-size: 0.7rem;
            font-weight: 600;
            color: rgba(226, 232, 240, 0.85);
        }

        .trend-label {
            font-size: 0.7rem;
            color: var(--text-muted);
            white-space: nowrap;
        }

        .insight-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
            gap: 1rem;
        }

        .insight-card {
            border-radius: 15px;
            padding: 1.1rem;
            background: rgba(15, 23, 42, 0.68);
            border: 1px solid rgba(99, 102, 241, 0.12);
            box-shadow: var(--shadow-sm);
            display: flex;
            gap: 0.85rem;
            align-items: flex-start;
        }

        .insight-card i {
            width: 36px;
            height: 36px;
            border-radius: 10px;
            background: rgba(99, 102, 241, 0.2);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            color: rgba(129, 140, 248, 0.95);
        }

        .insight-card strong {
            display: block;
            font-size: 0.95rem;
            color: #f8fafc;
        }

        .insight-card span {
            font-size: 0.8rem;
            color: var(--text-muted);
        }

        .breakdown-summary {
            text-align: center;
            margin-bottom: 1.5rem;
        }

        .breakdown-summary .primary-value {
            font-size: 2rem;
            font-weight: 700;
            color: #f8fafc;
        }

        .breakdown-summary .sub-label {
            font-size: 0.85rem;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: var(--text-muted);
        }

        .stacked-progress {
            display: flex;
            height: 14px;
            background: rgba(148, 163, 184, 0.15);
            border-radius: 999px;
            overflow: hidden;
            margin-bottom: 1rem;
        }

        .stacked-progress .segment {
            height: 100%;
        }

        .stacked-progress .segment.justified {
            background: rgba(56, 189, 248, 0.6);
        }

        .stacked-progress .segment.unjustified {
            background: rgba(248, 113, 113, 0.85);
        }

        .stacked-details {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
        }

        .stacked-details .detail-row {
            display: flex;
            justify-content: space-between;
            font-size: 0.86rem;
        }

        .stacked-details .detail-row span:last-child {
            font-weight: 600;
        }

        .trend-empty {
            text-align: center;
            padding: 2rem 1rem;
            color: var(--text-muted);
        }

        .icon-circle {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            font-size: 1.2rem;
        }

        .dashboard-header {
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            align-items: flex-end;
            gap: 1.25rem;
        }

        .dashboard-period-control {
            min-width: 220px;
        }

        .metric-grid {
            display: contents;
        }

        .metric-tile {
            display: flex;
            gap: 1rem;
            align-items: center;
            padding: 1.25rem;
            border-radius: 14px;
            background: rgba(15, 23, 42, 0.92);
            border: 1px solid var(--border-color);
            box-shadow: var(--shadow-sm);
            transition: transform 0.15s ease, border-color 0.2s ease;
        }

        .metric-tile:hover {
            transform: translateY(-2px);
            border-color: rgba(148, 163, 184, 0.25);
        }

        .metric-icon {
            width: 44px;
            height: 44px;
            border-radius: 12px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            font-size: 1.1rem;
            flex-shrink: 0;
        }

        .metric-label {
            font-size: 0.72rem;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--text-muted);
            font-weight: 600;
        }

        .metric-value {
            font-size: 1.9rem;
            font-weight: 700;
            color: #f8fafc;
            line-height: 1.1;
        }

        .metric-hint {
            font-size: 0.85rem;
            color: var(--text-muted);
            margin-top: 0.35rem;
        }

        .analytics-summary-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 1rem;
        }

        .analytics-tabs {
            display: flex;
            gap: 0.5rem;
            margin-bottom: 1.5rem;
            flex-wrap: wrap;
            list-style: none;
            padding-left: 0;
        }

        .analytics-tabs .nav-link {
            border-radius: 999px;
            color: var(--text-muted);
            background: rgba(148, 163, 184, 0.12);
            border: 1px solid transparent;
            padding: 0.45rem 1rem;
            font-weight: 600;
            transition: all 0.2s ease;
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
        }

        .analytics-tabs .nav-link:hover {
            color: #f8fafc;
            border-color: rgba(59, 130, 246, 0.2);
        }

        .analytics-tabs .nav-link.active {
            color: #f8fafc;
            background: rgba(59, 130, 246, 0.22);
            border-color: rgba(59, 130, 246, 0.35);
        }

        .analytics-card {
            transition: transform 0.2s ease, box-shadow 0.2s ease;
        }

        .analytics-card:not(.d-none):hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow-md);
        }

        .analytics-card.d-none {
            display: none !important;
        }

        .analytics-footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 1rem;
        }

        .analytics-pagination {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
        }

        .analytics-pagination button {
            min-width: 36px;
        }

        .analytics-pagination-status {
            font-size: 0.85rem;
            color: var(--text-muted);
        }


        .critical-filter-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 1rem;
        }

        .critical-custom-field,
        .critical-custom-actions {
            display: flex;
            flex-direction: column;
            transition: opacity 0.2s ease;
        }

        .critical-custom-field.d-none,
        .critical-custom-actions.d-none {
            opacity: 0;
        }

        .critical-students-list {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }

        .critical-student-card {
            border: 1px solid var(--border-color);
            border-radius: 16px;
            padding: 12px 16px;
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .critical-student-card .avatar {
            width: 42px;
            height: 42px;
            border-radius: 12px;
            background: rgba(99, 102, 241, 0.15);
            color: #c7d2fe;
            font-weight: 600;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        body[data-theme="light"] .critical-student-card .avatar {
            background: rgba(59, 130, 246, 0.15);
            color: #1e3a8a;
        }

        .critical-total-badge {
            font-size: 1rem;
            font-weight: 700;
        }

        .table-sort-trigger {
            border: none;
            background: none;
            color: inherit;
            font: inherit;
            padding: 0;
            display: inline-flex;
            align-items: center;
            gap: 0.25rem;
            cursor: pointer;
        }

        .table-sort-trigger:focus-visible {
            outline: 2px solid var(--bs-primary);
            outline-offset: 2px;
        }

        .table-sort-trigger .sort-indicator {
            font-size: 0.8em;
        }

        .table-sort-trigger.is-sorted {
            color: var(--bs-primary);
        }

        .history-custom-field,
        .history-custom-actions {
            transition: opacity 0.3s ease;
        }

        .history-custom-field.d-none,
        .history-custom-actions.d-none {
            opacity: 0;
        }
        
        .export-period-tabs {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 12px;
        }

        .period-pill {
            border-radius: 16px;
            border: 1px solid var(--border-color);
            background: rgba(99, 102, 241, 0.08);
            padding: 12px 16px;
            text-align: left;
            color: var(--text-muted);
            transition: all 0.2s ease;
        }

        .period-pill .pill-label {
            display: block;
            font-weight: 600;
            color: var(--text-color, #e2e8f0);
        }

        .period-pill small {
            display: block;
            color: var(--text-muted);
        }

        .period-pill.active {
            border-color: rgba(99, 102, 241, 0.7);
            background: rgba(99, 102, 241, 0.18);
            color: #fff;
        }

        .period-pill.active .pill-label {
            color: #fff;
        }

        body[data-theme="light"] .period-pill {
            background: rgba(59, 130, 246, 0.06);
        }

        .export-history-card {
            background: var(--card-bg);
            border: 1px solid var(--border-color);
            box-shadow: var(--shadow-sm);
        }

        .export-history-list {
            list-style: none;
            margin: 0;
            padding: 0;
        }

        .export-history-item {
            display: flex;
            align-items: flex-start;
            gap: 12px;
            padding: 14px 0;
            border-bottom: 1px solid var(--border-color);
        }

        .export-history-item:last-child {
            border-bottom: none;
        }

        .export-history-icon {
            width: 40px;
            height: 40px;
            border-radius: 12px;
            background: rgba(99, 102, 241, 0.16);
            color: #c7d2fe;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
        }

        body[data-theme="light"] .export-history-icon {
            background: rgba(59, 130, 246, 0.12);
            color: #1d4ed8;
        }

        .export-history-meta {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 4px;
            font-size: 12px;
        }

        .export-history-meta span {
            padding: 4px 8px;
            border-radius: 999px;
            background: rgba(99, 102, 241, 0.12);
            color: #c7d2fe;
        }

        body[data-theme="light"] .export-history-meta span {
            background: rgba(59, 130, 246, 0.12);
            color: #1d4ed8;
        }
        :root {
            --bs-primary: #2563eb;
            --bs-primary-rgb: 37, 99, 235;
            --bs-success: #16a34a;
            --bs-success-rgb: 22, 163, 74;
            --bs-warning: #f59e0b;
            --bs-warning-rgb: 245, 158, 11;
            --bs-danger: #dc2626;
            --bs-danger-rgb: 220, 38, 38;
            --bs-info: #0ea5e9;
            --bs-info-rgb: 14, 165, 233;
            --bg-body: #0b0b0f;
            --bg-panel: #12161f;
            --bg-card: #12161f;
            --bg-card-soft: #151a22;
            --bg-card-hover: #1b2230;
            --border-subtle: #262b36;
            --border-strong: #262b36;
            --border-color: #262b36;
            --text-main: #e5e7eb;
            --text-muted: #9ca3af;
            --accent: #2563eb;
            --accent-soft: rgba(37, 99, 235, 0.18);
            --accent-strong: #1d4ed8;
            --success: #16a34a;
            --warning: #f59e0b;
            --danger: #dc2626;
            --shadow-sm: 0 6px 24px rgba(0, 0, 0, 0.25);
            --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.25);
            --shadow-lg: 0 6px 24px rgba(0, 0, 0, 0.25);
            --radius-md: 10px;
            --radius-lg: 14px;
            --radius-xl: 16px;
        }

        body {
            font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
            font-size: 14px;
            background: var(--bg-body);
            color: var(--text-main);
        }

        .auth-screen {
            background: var(--bg-body);
        }

        .auth-card {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 14px;
            box-shadow: var(--shadow-md);
        }

        .auth-card .brand-mark {
            background: var(--accent);
            box-shadow: var(--shadow-sm);
        }

        .auth-card .form-control {
            background: var(--bg-card-soft);
            border: 1px solid var(--border-color);
            color: var(--text-main);
            border-radius: 10px;
        }

        .auth-alert {
            border: 1px solid rgba(220, 38, 38, 0.25);
            border-left: 3px solid var(--danger);
            background: rgba(220, 38, 38, 0.12);
            color: #fecaca;
        }

        .sidebar {
            background: var(--bg-panel);
            border-right: 1px solid var(--border-color);
            color: var(--text-main);
            box-shadow: var(--shadow-sm);
        }

        .sidebar-link {
            color: var(--text-muted);
        }

        .sidebar-link:hover {
            background: rgba(37, 99, 235, 0.12);
            color: var(--accent);
        }

        .sidebar-link.active {
            background: rgba(37, 99, 235, 0.18);
            color: #bfdbfe;
        }

        .content-header {
            background: var(--bg-panel);
            border-bottom: 1px solid var(--border-color);
        }

        .content-area {
            background: var(--bg-body);
        }

        .card {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 14px;
            box-shadow: var(--shadow-sm);
        }

        .dashboard-card,
        .dashboard-kpi-card,
        .history-entry,
        .critical-student-card,
        .attendance-card,
        .teacher-card,
        .student-card {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            box-shadow: var(--shadow-sm);
        }

        .table {
            color: var(--text-main);
        }

        .table thead th {
            color: var(--text-muted);
        }

        .table tbody tr:nth-child(even) {
            background: var(--bg-card-soft);
        }

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

        .table td,
        .table th {
            vertical-align: middle;
            line-height: 1.15;
        }

        .table-responsive {
            overflow-x: auto;
        }

        .attendance-day-cell {
            white-space: nowrap;
        }

        .export-toggle-card {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 16px;
            padding: 12px 14px;
            border: 1px solid var(--border-color);
            border-radius: 12px;
            background: var(--bg-card-soft);
        }

        .export-toggle-text {
            display: flex;
            flex-direction: column;
            gap: 4px;
            min-width: 0;
        }

        .export-toggle-text .form-check-label {
            font-weight: 600;
            margin-bottom: 0;
        }

        .export-toggle-text small {
            color: var(--text-muted);
            line-height: 1.3;
        }

        .export-toggle-card .form-check-input {
            width: 48px;
            height: 26px;
            margin-left: 0;
            cursor: pointer;
            border-radius: 999px;
            border: 1px solid var(--border-color);
            background-color: var(--bg-card-hover);
            background-image: radial-gradient(circle at 13px 13px, #e2e8f0 0 9px, transparent 10px);
            background-repeat: no-repeat;
            background-size: 48px 26px;
            transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
        }

        .export-toggle-card .form-check-input:focus {
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
        }

        .export-toggle-card .form-check-input:checked {
            background-color: var(--accent);
            border-color: var(--accent);
            background-image: radial-gradient(circle at 35px 13px, #ffffff 0 9px, transparent 10px);
        }


        .form-control,
        .form-select {
            background: var(--bg-card-soft);
            border: 1px solid var(--border-color);
            color: var(--text-main);
            border-radius: 10px;
        }

        .form-control:focus,
        .form-select:focus {
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
        }

        .btn-primary {
            background: var(--accent);
            border: 1px solid var(--accent);
            box-shadow: 0 4px 12px rgba(37, 99, 235, 0.18);
        }

        .btn-secondary,
        .btn-outline-secondary {
            background: var(--bg-card-soft);
            border: 1px solid var(--border-color);
            color: var(--text-main);
        }

        .btn-outline-primary {
            border-color: rgba(37, 99, 235, 0.35);
            color: var(--accent);
        }

        .btn-outline-primary:hover {
            background: rgba(37, 99, 235, 0.12);
            color: #bfdbfe;
        }

        .card-header,
        .card-footer {
            background: var(--bg-card-soft);
            border-color: var(--border-color);
        }

        .sidebar-group-label {
            color: var(--text-muted);
        }

        .dashboard-kpi-icon,
        .history-entry-icon,
        .export-history-icon {
            background: var(--bg-card-hover) !important;
            color: #e5e7eb !important;
        }

        .history-entry-icon.bg-success,
        .history-entry-icon.bg-warning,
        .history-entry-icon.bg-info,
        .history-entry-icon.bg-danger,
        .history-entry-icon.bg-primary,
        .history-entry-icon.bg-secondary {
            background: var(--bg-card-hover) !important;
            color: #e5e7eb !important;
        }

        .badge,
        .badge-soft,
        .history-chip {
            background: var(--bg-card-hover) !important;
            color: var(--text-main) !important;
            border: 1px solid var(--border-color);
        }

        .badge.bg-primary {
            background: rgba(37, 99, 235, 0.2) !important;
            color: #bfdbfe !important;
            border-color: rgba(37, 99, 235, 0.35);
        }

        .badge.bg-success {
            background: rgba(22, 163, 74, 0.2) !important;
            color: #bbf7d0 !important;
            border-color: rgba(22, 163, 74, 0.35);
        }

        .badge.bg-warning {
            background: rgba(245, 158, 11, 0.2) !important;
            color: #fde68a !important;
            border-color: rgba(245, 158, 11, 0.35);
        }

        .badge.bg-danger,
        .badge.bg-danger-subtle {
            background: rgba(220, 38, 38, 0.2) !important;
            color: #fecaca !important;
            border-color: rgba(220, 38, 38, 0.35);
        }

        .icon-muted {
            color: var(--text-muted);
        }

        .icon-accent {
            color: #bfdbfe;
        }

        .table,
        .table.table-dark {
            background: var(--bg-card);
            color: var(--text-main);
        }

        .table thead th {
            background: var(--bg-card-soft);
            color: var(--text-muted);
        }

        .table tbody tr:nth-child(even) {
            background: var(--bg-card-soft);
        }

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

        .dashboard-card,
        .dashboard-kpi-card,
        .history-entry,
        .export-history-card,
        .critical-student-card,
        .attendance-card,
        .teacher-card,
        .student-card {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            box-shadow: var(--shadow-sm);
        }

        .history-entry,
        .export-history-item {
            background: var(--bg-card);
            border-color: var(--border-color);
        }

        .export-history-meta span {
            background: var(--bg-card-soft);
            color: var(--text-muted);
        }

        .text-muted {
            color: var(--text-muted) !important;
        }
