:root {
  --theme-page:#f4f7fa;
  --theme-surface:#ffffff;
  --theme-raised:#ffffff;
  --theme-soft:#eef4f1;
  --theme-text:#203642;
  --theme-text-secondary:#344d5d;
  --theme-muted:#526575;
  --theme-border:#d5e0e6;
  --theme-border-strong:#9aadb9;
  --theme-input:#ffffff;
  --theme-input-disabled:#e9eef1;
  --theme-nav:#102b3e;
  --theme-nav-hover:#244b5d;
  --theme-table-head:#eef3f6;
  --theme-focus:#a36a09;
  --theme-success-bg:#e5f1ed;
  --theme-success-text:#145b49;
  --theme-warning-bg:#fff5d9;
  --theme-warning-text:#674600;
  --theme-danger-bg:#fff0ed;
  --theme-danger-text:#8b2929;
  --theme-info-bg:#eaf3f7;
  --theme-info-text:#174b60;
  --theme-shadow:0 12px 32px rgba(16,43,62,.10);
  --nmtc-background:var(--theme-page);
  --nmtc-surface:var(--theme-surface);
  --nmtc-text:var(--theme-text);
  --nmtc-text-muted:var(--theme-muted);
  --nmtc-border:var(--theme-border);
  --nmtc-pale:var(--theme-soft);
  --portal-ink:var(--theme-text);
  --portal-muted:var(--theme-muted);
  --portal-border:var(--theme-border);
}

html[data-theme="dark"] {
  --theme-page:#0c1720;
  --theme-surface:#12232e;
  --theme-raised:#182c38;
  --theme-soft:#172a34;
  --theme-text:#edf4f6;
  --theme-text-secondary:#cfdae0;
  --theme-muted:#a8bac4;
  --theme-border:#314754;
  --theme-border-strong:#5d7480;
  --theme-input:#10212b;
  --theme-input-disabled:#263943;
  --theme-nav:#081d2b;
  --theme-nav-hover:#1d4657;
  --theme-table-head:#1b303c;
  --theme-focus:#f0cc70;
  --theme-success-bg:#173b32;
  --theme-success-text:#9be1c7;
  --theme-warning-bg:#3b311c;
  --theme-warning-text:#f2d487;
  --theme-danger-bg:#402529;
  --theme-danger-text:#ffb5b5;
  --theme-info-bg:#183442;
  --theme-info-text:#a8d9ed;
  --theme-shadow:0 16px 38px rgba(0,0,0,.32);
  --nmtc-primary:#62c7aa;
  --nmtc-primary-dark:#8ad8c2;
  --nmtc-secondary:#4aa88e;
  --nmtc-footer-text:#e9f2f3;
  --portal-green:#63c7aa;
  --portal-navy:var(--theme-nav);
  --management-navy:var(--theme-nav);
  --management-green:#24866c;
  --management-border:var(--theme-border);
  --management-muted:var(--theme-muted);
  --bs-body-bg:var(--theme-page);
  --bs-body-color:var(--theme-text);
  --bs-border-color:var(--theme-border);
  --bs-secondary-color:var(--theme-muted);
}

html[data-theme="dark"] .portal-app {
  --portal-ink:var(--theme-text);
  --portal-muted:var(--theme-muted);
  --portal-border:var(--theme-border);
  --portal-navy:var(--theme-nav);
  --portal-green:#63c7aa;
}
html[data-theme="dark"] .management-app {
  --management-navy:var(--theme-nav);
  --management-green:#45a98f;
  --management-border:var(--theme-border);
  --management-muted:var(--theme-muted);
  --background:var(--theme-page);
  --surface:var(--theme-surface);
  --border:var(--theme-border);
  --text:var(--theme-text);
  --text-muted:var(--theme-muted);
  --secondary:var(--theme-text);
  --primary-light:var(--theme-success-bg);
}

html { background:var(--theme-page); }
body { background-color:var(--theme-page); color:var(--theme-text); }

.theme-control { position:relative; display:inline-flex; min-width:0; margin:0; color:var(--theme-text-secondary); }
.theme-control-trigger { display:inline-flex; align-items:center; justify-content:center; gap:.35rem; min-width:38px; min-height:38px; padding:.45rem; border:1px solid var(--theme-border); border-radius:9px; background:var(--theme-soft); color:var(--theme-text-secondary); cursor:pointer; }
.theme-control-trigger:hover,.theme-control-trigger[aria-expanded="true"] { background:var(--theme-surface); color:var(--theme-text); border-color:var(--theme-border-strong); }
.theme-control-trigger:focus-visible,.theme-control-option:focus-visible { outline:3px solid var(--theme-focus); outline-offset:2px; }
.theme-control-trigger svg,.theme-control-option svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; flex:0 0 18px; }
.theme-control-trigger [hidden],.theme-control-option [hidden] { display:none!important; }
.theme-control-trigger-text { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.theme-control-menu { position:absolute; z-index:80; top:calc(100% + .45rem); right:0; width:190px; padding:.35rem; border:1px solid var(--theme-border); border-radius:10px; background:var(--theme-surface); box-shadow:var(--theme-shadow); }
.theme-control-option { display:grid; grid-template-columns:20px minmax(0,1fr) 18px; align-items:center; gap:.55rem; width:100%; min-height:40px; padding:.5rem .55rem; border:0; border-radius:7px; background:transparent; color:var(--theme-text-secondary); text-align:left; cursor:pointer; }
.theme-control-option:hover,.theme-control-option[aria-checked="true"] { background:var(--theme-soft); color:var(--theme-text); }
.theme-control-option[aria-checked="true"] { font-weight:750; }
.theme-control-check { color:var(--theme-success-text); font-weight:900; text-align:right; }

.site-header .theme-control { margin-left:auto; }
.practical-auth>.theme-control,
body>.theme-control { position:fixed; z-index:60; top:14px; right:14px; }
.login-card>.theme-control { position:absolute; top:14px; right:14px; }
.login-card { position:relative; }

html[data-theme="dark"] body,
html[data-theme="dark"] .public-site,
html[data-theme="dark"] .portal-app { background:var(--theme-page); color:var(--theme-text); }
html[data-theme="dark"] .practical-student-app {
  --student-green:#63c7aa;
  --student-ink:var(--theme-text);
  --student-muted:var(--theme-muted);
  --student-line:var(--theme-border);
  --student-soft:var(--theme-soft);
  --student-shadow:var(--theme-shadow);
}

/* The practical student workspace predates the shared theme tokens. Map its
   light-only cards and nested detail surfaces onto the shared semantic layers
   so labels and authoritative values always use matching foregrounds. */
html[data-theme="dark"] .practical-student-app :is(
  .student-identity-grid>div,.student-metrics>div,.student-exam-card,
  .student-announcement-card,.student-directory-card,.student-online-centre,
  .student-exam-detail,.student-result-card,.student-result-detail,.student-profile-card,
  .student-announcement-detail,.student-communication-card,
  .student-announcement-directory-card,.student-popover,
  .student-filter-tabs a,.student-detail-grid>div,
  .student-result-summary-copy dl>div,.student-result-components-mobile dl>div,
  .pagination a,.pagination span
) {
  background:var(--theme-surface);
  color:var(--theme-text);
  border-color:var(--theme-border);
}
html[data-theme="dark"] .practical-student-app :is(
  .student-schedule-intro,.student-results-intro,.student-communications-intro,
  .student-next-exam,.student-empty-card,.student-result-summary,
  .student-result-outcome,.student-exam-facts>div,.student-profile-guidance,
  .student-publication-note,.student-result-components-mobile article,
  .student-popover>header,.student-popover-all,
  .student-directory-card>header,.student-result-card>header,
  .student-announcement-directory-card>header,.student-ward-section,
  .student-instructions,.student-popover-list article.is-unread
) {
  background:var(--theme-soft);
  color:var(--theme-text-secondary);
  border-color:var(--theme-border);
}
html[data-theme="dark"] .practical-student-app :is(
  .student-identity-grid dd,.student-metrics dd,.student-section-heading h2,
  .student-next-copy h2,.student-exam-card h3,.student-exam-card dd,
  .student-directory-card h3,.student-exam-facts dd,.student-detail-heading h3,
  .student-detail-grid dd,.student-result-card h2,.student-result-card dd,
  .student-result-summary-copy h3,.student-result-summary-copy dd,
  .student-result-components-mobile h4,.student-result-components-mobile dd,
  .student-announcement-card h3 a,.student-announcement-detail h2,
  .student-communication-copy h3,.student-announcement-directory-card h3 a
) { color:var(--theme-text); }
html[data-theme="dark"] .practical-student-app :is(
  .student-identity-grid dt,.student-metrics dt,.student-next-copy p,
  .student-exam-card dt,.student-exam-card header,.student-registration-badge,
  .student-exam-facts dt,.student-detail-grid dt,.student-result-card dt,
  .student-result-card>header time,.student-result-summary-copy dt,
  .student-result-components-mobile dt,.student-message,
  .student-announcement-directory-card p,.student-profile-guidance
) { color:var(--theme-muted); }
html[data-theme="dark"] .practical-student-app :is(
  .button.outline,.student-next-icon,.student-detail-heading>span,
  .student-component-order,.student-online-centre>div:first-child,
  .student-announcement-icon,.student-communication-marker,
  .student-filter-tabs a span
) {
  background:var(--theme-raised);
  color:#9fe1ce;
  border-color:var(--theme-border-strong);
}
html[data-theme="dark"] .practical-student-app :is(
  .header-icon:hover,.header-icon[aria-expanded="true"],.student-account-link:hover
) { background:var(--theme-raised); color:var(--theme-text); border-color:var(--theme-border); }
html[data-theme="dark"] .practical-student-app .student-state-badge.is-active,
html[data-theme="dark"] .practical-student-app .student-state-badge.is-unread {
  background:var(--theme-success-bg); color:var(--theme-success-text); border:1px solid #376d5e;
}
html[data-theme="dark"] .practical-student-app .student-state-badge.is-read {
  background:var(--theme-soft); color:var(--theme-muted); border:1px solid var(--theme-border);
}
html[data-theme="dark"] .practical-student-app :is(
  .student-exam-card dl>div,.student-directory-card>footer,
  .student-result-card>footer,.student-result-table,
  .student-result-table th,.student-result-table td,.student-detail-section
) { border-color:var(--theme-border); }
html[data-theme="dark"] .practical-student-app .student-result-table :is(caption,thead th) {
  background:var(--theme-table-head)!important;
  color:var(--theme-text-secondary)!important;
}
html[data-theme="dark"] .practical-student-app .student-result-table tbody th {
  background:var(--theme-surface)!important;
  color:var(--theme-text)!important;
}
html[data-theme="dark"] .practical-student-app .student-result-score {
  background:#17695c;
  color:#fff;
}
.practical-student-app .student-result-score small {
  color:#e4f4ef;
}
html[data-theme="dark"] :is(h1,h2,h3,h4,h5,h6,label,legend,dt,strong) { color:inherit; }
html[data-theme="dark"] a { color:#8ad8c2; }
html[data-theme="dark"] :focus-visible { outline-color:var(--theme-focus)!important; }

html[data-theme="dark"] :is(
  .site-header,.quick-links a,.programme-card,.content-card,.panel,.events-panel,.news-row,.resource-row,.faq,
  .admission-card,.application-steps>li,.gallery-preview figure,.gallery-preview article,.search-form,
  .management-topbar,.management-account-menu,.management-table,.management-record,.summary-card,.workspace-card,
  .form-section,.exam-form-section,.component-card,.branding-preview-grid,.examiner-topbar,.student-topbar,
  .staff-topbar,.staff-account-menu,.student-assignment-group,.assignment-card,.dashboard-student-card,
  .assessment-confirm-dialog,.practical-auth-card,.login-card,.table-container,.student-table,.criterion,
  .step-rating-card,.assessment-table,.candidate-filters,.candidate-table,.task-search,.assessment-criterion,
  .candidate-context-card
) ,
html[data-theme="dark"] .portal-app :is(.metrics>div,.student-summary>div,.programme-summary-card),
html[data-theme="dark"] .dashboard-welcome {
  background:var(--theme-surface); color:var(--theme-text); border-color:var(--theme-border);
}

html[data-theme="dark"] .dashboard-welcome {
  background-image:linear-gradient(120deg,#122b2b 0%,#12232e 68%,#352f1d 100%);
}
html[data-theme="dark"] .dashboard-welcome h2 { color:var(--theme-text); }
html[data-theme="dark"] .dashboard-welcome-kicker { color:#f0cc70; }
html[data-theme="dark"] .dashboard-welcome-role { color:var(--theme-muted); }
html[data-theme="dark"] .portal-app :is(.metrics strong,.management-count,.programme-summary-card strong,.student-counts dd) { color:#9fe1ce; }
html[data-theme="dark"] .portal-app :is(.metrics .portal-icon,.eyebrow,.page-eyebrow,.student-eyebrow) { color:#71cdb3; }

html[data-theme="dark"] :is(
  .assignment-location,.assignment-scope,.assignment-progress small,.assessor-dashboard .section-heading p,
  .dashboard-student-identity small,.dashboard-student-progress,.history-card dt,.dialog-facts dt,
  .success-facts dt,.saved-comment span,.final-total span,.no-js-note
) { color:var(--theme-muted); }

html[data-theme="dark"] :is(
  .hero,.page-header,.programme-symbol,.event-row time,.image-unavailable,.principal-photo,.detail-image,
  .programme-detail-image,.management-badge,.compact-empty,.assignment-progress,.assignment-facts>div,
  .student-assignment-group>header,.dialog-facts>div,.success-facts>div,.history-card dl>div,
  .branding-preview-surface,.component-options label,.saved-comment,.form-empty-state,.empty-state,
  .assessment-task-facts>div,.progress-facts>div,.candidate-card-facts>div,.category-facts>div,
  .task-facts>div,.criterion-entry,.rating-scale dl div,.assessor-shortcuts button,.assessment-steps span
) { background:var(--theme-soft); color:var(--theme-text-secondary); border-color:var(--theme-border); }
html[data-theme="dark"] :is(.hero,.page-header) { background:linear-gradient(120deg,#102530,#132a33); }

html[data-theme="dark"] :is(
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),select,textarea,
  .practical-input
) { background:var(--theme-input)!important; color:var(--theme-text)!important; border-color:var(--theme-border-strong)!important; }
html[data-theme="dark"] ::placeholder { color:#8fa3ad; opacity:1; }
html[data-theme="dark"] :is(input,select,textarea):disabled { background:var(--theme-input-disabled)!important; color:var(--theme-muted)!important; }
html[data-theme="dark"] select { color-scheme:dark; }

html[data-theme="dark"] :is(table,.table) { color:var(--theme-text); }
html[data-theme="dark"] :is(thead th,.staff-app th) { background:var(--theme-table-head)!important; color:var(--theme-text-secondary)!important; border-color:var(--theme-border)!important; }
html[data-theme="dark"] :is(th,td,.table>:not(caption)>*>*) { color:var(--theme-text); border-color:var(--theme-border); background-color:transparent; }
html[data-theme="dark"] tbody tr:hover { background:#182d38; }

html[data-theme="dark"] :is(.management-sidebar,.examiner-sidebar,#student-sidebar,#staff-sidebar) { background:var(--theme-nav); border-color:#28414e; }
html[data-theme="dark"] :is(.management-sidebar,.examiner-sidebar,#student-sidebar,#staff-sidebar) a { color:#edf5f9; }
html[data-theme="dark"] :is(.management-menu-button,.management-notification-link,.header-icon,.portal-menu,.management-account summary,.button.outline,.button.secondary,.table-action,.quick-actions a) {
  background:var(--theme-raised); color:#a8e4d2; border-color:var(--theme-border);
}
html[data-theme="dark"] :is(.management-menu-button,.management-notification-link,.header-icon,.portal-menu,.management-account summary,.button.outline,.button.secondary,.table-action,.quick-actions a):hover { background:#203945; }
html[data-theme="dark"] :is(.management-context strong,.portal-context strong,.management-main h1,.workspace-header h1,.student-page-header h1,.assignment-card header h3,.history-candidate-name) { color:var(--theme-text); }
html[data-theme="dark"] :is(.management-context-kicker,.portal-context small,.muted,.helptext,.form-help,.table-subtext,small) { color:var(--theme-muted); }
html[data-theme="dark"] :is(.criterion-description,.criterion-range,.criterion-state,.field-help,.score-input-wrap>span,.candidate-card-facts dt,.assessment-task-facts dt,.progress-facts dt) { color:var(--theme-muted); }
html[data-theme="dark"] :is(.criterion-number,.step-progress,.assessment-table thead) { background:#17465a; color:#fff; }
html[data-theme="dark"] .rating-options span { background:var(--theme-input); color:var(--theme-text); border-color:var(--theme-border-strong); }
html[data-theme="dark"] .rating-options input:checked+span { background:#20745f; color:#fff; border-color:#68c7ad; }
html[data-theme="dark"] .sticky-actions { background:rgba(18,35,46,.96); border-color:var(--theme-border); }

html[data-theme="dark"] :is(.portal-alert.success,.admin-alert-success,.success-message) { background:var(--theme-success-bg); color:var(--theme-success-text); border-color:#376d5e; }
html[data-theme="dark"] :is(.portal-alert.error,.admin-alert-error,.errorlist,.field-errors,.blocker-list li) { background:var(--theme-danger-bg); color:var(--theme-danger-text); border-color:#7d4448; }
html[data-theme="dark"] :is(.portal-alert.warning,.admin-alert-warning,.practical-security-warning,.button.warning,.reconciliation-attention.has-tasks) { background:var(--theme-warning-bg); color:var(--theme-warning-text); border-color:#806d38; }
html[data-theme="dark"] :is(.portal-alert.info,.admin-alert-info) { background:var(--theme-info-bg); color:var(--theme-info-text); border-color:#3c677a; }
html[data-theme="dark"] :is(.status-badge,.portal-badge,.management-badge,.assignment-role) { border-color:var(--theme-border-strong); }
html[data-theme="dark"] dialog::backdrop { background:rgba(1,9,14,.78); }

/* Administration components use a local semantic token layer. Keep literal
   light surfaces limited to Light Mode while preserving their component roles. */
html[data-theme="dark"] .management-app :is(
  .boolean-control,.cohort-checkbox-list,.programme-checkbox-list>div,.action-panel,
  .readiness-item,.workflow-step,.ward-card-metrics>div,.assignment-person,.availability-list,
  .empty-state,.import-guidance-disclosure,.import-guidance-content section,.import-summary span,
  .institution-control
) { background:var(--theme-soft); color:var(--theme-text-secondary); border-color:var(--theme-border); }
html[data-theme="dark"] .management-app :is(
  .boolean-control label,.cohort-checkbox-row,.programme-checkbox-label,
  .pagination a,.pagination span
) { background:var(--theme-surface); color:var(--theme-text); border-color:var(--theme-border-strong); }
html[data-theme="dark"] .management-app :is(
  .institution-control__selector,.import-guidance-disclosure[open] .import-guidance-toggle
) { border-color:var(--theme-border); }
html[data-theme="dark"] .management-app :is(
  .import-guidance-toggle:hover,.import-guidance-disclosure[open] .import-guidance-toggle
) { background:var(--theme-soft); }
html[data-theme="dark"] .management-app :is(.code-chip,.readiness-item>span:first-child,.workflow-marker,.import-guidance-content code) {
  background:var(--theme-raised); color:var(--theme-text-secondary); border-color:var(--theme-border);
}
html[data-theme="dark"] .management-app :is(.confirmation-block,.confirmation-note,.notice--warning) {
  background:var(--theme-warning-bg); color:var(--theme-warning-text); border-color:#806d38;
}
html[data-theme="dark"] .management-app .confirmation-block label { background:#2b2a20; color:var(--theme-warning-text); border-color:#806d38; }
html[data-theme="dark"] .management-app :is(.status-success,.status-ready,.status-active,.status-approved,.status-released,.status-verified,.status-reconciled) {
  background:var(--theme-success-bg); color:var(--theme-success-text); border-color:#376d5e;
}
html[data-theme="dark"] .management-app :is(.status-warning,.status-pending,.status-scheduled,.status-draft,.status-incomplete) {
  background:var(--theme-warning-bg); color:var(--theme-warning-text); border-color:#806d38;
}
html[data-theme="dark"] .management-app :is(.status-danger,.status-returned,.status-flagged,.status-not-ready) {
  background:var(--theme-danger-bg); color:var(--theme-danger-text); border-color:#7d4448;
}
html[data-theme="dark"] .management-app :is(.status-muted,.status-ended,.status-completed,.status-archived) {
  background:var(--theme-soft); color:var(--theme-muted); border-color:var(--theme-border-strong);
}
html[data-theme="dark"] .management-app .button.ghost { background:transparent; color:#a8e4d2; border-color:var(--theme-border); }
html[data-theme="dark"] .management-app .button.ghost:hover { background:var(--theme-raised); color:#c5f1e3; border-color:var(--theme-border-strong); }
html[data-theme="dark"] .management-app .button.danger-outline { background:transparent; color:var(--theme-danger-text); border-color:#8b4b50; }
html[data-theme="dark"] .management-app .button.danger-outline:hover { background:var(--theme-danger-bg); color:#ffd0d0; border-color:#a65d62; }
html[data-theme="dark"] .management-app :is(.button:disabled,.button[aria-disabled="true"]) {
  background:var(--theme-input-disabled); color:var(--theme-muted); border-color:var(--theme-border-strong); opacity:1;
}

/* Practical Administration reuses the management shell, but some operational
   components predate the shared semantic tokens. Bridge their surface aliases
   to the active palette; report print rules provide the separate white paper. */
.practical-admin-app {
  --surface-card:var(--theme-surface);
  --surface-muted:var(--theme-soft);
  --surface-raised:var(--theme-raised);
  --table-header-bg:var(--theme-table-head);
}
html[data-theme="dark"] .practical-admin-app {
  --portal-surface:var(--theme-surface);
}
html[data-theme="dark"] .practical-admin-app :is(
  .practical-kpi-card,.candidate-summary-grid article,.ward-assignment-card,
  .exam-content-card,.admin-dialog,.rubric-editor-list>article,
  .rubric-score-table .rubric-score-card,.rubric-score-table .rubric-score-empty,
  .checklist-programme-card,.checklist-category-card,.checklist-mobile-list article,
  .checklist-step-list>li
) {
  background:var(--theme-surface); color:var(--theme-text); border-color:var(--theme-border);
}
html[data-theme="dark"] .practical-admin-app :is(
  .practical-scope-panel,.candidate-filter-form,.readiness-item,
  .dashboard-quick-actions>a,.quick-action-unavailable,.candidate-detail-list div,
  .assessor-ward-grid article,.admin-dialog-details div,.monitoring-assessor-list article,
  .admin-privacy-note,.report-unavailable-note,.batch-preview-list article,
  .readiness-result-counts div,.library-tabs,.policy-applicability-grid span,
  .policy-form-control>div label,.policy-readonly-identity>div,
  .checklist-programme-card dl div,.checklist-mobile-list dl div,
  .checklist-status-strip,.checklist-scale-panel li,.checklist-review-form
) {
  background:var(--theme-soft); color:var(--theme-text-secondary); border-color:var(--theme-border);
}
html[data-theme="dark"] .practical-admin-app .practical-scope-panel {
  background-image:linear-gradient(120deg,var(--theme-surface),var(--theme-soft));
}
html[data-theme="dark"] .practical-admin-app :is(
  .dashboard-scope-chip,.icon-action,.policy-section-summary
) {
  background:var(--theme-raised); color:var(--theme-text); border-color:var(--theme-border-strong);
}
html[data-theme="dark"] .practical-admin-app :is(
  .dashboard-quick-actions>a:hover,.dashboard-quick-actions>a:focus-visible,
  .icon-action:hover,.icon-action:focus-visible,.library-tabs a:hover,
  .library-recent-list>a:hover,.policy-collapsible[open]>.policy-section-summary
) {
  background:var(--theme-raised); color:#a8e4d2; border-color:var(--theme-border-strong);
}
html[data-theme="dark"] .practical-admin-app :is(
  .practical-kpi-card strong,.practical-kpi-card .kpi-label,
  .candidate-summary-grid strong,.candidate-summary-grid small,
  .exam-content-card h3,.ward-assignment-card h2,
  .checklist-programme-card h2,.checklist-category-card h2
) { color:var(--theme-text); }
html[data-theme="dark"] .practical-admin-app :is(
  .practical-kpi-card small,.candidate-summary-grid small
) { color:var(--theme-muted); }
html[data-theme="dark"] .practical-admin-app :is(
  .candidate-avatar,.dashboard-quick-actions>a>span,.quick-action-unavailable>span,
  .admin-dialog-icon,.rubric-order,.checklist-step-number
) { background:var(--theme-success-bg); color:var(--theme-success-text); }
html[data-theme="dark"] .practical-admin-app :is(
  .readiness-blocker-list article,.readiness-blocker-icon
) { background:var(--theme-danger-bg); color:var(--theme-danger-text); border-color:#7d4448; }
html[data-theme="dark"] .practical-admin-app :is(
  .readiness-warning-list,.policy-legacy-baseline,.admin-alert-warning
) { background:var(--theme-warning-bg); color:var(--theme-warning-text); border-color:#806d38; }

/* Portal UI intentionally allows general badges to wrap. Administration table
   statuses are short labels and remain more legible as a single unit. */
.management-app .status-badge { white-space:nowrap; }

/* Public dark-mode overrides below stay in place for the legacy public surface.
   The institutional public components are bridged separately by
   css/institutional-dark.css, which is loaded after this file. */
html[data-theme="dark"] .public-site { --nmtc-text-muted:var(--theme-muted); }
html[data-theme="dark"] .public-site #primary-nav { background:var(--theme-raised); border-color:var(--theme-border); }
html[data-theme="dark"] .public-site #primary-nav a:hover { background:var(--theme-soft); }
html[data-theme="dark"] .public-site .quick-links a,
html[data-theme="dark"] .public-site .quick-links a:first-child,
html[data-theme="dark"] .public-site .quick-links a:last-child { background:var(--theme-surface); color:var(--theme-text); border-color:var(--theme-border); }
html[data-theme="dark"] .public-site .button.outline { color:#9fe1ce; border-color:#55ad95; }
html[data-theme="dark"] .public-site .button.outline:hover { background:#1a382f; }
html[data-theme="dark"] .public-site .admission-notice { background:var(--theme-warning-bg); color:var(--theme-warning-text); }
html[data-theme="dark"] .public-site .utility {
  background:var(--theme-nav);
  color:var(--theme-text-secondary);
  border-bottom:1px solid var(--theme-border);
}
html[data-theme="dark"] .public-site .nav-border {
  background:var(--theme-nav);
  border-color:var(--theme-border);
}
html[data-theme="dark"] .public-site .nav-toggle {
  background:var(--theme-soft);
  color:var(--theme-text);
  border-color:var(--theme-border);
}
html[data-theme="dark"] .public-site .nav-toggle:hover,
html[data-theme="dark"] .public-site .nav-toggle[aria-expanded="true"] {
  background:var(--theme-raised);
  color:var(--theme-text);
  border-color:var(--theme-border-strong);
}
html[data-theme="dark"] .public-site .header-actions .portal-link,
html[data-theme="dark"] .public-site .search-link { color:#9fe1ce; }
html[data-theme="dark"] .public-site .header-actions .portal-link:hover,
html[data-theme="dark"] .public-site .search-link:hover { color:var(--theme-text); }
/* Public promotional surfaces retain their structure in dark mode, but must
   use the shared semantic palette instead of the light-theme mint variables. */
html[data-theme="dark"] .public-site .admissions-band {
  background:var(--theme-surface);
  color:var(--theme-text);
  border-block:1px solid var(--theme-border);
}
html[data-theme="dark"] .public-site .admissions-band h2 { color:var(--theme-text); }
html[data-theme="dark"] .public-site .admissions-band p:last-child { color:var(--theme-muted); }
html[data-theme="dark"] .public-site .site-footer {
  background:var(--theme-nav);
  color:var(--theme-text-secondary);
  border-top-color:var(--theme-focus);
}
html[data-theme="dark"] .public-site .site-footer h2,
html[data-theme="dark"] .public-site .site-footer .footer-brand { color:var(--theme-text); }
html[data-theme="dark"] .public-site .site-footer a { color:#9fe1ce; }
html[data-theme="dark"] .public-site .site-footer a:hover { color:var(--theme-text); }
html[data-theme="dark"] .public-site .site-footer p,
html[data-theme="dark"] .public-site .footer-bottom { color:var(--theme-muted); }
html[data-theme="dark"] .public-site .footer-bottom { border-top-color:var(--theme-border); }
html[data-theme="dark"] .button:not(.outline):not(.secondary):not(.ghost):not(.warning):not(.danger):not(.danger-outline):not(.destructive) { color:#062c24; }
html[data-theme="dark"] .practical-auth { background:linear-gradient(135deg,#06141e,#102c36); }
html[data-theme="dark"] .password-toggle { background:var(--theme-soft); color:var(--theme-text); border-color:var(--theme-border); }
html[data-theme="dark"] .login-footer { border-color:var(--theme-border); }
html[data-theme="dark"] .portal-switch { background:var(--theme-soft); border-color:var(--theme-border); }
html[data-theme="dark"] :is(.login-intro p,.login-note,.login-copyright) { color:var(--theme-muted); }

@media (max-width:700px) {
  .theme-control-menu { right:0; width:min(190px,calc(100vw - 1.5rem)); }
  .public-site .header-actions .theme-control { order:-1; }
  .public-site .site-header .theme-control { margin-left:0; }
}

@media (prefers-reduced-motion:no-preference) {
  body,.site-header,.management-topbar,.examiner-topbar,.student-topbar,.staff-topbar { transition:background-color .16s ease,color .16s ease,border-color .16s ease; }
}
[data-theme="dark"] .management-app .ward-management-row,
[data-theme="dark"] .management-app .ward-management-row dl>div{
  background:var(--surface-card);border-color:var(--border-color);color:var(--text-primary)
}
[data-theme="dark"] .management-app .ward-management-row h3,
[data-theme="dark"] .management-app .ward-management-row h3 a,
[data-theme="dark"] .management-app .ward-management-row dd{color:var(--text-primary)}
[data-theme="dark"] .management-app .ward-management-row dt{color:var(--text-muted)}
