@import url('https://fonts.googleapis.com/css2?family=Roboto+Flex:opsz,wght@8..144,300..700&display=swap');

:root {
    --primary: #2c5282;
    --primary-dark: #1a365d;
    --primary-light: #4a90c2;
    --secondary: #d97706;
    --success: #059669;
    --danger: #dc2626;
    --warning: #f59e0b;
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f3f4f6;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
    --toast-info: #2563eb;
    --toast-success: #059669;
    --toast-warning: #d97706;
    --toast-danger: #dc2626;
}

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

body {
    font-family: 'Roboto Flex', sans-serif;
    font-optical-sizing: auto;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: inherit;
    font-weight: 650;
    line-height: 1.2;
    color: var(--primary-dark);
    letter-spacing: -0.015em;
}

/* Authentication Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: float 20s infinite ease-in-out;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-30px, 30px) rotate(5deg); }
}

.auth-box {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 50px;
    width: 100%;
    max-width: 450px;
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-box h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--primary-dark);
}

.auth-box p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* Navigation */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border);
    padding: 0;
    box-shadow: var(--shadow-sm);
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    height: 70px;
}

.navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;          /* space between image and text */
    text-decoration: none;
    color: var(--primary);
    font-weight: 700;
    font-size: 1.5rem;
}

.navbar-logo {
    height: 60px;      /* adjust to taste */
    width: auto;
    display: block;
}

.navbar-brand-text {
    line-height: 1;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.user-role {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Navbar Menu */
.navbar-menu {
    display: flex;
    gap: 5px;
    margin-left: 30px;
}

.navbar-link {
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    position: relative;
}

.navbar-link:hover {
    background: rgba(44, 82, 130, 0.08);
    color: var(--primary);
}

.navbar-link.active {
    background: var(--primary);
    color: white;
}

.navbar-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: var(--primary-light);
    border-radius: 2px;
}

/* Main Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 30px;
}

.dashboard-header {
    margin-bottom: 40px;
}

.dashboard-header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
}

.dashboard-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Generic 2-column layout for dashboard cards */
.dashboard-row {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: stretch;      /* make children the same height */
}

/* Each card inside that row */
.dashboard-row .card {
    flex: 1 1 320px;           /* grow/shrink nicely, min width for mobile */
    display: flex;
    flex-direction: column;    /* so header/body stack */
}

/* Make the body fill the remaining height so both cards match */
.dashboard-row .card-body {
    flex: 1;
}

/* On small screens, stack them again */
@media (max-width: 900px) {
    .dashboard-row {
        grid-template-columns: 1fr;
    }
}


/* Cards */
.card {
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

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

.card-header {
    padding: 18px 24px;
    border-bottom: 2px solid var(--bg-tertiary);
}

.card-header h2 {
    font-size: 1.5rem;
    color: var(--primary-dark);
}

.card-body {
    padding: 20px 24px; /* was 30px */

}

.grade-quick-btn {
    background: #e5e7eb;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    cursor: pointer;
}

.grade-quick-btn.active {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
}
#live-notifications {
    position: fixed;
    top: 88px;
    right: 24px;
    z-index: 1500;
    width: min(380px, calc(100vw - 32px));
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

#live-notifications .live-notification {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 16px 16px 14px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: transform 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease;
}

#live-notifications .live-notification.is-hiding {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
}

#live-notifications .live-notification__icon {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 0.95rem;
    font-weight: 800;
    color: white;
}

#live-notifications .live-notification__body {
    min-width: 0;
    flex: 1;
}

#live-notifications .live-notification__eyebrow {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

#live-notifications .live-notification__message {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.45;
    word-break: break-word;
}

#live-notifications .live-notification__meta {
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

#live-notifications .live-notification__dismiss {
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
    transition: background 0.2s ease, color 0.2s ease;
}

#live-notifications .live-notification__dismiss:hover {
    background: rgba(15, 23, 42, 0.06);
    color: var(--text-primary);
}

#live-notifications .live-notification--info {
    border-left-color: var(--toast-info);
}

#live-notifications .live-notification--info .live-notification__icon {
    background: var(--toast-info);
}

#live-notifications .live-notification--success {
    border-left-color: var(--toast-success);
}

#live-notifications .live-notification--success .live-notification__icon {
    background: var(--toast-success);
}

#live-notifications .live-notification--warning {
    border-left-color: var(--toast-warning);
}

#live-notifications .live-notification--warning .live-notification__icon {
    background: var(--toast-warning);
}

#live-notifications .live-notification--danger {
    border-left-color: var(--toast-danger);
}

#live-notifications .live-notification--danger .live-notification__icon {
    background: var(--toast-danger);
}

@media (max-width: 640px) {
    #live-notifications {
        top: 76px;
        right: 16px;
        left: 16px;
        width: auto;
    }
}

.unlock-banner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 18px 20px;
    margin-bottom: 18px;
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.08), rgba(255, 255, 255, 0.98));
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.unlock-banner__icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--toast-info);
    color: #fff;
    font-weight: 800;
    font-size: 1.2rem;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.24);
}

.unlock-banner__content {
    min-width: 0;
}

.unlock-banner__eyebrow {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--toast-info);
    margin-bottom: 4px;
}

.unlock-banner__title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.unlock-banner__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.unlock-banner__chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-dark);
    font-size: 0.84rem;
    font-weight: 700;
}

.unlock-banner__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

@media (max-width: 720px) {
    .unlock-banner {
        grid-template-columns: 1fr;
        justify-items: start;
    }

    .unlock-banner__actions {
        width: 100%;
        justify-content: flex-start;
    }
}

.q-close-btn{
  border:0;
  background:transparent;
  font-size:1rem;
  font-weight:900;
  cursor:pointer;
  padding:6px 10px;
  border-radius:8px;
  color: var(--text-secondary);
}
.q-close-btn:hover{ background: rgba(0,0,0,.06); color: #111; }


/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}


.stat-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid var(--border, #e5e7eb);
    padding: 0.75rem 1rem;              /* smaller padding */
    min-height: auto;                   /* don't force tall cards */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.stat-card:nth-child(1) {
    /* Total Questions */
    border-left-color: #3b82f6; /* blue */
}
.stat-card.success {
    border-left-color: var(--success);
}

.stat-card.warning {
    border-left-color: var(--warning);
}

.stat-card.danger {
    border-left-color: var(--danger);
}

.stat-label {
    font-size: 0.7rem;                  /* smaller label */
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 0.15rem;
}

.stat-value {
    font-size: 1.25rem;                 /* slightly smaller than before */
    font-weight: 700;
}

/* Forms */
.form-group {
    margin-bottom: 25px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1);
}

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

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}

.file-input-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 2px dashed var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-input-label:hover {
    border-color: var(--primary);
    background: var(--bg-secondary);
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    left: -9999px;
}

/* Buttons */
.btn {
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-family: 'DM Sans', sans-serif;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
    background: var(--text-primary);
}

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

.btn-success:hover {
    background: #047857;
}

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

.btn-danger:hover {
    background: #b91c1c;
}

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

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

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

/* Questions List */
.questions-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.question-item {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 2px solid var(--border);
    overflow: hidden;
    transition: all 0.3s ease;
}

.question-item.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.question-header {
    padding: 20px 25px;
    background: var(--bg-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.question-header:hover {
    background: #e5e7eb;
}

.question-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.question-code {
    font-family: 'Crimson Pro', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    min-width: 60px;
}

.question-text {
    font-size: 1.05rem;
    color: var(--text-primary);
}

.question-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
}

.question-status.pending {
    background: #fef3c7;
    color: #92400e;
}

.question-status.approved {
    background: #d1fae5;
    color: #065f46;
}

.question-status.rejected {
    background: #fee2e2;
    color: #991b1b;
}

.question-status.not-answered {
    background: #f3f4f6;
    color: #6b7280;
}

.question-content {
    padding: 25px;
    border-top: 2px solid var(--border);
}

.submission-info {
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

thead th {
    background: var(--bg-tertiary);
    padding: 15px 20px;
    text-align: left;
    font-weight: 700;
    color: var(--primary-dark);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

tbody td {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

tbody tr:hover {
    background: var(--bg-tertiary);
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.auto-dismiss-alert {
    transition: opacity 0.28s ease, transform 0.28s ease, margin 0.28s ease, padding 0.28s ease;
}

.auto-dismiss-alert.is-dismissing {
    opacity: 0;
    transform: translateY(-6px);
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success);
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid var(--primary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 25px 30px;
    border-bottom: 2px solid var(--border);
}

.modal-header h2 {
    font-size: 1.8rem;
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 2px solid var(--border);
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-gap {
    display: flex;
    gap: 15px;
}
/* Short line in header */
.question-text-short {
    font-size: 0.95rem;
    color: #4b5563;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Full description inside expanded area */
.question-full-text {
    font-size: 0.95rem;
    color: #374151;
    line-height: 1.4;
    margin-bottom: 10px;
}

/* Slight divider between title row and body */
.question-content {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px dashed #e5e7eb;

}

.question-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
}

/* Left side: code + short text */
.question-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;           /* important so text can truncate */
}

/* Question code */
.question-code {
    font-weight: 700;
    color: #1f2933;
    white-space: nowrap;
}

/* Short text in row */
.question-text-short {
    font-size: 0.95rem;
    color: #4b5563;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.question-status {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 999px;
    white-space: nowrap;
}

/* colours per status */
.question-status.approved,
.question-status.graded {
    background: #dcfce7;
    color: #166534;
}

.question-status.pending {
    background: #fef9c3;
    color: #92400e;
}

.question-status.rejected {
    background: #fee2e2;
    color: #b91c1c;
}

.question-status.not-answered {
    background: #e5e7eb;
    color: #4b5563;
}
@media (max-width: 640px) {
    .question-header {
        align-items: flex-start;
    }

    .question-status {
        margin-left: auto; /* push it to the right even when title wraps */
    }
}

/* Mobile tweaks */
@media (max-width: 640px) {
    .question-text-short {
        font-size: 0.9rem;
    }
    .question-full-text {
        font-size: 0.9rem;
    }
}


/* Responsive */
@media (max-width: 768px) {
    .auth-box {
        padding: 30px;
    }
    
    .navbar-container {
        padding: 0 15px;
    }
    
    .container {
        padding: 20px 15px;
    }
    
    
    .dashboard-header h1 {
        font-size: 2rem;
    }
     .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)); /* 2×2 grid */
        gap: 0.75rem;
    }

    .stat-card {
        padding: 0.6rem 0.7rem;
        border-radius: 10px;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    .stat-value {
        font-size: 1.1rem;
    }
}

/* Extra-small screens if you want it even tighter */
@media (max-width: 480px) {
    .stats-grid {
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.5rem 0.6rem;
    }
}

/* Material You theme layer */
:root {
    color-scheme: light;
    --primary: #006c4c;
    --primary-dark: #003827;
    --primary-light: #7fdcb8;
    --secondary: #4d6357;
    --success: #146c43;
    --danger: #ba1a1a;
    --warning: #8a5100;
    --bg-primary: #f7fbf6;
    --bg-secondary: #ffffff;
    --bg-tertiary: #eaf3ec;
    --surface: #ffffff;
    --surface-container-low: #f1f7f0;
    --surface-container: #eaf2e9;
    --surface-container-high: #e3ece2;
    --surface-tint: #006c4c;
    --text-primary: #17211b;
    --text-secondary: #526058;
    --text-muted: #68756d;
    --border: #d6e3da;
    --outline: #718078;
    --outline-variant: #c0cec5;
    --on-primary: #ffffff;
    --primary-container: #8df8c9;
    --on-primary-container: #002115;
    --secondary-container: #d0e8d8;
    --on-secondary-container: #0b1f16;
    --success-container: #b7f1c9;
    --danger-container: #ffdad6;
    --warning-container: #ffdcc2;
    --info-container: #cce6ff;
    --on-success-container: #00391f;
    --on-danger-container: #410002;
    --on-warning-container: #2c1600;
    --on-info-container: #001e30;
    --toast-info: #00658f;
    --toast-success: #146c43;
    --toast-warning: #8a5100;
    --toast-danger: #ba1a1a;
    --body-glow-primary: rgba(141, 248, 201, 0.55);
    --body-glow-info: rgba(204, 230, 255, 0.55);
    --body-gradient-start: #f7fbf6;
    --body-gradient-end: #eef7f0;
    --auth-glow-primary: rgba(141, 248, 201, 0.55);
    --auth-glow-info: rgba(204, 230, 255, 0.60);
    --auth-gradient-start: #eef7f0;
    --auth-gradient-end: #f8fcf7;
    --glass-surface: rgba(255, 255, 255, 0.88);
    --glass-surface-strong: rgba(255, 255, 255, 0.92);
    --glass-surface-soft: rgba(255, 255, 255, 0.62);
    --nav-surface: rgba(247, 251, 246, 0.86);
    --overlay-scrim: rgba(23, 33, 27, 0.48);
    --primary-hover: #00513a;
    --secondary-hover: #bfd8c8;
    --success-hover: #9edcaf;
    --danger-hover: #ffb4ab;
    --radius-xs: 10px;
    --radius-sm: 14px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --state-hover: rgba(0, 108, 76, 0.08);
    --state-press: rgba(0, 108, 76, 0.12);
    --shadow-sm: 0 1px 2px rgba(23, 33, 27, 0.08), 0 1px 3px rgba(23, 33, 27, 0.06);
    --shadow-md: 0 4px 12px rgba(23, 33, 27, 0.10), 0 1px 3px rgba(23, 33, 27, 0.08);
    --shadow-lg: 0 16px 36px rgba(23, 33, 27, 0.14), 0 4px 12px rgba(23, 33, 27, 0.10);
}

html {
    background: var(--bg-primary);
}

body {
    background:
        radial-gradient(circle at 12% -10%, var(--body-glow-primary), transparent 34rem),
        radial-gradient(circle at 95% 8%, var(--body-glow-info), transparent 30rem),
        linear-gradient(180deg, var(--body-gradient-start) 0%, var(--body-gradient-end) 100%);
    color: var(--text-primary);
    font-weight: 430;
}

body::selection {
    background: var(--primary-container);
    color: var(--on-primary-container);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--primary-dark);
    letter-spacing: -0.01em;
}

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

.auth-container {
    background:
        radial-gradient(circle at 20% 18%, var(--auth-glow-primary), transparent 24rem),
        radial-gradient(circle at 85% 75%, var(--auth-glow-info), transparent 26rem),
        linear-gradient(145deg, var(--auth-gradient-start) 0%, var(--auth-gradient-end) 100%);
}

.auth-container::before {
    background: radial-gradient(circle, rgba(0, 108, 76, 0.10) 0%, transparent 68%);
}

.auth-box {
    background: var(--glass-surface);
    border: 1px solid rgba(214, 227, 218, 0.85);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.auth-box h1 {
    color: var(--primary-dark);
}

.navbar {
    position: sticky;
    top: 0;
    z-index: 900;
    background: var(--nav-surface);
    border-bottom: 1px solid rgba(192, 206, 197, 0.70);
    box-shadow: none;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.navbar-container {
    min-height: 72px;
    height: auto;
    gap: 18px;
}

.navbar-brand {
    color: var(--primary-dark);
    border-radius: 999px;
    padding: 4px 10px 4px 4px;
}

.navbar-logo {
    height: 54px;
}

.navbar-menu {
    gap: 8px;
    padding: 6px;
    margin-left: 12px;
    background: var(--surface-container);
    border: 1px solid rgba(192, 206, 197, 0.70);
    border-radius: 999px;
}

.navbar-link {
    border-radius: 999px;
    color: var(--text-secondary);
    padding: 10px 18px;
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.navbar-link:hover {
    background: var(--state-hover);
    color: var(--primary);
}

.navbar-link.active {
    background: var(--secondary-container);
    color: var(--on-secondary-container);
    box-shadow: inset 0 0 0 1px rgba(0, 108, 76, 0.08);
}

.navbar-link.active::after {
    display: none;
}

.user-name {
    color: var(--text-primary);
}

.user-role {
    color: var(--primary);
    font-weight: 750;
}

.container {
    padding-top: 34px;
}

.dashboard-header {
    margin-bottom: 28px;
    padding: 28px clamp(20px, 4vw, 34px);
    background:
        linear-gradient(135deg, var(--state-hover), var(--glass-surface)),
        var(--surface-container-low);
    border: 1px solid rgba(192, 206, 197, 0.72);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.dashboard-header h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    color: var(--primary-dark);
}

.dashboard-header p {
    color: var(--text-secondary);
    max-width: 62rem;
}

.card,
.stat-card,
.question-item,
.submission-info,
.modal-content {
    background: var(--glass-surface);
    border: 1px solid rgba(214, 227, 218, 0.95);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.card {
    overflow: hidden;
}

.card:hover,
.stat-card:hover,
.question-item:hover {
    transform: none;
    box-shadow: var(--shadow-md);
}

.card-header {
    background: var(--surface-container-low);
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    color: var(--primary-dark);
}

.card-body {
    background: var(--glass-surface-soft);
}

.stats-grid {
    gap: 14px;
}

.stat-card {
    min-height: 92px;
    padding: 18px 20px;
    border-left: 0;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
    background: var(--primary);
    border-radius: 999px;
}

.stat-card:nth-child(1)::before {
    background: var(--toast-info);
}

.stat-card.success::before {
    background: var(--success);
}

.stat-card.warning::before {
    background: var(--warning);
}

.stat-card.danger::before {
    background: var(--danger);
}

.stat-label {
    color: var(--text-muted);
    font-weight: 750;
}

.stat-value {
    color: var(--primary-dark);
    font-size: 1.7rem;
    letter-spacing: -0.02em;
}

.form-label {
    color: var(--text-secondary);
    font-weight: 700;
}

.form-control,
select.form-control,
textarea.form-control {
    min-height: 52px;
    background: var(--surface);
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-family: inherit;
    box-shadow: inset 0 0 0 1px transparent;
}

.form-control:hover {
    border-color: var(--outline);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 108, 76, 0.12);
}

.file-input-label {
    background: var(--surface-container-low);
    border: 1px dashed var(--outline);
    border-radius: var(--radius-md);
}

.file-input-label:hover {
    background: var(--secondary-container);
    border-color: var(--primary);
}

.file-input-label.has-file {
    background: var(--info-container);
    border-color: var(--primary);
    color: var(--on-info-container);
}

.resource-upload-status {
    min-height: 1.25rem;
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 650;
}

.resource-upload-status.is-uploading {
    color: var(--primary-dark);
}

.resource-upload-status.is-complete {
    color: var(--on-success-container);
}

.resource-upload-status.is-error {
    color: var(--on-danger-container);
}

.resource-upload-progress {
    display: none;
    height: 8px;
    margin-top: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-container-high);
    border: 1px solid var(--outline-variant);
}

.resource-upload-progress.is-active {
    display: block;
}

.resource-upload-progress > div {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
    transition: width 0.16s ease;
}

.recap-fieldset {
    width: auto;
    max-width: 100%;
}

.recap-grid {
    align-items: start;
}

@media (max-width: 700px) {
    .recap-grid {
        grid-template-columns: 1fr !important;
    }
}

.btn {
    min-height: 42px;
    padding: 10px 22px;
    border-radius: 999px;
    font-family: inherit;
    font-weight: 750;
    line-height: 1;
    box-shadow: none;
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    color: var(--on-primary);
    box-shadow: 0 2px 6px rgba(0, 108, 76, 0.22);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(0, 108, 76, 0.26);
}

.btn-secondary {
    background: var(--secondary-container);
    color: var(--on-secondary-container);
}

.btn-secondary:hover {
    background: var(--secondary-hover);
}

.btn-success {
    background: var(--success-container);
    color: var(--on-success-container);
}

.btn-success:hover {
    background: var(--success-hover);
}

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

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

.btn-warning {
    background: var(--warning-container);
    color: var(--on-warning-container);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--outline);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--state-hover);
    color: var(--primary);
}

.grade-quick-btn {
    min-height: 36px;
    padding: 8px 14px;
    background: var(--surface-container);
    border: 1px solid var(--outline-variant);
    color: var(--text-secondary);
    border-radius: 999px;
    font-weight: 700;
}

.grade-quick-btn:hover {
    background: var(--state-hover);
}

.grade-quick-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--on-primary);
}

.question-item {
    border-radius: var(--radius-md);
}

.question-header {
    background: var(--surface-container-low);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    transition: background-color 0.18s ease;
}

.question-header:hover {
    background: var(--surface-container);
}

.question-code {
    color: var(--primary);
    font-family: inherit;
    font-weight: 850;
}

.question-text,
.question-text-short,
.question-full-text {
    color: var(--text-secondary);
}

.question-content {
    background: var(--glass-surface-soft);
    border-top: 1px solid var(--border);
}

.submission-info {
    background: var(--surface-container-low);
    border-radius: var(--radius-md);
}

.question-status {
    border-radius: 999px;
    font-weight: 750;
    border: 1px solid transparent;
    min-width: 104px;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    flex: 0 0 auto;
}

.question-status.approved,
.question-status.graded {
    background: var(--success-container);
    color: var(--on-success-container);
}

.question-status.pending {
    background: var(--warning-container);
    color: var(--on-warning-container);
}

.question-status.rejected {
    background: var(--danger-container);
    color: var(--on-danger-container);
}

.question-status.not-answered {
    background: var(--surface-container-high);
    color: var(--text-secondary);
}

.table-wrapper {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
}

table {
    background: var(--surface);
}

thead th {
    background: var(--surface-container);
    color: var(--primary-dark);
    border-bottom: 1px solid var(--border);
}

tbody td {
    border-bottom: 1px solid var(--border);
}

tbody tr:hover {
    background: var(--surface-container-low);
}

.alert {
    border: 1px solid transparent;
    border-left-width: 0;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background: var(--success-container);
    color: var(--on-success-container);
    border-color: rgba(20, 108, 67, 0.20);
}

.alert-danger {
    background: var(--danger-container);
    color: var(--on-danger-container);
    border-color: rgba(186, 26, 26, 0.20);
}

.alert-warning {
    background: var(--warning-container);
    color: var(--on-warning-container);
    border-color: rgba(138, 81, 0, 0.20);
}

.alert-info {
    background: var(--info-container);
    color: var(--on-info-container);
    border-color: rgba(0, 101, 143, 0.20);
}

.modal {
    background: var(--overlay-scrim);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
}

.modal-header,
.modal-footer {
    background: var(--surface-container-low);
    border-color: var(--border);
}

.modal-header h2 {
    color: var(--primary-dark);
}

#live-notifications .live-notification {
    background: var(--glass-surface-strong);
    border: 1px solid rgba(214, 227, 218, 0.90);
    border-left-width: 6px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

#live-notifications .live-notification__icon {
    color: var(--on-primary);
}

#live-notifications .live-notification__dismiss:hover {
    background: var(--state-hover);
    color: var(--primary);
}

.unlock-banner {
    background: linear-gradient(135deg, var(--primary-container), var(--glass-surface-strong));
    border-color: rgba(0, 108, 76, 0.20);
    border-radius: var(--radius-lg);
}

.unlock-banner__icon {
    background: var(--primary);
    border-radius: 16px;
}

.unlock-banner__eyebrow {
    color: var(--primary);
}

.unlock-banner__chip {
    background: var(--primary-container);
    color: var(--on-primary-container);
}

.q-close-btn {
    border-radius: 999px;
}

.q-close-btn:hover {
    background: var(--state-hover);
    color: var(--primary);
}

.theme-toggle {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1600;
    min-width: 72px;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid var(--outline-variant);
    border-radius: 999px;
    background: var(--glass-surface-strong);
    color: var(--primary);
    box-shadow: var(--shadow-md);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.theme-toggle:hover {
    background: var(--secondary-container);
    color: var(--on-secondary-container);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --primary: #8df8c9;
    --primary-dark: #c6ffdf;
    --primary-light: #67dba7;
    --secondary: #b4ccbd;
    --success: #9bd9aa;
    --danger: #ffb4ab;
    --warning: #ffb86b;
    --bg-primary: #0d1511;
    --bg-secondary: #111d17;
    --bg-tertiary: #1b2721;
    --surface: #111d17;
    --surface-container-low: #17231d;
    --surface-container: #1d2923;
    --surface-container-high: #27332d;
    --surface-tint: #8df8c9;
    --text-primary: #e0e6df;
    --text-secondary: #c0cbc2;
    --text-muted: #93a099;
    --border: #3f4a44;
    --outline: #89978f;
    --outline-variant: #3f4a44;
    --on-primary: #003827;
    --primary-container: #00513a;
    --on-primary-container: #c6ffdf;
    --secondary-container: #354a3e;
    --on-secondary-container: #d0e8d8;
    --success-container: #124f2e;
    --danger-container: #93000a;
    --warning-container: #693a00;
    --info-container: #004c6d;
    --on-success-container: #c7ffd5;
    --on-danger-container: #ffdad6;
    --on-warning-container: #ffdcc2;
    --on-info-container: #cce6ff;
    --toast-info: #8ccdff;
    --toast-success: #9bd9aa;
    --toast-warning: #ffb86b;
    --toast-danger: #ffb4ab;
    --body-glow-primary: rgba(141, 248, 201, 0.18);
    --body-glow-info: rgba(140, 205, 255, 0.12);
    --body-gradient-start: #0d1511;
    --body-gradient-end: #101914;
    --auth-glow-primary: rgba(141, 248, 201, 0.20);
    --auth-glow-info: rgba(140, 205, 255, 0.14);
    --auth-gradient-start: #0d1511;
    --auth-gradient-end: #14211a;
    --glass-surface: rgba(17, 29, 23, 0.88);
    --glass-surface-strong: rgba(27, 39, 33, 0.94);
    --glass-surface-soft: rgba(17, 29, 23, 0.58);
    --nav-surface: rgba(13, 21, 17, 0.88);
    --overlay-scrim: rgba(4, 8, 6, 0.66);
    --primary-hover: #a9ffd6;
    --secondary-hover: #40564a;
    --success-hover: #1c653b;
    --danger-hover: #b3261e;
    --state-hover: rgba(141, 248, 201, 0.10);
    --state-press: rgba(141, 248, 201, 0.16);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28), 0 1px 3px rgba(0, 0, 0, 0.20);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.34), 0 2px 6px rgba(0, 0, 0, 0.24);
    --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.42), 0 6px 16px rgba(0, 0, 0, 0.30);
}

:root[data-theme="dark"] .btn-primary:hover {
    color: var(--on-primary);
}

:root[data-theme="dark"] .btn-success:hover,
:root[data-theme="dark"] .btn-danger:hover {
    color: var(--text-primary);
}

:root[data-theme="dark"] img:not(.navbar-logo) {
    filter: saturate(0.96);
}

:root[data-theme="dark"] body [style*="background: white"],
:root[data-theme="dark"] body [style*="background:white"],
:root[data-theme="dark"] body [style*="background: #fff"],
:root[data-theme="dark"] body [style*="background:#fff"],
:root[data-theme="dark"] body [style*="background: #ffffff"],
:root[data-theme="dark"] body [style*="background:#ffffff"],
:root[data-theme="dark"] body [style*="background:#f9fafb"],
:root[data-theme="dark"] body [style*="background: #f9fafb"],
:root[data-theme="dark"] body [style*="background:#f3f4f6"],
:root[data-theme="dark"] body [style*="background: #f3f4f6"],
:root[data-theme="dark"] body [style*="background: #f0f9ff"],
:root[data-theme="dark"] body [style*="background:#f0f9ff"],
:root[data-theme="dark"] body [style*="background: #fffbeb"],
:root[data-theme="dark"] body [style*="background:#fffbeb"],
:root[data-theme="dark"] body [style*="background:#dbeafe"],
:root[data-theme="dark"] body [style*="background: #dbeafe"] {
    background: var(--surface-container) !important;
    color: var(--text-primary) !important;
    border-color: var(--outline-variant) !important;
}

:root[data-theme="dark"] body [style*="color: #6b7280"],
:root[data-theme="dark"] body [style*="color:#6b7280"],
:root[data-theme="dark"] body [style*="color: #4b5563"],
:root[data-theme="dark"] body [style*="color:#4b5563"] {
    color: var(--text-muted) !important;
}

:root[data-theme="dark"] body [style*="color: #1e40af"],
:root[data-theme="dark"] body [style*="color:#1e40af"],
:root[data-theme="dark"] body [style*="color:#1e3a8a"],
:root[data-theme="dark"] body [style*="color: #1e3a8a"] {
    color: var(--primary) !important;
}

:root[data-theme="dark"] body [style*="border: 1px solid #bae6fd"],
:root[data-theme="dark"] body [style*="border:1px solid #bae6fd"],
:root[data-theme="dark"] body [style*="border: 2px solid #3b82f6"],
:root[data-theme="dark"] body [style*="border:2px solid #3b82f6"],
:root[data-theme="dark"] body [style*="border:1px solid #93c5fd"],
:root[data-theme="dark"] body [style*="border: 1px solid #93c5fd"] {
    border-color: var(--outline-variant) !important;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --primary: #8df8c9;
        --primary-dark: #c6ffdf;
        --primary-light: #67dba7;
        --secondary: #b4ccbd;
        --success: #9bd9aa;
        --danger: #ffb4ab;
        --warning: #ffb86b;
        --bg-primary: #0d1511;
        --bg-secondary: #111d17;
        --bg-tertiary: #1b2721;
        --surface: #111d17;
        --surface-container-low: #17231d;
        --surface-container: #1d2923;
        --surface-container-high: #27332d;
        --surface-tint: #8df8c9;
        --text-primary: #e0e6df;
        --text-secondary: #c0cbc2;
        --text-muted: #93a099;
        --border: #3f4a44;
        --outline: #89978f;
        --outline-variant: #3f4a44;
        --on-primary: #003827;
        --primary-container: #00513a;
        --on-primary-container: #c6ffdf;
        --secondary-container: #354a3e;
        --on-secondary-container: #d0e8d8;
        --success-container: #124f2e;
        --danger-container: #93000a;
        --warning-container: #693a00;
        --info-container: #004c6d;
        --on-success-container: #c7ffd5;
        --on-danger-container: #ffdad6;
        --on-warning-container: #ffdcc2;
        --on-info-container: #cce6ff;
        --toast-info: #8ccdff;
        --toast-success: #9bd9aa;
        --toast-warning: #ffb86b;
        --toast-danger: #ffb4ab;
        --body-glow-primary: rgba(141, 248, 201, 0.18);
        --body-glow-info: rgba(140, 205, 255, 0.12);
        --body-gradient-start: #0d1511;
        --body-gradient-end: #101914;
        --auth-glow-primary: rgba(141, 248, 201, 0.20);
        --auth-glow-info: rgba(140, 205, 255, 0.14);
        --auth-gradient-start: #0d1511;
        --auth-gradient-end: #14211a;
        --glass-surface: rgba(17, 29, 23, 0.88);
        --glass-surface-strong: rgba(27, 39, 33, 0.94);
        --glass-surface-soft: rgba(17, 29, 23, 0.58);
        --nav-surface: rgba(13, 21, 17, 0.88);
        --overlay-scrim: rgba(4, 8, 6, 0.66);
        --primary-hover: #a9ffd6;
        --secondary-hover: #40564a;
        --success-hover: #1c653b;
        --danger-hover: #b3261e;
        --state-hover: rgba(141, 248, 201, 0.10);
        --state-press: rgba(141, 248, 201, 0.16);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28), 0 1px 3px rgba(0, 0, 0, 0.20);
        --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.34), 0 2px 6px rgba(0, 0, 0, 0.24);
        --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.42), 0 6px 16px rgba(0, 0, 0, 0.30);
    }

    :root:not([data-theme="light"]) .btn-primary:hover {
        color: var(--on-primary);
    }

    :root:not([data-theme="light"]) .btn-success:hover,
    :root:not([data-theme="light"]) .btn-danger:hover {
        color: var(--text-primary);
    }

    :root:not([data-theme="light"]) img:not(.navbar-logo) {
        filter: saturate(0.96);
    }

    :root:not([data-theme="light"]) body [style*="background: white"],
    :root:not([data-theme="light"]) body [style*="background:white"],
    :root:not([data-theme="light"]) body [style*="background: #fff"],
    :root:not([data-theme="light"]) body [style*="background:#fff"],
    :root:not([data-theme="light"]) body [style*="background: #ffffff"],
    :root:not([data-theme="light"]) body [style*="background:#ffffff"],
    :root:not([data-theme="light"]) body [style*="background:#f9fafb"],
    :root:not([data-theme="light"]) body [style*="background: #f9fafb"],
    :root:not([data-theme="light"]) body [style*="background:#f3f4f6"],
    :root:not([data-theme="light"]) body [style*="background: #f3f4f6"],
    :root:not([data-theme="light"]) body [style*="background: #f0f9ff"],
    :root:not([data-theme="light"]) body [style*="background:#f0f9ff"],
    :root:not([data-theme="light"]) body [style*="background: #fffbeb"],
    :root:not([data-theme="light"]) body [style*="background:#fffbeb"],
    :root:not([data-theme="light"]) body [style*="background:#dbeafe"],
    :root:not([data-theme="light"]) body [style*="background: #dbeafe"] {
        background: var(--surface-container) !important;
        color: var(--text-primary) !important;
        border-color: var(--outline-variant) !important;
    }

    :root:not([data-theme="light"]) body [style*="color: #6b7280"],
    :root:not([data-theme="light"]) body [style*="color:#6b7280"],
    :root:not([data-theme="light"]) body [style*="color: #4b5563"],
    :root:not([data-theme="light"]) body [style*="color:#4b5563"] {
        color: var(--text-muted) !important;
    }

    :root:not([data-theme="light"]) body [style*="color: #1e40af"],
    :root:not([data-theme="light"]) body [style*="color:#1e40af"],
    :root:not([data-theme="light"]) body [style*="color:#1e3a8a"],
    :root:not([data-theme="light"]) body [style*="color: #1e3a8a"] {
        color: var(--primary) !important;
    }

    :root:not([data-theme="light"]) body [style*="border: 1px solid #bae6fd"],
    :root:not([data-theme="light"]) body [style*="border:1px solid #bae6fd"],
    :root:not([data-theme="light"]) body [style*="border: 2px solid #3b82f6"],
    :root:not([data-theme="light"]) body [style*="border:2px solid #3b82f6"],
    :root:not([data-theme="light"]) body [style*="border:1px solid #93c5fd"],
    :root:not([data-theme="light"]) body [style*="border: 1px solid #93c5fd"] {
        border-color: var(--outline-variant) !important;
    }
}

/* Dashboard density pass */
.container {
    padding: 22px 24px;
}

.dashboard-header {
    padding: 20px clamp(16px, 3vw, 24px);
    margin-bottom: 18px;
}

.dashboard-header h1 {
    font-size: clamp(1.8rem, 3vw, 2.35rem);
    margin-bottom: 6px;
}

.dashboard-header p {
    font-size: 1rem;
}

.stats-grid {
    gap: 10px;
    margin-bottom: 16px;
}

.stat-card {
    min-height: 72px;
    padding: 12px 14px;
}

.stat-card::before {
    width: 4px;
}

.stat-label {
    font-size: 0.68rem;
    margin-bottom: 2px;
}

.stat-value {
    font-size: 1.35rem;
}

.card-header {
    padding: 13px 18px;
}

.card-header h2 {
    font-size: 1.25rem;
}

.card-body {
    padding: 15px 18px;
}

.dashboard-row {
    gap: 16px;
}

.questions-list {
    gap: 12px;
}

.question-header {
    padding: 11px 14px;
}

.question-title {
    gap: 10px;
}

.question-code {
    font-size: 1.05rem;
    min-width: 48px;
}

.question-status {
    padding: 5px 10px;
    font-size: 0.8rem;
}

.question-content {
    padding: 14px;
    margin-top: 0;
}

.submission-info {
    padding: 14px;
    margin-bottom: 14px;
}

.table-wrapper {
    border-radius: var(--radius-sm);
}

thead th,
tbody td {
    padding: 10px 12px;
}

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

.form-label {
    margin-bottom: 6px;
}

.form-control,
select.form-control,
textarea.form-control {
    min-height: 44px;
    padding: 9px 12px;
}

textarea.form-control {
    min-height: 96px;
}

.btn {
    min-height: 38px;
    padding: 8px 16px;
}

.alert {
    padding: 12px 14px;
    margin-bottom: 14px;
}

.reviewed-submissions-header p {
    margin-top: 6px;
}

@media (max-width: 900px) {
    .navbar-container {
        min-height: 62px;
        gap: 10px;
    }

    .navbar-menu {
        padding: 4px;
        gap: 4px;
    }

    .navbar-link {
        padding: 8px 12px;
        font-size: 0.88rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 12px 10px;
    }

    .dashboard-header {
        padding: 14px 14px;
        margin-bottom: 12px;
        border-radius: var(--radius-sm);
    }

    .dashboard-header h1 {
        font-size: 1.55rem;
        margin-bottom: 3px;
    }

    .dashboard-header p {
        font-size: 0.9rem;
        line-height: 1.35;
    }

    .stats-grid {
        gap: 8px;
        margin-bottom: 12px;
    }

    .stat-card {
        min-height: 56px;
        padding: 8px 10px 8px 12px;
        border-radius: 12px;
    }

    .stat-label {
        font-size: 0.58rem;
        letter-spacing: 0.05em;
    }

    .stat-value {
        font-size: 1.05rem;
    }

    .card-header {
        padding: 11px 12px;
    }

    .card-header h2 {
        font-size: 1.08rem;
    }

    .card-body {
        padding: 12px;
    }

    .question-header {
        padding: 10px 11px;
        gap: 8px;
    }

    .question-title {
        gap: 8px;
        width: calc(100% - 86px);
    }

    .question-code {
        min-width: 40px;
        font-size: 0.95rem;
    }

    .question-text-short,
    .question-full-text {
        font-size: 0.86rem;
    }

    .question-status {
        padding: 4px 8px;
        font-size: 0.72rem;
        min-width: 86px;
    }

    .question-content,
    .submission-info {
        padding: 11px;
    }

    thead th,
    tbody td {
        padding: 8px 9px;
        font-size: 0.86rem;
    }

    .btn {
        min-height: 34px;
        padding: 7px 12px;
        font-size: 0.88rem;
    }

    .form-control,
    select.form-control,
    textarea.form-control {
        min-height: 40px;
        padding: 8px 10px;
        font-size: 0.94rem;
    }

    .theme-toggle {
        right: 10px;
        bottom: 10px;
        min-width: 62px;
        min-height: 36px;
        padding: 8px 12px;
        font-size: 0.78rem;
    }

    .card[style*="margin-top: 30px"],
    div[style*="margin-top: 30px"] {
        margin-top: 14px !important;
    }

    div[style*="margin-bottom: 40px"] {
        margin-bottom: 16px !important;
    }

    div[style*="margin-bottom: 30px"] {
        margin-bottom: 14px !important;
    }

    div[style*="padding: 50px"] {
        padding: 22px !important;
    }

    div[style*="padding: 30px"] {
        padding: 16px !important;
    }

    div[style*="padding: 25px"] {
        padding: 14px !important;
    }

    div[style*="padding: 20px"] {
        padding: 12px !important;
    }

    div[style*="gap: 30px"] {
        gap: 12px !important;
    }

    div[style*="gap: 20px"] {
        gap: 10px !important;
    }

    #reviewModal > div,
    #viewSubmissionModal > div {
        width: calc(100vw - 20px) !important;
        max-width: none !important;
        margin: 12px auto !important;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px 8px;
    }

    .stats-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }

    .stat-card {
        min-width: 0;
        padding: 7px 6px 7px 9px;
    }

    .stat-card::before {
        width: 3px;
    }

    .stat-label {
        font-size: 0.5rem;
        line-height: 1.1;
        white-space: normal;
    }

    .stat-value {
        font-size: 0.95rem;
        line-height: 1.1;
    }

    .dashboard-header {
        padding: 12px;
    }

    .dashboard-header h1 {
        font-size: 1.35rem;
    }
}

/* Dashboard density middle ground */
.dashboard-header {
    padding: 22px clamp(18px, 3vw, 28px);
}

.card-header {
    padding: 15px 20px;
}

.card-body {
    padding: 16px 20px;
}

.stat-card {
    min-height: 82px;
    padding: 14px 16px;
}

.stat-label {
    font-size: 0.72rem;
}

.stat-value {
    font-size: 1.5rem;
}

.question-header {
    padding: 12px 16px;
}

.question-content,
.submission-info {
    padding: 15px;
}

@media (max-width: 768px) {
    .dashboard-header {
        padding: 16px;
        margin-bottom: 14px;
    }

    .dashboard-header h1 {
        font-size: 1.7rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
        margin-bottom: 14px;
    }

    .stat-card {
        min-height: 58px;
        padding: 10px 12px;
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        column-gap: 10px;
    }

    .stat-label {
        font-size: 0.68rem;
        line-height: 1.15;
    }

    .stat-value {
        font-size: 1.25rem;
        line-height: 1;
    }

    .card-header {
        padding: 12px 14px;
    }

    .card-body {
        padding: 13px 14px;
    }

    .question-content,
    .submission-info {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px 10px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .stat-card {
        min-height: 54px;
        padding: 9px 10px 9px 12px;
    }

    .stat-label {
        font-size: 0.62rem;
        letter-spacing: 0.045em;
    }

    .stat-value {
        font-size: 1.15rem;
    }

    .question-status {
        min-width: 82px;
        font-size: 0.7rem;
        padding: 4px 7px;
    }

    .dashboard-header h1 {
        font-size: 1.5rem;
    }
}

/* Keep account identity visible in the top bar */
@media (max-width: 640px) {
    .navbar-container {
        gap: 8px;
    }

    .navbar-user {
        gap: 8px;
    }

    .user-info {
        display: block;
        text-align: right;
        max-width: 42vw;
        min-width: 0;
    }

    .user-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.82rem;
        line-height: 1.15;
    }

    .user-role {
        font-size: 0.62rem;
        line-height: 1.1;
        letter-spacing: 0.04em;
    }

    .navbar-user .btn {
        min-height: 32px;
        padding: 7px 10px;
        font-size: 0.78rem;
    }
}

@media (max-width: 900px) {
    .navbar-container {
        flex-wrap: wrap;
        justify-content: center;
        padding: 10px 16px;
    }

    .navbar-menu {
        order: 3;
        width: 100%;
        margin: 0;
        justify-content: center;
        overflow-x: auto;
    }

    .navbar-user {
        margin-left: auto;
    }
}

@media (max-width: 640px) {
    body {
        background:
            radial-gradient(circle at 12% -8%, var(--body-glow-primary), transparent 20rem),
            linear-gradient(180deg, var(--body-gradient-start) 0%, var(--body-gradient-end) 100%);
    }

    .auth-box {
        border-radius: var(--radius-md);
    }

    .navbar-container {
        justify-content: space-between;
    }

    .navbar-brand {
        max-width: 72px;
    }

    .navbar-logo {
        height: 46px;
    }

    .navbar-user {
        gap: 10px;
    }

    .user-info {
        display: none;
    }

    .dashboard-header {
        padding: 22px 18px;
        border-radius: var(--radius-md);
    }

    .card,
    .stat-card,
    .question-item {
        border-radius: var(--radius-sm);
    }

    .question-header {
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    .navbar-user .user-info {
        display: block;
        text-align: right;
        max-width: 42vw;
        min-width: 0;
    }
}

/* Palette refinement: Cospicua Quest navy, blue, and gold theme */
:root {
    --primary: #123A75;
    --primary-dark: #0B1E3D;
    --primary-light: #5AA3E8;
    --accent: #F2B43C;
    --secondary: #5C6880;
    --success: #1f7a4d;
    --danger: #ba1a1a;
    --warning: #F2B43C;
    --bg-primary: #F3F6FF;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #EEF3FF;
    --surface: #ffffff;
    --surface-container-low: #F7F9FF;
    --surface-container: #EEF3FF;
    --surface-container-high: #E4EBFA;
    --surface-tint: #123A75;
    --text-primary: #0B1E3D;
    --text-secondary: #5C6880;
    --text-muted: #71809A;
    --border: #D6DDEC;
    --outline: #7C8AA3;
    --outline-variant: #D6DDEC;
    --on-primary: #ffffff;
    --primary-container: #DCEBFF;
    --on-primary-container: #0B1E3D;
    --secondary-container: #E7ECF8;
    --on-secondary-container: #0B1E3D;
    --success-container: #c5f0d3;
    --danger-container: #ffdad6;
    --warning-container: #FFF0C8;
    --info-container: #DCEBFF;
    --on-success-container: #00391f;
    --on-danger-container: #410002;
    --on-warning-container: #5C3A00;
    --on-info-container: #0B1E3D;
    --toast-info: #1E5AA8;
    --toast-success: #1f7a4d;
    --toast-warning: #F2B43C;
    --toast-danger: #ba1a1a;
    --body-glow-primary: rgba(90, 163, 232, 0.34);
    --body-glow-info: rgba(242, 180, 60, 0.20);
    --body-gradient-start: #F3F6FF;
    --body-gradient-end: #EEF3FF;
    --auth-glow-primary: rgba(90, 163, 232, 0.34);
    --auth-glow-info: rgba(242, 180, 60, 0.24);
    --auth-gradient-start: #EEF3FF;
    --auth-gradient-end: #FFFFFF;
    --glass-surface: rgba(255, 255, 255, 0.90);
    --glass-surface-strong: rgba(255, 255, 255, 0.94);
    --glass-surface-soft: rgba(255, 255, 255, 0.68);
    --nav-surface: rgba(243, 246, 255, 0.90);
    --overlay-scrim: rgba(11, 30, 61, 0.50);
    --primary-hover: #1E5AA8;
    --secondary-hover: #DDE5F4;
    --success-hover: #a9deb9;
    --danger-hover: #ffb4ab;
    --state-hover: rgba(30, 90, 168, 0.09);
    --state-press: rgba(30, 90, 168, 0.14);
    --shadow-sm: 0 1px 2px rgba(11, 30, 61, 0.08), 0 1px 3px rgba(11, 30, 61, 0.06);
    --shadow-md: 0 4px 12px rgba(11, 30, 61, 0.10), 0 1px 3px rgba(11, 30, 61, 0.08);
    --shadow-lg: 0 16px 36px rgba(11, 30, 61, 0.14), 0 4px 12px rgba(11, 30, 61, 0.10);
}

.auth-container::before {
    background: radial-gradient(circle, rgba(30, 90, 168, 0.12) 0%, transparent 68%);
}

.auth-box,
.dashboard-header,
.card,
.stat-card,
.question-item,
.submission-info,
.modal-content,
#live-notifications .live-notification {
    border-color: var(--border);
}

.navbar,
.navbar-menu,
.unlock-banner {
    border-color: var(--outline-variant);
}

.form-control:focus {
    box-shadow: 0 0 0 4px rgba(30, 90, 168, 0.16);
}

.btn-primary {
    box-shadow: 0 2px 6px rgba(30, 90, 168, 0.22);
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(30, 90, 168, 0.26);
}

.reviewed-submissions-header {
    background: linear-gradient(135deg, var(--info-container), var(--surface-container-low)) !important;
    border-bottom: 3px solid var(--primary) !important;
}

.reviewed-submissions-header h2 {
    color: var(--primary-dark) !important;
}

.reviewed-submissions-header p {
    color: var(--text-secondary) !important;
    margin: 10px 0 0 0;
    font-size: 0.95rem;
}

.admin-comment-cell {
    color: var(--text-primary);
    font-weight: 600;
}

:root[data-theme="dark"] {
    --primary: #1E5AA8;
    --primary-dark: #5AA3E8;
    --primary-light: #5AA3E8;
    --accent: #F2B43C;
    --secondary: #B9C3D6;
    --success: #95d5a8;
    --danger: #ffb4ab;
    --warning: #F2B43C;
    --bg-primary: #0B1020;
    --bg-secondary: #121A2B;
    --bg-tertiary: #17223A;
    --surface: #121A2B;
    --surface-container-low: #17223A;
    --surface-container: #1B2944;
    --surface-container-high: #223152;
    --surface-tint: #1E5AA8;
    --text-primary: #F5F7FB;
    --text-secondary: #D6E6FF;
    --text-muted: #B9C3D6;
    --border: #2B3855;
    --outline: #6E7D9A;
    --outline-variant: #2B3855;
    --on-primary: #FFFFFF;
    --primary-container: #173C75;
    --on-primary-container: #DCEBFF;
    --secondary-container: #223152;
    --on-secondary-container: #F5F7FB;
    --success-container: #174b2e;
    --danger-container: #8c1d18;
    --warning-container: #6F4907;
    --info-container: #132447;
    --on-success-container: #c5f0d3;
    --on-danger-container: #ffdad6;
    --on-warning-container: #FFF0C8;
    --on-info-container: #D6E6FF;
    --toast-info: #5AA3E8;
    --toast-success: #95d5a8;
    --toast-warning: #F2B43C;
    --toast-danger: #ffb4ab;
    --body-glow-primary: rgba(30, 90, 168, 0.22);
    --body-glow-info: rgba(242, 180, 60, 0.12);
    --body-gradient-start: #0B1020;
    --body-gradient-end: #121A2B;
    --auth-glow-primary: rgba(30, 90, 168, 0.24);
    --auth-glow-info: rgba(242, 180, 60, 0.14);
    --auth-gradient-start: #0B1020;
    --auth-gradient-end: #121A2B;
    --glass-surface: rgba(18, 26, 43, 0.90);
    --glass-surface-strong: rgba(23, 34, 58, 0.96);
    --glass-surface-soft: rgba(18, 26, 43, 0.66);
    --nav-surface: rgba(11, 16, 32, 0.90);
    --overlay-scrim: rgba(3, 7, 18, 0.72);
    --primary-hover: #2F6FC4;
    --secondary-hover: #2B3855;
    --success-hover: #1f623b;
    --danger-hover: #a7352f;
    --state-hover: rgba(90, 163, 232, 0.11);
    --state-press: rgba(90, 163, 232, 0.17);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.34), 0 1px 3px rgba(0, 0, 0, 0.24);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.40), 0 2px 6px rgba(0, 0, 0, 0.30);
    --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.48), 0 6px 16px rgba(0, 0, 0, 0.36);
}

:root[data-theme="dark"] .alert-info {
    background: #132447;
    color: #D6E6FF;
    border-color: #2F6FC4;
}

:root[data-theme="dark"] .alert-info::marker,
:root[data-theme="dark"] .alert-info::first-letter,
:root[data-theme="dark"] .alert-info strong,
:root[data-theme="dark"] .alert-info svg,
:root[data-theme="dark"] .alert-info [aria-hidden="true"] {
    color: #5AA3E8;
}

:root[data-theme="dark"] body [style*="background:#dbeafe"],
:root[data-theme="dark"] body [style*="background: #dbeafe"] {
    background: #132447 !important;
    border-color: #2F6FC4 !important;
    color: #D6E6FF !important;
}

:root[data-theme="dark"] .alert[style*="background:#dbeafe"]::first-letter,
:root[data-theme="dark"] .alert[style*="background: #dbeafe"]::first-letter {
    color: #5AA3E8;
}

:root[data-theme="dark"] .submission-info {
    background: #132447;
    border-color: #2F6FC4;
    color: #D6E6FF;
}

:root[data-theme="dark"] .submission-info strong,
:root[data-theme="dark"] .submission-info a:not(.btn) {
    color: #5AA3E8;
}

:root[data-theme="dark"] .btn-outline {
    border-color: #52617A;
    color: #D6E6FF;
}

:root[data-theme="dark"] .btn-outline:hover {
    background: #1E5AA8;
    border-color: #2F6FC4;
    color: #FFFFFF;
}

:root[data-theme="dark"] .user-role {
    color: #5AA3E8;
}

:root[data-theme="dark"] .btn-secondary,
:root[data-theme="dark"] .grade-quick-btn,
:root[data-theme="dark"] .question-status.not-answered,
:root[data-theme="dark"] .navbar-link,
:root[data-theme="dark"] td small,
:root[data-theme="dark"] small[style*="var(--text-secondary)"] {
    color: #D6E6FF !important;
}

:root[data-theme="dark"] .resource-upload-status.is-uploading {
    color: #5AA3E8;
}

:root[data-theme="dark"] .resource-upload-status.is-complete {
    color: #C5F0D3;
}

:root[data-theme="dark"] body [style*="background: #d1fae5"],
:root[data-theme="dark"] body [style*="background:#d1fae5"] {
    background: rgba(23, 75, 46, 0.74) !important;
    color: var(--text-primary) !important;
}

:root[data-theme="dark"] body [style*="background: #fee2e2"],
:root[data-theme="dark"] body [style*="background:#fee2e2"] {
    background: rgba(140, 29, 24, 0.72) !important;
    color: var(--text-primary) !important;
}

:root[data-theme="dark"] body [style*="background: #fef3c7"],
:root[data-theme="dark"] body [style*="background:#fef3c7"] {
    background: rgba(111, 73, 7, 0.74) !important;
    color: var(--on-warning-container) !important;
}

:root[data-theme="dark"] body [style*="color: #065f46"],
:root[data-theme="dark"] body [style*="color:#065f46"] {
    color: var(--on-success-container) !important;
}

:root[data-theme="dark"] body [style*="color: #991b1b"],
:root[data-theme="dark"] body [style*="color:#991b1b"] {
    color: var(--on-danger-container) !important;
}

:root[data-theme="dark"] .admin-comment-cell {
    color: var(--text-primary) !important;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --primary: #1E5AA8;
        --primary-dark: #5AA3E8;
        --primary-light: #5AA3E8;
        --accent: #F2B43C;
        --secondary: #B9C3D6;
        --success: #95d5a8;
        --danger: #ffb4ab;
        --warning: #F2B43C;
        --bg-primary: #0B1020;
        --bg-secondary: #121A2B;
        --bg-tertiary: #17223A;
        --surface: #121A2B;
        --surface-container-low: #17223A;
        --surface-container: #1B2944;
        --surface-container-high: #223152;
        --surface-tint: #1E5AA8;
        --text-primary: #F5F7FB;
        --text-secondary: #D6E6FF;
        --text-muted: #B9C3D6;
        --border: #2B3855;
        --outline: #6E7D9A;
        --outline-variant: #2B3855;
        --on-primary: #FFFFFF;
        --primary-container: #173C75;
        --on-primary-container: #DCEBFF;
        --secondary-container: #223152;
        --on-secondary-container: #F5F7FB;
        --success-container: #174b2e;
        --danger-container: #8c1d18;
        --warning-container: #6F4907;
        --info-container: #132447;
        --on-success-container: #c5f0d3;
        --on-danger-container: #ffdad6;
        --on-warning-container: #FFF0C8;
        --on-info-container: #D6E6FF;
        --toast-info: #5AA3E8;
        --toast-success: #95d5a8;
        --toast-warning: #F2B43C;
        --toast-danger: #ffb4ab;
        --body-glow-primary: rgba(30, 90, 168, 0.22);
        --body-glow-info: rgba(242, 180, 60, 0.12);
        --body-gradient-start: #0B1020;
        --body-gradient-end: #121A2B;
        --auth-glow-primary: rgba(30, 90, 168, 0.24);
        --auth-glow-info: rgba(242, 180, 60, 0.14);
        --auth-gradient-start: #0B1020;
        --auth-gradient-end: #121A2B;
        --glass-surface: rgba(18, 26, 43, 0.90);
        --glass-surface-strong: rgba(23, 34, 58, 0.96);
        --glass-surface-soft: rgba(18, 26, 43, 0.66);
        --nav-surface: rgba(11, 16, 32, 0.90);
        --overlay-scrim: rgba(3, 7, 18, 0.72);
        --primary-hover: #2F6FC4;
        --secondary-hover: #2B3855;
        --success-hover: #1f623b;
        --danger-hover: #a7352f;
        --state-hover: rgba(90, 163, 232, 0.11);
        --state-press: rgba(90, 163, 232, 0.17);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.34), 0 1px 3px rgba(0, 0, 0, 0.24);
        --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.40), 0 2px 6px rgba(0, 0, 0, 0.30);
        --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.48), 0 6px 16px rgba(0, 0, 0, 0.36);
    }

    :root:not([data-theme="light"]) .alert-info {
        background: #132447;
        color: #D6E6FF;
        border-color: #2F6FC4;
    }

    :root:not([data-theme="light"]) .alert-info::marker,
    :root:not([data-theme="light"]) .alert-info::first-letter,
    :root:not([data-theme="light"]) .alert-info strong,
    :root:not([data-theme="light"]) .alert-info svg,
    :root:not([data-theme="light"]) .alert-info [aria-hidden="true"] {
        color: #5AA3E8;
    }

    :root:not([data-theme="light"]) body [style*="background:#dbeafe"],
    :root:not([data-theme="light"]) body [style*="background: #dbeafe"] {
        background: #132447 !important;
        border-color: #2F6FC4 !important;
        color: #D6E6FF !important;
    }

    :root:not([data-theme="light"]) .alert[style*="background:#dbeafe"]::first-letter,
    :root:not([data-theme="light"]) .alert[style*="background: #dbeafe"]::first-letter {
        color: #5AA3E8;
    }

    :root:not([data-theme="light"]) .submission-info {
        background: #132447;
        border-color: #2F6FC4;
        color: #D6E6FF;
    }

    :root:not([data-theme="light"]) .submission-info strong,
    :root:not([data-theme="light"]) .submission-info a:not(.btn) {
        color: #5AA3E8;
    }

    :root:not([data-theme="light"]) .btn-outline {
        border-color: #52617A;
        color: #D6E6FF;
    }

    :root:not([data-theme="light"]) .btn-outline:hover {
        background: #1E5AA8;
        border-color: #2F6FC4;
        color: #FFFFFF;
    }

    :root:not([data-theme="light"]) .user-role {
        color: #5AA3E8;
    }

    :root:not([data-theme="light"]) .btn-secondary,
    :root:not([data-theme="light"]) .grade-quick-btn,
    :root:not([data-theme="light"]) .question-status.not-answered,
    :root:not([data-theme="light"]) .navbar-link,
    :root:not([data-theme="light"]) td small,
    :root:not([data-theme="light"]) small[style*="var(--text-secondary)"] {
        color: #D6E6FF !important;
    }

    :root:not([data-theme="light"]) .resource-upload-status.is-uploading {
        color: #5AA3E8;
    }

    :root:not([data-theme="light"]) .resource-upload-status.is-complete {
        color: #C5F0D3;
    }

    :root:not([data-theme="light"]) body [style*="background: #d1fae5"],
    :root:not([data-theme="light"]) body [style*="background:#d1fae5"] {
        background: rgba(23, 75, 46, 0.74) !important;
        color: var(--text-primary) !important;
    }

    :root:not([data-theme="light"]) body [style*="background: #fee2e2"],
    :root:not([data-theme="light"]) body [style*="background:#fee2e2"] {
        background: rgba(140, 29, 24, 0.72) !important;
        color: var(--text-primary) !important;
    }

    :root:not([data-theme="light"]) body [style*="background: #fef3c7"],
    :root:not([data-theme="light"]) body [style*="background:#fef3c7"] {
        background: rgba(111, 73, 7, 0.74) !important;
        color: var(--on-warning-container) !important;
    }

    :root:not([data-theme="light"]) body [style*="color: #065f46"],
    :root:not([data-theme="light"]) body [style*="color:#065f46"] {
        color: var(--on-success-container) !important;
    }

    :root:not([data-theme="light"]) body [style*="color: #991b1b"],
    :root:not([data-theme="light"]) body [style*="color:#991b1b"] {
        color: var(--on-danger-container) !important;
    }

    :root:not([data-theme="light"]) .admin-comment-cell {
        color: var(--text-primary) !important;
    }
}

/* Keep question status pills on the same row as the question title on phones. */
@media (max-width: 640px) {
    .question-header {
        flex-wrap: nowrap !important;
        align-items: center !important;
    }

    .question-title {
        flex: 1 1 auto;
        width: auto !important;
        min-width: 0;
    }

    .question-text-short {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .question-status {
        margin-left: 8px;
        flex: 0 0 82px;
    }
}

/* Let the question card own the rounded corners to avoid inner header corner gaps. */
.question-item {
    overflow: hidden;
}

.question-item .question-header {
    border-radius: 0 !important;
}

/* Admin vetting polish: contrast, section hierarchy, and tighter responsive layout. */
.pending-submissions-header,
.reviewed-submissions-header {
    padding-block: 14px;
}

.pending-submissions-header {
    background: linear-gradient(135deg, var(--warning-container), var(--surface-container-low)) !important;
    border-bottom: 3px solid var(--warning) !important;
}

.pending-submissions-header h2,
.pending-submissions-header p {
    color: var(--on-warning-container) !important;
}

.pending-submissions-header p,
.reviewed-submissions-header p {
    margin-top: 6px !important;
    line-height: 1.35;
}

.pending-submissions-header h2,
.reviewed-submissions-header h2 {
    line-height: 1.15;
}

.admin-comment-cell,
td,
td small {
    color: var(--text-primary);
}

td small {
    color: var(--text-secondary);
}

#reviewModal,
#viewSubmissionModal {
    background: var(--overlay-scrim) !important;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

#reviewModal > div,
#viewSubmissionModal > div {
    background: var(--surface) !important;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg) !important;
    overflow: hidden;
}

#reviewModal > div > div:first-child,
#viewSubmissionModal > div > div:first-child,
#viewSubmissionModal > div > div:last-child {
    background: var(--surface-container-low);
    border-color: var(--border) !important;
}

#review_answer_text,
#viewSubmissionContent div[style*="background: var(--bg-tertiary)"] {
    color: var(--text-primary);
    background: var(--surface-container) !important;
    border: 1px solid var(--outline-variant);
}

#review_question_code,
td strong[style*="#f59e0b"],
#viewSubmissionContent div[style*="#f59e0b"] {
    color: var(--warning) !important;
}

#review_file_link,
#viewSubmissionContent {
    color: var(--text-primary);
}

:root[data-theme="dark"] #viewSubmissionContent div[style*="background: #dbeafe"],
:root[data-theme="dark"] #viewSubmissionContent div[style*="background:#dbeafe"] {
    color: #D6E6FF !important;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) #viewSubmissionContent div[style*="background: #dbeafe"],
    :root:not([data-theme="light"]) #viewSubmissionContent div[style*="background:#dbeafe"] {
        color: #D6E6FF !important;
    }
}

.dashboard-row .card {
    min-width: min(100%, 340px);
}

@media (max-width: 900px) {
    .dashboard-row {
        gap: 12px;
    }

    .dashboard-row .card {
        flex-basis: 100%;
    }

    .card-body form[method="GET"] {
        flex-wrap: wrap;
        gap: 10px !important;
    }

    .card-body form[method="GET"] select.form-control {
        max-width: none !important;
        flex-basis: 100%;
    }
}

/* Player dashboard submitted-question visibility toggle. */
.hide-submitted-questions .question-item--submitted {
    display: none;
}

.questions-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.submitted-toggle {
    flex: 0 0 auto;
}

@media (max-width: 520px) {
    .questions-card-header {
        align-items: flex-start;
    }

    .submitted-toggle {
        min-height: 32px;
        padding: 7px 10px;
        font-size: 0.76rem;
        white-space: nowrap;
    }
}

/* Question CSV import/export controls. */
.csv-tools {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(280px, 1.4fr);
    gap: 14px;
    align-items: end;
    padding: 16px;
    margin-bottom: 18px;
    background: var(--surface-container-low);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.csv-tools h3 {
    margin: 0 0 6px;
    color: var(--primary-dark);
    font-size: 1.05rem;
}

.csv-tools p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.4;
}

.csv-import-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.csv-import-form .form-control {
    min-width: 0;
}

.card-header .flex-between {
    gap: 10px;
    flex-wrap: wrap;
}

@media (max-width: 760px) {
    .csv-tools {
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .csv-import-form {
        flex-direction: column;
        align-items: stretch;
    }

    .card-header .flex-between {
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .pending-submissions-header,
    .reviewed-submissions-header {
        padding: 12px !important;
    }

    .pending-submissions-header h2,
    .reviewed-submissions-header h2 {
        font-size: 1rem;
    }

    .pending-submissions-header p,
    .reviewed-submissions-header p {
        font-size: 0.82rem !important;
    }

    #reviewModal > div,
    #viewSubmissionModal > div {
        border-radius: var(--radius-md) !important;
    }

    #reviewModal > div > div,
    #viewSubmissionModal > div > div {
        padding: 14px !important;
    }
}

:root[data-theme="dark"] .pending-submissions-header {
    background: linear-gradient(135deg, rgba(111, 73, 7, 0.82), var(--surface-container-low)) !important;
}

:root[data-theme="dark"] .reviewed-submissions-header {
    background: linear-gradient(135deg, var(--info-container), var(--surface-container-low)) !important;
}

:root[data-theme="dark"] td,
:root[data-theme="dark"] td strong,
:root[data-theme="dark"] .admin-comment-cell {
    color: var(--text-primary) !important;
}

:root[data-theme="dark"] td small {
    color: var(--text-secondary) !important;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .pending-submissions-header {
        background: linear-gradient(135deg, rgba(111, 73, 7, 0.82), var(--surface-container-low)) !important;
    }

    :root:not([data-theme="light"]) .reviewed-submissions-header {
        background: linear-gradient(135deg, var(--info-container), var(--surface-container-low)) !important;
    }

    :root:not([data-theme="light"]) td,
    :root:not([data-theme="light"]) td strong,
    :root:not([data-theme="light"]) .admin-comment-cell {
        color: var(--text-primary) !important;
    }

    :root:not([data-theme="light"]) td small {
        color: var(--text-secondary) !important;
    }
}
