/* Admin (Sneat): darker body text — do not load theme-overrides.css here (it tints text pink via --bs-secondary) */
body:not(.student-portal) {
    --bs-body-color: #4e5965;
    --bs-body-color-rgb: 78, 89, 101;
}

/* Icon base for Boxicons — match Sneat / Admin (--bs-icon-size: 1.25rem) */
.icon-base {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  font-size: 1.25rem;
  line-height: 1;
  vertical-align: middle;
}

/* Required field asterisk */
.form-label .req {
    color: var(--bs-danger);
}

/* Flatpickr alt input: keep label above picker in modals */
.modal-body .flatpickr-input.form-control {
    display: block;
    width: 100%;
}

/* Rendered rich text (Quill HTML) – display as markup, not raw code */
.rich-text-display {
    line-height: 1.5;
    max-height: 8em;
    overflow: auto;
    word-break: break-word;
}
.rich-text-display ul, .rich-text-display ol { padding-left: 1.25rem; margin-bottom: 0.5rem; }
.rich-text-display p { margin-bottom: 0.5rem; }
.rich-text-display p:last-child { margin-bottom: 0; }

/* Form layout: keep Quill and fields within grid columns */
.quill-wrapper {
    min-width: 0;
    max-width: 100%;
}
.quill-wrapper .quill-editor-target {
    max-width: 100%;
}
.ql-editor {
    min-height: inherit;
}
.ql-container.ql-snow {
    border-radius: 0 0 var(--bs-border-radius);
}
/* Keep multi-column rows (Instructions, AssignQuestions, QuestionGroups) aligned so Quill doesn’t stretch layout */
.instruction-row .row,
.question-row.row,
.group-row .row {
    align-items: flex-start;
}
.instruction-row .col-md-9 .quill-wrapper,
.question-row .col-md-3 .quill-wrapper,
.question-row .col-12 .quill-wrapper,
.group-row .col-md-5 .quill-wrapper,
.group-row .col-12 .quill-wrapper {
    width: 100%;
}

html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin-bottom: 60px;
}

/* Admin tables: keep fixed minimum width and allow horizontal scroll */
.layout-wrapper .table-responsive {
    overflow-x: auto;
}

.layout-wrapper .table-responsive > .table {
    min-width: 1400px;
    table-layout: fixed;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Question collapse header: align number and statement on same baseline */
.question-collapse-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    line-height: 1.5;
    gap: 0.25rem 0.5rem;
}
.question-collapse-header .question-number,
.question-collapse-header > span:first-of-type {
    flex-shrink: 0;
    vertical-align: middle;
}
/* Quiz styles (use core.css --bs-primary) */
.question-card .form-check-input:checked + .form-check-label {
    font-weight: 600;
}

.question-card .table {
    font-size: 0.95em;
}

.question-card code {
    background: rgba(var(--bs-primary-rgb), 0.1);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
}

.question-card var {
    font-style: italic;
}

.feedback-badge.bg-success {
    background-color: var(--bs-success) !important;
}

.feedback-badge.bg-danger {
    background-color: var(--bs-danger) !important;
}

.feedback-badge.bg-warning {
    background-color: var(--bs-warning) !important;
    color: #000;
}

/* Instructions step – rich format (headings, lists, blockquote, etc.) */
.instructions-content {
    min-height: 120px;
    line-height: 1.6;
}

    .instructions-content h1 { font-size: 1.5rem; font-weight: 600; margin-bottom: 0.75rem; }
    .instructions-content h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.5rem; }
    .instructions-content h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }

    .instructions-content ul,
    .instructions-content ol {
        padding-left: 1.25rem;
        margin-bottom: 0.75rem;
    }

    .instructions-content li {
        margin-bottom: 0.5rem;
    }

    .instructions-content blockquote {
        border-left: 4px solid rgba(var(--bs-primary-rgb), 0.5);
        padding-left: 1rem;
        margin: 0.75rem 0;
        color: var(--bs-secondary);
    }

    .instructions-content .ql-code-block-container,
    .instructions-content pre,
    .instructions-content code {
        background: rgba(0, 0, 0, 0.06);
        padding: 0.25rem 0.5rem;
        border-radius: 4px;
        font-size: 0.9em;
    }

    .instructions-content pre { padding: 0.75rem; overflow-x: auto; }
    .instructions-content p { margin-bottom: 0.5rem; }

/* Quiz progress bar */
.quiz-progress-bar .progress {
    background-color: rgba(var(--bs-primary-rgb), 0.15);
}

.quiz-progress-bar .quiz-progress-fill {
    background-color: var(--bs-primary);
}

/* Quiz timers */
.quiz-timers {
    font-size: 1rem;
}

.quiz-timer-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.5rem 0.75rem;
    background: rgba(var(--bs-primary-rgb), 0.08);
    border-radius: 8px;
    border: 1px solid rgba(var(--bs-primary-rgb), 0.2);
    min-width: 100px;
}

.quiz-timer-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bs-primary);
    font-weight: 600;
}

.quiz-timer-value {
    font-size: 1.25rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #333;
}

@media (min-width: 768px) {
    .quiz-timer-value {
        font-size: 1.4rem;
    }
}

/* ========== ACCA Exam Interface (Chapter-wise tests) ========== */
/* Exam mode: hide site header/footer, full-width */
body.quiz-exam-mode header,
body.quiz-exam-mode footer {
    display: none !important;
}
body.quiz-exam-mode .container {
    max-width: none;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
}
body.quiz-exam-mode main {
    padding-bottom: 0;
}

/* ACCA exam header bar – base layout (theme colors in theme-overrides.css) */
.acca-exam-header {
    background: #2d3748;
    color: #e2e8f0;
    padding: 1rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}
.acca-exam-header.acca-exam-topbar {
    padding: 1rem 2rem;
    gap: 1.5rem;
}
.acca-topbar-brand,
.acca-topbar-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.acca-logo-link {
    display: inline-flex;
    color: inherit;
    text-decoration: none;
}
.acca-logo-link:hover {
    color: inherit;
    text-decoration: none;
}
.acca-brand-logo {
    height: 36px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    display: block;
}
.acca-exam-header .acca-logo {
    background: #c41e3a;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    padding: 0.35rem 0.6rem;
    border-radius: 4px;
}
.acca-exam-header .acca-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin: 0;
    letter-spacing: 0.02em;
}
.acca-exam-header .acca-test-name {
    color: #d97706;
    font-weight: 500;
    font-size: 0.95rem;
}
.acca-exam-header .acca-exit-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    color: #e2e8f0;
    text-decoration: none;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    background: #4a5568;
    border: 1px solid #718096;
}
.acca-exam-header .acca-exit-btn:hover { color: #fff; background: #718096; }
.acca-exam-header .acca-exit-btn {
    cursor: pointer;
    text-decoration: none;
    border: none;
}
.acca-exam-header .acca-exit-btn .icon-base { font-size: 1.25rem; }
.acca-exam-header .acca-exit-btn small { font-size: 0.65rem; text-transform: uppercase; }

/* ACCA exam header – question view */
.acca-exam-header .acca-time-value { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.acca-exam-header .acca-progress-bar { height: 6px; background: #4a5568; border-radius: 3px; overflow: hidden; }
.acca-exam-header .acca-progress-fill { height: 100%; background: #38a169; border-radius: 3px; transition: width 0.2s; }
.acca-exam-header .acca-progress-card-btn:hover .acca-progress-details-link { opacity: 0.85; }
.acca-topbar-question-strip .acca-meta-label { color: var(--theme-primary, #c41e3a); }

/* ACCA footer bar */
.acca-exam-footer {
    background: #2d3748;
    color: #e2e8f0;
    padding: 1rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}
.acca-exam-footer .acca-footer-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: #e2e8f0;
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
}
.acca-exam-footer .acca-footer-btn:hover { color: #fff; }
.acca-exam-footer .acca-footer-btn .icon-base { font-size: 1.5rem; }
.acca-exam-footer .acca-footer-btn.acc-primary { color: #d97706; }
.acca-exam-footer .acca-footer-btn.acc-primary:hover { color: #f59e0b; }
.acca-exam-footer .acca-footer-btn.prev .icon-base { font-size: 1.25rem; }
.acca-exam-footer .acca-footer-btn.next .icon-base { font-size: 1.25rem; }
.acca-exam-footer .acca-footer-label { align-self: center; margin: 0; }

/* ACCA instructions – two-column layout */
.acca-instructions-wrapper {
    background: #fff;
    min-height: 60vh;
    padding: 2rem;
}
.acca-instructions-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}
.acca-instructions-alert .icon-base { color: #d97706; font-size: 1.25rem; flex-shrink: 0; }
.acca-instructions-alert p { margin: 0; font-size: 0.95rem; }
.acca-instructions-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}
@media (max-width: 768px) {
    .acca-instructions-columns { grid-template-columns: 1fr; }
}
.acca-instructions-section h5 { font-size: 1.15rem; font-weight: 700; margin-bottom: 1rem; }
.acca-instructions-section ul { padding-left: 1.25rem; margin-bottom: 1rem; }
.acca-instructions-section li { margin-bottom: 0.5rem; }
.acca-instructions-section .acc-example { font-weight: 600; margin-top: 0.25rem; }
.acca-instructions-section .acc-icon-inline { display: inline-flex; align-items: center; gap: 0.25rem; }
.acca-instructions-section .acc-icon-inline .icon-base { font-size: 0.9rem; }

/* ACCA Start Exam page */
.acca-start-exam {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    padding: 3rem 2rem;
}
.acca-start-exam p { font-size: 1.1rem; margin-bottom: 1.5rem; color: #374151; }
.acca-start-exam .btn-start-exam {
    background: #c41e3a;
    color: #fff;
    border: 2px solid #a01830;
    padding: 0.75rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 6px;
}
.acca-start-exam .btn-start-exam:hover { background: #a01830; color: #fff; border-color: #801428; }

/* ACCA exam step – main content horizontally center-aligned (75% width) */
body.quiz-exam-mode #step-instructions .acca-exam-header,
body.quiz-exam-mode #step-instructions .acca-instructions-wrapper,
body.quiz-exam-mode #step-instructions .acca-exam-footer,
body.quiz-exam-mode #step-questions .acca-exam-header,
body.quiz-exam-mode #step-questions .acca-topbar-question-strip,
body.quiz-exam-mode #step-questions .acca-question-content,
body.quiz-exam-mode #step-questions .acca-exam-footer,
body.quiz-exam-mode #step-start-exam .acca-exam-header,
body.quiz-exam-mode #step-start-exam .acca-start-exam,
body.quiz-exam-mode #step-start-exam .acca-exam-footer,
body.quiz-exam-mode #step-result .acca-exam-header,
body.quiz-exam-mode #step-result .acca-result-wrapper {
    margin-left: auto;
    margin-right: auto;
    max-width: 75%;
    width: 100%;
}

/* ACCA question content area – center aligned */
.acca-question-content {
    background: #faf9f7;
    min-height: 50vh;
    padding: 2rem 2.5rem;
    position: relative;
    display: flex;
    justify-content: center;
    width: 100%;
}
.acca-question-content .acc-question-body {
    max-width: 720px;
    width: 100%;
    position: relative;
    z-index: 1;
}
.acca-question-content .question-card .question-statement { line-height: 1.6; }
.acca-question-content .question-card .question-statement p { margin-bottom: 0.5rem; }
.acca-question-content .question-card .question-statement p:last-child { margin-bottom: 0; }
.acca-question-content .question-card .question-statement {
    line-height: 1.6;
    font-size: 1.1rem;
}
.acca-question-content .question-card .question-statement p { margin-bottom: 0.5rem; }
.acca-question-content .question-card .question-statement p:last-child { margin-bottom: 0; }
.acca-question-content .question-card .question-statement ol,
.acca-question-content .question-card .question-statement ul {
    padding-left: 1.25rem;
    margin-bottom: 0.75rem;
}
.acca-question-content .form-check {
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    transition: border-color 0.2s, background-color 0.2s;
}
.acca-question-content .form-check:hover {
    border-color: rgba(0, 0, 0, 0.25);
}

/* ACCA Test Progress Details panel */
.acca-progress-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-width: 480px;
}
.acca-progress-panel .acc-panel-legend {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.acca-progress-panel .acc-legend-item { display: flex; align-items: center; gap: 0.35rem; }
.acca-progress-panel .acc-legend-dot { width: 12px; height: 12px; border-radius: 50%; }
.acca-progress-panel .acc-legend-dot.complete { background: #d97706; }
.acca-progress-panel .acc-legend-dot.incomplete { background: transparent; border: 2px solid #718096; }
.acca-progress-panel .acc-legend-dot.flagged { background: #333; }
.acca-progress-panel .acc-panel-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 0.5rem;
}
.acca-progress-panel .acc-panel-cell {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid #c41e3a;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}
.acca-progress-panel .acc-panel-cell:hover { background: #fef2f2; }
.acca-progress-panel .acc-panel-cell.current { border-width: 3px; font-weight: 700; }
.acca-progress-panel .acc-panel-cell.complete { background: #d97706; color: #fff; border-color: #d97706; }
.acca-progress-panel .acc-panel-cell.incomplete { border-color: #718096; color: #333; }
.acca-progress-panel .acc-panel-cell.flagged { border-color: #333; }
.acca-progress-panel .acc-panel-cell .acc-cell-flag { font-size: 1.25rem; display: inline-block; line-height: 1; }

/* ACCA Result page – consistent with instructions/start-exam spacing */
.acca-result-wrapper {
    padding: 2rem 2.5rem;
    max-width: 100%;
}
.acca-result-wrapper .acc-result-title { font-size: 2rem; font-weight: 700; margin-bottom: 1.5rem; color: #1f2937; }
.acca-result-wrapper .acc-result-detail { margin-bottom: 0.75rem; }
.acca-result-wrapper .acc-result-box {
    background: #d97706;
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1rem 0 1.5rem 0;
}
.acca-result-wrapper .acc-result-box.success { background: #059669; }
.acca-result-wrapper .acc-result-detail strong { color: #d97706; }
.acca-result-wrapper .mt-4.d-flex { margin-top: 1.5rem !important; }

/* ===== Student portal consistency contract (buttons + quiz headers) ===== */
.student-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
}

.student-action-row .student-action-btn {
    min-width: 220px;
    font-weight: 600;
}

.acca-exam-header.acca-exam-topbar {
    display: grid;
    grid-template-columns: auto minmax(180px, 1fr) minmax(220px, 1.2fr) auto;
    align-items: center;
    gap: 1rem;
}

/* Instructions / start / result: logo + title + test name — not the 4-col question grid */
.acca-exam-header.acca-exam-topbar:has(.acca-topbar-left) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.5rem;
}

.acca-exam-header.acca-exam-topbar:has(.acca-topbar-left) .acca-topbar-left {
    flex: 0 1 auto;
    min-width: 0;
}

.acca-exam-header.acca-exam-topbar:has(.acca-topbar-left) .acca-topbar-right {
    flex: 1 1 16rem;
    min-width: 0;
    justify-content: flex-end;
    align-items: center;
}

.acca-exam-header.acca-exam-topbar:has(.acca-topbar-left) .acca-test-name {
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
    line-height: 1.35;
}

.acca-exam-topbar .acca-topbar-brand {
    display: flex;
    align-items: center;
    min-width: 0;
}

.acca-exam-topbar .acca-topbar-card {
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    min-height: 3.25rem;
}

.acca-exam-topbar .acca-topbar-timer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-width: 0;
}

.acca-exam-topbar .acca-timer-display {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.acca-exam-topbar .acca-timer-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.acca-exam-topbar .acca-topbar-progress {
    min-width: 0;
}

.acca-exam-topbar .acca-progress-card-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0;
    text-align: left;
    cursor: pointer;
    color: inherit;
}

.acca-exam-topbar .acca-progress-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.acca-exam-topbar .acca-progress-details-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.acca-exam-topbar .acca-card-label {
    font-size: 0.78rem;
    font-weight: 600;
}

.acca-exam-topbar .acca-topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.acca-exam-topbar .acc-pause-btn,
.acca-exam-topbar .acc-resume-btn {
    min-width: 5.5rem;
    justify-content: center;
}

.acca-topbar-question-strip {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    padding: 0.5rem 2rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: var(--bs-body-bg, #fff);
}

.acca-topbar-question-strip .acca-meta-label {
    font-weight: 700;
}

.acca-topbar-question-strip .acca-test-name {
    font-weight: 600;
    color: var(--theme-primary, #a01830);
}

.acca-topbar-question-strip .acca-test-name:empty {
    display: none;
}

.acca-exam-footer {
    justify-content: center;
    gap: 0.75rem;
}

.acca-exam-footer .acca-footer-btn {
    flex-direction: row;
    gap: 0.35rem;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.45rem;
    min-width: 120px;
    justify-content: center;
}

.acca-exam-footer .acca-footer-label {
    order: 6;
    min-width: 160px;
    text-align: center;
    font-weight: 600;
}

#quiz-wizard,
#mock-test-wizard {
    width: 100%;
}

@media (max-width: 991.98px) {
    .acca-exam-header.acca-exam-topbar {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "brand actions"
            "timer timer"
            "progress progress";
    }
    .acca-exam-header.acca-exam-topbar:has(.acca-topbar-left) {
        display: flex;
    }
    .acca-exam-topbar .acca-topbar-brand {
        grid-area: brand;
    }
    .acca-exam-topbar .acca-topbar-actions {
        grid-area: actions;
        justify-self: end;
    }
    .acca-exam-topbar .acca-topbar-timer {
        grid-area: timer;
    }
    .acca-exam-topbar .acca-topbar-progress {
        grid-area: progress;
    }
    .acca-topbar-question-strip {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 1200px) {
    body.quiz-exam-mode #quiz-wizard #step-instructions .acca-exam-header,
    body.quiz-exam-mode #quiz-wizard #step-instructions .acca-instructions-wrapper,
    body.quiz-exam-mode #quiz-wizard #step-instructions .acca-exam-footer,
    body.quiz-exam-mode #quiz-wizard #step-questions .acca-exam-header,
    body.quiz-exam-mode #quiz-wizard #step-questions .acca-topbar-question-strip,
    body.quiz-exam-mode #quiz-wizard #step-questions .acca-question-content,
    body.quiz-exam-mode #quiz-wizard #step-questions .acca-exam-footer,
    body.quiz-exam-mode #quiz-wizard #step-start-exam .acca-exam-header,
    body.quiz-exam-mode #quiz-wizard #step-start-exam .acca-start-exam,
    body.quiz-exam-mode #quiz-wizard #step-start-exam .acca-exam-footer,
    body.quiz-exam-mode #quiz-wizard #step-result .acca-exam-header,
    body.quiz-exam-mode #quiz-wizard #step-result .acca-result-wrapper,
    body.quiz-exam-mode #mock-test-wizard #step-instructions .acca-exam-header,
    body.quiz-exam-mode #mock-test-wizard #step-instructions .acca-instructions-wrapper,
    body.quiz-exam-mode #mock-test-wizard #step-instructions .acca-exam-footer,
    body.quiz-exam-mode #mock-test-wizard #step-questions .acca-exam-header,
    body.quiz-exam-mode #mock-test-wizard #step-questions .acca-topbar-question-strip,
    body.quiz-exam-mode #mock-test-wizard #step-questions .acca-question-content,
    body.quiz-exam-mode #mock-test-wizard #step-questions .acca-exam-footer,
    body.quiz-exam-mode #mock-test-wizard #step-start-exam .acca-exam-header,
    body.quiz-exam-mode #mock-test-wizard #step-start-exam .acca-start-exam,
    body.quiz-exam-mode #mock-test-wizard #step-start-exam .acca-exam-footer,
    body.quiz-exam-mode #mock-test-wizard #step-result .acca-exam-header,
    body.quiz-exam-mode #mock-test-wizard #step-result .acca-result-wrapper {
        max-width: 90%;
    }
}

@media (max-width: 992px) {
    body.quiz-exam-mode #quiz-wizard #step-instructions .acca-exam-header,
    body.quiz-exam-mode #quiz-wizard #step-instructions .acca-instructions-wrapper,
    body.quiz-exam-mode #quiz-wizard #step-instructions .acca-exam-footer,
    body.quiz-exam-mode #quiz-wizard #step-questions .acca-exam-header,
    body.quiz-exam-mode #quiz-wizard #step-questions .acca-topbar-question-strip,
    body.quiz-exam-mode #quiz-wizard #step-questions .acca-question-content,
    body.quiz-exam-mode #quiz-wizard #step-questions .acca-exam-footer,
    body.quiz-exam-mode #quiz-wizard #step-start-exam .acca-exam-header,
    body.quiz-exam-mode #quiz-wizard #step-start-exam .acca-start-exam,
    body.quiz-exam-mode #quiz-wizard #step-start-exam .acca-exam-footer,
    body.quiz-exam-mode #quiz-wizard #step-result .acca-exam-header,
    body.quiz-exam-mode #quiz-wizard #step-result .acca-result-wrapper,
    body.quiz-exam-mode #mock-test-wizard #step-instructions .acca-exam-header,
    body.quiz-exam-mode #mock-test-wizard #step-instructions .acca-instructions-wrapper,
    body.quiz-exam-mode #mock-test-wizard #step-instructions .acca-exam-footer,
    body.quiz-exam-mode #mock-test-wizard #step-questions .acca-exam-header,
    body.quiz-exam-mode #mock-test-wizard #step-questions .acca-topbar-question-strip,
    body.quiz-exam-mode #mock-test-wizard #step-questions .acca-question-content,
    body.quiz-exam-mode #mock-test-wizard #step-questions .acca-exam-footer,
    body.quiz-exam-mode #mock-test-wizard #step-start-exam .acca-exam-header,
    body.quiz-exam-mode #mock-test-wizard #step-start-exam .acca-start-exam,
    body.quiz-exam-mode #mock-test-wizard #step-start-exam .acca-exam-footer,
    body.quiz-exam-mode #mock-test-wizard #step-result .acca-exam-header,
    body.quiz-exam-mode #mock-test-wizard #step-result .acca-result-wrapper {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    #quiz-wizard .acca-exam-header.acca-exam-topbar,
    #mock-test-wizard .acca-exam-header.acca-exam-topbar {
        padding: 0.875rem 1rem;
        gap: 0.75rem;
    }

    #quiz-wizard .acca-topbar-timer,
    #quiz-wizard .acca-topbar-progress,
    #mock-test-wizard .acca-topbar-timer,
    #mock-test-wizard .acca-topbar-progress {
        width: 100%;
    }

    #quiz-wizard .acca-topbar-question-strip,
    #mock-test-wizard .acca-topbar-question-strip {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    #quiz-wizard .acca-instructions-wrapper,
    #quiz-wizard .acca-question-content,
    #quiz-wizard .acca-start-exam,
    #quiz-wizard .acca-result-wrapper,
    #mock-test-wizard .acca-instructions-wrapper,
    #mock-test-wizard .acca-question-content,
    #mock-test-wizard .acca-start-exam,
    #mock-test-wizard .acca-result-wrapper {
        padding: 1rem;
    }

    #quiz-wizard .acca-question-content .question-card .question-statement,
    #mock-test-wizard .acca-question-content .question-card .question-statement {
        font-size: 1rem;
    }

    #quiz-wizard .acca-exam-footer,
    #mock-test-wizard .acca-exam-footer {
        padding: 0.75rem;
        gap: 0.5rem;
        justify-content: flex-start;
    }

    #quiz-wizard .acca-exam-footer .acca-footer-label,
    #mock-test-wizard .acca-exam-footer .acca-footer-label {
        width: 100%;
        order: 10;
        text-align: center;
    }

    #quiz-wizard .acca-exam-footer .acca-footer-btn,
    #mock-test-wizard .acca-exam-footer .acca-footer-btn {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 135px;
        padding: 0.5rem 0.6rem;
    }

    #quiz-wizard .acca-progress-panel .acc-panel-legend,
    #mock-test-wizard .acca-progress-panel .acc-panel-legend {
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    #quiz-wizard .acca-progress-panel .acc-panel-grid,
    #mock-test-wizard .acca-progress-panel .acc-panel-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    #quiz-wizard .acca-progress-panel .acc-panel-cell,
    #mock-test-wizard .acca-progress-panel .acc-panel-cell {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
    }

    #quiz-wizard .acca-start-exam .btn-start-exam,
    #mock-test-wizard .acca-start-exam .btn-start-exam {
        width: 100%;
        max-width: 320px;
    }

    .student-action-row .student-action-btn {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 480px) {
    #quiz-wizard .acca-brand-logo,
    #mock-test-wizard .acca-brand-logo {
        height: 30px;
    }

    #quiz-wizard .acca-exam-header .acca-title,
    #mock-test-wizard .acca-exam-header .acca-title {
        font-size: 1rem;
    }

    #mock-test-wizard .acca-exam-header.acca-exam-topbar:has(.acca-topbar-left) .acca-topbar-right {
        flex: 1 1 100%;
        justify-content: space-between;
    }

    #mock-test-wizard .acca-exam-header.acca-exam-topbar:has(.acca-topbar-left) .acca-test-name {
        text-align: left;
    }

    #quiz-wizard .acca-exam-footer .acca-footer-btn,
    #mock-test-wizard .acca-exam-footer .acca-footer-btn {
        flex: 1 1 100%;
    }

    #progressDetailsModal .modal-dialog,
    #exitConfirmModal .modal-dialog {
        margin: 0.5rem;
    }
}

/* ===== Student portal – mobile-first layout ===== */
body.student-portal {
    overflow-x: hidden;
}

body.student-portal .student-portal-main {
    max-width: 1140px;
    margin-left: auto;
    margin-right: auto;
}

body.student-portal .student-portal-nav {
    max-width: 100%;
    position: relative;
}

@media (max-width: 767.98px) {
    body.student-portal .student-portal-navbar .student-portal-navbar-brand {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        margin: 0;
        z-index: 1;
    }

    body.student-portal .student-portal-navbar .navbar-toggler {
        z-index: 2;
    }
}

body.student-portal .student-portal-footer {
    position: static;
    width: 100%;
    white-space: normal;
    line-height: 1.5;
    padding: 1rem 0;
    margin-top: 1.5rem;
}

body.student-portal .student-portal-impersonation .btn {
    align-self: flex-start;
}

body.student-portal .navbar-brand img {
    max-height: 36px;
    width: auto;
}

body.student-portal .student-portal-logout-btn {
    white-space: nowrap;
}

body.student-portal .student-portal-navbar .navbar-nav .nav-item {
    display: flex;
    align-items: center;
}

body.student-portal .student-portal-navbar .student-portal-logout-form {
    line-height: 1;
}

body.student-portal .table-responsive > .table,
body.student-portal .student-portal-datatable-wrap > .table {
    min-width: 0;
    table-layout: auto;
}

body.student-portal .student-portal-datatable-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

body.student-portal #myTestsTable td,
body.student-portal #myTestsTable th,
body.student-portal #myRequestsTable td,
body.student-portal #myRequestsTable th {
    vertical-align: middle;
}

@media (max-width: 767.98px) {
    body.student-portal #myTestsTable td,
    body.student-portal #myTestsTable th,
    body.student-portal #myRequestsTable td,
    body.student-portal #myRequestsTable th {
        white-space: normal;
        font-size: 0.875rem;
    }

    body.student-portal .dataTables_wrapper .dataTables_length,
    body.student-portal .dataTables_wrapper .dataTables_filter {
        text-align: left;
        margin-bottom: 0.5rem;
    }

    body.student-portal .dataTables_wrapper .dataTables_filter input {
        width: 100%;
        max-width: none;
        margin-left: 0;
    }

    body.student-portal .card-header h5,
    body.student-portal .student-portal-page h2,
    body.student-portal .student-portal-page h5 {
        font-size: 1.1rem;
    }

    body.student-portal .student-portal-home-title {
        font-size: clamp(1.75rem, 6vw, 2.5rem);
        font-weight: 300;
        line-height: 1.2;
    }

    body.student-portal .student-portal-home .lead {
        font-size: 1rem;
    }
}

@media (min-width: 768px) {
    body.student-portal .student-portal-home-title {
        font-size: 2.5rem;
        font-weight: 300;
    }
}

@media (max-width: 767.98px) {
    body.student-portal #quiz-wizard .list-group-item,
    body.student-portal #mock-test-wizard .list-group-item {
        padding-left: 0;
        padding-right: 0;
    }

    body.student-portal #quiz-wizard .acca-exam-header:not(.acca-exam-topbar),
    body.student-portal #mock-test-wizard .acca-exam-header:not(.acca-exam-topbar) {
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }

    body.student-portal #quiz-wizard .acca-exam-header:not(.acca-exam-topbar) > .d-flex,
    body.student-portal #mock-test-wizard .acca-exam-header:not(.acca-exam-topbar) > .d-flex {
        flex-wrap: wrap;
        width: 100%;
        gap: 0.5rem;
    }

    body.student-portal .mytests-questions-table-wrap th,
    body.student-portal .mytests-questions-table-wrap td {
        font-size: 0.8125rem;
    }

    body.student-portal dl.row dt {
        margin-bottom: 0.25rem;
    }

    body.student-portal dl.row dd {
        margin-bottom: 0.75rem;
    }
}

@media (min-width: 768px) {
    body.student-portal #myTestsTable td,
    body.student-portal #myTestsTable th {
        white-space: nowrap;
    }
}

/* Admin: Select2 — align with Sneat form-select / form-control */
body:not(.student-portal) .select2-container--bootstrap-5 .select2-selection {
    border: var(--bs-border-width) solid color-mix(in sRGB, var(--bs-base-color) 22%, var(--bs-paper-bg));
    background-color: transparent;
    color: var(--bs-heading-color);
}

body:not(.student-portal) .select2-container--bootstrap-5.select2-container--focus .select2-selection,
body:not(.student-portal) .select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: var(--bs-primary);
    box-shadow: 0 0.125rem 0.25rem 0 rgba(var(--bs-primary-rgb), 0.4);
}

body:not(.student-portal) .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    line-height: 1.375;
}

body:not(.student-portal) .select2-container--bootstrap-5 .select2-dropdown {
    border: var(--bs-border-width) solid color-mix(in sRGB, var(--bs-base-color) 22%, var(--bs-paper-bg));
}

/* Admin: modal / offcanvas / Select2 / SweetAlert2 stacking */
body:not(.student-portal) .modal-backdrop {
    z-index: 2050 !important;
}

body:not(.student-portal) .modal {
    z-index: 2060 !important;
}

body:not(.student-portal) .select2-container--open {
    z-index: 2070 !important;
}

body:not(.student-portal) .offcanvas {
    z-index: 2080 !important;
}

body:not(.student-portal) .offcanvas-backdrop {
    z-index: 2075 !important;
}

body:not(.student-portal) .swal2-container {
    z-index: 2090 !important;
}
