/* ==========================================================================
   Supplier + admin portals — Dark theme (screen only: linked with media="screen" so print/PDF stay light).
   Light (trade-ledger.css) is untouched. Dark re-declares the SAME tokens on the same selectors
   (body.portal-v2 and every [data-bs-theme] descendant, e.g. the sidebar) under html[data-bs-theme="dark"],
   so Tabler's own dark rules, the Trade Ledger tokens and the legacy AdminLTE layouts agree on one palette.
   ========================================================================== */
html[data-bs-theme="dark"] body.portal-v2,
html[data-bs-theme="dark"] body.portal-v2 [data-bs-theme] {
  color-scheme: dark;
  --tl-paper: #0F141B;
  --tl-panel: #171F2A;
  --tl-panel-2: #202B38;
  --tl-line: #2C3A4B;
  --tl-line-2: #243142;
  --tl-ink: #E8EDF5;
  --tl-muted: #A8B5C5;
  --tl-muted-2: #8493A6;
  --tl-brand: #4FBF86;
  --tl-brand-press: #72D3A0;
  --tl-brand-soft: #16382A;
  --tl-brand-fill: #1E7F52;
  --tl-danger: #FF8A7C;
  --tl-danger-soft: #3A1F20;
  --tl-olive: #E5C15A;
  --tl-olive-soft: #3A3414;
  --tl-green: #5BCB8C;
  --tl-accent: #B9D84A;
  --tl-accent-ink: #1F3300;
  --tl-ring: 0 0 0 3px rgba(79,191,134,.28);

  --cosmo-portal-accent: #4FBF86;
  --cosmo-portal-accent-dark: #72D3A0;
  --tblr-primary: #1E7F52;
  --tblr-primary-rgb: 30, 127, 82;
  --tblr-primary-fg: #fff;
  --tblr-primary-text-emphasis: #72D3A0;
  --tblr-primary-bg-subtle: #16382A;
  --tblr-primary-border-subtle: #1F5A3E;
  --tblr-primary-lt: #16382A;
  --tblr-link-color: #4FBF86;
  --tblr-link-color-rgb: 79, 191, 134;
  --tblr-link-hover-color: #72D3A0;
  --tblr-link-hover-color-rgb: 114, 211, 160;
  --tblr-body-bg: #0F141B;
  --tblr-body-bg-rgb: 15, 20, 27;
  --tblr-body-color: #E8EDF5;
  --tblr-body-color-rgb: 232, 237, 245;
  --tblr-emphasis-color: #F4F7FB;
  --tblr-emphasis-color-rgb: 244, 247, 251;
  --tblr-bg-surface: #171F2A;
  --tblr-bg-surface-secondary: #1B2430;
  --tblr-bg-surface-tertiary: #202B38;
  --tblr-bg-forms: #171F2A;
  --tblr-secondary-bg: #202B38;
  --tblr-secondary-bg-rgb: 32, 43, 56;
  --tblr-tertiary-bg: #1B2430;
  --tblr-tertiary-bg-rgb: 27, 36, 48;
  --tblr-border-color: #2C3A4B;
  --tblr-border-color-translucent: rgba(232,237,245,.1);
  --tblr-secondary: #A8B5C5;
  --tblr-secondary-color: #A8B5C5;
  --tblr-secondary-color-rgb: 168, 181, 197;
  --tblr-tertiary-color: #8493A6;
  --tblr-muted: #A8B5C5;
  --tblr-shadow-card: none;
  --tblr-shadow-input: none;
  --tblr-box-shadow: 0 2px 6px rgba(0,0,0,.4), 0 22px 44px -22px rgba(0,0,0,.7);
  --tblr-success: #3FAE6B;
  --tblr-success-rgb: 63, 174, 107;
  --tblr-danger: #E5604F;
  --tblr-danger-rgb: 229, 96, 79;
  --tblr-warning: #E5A23A;
  --tblr-warning-rgb: 229, 162, 58;
  --tblr-info: #5AAEE6;
  --tblr-info-rgb: 90, 174, 230;
  --tblr-success-text-emphasis: #7BE0A8;
  --tblr-danger-text-emphasis: #FFA095;
  --tblr-warning-text-emphasis: #F0C766;
  --tblr-info-text-emphasis: #8CC8F2;
  --tblr-success-bg-subtle: #15341F;
  --tblr-danger-bg-subtle: #3A1F20;
  --tblr-warning-bg-subtle: #3A2F14;
  --tblr-info-bg-subtle: #14304A;
  --tblr-success-border-subtle: #1F5A33;
  --tblr-danger-border-subtle: #7A3A33;
  --tblr-warning-border-subtle: #5A4A1E;
  --tblr-info-border-subtle: #1F4A70;
}
html[data-bs-theme="dark"] { background-color: #0F141B; }
html[data-bs-theme="dark"] body.portal-v2 { background: var(--tl-paper); color: var(--tl-ink); }
html[data-bs-theme="dark"] .portal-v2 ::selection { background: #1E7F52; color: #fff; }

/* ---------- wordmark / sidebar / navbar ---------- */
html[data-bs-theme="dark"] .portal-brand__mono { background: #1E7F52; color: #fff; }
html[data-bs-theme="dark"] .portal-v2 .navbar-vertical { background: var(--tl-panel) !important; border-color: var(--tl-line); }
html[data-bs-theme="dark"] .portal-v2 .navbar-vertical .nav-link { color: var(--tl-muted); }
html[data-bs-theme="dark"] .portal-v2 .navbar-vertical .nav-link:hover { color: var(--tl-ink); }
html[data-bs-theme="dark"] .portal-v2 .navbar-vertical .sidebar-search .form-control { background: var(--tl-paper); border-color: var(--tl-line); }
html[data-bs-theme="dark"] .portal-v2 header.navbar,
html[data-bs-theme="dark"] .portal-v2 .navbar:not(.navbar-vertical) { background: var(--tl-panel); border-color: var(--tl-line); color: var(--tl-ink); }
html[data-bs-theme="dark"] .portal-v2 .navbar .nav-link { color: var(--tl-muted); }
html[data-bs-theme="dark"] .portal-v2 .navbar .nav-link:hover { color: var(--tl-ink); }
html[data-bs-theme="dark"] .portal-v2 .navbar-toggler-icon { filter: invert(1); }
html[data-bs-theme="dark"] .portal-v2 #loading { background: rgba(15,20,27,.78); }

/* ---------- filled brand controls keep white text on the deeper green ---------- */
html[data-bs-theme="dark"] .portal-v2 .btn-primary {
  --tblr-btn-bg: #1E7F52; --tblr-btn-border-color: #1E7F52; --tblr-btn-color: #fff;
  --tblr-btn-hover-bg: #17693F; --tblr-btn-hover-border-color: #17693F; --tblr-btn-hover-color: #fff;
  --tblr-btn-active-bg: #17693F; --tblr-btn-active-border-color: #17693F; --tblr-btn-active-color: #fff;
  --tblr-btn-disabled-bg: #1E7F52; --tblr-btn-disabled-border-color: #1E7F52; --tblr-btn-disabled-color: #fff;
}
html[data-bs-theme="dark"] .portal-v2 .btn-primary:is(:hover,:focus,:active,:disabled),
html[data-bs-theme="dark"] .portal-v2 .btn-primary.active { background-color: #17693F !important; border-color: #17693F !important; color: #fff !important; }
html[data-bs-theme="dark"] .portal-v2 .btn-danger { --tblr-btn-bg: #C2382C; --tblr-btn-border-color: #C2382C; --tblr-btn-hover-bg: #A92E23; --tblr-btn-hover-border-color: #A92E23; --tblr-btn-color: #fff; }
html[data-bs-theme="dark"] .portal-v2 .btn-success { --tblr-btn-bg: #1E7F52; --tblr-btn-border-color: #1E7F52; --tblr-btn-hover-bg: #17693F; --tblr-btn-hover-border-color: #17693F; --tblr-btn-color: #fff; }
html[data-bs-theme="dark"] .portal-v2 .btn-outline-primary { --tblr-btn-color: #4FBF86; --tblr-btn-border-color: #4FBF86; --tblr-btn-hover-bg: #1E7F52; --tblr-btn-hover-border-color: #1E7F52; --tblr-btn-hover-color: #fff; }
html[data-bs-theme="dark"] .portal-v2 :is(.bg-primary, .badge.bg-primary, .progress-bar, .form-check-input:checked) { background-color: #1E7F52 !important; border-color: #1E7F52; }
html[data-bs-theme="dark"] .portal-v2 .text-primary { color: #4FBF86 !important; }
html[data-bs-theme="dark"] .portal-v2 .bg-primary-lt { background-color: #16382A !important; color: #72D3A0 !important; }
html[data-bs-theme="dark"] .portal-v2 .text-secondary, html[data-bs-theme="dark"] .portal-v2 .text-muted { color: var(--tl-muted) !important; }
html[data-bs-theme="dark"] .portal-v2 .btn-ghost-secondary, html[data-bs-theme="dark"] .portal-v2 .btn-default { color: var(--tl-ink); }
html[data-bs-theme="dark"] .portal-v2 .btn-white, html[data-bs-theme="dark"] .portal-v2 .btn-light { --tblr-btn-bg: var(--tl-panel-2); --tblr-btn-color: var(--tl-ink); --tblr-btn-border-color: var(--tl-line); --tblr-btn-hover-bg: var(--tl-line); --tblr-btn-hover-color: var(--tl-ink); }

/* ---------- surfaces ---------- */
html[data-bs-theme="dark"] .portal-v2 :is(.card, .modal-content, .dropdown-menu, .offcanvas, .popover, .list-group-item, .accordion-item) { background-color: var(--tl-panel); color: var(--tl-ink); border-color: var(--tl-line); }
html[data-bs-theme="dark"] .portal-v2 :is(.card-header, .card-footer, .modal-header, .modal-footer) { background-color: transparent; border-color: var(--tl-line-2); }
html[data-bs-theme="dark"] .portal-v2 .modal-backdrop { --tblr-backdrop-bg: #000; }
html[data-bs-theme="dark"] .portal-v2 .bg-white, html[data-bs-theme="dark"] .portal-v2 .bg-body, html[data-bs-theme="dark"] .portal-v2 .bg-surface { background-color: var(--tl-panel) !important; }
html[data-bs-theme="dark"] .portal-v2 :is(.bg-light, .bg-body-secondary, .bg-surface-secondary, .bg-body-tertiary) { background-color: var(--tl-panel-2) !important; }
html[data-bs-theme="dark"] .portal-v2 .dropdown-item { color: var(--tl-ink); }
html[data-bs-theme="dark"] .portal-v2 .dropdown-item:hover, html[data-bs-theme="dark"] .portal-v2 .dropdown-item:focus { background: var(--tl-panel-2); color: var(--tl-ink); }
html[data-bs-theme="dark"] .portal-v2 .dropdown-divider { border-color: var(--tl-line); }
html[data-bs-theme="dark"] .portal-v2 .btn-close { filter: invert(1) grayscale(1) brightness(1.7); }
html[data-bs-theme="dark"] .portal-v2 hr { border-color: var(--tl-line); opacity: 1; }
html[data-bs-theme="dark"] .portal-v2 .nav-tabs { border-color: var(--tl-line); }
html[data-bs-theme="dark"] .portal-v2 .nav-tabs .nav-link { color: var(--tl-muted); }
html[data-bs-theme="dark"] .portal-v2 .nav-tabs .nav-link.active { background: transparent; color: var(--tl-ink); }
html[data-bs-theme="dark"] .portal-v2 .portal-home-link { background: var(--tl-panel); border-color: var(--tl-line); color: var(--tl-ink); }
html[data-bs-theme="dark"] .portal-v2 .portal-home-link:hover { background: var(--tl-panel-2); }
html[data-bs-theme="dark"] .portal-v2 .page-center { background: var(--tl-paper) !important; }
html[data-bs-theme="dark"] .portal-v2 .alert { background-color: var(--tl-panel); border-color: var(--tl-line); color: var(--tl-ink); }
html[data-bs-theme="dark"] .portal-v2 .alert-success { background: #15341F; color: #7BE0A8; border-color: #1F5A33; }
html[data-bs-theme="dark"] .portal-v2 .alert-danger { background: #3A1F20; color: #FFA095; border-color: #7A3A33; }
html[data-bs-theme="dark"] .portal-v2 .alert-warning { background: #3A2F14; color: #F0C766; border-color: #5A4A1E; }
html[data-bs-theme="dark"] .portal-v2 .alert-info { background: #14304A; color: #8CC8F2; border-color: #1F4A70; }

/* ---------- forms ---------- */
html[data-bs-theme="dark"] .portal-v2 :is(.form-control, .form-select, .input-group-text, textarea, select) { background-color: var(--tl-panel); color: var(--tl-ink); border-color: var(--tl-line); }
html[data-bs-theme="dark"] .portal-v2 :is(.form-control:disabled, .form-control[readonly], .form-select:disabled) { background-color: var(--tl-panel-2); color: var(--tl-muted); opacity: 1; }
html[data-bs-theme="dark"] .portal-v2 ::placeholder { color: var(--tl-muted-2) !important; opacity: 1; }
html[data-bs-theme="dark"] .portal-v2 .form-control:focus, html[data-bs-theme="dark"] .portal-v2 .form-select:focus { background-color: var(--tl-panel); color: var(--tl-ink); border-color: #4FBF86; }
html[data-bs-theme="dark"] .portal-v2 .form-select { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23A8B5C5' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); }
html[data-bs-theme="dark"] .portal-v2 .form-check-input { background-color: var(--tl-panel-2); border-color: var(--tl-line); }
html[data-bs-theme="dark"] .portal-v2 .form-check-input:checked { background-color: #1E7F52; border-color: #1E7F52; }
html[data-bs-theme="dark"] .portal-v2 .form-label, html[data-bs-theme="dark"] .portal-v2 label { color: var(--tl-ink); }
html[data-bs-theme="dark"] .portal-v2 .form-hint, html[data-bs-theme="dark"] .portal-v2 .form-text { color: var(--tl-muted); }
html[data-bs-theme="dark"] .portal-v2 .form-control.is-invalid, html[data-bs-theme="dark"] .portal-v2 .was-validated .form-control:invalid { border-color: #E5604F; }
html[data-bs-theme="dark"] .portal-v2 .invalid-feedback { color: #FF8A7C; }
html[data-bs-theme="dark"] .portal-v2 input:-webkit-autofill { -webkit-text-fill-color: var(--tl-ink); box-shadow: 0 0 0 1000px var(--tl-panel) inset; }
html[data-bs-theme="dark"] .portal-v2 input[type="file"]::file-selector-button { background: var(--tl-panel-2); color: var(--tl-ink); border-color: var(--tl-line); }
html[data-bs-theme="dark"] .portal-v2 input[type="date"]::-webkit-calendar-picker-indicator,
html[data-bs-theme="dark"] .portal-v2 input[type="time"]::-webkit-calendar-picker-indicator,
html[data-bs-theme="dark"] .portal-v2 input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(.8); }

/* ---------- tables, bootstrap-table, pagination ---------- */
html[data-bs-theme="dark"] .portal-v2 .table { --tblr-table-bg: transparent; --tblr-table-color: var(--tl-ink); --tblr-table-striped-bg: rgba(255,255,255,.03); --tblr-table-hover-bg: rgba(79,191,134,.09); color: var(--tl-ink); border-color: var(--tl-line-2); }
html[data-bs-theme="dark"] .portal-v2 .table > :not(caption) > * > * { background-color: transparent; color: var(--tl-ink); border-bottom-color: var(--tl-line-2); box-shadow: none; }
html[data-bs-theme="dark"] .portal-v2 .table thead th, html[data-bs-theme="dark"] .portal-v2 .table-vcenter thead th { background-color: var(--tl-panel-2); color: var(--tl-muted); border-color: var(--tl-line); }
html[data-bs-theme="dark"] .portal-v2 .table-striped > tbody > tr:nth-of-type(odd) > * { background-color: rgba(255,255,255,.03); }
html[data-bs-theme="dark"] .portal-v2 .table-hover > tbody > tr:hover > * { background-color: rgba(79,191,134,.09); }
html[data-bs-theme="dark"] .portal-v2 .fixed-table-container, html[data-bs-theme="dark"] .portal-v2 .fixed-table-toolbar,
html[data-bs-theme="dark"] .portal-v2 .fixed-table-pagination, html[data-bs-theme="dark"] .portal-v2 .bootstrap-table .fixed-table-container .table thead th { background-color: transparent; border-color: var(--tl-line); color: var(--tl-ink); }
html[data-bs-theme="dark"] .portal-v2 .fixed-table-container .table thead th { background-color: var(--tl-panel-2); }
html[data-bs-theme="dark"] .portal-v2 .fixed-table-loading { background: var(--tl-panel); color: var(--tl-ink); }
html[data-bs-theme="dark"] .portal-v2 .bootstrap-table .fixed-table-toolbar .columns-right .btn-group .dropdown-menu label { color: var(--tl-ink); }
html[data-bs-theme="dark"] .portal-v2 .no-records-found td { color: var(--tl-muted); }
html[data-bs-theme="dark"] .portal-v2 .page-link { background: var(--tl-panel); border-color: var(--tl-line); color: var(--tl-ink); }
html[data-bs-theme="dark"] .portal-v2 .pagination .page-link:hover { background: var(--tl-brand-soft); border-color: var(--tl-brand); color: var(--tl-brand-press); }
html[data-bs-theme="dark"] .portal-v2 .page-item.active .page-link, html[data-bs-theme="dark"] .portal-v2 .page-item.active .page-link:hover { background: var(--tl-brand-fill); border-color: var(--tl-brand-fill); color: #fff; }
html[data-bs-theme="dark"] .portal-v2 .page-item.disabled .page-link { background: var(--tl-panel); border-color: var(--tl-line-2); color: var(--tl-muted-2); }
html[data-bs-theme="dark"] .portal-v2 .badge:not([class*="bg-"]) { background-color: var(--tl-panel-2); color: var(--tl-ink); }
html[data-bs-theme="dark"] .portal-v2 .badge.bg-light, html[data-bs-theme="dark"] .portal-v2 .badge.bg-secondary-lt { background-color: var(--tl-panel-2) !important; color: var(--tl-ink) !important; }
html[data-bs-theme="dark"] .portal-v2 :is(.bg-green-lt, .bg-success-lt) { background-color: #15341F !important; color: #7BE0A8 !important; }
html[data-bs-theme="dark"] .portal-v2 :is(.bg-red-lt, .bg-danger-lt) { background-color: #3A1F20 !important; color: #FFA095 !important; }
html[data-bs-theme="dark"] .portal-v2 :is(.bg-yellow-lt, .bg-orange-lt, .bg-warning-lt) { background-color: #3A2F14 !important; color: #F0C766 !important; }
html[data-bs-theme="dark"] .portal-v2 :is(.bg-blue-lt, .bg-azure-lt, .bg-info-lt, .bg-cyan-lt, .bg-indigo-lt) { background-color: #14304A !important; color: #8CC8F2 !important; }
html[data-bs-theme="dark"] .portal-v2 :is(.bg-purple-lt, .bg-pink-lt) { background-color: #2A2347 !important; color: #BBA9F0 !important; }
html[data-bs-theme="dark"] .portal-v2 :is(.bg-secondary-lt, .bg-gray-lt) { background-color: var(--tl-panel-2) !important; color: var(--tl-muted) !important; }

/* ---------- third-party widgets ---------- */
/* tom-select */
html[data-bs-theme="dark"] .portal-v2 .ts-control, html[data-bs-theme="dark"] .portal-v2 .ts-wrapper.single .ts-control, html[data-bs-theme="dark"] .portal-v2 .ts-wrapper.multi .ts-control { background: var(--tl-panel); color: var(--tl-ink); border-color: var(--tl-line); box-shadow: none; }
html[data-bs-theme="dark"] .portal-v2 .ts-control input, html[data-bs-theme="dark"] .portal-v2 .ts-control > .item { color: var(--tl-ink); }
html[data-bs-theme="dark"] .portal-v2 .ts-wrapper.multi .ts-control > div { background: var(--tl-panel-2); color: var(--tl-ink); border-color: var(--tl-line); }
html[data-bs-theme="dark"] .portal-v2 .ts-wrapper.multi .ts-control > div.active { background: #1E7F52; color: #fff; }
html[data-bs-theme="dark"] .portal-v2 .ts-dropdown, html[data-bs-theme="dark"] .portal-v2 .ts-dropdown.form-control { background: var(--tl-panel); color: var(--tl-ink); border-color: var(--tl-line); box-shadow: var(--tblr-box-shadow); }
html[data-bs-theme="dark"] .portal-v2 .ts-dropdown .active { background: var(--tl-panel-2); color: var(--tl-ink); }
html[data-bs-theme="dark"] .portal-v2 .ts-dropdown .optgroup-header, html[data-bs-theme="dark"] .portal-v2 .ts-dropdown .no-results { background: var(--tl-panel); color: var(--tl-muted); }
html[data-bs-theme="dark"] .portal-v2 .ts-dropdown .create { color: var(--tl-ink); }
/* daterangepicker */
html[data-bs-theme="dark"] .daterangepicker { background: var(--tl-panel, #171F2A); border-color: var(--tl-line, #2C3A4B); color: var(--tl-ink, #E8EDF5); }
html[data-bs-theme="dark"] .daterangepicker:before { border-bottom-color: var(--tl-line, #2C3A4B); }
html[data-bs-theme="dark"] .daterangepicker:after { border-bottom-color: var(--tl-panel, #171F2A); }
html[data-bs-theme="dark"] .daterangepicker .calendar-table { background: var(--tl-panel, #171F2A); border-color: var(--tl-line, #2C3A4B); }
html[data-bs-theme="dark"] .daterangepicker td.off, html[data-bs-theme="dark"] .daterangepicker td.off.in-range, html[data-bs-theme="dark"] .daterangepicker td.off.start-date, html[data-bs-theme="dark"] .daterangepicker td.off.end-date { background: var(--tl-panel, #171F2A); color: var(--tl-muted-2, #8493A6); }
html[data-bs-theme="dark"] .daterangepicker td.available:hover, html[data-bs-theme="dark"] .daterangepicker th.available:hover { background: var(--tl-panel-2, #202B38); color: var(--tl-ink, #E8EDF5); }
html[data-bs-theme="dark"] .daterangepicker td.in-range { background: #16382A; color: var(--tl-ink, #E8EDF5); }
html[data-bs-theme="dark"] .daterangepicker td.active, html[data-bs-theme="dark"] .daterangepicker td.active:hover { background: #1E7F52; color: #fff; }
html[data-bs-theme="dark"] .daterangepicker td.disabled, html[data-bs-theme="dark"] .daterangepicker option.disabled { color: var(--tl-muted-2, #8493A6); }
html[data-bs-theme="dark"] .daterangepicker select.monthselect, html[data-bs-theme="dark"] .daterangepicker select.yearselect, html[data-bs-theme="dark"] .daterangepicker select.hourselect,
html[data-bs-theme="dark"] .daterangepicker select.minuteselect, html[data-bs-theme="dark"] .daterangepicker select.ampmselect { background: var(--tl-panel-2, #202B38); color: var(--tl-ink, #E8EDF5); border-color: var(--tl-line, #2C3A4B); }
html[data-bs-theme="dark"] .daterangepicker .ranges li { background: var(--tl-panel-2, #202B38); color: var(--tl-ink, #E8EDF5); border-color: var(--tl-line, #2C3A4B); }
html[data-bs-theme="dark"] .daterangepicker .ranges li:hover { background: var(--tl-line, #2C3A4B); }
html[data-bs-theme="dark"] .daterangepicker .ranges li.active { background: #1E7F52; color: #fff; }
html[data-bs-theme="dark"] .daterangepicker .drp-buttons { border-top-color: var(--tl-line, #2C3A4B); }
html[data-bs-theme="dark"] .daterangepicker .calendar-table .next span, html[data-bs-theme="dark"] .daterangepicker .calendar-table .prev span { border-color: var(--tl-ink, #E8EDF5); }
/* dropzone (file uploads), tagify, intl-tel-input, lightbox, jstree */
html[data-bs-theme="dark"] .portal-v2 .dropzone { background: var(--tl-panel); border-color: var(--tl-line); color: var(--tl-muted); }
html[data-bs-theme="dark"] .portal-v2 .dropzone .dz-message { color: var(--tl-muted); }
html[data-bs-theme="dark"] .portal-v2 .dropzone .dz-preview .dz-details { color: var(--tl-ink); }
html[data-bs-theme="dark"] .portal-v2 .dropzone .dz-preview .dz-image { background: var(--tl-panel-2); }
html[data-bs-theme="dark"] .portal-v2 .tagify { --tags-border-color: var(--tl-line); --tags-hover-border-color: var(--tl-muted-2); --tags-focus-border-color: #4FBF86; --tag-bg: var(--tl-panel-2); --tag-hover: var(--tl-line); --tag-text-color: var(--tl-ink); --tag-remove-btn-color: var(--tl-ink); --input-color: var(--tl-ink); --placeholder-color: var(--tl-muted-2); background: var(--tl-panel); }
html[data-bs-theme="dark"] .tagify__dropdown__wrapper { background: var(--tl-panel, #171F2A); color: var(--tl-ink, #E8EDF5); border-color: var(--tl-line, #2C3A4B); }
html[data-bs-theme="dark"] .tagify__dropdown__item--active { background: var(--tl-panel-2, #202B38); color: var(--tl-ink, #E8EDF5); }
html[data-bs-theme="dark"] .iti__country-list { background: var(--tl-panel, #171F2A); color: var(--tl-ink, #E8EDF5); border-color: var(--tl-line, #2C3A4B); }
html[data-bs-theme="dark"] .iti__country.iti__highlight, html[data-bs-theme="dark"] .iti__country:hover { background: var(--tl-panel-2, #202B38); }
html[data-bs-theme="dark"] .iti__divider { border-bottom-color: var(--tl-line, #2C3A4B); }
html[data-bs-theme="dark"] .iti__selected-flag:hover, html[data-bs-theme="dark"] .iti__selected-flag:focus { background: var(--tl-panel-2, #202B38); }
html[data-bs-theme="dark"] .jstree-default .jstree-anchor { color: var(--tl-ink); }
html[data-bs-theme="dark"] .jstree-default .jstree-hovered { background: var(--tl-panel-2); }
html[data-bs-theme="dark"] .jstree-default .jstree-clicked { background: #16382A; }
/* ApexCharts */
html[data-bs-theme="dark"] .apexcharts-text, html[data-bs-theme="dark"] .apexcharts-legend-text, html[data-bs-theme="dark"] .apexcharts-title-text,
html[data-bs-theme="dark"] .apexcharts-xaxis-label, html[data-bs-theme="dark"] .apexcharts-yaxis-label { fill: var(--tl-muted, #A8B5C5) !important; color: var(--tl-muted, #A8B5C5) !important; }
html[data-bs-theme="dark"] .apexcharts-gridline, html[data-bs-theme="dark"] .apexcharts-xaxis-tick, html[data-bs-theme="dark"] .apexcharts-xaxis line { stroke: var(--tl-line, #2C3A4B); }
html[data-bs-theme="dark"] .apexcharts-tooltip, html[data-bs-theme="dark"] .apexcharts-xaxistooltip, html[data-bs-theme="dark"] .apexcharts-yaxistooltip { background: var(--tl-panel-2, #202B38) !important; color: var(--tl-ink, #E8EDF5) !important; border-color: var(--tl-line, #2C3A4B) !important; box-shadow: var(--tblr-box-shadow); }
html[data-bs-theme="dark"] .apexcharts-tooltip-title { background: var(--tl-panel, #171F2A) !important; border-bottom-color: var(--tl-line, #2C3A4B) !important; color: var(--tl-ink, #E8EDF5); }
html[data-bs-theme="dark"] .apexcharts-menu { background: var(--tl-panel, #171F2A); border-color: var(--tl-line, #2C3A4B); color: var(--tl-ink, #E8EDF5); }
html[data-bs-theme="dark"] .apexcharts-menu-item:hover { background: var(--tl-panel-2, #202B38); }
html[data-bs-theme="dark"] .apexcharts-canvas .apexcharts-datalabel-label, html[data-bs-theme="dark"] .apexcharts-pie-label { fill: #fff; }
/* notiflix, sweetalert, toasts */
html[data-bs-theme="dark"] .notiflix-confirm-content, html[data-bs-theme="dark"] .notiflix-report-content, html[data-bs-theme="dark"] .notiflix-confirm-content > div { background: var(--tl-panel, #171F2A) !important; color: var(--tl-ink, #E8EDF5) !important; }
html[data-bs-theme="dark"] .notiflix-confirm-head h5, html[data-bs-theme="dark"] .notiflix-report-content h5 { color: var(--tl-ink, #E8EDF5) !important; }
html[data-bs-theme="dark"] .notiflix-confirm-head, html[data-bs-theme="dark"] .notiflix-confirm-buttons { border-color: var(--tl-line, #2C3A4B) !important; }
html[data-bs-theme="dark"] .swal2-popup { background: var(--tl-panel, #171F2A); color: var(--tl-ink, #E8EDF5); }
html[data-bs-theme="dark"] .swal2-title, html[data-bs-theme="dark"] .swal2-html-container { color: var(--tl-ink, #E8EDF5); }
html[data-bs-theme="dark"] .toast, html[data-bs-theme="dark"] .portal-v2 .toast { background-color: var(--tl-panel-2); color: var(--tl-ink); border-color: var(--tl-line); }
/* jQuery UI (sortable / autocomplete) */
html[data-bs-theme="dark"] .ui-widget-content { background: var(--tl-panel, #171F2A); color: var(--tl-ink, #E8EDF5); border-color: var(--tl-line, #2C3A4B); }
html[data-bs-theme="dark"] .ui-menu-item-wrapper.ui-state-active, html[data-bs-theme="dark"] .ui-state-active { background: var(--tl-panel-2, #202B38) !important; color: var(--tl-ink, #E8EDF5) !important; border-color: var(--tl-line, #2C3A4B) !important; }
/* HugeRTE editor chrome (skin follows the page; editor body text is set in dark skin) */
html[data-bs-theme="dark"] .tox-tinymce, html[data-bs-theme="dark"] .tox.tox-tinymce { border-color: var(--tl-line, #2C3A4B); }

/* ---------- product / media thumbnails keep their real colours on a neutral mat ---------- */
html[data-bs-theme="dark"] .portal-v2 :is(img, video) { filter: none; }
html[data-bs-theme="dark"] .portal-v2 .avatar { background-color: var(--tl-panel-2); color: var(--tl-brand); }
html[data-bs-theme="dark"] * { scrollbar-color: #2C3A4B transparent; }

/* ==========================================================================
   Printed / document surfaces stay a white page with dark text, on screen and in print.
   (Print is already safe because this sheet is media="screen"; this keeps the on-screen preview honest.)
   Tabler's nested [data-bs-theme=light] would be inverted by body[data-bs-theme=dark], so the Light
   tokens are re-declared on the document root instead.
   ========================================================================== */
html[data-bs-theme="dark"] body.portal-v2 :is(#section-to-print, .portal-invoice, .theme-document) {
  color-scheme: light;
  --tl-paper: #FFFFFF; --tl-panel: #FFFFFF; --tl-panel-2: #FFFFFF; --tl-line: #DDD5C3; --tl-line-2: #E9E3D5;
  --tl-ink: #1A211C; --tl-muted: #57605A; --tl-muted-2: #848A82; --tl-brand: #177245; --tl-brand-press: #115A36;
  --tl-brand-soft: #DFF0E4; --tl-brand-fill: #177245; --tl-danger: #C2382C; --tl-green: #237A3B;
  --tblr-body-bg: #FFFFFF; --tblr-body-color: #1A211C; --tblr-emphasis-color: #1A211C; --tblr-bg-surface: #FFFFFF;
  --tblr-bg-surface-secondary: #FFFFFF; --tblr-border-color: #DDD5C3; --tblr-secondary-color: #57605A; --tblr-muted: #57605A;
  --tblr-table-color: #1A211C; --tblr-table-bg: transparent;
  background-color: #FFFFFF; color: #1A211C;
}
html[data-bs-theme="dark"] body.portal-v2 :is(#section-to-print, .portal-invoice, .theme-document) :is(.card, .table, .table > :not(caption) > * > *, .list-group-item) { background-color: #FFFFFF; color: #1A211C; border-color: #DDD5C3; }
html[data-bs-theme="dark"] body.portal-v2 :is(#section-to-print, .portal-invoice, .theme-document) .table thead th { background-color: #FFFFFF; color: #57605A; border-color: #DDD5C3; }
html[data-bs-theme="dark"] body.portal-v2 :is(#section-to-print, .portal-invoice, .theme-document) :is(.text-secondary, .text-muted) { color: #57605A !important; }
html[data-bs-theme="dark"] [id^="NotiflixConfirmWrap"] .notiflix-confirm-buttons>a.nx-confirm-button-ok { background: #1E7F52 !important; border-color: #1E7F52; }
html[data-bs-theme="dark"] [id^="NotiflixConfirmWrap"] .notiflix-confirm-buttons>a.nx-confirm-button-ok:hover { background: #17693F !important; border-color: #17693F; }
