/* =============================================================
   EAES-INSPIRED EXAMINATION SYSTEM STYLE GUIDE (Ministry of Education)
   Color palette derived from Ethiopian FDRE MoE & EAES branding
   ============================================================= */
:root {
  --moe-navy:       #0a2540;
  --moe-blue:       #1a3a5c;
  --moe-light-blue: #e8f0fe;
  --moe-green:      #1a8a3a;
  --moe-green-soft: #e6f4ea;
  --moe-gold:       #d4a017;
  --moe-gold-soft:  #fef7e0;
  --moe-red:        #c5221f;
  --moe-red-soft:   #fce8e6;
  --moe-bg:         #f0f4f8;
  --moe-surface:    #ffffff;
  --moe-line:       #d1d9e6;
  --moe-soft-line:  #e8edf4;
  --moe-text:       #1d2b3e;
  --moe-muted:      #5f6b7a;
  --moe-ink:        #0b1a2e;
  --moe-shadow:     0 8px 24px rgba(10, 37, 64, 0.10);
  --moe-radius:     8px;
  --eaes-blue:      #0b4f6c;
  --eaes-green:     #0f7b63;
  --school-green:   #1a8a3a;
  --school-navy:    #0a2540;
}

/* ===== Global Reset ===== */
*, *::before, *::after {
  box-sizing: border-box;
}

/* ===== Global Styles ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background-color: var(--moe-bg);
    color: #333;
}

a {
    color: #005f73;
    text-decoration: none;
    font-weight: bold;
}

a:hover {
    color: #94d2bd;
}

/* ===== Header ===== */
header {
    background-color: #005f73;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

header .logo {
    display: flex;
    align-items: center;
}

header .logo .school-logo {
    height: 50px;
    margin-right: 1rem;
    border-radius: 50%;
}

header h1 {
    font-size: 1.8rem;
}

/* ===== Navigation ===== */
nav a {
    color: white;
    margin-left: 1rem;
}

nav a:hover {
    color: #94d2bd;
}

/* ===== Main Content ===== */
main {
    padding: 2rem;
    min-height: 70vh;
}

/* ===== Footer ===== */
footer {
    text-align: center;
    padding: 1rem;
    background-color: #0a9396;
    color: white;
    margin-top: 2rem;
}

/* ===== Buttons (base - overridden by moe system) ===== */
button, .btn {
    padding: 0.5rem 1rem;
    background-color: var(--moe-green);
    color: white;
    border: 1px solid var(--moe-line);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    text-decoration: none;
    transition: 0.15s;
}

button:hover, .btn:hover {
    background-color: #0b5f59;
    transform: none;
    box-shadow: none;
}

/* ===== Welcome Page ===== */
.welcome-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 80vh;
    text-align: center;
}

.welcome-container h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #005f73;
}

.welcome-container p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.welcome-container a.btn {
    font-size: 1.2rem;
    padding: 0.8rem 2rem;
}


/* Login Page Styles */
.login-container {
    max-width: 400px;
    margin: 50px auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    text-align: center;
}

.login-container h2 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: #005f73;
}

.login-container label {
    display: block;
    text-align: left;
    margin-bottom: 0.3rem;
    margin-top: 1rem;
    font-weight: bold;
    color: #0a9396;
}

.login-container input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.login-container button {
    width: 100%;
    padding: 0.7rem;
    background: #0a9396;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 1rem;
}

.login-container button:hover {
    background: #005f73;
}

.login-note {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #555;
}
.messages {
    margin-bottom: 1rem;
}

.message {
    color: red;
    font-weight: bold;
    font-size: 0.9rem;
}


/* admin and teachers dashboard  */

/* Dashboard layout */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    font-family: Arial, sans-serif;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background:  #005f73;
    /* background: #0a9396; */
    color: white;
    transition: width 0.3s;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.sidebar-header .logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.sidebar-header .school-name {
    margin-left: 0.5rem;
    font-weight: bold;
    font-size: 1rem;
}

#toggle-sidebar {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    margin: 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 1rem;
    color: white;
    text-decoration: none;
    transition: background 0.2s;
}

.sidebar-menu li a:hover {
    background: #005f73;
}

.sidebar-menu i {
    width: 25px;
    text-align: center;
}

.sidebar.collapsed .sidebar-menu span {
    display: none;
}

/* Main content */
.main-content {
    flex: 1;
    background: #f4f4f4;
    display: flex;
    flex-direction: column;
}

.dashboard-header {
    background: #005f73;
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.logout-btn {
    color: white;
    text-decoration: none;
    margin-left: 1rem;
}

.dashboard-body {
    padding: 2rem;
}
/* admin dashboard */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.card h3 {
    color: #0a9396;
    /* color: #0a9396; */
    margin-bottom: 0.5rem;
}

.card p {
    font-size: 1.5rem;
    font-weight: bold;
}
/* Recent Section */
.recent-section {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    margin-top: 100px;
}
.recent-section h2 {
    margin-bottom: 1rem;
    color: #005f73;
}
.recent-section table {
    width: 100%;
    border-collapse: collapse;
}
.recent-section th, .recent-section td {
    border: 1px solid #ccc;
    padding: 0.5rem;
    text-align: center;
}
.recent-section th {
    background: #0a9396;
    color: white;
}


/* teacher upload */
.add-teacher-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-top: 2rem;
}

.add-teacher-card h3 {
    color: #0a9396;
    margin-bottom: 1rem;
}

.add-teacher-card label {
    display: block;
    margin-top: 1rem;
    font-weight: bold;
}

.add-teacher-card input {
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.3rem;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.add-teacher-card button {
    margin-top: 1rem;
    padding: 0.7rem;
    width: 100%;
    background: #0a9396;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.add-teacher-card button:hover {
    background: #005f73;
}

.teacher-info {
    margin-top: 1.5rem;
    background: #e0f7fa;
    padding: 1rem;
    border-radius: 6px;
}
.teacher-info h4 {
    color: #005f73;
}

/* ===== 2026 interface refresh (merged into moe system) ===== */

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.section-heading h1 {
    color: var(--school-navy);
    font-size: 1.6rem;
    line-height: 1.2;
    margin-bottom: 0.35rem;
}

.section-heading p {
    color: var(--ink-soft);
}

.cards {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.card,
.modern-card,
.main-card,
.side-card,
.success-card,
.profile-card,
.result-card,
.login-card,
.welcome-card,
.recent-section,
.stat-card,
.summary-box,
.profile-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

.card {
    text-align: left;
    padding: 1.25rem;
}

.card:hover,
.modern-card:hover,
.stat-card:hover {
    transform: none;
    box-shadow: var(--shadow-soft);
}

.card h3,
.recent-section h2,
.card-header h2,
.card-header h3,
.table-header h2,
.page-info h1,
.header-left h1,
.login-title,
.welcome-title {
    color: var(--school-navy);
}

.card p {
    font-size: 2rem;
    color: var(--ink);
}

.recent-section {
    margin-top: 1rem;
    overflow: hidden;
}

.recent-section table,
.modern-table,
.result-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.recent-section th,
.modern-table thead th,
.result-table thead th {
    background: #eef3ea;
    color: var(--ink-soft);
    font-size: 0.82rem;
    letter-spacing: 0;
    text-align: left;
}

.recent-section td,
.recent-section th,
.modern-table tbody td,
.modern-table thead th,
.result-table tbody td,
.result-table thead th {
    border-color: var(--line-soft);
}

.page-badge,
.header-badge,
.card-icon,
.header-icon,
.hero-icon,
.logo-box,
.student-avatar,
.side-icon {
    border-radius: 8px;
    background: var(--school-navy);
    box-shadow: none;
}

.form-control,
.form-group input,
.form-group select,
input,
select,
textarea {
    border-radius: 8px;
    border-color: var(--line);
    background: #fbfcf8;
}

.form-control:focus,
.form-group input:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: var(--school-green);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.badge,
.gender-badge,
.age-box,
.status-badge,
.semester-badge,
.user-badge,
.table-badge,
.portal-badge {
    border-radius: 999px;
}

@media (max-width: 768px) {
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-body,
    main {
        padding: 1rem;
    }
}

/* Keep older inline page styles visually consistent. */
.modern-card,
.main-card,
.side-card,
.success-card,
.profile-card,
.result-card,
.login-card,
.welcome-card,
.recent-section,
.stat-card,
.summary-box,
.profile-item,
.portal-box,
.modal-box {
    border-radius: 8px !important;
}

.page-badge,
.header-badge,
.card-icon,
.header-icon,
.hero-icon,
.logo-box,
.student-avatar,
.side-icon,
.stat-icon,
.profile-avatar {
    border-radius: 8px !important;
    background: var(--school-navy) !important;
    box-shadow: none !important;
}

.btn-primary,
.login-btn,
.view-btn,
.save-btn,
.generate-btn,
.primary-action {
    background: var(--school-green) !important;
    color: #fff !important;
}

.btn-primary:hover,
.login-btn:hover,
.view-btn:hover,
.save-btn:hover,
.generate-btn:hover,
.primary-action:hover {
    background: #0b5f59 !important;
    transform: none !important;
    box-shadow: none !important;
}

/* ===== Internal school-system design layer ===== */
body {
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background: var(--moe-bg) !important;
    color: var(--ink) !important;
}

.dashboard-body,
.page-wrapper,
.teacher-page,
.students-page,
.results-page,
.analysis-page,
.profile-page,
.subjects-page,
.upload-page,
.homeroom-page,
.settings-page {
    color: var(--ink) !important;
}

.top-section,
.page-header,
.profile-header,
.hero-section,
.analysis-header,
.roster-header,
.section-heading {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin-bottom: 18px !important;
}

.page-info h1,
.header-text h1,
.header-left h1,
.profile-text h1,
.analysis-header h1,
.roster-header h1,
.section-heading h1,
.welcome-title,
.login-title {
    color: var(--school-navy) !important;
    font-size: clamp(1.35rem, 2.4vw, 1.9rem) !important;
    line-height: 1.2 !important;
    letter-spacing: 0 !important;
}

.page-info p,
.header-text p,
.header-left p,
.profile-text p,
.analysis-header p,
.roster-header p,
.section-heading p,
.card-header p,
.table-header p,
.card-title p,
.empty-state p {
    color: var(--ink-soft) !important;
    font-size: 0.95rem !important;
    line-height: 1.55 !important;
}

.page-badge,
.header-badge,
.profile-badge,
.table-badge,
.portal-badge,
.semester-badge {
    background: #eef3ea !important;
    color: var(--school-navy) !important;
    border: 1px solid var(--line) !important;
    border-radius: 999px !important;
    box-shadow: none !important;
    padding: 9px 13px !important;
}

.header-icon,
.card-icon,
.side-icon,
.profile-avatar,
.hero-icon,
.logo-box,
.student-avatar,
.stat-icon,
.nav-icon,
.empty-state i {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    border-radius: 8px !important;
    background: var(--school-navy) !important;
    color: #fff !important;
    box-shadow: none !important;
    font-size: 1.15rem !important;
}

.modern-card,
.main-card,
.side-card,
.success-card,
.profile-card,
.result-card,
.recent-section,
.stat-card,
.summary-box,
.profile-item,
.portal-box,
.modal-box,
.content-card,
.filter-card,
.table-card,
.info-card,
.nav-card,
.settings-card,
.class-card,
.student-card,
.upload-card,
.review-card {
    background: #fff !important;
    border: 1px solid var(--line) !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 24px rgba(23, 32, 51, 0.06) !important;
}

.modern-card,
.main-card,
.side-card,
.success-card,
.profile-card,
.result-card,
.recent-section,
.settings-card,
.content-card,
.filter-card,
.table-card,
.upload-card {
    padding: 22px !important;
}

.card-header,
.table-header,
.modal-header,
.card-title {
    border-bottom: 1px solid var(--line-soft) !important;
    padding-bottom: 14px !important;
    margin-bottom: 18px !important;
}

.card-header h2,
.card-header h3,
.table-header h2,
.card-title h2,
.modal-header h2,
.side-card h3,
.empty-state h2,
.empty-state h3 {
    color: var(--school-navy) !important;
    font-size: 1.12rem !important;
    line-height: 1.25 !important;
}

.cards,
.stats-grid,
.summary-grid,
.profile-grid,
.content-grid,
.nav-grid {
    gap: 14px !important;
}

.card,
.stat-card,
.summary-box,
.profile-item {
    padding: 18px !important;
}

.card h3,
.stat-info h3,
.summary-box h4,
.profile-item h4 {
    color: var(--ink-soft) !important;
    font-size: 0.82rem !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

.card p,
.stat-info h2,
.summary-box p {
    color: var(--school-navy) !important;
    font-size: clamp(1.35rem, 3vw, 1.9rem) !important;
    line-height: 1.15 !important;
}

table,
.modern-table,
.result-table,
.recent-section table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    background: #fff !important;
}

th,
.modern-table thead th,
.result-table thead th,
.recent-section th {
    background: #eef3ea !important;
    color: var(--ink-soft) !important;
    font-size: 0.8rem !important;
    font-weight: 800 !important;
    letter-spacing: 0 !important;
    text-align: left !important;
    padding: 12px 13px !important;
    border-color: var(--line) !important;
}

td,
.modern-table tbody td,
.result-table tbody td,
.recent-section td {
    color: var(--ink) !important;
    padding: 12px 13px !important;
    border-color: var(--line-soft) !important;
}

tr:hover,
.modern-table tbody tr:hover,
.result-table tbody tr:hover {
    background: #fbfcf8 !important;
}

.form-grid {
    gap: 16px !important;
}

label,
.form-label,
.form-group label,
.field label {
    color: var(--school-navy) !important;
    font-weight: 750 !important;
    letter-spacing: 0 !important;
}

input,
select,
textarea,
.form-control {
    min-height: 44px !important;
    border-radius: 8px !important;
    border: 1px solid var(--line) !important;
    background: #fbfcf8 !important;
    color: var(--ink) !important;
    box-shadow: none !important;
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus {
    border-color: var(--school-green) !important;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12) !important;
}

button,
.btn,
.view-btn,
.save-btn,
.cancel-btn,
.copy-btn,
.open-btn,
.generate-btn,
.download-btn,
.submit-btn,
.action-link,
.filter-btn,
.primary-action {
    border-radius: 8px !important;
    box-shadow: none !important;
    letter-spacing: 0 !important;
    transform: none !important;
}

.btn-primary,
.view-btn,
.save-btn,
.generate-btn,
.submit-btn,
.download-btn,
.primary-action {
    background: var(--school-green) !important;
    color: #fff !important;
}

.btn-light,
.btn-secondary,
.cancel-btn,
.copy-btn,
.open-btn {
    background: #eef3ea !important;
    color: var(--school-navy) !important;
    border: 1px solid var(--line) !important;
}

.action-btn,
.edit-btn,
.delete-btn {
    border-radius: 8px !important;
}

.badge,
.status-badge,
.gender-badge,
.age-box,
.user-badge {
    border-radius: 999px !important;
    font-weight: 750 !important;
}

.bg-blue,
.bg-green,
.bg-red,
.bg-gold,
.approved,
.pending,
.rejected {
    background-image: none !important;
}

@media (max-width: 768px) {
    .dashboard-body {
        padding: 14px !important;
    }

    .modern-card,
    .main-card,
    .side-card,
    .profile-card,
    .result-card,
    .recent-section,
    .settings-card,
    .content-card,
    .filter-card,
    .table-card,
    .upload-card {
        padding: 16px !important;
    }

    .page-header,
    .top-section,
    .profile-header {
        align-items: flex-start !important;
    }

    .header-icon,
    .card-icon,
    .side-icon,
    .profile-avatar,
    .stat-icon {
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
    }

    .dashboard-header,
    .user-info,
    .form-actions,
    .modal-actions,
    .action-buttons,
    .review-form {
        align-items: stretch !important;
    }

    .dashboard-header {
        gap: 12px !important;
    }

    .user-info,
    .action-buttons,
    .review-form {
        width: 100% !important;
    }

    .user-badge,
    .logout-btn,
    .btn,
    button,
    .view-btn,
    .save-btn,
    .generate-btn,
    .download-btn,
    .submit-btn {
        max-width: 100% !important;
        white-space: normal !important;
    }

    .table-responsive,
    .table-wrapper {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    table {
        min-width: 720px;
    }

    .modal-box {
        width: min(100%, 94vw) !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }
}

@media (max-width: 520px) {
    .dashboard-header {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

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

    .cards,
    .stats-grid,
    .summary-grid,
    .profile-grid,
    .content-grid,
    .form-grid {
        grid-template-columns: 1fr !important;
    }

    .btn,
    button[type="submit"],
    .view-btn,
    .save-btn,
    .generate-btn,
    .download-btn,
    .submit-btn {
        width: 100%;
        justify-content: center !important;
    }
}

/* ===== Shared mobile hardening for dashboard pages ===== */
img,
video,
canvas,
svg {
    max-width: 100%;
}

input,
select,
textarea {
    font-size: 16px;
}

.section-heading,
.page-header,
.page-header-modern,
.card-header,
.table-header,
.card-top,
.profile-header {
    min-width: 0;
}

.section-heading h1,
.page-header h1,
.page-header-modern h1,
.card-header h2,
.card-header h3,
.table-header h2 {
    overflow-wrap: anywhere;
}

@media (max-width: 768px) {
    .section-heading,
    .page-header,
    .page-header-modern,
    .card-header,
    .table-header,
    .card-top,
    .profile-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 14px !important;
    }

    .header-badge,
    .portal-badge,
    .table-badge {
        width: 100% !important;
        justify-content: center !important;
        text-align: center !important;
    }

    .form-grid,
    .filter-grid,
    .profile-grid,
    .summary-grid,
    .cards,
    .stats-grid,
    .subject-grid,
    .dashboard-grid,
    .panel-grid {
        grid-template-columns: 1fr !important;
    }

    .modern-card,
    .card,
    .download-panel,
    .lookup-panel,
    .profile-card,
    .result-card {
        border-radius: 8px !important;
    }

    table {
        min-width: 640px;
    }
}

@media (max-width: 420px) {
    .dashboard-body {
        padding: 10px !important;
    }

    table {
        min-width: 560px;
    }
}

/* =============================================================
   EAES / MoE EXAM SYSTEM DESIGN SYSTEM
   Professional-grade styling for Grade 12 National Exam platform
   ============================================================= */

/* -------- MoE Brand Bar -------- */
.moe-top-banner {
  background: linear-gradient(135deg, var(--moe-navy) 0%, var(--moe-blue) 100%);
  padding: 4px 0;
  text-align: center;
  color: rgba(255,255,255,0.7);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.moe-header {
  background: var(--moe-surface);
  border-bottom: 3px solid var(--moe-green);
  padding: 10px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  box-shadow: 0 2px 10px rgba(10, 37, 64, 0.06);
}

.moe-header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.moe-crest {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--moe-gold);
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(10, 37, 64, 0.14);
}

.moe-crest img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.moe-header-text h1 {
  font-size: 15px;
  font-weight: 800;
  color: var(--moe-navy);
  margin: 0;
  line-height: 1.2;
}

.moe-header-text span {
  font-size: 11px;
  color: var(--moe-muted);
  font-weight: 600;
}

.moe-header .moe-year {
  font-weight: 700;
  color: var(--moe-muted);
  font-size: 13px;
  padding: 6px 12px;
  border: 1px solid var(--moe-soft-line);
  border-radius: 999px;
  background: var(--moe-bg);
  white-space: nowrap;
}

/* -------- Student Exam Base -------- */
.moe-frame {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--moe-bg);
}

.moe-body {
  flex: 1;
}

.moe-footer {
  margin-top: auto;
  padding: 20px;
  text-align: center;
  font-size: 12px;
  line-height: 1.7;
  color: var(--moe-muted);
  background: var(--moe-surface);
  border-top: 1px solid var(--moe-soft-line);
}

.moe-footer strong {
  color: var(--moe-navy);
}

/* -------- Student Login Page -------- */
.moe-login-wrap {
  width: min(100%, 1200px);
  margin: 40px auto;
  padding: 0 18px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 36px;
  align-items: start;
}

.moe-login-hero {
  background: linear-gradient(135deg, var(--moe-navy) 0%, var(--moe-blue) 60%, #1a5a3a 100%);
  border-radius: 12px;
  padding: 40px 36px;
  color: #fff;
}

.moe-login-hero h1 {
  font-size: clamp(28px, 3.5vw, 42px);
  margin: 0;
  line-height: 1.1;
  font-weight: 800;
}

.moe-login-hero p {
  margin: 14px 0 0;
  opacity: 0.85;
  line-height: 1.65;
  max-width: 500px;
}

.moe-login-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 28px;
}

.moe-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: rgba(255,255,255,0.1);
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
}

.moe-feature i {
  width: 32px;
  height: 32px;
  background: var(--moe-gold);
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 14px;
  flex-shrink: 0;
}

.moe-login-instructions {
  margin-top: 28px;
}

.moe-login-instructions h2 {
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 12px;
  opacity: 0.9;
}

.moe-login-instructions ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.moe-login-instructions li {
  padding-left: 24px;
  position: relative;
  font-size: 13px;
  opacity: 0.85;
}

.moe-login-instructions li::before {
  content: "›";
  position: absolute;
  left: 6px;
  font-weight: 900;
  color: var(--moe-gold);
}

.moe-login-card {
  background: var(--moe-surface);
  border: 1px solid var(--moe-line);
  border-radius: 12px;
  padding: 32px;
  box-shadow: var(--moe-shadow);
}

.moe-login-card h2 {
  color: var(--moe-navy);
  font-size: 22px;
  margin: 0 0 6px;
}

.moe-login-card > p {
  color: var(--moe-muted);
  margin: 0 0 20px;
  font-size: 14px;
}

.moe-field {
  margin-bottom: 18px;
}

.moe-field label {
  display: block;
  font-weight: 700;
  color: var(--moe-navy);
  margin-bottom: 7px;
  font-size: 13px;
}

.moe-field input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--moe-line);
  border-radius: 8px;
  padding: 0 14px;
  background: #fbfcfd;
  color: var(--moe-text);
  font-size: 15px;
  transition: 0.2s;
}

.moe-field input:focus {
  border-color: var(--moe-green);
  box-shadow: 0 0 0 3px rgba(26, 138, 58, 0.12);
  outline: 0;
}

.moe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid var(--moe-line);
  background: var(--moe-surface);
  color: var(--moe-text);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: 0.15s;
  white-space: nowrap;
}

.moe-btn:hover {
  background: #f5f7fa;
}

.moe-btn-primary {
  background: var(--moe-navy);
  color: #fff;
  border-color: var(--moe-navy);
}

.moe-btn-primary:hover {
  background: var(--moe-blue);
}

.moe-btn-green {
  background: var(--moe-green);
  color: #fff;
  border-color: var(--moe-green);
}

.moe-btn-green:hover {
  background: #157a32;
}

.moe-btn-full {
  width: 100%;
  justify-content: center;
}

.moe-login-notice {
  margin-top: 20px;
  padding: 14px;
  background: var(--moe-gold-soft);
  border-left: 4px solid var(--moe-gold);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #7a5a0a;
}

.moe-message {
  background: var(--moe-red-soft);
  color: var(--moe-red);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-weight: 700;
  font-size: 13px;
}

.moe-message.success {
  background: var(--moe-green-soft);
  color: #1a6e30;
}

/* -------- Student Portal / Dashboard -------- */
.moe-portal {
  width: min(100%, 1200px);
  margin: 0 auto;
  padding: 28px 18px 0;
}

.moe-portal-welcome {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.moe-portal-welcome h1 {
  color: var(--moe-navy);
  font-size: clamp(24px, 3vw, 36px);
  margin: 0;
  line-height: 1.15;
}

.moe-portal-welcome p {
  color: var(--moe-muted);
  margin: 6px 0 0;
  line-height: 1.55;
}

.moe-portal-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.32fr) minmax(0, 0.68fr);
  gap: 24px;
  align-items: start;
}

.moe-profile-card {
  background: var(--moe-surface);
  border: 1px solid var(--moe-line);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--moe-shadow);
}

.moe-profile-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--moe-soft-line);
  margin-bottom: 18px;
}

.moe-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--moe-navy), var(--moe-green));
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  font-size: 22px;
  flex-shrink: 0;
}

.moe-profile-top h2 {
  color: var(--moe-navy);
  font-size: 18px;
  margin: 0;
}

.moe-profile-top span {
  color: var(--moe-muted);
  font-size: 13px;
}

.moe-detail-list {
  display: grid;
  gap: 12px;
}

.moe-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--moe-soft-line);
  font-size: 13px;
}

.moe-detail-row dt {
  color: var(--moe-muted);
  font-weight: 700;
}

.moe-detail-row dd {
  margin: 0;
  font-weight: 700;
  color: var(--moe-text);
  text-align: right;
}

/* -------- Exam List Panel -------- */
.moe-exam-panel {
  background: var(--moe-surface);
  border: 1px solid var(--moe-line);
  border-radius: 12px;
  box-shadow: var(--moe-shadow);
  overflow: hidden;
}

.moe-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--moe-soft-line);
  gap: 16px;
  flex-wrap: wrap;
}

.moe-panel-head h2 {
  color: var(--moe-navy);
  margin: 0;
  font-size: 20px;
}

.moe-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 12px;
  background: var(--moe-green-soft);
  color: var(--moe-green);
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
}

.moe-exam-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  padding: 22px 24px;
  border-left: 5px solid var(--moe-green);
  border-bottom: 1px solid var(--moe-soft-line);
  transition: 0.15s;
}

.moe-exam-card:last-child {
  border-bottom: 0;
}

.moe-exam-card:hover {
  background: #fafcfd;
}

.moe-exam-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.moe-exam-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--moe-soft-line);
  background: var(--moe-green-soft);
  color: var(--moe-green);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 12px;
  flex-shrink: 0;
}

.moe-exam-title h3 {
  color: var(--moe-navy);
  margin: 0;
  font-size: 20px;
}

.moe-exam-title p {
  margin: 3px 0 0;
  color: var(--moe-muted);
  font-size: 13px;
}

.moe-exam-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(100px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.moe-meta-box {
  background: #f8fafc;
  border: 1px solid var(--moe-soft-line);
  border-radius: 8px;
  padding: 12px;
}

.moe-meta-box span {
  display: block;
  color: var(--moe-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.moe-meta-box strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  color: var(--moe-text);
}

.moe-exam-actions {
  align-self: center;
  display: grid;
  gap: 8px;
  min-width: 140px;
}

.moe-empty {
  padding: 32px 24px;
  text-align: center;
}

.moe-empty strong {
  display: block;
  color: var(--moe-navy);
}

.moe-empty p {
  color: var(--moe-muted);
  margin: 6px 0 0;
  font-size: 14px;
}

/* -------- Exam Start/Instructions Page -------- */
.moe-start-page {
  width: min(100%, 1200px);
  margin: 0 auto;
  padding: 28px 18px;
}

.moe-start-header {
  background: linear-gradient(135deg, var(--moe-navy), var(--moe-blue));
  border-radius: 12px;
  padding: 28px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  color: #fff;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.moe-start-header h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.1;
}

.moe-start-header p {
  margin: 6px 0 0;
  opacity: 0.8;
  font-weight: 600;
}

.moe-status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 16px;
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}

.moe-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.moe-metric-card {
  background: var(--moe-surface);
  border: 1px solid var(--moe-line);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  box-shadow: var(--moe-shadow);
}

.moe-metric-card span {
  display: block;
  color: var(--moe-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.moe-metric-card strong {
  display: block;
  margin-top: 6px;
  color: var(--moe-navy);
  font-size: 24px;
}

.moe-start-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  align-items: start;
}

.moe-card {
  background: var(--moe-surface);
  border: 1px solid var(--moe-line);
  border-radius: 12px;
  box-shadow: var(--moe-shadow);
  padding: 24px;
}

.moe-card-muted {
  background: #f8fafc;
}

.moe-step-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--moe-soft-line);
  margin-bottom: 18px;
}

.moe-step-num {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--moe-green-soft);
  color: var(--moe-green);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 14px;
  flex-shrink: 0;
}

.moe-step-head h2 {
  margin: 0;
  color: var(--moe-navy);
  font-size: 18px;
}

.moe-step-head p {
  margin: 3px 0 0;
  color: var(--moe-muted);
  font-size: 13px;
}

.moe-check-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0;
}

.moe-check-list li {
  padding: 14px 0 14px 32px;
  border-bottom: 1px solid var(--moe-soft-line);
  position: relative;
  font-size: 14px;
  line-height: 1.5;
}

.moe-check-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 20px;
  width: 10px;
  height: 5px;
  border-left: 2.5px solid var(--moe-green);
  border-bottom: 2.5px solid var(--moe-green);
  transform: rotate(-45deg);
}

.moe-warning {
  margin-top: 20px;
  padding: 16px;
  background: var(--moe-gold-soft);
  border-left: 5px solid var(--moe-gold);
  border-radius: 8px;
}

.moe-warning h3 {
  margin: 0 0 6px;
  color: #7a5a0a;
  font-size: 14px;
}

.moe-warning p {
  margin: 0;
  color: #7a5a0a;
  font-size: 13px;
  line-height: 1.55;
}

.moe-declaration {
  margin-top: 20px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid var(--moe-soft-line);
  border-radius: 8px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 700;
  font-size: 14px;
}

.moe-declaration input {
  width: 18px;
  min-height: 18px;
  margin-top: 3px;
  accent-color: var(--moe-green);
  flex-shrink: 0;
}

.moe-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.moe-summary-card {
  display: grid;
  gap: 12px;
}

.moe-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--moe-soft-line);
  font-size: 14px;
}

.moe-summary-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.moe-summary-row span {
  color: var(--moe-muted);
  font-weight: 600;
}

.moe-summary-row strong {
  color: var(--moe-text);
  text-align: right;
}

/* -------- EXAM ROOM (CBT Interface) -------- */
.moe-exam-room {
  flex: 1;
  width: min(100%, 1500px);
  margin: 0 auto;
  padding: 18px;
}

.moe-room-header {
  background: var(--moe-navy);
  border-radius: 10px;
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  color: #fff;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.moe-room-header h1 {
  margin: 0;
  font-size: clamp(18px, 2vw, 26px);
  line-height: 1.15;
}

.moe-room-header .moe-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 4px;
}

.moe-room-header p {
  margin: 3px 0 0;
  opacity: 0.75;
  font-size: 13px;
}

.moe-timer-box {
  min-width: 160px;
  background: rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 12px 16px;
  text-align: center;
}

.moe-timer-box span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  opacity: 0.7;
  letter-spacing: 1px;
}

.moe-timer-box strong {
  display: block;
  margin-top: 3px;
  font-size: 28px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.moe-room-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.moe-palette {
  position: sticky;
  top: 16px;
}

.moe-palette-card {
  background: var(--moe-surface);
  border: 1px solid var(--moe-line);
  border-radius: 10px;
  padding: 18px;
  box-shadow: var(--moe-shadow);
}

.moe-palette-card h2 {
  color: var(--moe-navy);
  font-size: 16px;
  margin: 0 0 4px;
}

.moe-palette-card > p {
  color: var(--moe-muted);
  font-size: 12px;
  margin: 0 0 14px;
}

.moe-palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.moe-p-cell {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid var(--moe-line);
  background: #f5f7fa;
  color: var(--moe-muted);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  text-decoration: none;
  transition: 0.1s;
}

.moe-p-cell:hover {
  background: #eef3f8;
}

.moe-p-cell.answered {
  background: var(--moe-green-soft);
  border-color: #a8dab5;
  color: var(--moe-green);
}

.moe-p-cell.flagged {
  box-shadow: inset 0 -3px 0 var(--moe-gold);
}

.moe-p-cell.active {
  outline: 3px solid var(--moe-navy);
  outline-offset: -1px;
}

.moe-palette-legend {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--moe-muted);
}

.moe-legend-box {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--moe-line);
  background: #f5f7fa;
  display: inline-block;
  vertical-align: -2px;
  margin-right: 5px;
}

.moe-legend-box.answered {
  background: var(--moe-green-soft);
  border-color: #a8dab5;
}

.moe-legend-box.flagged {
  background: var(--moe-gold-soft);
  border-color: var(--moe-gold);
}

.moe-paper {
  min-width: 0;
}

.moe-paper-toolbar {
  background: var(--moe-surface);
  border: 1px solid var(--moe-line);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  box-shadow: var(--moe-shadow);
}

.moe-save-state {
  color: var(--moe-muted);
  font-weight: 700;
  font-size: 13px;
}

.moe-q-card {
  background: var(--moe-surface);
  border: 1px solid var(--moe-line);
  border-radius: 10px;
  padding: 20px 22px;
  margin-bottom: 14px;
  box-shadow: var(--moe-shadow);
}

.moe-q-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--moe-soft-line);
  margin-bottom: 16px;
}

.moe-q-number {
  display: block;
  color: var(--moe-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.moe-q-head h2 {
  margin: 4px 0 0;
  font-size: 20px;
  color: var(--moe-navy);
}

.moe-q-side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.moe-marks-pill {
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--moe-light-blue);
  color: var(--moe-navy);
  display: inline-flex;
  align-items: center;
  font-weight: 800;
  font-size: 12px;
}

.moe-flag-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--moe-muted);
  cursor: pointer;
}

.moe-flag-control input {
  accent-color: var(--moe-gold);
}

.moe-q-prompt {
  font-size: 16px;
  line-height: 1.65;
  color: var(--moe-text);
  margin-bottom: 16px;
}

.moe-q-prompt p {
  margin: 0 0 10px;
}

.moe-q-equation {
  background: #f8fafc;
  border: 1px solid var(--moe-soft-line);
  border-radius: 8px;
  padding: 14px;
  white-space: pre-wrap;
  font-family: "Courier New", monospace;
  margin-bottom: 16px;
}

.moe-answer-area {
  display: grid;
  gap: 8px;
}

.moe-answer-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--moe-soft-line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px 14px;
  cursor: pointer;
  transition: 0.12s;
}

.moe-answer-option:hover {
  border-color: #a8dab5;
  background: var(--moe-surface);
}

.moe-answer-option input {
  margin-top: 4px;
  accent-color: var(--moe-green);
  flex-shrink: 0;
}

.moe-answer-option span {
  font-size: 14px;
  line-height: 1.55;
}

.moe-answer-option strong {
  color: var(--moe-navy);
}

.moe-q-textarea {
  width: 100%;
  min-height: 140px;
  border: 1px solid var(--moe-line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
  color: var(--moe-text);
  font-size: 14px;
  resize: vertical;
}

.moe-q-textarea:focus {
  border-color: var(--moe-green);
  box-shadow: 0 0 0 3px rgba(26, 138, 58, 0.12);
  outline: 0;
}

.moe-submit-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: var(--moe-surface);
  border: 1px solid var(--moe-line);
  border-top-color: var(--moe-soft-line);
  border-radius: 10px 10px 0 0;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.04);
}

.moe-submit-bar span {
  color: var(--moe-muted);
  font-size: 13px;
  font-weight: 600;
}

/* -------- Exam Room — Student attempt view -------- */

.er-layout {
  max-width: 1640px;
  margin: 0 auto;
  padding: 38px 28px 0;
}

.er-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--moe-muted);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 14px;
}

.er-breadcrumb a {
  color: #0a4d43;
  text-decoration: none;
  transition: color 0.15s ease;
}

.er-breadcrumb a:hover {
  color: #0f7b63;
  text-decoration: underline;
}

.er-breadcrumb a:focus-visible {
  outline: 3px solid rgba(15, 123, 99, 0.35);
  outline-offset: 2px;
  border-radius: 2px;
}

.er-breadcrumb span {
  color: #dce7e1;
}

.er-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.er-title-icon {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  border: 2px solid #b94e35;
  color: #b94e35;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 900;
}

.er-title-row h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 44px);
  letter-spacing: 0;
}

.er-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  align-items: start;
}

.er-panel {
  background: #ffffff;
  border-top: 4px solid transparent;
  border-image: linear-gradient(90deg, #0f7b63 0 50%, #b94e35 50% 100%) 1;
  padding: 34px;
  box-shadow: 0 16px 40px rgba(20, 35, 42, 0.12);
}

.er-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.er-save-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #64746e;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

.er-save-state::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #89969a;
  flex-shrink: 0;
}

.er-save-state.is-saving::before {
  background: #f0b429;
}

.er-save-state.is-saved {
  color: #247246;
}

.er-save-state.is-saved::before {
  background: #247246;
}

.er-save-state.is-error {
  color: #a63a3a;
}

.er-save-state.is-error::before {
  background: #a63a3a;
}

.er-timer {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(166, 58, 58, 0.35);
  color: #7b2a2a;
  background: rgba(166, 58, 58, 0.06);
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.er-timer.warning {
  border-color: rgba(240, 180, 41, 0.55);
  color: #654b10;
  background: rgba(240, 180, 41, 0.14);
}

.er-timer.danger {
  border-color: rgba(166, 58, 58, 0.6);
  color: #7b2a2a;
  background: rgba(166, 58, 58, 0.12);
  animation: er-timer-pulse 1.6s ease-in-out infinite;
}

@keyframes er-timer-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(166, 58, 58, 0.25); }
  50% { box-shadow: 0 0 0 6px rgba(166, 58, 58, 0); }
}

.er-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 6px;
  border: 1px solid #aebabe;
  padding: 0 16px;
  text-decoration: none;
  background: #ffffff;
  color: #17231f;
  font-weight: 800;
  white-space: nowrap;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.er-btn:hover {
  background: #f4f7f6;
  border-color: #89969a;
  color: #17231f;
}

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

.er-btn:focus-visible {
  outline: 3px solid rgba(15, 123, 99, 0.35);
  outline-offset: 2px;
}

.er-btn.primary {
  border-color: transparent;
  background: #0a4d43;
  color: #ffffff;
}

.er-btn.primary:hover {
  background: #0d5f52;
  border-color: transparent;
  color: #ffffff;
}

.er-q-row {
  display: grid;
  grid-template-columns: 144px minmax(0, 1fr);
  gap: 26px;
  margin-bottom: 34px;
  scroll-margin-top: 20px;
}

.er-q-card {
  border: 1px solid #cbd5d8;
  background: #f8fafb;
  border-radius: 4px;
  padding: 16px;
  min-height: 170px;
}

.er-q-card h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1;
}

.er-q-card .number {
  display: block;
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 12px;
}

.er-q-card p {
  margin: 8px 0;
  color: #2d3a40;
  font-size: 15px;
}

.er-q-card .er-answered {
  color: #247246;
}

.er-q-card .er-pending {
  color: #64746e;
}

.er-flag-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 15px;
  color: #64746e;
  cursor: pointer;
  transition: color 0.15s ease;
}

.er-flag-label:hover {
  color: #2d3a40;
}

.er-flag-label input {
  display: none;
}

.er-flag-label.flagged,
.er-flag-label.flagged:hover {
  color: #f0b429;
}

.er-q-body {
  background: #e7eeee;
  border-radius: 4px;
  padding: 24px 28px;
  min-height: 250px;
}

.er-q-body h3 {
  margin: 0 0 20px;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.45;
}

.er-q-body .er-equation {
  background: #ffffff;
  border: 1px solid #dce7e1;
  border-radius: 8px;
  padding: 14px;
  white-space: pre-wrap;
  font-family: "Courier New", monospace;
  margin-bottom: 16px;
}

.er-choices {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.er-choices label {
  display: grid;
  grid-template-columns: 22px 22px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  cursor: pointer;
  font-size: 18px;
  padding: 10px 12px;
  margin: -10px -12px;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.er-choices label:hover {
  background: rgba(255, 255, 255, 0.65);
}

.er-choices label:has(input:checked) {
  background: rgba(15, 123, 99, 0.09);
}

.er-choices label:focus-within {
  outline: 3px solid rgba(15, 123, 99, 0.35);
  outline-offset: 2px;
}

.er-choices input[type="radio"],
.er-choices input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 4px;
  accent-color: #0f7b63;
  cursor: pointer;
}

.er-choices .letter {
  font-weight: 800;
}

.er-q-body textarea {
  width: 100%;
  min-height: 130px;
  border: 1px solid #dce7e1;
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
  color: #17231f;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  font-family: inherit;
}

.er-q-body textarea::placeholder {
  color: #89969a;
}

.er-q-body textarea:focus {
  border-color: #0f7b63;
  box-shadow: 0 0 0 3px rgba(15, 123, 99, 0.12);
  outline: 0;
}

.er-submit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  border-top: 1px solid #dce7e1;
  padding-top: 22px;
}

.er-submit-row span {
  color: #64746e;
  font-size: 14px;
  font-weight: 600;
}

.er-side {
  background: #ffffff;
  border: 1px solid #dce7e1;
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 16px 40px rgba(20, 35, 42, 0.12);
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 124px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #cbd5d8 transparent;
}

.er-side::-webkit-scrollbar {
  width: 8px;
}

.er-side::-webkit-scrollbar-thumb {
  background: #cbd5d8;
  border-radius: 999px;
}

.er-side h2 {
  margin: 0 0 16px;
  font-size: 22px;
  font-weight: 500;
}

.er-nav {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
}

.er-qnum {
  min-width: 0;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid #89969a;
  border-radius: 4px;
  color: #17231f;
  text-decoration: none;
  background: #f2f5f6;
  font-size: 14px;
  font-weight: 700;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.er-qnum:hover {
  background: #eef3f8;
  border-color: #6d7a7e;
}

.er-qnum:focus-visible {
  outline: 3px solid rgba(15, 123, 99, 0.35);
  outline-offset: 2px;
}

.er-qnum.current {
  outline: 3px solid #0a4d43;
  outline-offset: -1px;
  border-color: #0a4d43;
  background: #dce8ea;
  font-weight: 900;
}

.er-qnum.saved {
  background: #d8e9df;
  border-color: #82ae92;
}

.er-finish-link {
  display: inline-block;
  margin-top: 20px;
  color: #0a4d43;
  font-weight: 800;
  text-decoration: none;
  font-size: 14px;
}

.er-finish-link:hover {
  color: #0f7b63;
  text-decoration: underline;
}

.er-finish-link:focus-visible {
  outline: 3px solid rgba(15, 123, 99, 0.35);
  outline-offset: 2px;
  border-radius: 2px;
}

.er-note {
  margin-top: 18px;
  padding: 14px 16px;
  background: rgba(240, 180, 41, 0.14);
  border-left: 4px solid #f0b429;
  border-radius: 6px;
  color: #654b10;
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 1060px) {
  .er-grid {
    grid-template-columns: 1fr;
  }
  .er-side {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
}

@media (max-width: 760px) {
  .er-layout {
    padding: 28px 18px 0;
  }
  .er-panel {
    padding: 24px;
  }
  .er-q-row {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .er-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .er-timer {
    justify-content: center;
  }
  .er-save-state {
    justify-content: center;
  }
  .er-nav {
    grid-template-columns: repeat(5, 1fr);
  }
  .er-submit-row {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 480px) {
  .er-layout {
    padding: 22px 12px 0;
  }
  .er-panel {
    padding: 18px 14px;
  }
  .er-q-body {
    padding: 18px 16px;
  }
  .er-choices label {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .er-breadcrumb a,
  .er-btn,
  .er-timer,
  .er-flag-label,
  .er-choices label,
  .er-qnum {
    transition: none;
  }
  .er-timer.danger {
    animation: none;
  }
}

/* -------- Result Page -------- */
.moe-result-page {
  width: min(100%, 1200px);
  margin: 0 auto;
  padding: 28px 18px;
}

.moe-result-header {
  background: linear-gradient(135deg, var(--moe-navy), var(--moe-blue));
  border-radius: 12px;
  padding: 28px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  color: #fff;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.moe-result-header h1 {
  margin: 0;
  font-size: clamp(26px, 3vw, 38px);
}

.moe-result-header p {
  margin: 6px 0 0;
  opacity: 0.8;
}

.moe-result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  align-items: start;
}

.moe-result-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.moe-result-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.moe-notice {
  padding: 18px;
  background: var(--moe-gold-soft);
  border-left: 5px solid var(--moe-gold);
  border-radius: 8px;
}

.moe-notice h3 {
  margin: 0 0 6px;
  color: #7a5a0a;
  font-size: 16px;
}

.moe-notice p {
  margin: 0;
  color: #7a5a0a;
  font-size: 14px;
}

/* -------- Review Page -------- */
.moe-review-page {
  flex: 1;
  width: min(100%, 1500px);
  margin: 0 auto;
  padding: 18px;
}

.moe-review-header {
  background: var(--moe-navy);
  border-radius: 10px;
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  color: #fff;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.moe-review-header h1 {
  margin: 0;
  font-size: clamp(20px, 2.5vw, 30px);
}

.moe-review-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.moe-p-cell.correct {
  background: #d7ead8;
  border-color: #7eb987;
  color: #1a6e30;
}

.moe-p-cell.partial {
  background: var(--moe-gold-soft);
  border-color: var(--moe-gold);
  color: #7a5a0a;
}

.moe-p-cell.wrong {
  background: var(--moe-red-soft);
  border-color: #f5a8a5;
  color: var(--moe-red);
}

.moe-p-cell.blank {
  background: #f5f7fa;
  border-color: var(--moe-line);
  color: var(--moe-muted);
}

.moe-review-options {
  display: grid;
  gap: 8px;
}

.moe-review-option {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: start;
  border: 1px solid var(--moe-soft-line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
  font-size: 14px;
}

.moe-review-option.correct {
  border-color: #a8dab5;
  background: var(--moe-green-soft);
}

.moe-review-option.wrong {
  border-color: #f5a8a5;
  background: var(--moe-red-soft);
}

.moe-review-option .opt-label {
  font-weight: 900;
  color: var(--moe-navy);
}

.moe-review-option strong {
  color: var(--moe-green);
  font-size: 12px;
  white-space: nowrap;
}

.moe-written-answer {
  background: #f8fafc;
  border: 1px solid var(--moe-soft-line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.moe-written-answer h3 {
  margin: 0;
  font-size: 13px;
  color: var(--moe-navy);
}

.moe-written-answer p {
  margin: 0;
  line-height: 1.55;
}

.moe-explanation {
  margin-top: 12px;
  padding: 14px;
  background: var(--moe-light-blue);
  border: 1px solid #c5d9f5;
  border-radius: 8px;
}

.moe-explanation h3 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--moe-navy);
}

.moe-explanation p {
  margin: 0;
  line-height: 1.55;
  font-size: 14px;
}

/* -------- Staff (Admin/Teacher) Base -------- */
.moe-staff-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.moe-staff-sidebar {
  background: var(--moe-navy);
  color: #fff;
  padding: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.moe-staff-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 6px;
}

.moe-staff-brand img {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  object-fit: cover;
  background: #fff;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
  flex-shrink: 0;
}

.moe-staff-brand strong {
  display: block;
  font-size: 13px;
}

.moe-staff-brand span {
  display: block;
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  margin-top: 2px;
}

.moe-staff-nav {
  display: grid;
  gap: 4px;
  margin-top: 12px;
}

.moe-staff-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.75);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  transition: 0.1s;
}

.moe-staff-nav a:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.moe-staff-nav a i {
  width: 20px;
  text-align: center;
  font-size: 14px;
}

.moe-staff-main {
  min-width: 0;
}

.moe-staff-topbar {
  min-height: 64px;
  padding: 14px 28px;
  background: #fff;
  border-bottom: 1px solid var(--moe-soft-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.moe-staff-topbar h1 {
  margin: 0;
  color: var(--moe-navy);
  font-size: 20px;
}

.moe-staff-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--moe-muted);
}

.moe-staff-body {
  padding: 22px 28px 40px;
}

.moe-msg {
  border: 1px solid var(--moe-line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  color: var(--moe-text);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 10px;
}

.moe-msg.success {
  background: var(--moe-green-soft);
  color: #1a6e30;
  border-color: #a8dab5;
}

.moe-msg.error {
  background: var(--moe-red-soft);
  color: var(--moe-red);
  border-color: #f5a8a5;
}

/* -------- Staff Page Elements -------- */
.moe-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.moe-page-head h2 {
  color: var(--moe-navy);
  font-size: 26px;
  margin: 0 0 4px;
}

.moe-page-head p {
  color: var(--moe-muted);
  margin: 0;
  font-size: 14px;
}

.moe-staff-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.moe-staff-metric {
  background: #fff;
  border: 1px solid var(--moe-line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--moe-shadow);
}

.moe-staff-metric span {
  display: block;
  color: var(--moe-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.moe-staff-metric strong {
  display: block;
  margin-top: 6px;
  color: var(--moe-navy);
  font-size: 26px;
}

.moe-staff-table-wrap {
  background: #fff;
  border: 1px solid var(--moe-line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--moe-shadow);
}

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

.moe-staff-table th,
.moe-staff-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--moe-soft-line);
  vertical-align: top;
  font-size: 13px;
}

.moe-staff-table th {
  background: #f5f7fa;
  color: var(--moe-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.moe-staff-table tbody tr:hover {
  background: #fafcfd;
}

.moe-staff-table td strong {
  color: var(--moe-navy);
}

.moe-filter-card {
  background: #fff;
  border: 1px solid var(--moe-line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--moe-shadow);
}

.moe-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  align-items: end;
}

.moe-filter-grid label {
  display: block;
  font-weight: 700;
  color: var(--moe-navy);
  margin-bottom: 6px;
  font-size: 12px;
}

.moe-filter-grid select,
.moe-filter-grid input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--moe-line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fbfcfd;
  color: var(--moe-text);
  font-size: 13px;
}

/* -------- Status Badges -------- */
.moe-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-weight: 800;
  font-size: 11px;
  background: #f5f7fa;
  color: var(--moe-muted);
}

.moe-status.draft {
  background: #f5f7fa;
  color: var(--moe-muted);
}

.moe-status.submitted {
  background: var(--moe-gold-soft);
  color: #7a5a0a;
}

.moe-status.approved {
  background: var(--moe-green-soft);
  color: #1a6e30;
}

.moe-status.published {
  background: #d3eaff;
  color: #0a4f8a;
}

.moe-status.closed {
  background: var(--moe-red-soft);
  color: var(--moe-red);
}

.moe-status.archived {
  background: #f0f0f0;
  color: #666;
}

/* -------- Responsive -------- */
@media (max-width: 1000px) {
  .moe-room-layout,
  .moe-review-layout,
  .moe-start-layout,
  .moe-result-layout,
  .moe-portal-grid {
    grid-template-columns: 1fr;
  }
  .moe-palette {
    position: static;
  }
  .moe-palette-grid {
    grid-template-columns: repeat(8, 1fr);
  }
  .moe-metrics,
  .moe-result-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .moe-staff-shell {
    grid-template-columns: 1fr;
  }
  .moe-staff-sidebar {
    position: static;
    height: auto;
  }
}

@media (max-width: 768px) {
  .moe-login-wrap {
    grid-template-columns: 1fr;
  }
  .moe-login-features {
    grid-template-columns: 1fr;
  }
  .moe-start-header,
  .moe-result-header,
  .moe-room-header,
  .moe-review-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .moe-metrics,
  .moe-result-metrics {
    grid-template-columns: 1fr 1fr;
  }
  .moe-exam-meta {
    grid-template-columns: 1fr;
  }
  .moe-exam-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .moe-metrics,
  .moe-result-metrics {
    grid-template-columns: 1fr;
  }
  .moe-palette-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* =============================================================
   UNIFIED BRIDGE CLASSES
   Maps teacher / admin / summary-page class names to the MoE
   design system so every page is visually consistent.
   ============================================================= */

/* ---- CSS variable aliases (used by student_attempt_summary) ---- */
:root {
  --blue:         var(--moe-navy);
  --surface:      var(--moe-surface);
  --surface-soft: #f8fafc;
  --line:         var(--moe-line);
  --line-soft:    var(--moe-soft-line);
  --shadow:       var(--moe-shadow);
  --muted:        var(--moe-muted);
  --teal-dark:    var(--moe-green);
  --success:      var(--moe-green);
  --danger:       var(--moe-red);
  --gold:         var(--moe-gold);
  --green:        var(--moe-green);
  --moe-soft:     #5f6b7a;
}

/* ---- Page wrapper ---- */
.exam-page {
  display: grid;
  gap: 18px;
}

/* ---- Page header ---- */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.page-head h2 {
  color: var(--moe-navy);
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  margin: 0 0 3px;
  line-height: 1.2;
}

.page-head p {
  color: var(--moe-muted);
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
}

/* ---- Buttons ---- */
.btn-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-row .btn,
.btn-row button {
  flex-shrink: 0;
}

.btn.primary {
  background: var(--moe-green);
  color: #fff;
  border-color: var(--moe-green);
}

.btn.primary:hover {
  background: #157a32;
}

.btn.danger {
  background: var(--moe-red-soft);
  color: var(--moe-red);
  border-color: #f5a8a5;
}

.btn.danger:hover {
  background: var(--moe-red);
  color: #fff;
}

/* ---- Inline form (e.g. single-button forms in table rows) ---- */
.inline-form {
  display: inline-flex;
  align-items: center;
}

/* ---- Notice / alert ---- */
.notice {
  padding: 16px 18px;
  background: var(--moe-gold-soft);
  border-left: 5px solid var(--moe-gold);
  border-radius: 8px;
}

.notice strong {
  display: block;
  color: #7a5a0a;
  font-size: 14px;
  margin-bottom: 4px;
}

.notice p {
  margin: 4px 0 0;
  color: #7a5a0a;
  font-size: 13px;
  line-height: 1.55;
}

/* ---- Metrics row ---- */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.metric {
  background: var(--moe-surface);
  border: 1px solid var(--moe-line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--moe-shadow);
}

.metric span {
  display: block;
  color: var(--moe-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.metric strong {
  display: block;
  margin-top: 6px;
  color: var(--moe-navy);
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  line-height: 1.15;
}

/* ---- Form stack ---- */
.form-stack {
  display: grid;
  gap: 16px;
}

/* ---- Question list (wrapper for question/answer/comment cards) ---- */
.question-list {
  display: grid;
  gap: 14px;
}

/* ---- Review list (student attempt review) ---- */
.review-list {
  display: grid;
  gap: 16px;
}

/* ---- Student page wrapper (blocked / access pages) ---- */
.student-page {
  display: grid;
  gap: 0;
}

/* ---- Question card ---- */
.question-card {
  background: var(--moe-surface);
  border: 1px solid var(--moe-line);
  border-radius: 10px;
  padding: 20px 22px;
  box-shadow: var(--moe-shadow);
}

.question-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--moe-soft-line);
  margin-bottom: 14px;
}

.option-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: grid;
  gap: 6px;
}

.option-list li {
  padding: 10px 14px;
  border: 1px solid var(--moe-soft-line);
  border-radius: 8px;
  background: #f8fafc;
  font-size: 14px;
  line-height: 1.55;
}

.option-list li strong {
  color: var(--moe-navy);
}

.option-list li.correct {
  border-color: #a8dab5;
  background: var(--moe-green-soft);
}

/* ---- Split grid (two-column layout) ---- */
.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

@media (max-width: 1100px) {
  .split-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Table card ---- */
.table-card {
  background: var(--moe-surface);
  border: 1px solid var(--moe-line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--moe-shadow);
}

/* ---- Exam table ---- */
.exam-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.exam-table th {
  background: #f5f7fa;
  color: var(--moe-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--moe-line);
}

.exam-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--moe-soft-line);
  font-size: 13px;
  vertical-align: top;
}

.exam-table tbody tr {
  transition: background 0.15s;
}

.exam-table tbody tr:hover {
  background: #fafcfd;
}

/* ---- Filter bar ---- */
.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  align-items: end;
}

.filter-bar label {
  display: block;
  font-weight: 700;
  color: var(--moe-navy);
  margin-bottom: 6px;
  font-size: 12px;
}

.filter-bar select,
.filter-bar input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--moe-line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fbfcfd;
  color: var(--moe-text);
  font-size: 13px;
}

/* ---- Field errors ---- */
.field-errors {
  color: var(--moe-red);
  font-size: 12px;
  font-weight: 700;
  margin-top: 4px;
}

/* ---- Muted text helper ---- */
.muted {
  color: var(--moe-muted);
  font-size: 13px;
  line-height: 1.55;
}

/* ---- Form grid ---- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.form-grid label,
.form-grid > div > label {
  display: block;
  font-weight: 700;
  color: var(--moe-navy);
  margin-bottom: 6px;
  font-size: 13px;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
}

/* ---- Message / flash ---- */
.message.error {
  padding: 12px 14px;
  background: var(--moe-red-soft);
  color: var(--moe-red);
  border: 1px solid #f5a8a5;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
}

/* ---- Badge state colors (extend moe-status) ---- */
.badge.rejected,
.badge.closed {
  background: var(--moe-red-soft);
  color: var(--moe-red);
}

.badge.approved,
.badge.correct {
  background: var(--moe-green-soft);
  color: #1a6e30;
}

.badge.submitted,
.badge.pending {
  background: var(--moe-gold-soft);
  color: #7a5a0a;
}

.badge.browser-secure {
  background: #eff6ff;
  color: #1d4ed8;
}

.badge.browser-normal {
  background: var(--moe-green-soft);
  color: #1a6e30;
}

/* ---- Question studio (question_form.html scoped styles) ---- */
.question-studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.studio-main {
  display: grid;
  gap: 16px;
}

.studio-panel,
.sidebar-card {
  background: var(--moe-surface);
  border: 1px solid var(--moe-line);
  border-radius: 8px;
  box-shadow: var(--moe-shadow);
  padding: 18px;
}

.studio-panel-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--moe-soft-line);
}

.studio-panel-head h3,
.sidebar-card h3 {
  margin: 0;
  color: var(--moe-navy);
  font-size: 1.12rem;
}

.studio-panel-head p,
.sidebar-card p {
  margin: 4px 0 0;
  color: var(--moe-muted);
  line-height: 1.5;
  font-size: 13px;
}

.studio-step {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--moe-green-soft);
  color: var(--moe-green);
  display: grid;
  place-items: center;
  font-weight: 900;
  flex: 0 0 auto;
}

.compact-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.studio-field {
  min-width: 0;
}

.studio-field textarea {
  min-height: 130px;
}

.option-editor {
  display: grid;
  gap: 10px;
}

.option-row {
  display: grid;
  grid-template-columns: 72px minmax(180px, 1fr) 90px 80px 80px;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--moe-soft-line);
  border-radius: 8px;
  background: #fbfcf8;
}

.option-row textarea {
  min-height: 58px;
  resize: vertical;
}

.option-row > div {
  min-width: 0;
}

.option-check {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--moe-navy);
  font-weight: 900;
}

.option-check input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--moe-green);
}

.delete-check {
  color: var(--moe-red);
}

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

.studio-sidebar {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 94px;
}

.sidebar-card ul {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--moe-muted);
  line-height: 1.7;
  font-size: 13px;
}

.studio-actions {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.studio-actions .btn {
  width: 100%;
}

@media (max-width: 1100px) {
  .question-studio {
    grid-template-columns: 1fr;
  }
  .studio-sidebar {
    position: static;
  }
}

@media (max-width: 760px) {
  .option-row,
  .answer-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Dialog / modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 37, 64, 0.45);
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-backdrop[aria-hidden="true"] {
  display: none;
}

.dialog {
  background: var(--moe-surface);
  border: 1px solid var(--moe-line);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(10, 37, 64, 0.2);
  max-width: 520px;
  width: 100%;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--moe-soft-line);
}

.dialog-head h2 {
  margin: 0;
  color: var(--moe-navy);
  font-size: 18px;
}

.dialog-body {
  padding: 18px 22px;
}

.dialog-body p {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--moe-text);
  line-height: 1.55;
}

.dialog-body p:last-child {
  margin-bottom: 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--moe-soft-line);
}

.btn.dark {
  background: #f5f7fa;
  color: var(--moe-text);
  border: 1px solid var(--moe-line);
}

.btn.dark:hover {
  background: #eef1f5;
}

.icon-button {
  border: 0;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--moe-muted);
  line-height: 1;
  padding: 4px;
  transition: color 0.15s;
}

.icon-button:hover {
  color: var(--moe-navy);
}

/* ---- Smooth transitions globally ---- */
a,
button,
.btn,
.moe-btn,
input,
select,
textarea,
.badge,
.moe-status,
.moe-p-cell,
.moe-exam-card,
.card,
.question-card,
.metric,
.moe-staff-metric,
.palette-cell,
.status-row,
.option-list li,
.moe-answer-option,
.option-row {
  transition: all 0.2s ease;
}

/* ---- Scrollbar styling ---- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--moe-line);
  border-radius: 3px;
}

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

/* ---- Staff login page ---- */
.staff-login-page {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 460px);
  align-items: center;
  gap: 56px;
  padding: 34px 0 52px;
}

.context-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--moe-green-soft);
  color: var(--moe-green);
  font-weight: 800;
  font-size: 0.84rem;
  margin-bottom: 20px;
}

.login-context h1 {
  color: var(--moe-navy);
  font-size: clamp(2.45rem, 5vw, 4rem);
  line-height: 1;
  max-width: 720px;
}

.login-context p {
  margin-top: 22px;
  color: var(--moe-muted);
  line-height: 1.75;
  font-size: 1.04rem;
  max-width: 650px;
}

.context-card {
  margin-top: 30px;
  max-width: 560px;
  border-left: 4px solid var(--moe-green);
  padding: 18px;
  background: var(--moe-surface);
  border: 1px solid var(--moe-line);
  border-radius: 8px;
  box-shadow: var(--moe-shadow);
}

.context-card strong {
  display: block;
  color: var(--moe-navy);
}

.context-card span {
  display: block;
  color: var(--moe-muted);
  line-height: 1.55;
  margin-top: 4px;
}

.staff-login-form {
  margin-bottom: 20px;
}

.staff-login-form h2 {
  margin: 0;
  color: var(--moe-navy);
  font-size: 22px;
}

.staff-login-form > p {
  margin: 4px 0 0;
  color: var(--moe-muted);
}

.moe-field-icon {
  position: relative;
}

.moe-field-icon i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--moe-muted);
  pointer-events: none;
}

.moe-field-icon input {
  padding-left: 42px;
}

@media (max-width: 900px) {
  .staff-login-page {
    grid-template-columns: 1fr;
    gap: 30px;
    padding-top: 22px;
  }
}

@media (max-width: 560px) {
  .login-context h1 {
    font-size: 2.45rem;
  }
}

/* ---- Compact action buttons (table rows) ---- */
.moe-btn-sm {
  min-height: 32px;
  font-size: 12px;
  padding: 0 12px;
}

.moe-btn-sm i {
  font-size: 11px;
}

.moe-btn-sm.moe-btn-full {
  width: 100%;
}

/* ---- Action group (button row in tables / headers) ---- */
.moe-action-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.moe-action-group-lg {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- Secondary text helper ---- */
.moe-text-secondary {
  color: var(--moe-muted);
  font-size: 12px;
}

.moe-text-xs {
  font-size: 11px;
  color: var(--moe-muted);
  word-break: break-all;
  margin-top: 6px;
}

/* ---- Inline-flex gap helper ---- */
.moe-flex-gap {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.moe-flex-gap-sm {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* =============================================================
   DETAIL PAGE LAYOUT (admin_exam_detail two-column)
   ============================================================= */

.detail-main {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.detail-sidebar {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 94px;
  align-self: start;
}

.detail-section {
  display: grid;
  gap: 14px;
}

.detail-section-title {
  margin: 0;
  color: var(--moe-navy);
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-section-title i {
  color: var(--moe-muted);
  font-size: 14px;
}

/* ---- Sidebar card internals ---- */
.sidebar-actions {
  display: grid;
  gap: 8px;
}

.sidebar-status-row {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.sidebar-status-row p {
  margin: 0;
  color: var(--moe-muted);
  font-size: 13px;
  line-height: 1.5;
}

.sidebar-link-box {
  background: var(--moe-bg);
  border: 1px solid var(--moe-soft-line);
  border-radius: 6px;
  padding: 10px 12px;
  word-break: break-all;
}

.sidebar-link-box code {
  font-size: 12px;
  color: var(--moe-navy);
  font-weight: 700;
}

.sidebar-dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  font-size: 13px;
}

.sidebar-dl dt {
  color: var(--moe-muted);
  font-weight: 700;
}

.sidebar-dl dd {
  margin: 0;
  color: var(--moe-text);
}

@media (max-width: 1100px) {
  .detail-sidebar {
    position: static;
  }
}
