/* Shared appearance tokens. Existing declarations keep their light colors as
   fallbacks; screen scoping preserves document and print colors. */
:root { color-scheme: light; }

@media screen {
    :root[data-theme="dark"] {
        --ub-focus: #ded6ff;
        --ub-navigation-backdrop: rgba(17, 19, 24, 0.34);
        --ub-amber-border: #a38a55;
        --ub-amber-fill: #795415;
        --ub-amber-surface: #3a3020;
        --ub-amber-text: #f2cd87;
        --ub-blue-border: #597dab;
        --ub-blue-fill: #315f9b;
        --ub-blue-surface: #25344b;
        --ub-blue-text: #9ec6ff;
        --ub-green-border: #488e6b;
        --ub-green-fill: #206848;
        --ub-green-surface: #1c3932;
        --ub-green-text: #86d9b6;
        --ub-neutral-border: #7785a0;
        --ub-neutral-fill: #343b49;
        --ub-neutral-muted: #a4adbf;
        --ub-neutral-raised: #222630;
        --ub-neutral-surface: #1a1d24;
        --ub-neutral-text: #edf0f6;
        --ub-pink-border: #a66eae;
        --ub-pink-fill: #85438e;
        --ub-pink-surface: #38263e;
        --ub-pink-text: #e7b0ed;
        --ub-red-border: #ae6472;
        --ub-red-fill: #a23649;
        --ub-red-surface: #3c252e;
        --ub-red-text: #f4a6af;
        --ub-teal-border: #478e88;
        --ub-teal-fill: #216c65;
        --ub-teal-surface: #1c3636;
        --ub-teal-text: #7ddbcf;
        --ub-violet-border: #8275bf;
        --ub-violet-fill: #6550d9;
        --ub-violet-surface: #2c2743;
        --ub-violet-text: #b2a4ff;
    }

    :root[data-theme="dark"] {
        color-scheme: dark;
        --bs-body-color: #edf0f6;
        --bs-body-bg: #111318;
        --bs-border-color: #343b49;
        --bs-secondary-color: #a4adbf;
        --bs-tertiary-bg: #222630;
        --bs-primary-rgb: 101, 80, 217;
        --bs-secondary-rgb: 52, 59, 73;
        --bs-success-rgb: 32, 104, 72;
        --bs-danger-rgb: 162, 54, 73;
        --bs-warning-rgb: 121, 84, 21;
        --bs-info-rgb: 49, 95, 155;
        --bs-dark-rgb: 26, 29, 36;
        --bs-light-rgb: 34, 38, 48;
        --bs-danger-bg-subtle: #3c252e;
        --bs-danger-text-emphasis: #f4a6af;
    }

    html[data-theme="dark"] body { color: #edf0f6; background-color: #111318; }
    html[data-theme="dark"] :is(.main, .main-wrapper) { background-color: #111318; }
    html[data-theme="dark"] :where(h1, h2, h3, h4, h5, h6, label, legend) { color: inherit; }
    html[data-theme="dark"] :where(a) { color: #b2a4ff; }
    html[data-theme="dark"] :is(.text-dark, .text-black, .text-body) { color: #edf0f6 !important; }
    html[data-theme="dark"] :is(.text-white, .text-light) { color: #fff !important; }
    html[data-theme="dark"] :is(.text-muted, .text-secondary, .form-text) { color: #a4adbf !important; }
    html[data-theme="dark"] body.primary-navigation-shell a.primary-navigation__link--disabled { opacity: 1; }

    /* Open navigation uses quiet surfaces; violet identifies hover and selection. */
    html[data-theme="dark"] body.primary-navigation-shell > .primary-navigation__popover,
    html[data-theme="dark"] body.primary-navigation-shell .primary-navigation__item--has-menu > .primary-navigation__submenu,
    html[data-theme="dark"] body.primary-navigation-shell .primary-navigation__items.is-mobile-open {
        background: linear-gradient(145deg, #222630, #1a1d24);
        border-color: #7785a0;
        box-shadow: 0 16px 48px #00000055;
    }
    html[data-theme="dark"] body.primary-navigation-shell > .primary-navigation__popover li a,
    html[data-theme="dark"] body.primary-navigation-shell .primary-navigation__submenu > li > a {
        color: #edf0f6;
        background: #222630;
        border-color: #343b49;
        box-shadow: none;
    }
    html[data-theme="dark"] body.primary-navigation-shell > .primary-navigation__popover li a:not(.primary-navigation__link--disabled):is(:hover, :focus-visible, .is-active),
    html[data-theme="dark"] body.primary-navigation-shell .primary-navigation__submenu > li > a:not(.primary-navigation__link--disabled):is(:hover, :focus-visible, .is-active) {
        color: #edf0f6;
        background: #2c2743;
        border-color: #8275bf;
        box-shadow: none;
    }
    html[data-theme="dark"] body.primary-navigation-shell > .primary-navigation__popover::before {
        color: #b2a4ff;
        border-bottom-color: #343b49;
    }
    html[data-theme="dark"] body.primary-navigation-shell > .primary-navigation__popover li a::before { background: #b2a4ff; }
    html[data-theme="dark"] body.primary-navigation-shell > .primary-navigation__popover li a:not(.primary-navigation__link--disabled)::after {
        border-color: #b2a4ff;
        opacity: 1;
    }
    html[data-theme="dark"] :is(.text-primary, .link-primary) { color: #b2a4ff !important; }
    html[data-theme="dark"] :is(.text-success, .link-success) { color: #86d9b6 !important; }
    html[data-theme="dark"] :is(.text-danger, .field-validation-error, .validation-summary-errors) { color: #f4a6af !important; }
    html[data-theme="dark"] :is(.text-warning, .link-warning) { color: #f2cd87 !important; }
    html[data-theme="dark"] :is(.text-info, .link-info) { color: #9ec6ff !important; }
    html[data-theme="dark"] :is(.link-dark, .link-light) { color: #edf0f6 !important; }
    html[data-theme="dark"] .link-secondary { color: #a4adbf !important; }
    html[data-theme="dark"] .link-danger { color: #f4a6af !important; }
    html[data-theme="dark"] :is(.bg-white, .bg-light) { background-color: #1a1d24 !important; }
    html[data-theme="dark"] :is(.bg-warning, .bg-info, .text-bg-warning, .text-bg-info, .text-bg-light) { color: #edf0f6 !important; }
    html[data-theme="dark"] :is(.border, .border-top, .border-bottom, .border-start, .border-end) { border-color: #343b49 !important; }
    html[data-theme="dark"] hr { border-color: #7785a0; opacity: 1; }
    html[data-theme="dark"] ::selection { color: #fff; background: #6550d9; }
    html[data-theme="dark"] :focus-visible { outline: 2px solid #ded6ff; outline-offset: 3px; }
    html[data-theme="dark"] :where(button, input, select, textarea) { color: #edf0f6; accent-color: #6550d9; }

    /* Bootstrap controls and their validation, disabled and autofill states. */
    html[data-theme="dark"] :is(.form-control, .form-select, .input-group-text) {
        color: #edf0f6; background-color: #15181f; border-color: #7785a0;
    }
    html[data-theme="dark"] :is(.form-control, .form-select):focus {
        color: #edf0f6; background-color: #15181f; border-color: #ded6ff;
        box-shadow: 0 0 0 .2rem #ded6ff30;
    }
    html[data-theme="dark"] :is(input, textarea)::placeholder { color: #a4adbf; opacity: 1; }
    html[data-theme="dark"] :is(.form-control, .form-select):is(:disabled, [readonly]) {
        color: #a4adbf; background-color: #222630; border-color: #7785a0;
    }
    html[data-theme="dark"] option { color: #edf0f6; background: #15181f; }
    html[data-theme="dark"] .form-select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23a4adbf' stroke-width='2'%3E%3Cpath d='m2 5 6 6 6-6'/%3E%3C/svg%3E");
    }
    html[data-theme="dark"] .form-check-input { background-color: #15181f; border-color: #8894a9; }
    html[data-theme="dark"] .form-check-input:checked { background-color: #6550d9; border-color: #b2a4ff; }
    html[data-theme="dark"] input:-webkit-autofill {
        -webkit-text-fill-color: #edf0f6; caret-color: #edf0f6;
        -webkit-box-shadow: 0 0 0 1000px #15181f inset;
    }
    html[data-theme="dark"] :where(.btn, .btn:disabled) { color: #edf0f6; }
    html[data-theme="dark"] :is(button, input, select, textarea):disabled { opacity: 1 !important; }
    html[data-theme="dark"] :is(button, .btn):disabled { border-style: dashed; cursor: not-allowed; }
    html[data-theme="dark"] .btn-edit-cstm_overview { color: #edf0f6; }
    html[data-theme="dark"] :is(.btn-primary, .btn-secondary, .btn-light, .btn-dark, .btn-success, .btn-danger, .btn-warning, .btn-info) {
        color: #edf0f6;
        --bs-btn-color: #edf0f6;
        --bs-btn-hover-color: #edf0f6;
        --bs-btn-hover-bg: var(--bs-btn-bg);
        --bs-btn-hover-border-color: var(--bs-btn-border-color);
        --bs-btn-active-color: #edf0f6;
        --bs-btn-active-bg: var(--bs-btn-hover-bg);
        --bs-btn-active-border-color: var(--bs-btn-hover-border-color);
        --bs-btn-disabled-color: #edf0f6;
        --bs-btn-disabled-bg: var(--bs-btn-bg);
        --bs-btn-disabled-border-color: var(--bs-btn-border-color);
    }
    html[data-theme="dark"] .btn-primary {
        --bs-btn-bg: #6550d9; --bs-btn-border-color: #8275bf;
        --bs-btn-hover-bg: #5743c4; --bs-btn-hover-border-color: #b2a4ff;
        background: var(--bs-btn-bg); border-color: var(--bs-btn-border-color);
    }
    html[data-theme="dark"] .btn-primary:is(:hover, :focus, :active) { background: #5743c4; border-color: #b2a4ff; }
    html[data-theme="dark"] :is(.btn-secondary, .btn-light, .btn-dark) {
        --bs-btn-bg: #343b49; --bs-btn-border-color: #7785a0;
        background: var(--bs-btn-bg); border-color: var(--bs-btn-border-color);
    }
    html[data-theme="dark"] .btn-success {
        --bs-btn-bg: #206848; --bs-btn-border-color: #488e6b;
        background: var(--bs-btn-bg); border-color: var(--bs-btn-border-color);
    }
    html[data-theme="dark"] .btn-danger {
        --bs-btn-bg: #a23649; --bs-btn-border-color: #ae6472;
        background: var(--bs-btn-bg); border-color: var(--bs-btn-border-color);
    }
    html[data-theme="dark"] .btn-warning {
        --bs-btn-bg: #795415; --bs-btn-border-color: #a38a55;
        background: var(--bs-btn-bg); border-color: var(--bs-btn-border-color);
    }
    html[data-theme="dark"] .btn-info {
        --bs-btn-bg: #315f9b; --bs-btn-border-color: #597dab;
        background: var(--bs-btn-bg); border-color: var(--bs-btn-border-color);
    }
    html[data-theme="dark"] .btn-link { color: #b2a4ff; }
    /* Use Bootstrap's state variables so hover, keyboard focus, active/checked
       and disabled controls keep their foreground and background paired. */
    html[data-theme="dark"] :where(.btn-outline-primary, .btn-outline-secondary, .btn-outline-success, .btn-outline-danger, .btn-outline-warning, .btn-outline-info, .btn-outline-light, .btn-outline-dark) {
        color: var(--bs-btn-color);
        --bs-btn-hover-color: #edf0f6;
        --bs-btn-hover-border-color: var(--bs-btn-border-color);
        --bs-btn-active-color: var(--bs-btn-hover-color);
        --bs-btn-active-bg: var(--bs-btn-hover-bg);
        --bs-btn-active-border-color: var(--bs-btn-border-color);
        --bs-btn-disabled-color: var(--bs-btn-color);
        --bs-btn-disabled-bg: transparent;
        --bs-btn-disabled-border-color: var(--bs-btn-border-color);
    }
    html[data-theme="dark"] .btn-outline-primary {
        --bs-btn-color: #b2a4ff; --bs-btn-border-color: #8275bf; --bs-btn-hover-bg: #6550d9;
    }
    html[data-theme="dark"] .btn-outline-secondary {
        --bs-btn-color: #a4adbf; --bs-btn-border-color: #7785a0; --bs-btn-hover-bg: #343b49;
    }
    html[data-theme="dark"] .btn-outline-success {
        --bs-btn-color: #86d9b6; --bs-btn-border-color: #488e6b; --bs-btn-hover-bg: #206848;
    }
    html[data-theme="dark"] .btn-outline-danger {
        --bs-btn-color: #f4a6af; --bs-btn-border-color: #ae6472; --bs-btn-hover-bg: #a23649;
    }
    html[data-theme="dark"] .btn-outline-warning {
        --bs-btn-color: #f2cd87; --bs-btn-border-color: #a38a55; --bs-btn-hover-bg: #795415;
    }
    html[data-theme="dark"] .btn-outline-info {
        --bs-btn-color: #9ec6ff; --bs-btn-border-color: #597dab; --bs-btn-hover-bg: #315f9b;
    }
    html[data-theme="dark"] :is(.btn-outline-light, .btn-outline-dark) {
        --bs-btn-color: #edf0f6; --bs-btn-border-color: #7785a0; --bs-btn-hover-bg: #343b49;
    }
    html[data-theme="dark"] .btn-close { filter: invert(1) grayscale(1); opacity: .8; }

    /* Dialogs, notifications, navigation, accordions and tab content. */
    html[data-theme="dark"] :is(.modal-content, .offcanvas, .card, .list-group-item, .dropdown-menu, .accordion-item, .accordion-button, .toast) {
        color: #edf0f6; background-color: #1a1d24; border-color: #343b49;
    }
    html[data-theme="dark"] :is(.modal-header, .modal-footer, .card-header, .card-footer, .dropdown-divider) { border-color: #343b49; }
    html[data-theme="dark"] :is(.dropdown-item, .nav-link, .breadcrumb-item) { color: #a4adbf; }
    html[data-theme="dark"] :is(.dropdown-item:hover, .dropdown-item:focus, .accordion-button:not(.collapsed)) {
        color: #edf0f6; background: #2c2743;
    }
    html[data-theme="dark"] :is(.nav-tabs .nav-link.active, .list-group-item.active) { color: #b2a4ff; background: #2c2743; border-color: #7785a0; }
    html[data-theme="dark"] .nav-tabs { border-color: #343b49; }
    html[data-theme="dark"] .accordion-button::after { filter: brightness(0) invert(1); }
    html[data-theme="dark"] .alert { color: #edf0f6; border-color: #7785a0; }
    html[data-theme="dark"] :is(.alert-primary, .alert-secondary, .alert-light, .alert-dark) { color: #edf0f6; background: #2c2743; }
    html[data-theme="dark"] .alert-success { color: #86d9b6; background: #1c3932; }
    html[data-theme="dark"] .alert-danger { color: #f4a6af; background: #3c252e; }
    html[data-theme="dark"] .alert-warning { color: #f2cd87; background: #3a3020; }
    html[data-theme="dark"] .alert-info { color: #9ec6ff; background: #25344b; }
    html[data-theme="dark"] .alert-link { color: inherit; }
    html[data-theme="dark"] .union-shipping-warning {
        color: #edf0f6 !important; background-color: #1a1d24 !important; border-color: #7785a0 !important;
    }
    html[data-theme="dark"] :is(.swal-modal, .swal2-popup, .swal-content, .swal2-input, .swal2-textarea) { color: #edf0f6; background: #1a1d24; border-color: #7785a0; }
    html[data-theme="dark"] :is(.swal-title, .swal-text, .swal2-title, .swal2-html-container) { color: #edf0f6; }
    html[data-theme="dark"] .swal-button { color: #fff; background: #6550d9; }
    html[data-theme="dark"] .swal-button--cancel { color: #edf0f6; background: #343b49; }
    html[data-theme="dark"] :is(.swal-footer, .swal-icon--success::before, .swal-icon--success::after, .swal-icon--success__hide-corners) { background: #1a1d24; }
    html[data-theme="dark"] :is(.toast-header, .toast-body, .jq-toast-single) { color: #edf0f6; background: #222630; }

    /* DataTables includes duplicated headers, fixed columns and empty states. */
    html[data-theme="dark"], html[data-theme="dark"] * {
        scrollbar-color: #7785a0 #15181f !important;
    }
    html[data-theme="dark"] ::-webkit-scrollbar-track,
    html[data-theme="dark"] ::-webkit-scrollbar-corner,
    html[data-theme="dark"] ::-webkit-scrollbar-button { background: #15181f !important; }
    html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #7785a0 !important; }
    html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #a4adbf !important; }
    html[data-theme="dark"] .table {
        color: #edf0f6; border-color: #343b49;
        --bs-table-color: #edf0f6; --bs-table-bg: #1a1d24;
        --bs-table-striped-bg: #1e202b; --bs-table-striped-color: #edf0f6;
        --bs-table-hover-bg: #2c2c3e; --bs-table-hover-color: #edf0f6;
        --bs-table-active-bg: #2c2743; --bs-table-active-color: #edf0f6;
    }
    html[data-theme="dark"] :is(.table-primary, .table-secondary, .table-success, .table-danger, .table-warning, .table-info, .table-light, .table-dark) {
        --bs-table-color: #edf0f6; --bs-table-striped-color: #edf0f6;
        --bs-table-active-color: #edf0f6; --bs-table-hover-color: #edf0f6;
        --bs-table-striped-bg: #ffffff05; --bs-table-active-bg: #ffffff10; --bs-table-hover-bg: #ffffff0a;
        --bs-table-border-color: #7785a0;
    }
    html[data-theme="dark"] .table-primary { --bs-table-bg: #2c2743; }
    html[data-theme="dark"] :is(.table-secondary, .table-light, .table-dark) { --bs-table-bg: #222630; }
    html[data-theme="dark"] .table-success { --bs-table-bg: #1c3932; }
    html[data-theme="dark"] .table-danger { --bs-table-bg: #3c252e; }
    html[data-theme="dark"] .table-warning { --bs-table-bg: #3a3020; }
    html[data-theme="dark"] .table-info { --bs-table-bg: #25344b; }
    /* Let ordinary cells reveal the existing row highlight and stripe rules. */
    html[data-theme="dark"] table.datatable-table { --bs-table-bg: transparent; }
    html[data-theme="dark"] :is(.ub-product-card__visual, .ub-product-card__attribute-chip, .col-checkbox) img {
        filter: brightness(0) invert(1) !important;
    }
    /* Lift black glyphs while retaining internal detail in multicolor icons. */
    html[data-theme="dark"] .dropdown-menu ul li > a > img {
        filter: invert(1) hue-rotate(180deg);
    }
    html[data-theme="dark"] .dataTables_wrapper.datatable-theme .dataTables_scrollBody {
        border-inline: 0 !important;
    }
    html[data-theme="dark"] :is([data-datatable-theme="violet"], .datatable-theme, .datatable-table) {
        --dt-head: #272335; --dt-head-ink: #edf0f6; --dt-ink: #edf0f6;
        --dt-muted: #a4adbf; --dt-stripe: #1e202b; --dt-hover: #2c2c3e;
        --dt-border: #343b49; --dt-card-border: #343b49; --dt-row-line: #343b49;
    }
    html[data-theme="dark"] :is(.page-link, .page-item.disabled .page-link) { color: #a4adbf; background: #1a1d24; border-color: #7785a0; }
    html[data-theme="dark"] .page-item.active .page-link { color: #fff; background: #6550d9; border-color: #8275bf; }

    /* Application links often use the same legacy variable as solid buttons. */
    html[data-theme="dark"] :is(.dashboard-overview, .client-editor, .order-editor, .patient-editor, .auth-page, .network-profile-editor) a:not(.btn):not(.button-primary):not(.auth-button) { color: #b2a4ff; }
    html[data-theme="dark"] :is(.datatable-link, .highlighted-link, .datatable-tabs a, .datatable-tabs button, .patient-editor__section-link[aria-current], .client-editor__section-link[aria-current], .order-editor__section-link[aria-current]) { color: #b2a4ff; }

    /* Third-party widgets retain their native behavior and dimensions. */
    html[data-theme="dark"] :is(.select2-dropdown, .select2-container--default .select2-selection--single, .select2-container--default .select2-selection--multiple, .select2-search__field, .bootstrap-select .dropdown-toggle) {
        color: #edf0f6; background: #15181f; border-color: #7785a0;
    }
    html[data-theme="dark"] :is(.select2-container--default .select2-selection__rendered, .select2-container--default .select2-selection__choice, .select2-container--default .select2-selection__placeholder) { color: #edf0f6; }
    html[data-theme="dark"] .select2-container--default .select2-selection__choice { background: #2c2743; border-color: #7785a0; }
    html[data-theme="dark"] .select2-results__option[aria-selected="true"] { background: #2c2743; }
    html[data-theme="dark"] .select2-results__option--highlighted[aria-selected] { color: #fff; background: #6550d9; }
    html[data-theme="dark"] :is(.ui-widget-content, .ui-widget-header, .ui-state-default, .ui-widget.ui-widget-content, .daterangepicker, .daterangepicker .calendar-table, .datepicker, .bootstrap-datetimepicker-widget) {
        color: #edf0f6; background: #1a1d24; border-color: #7785a0;
    }
    html[data-theme="dark"] :is(.ui-menu-item-wrapper, .daterangepicker .ranges li, .daterangepicker .calendar-table td) { color: #edf0f6; }
    html[data-theme="dark"] .daterangepicker td.off { color: #a4adbf; background: #222630; }
    html[data-theme="dark"] .daterangepicker td.in-range { color: #edf0f6; background: #2c2743; }
    html[data-theme="dark"] :is(.daterangepicker td.active, .daterangepicker .ranges li.active, .ui-state-active, .datepicker td.active) { color: #fff; background: #6550d9; }
    html[data-theme="dark"] :is(.daterangepicker td.available:hover, .daterangepicker th.available:hover, .daterangepicker .ranges li:hover, .bootstrap-datetimepicker-widget td.day:hover) { color: #edf0f6; background: #2c2743; }
    html[data-theme="dark"] .daterangepicker .calendar-table :is(.next span, .prev span) { border-color: #a4adbf; }
    html[data-theme="dark"] .ui-icon { filter: brightness(0) invert(1); }
    /* Keep the stored signature pixels unchanged while showing light ink on screen. */
    html[data-theme="dark"] .kbw-signature { background: #15181f; border-color: #7785a0; }
    html[data-theme="dark"] .kbw-signature canvas { filter: invert(1); }
    html[data-theme="dark"] .kbw-signature-disabled { opacity: 1; }
    html[data-theme="dark"] :is(.apexcharts-tooltip, .apexcharts-xaxistooltip, .apexcharts-yaxistooltip, .apexcharts-menu) { color: #edf0f6; background: #222630; border-color: #7785a0; }
    html[data-theme="dark"] .apexcharts-tooltip-title { color: #edf0f6; background: #2c2743; border-color: #7785a0; }
    html[data-theme="dark"] .apexcharts-text { fill: #a4adbf !important; }
    html[data-theme="dark"] .apexcharts-gridline { stroke: #343b49; }
    html[data-theme="dark"] .apexcharts-menu-item:hover { background: #2c2743; }
    html[data-theme="dark"] svg :is([fill="#000"], [fill="#000000"], [fill="black"]) { fill: #edf0f6; }
    html[data-theme="dark"] svg :is([stroke="#000"], [stroke="#000000"], [stroke="black"]) { stroke: #edf0f6; }
    html[data-theme="dark"] img[src$="/Logo_black.png"] { filter: brightness(0) invert(1); }
    html[data-theme="dark"] :is(.menu-toggle, .menu-toggle--gray, .nav-user-img img[src$="/user-icons.png"]) { filter: brightness(0) invert(1); }
    html[data-theme="dark"] .dropdown .dropdown-button::after { filter: brightness(0) invert(1); }
    html[data-theme="dark"] body.legacy-side-menu-shell :is(.shopping-wrapper, .notification-wrapper) .gray-circle-btn { background-image: none; }
    html[data-theme="dark"] body.legacy-side-menu-shell :is(.shopping-wrapper, .notification-wrapper) .gray-circle-btn::before {
        content: ""; position: absolute; inset: 10px; pointer-events: none;
        background: url("../assets/img/notifications-outline.png") center / contain no-repeat;
        filter: brightness(0) invert(1);
    }
    html[data-theme="dark"] body.legacy-side-menu-shell .shopping-wrapper .gray-circle-btn::before { background-image: url("../assets/img/shopping-bag.png"); }

    /* ScriptCo's same-origin quote iframe uses Angular Material controls. */
    html[data-theme="dark"] .appearance-embedded :is(.mat-mdc-form-field, .mat-mdc-select, .mat-mdc-text-field-wrapper) {
        --mdc-filled-text-field-container-color: #15181f;
        --mdc-filled-text-field-input-text-color: #edf0f6;
        --mdc-filled-text-field-label-text-color: #a4adbf;
        --mdc-filled-text-field-disabled-container-color: #222630;
        --mdc-filled-text-field-disabled-input-text-color: #a4adbf;
        --mdc-filled-text-field-disabled-label-text-color: #a4adbf;
        --mdc-filled-text-field-caret-color: #ded6ff;
        --mdc-filled-text-field-active-indicator-color: #7785a0;
        --mdc-filled-text-field-hover-active-indicator-color: #a4adbf;
        --mdc-filled-text-field-focus-active-indicator-color: #ded6ff;
        --mdc-filled-text-field-focus-label-text-color: #ded6ff;
        --mdc-filled-text-field-error-label-text-color: #f4a6af;
        --mdc-filled-text-field-error-active-indicator-color: #f4a6af;
        --mat-select-enabled-trigger-text-color: #edf0f6;
        --mat-select-disabled-trigger-text-color: #a4adbf;
        --mat-select-enabled-arrow-color: #a4adbf;
        --mat-select-disabled-arrow-color: #a4adbf;
        --mat-select-focused-arrow-color: #ded6ff;
    }
    html[data-theme="dark"] .appearance-embedded :is(.mat-mdc-autocomplete-panel, .mat-mdc-select-panel, .mat-mdc-option) {
        color: #edf0f6; background-color: #1a1d24;
        --mat-option-label-text-color: #edf0f6;
        --mat-option-selected-state-label-text-color: #b2a4ff;
        --mat-option-hover-state-layer-color: #2c2743;
        --mat-option-focus-state-layer-color: #2c2743;
        --mat-option-selected-state-layer-color: #2c2743;
    }
    html[data-theme="dark"] .appearance-embedded :is(.mat-mdc-button-base, .mat-mdc-form-field-error, .mdc-floating-label, .mat-mdc-select-value) { color: #edf0f6; }
    html[data-theme="dark"] .appearance-embedded .mat-mdc-form-field-focus-overlay { background: #b2a4ff; }
    html[data-theme="dark"] .appearance-embedded .mat-mdc-raised-button {
        --mdc-protected-button-container-color: #6550d9;
        --mdc-protected-button-label-text-color: #fff;
        --mdc-protected-button-disabled-container-color: #343b49;
        --mdc-protected-button-disabled-label-text-color: #a4adbf;
        border: 1px solid #8275bf;
        color: #fff !important; background-color: #6550d9 !important;
    }
    html[data-theme="dark"] .appearance-embedded .mat-mdc-raised-button:disabled { color: #a4adbf !important; background-color: #343b49 !important; }
    html[data-theme="dark"] .appearance-embedded :is(.mdc-floating-label, .mat-mdc-select-placeholder) { color: #a4adbf !important; }
    html[data-theme="dark"] .appearance-embedded .mat-mdc-option .mdc-list-item__primary-text { color: #edf0f6; }
    html[data-theme="dark"] .appearance-embedded .mdc-text-field--invalid .mdc-floating-label { color: #f4a6af !important; }
    html[data-theme="dark"] .appearance-embedded .mat-mdc-form-field-error { color: #f4a6af; }
}
