html[data-student-theme] { font-size: calc(100% * var(--student-font-scale, 1)); }
.student-portal-page {
    --appearance-surface: #fcfdfc;
    --appearance-soft: #e9f2eb;
    --appearance-accent: #315d42;
}
.student-portal-page .student-home-nav { flex-shrink: 0; }
.student-settings-tabs { display: flex; border-bottom: 1px solid var(--portal-line); margin-bottom: 32px; }
.student-settings-tabs a { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 12px 4px; border-bottom: 2px solid var(--appearance-accent); color: var(--appearance-accent); text-decoration: none; font-size: .875rem; font-weight: 600; }
.student-appearance { max-width: 760px; }
.student-appearance[hidden] { display: none; }
.appearance-section { border: 0; border-bottom: 1px solid var(--portal-line); padding: 0 0 28px; margin: 0 0 28px; min-width: 0; }
.appearance-section legend, .appearance-section h2 { padding: 0; margin: 0 0 18px; color: var(--portal-ink); font-size: 1rem; font-weight: 600; line-height: 1.5; }
.appearance-themes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--appearance-soft); border-radius: 8px; max-width: 480px; }
.appearance-themes label { position: relative; min-width: 0; cursor: pointer; }
.appearance-themes input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.appearance-themes span { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; padding: 12px 8px; min-height: 48px; border: 1px solid transparent; border-radius: 6px; color: var(--portal-muted); font-size: .875rem; line-height: 1.5; }
.appearance-themes input:checked + span { color: var(--appearance-accent); background: var(--appearance-surface); border-color: var(--portal-line); box-shadow: var(--portal-shadow); }
.appearance-themes input:focus-visible + span { outline: 2px solid var(--appearance-accent); outline-offset: 2px; }
.appearance-font { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.appearance-font h2 { margin: 0; }
.appearance-stepper { display: grid; grid-template-columns: 44px minmax(80px, auto) 44px; align-items: center; gap: 8px; }
.appearance-stepper output { text-align: center; color: var(--portal-ink); font-size: .875rem; font-variant-numeric: tabular-nums; }
.student-portal-page .appearance-stepper button { width: 44px; height: 44px; padding: 0; }
.student-portal-page :is(.appearance-stepper button, #studentAppearanceReset) { border: 1px solid var(--portal-line); color: var(--appearance-accent); background: var(--appearance-surface); }
.student-portal-page .appearance-stepper button:disabled { opacity: .35; cursor: default; }
.student-portal-page :is(.appearance-stepper button, #studentAppearanceReset):hover:not(:disabled) { background: var(--appearance-soft); }
.appearance-preview { display: flex; gap: 18px; align-items: center; padding: 24px 0; }
.appearance-preview > svg { width: 32px; height: 32px; color: var(--appearance-accent); }
.appearance-preview h2 { margin: 0 0 8px; font-size: 1.25rem; font-weight: 600; line-height: 1.5; }
.appearance-preview p { margin: 0; color: var(--portal-muted); font-size: .875rem; line-height: 1.6; }
.appearance-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; border-top: 1px solid var(--portal-line); padding: 24px 0 0; }
.appearance-footer p { margin: 0; max-width: 42ch; font-size: .75rem; line-height: 1.6; color: var(--portal-muted); }
.student-portal-page #studentAppearanceReset { padding: 10px 16px; font-size: .8125rem; }
.student-portal-page :is(.appearance-preview h2, .appearance-footer, .appearance-section) { overflow-wrap: anywhere; }
.student-portal-page .file-selected-details strong { font-size: .9375rem; }
.student-portal-page .file-selected-details small { font-size: .8125rem; }
.report-email-section { padding: 24px 0; border-bottom: 1px solid var(--portal-line); }
.report-email-section h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; color: var(--portal-ink); font-size: 1rem; font-weight: 600; }
.report-email-optin { display: flex; align-items: flex-start; gap: 12px; color: var(--portal-ink); font-size: .875rem; line-height: 1.6; cursor: pointer; }
.student-portal-page .report-email-optin input { width: 20px; height: 20px; flex: 0 0 20px; margin: 2px 0 0; accent-color: var(--portal-green); }
.report-email-section p { margin: 12px 0 0 32px; max-width: 80ch; color: var(--portal-muted); font-size: .75rem; line-height: 1.7; }
.report-student-actions { display: grid; gap: 12px; flex-shrink: 0; }
.student-portal-page .report-email-stop button { border: 1px solid var(--portal-line); background: var(--portal-glass); color: var(--appearance-accent); padding: 8px 12px; font-size: .75rem; }
.student-portal-page .report-row summary { grid-template-columns: minmax(0, 1fr) 160px max-content 16px; }
.student-portal-page .report-status { white-space: nowrap; }

/* Dark surfaces cover the shared navigation, home, forms, reports and dialogs. */
html[data-student-theme="dark"] { color-scheme: dark; background: #171a1c; }
html[data-student-theme="dark"] .student-portal-page {
    --portal-ink: #e7eeeb;
    --portal-muted: #afbeb6;
    --portal-line: #3e4846;
    --portal-green: #35654b;
    --portal-glass: rgba(34, 39, 41, .94);
    --portal-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 3px 12px rgba(0, 0, 0, .12);
    --appearance-surface: #242a2c;
    --appearance-soft: #2c3c34;
    --appearance-accent: #a4d6b6;
    background: #171a1c;
    color: var(--portal-ink);
    color-scheme: dark;
}
html[data-student-theme="dark"] .student-portal-page :is(.student-home-rail, .home-topbar) { box-shadow: none; }
html[data-student-theme="dark"] .student-portal-page :is(.student-rail-brand strong, .home-breadcrumb strong, .home-account, .student-home-header h1, .home-primary h2, .home-contact h2, .home-action-name, .home-safety-list strong, .home-student-profile figcaption strong, .home-contact address strong, .profile-card h2, .profile-card label, .incident-form .incident-card h2, .incident-form .incident-card label, .incident-form .evidence-card h2, .reports-toolbar label) { color: var(--portal-ink); }
html[data-student-theme="dark"] .student-portal-page :is(.student-rail-brand span, .student-rail-label, .student-rail-access, .student-home-signout, .student-home-nav-item, .student-home-header p, .student-home-header .home-eyebrow, .portal-eyebrow, .home-safety-list li > span > span, .home-contact address small, .home-contact address > a, .home-contact address > span, .home-privacy-notice p, .home-privacy-notice summary span > span, .profile-campus-status > span) { color: var(--portal-muted); }
html[data-student-theme="dark"] .student-portal-page :is(.student-home-nav-item.active, .student-home-nav-item:hover, .student-home-signout:hover, .home-action--report, .home-action:hover, .home-action-icon, .home-avatar, .profile-avatar) { color: var(--appearance-accent); background: var(--appearance-soft); border-color: var(--portal-line); }
html[data-student-theme="dark"] .student-portal-page :is(.home-action, .student-home-signout, .home-safety-list li, .home-student-profile, .home-contact, .home-avatar, .profile-avatar, .profile-dialog) { border-color: var(--portal-line); }
html[data-student-theme="dark"] .student-portal-page :is(.home-action--report .home-action-icon, .home-privacy) { background: #23342c; }
html[data-student-theme="dark"] .student-portal-page :is(.home-action-arrow, .home-action--report .home-action-arrow, .home-action--report .home-action-icon, .home-privacy-notice summary, .home-privacy > svg, .profile-campus-status, .home-contact a:hover strong) { color: var(--appearance-accent); }
html[data-student-theme="dark"] .student-portal-page .home-tip-icon--gold { background: #413921; color: #efcf83; }
html[data-student-theme="dark"] .student-portal-page .home-tip-icon--coral { background: #442e2c; color: #f1b0a2; }
html[data-student-theme="dark"] .student-portal-page .home-tip-icon--teal { background: #233f39; color: #9adacb; }
html[data-student-theme="dark"] .student-portal-page :is(input, textarea)::placeholder { color: #a7b6ae; }
html[data-student-theme="dark"] .student-portal-page .incident-form .incident-card textarea::placeholder { color: #a7b6ae; }
html[data-student-theme="dark"] .student-portal-page :is(.profile-card input[readonly], .profile-readonly-field) { color: var(--portal-muted); background: #2c3234; }
html[data-student-theme="dark"] .student-portal-page :is(.profile-actions a, .profile-dialog-cancel, .incident-form .file-button, .incident-form .form-actions .secondary-button, .file-selected-remove) { color: var(--appearance-accent); background: var(--appearance-surface); border-color: var(--portal-line); }
html[data-student-theme="dark"] .student-portal-page :is(.profile-message--success, .incident-form .form-success, .incident-form .file-selected-card, .report-status.is-complete) { background: #234234; color: #b9edcf; border-color: #436652; }
html[data-student-theme="dark"] .student-portal-page .file-selected-details :is(strong, small) { color: #b9edcf; }
html[data-student-theme="dark"] .student-portal-page :is(.profile-message--error, .reports-error, .incident-form .form-error) { background: #472c2b; color: #ffc4b8; }
html[data-student-theme="dark"] .student-portal-page .report-status { background: #293f49; color: #c1e1f1; }
html[data-student-theme="dark"] .student-portal-page .report-status.is-pending { background: #443c24; color: #f3d487; }
html[data-student-theme="dark"] .student-portal-page .report-remove-form button { background: #3b2b2a; color: #f3b5aa; border-color: #81564e; }
html[data-student-theme="dark"] .student-portal-page :is(.report-row summary:hover, .profile-pencil-button:hover, .profile-actions a:hover, .profile-dialog-cancel:hover, .reports-pagination button:hover, .file-button:hover) { background: var(--appearance-soft); }
html[data-student-theme="dark"] .student-portal-page :is(a, button, summary, input, select, textarea):focus-visible { outline-color: #a4d6b6; }
@media (max-width: 1100px) {
    .student-portal-page .report-row summary { grid-template-columns: minmax(0, 1fr) max-content 16px; }
}
@media (max-width: 760px) {
    .student-portal-page .student-home-nav { grid-template-columns: repeat(5, minmax(3.5rem, 1fr)); overflow-x: auto; }
    .student-portal-page .student-home-nav-item { height: auto; min-height: 68px; overflow-wrap: normal; }
    .student-portal-page .profile-card input, .student-portal-page .incident-form .incident-card :is(input, select, textarea), .student-portal-page .reports-toolbar :is(input, select) { font-size: max(16px, 1rem); }
    .appearance-themes span { flex-direction: column; }
    .appearance-footer { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 580px) {
    .student-portal-page .report-row summary { grid-template-columns: minmax(0, 1fr) 16px; }
    .student-portal-page .report-identity { grid-column: 1; grid-row: 1; }
    .student-portal-page .report-status { grid-column: 1; grid-row: 2; }
    .student-portal-page .report-expand { grid-column: 2; grid-row: 1; }
    .student-portal-page .report-submitted { grid-column: 1 / -1; grid-row: 3; }
}
@media (prefers-reduced-transparency: reduce) {
    html[data-student-theme="dark"] .student-portal-page { --portal-glass: #222729; }
}
@media (forced-colors: active) {
    html[data-student-theme] .student-portal-page { --appearance-surface: Canvas; --appearance-soft: Canvas; --appearance-accent: LinkText; --portal-ink: CanvasText; --portal-muted: CanvasText; --portal-line: ButtonBorder; --portal-glass: Canvas; }
}
