:root {
    --oxford-navy: #14213d;
    --oxford-blue: #1f3b73;
    --camp-gold: #c7a54b;
    --cloud: #f5f7fb;
    --ink: #132238;
    --white: #ffffff;
    --danger: #a63333;
    --success: #1f6b4f;
    --border: rgba(20, 33, 61, 0.12);
    --shadow: 0 24px 60px rgba(20, 33, 61, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top, rgba(199, 165, 75, 0.18), transparent 30%),
        linear-gradient(180deg, #eef2f9 0%, #f7f9fc 100%);
}

body.pdf-loading-active {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

.page-shell {
    min-height: 100vh;
    padding: 24px;
}

.site-header,
.hero-card,
.card,
.message {
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.site-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 20px 24px;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--oxford-navy), var(--oxford-blue));
    color: var(--white);
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px;
}

.eyebrow {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.75rem;
    opacity: 0.8;
}

.header-actions,
.actions-row,
.actions-cell {
    display: flex;
    gap: 12px;
    align-items: center;
}

.inline-form {
    margin: 0;
}

.report-action-row {
    gap: 8px;
    flex-wrap: nowrap;
}

.report-action-row .inline-form {
    display: inline-flex;
}

.hidden-form {
    display: none;
}

.user-pill {
    display: grid;
    gap: 2px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
}

.content-shell {
    margin-top: 24px;
    display: grid;
    gap: 24px;
}

.page-nav {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hero-card,
.card {
    border-radius: 28px;
    background: var(--white);
    padding: 24px;
}

.hero-card {
    background:
        linear-gradient(125deg, rgba(20, 33, 61, 0.03), rgba(31, 59, 115, 0.09)),
        var(--white);
}

.lede {
    max-width: 64ch;
    line-height: 1.6;
}

.card-grid,
.dashboard-layout {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.dashboard-layout {
    grid-template-columns: 2fr 1fr;
}

.dashboard-home-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 20px;
}

.table-wrap {
    overflow-x: auto;
}

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

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

.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 14px;
}

.activity-list li {
    display: grid;
    gap: 4px;
}

.split-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

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

.people-list li {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.dashboard-test-section {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.dashboard-test-section h4 {
    margin: 0;
}

.dashboard-test-table-wrap {
    max-height: 540px;
    overflow-y: auto;
}

.dashboard-test-table-wrap thead th {
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 1;
}

.table-wrap-limited {
    max-height: 360px;
    overflow-y: auto;
}

.table-wrap-limited thead th {
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 1;
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover td {
    background: rgba(20, 33, 61, 0.04);
}

.compact-metric-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

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

.filter-bar {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 16px;
    margin-bottom: 18px;
    align-items: end;
}

.field {
    display: grid;
    gap: 8px;
}

.compact-field span {
    font-size: 0.9rem;
}

.filter-actions {
    padding-bottom: 2px;
}

.midterm-checkbox-filter {
    min-width: 220px;
}

.filter-checkbox-group {
    display: grid;
    gap: 8px;
    max-height: 150px;
    overflow: auto;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--white);
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--white);
    font-size: 16px;
    line-height: 1.4;
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 12px 18px;
    border: 0;
    border-radius: 999px;
    background: var(--oxford-navy);
    color: var(--white);
    cursor: pointer;
}

.button-secondary {
    background: rgba(20, 33, 61, 0.09);
    color: var(--oxford-navy);
}

.site-header .button,
.site-header .button-secondary {
    background: rgba(255, 255, 255, 0.16);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.28);
}

.site-header .button:hover,
.site-header .button-secondary:hover {
    background: rgba(255, 255, 255, 0.24);
}

.button-danger {
    background: var(--danger);
}

.button-small {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.messages {
    margin-top: 18px;
    display: grid;
    gap: 12px;
}

.message {
    padding: 14px 18px;
    border-radius: 18px;
    background: var(--white);
}

.message-success {
    border-left: 6px solid var(--success);
}

.message-warning,
.message-error {
    border-left: 6px solid var(--camp-gold);
}

.pdf-loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(20, 33, 61, 0.34);
    backdrop-filter: blur(4px);
    z-index: 2000;
}

.pdf-loading-overlay[hidden] {
    display: none !important;
}

.pdf-loading-dialog {
    width: min(100%, 29rem);
    display: grid;
    justify-items: center;
    gap: 14px;
    text-align: center;
    padding: 28px 24px;
    border: 1px solid var(--border);
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 247, 251, 0.98));
    box-shadow: 0 28px 64px rgba(20, 33, 61, 0.2);
}

.pdf-loading-spinner {
    width: 3rem;
    height: 3rem;
    border-radius: 999px;
    border: 4px solid rgba(20, 33, 61, 0.14);
    border-top-color: var(--oxford-blue);
    animation: pdf-loading-spin 0.9s linear infinite;
}

.pdf-loading-title {
    margin: 0;
    font-size: 1.4rem;
}

.pdf-loading-message {
    margin: 0;
    max-width: 32ch;
    line-height: 1.6;
}

@keyframes pdf-loading-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.field-error {
    color: var(--danger);
}

.muted {
    opacity: 0.7;
}

.practice-student-label {
    color: #b42318;
    font-weight: 700;
}

.login-card,
.form-card {
    max-width: 720px;
}

.turnstile-wrap {
    display: flex;
    justify-content: flex-start;
}

.login-methods {
    display: grid;
    gap: 16px;
}

.session-plan-matrix-card {
    max-width: none;
}

.session-plan-matrix-card .table-wrap {
    width: 100%;
}

.session-plan-matrix-card table {
    min-width: 100%;
}

.personal-statement-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.personal-statement-list,
.feedback-stack {
    display: grid;
    gap: 16px;
}

.feedback-item {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(20, 33, 61, 0.03);
}

.assignments-layout {
    grid-template-columns: 1fr 1fr;
}

.assignment-filter-bar {
    grid-template-columns: 1fr 1fr auto;
}

.question-bank-layout {
    grid-template-columns: 1fr 1fr;
}

.folder-picker-stack {
    display: grid;
    gap: 12px;
}

.folder-picker-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.folder-picker-row input[type="file"] {
    flex: 1;
}

.question-bank-admin-tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.import-jobs-table-wrap {
    max-height: 230px;
    overflow-y: auto;
}

.import-jobs-table-wrap thead th {
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 1;
}

.question-bank-filter-bar {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: end;
}

.question-bank-filter-search {
    grid-column: span 3;
}

.question-bank-filter-source-label {
    grid-column: span 3;
}

.question-bank-filter-year {
    grid-column: span 1;
}

.question-bank-filter-section {
    grid-column: span 2;
}

.question-bank-filter-category-root {
    grid-column: span 3;
}

.question-bank-filter-category-detail {
    grid-column: span 3;
}

.question-bank-filter-answer {
    grid-column: span 1;
}

.question-bank-filter-usage {
    grid-column: span 4;
}

.question-bank-filter-bar .filter-actions {
    grid-column: span 4;
}

.checkbox-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
    max-height: 320px;
    overflow: auto;
}

.student-checkbox-list {
    display: grid;
    gap: 8px;
    max-height: 320px;
    overflow: auto;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(20, 33, 61, 0.03);
}

.checkbox-option {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
}

.checkbox-option input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.folder-slider {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 260px);
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.folder-card {
    display: grid;
    gap: 8px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(20, 33, 61, 0.03);
    min-height: 120px;
}

.folder-card input {
    width: auto;
}

.folder-card-imported {
    border-color: rgba(31, 107, 79, 0.35);
    background: rgba(31, 107, 79, 0.08);
}

.status-badge {
    display: inline-flex;
    width: fit-content;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(31, 107, 79, 0.14);
    color: var(--success);
    font-size: 0.85rem;
}

.status-badge-muted {
    background: rgba(20, 33, 61, 0.08);
    color: var(--ink);
}

.bulk-toggle {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.bulk-toggle input {
    width: auto;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    display: inline-flex;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(20, 33, 61, 0.08);
    font-size: 0.85rem;
}

.pagination-bar {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.compact-form {
    max-width: 420px;
}

.answer-field input {
    max-width: 120px;
    text-transform: uppercase;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
}

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

.rule-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(20, 33, 61, 0.03);
}

.rule-item-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.rule-item-summary strong,
.rule-item-summary span {
    white-space: nowrap;
}

.rule-item-summary span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.timer-display {
    font-size: 1.05rem;
    font-weight: 700;
}

.question-image-wrap {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(20, 33, 61, 0.03);
}

.question-image-wrap-small {
    max-width: 560px;
}

.question-image {
    width: 100%;
    height: auto;
    border-radius: 14px;
}

.question-thumbnail-button {
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(20, 33, 61, 0.03);
    overflow: hidden;
    width: 112px;
    height: 112px;
    cursor: pointer;
}

.question-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.question-viewer[hidden] {
    display: none;
}

.question-viewer {
    position: fixed;
    inset: 0;
    background: rgba(19, 34, 56, 0.72);
    padding: 32px 20px;
    z-index: 40;
}

.question-viewer-card {
    max-width: 980px;
    max-height: calc(100vh - 64px);
    margin: 0 auto;
    display: grid;
    gap: 18px;
    padding: 24px;
    border-radius: 28px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    background: var(--white);
    overflow: auto;
}

.question-viewer-image {
    width: 100%;
    height: auto;
    border-radius: 18px;
}

.question-viewer-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.question-viewer-answer {
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(20, 33, 61, 0.05);
    font-weight: 700;
}

.student-answer-hidden {
    color: transparent;
    user-select: none;
}

.student-answer-hidden::selection {
    color: transparent;
    background: transparent;
}

.status-chip {
    display: inline-flex;
    width: fit-content;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 700;
}

.status-chip-done {
    background: rgba(31, 107, 79, 0.14);
    color: var(--success);
}

.status-chip-incomplete {
    background: rgba(166, 51, 51, 0.12);
    color: var(--danger);
}

.status-chip-flagged {
    background: rgba(199, 165, 75, 0.2);
    color: #7d5d09;
}

.test-workspace-page {
    min-height: 100vh;
    background: #eef2f9;
}

.test-workspace-main {
    min-height: 100vh;
    padding: 16px;
}

.test-workspace-messages {
    padding: 16px 16px 0;
}

.test-workspace-shell {
    width: min(1100px, 100%);
    margin: 0 auto;
}

.test-workspace-shell:fullscreen {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 16px;
    overflow: auto;
    background: #eef2f9;
}

.test-workspace-card {
    display: grid;
    gap: 18px;
    border-radius: 24px;
    background: var(--white);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.test-workspace-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.test-workspace-meta,
.test-workspace-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
}

.test-workspace-question-wrap {
    margin-top: 0;
}

.test-workspace-prompt {
    font-size: 1.05rem;
    line-height: 1.6;
}

.test-workspace-hint {
    margin: 0;
}

.test-workspace-blocked {
    text-align: center;
    max-width: 720px;
    margin: 48px auto;
}

@media (max-width: 960px) {
    .site-header,
    .header-actions,
    .dashboard-layout,
    .dashboard-home-layout,
    .card-grid,
    .filter-bar,
    .personal-statement-grid,
    .question-bank-admin-tools {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    .site-header {
        align-items: flex-start;
    }

    .split-header,
    .actions-cell,
    .report-action-row {
        flex-wrap: wrap;
    }

    .pagination-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .answer-field input {
        max-width: 100%;
    }

    .pdf-loading-dialog {
        padding: 24px 18px;
    }
}

.ai-overlay {
    position: fixed;
    inset: 0;
    background: rgba(19, 34, 56, 0.78);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 9999;
}

.ai-overlay[hidden] {
    display: none !important;
}

.ai-overlay-card {
    width: min(420px, 100%);
    background: #fffaf2;
    border: 1px solid #d5dce7;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
}
