/* Central theme tokens; dark overrides are screen-only so printing stays light. */
:root { --yzs-canvas: #f7f4f8; --yzs-surface: #fff; --yzs-raised: #f6f1f7; --yzs-text: #28182c; --yzs-muted: #746877; --yzs-line: #e9e2ea; --yzs-accent: #98217e; }
@media screen {
    html[data-theme=dark] { color-scheme: dark; --yzs-canvas: #14121b; --yzs-surface: #201c29; --yzs-raised: #2a2435; --yzs-text: #eee8f2; --yzs-muted: #b6aabd; --yzs-line: #40354a; --yzs-accent: #e096d2; --crm-canvas: var(--yzs-canvas); --crm-ink: var(--yzs-text); --crm-muted: var(--yzs-muted); --crm-line: var(--yzs-line); --canvas: var(--yzs-canvas); --surface: var(--yzs-surface); --navy: var(--yzs-text); --muted: var(--yzs-muted); --line: var(--yzs-line); }
    html[data-theme=dark] body,
    html[data-theme=dark] .pcoded-main-container { background: var(--yzs-canvas) !important; color: var(--yzs-text) !important; }
    html[data-theme=dark] .pcoded-content { color: var(--yzs-text); }
    html[data-theme=dark] :is(.card,.card-header,.card-body,.card-footer,.modal-content,.modal-header,.modal-footer,.dropdown-menu,.profile-notification,.crm-logout-dialog,.crm-footer,.deposit-list-card,.deposit-list-card-header,.deposit-list-hero,.deposit-list-hero-status,.stock-tabs,.du-card,.du-card-header,.du-hero,.customer-form-card,.customer-form-hero,.settings-card,.login-card-surface,.brand-panel,.mobile-brand,.login-footer,.crm-loader-content,.choices__inner,.select2-dropdown) { background: var(--yzs-surface) !important; border-color: var(--yzs-line) !important; color: var(--yzs-text) !important; }
    html[data-theme=dark] :is(.deposit-list-page,.deposit-update-page,.customer-form-page,.add-sales-page,.sales-workspace-page,.settings-page) { color: var(--yzs-text) !important; }
    html[data-theme=dark] :is(.pcoded-content,.modal-content,.crm-logout-dialog,.login-shell,.crm-footer,.profile-notification) :is(h1,h2,h3,h4,h5,h6,label,legend) { color: var(--yzs-text) !important; }
    html[data-theme=dark] :is(.deposit-list-hero p,.deposit-list-hero-status small,.deposit-list-card-title small,.du-hero p,.du-eyebrow,.customer-form-hero p,.intro,.brand-copy p,.security-note,.crm-logout-dialog p,.crm-footer-links,.dataTables_info,.dataTables_length,.dataTables_filter) { color: var(--yzs-muted) !important; }
    html[data-theme=dark] :is(.deposit-list-hero-status strong,.crm-loader-content strong,.crm-user-role,.crm-footer a,.dropdown-item,.pro-body a) { color: var(--yzs-text) !important; }
    html[data-theme=dark] .dropdown-item:hover { background: var(--yzs-raised) !important; }
    html[data-theme=dark] .pcoded-content :is(.bg-white,.bg-light) { background: var(--yzs-surface) !important; }
    html[data-theme=dark] :is(.pcoded-content,.modal-content,.login-shell) :is(input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]):not([type=hidden]),select,textarea,.form-control,.form-select,.select2-selection) { background: var(--yzs-canvas) !important; color: var(--yzs-text) !important; border-color: var(--yzs-line) !important; }
    html[data-theme=dark] input::placeholder,html[data-theme=dark] textarea::placeholder { color: #a395ad !important; opacity: 1; }
    html[data-theme=dark] :is(.deposit-list-toolbar .dt-button,.deposit-list-daterange button,.deposit-icon-button,.crm-preference-button,.toggle-password,.send-code,.crm-logout-cancel,.page-link) { background: var(--yzs-raised) !important; color: var(--yzs-text) !important; border-color: var(--yzs-line) !important; }
    html[data-theme=dark] :is(table.deposit-list-table,.pcoded-content table,.modal-content table) { --bs-table-bg: var(--yzs-surface); --bs-table-color: var(--yzs-text); --bs-table-border-color: var(--yzs-line); --bs-table-striped-bg: var(--yzs-raised); --bs-table-striped-color: var(--yzs-text); --bs-table-hover-bg: var(--yzs-raised); --bs-table-hover-color: var(--yzs-text); color: var(--yzs-text) !important; }
    html[data-theme=dark] :is(.pcoded-content,.modal-content) table :is(th,td) { background: var(--yzs-surface) !important; color: var(--yzs-text) !important; border-color: var(--yzs-line) !important; }
    html[data-theme=dark] :is(.pcoded-content,.modal-content) table :is(thead,tfoot) :is(th,td) { background: var(--yzs-raised) !important; }
    html[data-theme=dark] .pcoded-content table tbody tr:hover td { background: var(--yzs-raised) !important; }
    html[data-theme=dark] .pcoded-content :is(.text-muted,.text-secondary) { color: var(--yzs-muted) !important; }
    html[data-theme=dark] .pcoded-content :is(.text-dark,.text-black) { color: var(--yzs-text) !important; }
    html[data-theme=dark] :is(.stock-tabs a:not(.active),.deposit-list-eyebrow,.deposit-list-card-title small,.deposit-receipt,.deposit-branch) { color: var(--yzs-accent) !important; }
    html[data-theme=dark] :is(.deposit-icon-danger,.text-danger,.field-error) { color: #ff9cac !important; }
    html[data-theme=dark] :is(.notice-error,.report-load-error,.appointment-load-error,.deposit-list-alert-error) { background: #3b2330 !important; border-color: #704052 !important; color: #ffafbc !important; }
    html[data-theme=dark] :is(.notice-success,.deposit-list-alert-success) { background: #19382d !important; border-color: #315b49 !important; color: #a0dfc0 !important; }
    html[data-theme=dark] :is(.login-tabs,.pro-head) { background: var(--yzs-raised) !important; }
    html[data-theme=dark] .login-tab { color: var(--yzs-muted) !important; }
    html[data-theme=dark] .login-tab[aria-pressed=true] { background: #56324f !important; color: #fff !important; }
    html[data-theme=dark] :is(.forgot-link,.back-link a,.brand-copy h1 span,.brand-footer,.login-footer,.crm-loader-caption,.mobile-brand-tag) { color: var(--yzs-accent) !important; }
    html[data-theme=dark] .crm-page-loader { background: rgba(20,18,27,.94) !important; }
    html[data-theme=dark] .crm-preference-button:hover { background: #48334a !important; }

    html[data-theme=dark] .deposit-list-table-shell { scrollbar-color: #67536f var(--yzs-canvas); }
    html[data-theme=dark] :is(.analytics-card,.arp-card,.arp-chart-panel,.arp-hero,.branch-card,.branch-card-body,.branch-card-header,.branch-form-card,.branch-hero,.chart-card,.crm-activity-card,.crm-activity-range-panel,.crm-activity-summary,.crm-chart-panel,.crm-compact-panel,.crm-customer-section,.crm-glass-panel,.crm-sales-panel,.crm-stat-card,.crm-table-panel,.crm-unavailable-card,.crm-yearly-panel,.customer-form-card,.customer-form-hero,.customer-form-toolbar,.deposit-list-card,.deposit-list-card-header,.deposit-list-hero,.deposit-list-toolbar,.deposit-processing-card,.du-card,.du-card-body,.du-card-header,.du-hero,.filter-panel,.filter-section,.form-list-hero,.invoice-card,.invoice-card-body,.invoice-card-header,.invoice-filter-toolbar,.invoice-hero,.invoice-range-panel,.matrix-card,.members-card,.members-card-header,.members-hero,.members-processing-card,.members-toolbar,.profile-identity-card,.report-hero,.report-table-toolbar,.role-access-card,.role-form-card,.role-form-hero,.role-matrix-card,.role-matrix-card-header,.role-matrix-hero,.roles-card,.roles-card-body,.roles-card-header,.roles-hero,.sales-customer-summary,.sales-directory-card,.sales-entry-card,.sales-entry-card-body,.sales-entry-card-header,.sales-entry-hero,.sales-items-section,.sales-items-toolbar,.sales-payment-panel,.sales-total-panel,.sales-trend-card,.sales-workspace-card,.service-list-card,.service-list-card-body,.service-list-card-header,.service-list-hero,.service-report-card,.service-report-card-body,.service-report-card-header,.service-report-form-card,.service-report-hero,.service-report-view-card,.settings-card,.settings-hero,.summary-card,.table-card,.terms-card,.widget-visitor-card) { background: var(--yzs-surface) !important; border-color: var(--yzs-line) !important; color: var(--yzs-text) !important; }
    html[data-theme=dark] .pcoded-content :is(.arp-card-title,.branch-card-title,.branch-name,.card-heading,.chart-title,.consultant-name,.crm-brand-label,.crm-brand-name,.crm-chart-label,.crm-customer-title,.crm-dashboard-heading,.crm-echart-name,.crm-glass-value,.crm-panel-title,.crm-user-name,.crm-yearly-title,.customer-name,.customer-section-heading,.dcol-name,.deposit-list-card-title,.deposit-loading-title,.filter-heading,.filter-label,.filter-title,.form-label,.invoice-card-title,.invoice-void-title,.members-card-title,.members-loading-title,.modal-title,.roles-card-title,.sales-directory-heading,.sales-directory-title,.sales-entry-title,.sales-items-card-heading,.sales-items-card-title,.sales-panel-heading,.sales-payment-ledger-label,.sales-trend-heading,.sales-workspace-title,.service-list-card-title,.service-report-card-title,.settings-card-heading) { color: var(--yzs-text) !important; }

    html[data-theme=dark] .crm-quick-actions { background: var(--yzs-surface) !important; }
    html[data-theme=dark] .crm-quick-actions .crm-action { background: var(--yzs-raised) !important; border-color: var(--yzs-line) !important; color: var(--yzs-text) !important; }
    html[data-theme=dark] .crm-quick-actions .crm-action-primary { background: #70265f !important; color: #fff !important; }

    html[data-theme=dark] .pcoded-header.header-blue { background: rgba(28,24,35,.96) !important; border-bottom-color: #40354a; box-shadow: 0 8px 24px rgba(0,0,0,.16); }
    html[data-theme=dark] .pcoded-header .crm-language-nav { border-right-color: #42364b; }
    html[data-theme=dark] .pcoded-header .crm-preference-button { background: #302738 !important; color: #dac7e3 !important; border-color: transparent !important; }
    html[data-theme=dark] .pcoded-header .crm-preference-button:hover { background: #493451 !important; color: #f6e7fa !important; }
    html[data-theme=dark] .pcoded-header .dropdown .crm-user-trigger { background: #28212f !important; border-color: #403348 !important; color: #eee5f3 !important; }
    html[data-theme=dark] .pcoded-header .dropdown .crm-user-trigger:hover,html[data-theme=dark] .pcoded-header .dropdown .crm-user-trigger[aria-expanded=true] { background: #372a3f !important; border-color: #624d6e !important; }
    html[data-theme=dark] .pcoded-header .crm-user-name { color: #eee5f3 !important; }
    html[data-theme=dark] .pcoded-header .crm-user-role { color: #b6a2c1 !important; }
    html[data-theme=dark] .pcoded-header .crm-user-avatar { background: #e4d7ec; }

    html[data-theme=dark] .pcoded-header > .collapse.navbar-collapse,
    html[data-theme=dark] .pcoded-header .navbar-nav,
    html[data-theme=dark] .pcoded-header .navbar-nav > li { background: transparent !important; }
    html[data-theme=dark] .pcoded-content { background: var(--yzs-canvas) !important; }

}

/* Choices menus share the CRM theme, including consultant and Master pickers. */
@media screen {
    html[data-theme=dark] .choices :is(.choices__list--dropdown,.choices__list[aria-expanded]) {
        background:var(--yzs-surface)!important;
        border-color:var(--yzs-line)!important;
        color:var(--yzs-text)!important;
        box-shadow:0 12px 32px rgba(0,0,0,.3);
    }
    html[data-theme=dark] .choices :is(.choices__list--dropdown,.choices__list[aria-expanded]) .choices__item {
        background:transparent!important;
        color:var(--yzs-text)!important;
    }
    html[data-theme=dark] .choices :is(.choices__list--dropdown,.choices__list[aria-expanded]) .choices__item--selectable.is-highlighted {
        background:var(--yzs-raised)!important;
        color:var(--yzs-accent)!important;
    }
    html[data-theme=dark] .choices :is(.choices__list--dropdown,.choices__list[aria-expanded]) .choices__item--selectable::after {
        color:var(--yzs-muted)!important;
    }
    html[data-theme=dark] .choices .choices__input {
        background:transparent!important;
        color:var(--yzs-text)!important;
        border-color:var(--yzs-line)!important;
    }
    html[data-theme=dark] .choices .choices__input::placeholder {color:var(--yzs-muted);opacity:1;}
    html[data-theme=dark] .choices :is(.choices__item--disabled,.choices__item--choice.choices__placeholder) {opacity:.55;}
    html[data-theme=dark] .choices :is(.choices__heading,.choices__item--no-results,.choices__item--no-choices) {
        color:var(--yzs-muted)!important;
        border-color:var(--yzs-line)!important;
    }
}
