﻿/* =================================================================
 *  Voyger Dark Theme — Overrides Globais
 *  -----------------------------------------------------------------
 *  Aplicado quando o <html> tem [data-theme="dark"].
 *  Para desligar APENAS em um módulo específico, o module-loader
 *  marca o container com [data-module-theme="light"] e os blocos
 *  no fim deste arquivo revertem todas as variáveis para os
 *  valores claros, propagando no escopo daquele container.
 * ================================================================= */

/* ---------- 1. Variáveis globais (styles.css base) ---------- */
:root[data-theme="dark"] {
    --color-primary: #ffffff;
    --color-primary-dark: #e5e5e5;
    --color-primary-light: #d0d0d0;
    --color-secondary: #b0b0b0;
    --color-secondary-dark: #888888;
    --color-accent: #1a1a1a;
    --color-accent-dark: #0f0f0f;

    --color-black: #ffffff;
    --color-dark: #f0f0f0;
    --color-gray-dark: #cfcfcf;
    --color-gray: #9aa0a6;
    --color-gray-light: #6b7280;
    --color-gray-lighter: #3a3a3a;
    --color-white-dark: #161616;
    --color-white: #0d0d0d;

    --gradient-primary: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    --gradient-secondary: linear-gradient(135deg, #2a2a2a 0%, #3a3a3a 100%);
    --gradient-dark: linear-gradient(135deg, #050505 0%, #1a1a1a 100%);
    --gradient-light: linear-gradient(135deg, #1a1a1a 0%, #232323 100%);
    --gradient-accent: linear-gradient(135deg, #1f1f1f 0%, #2c2c2c 100%);
    --gradient-overlay: linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.6) 100%);

    --glass-white: rgba(255, 255, 255, 0.06);
    --glass-black: rgba(0, 0, 0, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: rgba(0, 0, 0, 0.5);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.6);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.55), 0 2px 4px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.7), 0 10px 10px -5px rgba(0, 0, 0, 0.5);
}

/* ---------- 2. body / superfícies base ---------- */
[data-theme="dark"] body {
    background-color: #0d0d0d;
    color: #e5e7eb;
}

[data-theme="dark"] #main-content-area,
[data-theme="dark"] .voyger-tab-pane {
    background-color: #0f0f0f;
    color: #e5e7eb;
}

/* Logo do header (img → SVG opaco): recolorir via filter.
   fill/stroke/color não alcançam o <path> interno quando o SVG
   é carregado como <img>; só filter funciona. */
[data-theme="dark"] .header-voyger-logo {
    filter: brightness(0) invert(1);
}

/* ---------- 3. Tokens de módulos (escopados) ----------
 *  Todos os módulos seguem o padrão "Premium Monochromatic".
 *  Aqui invertemos a paleta tradicional (claro -> escuro)
 *  mantendo a identidade visual por módulo.
 *  Aplica-se quando o root está em dark E o container do
 *  módulo NÃO tem opt-out.
 * ------------------------------------------------------- */
[data-theme="dark"] .nfe-module:not([data-module-theme="light"]),
[data-theme="dark"] .servico-module:not([data-module-theme="light"]),
[data-theme="dark"] .br-module:not([data-module-theme="light"]),
[data-theme="dark"] .pm-module:not([data-module-theme="light"]),
[data-theme="dark"] .hris-module:not([data-module-theme="light"]),
[data-theme="dark"] .overview-module:not([data-module-theme="light"]),
[data-theme="dark"] .module-root:not([data-module-theme="light"]) {
    --ink: #f3f4f6;
    --ink-soft: #c7c7c7;
    --ink-muted: #8b8b8b;
    --surface: #161616;
    --surface-alt: #0f0f0f;
    --border: #2a2a2a;
    --border-strong: #3a3a3a;
    --primary: #ffffff;
    --primary-soft: rgba(255, 255, 255, 0.08);

    /* Cores semânticas — manter saturação, ajustar background */
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #60a5fa;
}

/* Prefixos específicos de módulo: nfe, svc, br, pm, hris */
[data-theme="dark"] [class*="-module"]:not([data-module-theme="light"]) {
    /* nfe-* */

    --nfe-ink-soft: #c7c7c7;
    --nfe-ink-muted: #8b8b8b;
    --nfe-surface: #161616;
    --nfe-surface-alt: #0f0f0f;
    --nfe-border: #2a2a2a;
    --nfe-border-strong: #3a3a3a;
    --nfe-primary: #ffffff;
    --nfe-primary-soft: rgba(255, 255, 255, 0.08);

    /* svc-* */
    --svc-ink: #f3f4f6;
    --svc-ink-soft: #c7c7c7;
    --svc-ink-muted: #8b8b8b;
    --svc-surface: #161616;
    --svc-surface-alt: #0f0f0f;
    --svc-border: #2a2a2a;
    --svc-border-strong: #3a3a3a;
    --svc-primary: #ffffff;
    --svc-primary-soft: rgba(255, 255, 255, 0.08);
    --svc-on-primary: #0f0f0f;
    /* texto sobre svc-primary (que vira #fff em dark) */
    --svc-on-ink: #0f0f0f;
    /* texto sobre svc-ink (que vira #f3f4f6 em dark) */
    --svc-info-surface: rgba(99, 102, 241, 0.14);
    --svc-info-border: rgba(99, 102, 241, 0.28);
    --svc-info-ink: #c7d2fe;
    --svc-selection-surface: rgba(255, 255, 255, 0.06);
    --svc-selection-surface-strong: rgba(255, 255, 255, 0.10);
    --svc-selection-border: rgba(255, 255, 255, 0.12);
    --svc-selection-border-strong: rgba(255, 255, 255, 0.22);
    --svc-warning-surface: rgba(247, 144, 9, 0.14);
    --svc-proposal-surface: linear-gradient(135deg, rgba(247, 144, 9, 0.18), rgba(247, 144, 9, 0.08));

    /* br-* (bank reconciliation) */
    --br-ink: #f3f4f6;
    --br-ink-soft: #c7c7c7;
    --br-ink-muted: #8b8b8b;
    --br-surface: #161616;
    --br-surface-alt: #0f0f0f;
    --br-border: #2a2a2a;
    --br-border-strong: #3a3a3a;
    --br-primary: #ffffff;
    --br-primary-soft: rgba(255, 255, 255, 0.08);

    /* pm-* (planogram) */
    --pm-ink: #f3f4f6;
    --pm-ink-soft: #c7c7c7;
    --pm-ink-muted: #8b8b8b;
    --pm-surface: #161616;
    --pm-surface-alt: #0f0f0f;
    --pm-border: #2a2a2a;
    --pm-border-strong: #3a3a3a;
    --pm-primary: #ffffff;
    --pm-primary-soft: rgba(255, 255, 255, 0.08);

    /* hris-* */
    --hris-ink: #f3f4f6;
    --hris-ink-soft: #c7c7c7;
    --hris-ink-muted: #8b8b8b;
    --hris-surface: #161616;
    --hris-surface-alt: #0f0f0f;
    --hris-border: #2a2a2a;
    --hris-border-strong: #3a3a3a;
    --hris-primary: #ffffff;
    --hris-primary-soft: rgba(255, 255, 255, 0.08);
}

/* ---------- 4. Reset hardcoded de cores claras em fundos comuns ---------- */
[data-theme="dark"] [class*="-module"]:not([data-module-theme="light"]) .module-toolbar,
[data-theme="dark"] [class*="-module"]:not([data-module-theme="light"]) .dashboard-layout,
[data-theme="dark"] [class*="-module"]:not([data-module-theme="light"]) .voyger-card,
[data-theme="dark"] [class*="-module"]:not([data-module-theme="light"]) .card {
    background-color: var(--surface, #161616);
    color: var(--ink, #f3f4f6);
}

/* Tabelas/listas em grid: header bar */
[data-theme="dark"] [class*="-module"]:not([data-module-theme="light"]) .grid-header,
[data-theme="dark"] [class*="-module"]:not([data-module-theme="light"]) .list-header,
[data-theme="dark"] [class*="-module"]:not([data-module-theme="light"]) thead,
[data-theme="dark"] [class*="-module"]:not([data-module-theme="light"]) thead th {
    background-color: #1a1a1a;
    color: #c7c7c7;
}

[data-theme="dark"] [class*="-module"]:not([data-module-theme="light"]) tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

/* Inputs/forms */
[data-theme="dark"] [class*="-module"]:not([data-module-theme="light"]) input:not([type="color"]):not([type="checkbox"]):not([type="radio"]),
[data-theme="dark"] [class*="-module"]:not([data-module-theme="light"]) select,
[data-theme="dark"] [class*="-module"]:not([data-module-theme="light"]) textarea {
    background-color: #1a1a1a;
    color: #f3f4f6;
    border-color: #2f2f2f;
}

[data-theme="dark"] [class*="-module"]:not([data-module-theme="light"]) input:focus,
[data-theme="dark"] [class*="-module"]:not([data-module-theme="light"]) select:focus,
[data-theme="dark"] [class*="-module"]:not([data-module-theme="light"]) textarea:focus {
    border-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
    outline: none;
}

/* ---------- 5. Header e elementos globais do dashboard ---------- */
[data-theme="dark"] .dashboard-header,
[data-theme="dark"] .top-header,
[data-theme="dark"] .voyger-tab-bar {
    background-color: #0f0f0f;
    color: #e5e7eb;
    border-color: #1f1f1f;
}

/* Shell principal — fundo cinza claro hardcoded em dashboard.css
   (#f4f6f9, lines 282/668). Sem isso, o "fundão" entre sidebar e
   conteúdo continua claro mesmo em dark mode. */
[data-theme="dark"] .dashboard-main {
    background-color: #0a0a0a;
}

[data-theme="dark"] .content-placeholder {
    background-color: #161616;
    color: #f3f4f6;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .content-placeholder h2 {
    color: #f3f4f6;
}

/* Scrollbars do dashboard-main (dashboard.css 793-859 com #cacaca/#999) */
[data-theme="dark"] .dashboard-main::-webkit-scrollbar-track {
    background: #0a0a0a !important;
}

[data-theme="dark"] .dashboard-main::-webkit-scrollbar-thumb {
    background: #2f2f2f !important;
}

[data-theme="dark"] .dashboard-main::-webkit-scrollbar-thumb:hover {
    background: #3f3f3f !important;
}

[data-theme="dark"] .voyger-tab {
    background-color: #161616;
    color: #c7c7c7;
    border-color: #2a2a2a;
}

[data-theme="dark"] .voyger-tab.active {
    background-color: #ffffff;
    color: #0f0f0f;
}

/* ---------- 6. Reset de opt-out por módulo ----------
 *  Quando um container individual carrega
 *  [data-module-theme="light"], todas as variáveis voltam para
 *  os valores claros — assim o módulo continua claro mesmo com o
 *  resto da app em dark.
 * ----------------------------------------------------- */
[data-theme="dark"] [data-module-theme="light"] {
    --color-primary: #000000;
    --color-primary-dark: #1a1a1a;
    --color-primary-light: #333333;
    --color-secondary: #666666;
    --color-secondary-dark: #4d4d4d;
    --color-accent: #ffffff;
    --color-accent-dark: #f5f5f5;
    --color-black: #000000;
    --color-dark: #1a1a1a;
    --color-gray-dark: #333333;
    --color-gray: #666666;
    --color-gray-light: #999999;
    --color-gray-lighter: #cccccc;
    --color-white-dark: #f5f5f5;
    --color-white: #ffffff;

    --ink: #111111;
    --ink-soft: #4d4d4d;
    --ink-muted: #8b8b8b;
    --surface: #ffffff;
    --surface-alt: #f6f6f6;
    --border: #e4e4e4;
    --border-strong: #cacaca;
    --primary: #111111;
    --primary-soft: rgba(17, 17, 17, 0.08);

    background-color: #ffffff;
    color: #111111;
}

/* Garante que filhos diretos voltem para tons claros */
[data-theme="dark"] [data-module-theme="light"] .module-toolbar,
[data-theme="dark"] [data-module-theme="light"] .dashboard-layout,
[data-theme="dark"] [data-module-theme="light"] .voyger-card,
[data-theme="dark"] [data-module-theme="light"] .card {
    background-color: #ffffff;
    color: #111111;
}

/* =================================================================
 *  PHASE 1 — Módulos certificados (Visão & Vendas)
 *  -----------------------------------------------------------------
 *  Cada bloco abaixo só sobrescreve TOKENS LOCAIS dos módulos —
 *  nenhuma estrutura visual é alterada, apenas a paleta. Como o
 *  módulo já consome esses tokens via var(--xx-*), tudo herda.
 * ================================================================= */

/* Scrollbar global em dark (cobre overview, mdm, analytics e demais) */
[data-theme="dark"] ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #0f0f0f;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #2f2f2f;
    border-radius: 999px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #3f3f3f;
}

/* ---- Overview (--ov-*) ---- */
[data-theme="dark"] .overview-module:not([data-module-theme="light"]) {
    --ov-ink: #f3f4f6;
    --ov-ink-soft: #c7c7c7;
    --ov-ink-muted: #8b8b8b;
    --ov-surface: #161616;
    --ov-surface-alt: #0f0f0f;
    --ov-surface-soft: rgba(22, 22, 22, 0.88);
    --ov-border: #2a2a2a;
    --ov-border-strong: #3a3a3a;
    --ov-primary: #ffffff;
    --ov-primary-soft: rgba(255, 255, 255, 0.08);
    --ov-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.45);
    --ov-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.6);
}

/* ---- MDM (--mdm-*) ---- */
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) {
    --mdm-ink: #f3f4f6;
    --mdm-ink-soft: #c7c7c7;
    --mdm-ink-muted: #8b8b8b;
    --mdm-surface: #161616;
    --mdm-surface-alt: #0f0f0f;
    --mdm-surface-soft: rgba(22, 22, 22, 0.88);
    --mdm-border: #2a2a2a;
    --mdm-border-strong: #3a3a3a;
    --mdm-primary: #ffffff;
    --mdm-primary-soft: rgba(255, 255, 255, 0.08);
    --mdm-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.45);
    --mdm-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.6);
}

/* ---- Discount Rules (--dr-*) ---- */
[data-theme="dark"] .dr-module:not([data-module-theme="light"]),
[data-theme="dark"] .discount-rules-module:not([data-module-theme="light"]),
[data-theme="dark"] .dr-modal {
    --dr-ink: #f3f4f6;
    --dr-ink-soft: #c7c7c7;
    --dr-ink-muted: #8b8b8b;
    --dr-surface: #161616;
    --dr-surface-alt: #0f0f0f;
    --dr-surface-soft: rgba(22, 22, 22, 0.88);
    --dr-border: #2a2a2a;
    --dr-border-strong: #3a3a3a;
    --dr-primary: #ffffff;
    --dr-primary-soft: rgba(255, 255, 255, 0.08);
    --dr-on-primary: #0f0f0f;
    --dr-on-ink: #0f0f0f;
    --dr-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.45);
    --dr-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.6);
}

/* ---- Vendas Config (--vc-*) ---- */
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) {
    --vc-ink: #f3f4f6;
    --vc-ink-soft: #c7c7c7;
    --vc-ink-muted: #8b8b8b;
    --vc-surface: #161616;
    --vc-surface-alt: #0f0f0f;
    --vc-border: #2a2a2a;
    --vc-border-strong: #3a3a3a;
    --vc-primary: #ffffff;
    --vc-primary-soft: rgba(255, 255, 255, 0.08);
    --vc-on-primary: #0f0f0f;
    --vc-on-ink: #0f0f0f;
    --vc-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.45);
    --vc-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.6);
}

/* Hero do Overview: o background usa var(--ov-ink) que já invertemos
   acima (#f3f4f6 em dark). Mas o hero precisa ser ESCURO em dark mode
   para manter a estética premium. Forçamos um gradiente escuro. */
[data-theme="dark"] .overview-module:not([data-module-theme="light"]) .overview-welcome-hero {
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
    color: #f3f4f6;
    border: 1px solid #2a2a2a;
}

/* Hero do MDM (mesma estratégia) */
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) .mdm-hero,
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) [class*="hero"] {
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
    color: #f3f4f6;
    border: 1px solid #2a2a2a;
}

/* ---- CRM (--crm-*) ---- */
[data-theme="dark"] .crm-module:not([data-module-theme="light"]),
[data-theme="dark"] .crm-prosp-drawer,
[data-theme="dark"] .crmv2-modal,
[data-theme="dark"] .crm-prosp-modal {
    --crm-bg: #0a0a0a;
    --crm-surface: #161616;
    --crm-surface-2: #1a1a1a;
    --crm-border: #2a2a2a;
    --crm-border-strong: #3a3a3a;
    --crm-text: #f3f4f6;
    --crm-text-soft: #c7c7c7;
    --crm-text-muted: #8b8b8b;
    --crm-text-dim: #666666;
    --crm-success: #34d399;
    --crm-success-soft: rgba(52, 211, 153, 0.1);
    --crm-warn: #fbbf24;
    --crm-warn-soft: rgba(251, 191, 36, 0.1);
    --crm-danger: #f87171;
    --crm-danger-soft: rgba(248, 113, 113, 0.1);
    --crm-info: #60a5fa;
    --crm-info-soft: rgba(96, 165, 250, 0.1);
}

/* =================================================================
 *  PHASE 2 — Módulos com hardcoding pontual
 * ================================================================= */

/* ---- Analytics (--bi-*) ---- */
[data-theme="dark"] .bi-module:not([data-module-theme="light"]),
[data-theme="dark"] .analytics-module:not([data-module-theme="light"]) {
    --bi-ink: #f3f4f6;
    --bi-ink-soft: #c7c7c7;
    --bi-ink-muted: #8b8b8b;
    --bi-surface: #161616;
    --bi-surface-alt: #0f0f0f;
    --bi-border: #2a2a2a;
    --bi-border-strong: #3a3a3a;
    --bi-primary: #ffffff;
    --bi-primary-soft: rgba(255, 255, 255, 0.08);
    --bi-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.45);
    --bi-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.6);
}

/* Hero do Analytics tem #111111 hardcoded — overrider */
[data-theme="dark"] .bi-module:not([data-module-theme="light"]) .bi-hero,
[data-theme="dark"] .analytics-module:not([data-module-theme="light"]) .bi-hero {
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%) !important;
    color: #f3f4f6;
    border: 1px solid #2a2a2a;
}

/* ---- Cotacao / CPQ (--cpq-*) ---- */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]),
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]),
[data-theme="dark"] #modal-cotacao,
[data-theme="dark"] #modal-cpq-config {
    --cpq-ink: #f3f4f6;
    --cpq-ink-soft: #c7c7c7;
    --cpq-ink-muted: #8b8b8b;
    --cpq-surface: #161616;
    --cpq-surface-alt: #0f0f0f;
    --cpq-border: #2a2a2a;
    --cpq-border-strong: #3a3a3a;
    --cpq-primary: #ffffff;
    --cpq-primary-soft: rgba(255, 255, 255, 0.08);
    --cpq-on-primary: #0f0f0f;
    --cpq-on-ink: #0f0f0f;
    --cpq-bg: #0d0d0d;
    --cpq-card: #161616;
    --cpq-text: #f3f4f6;
    --cpq-text-muted: #8b8b8b;
    --cpq-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.45);
    --cpq-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.6);
}

/* Modais do CPQ injetados no body (fora do .cotacao-module) — o módulo
   abre quick-modal no body, então também escopamos por [data-theme] */
[data-theme="dark"] .cpq-quick-modal {
    background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .cpq-quick-modal .btn-cotacao-secondary {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2f2f2f !important;
}

[data-theme="dark"] .cpq-quick-modal .btn-cotacao-primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .cpq-quick-modal .modal-content,
[data-theme="dark"] .cpq-quick-modal .modal-body,
[data-theme="dark"] .cpq-quick-modal .modal-header,
[data-theme="dark"] .cpq-quick-modal .modal-footer {
    background: #161616;
    color: #f3f4f6;
    border-color: #2a2a2a;
}

/* Pipeline steps (Rascunho/Enviada/Aprovada/Recusada/Cancelada) */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-pipeline-step,
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) [class*="pipeline"] {
    background: #1a1a1a;
    color: #c7c7c7;
    border-color: #2a2a2a;
}

/* ---- Servico (--svc-*) — fixes pontuais ---- */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-company-strip {
    background: linear-gradient(140deg, #161616 0%, #1a1a1a 100%) !important;
    border-color: #2a2a2a;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-logo-wrap {
    background: #1a1a1a !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-btn-primary {
    background: #ffffff;
    color: #0f0f0f;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-btn-primary:hover {
    background: #e5e5e5 !important;
    color: #0f0f0f;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-hero,
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) [class*="hero"] {
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%) !important;
    color: #f3f4f6;
}

/* ---- PCP Planning / Shop Floor (--pcp-* / --sf-*) ---- */
[data-theme="dark"] .pcp-module:not([data-module-theme="light"]) {
    --pcp-ink: #f3f4f6;
    --pcp-ink-soft: #c7c7c7;
    --pcp-ink-muted: #9ca3af;
    --pcp-surface: #161616;
    --pcp-surface-alt: #0f0f0f;
    --pcp-border: #2a2a2a;
    --pcp-border-strong: #3a3a3a;
    --pcp-accent: var(--vt-primary, #ffffff);
    --pcp-accent-soft: var(--vt-primary-soft, rgba(255, 255, 255, 0.12));
    --pcp-accent-softer: var(--vt-primary-softer, rgba(255, 255, 255, 0.06));
    --pcp-accent-hover: var(--vt-primary-hover, #e5e7eb);
    --pcp-text-on-accent: var(--vt-text-on-primary, #0f0f0f);
    --pcp-s-rascunho: #cbd5e1;
    --pcp-s-aguardando: #e5e7eb;
    --pcp-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.45);
    --pcp-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.6);
    --pcp-shadow-card: 0 4px 14px rgba(0, 0, 0, 0.28);
}

[data-theme="dark"] .sf-module:not([data-module-theme="light"]) {
    --sf-ink: #f3f4f6;
    --sf-ink-soft: #c7c7c7;
    --sf-ink-muted: #9ca3af;
    --sf-surface: #161616;
    --sf-surface-alt: #0f0f0f;
    --sf-border: #2a2a2a;
    --sf-border-strong: #3a3a3a;
    --sf-accent: var(--vt-primary, #ffffff);
    --sf-accent-soft: var(--vt-primary-soft, rgba(255, 255, 255, 0.12));
    --sf-accent-softer: var(--vt-primary-softer, rgba(255, 255, 255, 0.06));
    --sf-accent-hover: var(--vt-primary-hover, #e5e7eb);
    --sf-text-on-accent: var(--vt-text-on-primary, #0f0f0f);
    --sf-s-rascunho: #cbd5e1;
    --sf-s-aguardando: #e5e7eb;
    --sf-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.45);
    --sf-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.6);
    --sf-shadow-card: 0 4px 14px rgba(0, 0, 0, 0.28);
}

[data-theme="dark"] .pcp-module:not([data-module-theme="light"]),
[data-theme="dark"] .sf-module:not([data-module-theme="light"]) {
    background: var(--surface-alt, #0f0f0f);
    color: var(--ink, #f3f4f6);
    color-scheme: dark;
}

[data-theme="dark"] .pcp-module:not([data-module-theme="light"]) .pcp-input,
[data-theme="dark"] .pcp-module:not([data-module-theme="light"]) .pcp-select,
[data-theme="dark"] .pcp-module:not([data-module-theme="light"]) .pcp-textarea,
[data-theme="dark"] .sf-module:not([data-module-theme="light"]) .sf-input,
[data-theme="dark"] .sf-module:not([data-module-theme="light"]) .sf-select,
[data-theme="dark"] .sf-module:not([data-module-theme="light"]) .sf-textarea {
    color-scheme: dark;
}

[data-theme="dark"] .pcp-module:not([data-module-theme="light"]) .pcp-select option,
[data-theme="dark"] .sf-module:not([data-module-theme="light"]) .sf-select option {
    background: #161616;
    color: #f3f4f6;
}

[data-theme="dark"] .pcp-module:not([data-module-theme="light"]) .pcp-pill-RASCUNHO,
[data-theme="dark"] .pcp-module:not([data-module-theme="light"]) .pcp-pill-OBSOLETA {
    background: rgba(203, 213, 225, 0.12);
    color: #cbd5e1;
}

[data-theme="dark"] .pcp-module:not([data-module-theme="light"]) .pcp-pill-AGUARDANDO_INICIO {
    background: rgba(255, 255, 255, 0.08);
    color: #e5e7eb;
}

[data-theme="dark"] .pcp-module:not([data-module-theme="light"]) .pcp-prio-BAIXA {
    background: rgba(203, 213, 225, 0.12);
    color: #cbd5e1;
}

[data-theme="dark"] .pcp-module:not([data-module-theme="light"]) .pcp-op-card:hover,
[data-theme="dark"] .pcp-module:not([data-module-theme="light"]) .pcp-ficha-card:hover {
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .pcp-module:not([data-module-theme="light"]) .pcp-op-card__top--no-photo {
    background: linear-gradient(
        135deg,
        rgba(var(--vt-primary-r, 255), var(--vt-primary-g, 255), var(--vt-primary-b, 255), 0.24) 0%,
        #0f0f0f 100%
    );
}

[data-theme="dark"] .pcp-module:not([data-module-theme="light"]) .pcp-op-card__top--no-photo .pcp-op-card__initial {
    color: rgba(255, 255, 255, 0.18);
}

[data-theme="dark"] .pcp-module:not([data-module-theme="light"]) .pcp-kanban-step__num {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .pcp-module:not([data-module-theme="light"]) .pcp-kanban-step:hover .pcp-kanban-step__num {
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .pcp-module:not([data-module-theme="light"]) .pcp-modal-overlay,
[data-theme="dark"] .pcp-module:not([data-module-theme="light"]) .pcp-drawer-overlay {
    background: rgba(0, 0, 0, 0.58);
}

[data-theme="dark"] .pcp-module:not([data-module-theme="light"]) .pcp-drawer {
    box-shadow: -10px 0 36px rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .sf-module:not([data-module-theme="light"]) .sf-status-RASCUNHO {
    background: rgba(203, 213, 225, 0.12);
    color: #cbd5e1;
}

[data-theme="dark"] .sf-module:not([data-module-theme="light"]) .sf-status-AGUARDANDO_INICIO {
    background: rgba(255, 255, 255, 0.08);
    color: #e5e7eb;
}

[data-theme="dark"] .sf-module:not([data-module-theme="light"]) .sf-prioridade-BAIXA {
    background: rgba(203, 213, 225, 0.12);
    color: #cbd5e1;
}

[data-theme="dark"] .sf-module:not([data-module-theme="light"]) .sf-op-card:hover {
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .sf-module:not([data-module-theme="light"]) .sf-pause-banner {
    background: rgba(247, 144, 9, 0.1);
    border-color: rgba(247, 144, 9, 0.32);
}

[data-theme="dark"] .sf-module:not([data-module-theme="light"]) .sf-action-bar {
    box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .sf-module:not([data-module-theme="light"]) .sf-modal-overlay {
    background: rgba(0, 0, 0, 0.58);
}

[data-theme="dark"] .sf-module:not([data-module-theme="light"]) .sf-reason-btn:hover {
    background: rgba(247, 144, 9, 0.08);
}

[data-theme="dark"] .sf-module:not([data-module-theme="light"]) .sf-reason-btn.selected {
    background: rgba(247, 144, 9, 0.14);
}

/* =================================================================
 *  PHASE 4 — Refinamentos críticos (chrome global + bugs visuais)
 *  -----------------------------------------------------------------
 *  Cobre:
 *  - Header global (.dashboard-header) e seus sub-componentes
 *  - Variáveis do dashboard-modal (todos modais Voyger)
 *  - Notification dropdown
 *  - Cotacao: action buttons / pipeline-aprovada / trend-bars
 *    (eram --cpq-ink que virou claro → branco-no-branco)
 *  - Servico: .svc-tab.active / .svc-company-strip / hero buttons
 * ================================================================= */

/* ---- 4.1  Header global ---- */
[data-theme="dark"] .dashboard-header {
    background-color: #0f0f0f;
    border-bottom-color: #2a2a2a;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .dashboard-breadcrumb {
    color: #a8a8a8;
}

[data-theme="dark"] .breadcrumb-category {
    color: #8b8b8b;
}

[data-theme="dark"] .breadcrumb-separator {
    color: #555;
}

[data-theme="dark"] .breadcrumb-module {
    color: #f3f4f6;
}

[data-theme="dark"] .header-left #module-title {
    color: #f3f4f6;
}

[data-theme="dark"] .mobile-menu-toggle {
    color: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .mobile-menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

/* Search bar */
[data-theme="dark"] .search-bar input {
    background-color: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: #f3f4f6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .search-bar input:focus {
    background-color: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .search-bar > i {
    color: rgba(255, 255, 255, 0.55);
}

[data-theme="dark"] .search-bar input:focus + i {
    color: #ffffff;
}

[data-theme="dark"] .search-bar input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

/* Notifications */
[data-theme="dark"] .notifications:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .notifications i {
    color: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .notifications:hover i {
    color: #ffffff;
}

/* Notification dropdown panel */
[data-theme="dark"] .notification-dropdown {
    background: #161616 !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6;
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .notification-dropdown .notification-header,
[data-theme="dark"] .notification-dropdown .notification-footer {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6;
}

[data-theme="dark"] .notification-dropdown .notification-item {
    background: #161616 !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6 !important;
}

[data-theme="dark"] .notification-dropdown .notification-item:hover {
    background: #1f1f1f !important;
}

[data-theme="dark"] .notification-dropdown .notification-item.unread {
    background: rgba(59, 130, 246, 0.08) !important;
}

[data-theme="dark"] .notification-dropdown .notification-text,
[data-theme="dark"] .notification-dropdown .notification-title {
    color: #f3f4f6 !important;
}

[data-theme="dark"] .notification-dropdown .notification-time,
[data-theme="dark"] .notification-dropdown .notification-empty {
    color: #8b8b8b !important;
}

/* User profile pill */
[data-theme="dark"] .user-profile {
    color: #f3f4f6;
}

[data-theme="dark"] .user-profile:hover,
[data-theme="dark"] .user-profile:focus-visible,
[data-theme="dark"] .user-profile.active,
[data-theme="dark"] .user-profile-shell.panel-open .user-profile {
    background-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .header-branch-toggle {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
    color: #f3f4f6;
}

[data-theme="dark"] .header-branch-toggle:hover {
    border-color: rgba(96, 165, 250, 0.35);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.34);
}

[data-theme="dark"] .header-branch-toggle:focus-visible,
[data-theme="dark"] .header-branch-switcher.active .header-branch-toggle {
    border-color: rgba(96, 165, 250, 0.42);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.16), 0 14px 28px rgba(0, 0, 0, 0.34);
}

[data-theme="dark"] .header-branch-toggle-icon {
    background: rgba(59, 130, 246, 0.16);
    color: #93c5fd;
}

[data-theme="dark"] .header-branch-option-media {
    background: rgba(59, 130, 246, 0.16);
    border-color: rgba(96, 165, 250, 0.16);
    color: #93c5fd;
}

[data-theme="dark"] .header-branch-toggle-icon.has-logo,
[data-theme="dark"] .header-branch-option-media.has-logo {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .header-branch-toggle-icon.is-loading,
[data-theme="dark"] .header-branch-option-media.is-loading {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(148, 163, 184, 0.14);
}

[data-theme="dark"] .header-branch-toggle-icon.is-loading::after,
[data-theme="dark"] .header-branch-option-media.is-loading::after {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(148, 163, 184, 0.14));
}

[data-theme="dark"] .header-branch-logo,
[data-theme="dark"] .header-branch-option-logo {
    background: rgba(255, 255, 255, 0.96);
}

[data-theme="dark"] .header-branch-toggle-label,
[data-theme="dark"] .header-branch-toggle-meta,
[data-theme="dark"] .header-branch-toggle-chevron,
[data-theme="dark"] .header-branch-empty,
[data-theme="dark"] .header-branch-option-meta {
    color: #9ca3af;
}

[data-theme="dark"] .header-branch-toggle-name,
[data-theme="dark"] .header-branch-option-name {
    color: #f3f4f6;
}

[data-theme="dark"] .header-branch-menu {
    background: #161616;
    border-color: #2a2a2a;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .header-branch-option:hover {
    background: #1f1f1f;
}

[data-theme="dark"] .header-branch-option.is-active {
    background: rgba(59, 130, 246, 0.14);
}

[data-theme="dark"] .header-branch-option-action {
    background: rgba(17, 24, 39, 0.74);
    border-color: rgba(75, 85, 99, 0.42);
    color: #d1d5db;
}

[data-theme="dark"] .header-branch-option-action:hover,
[data-theme="dark"] .header-branch-option-action:focus-visible {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(96, 165, 250, 0.28);
    color: #eff6ff;
}

[data-theme="dark"] .header-branch-editor-chip,
[data-theme="dark"] .header-branch-editor-close {
    background: rgba(3, 7, 18, 0.8);
    border-color: rgba(148, 163, 184, 0.18);
    color: #f3f4f6;
}

[data-theme="dark"] .header-branch-editor-chip-label {
    color: rgba(191, 219, 254, 0.7);
}

/* Global search results panel */
[data-theme="dark"] .global-search-results {
    --search-bg: #161616;
    --search-bg-hover: #1e1e1e;
    --search-bg-active: #252525;
    --search-border: #2a2a2a;
    --search-shadow: rgba(0, 0, 0, 0.55);
    --search-shadow-hover: rgba(0, 0, 0, 0.65);
    --search-text-primary: #f3f4f6;
    --search-text-secondary: #d1d5db;
    --search-text-muted: #9ca3af;
    --search-text-accent: #ffffff;
    --search-icon-bg: #f3f4f6;
    --search-icon-help: #2f2f2f;
    --search-icon-color: #111111;
    --search-highlight: #2b2b2b;
    --search-highlight-text: #ffffff;
    background: #161616 !important;
    color: #f3f4f6;
    border-color: #2a2a2a;
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .global-search-results .search-result-item:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.38);
}

[data-theme="dark"] .global-search-results .search-result-title,
[data-theme="dark"] .global-search-results .search-result-description,
[data-theme="dark"] .global-search-results .search-results-section-title,
[data-theme="dark"] .global-search-results .search-result-arrow {
    color: inherit;
}

[data-theme="dark"] .global-search-results .search-results-list::-webkit-scrollbar-thumb {
    background: #333333;
}

[data-theme="dark"] .global-search-results .search-results-list::-webkit-scrollbar-track {
    background: #161616;
}

/* ---- 4.2  Dashboard modal (variáveis globais) ---- */
/* Sobrescreve as :root --dm-* — afeta TODOS os modais
   (Personalizar Dashboard, modais utilitários, etc.) */
:root[data-theme="dark"] {
    --dm-overlay-bg: rgba(0, 0, 0, 0.78);
    --dm-content-bg: #161616;
    --dm-header-gradient: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
    --dm-header-text: #f3f4f6;
    --dm-body-bg: #161616;
    --dm-footer-bg: #1a1a1a;
    --dm-border-color: #2a2a2a;
}

[data-theme="dark"] .dashboard-modal-content,
[data-theme="dark"] .dashboard-modal .modal-content {
    background: #161616;
    color: #f3f4f6;
    border: 1px solid #2a2a2a;
}

[data-theme="dark"] .dashboard-modal .modal-body {
    color: #f3f4f6;
}

[data-theme="dark"] .dashboard-modal .modal-body::-webkit-scrollbar-thumb {
    background: #2f2f2f;
}

[data-theme="dark"] .dashboard-modal .modal-body::-webkit-scrollbar-track {
    background: #0f0f0f;
}

/* Botão primário do dashboard-modal: o gradiente já fica preto/cinza
   no light, em dark vira igual ao header (escuro com texto branco).
   Forçamos texto branco visível. */
[data-theme="dark"] .dashboard-modal .btn-primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border: 1px solid #ffffff !important;
}

[data-theme="dark"] .dashboard-modal .btn-primary:hover {
    background: #e5e5e5 !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .dashboard-modal .btn-secondary {
    background: #1f1f1f !important;
    color: #f3f4f6 !important;
    border: 1px solid #2f2f2f !important;
}

[data-theme="dark"] .dashboard-modal .btn-secondary:hover {
    background: #2a2a2a !important;
}

/* Inputs/Selects/Textareas dentro de qualquer dashboard-modal */
[data-theme="dark"] .dashboard-modal input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
[data-theme="dark"] .dashboard-modal select,
[data-theme="dark"] .dashboard-modal textarea {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2f2f2f !important;
}

[data-theme="dark"] .dashboard-modal label,
[data-theme="dark"] .dashboard-modal .form-label,
[data-theme="dark"] .dashboard-modal h3,
[data-theme="dark"] .dashboard-modal h4 {
    color: #f3f4f6 !important;
}

/* Tabs dentro do dashboard-modal (Layout / Widgets / Seções) */
[data-theme="dark"] .dashboard-modal .modal-tabs,
[data-theme="dark"] .dashboard-modal [class*="tabs"] {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .dashboard-modal .modal-tab,
[data-theme="dark"] .dashboard-modal .tab-btn,
[data-theme="dark"] .dashboard-modal [class*="tab-"]:not(.tab-content):not(.tab-pane) {
    color: #c7c7c7;
    /* RC2 fix — dashboard-modal.css hardcodes background: #ffffff on .modal-tab */
    background: #1a1a1a !important;
    border-color: #2f2f2f !important;
}

[data-theme="dark"] .dashboard-modal .modal-tab.active,
[data-theme="dark"] .dashboard-modal .tab-btn.active {
    background: #161616 !important;
    color: #ffffff !important;
    border-bottom-color: #ffffff !important;
    border-color: #3a3a3a !important;
}

/* RC4 fix — .form-section uses --sm-color-surface (module-scoped var, not
   available in modal context as modal is a sibling of .suppliers-module) */
[data-theme="dark"] .dashboard-modal .form-section,
[data-theme="dark"] .dashboard-modal .pm-form-section {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6 !important;
}

/* Cards de "seção" toggle */
[data-theme="dark"] .dashboard-modal .section-row,
[data-theme="dark"] .dashboard-modal [class*="section-card"],
[data-theme="dark"] .dashboard-modal [class*="section-item"] {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6 !important;
}

/* ---- 4.3  Cotacao — action buttons / pipeline / trend bars ---- */
/* Quick-action cards (LISTAR / NOVA / RELATÓRIOS / APROVAR E FATURAR)
   usavam var(--cpq-ink) como fundo + color:#fff. Em dark, --cpq-ink
   virou #f3f4f6 (texto claro), causando branco-no-branco.
   Forçamos um fundo dark distinto e mantemos o texto branco. */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-ov-action-btn,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-ov-action-btn {
    background: linear-gradient(135deg, #1f1f1f 0%, #161616 100%) !important;
    border-color: #2f2f2f !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-ov-action-btn:hover,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-ov-action-btn:hover {
    background: linear-gradient(135deg, #262626 0%, #1c1c1c 100%) !important;
    border-color: #3a3a3a !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-ov-action-btn::before,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-ov-action-btn::before {
    background: rgba(255, 255, 255, 0.10);
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-ov-action-btn-icon,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-ov-action-btn-icon {
    background: rgba(255, 255, 255, 0.10);
    color: #ffffff !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-ov-action-btn-label,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-ov-action-btn-label {
    color: #ffffff !important;
}

/* Pipeline (Rascunho/Enviada/Aprovada/Recusada/Cancelada) */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-ov-pipe-rascunho,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-ov-pipe-rascunho {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #c7c7c7 !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-ov-pipe-enviada,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-ov-pipe-enviada {
    background: rgba(255, 255, 255, 0.14) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-ov-pipe-aprovada,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-ov-pipe-aprovada {
    background: linear-gradient(135deg, #ffffff 0%, #e5e5e5 100%) !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-ov-pipe-aprovada *,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-ov-pipe-aprovada * {
    color: #0f0f0f !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-ov-pipe-recusada,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-ov-pipe-recusada {
    background: rgba(255, 255, 255, 0.10) !important;
    color: #d8d8d8 !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-ov-pipe-cancelada,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-ov-pipe-cancelada {
    background: rgba(255, 255, 255, 0.04) !important;
    color: #8b8b8b !important;
}

/* Trend bars (TENDÊNCIA MENSAL) — usavam var(--cpq-ink) */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-ov-trend-bar,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-ov-trend-bar {
    background: rgba(255, 255, 255, 0.30) !important;
    opacity: 0.4;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-ov-trend-bar.cpq-ov-bar-current,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-ov-trend-bar.cpq-ov-bar-current {
    background: #ffffff !important;
    opacity: 1;
}

/* ---- 4.4  Servico — tabs + hero strip + Resumo Financeiro ---- */
/* .svc-tab.active = bg: var(--svc-ink) → light em dark + color:#fff (invisível) */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-tab.active {
    background: #ffffff !important;
    color: #0f0f0f !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-tab:not(.active) .svc-tab-hint {
    background: #2a2a2a;
    color: #c7c7c7;
}

/* Hero buttons (svc-btn-hero-primary tinha bg #fff dentro do strip claro) */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-company-logo-wrap,
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-btn-hero-primary {
    background: #1f1f1f !important;
    color: #f3f4f6 !important;
}

/* "Resumo Financeiro" e cards de painel lateral em dashboard-modal
   (modal Adicionar Serviço) — texto cinza claro era invisível */
[data-theme="dark"] .dashboard-modal .svc-summary-card,
[data-theme="dark"] .dashboard-modal [class*="summary"],
[data-theme="dark"] .dashboard-modal [class*="resumo"],
[data-theme="dark"] .dashboard-modal [class*="financial"],
[data-theme="dark"] .dashboard-modal [class*="financeir"] {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6 !important;
}

[data-theme="dark"] .dashboard-modal [class*="summary"] *,
[data-theme="dark"] .dashboard-modal [class*="resumo"] *,
[data-theme="dark"] .dashboard-modal [class*="financial"] *,
[data-theme="dark"] .dashboard-modal [class*="financeir"] * {
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .dashboard-modal [class*="summary"] .text-muted,
[data-theme="dark"] .dashboard-modal [class*="resumo"] .text-muted {
    color: #8b8b8b !important;
}

/* Tabs do modal "Adicionar Serviço" (Geral/Etapas/Precificação/Fiscal) */
[data-theme="dark"] .dashboard-modal .nav-tabs,
[data-theme="dark"] .dashboard-modal .modal-body .nav-tabs,
[data-theme="dark"] .dashboard-modal .nav.nav-tabs {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .dashboard-modal .nav-tabs .nav-link,
[data-theme="dark"] .dashboard-modal .nav-link {
    color: #c7c7c7 !important;
    background: transparent !important;
    border-color: transparent !important;
}

[data-theme="dark"] .dashboard-modal .nav-tabs .nav-link:hover,
[data-theme="dark"] .dashboard-modal .nav-link:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .dashboard-modal .nav-tabs .nav-link.active,
[data-theme="dark"] .dashboard-modal .nav-link.active {
    background: #161616 !important;
    color: #ffffff !important;
    border-color: #2a2a2a #2a2a2a #161616 !important;
}

/* "Salvar Serviço" — fica desabilitado (cinza). Quando ativo, deve
   destacar com branco. Quando disabled, manter discreto. */
[data-theme="dark"] .dashboard-modal .btn-primary:disabled,
[data-theme="dark"] .dashboard-modal .btn-primary[disabled] {
    background: #2a2a2a !important;
    color: #6b6b6b !important;
    border-color: #2a2a2a !important;
    cursor: not-allowed;
}

/* =================================================================
 *  PHASE 5 — Categorias Financeiro & Compras
 *  -----------------------------------------------------------------
 *  Cobertura:
 *  - Financeiro: financeiro2 (--fin2-*), sales-report (--sr-*)
 *  - Compras:    purchases (tokens já em fase anterior),
 *                suppliers/carriers (--sm-color-*)
 *
 *  Excluído: bank-reconciliation (Contas legado, locked)
 *
 *  Padrão: tokens locais invertidos para paleta dark; onde o módulo
 *  usa --xx-primary como BG com texto #fff fixo, forçamos texto
 *  preto via seletores específicos.
 * ================================================================= */

/* ---- 5.1  Financeiro2 (--fin2-*) ---- */
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) {
    --fin2-ink: #f3f4f6;
    --fin2-ink-soft: #c7c7c7;
    --fin2-ink-muted: #8b8b8b;
    --fin2-surface: #161616;
    --fin2-surface-2: #1a1a1a;
    --fin2-surface-3: #1f1f1f;
    --fin2-surface-soft: #1a1a1a;
    --fin2-border: #2a2a2a;
    --fin2-border-strong: #3a3a3a;
    --fin2-primary: #ffffff;
    --fin2-primary-hover: #e5e5e5;
    --fin2-primary-soft: rgba(255, 255, 255, 0.08);
    --fin2-success: #22c55e;
    --fin2-warning: #fbbf24;
    --fin2-danger: #f87171;
    --fin2-info: #60a5fa;
    --fin2-shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.45);
    --fin2-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
    --fin2-shadow-lg: 0 28px 52px rgba(0, 0, 0, 0.65);
}

/* Onde --fin2-primary aparece como BG + texto #fff fixo */
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-nav-item.is-active,
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-btn--primary,
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-btn--primary:hover,
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-chip-btn.is-active {
    color: #0f0f0f !important;
}

[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-nav-item.is-active:hover {
    background: #e5e5e5 !important;
    color: #0f0f0f !important;
}

/* Topbar (cabeçalho do módulo) — dá moldura distinta no canvas */
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-topbar,
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-topbar-right {
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%) !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

/* Chips de status (timeline) — preserva semântica com fundo translúcido */
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-chip {
    background: rgba(255, 255, 255, 0.08);
    color: #f3f4f6;
    border-color: #2a2a2a;
}

[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-chip--branch {
    background: rgba(96, 165, 250, 0.15);
    color: #93c5fd;
}

[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-chip--env {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
}

[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-chip--provider {
    background: rgba(168, 85, 247, 0.15);
    color: #c4b5fd;
}

/* Timeline */
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-timeline-item:hover {
    background: #1f1f1f !important;
}

[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-timeline-item.pending {
    background: rgba(251, 146, 60, 0.12) !important;
    color: #fdba74 !important;
}

[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-timeline-item.success {
    background: rgba(34, 197, 94, 0.12) !important;
    color: #86efac !important;
}

/* Botão warning hover (#d97706 hardcoded no light) */
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-btn--warning {
    color: #0f0f0f !important;
}

/* ---- 5.2  Sales Report (--sr-*) ---- */
[data-theme="dark"] .sales-report-module:not([data-module-theme="light"]) {
    --sr-ink: #f3f4f6;
    --sr-ink-soft: #c7c7c7;
    --sr-ink-muted: #8b8b8b;
    --sr-surface: #161616;
    --sr-surface-alt: #0f0f0f;
    --sr-surface-soft: #1a1a1a;
    --sr-border: #2a2a2a;
    --sr-border-strong: #3a3a3a;
    --sr-primary: #ffffff;
    --sr-primary-soft: rgba(255, 255, 255, 0.08);
    --sr-success: #22c55e;
    --sr-warning: #fbbf24;
    --sr-danger: #f87171;
    --sr-info: #60a5fa;
    --sr-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.45);
    --sr-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.6);
}

/* Hero do sales-report — reforça gradiente */
[data-theme="dark"] .sales-report-module:not([data-module-theme="light"]) .sr-hero {
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%) !important;
    border: 1px solid #2a2a2a;
}

[data-theme="dark"] .sales-report-module:not([data-module-theme="light"]) .sr-btn-hero-primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .sales-report-module:not([data-module-theme="light"]) .sr-btn-hero-primary:hover {
    background: #e5e5e5 !important;
}

/* Hover do metric card era branco */
[data-theme="dark"] .sales-report-module:not([data-module-theme="light"]) .sr-metric-card.hovered,
[data-theme="dark"] .sales-report-module:not([data-module-theme="light"]) .sr-metric-card:hover {
    background: #1f1f1f !important;
    border-color: #3a3a3a !important;
}

/* ---- 5.3  Purchases — fixes adicionais (tokens já cobertos) ---- */
[data-theme="dark"] .purchases-module:not([data-module-theme="light"]) .pm-hero {
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%) !important;
    border: 1px solid #2a2a2a;
}

[data-theme="dark"] .purchases-module:not([data-module-theme="light"]) .pm-btn-hero-primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .purchases-module:not([data-module-theme="light"]) .pm-btn-hero-primary:hover {
    background: #e5e5e5 !important;
}

[data-theme="dark"] .purchases-module:not([data-module-theme="light"]) .pm-btn-hero-secondary {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .purchases-module:not([data-module-theme="light"]) .pm-filter-btn {
    background: #1a1a1a;
    border-color: #2a2a2a;
    color: #c7c7c7;
}

[data-theme="dark"] .purchases-module:not([data-module-theme="light"]) .pm-filter-btn:hover {
    background: #1f1f1f;
    color: #ffffff;
}

[data-theme="dark"] .purchases-module:not([data-module-theme="light"]) .pm-filter-btn.active {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
}

/* RC3 fix — .purchases-modal has --pm-surface/#ffffff hardcoded; dark-theme only
   overrides [class*="-module"] so .purchases-modal (no "-module") was missed */
[data-theme="dark"] .purchases-modal:not([data-module-theme="light"]) {
    --pm-surface: #161616;
    --pm-surface-alt: #0f0f0f;
    --pm-ink: #f3f4f6;
    --pm-ink-soft: #c7c7c7;
    --pm-ink-muted: #8b8b8b;
    --pm-border: #2a2a2a;
    --pm-border-strong: #3a3a3a;
    --pm-primary: #ffffff;
    --pm-primary-soft: rgba(255, 255, 255, 0.08);
    --pm-primary-hover: #e5e5e5;
}

/* ---- 5.4  Suppliers + Carriers (--sm-color-*) ---- */
[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]),
[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) {
    --sm-color-ink: #f3f4f6;
    --sm-color-ink-soft: #c7c7c7;
    --sm-color-ink-muted: #8b8b8b;
    --sm-color-surface: #161616;
    --sm-color-surface-alt: #0f0f0f;
    --sm-color-border: #2a2a2a;
    --sm-color-border-strong: #3a3a3a;
    --sm-color-primary: #ffffff;
    --sm-color-primary-soft: rgba(255, 255, 255, 0.08);
    --sm-color-success: #22c55e;
    --sm-color-warning: #fbbf24;
    --sm-color-danger: #f87171;
    --sm-color-info: #60a5fa;
    --sm-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.45);
    --sm-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.6);
    /* Fallbacks de --dashboard-* usados nesses módulos */
    --dashboard-white: #161616;
    --dashboard-white-dark: #1a1a1a;
}

/* Module header — usa --sm-color-primary como BG */
[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) .module-header,
[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) .module-header {
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%) !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) .module-header .header-actions .action-btn,
[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) .module-header .header-actions .action-btn {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.18);
    color: #ffffff !important;
}

[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) .module-header .header-actions .action-btn:hover,
[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) .module-header .header-actions .action-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) .module-header .header-actions .action-btn i,
[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) .module-header .header-actions .action-btn i {
    color: #ffffff !important;
}

/* Filter bar */
[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) .filter-bar,
[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) .filter-bar {
    background: #161616 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) .filter-bar .filter-btn,
[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) .filter-bar .filter-btn,
[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) .filter-btn {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
    color: #c7c7c7 !important;
}

[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) .filter-bar .filter-btn:hover,
[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) .filter-bar .filter-btn:hover,
[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) .filter-btn:hover {
    background: #1f1f1f !important;
    color: #ffffff !important;
    border-color: #3a3a3a !important;
}

/* Tabela / linhas (table-row hardcoded rgba(255,255,255,…) em hover) */
[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) .table-row,
[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) .table-row {
    background: #161616;
    border-color: #2a2a2a;
    color: #f3f4f6;
}

[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) .table-row:hover,
[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) .table-row:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

/* Cards / list items que usam --dashboard-* fallback */
[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) .supplier-card,
[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) .supplier-list .list-item,
[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) .carrier-card,
[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) .carrier-list .list-item {
    background: #161616 !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6 !important;
}

/* Modal próprio do supplier (não usa .dashboard-modal) */
[data-theme="dark"] .supplier-modal .modal-body,
[data-theme="dark"] .supplier-modal .modal-content,
[data-theme="dark"] .supplier-modal .modal-header,
[data-theme="dark"] .supplier-modal .modal-footer {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

/* =================================================================
 *  PHASE 6 — Refinamentos finais (Overview / MDM / Cotacao / Servico
 *           / Descontos / Vendas-Config)
 *  -----------------------------------------------------------------
 *  Causa-raiz: tokens --xx-ink/--xx-primary foram invertidos para
 *  CLARO no dark, mas vários elementos usam-nos como BG com texto
 *  #fff hardcoded. Solução: força texto preto nesses pontos.
 *  Também cobre scrollbars internos, switches, recibos e modals
 *  específicos que renderizam dentro de body (fora do escopo).
 * ================================================================= */

/* ---- 6.0  Scrollbars internos genéricos dos módulos ---- */
[data-theme="dark"] [class*="-module"]:not([data-module-theme="light"]) ::-webkit-scrollbar-thumb {
    background: #2f2f2f !important;
}

[data-theme="dark"] [class*="-module"]:not([data-module-theme="light"]) ::-webkit-scrollbar-thumb:hover {
    background: #3f3f3f !important;
}

[data-theme="dark"] [class*="-module"]:not([data-module-theme="light"]) ::-webkit-scrollbar-track {
    background: #0f0f0f !important;
}

/* =================================================================
 *  6.1  OVERVIEW — Customize panel
 * ================================================================= */
/* Header do painel "Personalizar" usa --ov-ink como BG + #fff text */
[data-theme="dark"] .overview-module:not([data-module-theme="light"]) .ov-customize-header {
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%) !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .overview-module:not([data-module-theme="light"]) .ov-customize-header * {
    color: inherit;
}

/* Preview cells (vazias e preenchidas) */
[data-theme="dark"] .overview-module:not([data-module-theme="light"]) .ov-preview-cell {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
    color: #c7c7c7 !important;
}

[data-theme="dark"] .overview-module:not([data-module-theme="light"]) .ov-preview-cell.filled {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .overview-module:not([data-module-theme="light"]) .ov-preview-cell.filled * {
    color: #0f0f0f !important;
}

/* Slots arrastáveis */
[data-theme="dark"] .overview-module:not([data-module-theme="light"]) .ov-slot {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
    color: #c7c7c7 !important;
}

[data-theme="dark"] .overview-module:not([data-module-theme="light"]) .ov-slot.filled {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .overview-module:not([data-module-theme="light"]) .ov-slot.filled * {
    color: #0f0f0f !important;
}

[data-theme="dark"] .overview-module:not([data-module-theme="light"]) .ov-slot-remove {
    background: rgba(0, 0, 0, 0.10) !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .overview-module:not([data-module-theme="light"]) .ov-slot-remove:hover {
    background: rgba(0, 0, 0, 0.20) !important;
}

/* Botão Salvar */
[data-theme="dark"] .overview-module:not([data-module-theme="light"]) .ov-btn-save {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .overview-module:not([data-module-theme="light"]) .ov-btn-save:hover {
    background: #e5e5e5 !important;
}

/* Switch slider — knob fica branco */
[data-theme="dark"] .overview-module:not([data-module-theme="light"]) .ov-switch-slider {
    background: #2a2a2a !important;
}

[data-theme="dark"] .overview-module:not([data-module-theme="light"]) .ov-switch input:checked+.ov-switch-slider,
[data-theme="dark"] .overview-module:not([data-module-theme="light"]) input:checked+.ov-switch-slider {
    background: #ffffff !important;
}

[data-theme="dark"] .overview-module:not([data-module-theme="light"]) .ov-switch-slider::after {
    background: #ffffff !important;
}

[data-theme="dark"] .overview-module:not([data-module-theme="light"]) input:checked+.ov-switch-slider::after {
    background: #0f0f0f !important;
}

/* =================================================================
 *  6.2  ANALYTICS BI — Já desativado via JS (data-module-theme=light).
 *       Defesa em CSS caso atributo não esteja presente.
 * ================================================================= */
[data-theme="dark"] .bi-module,
[data-theme="dark"] .analytics-module {
    --bi-ink: #111111;
    --bi-ink-soft: #4d4d4d;
    --bi-ink-muted: #8b8b8b;
    --bi-surface: #ffffff;
    --bi-surface-alt: #f6f6f6;
    --bi-border: #e4e4e4;
    --bi-primary: #111111;
    --bi-primary-soft: rgba(17, 17, 17, 0.08);
    background: #ffffff !important;
    color: #111111 !important;
}

/* =================================================================
 *  6.3  MDM
 * ================================================================= */
/* Botão segmentado .active usa --mdm-primary como BG */
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) .mdm-segmented-control button.active,
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) .mdm-step.active .mdm-step-number {
    color: #0f0f0f !important;
}

/* Modal do MDM (renderizado dentro do dashboard-modal) */
[data-theme="dark"] .mdm-modal-content,
[data-theme="dark"] .modal-content.dashboard-modal-content.mdm-modal-content {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .mdm-modal-content .modal-header,
[data-theme="dark"] .mdm-modal-content .modal-body,
[data-theme="dark"] .mdm-modal-content .modal-footer {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .mdm-modal-content input,
[data-theme="dark"] .mdm-modal-content select,
[data-theme="dark"] .mdm-modal-content textarea {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2f2f2f !important;
}

/* #addCompanyBtn herda --mdm-primary; força texto preto */
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) #addCompanyBtn,
[data-theme="dark"] #addCompanyBtn {
    color: #0f0f0f !important;
}

/* =================================================================
 *  6.4  COTAÇÃO — Grid completo, filtros, modals
 * ================================================================= */
/* Filter buttons — .active usava var(--cpq-ink) BG + #fff text */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-filter-btn,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-filter-btn {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
    color: #c7c7c7 !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-filter-btn:hover,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-filter-btn:hover {
    background: #1f1f1f !important;
    color: #ffffff !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-filter-btn.active,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-filter-btn.active {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-filter-btn.active *,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-filter-btn.active * {
    color: #0f0f0f !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-filter-btn-count,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-filter-btn-count {
    background: rgba(255, 255, 255, 0.10) !important;
    color: inherit !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-filter-btn.active .cpq-filter-btn-count,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-filter-btn.active .cpq-filter-btn-count {
    background: rgba(0, 0, 0, 0.12) !important;
    color: #0f0f0f !important;
}

/* Tabela / grid de cotações */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) table,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) table,
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-table,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-table {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) thead th,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) thead th {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) tbody td,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) tbody td {
    background: transparent !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) tbody tr:hover,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) tbody tr:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-row-actions button,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-row-actions button {
    background: #1f1f1f !important;
    color: #c7c7c7 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-row-actions button:hover,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-row-actions button:hover {
    background: #2a2a2a !important;
    color: #ffffff !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-grid-input,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-grid-input {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-grid-input:focus,
[data-theme="dark"] .cpq-module:not([data-module-theme="light"]) .cpq-grid-input:focus {
    border-color: #ffffff !important;
    background: #1f1f1f !important;
}

/* Modal "Fazer cotação" e "Configuração de cotação" — renderizam no body */
[data-theme="dark"] .cpq-config-modal,
[data-theme="dark"] .cpq-config-modal-content,
[data-theme="dark"] .cpq-form-modal,
[data-theme="dark"] .cpq-new-quote-modal,
[data-theme="dark"] [class*="cpq-"][class*="modal"] {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .cpq-config-modal-content *,
[data-theme="dark"] .cpq-form-modal *,
[data-theme="dark"] .cpq-new-quote-modal * {
    border-color: #2a2a2a;
    background-color: #171717 !important;
}

[data-theme="dark"] .cpq-config-modal input,
[data-theme="dark"] .cpq-config-modal select,
[data-theme="dark"] .cpq-config-modal textarea,
[data-theme="dark"] .cpq-form-modal input,
[data-theme="dark"] .cpq-form-modal select,
[data-theme="dark"] .cpq-form-modal textarea,
[data-theme="dark"] .cpq-new-quote-modal input,
[data-theme="dark"] .cpq-new-quote-modal select,
[data-theme="dark"] .cpq-new-quote-modal textarea {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2f2f2f !important;
}

[data-theme="dark"] .cpq-config-modal label,
[data-theme="dark"] .cpq-form-modal label,
[data-theme="dark"] .cpq-new-quote-modal label,
[data-theme="dark"] .cpq-config-modal h1,
[data-theme="dark"] .cpq-config-modal h2,
[data-theme="dark"] .cpq-config-modal h3,
[data-theme="dark"] .cpq-config-modal h4 {
    color: #f3f4f6 !important;
}

/* Botões padrão do cotacao quando dentro de modal */
[data-theme="dark"] .cpq-quick-modal .cpq-btn-primary,
[data-theme="dark"] .cpq-config-modal .cpq-btn-primary,
[data-theme="dark"] .cpq-form-modal .cpq-btn-primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .cpq-quick-modal .cpq-btn-primary:hover,
[data-theme="dark"] .cpq-config-modal .cpq-btn-primary:hover,
[data-theme="dark"] .cpq-form-modal .cpq-btn-primary:hover {
    background: #e5e5e5 !important;
}

/* =================================================================
 *  6.5  SERVIÇO — Hero / Tabs / Pipeline / Catálogo / Recibos
 * ================================================================= */
/* svc-hero usa var(--svc-ink) que virou CLARO em dark → reforçar dark */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-hero {
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%) !important;
    color: #f3f4f6 !important;
    border: 1px solid #2a2a2a;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-hero * {
    color: inherit;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-btn-hero-secondary {
    background: rgba(255, 255, 255, 0.10) !important;
    border-color: rgba(255, 255, 255, 0.18) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-btn-primary:hover {
    background: #e5e5e5 !important;
    color: #0f0f0f !important;
}

/* svc-tabs — container e botões */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-tabs {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-tab {
    color: #c7c7c7 !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-tab:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #ffffff !important;
}

/* Pipeline OS — step ativo */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svcos-pipe-step {
    background: #1a1a1a !important;
    color: #c7c7c7 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svcos-pipe-step.active {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svcos-pipe-step.active * {
    color: #0f0f0f !important;
}

/* Botões dentro do modal "Nova OS" */
[data-theme="dark"] [class*="svcos-"][class*="modal"],
[data-theme="dark"] .svcos-modal,
[data-theme="dark"] .svcos-form-modal {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .svcos-modal input,
[data-theme="dark"] .svcos-modal select,
[data-theme="dark"] .svcos-modal textarea,
[data-theme="dark"] [class*="svcos-"][class*="modal"] input,
[data-theme="dark"] [class*="svcos-"][class*="modal"] select,
[data-theme="dark"] [class*="svcos-"][class*="modal"] textarea {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2f2f2f !important;
}

[data-theme="dark"] .svcos-btn-primary,
[data-theme="dark"] [class*="svcos-"] .svc-btn-primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

/* Catálogo de serviços — grid */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svcat-grid,
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svcat-card,
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svcat-row,
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svcat-list {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svcat-card:hover,
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svcat-row:hover {
    background: #1f1f1f !important;
    border-color: #3a3a3a !important;
}

/* svcat-modal-tabs */
[data-theme="dark"] .svcat-modal-tabs,
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svcat-modal-tabs {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .svcat-modal-tabs button,
[data-theme="dark"] .svcat-modal-tabs .tab-btn,
[data-theme="dark"] .svcat-modal-tabs [class*="tab"] {
    color: #c7c7c7 !important;
    background: transparent !important;
}

[data-theme="dark"] .svcat-modal-tabs .active,
[data-theme="dark"] .svcat-modal-tabs button.active,
[data-theme="dark"] .svcat-modal-tabs .tab-btn.active {
    background: #161616 !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
}

/* svcat-finance-card */
[data-theme="dark"] .svcat-finance-card,
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svcat-finance-card,
[data-theme="dark"] [class*="svcat-finance"] {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .svcat-finance-card * {
    border-color: #2a2a2a;
}

/* Switches genéricos do Servico */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-switch,
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-toggle,
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) [class*="svc-switch"],
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) [class*="svc-toggle"] {
    background: #2a2a2a !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) input:checked+.svc-switch,
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) input:checked+[class*="svc-switch"],
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) input:checked+.svc-toggle,
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) input:checked+[class*="svc-toggle"] {
    background: #ffffff !important;
}

/* Recibos de locação — modal, grid e tabela */
[data-theme="dark"] .svc-recibo-modal,
[data-theme="dark"] .svc-recibo-grid,
[data-theme="dark"] .svc-recibo-list,
[data-theme="dark"] .svc-recibo-table,
[data-theme="dark"] [class*="svc-recibo"],
[data-theme="dark"] [class*="svcct-"] {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .svc-recibo-pricing-strip,
[data-theme="dark"] .svc-recibo-summary,
[data-theme="dark"] .svc-recibo-summary-item {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .svc-recibo-table thead th {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .svc-recibo-table tbody td {
    background: transparent !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .svc-recibo-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

[data-theme="dark"] .svc-recibo-toggle,
[data-theme="dark"] .svc-recibo-quick-toggle {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .svc-recibo-toggle summary,
[data-theme="dark"] .svc-recibo-quick-toggle summary {
    color: #f3f4f6 !important;
}

[data-theme="dark"] .svc-recibo-modal input,
[data-theme="dark"] .svc-recibo-modal select,
[data-theme="dark"] .svc-recibo-modal textarea,
[data-theme="dark"] [class*="svcct-"] input,
[data-theme="dark"] [class*="svcct-"] select,
[data-theme="dark"] [class*="svcct-"] textarea {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2f2f2f !important;
}

[data-theme="dark"] .inv-step-number {
    color: black !important;

}

[data-theme="dark"] .um-pipeline-step.active .um-pipeline-count .um-pipeline-label {
    color: black !important;
}

[data-theme="dark"] .svc-recibo-modal label,
[data-theme="dark"] [class*="svcct-"] label {
    color: #c7c7c7 !important;
}

/* =================================================================
 *  6.6  REGRAS DE DESCONTO (--dr-*)
 * ================================================================= */
/* Botões usavam #fff text + var(--dr-ink/primary) BG → texto preto */
[data-theme="dark"] .dr-module:not([data-module-theme="light"]) .dr-btn-primary,
[data-theme="dark"] .discount-rules-module:not([data-module-theme="light"]) .dr-btn-primary {
    color: #0f0f0f !important;
}

[data-theme="dark"] .dr-module:not([data-module-theme="light"]) .dr-btn-primary:hover,
[data-theme="dark"] .discount-rules-module:not([data-module-theme="light"]) .dr-btn-primary:hover {
    background: #e5e5e5 !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .dr-module:not([data-module-theme="light"]) .dr-btn-add,
[data-theme="dark"] .discount-rules-module:not([data-module-theme="light"]) .dr-btn-add {
    color: #0f0f0f !important;
}

[data-theme="dark"] .dr-module:not([data-module-theme="light"]) .dr-btn-outline,
[data-theme="dark"] .dr-module:not([data-module-theme="light"]) .dr-btn-ghost,
[data-theme="dark"] .discount-rules-module:not([data-module-theme="light"]) .dr-btn-outline,
[data-theme="dark"] .discount-rules-module:not([data-module-theme="light"]) .dr-btn-ghost {
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .dr-module:not([data-module-theme="light"]) .dr-btn-outline:hover,
[data-theme="dark"] .dr-module:not([data-module-theme="light"]) .dr-btn-ghost:hover,
[data-theme="dark"] .discount-rules-module:not([data-module-theme="light"]) .dr-btn-outline:hover,
[data-theme="dark"] .discount-rules-module:not([data-module-theme="light"]) .dr-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

/* Filter buttons */
[data-theme="dark"] .dr-module:not([data-module-theme="light"]) .dr-filter-btn--active,
[data-theme="dark"] .discount-rules-module:not([data-module-theme="light"]) .dr-filter-btn--active {
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .dr-module:not([data-module-theme="light"]) .dr-filter-btn--active *,
[data-theme="dark"] .discount-rules-module:not([data-module-theme="light"]) .dr-filter-btn--active * {
    color: #0f0f0f !important;
}

/* Tabs */
[data-theme="dark"] .dr-module:not([data-module-theme="light"]) .dr-tab-btn.active,
[data-theme="dark"] .discount-rules-module:not([data-module-theme="light"]) .dr-tab-btn.active {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .dr-module:not([data-module-theme="light"]) .dr-tab-btn.active i,
[data-theme="dark"] .discount-rules-module:not([data-module-theme="light"]) .dr-tab-btn.active i {
    color: #0f0f0f !important;
}

/* Modal "Nova regra" e "Simular" — renderizam no body */
[data-theme="dark"] .dr-modal,
[data-theme="dark"] .dr-modal-simulate-content,
[data-theme="dark"] [class*="dr-modal"] {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .dr-modal h1,
[data-theme="dark"] .dr-modal h2,
[data-theme="dark"] .dr-modal h3,
[data-theme="dark"] .dr-modal h4,
[data-theme="dark"] .dr-modal h5,
[data-theme="dark"] .dr-modal h6,
[data-theme="dark"] .dr-modal label,
[data-theme="dark"] .dr-modal p {
    color: #f3f4f6 !important;
}

[data-theme="dark"] .dr-modal input,
[data-theme="dark"] .dr-modal select,
[data-theme="dark"] .dr-modal textarea {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2f2f2f !important;
}

[data-theme="dark"] .dr-modal button {
    color: inherit;
}

[data-theme="dark"] .dr-modal .dr-btn-primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

/* =================================================================
 *  6.7  CONFIGURAÇÕES DE VENDAS (--vc-*)
 * ================================================================= */
/* Sections e cards */
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-section,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-section {
    background: #161616 !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6 !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-section:hover,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-section:hover {
    background: #1a1a1a !important;
    border-color: #3a3a3a !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-section-header,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-section-header {
    color: #f3f4f6 !important;
    background: transparent !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-section-header:hover,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-section-header:hover {
    background: rgba(255, 255, 255, 0.03) !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-section-desc,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-section-desc {
    color: #8b8b8b !important;
}

/* Tabs */
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-tab-groups,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-tab-groups {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
}

/* Inputs */
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-input,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-input {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2f2f2f !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-input:hover,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-input:hover {
    border-color: #3a3a3a !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-input:focus,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-input:focus {
    border-color: #ffffff !important;
    background: #1f1f1f !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-input::placeholder,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-input::placeholder {
    color: #8b8b8b !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-input[readonly],
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-input[readonly] {
    background: #0f0f0f !important;
    color: #c7c7c7 !important;
}

/* Botões */
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-btn-primary,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-btn-primary {
    color: #0f0f0f !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-btn-primary:hover,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-btn-primary:hover {
    background: #e5e5e5 !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-btn-secondary,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-btn-ghost,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-btn-secondary,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-btn-ghost {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-btn-icon,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-btn-icon {
    background: #1a1a1a !important;
    color: #c7c7c7 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-btn-icon:hover,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-btn-icon:hover {
    background: #1f1f1f !important;
    color: #ffffff !important;
}

/* Toggle slider — knob fica branco */
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-toggle-slider,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-toggle-slider {
    background: #2a2a2a !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) input:checked+.vc-toggle-slider,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) input:checked+.vc-toggle-slider {
    background: #ffffff !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-toggle-slider::before,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-toggle-slider::before {
    background: #ffffff !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) input:checked+.vc-toggle-slider::before,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) input:checked+.vc-toggle-slider::before {
    background: #0f0f0f !important;
}

/* Pagamento tipo button .active */
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-pagto-tipo-btn.active,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-pagto-tipo-btn.active {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-pagto-tipo-btn.active *,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-pagto-tipo-btn.active * {
    color: #0f0f0f !important;
}

/* =================================================================
 *  PHASE 7 — Refinamentos Financeiro2 / Sales-Report / Compras /
 *           Fornecedores / Transportadoras
 *  -----------------------------------------------------------------
 *  Padrão de problema: var(--xx-ink|primary) como BG + color: #fff
 *  hardcoded → texto invisível em dark (BG inverte para branco).
 *  Solução: forçar color #0f0f0f nesses elementos.
 *  Também cobre cards azulados, drag handles, settings cards e
 *  modals globais (renderizados fora do .module container).
 * ================================================================= */

/* =================================================================
 *  7.1  FINANCEIRO2 (--fin2-*)
 * ================================================================= */
/* Navegação ativa, primary buttons, totals, toast, icon-btn hover,
   success/danger — todos compartilham o padrão BG=ink/primary + #fff */
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-nav-item.is-active,
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-nav-item.is-active i,
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-nav-item.is-active .fin2-nav-count,
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-btn--primary,
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-btn--primary *,
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-icon-btn:hover,
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-am-resumo-row--total,
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-am-resumo-row--total b,
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-am-resumo-row--total * {
    color: #0f0f0f !important;
}

[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-btn--primary:hover {
    background: #e5e5e5 !important;
    color: #0f0f0f !important;
}

/* Toast: BG ink (vira branco) + texto branco — força preto */
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-toast {
    color: #0f0f0f !important;
}

/* Variantes coloridas mantêm texto branco (têm BG colorido próprio) */
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-toast.is-success,
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-toast.is-error,
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-toast.is-warning,
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-toast.is-info {
    color: #ffffff !important;
}

/* Drag handle dos widgets de overview */
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-ov-widget-handle {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
    color: #c7c7c7 !important;
}

[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-ov-widget-handle:hover {
    background: #1f1f1f !important;
}

[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-ov-widget-handle>i {
    color: #8b8b8b !important;
}

/* Settings cards — variant --info usa #f9fafb (azul-cinza claro) */
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-settings-card {
    background: #161616 !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6 !important;
}

[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-settings-card--info {
    background: #1a1a1a !important;
}

[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-settings-card legend {
    color: #f3f4f6 !important;
    background: #161616 !important;
}

[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-settings-card textarea,
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-settings-card input,
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-settings-card select {
    background: #0f0f0f !important;
    color: #f3f4f6 !important;
    border-color: #2f2f2f !important;
}

/* Modal host do financeiro2 (.fin2-modal-host) e seu conteúdo */
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-modal-host,
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) [class*="fin2-modal"] {
    color: #f3f4f6;
}

[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-modal-host input,
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-modal-host select,
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .fin2-modal-host textarea {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2f2f2f !important;
}

/* Conciliação bancária + sugestão automática:
   geralmente .fin2-bn-* (banking) ou variantes de btn--primary já cobertas.
   Cobertura defensiva para classes prefixadas bn/conciliacao */
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) [class*="fin2-bn-"][class*="--primary"],
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) [class*="fin2-conc"][class*="--primary"],
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) [class*="fin2-trib"][class*="--primary"] {
    color: #0f0f0f !important;
}

[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) [class*="fin2-bn-"][class*="--primary"] *,
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) [class*="fin2-conc"][class*="--primary"] * {
    color: #0f0f0f !important;
}

/* Grid do contas a pagar — voyger-grid herda --fin2-primary como --vg-primary */
[data-theme="dark"] .fin2-module:not([data-module-theme="light"]) .voyger-grid-container {
    --vg-primary: #ffffff;
    --vg-primary-text: #0f0f0f;
}

/* =================================================================
 *  7.2  SALES-REPORT (--sr-*)
 * ================================================================= */
[data-theme="dark"] .sales-report-module:not([data-module-theme="light"]) .sr-filter-chip,
[data-theme="dark"] .sales-report-module:not([data-module-theme="light"]) .sr-period-btn.active,
[data-theme="dark"] .sales-report-module:not([data-module-theme="light"]) .sr-btn-primary,
[data-theme="dark"] .sales-report-module:not([data-module-theme="light"]) .sr-btn-primary * {
    color: #0f0f0f !important;
}

[data-theme="dark"] .sales-report-module:not([data-module-theme="light"]) .sr-btn-primary:hover {
    background: #e5e5e5 !important;
    color: #0f0f0f !important;
}

/* View toggle (overview) */
[data-theme="dark"] .sales-report-module:not([data-module-theme="light"]) .sr-ov-view-toggle {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .sales-report-module:not([data-module-theme="light"]) .sr-ov-view-toggle button,
[data-theme="dark"] .sales-report-module:not([data-module-theme="light"]) .sr-ov-view-toggle [class*="btn"] {
    background: transparent !important;
    color: #c7c7c7 !important;
    border-color: transparent !important;
}

[data-theme="dark"] .sales-report-module:not([data-module-theme="light"]) .sr-ov-view-toggle .active,
[data-theme="dark"] .sales-report-module:not([data-module-theme="light"]) .sr-ov-view-toggle button.active,
[data-theme="dark"] .sales-report-module:not([data-module-theme="light"]) .sr-ov-view-toggle [class*="active"] {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

/* VoygerGrid token override — força contraste preto-em-branco em
   highlights/seleção (BG do grid já é dark via Phase 1) */
[data-theme="dark"] .sales-report-module:not([data-module-theme="light"]) .voyger-grid-container {
    --vg-primary: #ffffff;
    --vg-primary-text: #0f0f0f;
}

/* Modais de Sales Report — .sr-modal */
[data-theme="dark"] .sr-modal,
[data-theme="dark"] .sr-modal-content {
    background: rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .sr-modal-content {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .sr-modal-header,
[data-theme="dark"] .sr-modal-body {
    background: linear-gradient(270deg, rgba(2, 6, 23, 0.28) 0%, rgba(2, 6, 23, 0.1) 28%, rgba(2, 6, 23, 0) 100%);
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .sr-modal input,
[data-theme="dark"] .sr-modal select,
[data-theme="dark"] .sr-modal textarea {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .sr-modal label {
    color: #c7c7c7 !important;
}

[data-theme="dark"] .sr-modal-close {
    color: #c7c7c7 !important;
    background: transparent !important;
}

[data-theme="dark"] .sr-modal-close:hover {
    background: rgba(255, 255, 255, 0.08) !important;
}

/* =================================================================
 *  7.3  COMPRAS (--pm-*)
 * ================================================================= */
[data-theme="dark"] .purchases-module:not([data-module-theme="light"]) .pm-filter-btn.active,
[data-theme="dark"] .purchases-module:not([data-module-theme="light"]) .pm-filter-btn-count,
[data-theme="dark"] .purchases-module:not([data-module-theme="light"]) .pm-btn-primary,
[data-theme="dark"] .purchases-module:not([data-module-theme="light"]) .pm-btn-primary *,
[data-theme="dark"] .purchases-module:not([data-module-theme="light"]) .pm-segmented-control button.active,
[data-theme="dark"] .purchases-module:not([data-module-theme="light"]) .pm-step.active .pm-step-number {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .purchases-module:not([data-module-theme="light"]) .pm-btn-primary:hover {
    background: #e5e5e5 !important;
    color: #0f0f0f !important;
}

/* Filter buttons base (idle/hover) */
[data-theme="dark"] .purchases-module:not([data-module-theme="light"]) .pm-filter-btn {
    background: #1a1a1a !important;
    color: #c7c7c7 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .purchases-module:not([data-module-theme="light"]) .pm-filter-btn:hover {
    background: #1f1f1f !important;
    color: #ffffff !important;
}

[data-theme="dark"] .purchases-module:not([data-module-theme="light"]) .pm-filter-btn.active {
    background: #ffffff !important;
    border-color: #ffffff !important;
}

/* Modais "Pedido de Compra" / "Receber" / "Importar XML"
   — podem ser .pm-modal* ou usar .dashboard-modal já coberto */
[data-theme="dark"] [class*="pm-modal"],
[data-theme="dark"] .pm-modal,
[data-theme="dark"] .pm-modal-content {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] [class*="pm-modal"] input,
[data-theme="dark"] [class*="pm-modal"] select,
[data-theme="dark"] [class*="pm-modal"] textarea {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2f2f2f !important;
}

[data-theme="dark"] [class*="pm-modal"] label,
[data-theme="dark"] [class*="pm-modal"] .pm-form-label {
    color: #c7c7c7 !important;
}

[data-theme="dark"] [class*="pm-modal"] .pm-btn-primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

/* =================================================================
 *  7.4  FORNECEDORES (.suppliers-module)
 *  Usa classes genéricas (.btn-primary, .modal) — cobertura ampla
 * ================================================================= */
/* Grid */
[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) table,
[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) .voyger-grid-container,
[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) .suppliers-grid {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) thead th {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) tbody td {
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) tbody tr:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) .voyger-grid-container {
    --vg-primary: #ffffff;
    --vg-primary-text: #0f0f0f;
    --vg-surface: #161616;
    --vg-border: #2a2a2a;
}

/* Botões primary genéricos do módulo */
[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) .btn-primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) .btn-primary:hover {
    background: #e5e5e5 !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) .btn-secondary {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

/* Modais associados ao suppliers (renderizados como ~siblings) */
[data-theme="dark"] .suppliers-module~.modal:not(.dashboard-modal),
[data-theme="dark"] .suppliers-module~.category-modal,
[data-theme="dark"] .suppliers-module~#voyger-import-modal {
    background: rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .suppliers-module~.modal:not(.dashboard-modal) .modal-content,
[data-theme="dark"] .suppliers-module~.category-modal .modal-content,
[data-theme="dark"] .suppliers-module~#voyger-import-modal .modal-content,
[data-theme="dark"] .suppliers-module~#voyger-import-modal>div {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .suppliers-module~.modal input,
[data-theme="dark"] .suppliers-module~.modal select,
[data-theme="dark"] .suppliers-module~.modal textarea,
[data-theme="dark"] .suppliers-module~.category-modal input,
[data-theme="dark"] .suppliers-module~.category-modal select,
[data-theme="dark"] .suppliers-module~#voyger-import-modal input,
[data-theme="dark"] .suppliers-module~#voyger-import-modal select,
[data-theme="dark"] .suppliers-module~#voyger-import-modal textarea {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2f2f2f !important;
}

[data-theme="dark"] .suppliers-module~.modal label,
[data-theme="dark"] .suppliers-module~.category-modal label,
[data-theme="dark"] .suppliers-module~#voyger-import-modal label {
    color: #c7c7c7 !important;
}

[data-theme="dark"] .suppliers-module~.modal .btn-primary,
[data-theme="dark"] .suppliers-module~.category-modal .btn-primary,
[data-theme="dark"] .suppliers-module~#voyger-import-modal .btn-primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

/* Quando módulo de fornecedores está ativo, forçar fundo dos modais
   globais que ele usa (dashboard-modal já coberto, mas garantia extra) */
[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) .modal-content,
[data-theme="dark"] .suppliers-module:not([data-module-theme="light"]) .category-modal {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

/* =================================================================
 *  7.5  TRANSPORTADORAS (.carriers-module)
 *  Mesmo padrão de Fornecedores
 * ================================================================= */
[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) table,
[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) .voyger-grid-container {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) thead th {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) tbody td {
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) tbody tr:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) .voyger-grid-container {
    --vg-primary: #ffffff;
    --vg-primary-text: #0f0f0f;
    --vg-surface: #161616;
    --vg-border: #2a2a2a;
}

[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) .btn-primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) .btn-primary:hover {
    background: #e5e5e5 !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) .btn-secondary {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .carriers-module~.modal:not(.dashboard-modal),
[data-theme="dark"] .carriers-module~.category-modal {
    background: rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .carriers-module~.modal:not(.dashboard-modal) .modal-content,
[data-theme="dark"] .carriers-module~.category-modal .modal-content {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .carriers-module~.modal input,
[data-theme="dark"] .carriers-module~.modal select,
[data-theme="dark"] .carriers-module~.modal textarea {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2f2f2f !important;
}

[data-theme="dark"] .carriers-module~.modal label {
    color: #c7c7c7 !important;
}

[data-theme="dark"] .carriers-module~.modal .btn-primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .carriers-module:not([data-module-theme="light"]) .modal-content {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

/* =================================================================
 *  PHASE 8 — Refinamentos profundos (Cotação / Serviço / Descontos /
 *           Vendas-Config) baseados em auditoria full
 *  -----------------------------------------------------------------
 *  Foco: subtabs, context-bar, config-tabs, encargos, modal de
 *  desconto inteiro (montado no body), grid de catálogo de serviço,
 *  pagto-tipo. Muitos elementos têm gradientes ou cores hardcoded
 *  que escapam à inversão de tokens.
 * ================================================================= */

/* =================================================================
 *  8.1  COTAÇÃO — refinamentos
 * ================================================================= */

/* Context-bar: superfície + cells */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-context-bar,
[data-theme="dark"] #modal-cotacao .cpq-context-bar,
[data-theme="dark"] #modal-cpq-config .cpq-context-bar {
    background: #0f0f0f !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-ctx-cell,
[data-theme="dark"] #modal-cotacao .cpq-ctx-cell,
[data-theme="dark"] #modal-cpq-config .cpq-ctx-cell {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-ctx-cell *:not(button):not(.btn):not(input):not(select):not(textarea),
[data-theme="dark"] #modal-cotacao .cpq-ctx-cell *:not(button):not(.btn):not(input):not(select):not(textarea),
[data-theme="dark"] #modal-cpq-config .cpq-ctx-cell *:not(button):not(.btn):not(input):not(select):not(textarea) {
    color: inherit;
}

/* Botões "ativos" dentro do context-bar (BG=ink, texto=#fff hardcoded) */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-context-bar .btn-active,
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-context-bar .btn.active,
[data-theme="dark"] #modal-cotacao .cpq-context-bar .btn-active,
[data-theme="dark"] #modal-cpq-config .cpq-context-bar .btn-active {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

/* Subtab nav (gradiente light hardcoded #e6e8ec → #dcdfe4) */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-subtab-nav,
[data-theme="dark"] #modal-cotacao .cpq-subtab-nav,
[data-theme="dark"] #modal-cpq-config .cpq-subtab-nav {
    background: #0f0f0f !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-subtab,
[data-theme="dark"] #modal-cotacao .cpq-subtab,
[data-theme="dark"] #modal-cpq-config .cpq-subtab {
    background: linear-gradient(180deg, #1a1a1a 0%, #141414 100%) !important;
    color: #c7c7c7 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-subtab:hover,
[data-theme="dark"] #modal-cotacao .cpq-subtab:hover,
[data-theme="dark"] #modal-cpq-config .cpq-subtab:hover {
    background: #1f1f1f !important;
    color: #ffffff !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-subtab.active,
[data-theme="dark"] #modal-cotacao .cpq-subtab.active,
[data-theme="dark"] #modal-cpq-config .cpq-subtab.active {
    background: #161616 !important;
    color: #ffffff !important;
    box-shadow: 0 -3px 0 0 #ffffff inset !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-subtab-panel,
[data-theme="dark"] #modal-cotacao .cpq-subtab-panel,
[data-theme="dark"] #modal-cpq-config .cpq-subtab-panel {
    background: #161616 !important;
    color: #f3f4f6 !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-subtab-panel.active,
[data-theme="dark"] #modal-cotacao .cpq-subtab-panel.active,
[data-theme="dark"] #modal-cpq-config .cpq-subtab-panel.active {
    background: #161616 !important;
    color: #f3f4f6 !important;
}

/* Config tabs (.cpq-config-tabs + .cpq-tab) */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-config-tabs,
[data-theme="dark"] #modal-cpq-config .cpq-config-tabs {
    background: #161616 !important;
    border-color: #2a2a2a !important;
    box-shadow: 0 8px 16px -14px rgba(0, 0, 0, 0.6) !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-tab,
[data-theme="dark"] #modal-cpq-config .cpq-tab {
    color: #c7c7c7 !important;
    background: transparent !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-tab:hover,
[data-theme="dark"] #modal-cpq-config .cpq-tab:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.04) !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-tab.active,
[data-theme="dark"] #modal-cpq-config .cpq-tab.active {
    color: #ffffff !important;
    border-bottom-color: #ffffff !important;
}

/* Config section body (painel após o tab ativo) */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-config-section-body,
[data-theme="dark"] #modal-cpq-config .cpq-config-section-body {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-config-section-body label,
[data-theme="dark"] #modal-cpq-config .cpq-config-section-body label {
    color: #c7c7c7 !important;
}

/* Seção Encargos */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-ctx-field--encargos,
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) [class*="cpq-encargos"],
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) [class*="cpq-ctx-encargos"],
[data-theme="dark"] #modal-cotacao [class*="cpq-encargos"],
[data-theme="dark"] #modal-cpq-config [class*="cpq-encargos"] {
    color: #f3f4f6 !important;
}

/* Mantém matiz semântica (índigo/âmbar/vermelho) em texto, mas aclara
   para ficar legível em fundo escuro */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-encargos-icmsst,
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) [class*="cpq-encargos"][class*="indigo"] {
    color: #a5b4fc !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-encargos-ipi,
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) [class*="cpq-encargos"][class*="amber"] {
    color: #fbbf24 !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) [class*="cpq-encargos"][class*="danger"] {
    color: #fca5a5 !important;
}

/* Surfaces near-white dentro de painéis CPQ (audit B2/B5: 4017,4144,4306,4330,4366,8003) */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) [class*="cpq-"][class*="-panel"],
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) [class*="cpq-"][class*="-card"]:not([class*="-active"]),
[data-theme="dark"] #modal-cotacao [class*="cpq-"][class*="-panel"],
[data-theme="dark"] #modal-cpq-config [class*="cpq-"][class*="-panel"] {
    background-image: none !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-prev-items-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03) !important;
}

/* Botões primary/secondary do CPQ ainda com #fff hardcoded */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-btn-primary,
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .btn-cotacao-primary,
[data-theme="dark"] #modal-cotacao .cpq-btn-primary,
[data-theme="dark"] #modal-cotacao .btn-cotacao-primary,
[data-theme="dark"] #modal-cpq-config .cpq-btn-primary,
[data-theme="dark"] #modal-cpq-config .btn-cotacao-primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-btn-primary:hover,
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .btn-cotacao-primary:hover,
[data-theme="dark"] #modal-cotacao .cpq-btn-primary:hover,
[data-theme="dark"] #modal-cotacao .btn-cotacao-primary:hover {
    background: #e5e5e5 !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .btn-cotacao-secondary,
[data-theme="dark"] #modal-cotacao .btn-cotacao-secondary,
[data-theme="dark"] #modal-cpq-config .btn-cotacao-secondary {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .btn-cotacao-secondary:hover,
[data-theme="dark"] #modal-cotacao .btn-cotacao-secondary:hover,
[data-theme="dark"] #modal-cpq-config .btn-cotacao-secondary:hover {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

/* Filter buttons (já parcialmente em Phase 6, reforço) */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) [id^="cpq-filter-"].active {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

/* =================================================================
 *  8.2  SERVIÇO — refinamentos
 * ================================================================= */

/* Hero icon + title (texto branco hardcoded sobre BG que precisa
   ser dark) — mantemos texto branco mas garantimos BG dark */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-hero-icon {
    background: rgba(255, 255, 255, 0.10) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-hero-text h1,
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-hero-text p,
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-hero h1,
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-hero h2 {
    color: #ffffff !important;
}

/* Catálogo de serviços — grid + cards */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svcat-grid,
[data-theme="dark"] .svcat-modal .svcat-grid {
    background: transparent !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svcat-card,
[data-theme="dark"] .svcat-modal .svcat-card {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svcat-card:hover,
[data-theme="dark"] .svcat-modal .svcat-card:hover {
    background: #1f1f1f !important;
    border-color: #3a3a3a !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svcat-card *,
[data-theme="dark"] .svcat-modal .svcat-card * {
    border-color: #2a2a2a;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svcat-card-status,
[data-theme="dark"] .svcat-modal .svcat-card-status {
    background: rgba(18, 183, 106, 0.20) !important;
    color: #34d399 !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svcat-card-btn,
[data-theme="dark"] .svcat-modal .svcat-card-btn {
    color: #f3f4f6 !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svcat-card-btn--danger:hover,
[data-theme="dark"] .svcat-modal .svcat-card-btn--danger:hover {
    background: #d92d20 !important;
    color: #ffffff !important;
}

/* svcat-modal-close (linha 2965 audit) */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svcat-modal-close:hover,
[data-theme="dark"] .svcat-modal .svcat-modal-close:hover {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

/* Light surfaces internas do servico (audit B2: 680/687/1036) */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) [class*="svc-"][class*="-list"]:not([class*="status"]),
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) [class*="svc-"][class*="-card"]:not([class*="status"]):not([class*="btn"]) {
    background-color: #161616 !important;
}

/* -----------------------------------------------------------------
 *  8.2-EXT  SERVIÇO — refinamentos adicionais (hardcodes residuais)
 * ----------------------------------------------------------------- */

/* RC-S1 — .svc-pipeline-step.active usa var(--svc-ink) que em dark
   vira #f3f4f6 (quase branco) → o botão "Todos / 16" fica branco */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-pipeline-step {
    color: #c7c7c7 !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-pipeline-step:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-pipeline-step.active {
    background: #ffffff !important;
    color: #0f0f0f !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-pipeline-step.active .svc-pipeline-count,
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-pipeline-step.active .svc-pipeline-label {
    color: #0f0f0f !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-pipeline-divider {
    background: #2a2a2a !important;
}

/* RC-S2 — .svc-contract-row-head { background: #f5f7fa } hardcoded */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-contract-row-head {
    background: #1a1a1a !important;
    color: #8b8b8b !important;
    border-color: #2a2a2a !important;
}

/* RC-S3 — .svc-contract-row:hover { background: #fafafa } hardcoded */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-contract-row:not(.svc-contract-row-head):hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

/* RC-S4 — status badges com cores hardcoded escuras (invisíveis em dark) */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-status-badge.rascunho {
    background: rgba(139, 139, 139, 0.15) !important;
    color: #c7c7c7 !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-status-badge.ativo {
    background: rgba(18, 183, 106, 0.15) !important;
    color: #34d399 !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-status-badge.concluido {
    background: rgba(21, 112, 239, 0.15) !important;
    color: #60a5fa !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-status-badge.cancelado {
    background: rgba(217, 45, 32, 0.15) !important;
    color: #f87171 !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-status-badge.pendente {
    background: rgba(247, 144, 9, 0.15) !important;
    color: #fbbf24 !important;
}

/* RC-S5/S6/S7 — botões de ação coloridos com background light hardcoded */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-row-action-btn-pdf {
    background: rgba(217, 45, 32, 0.12) !important;
    border-color: rgba(217, 45, 32, 0.25) !important;
    color: #f87171 !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-row-action-btn-pdf:hover {
    background: rgba(217, 45, 32, 0.20) !important;
    border-color: rgba(217, 45, 32, 0.40) !important;
    color: #fca5a5 !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-row-action-btn-boleto {
    background: rgba(234, 88, 12, 0.12) !important;
    border-color: rgba(234, 88, 12, 0.25) !important;
    color: #fb923c !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-row-action-btn-boleto:hover {
    background: rgba(234, 88, 12, 0.20) !important;
    border-color: rgba(234, 88, 12, 0.40) !important;
    color: #fdba74 !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-row-action-btn-delete:hover {
    background: rgba(217, 45, 32, 0.12) !important;
    border-color: rgba(217, 45, 32, 0.30) !important;
    color: #f87171 !important;
}

/* RC-S8 — .svc-btn-save-close { background: #eef2ff; color: #4338ca } */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-btn-save-close {
    background: rgba(99, 102, 241, 0.12) !important;
    border-color: rgba(99, 102, 241, 0.25) !important;
    color: #a5b4fc !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-btn-save-close:hover {
    background: rgba(99, 102, 241, 0.20) !important;
    border-color: rgba(99, 102, 241, 0.40) !important;
}

/* RC-S9 — .svc-cycle-chip-due { background: #fff7ed } — vencimento vencido */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-cycle-chip-due {
    background: rgba(234, 88, 12, 0.12) !important;
    border-color: rgba(234, 88, 12, 0.25) !important;
    color: #fb923c !important;
}

/* RC-S10 — send modal icons com #fef2f2 e #fff7ed hardcoded */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-send-option-icon--pdf {
    background: rgba(217, 45, 32, 0.12) !important;
    color: #f87171 !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-send-option-icon--boleto {
    background: rgba(234, 88, 12, 0.12) !important;
    color: #fb923c !important;
}

/* RC-S11 — .svc-contract-brand-logo { background: #fff } — logo no contrato */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-contract-brand-logo {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
}

/* RC-S12 — .svc-logo-preview { background: #fff } — preview nas configurações */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-logo-preview {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) #svc-logo-preview-empty {
    color: #8b8b8b !important;
}

/* =================================================================
 *  8.3  REGRAS DE DESCONTO — modal completo (montado no body)
 * ================================================================= */

/* Backdrop + container — escopado SEM .dr-module pois é appended ao body */
[data-theme="dark"] .dr-modal {
    background: rgba(0, 0, 0, 0.55) !important;
}

[data-theme="dark"] .dr-modal-content,
[data-theme="dark"] .dr-modal .modal-content,
[data-theme="dark"] .dr-modal-simulate-content {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
    box-shadow: 0 28px 52px rgba(0, 0, 0, 0.6) !important;
}

[data-theme="dark"] .dr-modal-header,
[data-theme="dark"] .dr-modal-body,
[data-theme="dark"] .dr-modal-footer {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .dr-modal-header h1,
[data-theme="dark"] .dr-modal-header h2,
[data-theme="dark"] .dr-modal-header h3,
[data-theme="dark"] .dr-modal-header h4,
[data-theme="dark"] .dr-modal h1,
[data-theme="dark"] .dr-modal h2,
[data-theme="dark"] .dr-modal h3,
[data-theme="dark"] .dr-modal h4,
[data-theme="dark"] .dr-modal h5,
[data-theme="dark"] .dr-modal h6,
[data-theme="dark"] .dr-modal label,
[data-theme="dark"] .dr-modal p {
    color: #f3f4f6 !important;
}

[data-theme="dark"] .dr-modal small,
[data-theme="dark"] .dr-modal .text-muted,
[data-theme="dark"] .dr-modal .dr-hint,
[data-theme="dark"] .dr-modal [class*="hint"],
[data-theme="dark"] .dr-modal [class*="muted"] {
    color: #8b8b8b !important;
}

[data-theme="dark"] .dr-modal input:not([type="checkbox"]):not([type="radio"]),
[data-theme="dark"] .dr-modal select,
[data-theme="dark"] .dr-modal textarea {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2f2f2f !important;
}

[data-theme="dark"] .dr-modal input:focus,
[data-theme="dark"] .dr-modal select:focus,
[data-theme="dark"] .dr-modal textarea:focus {
    border-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08) !important;
    outline: none;
}

[data-theme="dark"] .dr-modal input::placeholder,
[data-theme="dark"] .dr-modal textarea::placeholder {
    color: #6b6b6b !important;
}

/* Cards/sections internos do modal */
[data-theme="dark"] .dr-modal [class*="dr-"][class*="-section"],
[data-theme="dark"] .dr-modal [class*="dr-"][class*="-card"],
[data-theme="dark"] .dr-modal [class*="dr-"][class*="-form"],
[data-theme="dark"] .dr-modal [class*="dr-"][class*="-panel"] {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

/* Step labels (.dr-step-label.active e variantes coloridas) — usam
   pares hardcoded (#eef3ff/#fff7e6/#e8f7ee/#f5f0fa/#fff0f0 + texto sat).
   Em dark, bg fica escuro com matiz preservada via texto colorido. */
[data-theme="dark"] .dr-modal .dr-step-label,
[data-theme="dark"] .dr-modal [class*="dr-step"] {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
    color: #c7c7c7 !important;
}

[data-theme="dark"] .dr-modal .dr-step-label.active,
[data-theme="dark"] .dr-modal [class*="dr-step"].active {
    background: #1f1f1f !important;
    border-color: #3a3a3a !important;
    color: #ffffff !important;
}

/* Step variants (cor por tipo) — preserva matiz no texto */
[data-theme="dark"] .dr-modal [class*="dr-step"][class*="info"],
[data-theme="dark"] .dr-modal [class*="dr-step"][class*="condition"] {
    color: #93c5fd !important;
    border-color: #1e3a5f !important;
}

[data-theme="dark"] .dr-modal [class*="dr-step"][class*="warning"],
[data-theme="dark"] .dr-modal [class*="dr-step"][class*="trigger"] {
    color: #fbbf24 !important;
    border-color: #5c4318 !important;
}

[data-theme="dark"] .dr-modal [class*="dr-step"][class*="success"],
[data-theme="dark"] .dr-modal [class*="dr-step"][class*="action"] {
    color: #6ee7b7 !important;
    border-color: #1f4d3a !important;
}

[data-theme="dark"] .dr-modal [class*="dr-step"][class*="purple"],
[data-theme="dark"] .dr-modal [class*="dr-step"][class*="rule"] {
    color: #c4b5fd !important;
    border-color: #3d2f5c !important;
}

[data-theme="dark"] .dr-modal [class*="dr-step"][class*="danger"] {
    color: #fca5a5 !important;
    border-color: #5c1f1f !important;
}

/* Botões dentro do modal */
[data-theme="dark"] .dr-modal .dr-btn-primary,
[data-theme="dark"] .dr-modal button[class*="primary"]:not(.dr-btn-outline):not(.dr-btn-ghost) {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .dr-modal .dr-btn-primary:hover,
[data-theme="dark"] .dr-modal button[class*="primary"]:hover:not(.dr-btn-outline):not(.dr-btn-ghost) {
    background: #e5e5e5 !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .dr-modal .dr-btn-outline,
[data-theme="dark"] .dr-modal .dr-btn-ghost,
[data-theme="dark"] .dr-modal .dr-btn-secondary {
    background: transparent !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .dr-modal .dr-btn-outline:hover,
[data-theme="dark"] .dr-modal .dr-btn-ghost:hover,
[data-theme="dark"] .dr-modal .dr-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #ffffff !important;
}

/* Close button */
[data-theme="dark"] .dr-modal .dr-modal-close,
[data-theme="dark"] .dr-modal [class*="close"] {
    color: #c7c7c7 !important;
    background: transparent !important;
}

[data-theme="dark"] .dr-modal .dr-modal-close:hover,
[data-theme="dark"] .dr-modal [class*="close"]:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}

/* =================================================================
 *  8.4  VENDAS-CONFIG — refinamentos
 * ================================================================= */

/* Group buttons (tabs principais Compartilhadas/CPQ/NFE) */
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-group-btn {
    color: #c7c7c7 !important;
    background: transparent !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-group-btn:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.04) !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-group-btn.active {
    color: #ffffff !important;
}

/* Tipo de pagamento buttons (.vc-pagto-tipo-btn — vermelho hardcoded
   #c4291c que mantemos por ser semântico) */
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-pagto-tipo-btn {
    background: #1a1a1a !important;
    color: #c7c7c7 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-pagto-tipo-btn:hover {
    background: #1f1f1f !important;
    color: #ffffff !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-pagto-tipo-btn.active {
    background: #c4291c !important;
    color: #ffffff !important;
    border-color: #c4291c !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-pagto-tipo-btn.active * {
    color: #ffffff !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-pagto-tipo-btn.active .fa-pen {
    color: #ffffff !important;
}

/* Cards de accent (shared/cpq/nfe) — preservar matiz no border-left */
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) [class*="vc-accent"],
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) [class*="vc-chip"] {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

/* Cores hardcoded #333/#222/#fff em vc (linhas 1489-1490 audit):
   já são dark; só garantir contraste de texto */
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-btn-danger {
    background: #d92d20 !important;
    color: #ffffff !important;
}

/* =================================================================
 *  PHASE 9 — Refinamentos baseados em report visual do usuário
 *  -----------------------------------------------------------------
 *  - Voyger-Grid component (todas as toolbars/paginations)
 *  - Cotação: scope-toggle, config-section-header gradiente, ICMS
 *    matrix completa, save-button, product-search
 *  - Serviço: contract-row-head + hover, contract-filters,
 *    svcos-modal save, svcat-grid completo
 *  - Vendas-Config: ICMS matrix, vc-config-grid headers, vc-pagto-chip
 *  - MDM: mdm-modal-header, mdm-btn-primary, addDeviceBtn,
 *    quick-device + security-rules + global-config
 *  - Discount Rules: dr-icon-btn (fundo + ícone visíveis)
 * ================================================================= */

/* ─────────────────────────────────────────────────────────────────
   9.0 — VOYGER-GRID component (variáveis --vg-*)
   Component compartilhado por Cotação, Serviço, Vendas-Config etc.
   Sobrescreve as defaults claras (#f8f9fa, #fff, #888) por dark.
   ───────────────────────────────────────────────────────────────── */
[data-theme="dark"] .voyger-grid,
[data-theme="dark"] [class*="-module"]:not([data-module-theme="light"]) .voyger-grid,
[data-theme="dark"] .voyger-grid-toolbar,
[data-theme="dark"] .voyger-grid-pagination,
[data-theme="dark"] .voyger-grid-quick-filters,
[data-theme="dark"] .voyger-grid-table,
[data-theme="dark"] .voyger-grid-header {
    --vg-bg: #161616;
    --vg-bg-surface: #0f0f0f;
    --vg-header-bg: #1a1a1a;
    --vg-border: #2a2a2a;
    --vg-text: #f3f4f6;
    --vg-text-secondary: #c7c7c7;
    --vg-text-muted: #8b8b8b;
    --vg-row-hover: rgba(255, 255, 255, 0.05);
    --vg-selected: rgba(255, 255, 255, 0.10);
    --vg-primary: #ffffff;
}

[data-theme="dark"] .voyger-grid {
    background: #161616 !important;
    border-color: #2a2a2a !important;
}

/* RC1 fix — inline JS-applied light --vg-bg/--vg-bg-surface vars override CSS vars;
   !important on background beats inline style (background != CSS custom property) */
[data-theme="dark"] .voyger-grid-container {
    background: #161616 !important;
}

[data-theme="dark"] .voyger-grid-wrapper {
    background: #0f0f0f !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .cpq-encargo-card-header {
    background: transparent !important;
}

[data-theme="dark"] .dr-block-num {
    background-color: #000000;
}

[data-theme="dark"] .user-profile #user-name {
    color: #ffffff !important;
}

[data-theme="dark"] .voyger-grid-toolbar,
[data-theme="dark"] .voyger-grid-pagination {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6 !important;
}

[data-theme="dark"] .voyger-grid-pagination-info,
[data-theme="dark"] .voyger-grid-pagination-pages,
[data-theme="dark"] .voyger-grid-pagination-size,
[data-theme="dark"] .voyger-grid-pagination-size label {
    color: #c7c7c7 !important;
}

[data-theme="dark"] .voyger-grid-quick-filters {
    background: #161616 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .voyger-grid-quick-filter {
    color: #c7c7c7 !important;
    background: transparent !important;
}

[data-theme="dark"] .voyger-grid-quick-filter:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .voyger-grid-quick-filter.active {
    background: #1f1f1f !important;
    color: #ffffff !important;
    border-color: #3a3a3a !important;
}

[data-theme="dark"] .voyger-grid-header,
[data-theme="dark"] .voyger-grid-th {
    background: #1a1a1a !important;
    color: #c7c7c7 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .voyger-grid-th-sortable:hover {
    background: rgba(255, 255, 255, 0.04) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .voyger-grid-th-sorted,
[data-theme="dark"] .voyger-grid-th-sorted .voyger-grid-sort-icon {
    color: #ffffff !important;
}

[data-theme="dark"] .voyger-grid-row {
    background: transparent !important;
}

[data-theme="dark"] .voyger-grid-row:nth-child(even) {
    background: rgba(255, 255, 255, 0.02) !important;
}

[data-theme="dark"] .voyger-grid-row:hover {
    background: rgba(255, 255, 255, 0.06) !important;
}

[data-theme="dark"] .voyger-grid-row-selected {
    background: rgba(255, 255, 255, 0.10) !important;
    box-shadow: inset 3px 0 0 #ffffff !important;
}

[data-theme="dark"] .voyger-grid-td {
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .voyger-grid-empty {
    color: #8b8b8b !important;
}

[data-theme="dark"] .voyger-grid-search-input,
[data-theme="dark"] .voyger-grid-page-size-select,
[data-theme="dark"] .voyger-grid-cell-editor {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2f2f2f !important;
}

[data-theme="dark"] .voyger-grid-search-input::placeholder {
    color: #6b6b6b !important;
}

[data-theme="dark"] .voyger-grid-search-icon {
    color: #8b8b8b !important;
}

[data-theme="dark"] .voyger-grid-btn,
[data-theme="dark"] .voyger-grid-btn-page,
[data-theme="dark"] .voyger-grid-btn-export {
    background: #1a1a1a !important;
    color: #c7c7c7 !important;
    border-color: #2f2f2f !important;
}

[data-theme="dark"] .voyger-grid-btn:hover:not(:disabled),
[data-theme="dark"] .voyger-grid-btn-page:hover:not(:disabled),
[data-theme="dark"] .voyger-grid-btn-export:hover:not(:disabled) {
    background: #2a2a2a !important;
    color: #ffffff !important;
    border-color: #3f3f3f !important;
}

[data-theme="dark"] .voyger-grid-action-btn {
    color: #c7c7c7 !important;
    background: transparent !important;
}

[data-theme="dark"] .voyger-grid-action-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}

/* Scroll arrows — fundo já é dark via fallback, mas fixar */
[data-theme="dark"] .voyger-grid-scroll-btn {
    background: #161616 !important;
    border-color: #2a2a2a !important;
    color: #c7c7c7 !important;
}

[data-theme="dark"] .voyger-grid-scroll-btn.visible:not(.disabled) {
    color: #ffffff !important;
    border-color: #3a3a3a !important;
}

[data-theme="dark"] .voyger-grid-scroll-btn.visible:not(.disabled):hover {
    background: #2a2a2a !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .voyger-grid-scroll-outer::before {
    background: linear-gradient(to right, #161616 0%, transparent 100%) !important;
}

[data-theme="dark"] .voyger-grid-scroll-outer::after {
    background: linear-gradient(to left, #161616 0%, transparent 100%) !important;
}

/* ─────────────────────────────────────────────────────────────────
   9.1 — COTAÇÃO refinements
   ───────────────────────────────────────────────────────────────── */

/* #cpq-ov-scope-toggle (sub-button group) */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-ov-scope-toggle,
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) #cpq-ov-scope-toggle {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-ov-scope-btn {
    color: #c7c7c7 !important;
    background: transparent !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-ov-scope-btn:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.06) !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-ov-scope-btn.active {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

/* .cpq-config-section-header (gradiente claro #f8f9fb → #f1f2f6) */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-config-section-header,
[data-theme="dark"] #modal-cotacao .cpq-config-section-header,
[data-theme="dark"] #modal-cpq-config .cpq-config-section-header {
    background: linear-gradient(180deg, #1a1a1a 0%, #141414 100%) !important;
    color: #f3f4f6 !important;
    border-left-color: #ffffff !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-config-section-header:hover,
[data-theme="dark"] #modal-cotacao .cpq-config-section-header:hover,
[data-theme="dark"] #modal-cpq-config .cpq-config-section-header:hover {
    background: linear-gradient(180deg, #1f1f1f 0%, #181818 100%) !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-config-section,
[data-theme="dark"] #modal-cotacao .cpq-config-section,
[data-theme="dark"] #modal-cpq-config .cpq-config-section {
    background: #161616 !important;
    border-color: #2a2a2a !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

/* thead da aba comercial / .cotacao-table thead th */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cotacao-table thead th,
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-ctx-comercial-grid thead th,
[data-theme="dark"] #modal-cotacao .cotacao-table thead th {
    background: #1a1a1a !important;
    color: #c7c7c7 !important;
    border-color: #2a2a2a !important;
}

/* ICMS matrix completa — toolbar, matrix, células, inputs */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-icms-toolbar,
[data-theme="dark"] #modal-cotacao .cpq-icms-toolbar,
[data-theme="dark"] #modal-cpq-config .cpq-icms-toolbar {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6 !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-icms-toolbar-group label,
[data-theme="dark"] #modal-cotacao .cpq-icms-toolbar-group label,
[data-theme="dark"] #modal-cpq-config .cpq-icms-toolbar-group label {
    color: #c7c7c7 !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-icms-toolbar-status,
[data-theme="dark"] #modal-cotacao .cpq-icms-toolbar-status,
[data-theme="dark"] #modal-cpq-config .cpq-icms-toolbar-status {
    color: #8b8b8b !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-icms-matrix-wrapper,
[data-theme="dark"] #modal-cotacao .cpq-icms-matrix-wrapper,
[data-theme="dark"] #modal-cpq-config .cpq-icms-matrix-wrapper {
    background: #161616 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-icms-matrix thead th,
[data-theme="dark"] #modal-cotacao .cpq-icms-matrix thead th,
[data-theme="dark"] #modal-cpq-config .cpq-icms-matrix thead th {
    background: #1a1a1a !important;
    color: #c7c7c7 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-icms-corner,
[data-theme="dark"] #modal-cotacao .cpq-icms-corner,
[data-theme="dark"] #modal-cpq-config .cpq-icms-corner {
    background: #1a1a1a !important;
    color: #c7c7c7 !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-icms-row-head,
[data-theme="dark"] #modal-cotacao .cpq-icms-row-head,
[data-theme="dark"] #modal-cpq-config .cpq-icms-row-head {
    background: #1f1f1f !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-icms-cell,
[data-theme="dark"] #modal-cotacao .cpq-icms-cell,
[data-theme="dark"] #modal-cpq-config .cpq-icms-cell {
    background: #161616 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-icms-cell-diagonal,
[data-theme="dark"] #modal-cotacao .cpq-icms-cell-diagonal,
[data-theme="dark"] #modal-cpq-config .cpq-icms-cell-diagonal {
    background: #0f0f0f !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-icms-input,
[data-theme="dark"] #modal-cotacao .cpq-icms-input,
[data-theme="dark"] #modal-cpq-config .cpq-icms-input {
    background: transparent !important;
    color: #f3f4f6 !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-icms-input:hover,
[data-theme="dark"] #modal-cotacao .cpq-icms-input:hover,
[data-theme="dark"] #modal-cpq-config .cpq-icms-input:hover {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: #3a3a3a !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-icms-input:focus,
[data-theme="dark"] #modal-cotacao .cpq-icms-input:focus,
[data-theme="dark"] #modal-cpq-config .cpq-icms-input:focus {
    background: #1a1a1a !important;
    border-color: #ffffff !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12) !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-icms-row-active td,
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-icms-row-active th,
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-icms-col-active {
    background: rgba(255, 255, 255, 0.06) !important;
}

/* Generic catch-all: utilitários com letra preta + fundo preto.
   Acontece quando o módulo redefine `--cpq-ink: #f3f4f6` (claro em
   dark) MAS algum CSS hardcoded usa `color: #111`. Forçamos texto
   claro em qualquer descendente do módulo cujo fundo seja escuro. */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) [style*="color: #111"],
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) [style*="color:#111"],
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) [style*="color: rgb(17"] {
    color: #f3f4f6 !important;
}

/* Botão "Salvar Cotação" — body-appended ou interno. Cobre vários
   IDs/classes possíveis usados pelo módulo. */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) #btn-salvar-cotacao,
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) [id*="salvar-cotacao"],
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) [class*="cpq-save"],
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) [class*="cpq-btn-save"],
[data-theme="dark"] #modal-cotacao [id*="salvar"],
[data-theme="dark"] #modal-cotacao [class*="cpq-save"],
[data-theme="dark"] #modal-cotacao [class*="btn-save"],
[data-theme="dark"] #modal-cotacao .cpq-btn-primary,
[data-theme="dark"] #modal-cpq-config .cpq-btn-primary,
[data-theme="dark"] .cpq-quick-modal .cpq-btn-primary,
[data-theme="dark"] .cpq-quick-modal [class*="btn-save"] {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] #modal-cotacao .cpq-btn-primary *,
[data-theme="dark"] #modal-cpq-config .cpq-btn-primary *,
[data-theme="dark"] .cpq-quick-modal .cpq-btn-primary * {
    color: #0f0f0f !important;
}

/* Botão de pesquisa de produto (white bg + white icon).
   .cpq-product-search é container — precisamos do botão dentro */
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-product-search button,
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-product-search .cpq-btn,
[data-theme="dark"] #modal-cotacao .cpq-product-search button,
[data-theme="dark"] #modal-cotacao .cpq-product-search .cpq-btn {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2f2f2f !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-product-search button i,
[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-product-search .cpq-btn i,
[data-theme="dark"] #modal-cotacao .cpq-product-search button i,
[data-theme="dark"] #modal-cotacao .cpq-product-search .cpq-btn i {
    color: #f3f4f6 !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-product-search button:hover,
[data-theme="dark"] #modal-cotacao .cpq-product-search button:hover {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-product-search button:hover i,
[data-theme="dark"] #modal-cotacao .cpq-product-search button:hover i {
    color: #0f0f0f !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-product-results,
[data-theme="dark"] #modal-cotacao .cpq-product-results {
    background: #161616 !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6 !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-product-item,
[data-theme="dark"] #modal-cotacao .cpq-product-item {
    border-color: #2a2a2a !important;
    color: #f3f4f6 !important;
}

[data-theme="dark"] .cotacao-module:not([data-module-theme="light"]) .cpq-product-item:hover,
[data-theme="dark"] #modal-cotacao .cpq-product-item:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

/* ─────────────────────────────────────────────────────────────────
   9.2 — REGRAS DE DESCONTO refinements
   ───────────────────────────────────────────────────────────────── */
/* dr-icon-btn: garante fundo dark + ícone claro mesmo com primary-soft
   sendo rgba(255,255,255,0.08) (que ficaria lavado em surfaces claras
   internas) */
[data-theme="dark"] .dr-modal .dr-icon-btn,
[data-theme="dark"] .dr-module:not([data-module-theme="light"]) .dr-icon-btn,
[data-theme="dark"] .discount-rules-module:not([data-module-theme="light"]) .dr-icon-btn {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .dr-modal .dr-icon-btn i,
[data-theme="dark"] .dr-module:not([data-module-theme="light"]) .dr-icon-btn i,
[data-theme="dark"] .discount-rules-module:not([data-module-theme="light"]) .dr-icon-btn i {
    color: #f3f4f6 !important;
}

[data-theme="dark"] .dr-modal .dr-icon-btn:hover,
[data-theme="dark"] .dr-module:not([data-module-theme="light"]) .dr-icon-btn:hover {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .dr-modal .dr-icon-btn:hover i,
[data-theme="dark"] .dr-module:not([data-module-theme="light"]) .dr-icon-btn:hover i {
    color: #0f0f0f !important;
}

[data-theme="dark"] .dr-modal .dr-icon-btn--danger:hover,
[data-theme="dark"] .dr-module:not([data-module-theme="light"]) .dr-icon-btn--danger:hover {
    background: #d92d20 !important;
    color: #ffffff !important;
    border-color: #d92d20 !important;
}

[data-theme="dark"] .dr-modal .dr-icon-btn--danger:hover i,
[data-theme="dark"] .dr-module:not([data-module-theme="light"]) .dr-icon-btn--danger:hover i {
    color: #ffffff !important;
}

/* ─────────────────────────────────────────────────────────────────
   9.3 — SERVIÇO refinements
   ───────────────────────────────────────────────────────────────── */

/* Modal de Nova OS — botão Salvar (#fff/#fff) */
[data-theme="dark"] .svcos-modal,
[data-theme="dark"] .svcos-modal-overlay {
    color: #f3f4f6 !important;
}

[data-theme="dark"] .svcos-modal {
    background: #161616 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .svcos-modal-header,
[data-theme="dark"] .svcos-modal-body,
[data-theme="dark"] .svcos-modal-footer {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .svcos-modal-title h3 {
    color: #f3f4f6 !important;
}

[data-theme="dark"] .svcos-modal input:not([type="checkbox"]):not([type="radio"]),
[data-theme="dark"] .svcos-modal select,
[data-theme="dark"] .svcos-modal textarea {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2f2f2f !important;
}

[data-theme="dark"] .svcos-modal label {
    color: #c7c7c7 !important;
}

[data-theme="dark"] .svcos-modal .svc-btn-primary,
[data-theme="dark"] .svcos-modal .svc-btn-save-close,
[data-theme="dark"] .svcos-modal [class*="btn-save"],
[data-theme="dark"] .svcos-modal [class*="btn-primary"] {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .svcos-modal .svc-btn-primary *,
[data-theme="dark"] .svcos-modal [class*="btn-save"] *,
[data-theme="dark"] .svcos-modal [class*="btn-primary"] * {
    color: #0f0f0f !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-btn-primary,
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-btn-save-close {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-btn-primary *,
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-btn-save-close * {
    color: #0f0f0f !important;
}

/* svcat-grid (catálogo de serviços usando voyger-grid) — vc-* já
   resolvido via 9.0; reforço de container */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svcat-grid,
[data-theme="dark"] .svcat-modal .svcat-grid {
    background: #161616 !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6 !important;
}

/* Aba contratos — header + hover */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-contract-row {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-contract-row:not(.svc-contract-row-head):hover {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-contract-row-head {
    background: #1a1a1a !important;
    color: #c7c7c7 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-col-label-icon {
    color: #c7c7c7 !important;
    opacity: 0.85;
}

/* Filtros da aba contratos — selecionado branco/branco */
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) [class*="svc-contract-filter"],
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) [class*="svc-filter"],
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) [class*="svc-tab"]:not(.active) {
    background: #1a1a1a !important;
    color: #c7c7c7 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) [class*="svc-contract-filter"]:hover,
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) [class*="svc-filter"]:hover {
    background: #1f1f1f !important;
    color: #ffffff !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) [class*="svc-contract-filter"].active,
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) [class*="svc-filter"].active,
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) [class*="svc-tab"].active {
    color: #ffffff !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) [class*="svc-contract-filter"].active *,
[data-theme="dark"] .servico-module:not([data-module-theme="light"]) [class*="svc-filter"].active *,

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svcos-pipe-step.active {
    background-color: #8b8b8b !important;
}

[data-theme="dark"] .servico-module:not([data-module-theme="light"]) .svc-tab.active {
    background-color: #8b8b8b !important;
}

[data-theme="dark"] .cpq-motor-config-card {
    background: transparent !important;
}

[data-theme="dark"] .cpq-history-item {
    color: white !important;
}

/* ─────────────────────────────────────────────────────────────────
   9.4 — VENDAS-CONFIG refinements
   ───────────────────────────────────────────────────────────────── */

/* vc-config-grid thead th (background #e9ebf0) */
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-config-grid {
    background: #161616 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-config-grid thead th {
    background: #1a1a1a !important;
    color: #c7c7c7 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-config-grid tbody td {
    background: transparent !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-config-grid tbody tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.02) !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-config-grid tbody input,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-config-grid tbody select {
    color: #f3f4f6 !important;
    background: transparent !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-config-grid tbody input:hover,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-config-grid tbody select:hover {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: #3a3a3a !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-config-grid tbody input:focus,
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-config-grid tbody select:focus {
    background: #1a1a1a !important;
    border-color: #ffffff !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.10) !important;
}

/* vc-icms-matrix completa */
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-icms-matrix-wrapper {
    background: #161616 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-icms-matrix thead th {
    background: #1a1a1a !important;
    color: #c7c7c7 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-icms-corner {
    background: #1a1a1a !important;
    color: #c7c7c7 !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-icms-row-head {
    background: #1f1f1f !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-icms-cell {
    background: #161616 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-icms-input {
    background: transparent !important;
    color: #f3f4f6 !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-icms-input:hover {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: #3a3a3a !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-icms-input:focus {
    background: #1a1a1a !important;
    border-color: #ffffff !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12) !important;
}

/* vc-pagto-chip.active (bg=ink → branco; color=#fff hardcoded → invisível) */
[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-pagto-chip {
    background: #1a1a1a !important;
    color: #c7c7c7 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-pagto-chip:hover {
    background: #1f1f1f !important;
    color: #ffffff !important;
    border-color: #3a3a3a !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-pagto-chip.active {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .vc-root:not([data-module-theme="light"]) .vc-pagto-chip.active * {
    color: #0f0f0f !important;
}

/* ─────────────────────────────────────────────────────────────────
   9.5 — MDM refinements
   ───────────────────────────────────────────────────────────────── */

/* Modal header (montado no body via .dashboard-modal.mdm-modal) */
[data-theme="dark"] .mdm-modal,
[data-theme="dark"] .dashboard-modal.mdm-modal {
    color: #f3f4f6;
}

[data-theme="dark"] .mdm-modal .mdm-modal-content,
[data-theme="dark"] .dashboard-modal.mdm-modal .mdm-modal-content {
    background: #161616 !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6 !important;
    box-shadow: 0 28px 52px rgba(0, 0, 0, 0.6) !important;
}

[data-theme="dark"] .mdm-modal .mdm-modal-header {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .mdm-modal .mdm-modal-title-area h3 {
    color: #f3f4f6 !important;
}

[data-theme="dark"] .mdm-modal .mdm-modal-title-area p,
[data-theme="dark"] .mdm-modal .mdm-modal-title-area small {
    color: #8b8b8b !important;
}

[data-theme="dark"] .mdm-modal .mdm-modal-icon {
    background: rgba(255, 255, 255, 0.10) !important;
    color: #f3f4f6 !important;
}

[data-theme="dark"] .mdm-modal .mdm-modal-close {
    background: transparent !important;
    color: #c7c7c7 !important;
}

[data-theme="dark"] .mdm-modal .mdm-modal-close:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .mdm-modal label,
[data-theme="dark"] .mdm-modal .mdm-form-label {
    color: #c7c7c7 !important;
}

[data-theme="dark"] .mdm-modal input:not([type="checkbox"]):not([type="radio"]),
[data-theme="dark"] .mdm-modal select,
[data-theme="dark"] .mdm-modal textarea {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2f2f2f !important;
}

[data-theme="dark"] .mdm-modal input:focus,
[data-theme="dark"] .mdm-modal select:focus,
[data-theme="dark"] .mdm-modal textarea:focus {
    border-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08) !important;
}

/* mdm-btn-primary — bg=var(--mdm-ink) já invertido para #f3f4f6 (claro
   em dark) + color: #fff hardcoded → invisível. Forçar texto escuro. */
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) .mdm-btn-primary,
[data-theme="dark"] .mdm-modal .mdm-btn-primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) .mdm-btn-primary *,
[data-theme="dark"] .mdm-modal .mdm-btn-primary * {
    color: #0f0f0f !important;
}

[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) .mdm-btn-primary:hover,
[data-theme="dark"] .mdm-modal .mdm-btn-primary:hover {
    background: #e5e5e5 !important;
    color: #0f0f0f !important;
}

/* mdm-btn-secondary hover = bg=ink + #fff → mesmo problema */
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) .mdm-btn-secondary {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border-color: #2f2f2f !important;
}

[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) .mdm-btn-secondary:hover {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) .mdm-btn-outline {
    background: transparent !important;
    color: #f3f4f6 !important;
    border-color: #2f2f2f !important;
}

[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) .mdm-btn-outline:hover {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

/* #addDeviceBtn + qualquer botão "primary" white-on-white em MDM */
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) #addDeviceBtn,
[data-theme="dark"] .mdm-modal #addDeviceBtn,
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) [id*="addDevice"],
[data-theme="dark"] .mdm-modal [id*="addDevice"],
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) [id*="quickDevice"],
[data-theme="dark"] .mdm-modal [id*="quickDevice"],
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) [id*="QuickDevice"],
[data-theme="dark"] .mdm-modal [id*="QuickDevice"] {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) #addDeviceBtn *,
[data-theme="dark"] .mdm-modal #addDeviceBtn *,
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) [id*="addDevice"] *,
[data-theme="dark"] .mdm-modal [id*="addDevice"] * {
    color: #0f0f0f !important;
}

/* Tabelas internas do MDM (mdm-data-table) */
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) .mdm-table-card,
[data-theme="dark"] .mdm-modal .mdm-table-card {
    background: #161616 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) .mdm-data-table {
    color: #c7c7c7 !important;
}

[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) .mdm-data-table thead th {
    background: #1a1a1a !important;
    color: #c7c7c7 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) .mdm-data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) .mdm-data-table td {
    color: #f3f4f6 !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
}

/* Cards/empresa cards do MDM */
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) .mdm-company-card {
    background: #161616 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) .mdm-company-card:hover {
    border-color: #3a3a3a !important;
}

[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) .mdm-company-card-name {
    color: #f3f4f6 !important;
}

[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) .mdm-company-card-id,
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) .mdm-company-card-meta span {
    color: #8b8b8b !important;
}

/* Configurações globais + Editor de regras de segurança — selectors
   genéricos para qualquer painel/seção do MDM com fundo branco */
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) [class*="mdm-global"],
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) [class*="mdm-security"],
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) [class*="mdm-config"],
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) [class*="mdm-rules"],
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) [class*="mdm-settings"],
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) [class*="mdm-panel"],
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) [class*="mdm-section"],
[data-theme="dark"] .mdm-modal [class*="mdm-global"],
[data-theme="dark"] .mdm-modal [class*="mdm-security"],
[data-theme="dark"] .mdm-modal [class*="mdm-config"],
[data-theme="dark"] .mdm-modal [class*="mdm-rules"],
[data-theme="dark"] .mdm-modal [class*="mdm-settings"] {
    background-color: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) [class*="mdm-global"] h1,
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) [class*="mdm-global"] h2,
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) [class*="mdm-global"] h3,
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) [class*="mdm-security"] h1,
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) [class*="mdm-security"] h2,
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) [class*="mdm-security"] h3,
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) [class*="mdm-rules"] h1,
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) [class*="mdm-rules"] h2,
[data-theme="dark"] .mdm-module:not([data-module-theme="light"]) [class*="mdm-rules"] h3 {
    color: #f3f4f6 !important;
}

/* ---------- 7. Transição suave ---------- */
:root[data-theme] body,
:root[data-theme] [class*="-module"],
:root[data-theme] .voyger-tab-bar,
:root[data-theme] .dashboard-header {
    transition: background-color 220ms cubic-bezier(.4, 0, .2, 1),
        color 220ms cubic-bezier(.4, 0, .2, 1),
        border-color 220ms cubic-bezier(.4, 0, .2, 1);
}

/* =================================================================
 *  8. MODAIS — Perfil (#profile-modal) e Settings v3 (.settings-modal-v3)
 *  -----------------------------------------------------------------
 *  Os dois modais são definidos em modal-system.css / profile-modal.css
 *  / simple-settings-modal.css com cores hardcoded (#fff, #fafafa,
 *  #f5f5f5, #e5e7eb, #1a1a1a, etc.) e usam tokens --modal-* fixos.
 *  Para o dark mode funcionar precisamos:
 *    a) reescrever os tokens --modal-* dentro de [data-theme="dark"];
 *    b) sobrescrever as regras com hex hardcoded usando seletores
 *       específicos (mesma especificidade) com !important.
 * ================================================================= */

/* 8.1 Reescreve tokens --modal-* / --settings-* no dark.
   Mantemos black/white "invertidos" para que gradientes e elementos
   que usam os tokens automaticamente fiquem coerentes. */
:root[data-theme="dark"] {
    --modal-black: #f3f4f6;
    --modal-dark: #e5e7eb;
    --modal-gray-dark: #d1d5db;
    --modal-gray: #9ca3af;
    --modal-gray-light: #6b7280;
    --modal-gray-lighter: #2a2a2a;
    --modal-white-dark: #161616;
    --modal-white: #1a1a1a;

    --settings-black: #f3f4f6;
    --settings-dark: #e5e7eb;
    --settings-gray-dark: #d1d5db;
    --settings-gray: #9ca3af;
    --settings-gray-light: #6b7280;
    --settings-gray-lighter: #2a2a2a;
    --settings-white-dark: #161616;
    --settings-white: #1a1a1a;

    --modal-gradient-primary: linear-gradient(135deg, #1f1f1f 0%, #2a2a2a 100%);
    --modal-gradient-secondary: linear-gradient(135deg, #2a2a2a 0%, #3a3a3a 100%);
    --modal-gradient-light: linear-gradient(135deg, #161616 0%, #1a1a1a 100%);
    --settings-gradient-primary: linear-gradient(135deg, #1f1f1f 0%, #2a2a2a 100%);
    --settings-gradient-secondary: linear-gradient(135deg, #2a2a2a 0%, #3a3a3a 100%);
    --settings-gradient-light: linear-gradient(135deg, #161616 0%, #1a1a1a 100%);
}

/* ---------- 8.2 PROFILE MODAL ---------- */

[data-theme="dark"] #profile-modal .profile-modal-content {
    background: #1a1a1a !important;
    border: 1px solid #2a2a2a !important;
    color: #e5e7eb;
}

[data-theme="dark"] #profile-modal .profile-modal-header {
    background: #1a1a1a !important;
    border-bottom: none !important;
}

[data-theme="dark"] #profile-modal .profile-modal-header h2 {
    color: #e5e7eb !important;
}

[data-theme="dark"] #profile-modal .profile-modal-nav {
    background: #1a1a1a !important;
    border-right: none !important;
    border-bottom-color: #2a2a2a !important;
}

[data-theme="dark"] #profile-modal .profile-nav-btn {
    color: #9ca3af;
    border-bottom-color: transparent !important;
}

[data-theme="dark"] #profile-modal .profile-nav-btn:hover {
    background: none !important;
    color: #d1d5db;
    transform: none !important;
}

[data-theme="dark"] #profile-modal .profile-nav-btn.active {
    background: none !important;
    color: #e5e7eb !important;
    border-bottom-color: #e5e7eb !important;
    box-shadow: none !important;
    transform: none !important;
}

[data-theme="dark"] #profile-modal .profile-modal-sections {
    background: #1a1a1a !important;
    color: #e5e7eb;
}

[data-theme="dark"] #profile-modal .profile-section h3,
[data-theme="dark"] #profile-modal .profile-section h4 {
    color: #f3f4f6;
}

[data-theme="dark"] #profile-modal .profile-content {
    background: transparent !important;
    border: none !important;
    color: #e5e7eb;
}

[data-theme="dark"] #profile-modal .profile-left-card {
    background: #222 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] #profile-modal .profile-form-footer {
    border-top-color: #2a2a2a !important;
}

[data-theme="dark"] #profile-modal .btn-save-changes {
    background: #e5e7eb !important;
    color: #1a1a1a !important;
}

[data-theme="dark"] #profile-modal .btn-save-changes:hover {
    background: #fff !important;
}

[data-theme="dark"] #profile-modal .form-group label {
    color: #d1d5db;
}

[data-theme="dark"] #profile-modal .form-group input[type="text"],
[data-theme="dark"] #profile-modal .form-group input[type="email"],
[data-theme="dark"] #profile-modal .form-group input[type="number"],
[data-theme="dark"] #profile-modal .form-group input[type="password"],
[data-theme="dark"] #profile-modal .form-group input[type="tel"],
[data-theme="dark"] #profile-modal .form-group select,
[data-theme="dark"] #profile-modal .form-group textarea {
    background: #252525 !important;
    color: #f3f4f6 !important;
    border-color: #333 !important;
}

[data-theme="dark"] #profile-modal .form-group input:focus,
[data-theme="dark"] #profile-modal .form-group select:focus,
[data-theme="dark"] #profile-modal .form-group textarea:focus {
    border-color: #e5e7eb !important;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] #profile-modal .form-group input[readonly],
[data-theme="dark"] #profile-modal .form-group input:disabled,
[data-theme="dark"] #profile-modal .form-group select:disabled {
    background: #1e1e1e !important;
    color: #555 !important;
}

[data-theme="dark"] #profile-modal .form-group small {
    color: #9ca3af;
}

[data-theme="dark"] #profile-modal .checkbox-label {
    color: #d1d5db;
}

[data-theme="dark"] #profile-modal .profile-message.success {
    background: #1a3327 !important;
    color: #6ee7b7 !important;
    border-color: #2d5040 !important;
}

[data-theme="dark"] #profile-modal .profile-message.error {
    background: #3a1a1a !important;
    color: #fca5a5 !important;
    border-color: #5c2a2a !important;
}

[data-theme="dark"] #profile-modal .profile-message.info {
    background: #1a2a3a !important;
    color: #93c5fd !important;
    border-color: #2a3f5a !important;
}

[data-theme="dark"] #profile-modal .profile-modal-sections::-webkit-scrollbar-track,
[data-theme="dark"] #profile-modal .profile-modal-nav::-webkit-scrollbar-track {
    background: #161616;
}

[data-theme="dark"] #profile-modal .profile-modal-sections::-webkit-scrollbar-thumb,
[data-theme="dark"] #profile-modal .profile-modal-nav::-webkit-scrollbar-thumb {
    background: #3a3a3a;
}

[data-theme="dark"] #profile-modal .profile-modal-sections::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] #profile-modal .profile-modal-nav::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a;
}

/* Painel lateral do user-profile no header */
[data-theme="dark"] .profile-panel-backdrop {
    background: linear-gradient(270deg, rgba(2, 6, 23, 0.28) 0%, rgba(2, 6, 23, 0.1) 28%, rgba(2, 6, 23, 0) 100%);
}

[data-theme="dark"] .profile-side-panel {
    background: var(--vt-sidebar-drawer, rgba(12, 18, 29, 0.96)) !important;
    border-left-color: var(--vt-sidebar-border, rgba(71, 85, 105, 0.45)) !important;
    box-shadow: -22px 0 60px rgba(0, 0, 0, 0.55) !important;
}

[data-theme="dark"] .profile-side-panel__header {
    border-bottom-color: rgba(71, 85, 105, 0.35) !important;
}

[data-theme="dark"] .profile-side-panel__branch-card,
[data-theme="dark"] .profile-panel-link {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(71, 85, 105, 0.35) !important;
}

[data-theme="dark"] .profile-panel-link {
    color: #e5e7eb !important;
}

[data-theme="dark"] .profile-side-panel__branch-scope,
[data-theme="dark"] .profile-side-panel__branch-mark,
[data-theme="dark"] .profile-panel-link__icon {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(71, 85, 105, 0.32) !important;
    color: var(--vt-sidebar-accent, #bfdbfe) !important;
}

[data-theme="dark"] .profile-panel-link__copy strong,
[data-theme="dark"] .profile-side-panel__copy strong,
[data-theme="dark"] .profile-side-panel__branch-copy strong,
[data-theme="dark"] .profile-side-panel__branch-detail strong,
[data-theme="dark"] .profile-side-panel__branch-card strong {
    color: #f8fafc !important;
}

[data-theme="dark"] .profile-panel-link__copy small,
[data-theme="dark"] .profile-side-panel__copy span:last-child,
[data-theme="dark"] .profile-side-panel__branch-copy span,
[data-theme="dark"] .profile-side-panel__branch-detail span {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .profile-panel-link:hover,
[data-theme="dark"] .profile-panel-link:focus-visible {
    background: var(--vt-sidebar-active, rgba(255, 255, 255, 0.1)) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .profile-side-panel__branch-detail {
    border-top-color: rgba(71, 85, 105, 0.28) !important;
}

[data-theme="dark"] .profile-side-panel__actions hr {
    border-color: rgba(71, 85, 105, 0.35) !important;
}

[data-theme="dark"] .profile-panel-logout {
    background: rgba(248, 113, 113, 0.12) !important;
    border-color: rgba(248, 113, 113, 0.26) !important;
    color: #fecaca !important;
}

[data-theme="dark"] .profile-panel-logout:hover,
[data-theme="dark"] .profile-panel-logout:focus-visible {
    background: rgba(248, 113, 113, 0.2) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .user-profile #user-name {
    color: #e5e7eb !important;
}

[data-theme="dark"] .user-profile .fa-chevron-right {
    color: #9ca3af !important;
}

/* ---------- 8.3 SETTINGS MODAL V3 ---------- */

[data-theme="dark"] .settings-modal-content-v3 {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
    color: #e5e7eb;
}

[data-theme="dark"] .settings-modal-header-v3 {
    background: linear-gradient(135deg, #1f1f1f 0%, #2a2a2a 100%) !important;
    border-bottom-color: #2a2a2a !important;
}

[data-theme="dark"] .settings-modal-nav-v3 {
    background: linear-gradient(180deg, #161616 0%, #1a1a1a 100%) !important;
    border-right-color: #2a2a2a !important;
}

[data-theme="dark"] .settings-nav-btn-v3 {
    color: #9ca3af;
}

[data-theme="dark"] .settings-nav-btn-v3:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #f3f4f6;
}

[data-theme="dark"] .settings-nav-btn-v3.active {
    background: linear-gradient(135deg, #2a2a2a 0%, #3a3a3a 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .settings-modal-sections-v3 {
    background: #1a1a1a !important;
    color: #e5e7eb;
}

[data-theme="dark"] .settings-section-v3 h3 {
    color: #f3f4f6;
}

[data-theme="dark"] .settings-content-v3 {
    background: #161616 !important;
    border-color: #2a2a2a !important;
    color: #e5e7eb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .settings-card-v3,
[data-theme="dark"] .settings-subsection-v3 {
    background: #1f1f1f !important;
    border-color: #2a2a2a !important;
    color: #e5e7eb;
}

[data-theme="dark"] .settings-card-v3 h4,
[data-theme="dark"] .settings-subsection-v3 h4 {
    color: #f3f4f6;
}

[data-theme="dark"] .settings-modal-v3 .form-group label {
    color: #d1d5db;
}

[data-theme="dark"] .settings-modal-v3 .form-group input[type="text"],
[data-theme="dark"] .settings-modal-v3 .form-group input[type="email"],
[data-theme="dark"] .settings-modal-v3 .form-group input[type="number"],
[data-theme="dark"] .settings-modal-v3 .form-group input[type="password"],
[data-theme="dark"] .settings-modal-v3 .form-group select,
[data-theme="dark"] .settings-modal-v3 .form-group textarea {
    background: #1f1f1f !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .settings-modal-v3 .form-group input:focus,
[data-theme="dark"] .settings-modal-v3 .form-group select:focus,
[data-theme="dark"] .settings-modal-v3 .form-group textarea:focus {
    border-color: #6b7280 !important;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .settings-modal-v3 .checkbox-label {
    color: #d1d5db !important;
}

[data-theme="dark"] .settings-description-v3 {
    color: #9ca3af !important;
}

[data-theme="dark"] .upload-preview-v3 {
    border-color: #3a3a3a;
    color: #6b7280;
    background: #161616;
}

[data-theme="dark"] .upload-preview-v3:hover {
    border-color: #f3f4f6;
    color: #f3f4f6;
}

[data-theme="dark"] .settings-message-v3:not(:empty) {
    background: #1f1f1f;
    border-left-color: #f3f4f6;
    color: #e5e7eb;
}

[data-theme="dark"] .settings-modal-sections-v3::-webkit-scrollbar-track {
    background: #161616;
}

[data-theme="dark"] .settings-modal-sections-v3::-webkit-scrollbar-thumb {
    background: #3a3a3a;
}

[data-theme="dark"] .settings-modal-sections-v3::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a;
}

/* Suaviza fundo de avisos amarelos (fiscal-warning) sem perder destaque */
[data-theme="dark"] .fiscal-warning-v3 {
    background: rgba(252, 211, 77, 0.1) !important;
    border-color: rgba(252, 211, 77, 0.35) !important;
}

[data-theme="dark"] .fiscal-warning-v3 p {
    color: #fcd34d !important;
}

/* =================================================================
 *  9. MÓDULOS PDV — Caixa (PDV), Fechamento de Caixa, Supervisor
 *  -----------------------------------------------------------------
 *  Os 4 módulos abaixo seguem a mesma identidade Premium Monocromática
 *  e expõem tokens scopados (--ck-*, --cc-*, --sr-*, --pdv-*).
 *  Estratégia: redefinir os tokens no escopo [data-theme="dark"] e
 *  o módulo herda as cores corretas em quase todo lugar. Overrides
 *  pontuais (com !important) cobrem cores hardcoded em hex.
 *
 *  A regra :not([data-module-theme="light"]) preserva o opt-out
 *  por módulo (lista runtime via VoygerDarkTheme.disableForModule).
 * ================================================================= */

/* ---------- 9.1 CHECKOUT (.ck-module) — "Caixa (PDV)" hub ---------- */
[data-theme="dark"] .ck-module:not([data-module-theme="light"]) {
    --ck-ink: #f3f4f6;
    --ck-ink-soft: #cbd1d9;
    --ck-ink-muted: #8b8f97;
    --ck-surface: #161616;
    --ck-surface-alt: #0f0f0f;
    --ck-surface-soft: rgba(22, 22, 22, 0.88);
    --ck-border: #2a2a2a;
    --ck-border-strong: #3a3a3a;
    --ck-primary: #ffffff;
    --ck-primary-soft: rgba(255, 255, 255, 0.08);
    --ck-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.5);
    --ck-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.65);
}

/* Hero usa background fixo escuro (#111) — em dark fica praticamente igual,
   mas aumentamos contraste do gradiente lateral usando primary invertido */
[data-theme="dark"] .ck-module:not([data-module-theme="light"]) .ck-hero {
    background: linear-gradient(140deg, #1a1a1a 0%, #0f0f0f 100%);
    box-shadow: 0 28px 52px rgba(0, 0, 0, 0.6);
}

/* Botões "primary" usam cor sólida do --ck-ink que agora é claro;
   forçamos texto escuro no botão claro pra manter contraste */
[data-theme="dark"] .ck-module:not([data-module-theme="light"]) .ck-btn-primary,
[data-theme="dark"] .ck-module:not([data-module-theme="light"]) .ck-btn-hero-primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .ck-module:not([data-module-theme="light"]) .ck-btn-primary:hover,
[data-theme="dark"] .ck-module:not([data-module-theme="light"]) .ck-btn-hero-primary:hover {
    background: #e5e7eb !important;
    color: #0f0f0f !important;
}

/* Input/select genéricos */
[data-theme="dark"] .ck-module:not([data-module-theme="light"]) input,
[data-theme="dark"] .ck-module:not([data-module-theme="light"]) select,
[data-theme="dark"] .ck-module:not([data-module-theme="light"]) textarea {
    background: #1f1f1f;
    color: #f3f4f6;
    border-color: #2a2a2a;
}

/* ---------- 9.2 CASH-CLOSING (.cc-module) — Fechamento de Caixa ---------- */
[data-theme="dark"] .cc-module:not([data-module-theme="light"]) {
    --cc-ink: #f3f4f6;
    --cc-ink-soft: #cbd1d9;
    --cc-ink-muted: #8b8f97;
    --cc-surface: #161616;
    --cc-surface-alt: #0f0f0f;
    --cc-border: #2a2a2a;
    --cc-border-strong: #3a3a3a;
    --cc-primary: #ffffff;
    --cc-primary-soft: rgba(255, 255, 255, 0.08);
    --cc-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.5);
    --cc-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.65);
}

/* Hero original usa background:var(--cc-ink) → ficaria branco no dark.
   Reescrevemos para gradiente escuro consistente com o resto. */
[data-theme="dark"] .cc-module:not([data-module-theme="light"]) .cc-hero {
    background: linear-gradient(140deg, #1a1a1a 0%, #0f0f0f 100%);
}

/* Pipeline step ativo usa background:var(--cc-ink) — agora claro.
   Preservamos com texto escuro pra manter contraste */
[data-theme="dark"] .cc-module:not([data-module-theme="light"]) .cc-pipeline-step.active {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .cc-module:not([data-module-theme="light"]) .cc-pipeline-step.active .cc-pipeline-icon {
    color: #0f0f0f !important;
}

/* Botões primary/outline — mesmo problema do checkout */
[data-theme="dark"] .cc-module:not([data-module-theme="light"]) .cc-btn--primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .cc-module:not([data-module-theme="light"]) .cc-btn--primary:hover {
    background: #e5e7eb !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .cc-module:not([data-module-theme="light"]) .cc-btn--outline:hover {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

/* Sellers podium usa cores fixas — escurecer barras 2/3 e fundo da #1 */
[data-theme="dark"] .cc-module:not([data-module-theme="light"]) .cc-podium-bar--1 {
    background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
}

[data-theme="dark"] .cc-module:not([data-module-theme="light"]) .cc-podium-bar--2 {
    background: #232323;
}

[data-theme="dark"] .cc-module:not([data-module-theme="light"]) .cc-podium-bar--3 {
    background: #1c1c1c;
}

/* Modal close — mesmo padrão de inversão */
[data-theme="dark"] .cc-module:not([data-module-theme="light"]) .cc-modal-close:hover {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

/* Loading overlay com fundo branco translúcido — escurecer */
[data-theme="dark"] .cc-module:not([data-module-theme="light"]) .cc-loading {
    background: rgba(15, 15, 15, 0.9);
}

/* Modal box-shadow mais profunda no dark */
[data-theme="dark"] .cc-module:not([data-module-theme="light"]) .cc-modal {
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.7);
}

/* ---------- 9.3 SUPERVISOR-REQUESTS (.supervisor-requests-module) ---------- */
[data-theme="dark"] .supervisor-requests-module:not([data-module-theme="light"]) {
    --sr-color-ink: #f3f4f6;
    --sr-color-ink-soft: #cbd1d9;
    --sr-color-ink-muted: #8b8f97;
    --sr-color-surface: #161616;
    --sr-color-surface-alt: #0f0f0f;
    --sr-color-surface-soft: rgba(22, 22, 22, 0.88);
    --sr-color-border: #2a2a2a;
    --sr-color-border-strong: #3a3a3a;
    --sr-color-primary: #ffffff;
    --sr-color-primary-soft: rgba(255, 255, 255, 0.08);
    --sr-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.5);
    --sr-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.65);
}

/* Botão primary (background --sr-color-primary que virou branco) — texto escuro */
[data-theme="dark"] .supervisor-requests-module:not([data-module-theme="light"]) .btn-primary,
[data-theme="dark"] .supervisor-requests-module:not([data-module-theme="light"]) .module-actions button.primary {
    color: #0f0f0f !important;
}

[data-theme="dark"] .supervisor-requests-module:not([data-module-theme="light"]) .btn-primary:hover,
[data-theme="dark"] .supervisor-requests-module:not([data-module-theme="light"]) .module-actions button.primary:hover {
    background: #161616 !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .supervisor-requests-module:not([data-module-theme="light"]) .btn-secondary:hover,
[data-theme="dark"] .supervisor-requests-module:not([data-module-theme="light"]) .module-actions button.secondary:hover {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

/* Filter select hardcoda background:#ffffff no focus */
[data-theme="dark"] .supervisor-requests-module:not([data-module-theme="light"]) .filter-group select:focus {
    background: #1f1f1f !important;
    border-color: #ffffff !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12) !important;
}

/* Request cards com tints coloridos — leve aumento de opacidade pra
   compensar fundo escuro */
[data-theme="dark"] .supervisor-requests-module:not([data-module-theme="light"]) .request-card.pending {
    background: rgba(247, 144, 9, 0.12);
    border-color: rgba(247, 144, 9, 0.3);
}

[data-theme="dark"] .supervisor-requests-module:not([data-module-theme="light"]) .request-card.urgent {
    background: rgba(217, 45, 32, 0.12);
    border-color: rgba(217, 45, 32, 0.32);
}

[data-theme="dark"] .supervisor-requests-module:not([data-module-theme="light"]) .request-card.approved {
    background: rgba(18, 183, 106, 0.12);
    border-color: rgba(18, 183, 106, 0.3);
}

[data-theme="dark"] .supervisor-requests-module:not([data-module-theme="light"]) .request-card.rejected {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.18);
}

[data-theme="dark"] .supervisor-requests-module:not([data-module-theme="light"]) .request-status {
    background: rgba(255, 255, 255, 0.1);
}

/* ---------- 9.4 CAIXA-PDV (.caixa-pdv-module) — página standalone ---------- */
[data-theme="dark"] .caixa-pdv-module {
    --pdv-ink: #f3f4f6;
    --pdv-ink-soft: #cbd1d9;
    --pdv-ink-muted: #8b8f97;
    --pdv-surface: #161616;
    --pdv-surface-alt: #0f0f0f;
    --pdv-border: #2a2a2a;
    --pdv-border-strong: #3a3a3a;
    --pdv-primary: #ffffff;
    --pdv-primary-soft: rgba(255, 255, 255, 0.08);
    --pdv-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.5);
    --pdv-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.65);
    --pdv-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --pdv-glass-soft-surface: #1a1a1a;
    --pdv-glass-input-surface: #1f1f1f;
    --pdv-glass-row-hover: #232323;

    /* aliases legacy --caixa-* (estilos inline gerados via JS) */
    --caixa-white: #161616;
    --caixa-white-dark: #0f0f0f;
    --caixa-gray-lighter: #2a2a2a;
    --caixa-gray-light: #cbd1d9;
    --caixa-gray: #8b8f97;
    --caixa-gray-dark: #d1d5db;
    --caixa-gradient-light: linear-gradient(135deg, #161616 0%, #0f0f0f 100%);
}

[data-theme="dark"] body.caixa-pdv-module {
    background: #0f0f0f;
    color: #f3f4f6;
}

[data-theme="dark"] .caixa-pdv-module .pdv-header {
    border-bottom-color: #2a2a2a;
}

/* Botões primary com background var(--pdv-primary) virou branco — texto escuro */
[data-theme="dark"] .caixa-pdv-module .pdv-btn-primary,
[data-theme="dark"] .caixa-pdv-module .pdv-header-btn--primary,
[data-theme="dark"] .caixa-pdv-module .btn-primary {
    color: #0f0f0f !important;
}

[data-theme="dark"] .caixa-pdv-module .pdv-btn-primary:hover,
[data-theme="dark"] .caixa-pdv-module .pdv-header-btn--primary:hover {
    background: #e5e7eb !important;
    color: #0f0f0f !important;
}

/* Inputs */
[data-theme="dark"] .caixa-pdv-module input,
[data-theme="dark"] .caixa-pdv-module select,
[data-theme="dark"] .caixa-pdv-module textarea {
    background: #1f1f1f;
    color: #f3f4f6;
    border-color: #2a2a2a;
}

[data-theme="dark"] .caixa-pdv-module input::placeholder,
[data-theme="dark"] .caixa-pdv-module textarea::placeholder {
    color: #6b7280;
}

/* Scrollbars */
[data-theme="dark"] .caixa-pdv-module ::-webkit-scrollbar-track {
    background: #0f0f0f;
}

[data-theme="dark"] .caixa-pdv-module ::-webkit-scrollbar-thumb {
    background: #3a3a3a;
}

[data-theme="dark"] .caixa-pdv-module ::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a;
}

/* =================================================================
 *  10. MÓDULOS DE ESTOQUE — DARK THEME COMPLETO
 *      inventory, products, expirations, rupture-control,
 *      price-divergence, store-layout
 *  -----------------------------------------------------------------
 *  Os 6 módulos têm TONELADAS de cores hardcoded em hex (#fff,
 *  #f9fafb, #111827, #e5e7eb, etc.) — não basta redefinir tokens.
 *  Cada módulo recebe:
 *    a) redefinição de tokens scopados (CSS variables)
 *    b) overrides explícitos para hex hardcoded (modais, cards,
 *       movimentos, timeline, status pills, etc.)
 *    c) inversão de botões "primary" (fundo claro/texto escuro)
 *
 *  Paleta dark uniforme entre os módulos:
 *    surface base:    #0f0f0f
 *    surface card:    #161616
 *    surface elevado: #1a1a1a
 *    input:           #1f1f1f
 *    hover:           #232323
 *    border:          #2a2a2a
 *    border forte:    #3a3a3a
 *    text primário:   #f3f4f6
 *    text secundário: #cbd1d9
 *    text muted:      #8b8f97
 * ================================================================= */

/* =================================================================
 *  10.1 INVENTORY (.inventory-module / .inventory-modal)
 * ================================================================= */
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]),
[data-theme="dark"] .inventory-modal:not([data-module-theme="light"]) {
    --inv-ink: #f3f4f6;
    --inv-ink-soft: #cbd1d9;
    --inv-ink-muted: #8b8f97;
    --inv-surface: #161616;
    --inv-surface-alt: #0f0f0f;
    --inv-surface-soft: rgba(22, 22, 22, 0.88);
    --inv-border: #2a2a2a;
    --inv-border-strong: #3a3a3a;
    --inv-primary: #ffffff;
    --inv-primary-soft: rgba(255, 255, 255, 0.08);
    --inv-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.5);
    --inv-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.65);
}

/* Fundo do módulo + scrollbar */
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) {
    background: #0f0f0f;
    color: #f3f4f6;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) ::-webkit-scrollbar-thumb {
    background: #3a3a3a;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) ::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a;
}

/* Hero (background:var(--inv-ink) → claro no dark) */
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .inv-hero {
    background: linear-gradient(140deg, #1a1a1a 0%, #0f0f0f 100%);
    box-shadow: 0 28px 52px rgba(0, 0, 0, 0.6);
}

/* Botões "primary" (fundo --inv-ink que virou claro) — texto escuro */
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .inv-btn-primary,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .inv-btn-hero-primary,
[data-theme="dark"] .inventory-modal:not([data-module-theme="light"]) .inv-btn-primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .inv-btn-primary:hover,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .inv-btn-hero-primary:hover {
    background: #e5e7eb !important;
    color: #0f0f0f !important;
}

/* Hover de toolbar/segmented/filter/card-btn que viram fundo claro */
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .inv-toolbar-btn:hover,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .inv-segmented-control button.active,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .inv-filter-btn.active,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-filter-btn.active,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .inv-card-btn:hover,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .inv-step.active .inv-step-number,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .inv-input-btn:hover,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .inv-search-trigger:hover {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

/* Modais do inventory — header/body/footer hardcoded em #fff via tokens */
[data-theme="dark"] .inventory-modal:not([data-module-theme="light"]) {
    background: #161616 !important;
    color: #f3f4f6;
}

[data-theme="dark"] .inventory-modal:not([data-module-theme="light"]) .inv-modal-header,
[data-theme="dark"] .inventory-modal:not([data-module-theme="light"]) .inv-modal-footer {
    background: #161616 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .inventory-modal:not([data-module-theme="light"]) .inv-steps-nav {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
}

/* Movimentações — bloco gigante de cores hardcoded ===================== */
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-card,
[data-theme="dark"] .inventory-modal:not([data-module-theme="light"]) .mov-card {
    background: #161616 !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-card:hover,
[data-theme="dark"] .inventory-modal:not([data-module-theme="light"]) .mov-card:hover {
    border-color: #3a3a3a !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-card-title,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-detail-title,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-empty h4,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-summary-value,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-type-title,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-return-option-title,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-timeline-heading,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-timeline-title,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-detail-grid strong,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .inv-search-item small b,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-result-main strong {
    color: #f3f4f6 !important;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-card-sub,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-card-bottom,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-card-title .mov-sku,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-summary-label,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-type-desc,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-return-option-desc,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-timeline-time,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-detail-grid span,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-empty,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-loading,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-sku,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .inv-search-item small {
    color: #cbd1d9 !important;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-muted,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-empty i,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .inv-search-empty {
    color: #6b7280 !important;
}

/* Cartões de wizard tipo/seleção/sumário/timeline */
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-type-card {
    background: #161616 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-type-card:hover {
    border-color: #4a90ff !important;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-type-card.selected {
    background: rgba(37, 99, 235, 0.15) !important;
    border-color: #3b82f6 !important;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-selected-card,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-summary-section,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-detail-grid>div,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-detail-note,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-timeline-payload,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-return-context {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-summary-grid>div {
    background: #161616 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-detail-header {
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-timeline {
    border-left-color: #2a2a2a !important;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-timeline-dot {
    border-color: #161616 !important;
}

/* Status / chip pills coloridos — ajusta opacidade e contraste */
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-status-pill.status-pending,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-summary-note.warn {
    background: rgba(245, 158, 11, 0.18) !important;
    color: #fcd34d !important;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-status-pill.status-transit {
    background: rgba(59, 130, 246, 0.18) !important;
    color: #93c5fd !important;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-status-pill.status-completed,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-status-pill.status-returned,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-summary-note.ok,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-chip.ok,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-type-badge.badge-returnable {
    background: rgba(16, 185, 129, 0.18) !important;
    color: #6ee7b7 !important;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-status-pill.status-failed,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-chip.bad,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-type-badge.badge-no-return {
    background: rgba(239, 68, 68, 0.18) !important;
    color: #fca5a5 !important;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-status-pill.status-cancelled,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-chip {
    background: #2a2a2a !important;
    color: #cbd1d9 !important;
}

/* Botões "Cancelar/Fechar" hardcoded com #f3f4f6 */
[data-theme="dark"] #movement-modal .inv-btn.inv-btn-outline,
[data-theme="dark"] #movement-detail-modal .btn-secondary,
[data-theme="dark"] #movement-return-modal .btn-secondary {
    background: #1f1f1f !important;
    color: #f3f4f6 !important;
    border-color: #3a3a3a !important;
}

[data-theme="dark"] #movement-modal .inv-btn.inv-btn-outline:hover,
[data-theme="dark"] #movement-detail-modal .btn-secondary:hover,
[data-theme="dark"] #movement-return-modal .btn-secondary:hover {
    background: #2a2a2a !important;
    border-color: #4a4a4a !important;
    color: #ffffff !important;
}

/* Cancelar movimentação (danger) */
[data-theme="dark"] #movement-detail-modal .inv-btn.inv-btn-danger {
    background: rgba(217, 45, 32, 0.16) !important;
    color: #fca5a5 !important;
    border-color: rgba(217, 45, 32, 0.4) !important;
}

[data-theme="dark"] #movement-detail-modal .inv-btn.inv-btn-danger:hover {
    background: #dc2626 !important;
    color: #ffffff !important;
    border-color: #dc2626 !important;
}

/* Status legacy (cores específicas hardcoded) */
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) #inv-filter-depleted.active,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) #inv-filter-inactive.active {
    background: #4b5563 !important;
    border-color: #4b5563 !important;
    color: #f3f4f6 !important;
}

/* Search dropdown */
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) #movement-modal .inv-search-results,
[data-theme="dark"] .inventory-modal:not([data-module-theme="light"]) #movement-modal .inv-search-results {
    background: #161616 !important;
    border-color: #3a3a3a !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .inv-search-item:hover {
    background: #1f1f1f !important;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .inv-search-item {
    border-bottom-color: #2a2a2a !important;
}

/* mov-return-option (radio cards) */
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-return-option {
    background: #161616 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-return-option:hover {
    border-color: #4a90ff !important;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .mov-return-option:has(input:checked) {
    background: rgba(37, 99, 235, 0.15) !important;
    border-color: #3b82f6 !important;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .inv-filter-btn.active .inv-filter-btn-count .inv-step.active .inv-step-number {
    color: #000000 !important;
}


/* XML preview button primary */
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .xml-preview-table .btn-sm.btn-primary,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .xml-preview-table .btn-sm:hover {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

/* Loading bar global (compartilhado entre inventory/products/expirations) */
[data-theme="dark"] #loading-bar {
    background: linear-gradient(90deg, #f3f4f6, #cbd1d9);
}

/* =================================================================
 *  10.2 PRODUCTS (.products-module)
 * ================================================================= */
[data-theme="dark"] .products-module:not([data-module-theme="light"]) {
    --pm-color-ink: #f3f4f6;
    --pm-color-ink-soft: #cbd1d9;
    --pm-color-ink-muted: #8b8f97;
    --pm-color-surface: #161616;
    --pm-color-surface-alt: #0f0f0f;
    --pm-color-border: #2a2a2a;
    --pm-color-border-strong: #3a3a3a;
    --pm-color-primary: #ffffff;
    --pm-color-primary-soft: rgba(255, 255, 255, 0.08);
    --pm-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.5);
    --pm-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.65);
}

[data-theme="dark"] .products-module:not([data-module-theme="light"]) {
    background: #0f0f0f;
    color: #f3f4f6;
}

[data-theme="dark"] .products-module:not([data-module-theme="light"]) .checkbox-group {
    background-color: black;
}

[data-theme="dark"] .products-module:not([data-module-theme="light"]) label[for="product-variable-expiration-enabled"] {
    color: black !important;
}

[data-theme="dark"] .products-module:not([data-module-theme="light"]) ::-webkit-scrollbar-thumb {
    background: #3a3a3a;
}

[data-theme="dark"] .products-module:not([data-module-theme="light"]) ::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a;
}

/* Botões primary genéricos */
[data-theme="dark"] .products-module:not([data-module-theme="light"]) .btn-primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .products-module:not([data-module-theme="light"]) .btn-primary:hover {
    background: #e5e7eb !important;
}

/* Cores hardcoded #ffffff em backgrounds (cards, modais, etc.) */
[data-theme="dark"] .products-module:not([data-module-theme="light"]) .module-header,
[data-theme="dark"] .products-module:not([data-module-theme="light"]) .product-card,
[data-theme="dark"] .products-module:not([data-module-theme="light"]) .product-modal-content,
[data-theme="dark"] .products-module:not([data-module-theme="light"]) .modal-content,
[data-theme="dark"] .products-module:not([data-module-theme="light"]) .form-section {
    background: #161616 !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6;
}

[data-theme="dark"] .products-module:not([data-module-theme="light"]) input,
[data-theme="dark"] .products-module:not([data-module-theme="light"]) select,
[data-theme="dark"] .products-module:not([data-module-theme="light"]) textarea {
    background: #1f1f1f !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .products-module:not([data-module-theme="light"]) input::placeholder,
[data-theme="dark"] .products-module:not([data-module-theme="light"]) textarea::placeholder {
    color: #6b7280 !important;
}

/* Tabelas */
[data-theme="dark"] .products-module:not([data-module-theme="light"]) table,
[data-theme="dark"] .products-module:not([data-module-theme="light"]) thead,
[data-theme="dark"] .products-module:not([data-module-theme="light"]) tbody {
    background: #161616 !important;
    color: #f3f4f6 !important;
}

[data-theme="dark"] .products-module:not([data-module-theme="light"]) th {
    background: #1a1a1a !important;
    color: #cbd1d9 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .products-module:not([data-module-theme="light"]) td {
    background: transparent !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .products-module:not([data-module-theme="light"]) tr:hover td {
    background: #1f1f1f !important;
}

/* Cards/blocos com #fafafa, #f9f9f9, #f6f6f6 */
[data-theme="dark"] .products-module:not([data-module-theme="light"]) [style*="background:#fafafa"],
[data-theme="dark"] .products-module:not([data-module-theme="light"]) [style*="background: #fafafa"],
[data-theme="dark"] .products-module:not([data-module-theme="light"]) [style*="background:#f9f9f9"],
[data-theme="dark"] .products-module:not([data-module-theme="light"]) [style*="background: #f9f9f9"] {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
}

/* =================================================================
 *  10.3 EXPIRATIONS (.expirations-module)
 * ================================================================= */
[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) {
    --exp-color-ink: #f3f4f6;
    --exp-color-ink-soft: #cbd1d9;
    --exp-color-ink-muted: #8b8f97;
    --exp-color-surface: #161616;
    --exp-color-surface-alt: #0f0f0f;
    --exp-color-border: #2a2a2a;
    --exp-color-border-strong: #3a3a3a;
    --exp-color-primary: #ffffff;
    --exp-color-primary-soft: rgba(255, 255, 255, 0.08);
    --exp-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.5);
    --exp-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.65);
}

[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) {
    background: #0f0f0f;
    color: #f3f4f6;
}

[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) .exp-tab.active {
    background: black !important;
}

[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) ::-webkit-scrollbar-thumb {
    background: #3a3a3a;
}

[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) .btn-primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) .module-header,
[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) .stat-card,
[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) .filter-card,
[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) .table-card,
[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) .modal-content {
    background: #161616 !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6;
}

[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) input,
[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) select,
[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) textarea {
    background: #1f1f1f !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) table {
    background: #161616 !important;
}

[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) th {
    background: #1a1a1a !important;
    color: #cbd1d9 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) td {
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) tr:hover td {
    background: #1f1f1f !important;
}

/* =================================================================
 *  10.4 RUPTURE-CONTROL (.rupture-control-module)
 * ================================================================= */
[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) {
    --rc-color-ink: #f3f4f6;
    --rc-color-ink-soft: #cbd1d9;
    --rc-color-ink-muted: #8b8f97;
    --rc-color-surface: #161616;
    --rc-color-surface-alt: #0f0f0f;
    --rc-color-surface-soft: rgba(22, 22, 22, 0.8);
    --rc-color-border: #2a2a2a;
    --rc-color-border-strong: #3a3a3a;
    --rc-color-primary: #ffffff;
    --rc-color-primary-soft: rgba(255, 255, 255, 0.08);
    --rc-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.5);
    --rc-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.65);
}

[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) {
    background: #0f0f0f;
    color: #f3f4f6;
}

[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) ::-webkit-scrollbar-thumb {
    background: #3a3a3a;
}

/* Botão rupture-btn usa background: var(--rc-color-ink) → vira claro;
   alguns botões já têm .primary que herda. Garantimos contraste em ambos. */
[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) .rupture-btn,
[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) .btn-primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) .rupture-btn:hover,
[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) .btn-primary:hover {
    background: #e5e7eb !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) .rupture-header,
[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) .rupture-card,
[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) .rupture-stat-card,
[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) .rupture-modal-content,
[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) .modal-content,
[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) .panel,
[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) .list-container {
    background: #161616 !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6;
}

[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) input,
[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) select,
[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) textarea {
    background: #1f1f1f !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) table {
    background: #161616 !important;
}

[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) th {
    background: #1a1a1a !important;
    color: #cbd1d9 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) td {
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) tr:hover td {
    background: #1f1f1f !important;
}

/* =================================================================
 *  10.5 PRICE-DIVERGENCE (.price-divergence-module)
 * ================================================================= */
[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) {
    --pd-color-ink: #f3f4f6;
    --pd-color-ink-soft: #cbd1d9;
    --pd-color-ink-muted: #8b8f97;
    --pd-color-surface: #161616;
    --pd-color-surface-alt: #0f0f0f;
    --pd-color-surface-soft: rgba(22, 22, 22, 0.8);
    --pd-color-border: #2a2a2a;
    --pd-color-border-strong: #3a3a3a;
    --pd-color-primary: #ffffff;
    --pd-color-primary-soft: rgba(255, 255, 255, 0.08);
    --pd-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.5);
    --pd-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.65);
}

[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) {
    background: #0f0f0f;
    color: #f3f4f6;
}

[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) ::-webkit-scrollbar-thumb {
    background: #3a3a3a;
}

[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) .btn-primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) .btn-primary:hover {
    background: #e5e7eb !important;
}

[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) .module-header,
[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) .pd-card,
[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) .modal-content,
[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) .panel {
    background: #161616 !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6;
}

[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) input,
[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) select,
[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) textarea {
    background: #1f1f1f !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) table {
    background: #161616 !important;
}

[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) th {
    background: #1a1a1a !important;
    color: #cbd1d9 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) td {
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) tr:hover td {
    background: #1f1f1f !important;
}

/* =================================================================
 *  10.6 STORE-LAYOUT (.store-layout-module)
 *  ATENÇÃO: define tokens em :root global (--bg-*, --text-*, etc.)
 *  que vazam pra app inteira. Redefinimos apenas no escopo do módulo.
 * ================================================================= */
[data-theme="dark"] .store-layout-module:not([data-module-theme="light"]),
[data-theme="dark"] #unified-store-layout-module:not([data-module-theme="light"]) {
    --bg-primary: #0f0f0f;
    --bg-secondary: #161616;
    --bg-tertiary: #1a1a1a;
    --bg-panel: #161616;
    --bg-panel-hover: #1f1f1f;
    --bg-input: #1f1f1f;
    --bg-button: #1f1f1f;
    --bg-button-hover: #232323;
    --bg-button-primary: #ffffff;
    --bg-button-primary-hover: #e5e7eb;

    --text-primary: #f3f4f6;
    --text-secondary: #cbd1d9;
    --text-muted: #8b8f97;
    --text-inverse: #0f0f0f;

    --border-primary: #2a2a2a;
    --border-secondary: #3a3a3a;
    --border-focus: #ffffff;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.55), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .store-layout-module:not([data-module-theme="light"]) {
    background: #0f0f0f !important;
    color: #f3f4f6;
}

[data-theme="dark"] .store-layout-module:not([data-module-theme="light"]) ::-webkit-scrollbar-thumb {
    background: #3a3a3a;
}

/* Botão primary (texto inverso → escuro no botão claro) */
[data-theme="dark"] .store-layout-module:not([data-module-theme="light"]) .btn-primary,
[data-theme="dark"] #unified-store-layout-module:not([data-module-theme="light"]) .btn-primary {
    color: #0f0f0f !important;
}

/* Painéis e sidebars do planograma/store-layout */
[data-theme="dark"] .store-layout-module:not([data-module-theme="light"]) .module-header,
[data-theme="dark"] .store-layout-module:not([data-module-theme="light"]) .panel,
[data-theme="dark"] .store-layout-module:not([data-module-theme="light"]) .sidebar,
[data-theme="dark"] .store-layout-module:not([data-module-theme="light"]) .toolbar,
[data-theme="dark"] .store-layout-module:not([data-module-theme="light"]) .planogram-toolbar,
[data-theme="dark"] .store-layout-module:not([data-module-theme="light"]) .planta-viva-panel,
[data-theme="dark"] .store-layout-module:not([data-module-theme="light"]) .modal-content {
    background: #161616 !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6;
}

[data-theme="dark"] .store-layout-module:not([data-module-theme="light"]) input,
[data-theme="dark"] .store-layout-module:not([data-module-theme="light"]) select,
[data-theme="dark"] .store-layout-module:not([data-module-theme="light"]) textarea {
    background: #1f1f1f !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .store-layout-module:not([data-module-theme="light"]) input::placeholder,
[data-theme="dark"] .store-layout-module:not([data-module-theme="light"]) textarea::placeholder {
    color: #6b7280 !important;
}

/* =================================================================
 *  10.7 BOOST GENÉRICO — fallback para os 6 módulos
 *  -----------------------------------------------------------------
 *  Pega elementos de modal/card/section que não foram cobertos
 *  acima e ainda usam #ffffff/#fff/#fafafa hardcoded em CSS
 *  externos (product-wizard, stock-collapse, planogram-studio etc.)
 * ================================================================= */
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) [class*="modal-overlay"],
[data-theme="dark"] .products-module:not([data-module-theme="light"]) [class*="modal-overlay"],
[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) [class*="modal-overlay"],
[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) [class*="modal-overlay"],
[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) [class*="modal-overlay"],
[data-theme="dark"] .store-layout-module:not([data-module-theme="light"]) [class*="modal-overlay"] {
    background: rgba(0, 0, 0, 0.75) !important;
}

/* Headers internos / títulos genéricos h1-h4 */
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) h1,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) h2,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) h3,
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) h4,
[data-theme="dark"] .products-module:not([data-module-theme="light"]) h1,
[data-theme="dark"] .products-module:not([data-module-theme="light"]) h2,
[data-theme="dark"] .products-module:not([data-module-theme="light"]) h3,
[data-theme="dark"] .products-module:not([data-module-theme="light"]) h4,
[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) h1,
[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) h2,
[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) h3,
[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) h4,
[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) h1,
[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) h2,
[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) h3,
[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) h4,
[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) h1,
[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) h2,
[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) h3,
[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) h4 {
    color: #f3f4f6 !important;
}

/* Voyger Grid — usado em vários módulos de estoque */
[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .voyger-grid,
[data-theme="dark"] .products-module:not([data-module-theme="light"]) .voyger-grid,
[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) .voyger-grid,
[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) .voyger-grid,
[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) .voyger-grid {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .voyger-grid-header,
[data-theme="dark"] .products-module:not([data-module-theme="light"]) .voyger-grid-header,
[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) .voyger-grid-header,
[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) .voyger-grid-header,
[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) .voyger-grid-header {
    background: #1a1a1a !important;
    color: #cbd1d9 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .voyger-grid-row,
[data-theme="dark"] .products-module:not([data-module-theme="light"]) .voyger-grid-row,
[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) .voyger-grid-row,
[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) .voyger-grid-row,
[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) .voyger-grid-row {
    border-color: #2a2a2a !important;
    color: #f3f4f6 !important;
}

[data-theme="dark"] .inventory-module:not([data-module-theme="light"]) .voyger-grid-row:hover,
[data-theme="dark"] .products-module:not([data-module-theme="light"]) .voyger-grid-row:hover,
[data-theme="dark"] .expirations-module:not([data-module-theme="light"]) .voyger-grid-row:hover,
[data-theme="dark"] .rupture-control-module:not([data-module-theme="light"]) .voyger-grid-row:hover,
[data-theme="dark"] .price-divergence-module:not([data-module-theme="light"]) .voyger-grid-row:hover {
    background: #1f1f1f !important;
}

/* =================================================================
 *  ABA "PESSOAS" — Dark Mode Completo
 *  -----------------------------------------------------------------
 *  Cobre os módulos do sidebar > Pessoas:
 *    • Tarefas        (.tasks-module, prefixo --tm-*)
 *    • Funcionários   (.users-module, prefixo --um-*)
 *    • Meu RH / RH    (.hris-module,  prefixo --hris-*)
 *
 *  Estratégia (segue o padrão Premium Monochromatic):
 *    1. Reescreve os tokens locais para a paleta escura.
 *    2. Corrige cores hardcoded (botões, badges, gradientes
 *       de purple/blue, scrollbar, modais, alertas, etc.).
 *    3. Hero permanece escuro (já era preto), apenas reforçamos
 *       os gradientes de hero coloridos (hris-self).
 *    4. Mantém o opt-out: nada se aplica se [data-module-theme="light"].
 * ================================================================= */

/* ---------- Tokens: TAREFAS (--tm-*) ---------- */
[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) {
    --tm-ink: #f3f4f6;
    --tm-ink-soft: #c7c7c7;
    --tm-ink-muted: #8b8b8b;
    --tm-surface: #161616;
    --tm-surface-alt: #0f0f0f;
    --tm-surface-soft: rgba(22, 22, 22, 0.88);
    --tm-border: #2a2a2a;
    --tm-border-strong: #3a3a3a;
    --tm-primary: #ffffff;
    --tm-primary-soft: rgba(255, 255, 255, 0.08);
    --tm-danger: #f87171;
    --tm-warning: #fbbf24;
    --tm-success: #34d399;
    --tm-info: #60a5fa;
    --tm-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.45);
    --tm-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.6);
}

/* ---------- Tokens: FUNCIONÁRIOS (--um-*) ---------- */
[data-theme="dark"] .users-module:not([data-module-theme="light"]) {

    --um-ink-soft: #c7c7c7;
    --um-ink-muted: #8b8b8b;
    --um-surface: #161616;
    --um-surface-alt: #0f0f0f;
    --um-surface-soft: rgba(22, 22, 22, 0.88);
    --um-border: #2a2a2a;
    --um-border-strong: #3a3a3a;
    --um-primary: #ffffff;
    --um-primary-soft: rgba(255, 255, 255, 0.08);
    --um-danger: #f87171;
    --um-warning: #fbbf24;
    --um-success: #34d399;
    --um-info: #60a5fa;
    --um-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.45);
    --um-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .users-module:not([data-module-theme="light"]) .um-hero {
    background: #1a1a1a !important;
}

[data-theme="dark"] .users-module:not([data-module-theme="light"]) .pg-dept-card-header {
    background: #1a1a1a !important;
}

/* ---------- Tokens: RH2 (--rh2-*) ---------- */
[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) {
    --rh2-bg: #0f0f0f;
    --rh2-surface: #161616;
    --rh2-surface-soft: #1a1a1a;
    --rh2-surface-hover: #202020;
    --rh2-border: #2a2a2a;
    --rh2-border-strong: #3a3a3a;
    --rh2-ink: #f3f4f6;
    --rh2-ink-soft: #c7c7c7;
    --rh2-ink-light: #9ca3af;
    --rh2-muted: #6b7280;
    --rh2-blue: #60a5fa;
    --rh2-blue-soft: rgba(96, 165, 250, 0.16);
    --rh2-green: #34d399;
    --rh2-green-soft: rgba(52, 211, 153, 0.16);
    --rh2-amber: #fbbf24;
    --rh2-amber-soft: rgba(251, 191, 36, 0.18);
    --rh2-red: #f87171;
    --rh2-red-soft: rgba(248, 113, 113, 0.16);
    --rh2-purple: #a78bfa;
    --rh2-purple-soft: rgba(167, 139, 250, 0.16);
    --rh2-shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.35);
    --rh2-shadow-sm: 0 8px 18px rgba(0, 0, 0, 0.34);
    --rh2-shadow-md: 0 16px 30px rgba(0, 0, 0, 0.38);
    --rh2-shadow-lg: 0 24px 54px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
}

[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-search-wrap input,
[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-select,
[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-input,
[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-textarea,
[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-file-input {
    color-scheme: dark;
}

[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-select option {
    background: #161616;
    color: #f3f4f6;
}

[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-nav-brand-icon,
[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-person-avatar {
    background: #f3f4f6;
    color: #0f0f0f;
}

[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-btn--primary,
[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-action-btn--primary,
[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-shortcut-btn--primary {
    background: #f3f4f6 !important;
    color: #0f0f0f !important;
    border-color: #f3f4f6 !important;
}

[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-btn--primary:hover,
[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-action-btn--primary:hover,
[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-shortcut-btn--primary:hover {
    background: #e5e7eb !important;
    color: #0f0f0f !important;
    border-color: #e5e7eb !important;
}

[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-btn--secondary,
[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-action-btn,
[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-slide-close-btn {
    background: var(--rh2-surface);
    color: var(--rh2-ink-soft);
    border-color: var(--rh2-border-strong);
}

[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-btn--secondary:hover,
[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-action-btn:hover,
[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-slide-close-btn:hover {
    background: var(--rh2-surface-hover);
    color: var(--rh2-ink);
}

[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-pill {
    background: rgba(255, 255, 255, 0.08);
    color: #f3f4f6;
}

[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-slide-backdrop {
    background: rgba(0, 0, 0, 0.58);
}

[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-workspace-hero {
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
    color: #f3f4f6;
    border: 1px solid #2a2a2a;
}

[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-workspace-hero strong {
    color: #f3f4f6;
}

[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-workspace-hero p {
    color: rgba(255, 255, 255, 0.68);
}

[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-field {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-workspace-banner.danger {
    border-color: rgba(248, 113, 113, 0.28);
    background: rgba(248, 113, 113, 0.08);
}

[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-empty,
[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-card,
[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-kpi-card,
[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-list-shell,
[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-document-preview,
[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-summary-stat {
    background: var(--rh2-surface);
    color: var(--rh2-ink);
    border-color: var(--rh2-border);
}

[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-toast {
    background: rgba(22, 22, 22, 0.96);
    color: var(--rh2-ink);
    border-color: var(--rh2-border);
}

[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-toast.success {
    border-color: rgba(52, 211, 153, 0.28);
}

[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-toast.error {
    border-color: rgba(248, 113, 113, 0.28);
}

[data-theme="dark"] .rh2-module:not([data-module-theme="light"]) .rh2-toast.warning {
    border-color: rgba(251, 191, 36, 0.3);
}

/* ---------- Tokens: HRIS (--hris-*) ----------
 *  Atenção: hris.css usa nomes próprios (bg, accent, muted, secondary,
 *  *-soft) — sobrescrevemos TODOS para evitar inconsistências. */
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) {
    --hris-bg: #0f0f0f;
    --hris-surface: #161616;
    --hris-surface-soft: #1a1a1a;
    --hris-border: #2a2a2a;
    --hris-border-strong: #3a3a3a;
    --hris-ink: #f3f4f6;
    --hris-ink-soft: #c7c7c7;
    --hris-muted: #8b8b8b;
    --hris-accent: #ffffff;
    --hris-accent-soft: rgba(255, 255, 255, 0.08);
    --hris-secondary: #60a5fa;
    --hris-secondary-soft: rgba(96, 165, 250, 0.18);
    --hris-warning: #fbbf24;
    --hris-warning-soft: rgba(251, 191, 36, 0.18);
    --hris-danger: #f87171;
    --hris-danger-soft: rgba(248, 113, 113, 0.18);
    --hris-success: #34d399;
    --hris-success-soft: rgba(52, 211, 153, 0.18);
    --hris-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.45);
    --hris-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-hero {
    background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%) !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-nav-item.active {
    background: #1a1a1a !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-open-new-collaborator {
    background: #1a1a1a !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-primary-btn {
    background: #1f1f1f !important;
}

/* =================================================================
 *  Pessoas — Correções globais (scrollbar, hero, focus)
 * ================================================================= */

/* Scrollbar local dos módulos (tasks/users hardcodavam #cacaca / #999) */
[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) ::-webkit-scrollbar-thumb,
[data-theme="dark"] .users-module:not([data-module-theme="light"]) ::-webkit-scrollbar-thumb,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) ::-webkit-scrollbar-thumb {
    background: #2f2f2f;
}

[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) ::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .users-module:not([data-module-theme="light"]) ::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) ::-webkit-scrollbar-thumb:hover {
    background: #3f3f3f;
}

[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) ::-webkit-scrollbar-track,
[data-theme="dark"] .users-module:not([data-module-theme="light"]) ::-webkit-scrollbar-track,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) ::-webkit-scrollbar-track {
    background: transparent;
}

/* Foco em campos: anel ajustado (módulos podem usar shadow rgba(17,17,17)) */
[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) input:focus,
[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) select:focus,
[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) textarea:focus,
[data-theme="dark"] .users-module:not([data-module-theme="light"]) input:focus,
[data-theme="dark"] .users-module:not([data-module-theme="light"]) select:focus,
[data-theme="dark"] .users-module:not([data-module-theme="light"]) textarea:focus,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) input:focus,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) select:focus,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) textarea:focus {
    border-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1) !important;
}

/* =================================================================
 *  TAREFAS — Correções específicas
 * ================================================================= */

/* Botões de ação rápida (assume/resolve/start/edit) tinham hovers
   hardcoded para light mode — clarear para tons coerentes em dark */
[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .assume-btn:hover {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .resolve-btn:hover {
    background: #34d399 !important;
    color: #0f0f0f !important;
    border-color: #34d399 !important;
}

[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .start-btn:hover {
    background: #fbbf24 !important;
    color: #0f0f0f !important;
    border-color: #fbbf24 !important;
}

[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .edit-btn:hover {
    background: #60a5fa !important;
    color: #0f0f0f !important;
    border-color: #60a5fa !important;
}

/* Badges de prioridade — fundos mais densos e textos brilhantes */
[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .badge-priority.baixa {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #c7c7c7 !important;
}

[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .badge-priority.media {
    background: rgba(96, 165, 250, 0.18) !important;
    color: #93c5fd !important;
}

[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .badge-priority.alta {
    background: rgba(251, 191, 36, 0.2) !important;
    color: #fcd34d !important;
}

[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .badge-priority.urgente {
    background: rgba(248, 113, 113, 0.22) !important;
    color: #fca5a5 !important;
}

/* Badges de status genéricas (.badge-status.*) */
[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .badge-status.pendente,
[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .badge-status.aguardando {
    background: rgba(251, 191, 36, 0.18) !important;
    color: #fcd34d !important;
}

[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .badge-status.andamento,
[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .badge-status.executando {
    background: rgba(96, 165, 250, 0.18) !important;
    color: #93c5fd !important;
}

[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .badge-status.resolvida,
[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .badge-status.concluida,
[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .badge-status.completed {
    background: rgba(52, 211, 153, 0.18) !important;
    color: #6ee7b7 !important;
}

[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .badge-status.cancelada,
[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .badge-status.expirada {
    background: rgba(248, 113, 113, 0.18) !important;
    color: #fca5a5 !important;
}

/* Rank badges (gamification top 1/2/3) — manter dourado/prata/bronze
   mas suavizar para não estourar contraste */
[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .rank-badge.rank-1 {
    background: linear-gradient(135deg, #d97706, #fbbf24) !important;
    color: #1a1a1a !important;
}

[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .rank-badge.rank-2 {
    background: linear-gradient(135deg, #6b7280, #94a3b8) !important;
    color: #1a1a1a !important;
}

[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .rank-badge.rank-3 {
    background: linear-gradient(135deg, #92400e, #d97706) !important;
    color: #f3f4f6 !important;
}

/* Foto preview — borda branca do botão remover */
[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .remove-photo {
    border: 2px solid #161616 !important;
    background: #f87171 !important;
    color: #ffffff !important;
}

/* Card da tarefa — garantir surface e borda em dark */
[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .task-card {
    background: var(--tm-surface) !important;
    border-color: var(--tm-border) !important;
    color: var(--tm-ink) !important;
}

[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .task-card:hover {
    border-color: var(--tm-border-strong) !important;
}

/* Notification toast (.task-notification) costuma usar fundo branco */
[data-theme="dark"] .tasks-module:not([data-module-theme="light"]) .task-notification {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
    border: 1px solid #2a2a2a !important;
}

/* =================================================================
 *  FUNCIONÁRIOS (USERS) — Correções específicas
 * ================================================================= */

/* Avatares coloridos por papel — manter cores mas escurecer um nível */
[data-theme="dark"] .users-module:not([data-module-theme="light"]) .um-avatar.owner {
    background: linear-gradient(135deg, #78350f, #b45309) !important;
    color: #fef3c7 !important;
}

[data-theme="dark"] .users-module:not([data-module-theme="light"]) .um-avatar.manager {
    background: linear-gradient(135deg, #1e3a8a, #1d4ed8) !important;
    color: #dbeafe !important;
}

[data-theme="dark"] .users-module:not([data-module-theme="light"]) .um-avatar.employee {
    background: #2a2a2a !important;
    color: #f3f4f6 !important;
}

/* Badges de papel */
[data-theme="dark"] .users-module:not([data-module-theme="light"]) .um-role-badge.owner {
    background: rgba(251, 191, 36, 0.2) !important;
    color: #fcd34d !important;
    border-color: rgba(251, 191, 36, 0.3) !important;
}

[data-theme="dark"] .users-module:not([data-module-theme="light"]) .um-role-badge.manager {
    background: rgba(96, 165, 250, 0.2) !important;
    color: #93c5fd !important;
    border-color: rgba(96, 165, 250, 0.3) !important;
}

[data-theme="dark"] .users-module:not([data-module-theme="light"]) .um-role-badge.employee {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #c7c7c7 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Badges de status */
[data-theme="dark"] .users-module:not([data-module-theme="light"]) .um-status-badge.active {
    background: rgba(52, 211, 153, 0.18) !important;
    color: #6ee7b7 !important;
}

[data-theme="dark"] .users-module:not([data-module-theme="light"]) .um-status-badge.inactive {
    background: rgba(248, 113, 113, 0.2) !important;
    color: #fca5a5 !important;
}

[data-theme="dark"] .users-module:not([data-module-theme="light"]) .um-status-badge.active .um-status-dot {
    background: #34d399 !important;
}

[data-theme="dark"] .users-module:not([data-module-theme="light"]) .um-status-badge.inactive .um-status-dot {
    background: #f87171 !important;
}

/* Tabela / cards de funcionário */
[data-theme="dark"] .users-module:not([data-module-theme="light"]) .um-data-table,
[data-theme="dark"] .users-module:not([data-module-theme="light"]) .um-table-row,
[data-theme="dark"] .users-module:not([data-module-theme="light"]) .um-card {
    background: var(--um-surface) !important;
    color: var(--um-ink) !important;
    border-color: var(--um-border) !important;
}

[data-theme="dark"] .users-module:not([data-module-theme="light"]) .um-table-row:hover,
[data-theme="dark"] .users-module:not([data-module-theme="light"]) tbody tr:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

/* Access Denied card (#ffffff hardcoded fora dos tokens) */
[data-theme="dark"] .users-module:not([data-module-theme="light"]) .access-denied-card {
    background: #161616 !important;
    border: 1px solid #2a2a2a !important;
    color: #f3f4f6 !important;
}

[data-theme="dark"] .users-module:not([data-module-theme="light"]) .access-denied-btn-primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .users-module:not([data-module-theme="light"]) .access-denied-btn-secondary {
    background: transparent !important;
    color: #f3f4f6 !important;
    border: 1px solid #3a3a3a !important;
}

/* Permission Grid — toggles RGB hardcoded por operação */
[data-theme="dark"] .users-module:not([data-module-theme="light"]) .pg-mod-toggle.pg-mod-toggle-read:checked {
    background: #2563eb !important;
    border-color: #2563eb !important;
}

[data-theme="dark"] .users-module:not([data-module-theme="light"]) .pg-mod-toggle.pg-mod-toggle-create:checked {
    background: #16a34a !important;
    border-color: #16a34a !important;
}

[data-theme="dark"] .users-module:not([data-module-theme="light"]) .pg-mod-toggle.pg-mod-toggle-update:checked {
    background: #d97706 !important;
    border-color: #d97706 !important;
}

[data-theme="dark"] .users-module:not([data-module-theme="light"]) .pg-mod-toggle.pg-mod-toggle-delete:checked {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
}

/* Departamentos — gradientes/borders/textos roxos para tema escuro */
[data-theme="dark"] .users-module:not([data-module-theme="light"]) .pg-tree-dept-header {
    background: linear-gradient(135deg, #1e1b4b 0%, #2e1065 100%) !important;
    border: 1px solid #4c1d95 !important;
    color: #ddd6fe !important;
}

[data-theme="dark"] .users-module:not([data-module-theme="light"]) .pg-tree-dept-header:hover {
    background: linear-gradient(135deg, #2e1065 0%, #3b0764 100%) !important;
    border-color: #5b21b6 !important;
}

[data-theme="dark"] .users-module:not([data-module-theme="light"]) .pg-tree-dept-icon,
[data-theme="dark"] .users-module:not([data-module-theme="light"]) .pg-dept-card-icon {
    background: #7c3aed !important;
    color: #ffffff !important;
}

[data-theme="dark"] .users-module:not([data-module-theme="light"]) .pg-dept-card-header {
    background: linear-gradient(135deg, #1e1b4b 0%, #2e1065 100%) !important;
    color: #ddd6fe !important;
    border-color: #4c1d95 !important;
}

[data-theme="dark"] .users-module:not([data-module-theme="light"]) .pg-dept-tag {
    background: rgba(139, 92, 246, 0.18) !important;
    color: #c4b5fd !important;
    border: 1px solid rgba(139, 92, 246, 0.35) !important;
}

/* Aviso de grupo ativo (.um-group-active-notice) */
[data-theme="dark"] .users-module:not([data-module-theme="light"]) .um-group-active-notice {
    background: rgba(52, 211, 153, 0.12) !important;
    border: 1px solid rgba(52, 211, 153, 0.3) !important;
    color: #6ee7b7 !important;
}

/* Dropdown de Quick Assign — fundo claro hardcoded */
[data-theme="dark"] .users-module:not([data-module-theme="light"]) .um-quick-assign-dropdown {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border: 1px solid #2a2a2a !important;
}

[data-theme="dark"] .users-module:not([data-module-theme="light"]) .um-quick-assign-dropdown li:hover,
[data-theme="dark"] .users-module:not([data-module-theme="light"]) .um-quick-assign-dropdown .um-qa-item:hover {
    background: rgba(255, 255, 255, 0.06) !important;
}

/* Modal do users (escopado com .users-modal pode estar fora do .users-module) */
[data-theme="dark"] .users-modal,
[data-theme="dark"] .users-module:not([data-module-theme="light"]) .users-modal {
    --um-ink: #f3f4f6;
    --um-ink-soft: #c7c7c7;
    --um-ink-muted: #8b8b8b;
    --um-surface: #161616;
    --um-surface-alt: #0f0f0f;
    --um-border: #2a2a2a;
    --um-border-strong: #3a3a3a;
    --um-primary: #ffffff;
    --um-primary-soft: rgba(255, 255, 255, 0.08);
    color: #f3f4f6;
}

/* =================================================================
 *  HRIS / RH — Correções específicas
 * ================================================================= */

/* Hero Self-Service (gradiente azul). Em dark suavizamos para azul
   profundo evitando "neon" sobre fundo preto. */
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-hero-self {
    background: linear-gradient(135deg, #1e3a8a 0%, #0f1d4a 100%) !important;
    color: #ffffff !important;
}

/* Cards e painéis genéricos */
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-card,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-panel,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-panel-clean,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-summary-card,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-portal-card {
    background: var(--hris-surface) !important;
    color: var(--hris-ink) !important;
    border-color: var(--hris-border) !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-portal-card:hover {
    border-color: var(--hris-border-strong) !important;
}

/* Tabs / Navegação */
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-toolbar-shell {
    background: var(--hris-surface) !important;
    border-color: var(--hris-border) !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-nav-item {
    color: var(--hris-ink-soft) !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-nav-item:hover {
    color: var(--hris-ink) !important;
    background: rgba(255, 255, 255, 0.04) !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-nav-item.is-active {
    color: var(--hris-ink) !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-subview-btn {
    background: var(--hris-surface) !important;
    color: var(--hris-ink-soft) !important;
    border-color: var(--hris-border) !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-subview-btn:hover,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-subview-btn.is-active {
    background: var(--hris-ink) !important;
    color: var(--hris-bg) !important;
    border-color: var(--hris-ink) !important;
}

/* Tabelas */
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-table {
    background: var(--hris-surface) !important;
    color: var(--hris-ink) !important;
    border-color: var(--hris-border) !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-table thead,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-table thead th {
    background: #1a1a1a !important;
    color: var(--hris-ink-soft) !important;
    border-color: var(--hris-border) !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-table tbody tr {
    border-color: var(--hris-border) !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

/* Status badges semânticas — texto brilhante para contraste */
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-status.active,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-status.aprovada,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-status.aprovado,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-status.success {
    background: rgba(52, 211, 153, 0.18) !important;
    color: #6ee7b7 !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-status.pending,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-status.pendente,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-status.rascunho,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-status.warning {
    background: rgba(251, 191, 36, 0.18) !important;
    color: #fcd34d !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-status.inactive,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-status.rejeitada,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-status.rejeitado,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-status.danger {
    background: rgba(248, 113, 113, 0.18) !important;
    color: #fca5a5 !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-status.info {
    background: rgba(96, 165, 250, 0.18) !important;
    color: #93c5fd !important;
}

/* Badges de presença diária (light hardcoded) */
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-daily-status.hris-status-ok {
    background: rgba(52, 211, 153, 0.18) !important;
    color: #6ee7b7 !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-daily-status.hris-status-warn {
    background: rgba(251, 191, 36, 0.18) !important;
    color: #fcd34d !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-daily-status.hris-status-danger {
    background: rgba(248, 113, 113, 0.18) !important;
    color: #fca5a5 !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-overtime-badge {
    background: rgba(96, 165, 250, 0.18) !important;
    color: #93c5fd !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-late-badge {
    background: rgba(248, 113, 113, 0.18) !important;
    color: #fca5a5 !important;
}

/* Cards de alerta (warning/info/danger/success) — texto brilhante */
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-alert-card.warning {
    background: rgba(251, 191, 36, 0.12) !important;
    border-color: rgba(251, 191, 36, 0.3) !important;
    color: #fcd34d !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-alert-card.info {
    background: rgba(96, 165, 250, 0.12) !important;
    border-color: rgba(96, 165, 250, 0.3) !important;
    color: #93c5fd !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-alert-card.danger {
    background: rgba(248, 113, 113, 0.12) !important;
    border-color: rgba(248, 113, 113, 0.3) !important;
    color: #fca5a5 !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-alert-card.success {
    background: rgba(52, 211, 153, 0.12) !important;
    border-color: rgba(52, 211, 153, 0.3) !important;
    color: #6ee7b7 !important;
}

/* Hints dentro do modal */
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-modal-hint.warning {
    background: rgba(251, 191, 36, 0.12) !important;
    border-color: rgba(251, 191, 36, 0.3) !important;
    color: #fcd34d !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-modal-hint.danger {
    background: rgba(248, 113, 113, 0.12) !important;
    border-color: rgba(248, 113, 113, 0.3) !important;
    color: #fca5a5 !important;
}

[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-modal-hint.info {
    background: rgba(96, 165, 250, 0.12) !important;
    border-color: rgba(96, 165, 250, 0.3) !important;
    color: #93c5fd !important;
}

/* Modal HRIS — costuma ser injetado no body, então também escopa fora */
[data-theme="dark"] .hris-modal,
[data-theme="dark"] .hris-modal-overlay,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-modal {
    --hris-surface: #161616;
    --hris-surface-soft: #1a1a1a;
    --hris-ink: #f3f4f6;
    --hris-ink-soft: #c7c7c7;
    --hris-muted: #8b8b8b;
    --hris-border: #2a2a2a;
    --hris-border-strong: #3a3a3a;
    color: #f3f4f6;
}

[data-theme="dark"] .hris-modal-content,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-modal-content {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border: 1px solid #2a2a2a !important;
}

[data-theme="dark"] .hris-modal-header,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-modal-header,
[data-theme="dark"] .hris-modal-footer,
[data-theme="dark"] .hris-module:not([data-module-theme="light"]) .hris-modal-footer {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
}

/* =================================================================
 *  Pessoas — Modais injetados no body (fora do escopo do módulo)
 *  Tasks/Users/HRIS criam alguns modais como filhos de <body>.
 *  Aqui propagamos os tokens do módulo correto.
 * ================================================================= */
[data-theme="dark"] .tasks-modal,
[data-theme="dark"] .tasks-modal-overlay,
[data-theme="dark"] .tm-modal {
    --tm-ink: #f3f4f6;
    --tm-ink-soft: #c7c7c7;
    --tm-ink-muted: #8b8b8b;
    --tm-surface: #161616;
    --tm-surface-alt: #0f0f0f;
    --tm-border: #2a2a2a;
    --tm-border-strong: #3a3a3a;
    --tm-primary: #ffffff;
    --tm-primary-soft: rgba(255, 255, 255, 0.08);
    color: #f3f4f6;
}

[data-theme="dark"] .tasks-modal .modal-content,
[data-theme="dark"] .tm-modal .tm-modal-content {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border: 1px solid #2a2a2a !important;
}

/* =================================================================
 *  CRM — Clientes (customers) e CRM Avançado (crm)
 *  -----------------------------------------------------------------
 *  Tokens scopados (--cust-*, --crm-*) bem organizados.
 *  IMPORTANTE: customers.css é compartilhado pelo .crm-module também
 *  (crm.html dá link rel="stylesheet" href="/css/modules/customers.css").
 *  Os tokens --cust-* precisam estar redefinidos para ambos os scopes.
 * ================================================================= */

/* ---------- CUSTOMERS (.customers-module / .cust-modal / .crm-module) ---------- */
[data-theme="dark"] .customers-module:not([data-module-theme="light"]),
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]),
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) {
    --cust-ink: #f3f4f6;
    --cust-ink-soft: #cbd1d9;
    --cust-ink-muted: #8b8f97;
    --cust-ink-faint: #6b7280;

    --cust-surface: #161616;
    --cust-surface-alt: #0f0f0f;
    --cust-surface-soft: #1a1a1a;
    --cust-surface-overlay: rgba(0, 0, 0, 0.7);

    --cust-border: #2a2a2a;
    --cust-border-strong: #3a3a3a;
    --cust-border-faint: #1f1f1f;

    --cust-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.5);
    --cust-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.35);
    --cust-shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);
    --cust-shadow-xl: 0 32px 64px rgba(0, 0, 0, 0.7), 0 8px 24px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .customers-module:not([data-module-theme="light"]) {
    background: #0f0f0f;
    color: #f3f4f6;
}


[data-theme="dark"] .customers-module:not([data-module-theme="light"]) .crm-dash-widget-title {
    background: #0f0f0f !important;
}

[data-theme="dark"] .customers-module:not([data-module-theme="light"]) .crm-widget-event-info strong {
    color: #fafafa !important;
}

[data-theme="dark"] .customers-module:not([data-module-theme="light"]) .cust-hero {
    color: white;
}

[data-theme="dark"] .customers-module:not([data-module-theme="light"]) .cust-hero__bg {
    background:
        radial-gradient(circle at 0% 0%, rgba(255, 255, 255, 0.06) 0, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(255, 255, 255, 0.04) 0, transparent 50%),
        linear-gradient(135deg, #1a1a1c 0%, #0a0a0b 100%);
}

/* Botões "primary" (background:--cust-ink que virou claro) */
[data-theme="dark"] .customers-module:not([data-module-theme="light"]) .cust-btn--primary,
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-btn--primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .customers-module:not([data-module-theme="light"]) .cust-btn--primary:hover,
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-btn--primary:hover {
    background: #e5e7eb !important;
    color: #0f0f0f !important;
}

/* Hero buttons (.cust-btn--solid-light com background:#fff hardcoded) */
[data-theme="dark"] .customers-module:not([data-module-theme="light"]) .cust-btn--solid-light {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .customers-module:not([data-module-theme="light"]) .cust-btn--solid-light:hover {
    background: #e5e7eb !important;
}

/* Modal panel */
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-modal__panel {
    background: #161616 !important;
    color: #f3f4f6;
}

[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-modal__header,
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-modal__footer {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-modal__close {
    background: #1f1f1f !important;
    color: #cbd1d9 !important;
}

[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-modal__close:hover {
    background: #2a2a2a !important;
    color: #ffffff !important;
}

/* Inputs/selects/textareas */
[data-theme="dark"] .customers-module:not([data-module-theme="light"]) input:not([type="checkbox"]):not([type="radio"]),
[data-theme="dark"] .customers-module:not([data-module-theme="light"]) select,
[data-theme="dark"] .customers-module:not([data-module-theme="light"]) textarea,
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) input:not([type="checkbox"]):not([type="radio"]),
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) select,
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) textarea {
    background: #1f1f1f !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .customers-module:not([data-module-theme="light"]) input::placeholder,
[data-theme="dark"] .customers-module:not([data-module-theme="light"]) textarea::placeholder,
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) input::placeholder,
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) textarea::placeholder {
    color: #6b7280 !important;
}

/* Toolbar */
[data-theme="dark"] .customers-module:not([data-module-theme="light"]) .cust-toolbar,
[data-theme="dark"] .customers-module:not([data-module-theme="light"]) .cust-toolbar__search {
    background: #161616 !important;
    border-color: #2a2a2a !important;
}

/* Cards */
[data-theme="dark"] .customers-module:not([data-module-theme="light"]) .cust-card {
    background: #161616 !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6;
}

[data-theme="dark"] .customers-module:not([data-module-theme="light"]) .cust-card:hover {
    border-color: #3a3a3a !important;
}

[data-theme="dark"] .customers-module:not([data-module-theme="light"]) .cust-card.is-blocked {
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.08) 0%, #161616 60%) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

[data-theme="dark"] .customers-module:not([data-module-theme="light"]) .cust-card__menu:hover {
    background: #1f1f1f !important;
    color: #f3f4f6 !important;
}

/* Badges semi-translúcidos — aumentar opacidade pra dark */
[data-theme="dark"] .customers-module:not([data-module-theme="light"]) .cust-badge--individual,
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-badge--individual {
    background: rgba(99, 102, 241, 0.18) !important;
    color: #a5b4fc !important;
    border-color: rgba(99, 102, 241, 0.35) !important;
}

[data-theme="dark"] .customers-module:not([data-module-theme="light"]) .cust-badge--company,
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-badge--company {
    background: rgba(20, 184, 166, 0.18) !important;
    color: #5eead4 !important;
    border-color: rgba(20, 184, 166, 0.35) !important;
}

[data-theme="dark"] .customers-module:not([data-module-theme="light"]) .cust-badge--vip,
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-badge--vip,
[data-theme="dark"] .customers-module:not([data-module-theme="light"]) .cust-badge--cashback,
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-badge--cashback {
    background: rgba(245, 158, 11, 0.2) !important;
    color: #fcd34d !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
}

[data-theme="dark"] .customers-module:not([data-module-theme="light"]) .cust-badge--wholesale,
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-badge--wholesale {
    background: rgba(59, 130, 246, 0.2) !important;
    color: #93c5fd !important;
    border-color: rgba(59, 130, 246, 0.4) !important;
}

[data-theme="dark"] .customers-module:not([data-module-theme="light"]) .cust-badge--retail,
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-badge--retail {
    background: rgba(16, 185, 129, 0.2) !important;
    color: #6ee7b7 !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
}

[data-theme="dark"] .customers-module:not([data-module-theme="light"]) .cust-badge--credit,
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-badge--credit {
    background: rgba(139, 92, 246, 0.2) !important;
    color: #c4b5fd !important;
    border-color: rgba(139, 92, 246, 0.4) !important;
}

[data-theme="dark"] .customers-module:not([data-module-theme="light"]) .cust-badge--blocked,
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-badge--blocked {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #fca5a5 !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
}

/* Tag input chip (background:--cust-ink) */
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-tag-input__chip {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-tag-input__chip button {
    background: rgba(0, 0, 0, 0.18) !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-tag-input__chip button:hover {
    background: rgba(0, 0, 0, 0.32) !important;
}

[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-tag-input {
    background: #1f1f1f !important;
    border-color: #2a2a2a !important;
}

/* Switch */
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-switch input:checked+.cust-switch__track {
    background: #ffffff !important;
}

[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-switch__track {
    background: #3a3a3a;
}

[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-switch__thumb {
    background: #0f0f0f;
}

[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-switch input:checked+.cust-switch__track .cust-switch__thumb {
    background: #0f0f0f;
}

/* Balance display (warning) */
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-balance-display {
    background: rgba(245, 158, 11, 0.16) !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
}

[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-balance-display__value {
    color: #fcd34d !important;
}

/* Cashback list */
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-cashback-list {
    background: #1a1a1a;
    border-color: #2a2a2a;
}

[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-cashback-list__item {
    border-bottom-color: #2a2a2a;
}

/* Tabs do modal */
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-tabs {
    border-bottom-color: #2a2a2a !important;
}

/* Input group btn */
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-input-group__btn:hover {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) .cust-input-group {
    background: #1f1f1f !important;
    border-color: #2a2a2a !important;
}

/* Toast neutro (background:--cust-ink) */
[data-theme="dark"] .cust-toast:not(.cust-toast--success):not(.cust-toast--error):not(.cust-toast--warning) {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

/* Scrollbar */
[data-theme="dark"] .customers-module:not([data-module-theme="light"]) ::-webkit-scrollbar-thumb,
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) ::-webkit-scrollbar-thumb {
    background: #3a3a3a;
}

[data-theme="dark"] .customers-module:not([data-module-theme="light"]) ::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .cust-modal:not([data-module-theme="light"]) ::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a;
}

/* ---------- CRM AVANÇADO (.crm-module) ---------- */
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) {
    --crm-ink: #f3f4f6;
    --crm-ink-soft: #cbd1d9;
    --crm-ink-muted: #8b8f97;
    --crm-surface: #161616;
    --crm-surface-alt: #0f0f0f;
    --crm-border: #2a2a2a;
    --crm-border-strong: #3a3a3a;
    --crm-primary: #ffffff;
    --crm-primary-soft: rgba(255, 255, 255, 0.08);
    --crm-shadow-soft: 0 18px 32px rgba(0, 0, 0, 0.5);
    --crm-shadow-strong: 0 28px 52px rgba(0, 0, 0, 0.65);
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) {
    background: #0f0f0f;
    color: #f3f4f6;
}

/* Scrollbar (CSS hardcoda #cacaca / #999) */
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) ::-webkit-scrollbar-thumb {
    background: #3a3a3a !important;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) ::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a !important;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-header {
    background: #161616 !important;
    border-color: #2a2a2a !important;
}

/* Buttons primary (background:--crm-ink agora claro) */
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-btn-primary {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-btn-primary:hover {
    background: #e5e7eb !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

/* Botão secondary hover */
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-btn-secondary:hover {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

/* Tabs ativo (background:--crm-ink) */
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-tab-btn.active {
    background: #ffffff !important;
    color: #0f0f0f !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-tab-btn.active .crm-tab-badge {
    background: rgba(0, 0, 0, 0.18) !important;
    color: #0f0f0f !important;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-tabs {
    background: #161616 !important;
    border-color: #2a2a2a !important;
}

/* Panels */
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-panel,
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-controls {
    background: #161616 !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6;
}

/* Pre/code do AI markdown (background:#f3f3f3 hardcoded) */
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-customer-focus-ai-markdown pre {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-customer-focus-ai-markdown code {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6 !important;
}

/* Tabela */
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-table-wrap {
    border-color: #2a2a2a !important;
    background: #161616;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-table th {
    background: #1a1a1a !important;
    color: #cbd1d9 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-table td {
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03) !important;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-table tbody tr.crm-table-row--selected {
    background: rgba(255, 255, 255, 0.08) !important;
}

/* Lead cards (kanban/funnel) */
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-lead-card {
    background: #161616 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-lead-card:hover {
    border-color: #3a3a3a !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-lead-card.crm-lead-card--selected {
    background: #1f1f1f !important;
    border-color: #ffffff !important;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.55) !important;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-lead-card-stats {
    border-color: #2a2a2a !important;
}

/* Funnel customer card selected (background:#fff hardcoded) */
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-funnel-customer-card.crm-funnel-customer-card--selected {
    background: #1f1f1f !important;
    border-color: #ffffff !important;
}

/* Avatar (background:--crm-ink → claro) */
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-avatar {
    background: #ffffff !important;
    color: #0f0f0f !important;
}

/* Modal CRM */
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-modal-backdrop {
    background: rgba(0, 0, 0, 0.7) !important;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-modal-dialog {
    background: #161616 !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-modal-close {
    background: #1f1f1f !important;
    border-color: #2a2a2a !important;
    color: #cbd1d9 !important;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-modal-close:hover {
    background: #2a2a2a !important;
    color: #ffffff !important;
}

/* Form fields */
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-field input,
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-field select,
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-field textarea,
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-filter input,
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-filter select {
    background: #1f1f1f !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-field input:focus,
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-field select:focus,
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-field textarea:focus,
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-filter input:focus,
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-filter select:focus {
    border-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) input::placeholder,
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) textarea::placeholder {
    color: #6b7280 !important;
}

/* Lista lateral */
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-list li {
    background: #161616 !important;
    border-color: #2a2a2a !important;
    color: #f3f4f6;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-list li:hover {
    background: #1f1f1f !important;
    border-color: #3a3a3a !important;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-list li.crm-list-item--selected {
    background: #ffffff !important;
    color: #0f0f0f !important;
    border-color: #ffffff !important;
}

/* Category badges (vip/retail) — paleta dark */
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-category-badge--vip {
    background: rgba(247, 144, 9, 0.2) !important;
    color: #fcd34d !important;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-category-badge--retail {
    background: rgba(18, 183, 106, 0.2) !important;
    color: #6ee7b7 !important;
}

/* Search input */
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-search-wrap input {
    background: #1f1f1f !important;
}

/* Wallet meta total */
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .crm-wallet-meta #crm-wallet-total {
    color: #f3f4f6 !important;
}

/* Headings */
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) h1,
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) h2,
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) h3,
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) h4,
[data-theme="dark"] .customers-module:not([data-module-theme="light"]) h1,
[data-theme="dark"] .customers-module:not([data-module-theme="light"]) h2,
[data-theme="dark"] .customers-module:not([data-module-theme="light"]) h3,
[data-theme="dark"] .customers-module:not([data-module-theme="light"]) h4 {
    color: #f3f4f6 !important;
}

/* Voyger Grid no CRM */
[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .voyger-grid {
    background: #161616 !important;
    color: #f3f4f6 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .voyger-grid-header {
    background: #1a1a1a !important;
    color: #cbd1d9 !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .voyger-grid-row {
    border-color: #2a2a2a !important;
    color: #f3f4f6 !important;
}

[data-theme="dark"] .crm-module:not([data-module-theme="light"]) .voyger-grid-row:hover {
    background: #1f1f1f !important;
}