/* Common CSS for Admin, Teacher, and Student Areas */
/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Variables for consistent colors */
:root {
    --primary-color: #2563eb; /* Modern blue */
    --secondary-color: #1f2937; /* Dark gray */
    --success-color: #10b981; /* Green */
    --warning-color: #f59e0b; /* Amber */
    --danger-color: #ef4444; /* Red */
    --light-bg: #ffffff;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --text-color: #111827;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 8px;
    --transition: all 0.2s ease;
    --content-max-width: 1800px;
    --content-gutter: 32px;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 14px;
    font-weight: 400;
}

body.theme-dark,
body.theme-system {
    transition: background .25s ease, color .25s ease;
}

@media (prefers-color-scheme: dark) {
    body.theme-system {
        --primary-color:#4f8cff;--light-bg:#181818;--white:#252526;--gray-50:#181818;--gray-100:#1f1f1f;--gray-200:#2d2d30;--gray-300:#3e3e42;--gray-400:#6e7681;--gray-500:#9da1a6;--gray-600:#b9bdc2;--gray-700:#d2d5d8;--gray-800:#e5e7eb;--gray-900:#f3f4f6;--text-color:#d4d4d4;--border-color:#3e3e42;--shadow-sm:0 1px 2px rgba(0,0,0,.24);--shadow:0 8px 22px rgba(0,0,0,.28);--shadow-md:0 14px 34px rgba(0,0,0,.34);--shadow-lg:0 24px 60px rgba(0,0,0,.42);
    }
}

body.theme-dark {
    --primary-color:#4f8cff;--light-bg:#181818;--white:#252526;--gray-50:#181818;--gray-100:#1f1f1f;--gray-200:#2d2d30;--gray-300:#3e3e42;--gray-400:#6e7681;--gray-500:#9da1a6;--gray-600:#b9bdc2;--gray-700:#d2d5d8;--gray-800:#e5e7eb;--gray-900:#f3f4f6;--text-color:#d4d4d4;--border-color:#3e3e42;--shadow-sm:0 1px 2px rgba(0,0,0,.24);--shadow:0 8px 22px rgba(0,0,0,.28);--shadow-md:0 14px 34px rgba(0,0,0,.34);--shadow-lg:0 24px 60px rgba(0,0,0,.42);
}

body.theme-dark {
    background:radial-gradient(circle at 18% 0,rgba(79,140,255,.08),transparent 30rem),var(--gray-50);
}

@media (prefers-color-scheme: dark) {
    body.theme-system {
        background:radial-gradient(circle at 18% 0,rgba(79,140,255,.08),transparent 30rem),var(--gray-50);
    }
}

body.theme-glass .sidebar,
body.theme-glass .header,
body.theme-glass .card,
body.theme-glass .stat-card,
body.theme-glass table,
body.theme-glass .btn {
    backdrop-filter: blur(16px) saturate(125%);
    -webkit-backdrop-filter: blur(16px) saturate(125%);
}

body.theme-glass .sidebar,
body.theme-glass .header,
body.theme-glass .card,
body.theme-glass .stat-card {
    background: color-mix(in srgb, var(--white) 84%, transparent);
}

body.theme-glass .btn {
    border: 1px solid rgba(148, 163, 184, .22);
    box-shadow: 0 12px 28px rgba(15, 23, 42, .10);
}

body.theme-reduced-motion *,
body.theme-reduced-motion *:before,
body.theme-reduced-motion *:after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Sidebar Styles - Modern Light Design */
.sidebar {
    background: var(--white);
    color: var(--text-color);
    width: 280px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    padding: 32px 24px;
    z-index: 1000;
    box-shadow: var(--shadow);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar h2 {
    margin-bottom: 32px;
    color: var(--text-color);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.025em;
}

.sidebar nav ul {
    list-style: none;
    min-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.sidebar nav ul li {
    margin: 4px 0;
}

.sidebar nav ul li a {
    color: var(--gray-600);
    text-decoration: none;
    display: block;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-weight: 500;
    font-size: 14px;
}

.sidebar nav ul li a:hover,
.sidebar nav ul li a.active {
    background: var(--gray-100);
    color: var(--text-color);
    transform: translateX(4px);
}

.sidebar nav ul li.logout-item {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.sidebar nav ul li.logout-item a {
    color: var(--gray-600);
}

.sidebar nav ul li.logout-item a:hover {
    background: var(--gray-100);
    color: var(--text-color);
}

/* Main Content */
.main-content {
    margin-left: 280px;
    padding: var(--content-gutter);
    min-height: 100vh;
    background: var(--gray-50);
    width: calc(100% - 280px);
}

/* One predictable content width on every teacher and student page. */
.main-content > * {
    width: 100%;
    max-width: var(--content-max-width);
    margin-left: auto;
    margin-right: auto;
}

/* Header */
.header {
    background: var(--white);
    padding: 32px;
    border-radius: var(--border-radius);
    margin-bottom: 32px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.header h1 {
    color: var(--text-color);
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.025em;
}

.header p {
    color: var(--gray-600);
    font-size: 16px;
    font-weight: 400;
}

/* Cards */
.card {
    background: var(--white);
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
}

.card h3 {
    margin-bottom: 16px;
    color: var(--text-color);
    font-size: 18px;
    font-weight: 600;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 8px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--white);
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    text-align: center;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow);
}

.stat-card h3 {
    color: var(--gray-600);
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card .number {
    font-size: 2.5em;
    font-weight: 700;
    color: var(--text-color);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    background: var(--white);
    border: 1px solid var(--border-color);
}

table th,
table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

table tbody tr {
    transition: var(--transition);
}

table tbody tr:hover {
    background: var(--gray-50);
}

table tbody tr:nth-child(even) {
    background: var(--gray-50);
}

.settings-release {
    color: var(--gray-500);
    font-size: 12px;
    letter-spacing: .02em;
    padding: 8px 2px 24px;
    text-align: center;
}

.page-toolbar {
    align-items: center;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 24px;
    padding: 16px 20px;
}

.week-task-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.week-task-list .assignment-item { margin: 0; }
.lesson-task { margin-top: 8px; padding: 7px 8px; border-radius: 6px; background: var(--gray-100); color: var(--gray-700); font-size: 12px; font-weight: 600; }

body.theme-dark .student-answer,
body.theme-dark .correct-answer,
body.theme-dark .success,
body.theme-dark .error,
body.theme-dark .urgent,
body.theme-system .student-answer,
body.theme-system .correct-answer,
body.theme-system .success,
body.theme-system .error,
body.theme-system .urgent {
    color: var(--text-color);
}

body.theme-dark .student-answer,
body.theme-system .student-answer {
    background: rgba(14, 165, 233, .12);
}

body.theme-dark .correct-answer,
body.theme-system .correct-answer,
body.theme-dark .success,
body.theme-system .success {
    background: rgba(16, 185, 129, .12);
}

body.theme-dark .error,
body.theme-system .error {
    background: rgba(239, 68, 68, .12);
}

body.theme-dark .urgent,
body.theme-system .urgent {
    background: rgba(245, 158, 11, .14) !important;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
    font-size: 14px;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    min-height: 44px;
    height: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    color: var(--text-color);
    background: var(--white);
    transition: var(--transition);
    font-family: inherit;
    line-height: 1.5;
}

input[type="checkbox"],
input[type="radio"] {
    height: auto;
    min-height: auto;
    width: auto;
    padding: 0;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: var(--gray-400);
}

body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea,
body.theme-system input,
body.theme-system select,
body.theme-system textarea {
    background: #1f1f1f;
    border-color: #3e3e42;
    color: var(--text-color);
    color-scheme: dark;
}

body.theme-dark input::placeholder,
body.theme-dark textarea::placeholder,
body.theme-system input::placeholder,
body.theme-system textarea::placeholder {
    color: #858585;
}

body.theme-dark .btn:not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning),
body.theme-system .btn:not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning) {
    background: #2d2d30;
    color: var(--text-color);
    border: 1px solid #3e3e42;
}

body.theme-dark .card,body.theme-dark .stat-card,body.theme-dark .clean-subject-card,body.theme-dark table,
body.theme-system .card,body.theme-system .stat-card,body.theme-system .clean-subject-card,body.theme-system table{border-color:var(--border-color)}
body.theme-dark .sidebar,body.theme-system .sidebar{background:#1f1f1f;border-right-color:#333337}
body.theme-dark .sidebar a:hover,body.theme-system .sidebar a:hover{background:#2a2d2e}
body.theme-dark .sidebar a.active,body.theme-system .sidebar a.active{background:#37373d;color:#fff}
body.theme-dark input:focus,body.theme-dark select:focus,body.theme-dark textarea:focus,
body.theme-system input:focus,body.theme-system select:focus,body.theme-system textarea:focus{border-color:#4f8cff;box-shadow:0 0 0 3px rgba(79,140,255,.16)}

textarea[readonly] {
    background: var(--gray-50);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    height: 44px;
    line-height: 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    text-align: center;
    min-width: 100px;
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

/* Badges */
.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.badge-primary {
    background: var(--primary-color);
    color: white;
}

.badge-success {
    background: var(--success-color);
    color: white;
}

.badge-warning {
    background: var(--warning-color);
    color: white;
}

.badge-danger {
    background: var(--danger-color);
    color: white;
}

/* Tabs */
.tabs {
    display: flex;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--white);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.tab {
    padding: 16px 24px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    font-weight: 500;
    flex: 1;
    text-align: center;
    font-size: 14px;
}

.tab:hover {
    background: var(--gray-50);
}

.tab.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--gray-50);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Question Cards for Grading */
.question-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.question-card h4 {
    color: var(--text-color);
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 600;
}

.answer-section {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: var(--border-radius);
}

.student-answer {
    background: #f0f9ff;
    border: 1px solid #0ea5e9;
}

.correct-answer {
    background: #f0fdf4;
    border: 1px solid #10b981;
}

.points-input {
    width: 80px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
}

/* Success and Error Messages */
.success {
    color: var(--success-color);
    margin: 16px 0;
    padding: 16px;
    background: #ecfdf5;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--success-color);
    font-weight: 500;
}

.error {
    color: var(--danger-color);
    margin: 16px 0;
    padding: 16px;
    background: #fef2f2;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--danger-color);
    font-weight: 500;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 240px;
    }

    .main-content {
        margin-left: 240px;
        padding: 24px;
        width: calc(100% - 240px);
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .header h1 {
        font-size: 28px;
    }

    .card,
    .stat-card {
        padding: 20px;
    }

    table th,
    table td {
        padding: 12px;
        font-size: 13px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
        width: 100%;
    }

    .tabs {
        flex-direction: column;
    }

    .tab {
        border-bottom: 1px solid var(--border-color);
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }

.p-0 { padding: 0; }
.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }

/* Specific Student Area Styles */
.subject-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    color: white;
    font-size: 12px;
    font-weight: 500;
    margin-right: 8px;
}

.performance-excellent {
    color: var(--success-color);
    font-weight: 600;
}

.performance-good {
    color: var(--warning-color);
    font-weight: 600;
}

.performance-poor {
    color: var(--danger-color);
    font-weight: 600;
}

.performance-pending {
    color: var(--gray-500);
    font-style: italic;
}

.urgent {
    background: #fffbeb !important;
    border-left: 4px solid var(--warning-color);
}

/* Button Groups */
.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-group .btn {
    flex: 1;
    min-width: 120px;
}

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Focus States for Accessibility */
.btn:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .sidebar,
    .btn,
    .tabs {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    .card,
    .header {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}




















/* Login-spezifischer Container ohne Sidebar-Margin */
.login-content {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 40px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin: 0 auto;
    max-width: 800px;
}
.clean-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

/* Carddesign */
.clean-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    margin-bottom: 16px;
}

.clean-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.clean-subject-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

/* Farbiger Rand der komplett durchgeht */
.clean-subject-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--subject-color, var(--primary-color));
}

.clean-subject-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Kopfbereich */
.subject-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.subject-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* Beschreibung */
.subject-desc {
    color: var(--gray-600);
    font-size: 14px;
    margin: 12px 0 16px;
}

/* Footer */
.subject-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.performance-label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-color);
}

.no-perf {
    font-size: 13px;
    color: var(--gray-500);
}

/* Farben für Leistungswerte */
.performance-value.performance-excellent {
    color: var(--success-color);
    font-weight: 600;
}

.performance-value.performance-good {
    color: var(--warning-color);
    font-weight: 600;
}

.performance-value.performance-poor {
    color: var(--danger-color);
    font-weight: 600;
}

/* Status Classes for Exams and Assignments */
.status-upcoming {
    color: var(--warning-color);
    font-weight: 600;
    font-size: 14px;
}

.status-active {
    color: var(--success-color);
    font-weight: 600;
    font-size: 14px;
}

.status-expired {
    color: var(--gray-500);
    font-weight: 600;
    font-size: 14px;
}

.status-completed {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 14px;
}

/* Status Badges for Submissions */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-graded {
    background: var(--success-color);
    color: var(--white);
}

.status-pending {
    background: var(--warning-color);
    color: var(--white);
}

/* StudyGrid UI refresh --------------------------------------------------- */
:root {
    --surface-elevated: rgba(255, 255, 255, .96);
    --surface-muted: #f8fafc;
    --focus-ring: rgba(37, 99, 235, .16);
    --radius-sm: 7px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-card: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .045);
    --shadow-card-hover: 0 2px 4px rgba(15, 23, 42, .05), 0 14px 34px rgba(15, 23, 42, .075);
}

html {
    scroll-behavior: smooth;
}

body {
    background:
        radial-gradient(circle at 100% 0, rgba(37, 99, 235, .045), transparent 30rem),
        var(--gray-50);
    letter-spacing: -.006em;
}

/* Navigation: clearer selection, less visual movement. */
.sidebar {
    padding: 28px 20px 22px;
    box-shadow: 4px 0 24px rgba(15, 23, 42, .035);
}

.sidebar h2 {
    margin: 0 8px 26px;
    font-size: 19px;
    font-weight: 700;
}

.sidebar nav {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) transparent;
}

.sidebar nav ul {
    min-height: 100%;
    gap: 3px;
}

.sidebar nav ul li {
    margin: 0;
}

.sidebar nav ul li a {
    position: relative;
    padding: 11px 13px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    line-height: 1.35;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.sidebar nav ul li a:hover {
    transform: none;
    border-color: var(--border-color);
    background: var(--gray-50);
}

.sidebar nav ul li a.active {
    transform: none;
    border-color: transparent;
    background: color-mix(in srgb, var(--primary-color) 10%, var(--white));
    color: var(--primary-color);
    box-shadow: none;
}

.sidebar nav ul li.logout-item {
    padding-top: 16px;
}

/* Page structure and hierarchy. */
.main-content {
    padding: clamp(20px, 2.4vw, 38px);
}

.header {
    position: relative;
    overflow: hidden;
    padding: clamp(24px, 3vw, 36px);
    margin-bottom: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.header h1 {
    font-size: clamp(26px, 3vw, 34px);
    line-height: 1.2;
}

.header p {
    font-size: 15px;
    line-height: 1.65;
}

.card,
.stat-card,
.clean-card,
.clean-subject-card,
.page-toolbar,
.question-card,
.table-container {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.card {
    padding: clamp(20px, 2.2vw, 28px);
}

.card:hover {
    box-shadow: var(--shadow-card-hover);
}

.card > h3:first-child {
    margin: 0 0 20px;
    padding: 0 0 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 17px;
    letter-spacing: -.015em;
}

.stats-grid,
.clean-grid,
.grid-auto,
.grid-2,
.grid-3 {
    gap: 18px;
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 22px;
    text-align: left;
}

.stat-card:hover,
.clean-card:hover,
.clean-subject-card:hover {
    transform: none;
    border-color: color-mix(in srgb, var(--primary-color) 22%, var(--border-color));
    box-shadow: var(--shadow-card-hover);
}

.stat-card h3 {
    margin-bottom: 8px;
    font-size: 12px;
    letter-spacing: .075em;
}

.stat-card .number {
    font-size: clamp(28px, 3vw, 38px);
    line-height: 1.15;
}

.clean-subject-card {
    padding: 20px 22px;
}

/* Dense data stays readable without looking spreadsheet-heavy. */
.table-container {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    background: var(--white);
}

table {
    margin-top: 14px;
    border-collapse: separate;
    border-spacing: 0;
    box-shadow: none;
}

.table-container table {
    margin: 0;
    border: 0;
    border-radius: inherit;
}

table th {
    padding: 13px 16px;
    font-size: 11px;
    letter-spacing: .075em;
    color: var(--gray-600);
}

table td {
    padding: 14px 16px;
    vertical-align: middle;
}

table tbody tr:nth-child(even) {
    background: color-mix(in srgb, var(--gray-50) 62%, transparent);
}

table tbody tr:hover {
    background: color-mix(in srgb, var(--primary-color) 5%, var(--white));
}

table tbody tr:last-child td {
    border-bottom: 0;
}

/* Forms and actions. */
label {
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 600;
}

input,
select,
textarea {
    border-radius: var(--radius-md);
    background: var(--surface-muted);
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--gray-300);
}

input:focus,
select:focus,
textarea:focus {
    background: var(--white);
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.btn {
    min-width: 0;
    height: 42px;
    padding: 10px 17px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, .11);
}

.btn:active {
    transform: translateY(0) scale(.985);
}

.badge,
.status-badge {
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: .015em;
}

.tabs {
    width: fit-content;
    max-width: 100%;
    gap: 4px;
    padding: 5px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--gray-100);
    box-shadow: none;
    overflow-x: auto;
}

.tab {
    flex: 0 0 auto;
    padding: 9px 16px;
    border: 0;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.tab.active {
    background: var(--white);
    color: var(--primary-color);
    box-shadow: 0 1px 4px rgba(15, 23, 42, .09);
}

.tab-content.active {
    animation: none;
}

/* System-light must not inherit the legacy forced dark component colors. */
@media (prefers-color-scheme: light) {
    body.theme-system .sidebar {
        background: var(--white);
        border-right-color: var(--border-color);
    }

    body.theme-system .sidebar nav ul li a:hover {
        background: var(--gray-50);
        color: var(--text-color);
    }

    body.theme-system .sidebar nav ul li a.active {
        border-color: transparent;
        background: color-mix(in srgb, var(--primary-color) 10%, var(--white));
        color: var(--primary-color);
    }

    body.theme-system input,
    body.theme-system select,
    body.theme-system textarea {
        background: var(--surface-muted);
        border-color: var(--border-color);
        color: var(--text-color);
        color-scheme: light;
    }

    body.theme-system input:focus,
    body.theme-system select:focus,
    body.theme-system textarea:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 4px var(--focus-ring);
    }

    body.theme-system .btn:not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning) {
        background: var(--white);
        color: var(--text-color);
        border-color: var(--border-color);
    }
}

body.theme-dark {
    --surface-elevated: rgba(37, 37, 38, .94);
    --surface-muted: #1f1f1f;
    --focus-ring: rgba(79, 140, 255, .18);
}

body.theme-dark .sidebar nav ul li a.active {
    border-color: transparent;
    background: rgba(79, 140, 255, .13);
    color: #8bb4ff;
    box-shadow: none;
}

body.theme-dark .sidebar nav ul li a:hover {
    background: var(--gray-200);
    color: var(--text-color);
}

body.theme-dark .sidebar nav ul li a.active:hover {
    background: rgba(79, 140, 255, .13);
    color: #8bb4ff;
}

body.theme-dark .header,
body.theme-dark .card,
body.theme-dark .stat-card,
body.theme-dark .clean-card,
body.theme-dark .clean-subject-card,
body.theme-dark .page-toolbar,
body.theme-dark .table-container {
    background: var(--surface-elevated);
}

@media (prefers-color-scheme: dark) {
    body.theme-system {
        --surface-elevated: rgba(37, 37, 38, .94);
        --surface-muted: #1f1f1f;
        --focus-ring: rgba(79, 140, 255, .18);
    }

    body.theme-system .sidebar nav ul li a.active {
        border-color: transparent;
        background: rgba(79, 140, 255, .13);
        color: #8bb4ff;
        box-shadow: none;
    }

    body.theme-system .sidebar nav ul li a:hover {
        background: var(--gray-200);
        color: var(--text-color);
    }

    body.theme-system .sidebar nav ul li a.active:hover {
        background: rgba(79, 140, 255, .13);
        color: #8bb4ff;
    }

    body.theme-system .header,
    body.theme-system .card,
    body.theme-system .stat-card,
    body.theme-system .clean-card,
    body.theme-system .clean-subject-card,
    body.theme-system .page-toolbar,
    body.theme-system .table-container {
        background: var(--surface-elevated);
    }
}

body.theme-glass .header,
body.theme-glass .card,
body.theme-glass .stat-card,
body.theme-glass .page-toolbar {
    background: color-mix(in srgb, var(--surface-elevated) 88%, transparent);
    border-color: color-mix(in srgb, var(--border-color) 72%, transparent);
}

@media (max-width: 768px) {
    .sidebar {
        padding: 24px 16px 18px;
    }

    .main-content {
        padding: 22px;
    }

    .header,
    .card,
    .stat-card {
        padding: 20px;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .sidebar {
        padding: 18px 14px;
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar h2 {
        margin-bottom: 14px;
    }

    .sidebar nav ul {
        min-height: 0;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 5px;
    }

    .sidebar nav ul li.logout-item {
        margin-top: 0;
        padding-top: 5px;
        border-top: 0;
    }

    .sidebar nav ul li a {
        height: 100%;
        padding: 10px 11px;
    }

    .main-content {
        padding: 14px;
    }

    .header {
        margin-bottom: 16px;
    }

    .tabs {
        width: 100%;
        flex-direction: row;
    }

    .tab {
        flex: 1 0 auto;
        border-bottom: 0;
    }

    .btn-group .btn {
        min-width: min(120px, 100%);
    }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

