*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

@media print {
    .admin-sidebar, .admin-section, .btn, .btn-sm { display: none !important; }
    .admin-layout { display: block; }
    .admin-main { padding: 0; }
    .data-table { font-size: 12px; }
    .admin-page-title { font-size: 16px; margin-bottom: 12px; }
}

:root {
    --navy: #1a1a2e;
    --blue: #16213e;
    --accent: #0f3460;
    --text: #222;
    --text-light: #555;
    --bg: #f9f9f9;
    --white: #fff;
    --border: #ddd;
    --success: #2d7a4f;
    --error: #b91c1c;
    --info: #1d4ed8;
    --radius: 6px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.site-header {
    background: var(--navy);
    color: var(--white);
    padding: 0 24px;
}
.header-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
}
.brand {
    color: var(--white);
    text-decoration: none;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.5px;
}
.site-header nav a {
    color: #ccc;
    text-decoration: none;
    margin-left: 24px;
    font-size: 14px;
}
.site-header nav a:hover { color: var(--white); }

/* Main */
.main-content {
    flex: 1;
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
    padding: 40px 24px;
}

/* Footer */
.site-footer {
    background: var(--navy);
    color: #aaa;
    text-align: center;
    padding: 16px;
    font-size: 13px;
}
.site-footer a { color: #aaa; }

/* -----------------------------------------------------------------------
   Student Dashboard
   ----------------------------------------------------------------------- */

.dashboard-header {
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.dashboard-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px;
}

.enrollment-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.enr-tag {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 13px;
    color: var(--text-light);
}

.points-badge {
    display: inline-block;
    margin-top: 10px;
    background: var(--gold, #f59e0b);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    border-radius: 20px;
    padding: 3px 14px;
}

.dash-section {
    margin-bottom: 40px;
}

.dash-section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    margin: 0 0 16px;
}

.dash-empty {
    color: var(--text-light);
    font-size: 14px;
    padding: 16px 0;
}

/* Assessment cards */
.assessment-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.assessment-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.assessment-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.assessment-card-name {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.assessment-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

/* Scores table */
.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.dash-table th {
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-light);
    padding: 8px 12px;
    border-bottom: 2px solid var(--border);
}

.dash-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.dash-table tr:last-child td { border-bottom: none; }

/* Certificates */
.cert-list {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.cert-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 20px;
    min-width: 220px;
}

.cert-card-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

/* Badges */
.badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.badge-chip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 13px;
    font-weight: 500;
}

.badge-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.badge-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90px;
    text-align: center;
    gap: 6px;
}

.badge-card-img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.badge-card-img:hover {
    transform: scale(1.08);
}

.badge-card-placeholder {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
}

.badge-card-name {
    font-size: 11px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.3;
}

/* Locked (unearned) badge */
.badge-card-locked .badge-card-img {
    filter: grayscale(1) brightness(0.55);
    opacity: 0.6;
}

.badge-card-locked .badge-card-placeholder {
    filter: grayscale(1);
    opacity: 0.4;
}

.badge-card-locked .badge-card-name {
    color: #999;
}

/* Badge lightbox */
.badge-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.badge-lightbox.open {
    display: flex;
}

.badge-lightbox-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    pointer-events: none;
}

.badge-lightbox-img-wrap {
    position: relative;
    width: 220px;
    height: 220px;
}

.badge-lightbox-img-wrap img {
    width: 220px;
    height: 220px;
    object-fit: contain;
    border-radius: 16px;
    display: block;
}

.badge-lightbox-lock {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 16px;
}

.badge-lightbox-locked .badge-lightbox-img-wrap img {
    filter: grayscale(1) brightness(0.5);
}

.badge-lightbox-locked .badge-lightbox-lock {
    display: flex;
}

.badge-lightbox-name {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
}

.badge-lightbox-status {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 3px 12px;
    border-radius: 20px;
}

.badge-lightbox:not(.badge-lightbox-locked) .badge-lightbox-status {
    background: rgba(80, 200, 120, 0.25);
    color: #7effa0;
}

.badge-lightbox-locked .badge-lightbox-status {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.55);
}

.badge-lightbox-desc {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.72);
    max-width: 320px;
    text-align: center;
    line-height: 1.5;
}

/* Impersonation banner */
.impersonation-banner {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: var(--radius);
    padding: 10px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #664d03;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Flash messages */
.flash-messages { margin-bottom: 24px; }
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 14px;
}
.flash-info { background: #eff6ff; color: var(--info); border: 1px solid #bfdbfe; }
.flash-error { background: #fef2f2; color: var(--error); border: 1px solid #fecaca; }
.flash-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }

/* Auth card */
.auth-card {
    max-width: 440px;
    margin: 0 auto;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
}
.auth-card h1 {
    font-size: 22px;
    margin-bottom: 8px;
    color: var(--navy);
}
.auth-sub {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 28px;
    line-height: 1.5;
}
.auth-alt {
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-light);
    text-align: center;
}
.auth-alt a { color: var(--accent); }

/* Forms */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}
.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.15s;
}
.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 52, 96, 0.12);
}
.otp-input {
    font-size: 28px !important;
    letter-spacing: 10px;
    text-align: center;
    font-weight: 700;
}
.code-input {
    font-size: 22px !important;
    text-align: center;
    font-weight: 700;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s;
}
.btn:hover { opacity: 0.88; }
.btn-primary {
    background: var(--navy);
    color: var(--white);
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

/* =========================================================
   Assessment engine
   ========================================================= */

/* Header bar with timer */
.assessment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
    gap: 16px;
}

.assessment-title { font-size: 22px; color: var(--navy); font-weight: 700; }
.assessment-meta  { font-size: 13px; color: var(--text-light); margin-top: 4px; }

/* Countdown timer */
.timer-box {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 20px;
    text-align: center;
    min-width: 110px;
    flex-shrink: 0;
    position: sticky;
    top: 12px;
    z-index: 100;
}
.timer-label   { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-light); }
.timer-display { font-size: 28px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.timer-warning .timer-display { color: #d97706; }
.timer-warning { border-color: #fbbf24; }
.timer-danger  .timer-display { color: var(--error); }
.timer-danger  { border-color: #fca5a5; }

/* Question cards */
.question-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}

.question-number {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    margin-bottom: 10px;
}

.question-points { font-weight: 400; }

.question-prompt {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
    line-height: 1.5;
}

.question-code {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 16px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-family: "Courier New", Courier, monospace;
    white-space: pre;
    overflow-x: auto;
    margin-bottom: 16px;
    line-height: 1.6;
}

/* MCQ options */
.options-list { display: flex; flex-direction: column; gap: 10px; }

.option-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 15px;
    transition: border-color 0.1s, background 0.1s;
}
.option-label:hover { border-color: var(--accent); background: #f0f4ff; }
.option-label input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; }
.option-label input[type="radio"]:checked + span { font-weight: 600; }

/* Text inputs for code_reading / short_answer / coding */
.answer-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    background: var(--white);
}
.answer-input:focus, .answer-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 52, 96, 0.1);
}

.answer-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    background: var(--white);
    resize: vertical;
    line-height: 1.5;
}

.answer-code {
    font-family: "Courier New", Courier, monospace;
    font-size: 14px;
}

/* Submit bar */
.submit-bar {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.btn-submit {
    background: var(--navy);
    color: var(--white);
    padding: 14px 40px;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: opacity 0.15s;
}
.btn-submit:hover { opacity: 0.88; }

/* Results page */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.score-summary {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.score-block {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    text-align: center;
    min-width: 140px;
}

.score-total { border: 2px solid var(--navy); }

.score-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--navy);
    line-height: 1;
    margin-bottom: 6px;
}

.pending-score { color: #d97706; font-size: 20px; }

.score-label {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Result cards */
.result-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 12px;
}
.result-correct   { border-left-color: #22c55e; }
.result-incorrect { border-left-color: var(--error); }
.result-pending   { border-left-color: #f59e0b; }

.result-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 10px;
}

.result-points { margin-left: auto; font-weight: 700; color: var(--text); }

.result-prompt {
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.4;
}

.result-answer {
    font-size: 14px;
    color: var(--text);
    white-space: pre-wrap;
}

.result-answer-pre {
    margin-top: 6px;
    background: #f8fafc;
    padding: 10px 12px;
    border-radius: var(--radius);
    font-family: "Courier New", Courier, monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
}

.result-feedback {
    margin-top: 10px;
    padding: 8px 12px;
    background: #eff6ff;
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--info);
}

.btn-ghost-sm {
    display: inline-block;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--accent);
    text-decoration: none;
    background: transparent;
    cursor: pointer;
    transition: background 0.1s;
}
.btn-ghost-sm:hover { background: #f0f4ff; }

/* =========================================================
   Admin panel
   ========================================================= */

.admin-body {
    display: block;
    min-height: 100vh;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: var(--navy);
    color: var(--white);
    display: flex;
    flex-direction: column;
    padding: 0;
}

.admin-brand {
    padding: 20px 16px 12px;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.5px;
    color: var(--white);
}

.admin-user-info {
    padding: 0 16px 14px;
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.admin-user-role {
    text-transform: capitalize;
    color: rgba(255,255,255,0.45);
}

.admin-nav {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 8px 0;
}

.admin-nav a {
    display: block;
    padding: 10px 16px;
    color: #aab;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.1s, color 0.1s;
}

.admin-nav a:hover,
.admin-nav a.active {
    background: rgba(255,255,255,0.08);
    color: var(--white);
}

.admin-nav-spacer {
    flex: 1;
}

.admin-nav-logout {
    border-top: 1px solid rgba(255,255,255,0.1);
    color: #f87171 !important;
    margin-top: 8px;
}

/* Main content */
.admin-main {
    flex: 1;
    padding: 32px;
    background: var(--bg);
    overflow-x: auto;
}

.admin-page-title {
    font-size: 22px;
    color: var(--navy);
    margin-bottom: 24px;
    font-weight: 700;
}

/* Stat grid */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 16px;
    text-align: center;
}

.stat-card.stat-alert {
    border-color: #fca5a5;
    background: #fff5f5;
}

.stat-number {
    font-size: 36px;
    font-weight: 700;
    color: var(--navy);
    line-height: 1;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-heading {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    margin-bottom: 12px;
}

/* Course blocks (courses.html) */
.course-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.course-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-list {
    border-top: 1px solid var(--border);
    padding-top: 14px;
}

/* Section tags */
.section-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #e8f0fe;
    color: #2563eb;
    border-radius: 20px;
    padding: 3px 10px 3px 12px;
    font-size: 13px;
    font-weight: 500;
    margin-right: 6px;
    margin-bottom: 6px;
}

.section-tag-inactive {
    background: var(--border);
    color: var(--text-light);
}

.section-tag-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 0 2px;
    color: inherit;
    opacity: 0.7;
}

.section-tag-btn:hover {
    opacity: 1;
}

.admin-quick-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-quick-links .btn-primary {
    width: auto;
    padding: 10px 20px;
    font-size: 14px;
}

/* Admin sections */
.admin-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
}

.admin-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 14px;
}

/* Stacked form row (label above input) */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
}

.form-row label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
}

/* Inline form (horizontal fields) */
.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form input[type="text"],
.inline-form input[type="email"],
.inline-form input[type="number"],
.inline-form select {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    background: var(--white);
    color: var(--text);
}

.inline-form input[type="text"],
.inline-form input[type="email"] {
    min-width: 160px;
}

.field-labeled {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.field-labeled span {
    font-size: 10px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

/* Data table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 13px;
}

.data-table th {
    background: #f1f5f9;
    padding: 10px 12px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr.row-inactive td {
    color: var(--text-light);
}

.data-table tr:hover td {
    background: #fafafa;
}

/* Buttons (admin variants) */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    background: var(--navy);
    color: var(--white);
    text-decoration: none;
    transition: opacity 0.15s;
}

.btn-sm:hover { opacity: 0.85; }

.btn-ghost {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--border);
}

.btn-danger {
    background: var(--error);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.badge-green  { background: #dcfce7; color: #166534; }
.badge-gray   { background: #f1f5f9; color: #64748b; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-red    { background: #fee2e2; color: #991b1b; }

/* Code display */
.code-display {
    font-family: "Courier New", monospace;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--navy);
}

.text-muted { color: var(--text-light); font-size: 12px; }

/* SA / project review cards */
.review-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.review-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 12px;
}

.review-question {
    background: #f8fafc;
    border-left: 3px solid var(--accent);
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 14px;
}

.review-question p { margin-top: 6px; }

.review-answer {
    margin-bottom: 16px;
    font-size: 14px;
}

.review-answer pre {
    margin-top: 6px;
    background: #f1f5f9;
    padding: 12px;
    border-radius: var(--radius);
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
}

.review-form { margin-top: 12px; }

/* ============================================================
   Certificate Editor
============================================================ */
.cert-editor-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.cert-editor-sidebar {
    width: 300px;
    flex-shrink: 0;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border, #ddd);
    border-radius: 6px;
    padding: 16px;
}

.cert-editor-section {
    margin-bottom: 20px;
}

.cert-canvas-wrap {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.cert-canvas-scaler {
    transform-origin: top left;
    display: inline-block;
}

/* Fixed at 1100×850px — matches 11in×8.5in at 100px/in.
   JS scales the scaler div down to fit the sidebar layout. */
.cert-canvas {
    position: relative;
    width: 1100px;
    height: 850px;
    background-color: #fff;
    background-size: cover;
    background-position: center;
    box-shadow: 0 2px 16px rgba(0,0,0,0.18);
}

.cert-field {
    position: absolute;
    border: 2px dashed #0077cc;
    cursor: move;
    user-select: none;
    box-sizing: border-box;
    line-height: 1.2;
    white-space: nowrap;
    overflow: visible;
    background: rgba(255,255,255,0.55);
    padding: 3px 6px;
}

.cert-field:hover {
    border-color: #005fa3;
    background: rgba(255,255,255,0.75);
}

.cert-field.selected {
    border: 2px solid #ff6600;
    background: rgba(255,255,255,0.85);
    z-index: 10;
}

.cert-field-resize {
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 24px;
    background: #0077cc;
    cursor: ew-resize;
    border-radius: 3px;
    opacity: 0.7;
}

.cert-field.selected .cert-field-resize {
    background: #ff6600;
    opacity: 1;
}

.cert-field-delete {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 20px;
    height: 20px;
    background: #cc2200;
    color: #fff;
    border-radius: 50%;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    display: none;
    z-index: 20;
    font-style: normal;
    font-weight: bold;
}

.cert-field:hover .cert-field-delete,
.cert-field.selected .cert-field-delete {
    display: block;
}

.field-add-btn {
    display: block;
    width: 100%;
    margin-bottom: 4px;
    padding: 6px 8px;
    text-align: left;
    background: #f0f4ff;
    border: 1px solid #c0d0ff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.field-add-btn.disabled,
.field-add-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.style-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
}

.style-row label {
    width: 80px;
    flex-shrink: 0;
}

.toggle-btn {
    padding: 3px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    background: #fff;
}

.toggle-btn.active {
    background: #0077cc;
    color: #fff;
    border-color: #0077cc;
}


/* -----------------------------------------------------------------------
   Lesson view
----------------------------------------------------------------------- */

.lesson-header { margin-bottom: 24px; }
.lesson-course { font-size: 13px; color: var(--text-light); margin-top: 4px; }

.lesson-blocks { display: flex; flex-direction: column; gap: 24px; }

.lesson-block { }

.lesson-text { line-height: 1.65; }

.lesson-embed-wrap {
    position: relative;
    width: 80vw;
    left: 50%;
    transform: translateX(-50%);
}

.lesson-zoom { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

/* PDF card — shown on mobile instead of inline iframe */
.lesson-pdf-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    text-align: center;
}
.lesson-pdf-icon { font-size: 48px; line-height: 1; }
.lesson-pdf-label { font-size: 15px; font-weight: 600; color: var(--text); }

.lesson-footer {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}
.lesson-complete-badge {
    font-size: 14px;
    color: #2d8a4e;
    font-weight: 600;
}
.lesson-gate-note {
    font-size: 13px;
    color: var(--text-light);
}

/* Submit confirmation modal */
.sc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.sc-overlay[hidden] { display: none; }
.sc-modal {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 36px 32px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}
.sc-title { font-size: 22px; font-weight: 700; margin: 0 0 12px; }
.sc-body { font-size: 15px; color: var(--text-light); margin: 0 0 28px; }
.sc-actions { display: flex; justify-content: center; gap: 12px; }
.btn-secondary {
    background: var(--border);
    color: var(--text);
}

/* Expired assessment page */
.expired-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 32px 16px;
}
.expired-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 48px 40px;
    max-width: 480px;
    width: 100%;
    text-align: center;
}
.expired-icon { font-size: 56px; line-height: 1; margin-bottom: 16px; }
.expired-title { font-size: 28px; font-weight: 700; margin: 0 0 16px; }
.expired-message { font-size: 16px; color: var(--text); margin: 0 0 12px; line-height: 1.6; }
.expired-sub { font-size: 14px; color: var(--text-light); margin: 0 0 32px; line-height: 1.5; }
.expired-actions { display: flex; justify-content: center; gap: 12px; }
