/* Dark mode for pages that set their own colours. Generated from those pages' styles and limited to
   dark mode on screen, on the page named above each block. Light mode and printing are not affected. */
@media screen {

    /* Pharmacy sale */
    html.cemr-theme-dark:has(.pos-root) [style*="background: #f1f5f9"] {
        background-color: var(--md-sys-color-surface-container) !important;
    }
    html.cemr-theme-dark:has(.pos-root) [style*="background: #f8fafc"] {
        background-color: var(--md-sys-color-surface) !important;
    }
    html.cemr-theme-dark:has(.pos-root) [style*="color:#f59e0b"]:not([style*="background-color:#f59e0b"]) {
        color: color-mix(in srgb, #f59e0b 45%, #ffffff) !important;
    }
    html.cemr-theme-dark:has(.pos-root) .text-teal {
        color: var(--cemr-focus-ring) !important;
    }
    html.cemr-theme-dark:has(.pos-root) .pos-root {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-splash {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-top-ribbon {
        background-color: var(--md-sys-color-surface);
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-back-btn {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-back-btn:hover {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-brand-tag {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-inv-pill {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-strip-sep {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-mode-switcher {
        background-color: var(--md-sys-color-surface-container);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-mode-tab {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-mode-tab.active {
        background-color: var(--md-sys-color-surface);
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-field-ico {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-walkin-inp {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-walkin-inp:focus {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-pt-card {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-pt-name {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-pt-demog {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-pt-demog-mini {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
        border-color: var(--md-sys-color-outline-variant);
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-pt-mrn {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-pt-visit-wrap {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-pt-visit-ico {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-visit-sel {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-pt-doc-wrap {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-pt-doc-ico {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-pt-doc-val {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-pt-doc-inp {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-doc-badge {
        background-color: var(--md-sys-color-surface-container);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-input-error-pulse {
        background-color: color-mix(in srgb, #fff7f7 16%, var(--md-sys-color-surface)) !important;
        border-color: color-mix(in srgb, #ef4444 55%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.pos-root) .pos-pt-clear-btn {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-pt-clear-btn:hover {
        background-color: color-mix(in srgb, #fee2e2 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #ef4444 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-pt-search-box {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-pt-search-box:focus-within {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-search-ico {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-pt-search-input {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-search-kbd {
        background-color: var(--md-sys-color-surface-container);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-patient-drop {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-patient-item {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-pt-avatar-sm {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-patient-item .pos-pt-name {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-pt-meta {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-pt-clear-mini {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-pt-clear-mini:hover {
        color: color-mix(in srgb, #ef4444 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-meta-deck {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-meta-ico {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-meta-divider {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-meta-select {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-meta-date-val {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-meta-date-inp {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-entry-bar {
        background-color: var(--md-sys-color-surface);
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-entry-search-wrap {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-entry-icon {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-med-search-input {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-search-spin {
        color: var(--cemr-focus-ring) !important;
    }
    html.cemr-theme-dark:has(.pos-root) .pos-search-clear {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-search-clear:hover {
        color: color-mix(in srgb, #ef4444 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-medicine-drop {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-med-drop-item {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-med-drop-name {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-med-drop-generic {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-med-drop-comp {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-chip-pack {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface-variant);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-chip-rack {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-chip-sched {
        background-color: color-mix(in srgb, #fee2e2 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #b91c1c 45%, #ffffff);
        border-color: color-mix(in srgb, #fca5a5 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.pos-root) .pos-entry-batch-chip {
        background-color: color-mix(in srgb, #f0fdf4 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #86efac 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.pos-root) .pos-ebc-label {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-ebc-fefo {
        background-color: color-mix(in srgb, #dcfce7 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #166534 45%, #ffffff);
        border-color: color-mix(in srgb, #86efac 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.pos-root) .pos-ebc-sep {
        background-color: color-mix(in srgb, #86efac 16%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.pos-root) .pos-ebc-val {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-ebc-stk {
        color: color-mix(in srgb, #0284c7 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-ebc-rate {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-ebc-rack {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-batch-num-tag {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-batch-exp-tag {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-batch-stk-tag {
        background-color: color-mix(in srgb, #dcfce7 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #15803d 45%, #ffffff);
        border-color: color-mix(in srgb, #bbf7d0 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.pos-root) .pos-batch-rack-tag {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-bdi-rack {
        color: var(--cemr-focus-ring);
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-entry-comp-badge {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-entry-rack-badge {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-bdi-batch {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-bdi-meta {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-bdi-expiry-warn {
        background-color: color-mix(in srgb, #fef3c7 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #b45309 45%, #ffffff);
        border-color: color-mix(in srgb, #fde68a 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.pos-root) .pos-bi-rate-pill {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-bi-stk-pill {
        background-color: color-mix(in srgb, #dcfce7 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #15803d 45%, #ffffff);
        border-color: color-mix(in srgb, #86efac 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.pos-root) .pos-bi-stk-low {
        background-color: color-mix(in srgb, #fef3c7 16%, var(--md-sys-color-surface)) !important;
        color: color-mix(in srgb, #b45309 45%, #ffffff) !important;
        border-color: color-mix(in srgb, #fde68a 55%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.pos-root) .pos-nobatch-alert {
        background-color: color-mix(in srgb, #fee2e2 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #fca5a5 55%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #b91c1c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-entry-lbl {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-entry-inp {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-input-overstock {
        background-color: color-mix(in srgb, #fef2f2 16%, var(--md-sys-color-surface)) !important;
        border-color: color-mix(in srgb, #ef4444 55%, var(--md-sys-color-surface)) !important;
        color: color-mix(in srgb, #b91c1c 45%, #ffffff) !important;
    }
    html.cemr-theme-dark:has(.pos-root) .pos-qty-alert-pill {
        background-color: color-mix(in srgb, #fee2e2 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #fca5a5 55%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #b91c1c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-qty-alert-pill:hover {
        background-color: color-mix(in srgb, #fecaca 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #ef4444 55%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #991b1b 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-total-overstock {
        background-color: color-mix(in srgb, #fffbeb 16%, var(--md-sys-color-surface)) !important;
        border-color: color-mix(in srgb, #fde68a 55%, var(--md-sys-color-surface)) !important;
        color: color-mix(in srgb, #b45309 45%, #ffffff) !important;
    }
    html.cemr-theme-dark:has(.pos-root) .pos-add-btn-blocked {
        background-color: color-mix(in srgb, #fee2e2 16%, var(--md-sys-color-surface)) !important;
        border-color: color-mix(in srgb, #fca5a5 55%, var(--md-sys-color-surface)) !important;
        color: color-mix(in srgb, #b91c1c 45%, #ffffff) !important;
    }
    html.cemr-theme-dark:has(.pos-root) .pos-add-btn-blocked .pos-add-kbd {
        color: color-mix(in srgb, #b91c1c 45%, #ffffff) !important;
    }
    html.cemr-theme-dark:has(.pos-root) .pos-add-btn-idle {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-add-btn-idle .pos-add-kbd {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-table-pane {
        background-color: var(--md-sys-color-surface);
        border-right-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-table-empty {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-empty-icon-wrap {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-empty-desc {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-inline-kbd {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-table thead th {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface-variant);
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-row td {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-row-alt td {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-row-n {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-med-title {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-med-generic {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-med-comp {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-rack-tag {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-stk-tag {
        background-color: color-mix(in srgb, #dcfce7 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #166534 45%, #ffffff);
        border-color: color-mix(in srgb, #bbf7d0 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.pos-root) .pos-stk-nostock {
        background-color: color-mix(in srgb, #fee2e2 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #991b1b 45%, #ffffff);
        border-color: color-mix(in srgb, #fca5a5 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.pos-root) .pos-batch-num {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-grid-inp {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-over-stock {
        background-color: color-mix(in srgb, #fff7f7 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #ef4444 55%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.pos-root) .pos-grid-rate {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-grid-net {
        color: color-mix(in srgb, #1e3a8a 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-row-del {
        color: color-mix(in srgb, #dc2626 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-row-del:hover {
        background-color: color-mix(in srgb, #fee2e2 16%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.pos-root) .pos-row-ledger-placeholder td {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-shortcuts-bar {
        background-color: var(--md-sys-color-surface);
        border-top-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-key-divider {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-shortcuts-bar kbd {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-sidebar-pane {
        background-color: var(--md-sys-color-surface);
        border-left-color: var(--md-sys-color-outline-variant);
        border-top-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-side-box {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-box-hdr {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-box-title {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-badge-sm {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-sg-item {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-sg-item strong {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-savings-banner {
        background-color: color-mix(in srgb, #ecfdf5 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #a7f3d0 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.pos-root) .pos-side-disc-row {
        border-top-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-side-disc-lbl {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-disc-type-sel {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-disc-val-inp {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-net-roundoff {
        border-top-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-pay-lbl {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-pay-sel,
    html.cemr-theme-dark:has(.pos-root) .pos-pay-inp {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-tender-container {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-cash-tag {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-tender-input-wrap {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-tender-input-wrap:focus-within {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-tender-input-wrap span {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-tender-num-inp {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-preset-btn {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-preset-btn:hover {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-change-banner {
        background-color: color-mix(in srgb, #f0fdf4 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #86efac 55%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #166534 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-change-banner-left {
        color: color-mix(in srgb, #166534 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-change-banner-val {
        color: color-mix(in srgb, #15803d 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-due-banner {
        background-color: color-mix(in srgb, #fffbeb 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #fde68a 55%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #92400e 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-due-banner-left {
        color: color-mix(in srgb, #92400e 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-due-banner-val {
        color: color-mix(in srgb, #b45309 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-split-err-sm {
        background-color: color-mix(in srgb, #fee2e2 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #b91c1c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-sidebar-footer {
        border-top-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-btn-clear {
        background-color: var(--md-sys-color-surface);
        border-color: color-mix(in srgb, #fca5a5 55%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #dc2626 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-btn-clear:hover:not(:disabled) {
        background-color: color-mix(in srgb, #fee2e2 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #ef4444 55%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #b91c1c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-btn-clear .pos-kbd-tag {
        background-color: color-mix(in srgb, #fee2e2 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #fca5a5 55%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #b91c1c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-btn-draft {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-btn-draft:hover:not(:disabled) {
        background-color: var(--md-sys-color-surface-container);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-btn-draft .pos-kbd-tag {
        background-color: var(--md-sys-color-surface-container);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-btn-post {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-btn-post .pos-kbd-tag {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-btn-post:hover:not(:disabled) .pos-kbd-tag {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-btn-postprint .pos-kbd-tag {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-confirm-card {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-ribbon-date-inp {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-readonly-banner {
        background-color: color-mix(in srgb, #fffbeb 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #fef3c7 55%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #92400e 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-grid-mrp {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-saving-content {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-entry-total-badge {
        background-color: color-mix(in srgb, #f0fdf4 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #86efac 55%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #166534 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-root) .pos-ribbon-right {
        border-top-color: var(--md-sys-color-outline-variant);
    }

    /* Pharmacy sales return */
    html.cemr-theme-dark:has(.pos-return-root) [style*="background:#e0f2fe"] {
        background-color: color-mix(in srgb, #e0f2fe 16%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.pos-return-root) [style*="color:#0369a1"]:not([style*="background-color:#0369a1"]) {
        color: color-mix(in srgb, #0369a1 45%, #ffffff) !important;
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-drop-section-header {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
        border-top-color: var(--md-sys-color-outline-variant);
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-patient-item-ipd:hover {
        background-color: color-mix(in srgb, #e0f2fe 16%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-return-root {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-top-ribbon {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-back-btn {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-back-btn:hover {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-brand-tag {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-inv-pill {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-strip-sep {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-pt-search-box {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-search-ico {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-pt-search-input {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-search-kbd {
        background-color: var(--md-sys-color-surface-container);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-patient-drop {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-patient-item {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-pt-avatar-sm {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-patient-item .pos-pt-name {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-pt-meta {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-pt-card {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-pt-name {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-pt-demog {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-pt-demog-mini {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-pt-mrn {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-pt-visit-wrap {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-pt-visit-ico {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-visit-sel {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-pt-doc-val {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-pt-clear-btn {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-pt-clear-btn:hover {
        color: color-mix(in srgb, #ef4444 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-btn-history {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-btn-history:hover {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-meta-deck {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-meta-ico {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-meta-date-val {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-table-pane {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-pane-header {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-pane-title {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-pane-subtitle {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-badge-refund {
        border-color: color-mix(in srgb, #fca5a5 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-badge-exchange {
        border-color: color-mix(in srgb, #86efac 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-btn-add-drug {
        color: #10201a;
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-table thead th {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface-variant);
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-row td {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-row-active-refund td {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-med-title {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-med-generic {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-chip-pack {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface-variant);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-batch-exp-tag {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-grid-inp {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-input-active {
        background-color: color-mix(in srgb, #fff5f5 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #ef4444 55%, var(--md-sys-color-surface)) !important;
        color: color-mix(in srgb, #b91c1c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-qty-max-hint {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-amount-zero {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-grid-rate {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-btn-exchange-fast {
        border-color: color-mix(in srgb, #86efac 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-btn-exchange-fast:hover {
        background-color: color-mix(in srgb, #bbf7d0 16%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-batch-select {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-row-del {
        color: color-mix(in srgb, #dc2626 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-row-del:hover {
        background-color: color-mix(in srgb, #fee2e2 16%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-table-empty {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-empty-desc {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-settlement-dock {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-hero-refund {
        background-color: color-mix(in srgb, #fff5f5 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #fca5a5 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-hero-collect {
        background-color: color-mix(in srgb, #f0fdf4 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #86efac 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-hero-even {
        background-color: color-mix(in srgb, var(--cemr-ui-accent) 14%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, var(--cemr-ui-accent) 55%, var(--md-sys-color-surface));
        color: var(--cemr-primary-text);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-bd-label {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-field-label {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-field-select,
    html.cemr-theme-dark:has(.pos-return-root) .pos-field-input {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-btn-discard {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-btn-discard:hover {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-btn-draft {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pos-return-root) .pos-btn-draft:hover {
        background-color: var(--md-sys-color-surface-container);
        border-color: var(--md-sys-color-outline-variant);
    }

    /* Specialty template designer */

    html.cemr-theme-dark:has(.specialty-designer-page) [style*="color:#166534"]:not([style*="background-color:#166534"]) {
        color: color-mix(in srgb, #166534 45%, #ffffff) !important;
    }
    html.cemr-theme-dark:has(.specialty-designer-page) [style*="color:#b91c1c"]:not([style*="background-color:#b91c1c"]) {
        color: color-mix(in srgb, #b91c1c 45%, #ffffff) !important;
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .specialty-designer-page {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .designer-icon-btn.preview-active {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .template-list-panel {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .template-row {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .template-row:hover {
        background-color: var(--cemr-ui-hover);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .template-row.active {
        background-color: var(--cemr-ui-hover);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .template-row span {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .template-row small {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .designer-editor-panel {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .designer-label {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .designer-label small {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .designer-input {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .designer-check {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .designer-empty {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .designer-btn.secondary {
        background-color: var(--md-sys-color-surface);
        color: var(--cemr-primary-text);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .designer-btn.secondary:hover {
        background-color: var(--cemr-ui-hover);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .designer-tabs {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .designer-tab {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .designer-tab:hover {
        background-color: var(--cemr-ui-hover);
        color: var(--cemr-primary-text);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .designer-tab.active {
        background-color: var(--md-sys-color-surface);
        color: var(--cemr-primary-text);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .vb-schema-header {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .vb-empty-state {
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .vb-empty-state strong {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .field-card {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .field-card.expanded {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .field-card-header {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .field-card.expanded .field-card-header {
        background-color: var(--cemr-ui-hover);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .field-card-title strong {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .field-type-badge {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .ftype-checkbox {
        background-color: color-mix(in srgb, #dcfce7 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #166534 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .ftype-select {
        background-color: color-mix(in srgb, #dbeafe 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #1d4ed8 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .ftype-radio {
        background-color: color-mix(in srgb, #ccfbf1 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #0f766e 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .ftype-number {
        background-color: color-mix(in srgb, #ffedd5 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #9a3412 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .ftype-textarea {
        background-color: color-mix(in srgb, #fef9c3 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #92400e 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .ftype-text {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .ftype-image {
        background-color: color-mix(in srgb, #ffe4e6 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #be123c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .ftype-table {
        background-color: color-mix(in srgb, #dcfce7 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #15803d 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .table-designer-section {
        border-top-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .tbl-group-card {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .field-id-chip {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .required-badge {
        background-color: color-mix(in srgb, #fee2e2 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #b91c1c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .fc-btn {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .fc-btn:hover {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .fc-btn.danger {
        color: color-mix(in srgb, #b91c1c 45%, #ffffff);
        border-color: color-mix(in srgb, #fecaca 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .fc-btn.danger:hover {
        background-color: color-mix(in srgb, #fee2e2 16%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .fc-caret {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .field-card-body {
        background-color: var(--md-sys-color-surface);
        border-top-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .field-options-section {
        border-top-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .field-condition-section {
        border-top-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .condition-label {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .condition-equals {
        color: var(--cemr-primary-text);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .condition-hint {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .condition-hint i {
        color: var(--cemr-primary-text);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .condition-hint code {
        background-color: var(--md-sys-color-surface-container);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .options-empty {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .add-field-bar {
        border-top-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .add-field-hint {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .formula-meta-grid {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .formula-fields-section {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .formula-hint-inline {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .formula-hint-block {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .formula-field-check {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .formula-field-check:hover {
        background-color: var(--cemr-ui-hover);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .formula-field-check span {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .formula-field-check small {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .weight-label {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .ranges-header-row {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .json-tab-hint {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface-variant);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .schema-editor-card {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .schema-card-header {
        background-color: var(--md-sys-color-surface-container);
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .schema-card-header h6 {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .schema-editor {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .designer-footer {
        border-top-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .designer-alert.success {
        background-color: color-mix(in srgb, #ecfdf3 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #bbf7d0 55%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #166534 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .designer-alert.warning {
        background-color: color-mix(in srgb, #fff7ed 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #fed7aa 55%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #9a3412 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .validation-panel {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .validation-line.error {
        color: color-mix(in srgb, #b91c1c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .validation-line.warning {
        color: color-mix(in srgb, #92400e 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-result-panel {
        background-color: var(--cemr-ui-hover);
        border-color: color-mix(in srgb, var(--cemr-ui-accent) 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-result-panel span {
        color: color-mix(in srgb, #0e7490 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-result-panel strong {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .live-preview-panel {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-empty-state {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-form-heading {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-form-heading strong {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-form-heading p {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-image-wrapper {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-image-placeholder {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-image-placeholder span {
        color: var(--cemr-primary-text);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-image-placeholder small {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-table-label {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-th-group {
        border-color: color-mix(in srgb, #b91c1c 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-th-col {
        background-color: color-mix(in srgb, var(--md-sys-color-primary) 16%, var(--md-sys-color-surface));
        color: var(--cemr-primary-text);
        border-color: color-mix(in srgb, var(--md-sys-color-primary) 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-th-row-label {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-td-row-label {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-td-cell {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-table-input {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-table-input:focus {
        background-color: color-mix(in srgb, #eff6ff 16%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-check {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .check-score {
        color: var(--cemr-primary-text);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .req-star {
        color: color-mix(in srgb, #dc2626 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-radio-list label {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-help {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-score-strip {
        border-top-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-score-box,
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-interp-box {
        background-color: var(--cemr-ui-hover);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-score-box span,
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-interp-box span {
        color: var(--cemr-primary-text);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-score-box strong {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-designer-page) .preview-interp-box strong {
        color: var(--md-sys-color-on-surface);
    }

    /* Monthly availability */
    html.cemr-theme-dark:has(.availability-card) .availability-card {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.availability-card) .nav-btn {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.availability-card) .schedule-info {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.availability-card) .day-header {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.availability-card) .available {
        background-color: var(--md-sys-color-surface-container);
        color: color-mix(in srgb, #4d7a17 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.availability-card) .unavailable {
        background-color: color-mix(in srgb, #fdecec 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #cc4343 45%, #ffffff);
    }

    /* Consultation layout */
    html.cemr-theme-dark:has(.section-toggle-card) .section-editor-card {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.section-toggle-card) .section-editor-card.active {
        background-color: color-mix(in srgb, #eff6ff 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #2563eb 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.section-toggle-card) .subsection-toggle-card {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.section-toggle-card) .subsection-toggle-card.active {
        background-color: color-mix(in srgb, #dcfce7 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #16a34a 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.section-toggle-card) .section-toggle-card {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.section-toggle-card) .section-toggle-card:hover {
        background-color: color-mix(in srgb, #f0f4ff 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #2563eb 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.section-toggle-card) .section-toggle-card.active {
        background-color: color-mix(in srgb, #dbeafe 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #2563eb 55%, var(--md-sys-color-surface));
    }

    /* Role administration */
    html.cemr-theme-dark:has(.rbac-page-container) .rbac-page-container {
        background-color: var(--md-sys-color-surface);
    }

    /* Role administration list */
    html.cemr-theme-dark:has(.gc-grid-wrapper) .gc-kicker {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.gc-grid-wrapper) .gc-title {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.gc-grid-wrapper) .gc-count {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.gc-grid-wrapper) .gc-subtitle {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.gc-grid-wrapper) .gc-stat {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.gc-grid-wrapper) .gc-grid-wrapper {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.gc-grid-wrapper) .gc-dialog-title {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.gc-grid-wrapper) .gc-action-btn {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.gc-grid-wrapper) .gc-action-btn:hover:not(:disabled) {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.gc-grid-wrapper) .gc-action-btn:disabled {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface-variant);
        border-color: var(--md-sys-color-outline-variant);
    }

    /* Add pet */
    html.cemr-theme-dark:has(.pet-step-badge) .pet-admission-card {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant) !important;
    }
    html.cemr-theme-dark:has(.pet-step-badge) .pet-card-header {
        background-color: var(--md-sys-color-surface) !important;
        color: var(--md-sys-color-on-surface) !important;
        border-bottom-color: var(--md-sys-color-outline-variant) !important;
    }
    html.cemr-theme-dark:has(.pet-step-badge) .pet-card-header h6 {
        color: var(--md-sys-color-on-surface) !important;
    }
    html.cemr-theme-dark:has(.pet-step-badge) .pet-card-header h6 i {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pet-step-badge) .pet-step-badge {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pet-step-badge) .pet-nav-pill {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pet-step-badge) .pet-nav-pill:hover {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pet-step-badge) .owner-mode-chip {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pet-step-badge) .owner-mode-chip:hover {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pet-step-badge) .owner-mode-chip.active {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
    }

    /* About us */
    html.cemr-theme-dark:has(.what-we-do) .aboutus-page {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.what-we-do) .mission-card {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.what-we-do) .what-we-do {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.what-we-do) .what-we-do ul li {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.what-we-do) .what-we-do ul li::before {
        color: color-mix(in srgb, #2575fc 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.what-we-do) .service-card {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.what-we-do) .service-card .icon {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.what-we-do) .service-card p {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.what-we-do) .instructions h2 {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.what-we-do) .zigzag-card {
        background-image: none;
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.what-we-do) .zigzag-item.left .zigzag-card {
        background-image: none;
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.what-we-do) .zigzag-item.right .zigzag-card {
        background-image: none;
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.what-we-do) .zigzag-item.left:nth-child(odd) .zigzag-card {
        background-image: none;
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.what-we-do) .zigzag-item.right:nth-child(even) .zigzag-card {
        background-image: none;
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.what-we-do) .team {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.what-we-do) .team-member {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.what-we-do) .swiper-button-next,
    html.cemr-theme-dark:has(.what-we-do) .swiper-button-prev {
        color: color-mix(in srgb, #007bff 45%, #ffffff);
    }

    /* MST reporting */
    html.cemr-theme-dark:has(.mst-workspace) .mst-quality-panel-header {
        background-image: none;
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-timing-card {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-bbps-table-header {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-bbps-summary {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-bbps-guide {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-btn-primary {
        background-image: none;
        background-color: var(--md-sys-color-primary);
        border-color: var(--md-sys-color-primary);
        color: var(--md-sys-color-on-primary);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-meta-chip {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-dialog-close-btn:hover {
        border-color: color-mix(in srgb, #f0cbd0 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.mst-workspace) button.mst-dlg-primary {
        background-image: none !important;
        background-color: var(--md-sys-color-primary) !important;
        border-color: var(--md-sys-color-primary) !important;
        color: var(--md-sys-color-on-primary) !important;
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-ai-overlay {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-ai-stream-badge {
        border-color: color-mix(in srgb, var(--md-sys-color-primary) 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-ai-stream-text {
        color: var(--cemr-primary-text);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-live-stream-panel {
        background-color: var(--md-sys-color-surface);
        border-color: color-mix(in srgb, var(--md-sys-color-primary) 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-live-stream-header {
        border-bottom-color: color-mix(in srgb, var(--md-sys-color-primary) 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-live-stream-status {
        color: var(--cemr-primary-text);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-live-stream-body {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-live-stream-text {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-images-drawer-toggle {
        background-image: none;
        background-color: var(--md-sys-color-primary);
        border-color: var(--md-sys-color-primary);
        color: var(--md-sys-color-on-primary);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-images-drawer-toggle:hover {
        background-image: none;
        background-color: color-mix(in srgb, var(--md-sys-color-primary) 92%, #fff);
        border-color: color-mix(in srgb, var(--md-sys-color-primary) 92%, #fff);
        color: var(--md-sys-color-on-primary);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-confirmed-finding-location {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-workspace-header,
    html.cemr-theme-dark:has(.mst-workspace) .mst-report-header,
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-panel-header {
        background-image: none;
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-readonly-banner {
        background-color: color-mix(in srgb, #f0f9ff 16%, var(--md-sys-color-surface));
        border-bottom-color: color-mix(in srgb, #bae6fd 55%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #0369a1 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-error-boundary-box {
        background-color: color-mix(in srgb, #fff1f2 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #fecdd3 55%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #9f1239 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-error-boundary-box p {
        color: color-mix(in srgb, #be123c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-report-footer {
        background-image: none;
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-sf-accordion .e-acrdn-item.e-select .mst-step {
        background-image: none;
        background-color: var(--md-sys-color-primary);
        border-color: var(--md-sys-color-primary);
        color: var(--md-sys-color-on-primary);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-empty {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-card-header {
        background-color: var(--md-sys-color-surface);
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-card-footer {
        background-color: var(--md-sys-color-surface);
        border-top-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-card-comment {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-card-comment.is-empty {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-remove {
        border-color: color-mix(in srgb, #f0cbd0 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-remove:hover {
        background-color: color-mix(in srgb, #fbdde0 16%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-panel-header::before {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-accordion-add-button:hover {
        background-image: none;
        background-color: color-mix(in srgb, var(--md-sys-color-primary) 92%, #fff);
        border-color: color-mix(in srgb, var(--md-sys-color-primary) 92%, #fff);
        color: var(--md-sys-color-on-primary);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-accordion-selected-card-header {
        background-color: var(--md-sys-color-surface);
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-accordion-selected-footer {
        background-color: var(--md-sys-color-surface);
        border-top-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-accordion-card-comment {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-accordion-card-comment.is-empty {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-confirmed-finding-accent {
        background-image: none;
        background-color: var(--md-sys-color-primary);
        border-color: var(--md-sys-color-primary);
        color: var(--md-sys-color-on-primary);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-confirmed-finding-actions button.is-danger:hover {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-confirmed-finding-values > span {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-bbps-radio.is-selected span {
        background-image: none;
        background-color: var(--md-sys-color-primary);
        border-color: var(--md-sys-color-primary);
        color: var(--md-sys-color-on-primary);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-bbps-summary > div {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-bbps-summary-status strong.is-good {
        color: color-mix(in srgb, #18794e 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-bbps-summary-status strong.is-fair {
        color: color-mix(in srgb, #a66a00 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-library-heading strong,
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-heading strong,
    html.cemr-theme-dark:has(.mst-workspace) .mst-section-heading strong {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-icon-button {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-icon-button:hover {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-procedure-image-card:hover {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-procedure-image-card.active {
        background-color: var(--md-sys-color-surface-container);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-procedure-thumbnail {
        background-image: linear-gradient(110deg, var(--md-sys-color-surface-container) 8%, var(--md-sys-color-surface-container-high) 18%, var(--md-sys-color-surface-container) 33%);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-preview-information strong {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-preview-information span {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-comment-textarea {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-comment-textarea:focus {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-editor-spinner {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-syncfusion-image-editor-wrapper.is-comment-drop-target {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-grid-card.is-comment-drop-target {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-grid-card.is-comment-drop-target:hover {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-editor-card {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-compact-section-title {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-compact-anatomy-section {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-anatomy-map-only {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-image-comment-sidebar {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-comment-sidebar-header strong {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-draggable-findings-list {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-draggable-finding {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-draggable-finding:hover {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-comment-editor > label {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-comment-drop-area {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-comment-drop-area .mst-comment-textarea {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-comment-drop-hint {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-clear-comment-button {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-image-patient-header {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-patient-details-line > span {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-patient-details-line strong {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-image-dialog-close {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-image-dialog-close:hover {
        background-color: color-mix(in srgb, #fff1f2 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #dc2626 45%, #ffffff);
        border-color: color-mix(in srgb, #fecdd3 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-anatomy-stage {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-library-refresh-button {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-procedure-image-grid-mode .mst-procedure-image-card:hover {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-grid-card {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-grid-card:hover {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-grid-image,
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-grid-preview {
        background-image: none;
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-grid-number {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-grid-remove {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-grid-remove:hover:not(:disabled) {
        border-color: color-mix(in srgb, #fecaca 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-grid-label > span,
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-grid-label small {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-grid-label small {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-grid-comment {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-grid-comment:hover {
        background-color: var(--md-sys-color-surface-container);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-selected-comment-text {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-fb-patient-header {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-fb-patient-details-line > span {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-fb-patient-details-line strong {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-fb-dialog-close {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-fb-dialog-close:hover {
        background-color: color-mix(in srgb, #fff1f2 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #dc2626 45%, #ffffff);
        border-color: color-mix(in srgb, #fecdd3 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-master-header strong {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-master-header small {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-site-card h3,
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-findings-card h3 {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-search input {
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-site-row {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-site-row:hover {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-site-row.active {
        background-image: none;
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-finding-row:hover {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-finding-row.selected {
        background-image: none;
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-finding-select {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-checkbox {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-selected-panel {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-selected-header strong {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-selected-card:hover,
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-selected-card.active {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-selected-text strong {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-selected-text small {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-selected-text > span {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-add-instance {
        background-color: color-mix(in srgb, var(--md-sys-color-primary) 16%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-editor {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-editor-number {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-editor-header strong {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-editor-actions button {
        color: color-mix(in srgb, #ff3232 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-form-section {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-form-section h3 {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-field label {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-field label sup {
        color: color-mix(in srgb, #f43c3c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-unit-control > span {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-classification-header {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-classification-header strong {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-classification-header small {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-classification-option:hover {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-classification-option.selected {
        background-color: color-mix(in srgb, var(--md-sys-color-primary) 16%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-classification-visual {
        background-image: none;
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-classification-option > strong {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-classification-option > small {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-classification-selected {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-classification-selected strong {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-classification-note label {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-classification-note label span {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-classification-note textarea {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-collapsed-finding > button:first-child {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-collapsed-finding > button:first-child span {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-collapsed-finding > div button {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-collapsed-finding > div button.delete {
        color: color-mix(in srgb, #ff3232 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-editor-footer .cancel {
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-library-layout {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-library-card > header,
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-count-card > header {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-library-search input {
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-library-group-header {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-library-group-header:hover {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-library-item {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-library-item:hover {
        background-color: color-mix(in srgb, var(--md-sys-color-primary) 16%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-library-item.active {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-library-item > small {
        background-color: color-mix(in srgb, #d6f4e5 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #19704d 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-count-total {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-demo-count-list strong {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-pd-check-box {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-pd-number-with-unit > span {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-pd-switch span {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-pd-conditional-row {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-workspace-header {
        background-image: none;
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-workspace-badges span,
    html.cemr-theme-dark:has(.mst-workspace) .mst-score-pill,
    html.cemr-theme-dark:has(.mst-workspace) .mst-status-pill {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-section-title {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-section-count {
        background-color: color-mix(in srgb, var(--md-sys-color-primary) 16%, var(--md-sys-color-surface));
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-workspace) .mst-page-overlay {
        background-color: var(--md-sys-color-surface);
    }

    /* Consultation */
    html.cemr-theme-dark:has(.topics-section) [style*="border: 1px solid #f59e0b"] {
        border-color: color-mix(in srgb, #f59e0b 55%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.topics-section) [style*="background-color: #fffbeb"] {
        background-color: color-mix(in srgb, #fffbeb 16%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.topics-section) [style*="color: #92400e"]:not([style*="background-color: #92400e"]) {
        color: color-mix(in srgb, #92400e 45%, #ffffff) !important;
    }


    html.cemr-theme-dark:has(.topics-section) .back-button {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .card {
        background-color: var(--md-sys-color-surface);
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .card-header {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .action-icons i {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .icon-btn {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .vital-label {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.topics-section) .vital-label-input {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .vital-input {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .delete-vital,
    html.cemr-theme-dark:has(.topics-section) .delete-field {
        color: color-mix(in srgb, #ef4444 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.topics-section) .delete-vital:hover,
    html.cemr-theme-dark:has(.topics-section) .delete-field:hover {
        color: color-mix(in srgb, #dc2626 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.topics-section) .complaint-display {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .suggestion {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.topics-section) .border {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .topic-card {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .topic-card:hover {
        background-color: color-mix(in srgb, #dbeafe 16%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.topics-section) .topic-header {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .toggle-icon:hover {
        color: color-mix(in srgb, #2563eb 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.topics-section) .updated-topic {
        background-color: color-mix(in srgb, #d1fae5 16%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.topics-section) .updated-card {
        background-color: color-mix(in srgb, #ecfdf5 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #10b981 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.topics-section) .updated-tick {
        color: color-mix(in srgb, #10b981 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.topics-section) .medication-row span {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .topics-trigger:hover {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .topic-item {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.topics-section) .topics-section {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .topic-chip {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .topic-chip:hover {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.topics-section) .add-topic-chip {
        background-color: var(--md-sys-color-surface);
        color: color-mix(in srgb, #007bff 45%, #ffffff);
        border-color: color-mix(in srgb, #007bff 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.topics-section) .add-topic-chip:hover {
        background-color: color-mix(in srgb, #e7f1ff 16%, var(--md-sys-color-surface));
    }

    /* Consultation: vitals and history */

    /* Consultation: complaints */
    html.cemr-theme-dark:has(.topics-section) .cc-badge {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .cc-chip:hover {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .cc-dur-chip:hover {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .cc-save-tmpl-btn:hover {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .cc-add-complaint-btn {
        color: var(--cemr-focus-ring);
    }

    /* Consultation: diagnosis */
    html.cemr-theme-dark:has(.topics-section) .dx-badge {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .dx-suggestion-bar {
        background-color: color-mix(in srgb, #fffde7 16%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.topics-section) .dx-suggestion-lbl {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .dx-suggestion-lbl i {
        color: color-mix(in srgb, #e65100 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.topics-section) .dx-suggestion-chip {
        background-color: color-mix(in srgb, #fff8e1 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #ffcc80 55%, var(--md-sys-color-surface));
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.topics-section) .dx-suggestion-chip:hover {
        background-color: color-mix(in srgb, #ffe082 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #ffa000 55%, var(--md-sys-color-surface));
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.topics-section) .dx-icd-hint {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .dx-dismiss-btn {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .dx-chip:hover {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .dx-add-diagnosis-btn {
        color: var(--cemr-focus-ring);
    }

    /* Consultation: diagnosis rows */
    html.cemr-theme-dark:has(.topics-section) .dx-row--open {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.topics-section) .dr-num-badge {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .dr-icd-tag--set {
        color: var(--cemr-focus-ring);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .dr-icd-tag--set:hover {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.topics-section) .dr-icd-tag--empty:hover {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .dr-icd-input {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .dr-chevron--open {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .del-btn:hover {
        background-color: color-mix(in srgb, #fff1f1 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #dc2626 45%, #ffffff);
        border-color: color-mix(in srgb, #fca5a5 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.topics-section) .dr-tpl-save {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.topics-section) .dr-tpl-save:hover:not(:disabled) {
        color: var(--cemr-focus-ring);
    }

    /* Consultation: medication */
    html.cemr-theme-dark:has(.topics-section) [style*="color:#c62828"]:not([style*="background-color:#c62828"]) {
        color: color-mix(in srgb, #c62828 45%, #ffffff) !important;
    }
    html.cemr-theme-dark:has(.topics-section) .rx-badge {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .quick-type-btn:hover {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .rx-fav-chip:hover {
        background-color: var(--md-sys-color-surface-container);
        border-color: color-mix(in srgb, #1d9e75 55%, var(--md-sys-color-surface));
        color: var(--cemr-primary-text);
    }
    html.cemr-theme-dark:has(.topics-section) .rx-regimen-chip {
        background-color: var(--md-sys-color-surface-container);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--cemr-primary-text);
    }
    html.cemr-theme-dark:has(.topics-section) .rx-bundle-chip {
        background-color: var(--md-sys-color-surface-container);
        border-color: var(--md-sys-color-outline-variant);
        color: color-mix(in srgb, #283593 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.topics-section) .rx-bundle-chip:hover {
        border-color: color-mix(in srgb, #283593 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.topics-section) .rx-bundle-chip--selected {
        background-color: var(--md-sys-color-surface-container) !important;
        border-color: color-mix(in srgb, #1d9e75 55%, var(--md-sys-color-surface)) !important;
        color: var(--cemr-primary-text) !important;
    }
    html.cemr-theme-dark:has(.topics-section) .rx-bundle-chip--selected:hover {
        border-color: color-mix(in srgb, #1d9e75 55%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.topics-section) .mr-tpl-btn:hover {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .mr-preset-chip:hover {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .mr-smart-chip {
        background-color: var(--md-sys-color-surface-container);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .type-tab {
        background-color: var(--md-sys-color-surface-container);
        color: color-mix(in srgb, #283593 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.topics-section) .type-cap {
        background-color: var(--md-sys-color-surface-container);
        color: color-mix(in srgb, #00695c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.topics-section) .type-syr {
        background-color: var(--md-sys-color-surface-container);
        color: color-mix(in srgb, #1b5e20 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.topics-section) .type-inj {
        background-color: color-mix(in srgb, #fff3e0 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #bf360c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.topics-section) .type-drp {
        background-color: var(--cemr-ui-hover);
        color: var(--cemr-primary-text);
    }
    html.cemr-theme-dark:has(.topics-section) .type-puf {
        background-color: color-mix(in srgb, #fce4ec 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #ad1457 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.topics-section) .type-spr {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.topics-section) .del-btn {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.topics-section) .del-btn:hover {
        background-color: color-mix(in srgb, #ffebee 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #c62828 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.topics-section) .stepper--on {
        background-color: var(--md-sys-color-surface-container);
        border-color: color-mix(in srgb, var(--md-sys-color-primary) 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.topics-section) .step-btn:hover {
        color: var(--cemr-focus-ring);
    }
    /* Off state only: these used to match selected buttons too and hid their solid fill (Medication.razor .on). */
    html.cemr-theme-dark:has(.topics-section) .bfaf-btn.bf:not(.on) {
        background-color: var(--md-sys-color-surface-container);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .bfaf-btn.af:not(.on) {
        background-color: color-mix(in srgb, #fff8f1 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #ffcc80 55%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #e65100 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.topics-section) .bfaf-btn.af.on {
        border-color: color-mix(in srgb, #e65100 55%, var(--md-sys-color-surface));
    }

    /* Consultation: medication rows */
    html.cemr-theme-dark:has(.topics-section) .mr-num-badge {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .del-btn:hover {
        background-color: color-mix(in srgb, #fff1f1 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #dc2626 45%, #ffffff);
        border-color: color-mix(in srgb, #fca5a5 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.topics-section) .taper-toggle {
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .taper-toggle--on {
        background-color: var(--md-sys-color-surface-container);
        border-color: color-mix(in srgb, var(--md-sys-color-primary) 55%, var(--md-sys-color-surface));
        color: var(--cemr-primary-text);
    }
    html.cemr-theme-dark:has(.topics-section) .taper-toggle:hover {
        background-color: var(--md-sys-color-surface-container);
        border-color: color-mix(in srgb, var(--md-sys-color-primary) 55%, var(--md-sys-color-surface));
        color: var(--cemr-primary-text);
    }
    html.cemr-theme-dark:has(.topics-section) .taper-phase-row {
        background-color: color-mix(in srgb, var(--md-sys-color-primary) 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, var(--md-sys-color-primary) 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.topics-section) .taper-phase-lbl {
        color: var(--cemr-primary-text);
    }
    html.cemr-theme-dark:has(.topics-section) .del-phase-btn {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .del-phase-btn:hover {
        color: color-mix(in srgb, #dc2626 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.topics-section) .add-phase-btn {
        color: var(--cemr-primary-text);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .add-phase-btn:hover {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.topics-section) .taper-ctrl-bar {
        background-color: var(--md-sys-color-surface-container);
        border-color: color-mix(in srgb, var(--md-sys-color-primary) 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.topics-section) .taper-interval-lbl {
        color: var(--cemr-primary-text);
    }
    html.cemr-theme-dark:has(.topics-section) .gen-taper-btn {
        border-color: color-mix(in srgb, #f59e0b 55%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #d97706 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.topics-section) .gen-taper-btn--open,
    html.cemr-theme-dark:has(.topics-section) .gen-taper-btn:hover {
        background-color: color-mix(in srgb, #fef3c7 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #d97706 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.topics-section) .taper-gen-panel {
        background-color: color-mix(in srgb, #fffbeb 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #fde68a 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.topics-section) .taper-gen-lbl {
        color: color-mix(in srgb, #92400e 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.topics-section) .gen-slot-chk {
        color: var(--cemr-primary-text);
    }
    html.cemr-theme-dark:has(.topics-section) .gen-num-input {
        background-color: var(--md-sys-color-surface);
        border-color: color-mix(in srgb, #fcd34d 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.topics-section) .gen-num-input:focus {
        border-color: color-mix(in srgb, #d97706 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.topics-section) .gen-taper-go-btn:disabled {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.topics-section) .gen-taper-cancel-btn {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .gen-taper-cancel-btn:hover {
        color: color-mix(in srgb, #dc2626 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.topics-section) .clone-phase-btn {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .clone-phase-btn:hover {
        color: var(--cemr-primary-text);
    }
    html.cemr-theme-dark:has(.topics-section) .taper-summary {
        background-color: var(--md-sys-color-surface-container);
        color: var(--cemr-primary-text);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .taper-summary-sep {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .taper-total-pill {
        background-color: var(--md-sys-color-surface-container);
        color: var(--cemr-primary-text);
        border-color: color-mix(in srgb, var(--md-sys-color-primary) 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.topics-section) .drug-item-sep {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .drug-item-comp {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.topics-section) .drug-item-company {
        color: var(--cemr-primary-text);
    }

    /* Consultation: examination */
    html.cemr-theme-dark:has(.topics-section) .investigation-upload-queue {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }

    /* Consultation: shared row styles */
    html.cemr-theme-dark:has(.topics-section) .ar-del-btn:hover,
    html.cemr-theme-dark:has(.topics-section) .imr-del-btn:hover,
    html.cemr-theme-dark:has(.topics-section) .ccr-del-btn:hover,
    html.cemr-theme-dark:has(.topics-section) .dxr-del-btn:hover,
    html.cemr-theme-dark:has(.topics-section) .invr-del-btn:hover {
        background-color: color-mix(in srgb, #ffebee 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #c62828 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.topics-section) .allergy-known-bar {
        background-color: var(--md-sys-color-surface);
        border-bottom-color: color-mix(in srgb, #f7c1c1 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.topics-section) .allergy-lbl {
        color: color-mix(in srgb, #a32d2d 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.topics-section) .allergy-chip--warning {
        background-color: color-mix(in srgb, #fcebeb 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #a32d2d 45%, #ffffff);
        border-color: color-mix(in srgb, #f7c1c1 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.topics-section) .ccr-dur-chip:hover {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .ccr-dur-chip--display {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .dxr-icd-chip:hover {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .dxr-bookmark-btn:hover {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .invr-row--abnormal .invr-cell {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.topics-section) .invr-result-cell--abnormal {
        background-color: color-mix(in srgb, #fff4f4 16%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.topics-section) .invr-result-input--abnormal {
        background-color: color-mix(in srgb, #fff4f4 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #f09595 55%, var(--md-sys-color-surface)) !important;
        color: color-mix(in srgb, #a32d2d 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.topics-section) .invr-abnormal-flag {
        color: color-mix(in srgb, #e24b4a 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.topics-section) .invr-action-btn:hover {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.topics-section) .imr-date-chip {
        color: var(--cemr-focus-ring);
    }

    /* Specialty charts */
    html.cemr-theme-dark:has(.specialty-card) .specialty-nav {
        background-color: var(--md-sys-color-surface);
        border-right-color: var(--md-sys-color-outline-variant);
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-label {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-required {
        color: color-mix(in srgb, #dc2626 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-select,
    html.cemr-theme-dark:has(.specialty-card) .specialty-input {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-exam-item {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-exam-item small {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-exam-item.active {
        background-color: var(--cemr-ui-hover);
        color: color-mix(in srgb, #075985 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-form-panel {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-form-heading {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-form-heading h6 {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-form-heading p {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-version {
        background-color: var(--cemr-ui-hover);
        color: var(--cemr-primary-text);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-check {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-check small {
        color: var(--cemr-primary-text);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-radio-list label {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-help {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-image-wrapper {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-table-label {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-th-group {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-th-col {
        background-color: color-mix(in srgb, var(--md-sys-color-primary) 16%, var(--md-sys-color-surface));
        color: var(--cemr-primary-text);
        border-color: color-mix(in srgb, var(--md-sys-color-primary) 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-th-row-label {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-td-row-label {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-td-cell {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-table-input {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-table-input:focus {
        background-color: color-mix(in srgb, #eff6ff 16%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-result-strip {
        border-top-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-score-box,
    html.cemr-theme-dark:has(.specialty-card) .specialty-interpretation {
        background-color: var(--cemr-ui-hover);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-score-box span,
    html.cemr-theme-dark:has(.specialty-card) .specialty-interpretation span {
        color: var(--cemr-primary-text);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-score-box strong {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-interpretation strong {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-alert-success {
        background-color: color-mix(in srgb, #ecfdf3 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #bbf7d0 55%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #166534 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-alert-warning {
        background-color: color-mix(in srgb, #fff7ed 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #fed7aa 55%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #9a3412 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.specialty-card) .specialty-empty {
        color: var(--md-sys-color-on-surface-variant);
    }

    /* Audiometry */
    html.cemr-theme-dark:has(.specialty-card) .audiometry-container {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.specialty-card) .audiometry-average-toggle {
        color: color-mix(in srgb, #0f5132 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.specialty-card) .right-ear .audiometry-table thead {
        border-top-color: color-mix(in srgb, #dc3545 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.specialty-card) .left-ear .audiometry-table thead {
        border-top-color: color-mix(in srgb, #0d6efd 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.specialty-card) .averages-container {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.specialty-card) .legend-card {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }

    /* Impedance audiometry */
    html.cemr-theme-dark:has(.specialty-card) .audiometry-container {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.specialty-card) .right-ear .audiometry-table thead {
        border-top-color: color-mix(in srgb, #dc3545 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.specialty-card) .left-ear .audiometry-table thead {
        border-top-color: color-mix(in srgb, #0d6efd 55%, var(--md-sys-color-surface));
    }

    /* Patient attachments */

    /* Stock ledger */
    html.cemr-theme-dark:has(.pharmacy-stock-ledger-page) [style*="background: #f1f5f9"] {
        background-color: var(--md-sys-color-surface-container) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-stock-ledger-page) [style*="color: #475569"]:not([style*="background-color: #475569"]) {
        color: var(--md-sys-color-on-surface-variant) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-stock-ledger-page) [style*="background: #dcfce7"] {
        background-color: color-mix(in srgb, #dcfce7 16%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-stock-ledger-page) [style*="color: #16a34a"]:not([style*="background-color: #16a34a"]) {
        color: color-mix(in srgb, #16a34a 45%, #ffffff) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-stock-ledger-page) [style*="background: #fee2e2"] {
        background-color: color-mix(in srgb, #fee2e2 16%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-stock-ledger-page) [style*="color: #dc2626"]:not([style*="background-color: #dc2626"]) {
        color: color-mix(in srgb, #dc2626 45%, #ffffff) !important;
    }

    /* Pharmacy pages */
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-secondary-button {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-danger-button {
        background-color: color-mix(in srgb, #fff5f5 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #f4cccc 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .status-success {
        background-color: var(--md-sys-color-surface-container);
        color: color-mix(in srgb, #147a50 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .status-warning {
        background-color: color-mix(in srgb, #fff3dc 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #a96708 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .status-danger {
        background-color: color-mix(in srgb, #ffeded 16%, var(--md-sys-color-surface));
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .status-info {
        background-color: color-mix(in srgb, #edf2ff 16%, var(--md-sys-color-surface));
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .status-neutral {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-icon-button {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-summary-list > div {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-report-card {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .report-arrow {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-master-card {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-master-card:hover {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-master-card > i {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-bill-history-item {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-bill-history-item:hover {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .bill-status-paid {
        background-color: var(--md-sys-color-surface-container);
        color: color-mix(in srgb, #147a4d 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .bill-status-pending {
        background-color: color-mix(in srgb, #fff1d7 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #a76105 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .bill-status-partial {
        background-color: color-mix(in srgb, #eef1f5 16%, var(--md-sys-color-surface));
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .bill-status-cancelled {
        background-color: color-mix(in srgb, #ffebeb 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #bf3434 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .bill-dialog-actions {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-bill-print-area {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .bill-hospital-information p {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .bill-hospital-information span {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .bill-section-title {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .bill-medicine-table th {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .bill-medicine-table td {
        color: var(--md-sys-color-on-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .bill-total-table {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .bill-total-table > div {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .bill-document-footer {
        border-top-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .content:has(.pharmacy-viewport-page),
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .content:has(.pos-return-root) {
        background-color: var(--md-sys-color-surface) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .content:has(.pharmacy-stock-ledger-page),
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .content:has(.pharmacy-audit-page) {
        background-color: var(--md-sys-color-surface) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-viewport-page {
        background-color: var(--md-sys-color-surface) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-viewport-page .pharmacy-page-header {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-viewport-page .pharmacy-title-icon {
        background-color: var(--md-sys-color-surface-container);
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-viewport-page .pharmacy-title-text h1 {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-viewport-page .pharmacy-title-text p {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-btn-secondary {
        background-color: var(--md-sys-color-surface) !important;
        color: var(--md-sys-color-on-surface) !important;
        border-color: var(--md-sys-color-outline-variant) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-btn-secondary:hover {
        background-color: var(--md-sys-color-surface-container) !important;
        color: var(--cemr-focus-ring) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-viewport-page .pharmacy-grid-card {
        background-color: var(--md-sys-color-surface) !important;
        border-color: var(--md-sys-color-outline-variant) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-dialog-title {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-dialog-subtitle {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pos-search-kbd {
        background-color: var(--md-sys-color-surface-container);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .invoice-patient-item-active,
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pos-patient-item-active {
        background-color: color-mix(in srgb, #e0f2fe 16%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .invoice-patient-item-active .invoice-patient-name,
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pos-patient-item-active .pos-pt-name {
        color: var(--md-sys-color-on-surface) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .btn-substitute-add:hover,
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .btn-substitute-add:focus {
        border-color: var(--md-sys-color-outline-variant) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .btn-receive-pending {
        background-color: var(--md-sys-color-surface) !important;
        color: var(--md-sys-color-on-surface) !important;
        border-color: var(--md-sys-color-outline-variant) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .btn-receive-pending,
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .btn-receive-pending * {
        color: var(--md-sys-color-on-surface) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .btn-receive-pending:hover,
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .btn-receive-pending:focus {
        background-color: var(--md-sys-color-surface) !important;
        color: var(--md-sys-color-on-surface) !important;
        border-color: var(--md-sys-color-outline-variant) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .btn-receive-pending:hover *,
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .btn-receive-pending:focus * {
        color: var(--md-sys-color-on-surface) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-viewport-page.pharmacy-stock-ledger-page {
        background-color: var(--md-sys-color-surface) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-stock-ledger-page .pharmacy-grid-card {
        background-color: var(--md-sys-color-surface) !important;
        border-color: var(--md-sys-color-outline-variant) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-viewport-page.pharmacy-audit-page {
        background-color: var(--md-sys-color-surface) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pharmacy-audit-page .pharmacy-grid-card {
        background-color: var(--md-sys-color-surface) !important;
        border-color: var(--md-sys-color-outline-variant) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pos-badge-inward {
        background-color: var(--md-sys-color-surface-container) !important;
        color: var(--cemr-focus-ring) !important;
        border-color: var(--md-sys-color-outline-variant) !important;
    }
    html.cemr-theme-dark:has(.pharmacy-viewport-page) .pos-badge-refund {
        background-color: color-mix(in srgb, #fee2e2 16%, var(--md-sys-color-surface)) !important;
        color: color-mix(in srgb, #b91c1c 45%, #ffffff) !important;
        border-color: color-mix(in srgb, #fca5a5 55%, var(--md-sys-color-surface)) !important;
    }

    /* Role permissions dialog */
    html.cemr-theme-dark:has(.filter-tabs) .header-chip {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.filter-tabs) .dirty-badge {
        background-color: color-mix(in srgb, #fff7ed 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #fdba74 55%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #c2410c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.filter-tabs) .header-title {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .role-highlight {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.filter-tabs) .header-subtitle {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .stat-box {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .stat-box--highlight .stat-number {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.filter-tabs) .stat-box--warning {
        background-color: color-mix(in srgb, #fff7ed 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #ea580c 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.filter-tabs) .stat-box--warning .stat-number {
        color: color-mix(in srgb, #ea580c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.filter-tabs) .stat-box--error {
        background-color: color-mix(in srgb, #fff1f2 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #e11d48 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.filter-tabs) .stat-box--error .stat-number {
        color: color-mix(in srgb, #e11d48 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.filter-tabs) .stat-number {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .stat-label {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .filter-tabs {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.filter-tabs) .filter-tab {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .filter-tab.active {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .filter-tab--granted.active {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.filter-tabs) .filter-tab--modified.active {
        color: color-mix(in srgb, #ea580c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.filter-tabs) .filter-tab--unassigned.active {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .toggle-btn {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .toggle-btn:hover {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .toolbar-subrow {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .clone-label {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .clone-select {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .preset-label {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .preset-chip {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .action-btn--primary {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.filter-tabs) .action-btn--secondary {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .action-btn--secondary:hover {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .action-btn--danger {
        background-color: color-mix(in srgb, #fff1f2 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #e11d48 45%, #ffffff);
        border-color: color-mix(in srgb, #e11d48 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.filter-tabs) .dependency-warning {
        background-color: color-mix(in srgb, #fff1f2 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #e11d48 55%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #9f1239 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.filter-tabs) .empty-state {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .empty-icon {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .empty-state h4 {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .empty-state p {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .module-accordion-item {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .module-accordion-header {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .module-accordion-header:hover {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .module-accordion-header.expanded {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .module-name {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .module-count {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .progress-bar {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.filter-tabs) .progress-text {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .mini-btn {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .mini-btn:hover {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .module-accordion-content {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .permission-item-accordion {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .permission-item-accordion.is-modified {
        border-color: color-mix(in srgb, #ea580c 55%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.filter-tabs) .permission-item-accordion.invalid {
        background-color: color-mix(in srgb, #fff1f2 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #fda4af 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.filter-tabs) .perm-action {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .perm-code-tag {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .perm-description {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .sensitive-tag {
        background-color: color-mix(in srgb, #ffedd5 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #9a3412 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.filter-tabs) .admin-lock-notice {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .dependency-status {
        color: color-mix(in srgb, #166534 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.filter-tabs) .dependency-status.warning {
        color: color-mix(in srgb, #b45309 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.filter-tabs) .modified-tag.added {
        background-color: color-mix(in srgb, #dcfce7 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #15803d 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.filter-tabs) .modified-tag.revoked {
        background-color: color-mix(in srgb, #fee2e2 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #b91c1c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.filter-tabs) .perm-dependency.missing {
        color: color-mix(in srgb, #dc2626 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.filter-tabs) .perm-dependency.satisfied {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .perm-dependents {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.filter-tabs) .perm-indicator {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.filter-tabs) .perm-indicator.invalid {
        color: color-mix(in srgb, #e11d48 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.filter-tabs) .info-text {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .unsaved-badge {
        background-color: color-mix(in srgb, #fff7ed 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #fdba74 55%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #c2410c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.filter-tabs) .invalid-warning {
        color: color-mix(in srgb, #dc2626 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.filter-tabs) .modal-header-danger {
        color: color-mix(in srgb, #b91c1c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.filter-tabs) .impact-lead {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .impact-list {
        background-color: color-mix(in srgb, #fff1f2 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #fecdd3 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.filter-tabs) .impact-module-badge {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .impact-perm-name {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .impact-perm-code {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .impact-note {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .diff-chip {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.filter-tabs) .diff-title {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .diff-subtitle {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .diff-stat-pill.add {
        background-color: color-mix(in srgb, #dcfce7 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #15803d 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.filter-tabs) .diff-stat-pill.del {
        background-color: color-mix(in srgb, #fee2e2 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #b91c1c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.filter-tabs) .diff-stat-pill.total {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .diff-section-title.add {
        color: color-mix(in srgb, #16a34a 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.filter-tabs) .diff-section-title.del {
        color: color-mix(in srgb, #dc2626 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.filter-tabs) .diff-items-list {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.filter-tabs) .diff-mod {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .diff-item.add .diff-name {
        color: color-mix(in srgb, #15803d 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.filter-tabs) .diff-item.del .diff-name {
        color: color-mix(in srgb, #b91c1c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.filter-tabs) .modal-header-warn {
        color: color-mix(in srgb, #c2410c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.filter-tabs) .unsaved-guard-body {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.filter-tabs) .text-muted {
        color: var(--md-sys-color-on-surface-variant);
    }

    /* IPD pharmacy worklist */
    html.cemr-theme-dark:has(.ipd-page-container) [style*="background: #fff"] {
        background-color: var(--md-sys-color-surface) !important;
    }
    html.cemr-theme-dark:has(.ipd-page-container) [style*="border: 1px solid #e5e7eb"] {
        border-color: var(--md-sys-color-outline-variant) !important;
    }
    html.cemr-theme-dark:has(.ipd-page-container) [style*="background: #e0f2fe"] {
        background-color: color-mix(in srgb, #e0f2fe 16%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.ipd-page-container) [style*="color: #0f172a"]:not([style*="background-color: #0f172a"]) {
        color: var(--md-sys-color-on-surface) !important;
    }
    html.cemr-theme-dark:has(.ipd-page-container) [style*="background-color: #dcfce7"] {
        background-color: color-mix(in srgb, #dcfce7 16%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.ipd-page-container) [style*="color: #15803d"]:not([style*="background-color: #15803d"]) {
        color: color-mix(in srgb, #15803d 45%, #ffffff) !important;
    }
    html.cemr-theme-dark:has(.ipd-page-container) [style*="background-color: #fef3c7"] {
        background-color: color-mix(in srgb, #fef3c7 16%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.ipd-page-container) [style*="color: #d97706"]:not([style*="background-color: #d97706"]) {
        color: color-mix(in srgb, #d97706 45%, #ffffff) !important;
    }
    html.cemr-theme-dark:has(.ipd-page-container) [style*="background: #ede9fe"] {
        background-color: color-mix(in srgb, var(--md-sys-color-primary) 16%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.ipd-page-container) [style*="background: #f0fdf4"] {
        background-color: color-mix(in srgb, #f0fdf4 16%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.ipd-page-container) [style*="border-color: #bbf7d0 !important"] {
        border-color: color-mix(in srgb, #bbf7d0 55%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.ipd-page-container) [style*="color: #475569"]:not([style*="background-color: #475569"]) {
        color: var(--md-sys-color-on-surface-variant) !important;
    }
    html.cemr-theme-dark:has(.ipd-page-container) [style*="background-color: #e0f2fe"] {
        background-color: color-mix(in srgb, #e0f2fe 16%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.ipd-page-container) [style*="color: #0369a1"]:not([style*="background-color: #0369a1"]) {
        color: color-mix(in srgb, #0369a1 45%, #ffffff) !important;
    }
    html.cemr-theme-dark:has(.ipd-page-container) [style*="background-color: #fee2e2"] {
        background-color: color-mix(in srgb, #fee2e2 16%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.ipd-page-container) [style*="color: #b91c1c"]:not([style*="background-color: #b91c1c"]) {
        color: color-mix(in srgb, #b91c1c 45%, #ffffff) !important;
    }
    html.cemr-theme-dark:has(.ipd-page-container) [style*="background: #f8fafc"] {
        background-color: var(--md-sys-color-surface) !important;
    }
    html.cemr-theme-dark:has(.ipd-page-container) [style*="border: 1px solid #e2e8f0"] {
        border-color: var(--md-sys-color-outline-variant) !important;
    }
    html.cemr-theme-dark:has(.ipd-page-container) [style*="border-color: #86efac !important"] {
        border-color: color-mix(in srgb, #86efac 55%, var(--md-sys-color-surface)) !important;
    }

    /* Attachment viewer */
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-count {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-loading,
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-empty {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-gallery-card {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-gallery-card:hover {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-thumb {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-icon-thumb {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-file-name {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-file-meta {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-table-file i {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-modal-container {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-modal-header,
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-modal-footer {
        background-color: var(--md-sys-color-surface);
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-modal-header h4 {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-modal-header span {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-modal-footer {
        border-top-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-modal-close {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-modal-body {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-modal-iframe {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-preview-fallback {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-preview-fallback span {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-delete-confirm {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-delete-confirm h4 {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(:is(.attachment-count, .attachment-empty, .attachment-loading)) .attachment-delete-confirm p {
        color: var(--md-sys-color-on-surface-variant);
    }

    /* Role edit dialog */
    html.cemr-theme-dark:has(.gc-dialog-form) .gc-label {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.gc-dialog-form) .gc-required {
        color: color-mix(in srgb, #e11d48 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.gc-dialog-form) .gc-input {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.gc-dialog-form) .gc-form-actions {
        border-top-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.gc-dialog-form) .gc-btn--secondary {
        background-color: var(--md-sys-color-surface);
        color: var(--md-sys-color-on-surface-variant);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.gc-dialog-form) .gc-btn--secondary:hover {
        background-color: var(--md-sys-color-surface-container);
    }

    /* MST biopsy dialog */
    html.cemr-theme-dark:has(.mst-biopsy-dialog-content) .mst-procedure-dialog-header {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-biopsy-dialog-content) .mst-count-badge.biopsy {
        background-color: color-mix(in srgb, var(--md-sys-color-primary) 16%, var(--md-sys-color-surface));
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-biopsy-dialog-content) .mst-count-badge.intervention {
        background-color: var(--md-sys-color-surface-container);
        color: color-mix(in srgb, #187858 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.mst-biopsy-dialog-content) .mst-patient-summary {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-biopsy-dialog-content) .mst-clinical-grid-section {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-biopsy-dialog-content) .mst-row-number {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-biopsy-dialog-content) .mst-site-cell strong {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-biopsy-dialog-content) .mst-site-cell small {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-biopsy-dialog-content) .mst-intervention-details span {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-biopsy-dialog-content) .mst-intervention-details label {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-biopsy-dialog-content) .mst-outcome {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-biopsy-dialog-content) .mst-outcome.successful {
        background-color: var(--md-sys-color-surface-container);
        color: color-mix(in srgb, #187153 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.mst-biopsy-dialog-content) .mst-outcome.partial {
        background-color: color-mix(in srgb, #fff5db 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #987015 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.mst-biopsy-dialog-content) .mst-outcome.unsuccessful,
    html.cemr-theme-dark:has(.mst-biopsy-dialog-content) .mst-outcome.complication {
        background-color: color-mix(in srgb, #ffebed 16%, var(--md-sys-color-surface));
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-biopsy-dialog-content) .mst-outcome.abandoned {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-biopsy-dialog-content) .mst-command-edit {
        color: var(--md-sys-color-on-surface-variant) !important;
    }
    html.cemr-theme-dark:has(.mst-biopsy-dialog-content) .mst-command-delete {
        color: color-mix(in srgb, #d95361 45%, #ffffff) !important;
    }
    html.cemr-theme-dark:has(.mst-biopsy-dialog-content) .mst-command-save {
        color: color-mix(in srgb, #19865f 45%, #ffffff) !important;
    }
    html.cemr-theme-dark:has(.mst-biopsy-dialog-content) .mst-command-cancel {
        color: var(--md-sys-color-on-surface-variant) !important;
    }
    html.cemr-theme-dark:has(.mst-biopsy-dialog-content) .mst-dialog-footer-summary {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-biopsy-dialog-content) .mst-dialog-footer-summary i {
        color: color-mix(in srgb, #1c9069 45%, #ffffff);
    }

    /* MST finding builder dialog */
    html.cemr-theme-dark:has(.mst-builder-dialog) .mst-builder-header-slot {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-builder-dialog) .mst-builder-column {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-builder-dialog) .mst-builder-master-column {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-builder-dialog) .mst-builder-selected-column {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-builder-dialog) .mst-builder-editor-column {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-builder-dialog) .mst-builder-library-column {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-builder-dialog) .mst-demo-selected-panel {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-builder-dialog) .mst-demo-selected-header {
        background-color: var(--md-sys-color-surface);
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-builder-dialog) .mst-demo-selected-header strong {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-builder-dialog) .mst-demo-selected-header button {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.mst-builder-dialog) .mst-demo-selected-header button:hover:not(:disabled) {
        background-color: color-mix(in srgb, var(--md-sys-color-primary) 16%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.mst-builder-dialog) .mst-demo-selected-card {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-builder-dialog) .mst-demo-selected-card:hover {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.mst-builder-dialog) .mst-demo-selected-card.active {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.mst-builder-dialog) .mst-demo-selected-text strong {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.mst-builder-dialog) .mst-demo-selected-text small {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.mst-builder-dialog) .mst-demo-selected-text > span {
        color: var(--md-sys-color-on-surface-variant);
    }

    /* Patient overview */
    html.cemr-theme-dark:has(.p360-shell) [style*="color:#667085"]:not([style*="background-color:#667085"]) {
        color: var(--md-sys-color-on-surface-variant) !important;
    }
    html.cemr-theme-dark:has(.p360-shell) .p360-shell {
        background-image: none;
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.p360-shell) .p360-loading {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .loading-spinner {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .patient-hero {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .icon-back {
        background-color: var(--md-sys-color-surface);
        border-color: color-mix(in srgb, var(--md-sys-color-primary) 55%, var(--md-sys-color-surface));
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.p360-shell) .patient-hero h1 {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.p360-shell) .patient-meta-inline {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .pill.blue {
        background-color: color-mix(in srgb, #e8f7ff 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #0369a1 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.p360-shell) .pill.green {
        background-color: color-mix(in srgb, #e8fff3 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #047857 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.p360-shell) .pill.red {
        background-color: color-mix(in srgb, #fff0f0 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #b91c1c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.p360-shell) .pill.amber {
        background-color: color-mix(in srgb, #fff7de 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #9a5b00 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.p360-shell) .visit-hero-select {
        color: var(--cemr-focus-ring);
        border-color: color-mix(in srgb, var(--md-sys-color-primary) 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.p360-shell) .visit-hero-select:hover {
        background-color: color-mix(in srgb, var(--md-sys-color-primary) 16%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.p360-shell) .visit-panel {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .panel-head p {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .panel-head-count {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.p360-shell) .visit-card {
        background-color: color-mix(in srgb, #f8fbfd 16%, var(--md-sys-color-surface));
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .visit-card span {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .visit-card small.visit-times {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .visit-card em,
    html.cemr-theme-dark:has(.p360-shell) .appt-status-badge {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .appt-status-badge.completed,
    html.cemr-theme-dark:has(.p360-shell) .appt-status-badge.done,
    html.cemr-theme-dark:has(.p360-shell) .appt-status-badge.consulted {
        background-color: color-mix(in srgb, #e8fff3 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #047857 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.p360-shell) .appt-status-badge.in-progress,
    html.cemr-theme-dark:has(.p360-shell) .appt-status-badge.consulting,
    html.cemr-theme-dark:has(.p360-shell) .appt-status-badge.in-consultation {
        background-color: color-mix(in srgb, #e0f2fe 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #0369a1 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.p360-shell) .appt-status-badge.scheduled,
    html.cemr-theme-dark:has(.p360-shell) .appt-status-badge.booked,
    html.cemr-theme-dark:has(.p360-shell) .appt-status-badge.waiting {
        background-color: color-mix(in srgb, #fff7de 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #9a5b00 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.p360-shell) .appt-status-badge.cancelled,
    html.cemr-theme-dark:has(.p360-shell) .appt-status-badge.no-show,
    html.cemr-theme-dark:has(.p360-shell) .appt-status-badge.no-appt {
        background-color: color-mix(in srgb, #fff0f0 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #b91c1c 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.p360-shell) .clinical-card {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .card-title-row span,
    html.cemr-theme-dark:has(.p360-shell) .card-title-row button {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.p360-shell) .summary-grid div,
    html.cemr-theme-dark:has(.p360-shell) .vital-box {
        background-color: color-mix(in srgb, #f8fbfd 16%, var(--md-sys-color-surface));
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) label {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .summary-grid p {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .summary-inline-value .item-name {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.p360-shell) .summary-inline-value .item-details {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .alert-card {
        background-image: none;
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.p360-shell) .alert-list div {
        background-color: color-mix(in srgb, #fffaf4 16%, var(--md-sys-color-surface));
        border-color: color-mix(in srgb, #ffe2be 55%, var(--md-sys-color-surface));
    }
    html.cemr-theme-dark:has(.p360-shell) .alert-list b {
        color: color-mix(in srgb, #9a3412 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.p360-shell) .vital-box strong {
        color: color-mix(in srgb, #047857 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.p360-shell) .vital-box.warn strong {
        color: color-mix(in srgb, #d97706 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.p360-shell) .vital-box.missing strong {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .vital-box span {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .history-list div,
    html.cemr-theme-dark:has(.p360-shell) .lab-list div {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .history-list span,
    html.cemr-theme-dark:has(.p360-shell) .lab-list span,
    html.cemr-theme-dark:has(.p360-shell) .lab-list small {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .lab-list .high {
        color: color-mix(in srgb, #d97706 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.p360-shell) .lab-inline-value .item-name {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.p360-shell) .lab-inline-value .item-details {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .bill-card {
        background-color: color-mix(in srgb, #f8fbfd 16%, var(--md-sys-color-surface));
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .bill-invoice {
        color: var(--cemr-focus-ring);
    }
    html.cemr-theme-dark:has(.p360-shell) .bill-date {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .bill-doctor label {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .bill-amount label,
    html.cemr-theme-dark:has(.p360-shell) .bill-pay label {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.p360-shell) .bill-total {
        color: color-mix(in srgb, #047857 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.p360-shell) .bill-mode-badge {
        background-color: color-mix(in srgb, #e8f7ff 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #0369a1 45%, #ffffff);
    }

    /* Pharmacy query builder */
    html.cemr-theme-dark:has(.pqb-page) .pqb-page {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.pqb-page) .pqb-subtitle {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pqb-page) .pqb-card {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.pqb-page) .pqb-card-title {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pqb-page) .pqb-type-toggle {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.pqb-page) .pqb-active-chip {
        background-color: var(--md-sys-color-surface-container);
        color: color-mix(in srgb, #1a4f7a 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pqb-page) .pqb-hint {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.pqb-page) .pqb-msg-ok {
        background-color: var(--md-sys-color-surface-container);
        color: color-mix(in srgb, #0f6e56 45%, #ffffff);
    }
    html.cemr-theme-dark:has(.pqb-page) .pqb-msg-error {
        background-color: color-mix(in srgb, #faece7 16%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #993c1d 45%, #ffffff);
    }

    /* Dashboard components dialog */
    html.cemr-theme-dark:has(.permission-dialog) .page-title {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.permission-dialog) .permission-info div {
        background-color: var(--md-sys-color-surface);
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.permission-dialog) .permission-info label {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.permission-dialog) .permission-info h4 {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.permission-dialog) .component-list {
        border-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.permission-dialog) .component-row {
        border-bottom-color: var(--md-sys-color-outline-variant);
    }
    html.cemr-theme-dark:has(.permission-dialog) .component-row strong {
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.permission-dialog) .component-row small {
        color: var(--md-sys-color-on-surface-variant);
    }
    html.cemr-theme-dark:has(.permission-dialog) .switch span {
        background-color: var(--md-sys-color-surface-container);
    }
    html.cemr-theme-dark:has(.permission-dialog) .switch span:before {
        background-color: var(--md-sys-color-surface);
    }
    html.cemr-theme-dark:has(.permission-dialog) .cancel-btn {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface);
    }
    html.cemr-theme-dark:has(.permission-dialog) .access-denied {
        background-color: var(--md-sys-color-surface);
        border-color: color-mix(in srgb, #fecaca 55%, var(--md-sys-color-surface));
        color: color-mix(in srgb, #991b1b 45%, #ffffff);
    }

    /* IPD package dialog */
    html.cemr-theme-dark:has(.e-dialog) [style*="background:#e0e7ff"] {
        background-color: color-mix(in srgb, #e0e7ff 16%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.e-dialog) [style*="color:#3730a3"]:not([style*="background-color:#3730a3"]) {
        color: var(--md-sys-color-on-surface-variant) !important;
    }
    html.cemr-theme-dark:has(.e-dialog) [style*="background:#f0fdf4"] {
        background-color: color-mix(in srgb, #f0fdf4 16%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.e-dialog) [style*="border:1px solid #bbf7d0"] {
        border-color: color-mix(in srgb, #bbf7d0 55%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.e-dialog) [style*="color:#166534"]:not([style*="background-color:#166534"]) {
        color: color-mix(in srgb, #166534 45%, #ffffff) !important;
    }
    html.cemr-theme-dark:has(.e-dialog) [style*="background:#f8fafc"] {
        background-color: var(--md-sys-color-surface) !important;
    }
    html.cemr-theme-dark:has(.e-dialog) [style*="border:1px solid #e2e8f0"] {
        border-color: var(--md-sys-color-outline-variant) !important;
    }
    html.cemr-theme-dark:has(.e-dialog) [style*="background:#ffffff"] {
        background-color: var(--md-sys-color-surface) !important;
    }
    html.cemr-theme-dark:has(.e-dialog) [style*="border:1px solid #cbd5e1"] {
        border-color: var(--md-sys-color-outline-variant) !important;
    }
    html.cemr-theme-dark:has(.e-dialog) [style*="background:#fef2f2"] {
        background-color: color-mix(in srgb, #fef2f2 16%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.e-dialog) [style*="border:1px solid #fecaca"] {
        border-color: color-mix(in srgb, #fecaca 55%, var(--md-sys-color-surface)) !important;
    }
    html.cemr-theme-dark:has(.e-dialog) [style*="color:#991b1b"]:not([style*="background-color:#991b1b"]) {
        color: color-mix(in srgb, #991b1b 45%, #ffffff) !important;
    }
}
