:root {
    /* ChannelDock dark palette — single source for surfaces, borders, text */
    --cd-surface-base: #16181B;
    --cd-surface-sidebar: #181b1f;
    --cd-surface-raised: #202124;
    --cd-surface-overlay: #242528;
    --cd-surface-elevated: #2a2b2e;
    --cd-surface-input: #2a2b2e;
    --cd-surface-hover: rgba(255, 255, 255, 0.05);
    --cd-border-subtle: rgba(255, 255, 255, 0.06);
    --cd-border-default: rgba(255, 255, 255, 0.1);
    --cd-text-muted: rgba(254, 254, 254, 0.5);
    --cd-text-secondary: rgba(254, 254, 254, 0.68);

    --bs-blue: var(--primary);
    --bs-indigo: #6610f2;
    --bs-purple: #6f42c1;
    --bs-pink: #e83e8c;
    --bs-red: #d9534f;
    --bs-orange: #fd7e14;
    --bs-yellow: #cc8b37;
    --bs-green: #4bbf73;
    --bs-teal: #20c997;
    --bs-cyan: #1f9bcf;
    --bs-black: #fff;
    --bs-white: #333333;
    --bs-gray: #a9acb3;
    --bs-gray-dark: #d4d6d9;
    --bs-gray-100: #3e4555;
    --bs-gray-200: #545968;
    --bs-gray-300: #696e7b;
    --bs-gray-400: #7f838e;
    --bs-gray-500: #9498a1;
    --bs-gray-600: #a9acb3;
    --bs-gray-700: #bfc1c6;
    --bs-gray-800: #d4d6d9;
    --bs-gray-900: #eaeaec;
    --bs-primary: var(--primary);
    --bs-secondary: #7f838e;
    --bs-success: #4bbf73;
    --bs-info: #1f9bcf;
    --bs-warning: #cc8b37;
    --bs-danger: #d9534f;
    --bs-light: #343a4b;
    --bs-dark: #eaeaec;
    --bs-primary-rgb: var(--primary-rgb);
    --bs-secondary-rgb: 127, 131, 142;
    --bs-success-rgb: 75, 191, 115;
    --bs-info-rgb: 31, 155, 207;
    --bs-warning-rgb: 204, 139, 55;
    --bs-danger-rgb: 217, 83, 79;
    --bs-light-rgb: 52, 58, 75;
    --bs-dark-rgb: 234, 234, 236;
    --bs-white-rgb: 41, 48, 66;
    --bs-black-rgb: 255, 255, 255;
    --bs-body-font-family: var(--bs-font-sans-serif);
    --bs-body-font-size: 0.825rem;
    --bs-body-font-weight: 400;
    --bs-body-line-height: 1.625;
    --bs-border-width: 1px;
    --bs-border-style: solid;
    --bs-border-color: rgba(255, 255, 255, 0.1);
    --bs-border-color-translucent: hsla(0, 0%, 20%, .175);
    --bs-border-radius: 0.2rem;
    --bs-border-radius-sm: 0.1rem;
    --bs-border-radius-lg: 0.3rem;
    --bs-border-radius-xl: 1rem;
    --bs-border-radius-2xl: 2rem;
    --bs-border-radius-pill: 50rem;
    --bs-link-color: var(--primary);
    --bs-link-hover-color: var(--primary-hover);
    --bs-code-color: #e83e8c;
    --bs-highlight-bg:#f5e8d7;

    --bs-body-bg-rgb: 22, 24, 27;
    --bs-body-bg: var(--cd-surface-base);

    --bs-body-color-rgb: 250, 250, 254;
    --bs-body-color: #fefefe;

    --bs-secondary-color: var(--cd-text-muted);
    --bs-tertiary-color: rgba(254, 254, 254, 0.38);
    --bs-emphasis-color: #fefefe;

    --bs-input-bg-rgb: 42, 43, 46;
    --bs-input-bg: var(--cd-surface-input);

    --bs-card-bg-rgb: 32, 33, 36;
    --bs-card-bg: var(--cd-surface-raised);

    --bs-modal-bg-rgb: 36, 37, 40;
    --bs-modal-bg: var(--cd-surface-overlay);

    --bs-modal-card-bg-rgb: 42, 43, 46;
    --bs-modal-card-bg: var(--cd-surface-elevated);

    --bs-modal-card-header-bg-rgb: 42, 43, 46;

    /* CKEditor 5 — dark theme (toolbar + panels match app surfaces) */
    --ck-color-base-background: var(--cd-surface-elevated);
    --ck-color-base-border: var(--cd-border-default);
    --ck-color-base-text: var(--bs-body-color);
    --ck-color-base-action: var(--primary);
    --ck-color-focus-border: var(--primary);
    --ck-color-toolbar-background: var(--cd-surface-input);
    --ck-color-toolbar-border: var(--cd-border-subtle);
    --ck-color-button-default-background: transparent;
    --ck-color-button-default-hover-background: var(--cd-surface-hover);
    --ck-color-button-on-background: rgba(var(--primary-rgb), 0.18);
    --ck-color-button-on-color: var(--primary);
    --ck-color-button-on-hover-background: rgba(var(--primary-rgb), 0.24);
    --ck-color-button-on-active-background: rgba(var(--primary-rgb), 0.28);
    --ck-color-dropdown-panel-background: var(--cd-surface-overlay);
    --ck-color-dropdown-panel-border: var(--cd-border-subtle);
    --ck-color-input-background: var(--cd-surface-input);
    --ck-color-input-border: var(--cd-border-default);
    --ck-color-input-text: var(--bs-body-color);
    --ck-color-list-background: var(--cd-surface-overlay);
    --ck-color-panel-background: var(--cd-surface-overlay);
    --ck-color-panel-border: var(--cd-border-subtle);
    --ck-color-split-button-hover-background: var(--cd-surface-hover);
    --ck-color-labeled-field-label-background: var(--cd-surface-elevated);

}

body[data-theme=dark] .sidebar,
body[data-theme=dark] #sidebar,
body[data-theme=dark] .sidebar-content {
  background-color: #181b1f;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.card,
.card-header,
.bg-white,
.tab .tab-content,
.tab .nav-tabs .nav-link {
  background-color: rgb(var(--bs-card-bg-rgb));
}

.grouped-tbody {
  background-color: rgb(var(--bs-card-bg-rgb));
  color: white;
}
.stacked-product-title {
  color: white;
}

.modal-body .card {
  background-color: rgb(var(--bs-modal-card-bg-rgb));
}
.modal-body .card-header {
  background-color: rgb(var(--bs-modal-card-header-bg-rgb));
}

tbody, td, tfoot, th, thead, tr {
  background: transparent;
}

.bg-white, .modal-header, .modal-footer {
  background-color: rgb(var(--bs-card-bg-rgb)) !important;
}

.input-group-navbar .btn,
.form-control,
.form-select,
.input-group-navbar .form-control,
.shipment-address-input, .new-order-address-input {
  background-color: var(--bs-input-bg) !important;
  border-color: var(--bs-border-color) !important;
  color: var(--bs-body-color) !important;
}

body[data-theme=dark] .form-floating > .form-control,
body[data-theme=dark] .form-floating > .form-select,
body[data-theme=dark] .form-floating > textarea.form-control {
  background-color: var(--cd-surface-input) !important;
  border-color: var(--cd-border-default) !important;
  color: var(--bs-body-color) !important;
}

body[data-theme=dark] .form-floating > label {
  color: var(--cd-text-muted);
}

body[data-theme=dark] .form-floating > .form-control:focus ~ label,
body[data-theme=dark] .form-floating > .form-select:focus ~ label,
body[data-theme=dark] .form-floating > .form-control:not(:placeholder-shown) ~ label,
body[data-theme=dark] .form-floating > .form-select ~ label {
  color: var(--primary);
}

body[data-theme=dark] .form-floating > .form-control::placeholder {
  color: transparent;
}

body[data-theme=dark] .form-floating > .form-select {
  color-scheme: dark;
}

.order-comment-block .order-comment-textarea:focus {
  outline: none;
  border: 0;
  box-shadow: none;
}

body[data-theme=dark] .order-comment-block.card {
  border-color: rgba(255, 255, 255, 0.1);
}

body[data-theme=dark] .order-comment-block.card:focus-within {
  border-color: rgba(var(--primary-rgb), 0.45);
  box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb), 0.12), 0 0 0.875rem 0 rgba(0, 0, 0, 0.2);
}

body[data-theme=dark] .order-comment-block .order-comment-textarea {
  color: var(--bs-body-color, #fefefe);
}

body[data-theme=dark] .order-comment-block .order-comment-textarea::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.modal-body {
  background-color: rgb(var(--bs-modal-bg-rgb)) !important;
}

.inventory_log_item, .log_item {
  background-color: rgb(var(--bs-modal-card-bg-rgb)) !important;
}

.swal2-modal .swal2-file,
.swal2-modal .swal2-input,
.swal2-modal .swal2-textarea {
  background-color: var(--bs-body-bg);
}

.slider {
  background-color: #616161;
}

.btn-light, .btn-light.disabled, .btn-light.focus, .btn-light.hover:not(:disabled):not(.disabled), .btn-light:disabled, .btn-light:focus, .btn-light:hover:not(:disabled):not(.disabled), .btn-outline-light.hover:not(:disabled):not(.disabled), .btn-outline-light:hover:not(:disabled):not(.disabled), .btn-outline-light:not(:disabled):not(.disabled).active, .btn-outline-light:not(:disabled):not(.disabled):active, .btn-outline-white.hover:not(:disabled):not(.disabled), .btn-outline-white:hover:not(:disabled):not(.disabled), .btn-outline-white:not(:disabled):not(.disabled).active, .btn-outline-white:not(:disabled):not(.disabled):active, .btn-white, .btn-white.disabled, .btn-white.focus, .btn-white.hover:not(:disabled):not(.disabled), .btn-white:disabled, .btn-white:focus, .btn-white:hover:not(:disabled):not(.disabled), .show>.btn-light.dropdown-toggle, .show>.btn-white.dropdown-toggle
{
  color: #fff !important;
  background: var(--bs-input-bg);
  background-color: var(--bs-input-bg) !important;
  border-color: var(--bs-border-color) !important;
}

.swal2-popup {
  background-color: rgb(var(--bs-modal-bg-rgb));
  color: white;
}
.swal2-popup .swal2-title, .swal2-popup .swal2-content, .swal2-modal .swal2-file, .swal2-modal .swal2-input, .swal2-modal .swal2-textarea, .channeldock-blue th[colspan="7"] {
  color: white;
}

.channeldock-blue .calendar-inner td {
  color: #fff;
}

.nav-justified .nav-item, .nav-justified>.nav-link,
.product-inventory-tabs {
  border-color: rgb(var(--bs-modal-bg-rgb));
  background-color: rgb(var(--bs-modal-bg-rgb));
}
.tab .nav-tabs .nav-link,
.nav-tabs .nav-link {
  border-color: var(--cd-border-subtle) !important;
  background-color: var(--cd-surface-input) !important;
  color: var(--cd-text-secondary) !important;
}

.tab .nav-tabs .nav-link:hover,
.nav-tabs .nav-link:hover {
  background-color: var(--cd-surface-hover) !important;
  color: var(--bs-body-color) !important;
}

.tab .nav-tabs .nav-link.active,
.nav-tabs .nav-link.active,
.modal .tab-content {
  background-color: rgb(var(--bs-card-bg-rgb)) !important;
  color: var(--primary) !important;
  border-color: var(--cd-border-default) !important;
  border-bottom-color: transparent !important;
}

.tab .tab-content,
.modal .tab-content {
  border-top: 1px solid transparent !important;
}

.navbar {
  box-shadow: none;
}

body[data-theme=dark] .btn-dark {
  background-color: var(--bs-input-bg);
  border-color: var(--bs-border-color);
  color: var(--bs-body-color);
}

body[data-theme=dark] .btn-dark:hover {
  background-color: var(--cd-surface-hover);
  border-color: var(--bs-border-color);
  color: var(--bs-body-color) !important;
}

.progression-half-background-dark {
  background: transparent !important;
}

.channeldock-blue .calendar-inner,
.channeldock-blue .calendar-events,
.channeldock-blue .event-container:hover {
   background-color: rgb(var(--bs-card-bg-rgb)) !important;
   color: white !important;
}

.inbox_people,
.mesgs {
  color: white !important;
}

.channeldock-blue .calendar-events p {
  color: white !important;
}
.channeldock-blue .event-list > .event-empty,
.channeldock-blue .event-container {
  background: var(--bs-input-bg);
}



.home-card-button {
  border: solid 3px rgb(var(--bs-card-bg-rgb));
}
.channeldock-blue th[colspan="7"] {
  border-bottom: solid 0px transparent !important;
}
.write_msg, .srch_bar input, .chat_ib h5 {
  color: white;
}
.write_msg {
  border-top: solid 2px darkgray;
}
.chat_img img, .incoming_msg_img img, .delivery_qrcode {
  filter: invert(100%);
}
.type_msg {
  border-color: var(--bs-input-bg);
}
.received_withd_msg p {
  color: #fff;
  background: #2d2d2d none repeat scroll 0 0;
}
.chat_list {
  background: var(--bs-input-bg);
  border-color: var(--bs-input-bg);
  color: white;
}
.active_chat {
  background: var(--bs-input-bg);
  border-color: var(--primary);
  color: white;
}
.list-group-item {
  background-color: var(--cd-surface-input);
  border-color: var(--cd-border-subtle);
  color: var(--bs-body-color);
}

.list-group-item:hover {
  background-color: var(--cd-surface-hover);
}
.shipment-option-button, .shipment-option-button .shipment-option-text, .shipment-address {
  color: #fff;
  background-color: var(--bs-input-bg) !important;
  border-color: var(--bs-input-bg);
}

.shipment-option-icon {
  background-color: transparent !important;
  border-color: transparent;
}

/* Missing shipment method modal — dark mode */
body[data-theme=dark] .msm-content {
  background: #1e2025;
  box-shadow: 0 20px 60px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.25);
}

body[data-theme=dark] .msm-header {
  border-bottom-color: rgba(255,255,255,.08);
}

body[data-theme=dark] .msm-title {
  color: var(--bs-body-color);
}

body[data-theme=dark] .msm-subtitle,
body[data-theme=dark] .missing-shipment-reason-desc,
body[data-theme=dark] .msm-fix-text {
  color: rgba(255,255,255,.55);
}

body[data-theme=dark] .msm-card {
  background: #2a2d33;
  border-color: rgba(255,255,255,.08);
}

body[data-theme=dark] .msm-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

body[data-theme=dark] .msm-card-num {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.4);
}

body[data-theme=dark] .missing-shipment-reason-title {
  color: var(--bs-body-color);
}

body[data-theme=dark] .msm-fix-bar.fix-country { background: rgba(0,119,255,.1);  border-top-color: rgba(0,119,255,.2); }
body[data-theme=dark] .msm-fix-bar.fix-address { background: rgba(63,199,125,.08); border-top-color: rgba(63,199,125,.18); }
body[data-theme=dark] .msm-fix-bar.fix-size    { background: rgba(239,181,64,.07); border-top-color: rgba(239,181,64,.18); }

body[data-theme=dark] .msm-fix-label {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.6);
}

body[data-theme=dark] .msm-footer {
  background: transparent;
}

.inbox_people, .inbox_msg {
  border-color: #202020;
}
.inbox_msg {
  border-color: transparent;
}

.select2-container--default .select2-search--inline .select2-search__field {
  color: white!important;
}

.text-secondary {
  color: var(--cd-text-secondary) !important;
}

.text-muted {
  color: var(--cd-text-muted) !important;
}

.text-gray {
  color: var(--cd-text-muted) !important;
}

table.dataTable.table-striped>tbody>tr.odd>* {
  box-shadow: inset 0 0 0 9999px rgba(255, 255, 255, 0.02);
}

.card {
  border: 1px solid var(--cd-border-subtle);
}

.dropdown-menu,
.navbar-expand .navbar-nav .dropdown-menu {
  background-color: var(--cd-surface-overlay);
  border: 1px solid var(--cd-border-subtle);
  color: var(--bs-body-color);
}

.dropdown-item {
  color: var(--cd-text-secondary);
}

.dropdown-item:hover,
.dropdown-item:focus {
  background-color: var(--cd-surface-hover);
  color: var(--bs-body-color);
}

.dropdown-item.active,
.dropdown-item:active {
  background-color: rgba(var(--primary-rgb), 0.15);
  color: var(--primary);
}

.dropdown-divider {
  border-top-color: var(--cd-border-subtle);
}

.dropdown-header {
  color: var(--cd-text-muted);
}

.img-bg-thumbnail {
  opacity: 1;
  -webkit-transition: all 0.1s ease-in-out;
  -moz-transition: all 0.1s ease-in-out;
  -o-transition: all 0.1s ease-in-out;
  transition: all 0.1s ease-in-out;
  background-color: transparent;
}

tr:hover .img-bg-thumbnail {
  opacity: 1;
}

@media only screen and (max-width: 600px) {
  .modal-xl {
    background-color: rgb(var(--bs-card-bg-rgb)) !important;
  }
}
/* PWA menu */
.menu__item.active {
  background-color: #16181B;
}
.menu__item svg {
  fill: var(--bs-gray);
}

.text-dark svg {
  fill: #fff;
}

.badge-light {
  background-color: var(--cd-surface-input);
  color: var(--cd-text-secondary);
}

.accordion-item, .accordion-button {
  background-color: rgb(var(--bs-modal-card-bg-rgb));
  color: var(--bs-card-color);
}

.accordion-button:not(.collapsed) {
  background-color: rgb(var(--bs-modal-card-bg-rgb));
  color: var(--bs-card-color);
}

.marketplace-tile {
  background-color: var(--cd-surface-input) !important;
  color: var(--bs-body-color);
  border: 1px solid var(--cd-border-subtle);
}

/* CKEditor 5 */
.ck.ck-editor {
  border: 1px solid var(--cd-border-default) !important;
  border-radius: 0.5rem;
  overflow: hidden;
}

.ck.ck-toolbar,
.ck.ck-editor__top .ck-sticky-panel .ck-toolbar {
  background-color: var(--cd-surface-input) !important;
  border-color: var(--cd-border-subtle) !important;
}

.ck.ck-toolbar .ck-toolbar__separator {
  background: var(--cd-border-subtle) !important;
}

.ck.ck-button,
.ck.ck-button.ck-off {
  color: var(--cd-text-secondary) !important;
}

.ck.ck-button:not(.ck-disabled):hover,
.ck.ck-button.ck-off:not(.ck-disabled):hover {
  background-color: var(--cd-surface-hover) !important;
  color: var(--bs-body-color) !important;
}

.ck.ck-button.ck-on {
  background-color: rgba(var(--primary-rgb), 0.18) !important;
  color: var(--primary) !important;
}

.ck.ck-button.ck-on:hover {
  background-color: rgba(var(--primary-rgb), 0.24) !important;
}

.ck.ck-dropdown__panel,
.ck.ck-list {
  background: var(--cd-surface-overlay) !important;
  border-color: var(--cd-border-subtle) !important;
}

.ck.ck-list__item .ck-button {
  color: var(--cd-text-secondary) !important;
}

.ck.ck-list__item .ck-button:hover:not(.ck-disabled) {
  background: var(--cd-surface-hover) !important;
  color: var(--bs-body-color) !important;
}

.ck.ck-editor__main > .ck-editor__editable,
.ck.ck-editor__main > .ck-editor__editable.ck-rounded-corners {
  background-color: var(--cd-surface-elevated) !important;
  border-color: var(--cd-border-subtle) !important;
  color: var(--bs-body-color) !important;
}

.ck.ck-editor__main > .ck-editor__editable:focus {
  border-color: rgba(var(--primary-rgb), 0.45) !important;
  box-shadow: 0 0 0 0.15rem rgba(var(--primary-rgb), 0.12) !important;
}

.ck.ck-editor__editable_inline:not(.ck-editor__nested-editable).ck-focused {
  border-color: rgba(var(--primary-rgb), 0.45) !important;
  box-shadow: 0 0 0 0.15rem rgba(var(--primary-rgb), 0.12) !important;
}

.ck.ck-input,
.ck.ck-input-text {
  background: var(--cd-surface-input) !important;
  border-color: var(--cd-border-default) !important;
  color: var(--bs-body-color) !important;
}

.ck.ck-labeled-field-view > .ck.ck-labeled-field-view__input-wrapper > .ck.ck-label {
  background: var(--cd-surface-elevated) !important;
  color: var(--cd-text-muted) !important;
}

.select2-container--default .select2-selection--single {
  background-color: var(--bs-input-bg);
  color: #fff;
}

.select2-container--default .select2-selection--multiple {
  background-color: var(--bs-input-bg);
  box-shadow: none !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #fff;
}

/* Native <select> popups: OS list can stay light while text is white — color-scheme fixes cross-browser */
body[data-theme=dark] {
  color-scheme: dark;
}

body[data-theme=dark] .form-select,
body[data-theme=dark] select.form-select {
  color-scheme: dark;
}

body[data-theme=dark] .form-select option,
body[data-theme=dark] select.form-select option {
  background-color: var(--bs-input-bg);
  color: var(--bs-body-color);
}

/* Select2 dropdown panel (theme.css defaults are light-only) */
body[data-theme=dark] .select2-dropdown {
  background-color: var(--bs-input-bg);
  border-color: rgba(255, 255, 255, 0.12);
}

body[data-theme=dark] .select2-results__option {
  color: var(--bs-body-color);
}

body[data-theme=dark] .select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: var(--primary);
  color: #fff;
}

body[data-theme=dark] .select2-container--default .select2-results__option[aria-selected=true] {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--bs-body-color);
}

body[data-theme=dark] .select2-container--default .select2-results__option[aria-selected=true]:hover {
  background-color: var(--primary);
  color: #fff;
}

body[data-theme=dark] .select2-container--default .select2-search--dropdown {
  background-color: var(--bs-input-bg);
}

body[data-theme=dark] .select2-container--default .select2-search--dropdown .select2-search__field {
  background-color: var(--bs-body-bg);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--bs-body-color);
}

/* Sidebar navigation — theme-aware tokens in dark mode (ignore branding menu text on dark rail) */
body[data-theme=dark] {
  --sidebar-nav-fg: #fff;
  --sidebar-nav-fg-muted: rgba(255, 255, 255, 0.65);
  --sidebar-nav-fg-subtle: rgba(255, 255, 255, 0.55);
  --sidebar-nav-fg-emphasis: rgba(255, 255, 255, 0.72);
  --sidebar-nav-guide: rgba(255, 255, 255, 0.08);
  --menu-item-hover-bg: rgba(255, 255, 255, 0.08);
  --menu-item-active-bg: rgba(255, 255, 255, 0.14);
  --menu-bg-color: #181b1f;
}

body[data-theme=dark] .secondary-background-color {
  background-color: #181b1f !important;
}

body[data-theme=dark] #sidebar .sidebar-header,
body[data-theme=dark] .sidebar-header {
  color: var(--sidebar-nav-fg-muted);
}

body[data-theme=dark] .sidebar-nav > .sidebar-item.sidebar-account-setup {
  border-top-color: var(--sidebar-nav-guide);
  background-color: #181b1f !important;
}

body[data-theme=dark] #sidebar .sidebar-link,
body[data-theme=dark] #sidebar a.sidebar-link,
body[data-theme=dark] .sidebar-link,
body[data-theme=dark] a.sidebar-link {
  color: #fff;
}

body[data-theme=dark] #sidebar .sidebar-link i,
body[data-theme=dark] #sidebar .sidebar-link svg,
body[data-theme=dark] #sidebar a.sidebar-link i,
body[data-theme=dark] #sidebar a.sidebar-link svg,
body[data-theme=dark] .sidebar-link i,
body[data-theme=dark] .sidebar-link svg,
body[data-theme=dark] a.sidebar-link i,
body[data-theme=dark] a.sidebar-link svg {
  color: #fff;
}

body[data-theme=dark] #sidebar .sidebar-link:hover,
body[data-theme=dark] #sidebar a.sidebar-link:hover,
body[data-theme=dark] #sidebar .sidebar-link:hover i,
body[data-theme=dark] #sidebar .sidebar-link:hover svg,
body[data-theme=dark] #sidebar a.sidebar-link:hover i,
body[data-theme=dark] #sidebar a.sidebar-link:hover svg,
body[data-theme=dark] .sidebar-link:hover,
body[data-theme=dark] a.sidebar-link:hover,
body[data-theme=dark] .sidebar-link:hover i,
body[data-theme=dark] .sidebar-link:hover svg,
body[data-theme=dark] a.sidebar-link:hover i,
body[data-theme=dark] a.sidebar-link:hover svg {
  color: #fff;
}

body[data-theme=dark] #sidebar .sidebar-dropdown .sidebar-link,
body[data-theme=dark] .sidebar-dropdown .sidebar-link {
  color: #fff;
}

body[data-theme=dark] #sidebar .sidebar-dropdown .sidebar-item .sidebar-link:hover,
body[data-theme=dark] .sidebar-dropdown .sidebar-item .sidebar-link:hover {
  color: #fff;
}

body[data-theme=dark] #sidebar .sidebar-dropdown .sidebar-item.active .sidebar-link,
body[data-theme=dark] #sidebar .sidebar-item.active > .sidebar-link,
body[data-theme=dark] #sidebar .sidebar-item.active .sidebar-link:hover,
body[data-theme=dark] .sidebar-dropdown .sidebar-item.active .sidebar-link,
body[data-theme=dark] .sidebar-item.active > .sidebar-link,
body[data-theme=dark] .sidebar-item.active .sidebar-link:hover {
  color: #fff;
}

body[data-theme=dark] #sidebar .sidebar-item.active > .sidebar-link i,
body[data-theme=dark] #sidebar .sidebar-item.active > .sidebar-link svg,
body[data-theme=dark] #sidebar .sidebar-item.active .sidebar-link:hover i,
body[data-theme=dark] #sidebar .sidebar-item.active .sidebar-link:hover svg,
body[data-theme=dark] .sidebar-item.active > .sidebar-link i,
body[data-theme=dark] .sidebar-item.active > .sidebar-link svg,
body[data-theme=dark] .sidebar-item.active .sidebar-link:hover i,
body[data-theme=dark] .sidebar-item.active .sidebar-link:hover svg {
  color: #fff;
}

body[data-theme=dark] #sidebar .sidebar-header .btn,
body[data-theme=dark] #sidebar .sidebar-header .sidebar-order-usage {
  color: #fff;
}

body[data-theme=dark] .sidebar-nav > .sidebar-item:hover,
body[data-theme=dark] .sidebar-nav > .sidebar-item.active {
  background-color: transparent;
}

body[data-theme=dark] #sidebar .sidebar-nav > .sidebar-item > .sidebar-link:hover,
body[data-theme=dark] #sidebar .sidebar-dropdown .sidebar-item .sidebar-link:hover,
body[data-theme=dark] .sidebar-nav > .sidebar-item > .sidebar-link:hover,
body[data-theme=dark] .sidebar-dropdown .sidebar-item .sidebar-link:hover {
  background-color: var(--menu-item-hover-bg, rgba(255, 255, 255, 0.08));
}

body[data-theme=dark] #sidebar .sidebar-nav > .sidebar-item.active > .sidebar-link,
body[data-theme=dark] #sidebar .sidebar-dropdown .sidebar-item.active > .sidebar-link,
body[data-theme=dark] .sidebar-nav > .sidebar-item.active > .sidebar-link,
body[data-theme=dark] .sidebar-dropdown .sidebar-item.active > .sidebar-link {
  background-color: var(--menu-item-active-bg, rgba(255, 255, 255, 0.14));
}

/* When a sub menu is open, the parent loses its pill — the active child carries the highlight */
body[data-theme=dark] .sidebar-nav > .sidebar-item.active > .sidebar-link[data-bs-toggle=collapse]:not(.collapsed) {
  background-color: transparent;
}

body[data-theme=dark] .sidebar-nav > .sidebar-item.active > .sidebar-link[data-bs-toggle=collapse]:not(.collapsed):hover {
  background-color: var(--cd-surface-hover, rgba(255, 255, 255, 0.05));
}

body[data-theme=dark] .navbar-bg {
  background-color: rgb(var(--bs-card-bg-rgb)) !important;
  border-bottom: 1px solid var(--cd-border-subtle);
}

/* Unified surfaces & controls */
body[data-theme=dark] .content,
body[data-theme=dark] .main {
  background-color: var(--cd-surface-base);
}

body[data-theme=dark] .card-header {
  background-color: rgb(var(--bs-card-bg-rgb));
  border-bottom-color: var(--cd-border-subtle);
  color: var(--bs-body-color);
}

body[data-theme=dark] .bg-light {
  background-color: var(--cd-surface-elevated) !important;
  color: var(--bs-body-color);
}

body[data-theme=dark] .page-header {
  border-bottom-color: var(--cd-border-subtle);
}

body[data-theme=dark] .page-header .subtitle {
  color: var(--cd-text-muted);
}

body[data-theme=dark] hr {
  border-color: var(--cd-border-subtle);
  opacity: 1;
}

body[data-theme=dark] .table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--bs-body-color);
  --bs-table-border-color: var(--cd-border-subtle);
  --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
  --bs-table-hover-bg: var(--cd-surface-hover);
}

body[data-theme=dark] .table thead th {
  color: var(--cd-text-muted);
  border-bottom-color: var(--cd-border-default);
}

body[data-theme=dark] .btn-radio {
  background-color: var(--cd-surface-input) !important;
  border-color: var(--cd-border-default) !important;
  color: var(--cd-text-secondary) !important;
}

body[data-theme=dark] .btn-radio:hover {
  background-color: rgba(var(--primary-rgb), 0.12) !important;
  border-color: rgba(var(--primary-rgb), 0.35) !important;
  color: var(--primary) !important;
}

body[data-theme=dark] .btn-radio.active {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
  color: var(--primary-btn-color) !important;
}

body[data-theme=dark] .btn-outline-secondary,
body[data-theme=dark] .btn-secondary {
  background-color: var(--cd-surface-input);
  border-color: var(--cd-border-default);
  color: var(--cd-text-secondary);
}

body[data-theme=dark] .btn-outline-secondary:hover,
body[data-theme=dark] .btn-secondary:hover {
  background-color: var(--cd-surface-hover);
  border-color: var(--cd-border-default);
  color: var(--bs-body-color);
}

body[data-theme=dark] .input-group-text {
  background-color: var(--cd-surface-input);
  border-color: var(--bs-border-color);
  color: var(--cd-text-muted);
}

body[data-theme=dark] .spotlight-trigger-bar {
  background-color: var(--cd-surface-input);
  border-color: var(--cd-border-default);
  color: var(--cd-text-muted);
}

body[data-theme=dark] .spotlight-trigger-bar:hover {
  background-color: var(--cd-surface-hover);
  border-color: var(--cd-border-default);
  color: var(--bs-body-color);
}

/* Modals & PIM product modal */
body[data-theme=dark] .modal-content {
  background-color: rgb(var(--bs-card-bg-rgb));
  border: 1px solid var(--cd-border-subtle);
  color: var(--bs-body-color);
}

body[data-theme=dark] .modal-header,
body[data-theme=dark] .modal-footer,
body[data-theme=dark] .open-order-modal-hero,
body[data-theme=dark] .open-order-modal-actions {
  border-color: var(--cd-border-subtle);
}

body[data-theme=dark] .pim-product-modal .modal-content,
body[data-theme=dark] .pim-product-modal-panel.bg-white,
body[data-theme=dark] .pim-product-modal .open-order-modal-hero,
body[data-theme=dark] .pim-product-modal .open-order-modal-actions {
  background-color: rgb(var(--bs-card-bg-rgb)) !important;
}

body[data-theme=dark] .pim-product-modal-hero-img {
  background-color: var(--cd-surface-input);
  border: 1px solid var(--cd-border-subtle);
}

body[data-theme=dark] .pim-product-modal-hero-meta {
  color: var(--cd-text-muted);
}

body[data-theme=dark] .pim-product-modal .tab .nav-tabs {
  border-bottom-color: var(--cd-border-subtle) !important;
}

body[data-theme=dark] .pim-product-modal .tab .nav-tabs .nav-link {
  color: var(--cd-text-secondary) !important;
  background: transparent !important;
  border-bottom-color: transparent !important;
}

body[data-theme=dark] .pim-product-modal .tab .nav-tabs .nav-link:hover {
  color: var(--bs-body-color) !important;
}

body[data-theme=dark] .pim-product-modal .tab .nav-tabs .nav-link.active {
  color: var(--primary) !important;
  border-bottom-color: var(--primary) !important;
}

body[data-theme=dark] .pim-product-modal .open-order-modal-actions .btn-light,
body[data-theme=dark] .pim-product-modal .open-order-modal-more .btn-light,
body[data-theme=dark] .modal .btn-light {
  background-color: var(--cd-surface-input) !important;
  border-color: var(--cd-border-default) !important;
  color: var(--cd-text-secondary) !important;
}

body[data-theme=dark] .pim-product-modal .open-order-modal-actions .btn-light:hover,
body[data-theme=dark] .pim-product-modal .open-order-modal-more .btn-light:hover,
body[data-theme=dark] .modal .btn-light:hover {
  background-color: var(--cd-surface-hover) !important;
  color: var(--bs-body-color) !important;
}

body[data-theme=dark] .modal .text-danger {
  color: #e07a7a !important;
}

body[data-theme=dark] .modal .text-success {
  color: var(--success) !important;
}

body[data-theme=dark] .api-selector-list li:hover {
  background-color: var(--cd-surface-hover);
}

body[data-theme=dark] .pim-stock-advice-panel__surface {
  border-color: var(--cd-border-subtle);
  background: rgb(var(--bs-card-bg-rgb));
  box-shadow: none;
}

/* Entity modals (delivery, batch, orders) — unified form fields */
body[data-theme=dark] .modal .form-control,
body[data-theme=dark] .modal .form-select,
body[data-theme=dark] .modal .form-floating > .form-control,
body[data-theme=dark] .modal .form-floating > .form-select,
body[data-theme=dark] .modal .form-floating > textarea.form-control {
  background-color: var(--cd-surface-input) !important;
  border-color: var(--cd-border-default) !important;
  color: var(--bs-body-color) !important;
}

body[data-theme=dark] .modal .form-control:focus,
body[data-theme=dark] .modal .form-select:focus {
  background-color: var(--cd-surface-input) !important;
  border-color: rgba(var(--primary-rgb), 0.45) !important;
  box-shadow: 0 0 0 0.15rem rgba(var(--primary-rgb), 0.12) !important;
  color: var(--bs-body-color) !important;
}

body[data-theme=dark] .open-order-modal-panel.bg-white,
body[data-theme=dark] .delivery-modal-panel,
body[data-theme=dark] .batch-modal-panel {
  background-color: rgb(var(--bs-card-bg-rgb)) !important;
}

body[data-theme=dark] #delivery_modal .card,
body[data-theme=dark] #batchModal .card {
  background-color: rgb(var(--bs-card-bg-rgb));
  border-color: var(--cd-border-subtle);
  box-shadow: none !important;
}

body[data-theme=dark] #delivery_modal .card-header,
body[data-theme=dark] #batchModal .card-header {
  background-color: var(--cd-surface-elevated);
  border-bottom-color: var(--cd-border-subtle);
  color: var(--bs-body-color);
}

body[data-theme=dark] #delivery_modal .supplier-qr-card {
  background-color: var(--cd-surface-elevated) !important;
  border-color: var(--cd-border-subtle) !important;
  box-shadow: none !important;
}

body[data-theme=dark] #delivery_modal .supplier-qr-description {
  color: var(--cd-text-muted);
}

body[data-theme=dark] .form-control-disabled {
  background-color: var(--cd-surface-input) !important;
  opacity: 0.55;
  color: var(--cd-text-muted) !important;
}

.upload-form p {
  color: #fff;
}

/* Ensure DataTables Editor uses a dark surface in dark mode */
html.dark,
html[data-bs-theme=dark],
body[data-theme=dark] {
  --dt-html-background: var(--bs-modal-bg);
}

/* DataTables Editor: ensure modal title is readable in dark mode */
html.dark div.DTE span.DTE_Title,
html[data-bs-theme=dark] div.DTE span.DTE_Title {
  color: var(--bs-body-color);
}

body[data-theme=dark] div.DTE span.DTE_Title {
  color: var(--bs-body-color);
}

/* DataTables Editor: force dark background + text in lightbox/modal */
html.dark .DTED_Lightbox_Content .DTE,
html[data-bs-theme=dark] .DTED_Lightbox_Content .DTE,
body[data-theme=dark] .DTED_Lightbox_Content .DTE {
  background-color: var(--dt-html-background) !important;
  color: var(--bs-body-color);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Apply dark surface for any Editor container (catch-all) */
body[data-theme=dark] div.DTE {
  background-color: var(--dt-html-background) !important;
  color: var(--bs-body-color);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

html.dark .DTE_Body_Content,
html[data-bs-theme=dark] .DTE_Body_Content,
body[data-theme=dark] .DTE_Body_Content {
  background: var(--dt-html-background) !important;
}

/* Envelope display variant */
body[data-theme=dark] div.DTED_Envelope_Wrapper div.DTED_Envelope_Container {
  background-color: var(--dt-html-background) !important;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 3px 3px 10px #000;
}

/* Editor header/footer */
body[data-theme=dark] div.DTE div.DTE_Header {
  background-color: rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

body[data-theme=dark] div.DTE div.DTE_Footer {
  background-color: rgba(0, 0, 0, 0.1);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

/* Editor buttons */
body[data-theme=dark] div.DTE button.btn,
body[data-theme=dark] div.DTE div.DTE_Form_Buttons button {
  color: #fff;
  background-color: #0d6efd;
  border-color: #0d6efd;
}

body[data-theme=dark] div.DTE button.btn:hover,
body[data-theme=dark] div.DTE div.DTE_Form_Buttons button:hover {
  color: #fff;
  background-color: #0b5ed7;
  border-color: #0a58ca;
}

body[data-theme=dark] div.DTE button.btn:focus,
body[data-theme=dark] div.DTE div.DTE_Form_Buttons button:focus {
  color: #fff;
  background-color: #0b5ed7;
  border-color: #0a58ca;
  box-shadow: 0 0 0 0.25rem rgba(49,132,253,.5);
}

body[data-theme=dark] div.DTE button.btn:active,
body[data-theme=dark] div.DTE div.DTE_Form_Buttons button:active {
  color: #fff;
  background-color: #0a58ca;
  border-color: #0a53be;
}

body[data-theme=dark] div.DTE button.btn:active:focus,
body[data-theme=dark] div.DTE div.DTE_Form_Buttons button:active:focus {
  box-shadow: 0 0 0 0.25rem rgba(49,132,253,.5);
}

/* Editor inputs/selects */
body[data-theme=dark] div.DTE_Field input,
body[data-theme=dark] div.DTE_Field textarea {
  color: inherit;
  background-color: rgb(33, 37, 41);
}

body[data-theme=dark] div.DTE_Field input:focus,
body[data-theme=dark] div.DTE_Field textarea:focus {
  background-color: rgb(24, 30, 36);
}

body[data-theme=dark] div.DTE_Field input[type],
body[data-theme=dark] div.DTE_Field textarea {
  border: 1px solid rgba(255, 255, 255, 0.15);
}

body[data-theme=dark] div.DTE_Field select {
  border: 1px solid rgb(89, 91, 94);
  background: rgba(255, 255, 255, 0.1);
}

/* Labels and placeholders */
body[data-theme=dark] div.DTE_Body_Content div.DTE_Field>label {
  color: var(--bs-body-color);
}
body[data-theme=dark] div.DTE_Field input::placeholder,
body[data-theme=dark] div.DTE_Field textarea::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

/* Close icon */
body[data-theme=dark] div.DTED_Lightbox_Close:after {
  color: rgba(255, 255, 255, 0.5) !important;
}
body[data-theme=dark] div.DTED_Lightbox_Close:hover:after {
  color: #fff !important;
}

/* Field hover */
body[data-theme=dark] div.DTE_Body_Content div.DTE_Field:hover {
  background-color: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Strong overrides for Editor lightbox structure (prevent white backgrounds) */
body[data-theme=dark] div.DTED_Lightbox_Wrapper div.DTED_Lightbox_Container div.DTED_Lightbox_Content_Wrapper div.DTED_Lightbox_Content div.DTE {
  background-color: #202124 !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

body[data-theme=dark] div.DTED_Lightbox_Wrapper div.DTE div.DTE_Body_Content {
  background-color: #242528 !important;
}

body[data-theme=dark] div.DTED_Lightbox_Wrapper div.DTE div.DTE_Header,
body[data-theme=dark] div.DTED_Lightbox_Wrapper div.DTE div.DTE_Footer {
  background-color: #202124 !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

/* Form focus — primary accent app-wide (overrides page-level green success rings) */
body[data-theme=dark] .form-control:focus,
body[data-theme=dark] .form-select:focus,
body[data-theme=dark] select:focus,
body[data-theme=dark] .filter-section .form-control:focus,
body[data-theme=dark] .filter-section .form-select:focus,
body[data-theme=dark] .filter-section select:focus {
  border-color: rgba(var(--primary-rgb), 0.45) !important;
  box-shadow: 0 0 0 0.15rem rgba(var(--primary-rgb), 0.12) !important;
}

/* Soft badges — muted pastels on dark surfaces */
body[data-theme=dark] .badge.badge-soft-info {
  color: #7dd3fc;
  background-color: rgba(31, 155, 207, 0.22);
}

body[data-theme=dark] .badge.badge-soft-success {
  color: #86efac;
  background-color: rgba(75, 191, 115, 0.22);
}

body[data-theme=dark] .badge.badge-soft-primary {
  color: var(--primary-lighter, var(--primary));
  background-color: rgba(var(--primary-rgb), 0.2);
}

/* Sidebar menu count badges — match brand tint, readable neutral numerals */
body[data-theme=dark] #sidebar .sidebar-link .badge.badge-soft-primary {
  color: var(--bs-body-color) !important;
  background-color: rgba(var(--primary-rgb), 0.28) !important;
  font-weight: 600;
}

body[data-theme=dark] .badge.badge-soft-warning {
  color: #fcd34d;
  background-color: rgba(204, 139, 55, 0.22);
}

body[data-theme=dark] .feature-beta-badge {
  color: #fcd34d !important;
  background-color: rgba(204, 139, 55, 0.22) !important;
}

body[data-theme=dark] .feature-beta-badge i {
  color: inherit !important;
}

body[data-theme=dark] .feature-legacy-badge {
  color: var(--bs-secondary-color) !important;
  background-color: rgba(255, 255, 255, 0.12) !important;
}

body[data-theme=dark] .badge.badge-soft-danger {
  color: #fca5a5;
  background-color: rgba(217, 83, 79, 0.22);
}

body[data-theme=dark] .badge.badge-soft-purple {
  color: #c4b5fd;
  background-color: rgba(132, 74, 255, 0.22);
}

body[data-theme=dark] .badge.badge-soft-secondary,
body[data-theme=dark] .badge.badge-soft-dark {
  color: var(--cd-text-secondary);
  background-color: rgba(255, 255, 255, 0.08);
}

body[data-theme=dark] .badge.badge-soft-light {
  color: var(--cd-text-muted);
  background-color: var(--cd-surface-hover);
}

/* Alerts */
body[data-theme=dark] .alert-info {
  background-color: rgba(var(--primary-rgb), 0.12);
  border-color: rgba(var(--primary-rgb), 0.22);
  color: var(--bs-body-color);
}

body[data-theme=dark] .alert-success {
  background-color: rgba(75, 191, 115, 0.12);
  border-color: rgba(75, 191, 115, 0.22);
  color: var(--bs-body-color);
}

body[data-theme=dark] .alert-warning {
  background-color: rgba(204, 139, 55, 0.12);
  border-color: rgba(204, 139, 55, 0.22);
  color: var(--bs-body-color);
}

body[data-theme=dark] .alert-danger {
  background-color: rgba(217, 83, 79, 0.12);
  border-color: rgba(217, 83, 79, 0.22);
  color: var(--bs-body-color);
}

/* Stock Advice page — unified surfaces */
body[data-theme=dark] .stock-advice-guide {
  border-color: var(--cd-border-subtle);
  box-shadow: none;
}

body[data-theme=dark] .stock-advice-guide--expanded .stock-advice-guide__header,
body[data-theme=dark] .stock-advice-guide__group + .stock-advice-guide__group,
body[data-theme=dark] .stock-advice-guide__footer {
  border-color: var(--cd-border-subtle);
}

body[data-theme=dark] .stock-advice-guide__icon {
  color: var(--cd-text-muted);
  background: var(--cd-surface-input);
  border-color: var(--cd-border-subtle);
}

body[data-theme=dark] .stock-advice-guide__metric,
body[data-theme=dark] .stock-advice-guide__toggle-row {
  background: var(--cd-surface-elevated);
  border-color: var(--cd-border-subtle);
}

body[data-theme=dark] .stock-advice-guide__group-desc,
body[data-theme=dark] .stock-advice-guide__metric-label,
body[data-theme=dark] .stock-advice-guide__meta,
body[data-theme=dark] .stock-advice-guide__hint {
  color: var(--cd-text-muted);
}

body[data-theme=dark] .advice-counter-card {
  background: var(--cd-surface-raised);
  border-color: var(--cd-border-subtle);
  box-shadow: none;
}

body[data-theme=dark] .advice-counter-card:hover {
  border-color: var(--cd-border-default);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

body[data-theme=dark] .advice-counter-card-title,
body[data-theme=dark] .advice-counter-card-icon {
  color: var(--cd-text-muted);
}

body[data-theme=dark] .advice-counter-card-value {
  color: var(--bs-body-color);
}

body[data-theme=dark] .sa-settings-modal__section + .sa-settings-modal__section {
  border-top-color: var(--cd-border-subtle);
}

body[data-theme=dark] .sa-settings-modal__section-desc {
  color: var(--cd-text-muted);
}

/* Autofill — prevent blue-gray browser highlight on dark inputs */
body[data-theme=dark] input:-webkit-autofill,
body[data-theme=dark] input:-webkit-autofill:hover,
body[data-theme=dark] input:-webkit-autofill:focus,
body[data-theme=dark] textarea:-webkit-autofill,
body[data-theme=dark] textarea:-webkit-autofill:hover,
body[data-theme=dark] textarea:-webkit-autofill:focus,
body[data-theme=dark] select:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--cd-surface-input) inset !important;
  box-shadow: 0 0 0 1000px var(--cd-surface-input) inset !important;
  -webkit-text-fill-color: var(--bs-body-color) !important;
  caret-color: var(--bs-body-color);
}

/* Google Places Autocomplete target input */
body[data-theme=dark] .pac-target-input,
body[data-theme=dark] #location-input {
  background-color: var(--cd-surface-input) !important;
  color: var(--bs-body-color) !important;
  border-color: var(--cd-border-default) !important;
}

/* Google Places dropdown */
body[data-theme=dark] .pac-container {
  background-color: var(--cd-surface-overlay);
  border-color: var(--cd-border-subtle);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.35);
}

body[data-theme=dark] .pac-item {
  border-bottom-color: var(--cd-border-subtle);
  color: var(--cd-text-secondary);
}

body[data-theme=dark] .pac-item:hover,
body[data-theme=dark] .pac-item-selected {
  background-color: var(--cd-surface-hover);
}

body[data-theme=dark] .pac-item-query {
  color: var(--bs-body-color);
}

body[data-theme=dark] .pac-matched {
  color: var(--primary);
}

/* jQuery UI autocomplete (customer search) */
body[data-theme=dark] .ui-menu.ui-widget.ui-widget-content.ui-autocomplete.ui-front {
  background: var(--cd-surface-overlay);
  border-color: var(--cd-border-subtle);
  color: var(--bs-body-color);
}

body[data-theme=dark] .ui-menu .ui-menu-item-wrapper {
  color: var(--cd-text-secondary);
}

body[data-theme=dark] .ui-menu .ui-menu-item-wrapper.ui-state-active {
  background: rgba(var(--primary-rgb), 0.15);
  border-color: transparent;
  color: var(--primary);
}

body[data-theme=dark] .ui-autocomplete-category {
  color: var(--cd-text-muted);
  background: var(--cd-surface-input);
}

/* Create new order page */
body[data-theme=dark] .new-order-page .form-section-title {
  color: var(--cd-text-muted);
  border-bottom-color: var(--cd-border-subtle);
}

body[data-theme=dark] .new-order-page .address-map-container {
  background: var(--cd-surface-input);
  border-top-color: var(--cd-border-subtle);
  border-bottom-color: var(--cd-border-subtle);
}

body[data-theme=dark] .new-order-page #gmp-map,
body[data-theme=dark] .new-order-page .maps .map {
  background: var(--cd-surface-input);
}

/* Google Maps load-error panel */
body[data-theme=dark] .gm-err-container {
  background-color: var(--cd-surface-input) !important;
}

body[data-theme=dark] .gm-err-content {
  color: var(--cd-text-secondary) !important;
}

body[data-theme=dark] .gm-err-title {
  color: var(--bs-body-color) !important;
}

body[data-theme=dark] .gm-err-message,
body[data-theme=dark] .gm-err-message a {
  color: var(--cd-text-muted) !important;
}

body[data-theme=dark] .new-order-page .order-item-card {
  background: var(--cd-surface-elevated);
  border-color: var(--cd-border-subtle);
  box-shadow: none;
}

body[data-theme=dark] .new-order-page .order-item-card:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

body[data-theme=dark] .new-order-page .order-item-title,
body[data-theme=dark] .new-order-page .order-item-price {
  color: var(--bs-body-color);
}

body[data-theme=dark] .new-order-page .order-item-details,
body[data-theme=dark] .new-order-page .order-item-quantity-label {
  color: var(--cd-text-muted);
}

body[data-theme=dark] .new-order-page .order-item-remove {
  color: var(--cd-text-muted);
}

body[data-theme=dark] .new-order-page .order-item-remove:hover {
  color: var(--bs-body-color);
}

body[data-theme=dark] .new-order-page .order-item-body {
  border-top-color: var(--cd-border-subtle);
}

body[data-theme=dark] .new-order-page .order-item-image-wrapper {
  background-color: var(--cd-surface-input);
  border-color: var(--cd-border-subtle);
}

body[data-theme=dark] .new-order-page .order-items-footer {
  border-top-color: var(--cd-border-subtle);
}

body[data-theme=dark] .new-order-page .order-total-card {
  background: var(--cd-surface-elevated);
  border-color: var(--cd-border-subtle);
}

body[data-theme=dark] .new-order-page .order-total-label {
  color: var(--cd-text-muted);
}

body[data-theme=dark] .new-order-page .order-total-price {
  color: var(--bs-body-color);
}

/* Select2 — muted tags (not bright white pills) */
body[data-theme=dark] .select2-container--default .select2-selection--multiple .select2-selection__choice {
  background-color: var(--cd-surface-hover) !important;
  border: 1px solid var(--cd-border-default) !important;
  color: var(--cd-text-secondary) !important;
}

body[data-theme=dark] .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  color: var(--cd-text-muted) !important;
  border-right-color: var(--cd-border-subtle) !important;
}

body[data-theme=dark] .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
  color: var(--bs-body-color) !important;
}

body[data-theme=dark] .select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: var(--cd-text-muted) transparent transparent transparent;
}

/* Filter sidebar — Select2 focus ring (primary, not green) */
body[data-theme=dark] .filter-section .select2-container--default.select2-container--focus .select2-selection,
body[data-theme=dark] .page-filter-row .select2-container--default.select2-container--focus .select2-selection {
  border-color: rgba(var(--primary-rgb), 0.45) !important;
  box-shadow: 0 0 0 0.15rem rgba(var(--primary-rgb), 0.12) !important;
}

body[data-theme=dark] .filter-section .select2-container .select2-selection,
body[data-theme=dark] .page-filter-row .select2-container .select2-selection {
  background-color: var(--cd-surface-input) !important;
  border-color: var(--cd-border-default) !important;
}

body[data-theme=dark] .filter-actions {
  border-top-color: var(--cd-border-subtle);
}

body[data-theme=dark] .filter-label {
  color: var(--cd-text-secondary);
}

/* Orders table — product image circles & channel badges */
body[data-theme=dark] .stacked-product-image,
body[data-theme=dark] .stacked-product-img {
  background-color: var(--cd-surface-input) !important;
  border: 1px solid var(--cd-border-subtle);
  box-shadow: none;
}

body[data-theme=dark] .small-stacked-product-img {
  background-color: var(--cd-surface-input);
}

body[data-theme=dark] .channel-logo-badge {
  background: var(--cd-surface-input);
  border-color: var(--cd-border-subtle);
}

body[data-theme=dark] .channel-logo-fallback {
  color: var(--cd-text-muted);
}

/* Date range picker */
body[data-theme=dark] .daterangepicker {
  background-color: var(--cd-surface-overlay);
  border-color: var(--cd-border-subtle);
  color: var(--bs-body-color);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

body[data-theme=dark] .daterangepicker .calendar-table {
  background-color: var(--cd-surface-overlay);
  border-color: var(--cd-border-subtle);
}

body[data-theme=dark] .daterangepicker .calendar-table td,
body[data-theme=dark] .daterangepicker .calendar-table th {
  color: var(--cd-text-secondary);
}

body[data-theme=dark] .daterangepicker td.in-range {
  background-color: rgba(var(--primary-rgb), 0.12);
  color: var(--bs-body-color);
}

body[data-theme=dark] .daterangepicker td.off,
body[data-theme=dark] .daterangepicker td.off.end-date,
body[data-theme=dark] .daterangepicker td.off.in-range,
body[data-theme=dark] .daterangepicker td.off.start-date {
  background-color: var(--cd-surface-overlay);
  color: var(--cd-text-muted);
}

body[data-theme=dark] .daterangepicker td.active,
body[data-theme=dark] .daterangepicker td.active:hover,
body[data-theme=dark] .daterangepicker td.available:hover,
body[data-theme=dark] .daterangepicker th.available:hover {
  background-color: var(--primary);
  color: #fff;
}

body[data-theme=dark] .daterangepicker:after {
  border-bottom-color: var(--cd-surface-overlay);
}

body[data-theme=dark] .daterangepicker:before {
  border-bottom-color: var(--cd-border-subtle);
}

body[data-theme=dark] .daterangepicker .ranges li {
  color: var(--cd-text-secondary);
}

body[data-theme=dark] .daterangepicker .ranges li.active {
  background-color: var(--primary);
  color: #fff;
}

body[data-theme=dark] .daterangepicker .ranges li:hover {
  background-color: var(--cd-surface-hover);
  color: var(--bs-body-color);
}

body[data-theme=dark] .daterangepicker .drp-buttons {
  border-top-color: var(--cd-border-subtle);
}

body[data-theme=dark] .daterangepicker select.ampmselect,
body[data-theme=dark] .daterangepicker select.hourselect,
body[data-theme=dark] .daterangepicker select.minuteselect,
body[data-theme=dark] .daterangepicker select.secondselect {
  background: var(--cd-surface-input);
  border-color: var(--cd-border-default);
  color: var(--bs-body-color);
}

body[data-theme=dark] .daterangepicker.show-ranges .drp-calendar.left {
  border-left-color: var(--cd-border-subtle);
}

/* Open orders page */
body[data-theme=dark] #datatable-open-orders.bg-white,
body[data-theme=dark] #datatable-open-orders,
body[data-theme=dark] #datatable-orders.bg-white,
body[data-theme=dark] #datatable-orders {
  background-color: transparent !important;
}

body[data-theme=dark] .page-filter-row .form-label.text-muted {
  color: var(--cd-text-muted) !important;
}

body[data-theme=dark] #dateRangeSelectorOrders.bg-white,
body[data-theme=dark] #dateRangeSelector {
  background-color: var(--cd-surface-input) !important;
  border-color: var(--cd-border-default) !important;
  color: var(--bs-body-color) !important;
}

body[data-theme=dark] #dateRangeSelector::placeholder {
  color: var(--cd-text-muted);
}

body[data-theme=dark] #dateRangeSelector:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 0.2rem rgba(0, 119, 255, 0.25) !important;
}

body[data-theme=dark] #datatable-open-orders .form-check-input,
body[data-theme=dark] #datatable-orders .form-check-input {
  border-color: var(--cd-border-default);
  background-color: var(--cd-surface-input);
}

body[data-theme=dark] #datatable-open-orders .form-check-input:checked,
body[data-theme=dark] #datatable-orders .form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

body[data-theme=dark] .order-filter-card.shipment-method {
  border-color: var(--cd-border-subtle) !important;
}

body[data-theme=dark] .order-filter-card.shipment-method-active {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 1px rgba(var(--primary-rgb), 0.2) !important;
}

body[data-theme=dark] .carrier-logo-img {
  background-color: var(--cd-surface-input) !important;
  border-color: var(--cd-border-subtle);
}

body[data-theme=dark] .order-qty-badge[data-qty="1"] { background: rgba(75, 191, 115, 0.22); color: #86efac; border-color: rgba(75, 191, 115, 0.32); }
body[data-theme=dark] .order-qty-badge[data-qty="2"] { background: rgba(31, 155, 207, 0.22); color: #7dd3fc; border-color: rgba(31, 155, 207, 0.32); }
body[data-theme=dark] .order-qty-badge[data-qty="3"] { background: rgba(167, 139, 250, 0.22); color: #c4b5fd; border-color: rgba(167, 139, 250, 0.32); }
body[data-theme=dark] .order-qty-badge[data-qty="4"] { background: rgba(204, 139, 55, 0.22); color: #fcd34d; border-color: rgba(204, 139, 55, 0.32); }
body[data-theme=dark] .order-qty-badge[data-qty="5"] { background: rgba(229, 165, 75, 0.22); color: #fcd34d; border-color: rgba(229, 165, 75, 0.32); }
body[data-theme=dark] .order-qty-badge[data-qty="6"] { background: rgba(239, 108, 0, 0.2); color: #fdba74; border-color: rgba(239, 108, 0, 0.3); }
body[data-theme=dark] .order-qty-badge[data-qty="7"] { background: rgba(230, 81, 0, 0.2); color: #fdba74; border-color: rgba(230, 81, 0, 0.3); }
body[data-theme=dark] .order-qty-badge[data-qty="8"] { background: rgba(217, 83, 79, 0.22); color: #fca5a5; border-color: rgba(217, 83, 79, 0.32); }
body[data-theme=dark] .order-qty-badge[data-qty="9"] { background: rgba(217, 83, 79, 0.26); color: #fca5a5; border-color: rgba(217, 83, 79, 0.36); }
body[data-theme=dark] .order-qty-badge[data-qty="10"] { background: rgba(183, 28, 28, 0.28); color: #fca5a5; border-color: rgba(183, 28, 28, 0.38); }
body[data-theme=dark] .order-qty-badge[data-qty="default"] { background: rgba(255, 255, 255, 0.08); color: var(--cd-text-secondary); border-color: var(--cd-border-default); }

body[data-theme=dark] .channeldock-table-style .text-success {
  color: #86efac !important;
}

body[data-theme=dark] .channeldock-table-style .text-info {
  color: #7dd3fc !important;
}

body[data-theme=dark] .channeldock-table-style .text-warning {
  color: #fcd34d !important;
}

body[data-theme=dark] .channeldock-table-style .text-secondary {
  color: var(--cd-text-muted) !important;
}

/* Batches page */
body[data-theme=dark] #datatable-batches tbody tr.batch-status-pending {
  background-color: rgba(var(--primary-rgb), 0.06) !important;
}

body[data-theme=dark] #datatable-batches tbody tr.batch-status-picking,
body[data-theme=dark] #datatable-batches tbody tr.batch-status-picked,
body[data-theme=dark] #datatable-batches tbody tr.batch-status-packing {
  background-color: rgba(204, 139, 55, 0.08) !important;
}

body[data-theme=dark] #datatable-batches tbody tr.batch-status-shipped {
  background-color: rgba(75, 191, 115, 0.06) !important;
}

body[data-theme=dark] table.dataTable tr.dtrg-group th,
body[data-theme=dark] table.dataTable tr.dtrg-group.dtrg-level-0 th {
  background-color: var(--cd-surface-elevated);
  color: var(--bs-body-color);
  border-bottom: 1px solid var(--cd-border-subtle);
}

body[data-theme=dark] .single-tbody {
  background: var(--cd-surface-raised);
  border-bottom-color: var(--cd-surface-base);
}

body[data-theme=dark] .grouped-tbody {
  border-bottom-color: var(--cd-surface-base) !important;
}

body[data-theme=dark] .batch-workflow-phase-label,
body[data-theme=dark] .batch-workflow-phase-meta,
body[data-theme=dark] .batch-workflow-sub {
  color: var(--cd-text-muted);
}

body[data-theme=dark] .batch-workflow-track {
  background: var(--cd-surface-input);
}

body[data-theme=dark] .batch-workflow-fill-pick {
  background: rgba(75, 191, 115, 0.65);
}

body[data-theme=dark] .batch-workflow-fill-pack {
  background: rgba(var(--primary-rgb), 0.75);
}

body[data-theme=dark] .batch-sync-status--auto {
  --batch-sync-accent: var(--primary);
  --batch-sync-surface: rgba(var(--primary-rgb), 0.1);
  border-color: rgba(var(--primary-rgb), 0.22);
}

body[data-theme=dark] .batch-sync-status--auto .batch-sync-status__label {
  color: var(--cd-text-secondary);
}

/* Batch detail modal — unified surfaces & accents */
body[data-theme=dark] #batchModal .card-header.bg-light {
  background-color: var(--cd-surface-elevated) !important;
}

body[data-theme=dark] #batchModal .batch-progress-summary-foot .text-muted,
body[data-theme=dark] #batchModal .card-body .form-text.text-muted,
body[data-theme=dark] #batchModal .batch-location-warning-product-meta.text-muted {
  color: var(--cd-text-muted) !important;
}

body[data-theme=dark] #batchModal .batch-progress-track {
  background: var(--cd-surface-input);
}

body[data-theme=dark] #batchModal .batch-progress-fill {
  background: linear-gradient(90deg, rgba(var(--primary-rgb), 0.5), rgba(var(--primary-rgb), 0.85));
}

body[data-theme=dark] #batchModal .batch-location-warning-card--danger {
  border-color: rgba(217, 83, 79, 0.22);
  border-left: 3px solid rgba(224, 122, 122, 0.7);
  background-color: rgba(217, 83, 79, 0.1);
  box-shadow: none;
}

body[data-theme=dark] #batchModal .batch-location-warning-card--warning {
  border-color: rgba(204, 139, 55, 0.22);
  border-left: 3px solid rgba(229, 181, 64, 0.65);
  background-color: rgba(204, 139, 55, 0.1);
  box-shadow: none;
}

body[data-theme=dark] #batchModal .batch-location-warning-card--danger .batch-location-warning-card-header {
  background: rgba(217, 83, 79, 0.08) !important;
  border-bottom-color: rgba(217, 83, 79, 0.18);
}

body[data-theme=dark] #batchModal .batch-location-warning-card--warning .batch-location-warning-card-header {
  background: rgba(204, 139, 55, 0.08) !important;
  border-bottom-color: rgba(204, 139, 55, 0.18);
}

body[data-theme=dark] #batchModal .batch-location-warning-card--danger .batch-location-warning-heading,
body[data-theme=dark] #batchModal .batch-location-warning-card--warning .batch-location-warning-heading {
  color: var(--bs-body-color);
}

body[data-theme=dark] #batchModal .batch-location-warning-card .card-body {
  background: transparent;
}

body[data-theme=dark] #batchModal .batch-location-warning-table tbody td {
  border-bottom-color: var(--cd-border-subtle);
}

body[data-theme=dark] #batchModal .batch-location-warning-card--danger .batch-location-warning-table tbody tr:hover {
  background: rgba(217, 83, 79, 0.06);
}

body[data-theme=dark] #batchModal .batch-location-warning-card--warning .batch-location-warning-table tbody tr:hover {
  background: rgba(204, 139, 55, 0.06);
}

body[data-theme=dark] #batchModal .batch-location-warning-product-img {
  background: var(--cd-surface-input);
  border-color: var(--cd-border-subtle);
}

body[data-theme=dark] #batchModal .batch-cart-tag.badge-soft-success {
  color: var(--primary-lighter, var(--primary));
  background-color: rgba(var(--primary-rgb), 0.2);
}

body[data-theme=dark] #batchModal .batch-modal-footer {
  border-top-color: var(--cd-border-subtle);
}

body[data-theme=dark] #batchModal .batch-modal-workflow-btn.btn-success {
  background-color: rgba(var(--primary-rgb), 0.18);
  border-color: rgba(var(--primary-rgb), 0.32);
  color: var(--primary);
}

body[data-theme=dark] #batchModal .batch-modal-workflow-btn.btn-success:hover {
  background-color: rgba(var(--primary-rgb), 0.28);
  border-color: rgba(var(--primary-rgb), 0.4);
  color: var(--bs-body-color);
}

body[data-theme=dark] #batchModal .batch-modal-workflow-btn.btn-info {
  background-color: rgba(31, 155, 207, 0.18);
  border-color: rgba(31, 155, 207, 0.32);
  color: #7dd3fc;
}

body[data-theme=dark] #batchModal .batch-modal-workflow-btn.btn-info:hover {
  background-color: rgba(31, 155, 207, 0.28);
  border-color: rgba(31, 155, 207, 0.4);
  color: var(--bs-body-color);
}

body[data-theme=dark] #batchModal #batchCartTagInput {
  color: var(--bs-body-color);
}

body[data-theme=dark] #batchModal #batchCartTagInput::placeholder {
  color: var(--cd-text-muted);
}

body[data-theme=dark] .batch-cart-tags-field {
  background-color: var(--cd-surface-input);
  color: var(--bs-body-color);
  border-color: var(--cd-border-default);
}

/* Update stock modal — unified surfaces (injected modal styles also set dark rules) */
body[data-theme=dark] #updateStockAmountModal .modal-content {
  background-color: rgb(var(--bs-modal-bg-rgb));
  border-color: var(--cd-border-subtle);
}

body[data-theme=dark] #updateStockAmountModal .modal-header {
  border-bottom-color: var(--cd-border-subtle);
}

body[data-theme=dark] #updateStockAmountModal .product-inventory-tabs {
  background-color: rgb(var(--bs-card-bg-rgb)) !important;
  border-color: var(--cd-border-subtle) !important;
}

body[data-theme=dark] #updateStockAmountModal #stockUpdateTabs .nav-link {
  background-color: var(--cd-surface-input) !important;
  border-color: var(--cd-border-subtle) !important;
  color: var(--cd-text-secondary) !important;
}

body[data-theme=dark] #updateStockAmountModal #stockUpdateTabs .nav-link.active {
  background-color: rgb(var(--bs-card-bg-rgb)) !important;
  color: var(--primary) !important;
  border-bottom-color: transparent !important;
}

body[data-theme=dark] #updateStockAmountModal .tab-content {
  background-color: rgb(var(--bs-card-bg-rgb)) !important;
  border-color: var(--cd-border-subtle) !important;
}

body[data-theme=dark] #updateStockAmountModal .custom-dropdown-button {
  background-color: var(--cd-surface-raised) !important;
  border-color: var(--cd-border-default) !important;
  color: var(--bs-body-color) !important;
}

body[data-theme=dark] #updateStockAmountModal .custom-dropdown-button:hover {
  background-color: var(--cd-surface-hover) !important;
  border-color: rgba(var(--primary-rgb), 0.45) !important;
}

body[data-theme=dark] #updateStockAmountModal .custom-dropdown-options {
  background-color: var(--cd-surface-raised) !important;
  border-color: var(--cd-border-subtle) !important;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45) !important;
}

body[data-theme=dark] #updateStockAmountModal .dropdown-search-container {
  background-color: var(--cd-surface-raised) !important;
  border-bottom-color: var(--cd-border-subtle) !important;
}

body[data-theme=dark] #updateStockAmountModal .dropdown-search-input {
  background-color: transparent !important;
  border-color: var(--cd-border-subtle) !important;
  color: var(--bs-body-color) !important;
  box-shadow: none !important;
}

body[data-theme=dark] #updateStockAmountModal .dropdown-search-input:focus {
  border-color: rgba(var(--primary-rgb), 0.45) !important;
  box-shadow: 0 0 0 0.15rem rgba(var(--primary-rgb), 0.12) !important;
  background-color: transparent !important;
}

body[data-theme=dark] #updateStockAmountModal .dropdown-search-input::placeholder {
  color: var(--cd-text-muted) !important;
}

body[data-theme=dark] #updateStockAmountModal .dropdown-default-state .dropdown-text,
body[data-theme=dark] #updateStockAmountModal .dropdown-arrow {
  color: var(--cd-text-muted) !important;
}

body[data-theme=dark] #updateStockAmountModal .location-name,
body[data-theme=dark] #updateStockAmountModal .option-name {
  color: var(--bs-body-color) !important;
}

body[data-theme=dark] #updateStockAmountModal .dropdown-option {
  background-color: var(--cd-surface-raised) !important;
  border-bottom-color: var(--cd-border-subtle) !important;
  color: var(--bs-body-color) !important;
}

body[data-theme=dark] #updateStockAmountModal .dropdown-option:hover {
  background-color: var(--cd-surface-hover) !important;
}

body[data-theme=dark] #updateStockAmountModal .dropdown-option.selected {
  background-color: rgba(var(--primary-rgb), 0.14) !important;
  border-left-color: var(--primary) !important;
}

body[data-theme=dark] #updateStockAmountModal .dropdown-no-results {
  color: var(--cd-text-muted) !important;
}

body[data-theme=dark] #updateStockAmountModal .location-badges .badge.badge-soft-info,
body[data-theme=dark] #updateStockAmountModal .option-badges .badge.badge-soft-info {
  color: #7dd3fc !important;
  background-color: rgba(31, 155, 207, 0.28) !important;
}

body[data-theme=dark] #updateStockAmountModal .location-badges .badge.badge-soft-warning,
body[data-theme=dark] #updateStockAmountModal .option-badges .badge.badge-soft-warning {
  color: #fcd34d !important;
  background-color: rgba(204, 139, 55, 0.28) !important;
}

body[data-theme=dark] #updateStockAmountModal .location-badges .badge.badge-soft-success,
body[data-theme=dark] #updateStockAmountModal .option-badges .badge.badge-soft-success {
  color: var(--primary-lighter, var(--primary)) !important;
  background-color: rgba(var(--primary-rgb), 0.28) !important;
}

body[data-theme=dark] #updateStockAmountModal .location-badges .badge.badge-soft-secondary,
body[data-theme=dark] #updateStockAmountModal .option-badges .badge.badge-soft-secondary {
  color: var(--cd-text-secondary) !important;
  background-color: rgba(255, 255, 255, 0.1) !important;
}

body[data-theme=dark] #updateStockAmountModal .form-label {
  color: var(--bs-body-color);
}

body[data-theme=dark] #updateStockAmountModal .form-text {
  color: var(--cd-text-muted) !important;
}

body[data-theme=dark] #updateStockAmountModal .touchspin-wrapper .bootstrap-touchspin {
  flex-wrap: nowrap !important;
}

body[data-theme=dark] #datatable-batches .actions-cell .btn-success {
  background-color: rgba(var(--primary-rgb), 0.18);
  border-color: rgba(var(--primary-rgb), 0.32);
  color: var(--primary);
}

body[data-theme=dark] #datatable-batches .actions-cell .btn-success:hover {
  background-color: rgba(var(--primary-rgb), 0.28);
  border-color: rgba(var(--primary-rgb), 0.4);
  color: var(--bs-body-color);
}

body[data-theme=dark] #datatable-batches .actions-cell .btn-info {
  background-color: rgba(31, 155, 207, 0.18);
  border-color: rgba(31, 155, 207, 0.32);
  color: #7dd3fc;
}

body[data-theme=dark] #datatable-batches .actions-cell .btn-danger {
  background-color: rgba(217, 83, 79, 0.18);
  border-color: rgba(217, 83, 79, 0.32);
  color: #f5a8a6;
}

body[data-theme=dark] #datatable-batches .actions-cell .btn-danger:hover {
  background-color: rgba(217, 83, 79, 0.28);
  border-color: rgba(217, 83, 79, 0.4);
  color: var(--bs-body-color);
}

body[data-theme=dark] #datatable-batches .actions-cell .btn-light {
  background-color: rgba(var(--bs-body-color-rgb), 0.08);
  border-color: rgba(var(--bs-body-color-rgb), 0.15);
  color: var(--bs-body-color);
}

body[data-theme=dark] .batches-table-card .form-label.text-muted {
  color: var(--cd-text-muted) !important;
}

/* Stock locations page */
body[data-theme=dark] .locations-layer-ul {
  color: var(--bs-body-color);
}

body[data-theme=dark] .add-location-nav-button:hover {
  color: var(--bs-body-color);
}

body[data-theme=dark] #stock_section_navigator .add-section-nav-button {
  color: var(--primary);
}

body[data-theme=dark] #stock_section_navigator .delete-section-nav-button {
  color: #e07a7a;
}

body[data-theme=dark] .stock-sections-page .main-buttons .btn-light {
  background-color: var(--cd-surface-input) !important;
  border-color: var(--cd-border-default) !important;
  color: var(--cd-text-secondary) !important;
}

body[data-theme=dark] .stock-sections-page .main-buttons .btn-light:hover {
  background-color: var(--cd-surface-hover) !important;
  color: var(--bs-body-color) !important;
}

body[data-theme=dark] .stock-sections-page .stockLocationProductTable a {
  color: var(--primary);
}

body[data-theme=dark] .stock-sections-page .stockLocationProductTable a:hover {
  color: var(--primary-lighter, var(--primary));
}

/* ---- Administration page: seller dialog + DataTables dark mode ---- */
body[data-theme=dark] #seller_dialog .modal-content {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

body[data-theme=dark] #seller_dialog .modal-body {
  background: var(--cd-surface-base, #16181B);
}

body[data-theme=dark] #seller_dialog .seller-tab-btn {
  color: var(--cd-text-muted, rgba(255, 255, 255, 0.65));
}

body[data-theme=dark] #seller_dialog .seller-tab-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--bs-body-color, #fefefe);
}

body[data-theme=dark] #seller_dialog .btn-close {
  filter: invert(1);
  opacity: 0.5;
}

body[data-theme=dark] #seller_dialog .btn-close:hover {
  opacity: 1;
}

/* DataTables controls (length menu, search input, pagination) */
body[data-theme=dark] .dataTables_wrapper .dataTables_filter input,
body[data-theme=dark] .dataTables_wrapper .dataTables_length select {
  background-color: var(--cd-surface-input, #2a2b2e) !important;
  border-color: var(--cd-border-default, rgba(255, 255, 255, 0.15)) !important;
  color: var(--bs-body-color, #fefefe) !important;
}

body[data-theme=dark] .dataTables_wrapper .dt-buttons .btn {
  background-color: var(--cd-surface-input, #2a2b2e) !important;
  border-color: var(--cd-border-default, rgba(255, 255, 255, 0.15)) !important;
  color: var(--cd-text-secondary, rgba(255, 255, 255, 0.72)) !important;
}

body[data-theme=dark] .dataTables_wrapper .dt-buttons .btn:hover {
  background-color: var(--cd-surface-hover, rgba(255, 255, 255, 0.05)) !important;
  color: var(--bs-body-color, #fefefe) !important;
}

/* DataTables export dropdown collection (not a Bootstrap .dropdown-menu) */
body[data-theme=dark] .dt-button-collection {
  background: var(--cd-surface-overlay, #242528);
  border: 1px solid var(--cd-border-default, rgba(255, 255, 255, 0.15));
}

body[data-theme=dark] .dt-button-collection .dt-button {
  color: var(--bs-body-color, #fefefe);
}

body[data-theme=dark] .dt-button-collection .dt-button:hover {
  background: var(--cd-surface-hover, rgba(255, 255, 255, 0.05));
  color: var(--bs-body-color, #fefefe);
}

/* Pagination dark mode */
body[data-theme=dark] .dataTables_wrapper .paginate_button {
  color: var(--bs-body-color, #fefefe) !important;
}

body[data-theme=dark] .dataTables_wrapper .paginate_button:hover {
  background: var(--cd-surface-hover, rgba(255, 255, 255, 0.05)) !important;
  border-color: var(--cd-border-default, rgba(255, 255, 255, 0.15)) !important;
  color: var(--bs-body-color, #fefefe) !important;
}

body[data-theme=dark] .dataTables_wrapper .paginate_button.current {
  background: var(--primary, #0077ff) !important;
  border-color: var(--primary, #0077ff) !important;
  color: #fff !important;
}

body[data-theme=dark] .dataTables_wrapper .paginate_button.disabled {
  color: var(--cd-text-muted, rgba(255, 255, 255, 0.35)) !important;
  background: transparent !important;
}

/* Export modal tables in dark mode */
body[data-theme=dark] #centerAdminExportModal .tab-content,
body[data-theme=dark] #centerAdminExportModal .tab .tab-content {
  background: var(--cd-surface-base, #16181B);
}

body[data-theme=dark] #centerAdminExportModal .nav-tabs .nav-link {
  color: var(--cd-text-muted, rgba(255, 255, 255, 0.65));
  border-bottom-color: transparent;
}

body[data-theme=dark] #centerAdminExportModal .nav-tabs .nav-link:hover {
  color: var(--bs-body-color, #fefefe);
  border-color: transparent transparent var(--cd-border-default) transparent;
}

body[data-theme=dark] #centerAdminExportModal .nav-tabs .nav-link.active {
  color: var(--bs-body-color, #fefefe);
  background-color: var(--cd-surface-raised, #202124);
  border-color: var(--cd-border-default) var(--cd-border-default) transparent;
}

body[data-theme=dark] #centerAdminExportModal .form-control,
body[data-theme=dark] #centerAdminExportModal .form-select {
  background-color: var(--cd-surface-input, #2a2b2e);
  border-color: var(--cd-border-default, rgba(255, 255, 255, 0.15));
  color: var(--bs-body-color, #fefefe);
}

body[data-theme=dark] #centerAdminExportModal .table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--bs-body-color);
  --bs-table-border-color: var(--cd-border-subtle);
}

body[data-theme=dark] .stock-sections-page img[src*="stock_section_arrow"] {
  filter: invert(0.82) brightness(0.95);
  opacity: 0.85;
}

body[data-theme=dark] #importExportModal .card:hover {
  border-color: rgba(var(--primary-rgb), 0.35) !important;
  background-color: var(--cd-surface-hover);
}

body[data-theme=dark] #warehouseInsightsModal .text-muted,
body[data-theme=dark] #importExportModal .text-muted {
  color: var(--cd-text-muted) !important;
}

/* Order Filter Cards - Dark Mode */
@media (prefers-color-scheme: dark) {
    :root {
        --order-card-bg: #202124;
        --order-card-border: #374151;
        --order-card-text: #f9fafb;
        --order-card-text-muted: #9ca3af;
        --order-card-elevation: 0 0 0.875rem 0 rgba(0, 0, 0, 0.28);
        --order-card-elevation-hover: 0 0 1.125rem 0 rgba(0, 0, 0, 0.36);
        --order-progress-bg: #374151;
        --logo-filter: brightness(0) invert(1);
        --skeleton-base: #4b5563;
        --skeleton-shine: #6b7280;
        --skeleton-card-bg: #202124;
        --skeleton-card-border: #4b5563;
    }
}

[data-bs-theme="dark"] {
    --order-card-bg: #202124;
    --order-card-border: #374151;
    --order-card-text: #f9fafb;
    --order-card-text-muted: #9ca3af;
    --order-card-elevation: 0 0 0.875rem 0 rgba(0, 0, 0, 0.28);
    --order-card-elevation-hover: 0 0 1.125rem 0 rgba(0, 0, 0, 0.36);
    --order-progress-bg: #374151;
    --logo-filter: brightness(0) invert(1);
    --skeleton-base: #4b5563;
    --skeleton-shine: #6b7280;
    --skeleton-card-bg: #202124;
    --skeleton-card-border: #4b5563;
}

body[data-theme=dark] {
    --order-card-bg: #202124;
    --order-card-border: #374151;
    --order-card-text: #f9fafb;
    --order-card-text-muted: #9ca3af;
    --order-card-elevation: 0 0 0.875rem 0 rgba(0, 0, 0, 0.28);
    --order-card-elevation-hover: 0 0 1.125rem 0 rgba(0, 0, 0, 0.36);
    --order-progress-bg: #374151;
    --logo-filter: brightness(0) invert(1);
    --skeleton-base: #4b5563;
    --skeleton-shine: #6b7280;
    --skeleton-card-bg: #202124;
    --skeleton-card-border: #4b5563;
}

body[data-theme=dark] {
    --order-card-bg: #202124;
    --order-card-border: #374151;
    --order-card-text: #f9fafb;
    --order-card-text-muted: #9ca3af;
    --order-card-elevation: 0 0 0.875rem 0 rgba(0, 0, 0, 0.28);
    --order-card-elevation-hover: 0 0 1.125rem 0 rgba(0, 0, 0, 0.36);
    --order-progress-bg: #374151;
    --logo-filter: brightness(0) invert(1);
    --skeleton-base: #4b5563;
    --skeleton-shine: #6b7280;
    --skeleton-card-bg: #202124;
    --skeleton-card-border: #4b5563;
}