/* Shared appearance. Sidebar artwork lives in sidebar-reference.css. */
html body:not(.login-page):not(.signup-page) .sidebar :is(.menu a, .logo) {
    text-shadow: 0 1px 3px rgba(0, 22, 19, .45);
}

html body.dashboard-page .sidebar .menu li:has(> .osa-theme-toggle) {
    display: none !important;
}

/* App-wide dark palette. */
html[data-osa-theme="dark"] {
    color-scheme: dark;
    --page-bg: #101a21;
    --panel-bg: #1b2a33;
    --soft-header: #22343e;
    --teal: #55b3a5;
    --teal-dark: #85d5c8;
    --teal-deep: #b0e6dd;
    --teal-pale: #1f413f;
    --border: #40535e;
    --text: #e8f1f2;
    --muted: #aec2c8;
    --shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
    --shadow-soft: 0 6px 18px rgba(0, 0, 0, 0.2);
}

html body.dashboard-page .dashboard-header-actions .osa-dashboard-theme-toggle {
    align-items: center;
    background: #e6f5f2 !important;
    border: 1px solid #b8d4cf !important;
    border-radius: 12px;
    color: #145b54 !important;
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 46px;
    font: inherit;
    font-size: 18px;
    height: 46px;
    justify-content: center;
    margin-left: auto;
    min-height: 46px;
    padding: 0;
    width: 46px !important;
}
html body.dashboard-page .dashboard-header-actions .osa-dashboard-theme-toggle i {
    color: inherit !important;
}
html body.dashboard-page .dashboard-header-actions .osa-dashboard-theme-toggle:hover {
    background: #d4ebe7 !important;
}
html body.dashboard-page .dashboard-header-actions .osa-dashboard-theme-toggle:focus-visible {
    outline: 2px solid #247e73 !important;
    outline-offset: 2px;
}
html[data-osa-theme="dark"] body.dashboard-page .dashboard-header-actions .osa-dashboard-theme-toggle {
    background: #2c414c !important;
    border-color: #526873 !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.dashboard-page .dashboard-header-actions .osa-dashboard-theme-toggle:hover {
    background: #3d5662 !important;
}

html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) {
    background: #101a21 !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) .layout > :is(.main, .main-content),
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(.page-content, .content-area, .dashboard-content) {
    background-color: #101a21 !important;
}

html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    .page-header, .top-bar, .topbar, .dashboard-context-header,
    .card, .panel, .content-card, .content-box, .section-card,
    .table-card, .table-container, .table-wrapper, .responsive-table,
    .report-container, .report-card, .metrics, .events, .sms-panel,
    .filter-box, .filter-container, .report-filterbar, .notification-filterbar,
    .modal-content, .popup-content, .dialog-content, .notification-list-card,
    .user-form-section, .form-section, .detail-card, .summary-card,
    .archive-card, .notification-content, .account-settings-card
) {
    background: #1b2a33 !important;
    border-color: #40535e !important;
    color: #e8f1f2 !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .2) !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    .dashboard-section-title, .section-heading, .card-header, .report-header,
    .modal-header, .table-header, .notification-list-heading,
    .form-section-header, .report-section-title
) {
    background-color: #22343e !important;
    border-color: #40535e !important;
}
/* Dashboard summary titles are labels above the cards, not header panels. */
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page).dashboard-page .dashboard-section-title {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    margin: 0 0 12px !important;
    padding: 0 !important;
}
/* ui-uniform.css assigns near-black text directly to report header labels. */
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    .report-header span, .recent-report-heading strong
) {
    color: #f1f7f8 !important;
}

html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    h1, h2, h3, h4, h5, h6, p, label, legend, dt, dd,
    .dashboard-greeting, .dashboard-subtitle, .subtitle,
    .top-bar h1, .top-bar h2, .page-header h1, .page-header h2
) {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    small, .muted, .help-text, .field-help, .form-hint, .card-description
) {
    color: #aec2c8 !important;
}

/* Light-only information panels are reused by every staff role. */
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    .dormant-note, .report-guide, .recent-report-box,
    .account-settings-header, .account-settings-overview
) {
    background: #1b2a33 !important;
    border-color: #40535e !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    .guide-grid > div, .account-settings-tip
) {
    background: #253b43 !important;
    border-color: #45616a !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    .dormant-note, .report-guide, .recent-report-box,
    .account-settings-header, .account-settings-overview, .account-settings-tip,
    .guide-grid > div, .recent-report-row, .summary-card
) :is(strong, span, dt, dd, h1, h2, h3, p, small) {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    .report-guide p, .guide-grid span, .recent-report-row span,
    .account-settings-header p, .account-settings-overview dt,
    .summary-card span, .summary-card small
) {
    color: #b9cbd0 !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) .recent-report-row {
    border-color: #40535e !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    .section-title > span, .summary-card > strong
) {
    color: #85d5c8 !important;
}

html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(input, select, textarea) {
    background: #13232c !important;
    border-color: #536a75 !important;
    color: #f2f7f8 !important;
    color-scheme: dark;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(input, textarea)::placeholder {
    color: #a9bdc3 !important;
    opacity: 1;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(input, select, textarea):focus-visible,
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(button, a):focus-visible {
    outline: 2px solid #8edbd0 !important;
    outline-offset: 2px;
}

/* Staff filters share a stronger legacy white-card rule across modules. */
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) .layout form:is(
    .filter-box, .filter-container, .report-filterbar, .uniform-filter-bar
) {
    background: #1b2a33 !important;
    border-color: #40535e !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) .layout form:is(
    .filter-box, .filter-container, .report-filterbar, .uniform-filter-bar
) label {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) .layout form:is(
    .filter-box, .filter-container, .report-filterbar, .uniform-filter-bar
) :is(input, select, textarea) {
    background: #13232c !important;
    border-color: #536a75 !important;
    color: #f2f7f8 !important;
}

html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) table {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(th, thead td) {
    background: #2a3e49 !important;
    border-color: #4b616c !important;
    color: #f1f7f8 !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(td, tbody th) {
    background-color: #1b2a33 !important;
    border-color: #40535e !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) tbody tr:nth-child(even) :is(td, th) {
    background-color: #22343e !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) tbody tr:hover :is(td, th) {
    background-color: #2a454c !important;
}
/* Legacy athlete and activity styles paint a pale hover over the whole row. */
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    table tbody tr:hover, .report-row:hover, .recent-report-row:hover
) {
    background: #2a454c !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) table tbody tr:hover > :is(td, th) {
    background: #2a454c !important;
    box-shadow: none !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) table tbody tr:hover :is(
    .actions-cell, .action-row, .inline-action-form
) {
    background: transparent !important;
    box-shadow: none !important;
}

html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) a:not(.sidebar a):not(.osa-btn):not(.filter-btn) {
    color: #8edbd0;
}
/* Keep semantic badge palettes together with their original dark text.  The
   light badge fills are intentional and need not become dark themselves. */
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    .badge, .status-badge, .athlete-status, .severity-badge, .chip
):is(.light, .severity-light, .status-active, .status-complete,
    .status-completed, .status-approved, .status-resolved) {
    background: #dcfce7 !important;
    color: #14532d !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    .badge, .status-badge, .athlete-status, .severity-badge, .chip
):is(.less-grave, .severity-less-grave, .status-upcoming,
    .status-for-checking, .status-in-review, .status-pending, .status-for-compliance) {
    background: #fef3c7 !important;
    color: #713f12 !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    .badge, .status-badge, .athlete-status, .severity-badge, .chip
):is(.grave, .severity-grave, .status-inactive,
    .status-disapproved, .status-rejected) {
    background: #fee2e2 !important;
    color: #881d1d !important;
}
html[data-osa-theme="dark"] body.events-page .activity-osa-status.status-a { color: #14532d !important; }
html[data-osa-theme="dark"] body.events-page .activity-osa-status.status-b { color: #713f12 !important; }
html[data-osa-theme="dark"] body.events-page .activity-osa-status.status-c { color: #881d1d !important; }
html[data-osa-theme="dark"] body.events-page .activity-osa-status.status-checking { color: #334155 !important; }
html[data-osa-theme="dark"] body.events-page .activity-osa-status.status-cancelled { background: #e5e7eb !important; color: #334155 !important; }

/* Table action cells and dashboard list items should not remain white islands. */
html[data-osa-theme="dark"] body.events-page .table-container table,
html[data-osa-theme="dark"] body.events-page .table-container tbody tr {
    background: #1b2a33 !important;
}
html[data-osa-theme="dark"] body.events-page .table-container tbody tr:nth-child(even) {
    background: #22343e !important;
}
html[data-osa-theme="dark"] body.events-page .table-container tbody td.actions-cell {
    background: #1b2a33 !important;
    border-color: #40535e !important;
}
html[data-osa-theme="dark"] body.events-page .table-container tbody tr:nth-child(even) td.actions-cell {
    background: #22343e !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) .actions-cell :is(.action-row, .inline-action-form) {
    background: transparent !important;
}
html[data-osa-theme="dark"] body.dashboard-page .activity-list li {
    background: #253b43 !important;
    border-color: #45616a !important;
}
html[data-osa-theme="dark"] body.dashboard-page .activity-list li strong { color: #f0f7f7 !important; }
html[data-osa-theme="dark"] body.dashboard-page .activity-list li small { color: #b9cbd0 !important; }
html[data-osa-theme="dark"] body.dashboard-page .analytics-card .chart-container {
    background: #192a34 !important;
    border-color: #45616a !important;
}
html[data-osa-theme="dark"] body.dashboard-page .analytics-card .analytics-period,
html[data-osa-theme="dark"] body.dashboard-page .analytics-card .analytics-insight {
    background: #284149 !important;
    border-color: #45616a !important;
    color: #dcefee !important;
}
/* Dashboard side-panel status pills use a light fill; retain a dark label
   in dark mode for every role dashboard (discipline, activity, and sports). */
html[data-osa-theme="dark"] body.dashboard-page .events > .panel-title > span {
    color: #145b54 !important;
}

html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    .reset-btn, .cancel-btn, .secondary-btn, .pagination-link,
    .dashboard-side-page, .icon-action, .mini-btn, .close
) {
    background: #2c414c !important;
    border-color: #526873 !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    .pagination-link.active, .dashboard-side-page.active
) {
    background: #3d8d7d !important;
    border-color: #3d8d7d !important;
    color: #ffffff !important;
    box-shadow: 0 6px 14px rgba(61, 141, 125, 0.24) !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    a.pagination-link:hover, a.dashboard-side-page:hover
) {
    background: #3a555f !important;
    border-color: #78929b !important;
    color: #ffffff !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    a.pagination-link.active:hover, a.dashboard-side-page.active:hover
) {
    background: #2f7568 !important;
    border-color: #2f7568 !important;
    color: #ffffff !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    .osa-btn, .filter-btn, .apply-btn, .save-btn, .primary-btn
) {
    background: #2f8176 !important;
    color: #fff !important;
}

html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    .modal, .popup-overlay, .dialog-backdrop
) { background-color: rgba(2, 10, 14, .76) !important; }

/* Add, edit, and view forms use the shared popup card stylesheet. */
html[data-osa-theme="dark"] body #addModal .referral-modal-content {
    background: #22343e !important;
    border-color: #45616a !important;
    box-shadow: none !important;
}
html[data-osa-theme="dark"] body #addModal .assessment-box {
    background: #183d38 !important;
    border-color: #39796d !important;
    color: #edf9f5 !important;
}
html[data-osa-theme="dark"] body #addModal .assessment-box :is(strong, p, small) {
    color: #edf9f5 !important;
}
html[data-osa-theme="dark"] body #addModal .assessment-box small {
    color: #bfdfd8 !important;
}
html[data-osa-theme="dark"] body #addModal .grave-count-notice {
    background: #3d2e26 !important;
    border-color: #9c6837 !important;
    color: #ffe1b7 !important;
}
/* Resolve Offense: the summary and intervention panels must follow the modal palette. */
html[data-osa-theme="dark"] body.offense-page #resolveOffenseModal .resolve-modal-content {
    background: #1b2a33 !important;
    border-color: #40535e !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.offense-page #resolveOffenseModal .resolve-audit-strip > div {
    background: #253b43 !important;
    border-color: #45616a !important;
}
html[data-osa-theme="dark"] body.offense-page #resolveOffenseModal .resolve-audit-strip span {
    color: #b9cbd0 !important;
}
html[data-osa-theme="dark"] body.offense-page #resolveOffenseModal .resolve-audit-strip strong {
    color: #f2f7f8 !important;
}
html[data-osa-theme="dark"] body.offense-page #resolveOffenseModal .resolve-offense-context > div {
    background: #253b43 !important;
    border-color: #45616a !important;
}
html[data-osa-theme="dark"] body.offense-page #resolveOffenseModal .resolve-offense-context span {
    color: #b9cbd0 !important;
}
html[data-osa-theme="dark"] body.offense-page #resolveOffenseModal .resolve-offense-context strong {
    color: #f2f7f8 !important;
}
html[data-osa-theme="dark"] body.offense-page #resolveOffenseModal .resolve-assessment-card {
    background: #183d38 !important;
    border-color: #39796d !important;
    color: #edf9f5 !important;
}
html[data-osa-theme="dark"] body.offense-page #resolveOffenseModal .resolve-assessment-card :is(strong, p) {
    color: #edf9f5 !important;
}
html[data-osa-theme="dark"] body.offense-page #resolveOffenseModal .resolve-grid label span,
html[data-osa-theme="dark"] body.offense-page #resolveOffenseModal .resolve-checklist label {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.offense-page #resolveOffenseModal .resolve-form-hint {
    color: #b9cbd0 !important;
}
/* Athlete Assess and Activity Endorse use their own light summary/checklist cards. */
html[data-osa-theme="dark"] body.athlete-page #athleteAssessmentModal .athlete-assessment-modal-content,
html[data-osa-theme="dark"] body.events-page #activityApprovalModal .activity-approval-modal {
    background: #1b2a33 !important;
    border-color: #40535e !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.athlete-page #athleteAssessmentModal .athlete-assessment-audit-strip > div,
html[data-osa-theme="dark"] body.athlete-page #athleteAssessmentModal .athlete-form-section,
html[data-osa-theme="dark"] body.athlete-page #athleteAssessmentModal .athlete-requirement-grid label,
html[data-osa-theme="dark"] body.events-page #activityApprovalModal .activity-form-section,
html[data-osa-theme="dark"] body.events-page #activityApprovalModal .requirements-group label,
html[data-osa-theme="dark"] body.events-page #activityApprovalModal .activity-section-title h3,
html[data-osa-theme="dark"] body.events-page #activityApprovalModal .activity-approval-summary > div,
html[data-osa-theme="dark"] body.events-page #activityApprovalModal .auto-decision-reason {
    background: #253b43 !important;
    border-color: #45616a !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.athlete-page #athleteAssessmentModal .athlete-assessment-guidance {
    background: #183d38 !important;
    border-color: #39796d !important;
    color: #edf9f5 !important;
}
html[data-osa-theme="dark"] body.athlete-page #athleteAssessmentModal .athlete-assessment-guidance :is(strong, p),
html[data-osa-theme="dark"] body.athlete-page #athleteAssessmentModal .athlete-assessment-audit-strip strong,
html[data-osa-theme="dark"] body.athlete-page #athleteAssessmentModal .athlete-form-section h4,
html[data-osa-theme="dark"] body.athlete-page #athleteAssessmentModal :is(.athlete-form-section > label, .athlete-requirement-grid label),
html[data-osa-theme="dark"] body.events-page #activityApprovalModal .activity-section-title h3,
html[data-osa-theme="dark"] body.events-page #activityApprovalModal .requirements-group label,
html[data-osa-theme="dark"] body.events-page #activityApprovalModal .activity-approval-summary strong {
    color: #edf9f5 !important;
}
html[data-osa-theme="dark"] body.athlete-page #athleteAssessmentModal .athlete-assessment-audit-strip span,
html[data-osa-theme="dark"] body.events-page #activityApprovalModal .activity-approval-summary span {
    color: #b9cbd0 !important;
}
html[data-osa-theme="dark"] body #addModal :is(
    .intake-reference-row, .intake-section h3, .intake-choice,
    .offense-level-display label, .last-offense-box,
    .policy-rule-suggestions, .policy-rule-suggestion
) {
    background: #253b43 !important;
    border-color: #45616a !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body #addModal :is(
    .intake-reference-row span, .intake-reference-row p,
    .intake-section h3, .intake-section h3 .intake-section-icon,
    .intake-offense-form label > span, .intake-choice-group > span,
    .offense-level-display > span, .last-offense-box p,
    .last-offense-box small
) {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body #addModal :is(
    .intake-reference-row strong, .last-offense-box strong
) {
    color: #85d5c8 !important;
}
html[data-osa-theme="dark"] body #addModal .intake-offense-form :is(
    input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    select, textarea
) {
    background: #13232c !important;
    border-color: #536a75 !important;
    color: #f2f7f8 !important;
    color-scheme: dark;
}
html[data-osa-theme="dark"] body #addModal .intake-offense-form :is(input, textarea)::placeholder {
    color: #a9bdc3 !important;
}
html[data-osa-theme="dark"] body #addModal .intake-offense-form :is(
    input:not([type="checkbox"]):not([type="radio"]), select, textarea
):disabled {
    background: #293a43 !important;
    color: #d6e4e7 !important;
    opacity: 1 !important;
}
html[data-osa-theme="dark"] body.events-page #eventModal :is(
    .activity-intake-reference-row, .activity-section-title
),
html[data-osa-theme="dark"] body.athlete-page #archivedAthleteViewModal :is(
    .athlete-archive-view-reference-row, .athlete-archive-view-grid p
) {
    background: #253b43 !important;
    border-color: #45616a !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.events-page #eventModal :is(
    .activity-intake-reference-row span, .activity-intake-reference-row p,
    .activity-section-title h3
),
html[data-osa-theme="dark"] body.athlete-page #archivedAthleteViewModal :is(
    .athlete-archive-view-reference-row span, .athlete-archive-view-reference-row p,
    .athlete-archive-view-grid strong, .athlete-archive-view-grid span
) {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.events-page #eventModal .activity-intake-reference-row > div:nth-child(2) strong {
    background: #30444f !important;
    color: #f2f7f8 !important;
}
html[data-osa-theme="dark"] body.events-page #eventModal .activity-organizer-fields :is(label, span),
html[data-osa-theme="dark"] body.events-page #eventModal .activity-collaboration-field > span,
html[data-osa-theme="dark"] body.events-page #eventModal .activity-collaboration-fields :is(label, span) {
    color: #edf5f6 !important;
}
html[data-osa-theme="dark"] body.events-page #eventModal #activityReferenceNote {
    color: #c8d8dc !important;
}
html[data-osa-theme="dark"] body.athlete-page #athleteModal label {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.athlete-page #athleteModal :is(input, select, textarea) {
    background: #13232c !important;
    border-color: #536a75 !important;
    color: #f2f7f8 !important;
    color-scheme: dark;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    #addModal .offense-intake-card,
    #addModal .offense-intake-header,
    #eventModal .activity-intake-header,
    #eventModal .activity-intake-reference-row,
    #archivedAthleteViewModal .athlete-archive-view-header,
    #archivedAthleteViewModal .athlete-archive-view-section,
    #archivedAthleteViewModal .athlete-archive-view-section h3
) {
    background: #22343e !important;
    border-color: #45616a !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    #addModal .offense-intake-header,
    #eventModal .activity-intake-header,
    #eventModal .activity-intake-reference-row,
    #archivedAthleteViewModal .athlete-archive-view-header,
    #archivedAthleteViewModal .athlete-archive-view-section
) :is(h2, h3, p, span, strong, label, dt, dd) {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    #addModal .intake-close,
    #archivedAthleteViewModal .athlete-archive-view-close
) {
    background: #30444f !important;
    border-color: #536a75 !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body :is(
    .modal, .calendar-modal, .report-modal, .send-notification-backdrop,
    .send-notification-modal, .notification-log-popup-backdrop,
    .notification-inbox-popup-backdrop, .notification-popup-backdrop
) :is(
    .modal-content, .calendar-modal-card, .report-modal-card,
    .send-notification-modal-card, .notification-log-popup-card,
    .notification-inbox-popup-card, .notification-popup-card
) {
    background: #1b2a33 !important;
    border-color: #536a75 !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body :is(.modal, .calendar-modal, .report-modal) :is(
    .modal-header, .modal-actions, .form-actions, .calendar-actions
) {
    background: #22343e !important;
    border-color: #40535e !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body :is(
    .modal, .calendar-modal, .report-modal, .send-notification-modal
) :is(.close, .close-btn, .close-modal, .close-report-modal) {
    background: #30444f !important;
    border-color: #536a75 !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body .send-notification-modal-card .student-list {
    background: #14232c !important;
    border-color: #405660 !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body .send-notification-modal-card .student-list > div {
    border-color: #405660 !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body .send-notification-modal-card .student-list .muted {
    color: #a9bac1 !important;
}
html[data-osa-theme="dark"] body .sms-inbox-button {
    background: #d9f5ee !important;
    border-color: #8dd6c6 !important;
    color: #075e56 !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.24) !important;
}
html[data-osa-theme="dark"] body .sms-inbox-button:is(:hover, .has-unseen) {
    background: #c4eee3 !important;
    border-color: #72c9b7 !important;
    color: #064c47 !important;
}
html[data-osa-theme="dark"] body .sms-inbox-button .sms-unread-number {
    background: #ffe08a !important;
    border-color: #1b2a33 !important;
    color: #26343a !important;
}
html[data-osa-theme="dark"] body.athlete-page .scholarship-grant-legend {
    color: #eaf2f4 !important;
}
html[data-osa-theme="dark"] body.policy-page #policyModal :is(
    .modal-header, .policy-form-actions
) {
    background: #22343e !important;
    border-color: #40535e !important;
}
html[data-osa-theme="dark"] body.policy-page #policyModal .policy-form-field :is(span, small),
html[data-osa-theme="dark"] body.policy-page #policyViewModal .policy-detail-list :is(span, strong, p) {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.policy-page #policyViewModal .policy-detail-list > div {
    background: #22343e !important;
    border-color: #40535e !important;
}
/* Eye-icon views: their page-specific white cards override the shared modal skin. */
html[data-osa-theme="dark"] body :is(
    #studentModal, #userViewModal, #policyViewModal,
    #dormantCaseModal, #archivedAthleteViewModal,
    #eventModal, #reportModal
) :is(.modal-content, .report-modal-card) {
    background: #1b2a33 !important;
    border-color: #45616a !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body #dormantCaseModal :is(
    .dormant-view-header, .dormant-view-section h3
),
html[data-osa-theme="dark"] body #archivedAthleteViewModal :is(
    .athlete-archive-view-header, .athlete-archive-view-section h3
) {
    background: #22343e !important;
    border-color: #45616a !important;
}
html[data-osa-theme="dark"] body #dormantCaseModal :is(
    .dormant-view-reference-row, .dormant-view-section,
    .dormant-view-grid > div, .dormant-view-note
),
html[data-osa-theme="dark"] body #archivedAthleteViewModal :is(
    .athlete-archive-view-reference-row, .athlete-archive-view-section,
    .athlete-archive-view-grid p
),
html[data-osa-theme="dark"] body #eventModal :is(
    .activity-form-section, .activity-section-title h3,
    .requirements-group label, .activity-request-attachment-panel
),
html[data-osa-theme="dark"] body #studentModal .section,
html[data-osa-theme="dark"] body #userViewModal .detail-list p {
    background: #253b43 !important;
    border-color: #45616a !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body #dormantCaseModal :is(
    .dormant-view-header h2, .dormant-view-brand p, .dormant-view-brand span,
    .dormant-view-reference-row span, .dormant-view-reference-row strong,
    .dormant-view-reference-row p, .dormant-view-section h3,
    .dormant-view-section > p, .dormant-view-grid span,
    .dormant-view-grid strong, .dormant-view-note
),
html[data-osa-theme="dark"] body #archivedAthleteViewModal :is(
    .athlete-archive-view-header h3, .athlete-archive-view-brand p,
    .athlete-archive-view-brand span, .athlete-archive-view-reference-row span,
    .athlete-archive-view-reference-row strong, .athlete-archive-view-reference-row p,
    .athlete-archive-view-section h3, .athlete-archive-view-section > p,
    .athlete-archive-view-grid strong, .athlete-archive-view-grid span
),
html[data-osa-theme="dark"] body #eventModal :is(
    .activity-section-title h3, .activity-section-title p,
    .requirements-group label
) {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body #dormantCaseModal .dormant-view-reference-row > div:nth-child(2) strong,
html[data-osa-theme="dark"] body #archivedAthleteViewModal .athlete-archive-view-reference-row > div:nth-child(2) strong {
    background: #30444f !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body #dormantCaseModal .dormant-view-close {
    background: #30444f !important;
    border-color: #536a75 !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body .athlete-media-dialog {
    background: #1b2a33 !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.athlete-record-page {
    background: #101a21 !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.athlete-record-page .athlete-record-content {
    background: #1b2a33 !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body .athlete-media-dialog .media-close {
    background: #30444f !important;
    border-color: #536a75 !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body .athlete-record-content :is(
    .athlete-record-brand p, .athlete-record-brand span, .athlete-record-brand h1, h2, dt, dd,
    .athlete-record-reference span, .athlete-record-reference strong,
    .athlete-record-reference p, .attachment-group h3, .attachment-group p
) {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body .athlete-record-content :is(
    .athlete-record-reference, .athlete-record-grid > div,
    .attachment-card, .attachment-preview
) {
    background: #253b43 !important;
    border-color: #45616a !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body .athlete-record-content .athlete-record-status {
    background: #30444f !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body .athlete-record-content .athlete-record-section > h2 {
    background: #22343e !important;
    border-color: #45616a !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body .athlete-record-content .athlete-record-section > h2 i {
    color: #69b7aa !important;
}
html[data-osa-theme="dark"] body #reportModalPreview {
    background: #13232c !important;
}
html[data-osa-theme="dark"] body #reportModalPreview .official-report-preview {
    background: #13232c !important;
}
html[data-osa-theme="dark"] body #reportModalPreview .official-report-preview__page {
    background: #1b2a33 !important;
    border-color: #45616a !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .25) !important;
}
html[data-osa-theme="dark"] body #reportModalPreview :is(
    .official-report-preview__letterhead, .official-report-preview__section h3,
    .official-report-preview__records h3, .official-report-preview__records th
) {
    background: #253b43 !important;
    border-color: #45616a !important;
}
html[data-osa-theme="dark"] body #reportModalPreview :is(
    .official-report-preview, .official-report-preview__letterhead strong,
    .official-report-preview__letterhead h2, .official-report-preview__section h3,
    .official-report-preview__records h3, .official-report-preview__records th,
    .official-report-preview__info-grid p, .official-report-preview__info-grid b,
    .official-report-preview__summary p, .official-report-preview__summary b,
    .official-report-preview__summary span, .official-report-preview__body,
    .official-report-preview__footer, .official-report-preview__records td
) {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body #reportModalPreview :is(
    .official-report-preview__info-grid p, .official-report-preview__summary p,
    .official-report-preview__body, .official-report-preview__records :is(th, td)
) {
    border-color: #45616a !important;
}
html[data-osa-theme="dark"] body .notification-log-popup-backdrop .notification-log-popup-card,
html[data-osa-theme="dark"] body .notification-log-popup-backdrop .sms-phone-preview {
    background: #1b2a33 !important;
    border-color: #45616a !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body .notification-log-popup-backdrop :is(
    h3, .sms-phone-header strong, .sms-phone-header span,
    .sms-phone-preview p, .notification-log-popup-body
) {
    color: #e8f1f2 !important;
}
/* The notification page's light-mode rules target the message body by ID,
   so give that preview an equally explicit dark-mode override. */
html[data-osa-theme="dark"] body .notification-log-popup-backdrop .notification-log-popup-card .sms-phone-preview,
html[data-osa-theme="dark"] body .notification-log-popup-backdrop .notification-log-popup-card #notificationLogPopupBody,
html[data-osa-theme="dark"] body .notification-log-popup-backdrop .notification-log-popup-card #notificationLogPopupTime {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body .notification-log-popup-backdrop .notification-log-popup-card .sms-phone-preview {
    background: #15232c !important;
    border-color: #45616a !important;
}
/* Edit actions: registration, activity, policy, user, and attachment editors. */
html[data-osa-theme="dark"] body :is(
    #athleteModal, #eventModal, #policyModal, #userModal, #addModal
) .modal-content,
html[data-osa-theme="dark"] body dialog.attachment-editor {
    background: #1b2a33 !important;
    border-color: #45616a !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body #athleteModal :is(
    .athlete-intake-header, .athlete-form-section h4
) {
    background: #22343e !important;
    border-color: #45616a !important;
}
html[data-osa-theme="dark"] body #athleteModal :is(
    .athlete-intake-reference-row, .athlete-form-section,
    .athlete-photo-upload, .athlete-photo-preview-frame,
    .athlete-requirement-grid label
),
html[data-osa-theme="dark"] body #eventModal :is(
    .activity-choice-control, .attachment-card, .attachment-editor
),
html[data-osa-theme="dark"] body #userModal .user-form-section {
    background: #253b43 !important;
    border-color: #45616a !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body #athleteModal :is(
    .athlete-intake-header p, .athlete-intake-header span,
    .athlete-intake-header h2, .athlete-intake-reference-row span,
    .athlete-intake-reference-row strong, .athlete-intake-reference-row p,
    .athlete-form-section h4, .athlete-photo-upload,
    .athlete-photo-preview-frame, .athlete-photo-picker,
    .athlete-requirement-grid label
),
html[data-osa-theme="dark"] body #userModal :is(
    .user-form-section h4, .form-field span, .password-note
),
html[data-osa-theme="dark"] body dialog.attachment-editor :is(h3, label, p) {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body #athleteModal .athlete-intake-reference-row > div:nth-child(2) strong {
    background: #30444f !important;
    color: #e8f1f2 !important;
}
/* Darken every saved/queued attachment tile across activity, athlete, and public forms. */
html[data-osa-theme="dark"] body :is(
    .attachment-cards > .attachment-card, .attachment-queue .attachment-card,
    .attachment-preview, .athlete-upload, .attachment-editor
) {
    background: #101a21 !important;
    border-color: #45616a !important;
    color: #f2f7f8 !important;
}
html[data-osa-theme="dark"] body :is(
    .saved-attachment-heading strong, .saved-attachment-heading small,
    .attachment-card > small, .attachment-group > h3, .attachment-group > p,
    .athlete-upload label, .attachment-help
) {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body .saved-attachment-heading small {
    background: #263e46 !important;
}
html[data-osa-theme="dark"] body .attachment-card .attachment-actions {
    border-color: #45616a !important;
}
/* The following popups have separate light-only shells or inset cards. */
html[data-osa-theme="dark"] body #calendarModal .calendar-modal-card,
html[data-osa-theme="dark"] body #temporaryAccessModal .temporary-access-modal-content,
html[data-osa-theme="dark"] body #userViewModal .detail-list,
html[data-osa-theme="dark"] body #generateReportModal .generate-report-card,
html[data-osa-theme="dark"] body .notification-inbox-popup-backdrop .notification-inbox-popup-card {
    background: #1b2a33 !important;
    border-color: #45616a !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body #calendarModal :is(
    .generated-year, .semester-panel, .calendar-actions
),
html[data-osa-theme="dark"] body #temporaryAccessModal :is(
    .user-form-section, .temporary-module-option, .modal-header
),
html[data-osa-theme="dark"] body #userViewModal :is(
    .detail-list p, .modal-header, .modal-actions
),
html[data-osa-theme="dark"] body #generateReportModal :is(
    .generate-report-card > header, .report-modal-actions
),
html[data-osa-theme="dark"] body .notification-inbox-popup-backdrop :is(
    .notification-inbox-popup-header, .notification-delete-toolbar,
    .automatic-sms-log, .automatic-sms-log-header, .automatic-sms-list,
    .automatic-sms-item
) {
    background: #253b43 !important;
    border-color: #45616a !important;
    color: #e8f1f2 !important;
}

/* Preserve the shared no-divider treatment for action columns after the
   dark table palette applies its border colors. */
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) table tbody td:is(
    .actions-cell, .action-cell, .user-actions-cell
),
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) table tbody td:has(> :is(
    .action-row, .action-group, .user-action-stack, .report-actions
)) {
    border-bottom-color: transparent !important;
}
html[data-osa-theme="dark"] body #calendarModal :is(
    h2, h3, p, label, .generated-year, .generated-year span
),
html[data-osa-theme="dark"] body #temporaryAccessModal :is(
    h3, h4, p, label, .temporary-module-option span, .password-note
),
html[data-osa-theme="dark"] body #userViewModal :is(
    h3, .detail-list p, .detail-list b, .detail-list span
),
html[data-osa-theme="dark"] body .notification-inbox-popup-backdrop :is(
    h3, label, .automatic-sms-log-header span, .automatic-sms-item p,
    .automatic-sms-item strong, .automatic-sms-meta small
) {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body .notification-inbox-popup-backdrop .sms-log-header-actions > span {
    color: #07503f !important;
}
html[data-osa-theme="dark"] body #calendarModal .generated-year {
    border-left-color: #55b3a5 !important;
}
html[data-osa-theme="dark"] body .notification-inbox-popup-backdrop .automatic-sms-item {
    background: #1b2a33 !important;
}
html[data-osa-theme="dark"] body .notification-inbox-popup-backdrop .automatic-sms-meta .status-badge:not(.status-sent):not(.status-saved) {
    background: #30444f !important;
    color: #e8f1f2 !important;
}
/* The offense view's completed-case summary and attachment row. */
html[data-osa-theme="dark"] body #addModal :is(
    .resolved-case-summary, .resolved-attachment-value
) {
    background: #101a21 !important;
    border-color: #45616a !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body #addModal :is(
    .resolved-case-summary span, .resolved-case-summary strong,
    .resolved-case-summary small, .resolved-attachment-field > span,
    .resolved-attachment-value small
) {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body #addModal :is(
    .resolved-case-summary a, .resolved-attachment-value a,
    .resolved-attachment-value i
) {
    color: #85d5c8 !important;
}
html[data-osa-theme="dark"] body #reportModalPreview .official-report-preview__summary b {
    background: #30444f !important;
    border-color: #45616a !important;
    color: #f2f7f8 !important;
}
html[data-osa-theme="dark"] body dialog.attachment-editor :is(input, select, textarea) {
    background: #13232c !important;
    border-color: #536a75 !important;
    color: #f2f7f8 !important;
    color-scheme: dark;
}

/* Keep standalone athlete record X controls visible on hover/focus too. */
html[data-osa-theme="dark"] body :is(
    .athlete-record-page .athlete-record-close,
    .athlete-media-dialog .media-close
):is(:hover, :focus-visible) {
    background: #3d5662 !important;
    border-color: #6a8792 !important;
    box-shadow: 0 0 0 3px rgba(105, 183, 170, .2) !important;
    color: #f2f7f8 !important;
    outline: none !important;
}
html[data-osa-theme="dark"] body dialog.attachment-editor .attachment-editor-header button {
    background: #30444f !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    .action-btn.icon-action.view, .action-btn.icon-action.edit,
    .icon-action.view-action, .icon-action.edit-action,
    .policy-table .action-btn.view, .user-action-stack .action-btn.view
) {
    background: #2c414c !important;
    border-color: #526873 !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    .action-btn.icon-action.view, .action-btn.icon-action.edit,
    .icon-action.view-action, .icon-action.edit-action,
    .policy-table .action-btn.view, .user-action-stack .action-btn.view
) i { color: inherit !important; }
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    .action-btn.icon-action.view, .action-btn.icon-action.edit,
    .icon-action.view-action, .icon-action.edit-action,
    .policy-table .action-btn.view, .user-action-stack .action-btn.view
):hover {
    background: #3d5662 !important;
    border-color: #6a8792 !important;
    color: #fff !important;
}

/* Shared confirmation and result dialogs use their own white-card contract. */
html[data-osa-theme="dark"] body :is(#appConfirmOverlay, #appFeedbackOverlay) {
    background: rgba(2, 10, 14, .76) !important;
}
html[data-osa-theme="dark"] body #appConfirmOverlay .confirm-popup-card,
html[data-osa-theme="dark"] body #appFeedbackOverlay .feedback-popup-card {
    background: #1b2a33 !important;
    border-color: #536a75 !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body #appConfirmOverlay .confirm-popup-card :is(h3, p),
html[data-osa-theme="dark"] body #appFeedbackOverlay .feedback-popup-card :is(h3, p) {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body :is(#appConfirmOverlay, #appFeedbackOverlay) :is(.confirm-popup-close, .feedback-popup-close, .confirm-popup-cancel) {
    background: #30444f !important;
    border-color: #536a75 !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body :is(#appConfirmOverlay, #appFeedbackOverlay) :is(.confirm-popup-close, .feedback-popup-close, .confirm-popup-cancel):hover {
    background: #3d5662 !important;
}

/* Keep popup cards and their text on the same palette. The shared popup
   stylesheet gives cards a white background, while the general dark rule
   makes paragraph text light; both must be overridden together. */
html[data-osa-theme="dark"] body :is(
    #appConfirmOverlay, #appFeedbackOverlay, .modal, .calendar-modal,
    .report-modal, .send-notification-backdrop, .send-notification-modal,
    .notification-log-popup-backdrop, .notification-inbox-popup-backdrop,
    .notification-popup-backdrop
) :is(
    .modal-content, .calendar-modal-card, .report-modal-card,
    .confirm-popup-card, .feedback-popup-card, .send-notification-modal-card,
    .notification-log-popup-card, .notification-inbox-popup-card,
    .notification-popup-card
) {
    background: #1b2a33 !important;
    border-color: #536a75 !important;
    color: #e8f1f2 !important;
}

/* Status notices need a matching background/text pair, not the global
   light paragraph color on a pale light-mode background. */
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    .account-settings-messages p, .notification-messages p,
    .notification-popup-messages p, .message-list .message
) {
    background: #1b3b4a !important;
    border-color: #4b91ae !important;
    color: #def3fc !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    .account-settings-messages p.success, .notification-messages p.success,
    .notification-popup-messages p.success, .message-list .message.success
) {
    background: #173b32 !important;
    border-color: #3b9d70 !important;
    color: #d7f9e7 !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    .account-settings-messages p.error, .notification-messages p.error,
    .notification-popup-messages p.error, .message-list .message.error
) {
    background: #472828 !important;
    border-color: #c66b6b !important;
    color: #ffe1e1 !important;
}
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) :is(
    .account-settings-messages p.warning, .notification-messages p.warning,
    .notification-popup-messages p.warning, .message-list .message.warning
) {
    background: #4b3c22 !important;
    border-color: #c49a48 !important;
    color: #ffedbd !important;
}

/* The sign-in screen uses the same browser preference and exposes its own switch. */
.login-form-panel > :is(.osa-login-theme-toggle, .login-install-toggle) {
    align-items: center;
    background: #e7f2f0 !important;
    border: 1px solid #b8d4cf !important;
    border-radius: 999px;
    color: #145b54 !important;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    height: 40px;
    justify-content: center;
    min-height: 40px;
    padding: 0;
    position: absolute;
    right: 16px;
    top: 12px;
    width: 40px !important;
    z-index: 4;
}
.login-form-panel > .login-install-toggle {
    right: 64px;
}
.login-form-panel > :is(.osa-login-theme-toggle, .login-install-toggle):focus-visible {
    outline: 2px solid #247e73;
    outline-offset: 2px;
}
html[data-osa-theme="dark"] body.login-page {
    background: #101a21 !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.login-page :is(.login-shell, .login-form-panel) {
    background: #1b2a33 !important;
    border-color: #40535e !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.login-page :is(h1, h2, h3, p, label, .login-subtitle, .login-button-description) {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.login-page .login-messages p.error {
    background: #4b2329 !important;
    border-left-color: #f87171 !important;
    color: #fff4f2 !important;
}
html[data-osa-theme="dark"] body.login-page :is(input, select, textarea) {
    background: #13232c !important;
    border-color: #536a75 !important;
    color: #f2f7f8 !important;
    color-scheme: dark;
}
html[data-osa-theme="dark"] body.login-page :is(input, textarea)::placeholder {
    color: #a9bdc3 !important;
}
html[data-osa-theme="dark"] body.login-page .login-form-panel > :is(.osa-login-theme-toggle, .login-install-toggle) {
    background: #2c414c !important;
    border-color: #526873 !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.login-page.login-home .login-form-panel > :is(
    .osa-login-theme-toggle, .login-install-toggle
):is(:hover, :focus-visible) {
    background: #405963 !important;
    border-color: #7aa39f !important;
    color: #ffffff !important;
}
html[data-osa-theme="dark"] body.login-page.login-home .login-form-panel > :is(
    .osa-login-theme-toggle, .login-install-toggle
) > i {
    color: inherit !important;
    opacity: 1 !important;
}
html[data-osa-theme="dark"] body.login-page :is(.student-forms-login-btn, .login-install-link, .login-entry-actions a) {
    color: #a5e5dc !important;
}

/* Public student submissions use the same stored theme but not the app shell. */
html[data-osa-theme="dark"] .sport-submission-dialog { background:#1b2a33;color:#e8f1f2;border-color:#45616a; }
html[data-osa-theme="dark"] .sport-submission-dialog p { color:#d1e3e6; }
html[data-osa-theme="dark"] .sport-submission-dialog .sport-submission-close { color:#d1e3e6; }
html[data-osa-theme="dark"] body.student-forms-page .public-add-sport-dialog {
    background: #1b2a33 !important;
    border-color: #45616a !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.student-forms-page .public-add-sport-dialog-header h2,
html[data-osa-theme="dark"] body.student-forms-page .public-add-sport-dialog form > label {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.student-forms-page .public-add-sport-dialog > p {
    color: #aec2c8 !important;
}
html[data-osa-theme="dark"] body.student-forms-page .public-add-sport-dialog :is(input, .public-add-sport-close) {
    background: #14242d !important;
    border-color: #526873 !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.student-forms-page .public-add-sport-dialog .public-add-sport-cancel {
    background: #2c414c !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.student-forms-page .student-form-card,
html[data-osa-theme="dark"] body.student-forms-page :is(.form-choice-grid a, .public-entry-form fieldset, .check-grid label, .public-activity-requirement-attachments, .athlete-photo-upload, .public-photo-lightbox) {
    background: #1b2a33 !important;
    border-color: #45616a !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.student-forms-page .activity-collaboration-row,
html[data-osa-theme="dark"] body.events-page #eventModal .activity-collaboration-row {
    background: #263c44 !important;
    border-color: #45616a !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.student-forms-page :is(
    .activity-collaboration-field > strong,
    .activity-collaboration-fields label,
    .activity-collaboration-fields label span
),
html[data-osa-theme="dark"] body.events-page #eventModal :is(
    .activity-collaboration-field > span,
    .activity-collaboration-fields label,
    .activity-collaboration-fields label span
) {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.student-forms-page .activity-collaboration-remove,
html[data-osa-theme="dark"] body.events-page #eventModal .activity-collaboration-remove {
    background: #4a3034 !important;
    color: #ffd8dc !important;
}
html[data-osa-theme="dark"] body.student-forms-page :is(
    .form-title p, .form-picker > p, .submission-complete p,
    .form-choice-grid span, .form-choice-grid strong,
    .public-activity-requirement-attachments h4,
    .public-activity-requirement-attachments > p,
    .public-form-grid small, .public-athlete-photo-picker small
) {
    color: #d1e3e6 !important;
}
html[data-osa-theme="dark"] body.student-forms-page :is(
    .public-form-error, .student-form-messages .error
) {
    background: #4a262b !important;
    border: 1px solid #bb6971 !important;
    color: #ffe6e8 !important;
}
html[data-osa-theme="dark"] body.student-forms-page :is(
    .public-form-section > legend, .submission-reminder,
    .public-photo-preview-frame, .student-form-close,
    .student-form-actions a, .secondary-link
) {
    background: #263c44 !important;
    border-color: #45616a !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.student-forms-page :is(
    .public-form-grid input, .public-form-grid select,
    .public-form-grid textarea, .welcome-id-form input
) {
    background: #13232c !important;
    border-color: #536a75 !important;
    color: #f2f7f8 !important;
}
html[data-osa-theme="dark"] body.student-forms-page .student-form-card :is(.athlete-upload, .attachment-queue .attachment-card, .attachment-preview),
html[data-osa-theme="dark"] body.athlete-page .attachment-cards > .attachment-card,
html[data-osa-theme="dark"] body.athlete-page .attachment-cards > .attachment-card .attachment-preview {
    background: #101a21 !important;
    border-color: #45616a !important;
    color: #f2f7f8 !important;
}
html[data-osa-theme="dark"] body.athlete-record-page .athlete-record-content .attachment-cards > .attachment-card,
html[data-osa-theme="dark"] body.athlete-record-page .athlete-record-content .attachment-cards > .attachment-card .attachment-preview {
    background: #101a21 !important;
    border-color: #45616a !important;
    color: #f2f7f8 !important;
}
html[data-osa-theme="dark"] body :is(.attachment-cards, .attachment-queue) .attachment-actions .mini-btn {
    background: #2c414c !important;
    border-color: #536a75 !important;
    color: #e8f1f2 !important;
}
/* Archive eyes reuse the active forms in a read-only state. */
html body.athlete-page #athleteModal.athlete-read-only :is(
    .athlete-photo-picker, .athlete-add-sport, .athlete-upload,
    .attachment-edit, #athleteSaveBtn, .athlete-identity-note
),
html body.events-page #eventModal.activity-read-only :is(
    .athlete-upload, .attachment-edit
) {
    display: none !important;
}
html[data-osa-theme="dark"] body :is(
    #athleteModal.athlete-read-only, #eventModal.activity-read-only
) :is(input:disabled, select:disabled, textarea:disabled) {
    opacity: 1 !important;
    background: #13232c !important;
    border-color: #536a75 !important;
    color: #f2f7f8 !important;
}

/* Standalone add form and role-specific action dialogs. */
html[data-osa-theme="dark"] body.athlete-page #passedStudentDialog,
html[data-osa-theme="dark"] body.athlete-page #addSportModal .modal-content,
html[data-osa-theme="dark"] body.events-page #activityPostModal .activity-post-modal,
html[data-osa-theme="dark"] body.events-page #activityApprovalModal .activity-approval-modal {
    background: #1b2a33 !important;
    border-color: #45616a !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.athlete-page #passedStudentDialog :is(
    h2, p, label, .tryout-entry
),
html[data-osa-theme="dark"] body.athlete-page #addSportModal :is(
    h3, p, label
),
html[data-osa-theme="dark"] body.events-page #activityPostModal :is(
    h2, h3, p, label, .activity-approval-summary span,
    .activity-approval-summary strong
) {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.athlete-page #passedStudentDialog :is(input, select),
html[data-osa-theme="dark"] body.athlete-page #addSportModal input {
    background: #13232c !important;
    border-color: #536a75 !important;
    color: #f2f7f8 !important;
    color-scheme: dark;
}
html[data-osa-theme="dark"] body.athlete-page #passedStudentDialog :is(
    .tryout-close, .tryout-cancel
),
html[data-osa-theme="dark"] body.athlete-page #addSportModal .modal-actions .mini-btn {
    background: #30444f !important;
    border-color: #536a75 !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.events-page #activityPostModal :is(
    .activity-form-section, .requirements-group label,
    .activity-approval-summary > div, .activity-section-title,
    .activity-post-check-detail
) {
    background: #253b43 !important;
    border-color: #45616a !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.events-page #activityPostModal .activity-approval-summary span {
    color: #b9cbd0 !important;
}
html[data-osa-theme="dark"] body.events-page #activityPostModal .activity-post-complete-form {
    background: #253b43 !important;
    border-color: #45616a !important;
    color: #f2f7f8 !important;
}
html[data-osa-theme="dark"] body.events-page #activityPostModal .activity-post-review-confirm,
html[data-osa-theme="dark"] body.events-page #activityPostModal .activity-post-review-confirm span {
    color: #f2f7f8 !important;
}
html[data-osa-theme="dark"] body.events-page #activityPostModal .activity-post-review-confirm input {
    accent-color: #59b7a5;
}
html[data-osa-theme="dark"] body.events-page #activityPostModal .activity-post-review-hint {
    color: #b9cbd0 !important;
}
html[data-osa-theme="dark"] body.events-page #activityPostModal .activity-post-complete-btn:disabled {
    background: #354b55 !important;
    border-color: #536a75 !important;
    color: #c3d0d4 !important;
    opacity: 1 !important;
}
html[data-osa-theme="dark"] body.events-page .activity-post-requirement-cards.saved-requirement-cards > .attachment-card {
    background: #253b43 !important;
    border-color: #45616a !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.events-page .activity-post-requirement-cards .saved-attachment-heading :is(strong, small),
html[data-osa-theme="dark"] body.events-page .activity-post-requirement-cards .event-attachment-filename {
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.events-page .activity-post-requirement-cards .attachment-kind {
    background: #29444d !important;
    color: #b7d8d1 !important;
}
html[data-osa-theme="dark"] body.events-page .activity-post-requirement-cards .attachment-actions .mini-btn {
    background: #304852 !important;
    border-color: #536a75 !important;
    color: #e8f1f2 !important;
}
html[data-osa-theme="dark"] body.events-page .activity-post-requirement-cards .attachment-document-preview {
    background: #13232c !important;
    border-color: #45616a !important;
}
html[data-osa-theme="dark"] body.events-page .activity-post-requirement-cards .attachment-document-zoom {
    background: #304852 !important;
    border-color: #6b8791 !important;
    color: #f2f7f8 !important;
}
/* Keep the student entry and shared report/SMS dialogs fully dark. */
html[data-osa-theme="dark"] body.student-forms-page .welcome-dialog {
    background: #1b2a33 !important;
    color: #e8f1f2 !important;
    border: 1px solid #45616a !important;
}
html[data-osa-theme="dark"] body.student-forms-page .welcome-dialog :is(h2, .welcome-id-form label) {
    color: #f2f7f8 !important;
}
html[data-osa-theme="dark"] body.student-forms-page .welcome-dialog .welcome-close {
    background: #30444f !important;
    border-color: #536a75 !important;
    color: #f2f7f8 !important;
}
html[data-osa-theme="dark"] body #generateReportModal .generate-report-card,
html[data-osa-theme="dark"] body #generateReportModal .generate-report-form,
html[data-osa-theme="dark"] body #generateReportModal .generate-report-actions {
    background: #1b2a33 !important;
    border-color: #45616a !important;
}
html[data-osa-theme="dark"] body #generateReportModal :is(.generate-report-header h3, label) {
    color: #f2f7f8 !important;
}
html[data-osa-theme="dark"] body #generateReportModal .generate-report-header p {
    color: #bfd0d6 !important;
}
html[data-osa-theme="dark"] body #generateReportModal select {
    background: #13232c !important;
    border-color: #536a75 !important;
    color: #f2f7f8 !important;
    color-scheme: dark;
}
html[data-osa-theme="dark"] body.notification-page .notification-inbox-popup-card,
html[data-osa-theme="dark"] body.notification-page .notification-inbox-popup-card > form,
html[data-osa-theme="dark"] body.notification-page .notification-inbox-popup-card :is(
    .notification-delete-toolbar, .notification-log-grid, .sport-sms-list,
    .automatic-sms-log, .automatic-sms-list
) {
    background: #1b2a33 !important;
    border-color: #45616a !important;
}
html[data-osa-theme="dark"] body.notification-page .notification-inbox-popup-card .automatic-sms-item {
    background: #253b43 !important;
    border-color: #45616a !important;
}
html[data-osa-theme="dark"] body.notification-page .notification-inbox-popup-card :is(
    .notification-log-popup-close, .automatic-sms-meta .log-view-icon
) {
    background: #30444f !important;
    border-color: #536a75 !important;
    color: #f2f7f8 !important;
}
html[data-osa-theme="dark"] body.notification-page .notification-inbox-popup-card :is(
    .notification-inbox-popup-header h3, .automatic-sms-log-header h3,
    .notification-delete-toolbar label
) {
    color: #f2f7f8 !important;
}
html[data-osa-theme="dark"] body #calendarModal :is(
    select, input[type="date"]
),
html[data-osa-theme="dark"] body #temporaryAccessModal :is(
    select, input:not([type="checkbox"]), textarea
) {
    background: #13232c !important;
    border-color: #536a75 !important;
    color: #f2f7f8 !important;
    color-scheme: dark;
}

/* Keep every Actions column divider-free after all dark table overrides. */
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) table tbody tr > td:is(
    .actions-cell, .action-cell, .user-actions-cell
),
html[data-osa-theme="dark"] body:not(.login-page):not(.signup-page) table:has(
    tbody tr > td:last-child :is(a, button, form)
) tbody tr > td:last-child {
    border-top: 0 !important;
    border-bottom: 0 !important;
}
