/* Pure-black admin palette. Reserve raised neutral fills for interactive states. */
html[data-bs-theme="dark"],
body.theme-dark,
[data-menu-theme="dark"] {
    color-scheme: dark;
    --portal-dark-canvas: #000;
    --portal-dark-surface-1: #000;
    --portal-dark-surface-2: #000;
    --portal-dark-surface-3: #111;
    --portal-dark-surface-4: #1c1c1c;
    --portal-dark-border-1: #2a2a2a;
    --portal-dark-border-2: #3a3a3a;
    --portal-dark-border-3: #4a4a4a;
    --portal-dark-text-1: #ececec;
    --portal-dark-text-2: #dadada;
    --portal-dark-text-3: #bdbdbd;
    --portal-dark-text-4: #a3a3a3;
    --portal-dark-text-5: #8f8f8f;
    --portal-dark-accent-1: #101f2e;
    --portal-dark-accent-2: #0e2741;
    --portal-dark-accent-border: #0c345e;
    --portal-dark-accent-text: #8ec0ff;
    --portal-dark-brand-text: #3d98ff;
    --portal-dark-success-bg: #14251b;
    --portal-dark-success-text: #86efac;
    --portal-dark-danger-bg: #281717;
    --portal-dark-danger-text: #fca5a5;
    --portal-dark-warning-bg: #292014;
    --portal-dark-warning-text: #f6c86a;
    --portal-dark-violet-bg: #1d1b2e;
    --portal-dark-violet-text: #aea7ff;

    /* Tabler and the Bootstrap variables used by custom admin views. */
    --tblr-body-bg: var(--portal-dark-canvas);
    --tblr-body-bg-rgb: 0, 0, 0;
    --tblr-body-color: var(--portal-dark-text-1);
    --tblr-body-color-rgb: 236, 236, 236;
    --tblr-bg-main-color: var(--portal-dark-canvas);
    --tblr-bg-surface: var(--portal-dark-surface-1);
    --tblr-bg-surface-secondary: var(--portal-dark-surface-2);
    --tblr-bg-surface-tertiary: var(--portal-dark-surface-2);
    --tblr-bg-forms: var(--portal-dark-surface-1);
    --tblr-secondary-bg: var(--portal-dark-surface-2);
    --tblr-secondary-bg-rgb: 0, 0, 0;
    --tblr-tertiary-bg: var(--portal-dark-surface-1);
    --tblr-tertiary-bg-rgb: 0, 0, 0;
    --tblr-emphasis-color: var(--portal-dark-text-1);
    --tblr-emphasis-color-rgb: 236, 236, 236;
    --tblr-secondary-color: var(--portal-dark-text-3);
    --tblr-secondary-color-rgb: 189, 189, 189;
    --tblr-tertiary-color: var(--portal-dark-text-5);
    --tblr-tertiary-color-rgb: 143, 143, 143;
    --tblr-muted: var(--portal-dark-text-4);
    --tblr-muted-rgb: 163, 163, 163;
    --tblr-secondary: var(--portal-dark-text-4);
    --tblr-secondary-rgb: 163, 163, 163;
    --tblr-gray: var(--portal-dark-text-4);
    --tblr-gray-dark: var(--portal-dark-surface-1);
    --tblr-gray-100: var(--portal-dark-text-1);
    --tblr-gray-200: var(--portal-dark-text-2);
    --tblr-gray-300: var(--portal-dark-text-3);
    --tblr-gray-400: var(--portal-dark-text-4);
    --tblr-gray-500: var(--portal-dark-text-5);
    --tblr-gray-600: var(--portal-dark-surface-4);
    --tblr-gray-700: var(--portal-dark-surface-3);
    --tblr-gray-800: var(--portal-dark-surface-2);
    --tblr-gray-900: var(--portal-dark-surface-1);
    --tblr-light: var(--portal-dark-text-1);
    --tblr-light-rgb: 236, 236, 236;
    --tblr-light-text: 236, 236, 236;
    --tblr-dark: var(--portal-dark-surface-1);
    --tblr-dark-rgb: 0, 0, 0;
    --tblr-dark-text: var(--portal-dark-text-1);
    --tblr-border-color: var(--portal-dark-border-2);
    --tblr-border-color-translucent: var(--portal-dark-border-2);
    --tblr-dark-mode-border-color: var(--portal-dark-border-3);
    --tblr-light-border-subtle: var(--portal-dark-border-2);
    --tblr-dark-border-subtle: var(--portal-dark-border-3);
    --tblr-secondary-border-subtle: var(--portal-dark-border-3);
    --tblr-light-bg-subtle: var(--portal-dark-surface-2);
    --tblr-dark-bg-subtle: var(--portal-dark-surface-1);
    --tblr-secondary-bg-subtle: var(--portal-dark-surface-2);
    --tblr-light-text-emphasis: var(--portal-dark-text-1);
    --tblr-dark-text-emphasis: var(--portal-dark-text-2);
    --tblr-secondary-text-emphasis: var(--portal-dark-text-3);
    --tblr-primary: #007bfe;
    --tblr-primary-rgb: 0, 123, 254;
    --tblr-primary-fg: #fff;
    --tblr-tabler: var(--tblr-primary);
    --tblr-tabler-rgb: var(--tblr-primary-rgb);
    --tblr-primary-text-emphasis: var(--portal-dark-accent-text);
    --tblr-primary-bg-subtle: var(--portal-dark-accent-1);
    --tblr-primary-border-subtle: var(--portal-dark-border-3);
    --tblr-link-color: var(--portal-dark-accent-text);
    --tblr-link-color-rgb: 142, 192, 255;
    --tblr-link-hover-color: #b5d6ff;
    --tblr-link-hover-color-rgb: 181, 214, 255;
    --tblr-code-color: var(--portal-dark-accent-text);
    --tblr-active-bg: var(--portal-dark-accent-1);
    --tblr-focus-ring-color: rgba(61, 152, 255, 0.35);
    --tblr-navbar-bg: var(--portal-dark-surface-1);
    --tblr-navbar-color: var(--portal-dark-text-3);
    --tblr-navbar-active-color: var(--portal-dark-text-1);
    --tblr-navbar-border-color: var(--portal-dark-border-2);
    --bs-body-bg: var(--tblr-body-bg);
    --bs-body-bg-rgb: var(--tblr-body-bg-rgb);
    --bs-body-color: var(--tblr-body-color);
    --bs-body-color-rgb: var(--tblr-body-color-rgb);
    --bs-secondary-bg: var(--tblr-secondary-bg);
    --bs-secondary-bg-rgb: var(--tblr-secondary-bg-rgb);
    --bs-tertiary-bg: var(--tblr-tertiary-bg);
    --bs-tertiary-bg-rgb: var(--tblr-tertiary-bg-rgb);
    --bs-secondary-color: var(--tblr-secondary-color);
    --bs-tertiary-color: var(--tblr-tertiary-color);
    --bs-emphasis-color: var(--tblr-emphasis-color);
    --bs-border-color: var(--tblr-border-color);
    --bs-border-color-translucent: var(--tblr-border-color-translucent);
    --bs-primary: var(--tblr-primary);
    --bs-primary-rgb: var(--tblr-primary-rgb);
    --bs-link-color: var(--tblr-link-color);
    --bs-link-hover-color: var(--tblr-link-hover-color);
    --input-bg: var(--portal-dark-surface-2);
    --user-filter-bg: var(--portal-dark-surface-2);
    --user-filter-border: var(--portal-dark-border-3);
    --user-filter-focus: var(--portal-dark-brand-text);
    scrollbar-color: var(--portal-dark-surface-4) var(--portal-dark-canvas);
}

/* Light-only utility fills must not leave white panels in the dark theme. */
html[data-bs-theme="dark"] body {
    background-color: var(--portal-dark-canvas);
}

html[data-bs-theme="dark"] .bg-white,
html[data-bs-theme="dark"] .bg-light {
    background-color: var(--portal-dark-surface-1) !important;
}

html[data-bs-theme="dark"] .text-dark,
html[data-bs-theme="dark"] .text-black {
    color: var(--portal-dark-text-1) !important;
}

html[data-bs-theme="dark"] .text-secondary {
    color: var(--portal-dark-text-3) !important;
}

/* Backpack widgets carry local variables or vendor rules with !important. */
html[data-bs-theme="dark"] .form-control::placeholder,
html[data-bs-theme="dark"] .select2-search__field::placeholder {
    color: var(--portal-dark-text-5) !important;
    opacity: 1;
}

html[data-bs-theme="dark"] .form-control,
html[data-bs-theme="dark"] input:not(input[type=hidden]).form-control,
html[data-bs-theme="dark"] textarea.form-control,
html[data-bs-theme="dark"] select.form-control,
html[data-bs-theme="dark"] .form-select,
html[data-bs-theme="dark"] .input-group-text,
html[data-bs-theme="dark"] .select2-container--bootstrap .select2-selection--single .select2-selection__rendered,
html[data-bs-theme="dark"] .select2-container .select2-dropdown .select2-search input.select2-search__field,
html[data-bs-theme="dark"] .select2-selection--multiple input:not(:focus) {
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] .select2-selection--multiple input:not(:focus) {
    color: var(--portal-dark-text-1) !important;
}

html[data-bs-theme="dark"] .form-control:focus,
html[data-bs-theme="dark"] .form-select:focus {
    border-color: var(--portal-dark-brand-text);
}

/* Custom subscription filters override the vendor form backgrounds. */
html[data-bs-theme="dark"] :is(.subscription-filter-control, .subscription-filter-prefix, .pro-filter-control, .pro-filter-prefix),
html[data-bs-theme="dark"] :is(.subscription-date-range-trigger, .pro-date-range-trigger, .crm-date-range-trigger) {
    background-color: var(--portal-dark-surface-2) !important;
    border-color: var(--portal-dark-border-3) !important;
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] :is(.subscription-date-range-text, .pro-date-range-text, .crm-date-range-text) {
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] .page-item.disabled .page-link {
    color: var(--portal-dark-text-4);
    background-color: var(--portal-dark-surface-1);
    border-color: var(--portal-dark-border-2);
}

html[data-bs-theme="dark"] .badge.bg-success {
    background-color: var(--portal-dark-success-bg) !important;
    color: var(--portal-dark-success-text) !important;
}

html[data-bs-theme="dark"] .badge.bg-warning {
    background-color: var(--portal-dark-warning-bg) !important;
    color: var(--portal-dark-warning-text) !important;
}

html[data-bs-theme="dark"] .badge.bg-info {
    background-color: var(--portal-dark-accent-1) !important;
    color: var(--portal-dark-accent-text) !important;
}

/* Statistics, university logo fallbacks, and dashboard avatars. */
html[data-bs-theme="dark"] .stat-card {
    background: var(--portal-dark-surface-1);
    border-color: var(--portal-dark-border-2);
}

html[data-bs-theme="dark"] .stat-label {
    color: var(--portal-dark-text-3);
}

html[data-bs-theme="dark"] .stat-value {
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] .stage-value {
    background: var(--portal-dark-surface-1);
    color: var(--portal-dark-text-1);
    border-radius: 4px;
    padding: 0 4px;
}

html[data-bs-theme="dark"] :is(.bg-blue-soft, .uni-logo-fallback) {
    background-color: var(--portal-dark-accent-1);
    color: var(--portal-dark-accent-text) !important;
}

html[data-bs-theme="dark"] .bg-green-soft {
    background-color: var(--portal-dark-success-bg);
    color: var(--portal-dark-success-text) !important;
}

html[data-bs-theme="dark"] .bg-amber-soft {
    background-color: var(--portal-dark-warning-bg);
    color: var(--portal-dark-warning-text) !important;
}

html[data-bs-theme="dark"] .bg-purple-soft {
    background-color: var(--portal-dark-violet-bg);
    color: var(--portal-dark-violet-text) !important;
}

html[data-bs-theme="dark"] .user-avatar {
    background: var(--portal-dark-surface-3);
    color: var(--portal-dark-text-2);
}

html[data-bs-theme="dark"] .badge-count-red {
    background: var(--portal-dark-danger-bg);
    color: var(--portal-dark-danger-text);
}

/* Community and partner scholarship comment screens. */
html[data-bs-theme="dark"] .community-comment-page .card,
html[data-bs-theme="dark"] :is(.community-comment-page, .scholarship-comments-page) .comment-toolbar {
    background: var(--portal-dark-surface-1);
    border-color: var(--portal-dark-border-2) !important;
}

html[data-bs-theme="dark"] :is(.community-comment-header, .b2b-discussion-header) .page-title,
html[data-bs-theme="dark"] .scholarship-comments-page :is(.comment-text-preview, .scholarship-name) {
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] .community-comments-table :is(th, td) {
    border-color: var(--portal-dark-border-2);
}

html[data-bs-theme="dark"] .community-comments-table thead th {
    background: var(--portal-dark-surface-2);
}

html[data-bs-theme="dark"] .community-comments-table tbody tr:hover {
    background: var(--portal-dark-surface-3);
}

html[data-bs-theme="dark"] .community-comments-table tbody tr.is-unread {
    background: var(--portal-dark-warning-bg);
}

html[data-bs-theme="dark"] .community-comments-table tbody tr.is-unread:hover {
    background: var(--portal-dark-surface-3);
}

html[data-bs-theme="dark"] :is(.community-comment-page, .scholarship-comments-page) :is(.avatar-circle, .avatar-placeholder) {
    background: var(--portal-dark-surface-3) !important;
    color: var(--portal-dark-text-2) !important;
}

html[data-bs-theme="dark"] .scholarship-comments-page :is(.filter-dropdown, .date-picker-btn, .action-btn) {
    background: var(--portal-dark-surface-2);
    border-color: var(--portal-dark-border-3);
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] .scholarship-comments-page :is(.filter-dropdown, .date-picker-btn, .action-btn):hover {
    background: var(--portal-dark-surface-3);
}

html[data-bs-theme="dark"] .scholarship-comments-page :is(.status-read, .dropdown-icon) {
    color: var(--portal-dark-text-3);
}

html[data-bs-theme="dark"] .scholarship-comments-page .status-replied {
    background: var(--portal-dark-success-bg);
    color: var(--portal-dark-success-text);
}

/* The partner discussion shell also contains an independently scrolling list. */
html[data-bs-theme="dark"] .b2b-discussion-page :is(.discussion-workspace, .discussion-sidebar-header, .discussion-thread-list) {
    background: var(--portal-dark-surface-1);
    border-color: var(--portal-dark-border-2);
}

html[data-bs-theme="dark"] .b2b-discussion-page .discussion-thread-header .avatar-placeholder {
    background: var(--portal-dark-surface-3);
    color: var(--portal-dark-text-2);
}

html[data-bs-theme="dark"] .b2b-discussion-page .discussion-stage-badge {
    background: var(--portal-dark-accent-1);
    color: var(--portal-dark-accent-text);
    border-color: var(--portal-dark-border-3);
}

html[data-bs-theme="dark"] .b2b-discussion-page :is(.discussion-user-email, .thread-date, .thread-preview, .cw-time) {
    color: var(--portal-dark-text-3);
}

/* Standalone matching forms and both Select2 themes use light vendor fills. */
html[data-bs-theme="dark"] body :is(.form-control, .form-select):not(.crm-inline-select),
html[data-bs-theme="dark"] .select2-container .select2-selection,
html[data-bs-theme="dark"] .select2-container .select2-dropdown,
html[data-bs-theme="dark"] .select2-container .select2-search__field {
    background-color: var(--portal-dark-surface-2) !important;
    border-color: var(--portal-dark-border-3) !important;
}

html[data-bs-theme="dark"] .select2-container :is(.select2-selection__rendered, .select2-search__field),
html[data-bs-theme="dark"] .select2-results__option {
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] .select2-container .select2-selection__placeholder {
    color: var(--portal-dark-text-4);
}

html[data-bs-theme="dark"] .select2-results__option--highlighted[aria-selected],
html[data-bs-theme="dark"] .select2-results__option--highlighted[aria-selected="true"] {
    background-color: #006de0 !important;
    color: #fff !important;
}

html[data-bs-theme="dark"] .select2-results__option[aria-selected="true"]:not(.select2-results__option--highlighted) {
    background-color: var(--portal-dark-accent-1) !important;
    color: var(--portal-dark-accent-text);
}

html[data-bs-theme="dark"] .matching-layout .step-number-box {
    background: var(--portal-dark-surface-3);
    color: var(--portal-dark-accent-text);
    border-color: var(--portal-dark-border-3);
}

html[data-bs-theme="dark"] .alert-warning {
    --tblr-alert-bg: var(--portal-dark-warning-bg);
    --tblr-alert-color: var(--portal-dark-warning-text);
    background-color: var(--portal-dark-warning-bg);
    color: var(--portal-dark-warning-text);
    border-color: var(--portal-dark-border-3);
}

html[data-bs-theme="dark"] :is(.badge.bg-secondary, .badge.badge-secondary, .badge-gray) {
    background-color: var(--portal-dark-surface-3) !important;
    color: var(--portal-dark-text-2) !important;
    border-color: var(--portal-dark-border-3);
}

html[data-bs-theme="dark"] :is(.badge.badge-success, .badge-green) {
    background-color: var(--portal-dark-success-bg);
    color: var(--portal-dark-success-text);
    border-color: var(--portal-dark-border-3);
}

html[data-bs-theme="dark"] :is(.badge.badge-warning, .badge-amber) {
    background-color: var(--portal-dark-warning-bg);
    color: var(--portal-dark-warning-text);
    border-color: var(--portal-dark-border-3);
}

html[data-bs-theme="dark"] :is(.badge.badge-danger, .badge-red) {
    background-color: var(--portal-dark-danger-bg);
    color: var(--portal-dark-danger-text);
    border-color: var(--portal-dark-border-3);
}

html[data-bs-theme="dark"] :is(.badge-free, .badge-blue) {
    background-color: var(--portal-dark-accent-1);
    color: var(--portal-dark-accent-text);
    border-color: var(--portal-dark-border-3);
}

html[data-bs-theme="dark"] :is(.badge-pro, .badge-purple, .badge.bg-purple-lt) {
    background-color: var(--portal-dark-violet-bg) !important;
    color: var(--portal-dark-violet-text) !important;
    border-color: var(--portal-dark-border-3);
}

/* CRM lists have local table, statistics and pagination styles. */
html[data-bs-theme="dark"] body.crm-v2-crud {
    --crm-v2-primary: #006de0;
    --crm-v2-text-muted: var(--portal-dark-text-3);
}

html[data-bs-theme="dark"] body.crm-v2-crud :is(.content, .content-wrapper) {
    background: var(--portal-dark-canvas);
}

html[data-bs-theme="dark"] :is(.crm-card, .crm-stat-card, .crm-stat),
html[data-bs-theme="dark"] body.crm-v2-crud .controls-panel,
html[data-bs-theme="dark"] .crm-card .dataTables_wrapper > .row {
    background: var(--portal-dark-surface-1);
    border-color: var(--portal-dark-border-2);
}

html[data-bs-theme="dark"] .crm-table {
    --tblr-table-bg: var(--portal-dark-surface-1);
    --tblr-table-color: var(--portal-dark-text-1);
    --tblr-table-hover-bg: var(--portal-dark-surface-3);
}

html[data-bs-theme="dark"] .crm-table :is(th, td) {
    color: var(--portal-dark-text-1);
    border-color: var(--portal-dark-border-2);
}

html[data-bs-theme="dark"] .crm-table thead th {
    background-color: var(--portal-dark-surface-2);
}

html[data-bs-theme="dark"] .crm-table tbody tr:hover {
    background-color: var(--portal-dark-surface-3);
}

html[data-bs-theme="dark"] :is(.crm-stat-label, .crm-stat-lbl, .stg-ts-time, .stage-history-meta, .stage-history-start) {
    color: var(--portal-dark-text-3);
}

html[data-bs-theme="dark"] :is(.crm-stat-value, .crm-stat-val, .stg-ts-name) {
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] .crm-card :is(.student-name, .team-admin-name, .team-activity-title),
html[data-bs-theme="dark"] [data-country-row] .fw-semibold {
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] .crm-card :is(.team-date, .team-description) {
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] .select2-container .select2-selection .select2-selection__rendered {
    color: var(--portal-dark-text-1) !important;
}

html[data-bs-theme="dark"] body.crm-v2-crud .page-item:not(.active) .page-link,
html[data-bs-theme="dark"] :is(.criteria-pill, .team-route-code, .stage-history-pill.muted) {
    background: var(--portal-dark-surface-2);
    border-color: var(--portal-dark-border-3);
    color: var(--portal-dark-text-3);
}

html[data-bs-theme="dark"] body.crm-v2-crud .pagination-container {
    background: var(--portal-dark-surface-1);
    border-color: var(--portal-dark-border-2);
}

html[data-bs-theme="dark"] .stage-history-pill {
    background: var(--portal-dark-accent-1);
    color: var(--portal-dark-accent-text);
}

html[data-bs-theme="dark"] body.crm-v2-crud .stage-history-btn {
    background: var(--portal-dark-surface-3);
    border-color: var(--portal-dark-border-3);
    color: var(--portal-dark-text-2);
}

html[data-bs-theme="dark"] body :is(.form-control, .form-select):focus {
    border-color: var(--portal-dark-brand-text) !important;
}

html[data-bs-theme="dark"] body :is(.form-control, .form-select):disabled,
html[data-bs-theme="dark"] body .form-control[readonly] {
    background-color: var(--portal-dark-surface-3) !important;
    color: var(--portal-dark-text-3);
}

html[data-bs-theme="dark"] .feedback-category-pill {
    background: var(--portal-dark-violet-bg);
    color: var(--portal-dark-violet-text);
}

html[data-bs-theme="dark"] :is(.slide-table-shell, #course-drawer) {
    background: var(--portal-dark-surface-1);
    color: var(--portal-dark-text-1);
    border-color: var(--portal-dark-border-2);
}

html[data-bs-theme="dark"] .sub-user-name {
    color: var(--portal-dark-text-1) !important;
}

html[data-bs-theme="dark"] .sub-status-pill:not(.sub-status-pill--active, .sub-status-pill--expired) {
    background: var(--portal-dark-violet-bg) !important;
    color: var(--portal-dark-violet-text) !important;
}

html[data-bs-theme="dark"] .cp-head .status-tab.active {
    background: var(--portal-dark-accent-1);
    color: var(--portal-dark-accent-text);
}

html[data-bs-theme="dark"] .community-post-page :is(.chip, .from-cell .ico) {
    background: var(--portal-dark-accent-1);
    color: var(--portal-dark-accent-text);
}

html[data-bs-theme="dark"] .community-post-page :is(.from-cell, .date-cell) {
    color: var(--portal-dark-text-3);
}

html[data-bs-theme="dark"] .community-post-page .sp-pending {
    background: var(--portal-dark-warning-bg);
    color: var(--portal-dark-warning-text);
}

html[data-bs-theme="dark"] .community-post-page .sp-published {
    background: var(--portal-dark-success-bg);
    color: var(--portal-dark-success-text);
}

html[data-bs-theme="dark"] .community-post-page .sp-reject {
    background: var(--portal-dark-danger-bg);
    color: var(--portal-dark-danger-text);
}

html[data-bs-theme="dark"] :is(.activity-action-pill, .team-action-pill) {
    background: color-mix(in srgb, var(--activity-action-bg, #e0f2fe) 15%, var(--portal-dark-surface-1));
    color: color-mix(in srgb, var(--activity-action-color, #0369a1) 30%, var(--portal-dark-text-1));
}

/* Role assignment has custom inputs, comboboxes and staged role cards. */
html[data-bs-theme="dark"] .assign-role-studio :is(.role-card, .university-chip, .permission-group, .user-combobox__dropdown, .university-combobox__dropdown),
html[data-bs-theme="dark"] .assign-role-studio :is(.user-combobox, .role-filter, .partner-field, .university-combobox) :is(input, select) {
    background: var(--portal-dark-surface-1);
    border-color: var(--portal-dark-border-3);
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] .assign-role-studio .role-card.is-checked,
html[data-bs-theme="dark"] .assign-role-studio .university-result.is-selected {
    background: var(--portal-dark-accent-1);
    border-color: var(--portal-dark-brand-text);
}

/* Scholarship groups use a self-contained component set. */
html[data-bs-theme="dark"] .sg-page,
html[data-bs-theme="dark"] :is(.sg-title, .sg-name, .sg-breadcrumb strong, .sg-definition-list dd, .sg-mini-item, .sg-field label, .sg-modal-header h2) {
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] :is(.sg-topbar, .sg-card, .sg-modal-dialog, .sg-modal-actions) {
    background: var(--portal-dark-surface-1);
    border-color: var(--portal-dark-border-2);
}

html[data-bs-theme="dark"] :is(.sg-status, .sg-key, .sg-select, .sg-input, .sg-page-link, .sg-locked-input input),
html[data-bs-theme="dark"] :is(.sg-search, .sg-scholarship-search) input {
    background: var(--portal-dark-surface-2);
    border-color: var(--portal-dark-border-3);
    color: var(--portal-dark-text-2);
}

html[data-bs-theme="dark"] :is(.sg-subtitle, .sg-breadcrumb, .sg-show-label, .sg-stat span, .sg-field small, .sg-panel-heading p, .sg-definition-list dt, .sg-mini-item small, .sg-pagination-info, .sg-page-ellipsis, .sg-empty, .sg-modal-header p) {
    color: var(--portal-dark-text-3);
}

html[data-bs-theme="dark"] .sg-table th {
    background: var(--portal-dark-surface-2);
    color: var(--portal-dark-text-3);
}

html[data-bs-theme="dark"] .sg-table tbody tr:hover,
html[data-bs-theme="dark"] :is(.sg-page-link, .sg-mini-item, .sg-modal-close):hover {
    background: var(--portal-dark-surface-3);
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] :is(.sg-table td, .sg-pagination, .sg-advanced, .sg-mini-item, .sg-form-actions, .sg-modal-header, .sg-modal-actions, .sg-search-empty) {
    border-color: var(--portal-dark-border-2);
}

html[data-bs-theme="dark"] :is(.sg-count, .sg-modal-icon) {
    background: var(--portal-dark-accent-1);
    border-color: var(--portal-dark-accent-border);
    color: var(--portal-dark-accent-text);
}

html[data-bs-theme="dark"] :is(.sg-kicker, .sg-breadcrumb a, .sg-stat small) {
    color: var(--portal-dark-accent-text);
}

html[data-bs-theme="dark"] .sg-page-link.is-active {
    background: #006de0;
    border-color: #006de0;
    color: #fff;
}

html[data-bs-theme="dark"] .sg-page-link.is-disabled {
    background: var(--portal-dark-surface-1);
    color: var(--portal-dark-text-4);
}

html[data-bs-theme="dark"] .sg-error {
    background: var(--portal-dark-danger-bg);
    color: var(--portal-dark-danger-text);
    border-color: var(--portal-dark-border-3);
}

html[data-bs-theme="dark"] .sg-alert-success {
    background: var(--portal-dark-success-bg);
    color: var(--portal-dark-success-text);
    border-color: var(--portal-dark-border-3);
}

/* Applicant information and partner account forms/details. */
html[data-bs-theme="dark"] :is(.ai-avatar-placeholder, .ai-gender, .ai-section h4, .ai-card .btn-chat, .b2b-toggle, .b2b-role-row, .b2b-logo-wrap, .consult-muted-pill) {
    background: var(--portal-dark-surface-2);
    border-color: var(--portal-dark-border-3);
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] :is(.ai-list-item, .b2b-info-value) {
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] .detail-val {
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] .show-card a.fw-bold {
    color: var(--portal-dark-accent-text) !important;
}

html[data-bs-theme="dark"] :is(.b2b-card, .consult-card, .crm-detail-card, .show-card) {
    background: var(--portal-dark-surface-1);
    border-color: var(--portal-dark-border-2);
}

html[data-bs-theme="dark"] :is(.b2b-card-heading, .consult-card-header, .show-card-header, .detail-item, .team-code, .team-code-block) {
    background: var(--portal-dark-surface-2);
    border-color: var(--portal-dark-border-2);
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] :is(.consult-card-header h2, .consult-info-item strong, .consult-edit-label, .crm-detail-value) {
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] :is(.consult-section-kicker, .consult-info-item span, .b2b-card-heading p, .detail-lbl, .related-lbl) {
    color: var(--portal-dark-text-3);
}

html[data-bs-theme="dark"] :is(.b2b-info, .consult-edit-callout, .related-blue, .badge.text-bg-primary-subtle, .alert-info) {
    background: var(--portal-dark-accent-1);
    border-color: var(--portal-dark-accent-border);
    color: var(--portal-dark-accent-text);
}

html[data-bs-theme="dark"] :is(.b2b-existing, .related-green, .badge-teal, .badge.text-bg-success-subtle) {
    background: var(--portal-dark-success-bg);
    border-color: var(--portal-dark-border-3);
    color: var(--portal-dark-success-text);
}

html[data-bs-theme="dark"] :is(.badge-indigo, .badge.bg-blue-lt) {
    background: var(--portal-dark-accent-1) !important;
    color: var(--portal-dark-accent-text) !important;
    border-color: var(--portal-dark-border-3);
}

html[data-bs-theme="dark"] :is(.detail-val, .fee-summary-val)[style*="color"] {
    color: var(--portal-dark-text-1) !important;
}

html[data-bs-theme="dark"] .related-blue .related-num {
    color: var(--portal-dark-accent-text);
}

html[data-bs-theme="dark"] .related-green .related-num {
    color: var(--portal-dark-success-text);
}

html[data-bs-theme="dark"] .btn-show-white {
    background: var(--portal-dark-surface-3);
    border-color: var(--portal-dark-border-3);
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] #country_flag_container {
    background: var(--portal-dark-surface-2) !important;
    border-color: var(--portal-dark-border-3) !important;
}

html[data-bs-theme="dark"] .program-catalog-header h3 {
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] .help-block {
    color: var(--portal-dark-text-3);
}

html[data-bs-theme="dark"] :is(.slide-form-card, .slide-preview-shell, .shadcn-card) {
    background: var(--portal-dark-surface-1);
    border-color: var(--portal-dark-border-2);
}

html[data-bs-theme="dark"] :is(.slide-card-tabs, .slide-preview-image-link, .bg-slate-50, .bg-slate-100, .btn-outline-slate) {
    background: var(--portal-dark-surface-2);
    border-color: var(--portal-dark-border-3);
    color: var(--portal-dark-text-2);
}

html[data-bs-theme="dark"] .page-header:has(.group-icon-circle) {
    background: var(--portal-dark-canvas);
    color: var(--portal-dark-text-3);
}

html[data-bs-theme="dark"] .post-detail-page :is(.chip, .from-cell .ico) {
    background: var(--portal-dark-accent-1);
    color: var(--portal-dark-accent-text);
}

html[data-bs-theme="dark"] .post-detail-page .from-cell {
    color: var(--portal-dark-text-3);
}

html[data-bs-theme="dark"] .post-detail-page .sp-pending {
    background: var(--portal-dark-warning-bg);
    color: var(--portal-dark-warning-text);
}

html[data-bs-theme="dark"] .post-detail-page .sp-published {
    background: var(--portal-dark-success-bg);
    color: var(--portal-dark-success-text);
}

html[data-bs-theme="dark"] .post-detail-page .sp-reject {
    background: var(--portal-dark-danger-bg);
    color: var(--portal-dark-danger-text);
}

html[data-bs-theme="dark"] :is(.text-slate-900, .text-slate-800) {
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] :is(.text-slate-500, .text-slate-400, .shadcn-label) {
    color: var(--portal-dark-text-3);
}

html[data-bs-theme="dark"] .pc-btn-primary {
    background: #006de0;
    border-color: #006de0;
    color: #fff;
}

html[data-bs-theme="dark"] :is(.slide-form-card, .slide-card-tabs) :is(label, span),
html[data-bs-theme="dark"] .slide-card-tab {
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] .slide-image-preview img {
    background: var(--portal-dark-surface-2);
    border-color: var(--portal-dark-border-3);
}

html[data-bs-theme="dark"] .slide-table-shell tbody td {
    color: var(--portal-dark-text-2);
    border-color: var(--portal-dark-border-2);
}

html[data-bs-theme="dark"] .slide-table-shell thead th {
    background: var(--portal-dark-surface-2);
    color: var(--portal-dark-text-3);
    border-color: var(--portal-dark-border-2);
}

html[data-bs-theme="dark"] .slide-page-size-form span {
    color: var(--portal-dark-text-3);
}

html[data-bs-theme="dark"] .select2-container--bootstrap .select2-selection--multiple,
html[data-bs-theme="dark"] .select2-results__option:not(.select2-results__option--highlighted),
html[data-bs-theme="dark"] .select2-container .select2-dropdown .select2-search {
    background-color: var(--portal-dark-surface-1) !important;
}

html[data-bs-theme="dark"] .select2-selection__choice,
html[data-bs-theme="dark"] .select2-selection__choice .select2-selection__choice__remove {
    color: var(--portal-dark-text-1) !important;
}

html[data-bs-theme="dark"] .select2-selection__choice {
    background-color: var(--portal-dark-surface-3) !important;
    border-color: var(--portal-dark-border-3) !important;
}

html[data-bs-theme="dark"] .daterangepicker,
html[data-bs-theme="dark"] .daterangepicker .calendar-table,
html[data-bs-theme="dark"] .swal-modal,
html[data-bs-theme="dark"] .swal2-popup {
    background-color: var(--portal-dark-surface-1);
    border-color: var(--portal-dark-border-2);
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] .daterangepicker td.off {
    background-color: var(--portal-dark-surface-1);
    color: var(--portal-dark-text-5);
}

html[data-bs-theme="dark"] .daterangepicker td.active,
html[data-bs-theme="dark"] .daterangepicker td.active:hover,
html[data-bs-theme="dark"] .daterangepicker td.active.in-range,
html[data-bs-theme="dark"] .daterangepicker .calendar-table td.active,
html[data-bs-theme="dark"] .daterangepicker .calendar-table td.active:hover,
html[data-bs-theme="dark"] .daterangepicker .calendar-table td.active.in-range,
html[data-bs-theme="dark"] .daterangepicker .ranges li.active,
html[data-bs-theme="dark"] .daterangepicker .ranges li.active:hover {
    background-color: #006de0;
    color: #fff;
}

html[data-bs-theme="dark"] .daterangepicker .ranges li:not(.active) {
    color: var(--portal-dark-text-2);
}

html[data-bs-theme="dark"] .daterangepicker td.available:hover,
html[data-bs-theme="dark"] .daterangepicker th.available:hover,
html[data-bs-theme="dark"] .daterangepicker .ranges li:hover {
    background-color: var(--portal-dark-surface-3);
}

html[data-bs-theme="dark"] .daterangepicker td.in-range {
    background-color: var(--portal-dark-accent-1);
    color: var(--portal-dark-accent-text);
}

html[data-bs-theme="dark"] .daterangepicker .calendar-table .next span,
html[data-bs-theme="dark"] .daterangepicker .calendar-table .prev span {
    border-color: var(--portal-dark-text-3);
}

html[data-bs-theme="dark"] .swal-title,
html[data-bs-theme="dark"] .swal-text {
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] .swal-button--cancel {
    background-color: var(--portal-dark-surface-3);
}

html[data-bs-theme="dark"] .table-light {
    --tblr-table-color: var(--portal-dark-text-1);
    --tblr-table-bg: var(--portal-dark-surface-2);
    --tblr-table-border-color: var(--portal-dark-border-2);
    --tblr-table-striped-color: var(--portal-dark-text-1);
    --tblr-table-striped-bg: var(--portal-dark-surface-1);
    --tblr-table-active-color: var(--portal-dark-text-1);
    --tblr-table-active-bg: var(--portal-dark-surface-3);
    --tblr-table-hover-color: var(--portal-dark-text-1);
    --tblr-table-hover-bg: var(--portal-dark-surface-3);
}

html[data-bs-theme="dark"] .scholarship-card .text-primary,
html[data-bs-theme="dark"] .offcanvas .text-primary {
    color: var(--portal-dark-accent-text) !important;
}

html[data-bs-theme="dark"] .scholarship-card .badge.bg-success {
    background-color: var(--portal-dark-success-bg) !important;
    color: var(--portal-dark-success-text);
}

html[data-bs-theme="dark"] .scholarship-card .badge.bg-warning {
    background-color: var(--portal-dark-warning-bg) !important;
    color: var(--portal-dark-warning-text) !important;
}

html[data-bs-theme="dark"] .scholarship-card .badge.bg-info {
    background-color: var(--portal-dark-accent-1) !important;
    color: var(--portal-dark-accent-text) !important;
}

html[data-bs-theme="dark"] .scholarship-card .badge.bg-secondary {
    background-color: var(--portal-dark-surface-3) !important;
    color: var(--portal-dark-text-2);
}

html[data-bs-theme="dark"] .scholarship-card .scholarship-footer .text-danger {
    color: var(--portal-dark-danger-text) !important;
}

/* Application progress dialogs are moved to body when opened. */
html[data-bs-theme="dark"] :is(.apm-title, .apm-step-title, .apm-form label.form-label) {
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] :is(.apm-subtitle, .apm-step-desc) {
    color: var(--portal-dark-text-3);
}

html[data-bs-theme="dark"] .apm-preview {
    background: var(--portal-dark-surface-1);
    border-color: var(--portal-dark-border-3);
}

html[data-bs-theme="dark"] .apm-preview::-webkit-scrollbar-thumb {
    background: var(--portal-dark-surface-4);
}

html[data-bs-theme="dark"] :is(.apm-close, .apm-chip) {
    background: var(--portal-dark-surface-2);
    border-color: var(--portal-dark-border-3);
    color: var(--portal-dark-text-2);
}

html[data-bs-theme="dark"] :is(.apm-close, .apm-chip):hover {
    background: var(--portal-dark-surface-3);
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] :is(.apm-close, .apm-chip):focus-visible,
html[data-bs-theme="dark"] .apm-chip:focus-within {
    outline: 2px solid var(--portal-dark-brand-text);
    outline-offset: 2px;
}

html[data-bs-theme="dark"] .apm-form :is(.form-select, .form-control) {
    background-color: var(--portal-dark-surface-2);
    border-color: var(--portal-dark-border-3);
    color: var(--portal-dark-text-1);
}

html[data-bs-theme="dark"] .apm-form :is(.form-select, .form-control):focus {
    border-color: var(--portal-dark-brand-text);
}

html[data-bs-theme="dark"] :is(.apm-step, .ap-step)::before,
html[data-bs-theme="dark"] :is(.apm-step, .ap-step)::after {
    background: var(--portal-dark-border-3);
}

html[data-bs-theme="dark"] :is(.apm-step, .ap-step).is-complete::before,
html[data-bs-theme="dark"] :is(.apm-step, .ap-step).is-complete::after,
html[data-bs-theme="dark"] :is(.apm-step, .ap-step).is-active::before {
    background: var(--portal-dark-brand-text);
}

html[data-bs-theme="dark"] :is(.apm-dot, .ap-dot) {
    border-color: var(--portal-dark-surface-1);
}

html[data-bs-theme="dark"] :is(.apm-dot.active, .ap-dot.active) {
    box-shadow: 0 0 0 4px var(--portal-dark-accent-2);
}

html[data-bs-theme="dark"] :is(.apm-dot.completed, .ap-dot.done) {
    background: var(--portal-dark-surface-4);
    color: var(--portal-dark-text-2);
}

html[data-bs-theme="dark"] :is(.apm-dot.inactive, .ap-dot.todo) {
    background: var(--portal-dark-surface-3);
    color: var(--portal-dark-text-3);
}

html[data-bs-theme="dark"] :is(.ap-card, .apm-modal-content) .ap-note {
    color: var(--portal-dark-danger-text);
}

/* Record drawers (Application, Scholarship, Program, University): public/css/admin/detail-drawer.css. */
