/* Dark mode consolidado — TODO o CSS de tema escuro do app vive aqui, carregado por ÚLTIMO (ver app/utils/css_manifest.py). Antes estava espalhado em 2 pontos não-contíguos de estilo_ph3a.css (variáveis base + cauda de sweeps); consolidado na fundação da reorganização de CSS (03/08/2026). Seguro mover a posição relativa: `:root[data-theme-resolved="dark"]` tem especificidade maior que `:root` puro (sobrescreve independente de posição), e as regras de sweep já usam !important. */

/* ============================================================
   DARK MODE — toggle 3-estados (auto / light / dark)
   ============================================================
   Estratégia: `<html data-theme="...">` guarda a preferência BRUTA do
   usuário ('auto'|'light'|'dark' — precisa ser 'auto' literal pro
   dropdown saber marcar o botão certo). Todo o CSS de dark mode, porém,
   lê `<html data-theme-resolved="...">` — o estado EFETIVO já resolvido
   em JS (base.html, script inline no <head>, roda antes do paint) e
   mantido em sincronia por base-hubspot-ux.js (troca manual + listener
   de mudança do SO em runtime quando pref é 'auto').

   Bug corrigido 03/08/2026 (Paulo): antes ~300 regras usavam
   `:root[data-theme="dark"]` (o atributo BRUTO) — nunca disparavam com
   data-theme="auto", mesmo com o SO em modo escuro. Resultado: Auto virava
   um 3º tema próprio (só as variáveis base abaixo escureciam via
   `@media (prefers-color-scheme: dark)`; ~300 regras de componente —
   cards, tabelas, ícones — ficavam presas no claro, gerando contraste
   estranho). Não confundir os dois atributos ao adicionar regra nova:
   sempre `[data-theme-resolved="dark"]`, nunca `[data-theme="dark"]`.

   Os 2 blocos `@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) }`
   abaixo são fallback pra variáveis base + body SEM JS (defesa em
   camadas) — mantidos de propósito, não remover.

   Cores da MARCA (laranja primary + navy accent) ficam IGUAIS no dark —
   identidade visual PH3A preservada. Só backgrounds + texto + bordas
   invertem. Status (success/warning/danger/info) ganham tons mais
   brilhantes pra contraste em fundo escuro.

   Fase 1 — cobertura best-effort: telas que usam `var(--ph3a-*)`
   trocam automaticamente; telas com cor hardcoded (`background: var(--ph3a-white)`,
   `color:#1e293b`) precisam de revisão tela-por-tela quando aparecer
   problema visual. Backlog gradual — quando vendedor reportar tela
   específica, refactor pra variáveis. */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ph3a-bg:           #0f172a;
    --ph3a-bg-card:      #1e293b;
    --ph3a-bg-alt:       #0f172a;
    --ph3a-card:         #1e293b;
    --ph3a-surface:      #334155;
    --ph3a-white:        #1e293b;  /* "branco" semântico vira card escuro */
    --ph3a-text:         #e2e8f0;
    --ph3a-text-light:   #94a3b8;
    --ph3a-border:       #334155;
    --ph3a-success:      #4ade80;
    --ph3a-warning:      #fbbf24;
    --ph3a-danger:       #f87171;
    --ph3a-info:         #60a5fa;
  }
}
:root[data-theme-resolved="dark"] {
  --ph3a-bg:           #0f172a;
  --ph3a-bg-card:      #1e293b;
  --ph3a-bg-alt:       #0f172a;
  --ph3a-card:         #1e293b;
  --ph3a-surface:      #334155;
  --ph3a-white:        #1e293b;
  --ph3a-text:         #e2e8f0;
  --ph3a-text-light:   #94a3b8;
  --ph3a-border:       #334155;
  --ph3a-success:      #4ade80;
  --ph3a-warning:      #fbbf24;
  --ph3a-danger:       #f87171;
  --ph3a-info:         #60a5fa;
}
/* Body fica explicitamente sólido — alguns elementos pré-existentes
   herdam background:transparent e veriam o preto puro do <html> default
   do browser em vez do --ph3a-bg. */
:root[data-theme-resolved="dark"] body,
:root:not([data-theme="light"]) body {
  background-color: var(--ph3a-bg);
  color: var(--ph3a-text);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body {
    background-color: var(--ph3a-bg);
    color: var(--ph3a-text);
  }
}


/* ─── Dark mode: legibilidade dos cards do Dashboard ──────────────────────
   Paulo 22/05/2026 (v521): card de "Primeiros passos", KPI cards e
   tabelas tinham cores hardcoded inline (#fff, #f0fdf4, #fff3ef, #f1f5f9)
   que ficavam ilegíveis no tema escuro. Force override via attribute
   selector + specificity alta. Inspiração: Zoho One dark mode. */

:root[data-theme-resolved="dark"] .ph3a-table-card,
:root[data-theme-resolved="dark"] .ph3a-card,
:root[data-theme-resolved="dark"] .ph3a-form-card,
:root[data-theme-resolved="dark"] .metric-card {
  background: #1a1d24 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #e2e8f0;
}
/* .kpi-card-v2 dark: regras dedicadas mais abaixo (linha ~4734+) */

/* Card de Primeiros Passos (onboarding) — gradient hardcoded */
:root[data-theme-resolved="dark"] #cardOnboarding {
  background: linear-gradient(90deg, rgba(239, 89, 41, 0.12) 0%, #1a1d24 60%) !important;
}
:root[data-theme-resolved="dark"] #cardOnboarding a[href] {
  background: #232730 !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}
:root[data-theme-resolved="dark"] #cardOnboarding a[href][style*="#f0fdf4"],
:root[data-theme-resolved="dark"] #cardOnboarding a[href][style*="bbf7d0"] {
  background: rgba(34, 197, 94, 0.12) !important;
  border-color: rgba(34, 197, 94, 0.35) !important;
}
:root[data-theme-resolved="dark"] #cardOnboarding [style*="background:#f1f5f9"] {
  background: rgba(255, 255, 255, 0.08) !important;
}

/* Backgrounds claros hardcoded em inline-styles dentro de cards */
:root[data-theme-resolved="dark"] .ph3a-table-card [style*="background:#f1f5f9"],
:root[data-theme-resolved="dark"] .ph3a-card        [style*="background:#f1f5f9"],
:root[data-theme-resolved="dark"] .ph3a-table-card [style*="background:#f8fafc"],
:root[data-theme-resolved="dark"] .ph3a-card        [style*="background:#f8fafc"] {
  background: rgba(255, 255, 255, 0.06) !important;
}

/* ─── Dark mode WIDE SWEEP (v524) — fundos brancos hardcoded em inline-style
   e em classes locais com sufixo padronizado (-card, -kpi, -table, -filtros,
   -form-card). Pega ~80% das ~160 telas que ainda tinham bg branco em dark.
   Edge cases (badges/chips brancos intencionais) corrigidos sob demanda. */

/* Inline style: background: var(--ph3a-white) / #ffffff / white (com ou sem espaço) */
:root[data-theme-resolved="dark"] [style*="background:#fff"]:not([style*="background:#fff7"]):not([style*="background:#fff3"]):not([style*="background:#fffb"]),
:root[data-theme-resolved="dark"] [style*="background: #fff"]:not([style*="background: #fff7"]):not([style*="background: #fff3"]):not([style*="background: #fffb"]),
:root[data-theme-resolved="dark"] [style*="background:#ffffff"],
:root[data-theme-resolved="dark"] [style*="background: #ffffff"],
:root[data-theme-resolved="dark"] [style*="background:white"],
:root[data-theme-resolved="dark"] [style*="background: white"],
:root[data-theme-resolved="dark"] [style*="background-color:#fff"]:not([style*="background-color:#fff7"]):not([style*="background-color:#fff3"]),
:root[data-theme-resolved="dark"] [style*="background-color: #fff"]:not([style*="background-color: #fff7"]):not([style*="background-color: #fff3"]),
:root[data-theme-resolved="dark"] [style*="background-color:#ffffff"],
:root[data-theme-resolved="dark"] [style*="background-color: #ffffff"],
:root[data-theme-resolved="dark"] [style*="background-color:white"],
:root[data-theme-resolved="dark"] [style*="background-color: white"] {
  background: #1a1d24 !important;
  color: #e2e8f0 !important;
}

/* Classes locais com padrão de nome (cobre tk-card, dc-card, ld-card,
   roi-kpi, seq-card, lg-table, fc-day, dist-card etc — convenção que apareceu
   espalhada pelos templates). Exclusões: classes já tratadas individualmente
   ou que não devem virar escuras (.kpi-card-v2, .ph3a-table).
   `:not([class*="fa-"])`: ícone `fa-id-card`/`fa-address-card`/`fa-credit-card`
   também tem "-card" no nome e ganhava uma caixa escura atrás do desenho
   (achado no LinkedIn Prospector, 05/10/2026). Cuidado ao nomear contêiner
   com "-kpi"/"-card"/"-table"/"-filtros": ele vira cartão cinza no escuro. */
:root[data-theme-resolved="dark"] [class*="-card"]:not(.kpi-card-v2):not(.ph3a-card):not(.ph3a-table-card):not(.ph3a-form-card):not(.metric-card):not(.chart-card):not([class*="fa-"]),
:root[data-theme-resolved="dark"] [class*="-kpi"]:not(.kpi-card-v2),
:root[data-theme-resolved="dark"] [class*="-table"]:not(.ph3a-table):not(.ph3a-table-card),
:root[data-theme-resolved="dark"] [class*="-filtros"],
:root[data-theme-resolved="dark"] [class*="-form-card"]:not(.ph3a-form-card) {
  background: #1a1d24 !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Cabeçalho de tela com bg branco fixo (.header isolado em vários módulos) */
:root[data-theme-resolved="dark"] .header[style*="background"],
:root[data-theme-resolved="dark"] .form-card,
:root[data-theme-resolved="dark"] .filtros,
:root[data-theme-resolved="dark"] .sign-card,
:root[data-theme-resolved="dark"] .vcard,
:root[data-theme-resolved="dark"] .dpo-box,
:root[data-theme-resolved="dark"] .star-btn,
:root[data-theme-resolved="dark"] .pref-card,
:root[data-theme-resolved="dark"] .tfa-card,
:root[data-theme-resolved="dark"] .kb-card,
:root[data-theme-resolved="dark"] .fluxo-card {
  background: #1a1d24 !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Texto escuro hardcoded dentro de cards locais — força clarear */
:root[data-theme-resolved="dark"] [class*="-card"] [style*="color:#0f172a"],
:root[data-theme-resolved="dark"] [class*="-card"] [style*="color:#1e293b"],
:root[data-theme-resolved="dark"] [class*="-card"] [style*="color:#334155"],
:root[data-theme-resolved="dark"] [class*="-card"] [style*="color:#475569"],
:root[data-theme-resolved="dark"] [class*="-kpi"]  [style*="color:#0f172a"],
:root[data-theme-resolved="dark"] [class*="-kpi"]  [style*="color:#1e293b"] {
  color: #e2e8f0 !important;
}

/* Ícones/texto com cor inline hardcoded ilegível em dark mode — GLOBAL, não
   só dentro de card/kpi (ícones usam essas cores em headers, listas, badges,
   nav, modais). Não são cores de marca (laranja/navy ficam iguais nas
   variáveis — ver nota no topo do bloco); são tons pensados só pra fundo
   claro. Contraste medido contra --ph3a-card (#1e293b): #051F4E 1,09:1
   (praticamente invisível — o achado principal do relatório de contraste),
   #7c3aed 2,57:1, #2563eb 2,83:1, #dc2626 3,03:1, #64748b 3,07:1 — todos
   abaixo do piso de 3:1 pra elemento gráfico. Substitutos mantêm a família
   de cor (não viram cinza genérico); #dc2626→#f87171 e #64748b→#94a3b8
   reaproveitam os tokens dark já usados no resto do arquivo pro mesmo papel
   semântico (--ph3a-danger / --ph3a-text-light) (Paulo 03/08/2026). */
:root[data-theme-resolved="dark"] [style*="color:#051F4E"],
:root[data-theme-resolved="dark"] [style*="color: #051F4E"] {
  color: #7ba7e0 !important;
}
:root[data-theme-resolved="dark"] [style*="color:#7c3aed"],
:root[data-theme-resolved="dark"] [style*="color: #7c3aed"],
:root[data-theme-resolved="dark"] [style*="color:#7C3AED"],
:root[data-theme-resolved="dark"] [style*="color: #7C3AED"] {
  color: #a78bfa !important;
}
:root[data-theme-resolved="dark"] [style*="color:#2563eb"],
:root[data-theme-resolved="dark"] [style*="color: #2563eb"] {
  color: #93c5fd !important;
}
:root[data-theme-resolved="dark"] [style*="color:#dc2626"],
:root[data-theme-resolved="dark"] [style*="color: #dc2626"],
:root[data-theme-resolved="dark"] [style*="color:#DC2626"],
:root[data-theme-resolved="dark"] [style*="color: #DC2626"] {
  color: #f87171 !important;
}
:root[data-theme-resolved="dark"] [style*="color:#64748b"],
:root[data-theme-resolved="dark"] [style*="color: #64748b"] {
  color: #94a3b8 !important;
}

/* Bordas claras hardcoded em classes locais */
:root[data-theme-resolved="dark"] [class*="-card"][style*="border"],
:root[data-theme-resolved="dark"] [class*="-kpi"][style*="border"],
:root[data-theme-resolved="dark"] [class*="-table"][style*="border"],
:root[data-theme-resolved="dark"] [class*="-filtros"][style*="border"] {
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Gaps específicos que escaparam do sweep — barras de filtro/busca, chips,
   inputs sem .form-control. Identificados ao testar /negocios em dark. */
:root[data-theme-resolved="dark"] .filter-bar,
:root[data-theme-resolved="dark"] .filtros-pj-bar,
:root[data-theme-resolved="dark"] .filtros-lp-bar,
:root[data-theme-resolved="dark"] .filtros-pj-bar[style],
:root[data-theme-resolved="dark"] .filtros-lp-bar[style] {
  background: #1a1d24 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #e2e8f0 !important;
}

/* Chips de filtro com bg branco (estado neutro) — versões com sufixo -chip */
:root[data-theme-resolved="dark"] [class*="-chip"]:not(.ativo) {
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: #cbd5e1 !important;
}

/* Inputs/selects/textarea SEM .form-control (HTML5 puro ou classes locais) —
   o seletor [data-theme-resolved="dark"] .form-control já cobre os com classe; isto
   pega <input type="text/number"> "soltos" dentro de .filter-bar, .lp-faixa-inputs,
   .filtros-pj-bar, etc. */
:root[data-theme-resolved="dark"] .filter-bar input:not([type="checkbox"]):not([type="radio"]),
:root[data-theme-resolved="dark"] .filter-bar select,
:root[data-theme-resolved="dark"] .filtros-pj-bar input:not([type="checkbox"]):not([type="radio"]),
:root[data-theme-resolved="dark"] .filtros-pj-bar select,
:root[data-theme-resolved="dark"] .filtros-lp-bar input:not([type="checkbox"]):not([type="radio"]),
:root[data-theme-resolved="dark"] .lp-faixa-inputs input,
:root[data-theme-resolved="dark"] .lp-faixa > label {
  background: #232730 !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}
:root[data-theme-resolved="dark"] .filter-bar input::placeholder,
:root[data-theme-resolved="dark"] .filtros-pj-bar input::placeholder,
:root[data-theme-resolved="dark"] .lp-faixa-inputs input::placeholder {
  color: #6b7280 !important;
}

/* Modal interno com bg branco hardcoded (modal-filtro-pj em /negocios) */
:root[data-theme-resolved="dark"] [id^="modal-"] > div[style*="background:#fff"],
:root[data-theme-resolved="dark"] [id^="modal-"] > div[style*="background: #fff"] {
  background: #1a1d24 !important;
  color: #e2e8f0 !important;
}

/* Paginação (.page-link com background: var(--ph3a-white) hardcoded na linha 1641) */
:root[data-theme-resolved="dark"] .page-link {
  background: #232730 !important;
  color: #cbd5e1 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}
:root[data-theme-resolved="dark"] .page-link:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #f1f5f9 !important;
  border-color: var(--ph3a-primary) !important;
}
:root[data-theme-resolved="dark"] .page-item.active .page-link {
  background: var(--ph3a-primary) !important;
  color: #fff !important;
  border-color: var(--ph3a-primary) !important;
}

/* Botão claro (.btn-light com #fff !important hardcoded) — comum em ações
   secundárias e selectors de visualização (Hoje/Semana/Mês). Em dark vira
   botão escuro com mesma semântica. */
:root[data-theme-resolved="dark"] .btn-light {
  background-color: #232730 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #e2e8f0 !important;
}
:root[data-theme-resolved="dark"] .btn-light:hover,
:root[data-theme-resolved="dark"] .btn-light:focus,
:root[data-theme-resolved="dark"] .btn-light:active {
  background-color: #2a2f38 !important;
  border-color: var(--ph3a-accent) !important;
  color: #f1f5f9 !important;
}

/* Hero do cockpit de Negócio (.neg-hero em negocios/detalhe.html) — gradiente
   branco→creme hardcoded (linha 8 do <style> inline do template) que não
   trocava no dark: .neg-title já lê var(--ph3a-text), que vira claro no
   escuro, então o título ficava claro sobre fundo branco — ilegível.
   Reportado por Paulo 14/08/2026 ("título fica branco em darkmode"). */
:root[data-theme-resolved="dark"] .neg-hero {
  background: linear-gradient(135deg, #1a1d24 0%, rgba(239, 89, 41, 0.10) 100%) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* ─── Dark mode FULL SWEEP (v525) — varredura via agent identificou 26 regras
   no CSS global + classes locais + libs externas ainda em branco. Cobre Kanban,
   tabbar mobile, cockpit, skeletons, topbar search, FullCalendar, etc. */

/* Kanban (colunas, headers, botões de navegação) */
:root[data-theme-resolved="dark"] .kanban-nav-btn {
  background: #232730 !important;
  color: #cbd5e1 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}
:root[data-theme-resolved="dark"] .kanban-column {
  background: #1a1d24 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}
:root[data-theme-resolved="dark"] .kanban-column-header {
  background: #1e2128 !important;
  color: #e2e8f0 !important;
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}
:root[data-theme-resolved="dark"] .kanban-card {
  background: #232730 !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Tabela ph3a — headers (linha 872 e 3193 do CSS) */
:root[data-theme-resolved="dark"] .ph3a-table thead th {
  background: #1e2128 !important;
  color: #94a3b8 !important;
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}
:root[data-theme-resolved="dark"] .ph3a-th-sortable:hover {
  background: rgba(255, 255, 255, 0.04) !important;
}
:root[data-theme-resolved="dark"] .ph3a-th-dragover {
  background: rgba(239, 89, 41, 0.15) !important;
}

/* Topbar search (focus state) + dropdown de resultados globais */
:root[data-theme-resolved="dark"] .topbar-search input:focus,
:root[data-theme-resolved="dark"] .topbar-search input {
  background: #232730 !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}
:root[data-theme-resolved="dark"] #globalSearchResults,
:root[data-theme-resolved="dark"] .global-search-results {
  background: #1a1d24 !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Botões de ação inline em tabelas (.tr-action-btn — ícone editar/excluir) */
:root[data-theme-resolved="dark"] .tr-action-btn {
  background: #232730 !important;
  color: #cbd5e1 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}
:root[data-theme-resolved="dark"] .tr-action-btn:hover {
  background: rgba(255, 255, 255, 0.06) !important;
}

/* View toggle (Cards/Lista nas telas de Metas/Vendedor) — o hover de
   view-toggle.css (`.ph3a-view-toggle button:hover { color:var(--ph3a-primary); }`)
   nunca aparecia no dark: a regra acima (sem :hover, mas com !important +
   maior especificidade por causa do atributo [data-theme-resolved]) sempre
   ganha da cascata mesmo durante o hover, travando o botão em cinza e
   perdendo o feedback visual do laranja PH3A ao passar o mouse. */
:root[data-theme-resolved="dark"] .ph3a-view-toggle button {
  background: transparent !important;
  color: #94a3b8 !important;
}
:root[data-theme-resolved="dark"] .ph3a-view-toggle button:hover {
  color: var(--ph3a-primary) !important;
}
:root[data-theme-resolved="dark"] .ph3a-view-toggle button.active {
  background: rgba(239, 89, 41, 0.18) !important;
  color: var(--ph3a-primary) !important;
}

/* Tabbar mobile (rodapé PWA) e cockpit actionbar (sticky bottom em mobile) */
:root[data-theme-resolved="dark"] .ph3a-mobile-tabbar,
:root[data-theme-resolved="dark"] .ph3a-cockpit-actionbar {
  background: #1a1d24 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #e2e8f0 !important;
}

/* Skeleton cards (carregamento) — bg precisa contrastar com placeholder */
:root[data-theme-resolved="dark"] .ph3a-sk-card,
:root[data-theme-resolved="dark"] .ph3a-sk-cal-card,
:root[data-theme-resolved="dark"] .ph3a-sk-cockpit-section {
  background: #1a1d24 !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
}

/* Topbar e footer (já têm var(--ph3a-white), mas vamos forçar contraste) */
:root[data-theme-resolved="dark"] .ph3a-topbar {
  background: #1a1d24 !important;
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

/* FullCalendar (lib externa) — Agenda em /tarefas/agenda ou /agenda */
:root[data-theme-resolved="dark"] #calendario,
:root[data-theme-resolved="dark"] .fc,
:root[data-theme-resolved="dark"] .fc-view-harness,
:root[data-theme-resolved="dark"] .fc-scrollgrid,
:root[data-theme-resolved="dark"] .fc-theme-standard td,
:root[data-theme-resolved="dark"] .fc-theme-standard th,
:root[data-theme-resolved="dark"] .fc-list,
:root[data-theme-resolved="dark"] .fc-list-table {
  background: #1a1d24 !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}
:root[data-theme-resolved="dark"] .fc-col-header-cell,
:root[data-theme-resolved="dark"] .fc-list-day,
:root[data-theme-resolved="dark"] .fc-list-day-cushion {
  background: #1e2128 !important;
  color: #cbd5e1 !important;
}
:root[data-theme-resolved="dark"] .fc-daygrid-day.fc-day-today,
:root[data-theme-resolved="dark"] .fc .fc-daygrid-day.fc-day-today {
  background: rgba(239, 89, 41, 0.12) !important;
}
:root[data-theme-resolved="dark"] .fc-daygrid-day-number,
:root[data-theme-resolved="dark"] .fc-col-header-cell-cushion,
:root[data-theme-resolved="dark"] .fc-list-event-title,
:root[data-theme-resolved="dark"] .fc-list-event-time {
  color: #e2e8f0 !important;
}
:root[data-theme-resolved="dark"] .fc-list-event:hover td {
  background: rgba(255, 255, 255, 0.04) !important;
}
:root[data-theme-resolved="dark"] #ev-popup {
  background: #1a1d24 !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* WhatsApp Inbox — várias classes wppi-* com bg branco */
:root[data-theme-resolved="dark"] .wppi-chat-wrap,
:root[data-theme-resolved="dark"] .wppi-conv-header,
:root[data-theme-resolved="dark"] .wppi-msg-item-recebido,
:root[data-theme-resolved="dark"] .wppi-msg-input,
:root[data-theme-resolved="dark"] .wppi-popup-msg,
:root[data-theme-resolved="dark"] .wppi-msg-typing,
:root[data-theme-resolved="dark"] .wppi-busca-wrap,
:root[data-theme-resolved="dark"] .wppi-resultados {
  background: #1a1d24 !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}
:root[data-theme-resolved="dark"] .wppi-conv-item.active {
  background: rgba(239, 89, 41, 0.15) !important;
}

/* Cards de Meta/Vendedor (templates de vendedores/metas) — heuristic */
:root[data-theme-resolved="dark"] .meta-card,
:root[data-theme-resolved="dark"] .vendedor-card,
:root[data-theme-resolved="dark"] .vendedor-row,
:root[data-theme-resolved="dark"] .meta-row {
  background: #1a1d24 !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* <select> sem .form-select (usado em /agenda e outros) */
:root[data-theme-resolved="dark"] select:not(.form-select):not([multiple]) {
  background: #232730 !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

/* Linhas de tabela inline com bg #f8fafc (linhas alternadas hardcoded) */
:root[data-theme-resolved="dark"] [style*="background:#f8fafc"],
:root[data-theme-resolved="dark"] [style*="background: #f8fafc"],
:root[data-theme-resolved="dark"] [style*="background:#fafbfc"],
:root[data-theme-resolved="dark"] [style*="background: #fafbfc"],
:root[data-theme-resolved="dark"] [style*="background:#FAFBFC"] {
  background: rgba(255, 255, 255, 0.03) !important;
}

/* Login card — esse é INTENCIONALMENTE claro (telas de auth ficam claras
   pra parecer profissional). NÃO sobrescrevemos .login-card diretamente —
   o pin das variáveis ph3a-* + `color` vive em `.login-page` (components/login.css).
   Só precisamos de contra-regra aqui pra selectors de OUTRO arquivo que usam
   !important em cima de `.form-label` (linha ~740) — sem isso, "E-mail"/"Senha"
   ficariam claro-sobre-branco no login em dark mode. Ver bug 20/07/2026. */
:root[data-theme-resolved="dark"] .login-page .form-label {
  color: #4b4b4b !important;
}

/* ─── Dark mode FINAL CATCH-ALL (v526) — varreduras anteriores cobriram
   classes nomeadas. Esta camada pega o que sobrou: Bootstrap utilities,
   inputs/textarea puros sem classe, e variações rgb()/rgba(255,255,255,1)
   em inline-style. */

/* Bootstrap utility classes — comuns em badges, cards, alerts */
:root[data-theme-resolved="dark"] .bg-white,
:root[data-theme-resolved="dark"] .bg-light {
  background: #1a1d24 !important;
  color: #e2e8f0 !important;
}

/* Bootstrap card sem prefixo PH3A — usado em vários módulos terceiros */
:root[data-theme-resolved="dark"] .card:not(.kpi-card-v2):not(.ph3a-card) {
  background: var(--ph3a-white) !important;
  color: #e2e8f0 !important;
  border-color: var(--ph3a-border) !important;
}
:root[data-theme-resolved="dark"] .card-header,
:root[data-theme-resolved="dark"] .card-footer {
  background: rgba(255, 255, 255, 0.03) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #e2e8f0 !important;
}
:root[data-theme-resolved="dark"] .card-body {
  color: #e2e8f0 !important;
}

/* Bootstrap table sem prefixo PH3A */
:root[data-theme-resolved="dark"] .table:not(.ph3a-table) {
  background: var(--ph3a-white) !important;
  color: #e2e8f0 !important;
  border-color: var(--ph3a-border) !important;
}
:root[data-theme-resolved="dark"] .table:not(.ph3a-table) th,
:root[data-theme-resolved="dark"] .table:not(.ph3a-table) td {
  background: transparent !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
}

/* Bootstrap list-group */
:root[data-theme-resolved="dark"] .list-group-item {
  background: var(--ph3a-white) !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Bootstrap alerts neutros (alert-light) */
:root[data-theme-resolved="dark"] .alert-light,
:root[data-theme-resolved="dark"] .alert-secondary {
  background: #1e2128 !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Inputs/textareas/selects PUROS (sem classe) — herdam branco padrão browser */
:root[data-theme-resolved="dark"] input[type="text"]:not([class]),
:root[data-theme-resolved="dark"] input[type="email"]:not([class]),
:root[data-theme-resolved="dark"] input[type="number"]:not([class]),
:root[data-theme-resolved="dark"] input[type="tel"]:not([class]),
:root[data-theme-resolved="dark"] input[type="search"]:not([class]),
:root[data-theme-resolved="dark"] input[type="url"]:not([class]),
:root[data-theme-resolved="dark"] input[type="password"]:not([class]),
:root[data-theme-resolved="dark"] input[type="date"]:not([class]),
:root[data-theme-resolved="dark"] input[type="time"]:not([class]),
:root[data-theme-resolved="dark"] input[type="datetime-local"]:not([class]),
:root[data-theme-resolved="dark"] textarea:not([class]) {
  background: #232730 !important;
  color: #e2e8f0 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 6px !important;
  padding: 6px 10px !important;
}

/* rgb()/rgba(255,255,255,...) inline — backgrounds brancos com transparência */
:root[data-theme-resolved="dark"] [style*="background:rgb(255,255,255"],
:root[data-theme-resolved="dark"] [style*="background: rgb(255,255,255"],
:root[data-theme-resolved="dark"] [style*="background:rgba(255,255,255"],
:root[data-theme-resolved="dark"] [style*="background: rgba(255,255,255"],
:root[data-theme-resolved="dark"] [style*="background-color:rgb(255,255,255"],
:root[data-theme-resolved="dark"] [style*="background-color: rgb(255,255,255"],
:root[data-theme-resolved="dark"] [style*="background-color:rgba(255,255,255"],
:root[data-theme-resolved="dark"] [style*="background-color: rgba(255,255,255"] {
  background: #1a1d24 !important;
}

/* ─── Dark mode TINT SWEEP (v527) — cores pastel hardcoded em badges,
   chips, banners (#f0fdf4 verde claro, #fef3c7 amarelo, #fee2e2 rosa, etc).
   Em dark elas continuavam parecendo "branco-claras" e destoavam. Vira
   tint translúcida escura preservando intenção semântica via cor do texto. */

/* Verdes claros (success/ok/concluído) */
:root[data-theme-resolved="dark"] [style*="background:#f0fdf4"],
:root[data-theme-resolved="dark"] [style*="background: #f0fdf4"],
:root[data-theme-resolved="dark"] [style*="background:#dcfce7"],
:root[data-theme-resolved="dark"] [style*="background: #dcfce7"],
:root[data-theme-resolved="dark"] [style*="background:#bbf7d0"],
:root[data-theme-resolved="dark"] [style*="background: #bbf7d0"] {
  background: rgba(34, 197, 94, 0.15) !important;
}

/* Amarelos/Âmbar claros (warning/pendente/atenção) */
:root[data-theme-resolved="dark"] [style*="background:#fef3c7"],
:root[data-theme-resolved="dark"] [style*="background: #fef3c7"],
:root[data-theme-resolved="dark"] [style*="background:#fef9c3"],
:root[data-theme-resolved="dark"] [style*="background: #fef9c3"],
:root[data-theme-resolved="dark"] [style*="background:#fffbeb"],
:root[data-theme-resolved="dark"] [style*="background: #fffbeb"],
:root[data-theme-resolved="dark"] [style*="background:#fefce8"],
:root[data-theme-resolved="dark"] [style*="background: #fefce8"],
:root[data-theme-resolved="dark"] [style*="background:#fff3cd"],
:root[data-theme-resolved="dark"] [style*="background: #fff3cd"],
:root[data-theme-resolved="dark"] [style*="background:#ffedd5"],
:root[data-theme-resolved="dark"] [style*="background: #ffedd5"] {
  background: rgba(234, 179, 8, 0.15) !important;
}

/* Vermelhos claros (danger/error/perdido) */
:root[data-theme-resolved="dark"] [style*="background:#fee2e2"],
:root[data-theme-resolved="dark"] [style*="background: #fee2e2"],
:root[data-theme-resolved="dark"] [style*="background:#fef2f2"],
:root[data-theme-resolved="dark"] [style*="background: #fef2f2"],
:root[data-theme-resolved="dark"] [style*="background:#fff1f2"],
:root[data-theme-resolved="dark"] [style*="background: #fff1f2"],
:root[data-theme-resolved="dark"] [style*="background:#fff5f5"],
:root[data-theme-resolved="dark"] [style*="background: #fff5f5"],
:root[data-theme-resolved="dark"] [style*="background:#fff1f0"],
:root[data-theme-resolved="dark"] [style*="background: #fff1f0"],
:root[data-theme-resolved="dark"] [style*="background:#fce8e6"],
:root[data-theme-resolved="dark"] [style*="background: #fce8e6"] {
  background: rgba(239, 68, 68, 0.15) !important;
}

/* Laranjas/Primary PH3A claros (highlight/destaque/info) */
:root[data-theme-resolved="dark"] [style*="background:#fff7ed"],
:root[data-theme-resolved="dark"] [style*="background: #fff7ed"],
:root[data-theme-resolved="dark"] [style*="background:#fff3ef"],
:root[data-theme-resolved="dark"] [style*="background: #fff3ef"],
:root[data-theme-resolved="dark"] [style*="background:#fff7f2"],
:root[data-theme-resolved="dark"] [style*="background: #fff7f2"],
:root[data-theme-resolved="dark"] [style*="background:#fff8f0"],
:root[data-theme-resolved="dark"] [style*="background: #fff8f0"],
:root[data-theme-resolved="dark"] [style*="background:#fff7f3"],
:root[data-theme-resolved="dark"] [style*="background: #fff7f3"],
:root[data-theme-resolved="dark"] [style*="background:#fef3ed"],
:root[data-theme-resolved="dark"] [style*="background: #fef3ed"] {
  background: rgba(239, 89, 41, 0.15) !important;
}

/* Azuis claros (info/link) */
:root[data-theme-resolved="dark"] [style*="background:#f0f9ff"],
:root[data-theme-resolved="dark"] [style*="background: #f0f9ff"],
:root[data-theme-resolved="dark"] [style*="background:#f0f4ff"],
:root[data-theme-resolved="dark"] [style*="background: #f0f4ff"],
:root[data-theme-resolved="dark"] [style*="background:#eff6ff"],
:root[data-theme-resolved="dark"] [style*="background: #eff6ff"] {
  background: rgba(59, 130, 246, 0.15) !important;
}

/* Roxos/Violet claros (novo/feature) */
:root[data-theme-resolved="dark"] [style*="background:#f5f3ff"],
:root[data-theme-resolved="dark"] [style*="background: #f5f3ff"],
:root[data-theme-resolved="dark"] [style*="background:#faf5ff"],
:root[data-theme-resolved="dark"] [style*="background: #faf5ff"],
:root[data-theme-resolved="dark"] [style*="background:#f3e8ff"],
:root[data-theme-resolved="dark"] [style*="background: #f3e8ff"],
:root[data-theme-resolved="dark"] [style*="background:#fae8ff"],
:root[data-theme-resolved="dark"] [style*="background: #fae8ff"],
:root[data-theme-resolved="dark"] [style*="background:#fdf4ff"],
:root[data-theme-resolved="dark"] [style*="background: #fdf4ff"],
:root[data-theme-resolved="dark"] [style*="background:#fdf2f8"],
:root[data-theme-resolved="dark"] [style*="background: #fdf2f8"] {
  background: rgba(168, 85, 247, 0.15) !important;
}

/* Cinzas muito claros (fafafa, f9fafb, f3f4f6) — viram cinza escuro neutro */
:root[data-theme-resolved="dark"] [style*="background:#fafafa"],
:root[data-theme-resolved="dark"] [style*="background: #fafafa"],
:root[data-theme-resolved="dark"] [style*="background:#f9fafb"],
:root[data-theme-resolved="dark"] [style*="background: #f9fafb"],
:root[data-theme-resolved="dark"] [style*="background:#f3f4f6"],
:root[data-theme-resolved="dark"] [style*="background: #f3f4f6"] {
  background: rgba(255, 255, 255, 0.04) !important;
}

/* Texto cinza-claro (#94a3b8 / #64748b) clareia mais em dark pra contraste */
:root[data-theme-resolved="dark"] [style*="color:#64748b"],
:root[data-theme-resolved="dark"] [style*="color:#94a3b8"] {
  color: #94a3b8 !important;
}
:root[data-theme-resolved="dark"] [style*="color:#1e293b"],
:root[data-theme-resolved="dark"] [style*="color:#0f172a"] {
  color: #e2e8f0 !important;
}

/* Borders hardcoded suaves */
:root[data-theme-resolved="dark"] [style*="border:1px solid #e2e8f0"],
:root[data-theme-resolved="dark"] [style*="border:1.5px solid #e2e8f0"] {
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Background do canvas dos charts — Chart.js renderiza dentro do card.
   O CSS acima já força fundo escuro nos containers; cores do TICK e GRID
   foram resolvidas no JS dos charts (template painel/lista.html) que agora
   detecta isDark() em runtime. */

/* ─── Dark mode BROADER (v523) — varredura ampla pra demais telas ──
   Aplica regras genéricas pra elementos comuns que ainda têm cores hardcoded
   em inline-style: tabelas, modais, forms, badges, dropdowns. Mantém
   identidade visual PH3A (laranja primary preservado). */

/* Tabelas (ph3a-table-card, ph3a-table) */
:root[data-theme-resolved="dark"] .ph3a-table th,
:root[data-theme-resolved="dark"] .ph3a-table thead {
  background: #1a1d24 !important;
  color: #94a3b8 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}
:root[data-theme-resolved="dark"] .ph3a-table td,
:root[data-theme-resolved="dark"] .ph3a-table tbody tr {
  background: #1a1d24 !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
}
:root[data-theme-resolved="dark"] .ph3a-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04) !important;
}
:root[data-theme-resolved="dark"] .ph3a-table tbody tr:nth-child(even) {
  background: #1e2128 !important;
}

/* Forms (inputs, selects, textareas) */
:root[data-theme-resolved="dark"] .form-control,
:root[data-theme-resolved="dark"] .form-select {
  background: #232730 !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}
:root[data-theme-resolved="dark"] .form-control::placeholder {
  color: #6b7280 !important;
}
:root[data-theme-resolved="dark"] .form-control:focus,
:root[data-theme-resolved="dark"] .form-select:focus {
  background: #2a2f38 !important;
  border-color: #ef5929 !important;
  box-shadow: 0 0 0 .25rem rgba(239, 89, 41, 0.2) !important;
}
:root[data-theme-resolved="dark"] .form-label {
  color: #cbd5e1 !important;
}

/* Modais Bootstrap */
:root[data-theme-resolved="dark"] .modal-content {
  background: #1a1d24 !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}
:root[data-theme-resolved="dark"] .modal-header,
:root[data-theme-resolved="dark"] .modal-footer {
  border-color: rgba(255, 255, 255, 0.08) !important;
}
:root[data-theme-resolved="dark"] .btn-close {
  filter: invert(1) opacity(.7);
}

/* Dropdowns Bootstrap */
:root[data-theme-resolved="dark"] .dropdown-menu {
  background: #1a1d24 !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}
:root[data-theme-resolved="dark"] .dropdown-item {
  color: #e2e8f0 !important;
}
:root[data-theme-resolved="dark"] .dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #ffffff !important;
}
:root[data-theme-resolved="dark"] .dropdown-header {
  color: #94a3b8 !important;
}
:root[data-theme-resolved="dark"] .dropdown-divider {
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Page header */
:root[data-theme-resolved="dark"] .page-header h1,
:root[data-theme-resolved="dark"] .page-header h2 {
  color: #f1f5f9 !important;
}
:root[data-theme-resolved="dark"] .page-subtitle {
  color: #94a3b8 !important;
}

/* Empty state */
:root[data-theme-resolved="dark"] .empty-state-title {
  color: #cbd5e1 !important;
}
:root[data-theme-resolved="dark"] .empty-state-text {
  color: #94a3b8 !important;
}
:root[data-theme-resolved="dark"] .empty-state-icon {
  color: rgba(255, 255, 255, 0.2) !important;
}

/* KPI cards */
:root[data-theme-resolved="dark"] .kpi-card-v2 {
  background: #1a1d24 !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
}
:root[data-theme-resolved="dark"] .kpi-card-v2 .kpi-value {
  color: #f1f5f9 !important;
}
:root[data-theme-resolved="dark"] .kpi-card-v2 .kpi-label {
  color: #94a3b8 !important;
}
/* Chips de trend dentro do KPI — versões claras hardcoded ficavam berrantes */
:root[data-theme-resolved="dark"] .kpi-trend-up      { background: rgba(34, 197, 94, 0.15) !important; color: #4ade80 !important; }
:root[data-theme-resolved="dark"] .kpi-trend-down    { background: rgba(239, 68, 68, 0.15) !important; color: #fca5a5 !important; }
:root[data-theme-resolved="dark"] .kpi-trend-neutral { background: rgba(255, 255, 255, 0.06) !important; color: #94a3b8 !important; }

/* Badges PH3A — mantém cores próprias, mas badge "neutro" com fundo claro
   precisa virar fundo escuro */
:root[data-theme-resolved="dark"] .ph3a-badge[style*="background:#f1f5f9"],
:root[data-theme-resolved="dark"] .ph3a-badge[style*="background:#f8fafc"] {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #cbd5e1 !important;
}

/* Botões outline-ph3a */
:root[data-theme-resolved="dark"] .btn-outline-ph3a {
  color: #cbd5e1 !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  background: transparent !important;
}
:root[data-theme-resolved="dark"] .btn-outline-ph3a:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #ffffff !important;
}

/* Chips de filtros ativos */
:root[data-theme-resolved="dark"] .chip-filtro-ativo,
:root[data-theme-resolved="dark"] [class*="chip"][style*="background:#f"] {
  background: rgba(239, 89, 41, 0.15) !important;
  color: #fbb98e !important;
  border-color: rgba(239, 89, 41, 0.3) !important;
}

/* Toast / flash messages com fundo claro */
:root[data-theme-resolved="dark"] .alert {
  background: #232730 !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}
:root[data-theme-resolved="dark"] .alert-success {
  background: rgba(34, 197, 94, 0.15) !important;
  color: #86efac !important;
  border-color: rgba(34, 197, 94, 0.3) !important;
}
:root[data-theme-resolved="dark"] .alert-warning {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #fcd34d !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
}
:root[data-theme-resolved="dark"] .alert-danger {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}
:root[data-theme-resolved="dark"] .alert-info {
  background: rgba(14, 165, 233, 0.15) !important;
  color: #93c5fd !important;
  border-color: rgba(14, 165, 233, 0.3) !important;
}

/* Backgrounds claros inline genéricos */
:root[data-theme-resolved="dark"] [style*="background:#fff"],
:root[data-theme-resolved="dark"] [style*="background: #fff"],
:root[data-theme-resolved="dark"] [style*="background:#ffffff"],
:root[data-theme-resolved="dark"] [style*="background:white"] {
  background: #1a1d24 !important;
}

/* hr divider */
:root[data-theme-resolved="dark"] hr {
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Code/kbd */
:root[data-theme-resolved="dark"] code,
:root[data-theme-resolved="dark"] kbd {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #fbb98e !important;
}

/* ─── Dark mode CONTRASTE (v528) — achados da auditoria de contraste de
   07/08/2026: botões outline-secondary/outline/back-link e badges que usam
   var(--ph3a-accent) (navy #051F4E) como cor de TEXTO sobre fundo transparente
   ou tint translúcido não invertem — `--ph3a-accent` é cor de MARCA e
   permanece igual no dark (regra do topo do arquivo), mas usada como texto
   sobre superfície escura dá o mesmo contraste ~1,1:1 já medido no achado
   original de `[style*="color:#051F4E"]` (linha ~194) — só que essas classes
   usam a variável, não o hex, então escapavam daquele seletor de atributo.
   Reaproveita o mesmo substituto #7ba7e0. Hover já resolve por conta própria
   (preenche sólido + texto branco), não precisa de override. */
:root[data-theme-resolved="dark"] .btn-outline-secondary,
:root[data-theme-resolved="dark"] .btn-outline {
  color: #7ba7e0 !important;
  border-color: #7ba7e0 !important;
}
:root[data-theme-resolved="dark"] a.back-link,
:root[data-theme-resolved="dark"] .back-link {
  color: #7ba7e0 !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}
:root[data-theme-resolved="dark"] a.back-link:hover,
:root[data-theme-resolved="dark"] .back-link:hover {
  background: rgba(59, 130, 246, 0.15) !important;
  border-color: #7ba7e0 !important;
  color: #93c5fd !important;
}

/* Badges que usam var(--ph3a-accent) como texto sobre tint translúcido —
   mesmo problema acima (badges.css: .badge-accent, .badge-orange) */
:root[data-theme-resolved="dark"] .badge-accent,
:root[data-theme-resolved="dark"] .badge-orange {
  background: rgba(59, 130, 246, 0.15) !important;
  color: #7ba7e0 !important;
}
/* .badge-secondary (badges.css) — background var(--ph3a-bg-alt) vira quase
   preto no dark + color:#64748b fixo dá ~3,9:1, abaixo do piso AA de 4,5:1 */
:root[data-theme-resolved="dark"] .badge-secondary {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #cbd5e1 !important;
}

/* .text-muted / .text-secondary do Bootstrap — cinza fixo (~#6c757d), não é
   token PH3A e não escurece com o tema; usado em 112+ templates pra
   metadado/legenda secundária, contraste cai contra fundos já escurecidos
   pelo sweep. */
:root[data-theme-resolved="dark"] .text-muted,
:root[data-theme-resolved="dark"] .text-secondary {
  color: #94a3b8 !important;
}
:root[data-theme-resolved="dark"] .bg-secondary-subtle {
  background: rgba(255, 255, 255, 0.08) !important;
}
:root[data-theme-resolved="dark"] .text-secondary.bg-secondary-subtle,
:root[data-theme-resolved="dark"] .badge.bg-secondary-subtle {
  color: #cbd5e1 !important;
}

/* Timeline de Negócios (negocios/detalhe.html) — badges de canal/provider com
   bg+color hardcoded em <style> local, fora do padrão -card/-kpi do sweep */
:root[data-theme-resolved="dark"] .tl-badge-provider,
:root[data-theme-resolved="dark"] [class*="tl-badge-provider--"] {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #cbd5e1 !important;
}

/* WhatsApp Inbox — status de transcrição de áudio, fora da lista .wppi-* já
   coberta acima */
:root[data-theme-resolved="dark"] .wppi-transcricao-ok {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #86efac !important;
}
:root[data-theme-resolved="dark"] .wppi-transcricao-pendente {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #fcd34d !important;
}
:root[data-theme-resolved="dark"] .wppi-transcricao-falhou {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #fca5a5 !important;
}

/* Badge "Cancelada" e afins — background:#f9fafb/rgba(107,114,128,*) já
   escurece pelo sweep de cinza-claro acima, mas o color:#6b7280 companheiro
   não estava na lista de cores cobertas */
:root[data-theme-resolved="dark"] [style*="color:#6b7280"],
:root[data-theme-resolved="dark"] [style*="color: #6b7280"] {
  color: #94a3b8 !important;
}

/* Ícone com color:#000 hardcoded sobre superfície que o sweep escurece via
   var(--ph3a-white) (ajuda/index.html .funcao-icone, ícone TikTok) */
:root[data-theme-resolved="dark"] [style*="color:#000"],
:root[data-theme-resolved="dark"] [style*="color: #000"] {
  color: #e2e8f0 !important;
}

/* ─── Dark mode CONTRASTE (v529) — inline style="color:var(--ph3a-accent)"
   (navy), reportado na coluna "Valor" de negocios/lista.html: 95 ocorrências
   em 38 templates usam a variável de marca (não o hex) direto como cor de
   texto — mesmo problema estrutural do achado A/v528 (variável de marca não
   inverte no dark, texto navy fica quase invisível sobre card escuro), só
   que via inline style em vez de classe, então escapava tanto do seletor de
   hex quanto das classes já cobertas.
   Os 3 seletores abaixo casam SÓ a declaração `color:`, não `border-color:`
   nem `background-color:` (que também contêm a substring "color:var(...)")
   — âncora no delimitador (`^=` início do atributo, ou precedido de `;`)
   pra não pegar essas duas de arrasto. Confirmado por auditoria: nenhuma
   ocorrência real de border-color/background-color bate nesses 3 padrões. */
:root[data-theme-resolved="dark"] [style^="color:var(--ph3a-accent)"],
:root[data-theme-resolved="dark"] [style*=";color:var(--ph3a-accent)"],
:root[data-theme-resolved="dark"] [style*="; color:var(--ph3a-accent)"] {
  color: #7ba7e0 !important;
}

/* ─── Dark mode CONTRASTE (v530) — banner de autosave (components/autosave.css)
   nunca tinha entrado em nenhuma varredura: bg/border/color inteiramente
   hardcoded em verde-claro (#ecfdf5/#a7f3d0/#065f46) e o hover dos botões
   Restaurar/Descartar em verde/vermelho pastel (#d1fae5/#fee2e2) — sem
   nenhuma regra aqui, o card aparecia como uma caixa clara "zoada" caindo
   sobre um form inteiramente escuro. Mantém a semântica (verde=sucesso,
   vermelho=descartar) só com tons escuros/translúcidos, igual ao resto do
   arquivo (auditoria de contraste do hover, Paulo 18/08/2026). */
:root[data-theme-resolved="dark"] .ph3a-autosave-banner {
  background: rgba(34, 197, 94, 0.12) !important;
  border-color: rgba(34, 197, 94, 0.3) !important;
  color: #86efac !important;
}
:root[data-theme-resolved="dark"] .ph3a-autosave-banner-text strong {
  color: #4ade80 !important;
}
:root[data-theme-resolved="dark"] .ph3a-autosave-banner-btn {
  background: #232730 !important;
  border-color: rgba(34, 197, 94, 0.35) !important;
  color: #86efac !important;
}
:root[data-theme-resolved="dark"] .ph3a-autosave-banner-btn:hover {
  background: rgba(34, 197, 94, 0.18) !important;
  border-color: #4ade80 !important;
}
:root[data-theme-resolved="dark"] .ph3a-autosave-banner-btn.ph3a-autosave-discard {
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
}
:root[data-theme-resolved="dark"] .ph3a-autosave-banner-btn.ph3a-autosave-discard:hover {
  background: rgba(239, 68, 68, 0.18) !important;
  border-color: #f87171 !important;
}

