/* =====================================================================
   App-wide dark mode overrides
   Loaded after module CSS. All rules scoped to html[data-bs-theme="dark"].
   ===================================================================== */

/* ---------- Design tokens (dark) ---------- */
html[data-bs-theme="dark"] {
  color-scheme: dark;

  --c-bg: #0b1120;
  --c-surface: #111827;
  --c-surface-2: #1e293b;
  --c-border: #334155;
  --c-border-strong: #475569;
  --c-text: #e2e8f0;
  --c-text-strong: #f8fafc;
  --c-text-muted: #94a3b8;
  --c-text-subtle: #64748b;

  --c-primary-50: rgba(99, 102, 241, 0.14);
  --c-primary-100: rgba(99, 102, 241, 0.22);
  --c-primary-200: rgba(99, 102, 241, 0.34);
  --c-primary-300: rgba(129, 140, 248, 0.5);
  --c-primary-400: #818cf8;
  --c-primary-500: #6366f1;
  --c-primary-600: #818cf8;
  --c-primary-700: #a5b4fc;
  --c-primary-800: #c7d2fe;
  --c-primary-900: #e0e7ff;

  --c-sidebar-bg: #111827;
  --c-sidebar-text: #cbd5e1;
  --c-sidebar-text-muted: #94a3b8;
  --c-sidebar-active-bg: rgba(99, 102, 241, 0.18);
  --c-sidebar-active-text: #c7d2fe;
  --c-sidebar-border: #334155;
  --c-sidebar-hover-bg: rgba(148, 163, 184, 0.14);
  --c-sidebar-hover-text: #f1f5f9;
  --c-sidebar-hover-icon: #cbd5e1;

  --c-slate-50: #1a2332;
  --c-slate-100: #243044;
  --c-slate-200: #334155;
  --c-slate-300: #475569;
  --c-slate-400: #64748b;
  --c-slate-500: #94a3b8;
  --c-slate-600: #cbd5e1;
  --c-slate-700: #e2e8f0;
  --c-slate-800: #f1f5f9;
  --c-slate-900: #f8fafc;
  --c-slate-950: #ffffff;

  --c-success-50: rgba(16, 185, 129, 0.14);
  --c-success-700: #6ee7b7;
  --c-warning-50: rgba(245, 158, 11, 0.14);
  --c-warning-700: #fcd34d;
  --c-danger-50: rgba(239, 68, 68, 0.14);
  --c-danger-700: #fca5a5;
  --c-info-50: rgba(59, 130, 246, 0.14);
  --c-info-700: #93c5fd;

  --ms-surface: var(--c-surface);
  --ms-muted: var(--c-text-muted);
  --ms-border: var(--c-border);
  --ms-questions-bg: var(--c-surface-2);
  --ms-questions-bg-header: var(--c-surface);
  --ms-questions-border: var(--c-border);
  --billing-surface: var(--c-surface-2);
  --billing-border: var(--c-border);
  --billing-muted: var(--c-text-muted);

  /* Auth brand pane — independent of remapped primary scale */
  --auth-brand-bg: linear-gradient(
    158deg,
    #070b14 0%,
    #0f172a 28%,
    #1e1b4b 58%,
    #312e81 82%,
    #1a1638 100%
  );
  --auth-brand-fg: #f1f5f9;
  --auth-brand-fg-muted: rgba(226, 232, 240, 0.86);
  --auth-brand-glass: rgba(99, 102, 241, 0.16);
  --auth-brand-glass-border: rgba(129, 140, 248, 0.28);
  --auth-brand-icon-bg: rgba(99, 102, 241, 0.22);
  --auth-brand-glow-a: rgba(99, 102, 241, 0.34);
  --auth-brand-glow-b: rgba(129, 140, 248, 0.18);
  --auth-brand-grid: rgba(129, 140, 248, 0.07);
}

html[data-bs-theme="dark"] body.sp-body {
  background: var(--c-bg);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .app-shell,
html[data-bs-theme="dark"] .app-sidebar,
html[data-bs-theme="dark"] .app-topbar {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .app-content {
  background: var(--c-bg);
}

/* ---------- Bootstrap utilities (used across Razor pages) ---------- */
html[data-bs-theme="dark"] .bg-white,
html[data-bs-theme="dark"] .bg-light,
html[data-bs-theme="dark"] .text-bg-light,
html[data-bs-theme="dark"] .card.bg-light,
html[data-bs-theme="dark"] td.bg-light,
html[data-bs-theme="dark"] tr.bg-light,
html[data-bs-theme="dark"] th.bg-light,
html[data-bs-theme="dark"] .list-group-item.bg-light,
html[data-bs-theme="dark"] .border-bottom.bg-light,
html[data-bs-theme="dark"] .px-3.pb-3.pt-2.border-bottom.bg-light {
  background-color: var(--c-surface-2) !important;
  color: var(--c-text) !important;
  border-color: var(--c-border) !important;
}

html[data-bs-theme="dark"] .text-dark,
html[data-bs-theme="dark"] .text-body-emphasis {
  color: var(--c-text) !important;
}

html[data-bs-theme="dark"] .text-bg-warning.text-dark {
  color: var(--c-warning-700) !important;
}

html[data-bs-theme="dark"] .text-bg-info.text-dark {
  color: var(--c-info-700) !important;
}

html[data-bs-theme="dark"] pre.bg-light,
html[data-bs-theme="dark"] .bg-light pre,
html[data-bs-theme="dark"] pre.small {
  background-color: var(--c-surface-2) !important;
  color: var(--c-text) !important;
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .card-header.bg-white {
  background-color: var(--c-surface-2) !important;
  color: var(--c-text) !important;
  border-color: var(--c-border) !important;
}

html[data-bs-theme="dark"] .table-light,
html[data-bs-theme="dark"] .table > :not(caption) > * > .table-light {
  --bs-table-bg: var(--c-surface-2);
  --bs-table-color: var(--c-text);
  --bs-table-border-color: var(--c-border);
}

html[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-accent-bg: rgba(148, 163, 184, 0.06);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

html[data-bs-theme="dark"] .accordion-item,
html[data-bs-theme="dark"] .accordion-button {
  background-color: var(--c-surface);
  color: var(--c-text);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .accordion-button:not(.collapsed) {
  background-color: var(--c-surface-2);
  color: var(--c-text-strong);
}

html[data-bs-theme="dark"] .accordion-button::after {
  filter: invert(1) opacity(0.7);
}

html[data-bs-theme="dark"] .offcanvas,
html[data-bs-theme="dark"] .toast,
html[data-bs-theme="dark"] .toast-header {
  background-color: var(--c-surface);
  color: var(--c-text);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .pagination .page-link {
  background-color: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .pagination .page-link:hover {
  background-color: var(--c-surface-2);
  color: var(--c-text-strong);
}

html[data-bs-theme="dark"] .pagination .page-item.active .page-link {
  background-color: var(--c-primary-600);
  border-color: var(--c-primary-600);
  color: #fff;
}

html[data-bs-theme="dark"] .breadcrumb-item,
html[data-bs-theme="dark"] .breadcrumb-item.active {
  color: var(--c-text-muted);
}

html[data-bs-theme="dark"] .breadcrumb-item a {
  color: var(--c-primary-400);
}

/* ---------- App shell ---------- */
html[data-bs-theme="dark"] .sidebar-nav .nav-link {
  color: var(--c-sidebar-text);
}

html[data-bs-theme="dark"] .sidebar-nav .nav-link i {
  color: var(--c-sidebar-text-muted);
}

html[data-bs-theme="dark"] .sidebar-nav .nav-link:hover,
html[data-bs-theme="dark"] .sidebar-nav .nav-link:focus-visible {
  background: var(--c-sidebar-hover-bg);
  color: var(--c-sidebar-hover-text);
}

html[data-bs-theme="dark"] .sidebar-nav .nav-link:hover i,
html[data-bs-theme="dark"] .sidebar-nav .nav-link:focus-visible i {
  color: var(--c-sidebar-hover-text);
}

html[data-bs-theme="dark"] .sidebar-nav .nav-link.active {
  background: var(--c-sidebar-active-bg);
  color: var(--c-sidebar-active-text);
}

html[data-bs-theme="dark"] .sidebar-nav .nav-link.active i {
  color: var(--c-sidebar-active-text);
}

html[data-bs-theme="dark"] .sidebar-section {
  color: var(--c-sidebar-text-muted);
}

html[data-bs-theme="dark"] .sidebar-brand,
html[data-bs-theme="dark"] .platform-logo__name {
  color: var(--c-sidebar-text);
}

html[data-bs-theme="dark"] .platform-logo--on-dark {
  background: transparent;
  padding: 0;
  box-shadow: none;
}

html[data-bs-theme="dark"] .survey-list-bulk-bar {
  background: var(--c-surface-2);
}

html[data-bs-theme="dark"] .survey-list-bulk-bar__label,
html[data-bs-theme="dark"] .survey-list-group-toggle {
  color: var(--c-text-strong);
}

html[data-bs-theme="dark"] .survey-list-group-row > td {
  box-shadow: inset 4px 0 0 var(--c-primary-500);
}

html[data-bs-theme="dark"] .survey-list-row--grouped td {
  box-shadow: inset 4px 0 0 var(--c-primary-400);
}

html[data-bs-theme="dark"] .survey-list-row--grouped .survey-list-row__check + td::before,
html[data-bs-theme="dark"] .survey-list-table:not(:has(.survey-list-row__check)) .survey-list-row--grouped td:first-child::before {
  border-color: var(--c-primary-400);
}

html[data-bs-theme="dark"] .kpi,
html[data-bs-theme="dark"] .kpi-card,
html[data-bs-theme="dark"] .ds-card {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .kpi-value {
  color: var(--c-text-strong);
}

html[data-bs-theme="dark"] .kpi-label__icon,
html[data-bs-theme="dark"] .kpi-label > i {
  background: var(--c-primary-100);
  color: var(--c-primary-700);
}

html[data-bs-theme="dark"] .app-user-menu__avatar {
  background: var(--c-primary-100);
  color: var(--c-primary-800);
}

html[data-bs-theme="dark"] .app-user-menu__toggle {
  color: var(--c-text);
}

html[data-bs-theme="dark"] .company-switcher-search {
  background: var(--c-surface-2);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .company-switcher-search__input {
  color: var(--c-text);
}

html[data-bs-theme="dark"] .company-switcher-search__input::placeholder {
  color: var(--c-text-subtle);
}

html[data-bs-theme="dark"] .sp-modal,
html[data-bs-theme="dark"] .sp-loader-card {
  background: var(--c-surface);
  color: var(--c-text);
  border: 1px solid var(--c-border);
}

html[data-bs-theme="dark"] .sp-modal-title,
html[data-bs-theme="dark"] .sp-modal-message {
  color: var(--c-text);
}

html[data-bs-theme="dark"] .sp-modal-close {
  color: var(--c-text-muted);
}

html[data-bs-theme="dark"] .sp-modal-close:hover {
  background: var(--c-surface-2);
  color: var(--c-text-strong);
}

html[data-bs-theme="dark"] .auth-shell {
  background: var(--c-bg);
}

html[data-bs-theme="dark"] .auth-pane--form {
  background: var(--c-bg);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .auth-pane--brand {
  border-inline-end: 1px solid rgba(129, 140, 248, 0.12);
  box-shadow: inset -1px 0 0 rgba(15, 23, 42, 0.65);
}

html[data-bs-theme="dark"] .auth-brand-eyebrow {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

@media (prefers-reduced-transparency: reduce) {
  html[data-bs-theme="dark"] .auth-brand-eyebrow {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(30, 27, 75, 0.92);
  }
}

html[data-bs-theme="dark"] .home-signed-in-banner {
  background: var(--c-success-50);
  color: var(--c-success-700);
  border-color: rgba(16, 185, 129, 0.35);
}

html[data-bs-theme="dark"] .marketing-hero h1,
html[dir="rtl"][data-bs-theme="dark"] .marketing-hero h1 {
  -webkit-text-fill-color: initial;
  background: none;
  color: var(--c-text-strong);
}

html[data-bs-theme="dark"] .ds-search > .form-control {
  background: var(--c-surface-2);
}

/* ---------- Mystery Shopping ---------- */
html[data-bs-theme="dark"] .ms-subnav .nav-link:hover {
  background: var(--c-surface-2);
  color: var(--c-primary-400);
}

html[data-bs-theme="dark"] .ms-subnav .nav-link.active {
  background: var(--c-primary-100);
  color: var(--c-primary-400);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--c-primary-300);
}

html[data-bs-theme="dark"] .ms-workflow-card .card-header {
  background: linear-gradient(180deg, var(--c-surface-2) 0%, var(--c-surface) 100%);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .ms-workflow-flow__progress-badge {
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .ms-workflow-flow__body {
  background: var(--c-surface-2);
  color: var(--c-text);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .ms-workflow-flow__step.is-active .ms-workflow-flow__body {
  background: var(--c-surface);
  color: var(--c-text-strong);
  border-color: var(--c-primary-300);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.18);
}

html[data-bs-theme="dark"] .ms-workflow-flow__step.is-done .ms-workflow-flow__body {
  border-color: rgba(16, 185, 129, 0.35);
  background: var(--c-success-50);
}

html[data-bs-theme="dark"] .ms-workflow-flow__title {
  color: var(--c-text-strong);
}

html[data-bs-theme="dark"] .ms-workflow-flow__hint {
  color: var(--c-text-muted);
}

html[data-bs-theme="dark"] .ms-workflow-flow__connector {
  color: var(--c-text-subtle);
  background: transparent;
}

html[data-bs-theme="dark"] .ms-workflow-flow__connector i {
  background: var(--c-bg);
  color: var(--c-text-subtle);
}

html[data-bs-theme="dark"] .ms-workflow-flow__body .btn-outline-primary {
  color: var(--c-primary-400);
  border-color: var(--c-primary-400);
}

html[data-bs-theme="dark"] .ms-workflow-flow__body .btn-outline-primary:hover {
  background: var(--c-primary-100);
  color: var(--c-primary-800);
  border-color: var(--c-primary-400);
}

html[data-bs-theme="dark"] .ms-workflow-flow__body .btn-primary {
  background: var(--c-primary-500);
  border-color: var(--c-primary-500);
  color: #fff;
}

html[data-bs-theme="dark"] .ms-workflow-flow__body .btn-primary:hover {
  background: var(--c-primary-600);
  border-color: var(--c-primary-600);
  color: #fff;
}

html[data-bs-theme="dark"] .ms-context-bar .card-body {
  background: var(--c-surface-2);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .ms-criterion-questions__list > .list-group-item,
html[data-bs-theme="dark"] .ms-criterion-questions__add {
  background: var(--c-surface);
  color: var(--c-text);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .ms-criterion-questions__list .q-editor {
  background: var(--c-surface-2);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .ms-criterion-sortable .sortable-ghost,
html[data-bs-theme="dark"] .ms-criteria-builder .survey-question-sortable .sortable-ghost {
  background: var(--c-surface-2);
}

html[data-bs-theme="dark"] .ms-pipeline-stat {
  background: var(--c-surface-2);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .ms-pipeline-stat--available.is-active {
  background: var(--c-primary-100);
  color: var(--c-primary-800);
}

html[data-bs-theme="dark"] .ms-pipeline-stat--visited.is-active {
  background: var(--c-warning-50);
  color: var(--c-warning-700);
}

html[data-bs-theme="dark"] .ms-badge--available { background: var(--c-primary-100); color: var(--c-primary-800); }
html[data-bs-theme="dark"] .ms-badge--draft { background: var(--c-surface-2); color: var(--c-text-muted); }
html[data-bs-theme="dark"] .ms-badge--assigned,
html[data-bs-theme="dark"] .ms-badge--accepted { background: var(--c-info-50); color: var(--c-info-700); }
html[data-bs-theme="dark"] .ms-badge--progress { background: var(--c-warning-50); color: var(--c-warning-700); }
html[data-bs-theme="dark"] .ms-badge--rejected { background: var(--c-danger-50); color: var(--c-danger-700); }
html[data-bs-theme="dark"] .ms-badge--reopened { background: rgba(190, 24, 93, 0.18); color: #f9a8d4; }
html[data-bs-theme="dark"] .ms-badge--released { background: var(--c-surface-2); color: var(--c-text-muted); }

html[data-bs-theme="dark"] .ms-panel-tabs__nav {
  background: var(--c-surface-2);
}

html[data-bs-theme="dark"] .ms-panel-tabs__nav .nav-link:hover {
  background: var(--c-primary-100);
  color: var(--c-primary-700);
}

html[data-bs-theme="dark"] .ms-panel-tabs__nav .nav-link.active {
  background: var(--c-surface);
  color: var(--c-primary-700);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .ms-check-in-panel {
  background: var(--c-surface-2);
  border-color: var(--c-primary-300);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .ms-readiness-panel {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .ms-readiness-panel--blocked {
  background: var(--c-warning-50);
  border-color: rgba(245, 158, 11, 0.4);
  color: var(--c-warning-700);
}

html[data-bs-theme="dark"] .ms-criterion-card,
html[data-bs-theme="dark"] .ms-evidence-gallery__thumb,
html[data-bs-theme="dark"] .ms-hierarchy-breadcrumb,
html[data-bs-theme="dark"] .ms-status-alert {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .ms-page-builder__sidebar,
html[data-bs-theme="dark"] .ms-page-builder__canvas,
html[data-bs-theme="dark"] .ms-page-builder__block,
html[data-bs-theme="dark"] .ms-page-builder__palette-item {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .ms-page-builder__palette {
  background: var(--c-surface-2);
}

/* ---------- Billing / admin plans ---------- */
html[data-bs-theme="dark"] .billing-tabs__link:hover {
  background: var(--c-surface);
  color: var(--c-text-strong);
}

html[data-bs-theme="dark"] .billing-tabs__link.active {
  background: var(--c-surface);
  color: var(--c-primary-400);
  box-shadow: var(--shadow-xs);
}

html[data-bs-theme="dark"] .billing-tabs__count {
  background: var(--c-surface-2);
  color: var(--c-text-muted);
}

html[data-bs-theme="dark"] .billing-tabs__link.active .billing-tabs__count {
  background: var(--c-primary-100);
  color: var(--c-primary-800);
}

html[data-bs-theme="dark"] .billing-plan-card,
html[data-bs-theme="dark"] .billing-plan-tabs__link,
html[data-bs-theme="dark"] .billing-feature-grid__item,
html[data-bs-theme="dark"] .billing-limit-card,
html[data-bs-theme="dark"] .billing-usage-bar {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .billing-plan-tabs__link.active {
  background: var(--c-surface);
  color: var(--c-primary-400);
}

/* ---------- Shopper portal ---------- */
html[data-bs-theme="dark"] .shopper-bottom-nav {
  background: var(--c-surface);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .shopper-bottom-nav a {
  color: var(--c-text-muted);
}

html[data-bs-theme="dark"] .shopper-bottom-nav a.active {
  color: var(--c-primary-400);
}

html[data-bs-theme="dark"] .shopper-app-bar {
  background: var(--c-surface);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .shopper-job-card,
html[data-bs-theme="dark"] .shopper-stat-card,
html[data-bs-theme="dark"] .shopper-card,
html[data-bs-theme="dark"] .shopper-side-nav {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .shopper-side-nav .nav-link:hover,
html[data-bs-theme="dark"] .shopper-side-nav .nav-link.active {
  background: var(--c-sidebar-hover-bg);
  color: var(--c-sidebar-hover-text);
}

/* ---------- Survey builder ---------- */
html[data-bs-theme="dark"] .survey-builder-tabs .nav-link:hover,
html[data-bs-theme="dark"] .survey-builder-tabs .nav-link.active {
  background: var(--c-surface-2);
  color: var(--c-text-strong);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .survey-page-card,
html[data-bs-theme="dark"] .survey-question-card,
html[data-bs-theme="dark"] .survey-page-card__body,
html[data-bs-theme="dark"] .survey-question-card__body {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .survey-question-card.is-collapsed .survey-question-card__header,
html[data-bs-theme="dark"] .survey-page-card__header {
  background: var(--c-surface-2);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .survey-builder-empty,
html[data-bs-theme="dark"] .survey-logic-rule,
html[data-bs-theme="dark"] .survey-quota-row {
  background: var(--c-surface-2);
  border-color: var(--c-border);
  color: var(--c-text);
}

/* ---------- Survey map / motivation ---------- */
html[data-bs-theme="dark"] .survey-mapbox-search,
html[data-bs-theme="dark"] .survey-mapbox-search__input,
html[data-bs-theme="dark"] .mapboxgl-popup-content {
  background: var(--c-surface);
  color: var(--c-text);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .survey-motivation-card {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

/* ---------- Quill rich text ---------- */
html[data-bs-theme="dark"] .ql-toolbar,
html[data-bs-theme="dark"] .ql-container {
  background: var(--c-surface-2);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .ql-toolbar .ql-stroke {
  stroke: var(--c-text-muted);
}

html[data-bs-theme="dark"] .ql-toolbar .ql-fill {
  fill: var(--c-text-muted);
}

html[data-bs-theme="dark"] .ql-editor.ql-blank::before {
  color: var(--c-text-subtle);
}

/* ---------- Page help ---------- */
html[data-bs-theme="dark"] .page-help-prose .path,
html[data-bs-theme="dark"] .page-help-prose code {
  background: var(--c-surface-2);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .page-help-prose table.data {
  background: var(--c-surface);
}

html[data-bs-theme="dark"] .page-help-prose table.data th {
  background: var(--c-surface-2);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .page-help-prose .callout {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

/* ---------- CATI module ---------- */
html[data-bs-theme="dark"] .cati-queue-card,
html[data-bs-theme="dark"] .cati-session-panel {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

/* ---------- Public survey take (non-branded shell) ---------- */
html[data-bs-theme="dark"] body.sp-body:not(.survey-branded) .survey-take-shell,
html[data-bs-theme="dark"] body.sp-body:not(.survey-branded) .survey-take-card {
  background: var(--c-bg);
  color: var(--c-text);
}

html[data-bs-theme="dark"] body.sp-body:not(.survey-branded) .survey-take-card .card {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

/* ---------- Marketing / public site ---------- */
html[data-bs-theme="dark"] .site-header {
  background: rgba(11, 17, 32, 0.82);
  border-bottom: 1px solid rgba(129, 140, 248, 0.14);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

html[data-bs-theme="dark"] .site-logo {
  color: var(--c-text-strong);
}

html[data-bs-theme="dark"] .site-nav-link {
  color: var(--c-text-muted);
}

html[data-bs-theme="dark"] .site-nav-link:hover,
html[data-bs-theme="dark"] .site-nav-link:focus-visible {
  background: rgba(148, 163, 184, 0.12);
  color: var(--c-text-strong);
}

html[data-bs-theme="dark"] .site-nav-link.active {
  color: var(--c-primary-400);
  background: var(--c-primary-50);
}

html[data-bs-theme="dark"] .site-header-user {
  color: var(--c-text-muted) !important;
}

html[data-bs-theme="dark"] .site-header .lang-toggle,
html[data-bs-theme="dark"] .site-header .theme-toggle {
  background: rgba(30, 41, 59, 0.72);
  border-color: rgba(129, 140, 248, 0.22);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .site-header .lang-toggle:hover,
html[data-bs-theme="dark"] .site-header .lang-toggle:focus-visible,
html[data-bs-theme="dark"] .site-header .theme-toggle:hover,
html[data-bs-theme="dark"] .site-header .theme-toggle:focus-visible {
  background: rgba(51, 65, 85, 0.88);
  border-color: rgba(129, 140, 248, 0.38);
  color: var(--c-text-strong);
}

html[data-bs-theme="dark"] .marketing-hero {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.98) 0%, var(--c-bg) 100%);
  border-bottom-color: rgba(129, 140, 248, 0.1);
}

html[data-bs-theme="dark"] .marketing-hero .hero-eyebrow {
  background: var(--c-primary-50);
  color: var(--c-primary-400);
  border-color: rgba(129, 140, 248, 0.32);
}

@media (prefers-reduced-transparency: reduce) {
  html[data-bs-theme="dark"] .site-header {
    background: var(--c-surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

html[data-bs-theme="dark"] .feature-card:hover {
  border-color: var(--c-primary-400);
}

html[data-bs-theme="dark"] .onboarding-shell {
  background: var(--c-bg);
  color: var(--c-text);
}

/* ---------- In-app user manual ---------- */
html[data-bs-theme="dark"] .manual-in-app {
  --brand-light: var(--c-primary-50);
  --text: var(--c-text);
  --muted: var(--c-text-muted);
  --border: var(--c-border);
  --card: var(--c-surface);
  --bg: var(--c-bg);
}

html[data-bs-theme="dark"] .manual-in-app .manual-layout {
  background: var(--c-surface);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .manual-in-app .manual-toc a:hover,
html[data-bs-theme="dark"] .manual-in-app .manual-toc a.is-active {
  background: var(--c-primary-100);
  color: var(--c-primary-700);
}

html[data-bs-theme="dark"] .manual-in-app .manual-content h2 {
  border-bottom-color: var(--c-primary-200);
  color: var(--c-primary-700);
}

html[data-bs-theme="dark"] .manual-in-app .path,
html[data-bs-theme="dark"] .manual-content .path {
  background: var(--c-surface-2);
  color: var(--c-primary-700);
}

html[data-bs-theme="dark"] .manual-in-app .callout-tip,
html[data-bs-theme="dark"] .manual-content .callout-tip {
  background: var(--c-success-50);
  border-color: rgba(16, 185, 129, 0.35);
  color: var(--c-success-700);
}

html[data-bs-theme="dark"] .manual-in-app .callout-warn,
html[data-bs-theme="dark"] .manual-content .callout-warn {
  background: var(--c-warning-50);
  border-color: rgba(245, 158, 11, 0.35);
  color: var(--c-warning-700);
}

html[data-bs-theme="dark"] .manual-in-app .callout-info,
html[data-bs-theme="dark"] .manual-content .callout-info {
  background: var(--c-info-50);
  border-color: rgba(59, 130, 246, 0.35);
  color: var(--c-info-700);
}

html[data-bs-theme="dark"] .manual-in-app table.data tr:nth-child(even) td,
html[data-bs-theme="dark"] .manual-content table.data tr:nth-child(even) td {
  background: var(--c-surface-2);
}

html[data-bs-theme="dark"] .manual-in-app figure.screenshot-placeholder,
html[data-bs-theme="dark"] .manual-content figure.screenshot-placeholder {
  background: linear-gradient(180deg, var(--c-surface-2) 0%, var(--c-border) 100%);
  color: var(--c-text-muted);
}

/* ---------- Page help modal ---------- */
html[data-bs-theme="dark"] .page-help-fab {
  background: var(--c-surface);
  border-color: var(--c-primary-300);
  color: var(--c-primary-700);
  box-shadow: var(--shadow-md);
}

html[data-bs-theme="dark"] .page-help-fab:hover,
html[data-bs-theme="dark"] .page-help-fab:focus-visible {
  background: var(--c-primary-100);
  color: var(--c-primary-800);
}

html[data-bs-theme="dark"] .page-help-modal__header {
  background: linear-gradient(180deg, var(--c-primary-50) 0%, var(--c-surface) 100%);
}

html[data-bs-theme="dark"] .page-help-modal__body {
  background: var(--c-bg);
}

html[data-bs-theme="dark"] .page-help-modal__footer {
  background: var(--c-surface);
}

html[data-bs-theme="dark"] .page-help-prose .callout-info {
  background: var(--c-info-50);
  border-color: rgba(59, 130, 246, 0.35);
  color: var(--c-info-700);
}

html[data-bs-theme="dark"] .page-help-prose .callout-tip {
  background: var(--c-success-50);
  border-color: rgba(16, 185, 129, 0.35);
  color: var(--c-success-700);
}

html[data-bs-theme="dark"] .page-help-prose .callout-warn {
  background: var(--c-warning-50);
  border-color: rgba(245, 158, 11, 0.35);
  color: var(--c-warning-700);
}

html[data-bs-theme="dark"] .page-help-prose pre.manual-pre,
html[data-bs-theme="dark"] .page-help-prose pre {
  background: var(--c-surface-2);
  color: var(--c-text);
}

/* ---------- Mystery Shopping (extended) ---------- */
html[data-bs-theme="dark"] .ms-admin-content .ms-card,
html[data-bs-theme="dark"] .ms-admin-content .ms-panel-tabs {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .ms-workflow-card .card-header {
  background: linear-gradient(180deg, var(--c-surface-2) 0%, var(--c-surface) 100%);
}

html[data-bs-theme="dark"] .ms-workflow-flow__progress-badge {
  background: var(--c-surface-2);
  color: var(--c-text-muted);
}

html[data-bs-theme="dark"] .ms-workflow-flow__progress {
  background: var(--c-border);
}

html[data-bs-theme="dark"] .ms-workflow-flow__badge {
  background: var(--c-surface);
  color: var(--c-text-muted);
}

html[data-bs-theme="dark"] .ms-workflow-flow__step.is-active .ms-workflow-flow__badge {
  border-color: var(--c-primary-400);
  color: var(--c-primary-400);
}

html[data-bs-theme="dark"] .ms-workflow-flow__step.is-done .ms-workflow-flow__badge {
  background: var(--c-success-600);
  border-color: var(--c-success-600);
  color: #fff;
}

html[data-bs-theme="dark"] .ms-workflow-flow__step.is-done .ms-workflow-flow__body {
  border-color: rgba(16, 185, 129, 0.35);
  background: var(--c-success-50);
}

html[data-bs-theme="dark"] .ms-workflow-flow__title {
  color: var(--c-text-strong);
}

html[data-bs-theme="dark"] .ms-workflow-flow__connector::before {
  background: linear-gradient(90deg, var(--c-border), var(--c-border-strong));
}

html[data-bs-theme="dark"] .ms-kpi-card .ms-kpi-value {
  color: var(--c-text-strong);
}

html[data-bs-theme="dark"] .ms-kpi-card:hover {
  border-color: var(--c-primary-300);
}

html[data-bs-theme="dark"] .ms-criteria-builder .card,
html[data-bs-theme="dark"] .ms-assignments-layout__create,
html[data-bs-theme="dark"] .ms-assignments-table-card {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .ms-criterion-questions__list .sortable-ghost,
html[data-bs-theme="dark"] .ms-criterion-sortable .sortable-chosen {
  background: var(--c-surface-2);
}

html[data-bs-theme="dark"] .ms-status-alert {
  color: var(--c-text);
}

html[data-bs-theme="dark"] .ms-status-alert--info {
  background: var(--c-info-50);
  border-color: rgba(59, 130, 246, 0.35);
  color: var(--c-info-700);
}

html[data-bs-theme="dark"] .ms-status-alert--success {
  background: var(--c-success-50);
  border-color: rgba(16, 185, 129, 0.35);
  color: var(--c-success-700);
}

html[data-bs-theme="dark"] .ms-status-alert--warning {
  background: var(--c-warning-50);
  border-color: rgba(245, 158, 11, 0.35);
  color: var(--c-warning-700);
}

html[data-bs-theme="dark"] .ms-status-alert--danger {
  background: var(--c-danger-50);
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--c-danger-700);
}

html[data-bs-theme="dark"] .ms-badge--assigned,
html[data-bs-theme="dark"] .ms-badge--accepted { background: var(--c-info-50); color: var(--c-info-700); }
html[data-bs-theme="dark"] .ms-badge--submitted { background: var(--c-warning-50); color: var(--c-warning-700); }
html[data-bs-theme="dark"] .ms-badge--review { background: rgba(124, 58, 237, 0.18); color: #c4b5fd; }
html[data-bs-theme="dark"] .ms-badge--done { background: var(--c-success-50); color: var(--c-success-700); }

html[data-bs-theme="dark"] .ms-panel-tabs__content,
html[data-bs-theme="dark"] .ms-hierarchy-breadcrumb__item,
html[data-bs-theme="dark"] .ms-evidence-gallery__item {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .ms-questions-tabs .nav-link {
  color: var(--c-text-muted);
}

html[data-bs-theme="dark"] .ms-questions-tabs .nav-link.active {
  color: var(--c-primary-400);
  border-bottom-color: var(--c-primary-400);
}

html[data-bs-theme="dark"] .ms-questions-tabs__header {
  background: var(--c-surface);
  color: var(--c-text-strong);
}

/* ---------- Admin billing (hardcoded light surfaces) ---------- */
html[data-bs-theme="dark"] .billing-tabs,
html[data-bs-theme="dark"] .billing-plan-tabs,
html[data-bs-theme="dark"] .billing-plan-card__header,
html[data-bs-theme="dark"] .billing-plan-card__body,
html[data-bs-theme="dark"] .billing-invoice-row,
html[data-bs-theme="dark"] .billing-usage-card,
html[data-bs-theme="dark"] .billing-summary-card {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .billing-plan-card--featured {
  background: linear-gradient(135deg, var(--c-primary-50) 0%, var(--c-surface) 60%);
}

html[data-bs-theme="dark"] .billing-usage-bar__fill {
  background: var(--c-primary-500);
}

html[data-bs-theme="dark"] .billing-usage-bar__track {
  background: var(--c-surface-2);
}

/* ---------- Tenant subscription detail (Admin/TenantSubscription) ---------- */
html[data-bs-theme="dark"] .billing-tenant-hero {
  background: linear-gradient(135deg, var(--c-primary-50) 0%, var(--c-surface) 58%);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .billing-tenant-hero__title {
  color: var(--c-text-strong);
}

html[data-bs-theme="dark"] .billing-tenant-hero__slug {
  color: var(--c-text-muted);
}

html[data-bs-theme="dark"] .billing-stat-pill {
  background: var(--c-surface-2);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .billing-stat-pill__value {
  color: var(--c-text-strong);
}

html[data-bs-theme="dark"] .billing-stat-pill__label {
  color: var(--c-text-muted);
}

html[data-bs-theme="dark"] .billing-panel {
  background: var(--c-surface);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .billing-panel__header {
  background: var(--c-surface-2);
  color: var(--c-text-strong);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .billing-panel__body {
  color: var(--c-text);
}

html[data-bs-theme="dark"] .billing-panel__hint {
  background: var(--c-primary-50);
  color: var(--c-text-muted);
  border-left-color: var(--c-primary-500);
}

html[data-bs-theme="dark"] .billing-section__title {
  color: var(--c-text-muted);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .billing-override-feature {
  background: var(--c-surface-2);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .billing-override-feature__label {
  color: var(--c-text);
}

html[data-bs-theme="dark"] .billing-feature-check {
  background: var(--c-surface-2);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .billing-feature-check:hover {
  background: var(--c-primary-50);
  border-color: var(--c-primary-300);
}

html[data-bs-theme="dark"] .billing-plan-tabs__link:hover {
  background: var(--c-surface);
  color: var(--c-text-strong);
  border-color: var(--c-primary-300);
}

html[data-bs-theme="dark"] .billing-plan-tabs__link.active {
  background: var(--c-surface);
  border-bottom-color: var(--c-surface);
}

html[data-bs-theme="dark"] .billing-limits-table th {
  color: var(--c-text-muted);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .billing-limits-table td {
  color: var(--c-text);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .billing-limits-table tr:nth-child(even) td {
  background: var(--c-surface-2);
}

html[data-bs-theme="dark"] .billing-limits-table .limit-value {
  color: var(--c-text-strong);
}

html[data-bs-theme="dark"] .billing-limits-table .limit-yes {
  color: var(--c-success-700);
}

html[data-bs-theme="dark"] .billing-limits-table .limit-no {
  color: var(--c-text-muted);
}

html[data-bs-theme="dark"] .billing-status-badge--active {
  background: var(--c-success-50);
  color: var(--c-success-700);
}

html[data-bs-theme="dark"] .billing-status-badge--lifetime {
  background: var(--c-info-50);
  color: var(--c-info-700);
}

html[data-bs-theme="dark"] .billing-status-badge--cancelled,
html[data-bs-theme="dark"] .billing-status-badge--suspended {
  background: var(--c-danger-50);
  color: var(--c-danger-700);
}

html[data-bs-theme="dark"] .billing-status-badge--pastdue {
  background: var(--c-warning-50);
  color: var(--c-warning-700);
}

html[data-bs-theme="dark"] .billing-status-badge--default {
  background: var(--c-surface-2);
  color: var(--c-text-muted);
}

html[data-bs-theme="dark"] .billing-back-link {
  color: var(--c-text-muted);
}

html[data-bs-theme="dark"] .billing-back-link:hover {
  color: var(--c-primary-400);
}

html[data-bs-theme="dark"] .billing-admin .form-label,
html[data-bs-theme="dark"] .billing-admin .form-check-label {
  color: var(--c-text);
}

html[data-bs-theme="dark"] .billing-admin .text-muted {
  color: var(--c-text-muted) !important;
}

html[data-bs-theme="dark"] .billing-tenant-toolbar {
  background: var(--c-surface-2);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .billing-tenant-row:hover {
  background: var(--c-surface-2);
}

html[data-bs-theme="dark"] .billing-tenant-row__name {
  color: var(--c-text-strong);
}

html[data-bs-theme="dark"] .billing-usage-chip {
  background: var(--c-surface-2);
  color: var(--c-text-muted);
}

html[data-bs-theme="dark"] .billing-admin details summary {
  color: var(--c-text);
}

/* ---------- Survey map ---------- */
html[data-bs-theme="dark"] .survey-mapbox-search,
html[data-bs-theme="dark"] .survey-mapbox-search__input {
  background: var(--c-surface);
  color: var(--c-text);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .survey-mapbox-search__suggestion:hover,
html[data-bs-theme="dark"] .survey-mapbox-search__suggestion.is-active {
  background: var(--c-primary-50);
  color: var(--c-primary-700);
}

html[data-bs-theme="dark"] .survey-mapbox-pin-list__item {
  background: var(--c-surface-2);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .mapboxgl-popup-content {
  background: var(--c-surface);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .mapboxgl-popup-close-button {
  color: var(--c-text-muted);
}

/* ---------- Survey motivation ---------- */
html[data-bs-theme="dark"] .survey-motivation-shell,
html[data-bs-theme="dark"] .survey-motivation-card__body {
  background: var(--c-surface);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .survey-motivation-card__footer {
  background: linear-gradient(180deg, transparent 0%, var(--c-surface) 35%, var(--c-surface) 100%);
}

html[data-bs-theme="dark"] .survey-motivation-progress {
  background-color: var(--c-surface-2);
}

/* ---------- Shopper portal (extended) ---------- */
html[data-bs-theme="dark"] .shopper-shell {
  background: var(--c-bg);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .shopper-conduct-card,
html[data-bs-theme="dark"] .shopper-conduct-card .card-header,
html[data-bs-theme="dark"] .shopper-evidence-panel {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .shopper-pill-nav .nav-link:hover,
html[data-bs-theme="dark"] .shopper-pill-nav .nav-link.active {
  background: var(--c-primary-100);
  color: var(--c-primary-700);
}

html[data-bs-theme="dark"] .shopper-timeline__item {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .shopper-alert-banner {
  background: var(--c-warning-50);
  border-color: rgba(245, 158, 11, 0.35);
  color: var(--c-warning-700);
}

/* ---------- Shopper survey / conduct (dark admin preview) ---------- */
html[data-bs-theme="dark"] .shopper-survey-shell .survey-card,
html[data-bs-theme="dark"] .shopper-survey-shell .shopper-question-card {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .shopper-survey-shell .shopper-progress-track {
  background: var(--c-surface-2);
}

/* ---------- Survey take navigation ---------- */
html[data-bs-theme="dark"] .survey-take-nav--standard .survey-take-nav__bar {
  background: rgba(17, 24, 39, 0.96);
  border-color: var(--c-border);
  box-shadow: var(--shadow-md);
}

html[data-bs-theme="dark"] .survey-take-nav--standard .survey-take-nav__btn--back {
  background: var(--c-surface-2);
  border-color: var(--c-border);
  color: var(--c-text);
}

/* ---------- MS page builder ---------- */
html[data-bs-theme="dark"] .ms-page-builder__toolbar,
html[data-bs-theme="dark"] .ms-page-builder__inspector,
html[data-bs-theme="dark"] .ms-page-builder__block-preview {
  background: var(--c-surface-2);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .ms-page-builder__block.is-selected {
  border-color: var(--c-primary-400);
  box-shadow: 0 0 0 2px var(--c-primary-100);
}

/* ---------- Analytics / charts ---------- */
html[data-bs-theme="dark"] .analytics-chart-card,
html[data-bs-theme="dark"] .ai-chat-panel,
html[data-bs-theme="dark"] .ai-chat-message--assistant {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .ai-chat-message--user {
  background: var(--c-primary-100);
  color: var(--c-primary-800);
}

html[data-bs-theme="dark"] .word-cloud-badge {
  background: var(--c-surface-2) !important;
  color: var(--c-text) !important;
  border-color: var(--c-border) !important;
}

/* ---------- Misc components ---------- */
html[data-bs-theme="dark"] .input-group-text {
  background: var(--c-surface-2);
  border-color: var(--c-border);
  color: var(--c-text-muted);
}

html[data-bs-theme="dark"] .list-group-item-action:hover,
html[data-bs-theme="dark"] .list-group-item-action:focus {
  background: var(--c-surface-2);
  color: var(--c-text-strong);
}

html[data-bs-theme="dark"] .dropdown-item:hover,
html[data-bs-theme="dark"] .dropdown-item:focus {
  background: var(--c-surface-2);
  color: var(--c-text-strong);
}

html[data-bs-theme="dark"] .sticky-top.bg-white,
html[data-bs-theme="dark"] .position-sticky.bg-white {
  background: var(--c-surface) !important;
}

html[data-bs-theme="dark"] .border.bg-white,
html[data-bs-theme="dark"] img.collector-qr.bg-white {
  background: var(--c-surface) !important;
}

html[data-bs-theme="dark"] .shadow-sm,
html[data-bs-theme="dark"] .shadow {
  box-shadow: var(--shadow-sm) !important;
}

html[data-bs-theme="dark"] .shadow-lg {
  box-shadow: var(--shadow-lg) !important;
}

html[data-bs-theme="dark"] .text-black-50 {
  color: var(--c-text-muted) !important;
}

html[data-bs-theme="dark"] hr {
  border-color: var(--c-border);
  opacity: 1;
}

html[data-bs-theme="dark"] .border-secondary-subtle {
  border-color: var(--c-border) !important;
}

html[data-bs-theme="dark"] .nav-underline .nav-link.active {
  color: var(--c-primary-400);
  border-bottom-color: var(--c-primary-400);
}

html[data-bs-theme="dark"] .form-check-input {
  background-color: var(--c-surface-2);
  border-color: var(--c-border-strong);
}

html[data-bs-theme="dark"] .form-check-input:checked {
  background-color: var(--c-primary-500);
  border-color: var(--c-primary-500);
}

html[data-bs-theme="dark"] .form-switch .form-check-input {
  background-color: var(--c-border-strong);
}

html[data-bs-theme="dark"] .sq-tabular-matrix__row {
  background: var(--c-surface-2);
  border-color: var(--c-border);
  box-shadow: none;
}

html[data-bs-theme="dark"] .sq-tabular-matrix__row-label {
  color: var(--c-text);
}

html[data-bs-theme="dark"] .sq-tabular-matrix__cell {
  background: var(--c-surface);
  border-color: var(--c-border);
}

html[data-bs-theme="dark"] .sq-tabular-matrix__cell:hover {
  background: var(--c-surface-2);
  border-color: var(--c-border-strong);
}

html[data-bs-theme="dark"] .sq-tabular-matrix__cell:has(.sq-tabular-matrix__input:checked) {
  background: color-mix(in srgb, var(--c-primary-500) 18%, transparent);
  border-color: var(--c-primary-500);
}

html[data-bs-theme="dark"] .sq-tabular-matrix__cell-tag {
  color: var(--c-text-muted);
}

@media (min-width: 992px) {
  html[data-bs-theme="dark"] .sq-tabular-matrix {
    background: var(--c-surface-2);
    border-color: var(--c-border);
  }

  html[data-bs-theme="dark"] .sq-tabular-matrix__col-head {
    background: var(--c-surface);
    color: var(--c-text-muted);
    border-color: var(--c-border);
  }

  html[data-bs-theme="dark"] .sq-tabular-matrix__corner {
    background: var(--c-surface);
    border-color: var(--c-border);
  }

  html[data-bs-theme="dark"] .sq-tabular-matrix__row-label,
  html[data-bs-theme="dark"] .sq-tabular-matrix__cell {
    border-color: var(--c-border);
    background: transparent;
  }

  html[data-bs-theme="dark"] .sq-tabular-matrix__cell:has(.sq-tabular-matrix__input:checked) {
    background: color-mix(in srgb, var(--c-primary-500) 18%, transparent);
  }
}

html[data-bs-theme="dark"] .sq-tabular-cell:hover {
  background: var(--c-surface-2);
}

html[data-bs-theme="dark"] .sq-tabular-cell:has(.sq-tabular-cell__input:checked) {
  background: color-mix(in srgb, var(--c-primary-500) 18%, transparent);
}

html[data-bs-theme="dark"] .survey-take-category__panel {
  background: color-mix(in srgb, var(--c-primary-500) 10%, var(--c-surface-2));
  border-color: color-mix(in srgb, var(--c-primary-500) 22%, var(--c-border));
}

html[data-bs-theme="dark"] .survey-take-category__progress {
  background: var(--c-surface);
}

html[data-bs-theme="dark"] .shopper-survey .survey-take-category__panel {
  background: color-mix(in srgb, var(--c-surface) 92%, transparent);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
}

html[data-bs-theme="dark"] .progress {
  background: var(--c-surface-2);
}

html[data-bs-theme="dark"] .spinner-border.text-muted {
  color: var(--c-text-muted) !important;
}

/* Select2 / Tom Select if present */
html[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection,
html[data-bs-theme="dark"] .ts-control {
  background: var(--c-surface-2);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .select2-dropdown,
html[data-bs-theme="dark"] .ts-dropdown {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

html[data-bs-theme="dark"] .select2-results__option--highlighted,
html[data-bs-theme="dark"] .ts-dropdown .active {
  background: var(--c-primary-100);
  color: var(--c-primary-800);
}
