/* ============================================================================================ */
/* DARK THEME: PAGE OVERRIDES                                                                    */
/* Colors in page <style> blocks that have no role token (off-palette pastels, legacy #333/#666  */
/* text). Pastel cards become tints over the dark surface; dim text is lifted.                  */
/*                                                                                               */
/* Prefer fixing a page by switching its <style> to role tokens (css/theme/tokens.css); add a   */
/* section here only for colors that are deliberately page-specific. One section per page,      */
/* named after its view file.                                                                    */
/* ============================================================================================ */

/* SHARED VENDOR LEFTOVERS USED BY SEVERAL PAGES --------------------------------------------- */
/* Pixel Admin: .table-light headers (contracting/report, reports/policy) */
html[data-theme="dark"] .table-light thead tr,
html[data-theme="dark"] .table-light thead th {
    background: var(--app-table-head-bg);
    color: var(--app-table-head-text);
}
html[data-theme="dark"] .table-light .table-header {
    border-color: var(--app-border) !important;
    color: var(--app-text-secondary);
}
/* Pixel Admin: dropzone (commissions/upload, commissions/uploadAgentWritingId) */
html[data-theme="dark"] .dz-default.dz-message,
html[data-theme="dark"] .dz-default.dz-message .dz-text-small {
    color: var(--app-text-secondary);
}
html[data-theme="dark"] .dz-default.dz-message .fa.fa-cloud-upload {
    background: var(--app-surface-3);
    color: var(--app-text-faint);
}
html[data-theme="dark"] .dropzone-box {
    border-color: var(--app-border-color-dark);
}
/* Legacy inline greys (style="color: #333" etc.), e.g. editCompensationDimension headings.     */
/* Matched with and without the space after the colon, since both spellings are in use.         */
html[data-theme="dark"] [style*="color:#333"]:not([style*="background"]),
html[data-theme="dark"] [style*="color: #333"]:not([style*="background"]) {
    color: var(--app-text-heading) !important;
}
html[data-theme="dark"] [style*="color:#555"]:not([style*="background"]),
html[data-theme="dark"] [style*="color: #555"]:not([style*="background"]) {
    color: var(--app-text-secondary) !important;
}
html[data-theme="dark"] [style*="color:#666"]:not([style*="background"]),
html[data-theme="dark"] [style*="color: #666"]:not([style*="background"]),
html[data-theme="dark"] [style*="color:#888"]:not([style*="background"]),
html[data-theme="dark"] [style*="color: #888"]:not([style*="background"]),
html[data-theme="dark"] [style*="color:#999"]:not([style*="background"]),
html[data-theme="dark"] [style*="color: #999"]:not([style*="background"]) {
    color: var(--app-text-muted) !important;
}
html[data-theme="dark"] hr[style*="#ccc"],
html[data-theme="dark"] hr[style*="#ddd"],
html[data-theme="dark"] hr[style*="#eee"] {
    border-color: var(--app-border) !important;
}
/* Modal headers painted with a brand/status fill keep white titles */
html[data-theme="dark"] .modal-header[class*="bg-"] .modal-title,
html[data-theme="dark"] .modal-header[class*="bg-"] .close {
    color: #ffffff;
}

/* reports/policyAuditor ---------------------------------------------------------------------- */
/* record-type families: policies = purple, records = teal, listings = blue */
html[data-theme="dark"] {
    --pa-policies-text: #b7a9e8;
    --pa-policies-bg: rgba(107, 92, 168, 0.20);
    --pa-policies-border: rgba(143, 124, 201, 0.60);
    --pa-records-text: #7fcbd8;
    --pa-records-bg: rgba(42, 127, 143, 0.20);
    --pa-records-border: rgba(76, 147, 162, 0.60);
    --pa-listings-text: #8cbfeb;
    --pa-listings-bg: rgba(53, 118, 173, 0.20);
    --pa-listings-border: rgba(91, 147, 196, 0.60);
}
html[data-theme="dark"] .auditor-stat-label {
    color: var(--app-text-secondary);
}
html[data-theme="dark"] .sort-section-policies,
html[data-theme="dark"] .results-level-chips .level-policies.active,
html[data-theme="dark"] .saved-search-badge.private,
html[data-theme="dark"] .saved-search-chip.zone-policies {
    background: var(--pa-policies-bg);
    border-color: var(--pa-policies-border);
}
html[data-theme="dark"] .sort-section-records,
html[data-theme="dark"] .results-level-chips .level-records.active,
html[data-theme="dark"] .saved-search-chip.zone-records {
    background: var(--pa-records-bg);
    border-color: var(--pa-records-border);
}
html[data-theme="dark"] .sort-section-listings,
html[data-theme="dark"] .results-level-chips .level-listings.active,
html[data-theme="dark"] .saved-search-badge.public,
html[data-theme="dark"] .saved-search-chip.zone-listings {
    background: var(--pa-listings-bg);
    border-color: var(--pa-listings-border);
}
html[data-theme="dark"] .sort-section-policies .sort-section-title,
html[data-theme="dark"] .card-annotation-policies,
html[data-theme="dark"] .results-level-chips .level-policies.active,
html[data-theme="dark"] .saved-search-badge.private,
html[data-theme="dark"] .saved-search-chip.zone-policies {
    color: var(--pa-policies-text);
}
html[data-theme="dark"] .sort-section-records .sort-section-title,
html[data-theme="dark"] .card-annotation-records,
html[data-theme="dark"] .results-level-chips .level-records.active,
html[data-theme="dark"] .saved-search-chip.zone-records {
    color: var(--pa-records-text);
}
html[data-theme="dark"] .sort-section-listings .sort-section-title,
html[data-theme="dark"] .results-level-chips .level-listings.active,
html[data-theme="dark"] .saved-search-badge.public,
html[data-theme="dark"] .saved-search-chip.zone-listings {
    color: var(--pa-listings-text);
}
html[data-theme="dark"] .sort-menu-intro,
html[data-theme="dark"] .payout-listing-card,
html[data-theme="dark"] .saved-search-row {
    border-bottom-color: var(--app-border-subtle);
}
html[data-theme="dark"] .results-export-btn.working {
    background-color: rgba(29, 111, 66, 0.25);
}
html[data-theme="dark"] .results-export-btn.working.capped {
    background-color: var(--app-tint-warning-bg);
    color: var(--app-tint-warning-text);
}
html[data-theme="dark"] .results-export-btn:disabled,
html[data-theme="dark"] .results-reprocess-btn:disabled,
html[data-theme="dark"] .pagination-btn:disabled,
html[data-theme="dark"] .modal-header-btn:disabled,
html[data-theme="dark"] .saved-search-vis-btn:disabled,
html[data-theme="dark"] .saved-search-action-btn:disabled {
    color: var(--app-text-faint);
}
html[data-theme="dark"] .filter-chip:hover {
    background: rgba(13, 110, 253, 0.2);
}
html[data-theme="dark"] .payout-listings-column,
html[data-theme="dark"] .payout-listings-column-header,
html[data-theme="dark"] .payout-listings-total {
    border-color: var(--app-border);
}
html[data-theme="dark"] .payout-listings-column.current .payout-listings-column-header,
html[data-theme="dark"] .payout-listings-column.current .payout-listings-total {
    background: rgba(198, 40, 40, 0.22);
    border-color: rgba(198, 40, 40, 0.5);
}
html[data-theme="dark"] .payout-listings-column.correct .payout-listings-column-header,
html[data-theme="dark"] .payout-listings-column.correct .payout-listings-total {
    background: rgba(46, 125, 50, 0.22);
    border-color: rgba(46, 125, 50, 0.5);
}
html[data-theme="dark"] .payout-listings-column.current .payout-listings-column-header {
    color: #f19a9a;
}
html[data-theme="dark"] .payout-listings-column.correct .payout-listings-column-header {
    color: #8fd19e;
}
html[data-theme="dark"] .reprocess-loading-overlay .loading-text {
    color: var(--app-text-heading);
}
html[data-theme="dark"] .reprocess-loading-overlay .loading-subtext {
    color: var(--app-text-muted);
}
html[data-theme="dark"] .close-modal-btn:hover {
    color: var(--app-text-strong);
}
html[data-theme="dark"] .action-preview-descriptive.blocked {
    color: var(--app-tint-danger-text);
}
html[data-theme="dark"] .auditor-totals-footer,
html[data-theme="dark"] .results-pagination {
    background: var(--app-surface-1);
}
html[data-theme="dark"] .auditor-tag-row.clickable:hover {
    background: var(--app-surface-3);
}
html[data-theme="dark"] .auditor-tag-row.filtering {
    background: rgba(53, 118, 173, 0.25);
}
html[data-theme="dark"] .auditor-agent-panel {
    background: var(--app-surface-2);
    border-color: var(--app-border);
    color: var(--app-text-secondary);
}
html[data-theme="dark"] .auditor-agent-amt {
    color: var(--app-text);
}
html[data-theme="dark"] .auditor-agent-more {
    border-top-color: var(--app-border);
}
html[data-theme="dark"] .agent-payout-table td,
html[data-theme="dark"] .msa-history-detail {
    border-color: var(--app-border-subtle);
}
html[data-theme="dark"] .manual-tag-input,
html[data-theme="dark"] .manual-tag-severity-select {
    background: var(--app-input-bg);
    border-color: var(--app-border-input);
    color: var(--app-text);
}
html[data-theme="dark"] .manual-tag-add-btn {
    background: #1477c4;
}
html[data-theme="dark"] .manual-tag-add-btn:disabled {
    background: var(--app-surface-4);
}
html[data-theme="dark"] .msa-history-table .msa-history-flagged td {
    background: rgba(224, 168, 0, 0.14);
}
/* the three record-type families: policies (purple), records (teal), listings (blue) */
html[data-theme="dark"] .stat-group-policies,
html[data-theme="dark"] .annotation-section-policies {
    background: rgba(107, 92, 168, 0.20);
    border-color: rgba(107, 92, 168, 0.55);
}
html[data-theme="dark"] .stat-group-records,
html[data-theme="dark"] .annotation-section-records {
    background: rgba(42, 127, 143, 0.20);
    border-color: rgba(42, 127, 143, 0.55);
}
html[data-theme="dark"] .stat-group-listings {
    background: rgba(53, 118, 173, 0.20);
    border-color: rgba(53, 118, 173, 0.55);
}
html[data-theme="dark"] .stat-group-policies .auditor-tags-empty,
html[data-theme="dark"] .stat-group-policies .auditor-tag-count,
html[data-theme="dark"] .annotation-section-policies .annotation-section-title,
html[data-theme="dark"] .sort-summary-policies {
    color: #b7a9e8;
}
html[data-theme="dark"] .stat-group-records .auditor-tags-empty,
html[data-theme="dark"] .stat-group-records .auditor-tag-count,
html[data-theme="dark"] .annotation-section-records .annotation-section-title,
html[data-theme="dark"] .sort-summary-records {
    color: #7fcbd8;
}
html[data-theme="dark"] .stat-group-listings .auditor-tags-empty,
html[data-theme="dark"] .stat-group-listings .auditor-tag-count,
html[data-theme="dark"] .sort-summary-listings {
    color: #8cbfeb;
}
html[data-theme="dark"] .policy-result-card {
    background: var(--app-surface-1);
    border-color: rgba(107, 92, 168, 0.45);
}
html[data-theme="dark"] .policy-result-card:hover {
    border-color: rgba(185, 167, 221, 0.75);
}
html[data-theme="dark"] .policy-result-masterid {
    background: rgba(107, 92, 168, 0.28);
    color: #c9bdf0;
}
html[data-theme="dark"] .record-result-card {
    background: rgba(42, 127, 143, 0.14);
    border-color: rgba(42, 127, 143, 0.45);
}
html[data-theme="dark"] .record-result-card .policy-result-masterid {
    background: rgba(42, 127, 143, 0.30);
    color: #8fd3df;
}
html[data-theme="dark"] .listing-result-card {
    background: rgba(53, 118, 173, 0.14);
    border-color: rgba(53, 118, 173, 0.45);
}
html[data-theme="dark"] .listing-result-card .policy-result-masterid {
    background: rgba(53, 118, 173, 0.30);
    color: #9ccaf0;
}
html[data-theme="dark"] .listing-result-card.context-row {
    background: var(--app-surface-1);
    border-color: var(--app-border);
}
html[data-theme="dark"] .record-result-card .policy-result-children,
html[data-theme="dark"] .policy-result-children {
    border-left-color: var(--app-border-color-dark);
}
html[data-theme="dark"] .policy-result-field-label,
html[data-theme="dark"] .name-prefix,
html[data-theme="dark"] .total-of,
html[data-theme="dark"] .results-export-cap {
    color: var(--app-text-muted);
}
html[data-theme="dark"] .results-tab {
    background: var(--app-surface-3);
    color: var(--app-text-muted);
}
html[data-theme="dark"] .results-tab:hover {
    background: var(--app-surface-4);
}
html[data-theme="dark"] .annotation-menu-intro {
    border-bottom-color: var(--app-border-subtle);
}
html[data-theme="dark"] .action-preview-descriptive {
    background: rgba(13, 110, 253, 0.12);
    border-color: rgba(13, 110, 253, 0.35);
}
html[data-theme="dark"] .action-preview-descriptive.blocked,
html[data-theme="dark"] .import-search-error {
    background: var(--app-tint-danger-bg);
    border-color: #72262f;
    color: var(--app-tint-danger-text);
}
html[data-theme="dark"] .saved-search-confirm {
    background: var(--app-tint-warning-bg);
    border-color: #6b5517;
}
html[data-theme="dark"] .import-search-footer-note,
html[data-theme="dark"] .saved-search-confirm,
html[data-theme="dark"] .saved-search-confirm span,
html[data-theme="dark"] .saved-search-row-confirm > span {
    color: var(--app-tint-warning-text);
}
html[data-theme="dark"] .search-loading-overlay {
    background: var(--app-surface-overlay);
}
html[data-theme="dark"] .loading-content .loading-text {
    color: var(--app-text-heading);
}
html[data-theme="dark"] .loading-content .loading-subtext {
    color: var(--app-text-muted);
}

/* reports/policyAuditorFilters (the "Search - ..." filter drawer on policyAuditor) ------------- */
html[data-theme="dark"] .filter-drawer-chips-row {
    background: var(--app-surface-1);
}
html[data-theme="dark"] .filter-drawer-column.policies-column {
    background: var(--pa-policies-bg);
}
html[data-theme="dark"] .filter-drawer-column.records-column {
    background: var(--pa-records-bg);
}
html[data-theme="dark"] .filter-drawer-column.listings-column {
    background: var(--pa-listings-bg);
}
html[data-theme="dark"] .filter-drawer-header-btn.primary,
html[data-theme="dark"] .filter-drawer-header-btn:hover:not(:disabled) {
    color: var(--app-link);
}
html[data-theme="dark"] .chips-zone-policies .filter-chip,
html[data-theme="dark"] .policies-column .date-shortcut-chip:disabled {
    background: var(--pa-policies-bg);
    border-color: var(--pa-policies-border);
    color: var(--pa-policies-text);
}
html[data-theme="dark"] .chips-zone-records .filter-chip,
html[data-theme="dark"] .records-column .outcome-filter-btn.active,
html[data-theme="dark"] .records-column .amount-cmp-btn.active {
    background: var(--pa-records-bg);
    border-color: var(--pa-records-border);
    color: var(--pa-records-text);
}
html[data-theme="dark"] .chips-zone-listings .filter-chip,
html[data-theme="dark"] .listings-column .amount-cmp-btn.active {
    background: var(--pa-listings-bg);
    border-color: var(--pa-listings-border);
    color: var(--pa-listings-text);
}
html[data-theme="dark"] .chips-zone-policies .filter-chip:hover {
    background: rgba(107, 92, 168, 0.32);
}
html[data-theme="dark"] .chips-zone-records .filter-chip:hover {
    background: rgba(42, 127, 143, 0.32);
}
html[data-theme="dark"] .chips-zone-listings .filter-chip:hover {
    background: rgba(53, 118, 173, 0.32);
}
html[data-theme="dark"] .chips-zone-policies .filter-chip-remove,
html[data-theme="dark"] .policies-column .filter-column-level-label,
html[data-theme="dark"] .policies-column .filter-btn.has-filters i.fa-caret-down {
    color: var(--pa-policies-text);
}
html[data-theme="dark"] .chips-zone-records .filter-chip-remove,
html[data-theme="dark"] .records-column .filter-column-level-label,
html[data-theme="dark"] .records-column .filter-btn.has-filters i.fa-caret-down {
    color: var(--pa-records-text);
}
html[data-theme="dark"] .chips-zone-listings .filter-chip-remove,
html[data-theme="dark"] .listings-column .filter-column-level-label,
html[data-theme="dark"] .listings-column .filter-btn.has-filters i.fa-caret-down,
html[data-theme="dark"] .listings-column .auto-tag-filter-action-btn,
html[data-theme="dark"] .tag-filter-clear-btn {
    color: var(--pa-listings-text);
}
html[data-theme="dark"] .records-column .filter-dropdown .filter-menu .form-switch {
    --switch-border-color: var(--pa-records-border);
    --switch-bg-color: var(--pa-records-bg);
}
html[data-theme="dark"] .policy-filter-drawer .policy-search-suggestion {
    border-bottom-color: var(--app-border-subtle);
}
html[data-theme="dark"] .tag-filter-manual-input {
    background: var(--app-input-bg);
    border-color: var(--app-border-input);
    color: var(--app-text);
}
html[data-theme="dark"] .filter-drawer-copied-popover {
    background: #e9ecef;
    color: #15181c;
}
html[data-theme="dark"] .filter-drawer-copied-popover::after {
    border-top-color: #e9ecef;
}

/* reports/tagSettingsModal ------------------------------------------------------------------- */
html[data-theme="dark"] .tag-settings-warning,
html[data-theme="dark"] .tag-settings-warning span {
    color: var(--app-tint-warning-text);
}

/* reports/policyAuditorHelpModal ------------------------------------------------------------- */
html[data-theme="dark"] .pah-card {
    border-color: var(--app-border);
}
html[data-theme="dark"] .pah-lv-p,
html[data-theme="dark"] .pah-nest-p,
html[data-theme="dark"] .pah-chip.on-p,
html[data-theme="dark"] .pah-match-key {
    background: var(--pa-policies-bg);
    border-color: var(--pa-policies-border);
}
html[data-theme="dark"] .pah-lv-r,
html[data-theme="dark"] .pah-nest-r,
html[data-theme="dark"] .pah-chip.on-r {
    background: var(--pa-records-bg);
    border-color: var(--pa-records-border);
}
html[data-theme="dark"] .pah-lv-l,
html[data-theme="dark"] .pah-nest-l,
html[data-theme="dark"] .pah-chip.on-l,
html[data-theme="dark"] .pah-fake-row {
    background: var(--pa-listings-bg);
    border-color: var(--pa-listings-border);
}
html[data-theme="dark"] .pah-lv-p,
html[data-theme="dark"] .pah-nest-p .pah-nest-name,
html[data-theme="dark"] .pah-chip.on-p,
html[data-theme="dark"] .pah-match-key-name {
    color: var(--pa-policies-text);
}
html[data-theme="dark"] .pah-lv-r,
html[data-theme="dark"] .pah-nest-r .pah-nest-name,
html[data-theme="dark"] .pah-chip.on-r {
    color: var(--pa-records-text);
}
html[data-theme="dark"] .pah-lv-l,
html[data-theme="dark"] .pah-nest-l .pah-nest-name,
html[data-theme="dark"] .pah-chip.on-l,
html[data-theme="dark"] .pah-fake-row {
    color: var(--pa-listings-text);
}
html[data-theme="dark"] .pah-key-row {
    border-bottom-color: var(--app-border-subtle);
}
html[data-theme="dark"] .pah-note {
    background: var(--app-tint-warning-bg);
    border-color: #6b5517;
    color: var(--app-tint-warning-text);
}

/* management/policyproductmanagement/policyProductManagement --------------------------------- */
html[data-theme="dark"] .policy-product-card,
html[data-theme="dark"] .policy-products-container,
html[data-theme="dark"] .durations-container,
html[data-theme="dark"] .comp-dim-cards-container,
html[data-theme="dark"] .card-menu,
html[data-theme="dark"] .sort-menu,
html[data-theme="dark"] .sort-menu-header,
html[data-theme="dark"] .calc-hierarchy-list,
html[data-theme="dark"] .calc-hierarchy-item,
html[data-theme="dark"] .calc-summary-box,
html[data-theme="dark"] .card-menu-item,
html[data-theme="dark"] .aep-modal-header,
html[data-theme="dark"] .aep-modal-footer {
    border-color: var(--app-border);
}
html[data-theme="dark"] .card-menu,
html[data-theme="dark"] .sort-menu {
    background-color: var(--app-surface);
}
html[data-theme="dark"] .policy-product-card:hover,
html[data-theme="dark"] .card-menu-item:hover,
html[data-theme="dark"] .sort-menu-item:hover {
    background-color: var(--app-surface-3);
}
html[data-theme="dark"] .card-menu-btn,
html[data-theme="dark"] .settings-gear-btn,
html[data-theme="dark"] .search-wrapper .search-icon,
html[data-theme="dark"] .search-wrapper .clear-search,
html[data-theme="dark"] .policy-product-card .tags-expand-btn,
html[data-theme="dark"] .calc-hierarchy-number,
html[data-theme="dark"] .calc-writing-label,
html[data-theme="dark"] .calc-summary-label,
html[data-theme="dark"] .aep-modal-close {
    color: var(--app-text-muted);
}
html[data-theme="dark"] .card-menu-btn:hover,
html[data-theme="dark"] .search-wrapper .clear-search:hover,
html[data-theme="dark"] .aep-modal-close:hover {
    color: var(--app-text-strong);
}
html[data-theme="dark"] .card-menu-item.edit,
html[data-theme="dark"] .sort-menu-item i,
html[data-theme="dark"] .calc-hierarchy-item.calc-writing-agent .calc-writing-label {
    color: var(--app-link);
}
html[data-theme="dark"] .calc-hierarchy-list {
    background: var(--app-surface-1);
}
html[data-theme="dark"] .calc-hierarchy-item.calc-writing-agent {
    background-color: rgba(51, 122, 183, 0.20);
}
html[data-theme="dark"] .calc-summary-gross {
    background: rgba(91, 192, 222, 0.14);
}
html[data-theme="dark"] .calc-summary-paid {
    background: rgba(92, 184, 92, 0.14);
}
html[data-theme="dark"] .calc-summary-remaining {
    background: rgba(240, 173, 78, 0.14);
}
html[data-theme="dark"] .calc-summary-remaining-warning {
    background: var(--app-tint-danger-bg);
    color: var(--app-tint-danger-text);
}
html[data-theme="dark"] .policy-products-scroll::-webkit-scrollbar-track {
    background: var(--app-surface-2);
}
html[data-theme="dark"] .policy-products-scroll::-webkit-scrollbar-thumb {
    background: var(--app-border-color-dark);
}

/* common/compensationDimensionsTable (Compensation Dimensions on policyProductManagement) ----- */
html[data-theme="dark"] .comp-dim-paytype-tabs {
    border-bottom-color: var(--app-border);
}
html[data-theme="dark"] .comp-dim-paytype-tab {
    color: var(--app-text-muted);
}
html[data-theme="dark"] .comp-dim-paytype-tab:hover {
    background: var(--app-surface-2);
    color: var(--app-text-strong);
}
html[data-theme="dark"] .comp-dim-paytype-tab.active {
    background: var(--app-surface);
    border-color: var(--app-border);
    border-bottom-color: var(--app-surface);
    color: var(--app-link);
}
html[data-theme="dark"] .comp-dim-rank-group {
    background: var(--app-surface-1);
    border-color: var(--app-border);
}
html[data-theme="dark"] .comp-dim-rank-group-header {
    background: var(--app-surface-2);
    border-bottom-color: var(--app-border);
    color: var(--app-text);
}
html[data-theme="dark"] .comp-dim-card:not(.selected) {
    border-color: var(--app-border);
    color: var(--app-text);
}
html[data-theme="dark"] .comp-dim-card:not(.readonly-card):not(.selected):hover {
    background-color: var(--app-surface-3);
    box-shadow: 0 2px 4px var(--app-shadow-color);
}
html[data-theme="dark"] .comp-dim-card:not(.selected) .comp-dim-card-header.has-body,
html[data-theme="dark"] .comp-dim-card:not(.selected) .comp-dim-durations {
    border-color: var(--app-border-subtle);
}
html[data-theme="dark"] .comp-dim-card:not(.selected) .comp-dim-comp-type,
html[data-theme="dark"] .comp-dim-card:not(.selected) .comp-dim-label,
html[data-theme="dark"] .comp-dim-card:not(.selected) .comp-dim-id-tag,
html[data-theme="dark"] .comp-dim-empty,
html[data-theme="dark"] .comp-dim-loading {
    color: var(--app-text-muted);
}
html[data-theme="dark"] .comp-dim-card.hidden-card:not(.selected) {
    background-color: var(--app-surface-1);
}
html[data-theme="dark"] .comp-dim-card.hidden-card:not(.selected),
html[data-theme="dark"] .comp-dim-card.hidden-card:not(.selected) .comp-dim-value,
html[data-theme="dark"] .comp-dim-card.hidden-card:not(.selected) .comp-dim-comp-type,
html[data-theme="dark"] .comp-dim-card.hidden-card:not(.selected) .comp-dim-label {
    color: var(--app-text-faint);
}
html[data-theme="dark"] .comp-dim-card.hidden-card:not(.selected):hover {
    background-color: var(--app-surface-3);
    color: var(--app-text-secondary);
}
html[data-theme="dark"] .comp-dim-hidden-toggle {
    color: var(--app-link);
}
html[data-theme="dark"] .comp-dim-hidden-placeholder {
    background: var(--app-surface-1);
    border-color: var(--app-border-color-dark);
    color: var(--app-text-muted);
}

/* common/reprocesserModal (policyAuditor, commission pages) ---------------------------------- */
/* payout-listings-* columns are covered by the policyAuditor rules above */
html[data-theme="dark"] .reprocesser-modal .date-chip-popover-footer,
html[data-theme="dark"] .reprocesser-modal .payout-listing-card,
html[data-theme="dark"] .reprocesser-modal .payout-discrepancy-table-row,
html[data-theme="dark"] .reprocesser-modal .cluster-member-row,
html[data-theme="dark"] .reprocesser-modal .cluster-members-title,
html[data-theme="dark"] .reprocesser-modal .cluster-members-block {
    border-color: var(--app-border-subtle);
}
html[data-theme="dark"] .reprocesser-modal .filter-chip.applied:hover {
    background: rgba(13, 110, 253, 0.2);
}
html[data-theme="dark"] .reprocesser-modal .filter-chip.applied,
html[data-theme="dark"] .reprocesser-modal .filter-chip-remove,
html[data-theme="dark"] .reprocesser-modal .filter-chip-label {
    color: var(--app-link);
}
html[data-theme="dark"] .reprocesser-modal .auto-refresh-pill {
    background: var(--app-tint-warning-bg);
    border-color: #6b5517;
    color: var(--app-tint-warning-text);
}
html[data-theme="dark"] .reprocesser-modal .auto-refresh-resume {
    color: #ffb366;
}
html[data-theme="dark"] .reprocesser-modal .payout-discrepancy-section,
html[data-theme="dark"] .reprocesser-modal .reprocesser-seed-error {
    background: var(--app-tint-danger-bg);
    border-color: #72262f;
}
html[data-theme="dark"] .reprocesser-modal .reprocesser-seed-error,
html[data-theme="dark"] .reprocesser-modal .payout-discrepancy-header {
    color: var(--app-tint-danger-text);
}
html[data-theme="dark"] .reprocesser-modal .reprocesser-precheck-message {
    background: var(--app-tint-info-bg);
    border-color: #1b4a78;
    color: var(--app-tint-info-text);
}
html[data-theme="dark"] .reprocesser-modal .cluster-blast-badge,
html[data-theme="dark"] .reprocesser-modal .member-badge.out-filter {
    border-color: #6b5517;
    color: var(--app-tint-warning-text);
}
html[data-theme="dark"] .reprocesser-modal .member-badge.in-filter {
    background: var(--app-tint-success-bg);
    border-color: #1f5a40;
    color: var(--app-tint-success-text);
}

/* common/reprocessHistoryModal --------------------------------------------------------------- */
html[data-theme="dark"] .reprocess-history-modal .rch-table td {
    border-bottom-color: var(--app-border-subtle);
}
html[data-theme="dark"] .reprocess-history-modal .rch-event-row.is-open {
    background: var(--app-surface-2);
}
html[data-theme="dark"] .reprocess-history-modal .rch-detail-cell {
    background: var(--app-surface-1);
    color: var(--app-text);
}
html[data-theme="dark"] .reprocess-history-modal .rch-json {
    background: var(--app-input-bg);
    border-color: var(--app-border);
    color: var(--app-text);
}
html[data-theme="dark"] .reprocess-history-modal .rch-badge.rch-queued {
    color: var(--app-tint-warning-text);
}
html[data-theme="dark"] .reprocess-history-modal .rch-negative {
    color: #ef8a80;
}

/* admin/contacts/candidatesForMerge (contactManagement) -------------------------------------- */
html[data-theme="dark"] .candidate-group {
    background-color: var(--app-surface-1);
    border-color: var(--app-border);
}
html[data-theme="dark"] .candidate-contact-card {
    border-color: var(--app-border);
}
html[data-theme="dark"] .candidate-detail-label,
html[data-theme="dark"] .no-candidates-message,
html[data-theme="dark"] .loading-spinner p,
html[data-theme="dark"] .pagination-controls .page-ellipsis {
    color: var(--app-text-muted);
}
html[data-theme="dark"] .candidate-detail-value,
html[data-theme="dark"] .merge-loading-overlay .loading-text {
    color: var(--app-text);
}
html[data-theme="dark"] .candidate-detail-label.conflict {
    background-color: var(--app-tint-warning-bg);
    border-color: #6b5517;
    color: var(--app-tint-warning-text);
}
html[data-theme="dark"] .error-message {
    background-color: var(--app-tint-danger-bg);
    border-color: #72262f;
    color: var(--app-tint-danger-text);
}
html[data-theme="dark"] .results-info {
    background-color: var(--app-tint-info-bg);
    border-color: #1b4a78;
    color: var(--app-tint-info-text);
}
html[data-theme="dark"] .pagination-controls .page-number {
    border-color: var(--app-border-color-dark);
    color: var(--app-text);
}
html[data-theme="dark"] .pagination-controls .page-number:hover {
    background-color: var(--app-surface-3);
    border-color: var(--app-text-secondary);
}
html[data-theme="dark"] .pagination-controls .page-number.active {
    background-color: var(--app-color-primary);
    border-color: var(--app-color-primary);
    color: var(--app-text-on-color);
}
html[data-theme="dark"] .merge-loading-overlay {
    background-color: var(--app-surface-overlay);
}

/* admin/contacts/fixContacts: inline-styled loading veil ------------------------------------ */
html[data-theme="dark"] .fix-contacts-container > [style*="rgba(255, 255, 255, 0.95)"] {
    background: rgba(21, 24, 28, 0.95) !important;
}

/* paywall/paywall, agentDebtPaywall: the card-back image stays light, so keep its field dark-on-light */
html[data-theme="dark"] .credit-card-back input.ccv-code {
    color: #000000;
}
html[data-theme="dark"] .secure {
    background: var(--app-surface-2);
    color: var(--app-text);
}
html[data-theme="dark"] h1[style*="color:darkgreen"] {
    color: #75b798 !important;
}

/* carrier/carrierManagement ------------------------------------------------------------------ */
html[data-theme="dark"] .carrier-card {
    border-color: var(--app-border);
}
html[data-theme="dark"] .alias-chip,
html[data-theme="dark"] .state-chip {
    background-color: rgba(21, 101, 192, 0.25);
    border-color: rgba(21, 101, 192, 0.55);
    color: #9ccaf0;
}
html[data-theme="dark"] .alias-chip .alias-actions i,
html[data-theme="dark"] .state-chip .state-actions i,
html[data-theme="dark"] .no-aliases-text,
html[data-theme="dark"] .no-states-text {
    color: var(--app-text-muted);
}

/* hierarchy/downlineAggregate ---------------------------------------------------------------- */
html[data-theme="dark"] .downline-agg-rank-group {
    background: var(--app-surface-1);
}
html[data-theme="dark"] .downline-agg-rank-group-header {
    border-bottom-color: var(--app-border);
}
html[data-theme="dark"] .downline-agg-date-note {
    border-top-color: var(--app-border-subtle);
}
html[data-theme="dark"] .downline-agg-kpi-total {
    border-top-color: var(--app-text-secondary);
}
html[data-theme="dark"] .downline-agg-type-card-payout,
html[data-theme="dark"] .downline-agg-rank-group-total {
    color: #75b798;
}
html[data-theme="dark"] .downline-agg-filter-btn {
    --btn-bg-color: var(--app-surface);
    --btn-bg-color-active: var(--app-surface-3);
    --btn-color: var(--app-text-secondary);
    --btn-color-active: var(--app-text-strong);
    --btn-border-color: var(--app-border);
    --btn-border-color-active: var(--app-border-color-dark);
}
html[data-theme="dark"] .downline-agg-filter-btn.has-filters {
    --btn-color: var(--app-link);
    --btn-color-active: var(--app-link);
    --btn-border-color: var(--app-link);
    --btn-border-color-active: var(--app-link);
}

/* commissions/UnmatchedCommissions ----------------------------------------------------------- */
html[data-theme="dark"] .action-dropdown-menu li button:hover {
    background: var(--app-surface-3);
    color: var(--app-text-strong);
}
html[data-theme="dark"] .commission-reason-banner {
    background: var(--app-notice-bg);
    color: var(--app-tint-warning-text);
}
html[data-theme="dark"] .commission-reason-banner .reason-label {
    color: #e0b84c;
}
html[data-theme="dark"] .commission-accordion-body {
    background: var(--app-surface-1);
}
/* the "clear" link is inline-styled #c0392b (its #666 captions are covered by the shared rule) */
html[data-theme="dark"] [style*="color:#c0392b"]:not([style*="background"]) {
    color: #ef8a80 !important;
}

/* commissions/commissions: the Filters menu (#commissionFilterDropdownPanel, built in           */
/* commissions.js). Its surface and text are role tokens; the inline #ccc border, #eee dividers  */
/* and light shadow are lifted here.                                                             */
html[data-theme="dark"] #commissionFilterDropdownPanel {
    border-color: var(--app-border-input) !important;
    box-shadow: 0 0.25rem 0.75rem var(--app-shadow-color) !important;
}
html[data-theme="dark"] #commissionFilterDropdownPanel > div[style*="border-top"] {
    border-top-color: var(--app-border) !important;
}
/* the shortcut chip for the range in force is disabled; its light-blue pill becomes a dark tint */
html[data-theme="dark"] #commissionFilterDropdownPanel .date-shortcut-chip:disabled {
    border-color: var(--app-link);
    color: var(--app-tint-info-text);
}

/* commissions/UnmatchedCommissions: the Filters menu (#filterDropdownPanel). Surface is already */
/* a role token; the inline #ccc border, #eee dividers and light shadow are lifted here.         */
html[data-theme="dark"] #filterDropdownPanel {
    border-color: var(--app-border-input) !important;
    box-shadow: 0 0.25rem 0.75rem var(--app-shadow-color) !important;
}
html[data-theme="dark"] #filterDropdownPanel div[style*="border-top"] {
    border-top-color: var(--app-border) !important;
}

/* reports/commissionChangeAudit -------------------------------------------------------------- */
html[data-theme="dark"] .cca-table td {
    border-bottom-color: var(--app-border-subtle);
}
html[data-theme="dark"] .cca-table tbody tr:hover {
    background: var(--app-surface-2);
}
html[data-theme="dark"] .cca-badge.cca-queued {
    color: var(--app-tint-warning-text);
}

/* SHARED STATUS TEXT: the dark reds/greens pages use for +/- amounts, lifted for contrast ---- */
html[data-theme="dark"] .auditor-agent-amt.negative,
html[data-theme="dark"] .auditor-stat-value.negative,
html[data-theme="dark"] .agent-payout-table td.negative,
html[data-theme="dark"] .downline-agg-rank-group-total.negative,
html[data-theme="dark"] .downline-agg-rank-card-amt.negative,
html[data-theme="dark"] .cca-negative {
    color: #ef8a80;
}
html[data-theme="dark"] .cca-positive {
    color: #75b798;
}
