:root {
    --purple: #2b0b62;
    --purple2: #8d5df6;
    --teal: #14aaa5;
    --orange: #ef7900;
    --pink: #e82d88;
    --ink: #22232a;
    --muted: #6e7180;
    --bg: #f5f4f8;
    --line: #ddd9e6
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    font-family: Arial,Helvetica,sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.55
}

a {
    color: var(--purple);
    text-decoration: none
}

.site-header {
    height: 90px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 max(6vw,24px);
    box-shadow: 0 2px 12px #00000010
}

.site-header img {
    width: 135px
}

.site-header nav {
    display: flex;
    gap: 28px;
    font-weight: 700
}

.hero, .page-banner {
    background: linear-gradient(110deg,#984e9ddd,#566d9ddd,#00a9a5dd);
    color: white;
    padding: 90px 24px
}

.hero>div, .wrap {
    max-width: 1180px;
    margin: auto
}

.hero h1, .page-banner h1 {
    font-size: clamp(2.3rem,5vw,4.5rem);
    line-height: 1.05;
    margin: .2em 0
}

.hero p {
    font-size: 1.25rem;
    max-width: 760px
}

.page-banner {
    padding: 55px 24px
}

.page-banner.compact {
    padding: 35px 24px
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .78rem;
    font-weight: 800
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(300px,1fr));
    gap: 24px;
    padding: 50px 24px
}

.card, .panel, .question-section {
    background: white;
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 8px 30px #2b0b6212;
    border: 1px solid #ece9f1
}

.badge, .status {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 999px;
    background: #e9e0ff;
    color: var(--purple);
    font-weight: 700;
    font-size: .8rem
}

.meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: .9rem;
    margin: 20px 0
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    padding: 13px 22px;
    font-weight: 800;
    cursor: pointer;
    background: #eee;
    color: var(--ink)
}

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

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

.btn.small {
    padding: 8px 14px
}

.narrow {
    max-width: 700px;
    padding: 50px 24px
}

.form-grid {
    display: grid;
    gap: 18px
}

.form-grid label {
    display: grid;
    gap: 7px;
    font-weight: 700
}

.form-grid input, .form-grid textarea, .form-grid select, .filters input, .filters select, .question textarea, .question input[type=text] {
    width: 100%;
    padding: 13px;
    border: 1px solid #cfc9da;
    border-radius: 8px;
    font: inherit
}

.check {
    display: flex!important;
    grid-template-columns: auto 1fr!important;
    align-items: center
}

.assessment {
    padding: 40px 24px
}

.question-section {
    margin-bottom: 25px
}

.question {
    padding: 22px 0;
    border-top: 1px solid var(--line)
}

.question h3 {
    display: flex;
    gap: 12px;
    align-items: flex-start
}

.question h3>span {
    background: var(--purple);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none
}

.question h3 small {
    margin-left: auto;
    color: var(--muted);
    white-space: nowrap
}

.option {
    display: flex;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 9px 0;
    background: #fafafa
}

.submit-bar {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 18px;
    border-radius: 12px;
    box-shadow: 0 -8px 30px #0002;
    display: flex;
    justify-content: space-between;
    align-items: center
}

.reference {
    padding: 14px;
    background: #ffffff20;
    border-radius: 8px;
    margin: 20px 0;
    display: inline-block
}

.alert {
    padding: 14px;
    border-radius: 8px;
    margin: 15px 0
}

.alert.error {
    background: #ffe3e8;
    color: #8d1830
}

.alert.success {
    background: #dff7ef;
    color: #126349
}

footer {
    background: var(--purple);
    color: white;
    padding: 28px;
    text-align: center
}

.login-wrap {
    min-height: 70vh
}

.admin-body {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh
}

.sidebar {
    background: var(--purple);
    color: white;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 10px
}

.sidebar img {
    width: 125px;
    background: white;
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 10px
}

.sidebar a, .link-button {
    color: white;
    padding: 10px;
    border-radius: 7px;
    background: transparent;
    border: 0;
    font: inherit;
    text-align: left;
    cursor: pointer
}

.sidebar a:hover {
    background: #ffffff18
}

.admin-main {
    padding: 38px;
    min-width: 0
}

.admin-head, .panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center
}

.admin-head h1 {
    margin: .1em 0;
    font-size: 2.3rem
}

.stats {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 16px;
    margin: 25px 0
}

.stats>div {
    background: white;
    padding: 22px;
    border-radius: 14px;
    border-left: 5px solid var(--teal);
    box-shadow: 0 5px 20px #0000000c
}

.stats strong {
    display: block;
    font-size: 1.7rem;
    color: var(--purple)
}

.stats span {
    color: var(--muted)
}

.panel {
    margin: 20px 0
}

.table-wrap {
    overflow: auto
}

table {
    width: 100%;
    border-collapse: collapse
}

th, td {
    text-align: left;
    padding: 14px;
    border-bottom: 1px solid var(--line)
}

td small {
    display: block;
    color: var(--muted)
}

.status.review_required {
    background: #fff0cd;
    color: #815a00
}

.status.reviewed, .status.completed {
    background: #dff7ef;
    color: #126349
}

.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px
}

.answer {
    padding: 18px 0;
    border-top: 1px solid var(--line)
}

.print-page {
    background: white;
    max-width: 900px;
    margin: auto;
    padding: 35px
}

.print-page header {
    display: flex;
    gap: 30px;
    align-items: center;
    border-bottom: 5px solid var(--purple);
    padding-bottom: 20px
}

.print-page header img {
    width: 140px
}

.print-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: #ddd;
    margin: 25px 0
}

.print-grid div {
    background: white;
    padding: 12px
}

.print-grid b {
    display: block;
    color: var(--purple)
}

.print-answer {
    border-bottom: 1px solid #ddd
}

.signatures {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    margin-top: 70px
}

.signatures div {
    border-top: 1px solid #222;
    padding-top: 8px
}

@media(max-width:800px) {
    .admin-body {
        display: block
    }
    .sidebar {
        position: static
    }
    .stats {
        grid-template-columns: 1fr 1fr
    }
    .admin-main {
        padding: 20px
    }
    .site-header nav {
        gap: 12px
    }
    .submit-bar {
        display: block
    }
    .filters {
        display: grid
    }
}

@media print {
    .no-print, .sidebar {
        display: none!important
    }
    .admin-body {
        display: block
    }
    .print-page {
        padding: 0
    }
    .print-page .btn {
        display: none
    }
}

/* Diagnostic library and management additions */
.diagnostic-library {
    padding: 45px 24px 70px
}

.subject-group {
    margin-bottom: 48px
}

.subject-heading {
    border-left: 6px solid var(--teal);
    padding-left: 18px;
    margin-bottom: 18px
}

.subject-heading h2 {
    margin: .15em 0;
    font-size: 2rem;
    color: var(--purple)
}

.subject-cards {
    padding: 0
}

.diagnostic-card {
    display: flex;
    flex-direction: column
}

.diagnostic-card .meta {
    margin-top: auto
}

.status.published {
    background: #dff7ef;
    color: #126349
}

.status.draft {
    background: #eeeaf4;
    color: #5d5668
}

.sidebar strong {
    font-size: 1.05rem;
    margin-bottom: 10px
}

.admin-main p {
    color: var(--muted)
}

.check-row {
    display: flex!important;
    align-items: center!important;
    justify-content: flex-start!important;
    gap: 10px!important;
    width: max-content!important;
    margin: 0!important;
    cursor: pointer
}

.check-row input[type="checkbox"] {
    width: 18px!important;
    height: 18px!important;
    margin: 0!important;
    padding: 0!important;
    flex: 0 0 18px!important;
    accent-color: var(--orange)
}

.check-row span {
    display: inline-block;
    margin: 0;
    line-height: 1.4;
    white-space: nowrap
}

/* Release candidate: learner instructions, resume and autosave */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(260px,1fr));
    gap: 22px
}

.subject-group {
    margin-bottom: 38px
}

.resume-panel {
    margin-top: 20px;
    margin-bottom: 55px
}

.instructions-list {
    padding-left: 22px;
    line-height: 1.75
}

.info-strip {
    padding: 14px 16px;
    border-left: 5px solid #f28c00;
    background: #fff7ec;
    margin: 20px 0
}

.assessment-top {
    padding-top: 26px
}

.continuation-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    background: #2e1760;
    color: #fff;
    border-radius: 14px;
    padding: 18px 22px;
    margin-bottom: 18px
}

.continuation-card strong {
    display: block;
    font-size: .9rem
}

.continuation-card span {
    display: block;
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: .08em
}

.continuation-card p {
    margin: 0;
    max-width: 560px
}

.progress-shell {
    background: #fff;
    border-radius: 14px;
    padding: 15px 18px;
    box-shadow: 0 8px 24px rgba(26,20,47,.08)
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 9px;
    font-weight: 700
}

.progress-track {
    height: 12px;
    background: #ece8f3;
    border-radius: 999px;
    overflow: hidden
}

.progress-bar {
    height: 100%;
    background: #f28c00;
    transition: width .25s ease
}

.question-step {
    background: #fff;
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 10px 30px rgba(26,20,47,.09);
    margin-top: 24px
}

.question-step h2 {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 1.35rem;
    line-height: 1.45
}

.question-step h2>.question-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    min-width: 34px;
    flex: 0 0 34px;
    border-radius: 50%;
    background: #2e1760;
    color: #fff;
    font-size: 1rem;
    font-weight: 700
}

.question-step h2>.question-text {
    display: block;
    flex: 1;
    min-width: 0;
    color: var(--ink);
    background: transparent;
    width: auto;
    height: auto;
    border-radius: 0;
    margin: 0;
    font-size: inherit;
    font-weight: 700;
    line-height: 1.45;
    justify-content: flex-start;
    text-align: left
}

.section-label {
    color: #0a8178;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: .82rem
}

.marks-label {
    color: #666
}

.question-navigation {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin: 24px 0 10px
}

.submission-warning {
    text-align: right;
    font-weight: 700;
    color: #7a2d00
}

.btn:disabled {
    opacity: .45;
    cursor: not-allowed
}

@media(max-width:700px) {
    .continuation-card {
        display: block
    }
    .continuation-card p {
        margin-top: 12px
    }
    .progress-meta {
        display: block
    }
    .progress-meta span {
        display: block;
        margin-bottom: 4px
    }
    .question-step {
        padding: 20px
    }
    .question-navigation {
        flex-wrap: wrap
    }
    .question-navigation .btn {
        flex: 1
    }
}

/* Staff management and destructive actions */
.btn.danger {
    background: #b42318;
    color: #fff
}

.btn.danger:hover {
    background: #8f1c13
}

.row-actions, .staff-actions {
    display: flex;
    align-items: center;
    gap: 8px
}

.row-actions form {
    margin: 0
}

.staff-create-form {
    grid-template-columns: repeat(2,minmax(0,1fr));
    align-items: end
}

.staff-create-form>div {
    grid-column: 1/-1
}

.staff-list {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(320px,1fr));
    gap: 18px
}

.staff-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px;
    background: #faf9fc
}

.staff-card-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start
}

.staff-card-head strong, .staff-card-head small {
    display: block
}

.muted-note {
    display: block;
    color: var(--muted);
    margin-top: 12px
}

.staff-card>form+form {
    margin-top: 10px
}

@media(max-width:700px) {
    .staff-create-form {
        grid-template-columns: 1fr
    }
    .row-actions {
        align-items: stretch;
        flex-direction: column
    }
    .row-actions .btn {
        width: 100%
    }
}

/* Final override: keep the question number circular without constraining the question text */
.question-step .question-heading {
    display: flex !important;
    align-items: flex-start !important;
    gap: 12px !important;
    width: 100% !important;
}

.question-step .question-heading > .question-number {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 34px !important;
    width: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    border-radius: 50% !important;
    margin: 0 !important;
    background: var(--purple) !important;
    color: #fff !important;
}

.question-step .question-heading > .question-text {
    display: block !important;
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--ink) !important;
    font-size: 1.35rem !important;
    font-weight: 700 !important;
    line-height: 1.45 !important;
    white-space: normal !important;
    overflow: visible !important;
    text-align: left !important;
}
