/* The theme control appears in every public and authenticated header. */
.theme-header-actions { display: inline-flex; flex: 0 0 auto; align-items: center; gap: .65rem; }
.theme-toggle { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; padding: 0; border: 1px solid #cbd5e3; border-radius: 50%; background: #fff; color: #283c5b; cursor: pointer; }
.theme-toggle:hover { background: #edf3ff; border-color: #8fabed; color: #0044d5; }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-icon-sun, [data-theme="dark"] .theme-icon-moon { display: none; }
[data-theme="dark"] .theme-icon-sun { display: block; }
.header-nav .theme-toggle { margin-left: -12px; }
@media (max-width: 480px) { .theme-header-actions { gap: .35rem; } .student-mobile-header { gap: .4rem; } .header-nav .theme-toggle { margin-left: 0; } .brand > span > span, .ui-public-brand > span > span { display: none; } }
@media print { .theme-toggle { display: none !important; } }

/* The attendance card is deliberately dark in both themes. */
.ui-app .attendance-card :is(.attendance-consent, .attendance-consent label, .attendance-date, .attendance-prompt, .attendance-clock small, .active-session-meta span) { color: #d4dfed; }
.ui-app .attendance-card .clockout-form textarea,
.ui-app .attendance-card .clockout-form textarea:focus { background: #fff; color: #17243b; border-color: #aab8cd; }
.ui-app .attendance-card .clockout-form textarea::placeholder { color: #536178; }

[data-theme="dark"] {
    color-scheme: dark;
    --ui-ink: #edf3fc;
    --ui-muted: #b5c2d5;
    --ui-line: #3b4b62;
    --ui-canvas: #101925;
    --portal-background: #101925;
    --portal-foreground: #edf3fc;
    --portal-muted: #263548;
    --portal-muted-foreground: #b5c2d5;
    --portal-border: #3b4b62;
    --portal-card: #1b2939;
    --portal-accent: #a7c8ff;
    --portal-accent-secondary: #70a2f7;
    --portal-shadow-soft: 0 3px 12px rgba(0, 0, 0, .16);
    --bs-body-color: #edf3fc;
    --bs-body-bg: #101925;
    --bs-secondary-color: #b5c2d5;
    --bs-border-color: #3b4b62;
    --bs-link-color: #a7c8ff;
    --bs-link-hover-color: #cfdeff;
}
[data-theme="dark"] .theme-toggle { background: #263548; color: #edf3fc; border-color: #53647b; }
[data-theme="dark"] .theme-toggle:hover { background: #354a65; color: #fff; }
[data-theme="dark"] .ui-app { color: var(--ui-ink); background: var(--ui-canvas) !important; }
[data-theme="dark"] body.ui-app:not(.student-portal-body) > :is(header, footer) { background: #1b2939 !important; border-color: var(--ui-line) !important; }
[data-theme="dark"] .ui-app :is(.student-sidebar, .student-mobile-header) { background: #192737; border-color: var(--ui-line); }
[data-theme="dark"] .ui-app :is(.student-brand, .student-brand:hover, .ui-public-brand, .student-profile-copy strong) { color: var(--ui-ink); }
[data-theme="dark"] .ui-app :is(.student-nav-link:hover, .student-nav-sublink:hover, .student-nav-group > summary.is-active, .student-nav-link.is-active, .student-nav-sublink.is-active) { background: #2a3d56; color: #d9e8ff; }
[data-theme="dark"] .ui-app :is(.student-brand-mark, .placement-card-icon:not(.fic-card-icon):not(.is-muted)) { background: #0052d8; color: #fff; }
[data-theme="dark"] .ui-app :is(.student-avatar, .assigned-avatar) { background: #304b6c; color: #e1edff; }
[data-theme="dark"] .ui-app .progress-ring::before { background: #1b2939; }
[data-theme="dark"] .ui-app .student-icon-button { color: var(--ui-ink); background: #263548; border-color: #53647b; }
[data-theme="dark"] .ui-app .student-icon-button:hover { color: #fff; background: #354a65; }

/* Main surfaces, including cards with hard-coded light gradients. */
[data-theme="dark"] .ui-app :is(.card, .student-main .card, .student-content-section, .student-status-card, .fic-status-card, .portal-metric-card, .fic-dashboard-card, .fic-dashboard-card.is-hosts, .fic-secondary-action, .student-roster-filter, .assigned-student-card, .assigned-student-card.is-active, .assigned-student-card.has-alert, .placement-host-card, .student-profile-hero, .profile-hours-card, .profile-assignment-card, .profile-assignment-card.is-fic, .task-summary-grid button, .task-filter-bar, .student-task-card, .task-create-panel, .task-management-card, .review-count-grid a, .workflow-summary-grid a, .workflow-request-card, .workflow-request-card.is-host-change, .workflow-history-panel, .workflow-tool-panel, .review-action-section, .portal-filter-bar, .portal-request-disclosure, .tool-page-form, .account-create-section, .evaluation-cycle-create, .evaluation-cycle-card, .evaluation-exception-panel, .evaluation-student-list, .host-overview-card, .host-fic-card, .host-metric-grid article, .host-metric-grid > a, .host-student-card, .evaluation-response-card, .account-search-bar, .account-table-wrap, .account-edit-summary, .account-danger-zone) {
    background: #1b2939; color: var(--ui-ink); border-color: var(--ui-line);
}
[data-theme="dark"] .ui-app :is(.fic-dashboard-card.is-hosts, .profile-hours-card, .profile-assignment-card.is-fic, .host-metric-grid .is-live, .host-student-card.is-active) { background: #1b342f; border-color: #416b59; }
[data-theme="dark"] .ui-app :is(.host-metric-grid .has-attention, .placement-count-card, .placement-subtle-alert) { background: #3a3020; border-color: #80643c; color: #f7deb0; }
[data-theme="dark"] .ui-app .placement-subtle-alert.is-clear { background: #1b342f; border-color: #416b59; color: #d4f5df; }
[data-theme="dark"] .ui-app :is(.account-context-banner > div, .account-rule-note, .account-locked-scope, .student-task-card[open] > summary, .task-create-panel > summary, .task-management-head, .task-instruction-block, .task-submission-summary, .task-student-picker .form-check, .workflow-jump-nav, .workflow-jump-nav a:hover, .workflow-history-panel[open] > summary, .workflow-tool-panel[open] > summary, .review-action-card, .portal-scope-grid > div, .student-profile-view .placement-detail-grid > div, .student-profile-view .active-session-meta div, .host-detail-grid > div, .evaluation-overview-grid article, .evaluation-cycle-form, .evaluation-progress-grid > div, .host-fic-list article, .evaluation-rating-criterion label > span) { background: #263548; border-color: #465872; color: var(--ui-ink); }
[data-theme="dark"] .ui-app :is(.home-action-item, .home-attendance-day, .home-attendance-day.is-refuted, .home-attendance-issue, .temporary-password-result) { background: #263548; border-color: #465872; color: var(--ui-ink); }
[data-theme="dark"] .ui-app :is(.home-action-item > b, .home-clear-state strong, .temporary-password-result h2, .temporary-password-result p) { color: var(--ui-ink); }
[data-theme="dark"] .ui-app .home-attendance-day small { color: #a9e7bf; }
[data-theme="dark"] .ui-app .home-attendance-day.is-refuted small { color: #ffb6b6; }
[data-theme="dark"] .ui-app .evaluation-state { color: #f7deb0; }
[data-theme="dark"] .ui-app .evaluation-state.is-submitted { color: #a9e7bf; }
[data-theme="dark"] .ui-app .evaluation-state.is-missing { color: #ffb6b6; }
[data-theme="dark"] .ui-app .evaluation-exception-panel { border-color: #7585a0; }
[data-theme="dark"] .ui-app :is(.evaluation-exception-list, .evaluation-exception-row) { border-color: #465872; }
[data-theme="dark"] .ui-app .evaluation-exception-row > div span,
[data-theme="dark"] .ui-app .evaluation-exception-row p { color: #d6e3f5; }
[data-theme="dark"] .ui-app .evaluation-program-group > summary > span:last-child { color: #d6e3f5; }
[data-theme="dark"] .ui-app .evaluation-student-row > a:hover strong { color: #c9ddff; }
[data-theme="dark"] .ui-app :is(.task-summary-grid button[aria-pressed="true"], .evaluation-rating-criterion input:checked + span) { background: #244d7e; border-color: #78aefa; color: #fff; }
[data-theme="dark"] .ui-app .evaluation-rating-criterion input:checked + span b { color: #fff; }
[data-theme="dark"] .ui-app :is(.student-nav-submenu, .portal-record-row, .portal-review-row, .student-task-card[open] > summary, .workflow-decision-controls, .host-student-list > a, .evaluation-submit-row) { border-color: #465872; }

/* Explicit text colors on the application's information cards. */
[data-theme="dark"] .ui-app :is(.fic-contact-list strong, .student-status-list dd, .student-privacy-note strong, .student-profile-hero > div:last-child > p, .profile-hours-card h2, .profile-hours-card h2 small, .profile-hours-card p, .profile-hours-card > div:first-child > span, .student-profile-view .placement-detail-grid dt, .student-profile-view .placement-detail-grid dd, .student-profile-view .active-session-meta span, .student-profile-view .active-session-meta strong, .student-profile-view .section-heading-row h2, .student-profile-view .section-heading-row p, .student-profile-view table th, .student-profile-view table td, .profile-assignment-card h2, .profile-assignment-card dt, .profile-assignment-card dd, .task-instruction-block p, .task-create-panel > summary small, .task-assign-all strong, .task-student-picker legend, .task-student-picker .form-check span, .task-student-picker .form-check small, .task-management-head p, .task-management-head > small, .review-count-grid span, .workflow-jump-nav a, .workflow-request-copy > p, .workflow-request-copy dd, .review-action-card h3, .review-action-card p, .review-action-card blockquote, .review-type-label, .student-main .form-label, .host-overview-copy h2, .host-overview-copy > span, .host-overview-copy dt, .host-overview-copy dd, .host-placement-list dt, .host-placement-list dd, .host-fic-list strong, .host-fic-list small, .host-metric-grid span, .host-metric-grid strong, .host-metric-grid small, .host-student-card > div > span, .host-student-card strong, .host-student-card small, .host-placement-list article > div strong, .host-placement-list article > div span, .evaluation-response-head h2, .evaluation-rating-criterion legend, .evaluation-rating-criterion label b, .evaluation-rating-criterion label small, .evaluation-written-fields label, .evaluation-submit-row p, .account-results-heading, .account-results-heading strong, .account-identity-cell strong, .account-identity-cell a, .account-scope-cell strong, .account-identity-cell span, .account-scope-cell span, .account-edit-summary h2, .account-edit-summary span, .account-edit-summary p, .account-action-help) { color: var(--ui-ink); }
[data-theme="dark"] .ui-app :is(.placement-count-card span, .placement-count-card strong, .placement-count-card small, .placement-subtle-alert strong, .placement-subtle-alert p, .placement-subtle-alert a, .host-metric-grid .has-attention strong) { color: #f7deb0; }
[data-theme="dark"] .ui-app :is(.placement-subtle-alert.is-clear strong, .placement-subtle-alert.is-clear p, .host-metric-grid .is-live strong) { color: #bcebd1; }

/* Inputs, tables and top-layer popovers. */
[data-theme="dark"] .ui-app :is(.form-control, .form-select, .student-main .form-control, .student-main .form-select) { color: #f2f6fc; background-color: #111e2d; border-color: #65768c; }
[data-theme="dark"] .ui-app :is(.form-control, .form-select):disabled { color: #c2cbd7; background-color: #283546; }
[data-theme="dark"] .ui-app .form-control::placeholder { color: #b7c4d6; opacity: 1; }
[data-theme="dark"] .ui-app .attendance-card .clockout-form textarea { background: #111e2d; color: #f2f6fc; border-color: #65768c; }
[data-theme="dark"] .ui-app .attendance-card .clockout-form textarea::placeholder { color: #b7c4d6; }
[data-theme="dark"] .ui-app :is(.portal-secondary-button, .btn-outline-success, .btn-outline-primary, .btn-outline-secondary) { color: #e7f0ff; background: #263548; border-color: #65768c; }
[data-theme="dark"] .ui-app :is(.portal-secondary-button, .btn-outline-success, .btn-outline-primary, .btn-outline-secondary):hover { color: #fff; background: #354a65; border-color: #9bb6e1; }
[data-theme="dark"] .ui-app :is(.btn-outline-danger, .btn-outline-warning) { color: #ffd5d5; background: #38252d; border-color: #ab727b; }
[data-theme="dark"] .ui-app .btn-outline-warning { color: #ffe5b1; background: #3a3020; border-color: #a88652; }
[data-theme="dark"] .ui-app .btn-outline-danger:hover { color: #fff; background: #793544; }
[data-theme="dark"] .ui-app :is(.table-responsive, .student-main .table-responsive) { background: #1b2939; border-color: var(--ui-line); }
[data-theme="dark"] .ui-app .table { --bs-table-bg: #1b2939; --bs-table-color: #edf3fc; --bs-table-border-color: #465872; --bs-table-striped-bg: #243447; --bs-table-striped-color: #edf3fc; --bs-table-hover-bg: #2a3d56; --bs-table-hover-color: #fff; }
[data-theme="dark"] .ui-app .table thead th { color: #e3ecf9; background: #263548; }
[data-theme="dark"] :is(.ui-popover, .ui-popover:popover-open, .ui-popover.is-fallback-open) { background: #1b2939; color: #edf3fc; border-color: #65768c; }
[data-theme="dark"] :is(.ui-help-trigger, .ui-popover-close) { background: #263548; color: #edf3fc; border-color: #65768c; }
[data-theme="dark"] :is(.ui-help-trigger:hover, .ui-popover-close:hover) { background: #354a65; color: #fff; }
[data-theme="dark"] .ui-app :is(.portal-status-badge, .student-live-pill) { background: #304b6c; color: #e1edff; }
[data-theme="dark"] .ui-app .placement-detail-hero .portal-status-badge { background: #304b6c; color: #e1edff; }
[data-theme="dark"] .ui-app :is(.portal-notice, .evaluation-locked-state, .evaluation-locked-state.is-scheduled) { background: #263e55; color: #e1edff; border-color: #587da0; }
[data-theme="dark"] .ui-app .portal-notice span { color: #d0e1f8; }
[data-theme="dark"] .ui-app :is(a:not(.btn):not(.portal-primary-button):not(.student-nav-link):not(.student-nav-sublink):not(.student-icon-button):not(.assigned-student-card):not(.fic-dashboard-card):not(.fic-secondary-action):not(.ui-public-brand):not(.student-brand)) { color: #a7c8ff; }

/* The public landing page has its own palette. */
[data-theme="dark"] .ui-landing { --landing-ink: #edf3fc; --landing-muted: #b5c2d5; --landing-line: #3b4b62; --landing-blue: #a7c8ff; background: #101925; color: #edf3fc; }
[data-theme="dark"] .ui-landing :is(.landing-header, .landing-footer, .system-overview) { background: #192737; border-color: #3b4b62; }
[data-theme="dark"] .ui-landing :is(.registration-card, .feature) { background: #1b2939; border-color: #465872; }
[data-theme="dark"] .ui-landing :is(.registration-steps li, .registration-link) { border-color: #465872; }
[data-theme="dark"] .ui-landing :is(.registration-icon, .step-number, .feature-icon) { background: #304b6c; color: #e1edff; }
[data-theme="dark"] .ui-landing .brand-mark { background: #0052d8; color: #fff; }
[data-theme="dark"] .ui-landing .landing-button.is-primary { background: #0052d8; border-color: #0052d8; color: #fff; }
[data-theme="dark"] .ui-landing .landing-button.is-primary:hover { background: #1745a1; }
[data-theme="dark"] .ui-landing .landing-button.is-secondary { background: #263548; border-color: #65768c; color: #edf3fc; }
[data-theme="dark"] .ui-landing .landing-button.is-secondary:hover { background: #354a65; }
