/* ============================================================================
   Q-SERVICE ADMIN PANEL — DARK (NIGHT) MODE
   ----------------------------------------------------------------------------
   Retrofit dark theme for the legacy Limitless / Bootstrap admin template.
   EVERY rule is scoped under html[data-theme="dark"] so it is a no-op in light
   (day) mode. The theme is toggled by qs-theme-toggle.js and applied before
   paint by the inline no-FOUC script in the layout <head>.

   IMPORTANT — this project's custom stylesheet (ContentAdmin/css/site.css,
   the "Blue Frame Layout") pins nearly every structural background/text color
   with `!important`: html/body/.page-content (solid blue canvas), .content-
   wrapper (floating white card), .sidebar-dark, .card-header, table headers,
   DataTables toolbar/pagination, the dt-button-collection export dropdown,
   nav-pills, and the qs-ops-module's badge-flat pills / qs-card-rows table.
   In CSS, `!important` always wins over a non-important rule regardless of
   specificity or source order — so EVERY override below that corresponds to
   an `!important` light-mode rule MUST also carry `!important`, or it silently
   does nothing. This file is linked last in <head> so among competing
   `!important` declarations of equal specificity, these win (last one in the
   cascade wins ties).
   ============================================================================ */

/* ---------------------------------------------------------------------------
   0. TOKENS + base document
   --------------------------------------------------------------------------- */
html[data-theme="dark"] {
    /* 2026-08 audit remediation (L5-crit): the 18 --qs-d-* literals that lived here are
       DELETED. They were already dead: qs-tokens.css declares the same names under
       :root[data-theme="dark"], specificity (0,2,0), while this rule is
       html[data-theme="dark"], (0,1,1) — and specificity beats source order, so the
       bridge in qs-tokens.css was winning regardless of link order. The tokens now have
       exactly one home. color-scheme below MUST stay: it drives native scrollbars,
       date/colour pickers and autofill. */

    /* let native controls (scrollbars, date/color pickers, autofill) render dark */
    color-scheme: dark;
}

/* ROOT CAUSE FIX #1 — the "Blue Frame Layout" canvas. site.css pins these with
   !important (a solid blue html/body/.page-content canvas behind a floating
   white .content-wrapper card) — without matching !important here, this whole
   chain silently stays exactly as-is in dark mode, which is why the page
   background and the giant content card were the two things NOT going dark. */
html[data-theme="dark"] html,
html[data-theme="dark"] body {
    background: var(--qs-d-bg) !important;
    color: var(--qs-d-text);
}
html[data-theme="dark"] .page-content {
    background: var(--qs-d-bg) !important;
}
html[data-theme="dark"] .content-wrapper {
    background: var(--qs-d-surface) !important;
    box-shadow: 0 4px 32px var(--qs-d-shadow-lg), 0 1px 6px var(--qs-d-shadow) !important;
}
/* Default readable text everywhere inside the content area, so no element keeps
   the theme's dark #333/#444 ink (this is the "gray / dark-white, not clear"
   text). Children with their own semantic color (.text-danger, badges, etc.)
   still win via their own more-specific rules. */
html[data-theme="dark"] .content-wrapper,
html[data-theme="dark"] .content,
html[data-theme="dark"] .card,
html[data-theme="dark"] .card-body,
html[data-theme="dark"] .card-body p,
html[data-theme="dark"] .card-body span:not([class*="text-"]):not([class*="badge"]),
html[data-theme="dark"] .card-body div:not([class*="text-"]),
html[data-theme="dark"] dt,
html[data-theme="dark"] dd {
    color: var(--qs-d-text);
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6,
html[data-theme="dark"] .h1,
html[data-theme="dark"] .h2,
html[data-theme="dark"] .h3,
html[data-theme="dark"] .h4,
html[data-theme="dark"] .h5,
html[data-theme="dark"] .h6 {
    color: var(--qs-d-text);
}

html[data-theme="dark"] .text-muted,
html[data-theme="dark"] small,
html[data-theme="dark"] .small,
html[data-theme="dark"] .text-secondary {
    color: var(--qs-d-text-muted) !important;
}

/* dark text utilities would be invisible on a dark surface */
html[data-theme="dark"] .text-dark,
html[data-theme="dark"] .text-body,
html[data-theme="dark"] .text-black,
html[data-theme="dark"] .text-black-50,
html[data-theme="dark"] .text-gray-800,
html[data-theme="dark"] .text-gray-900 {
    color: var(--qs-d-text) !important;
}

/* content links (excludes buttons / nav / dropdown / pagination links, which
   carry their own colors). GPG redesign additions: .sb-item (sidebar menu
   links) and .tb-btn (topbar icon buttons, e.g. the theme toggle <a>) are
   plain <a> tags too and were never excluded here, so this generic "prose
   link" rule's higher specificity painted every unselected sidebar item
   link-blue in dark mode instead of the neutral --qs-nav-fg-leaf text color
   qs-menu.css/qs-theme-dark.css's own .sb-item rule intended. */
html[data-theme="dark"] a:not(.btn):not(.nav-link):not(.navbar-nav-link):not(.navbar-brand-link):not(.dropdown-item):not(.page-link):not(.list-group-item):not(.badge):not(.sb-item):not(.tb-btn) {
    color: var(--qs-d-link);
}
html[data-theme="dark"] a:not(.btn):not(.nav-link):not(.navbar-nav-link):not(.navbar-brand-link):not(.dropdown-item):not(.page-link):not(.list-group-item):not(.badge):not(.sb-item):not(.tb-btn):hover {
    color: var(--qs-link-hover);
}

html[data-theme="dark"] hr { border-top-color: var(--qs-d-border); }

html[data-theme="dark"] code:not([class*="hljs"]) {
    background-color: var(--qs-d-surface-2);
    color: var(--qs-danger-solid);
}
html[data-theme="dark"] pre {
    background-color: var(--qs-d-surface-2);
    color: var(--qs-d-text);
    border-color: var(--qs-d-border);
}

/* custom scrollbars app-wide */
html[data-theme="dark"] ::-webkit-scrollbar { width: 10px; height: 10px; }
html[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--qs-d-bg); }
html[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--qs-d-border-strong);
    border-radius: var(--qs-radius-sm);
    border: 2px solid var(--qs-d-bg);
}
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: var(--qs-d-text-faint); }
/* Firefox thin scrollbars used on .table-responsive / .dt-table-scroll (site.css pins these
   colors directly on the element, not via ::-webkit-*, so no !important war here) */
html[data-theme="dark"] .table-responsive,
html[data-theme="dark"] .dt-table-scroll {
    scrollbar-color: var(--qs-d-border-strong) var(--qs-d-bg);
}
html[data-theme="dark"] .table-responsive::-webkit-scrollbar-track,
html[data-theme="dark"] .dt-table-scroll::-webkit-scrollbar-track {
    background: var(--qs-d-bg);
}
html[data-theme="dark"] .table-responsive::-webkit-scrollbar-thumb,
html[data-theme="dark"] .dt-table-scroll::-webkit-scrollbar-thumb {
    background: var(--qs-d-border-strong);
    border-color: var(--qs-d-bg);
}
html[data-theme="dark"] .table-responsive::-webkit-scrollbar-thumb:hover,
html[data-theme="dark"] .dt-table-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--qs-d-text-faint);
}


/* ---------------------------------------------------------------------------
   1. APP SHELL — navbar, sidebar, page header, "list/add-edit" header, footer
   --------------------------------------------------------------------------- */
/* Top navbar — beats both site.css's `!important` #173FA6 fill and
   qs-signature.css's `!important` animated gradient (both load before this
   file, so equal-specificity !important ties go to whichever is later in the
   cascade — this file, since it's linked last). */
html[data-theme="dark"] .navbar.navbar-dark,
html[data-theme="dark"] .navbar.navbar-expand-md.navbar-dark,
html[data-theme="dark"] [dir="rtl"] .navbar.navbar-expand-md.navbar-dark,
html[data-theme="dark"] [dir="ltr"] .navbar.navbar-expand-md.navbar-dark {
    background: var(--qs-d-surface) !important;
    animation: none !important;
    border-bottom: 1px solid var(--qs-d-border);
}

/* Page + content background (base: .page-content { background:#f5f5f5 }) */
html[data-theme="dark"] .content { color: var(--qs-d-text); }

/* Standard Bootstrap-y page header (background:#fff, not !important) */
html[data-theme="dark"] .page-header {
    background-color: var(--qs-d-surface);
    color: var(--qs-d-text);
    box-shadow: 0 1px 6px var(--qs-d-shadow);
}
/* .page-header-light variant (e.g. Account/ChangePassword) was never overridden
   for dark mode, so it stayed white/light (the bright card the user flagged) */
html[data-theme="dark"] .page-header-light {
    background-color: var(--qs-d-surface);
    color: var(--qs-d-text);
}
/* The real white box was the INNER child (design/style.css:161 pins
   .page-header-content to #fff, no !important) — .page-header-light above
   only themes the outer wrapper and never reached this element. */
html[data-theme="dark"] .page-header-content {
    background-color: var(--qs-d-surface) !important;
    color: var(--qs-d-text);
}
html[data-theme="dark"] .page-header .page-title h1,
html[data-theme="dark"] .page-header .page-title h4,
html[data-theme="dark"] .page-header .page-title h5 {
    color: var(--qs-d-text);
}
html[data-theme="dark"] .breadcrumb-item { color: var(--qs-d-text-muted) !important; }
html[data-theme="dark"] .breadcrumb-item.active { color: var(--qs-d-text) !important; }
html[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before { color: var(--qs-d-text-faint); }

/* ROOT CAUSE FIX #2 — the shared "List / AddEdit page header" (icon + title +
   breadcrumb bar). Used by _ListLayout.cshtml, _AddEditLayout.cshtml, and
   _TabbedListLayout.cshtml — i.e. the header at the top of EVERY list and
   add/edit page across the whole project. site.css gives it a plain (non-
   !important) white background but an !important title color — this was
   never targeted at all in the first pass. */
html[data-theme="dark"] .addedit-header-inner {
    background: var(--qs-d-surface);
    box-shadow: 0 2px 12px var(--qs-d-shadow), 0 1px 4px var(--qs-d-shadow);
    border-inline-end-color: var(--qs-d-primary) !important;
    border-right-color: var(--qs-d-primary) !important;
}
html[data-theme="dark"] .addedit-hdr-icon {
    background: rgba(var(--qs-primary-rgb), 0.16);
    color: var(--qs-d-primary);
}
html[data-theme="dark"] .addedit-header-title {
    color: var(--qs-d-text) !important;
}
html[data-theme="dark"] .addedit-bc-link {
    color: var(--qs-d-text-faint) !important;
}
html[data-theme="dark"] .addedit-bc-link:hover {
    color: var(--qs-d-primary) !important;
}
html[data-theme="dark"] .addedit-bc-active {
    color: var(--qs-d-text) !important;
}
html[data-theme="dark"] .addedit-bc-sep { color: var(--qs-d-text-faint); }

/* Sidebar — site.css pins .sidebar-dark to a solid #173FA6 fill with
   !important (it's designed to match the blue canvas), so the retint needs
   matching !important all the way down every state (hover/active/submenu). */
html[data-theme="dark"] .sidebar-dark {
    background: var(--qs-d-surface) !important;
}
html[data-theme="dark"] .sidebar-dark .nav-sidebar > .nav-item > .nav-link:hover {
    background: var(--qs-d-surface-3) !important;
}
/* Dark mode keeps the SAME three-level hierarchy as light — quiet header, recessive
   leaf, unmistakable active row — expressed in the dark palette's own tokens rather
   than repeating light-mode literals. The cyan accent bar carries over unchanged: it
   is the one "you are here" signal in both themes. */
html[data-theme="dark"] .sidebar-dark .nav-sidebar > .nav-item > .nav-link,
html[data-theme="dark"] .sidebar-dark .nav-sidebar > .nav-item > .nav-link span:not(.badge):not([class*="badge"]),
html[data-theme="dark"] .sidebar-dark .nav-sidebar > .nav-item > .nav-link .nav-text {
    color: var(--qs-d-text-muted) !important;
}
html[data-theme="dark"] .sidebar-dark .nav-sidebar > .nav-item > .nav-link i {
    color: var(--qs-d-text-faint) !important;
}
html[data-theme="dark"] .sidebar-dark .nav-sidebar > .nav-item > .nav-link:hover,
html[data-theme="dark"] .sidebar-dark .nav-sidebar > .nav-item > .nav-link:hover span:not(.badge):not([class*="badge"]),
html[data-theme="dark"] .sidebar-dark .nav-sidebar > .nav-item > .nav-link:hover .nav-text,
html[data-theme="dark"] .sidebar-dark .nav-sidebar > .nav-item > .nav-link:hover i,
html[data-theme="dark"] .sidebar-dark .nav-sidebar > .nav-item > .nav-link.active span:not(.badge):not([class*="badge"]),
html[data-theme="dark"] .sidebar-dark .nav-sidebar > .nav-item > .nav-link.active .nav-text {
    color: var(--qs-d-text) !important;
}
html[data-theme="dark"] .sidebar-dark .nav-sidebar > .nav-item > .nav-link.active {
    background: rgba(var(--qs-primary-rgb), 0.30) !important;
    color: var(--qs-d-text) !important;
    border-inline-start-width: 3px !important;
    border-inline-start-style: solid !important;
}
html[data-theme="dark"] .sidebar-dark .nav-item-submenu.nav-item-open > .nav-link {
    background: rgba(var(--qs-primary-rgb), 0.22) !important;
    border-inline-start-color: var(--qs-d-primary) !important;
}
/* Submenu flyout — pinned to solid white !important in light mode */
html[data-theme="dark"] .sidebar-dark .nav-group-sub {
    background: var(--qs-d-surface-2) !important;
    box-shadow: 0 4px 16px var(--qs-d-shadow) !important;
}
html[data-theme="dark"] .sidebar-dark .nav-group-sub .nav-item a {
    color: var(--qs-d-text-muted) !important;
}
html[data-theme="dark"] .sidebar-dark .nav-group-sub .nav-item .nav-link i {
    color: var(--qs-d-text-faint) !important;
}
html[data-theme="dark"] .sidebar-dark .nav-group-sub .nav-item .nav-link:hover {
    background: var(--qs-d-surface-3) !important;
    color: var(--qs-d-link) !important;
}
html[data-theme="dark"] .sidebar-dark .nav-group-sub .nav-item .nav-link:hover i {
    color: var(--qs-d-link) !important;
}
html[data-theme="dark"] .sidebar-dark .nav-group-sub .nav-item .nav-link.active {
    background: var(--qs-d-primary) !important;
    color: var(--qs-inverse-fg) !important;
}
html[data-theme="dark"] .sidebar-dark .nav-group-sub .nav-group-sub {
    background: var(--qs-d-surface-3) !important;
    border-color: var(--qs-d-border) !important;
}
html[data-theme="dark"] .sidebar-dark .nav-sidebar .nav-item-divider {
    border-color: var(--qs-d-border) !important;
}
/* header/group labels + submenu container inside the sidebar (from the
   original generic pass — kept, low-specificity so it's harmless either way) */
html[data-theme="dark"] .sidebar-dark .nav-sidebar .nav-item-header,
html[data-theme="dark"] .sidebar-dark .nav-sidebar-bordered > .nav-item-header {
    background-color: rgba(var(--qs-shadow-rgb), 0.18);
    color: var(--qs-d-text-faint);
    border-top-color: var(--qs-d-border);
}

/* Footer (custom .app-footer*). site.css paints it with a BLUE GRADIENT via the
   `background` shorthand — overriding only `background-color` leaves the gradient
   background-image intact (that's why the footer stayed blue). Must use the
   `background` shorthand to clear it. */
html[data-theme="dark"] .app-footer {
    background: var(--qs-d-surface) !important;
    border-top: 1px solid var(--qs-d-border);
    color: var(--qs-d-text-muted);
}
html[data-theme="dark"] .app-footer__brand,
html[data-theme="dark"] .app-footer__brand strong { color: var(--qs-d-text); }
html[data-theme="dark"] .app-footer__brand-icon { color: var(--qs-d-text-muted); }
html[data-theme="dark"] .app-footer__copy { color: var(--qs-d-text-muted); }
html[data-theme="dark"] .app-footer__version {
    color: var(--qs-d-text);
    background: rgba(var(--qs-white-rgb), 0.08);
    border-color: var(--qs-d-border);
}
/* Was a flat 2-stop primary->info gradient, much less visible than the reference's
   3-stop blue/cyan/indigo bar (see the base rule in qs-layout.css). --qs-accent-cyan/
   --qs-accent-indigo aren't theme-scoped (same value in both themes), so the base
   rule's own gradient can just be reused here instead of a dimmer dark-only stand-in. */
html[data-theme="dark"] .app-footer__bar {
    background: linear-gradient(90deg, var(--qs-primary), var(--qs-accent-cyan), var(--qs-accent-indigo));
}
html[data-theme="dark"] .app-footer__brand strong,
html[data-theme="dark"] .app-footer__brand-icon { color: var(--qs-d-text); }
html[data-theme="dark"] .app-footer__copy,
html[data-theme="dark"] .app-footer__version { color: var(--qs-d-text-muted); }


/* ---------------------------------------------------------------------------
   2. BOOTSTRAP + LIMITLESS COMPONENTS
   --------------------------------------------------------------------------- */
/* Cards / panels (Bootstrap's own .card{background-color:#fff} has no
   !important, so higher specificity alone is enough here) */
html[data-theme="dark"] .card,
html[data-theme="dark"] .panel {
    /* Lighter shade (surface-2) so cards are visually distinguished from the page background */
    background-color: var(--qs-d-surface-2) !important;
    border-color: var(--qs-d-border);
    color: var(--qs-d-text);
    box-shadow: 0 1px 3px var(--qs-d-shadow);
}
html[data-theme="dark"] .card-body,
html[data-theme="dark"] .panel-body {
    background-color: var(--qs-d-surface-2) !important;
}
html[data-theme="dark"] .card-footer,
html[data-theme="dark"] .panel-footer {
    background-color: var(--qs-d-surface);
    border-top-color: var(--qs-d-border);
    color: var(--qs-d-text-muted);
}
html[data-theme="dark"] .card .text-muted { color: var(--qs-d-text-muted) !important; }

/* ROOT CAUSE FIX #3 — card headers. site.css pins EVERY .card-header to a
   solid #173FA6 fill with !important (this is the bright blue bar seen at
   the top of every card, list table, and dashboard panel). */
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .panel-heading {
    background: var(--qs-d-surface-3) !important;
    border-bottom: 1px solid var(--qs-d-border) !important;
}
html[data-theme="dark"] .card-header .card-title,
html[data-theme="dark"] .panel-title {
    color: var(--qs-d-text) !important;
}
html[data-theme="dark"] .card-header .header-elements .btn {
    background: var(--qs-d-surface-2) !important;
    color: var(--qs-d-text) !important;
    border-color: var(--qs-d-border-strong) !important;
    box-shadow: none !important;
}
html[data-theme="dark"] .card-header .header-elements .btn:hover {
    background: var(--qs-d-surface) !important;
    box-shadow: none !important;
}

/* Tables */
html[data-theme="dark"] .table,
html[data-theme="dark"] table.table {
    color: var(--qs-d-text);
    border-color: var(--qs-d-border);
}
html[data-theme="dark"] .table td,
html[data-theme="dark"] .table th,
html[data-theme="dark"] .table thead th,
html[data-theme="dark"] .table tbody + tbody {
    border-color: var(--qs-d-border);
}
/* .table thead th / table.table thead th are brand blue #173FA6 !important
   in site.css; table.dataTable thead th is a SEPARATE, more specific rule
   also pinned #173FA6 !important — both need to be matched explicitly. */
html[data-theme="dark"] .table thead th,
html[data-theme="dark"] table.table thead th,
html[data-theme="dark"] table.dataTable thead th {
    background: var(--qs-d-surface-3) !important;
    color: var(--qs-d-text) !important;
    border-color: var(--qs-d-border) !important;
}
html[data-theme="dark"] .table-bordered,
html[data-theme="dark"] .table-bordered td,
html[data-theme="dark"] .table-bordered th { border-color: var(--qs-d-border); }
html[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd),
html[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) > * {
    background-color: rgba(var(--qs-white-rgb), 0.02) !important;
    color: var(--qs-d-text) !important;
}
html[data-theme="dark"] .table-striped tbody tr:nth-of-type(even),
html[data-theme="dark"] .table-striped tbody tr:nth-of-type(even) > * {
    background-color: transparent !important;
    color: var(--qs-d-text) !important;
}
html[data-theme="dark"] .table-hover tbody tr:hover,
html[data-theme="dark"] table.dataTable tbody tr:hover {
    background: var(--qs-d-surface-2) !important;
    color: var(--qs-d-text) !important;
}
html[data-theme="dark"] .table .thead-light th {
    background-color: var(--qs-d-surface-3);
    color: var(--qs-d-text);
    border-color: var(--qs-d-border);
}
html[data-theme="dark"] table.dataTable tbody td {
    border-bottom-color: var(--qs-d-border) !important;
}
/* out-of-stock row highlight (light pink !important -> dark-tinted) */
html[data-theme="dark"] tr.qs-row-out-of-stock > td {
    background-color: rgba(var(--qs-danger-rgb), 0.10) !important;
}

/* Forms / inputs */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] textarea.form-control,
html[data-theme="dark"] select.form-control,
html[data-theme="dark"] .custom-select,
html[data-theme="dark"] .custom-file-label {
    background-color: var(--qs-d-surface-2);
    border-color: var(--qs-d-border);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .custom-select:focus {
    background-color: var(--qs-d-surface-2);
    border-color: var(--qs-d-primary);
    color: var(--qs-d-text);
    box-shadow: 0 0 0 0.15rem rgba(var(--qs-primary-rgb), 0.25);
}
/* The <select> box itself was already themed above, but its dropped-down native
   <option> popup list was never touched — Chromium/Edge honor background-color/
   color on <option>, so without this the open popup falls back to the browser's
   default white list (near-invisible light text on a near-white row), the exact
   washed-out look reported project-wide (e.g. the "Send notification" Recipients
   select). Firefox ignores per-option color and themes the whole popup from the
   OS color scheme, so this is a Chromium/Edge-specific but harmless addition. */
html[data-theme="dark"] select.form-control option,
html[data-theme="dark"] .custom-select option,
html[data-theme="dark"] select option {
    background-color: var(--qs-d-surface-2);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .form-control::placeholder { color: var(--qs-d-text-faint); }

/* The two search fields: BOTH stay white in night mode.
   -----------------------------------------------------
   The navbar global search (.qs-gsearch-box) and the sidebar's menu search sit on the same
   dark chrome, and both are primary "type a query here" inputs — so they are deliberately
   kept as solid white pills. Form fields are NOT: everything else follows the dark
   .form-control treatment above. This is the one intentional exception.

   The navbar one already gets this from qs-gsearch.css and needs no rule here. The sidebar
   one is a plain .form-control, so the block above WOULD have turned it dark — this brings
   it back to match its sibling.

   Same specificity as `html[data-theme="dark"] .form-control` (0,2,1), so background and
   colour win on ORDER, not weight — this block must stay BELOW that rule in this file.

   border-color is the exception and needs the forced tier: the blanket border rule further
   down this sheet (the long "…modal-header, .form-control, .breadcrumb, hr" selector list)
   sets `border-color: var(--qs-d-border) !important`, which would otherwise put a dark
   border around this white pill no matter where this block sits. Matching that tier on
   that one property is the whole reason for the flag here — the other two declarations
   deliberately stay unflagged.

   Colours are copied from qs-gsearch.css on purpose so the two pills are identical. */
html[data-theme="dark"] .qs-menu-search-input,
html[data-theme="dark"] .qs-menu-search-input:focus {
    background-color: var(--qs-inverse-fg);
    border-color: rgba(var(--qs-white-rgb), .5) !important;
    color: var(--qs-nav-bg);
}

html[data-theme="dark"] .qs-menu-search-input::placeholder {
    color: var(--qs-text-faint);
}
html[data-theme="dark"] .form-control:disabled,
html[data-theme="dark"] .form-control[readonly],
html[data-theme="dark"] .custom-select:disabled {
    background-color: var(--qs-d-surface);
    color: var(--qs-d-text-muted);
}
html[data-theme="dark"] .input-group-text,
html[data-theme="dark"] .input-group-prepend .input-group-text,
html[data-theme="dark"] .input-group-append .input-group-text,
html[data-theme="dark"] .help-search .input-group-text {
    background: var(--qs-d-surface-3) !important;
    border-color: var(--qs-d-border);
    color: var(--qs-d-text-muted);
}
/* Forced with !important: reported repeatedly staying black on plain form
   labels — both inside modals ("Send notification", "Add Address") and on
   full pages (ProductWizard Step1/AddEdit). Whatever wins the cascade for
   those specific labels isn't a plain (non-!important) rule, so this pins
   every label unconditionally rather than chasing the exact culprit per page. */
html[data-theme="dark"] label,
html[data-theme="dark"] .col-form-label,
html[data-theme="dark"] .form-check-label { color: var(--qs-d-text) !important; }
html[data-theme="dark"] .modal label,
html[data-theme="dark"] .modal .col-form-label,
html[data-theme="dark"] .modal .form-check-label,
html[data-theme="dark"] .modal small,
html[data-theme="dark"] .modal p,
html[data-theme="dark"] .modal span:not([class*="badge"]):not([class*="text-"]) {
    color: var(--qs-d-text) !important;
}
html[data-theme="dark"] .form-text,
html[data-theme="dark"] .form-text.text-muted { color: var(--qs-d-text-muted); }
html[data-theme="dark"] .custom-control-label::before {
    background-color: var(--qs-d-surface-2);
    border-color: var(--qs-d-border-strong);
}
html[data-theme="dark"] .custom-file-label::after {
    background-color: var(--qs-d-surface-3);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .invalid-feedback,
html[data-theme="dark"] .text-danger { color: var(--qs-d-danger) !important; }
html[data-theme="dark"] .valid-feedback,
html[data-theme="dark"] .text-success { color: var(--qs-d-success) !important; }
html[data-theme="dark"] .text-warning { color: var(--qs-d-warning) !important; }
html[data-theme="dark"] .text-info { color: var(--qs-d-info) !important; }

/* Buttons — keep brand/semantic fills; only neutral/light/link variants change */
html[data-theme="dark"] .btn-light,
html[data-theme="dark"] .btn-default,
html[data-theme="dark"] .btn-white,
html[data-theme="dark"] .btn-secondary {
    background-color: var(--qs-d-surface-2);
    border-color: var(--qs-d-border);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .btn-light:hover,
html[data-theme="dark"] .btn-default:hover,
html[data-theme="dark"] .btn-white:hover,
html[data-theme="dark"] .btn-secondary:hover {
    background-color: var(--qs-d-surface-3);
    border-color: var(--qs-d-border-strong);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .btn-outline-secondary,
html[data-theme="dark"] .btn-outline-dark,
html[data-theme="dark"] .btn-outline-light {
    color: var(--qs-d-text);
    border-color: var(--qs-d-border-strong);
}
html[data-theme="dark"] .btn-outline-secondary:hover,
html[data-theme="dark"] .btn-outline-dark:hover,
html[data-theme="dark"] .btn-outline-light:hover {
    background-color: var(--qs-d-surface-2);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .btn-link { color: var(--qs-d-link); }
html[data-theme="dark"] .btn-link:hover { color: var(--qs-link-hover); }
html[data-theme="dark"] .btn.disabled,
html[data-theme="dark"] .btn:disabled { opacity: 0.5; }
/* Row-action icon buttons.
   2026-08-20 (L2): `:not([class*="qs-act-btn--"])` added, and it is load-bearing.
   Until the L2 pass these buttons carried their fill as an INLINE style attribute,
   which outranks any stylesheet rule - so this rule only ever applied to the handful
   of action buttons that had no inline colour, and the coloured ones kept their bright
   light-mode fill on the dark page. Moving the fills into `qs-act-btn--*` classes
   removed the inline styles, at which point this rule started matching all of them and
   flattened every action in every grid to one identical dark grey. Measured: 4 distinct
   fills per page collapsed to 1.
   The classes now carry a proper dark ramp of their own (see --qs-act-* in
   qs-tokens.css, pale fill + dark glyph), so this rule steps aside for them and keeps
   owning only the uncoloured ones. */
html[data-theme="dark"] .btn-icon.btn-action:not([class*="qs-act-btn--"]) {
    background-color: var(--qs-d-surface-2);
    color: var(--qs-d-text);
    border-color: var(--qs-d-border);
}
html[data-theme="dark"] .btn-icon.btn-action:not([class*="qs-act-btn--"]):hover {
    background-color: var(--qs-d-surface-3);
    color: var(--qs-d-text);
}
/* Coloured actions keep the SAME fill in dark mode - see the note beside --qs-act-* in
   qs-tokens.css for why there is deliberately no dark ramp for them. A hover lifts the
   fill slightly instead of repainting it, so the semantic colour survives the hover. */
html[data-theme="dark"] .btn-icon.btn-action[class*="qs-act-btn--"]:hover {
    filter: brightness(1.12);
}

/* Dropdowns */
html[data-theme="dark"] .dropdown-menu {
    background-color: var(--qs-d-surface);
    border-color: var(--qs-d-border);
    box-shadow: 0 6px 24px var(--qs-d-shadow);
}
html[data-theme="dark"] .dropdown-item { color: var(--qs-d-text); }
html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus {
    background-color: var(--qs-d-surface-2);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .dropdown-item.active,
html[data-theme="dark"] .dropdown-item:active {
    background-color: var(--qs-d-primary);
    color: var(--qs-inverse-fg);
}
html[data-theme="dark"] .dropdown-divider { border-top-color: var(--qs-d-border); }
html[data-theme="dark"] .dropdown-header { color: var(--qs-d-text-faint); }

/* Modals */
html[data-theme="dark"] .modal-content {
    background-color: var(--qs-d-surface);
    border-color: var(--qs-d-border);
    color: var(--qs-d-text);
    box-shadow: 0 16px 48px var(--qs-d-shadow-lg);
}
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer { border-color: var(--qs-d-border); }
html[data-theme="dark"] .modal-title { color: var(--qs-d-text); }
html[data-theme="dark"] .modal-backdrop.show { opacity: 0.7; }
html[data-theme="dark"] .close,
html[data-theme="dark"] .modal .close {
    color: var(--qs-d-text);
    text-shadow: none;
    opacity: 0.7;
}
html[data-theme="dark"] .close:hover { color: var(--qs-inverse-fg); opacity: 1; }

/* Nav tabs / pills.
   2026-08-20 (L1): the note that used to sit here said site.css pins these with
   !important "so it needs matching !important". That is no longer true - site.css's
   "Unified Tabs" block was de-!important-ed in the same change, so every rule below
   now wins on ordinary specificity and source order. If you find yourself adding
   !important back here, check whether the base rule regrew one first. */
html[data-theme="dark"] .nav-tabs { border-bottom-color: var(--qs-d-border); }

/* 2026-08-20 (L5 re-open). This rule set `color` and `border-color` but NEVER
   `background`, so site.css:1596 `.nav-tabs .nav-link { background: #f7f9fc !important }`
   survived untouched and every UNSELECTED tab kept its light-mode near-white fill in
   dark mode. Measured on Users, Customers and Coupons: bg rgb(247,249,252) / fg
   rgb(71,85,105) with html[data-theme="dark"] active.
   Orders/Bookings looked fine only because `.qs-ops-module .nav-tabs .nav-link`
   (further down this file) happens to set a background for that one module — which is
   exactly why the generic case was never noticed.
   `:not(.active)` is LOAD-BEARING, not tidiness: it keeps this rule out of the way of
   the active-state rules below, which are more specific and must keep winning. */
html[data-theme="dark"] .nav-tabs .nav-link:not(.active),
html[data-theme="dark"] .nav-pills .nav-link:not(.active),
html[data-theme="dark"] .nav-tabs-highlight .nav-link:not(.active) {
    background: var(--qs-d-surface-2);
    color: var(--qs-d-text-muted);
    border-color: var(--qs-d-border);
}
html[data-theme="dark"] .nav-tabs .nav-link:not(.active):hover,
html[data-theme="dark"] .nav-pills .nav-link:not(.active):hover,
html[data-theme="dark"] .nav-tabs-highlight .nav-link:not(.active):hover {
    background: var(--qs-d-surface-3);
    border-color: var(--qs-d-border-strong);
    color: var(--qs-d-text);
}
/* The count badge riding inside an unselected tab: site.css pins it to
   rgba(255,255,255,.2), which on a dark tab is an almost-invisible grey wash. */
html[data-theme="dark"] .nav-tabs .nav-link:not(.active) .badge,
html[data-theme="dark"] .nav-pills .nav-link:not(.active) .badge {
    background: var(--qs-d-surface-3);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .nav-tabs .nav-link.active,
html[data-theme="dark"] .nav-tabs .nav-item.show .nav-link {
    background-color: var(--qs-d-surface);
    border-color: var(--qs-d-border) var(--qs-d-border) var(--qs-d-surface);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .tab-content { color: var(--qs-d-text); }
html[data-theme="dark"] .nav-pills .nav-link {
    background: var(--qs-d-surface-2);
    border-color: var(--qs-d-border);
    color: var(--qs-d-text-muted);
}
html[data-theme="dark"] .nav-pills .nav-link:hover {
    background: var(--qs-d-surface-3);
    border-color: var(--qs-d-border-strong);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .nav-pills .nav-link.active,
html[data-theme="dark"] .nav-pills .show > .nav-link {
    background: var(--qs-d-primary);
    border-color: var(--qs-d-primary);
    color: var(--qs-inverse-fg);
}

/* Pagination */
html[data-theme="dark"] .pagination .page-link {
    background-color: var(--qs-d-surface);
    border-color: var(--qs-d-border);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .pagination .page-link:hover {
    background-color: var(--qs-d-surface-2);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .pagination .page-item.active .page-link {
    background-color: var(--qs-d-primary);
    border-color: var(--qs-d-primary);
    color: var(--qs-inverse-fg);
}
html[data-theme="dark"] .pagination .page-item.disabled .page-link {
    background-color: var(--qs-d-surface);
    border-color: var(--qs-d-border);
    color: var(--qs-d-text-faint);
}

/* Breadcrumb */
html[data-theme="dark"] .breadcrumb { background-color: var(--qs-d-surface-2); }
html[data-theme="dark"] .breadcrumb-item a { color: var(--qs-d-link); }

/* Alerts — dark-tinted variants */
html[data-theme="dark"] .alert-success { background-color: rgba(var(--qs-success-rgb), 0.14); border-color: rgba(var(--qs-success-rgb), 0.35); color: var(--qs-success-subtle-fg); }
html[data-theme="dark"] .alert-danger  { background-color: rgba(var(--qs-danger-rgb), 0.14); border-color: rgba(var(--qs-danger-rgb), 0.35); color: var(--qs-danger-subtle-fg); }
html[data-theme="dark"] .alert-warning { background-color: rgba(var(--qs-warning-rgb), 0.14);  border-color: rgba(var(--qs-warning-rgb), 0.35);  color: var(--qs-warning-subtle-fg); }
html[data-theme="dark"] .alert-info    { background-color: rgba(var(--qs-info-rgb), 0.14);  border-color: rgba(var(--qs-info-rgb), 0.35);  color: var(--qs-info-subtle-fg); }
html[data-theme="dark"] .alert-primary { background-color: rgba(var(--qs-primary-rgb), 0.14);  border-color: rgba(var(--qs-primary-rgb), 0.35);  color: var(--qs-link-hover); }
html[data-theme="dark"] .alert-secondary,
html[data-theme="dark"] .alert-light,
html[data-theme="dark"] .alert-dark {
    background-color: var(--qs-d-surface-2);
    border-color: var(--qs-d-border);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .alert-light .close,
html[data-theme="dark"] .alert .close { color: inherit; }

/* List groups — !important since the FAQ accordion's white separator seams
   (ProviderSupport/HelpManagement) are exactly this Bootstrap default bleeding
   through on .list-group-item.border-0.faq-item rows */
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .faq-item {
    background-color: var(--qs-d-surface) !important;
    border-color: var(--qs-d-border) !important;
    color: var(--qs-d-text) !important;
}
html[data-theme="dark"] .list-group-item-action:hover,
html[data-theme="dark"] .list-group-item-action:focus {
    background-color: var(--qs-d-surface-2);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .list-group-item.active {
    background-color: var(--qs-d-primary);
    border-color: var(--qs-d-primary);
    color: var(--qs-inverse-fg);
}

/* Tooltips / popovers */
html[data-theme="dark"] .tooltip-inner {
    background-color: var(--qs-d-surface-3);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .tooltip .arrow::before { border-top-color: var(--qs-d-surface-3); }
html[data-theme="dark"] .popover {
    background-color: var(--qs-d-surface);
    border-color: var(--qs-d-border);
}
html[data-theme="dark"] .popover-header {
    background-color: var(--qs-d-surface-2);
    border-bottom-color: var(--qs-d-border);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .popover-body { color: var(--qs-d-text); }

/* Badges — semantic solid badges (success/warning/danger/info/primary/secondary)
   already have white text on a saturated fill in BOTH themes and stay as-is.
   Only truly neutral variants need adjusting. */
html[data-theme="dark"] .badge-light {
    background-color: var(--qs-d-surface-3);
    color: var(--qs-d-text);
}

/* Content wrapper — the floating white card (site.css pins it #fff !important).
   Use surface-2 (lighter shade) instead of surface so cards stand out and are more readable. */
html[data-theme="dark"] .content-wrapper {
    background: var(--qs-d-surface-2) !important;
    box-shadow: 0 4px 32px var(--qs-d-shadow-lg), 0 1px 6px var(--qs-d-shadow) !important;
}
/* DataTables header row — make it clearly distinguished from the body rows
   (surface-3 alone was too close to the card's own surface-2 to read as
   different; add a visible border + stronger shade). */
html[data-theme="dark"] table.dataTable thead th {
    background-color: var(--qs-border-strong) !important;
    color: var(--qs-d-text) !important;
    border-color: var(--qs-d-border-strong) !important;
    border-bottom: 2px solid var(--qs-d-primary) !important;
}
/* Regular table headers */
html[data-theme="dark"] table thead th,
html[data-theme="dark"] .table thead th {
    background-color: var(--qs-border-strong) !important;
    color: var(--qs-d-text) !important;
    border-bottom: 2px solid var(--qs-d-primary) !important;
}

/* Utility background classes used across views */
html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .bg-body { background-color: var(--qs-d-surface) !important; color: var(--qs-d-text); }
html[data-theme="dark"] .bg-light { background-color: var(--qs-d-surface-2) !important; color: var(--qs-d-text); }
html[data-theme="dark"] .bg-transparent { background-color: transparent !important; }
html[data-theme="dark"] .border { border-color: var(--qs-d-border) !important; }
html[data-theme="dark"] .border-top { border-top-color: var(--qs-d-border) !important; }
html[data-theme="dark"] .border-bottom { border-bottom-color: var(--qs-d-border) !important; }
html[data-theme="dark"] .border-left { border-left-color: var(--qs-d-border) !important; }
html[data-theme="dark"] .border-right { border-right-color: var(--qs-d-border) !important; }


/* ---------------------------------------------------------------------------
   3. CUSTOM MODULES — Orders/Bookings ops module (qs-ops-module.css), bulk
      actions, signature. Real class names confirmed directly from the source
      file (the earlier pass guessed at generic class names that don't exist —
      the actual pastel/light pieces are `.qs-ops-tabs a`, `.badge-flat.border-*`,
      and `table.qs-card-rows` / `#providerTable.dataTable`, ALL pinned with
      !important).
   --------------------------------------------------------------------------- */
/* 2026-08 audit remediation (L5-crit): the `.qs-ops-module .qs-ops-tabs a` block that
   was here is DELETED. The comment immediately below already documented that the
   selector matches nothing on these pages; verified again — `qs-ops-tabs` has 0
   occurrences across Views and ViewScripts. */

/* The Bookings/Orders filter pills actually render as `.qs-ops-module .nav-tabs
   .nav-link` (NOT `.qs-ops-tabs a` above — that selector matches nothing on
   these pages). Light rules in qs-ops-module.css (white bg, pale #eaf0ff
   active, specificity 0,3-4,0 !important) beat the generic `.nav-tabs .nav-link`
   dark rule elsewhere in this file, so these need equal-or-higher specificity. */
html[data-theme="dark"] .qs-ops-module .nav-tabs .nav-link {
    background: var(--qs-d-surface-2) !important;
    color: var(--qs-d-text-muted) !important;
    border-color: var(--qs-d-border) !important;
}
html[data-theme="dark"] .qs-ops-module .nav-tabs .nav-link:hover {
    background: var(--qs-d-surface-3) !important;
    color: var(--qs-d-text) !important;
    border-color: var(--qs-d-border-strong) !important;
}
html[data-theme="dark"] .qs-ops-module .nav-tabs .nav-link.active {
    background: var(--qs-primary) !important;
    color: var(--qs-inverse-fg) !important;
    border-color: var(--qs-primary) !important;
}
/* Count chip inside an inactive pill vs. inside the active (navy) pill */
html[data-theme="dark"] .qs-ops-module .nav-tabs .nav-link .badge-light {
    background: var(--qs-d-surface-3) !important;
    color: var(--qs-d-text-muted) !important;
}
html[data-theme="dark"] .qs-ops-module .nav-tabs .nav-link.active .badge-light {
    background: var(--qs-text) !important;
    color: var(--qs-primary) !important;
}

/* "View Details" action button (.qs-btn-view) — its dark rule previously only
   existed in the unlinked 04-custom-modules.css, so the served theme never
   actually darkened it; it kept the light white-bg/navy-border look. */
html[data-theme="dark"] .qs-btn-view {
    background: var(--qs-d-surface-2) !important;
    color: var(--qs-d-text) !important;
    border: 1px solid var(--qs-d-border-strong) !important;
}
html[data-theme="dark"] .qs-btn-view:hover {
    background: var(--qs-d-primary) !important;
    color: var(--qs-inverse-fg) !important;
    border-color: var(--qs-d-primary) !important;
}

/* soft/flat badges: light-tint -> dark-tint with colored text (real classes) */
html[data-theme="dark"] .qs-ops-module .badge-flat.border-success {
    background: rgba(var(--qs-success-rgb), 0.16) !important;
    color: var(--qs-success-subtle-fg) !important;
    border-color: rgba(var(--qs-success-rgb), 0.35) !important;
}
html[data-theme="dark"] .qs-ops-module .badge-flat.border-danger {
    background: rgba(var(--qs-danger-rgb), 0.16) !important;
    color: var(--qs-danger-subtle-fg) !important;
    border-color: rgba(var(--qs-danger-rgb), 0.35) !important;
}
html[data-theme="dark"] .qs-ops-module .badge-flat.border-warning {
    background: rgba(var(--qs-warning-rgb), 0.16) !important;
    color: var(--qs-warning-subtle-fg) !important;
    border-color: rgba(var(--qs-warning-rgb), 0.35) !important;
}
html[data-theme="dark"] .qs-ops-module .badge-flat.border-info {
    background: rgba(var(--qs-info-rgb), 0.16) !important;
    color: var(--qs-info-subtle-fg) !important;
    border-color: rgba(var(--qs-info-rgb), 0.35) !important;
}
html[data-theme="dark"] .qs-ops-module .badge-flat.border-primary {
    background: rgba(var(--qs-primary-rgb), 0.16) !important;
    color: var(--qs-link-hover) !important;
    border-color: rgba(var(--qs-primary-rgb), 0.35) !important;
}
html[data-theme="dark"] .qs-ops-module .badge-flat.border-secondary,
html[data-theme="dark"] .qs-ops-module .badge-flat.border-grey {
    background: var(--qs-d-surface-3) !important;
    color: var(--qs-d-text-muted) !important;
    border-color: var(--qs-d-border) !important;
}

/* Same soft/flat badge palette WITHOUT the .qs-ops-module scope — detail and
   refund pages (Bookings/Details, _BookingDetails, ProviderFinancial/
   RefundDetails, refund tables) use these badges outside that wrapper, so the
   scoped rules above never matched and they stayed pale/washed-out. */
html[data-theme="dark"] .badge-flat.border-success {
    background: rgba(var(--qs-success-rgb), 0.16) !important;
    color: var(--qs-success-subtle-fg) !important;
    border-color: rgba(var(--qs-success-rgb), 0.35) !important;
}
html[data-theme="dark"] .badge-flat.border-danger {
    background: rgba(var(--qs-danger-rgb), 0.16) !important;
    color: var(--qs-danger-subtle-fg) !important;
    border-color: rgba(var(--qs-danger-rgb), 0.35) !important;
}
html[data-theme="dark"] .badge-flat.border-warning {
    background: rgba(var(--qs-warning-rgb), 0.16) !important;
    color: var(--qs-warning-subtle-fg) !important;
    border-color: rgba(var(--qs-warning-rgb), 0.35) !important;
}
html[data-theme="dark"] .badge-flat.border-info {
    background: rgba(var(--qs-info-rgb), 0.16) !important;
    color: var(--qs-info-subtle-fg) !important;
    border-color: rgba(var(--qs-info-rgb), 0.35) !important;
}
html[data-theme="dark"] .badge-flat.border-primary {
    background: rgba(var(--qs-primary-rgb), 0.16) !important;
    color: var(--qs-link-hover) !important;
    border-color: rgba(var(--qs-primary-rgb), 0.35) !important;
}
html[data-theme="dark"] .badge-flat.border-secondary,
html[data-theme="dark"] .badge-flat.border-grey {
    background: var(--qs-d-surface-3) !important;
    color: var(--qs-d-text-muted) !important;
    border-color: var(--qs-d-border) !important;
}

/* qs-card-rows table (Orders/Bookings "card row" table skin) + providerTable —
   matched to the same header shade as every other list page's thead th
   (was surface-3, a different/lighter color, so this table's header looked
   inconsistent with Products/MyServices/Refunds/etc.) */
html[data-theme="dark"] .qs-ops-module table.qs-card-rows thead th,
html[data-theme="dark"] .qs-ops-module #providerTable.dataTable thead th {
    background: var(--qs-border-strong) !important;
    color: var(--qs-d-text) !important;
    border-bottom: 2px solid var(--qs-d-primary) !important;
}
html[data-theme="dark"] .qs-ops-module table.qs-card-rows.table-striped tbody tr:nth-of-type(odd) td,
html[data-theme="dark"] .qs-ops-module #providerTable.dataTable tbody tr:not(.shown-child) > td {
    background: var(--qs-d-surface) !important;
    border-top-color: var(--qs-d-border) !important;
    border-bottom-color: var(--qs-d-border) !important;
    color: var(--qs-d-text);
}
html[data-theme="dark"] .qs-ops-module table.qs-card-rows tbody td:last-child,
html[data-theme="dark"] .qs-ops-module #providerTable.dataTable tbody tr > td:last-child {
    border-right-color: var(--qs-d-border) !important;
}
html[data-theme="dark"] .qs-ops-module .subtable-wrap table.qs-card-rows thead th {
    background: var(--qs-info-subtle-bg) !important;
    color: var(--qs-inverse-fg) !important;
}

/* 2026-08 audit remediation (L5-crit): the `.bulk-actions-bar` / `.bulk-actions` dark
   overrides that were here are DELETED — those class names do not exist in this project
   (0 occurrences in Views/ViewScripts). The real served classes are .qs-bulk-toolbar and
   friends, defined in bulk-actions.css, which has ZERO !important — so tokenising its
   light rules fixes light AND dark with no dark counterpart needed here at all. */

/* signature pad */
html[data-theme="dark"] .qs-signature,
html[data-theme="dark"] .qs-signature-pad,
html[data-theme="dark"] .qs-signature-wrap {
    background-color: var(--qs-d-surface-2);
    border-color: var(--qs-d-border);
    color: var(--qs-d-text);
}


/* ---------------------------------------------------------------------------
   4. LAYOUT INLINE STYLES — notifications, filter panel, back button, banner
   (the inline <style> block in _Layout.cshtml uses plain low-specificity
   selectors with no !important, so this file — linked last — wins on its own.)
   --------------------------------------------------------------------------- */
html[data-theme="dark"] .notification-dropdown {
    background: var(--qs-d-surface);
    border-color: var(--qs-d-border);
    box-shadow: 0 20px 60px var(--qs-d-shadow-lg);
}
html[data-theme="dark"] .notification-dropdown::before {
    background: var(--qs-d-surface);
    border-left-color: var(--qs-d-border);
    border-top-color: var(--qs-d-border);
}
html[data-theme="dark"] .notification-dropdown-header {
    background: linear-gradient(135deg, var(--qs-d-surface-2) 0%, var(--qs-d-surface-3) 100%);
    border-bottom-color: var(--qs-d-border);
}
html[data-theme="dark"] .notification-dropdown-header span { color: var(--qs-d-text); }
html[data-theme="dark"] .notification-dropdown-header a { color: var(--qs-d-link); }
html[data-theme="dark"] .notification-dropdown-header a:hover { color: var(--qs-d-text); }
html[data-theme="dark"] .notification-dropdown-body { scrollbar-color: var(--qs-d-border-strong) transparent; }
html[data-theme="dark"] .notification-dropdown-body::-webkit-scrollbar-thumb { background: var(--qs-d-border-strong); }
html[data-theme="dark"] .notification-dropdown-footer {
    background: var(--qs-d-surface-2);
    border-top-color: var(--qs-d-border);
}
html[data-theme="dark"] .notification-dropdown-footer a { color: var(--qs-d-link); }
html[data-theme="dark"] .notification-dropdown-footer a:hover { color: var(--qs-d-text); }

html[data-theme="dark"] .notif-item { border-bottom-color: var(--qs-d-border); }
html[data-theme="dark"] .notif-item:hover { background: var(--qs-d-surface-2); }
html[data-theme="dark"] .notif-item:active { background: var(--qs-d-surface-3); }
html[data-theme="dark"] .notif-item.unread { background: rgba(var(--qs-primary-rgb), 0.12); }
html[data-theme="dark"] .notif-item.unread:hover { background: rgba(var(--qs-primary-rgb), 0.18); }
html[data-theme="dark"] .notif-item-icon {
    background: rgba(var(--qs-primary-rgb), 0.14);
    color: var(--qs-d-link);
    border-color: rgba(var(--qs-primary-rgb), 0.22);
}
html[data-theme="dark"] .notif-item.unread .notif-item-icon {
    background: rgba(var(--qs-primary-rgb), 0.24);
    color: var(--qs-d-link);
    border-color: rgba(var(--qs-primary-rgb), 0.40);
    box-shadow: 0 4px 12px var(--qs-d-shadow);
}
html[data-theme="dark"] .notif-title { color: var(--qs-d-text); }
html[data-theme="dark"] .notif-message { color: var(--qs-d-text-muted); }
html[data-theme="dark"] .notif-time { color: var(--qs-d-text-faint); }
html[data-theme="dark"] .notif-empty { color: var(--qs-d-text-muted); }
html[data-theme="dark"] .notif-empty i { color: var(--qs-d-text-faint); }

html[data-theme="dark"] .notif-toast {
    background: linear-gradient(145deg, var(--qs-d-surface), var(--qs-d-bg));
    color: var(--qs-d-text);
    box-shadow: 0 18px 48px var(--qs-d-shadow-lg), 0 0 0 1px var(--qs-d-border);
}

html[data-theme="dark"] .custom-switch .custom-control-label::before {
    background-color: var(--qs-d-surface-2);
    border-color: var(--qs-d-border);
}
html[data-theme="dark"] .custom-switch .custom-control-input:checked ~ .custom-control-label::before {
    background-color: var(--qs-d-success);
    border-color: var(--qs-d-success);
    box-shadow: 0 0 0 3px rgba(var(--qs-success-rgb), 0.22);
}

html[data-theme="dark"] #permission-denied-banner {
    background: rgba(var(--qs-danger-rgb), 0.15) !important;
    color: var(--qs-d-danger) !important;
    box-shadow: 0 2px 6px var(--qs-d-shadow) !important;
}

html[data-theme="dark"] .filter-panel .form-control {
    background-color: var(--qs-d-surface-2);
    border-color: var(--qs-d-border);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .filter-panel .form-control::placeholder { color: var(--qs-d-text-faint); }

html[data-theme="dark"] .btn-back-standard {
    background-color: var(--qs-d-surface-2);
    border-color: var(--qs-d-border);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .btn-back-standard:hover {
    background-color: var(--qs-d-surface-3);
    border-color: var(--qs-d-border-strong);
    color: var(--qs-d-text);
}


/* ---------------------------------------------------------------------------
   5. THIRD-PARTY WIDGETS
   --------------------------------------------------------------------------- */
/* Select2 v4 */
html[data-theme="dark"] .select2-container--default .select2-selection--single,
html[data-theme="dark"] .select2-container--default .select2-selection--multiple {
    background-color: var(--qs-d-surface-2);
    border-color: var(--qs-d-border);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--qs-d-text); }
html[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__placeholder { color: var(--qs-d-text-faint); }
html[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__arrow b { border-top-color: var(--qs-d-text-muted); }
html[data-theme="dark"] .select2-dropdown {
    background-color: var(--qs-d-surface);
    border-color: var(--qs-d-border);
}
/* Plain (not highlighted, not selected) result rows never got a background —
   only .select2-dropdown (the outer popup) is dark; each row's own background
   stays Select2's built-in near-white default, so near-white text on a
   near-white row washed out to invisible (the reported "dropdown still the
   same" bug on Recipients / City selects). */
html[data-theme="dark"] .select2-results__options { background-color: var(--qs-d-surface); }
html[data-theme="dark"] .select2-results__option {
    background-color: var(--qs-d-surface);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--qs-d-primary) !important;
    color: var(--qs-inverse-fg) !important;
}
html[data-theme="dark"] .select2-container--default .select2-results__option[aria-selected="true"]:not(.select2-results__option--highlighted) {
    background-color: var(--qs-d-surface-3) !important;
    color: var(--qs-d-text) !important;
}
html[data-theme="dark"] .select2-search--dropdown .select2-search__field {
    background-color: var(--qs-d-surface-2);
    border-color: var(--qs-d-border);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: var(--qs-d-surface-3);
    border-color: var(--qs-d-border);
    color: var(--qs-d-text);
}

/* DataTables — general chrome */
html[data-theme="dark"] .dataTables_wrapper,
html[data-theme="dark"] .dataTables_wrapper .dataTables_info,
html[data-theme="dark"] .dataTables_wrapper .dataTables_length,
html[data-theme="dark"] .dataTables_wrapper .dataTables_filter,
html[data-theme="dark"] .dataTables_wrapper .dataTables_length label { color: var(--qs-d-text-muted); }
html[data-theme="dark"] table.dataTable { color: var(--qs-d-text); }
html[data-theme="dark"] table.dataTable tbody tr { background-color: transparent; }
html[data-theme="dark"] table.dataTable.stripe tbody tr.odd,
html[data-theme="dark"] table.dataTable.display tbody tr.odd { background-color: rgba(var(--qs-white-rgb), 0.02); }

/* ROOT CAUSE FIX #4 — the page-size <select> next to "entries" is pinned
   white !important in site.css. */
html[data-theme="dark"] .dataTables_wrapper .dataTables_length select {
    background: var(--qs-d-surface-2) !important;
    color: var(--qs-d-text) !important;
    border-color: var(--qs-d-border) !important;
    box-shadow: none !important;
}

/* ROOT CAUSE FIX #5 — pagination buttons are pinned white !important with a
   dark-grey label; only :hover/.current (which use var(--qs-primary)) were
   readable before — the resting/disabled states stayed pure white. */
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    background: var(--qs-d-surface) !important;
    border-color: var(--qs-d-border) !important;
    color: var(--qs-d-text) !important;
}
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--qs-d-primary) !important;
    border-color: var(--qs-d-primary) !important;
    color: var(--qs-inverse-fg) !important;
}
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current,
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: linear-gradient(135deg, var(--qs-d-primary), var(--qs-d-primary-600)) !important;
    border-color: var(--qs-d-primary-600) !important;
    color: var(--qs-inverse-fg) !important;
}
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background: var(--qs-d-surface) !important;
    border-color: var(--qs-d-border) !important;
    color: var(--qs-d-text-faint) !important;
}
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .ellipsis { color: var(--qs-d-text-faint); }
html[data-theme="dark"] .dataTables_empty { color: var(--qs-d-text-muted); }
html[data-theme="dark"] .dt-footer-bar {
    background: var(--qs-d-surface-2);
    border-color: var(--qs-d-border);
}

/* ROOT CAUSE FIX #6 — the DataTables "Columns / Export" dropdown menu
   (div.dt-button-collection, opened by the Columns button) is pinned to a
   solid white card with !important and was never touched at all. */
html[data-theme="dark"] div.dt-button-collection {
    background: var(--qs-d-surface) !important;
    border-color: var(--qs-d-border) !important;
    box-shadow: 0 8px 24px var(--qs-d-shadow) !important;
}
html[data-theme="dark"] div.dt-button-collection .dt-button {
    color: var(--qs-d-text) !important;
    background-color: transparent !important;
}
html[data-theme="dark"] div.dt-button-collection .dt-button::before {
    border-color: var(--qs-d-border-strong) !important;
    background: var(--qs-d-surface-2) !important;
}
html[data-theme="dark"] div.dt-button-collection .dt-button:hover {
    background-color: var(--qs-d-surface-2) !important;
    color: var(--qs-d-text) !important;
}
html[data-theme="dark"] div.dt-button-collection .dt-button.active {
    background-color: rgba(var(--qs-primary-rgb), 0.18) !important;
    color: var(--qs-d-link) !important;
}
html[data-theme="dark"] div.dt-button-collection .dt-button.active::before {
    background-color: var(--qs-d-primary) !important;
    border-color: var(--qs-d-primary) !important;
}
html[data-theme="dark"] div.dt-button-collection .dt-button.active:hover {
    background-color: rgba(var(--qs-primary-rgb), 0.26) !important;
}

/* SweetAlert (legacy) */
html[data-theme="dark"] .sweet-alert {
    background-color: var(--qs-d-surface) !important;
    color: var(--qs-d-text) !important;
    box-shadow: 0 16px 48px var(--qs-d-shadow-lg) !important;
}
html[data-theme="dark"] .sweet-alert h2,
html[data-theme="dark"] .sweet-alert p { color: var(--qs-d-text) !important; }
html[data-theme="dark"] .sweet-alert input {
    background-color: var(--qs-d-surface-2) !important;
    border-color: var(--qs-d-border) !important;
    color: var(--qs-d-text) !important;
}
html[data-theme="dark"] .sweet-alert .sa-input-error { color: var(--qs-d-danger) !important; }

/* Summernote */
html[data-theme="dark"] .note-editor.note-frame,
html[data-theme="dark"] .note-editor.note-airframe { border-color: var(--qs-d-border); }
html[data-theme="dark"] .note-toolbar,
html[data-theme="dark"] .note-editor .note-toolbar {
    background-color: var(--qs-d-surface-2);
    border-bottom-color: var(--qs-d-border);
}
html[data-theme="dark"] .note-btn,
html[data-theme="dark"] .note-editor .note-btn {
    background-color: var(--qs-d-surface-3);
    border-color: var(--qs-d-border);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .note-editable,
html[data-theme="dark"] .note-editor .note-editable {
    background-color: var(--qs-d-surface);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .note-statusbar { background-color: var(--qs-d-surface-2); border-top-color: var(--qs-d-border); }
html[data-theme="dark"] .note-placeholder { color: var(--qs-d-text-faint); }

/* Fancybox */
html[data-theme="dark"] .fancybox-bg { background: var(--qs-inverse-surface-2); }
html[data-theme="dark"] .fancybox-caption { color: var(--qs-d-text); }

/* blockUI overlay */
html[data-theme="dark"] .blockUI.blockOverlay { background-color: var(--qs-inverse-surface-2) !important; opacity: 0.6 !important; }

/* jQuery UI / calendars datepicker */
html[data-theme="dark"] .ui-widget-content,
html[data-theme="dark"] .ui-datepicker,
html[data-theme="dark"] .calendars-picker {
    background-color: var(--qs-d-surface);
    border-color: var(--qs-d-border);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .ui-datepicker .ui-datepicker-header,
html[data-theme="dark"] .ui-widget-header {
    background-color: var(--qs-d-surface-2);
    border-color: var(--qs-d-border);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .ui-state-default,
html[data-theme="dark"] .ui-widget-content .ui-state-default {
    background-color: var(--qs-d-surface-2);
    border-color: var(--qs-d-border);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .ui-state-active,
html[data-theme="dark"] .ui-state-highlight {
    background-color: var(--qs-d-primary);
    color: var(--qs-inverse-fg);
    border-color: var(--qs-d-primary);
}

/* c3 charts (CSS-driven bits). NOTE: echarts colors are baked in JS and are
   NOT themeable via CSS — see the qs:themechange event if per-chart re-theming
   is added later. */
html[data-theme="dark"] .c3 svg { color: var(--qs-d-text); }
html[data-theme="dark"] .c3 text,
html[data-theme="dark"] .c3-axis .tick text { fill: var(--qs-d-text-muted); }
html[data-theme="dark"] .c3-axis path,
html[data-theme="dark"] .c3-axis line,
html[data-theme="dark"] .c3-grid line { stroke: var(--qs-d-border); }
html[data-theme="dark"] .c3-tooltip-container .c3-tooltip {
    background-color: var(--qs-d-surface) !important;
    color: var(--qs-d-text) !important;
    box-shadow: 0 6px 20px var(--qs-d-shadow) !important;
}
html[data-theme="dark"] .c3-tooltip th { background-color: var(--qs-d-surface-3); color: var(--qs-d-text); }
html[data-theme="dark"] .c3-tooltip td { background-color: var(--qs-d-surface); color: var(--qs-d-text); border-color: var(--qs-d-border); }


/* ---------------------------------------------------------------------------
   6. HOME DASHBOARD (Views/Home/Index.cshtml + _AdminDashboard.cshtml +
   _ProviderDashboard.cshtml)
   Page-local classes for the welcome dashboard. The stat tiles (.dash-card-*)
   were previously left untouched here on the theory they "already read fine"
   in dark mode — they render, but stay fully saturated (bright blue/green/
   orange/purple), which is NOT what the reference does: DesignReference's own
   dark-mode sheet mutes its equivalent tiles' gradient down to a near-black
   translucent wash (`--gw-a:#ffffff00 !important;--gw-b:#ffffff4f !important`)
   so dark mode reads as one calm dark surface instead of a wall of neon
   gradients. Reproduced here on our own classes/tokens. */
html[data-theme="dark"] .dash-card-primary,
html[data-theme="dark"] .dash-card-success,
html[data-theme="dark"] .dash-card-warning,
html[data-theme="dark"] .dash-card-info,
html[data-theme="dark"] .dash-card-danger,
html[data-theme="dark"] .dash-card-teal,
html[data-theme="dark"] .dash-card-purple {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .06)), var(--qs-d-surface-3);
    box-shadow: 0 6px 18px var(--qs-d-shadow);
}
html[data-theme="dark"] .dash-card:hover { box-shadow: 0 12px 26px var(--qs-d-shadow); }

html[data-theme="dark"] .dash-title,
html[data-theme="dark"] .dash-section-title,
html[data-theme="dark"] .dash-filter-title,
html[data-theme="dark"] .dash-sub-days { color: var(--qs-d-text); }
html[data-theme="dark"] .dash-updated-label { color: var(--qs-d-text-faint); }
html[data-theme="dark"] .dash-updated-date { color: var(--qs-d-text-muted); }
html[data-theme="dark"] .dash-panel { background-color: var(--qs-d-surface); }
html[data-theme="dark"] .dash-panel-header {
    background: var(--qs-d-surface-3);
    border-bottom-color: var(--qs-d-border);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .dash-filter-label { color: var(--qs-d-text-faint); }
html[data-theme="dark"] .dash-filter-note { background: var(--qs-d-surface-2); color: var(--qs-d-text-muted); }
html[data-theme="dark"] .dash-progress { background: var(--qs-d-surface-2); }
html[data-theme="dark"] .dash-quick-btn {
    background: var(--qs-d-surface-2);
    border-color: var(--qs-d-border);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .dash-quick-btn:hover {
    background: var(--qs-d-surface-3);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .attn-card {
    background: var(--qs-d-surface);
    border-color: var(--qs-d-border);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .attn-card:hover { color: var(--qs-d-text); }
html[data-theme="dark"] .attn-label { color: var(--qs-d-text-muted); }
html[data-theme="dark"] .attn-jump { color: var(--qs-d-text-faint); }
html[data-theme="dark"] .dash-loading-overlay { background: rgba(var(--qs-shadow-rgb), 0.5); }
html[data-theme="dark"] .stat-label { color: var(--qs-d-text-faint); }
html[data-theme="dark"] .stat-value { color: var(--qs-d-text); }
html[data-theme="dark"] .stat-sub { color: var(--qs-d-text-faint); }


/* ---------------------------------------------------------------------------
   7. PAGE-LOCAL CATCH-ALLS
   Many views carry hardcoded white / near-white backgrounds and dark text
   colours either as utility classes or inline style="" attributes. External
   CSS with !important overrides non-important inline styles, so these catch
   the common cases so page-specific panels don't stay bright on a dark page.
   Printed invoices/packing-slips render with Layout=null and never include
   this file, so they correctly stay light for printing.
   --------------------------------------------------------------------------- */
html[data-theme="dark"] [style*="background:#fff"],
html[data-theme="dark"] [style*="background: #fff"],
html[data-theme="dark"] [style*="background:#ffffff"],
html[data-theme="dark"] [style*="background: #ffffff"],
html[data-theme="dark"] [style*="background-color:#fff"],
html[data-theme="dark"] [style*="background-color: #fff"],
html[data-theme="dark"] [style*="background-color:#ffffff"],
html[data-theme="dark"] [style*="background-color: #ffffff"],
html[data-theme="dark"] [style*="background:#FFF"],
html[data-theme="dark"] [style*="background-color:#FFF"],
html[data-theme="dark"] [style*="background: white"],
html[data-theme="dark"] [style*="background-color: white"],
html[data-theme="dark"] [style*="background-color: rgb(255, 255, 255)"],
html[data-theme="dark"] [style*="background: rgb(255, 255, 255)"] {
    background-color: var(--qs-d-surface) !important;
}
html[data-theme="dark"] [style*="background:#f8f9fa"],
html[data-theme="dark"] [style*="background: #f8f9fa"],
html[data-theme="dark"] [style*="background-color:#f8f9fa"],
html[data-theme="dark"] [style*="background-color: #f8f9fa"],
html[data-theme="dark"] [style*="background:#f5f5f5"],
html[data-theme="dark"] [style*="background-color:#f5f5f5"],
html[data-theme="dark"] [style*="background:#f9fafb"],
html[data-theme="dark"] [style*="background-color:#f9fafb"],
html[data-theme="dark"] [style*="background:#fafafa"],
html[data-theme="dark"] [style*="background-color:#fafafa"],
html[data-theme="dark"] [style*="background:#eee"],
html[data-theme="dark"] [style*="background-color:#eee"],
html[data-theme="dark"] [style*="background:#f8fafc"],
html[data-theme="dark"] [style*="background-color:#f8fafc"],
html[data-theme="dark"] [style*="background: #f8fafc"],
html[data-theme="dark"] [style*="background-color: #f8fafc"],
html[data-theme="dark"] [style*="background:#f5f7fa"],
html[data-theme="dark"] [style*="background-color:#f5f7fa"],
html[data-theme="dark"] [style*="background:#e9ecef"],
html[data-theme="dark"] [style*="background-color:#e9ecef"],
html[data-theme="dark"] [style*="background:#f5f7ff"],
html[data-theme="dark"] [style*="background-color:#f5f7ff"] {
    background-color: var(--qs-d-surface-2) !important;
}
/* pale tinted "info" backgrounds (light blue) -> subtle dark blue tint */
html[data-theme="dark"] [style*="background:#e8f4fd"],
html[data-theme="dark"] [style*="background-color:#e8f4fd"],
html[data-theme="dark"] [style*="background:#e3f2fd"],
html[data-theme="dark"] [style*="background-color:#e3f2fd"],
html[data-theme="dark"] [style*="background:#eff6ff"],
html[data-theme="dark"] [style*="background-color:#eff6ff"],
html[data-theme="dark"] [style*="background:#eef2ff"],
html[data-theme="dark"] [style*="background-color:#eef2ff"] {
    background-color: rgba(var(--qs-primary-rgb), 0.12) !important;
}
html[data-theme="dark"] [style*="color:#333"],
html[data-theme="dark"] [style*="color: #333"],
html[data-theme="dark"] [style*="color:#000"],
html[data-theme="dark"] [style*="color: #000"],
html[data-theme="dark"] [style*="color:#222"],
html[data-theme="dark"] [style*="color: #222"],
html[data-theme="dark"] [style*="color:#1f2937"],
html[data-theme="dark"] [style*="color: #1f2937"],
html[data-theme="dark"] [style*="color:#212529"],
html[data-theme="dark"] [style*="color: #212529"] {
    color: var(--qs-d-text) !important;
}
html[data-theme="dark"] [style*="color:#666"],
html[data-theme="dark"] [style*="color: #666"],
html[data-theme="dark"] [style*="color:#6b7280"],
html[data-theme="dark"] [style*="color: #6b7280"],
html[data-theme="dark"] [style*="color:#888"],
html[data-theme="dark"] [style*="color: #888"],
html[data-theme="dark"] [style*="color:#999"],
html[data-theme="dark"] [style*="color: #999"],
html[data-theme="dark"] [style*="color:#64748b"],
html[data-theme="dark"] [style*="color: #64748b"],
html[data-theme="dark"] [style*="color:#5a6472"],
html[data-theme="dark"] [style*="color: #5a6472"],
html[data-theme="dark"] [style*="color:#8a94a6"],
html[data-theme="dark"] [style*="color: #8a94a6"],
html[data-theme="dark"] [style*="color:#94a3b8"],
html[data-theme="dark"] [style*="color: #94a3b8"],
html[data-theme="dark"] [style*="color:#6c757d"],
html[data-theme="dark"] [style*="color: #6c757d"] {
    color: var(--qs-d-text-muted) !important;
}

/* ROOT CAUSE — invert BLACK / near-black inline text everywhere. Any element
   whose inline style hardcodes a dark ink colour would be near-invisible on a
   dark surface. External CSS with !important beats the inline (non-important)
   value, so these flip every common black/slate ink to readable light text.
   All scoped under [data-theme="dark"] — light mode is never touched. */
html[data-theme="dark"] [style*="color:#000"],
html[data-theme="dark"] [style*="color: #000"],
html[data-theme="dark"] [style*="color:black"],
html[data-theme="dark"] [style*="color: black"],
html[data-theme="dark"] [style*="color:rgb(0,0,0)"],
html[data-theme="dark"] [style*="color: rgb(0, 0, 0)"],
html[data-theme="dark"] [style*="color:#111"],
html[data-theme="dark"] [style*="color: #111"],
html[data-theme="dark"] [style*="color:#1a1a1a"],
html[data-theme="dark"] [style*="color: #1a1a1a"],
html[data-theme="dark"] [style*="color:#1B1B1B"],
html[data-theme="dark"] [style*="color:#1b1b1b"],
html[data-theme="dark"] [style*="color:#252525"],
html[data-theme="dark"] [style*="color:#2c3e50"],
html[data-theme="dark"] [style*="color: #2c3e50"],
html[data-theme="dark"] [style*="color:#0f172a"],
html[data-theme="dark"] [style*="color: #0f172a"],
html[data-theme="dark"] [style*="color:#1e293b"],
html[data-theme="dark"] [style*="color: #1e293b"],
html[data-theme="dark"] [style*="color:#334155"],
html[data-theme="dark"] [style*="color: #334155"],
html[data-theme="dark"] [style*="color:#374151"],
html[data-theme="dark"] [style*="color: #374151"],
html[data-theme="dark"] [style*="color:#495057"],
html[data-theme="dark"] [style*="color: #495057"],
html[data-theme="dark"] [style*="color:#111827"],
html[data-theme="dark"] [style*="color: #111827"],
html[data-theme="dark"] [style*="color:#343a40"],
html[data-theme="dark"] [style*="color: #343a40"],
html[data-theme="dark"] [style*="color:#4b5563"],
html[data-theme="dark"] [style*="color: #4b5563"],
html[data-theme="dark"] [style*="color:#2a2f8f"],
html[data-theme="dark"] [style*="color: #2a2f8f"],
html[data-theme="dark"] [style*="color:#1976d2"],
html[data-theme="dark"] [style*="color: #1976d2"] {
    color: var(--qs-d-text) !important;
}

/* ROOT CAUSE — adjust/invert LIGHT BORDER (line) colours in inline styles.
   Thin light-grey dividers/outlines vanish or glare on dark; remap them to the
   dark border token. Covers the border shorthand and each border-*-color. */
html[data-theme="dark"] [style*="border:1px solid #ddd"],
html[data-theme="dark"] [style*="border: 1px solid #ddd"],
html[data-theme="dark"] [style*="border:1px solid #ded"],
html[data-theme="dark"] [style*="border:1px solid #e0e0e0"],
html[data-theme="dark"] [style*="border: 1px solid #e0e0e0"],
html[data-theme="dark"] [style*="border:1px solid #e5e7eb"],
html[data-theme="dark"] [style*="border: 1px solid #e5e7eb"],
html[data-theme="dark"] [style*="border:1px solid #eee"],
html[data-theme="dark"] [style*="border: 1px solid #eee"],
html[data-theme="dark"] [style*="border:1px solid #eef0f3"],
html[data-theme="dark"] [style*="border:1px solid #e2e8f0"],
html[data-theme="dark"] [style*="border: 1px solid #e2e8f0"],
html[data-theme="dark"] [style*="border:1px solid #dee2e6"],
html[data-theme="dark"] [style*="border: 1px solid #dee2e6"],
html[data-theme="dark"] [style*="border:1px solid #ced4da"],
html[data-theme="dark"] [style*="border:1px solid #ddd"],
html[data-theme="dark"] [style*="border-color:#ddd"],
html[data-theme="dark"] [style*="border-color: #ddd"],
html[data-theme="dark"] [style*="border-color:#e0e0e0"],
html[data-theme="dark"] [style*="border-color:#e5e7eb"],
html[data-theme="dark"] [style*="border-color:#eee"],
html[data-theme="dark"] [style*="border-bottom:1px solid #eee"],
html[data-theme="dark"] [style*="border-bottom: 1px solid #eee"],
html[data-theme="dark"] [style*="border-top:1px solid #eee"],
html[data-theme="dark"] [style*="border-bottom:1px solid #e5e7eb"],
html[data-theme="dark"] [style*="border-top:1px solid #e5e7eb"],
html[data-theme="dark"] [style*="border:1px solid #ccc"],
html[data-theme="dark"] [style*="border: 1px solid #ccc"],
html[data-theme="dark"] [style*="border-color:#ccc"],
html[data-theme="dark"] [style*="border:1px solid #dee2e6"],
html[data-theme="dark"] [style*="border: 1px solid #dee2e6"],
html[data-theme="dark"] [style*="border:1px solid #f0f0f0"],
html[data-theme="dark"] [style*="border-bottom:1px solid #f0f0f0"] {
    border-color: var(--qs-d-border) !important;
}

/* generic panel/box classes commonly used in view <style> blocks */
html[data-theme="dark"] .detail-card,
html[data-theme="dark"] .detail-box,
html[data-theme="dark"] .info-box,
html[data-theme="dark"] .info-card,
html[data-theme="dark"] .summary-card,
html[data-theme="dark"] .section-box,
html[data-theme="dark"] .white-box,
html[data-theme="dark"] .content-box,
html[data-theme="dark"] .timeline-item,
html[data-theme="dark"] .chat-bubble,
html[data-theme="dark"] .message-box {
    background-color: var(--qs-d-surface) !important;
    border-color: var(--qs-d-border) !important;
    color: var(--qs-d-text);
}


/* ---------------------------------------------------------------------------
   8. REMAINING CONFIRMED site.css LIGHT SURFACES (full sweep)
   These are the specific selectors that were still bright in the screenshots —
   each verified directly against site.css. They appear on EVERY list page and
   the notifications inboxes, which is why "all pages looked the same bad way".
   --------------------------------------------------------------------------- */

/* The white DataTable toolbar box (Columns/Print/Export + "Show N") — every list */
html[data-theme="dark"] .dt-toolbar-row {
    background: var(--qs-d-surface-2);
    border-color: var(--qs-d-border);
}
html[data-theme="dark"] .dataTables_wrapper .dataTables_length label { color: var(--qs-d-text-muted); }

/* DataTable rows — site.css pins tbody tr to #fff and even rows to #fafbfd.
   Both must be neutralized or half the rows glow light (this is the dim /
   washed-out row text you saw — light text sat on those light rows). */
html[data-theme="dark"] table.dataTable tbody tr { background: transparent; }
html[data-theme="dark"] table.dataTable tbody tr:nth-child(even) { background: rgba(var(--qs-white-rgb), 0.03); }
html[data-theme="dark"] table.dataTable tbody tr td { color: var(--qs-d-text); }

/* Notification inbox rows (AdminNotifications / ProviderNotifications / management) */
html[data-theme="dark"] .notif-card { border-bottom-color: var(--qs-d-border); }
html[data-theme="dark"] .notif-card.notif-unread { background: rgba(var(--qs-primary-rgb), 0.12); }
html[data-theme="dark"] .notif-card .notif-title { color: var(--qs-d-text); }
html[data-theme="dark"] .notif-card .notif-message { color: var(--qs-d-text-muted); }
html[data-theme="dark"] .notif-card .notif-time { color: var(--qs-d-text-faint); }
html[data-theme="dark"] .notif-actions-sep { background: var(--qs-d-border); }

/* Notification filter/tab pills */
html[data-theme="dark"] .notif-tab-pill {
    background: var(--qs-d-surface-2);
    color: var(--qs-d-text-muted);
}
html[data-theme="dark"] .notif-tab-pill:hover {
    background: var(--qs-d-surface-3);
    color: var(--qs-d-text);
}
html[data-theme="dark"] .notif-tab-pill.active {
    /* Same fixed navy (--qs-primary, #173FA6) that site.css pins with !important
       on every .nav-tabs .nav-link.active (e.g. Consumers/Index) in BOTH themes —
       this pill was using --qs-d-primary (#4c7dff), a much brighter blue unique
       to itself, which is why it never matched the rest of the app. */
    background: var(--qs-primary) !important;
    color: var(--qs-inverse-fg);
}
/* Count badge inside the active pill: keep it pale with dark navy text (same
   contrast pattern as Consumers/Index's active-tab badge) instead of the generic
   dark-mode .badge-light (dark-grey-on-dark), which blended into the blue pill. */
html[data-theme="dark"] .notif-tab-pill.active .badge-light {
    background-color: var(--qs-text);
    color: var(--qs-primary);
}
html[data-theme="dark"] .notif-pagination .page-item.active .page-link {
    background-color: var(--qs-d-primary);
    border-color: var(--qs-d-primary);
}

/* Select2 result hover pinned #e8e8e8 !important in site.css */
html[data-theme="dark"] .select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: var(--qs-d-surface-3) !important;
    color: var(--qs-d-text) !important;
}


/* ---------------------------------------------------------------------------
   9. GLOBAL BORDER (LINE) SWEEP
   Force every structural divider/hairline to the dark border token so NO light
   line survives anywhere (the white row/section lines you saw). Accent rails
   (primary borders on the page header + active sidebar item) are re-asserted
   immediately after so they keep their brand color.
   --------------------------------------------------------------------------- */
html[data-theme="dark"] .card,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-footer,
html[data-theme="dark"] .card-body,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .panel-heading,
html[data-theme="dark"] .table,
html[data-theme="dark"] .table td,
html[data-theme="dark"] .table th,
html[data-theme="dark"] .table thead th,
html[data-theme="dark"] .table tbody td,
html[data-theme="dark"] .table tbody tr,
html[data-theme="dark"] .table-bordered,
html[data-theme="dark"] .table-bordered td,
html[data-theme="dark"] .table-bordered th,
html[data-theme="dark"] table.dataTable,
html[data-theme="dark"] table.dataTable td,
html[data-theme="dark"] table.dataTable th,
html[data-theme="dark"] table.dataTable tbody td,
html[data-theme="dark"] table.dataTable tbody tr,
html[data-theme="dark"] .list-group,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .dropdown-divider,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer,
html[data-theme="dark"] .nav-tabs,
html[data-theme="dark"] .nav-tabs .nav-link,
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .custom-select,
html[data-theme="dark"] .custom-file-label,
html[data-theme="dark"] .input-group-text,
html[data-theme="dark"] .breadcrumb,
html[data-theme="dark"] .page-header,
html[data-theme="dark"] .dt-toolbar-row,
html[data-theme="dark"] .dt-footer-bar,
html[data-theme="dark"] .notif-card,
html[data-theme="dark"] .notif-item,
html[data-theme="dark"] .list-group-flush > .list-group-item,
html[data-theme="dark"] hr {
    border-color: var(--qs-d-border) !important;
}
/* re-assert brand accent rails (must come AFTER the sweep) */
html[data-theme="dark"] .addedit-header-inner {
    border-inline-end-color: var(--qs-d-primary) !important;
    border-right-color: var(--qs-d-primary) !important;
}
/* The "you are here" accent. This rule is the LAST declaration of
   border-inline-start-color in the file, so it is the one that actually decides the
   colour - setting it anywhere earlier is silently overridden. Same cyan as light mode,
   so the signal means the same thing in both themes. */
html[data-theme="dark"] .sidebar-dark .nav-sidebar > .nav-item > .nav-link.active,
html[data-theme="dark"] .sidebar-dark .nav-item-submenu.nav-item-open > .nav-link {
    border-inline-start-color: var(--qs-nav-section-fg) !important;
}


/* ---------------------------------------------------------------------------
   10. TEXT (FONT) SWEEP
   Brighten the default ink everywhere inside the content area so nothing keeps
   the theme's dark #333/#444 text (the "gray / dark-white, unclear" text).
   No !important, so semantic colors (.text-muted / .text-danger / badges,
   which carry their own !important) still win.
   --------------------------------------------------------------------------- */
html[data-theme="dark"] .content-wrapper,
html[data-theme="dark"] .content-wrapper p,
html[data-theme="dark"] .content-wrapper td,
html[data-theme="dark"] .content-wrapper th,
html[data-theme="dark"] .content-wrapper li,
html[data-theme="dark"] .content-wrapper dt,
html[data-theme="dark"] .content-wrapper dd,
html[data-theme="dark"] .content-wrapper label,
html[data-theme="dark"] .content-wrapper strong,
html[data-theme="dark"] .content-wrapper b,
html[data-theme="dark"] .content-wrapper h1,
html[data-theme="dark"] .content-wrapper h2,
html[data-theme="dark"] .content-wrapper h3,
html[data-theme="dark"] .content-wrapper h4,
html[data-theme="dark"] .content-wrapper h5,
html[data-theme="dark"] .content-wrapper h6,
html[data-theme="dark"] .content-wrapper .card-title,
html[data-theme="dark"] .content-wrapper .card-text {
    color: var(--qs-d-text);
}

/* ===========================================================================
   11. COMPREHENSIVE FIX — ALL white/light elements in dark mode
   =========================================================================== */

/* Table rows — ALL variants (regular, child, detail, expand, striped, hover) */
html[data-theme="dark"] table tr,
html[data-theme="dark"] table tbody tr,
html[data-theme="dark"] table.dataTable tbody tr.child,
html[data-theme="dark"] table.dataTable tr.dtrg-group,
html[data-theme="dark"] table tbody tr.shown-child,
html[data-theme="dark"] tr[role="row"] {
    background-color: transparent !important;
    color: var(--qs-d-text) !important;
}

/* Even rows get subtle alternation */
html[data-theme="dark"] table tbody tr:nth-child(even),
html[data-theme="dark"] table.dataTable tbody tr:nth-child(even):not(.child):not(.dtrg-group) {
    background-color: rgba(var(--qs-white-rgb), 0.02) !important;
}

/* Detail/child row wrapper (DataTables nested content) */
html[data-theme="dark"] table.dataTable tbody tr.child td,
html[data-theme="dark"] table.dataTable tbody tr.child {
    background-color: var(--qs-d-surface) !important;
}

/* All table cells */
html[data-theme="dark"] table td,
html[data-theme="dark"] table th {
    background-color: inherit !important;
    color: var(--qs-d-text) !important;
    border-color: var(--qs-d-border) !important;
}

/* Buttons that default to light in light theme — must all go dark.
   IMPORTANT: excludes .btn-icon.btn-action — the DataTables row-action icons
   (view/edit/status/delete) are intentionally colored per-action via an
   inline style="background-color:#xx" (datatable-helper.js actionsColumn),
   and this rule's !important was stomping that inline color flat gray. */
html[data-theme="dark"] .btn:not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-info):not(.btn-icon),
html[data-theme="dark"] button:not([class*="btn-primary"]):not([class*="btn-success"]):not([class*="btn-danger"]):not(.btn-icon):not(.sb-group-h):not(.sb-collapse):not(.tb-btn):not(.tb-burger),
html[data-theme="dark"] .btn-empty {
    background-color: var(--qs-d-surface-2) !important;
    color: var(--qs-d-text) !important;
    border-color: var(--qs-d-border) !important;
}
/* Generic/uncolored badges only — excludes EVERY semantic badge-* and bg-* variant
   (badge-success/-danger/-warning/-info/-primary/-secondary, all solid-colored
   with !important in site.css) and .badge-flat (styled separately above).
   The previous version only excluded success/danger, so badge-warning/-info/
   -primary/-secondary lost their colored fill to this rule's higher
   specificity (":not()" carries its argument's specificity) — that was the
   "status pill background stays black" regression. */
html[data-theme="dark"] .badge-light,
html[data-theme="dark"] .badge:not([class*="bg-"]):not([class*="badge-"]) {
    background-color: var(--qs-d-surface-2) !important;
    color: var(--qs-d-text) !important;
    border-color: var(--qs-d-border) !important;
}

/* Input groups — label/prefix/suffix styling */
html[data-theme="dark"] .input-group-text {
    background-color: var(--qs-d-surface-2) !important;
    border-color: var(--qs-d-border) !important;
    color: var(--qs-d-text) !important;
}

/* Form validation feedback text */
html[data-theme="dark"] .invalid-feedback,
html[data-theme="dark"] .valid-feedback {
    color: var(--qs-d-warning) !important;
}

/* Absolutely force NO light backgrounds anywhere */
html[data-theme="dark"] [style*="background: white"],
html[data-theme="dark"] [style*="background:#fff"],
html[data-theme="dark"] [style*="background-color: white"],
html[data-theme="dark"] [style*="background-color: #fff"] {
    background-color: var(--qs-d-surface-2) !important;
    color: var(--qs-d-text) !important;
}

/* GPG redesign sidebar — tuned values from the approved design review, not
   expressible as a token swap: the token-driven defaults (--qs-nav-fg-leaf/
   --qs-nav-section-fg) are close but the design review asked for these exact
   dark-mode values instead. Ported from DesignReference/UI-Redesign's own
   qs-theme-dark.css. Its `.stat-tile`/`.skel` rules are NOT ported here since
   this app's dashboard markup doesn't use those classes yet (see the Task 11
   gap in the shell-rebuild plan — the dashboard view itself was never
   restyled to the reference's classes). */
[data-theme="dark"] .sb-item { color: #e6e6e6; }
[data-theme="dark"] .sb-group-h { color: #9a9a9a; }
