* {
    box-sizing: border-box;
}

:root {
    --bg: #f4f7f6;
    --surface: #ffffff;
    --surface-soft: #f8faf9;
    --line: #d8e2df;
    --line-soft: #e8eeec;
    --text: #1d2528;
    --muted: #607076;
    --brand: #124f5c;
    --brand-dark: #0c3942;
    --brand-soft: #e7f3f2;
    --accent: #9a5b14;
    --accent-soft: #fff3df;
    --danger: #b42318;
    --success: #067647;
    --shadow: 0 1px 2px rgba(22, 38, 44, 0.08), 0 8px 24px rgba(22, 38, 44, 0.05);
}

body {
    margin: 0;
    color: var(--text);
    background: linear-gradient(180deg, #edf5f4 0, var(--bg) 260px);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

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

a:hover {
    text-decoration: underline;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 68px;
    padding: 0 28px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 2px 18px rgba(22, 38, 44, 0.05);
    color: var(--text);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--brand-dark);
    font-size: 18px;
    font-weight: 700;
}

.brand img {
    display: block;
    width: 72px;
    max-width: 34vw;
    height: 24px;
    object-fit: contain;
    object-position: left center;
}

.brand:hover {
    text-decoration: none;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
}

.topnav a {
    color: #40535a;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 14px;
}

.topnav a:hover,
.topnav a[aria-current="page"] {
    background: var(--brand-soft);
    color: var(--brand-dark);
    text-decoration: none;
}

.page {
    width: min(1240px, calc(100% - 36px));
    margin: 28px auto 52px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.page-header h1 {
    margin: 0;
    color: var(--brand-dark);
    font-size: 30px;
    line-height: 1.15;
}

.page-header p {
    margin: 6px 0 0;
    color: var(--muted);
}

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

.stat-card,
.panel,
.auth-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 18px;
}

.stat-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: var(--brand);
}

.stat-card:nth-child(2n)::before {
    background: var(--accent);
}

.stat-card:nth-child(3n)::before {
    background: var(--success);
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.stat-card strong {
    display: block;
    margin-top: 6px;
    color: var(--brand-dark);
    font-size: 28px;
    line-height: 1.1;
}

.stat-card small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.panel {
    margin-top: 20px;
    padding: 20px;
}

.panel h2 {
    margin: 0 0 14px;
    color: var(--brand-dark);
    font-size: 20px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid var(--brand);
    border-radius: 6px;
    background: var(--brand);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.button:hover,
button:hover {
    border-color: var(--brand-dark);
    background: var(--brand-dark);
    text-decoration: none;
}

.button:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(154, 91, 20, 0.22);
    outline-offset: 2px;
}

.button-secondary {
    background: var(--surface);
    color: var(--brand);
}

.button-secondary:hover {
    background: var(--brand-soft);
}

button:disabled,
.button:disabled {
    border-color: #b8c2cc;
    background: #e5ebf0;
    color: #667789;
    cursor: not-allowed;
}

.danger-button {
    border-color: #b42318;
    color: #b42318;
}

.danger-button:hover {
    background: #fff1f0;
}

.inline-form {
    display: inline;
}

.link-button {
    display: inline;
    min-height: 0;
    padding: 0;
    border: 0;
    background: none;
    color: #145ea8;
}

.link-button:hover {
    background: none;
    color: #145ea8;
    text-decoration: underline;
}

.disabled-button {
    display: inline-block;
    margin-right: 8px;
    color: #7a8491;
}

.table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

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

th,
td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    vertical-align: top;
}

th {
    color: #4f6267;
    background: var(--surface-soft);
    font-size: 12px;
    text-transform: uppercase;
}

th.sortable {
    cursor: pointer;
}

th.sortable::after {
    content: " sort";
    color: var(--muted);
    font-size: 10px;
    font-weight: 400;
    text-transform: none;
}

tbody tr:hover td {
    background: #fbf7ef;
}

tr:last-child td {
    border-bottom: 0;
}

.late-row td {
    background: var(--accent-soft);
}

.completed-row td {
    background: var(--surface-soft);
    color: var(--muted);
}

.status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    background: #eef3f2;
    color: #334145;
    font-size: 12px;
    font-weight: 700;
}

.status-unpaid,
.status-pending {
    background: #fff4d7;
    color: #7a4b00;
}

.status-paid,
.status-completed,
.status-active {
    background: #def7ec;
    color: var(--success);
}

.status-overdue,
.status-deleted,
.status-inactive {
    background: #fde8e8;
    color: var(--danger);
}

.deposit-thumb-link {
    display: inline-flex;
    align-items: center;
    gap: 0;
}

.deposit-thumb {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border: 1px solid #cbd7d4;
    border-radius: 4px;
    background: #eef4f3;
}

.deposit-file-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #cbd5df;
    border-radius: 4px;
    background: #eef2f6;
    color: #405164;
    font-size: 9px;
    font-weight: 700;
}

.deposit-proof-large {
    display: block;
    max-width: 100%;
    max-height: 72vh;
    margin: 0 auto;
    border: 1px solid #d8e0e7;
    border-radius: 6px;
    background: #f9fbfc;
}

.compact-header {
    margin-bottom: 12px;
}

.compact-header h2 {
    margin: 0;
    color: var(--brand-dark);
    font-size: 18px;
}

.message-preview,
.audit-detail {
    max-width: 680px;
    margin: 8px 0 0;
    padding: 10px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f7faf9;
    color: var(--text);
    font: 13px/1.45 Consolas, "Courier New", monospace;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.audit-detail {
    max-height: 240px;
}

.total-row td {
    font-weight: 700;
    background: #eef6f4;
}

.result-summary {
    margin: 18px 0 8px;
    color: var(--muted);
    font-weight: 700;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 18px;
}

.auth-page .page {
    max-width: 460px;
}

.auth-card {
    padding: 24px;
}

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

label span {
    display: block;
    margin-bottom: 6px;
    color: #3f5358;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid #cbd7d4;
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

textarea {
    resize: vertical;
}

.check-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.check-row input {
    width: auto;
    min-height: auto;
}

.check-row span {
    margin: 0;
}

.check-row-field {
    align-self: end;
    min-height: 38px;
    padding: 8px 0;
}

.choice-fieldset {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.choice-fieldset legend {
    padding: 0 6px;
    color: #3f5358;
    font-weight: 700;
}

.choice-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
}

.field-help {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.test-schedule-panel {
    padding: 16px;
    border-left: 4px solid #b42318;
    background: #fffafa;
}

.test-schedule-panel h2 {
    color: #842018;
}

.search-row {
    display: flex;
    gap: 10px;
    align-items: end;
    margin-bottom: 14px;
}

.search-row label {
    flex: 1;
}

.flash {
    margin-bottom: 16px;
    padding: 11px 13px;
    border: 1px solid transparent;
    border-radius: 8px;
}

.flash-error {
    background: #fde8e8;
    color: #8a1f1f;
    border-color: #fac5c5;
}

.flash-success {
    background: #def7ec;
    color: #075f3b;
    border-color: #a7e8cb;
}

.flash-info {
    background: var(--brand-soft);
    color: var(--brand-dark);
    border-color: #bfdfdb;
}

.detail-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.detail-list div {
    padding: 10px;
    background: var(--surface-soft);
    border: 1px solid var(--line-soft);
    border-radius: 6px;
}

.detail-list dt {
    color: #637283;
    font-size: 12px;
}

.detail-list dd {
    margin: 2px 0 0;
    font-weight: 700;
}

.calendar-toolbar {
    margin-bottom: 18px;
}

.calendar-panel {
    padding: 12px;
}

#calendar {
    min-height: 640px;
}

.fc-title {
    white-space: normal;
}

.event-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 5px;
    border-radius: 50%;
    vertical-align: middle;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.62);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    width: min(680px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    padding: 20px;
    background: var(--surface);
    border-radius: 8px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.28);
}

.modal h2 {
    margin: 0 0 14px;
}

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

.ops-section {
    margin-top: 0;
}

.ops-links {
    display: grid;
    gap: 8px;
    margin: 0;
    padding-left: 22px;
}

.ops-links li {
    padding-left: 2px;
    color: var(--brand);
}

.ops-links a {
    font-weight: 700;
}

.ops-links a:hover {
    text-decoration: underline;
}

.ops-pending {
    color: #6b7785;
    font-weight: 700;
}

.ops-pending small {
    padding: 2px 6px;
    border-radius: 999px;
    background: #fff4d7;
    color: #7a4b00;
    font-size: 11px;
}

.doc-list {
    display: grid;
    gap: 10px;
}

.doc-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-soft);
}

.doc-item strong {
    display: block;
}

.doc-item small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}

.doc-item p {
    margin: 6px 0 0;
    color: #40545a;
}

.student-files-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.student-files-heading h2 {
    margin-bottom: 3px;
}

.student-files-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.student-file-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 16px;
}

.student-file-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface);
    box-shadow: 0 3px 12px rgba(35, 49, 56, 0.08);
}

.student-file-preview {
    display: flex;
    width: 100%;
    height: 280px;
    min-height: 280px;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: #e9eef1;
    color: #2d4149;
}

.student-file-preview:hover {
    border-color: var(--line);
    background: #dfe7eb;
}

.student-file-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #f7f9fa;
}

.student-file-preview-static {
    cursor: default;
}

.student-file-type {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    min-height: 180px;
    padding: 24px;
    text-align: center;
}

.student-file-type strong {
    color: #264c67;
    font-size: 34px;
    line-height: 1;
}

.student-file-type small {
    color: #5c7079;
    font-weight: 700;
}

.student-file-card-body {
    padding: 15px;
}

.student-file-card-body h3 {
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--brand-dark);
    font-size: 17px;
}

.student-file-meta {
    margin: 7px 0 0;
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.student-file-notes {
    margin: 10px 0 0;
    color: #3f535b;
    font-size: 14px;
}

.student-file-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.student-file-actions .button,
.student-file-actions button {
    flex: 1 1 auto;
}

.student-file-delete {
    margin-top: 12px;
}

.empty-state {
    padding: 28px;
    border: 1px dashed #aebcc3;
    border-radius: 7px;
    background: #f8fafb;
    color: #53666e;
    text-align: center;
}

.empty-state p {
    margin: 5px 0 0;
}

.student-file-overlay {
    z-index: 1200;
}

.student-file-modal {
    width: min(1120px, 100%);
    padding: 16px;
}

.student-file-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.student-file-modal-header h2 {
    margin: 0;
    overflow-wrap: anywhere;
}

.icon-button {
    flex: 0 0 38px;
    width: 38px;
    min-height: 38px;
    padding: 0;
    border-color: #aebbc1;
    background: #fff;
    color: #324750;
}

.icon-button:hover {
    background: #edf2f4;
    color: #1f333b;
}

.student-file-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 420px;
    max-height: 72vh;
    overflow: auto;
    border: 1px solid #243945;
    border-radius: 6px;
    background: #172832;
}

.student-file-stage img {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.student-file-stage iframe {
    width: 100%;
    height: 70vh;
    border: 0;
    background: #fff;
}

.student-file-stage [hidden],
.document-scan-modal [hidden] {
    display: none !important;
}

.student-file-fallback {
    min-height: 360px;
    color: #fff;
}

.student-file-fallback strong,
.student-file-fallback small {
    color: inherit;
}

.student-file-modal-actions {
    margin-top: 12px;
}

.document-scan-button {
    flex-basis: 100%;
}

.document-scan-overlay {
    z-index: 1300;
}

.document-scan-modal {
    width: min(1180px, 100%);
}

.document-scan-modal .student-file-modal-header > div {
    min-width: 0;
}

.document-scan-privacy {
    max-width: 820px;
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.document-scan-status {
    padding: 14px;
    border: 1px solid #b9c8cf;
    border-radius: 6px;
    background: #f4f8fa;
}

.document-scan-progress {
    height: 9px;
    margin-top: 9px;
    overflow: hidden;
    border-radius: 4px;
    background: #d9e2e6;
}

.document-scan-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: #226b54;
    transition: width 180ms ease;
}

.document-scan-warnings {
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid #d7a52b;
    border-radius: 6px;
    background: #fff8df;
    color: #5f4300;
}

.document-scan-warnings ul {
    margin: 0;
    padding-left: 20px;
}

.document-scan-warnings li + li {
    margin-top: 5px;
}

.document-scan-results {
    max-height: 52vh;
    margin-top: 14px;
    overflow: auto;
}

.document-scan-results table {
    min-width: 860px;
}

.document-scan-results th,
.document-scan-results td {
    vertical-align: middle;
}

.document-scan-results input[type="text"],
.document-scan-results input[type="date"],
.document-scan-results select {
    min-width: 155px;
    padding: 8px 9px;
}

.document-scan-results .scan-short-input {
    min-width: 76px;
    width: 76px;
    text-transform: uppercase;
}

.scan-current-missing {
    color: #8a310e;
    font-weight: 700;
}

.scan-conflict-row {
    background: #fff8df;
}

.scan-match-row {
    background: #f2f5f6;
    color: #61747c;
}

.scan-apply-choice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 150px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}

.scan-apply-choice input[type="checkbox"] {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    min-height: 18px;
    padding: 0;
    margin-top: 2px;
}

.document-scan-actions {
    margin-top: 16px;
    position: sticky;
    bottom: -20px;
    z-index: 2;
    padding: 12px 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
}

.student-file-viewer {
    min-height: 70vh;
    text-align: center;
}

.student-file-full-image {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 190px);
    margin: 0 auto;
    object-fit: contain;
}

.student-file-full-pdf {
    display: block;
    width: 100%;
    height: calc(100vh - 210px);
    min-height: 620px;
    border: 1px solid var(--line);
    background: #fff;
}

.student-file-pdf-help {
    margin: 12px 0 0;
    color: var(--muted);
}

.doc-status {
    align-self: flex-start;
    min-width: 64px;
    justify-content: center;
}

.option-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding-left: 20px;
}

.option-list li {
    padding-left: 4px;
}

.option-list a {
    font-weight: 700;
}

.option-list small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
}

th.sortable-header {
    position: relative;
    padding-right: 28px;
    cursor: pointer;
    user-select: none;
}

th.sortable-header::after {
    content: "\2195";
    position: absolute;
    right: 9px;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 400;
}

th.sortable-header[aria-sort="ascending"]::after {
    content: "\2191";
    color: currentColor;
}

th.sortable-header[aria-sort="descending"]::after {
    content: "\2193";
    color: currentColor;
}

th.sortable-header:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: -3px;
}

.document-audit-stats {
    margin-bottom: 18px;
}

.section-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.section-heading-row h2,
.section-heading-row p {
    margin-top: 0;
}

.section-heading-row p {
    margin-bottom: 0;
    color: var(--muted);
}

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

.document-missing-toggle {
    align-self: end;
    min-height: 44px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-soft);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-height: 0;
    margin: 0;
}

.checkbox-label span {
    margin: 0;
}

.document-results-table table,
.document-audit-table table {
    min-width: 1120px;
}

.document-search-thumb {
    display: grid;
    width: 72px;
    height: 72px;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 800;
    text-decoration: none;
}

.document-search-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.table-subtext {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 10px;
}

.missing-doc-list {
    display: flex;
    min-width: 170px;
    flex-wrap: wrap;
    gap: 5px;
}

.missing-doc-list span {
    display: inline-flex;
    padding: 3px 6px;
    border: 1px solid #e2a7a7;
    border-radius: 4px;
    background: #fff1f1;
    color: #842626;
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.25;
}

.audit-complete {
    display: inline-flex;
    padding: 3px 6px;
    border: 1px solid #96c7aa;
    border-radius: 4px;
    background: #effaf3;
    color: #235f3b;
    font-size: 0.75rem;
    font-weight: 700;
}

.audit-attention-row td:first-child {
    border-left: 3px solid #b33a3a;
}

.audit-rules {
    margin: 18px 0;
    padding: 14px 16px;
    border-left: 3px solid var(--accent);
    background: var(--surface-soft);
}

.audit-rules .option-list {
    margin-top: 8px;
}

@media (max-width: 700px) {
    .section-heading-row,
    .student-files-heading {
        align-items: stretch;
        flex-direction: column;
    }
}

.student-portal .page {
    max-width: 760px;
}

.student-registration .page {
    max-width: 820px;
}

.student-account-portal .page {
    max-width: 1180px;
}

.honeypot-field {
    position: absolute !important;
    left: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

.student-registration-form,
.student-registration-result,
.password-form {
    max-width: 760px;
    margin-right: auto;
    margin-left: auto;
}

.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.filter-tabs a {
    padding: 9px 14px;
    border-bottom: 3px solid transparent;
    color: #53666e;
    font-weight: 700;
}

.filter-tabs a:hover,
.filter-tabs a[aria-current="page"] {
    border-bottom-color: var(--brand);
    color: var(--brand-dark);
    text-decoration: none;
}

.status-approved {
    background: #def7ec;
    color: var(--success);
}

.status-denied {
    background: #fde8e8;
    color: var(--danger);
}

.access-request-review {
    border-left: 4px solid var(--accent);
}

.portal-stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.portal-completion-panel {
    border-left: 4px solid var(--accent);
}

.portal-checklist {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.portal-checklist li {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-soft);
}

.portal-checklist li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-weight: 700;
}

.portal-checklist .is-complete span {
    background: #def7ec;
    color: var(--success);
}

.portal-checklist .is-missing span {
    background: var(--accent-soft);
    color: var(--accent);
}

.portal-record-list {
    display: grid;
    gap: 9px;
}

.portal-record-list article {
    padding-bottom: 9px;
    border-bottom: 1px solid var(--line-soft);
}

.portal-record-list article:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.portal-record-list strong,
.portal-record-list small,
.portal-record-list span {
    display: block;
}

.portal-record-list small,
.portal-record-list span {
    color: var(--muted);
}

.portal-file-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}

.portal-file-strip a {
    min-width: 0;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-soft);
}

.portal-file-strip strong,
.portal-file-strip small {
    display: block;
    overflow-wrap: anywhere;
}

.portal-file-strip small {
    margin-top: 3px;
    color: var(--muted);
}

.student-file-help p:last-child {
    margin-bottom: 0;
}

.student-portal .page-header {
    align-items: flex-start;
}

.student-test-panel {
    padding: 24px;
}

.student-test-list {
    gap: 14px;
}

.student-test-list li {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-soft);
}

.student-test-list a {
    display: inline-block;
    font-size: 17px;
}

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

.note-card {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-soft);
}

.note-card p {
    margin: 0 0 8px;
}

.note-card small {
    display: block;
    margin-bottom: 8px;
    color: #637283;
}

.two-column {
    grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
    align-items: start;
}

.print-document {
    background: #fff;
    color: #000;
    padding: 24px;
    border: 1px solid var(--line);
}

.print-section {
    margin-bottom: 18px;
    padding: 12px;
    border: 1px solid #b8c2cc;
}

.transcript-header {
    margin-bottom: 18px;
}

.transcript-header img {
    display: block;
    max-width: 150px;
    max-height: 90px;
    object-fit: contain;
    margin-bottom: 8px;
}

.transcript table {
    width: 100%;
    border-collapse: collapse;
    margin: 18px 0;
}

.transcript td {
    border: 1px solid #000;
    padding: 8px;
    vertical-align: top;
}

.label-cell {
    width: 40%;
    font-weight: 700;
    background: #f9f9f9;
}

.label-cell span {
    font-weight: 400;
}

.signature-line {
    margin-top: 40px;
    padding-top: 10px;
    border-top: 1px solid #000;
    font-style: italic;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.detail-grid div,
.detail-block {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.detail-grid strong,
.detail-block strong {
    display: block;
    margin-bottom: 4px;
    color: #506173;
    font-size: 12px;
    text-transform: uppercase;
}

.detail-grid span,
.detail-block p {
    margin: 0;
    overflow-wrap: anywhere;
}

.detail-block {
    margin-top: 12px;
}

.question-block {
    margin: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.question-block legend {
    padding: 0 6px;
    font-weight: 700;
    color: var(--brand-dark);
}

.choice-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.choice-list label,
.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.choice-list input,
.check-row input {
    width: auto;
}

@media print {
    body {
        background: #fff;
    }

    .topbar,
    .no-print {
        display: none !important;
    }

    .page {
        width: auto;
        margin: 0;
    }

    .print-document {
        padding: 0;
        border: 0;
    }

    .print-section {
        break-inside: avoid;
    }

    .student-file-viewer {
        min-height: 0;
        margin: 0;
        padding: 0;
        border: 0;
        box-shadow: none;
    }

    .student-file-full-image {
        max-width: 100%;
        max-height: none;
    }
}

@media (max-width: 720px) {
    .topbar,
    .page-header,
    .search-row {
        align-items: stretch;
        flex-direction: column;
    }

    .two-column {
        grid-template-columns: 1fr;
    }

    .portal-stat-grid,
    .portal-main-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        padding: 14px 16px;
        position: static;
    }

    .topnav {
        width: 100%;
    }

    .brand img {
        width: 72px;
        max-width: 36vw;
        height: 24px;
    }

    .topnav a {
        flex: 1 1 auto;
        text-align: center;
    }

    .doc-item {
        flex-direction: column;
    }

    .student-file-gallery {
        grid-template-columns: 1fr;
    }

    .student-file-preview {
        height: 250px;
        min-height: 250px;
    }

    .student-file-stage {
        min-height: 300px;
    }

    .student-file-modal-actions .button {
        width: 100%;
    }

    .student-file-full-pdf {
        min-height: 520px;
    }

    .button,
    button {
        width: 100%;
    }

    .inline-form .link-button {
        width: auto;
    }

    .student-file-modal-header .icon-button,
    .student-file-delete .link-button {
        width: auto;
    }
}
.document-scan-source {
    display: block;
    width: min(100%, 460px);
    margin: 12px auto;
    text-align: center;
}

.document-scan-source img {
    max-width: 100%;
    max-height: 220px;
    object-fit: contain;
}
