/* ==========================================================================
   REFINAMENTO DO MODO ESCURO E DO TEXTO PEQUENO
   Carregado por último (includes/header_assets.php), só ajusta o que ficava ruim de ler.
   Mexe só na aparência. Os ajustes de cor valem apenas no tema escuro: html[data-bs-theme="dark"].

   O que foi medido na ficha do cliente (contraste WCAG, texto normal pede 4,5:1):
     - subtítulo do cabeçalho .......... 2,5:1  (#64748b sobre azul-escuro)
     - nome da etapa atual ("Fila") .... 1,9:1  (#475569 fixo no HTML, escuro sobre escuro)
     - data "atrasada" nas etapas ...... 3,0:1  (#dc2626, 10,9px)
     - chips do checklist .............. claros (#f1f5f9) no meio do tema escuro
     - ícones dos cartões (Contrato, Faturas...) em pastel claro no meio do tema escuro
   ========================================================================== */

/* ---- Texto pequeno demais (vale nos dois temas) ---- */
.cd-ficha div.text-muted[style*="font-size: .7rem"] { font-size: .75rem !important; }          /* Contratado / Recebido / Próx. vencimento */
.stepper-job [style*="font-size: .68rem"] { font-size: .75rem !important; }                     /* data de cada etapa */
.stepper-job [style*="font-size: .72rem"] { font-size: .78rem !important; }                     /* nome de cada etapa */

/* ---- Tema escuro ---- */
html[data-bs-theme="dark"] .gd-header-subtitle { color: #a9b7cb; }

/* cores escritas direto no HTML para fundo claro: no escuro viram versões legíveis (fora do papel do contrato) */
html[data-bs-theme="dark"] .cd-ficha [style*="color: #64748b"]:not(#pills-contrato *),
html[data-bs-theme="dark"] .gd-header-card [style*="color: #64748b"] { color: #a9b7cb !important; }
html[data-bs-theme="dark"] .cd-ficha [style*="color: #475569"]:not(#pills-contrato *),
html[data-bs-theme="dark"] .gd-header-card [style*="color: #475569"] { color: #d5deea !important; }
html[data-bs-theme="dark"] .cd-ficha [style*="color: #dc2626"]:not(#pills-contrato *),
html[data-bs-theme="dark"] .gd-header-card [style*="color: #dc2626"] { color: #fca5a5 !important; }
html[data-bs-theme="dark"] .cd-ficha [style*="color: #b45309"]:not(#pills-contrato *) { color: #fbbf24 !important; }
html[data-bs-theme="dark"] .cd-ficha [style*="color: #166534"]:not(#pills-contrato *) { color: #86efac !important; }

/* chips do checklist: deixam de ser pílulas claras */
html[data-bs-theme="dark"] .wf-etapa-chip { background: rgba(148, 163, 184, .10); color: #cbd5e1; border-color: rgba(148, 163, 184, .28); }
html[data-bs-theme="dark"] .wf-etapa-chip:hover { background: rgba(148, 163, 184, .20); }
html[data-bs-theme="dark"] .wf-etapa-chip.done { background: rgba(34, 197, 94, .16); color: #86efac; border-color: rgba(34, 197, 94, .38); }
html[data-bs-theme="dark"] .wf-etapa-chip.done .wf-chip-ok { color: #4ade80; }

/* quadradinhos dos ícones dos cartões: translúcidos em vez de pastel claro (o ícone mantém a própria cor) */
html[data-bs-theme="dark"] .gd-card-secao-icone { background: rgba(148, 163, 184, .16) !important; }

/* aviso de atraso nas faturas: texto visível, não só um triângulo */
.indicador-atraso-fatura { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 700; color: #dc2626; white-space: nowrap; }
html[data-bs-theme="dark"] .indicador-atraso-fatura { color: #fca5a5 !important; }

/* menu lateral: o título da seção é um rótulo, não um link */
html[data-bs-theme="dark"] .ds-sidebar__section-label { color: #94a3b8; letter-spacing: .04em; }
html[data-bs-theme="dark"] .ds-sidebar__section-toggle:hover .ds-sidebar__section-label { color: #e2e8f0; }

/* botão de atendimento: menor, e a página ganha espaço no fim para ele não cobrir o último cartão */
.support-fab { width: 52px; height: 52px; }
.cd-ficha { padding-bottom: 76px; }

/* botão principal e aba ativa: o texto era branco sobre azul-claro (2,1:1); texto azul-marinho dá 9:1 */
html[data-bs-theme="dark"] .btn-primary,
html[data-bs-theme="dark"] .btn-primary:hover,
html[data-bs-theme="dark"] .btn-primary:focus,
html[data-bs-theme="dark"] .btn-primary:active,
html[data-bs-theme="dark"] .nav-link.gd-btn-action.active { color: #06121f !important; }
html[data-bs-theme="dark"] .btn-primary .fa-solid,
html[data-bs-theme="dark"] .btn-primary .material-symbols-outlined,
html[data-bs-theme="dark"] .nav-link.gd-btn-action.active i { color: inherit !important; }

/* botão com contorno cinza: o cinza do Bootstrap some no escuro */
html[data-bs-theme="dark"] .btn-outline-secondary { color: #cbd5e1; border-color: rgba(148, 163, 184, .55); }
html[data-bs-theme="dark"] .btn-outline-secondary:hover { color: #fff; background: rgba(148, 163, 184, .25); }

/* texto de apoio sobre fundo azul translúcido */
html[data-bs-theme="dark"] .cd-contratos-stat .text-muted { color: #cbd5e1 !important; }

/* fundos pastel escritos direto no HTML (ícone do serviço no cabeçalho, selos): viram versões translúcidas da mesma cor */
html[data-bs-theme="dark"] .gd-header-card [style*="background: #eef2ff"],
html[data-bs-theme="dark"] .cd-ficha [style*="background: #eef2ff"]:not(#pills-contrato *) { background: rgba(129, 140, 248, .18) !important; }
html[data-bs-theme="dark"] .cd-ficha [style*="background: #f1f5f9"]:not(#pills-contrato *) { background: rgba(148, 163, 184, .12) !important; }
html[data-bs-theme="dark"] .cd-ficha [style*="background: #e0f2fe"]:not(#pills-contrato *) { background: rgba(56, 189, 248, .16) !important; }
html[data-bs-theme="dark"] .cd-ficha [style*="background: #fef3c7"]:not(#pills-contrato *) { background: rgba(245, 158, 11, .16) !important; }
html[data-bs-theme="dark"] .cd-ficha [style*="background: #dcfce7"]:not(#pills-contrato *) { background: rgba(34, 197, 94, .16) !important; }
html[data-bs-theme="dark"] .cd-ficha [style*="background: #fee2e2"]:not(#pills-contrato *) { background: rgba(239, 68, 68, .16) !important; }

/* ==========================================================================
   PALETA UNIFICADA DO TEMA ESCURO
   As cores vêm de design-tokens.css (html[data-bs-theme="dark"]). Aqui ficam só os ajustes para o que foi escrito com cor fixa
   no HTML ou em CSS antigo e ficava ilegível sobre o fundo escuro (contraste medido abaixo de 4,5:1).
   O papel do contrato (.contract-paper) continua claro e não é alterado.
   ========================================================================== */

/* 1) Fundo de destaque com texto branco: usa o azul mais fechado, o #38bdf8 só serve para texto, ícone e borda */
html[data-bs-theme="dark"] .gd-filter-btn--active,
html[data-bs-theme="dark"] .gd-filter-btn[aria-selected="true"],
html[data-bs-theme="dark"] .bg-primary:not([class*="bg-opacity"]) {
    background-color: var(--accent-fill) !important;
    border-color: var(--accent-fill) !important;
}
html[data-bs-theme="dark"] .gd-filter-btn--active:hover,
html[data-bs-theme="dark"] .gd-filter-btn[aria-selected="true"]:hover { background-color: var(--accent-fill-hover) !important; }
html[data-bs-theme="dark"] [style*="background: var(--color-accent)" i],
html[data-bs-theme="dark"] [style*="background:var(--color-accent)" i],
html[data-bs-theme="dark"] [style*="background-color: var(--color-accent)" i],
html[data-bs-theme="dark"] [style*="background-color:var(--color-accent)" i] { background: var(--accent-fill) !important; }

/* 2) Avatares: o texto das iniciais é branco fixo no HTML (!important), então o que muda é o fundo. As cores claras da paleta
      (amarelo, lima, verde, ciano, azul-claro, rosa...) viram versões mais fechadas, com texto branco a 4,5:1 ou mais, nos dois temas. */
.gd-avatar:not([style*="color: #000" i]):not([style*="color:#000" i])[style*="#f59e0b" i] { background: #b45309 !important; }
.gd-avatar:not([style*="color: #000" i]):not([style*="color:#000" i])[style*="#84cc16" i] { background: #4d7c0f !important; }
.gd-avatar:not([style*="color: #000" i]):not([style*="color:#000" i])[style*="#10b981" i] { background: #047857 !important; }
.gd-avatar:not([style*="color: #000" i]):not([style*="color:#000" i])[style*="#06b6d4" i] { background: #0e7490 !important; }
.gd-avatar:not([style*="color: #000" i]):not([style*="color:#000" i])[style*="#38bdf8" i], .gd-avatar[style*="#0ea5e9" i] { background: #0369a1 !important; }
.gd-avatar:not([style*="color: #000" i]):not([style*="color:#000" i])[style*="#22c55e" i] { background: #15803d !important; }
.gd-avatar:not([style*="color: #000" i]):not([style*="color:#000" i])[style*="#14b8a6" i] { background: #0f766e !important; }
.gd-avatar:not([style*="color: #000" i]):not([style*="color:#000" i])[style*="#f97316" i] { background: #c2410c !important; }
.gd-avatar:not([style*="color: #000" i]):not([style*="color:#000" i])[style*="#ef4444" i] { background: #b91c1c !important; }
.gd-avatar:not([style*="color: #000" i]):not([style*="color:#000" i])[style*="#8b5cf6" i] { background: #6d28d9 !important; }
.gd-avatar:not([style*="color: #000" i]):not([style*="color:#000" i])[style*="#6366f1" i] { background: #4f46e5 !important; }
.gd-avatar:not([style*="color: #000" i]):not([style*="color:#000" i])[style*="#f43f5e" i] { background: #be123c !important; }
.gd-avatar:not([style*="color: #000" i]):not([style*="color:#000" i])[style*="#d946ef" i] { background: #a21caf !important; }
.gd-avatar:not([style*="color: #000" i]):not([style*="color:#000" i])[style*="#3b82f6" i] { background: #1d4ed8 !important; }
.gd-avatar:not([style*="color: #000" i]):not([style*="color:#000" i])[style*="#64748b" i] { background: #475569 !important; }
.badge[style*="#8b5cf6" i] { background: #7c3aed !important; }
/* 3) Links cinza do rodapé e do painel de suporte */
html[data-bs-theme="dark"] .link-secondary,
html[data-bs-theme="dark"] .nav-link.link-secondary,
html[data-bs-theme="dark"] a.link-secondary { color: var(--text-muted) !important; }
.support-panel-whats { background: #15803d !important; color: #ffffff !important; }

/* 4) Texto com cor escrita direto no HTML (style="color: #..."), nos grupos: cinza, escuro, vermelho, verde, âmbar e azul */
html[data-bs-theme="dark"] :is([style^="color: #64748b" i], [style^="color:#64748b" i], [style*=" color: #64748b" i], [style*=" color:#64748b" i], [style*=";color: #64748b" i], [style*=";color:#64748b" i], [style^="color: #6b7280" i], [style^="color:#6b7280" i], [style*=" color: #6b7280" i], [style*=" color:#6b7280" i], [style*=";color: #6b7280" i], [style*=";color:#6b7280" i], [style^="color: #6c757d" i], [style^="color:#6c757d" i], [style*=" color: #6c757d" i], [style*=" color:#6c757d" i], [style*=";color: #6c757d" i], [style*=";color:#6c757d" i], [style^="color: #7a8494" i], [style^="color:#7a8494" i], [style*=" color: #7a8494" i], [style*=" color:#7a8494" i], [style*=";color: #7a8494" i], [style*=";color:#7a8494" i], [style^="color: #667085" i], [style^="color:#667085" i], [style*=" color: #667085" i], [style*=" color:#667085" i], [style*=";color: #667085" i], [style*=";color:#667085" i], [style^="color: #8e9aaf" i], [style^="color:#8e9aaf" i], [style*=" color: #8e9aaf" i], [style*=" color:#8e9aaf" i], [style*=";color: #8e9aaf" i], [style*=";color:#8e9aaf" i], [style^="color: #5b6475" i], [style^="color:#5b6475" i], [style*=" color: #5b6475" i], [style*=" color:#5b6475" i], [style*=";color: #5b6475" i], [style*=";color:#5b6475" i], [style^="color: #526077" i], [style^="color:#526077" i], [style*=" color: #526077" i], [style*=" color:#526077" i], [style*=";color: #526077" i], [style*=";color:#526077" i]):not(.contract-paper *, #pills-contrato *, .contrato-papel *) {
    color: var(--text-muted) !important;
}

html[data-bs-theme="dark"] :is([style^="color: #475569" i], [style^="color:#475569" i], [style*=" color: #475569" i], [style*=" color:#475569" i], [style*=";color: #475569" i], [style*=";color:#475569" i], [style^="color: #334155" i], [style^="color:#334155" i], [style*=" color: #334155" i], [style*=" color:#334155" i], [style*=";color: #334155" i], [style*=";color:#334155" i], [style^="color: #1e293b" i], [style^="color:#1e293b" i], [style*=" color: #1e293b" i], [style*=" color:#1e293b" i], [style*=";color: #1e293b" i], [style*=";color:#1e293b" i], [style^="color: #0f172a" i], [style^="color:#0f172a" i], [style*=" color: #0f172a" i], [style*=" color:#0f172a" i], [style*=";color: #0f172a" i], [style*=";color:#0f172a" i], [style^="color: #212529" i], [style^="color:#212529" i], [style*=" color: #212529" i], [style*=" color:#212529" i], [style*=";color: #212529" i], [style*=";color:#212529" i], [style^="color: #1e2430" i], [style^="color:#1e2430" i], [style*=" color: #1e2430" i], [style*=" color:#1e2430" i], [style*=";color: #1e2430" i], [style*=";color:#1e2430" i], [style^="color: #344054" i], [style^="color:#344054" i], [style*=" color: #344054" i], [style*=" color:#344054" i], [style*=";color: #344054" i], [style*=";color:#344054" i], [style^="color: #111827" i], [style^="color:#111827" i], [style*=" color: #111827" i], [style*=" color:#111827" i], [style*=";color: #111827" i], [style*=";color:#111827" i], [style^="color: #374151" i], [style^="color:#374151" i], [style*=" color: #374151" i], [style*=" color:#374151" i], [style*=";color: #374151" i], [style*=";color:#374151" i], [style^="color: #4b5563" i], [style^="color:#4b5563" i], [style*=" color: #4b5563" i], [style*=" color:#4b5563" i], [style*=";color: #4b5563" i], [style*=";color:#4b5563" i]):not(.contract-paper *, #pills-contrato *, .contrato-papel *):not([style*="background" i]) {
    color: var(--text-body) !important;
}

html[data-bs-theme="dark"] :is([style^="color: #ef4444" i], [style^="color:#ef4444" i], [style*=" color: #ef4444" i], [style*=" color:#ef4444" i], [style*=";color: #ef4444" i], [style*=";color:#ef4444" i], [style^="color: #dc2626" i], [style^="color:#dc2626" i], [style*=" color: #dc2626" i], [style*=" color:#dc2626" i], [style*=";color: #dc2626" i], [style*=";color:#dc2626" i], [style^="color: #b91c1c" i], [style^="color:#b91c1c" i], [style*=" color: #b91c1c" i], [style*=" color:#b91c1c" i], [style*=";color: #b91c1c" i], [style*=";color:#b91c1c" i], [style^="color: #a32d2d" i], [style^="color:#a32d2d" i], [style*=" color: #a32d2d" i], [style*=" color:#a32d2d" i], [style*=";color: #a32d2d" i], [style*=";color:#a32d2d" i], [style^="color: #991b1b" i], [style^="color:#991b1b" i], [style*=" color: #991b1b" i], [style*=" color:#991b1b" i], [style*=";color: #991b1b" i], [style*=";color:#991b1b" i], [style^="color: #e5484d" i], [style^="color:#e5484d" i], [style*=" color: #e5484d" i], [style*=" color:#e5484d" i], [style*=";color: #e5484d" i], [style*=";color:#e5484d" i]):not(.contract-paper *, #pills-contrato *, .contrato-papel *) {
    color: var(--status-danger) !important;
}

html[data-bs-theme="dark"] :is([style^="color: #16a34a" i], [style^="color:#16a34a" i], [style*=" color: #16a34a" i], [style*=" color:#16a34a" i], [style*=";color: #16a34a" i], [style*=";color:#16a34a" i], [style^="color: #15803d" i], [style^="color:#15803d" i], [style*=" color: #15803d" i], [style*=" color:#15803d" i], [style*=";color: #15803d" i], [style*=";color:#15803d" i], [style^="color: #0f5132" i], [style^="color:#0f5132" i], [style*=" color: #0f5132" i], [style*=" color:#0f5132" i], [style*=";color: #0f5132" i], [style*=";color:#0f5132" i], [style^="color: #166534" i], [style^="color:#166534" i], [style*=" color: #166534" i], [style*=" color:#166534" i], [style*=";color: #166534" i], [style*=";color:#166534" i], [style^="color: #047857" i], [style^="color:#047857" i], [style*=" color: #047857" i], [style*=" color:#047857" i], [style*=";color: #047857" i], [style*=";color:#047857" i], [style^="color: #059669" i], [style^="color:#059669" i], [style*=" color: #059669" i], [style*=" color:#059669" i], [style*=";color: #059669" i], [style*=";color:#059669" i], [style^="color: #198754" i], [style^="color:#198754" i], [style*=" color: #198754" i], [style*=" color:#198754" i], [style*=";color: #198754" i], [style*=";color:#198754" i], [style^="color: #10b981" i], [style^="color:#10b981" i], [style*=" color: #10b981" i], [style*=" color:#10b981" i], [style*=";color: #10b981" i], [style*=";color:#10b981" i]):not(.contract-paper *, #pills-contrato *, .contrato-papel *) {
    color: var(--status-ok) !important;
}

html[data-bs-theme="dark"] :is([style^="color: #b45309" i], [style^="color:#b45309" i], [style*=" color: #b45309" i], [style*=" color:#b45309" i], [style*=";color: #b45309" i], [style*=";color:#b45309" i], [style^="color: #d97706" i], [style^="color:#d97706" i], [style*=" color: #d97706" i], [style*=" color:#d97706" i], [style*=";color: #d97706" i], [style*=";color:#d97706" i], [style^="color: #a16207" i], [style^="color:#a16207" i], [style*=" color: #a16207" i], [style*=" color:#a16207" i], [style*=";color: #a16207" i], [style*=";color:#a16207" i], [style^="color: #92400e" i], [style^="color:#92400e" i], [style*=" color: #92400e" i], [style*=" color:#92400e" i], [style*=";color: #92400e" i], [style*=";color:#92400e" i], [style^="color: #ca8a04" i], [style^="color:#ca8a04" i], [style*=" color: #ca8a04" i], [style*=" color:#ca8a04" i], [style*=";color: #ca8a04" i], [style*=";color:#ca8a04" i], [style^="color: #f59e0b" i], [style^="color:#f59e0b" i], [style*=" color: #f59e0b" i], [style*=" color:#f59e0b" i], [style*=";color: #f59e0b" i], [style*=";color:#f59e0b" i]):not(.contract-paper *, #pills-contrato *, .contrato-papel *) {
    color: var(--status-warn) !important;
}

html[data-bs-theme="dark"] :is([style^="color: #0284c7" i], [style^="color:#0284c7" i], [style*=" color: #0284c7" i], [style*=" color:#0284c7" i], [style*=";color: #0284c7" i], [style*=";color:#0284c7" i], [style^="color: #0369a1" i], [style^="color:#0369a1" i], [style*=" color: #0369a1" i], [style*=" color:#0369a1" i], [style*=";color: #0369a1" i], [style*=";color:#0369a1" i], [style^="color: #226dab" i], [style^="color:#226dab" i], [style*=" color: #226dab" i], [style*=" color:#226dab" i], [style*=";color: #226dab" i], [style*=";color:#226dab" i], [style^="color: #1d4ed8" i], [style^="color:#1d4ed8" i], [style*=" color: #1d4ed8" i], [style*=" color:#1d4ed8" i], [style*=";color: #1d4ed8" i], [style*=";color:#1d4ed8" i], [style^="color: #2563eb" i], [style^="color:#2563eb" i], [style*=" color: #2563eb" i], [style*=" color:#2563eb" i], [style*=";color: #2563eb" i], [style*=";color:#2563eb" i], [style^="color: #0ea5e9" i], [style^="color:#0ea5e9" i], [style*=" color: #0ea5e9" i], [style*=" color:#0ea5e9" i], [style*=";color: #0ea5e9" i], [style*=";color:#0ea5e9" i], [style^="color: #017dd3" i], [style^="color:#017dd3" i], [style*=" color: #017dd3" i], [style*=" color:#017dd3" i], [style*=";color: #017dd3" i], [style*=";color:#017dd3" i], [style^="color: #1964a3" i], [style^="color:#1964a3" i], [style*=" color: #1964a3" i], [style*=" color:#1964a3" i], [style*=";color: #1964a3" i], [style*=";color:#1964a3" i]):not(.contract-paper *, #pills-contrato *, .contrato-papel *) {
    color: var(--status-info) !important;
}

/* 5) Fundos claros que sobraram no tema escuro (texto claro sobre fundo claro = invisível: "Minhas Tarefas" do dashboard) */
html[data-bs-theme="dark"] .ds-task-item,
html[data-bs-theme="dark"] .ds-action-item { background: var(--bg-subtle); }
html[data-bs-theme="dark"] .ds-task-item:hover,
html[data-bs-theme="dark"] .ds-task-item.ds-task-active { background: rgba(56, 189, 248, 0.10); }
html[data-bs-theme="dark"] .ds-task-item::before { background-color: var(--border-color); }

/* 6) Dia da semana nos cartões de agenda: texto branco sobre vermelho/azul vivos */
html[data-bs-theme="dark"] .ds-agenda-date-header { background: #b91c1c; }
html[data-bs-theme="dark"] .ds-agenda-date-card.ds-active .ds-agenda-date-header { background: var(--accent-fill); }

/* 7) Botão verde em pílula (branco sobre #10b981 dava 2,5:1) */
.ds-btn-success-pill { background-color: #047857 !important; }

/* 8) Calendário e listas com cores de Bootstrap escritas no HTML (#0d6efd, #dc3545, #d63384, #e83e8c...) e as "emphasis" do Bootstrap */
html[data-bs-theme="dark"] :is([style^="color: #0d6efd" i], [style*=" color: #0d6efd" i], [style*=";color: #0d6efd" i], [style*=";color:#0d6efd" i], [style*="color: rgb(13, 110, 253)" i]) { color: var(--status-info) !important; }
html[data-bs-theme="dark"] :is([style^="color: #dc3545" i], [style*=" color: #dc3545" i], [style*=";color:#dc3545" i], [style*="color: rgb(220, 53, 69)" i], [style*="color: #842029" i], [style*="color:#842029" i]) { color: var(--status-danger) !important; }
html[data-bs-theme="dark"] :is([style*="color: #d63384" i], [style*="color:#d63384" i], [style*="color: #e83e8c" i], [style*="color:#e83e8c" i], [style*="color: rgb(214, 51, 132)" i], [style*="color: rgb(232, 62, 140)" i]) { color: #f9a8d4 !important; }
html[data-bs-theme="dark"] :is([style*="color: #6f42c1" i], [style*="color:#6f42c1" i], [style*="color: rgb(111, 66, 193)" i]) { color: #c4b5fd !important; }
html[data-bs-theme="dark"] :is([style*="color: #fd7e14" i], [style*="color:#fd7e14" i], [style*="color: rgb(253, 126, 20)" i]) { color: #fdba74 !important; }
html[data-bs-theme="dark"] :is([style*="color: #664d03" i], [style*="color:#664d03" i]) { color: var(--status-warn) !important; }
html[data-bs-theme="dark"] :is([style*="color: #055160" i], [style*="color:#055160" i]) { color: var(--status-info) !important; }
html[data-bs-theme="dark"] :is([style*="color: #0a3622" i], [style*="color:#0a3622" i]) { color: var(--status-ok) !important; }
html[data-bs-theme="dark"] :is(.text-danger-emphasis, .text-success-emphasis, .text-warning-emphasis, .text-info-emphasis, .text-primary-emphasis) { filter: none; }
html[data-bs-theme="dark"] .text-danger-emphasis { color: var(--status-danger) !important; }
html[data-bs-theme="dark"] .text-success-emphasis { color: var(--status-ok) !important; }
html[data-bs-theme="dark"] .text-warning-emphasis { color: var(--status-warn) !important; }
html[data-bs-theme="dark"] .text-info-emphasis, html[data-bs-theme="dark"] .text-primary-emphasis { color: var(--status-info) !important; }

/* 9) Atrás de fotos o fundo é cinza neutro, sem tom de azul: o azul do tema tingiria a percepção da cor da imagem (galeria, seleção, miniaturas) */
html[data-bs-theme="dark"] .gd-foto-fundo { background-color: var(--bg-foto) !important; border-color: var(--border-soft) !important; }

/* 10) Fundos claros escritos no HTML (cartões #f8f9fa, #f8fafc, #f1f5f9...): viram o nível "elevado" do tema, e o texto do próprio elemento acompanha */
html[data-bs-theme="dark"] :is(
    [style*="background-color: #f8f9fa" i], [style*="background: #f8f9fa" i], [style*="background-color:#f8f9fa" i], [style*="background:#f8f9fa" i],
    [style*="background-color: #f8fafc" i], [style*="background: #f8fafc" i], [style*="background-color:#f8fafc" i], [style*="background:#f8fafc" i],
    [style*="background-color: #f1f5f9" i], [style*="background: #f1f5f9" i], [style*="background-color:#f1f5f9" i], [style*="background:#f1f5f9" i],
    [style*="background-color: #f3f4f6" i], [style*="background: #f3f4f6" i], [style*="background-color: #f9fafb" i], [style*="background: #f9fafb" i]
):not(.contract-paper *, #pills-contrato *, .contrato-papel *) {
    background-color: var(--bg-subtle) !important;
    border-color: var(--border-color) !important;
    color: var(--text-body) !important;
}

/* 11) Avatares com classe do Bootstrap (bg-success, bg-info...) e o avatar do fluxo de serviços do dashboard */
.gd-avatar.bg-success { background-color: #047857 !important; }
.gd-avatar.bg-info { background-color: #0369a1 !important; }
.gd-avatar.bg-warning { background-color: #b45309 !important; }
.gd-avatar.bg-danger { background-color: #b91c1c !important; }
.gd-avatar.bg-primary { background-color: #1d4ed8 !important; }
.gd-avatar.bg-secondary { background-color: #475569 !important; }
.badge.bg-danger { background-color: #b91c1c !important; }

/* 12) Botões do calendário (FullCalendar) e "Tem data livre?" */
html[data-bs-theme="dark"] .fc .fc-button-primary,
html[data-bs-theme="dark"] .fc-button-primary {
    background-color: var(--bg-subtle) !important;
    border-color: var(--border-color) !important;
    color: var(--text-main) !important;
}
html[data-bs-theme="dark"] .fc .fc-button-primary:hover { background-color: var(--border-color) !important; color: var(--text-dark) !important; }
html[data-bs-theme="dark"] .fc .fc-button-primary:disabled { opacity: .6; color: var(--text-muted) !important; }
html[data-bs-theme="dark"] .fc .fc-button-primary.fc-button-active,
html[data-bs-theme="dark"] .fc .fc-button-primary:not(:disabled).fc-button-active,
html[data-bs-theme="dark"] .fc .fc-button-primary:not(:disabled):active {
    background-color: var(--accent-fill) !important;
    border-color: var(--accent-fill) !important;
    color: #ffffff !important;
}
html[data-bs-theme="dark"] .gd-abtn-principal { background: var(--accent-fill) !important; }

/* 13) Atraso no dashboard */
html[data-bs-theme="dark"] .dp-hoje-hora.is-atraso { color: var(--status-danger) !important; }

/* 14) Etiqueta de horário/atraso das tarefas do dashboard (fundo #f8f9fa fixo no CSS antigo) */
html[data-bs-theme="dark"] .ds-task-time { background-color: rgba(148, 163, 184, 0.14); color: var(--text-muted); }

/* 15) Etiquetas em tom pastel do Bootstrap escritas no HTML (#f8d7da, #d1e7dd, #fff3cd, #cff4fc...): viram o mesmo tom translúcido sobre o fundo escuro */
html[data-bs-theme="dark"] :is([style*="background-color: #f8d7da" i], [style*="background: #f8d7da" i], [style*="background-color:#f8d7da" i], [style*="background:#f8d7da" i]):not(.contract-paper *) { background-color: rgba(248, 113, 113, 0.16) !important; }
html[data-bs-theme="dark"] :is([style*="background-color: #d1e7dd" i], [style*="background: #d1e7dd" i], [style*="background-color:#d1e7dd" i], [style*="background:#d1e7dd" i]):not(.contract-paper *) { background-color: rgba(74, 222, 128, 0.16) !important; }
html[data-bs-theme="dark"] :is([style*="background-color: #fff3cd" i], [style*="background: #fff3cd" i], [style*="background-color:#fff3cd" i], [style*="background:#fff3cd" i]):not(.contract-paper *) { background-color: rgba(251, 191, 36, 0.16) !important; }
html[data-bs-theme="dark"] :is([style*="background-color: #cff4fc" i], [style*="background: #cff4fc" i], [style*="background-color:#cff4fc" i], [style*="background:#cff4fc" i], [style*="background-color: #cfe2ff" i], [style*="background: #cfe2ff" i]):not(.contract-paper *) { background-color: rgba(56, 189, 248, 0.16) !important; }
html[data-bs-theme="dark"] :is([style*="background-color: #e2e3e5" i], [style*="background: #e2e3e5" i], [style*="background-color:#e2e3e5" i]):not(.contract-paper *) { background-color: rgba(148, 163, 184, 0.16) !important; }
html[data-bs-theme="dark"] :is([style*="color: #084298" i], [style*="color:#084298" i], [style*="color: #0c5460" i], [style*="color:#0c5460" i], [style*="color: #0a58ca" i], [style*="color:#0a58ca" i]):not(.contract-paper *) { color: var(--status-info) !important; }

/* 13) Telas de configuração no escuro: azul claro (--bs-primary) é para texto e borda; fundo com texto branco usa --accent-fill */
html[data-bs-theme="dark"] .gd-table thead { background-color: var(--accent-fill) !important; }
html[data-bs-theme="dark"] .gd-btn-primary-pill { background: var(--accent-fill) !important; border-color: var(--accent-fill) !important; color: #fff !important; }
html[data-bs-theme="dark"] .gd-btn-primary-pill:hover { background: var(--accent-fill-hover) !important; border-color: var(--accent-fill-hover) !important; }
/* selos "suaves" (bg-X text-X border-X): sem isto viravam verde sobre verde / vermelho sobre vermelho */
html[data-bs-theme="dark"] .badge.bg-success.text-success   { background-color: rgba(74, 222, 128, .14) !important;  color: #86efac !important; border-color: rgba(74, 222, 128, .35) !important; }
html[data-bs-theme="dark"] .badge.bg-danger.text-danger     { background-color: rgba(248, 113, 113, .14) !important; color: #fca5a5 !important; border-color: rgba(248, 113, 113, .35) !important; }
html[data-bs-theme="dark"] .badge.bg-warning.text-warning   { background-color: rgba(251, 191, 36, .14) !important;  color: #fcd34d !important; border-color: rgba(251, 191, 36, .35) !important; }
html[data-bs-theme="dark"] .badge.bg-info.text-info         { background-color: rgba(56, 189, 248, .14) !important;  color: #7dd3fc !important; border-color: rgba(56, 189, 248, .35) !important; }
html[data-bs-theme="dark"] .badge.bg-primary.text-primary   { background-color: rgba(56, 189, 248, .14) !important;  color: #7dd3fc !important; border-color: rgba(56, 189, 248, .35) !important; }
html[data-bs-theme="dark"] .badge.bg-secondary.text-secondary { background-color: rgba(148, 163, 184, .14) !important; color: #cbd5e1 !important; border-color: rgba(148, 163, 184, .35) !important; }
/* 14) Editor de contrato (Quill): a área de edição segue branca como o documento; os títulos herdavam o texto claro do tema escuro e sumiam */
html[data-bs-theme="dark"] .ql-container.ql-snow .ql-editor h1,
html[data-bs-theme="dark"] .ql-container.ql-snow .ql-editor h2,
html[data-bs-theme="dark"] .ql-container.ql-snow .ql-editor h3,
html[data-bs-theme="dark"] .ql-container.ql-snow .ql-editor h4,
html[data-bs-theme="dark"] .ql-container.ql-snow .ql-editor h5,
html[data-bs-theme="dark"] .ql-container.ql-snow .ql-editor h6 { color: #0f172a !important; }   /* !important: portal.css força cor clara em todo h1-h6 no escuro */

/* 15) Cabeçalho de tabela .gd-table e cartões de plano (Minha Assinatura) no escuro */
html[data-bs-theme="dark"] .gd-table thead th { color: #fff !important; }   /* texto sobre o azul de fundo (--accent-fill); .text-muted o deixava cinza (2,5:1) */
html[data-bs-theme="dark"] .pricing-card.ds-card { background-color: var(--bg-surface) !important; border-color: var(--border-color) !important; }   /* o cartão ficava branco com título claro (invisível) */
html[data-bs-theme="dark"] .pricing-card .feature-item { color: var(--text-main) !important; }
html[data-bs-theme="dark"] .pricing-card .price-display { color: var(--text-dark) !important; }
html[data-bs-theme="dark"] .pricing-card .price-currency,
html[data-bs-theme="dark"] .pricing-card .price-cents { color: var(--text-muted) !important; }

/* 16) Telas principais no escuro (varredura de contraste de clientes, contratos, financeiro, entregas, planos, equipamentos, marketing e suporte) */
html[data-bs-theme="dark"] thead a.text-white,
html[data-bs-theme="dark"] .gd-table thead th a { color: #fff !important; }   /* links de ordenação do cabeçalho: ficavam cinza sobre o azul (2,5:1) */
html[data-bs-theme="dark"] [style*="color: #495057" i] { color: var(--text-muted) !important; }   /* "Sem Contrato" e afins: cinza escuro fixo no estilo da linha */
html[data-bs-theme="dark"] [style*="color: #41464b" i] { color: var(--text-main) !important; }    /* selos cinza claros: o fundo já escurece, o texto não */
html[data-bs-theme="dark"] [style*="color:#6d28d9" i] { color: #c4b5fd !important; }              /* roxo escuro do aviso "Módulo em Fase Beta" */
html[data-bs-theme="dark"] [style*="color: rgb(75, 85, 99)" i] { color: var(--text-muted) !important; }   /* abas inativas do Financeiro (a cor é aplicada por script) */
html[data-bs-theme="dark"] .gd-btn-solid,
html[data-bs-theme="dark"] .gd-ajuda-busca button { background-color: var(--accent-fill) !important; border-color: var(--accent-fill) !important; color: #fff !important; }   /* branco sobre o azul claro (2,1:1) */
/* A folha do contrato (pré-visualização) segue branca como o documento; o título herdava o texto claro do tema escuro e sumia */
html[data-bs-theme="dark"] .contract-paper .contract-preamble-title,
html[data-bs-theme="dark"] .contract-paper h1,
html[data-bs-theme="dark"] .contract-paper h2,
html[data-bs-theme="dark"] .contract-paper h3 { color: #0f172a !important; }
html[data-bs-theme="dark"] .ms-tema-nome { color: var(--text-dark) !important; }   /* nome do tema (Claro, Creme...) no Portal do Cliente: escuro sobre cartão escuro */
html[data-bs-theme="dark"] .ql-toolbar button[title="Show HTML source"] { color: #334155 !important; }   /* botão "<>" do editor de contrato: branco sobre a barra branca */
html[data-bs-theme="dark"] .badge.bg-success:not(.text-success) { background-color: #047857 !important; color: #fff !important; }   /* selo verde cheio com texto branco: o verde claro do tema dava 2,5:1 */
html[data-bs-theme="dark"] .pricing-badge { background: var(--accent-fill) !important; color: #fff !important; }   /* "Mais Escolhido" nos planos */
html[data-bs-theme="dark"] [style*="background-color: #0ea5e9" i] { background-color: #0369a1 !important; }   /* avatar azul-céu (iniciais em branco: 2,8:1) */
