/*
 * Modo escuro (acessibilidade: sensibilidade à luz). Liga com data-bs-theme="dark" no <html>, pelo botão de tema
 * (lib/helpers.php theme_styles(): guarda a escolha no navegador; sem escolha, segue o sistema operacional).
 * Bootstrap 5.3 já escurece os componentes dele; aqui ficam as cores do tema (variáveis --kt-*) e os
 * componentes próprios que tinham fundo claro fixo. Componente novo com cor fixa clara: acrescente aqui.
 */
[data-bs-theme=dark] {
  color-scheme: dark;
  --kt-white: #1e1e2d;
  --kt-light: #2b2b40;
  --kt-light-active: #323248;
  --kt-light-inverse: #cdcdde;

  --kt-primary-light: #212e48;
  --kt-secondary: #323248; --kt-secondary-active: #474761; --kt-secondary-light: #2b2b40; --kt-secondary-inverse: #cdcdde;
  --kt-success-light: #1c3238;
  --kt-info-light: #2f264f;
  --kt-warning-light: #392f28;
  --kt-danger-light: #3a2434;
  --kt-dark: #e4e6ef; --kt-dark-active: #ffffff; --kt-dark-light: #2b2b40; --kt-dark-inverse: #1e1e2d;

  --kt-secondary-text: #a2a3b7;
  --kt-warning-text: #ffc700;
  --kt-success-text: #50cd89;

  --kt-gray-100: #151521; --kt-gray-200: #2b2b40; --kt-gray-300: #323248; --kt-gray-400: #474761; --kt-gray-500: #7e7e96;
  --kt-gray-600: #92929f; --kt-gray-700: #a2a3b7; --kt-gray-800: #cdcdde; --kt-gray-900: #f5f5fa;
  --kt-text-muted: #8a8aa3;
  --kt-text-dark: #f5f5fa;
  --kt-border-color: #2b2b40;
  --kt-card-box-shadow: none;

  --bs-body-color: #cdcdde;
  --bs-body-bg: #151521;
  --bs-border-color: #323248;
  --bs-secondary-color: #8a8aa3;
  --bs-emphasis-color: #f5f5fa;
  --bs-heading-color: #f5f5fa;
  --bs-tertiary-bg: #1b1b29;
  --bs-light-rgb: 43, 43, 64;
}

/* superfícies */
[data-bs-theme=dark] body, [data-bs-theme=dark] .app-body { background: #151521; color: #cdcdde; }
[data-bs-theme=dark] .card, [data-bs-theme=dark] .modal-content, [data-bs-theme=dark] .dropdown-menu, [data-bs-theme=dark] .offcanvas,
[data-bs-theme=dark] .funil-kpi, [data-bs-theme=dark] .funil-card, [data-bs-theme=dark] .stackbar, [data-bs-theme=dark] .cal-dia,
[data-bs-theme=dark] .app-mobile-nav, [data-bs-theme=dark] .app-venda-total, [data-bs-theme=dark] .ag-aberto, [data-bs-theme=dark] .onb-anel span {
  background-color: #1e1e2d !important; color: #cdcdde;
}
[data-bs-theme=dark] .bg-light, [data-bs-theme=dark] .bg-white { background-color: #2b2b40 !important; }
[data-bs-theme=dark] .text-dark, [data-bs-theme=dark] .text-black { color: #f5f5fa !important; }
[data-bs-theme=dark] h1, [data-bs-theme=dark] h2, [data-bs-theme=dark] h3, [data-bs-theme=dark] h4, [data-bs-theme=dark] h5 { color: #f5f5fa; }
[data-bs-theme=dark] .form-control, [data-bs-theme=dark] .form-select, [data-bs-theme=dark] .input-group-text {
  background-color: #1b1b29; border-color: #323248; color: #e4e6ef;
}
[data-bs-theme=dark] .form-control:disabled, [data-bs-theme=dark] .form-control[readonly] { background-color: #232334; }
[data-bs-theme=dark] .form-check-input { background-color: #1b1b29; border-color: #474761; }
[data-bs-theme=dark] .form-check-input:checked { background-color: var(--kt-primary); border-color: var(--kt-primary); }
[data-bs-theme=dark] .table { --bs-table-bg: transparent; --bs-table-color: #cdcdde; --bs-table-striped-bg: #1b1b29; --bs-table-hover-bg: #232334; }
[data-bs-theme=dark] .table-bordered > :not(caption) > * > * { border-color: #323248; }
[data-bs-theme=dark] .separator, [data-bs-theme=dark] .border, [data-bs-theme=dark] .border-top, [data-bs-theme=dark] .border-bottom { border-color: #2b2b40 !important; }
[data-bs-theme=dark] .alert { --bs-alert-bg: #1b1b29; }
[data-bs-theme=dark] .badge-light { background-color: #2b2b40; color: #cdcdde; }
[data-bs-theme=dark] .btn.btn-light:hover, [data-bs-theme=dark] .btn.btn-light:focus { background-color: #323248 !important; color: #f5f5fa; }
[data-bs-theme=dark] img:not([src$=".svg"]) { filter: brightness(.92); }

/* componentes do sistema com fundo claro fixo */
[data-bs-theme=dark] .ag-col-body, [data-bs-theme=dark] .ag-cancelado, [data-bs-theme=dark] .gantt-trilha, [data-bs-theme=dark] .crm-tl-ico,
[data-bs-theme=dark] .crm-barra, [data-bs-theme=dark] .imovel-foto, [data-bs-theme=dark] .onb-check, [data-bs-theme=dark] .onb-letra,
[data-bs-theme=dark] .faq-item summary::after, [data-bs-theme=dark] .faq-mod > .bi { background-color: #2b2b40 !important; }
[data-bs-theme=dark] .ag-item, [data-bs-theme=dark] .onb-linha.atual, [data-bs-theme=dark] .onb-op.on { background-color: #212e48 !important; color: #e4e6ef; }
[data-bs-theme=dark] .ag-confirmado, [data-bs-theme=dark] .ag-concluido, [data-bs-theme=dark] .onb-op.certa, [data-bs-theme=dark] .domain-step.done .domain-step-icon { background-color: #1c3238 !important; }
[data-bs-theme=dark] .ag-faltou, [data-bs-theme=dark] .onb-op.errada, [data-bs-theme=dark] .gantt-barra.atraso, [data-bs-theme=dark] .meter-saida { background-color: #3a2434 !important; }
[data-bs-theme=dark] .crm-tl-item.pend { background: rgba(62, 151, 255, .08); }
[data-bs-theme=dark] .crm-tl-item { border-color: #2b2b40; }
[data-bs-theme=dark] .gantt-barra b { color: #f5f5fa; }
/* papéis impressos (etiqueta, cupom, documento): continuam brancos, como no papel */
[data-bs-theme=dark] .etiqueta, [data-bs-theme=dark] .cupom, [data-bs-theme=dark] .email-previa-corpo { background: #fff !important; color: #000 !important; }

/* páginas públicas (site, agendamento, proposta, portais) */
[data-bs-theme=dark] .lp {
  --lp-ink: #f5f5fa; --lp-txt: #c3c6d6; --lp-mut: #8a8aa3; --lp-line: #2b2b40; --lp-bg: #12121c;
  --lp-soft: color-mix(in srgb, var(--lp) 18%, #1e1e2d);
  background: #151521; color: var(--lp-txt);
}
[data-bs-theme=dark] .lp .lp-card, [data-bs-theme=dark] .lp .ag-box, [data-bs-theme=dark] .lp .ag-serv, [data-bs-theme=dark] .lp .ag-chip,
[data-bs-theme=dark] .lp .lp-faq details, [data-bs-theme=dark] .lp .lp-doc, [data-bs-theme=dark] .lp .rv-topo, [data-bs-theme=dark] .lp .lp-b.line,
[data-bs-theme=dark] .lp .lp-b.light, [data-bs-theme=dark] .lp .st-selo, [data-bs-theme=dark] .lp .rv-qtd input, [data-bs-theme=dark] .lp .ag-campo { background-color: #1e1e2d; color: var(--lp-ink); }
[data-bs-theme=dark] .lp .lp-nav, [data-bs-theme=dark] .lp .lp-barra, [data-bs-theme=dark] .lp .rv-carrinho { background: rgba(21, 21, 33, .92); }
[data-bs-theme=dark] .lp .lp-hero { color: #fff; }
[data-bs-theme=dark] .lp .lp-b.light { color: var(--lp); }
[data-bs-theme=dark] .lp-sec.cinza { background: #12121c; }

/* botão de tema */
.tema-btn { display: inline-flex; align-items: center; justify-content: center; }
.tema-btn .tema-claro { display: none; }
[data-bs-theme=dark] .tema-btn .tema-claro { display: inline; }
[data-bs-theme=dark] .tema-btn .tema-escuro { display: none; }
.tema-flut { position: fixed; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 80; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, .1); background: #fff; color: #181c32; box-shadow: 0 6px 18px rgba(0, 0, 0, .15); font-size: 18px; cursor: pointer; }
[data-bs-theme=dark] .tema-flut { background: #2b2b40; color: #ffc700; border-color: #323248; }
@media (max-width: 767.98px) { .com-barra .tema-flut { bottom: calc(84px + env(safe-area-inset-bottom)); } }
@media print { .tema-flut, .tema-btn { display: none !important; } }

/* topo: a faixa da cor da marca vira escura (luz forte incomoda), com um fio da cor da marca embaixo */
[data-bs-theme=dark] .app-header.brand-bg { background: #1e1e2d !important; border-bottom: 3px solid var(--kt-primary); }
[data-bs-theme=dark] .app-header .app-user-btn, [data-bs-theme=dark] .app-header .btn-light { background: #2b2b40 !important; color: #e4e6ef !important; border-color: #2b2b40 !important; }
[data-bs-theme=dark] .app-mobile-nav { border-color: #2b2b40 !important; }
/* fundos com a cor da marca (login e topo das páginas públicas): escuros, com um toque da cor */
[data-bs-theme=dark] body.brand-bg { background: radial-gradient(900px 500px at 50% -10%, color-mix(in srgb, var(--kt-primary) 22%, #151521), #151521 70%) !important; }
[data-bs-theme=dark] .lp-hero:not(.capa) { background: radial-gradient(1100px 500px at 85% -10%, color-mix(in srgb, var(--lp) 30%, #151521) 0, transparent 60%), linear-gradient(135deg, color-mix(in srgb, var(--lp) 22%, #151521), #151521); }
[data-bs-theme=dark] .lp-cta { background: linear-gradient(135deg, color-mix(in srgb, var(--lp) 30%, #151521), #1e1e2d) !important; }
[data-bs-theme=dark] .st-destino { background: linear-gradient(135deg, color-mix(in srgb, var(--lp) 30%, #151521), #1e1e2d); }
