/* =============================================================================
   Modo escuro monocromático (apenas preto / branco / cinzas).
   Carregado APÓS styles.css — não altera o modo claro.
   ============================================================================= */

html[data-theme="dark"] {
  --app-bg: #000000 !important;
  --surface: #0a0a0a !important;
  --surface-2: #111111 !important;
  --card: #141414 !important;
  --card-strong: #1a1a1a !important;
  --content-bg: #000000 !important;
  --sb-bg: #000000 !important;
  --sb-border: rgba(255, 255, 255, 0.12) !important;
  --sb-icon: #ffffff !important;
  --text: #ffffff !important;
  --muted: rgba(255, 255, 255, 0.62) !important;
  --border: rgba(255, 255, 255, 0.12) !important;
  --border-strong: rgba(255, 255, 255, 0.2) !important;
  --pm-card-dark: #161616 !important;
  --pm-topbar: #000000 !important;
  --pm-sb: #000000 !important;
  --pm-card-blue: #1a1a1a !important;
  --pm-card-strong: #1f1f1f !important;
  --accent: #ffffff !important;
  --accent-2: #e5e5e5 !important;
}

/* Shell principal */
html[data-theme="dark"] body,
html[data-theme="dark"] .app,
html[data-theme="dark"] .main,
html[data-theme="dark"] .content {
  background: #000000 !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .source-switcher,
html[data-theme="dark"] .pm-sb-tabs,
html[data-theme="dark"] .pm-layers-card-head {
  background: #000000 !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .source-btn,
html[data-theme="dark"] .source-btn.active,
html[data-theme="dark"] .icon-btn,
html[data-theme="dark"] .btn:not(.primary),
html[data-theme="dark"] .nav-item,
html[data-theme="dark"] .searchbox,
html[data-theme="dark"] .drawer,
html[data-theme="dark"] .user-menu,
html[data-theme="dark"] .pm-modal,
html[data-theme="dark"] .pm-map-sidebar,
html[data-theme="dark"] .pm-layers-card,
html[data-theme="dark"] .pm-sb-search,
html[data-theme="dark"] .pm-radius-control,
html[data-theme="dark"] .pm-report-builder-wrap,
html[data-theme="dark"] .pm-sb-panel,
html[data-theme="dark"] .pm-map-mode-option {
  background: #0f0f0f !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
}

html[data-theme="dark"] .source-btn.active,
html[data-theme="dark"] .pm-sb-tab.active,
html[data-theme="dark"] .pm-maptype-card.active,
html[data-theme="dark"] .pm-map-mode-option.active {
  background: #ffffff !important;
  color: #000000 !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
}

html[data-theme="dark"] .topbar .icon-btn,
html[data-theme="dark"] #btnTheme,
html[data-theme="dark"] #btnSettings,
html[data-theme="dark"] .sb-bottom .icon-btn {
  background: #141414 !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

html[data-theme="dark"] .searchbox input,
html[data-theme="dark"] .sb-search input,
html[data-theme="dark"] .pm-sb-search input,
html[data-theme="dark"] .cf-input,
html[data-theme="dark"] .input,
html[data-theme="dark"] .select {
  color: #ffffff !important;
  background: #0a0a0a !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
}

html[data-theme="dark"] .crumb,
html[data-theme="dark"] .crumb-sub,
html[data-theme="dark"] .card-title,
html[data-theme="dark"] .card-sub,
html[data-theme="dark"] .page-title,
html[data-theme="dark"] .nav-title,
html[data-theme="dark"] .nav-sub,
html[data-theme="dark"] .user-name,
html[data-theme="dark"] .user-menu-name {
  color: #ffffff !important;
}

html[data-theme="dark"] .crumb-sub,
html[data-theme="dark"] .card-sub,
html[data-theme="dark"] .nav-sub,
html[data-theme="dark"] .user-menu-role,
html[data-theme="dark"] .user-role {
  color: rgba(255, 255, 255, 0.72) !important;
}

html[data-theme="dark"] .map-layer-row,
html[data-theme="dark"] .mini-item,
html[data-theme="dark"] .card,
html[data-theme="dark"] .kpi,
html[data-theme="dark"] .sub-kpi-card {
  background: #111111 !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .card:hover {
  border-color: rgba(255, 255, 255, 0.28) !important;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55) !important;
}

html[data-theme="dark"] .chip,
html[data-theme="dark"] .chip.on {
  background: #1a1a1a !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .chip.on {
  background: #ffffff !important;
  color: #000000 !important;
}

html[data-theme="dark"] .user-avatar {
  background: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
}

html[data-theme="dark"] .user-initial {
  color: #000000 !important;
}

html[data-theme="dark"] .topbar .badge {
  background: #ffffff !important;
  color: #000000 !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
}

/* Censo / dashboards integrados */
html[data-theme="dark"] .censo-integrated {
  --edu-bg: #000000 !important;
  --edu-surface: #0f0f0f !important;
  --edu-surface-2: #141414 !important;
  --edu-border: rgba(255, 255, 255, 0.14) !important;
  --edu-text: #ffffff !important;
  --edu-muted: rgba(255, 255, 255, 0.68) !important;
  --edu-primary: #ffffff !important;
  --edu-cyan: #e5e5e5 !important;
  background: #000000 !important;
}

html[data-theme="dark"] .censo-integrated .source-panel > .tabs-bar,
html[data-theme="dark"] .censo-integrated #panel-ibge > .tabs-bar,
html[data-theme="dark"] .censo-integrated #panel-saude .tabs-bar {
  background: rgba(0, 0, 0, 0.92) !important;
  border-bottom-color: rgba(255, 255, 255, 0.12) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .censo-integrated .source-panel > .tabs-bar .tab,
html[data-theme="dark"] .censo-integrated #panel-saude .tab[data-sautab],
html[data-theme="dark"] .censo-integrated #panel-ibge > .tabs-bar .tab {
  color: rgba(255, 255, 255, 0.55) !important;
}

html[data-theme="dark"] .censo-integrated .source-panel > .tabs-bar .tab.active,
html[data-theme="dark"] .censo-integrated #panel-saude .tab[data-sautab].active,
html[data-theme="dark"] .censo-integrated #panel-ibge > .tabs-bar .tab.active {
  background: #e8e8e8 !important;
  color: #0a0a0a !important;
  border-color: rgba(255, 255, 255, 0.28) !important;
}

html[data-theme="dark"] .censo-integrated .card,
html[data-theme="dark"] .censo-integrated .sub-kpi-card,
html[data-theme="dark"] .censo-integrated #panel-saude .sau-card,
html[data-theme="dark"] .censo-integrated #panel-saude .sau-card-w,
html[data-theme="dark"] .censo-integrated .kpi-card,
html[data-theme="dark"] .censo-integrated .page-title-row {
  background: #111111 !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
}

html[data-theme="dark"] .censo-integrated #panel-tse .sub-kpi-card {
  background: #111111 !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
}

html[data-theme="dark"] .censo-integrated .commentary,
html[data-theme="dark"] .censo-integrated .insight-box,
html[data-theme="dark"] .censo-integrated #panel-saude .sau-filter-bar,
html[data-theme="dark"] .censo-integrated #panel-saude .sau-hi {
  background: #0f0f0f !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  border-left-color: #ffffff !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .censo-integrated .commentary strong,
html[data-theme="dark"] .censo-integrated .card-meta,
html[data-theme="dark"] .censo-integrated .source-tag {
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  background: rgba(255, 255, 255, 0.06) !important;
}

html[data-theme="dark"] .censo-integrated .select,
html[data-theme="dark"] .censo-integrated #panel-saude .sau-fsel,
html[data-theme="dark"] .censo-integrated #panel-saude select.select {
  background: #0a0a0a !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
}

html[data-theme="dark"] .censo-integrated button.btn,
html[data-theme="dark"] .censo-integrated .incra-pill,
html[data-theme="dark"] .censo-integrated #panel-saude .sau-pill,
html[data-theme="dark"] .censo-integrated #panel-saude .sau-chip,
html[data-theme="dark"] .censo-integrated #panel-saude .sau-filter-reset {
  background: #161616 !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

html[data-theme="dark"] .censo-integrated .incra-pill.on,
html[data-theme="dark"] .censo-integrated #panel-saude .sau-pill.on,
html[data-theme="dark"] .censo-integrated #panel-saude .sau-chip.on,
html[data-theme="dark"] .censo-integrated .chip.on {
  background: #ffffff !important;
  color: #000000 !important;
}

html[data-theme="dark"] .commentary {
  background: #0f0f0f !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  border-left-color: #ffffff !important;
}

html[data-theme="dark"] .commentary strong {
  color: #ffffff !important;
}

/* TSE widgets que ainda usavam azul no escuro */
html[data-theme="dark"] .tse-locais-map {
  background: #0a0a0a !important;
}

html[data-theme="dark"] .tse-map-legend {
  background: rgba(10, 10, 10, 0.95) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  color: rgba(255, 255, 255, 0.85) !important;
}

html[data-theme="dark"] .tse-map-legend b,
html[data-theme="dark"] .tse-map-legend small {
  color: #ffffff !important;
}

html[data-theme="dark"] .tse-map-toolbar button {
  background: #141414 !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

html[data-theme="dark"] .tse-map-toolbar button.active {
  background: #ffffff !important;
  color: #000000 !important;
  border-color: #ffffff !important;
}

/* Mapa: controles em preto e branco */
html[data-theme="dark"] .pm-map-area #pmStreetViewTrigger.active,
html[data-theme="dark"] .pm-map-area #pmTrafficFlowTrigger.active {
  background: #ffffff !important;
  border-color: #ffffff !important;
  color: #000000 !important;
}

html[data-theme="dark"] .pm-map-area .pm-map-zoom-pill #pmMapZoomIn,
html[data-theme="dark"] .pm-map-area .pm-map-zoom-pill #pmMapZoomOut,
html[data-theme="dark"] .pm-map-area .pm-map-zoom-pill .pm-map-zoom-btn,
html[data-theme="dark"] .pm-map-area .pm-maptype-trigger,
html[data-theme="dark"] .pm-map-area .pm-streetview-trigger,
html[data-theme="dark"] .pm-map-area .pm-traffic-trigger,
html[data-theme="dark"] .pm-map-area .pm-map-round-btn,
html[data-theme="dark"] .pm-map-area #pmMapSearchBtn,
html[data-theme="dark"] .pm-map-area #pmMapShareBtn,
html[data-theme="dark"] .pm-map-area #pmMapFullscreenBtn,
html[data-theme="dark"] .pm-map-area #pmMapTypeTrigger,
html[data-theme="dark"] .pm-map-area #pmMapModeTrigger {
  background: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  color: #000000 !important;
}

html[data-theme="dark"] .pm-map-area #pmMapZoomIn *,
html[data-theme="dark"] .pm-map-area #pmMapZoomOut *,
html[data-theme="dark"] .pm-map-area .pm-maptype-trigger *,
html[data-theme="dark"] .pm-map-area .pm-streetview-trigger *,
html[data-theme="dark"] .pm-map-area .pm-traffic-trigger *,
html[data-theme="dark"] .pm-map-area .pm-map-round-btn *,
html[data-theme="dark"] .pm-map-area #pmMapSearchBtn *,
html[data-theme="dark"] .pm-map-area #pmMapShareBtn *,
html[data-theme="dark"] .pm-map-area #pmMapFullscreenBtn *,
html[data-theme="dark"] .pm-map-area #pmStreetViewTrigger *,
html[data-theme="dark"] .pm-map-area #pmTrafficFlowTrigger *,
html[data-theme="dark"] .pm-map-area #pmMapTypeTrigger *,
html[data-theme="dark"] .pm-map-area #pmMapModeTrigger * {
  color: #000000 !important;
  stroke: #000000 !important;
}

html[data-theme="dark"] .pm-map-area .pm-map-zoom-btn + .pm-map-zoom-btn {
  border-top-color: rgba(0, 0, 0, 0.12) !important;
}

html[data-theme="dark"] .pm-map-area .pm-map-compass .pm-map-compass-arrow,
html[data-theme="dark"] .pm-map-area .pm-map-compass .pm-map-compass-n {
  color: #000000 !important;
  stroke: #000000 !important;
  fill: #000000 !important;
}

html[data-theme="dark"] .pm-map-area .pm-map-compass .pm-map-compass-disc {
  background: rgba(0, 0, 0, 0.06) !important;
}

html[data-theme="dark"] .pm-map-area #pmMapDistanceCard,
html[data-theme="dark"] .pm-map-area #pmMapCoordsCard,
html[data-theme="dark"] .pm-map-area .pm-active-bar {
  background: #0f0f0f !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .pm-map-area #pmMapDistanceCard .pm-map-distance-value,
html[data-theme="dark"] .pm-map-area #pmMapCoordsCard .pm-map-coords-meta,
html[data-theme="dark"] .pm-map-area #pmMapCoordsCard .pm-map-coords-values,
html[data-theme="dark"] .pm-map-area .pm-active-bar .pm-active-bar-label,
html[data-theme="dark"] .pm-map-area .pm-active-bar .pm-active-empty,
html[data-theme="dark"] .pm-map-area .pm-active-bar .pm-active-chip,
html[data-theme="dark"] .pm-map-area .pm-active-bar .pm-active-chip-text {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

html[data-theme="dark"] .pm-map-area #pmMapDistanceCard .pm-map-distance-line,
html[data-theme="dark"] .pm-map-area #pmMapDistanceCard .pm-map-distance-tick {
  background: rgba(255, 255, 255, 0.45) !important;
}

html[data-theme="dark"] .pm-map-area .pm-active-bar .pm-active-chip {
  background: #1a1a1a !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

html[data-theme="dark"] .pm-map-area .pm-active-bar .pm-active-clear,
html[data-theme="dark"] .pm-map-area .pm-active-bar .pm-active-chip-x {
  background: #ffffff !important;
  color: #000000 !important;
  border-color: rgba(0, 0, 0, 0.15) !important;
}

html[data-theme="dark"] .pm-map-area .pm-map-mode-popover,
html[data-theme="dark"] .pm-map-area .pm-maptype-popover {
  border-color: rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5) !important;
}

html[data-theme="dark"] .pm-map-area .pm-maptype-trigger:hover,
html[data-theme="dark"] .pm-map-area .pm-streetview-trigger:hover,
html[data-theme="dark"] .pm-map-area .pm-traffic-trigger:hover,
html[data-theme="dark"] .pm-map-area .pm-map-round-btn:hover,
html[data-theme="dark"] .pm-map-area .pm-map-zoom-btn:hover,
html[data-theme="dark"] .pm-map-area #pmMapSearchBtn:hover,
html[data-theme="dark"] .pm-map-area #pmMapShareBtn:hover,
html[data-theme="dark"] .pm-map-area #pmMapFullscreenBtn:hover,
html[data-theme="dark"] .pm-map-area #pmStreetViewTrigger:hover,
html[data-theme="dark"] .pm-map-area #pmTrafficFlowTrigger:hover,
html[data-theme="dark"] .pm-map-area #pmMapTypeTrigger:hover,
html[data-theme="dark"] .pm-map-area #pmMapModeTrigger:hover {
  border-color: rgba(255, 255, 255, 0.35) !important;
}

/* Rodapé padrão — compacto (mapa oculto via body.map-source-active / body.pm-standalone-map em styles.css) */
.pm-app-footer {
  flex-shrink: 0;
  text-align: center;
  font-size: 0.62rem;
  line-height: 1.4;
  padding: 5px 12px 6px;
  min-height: 0;
  border-top: 1px solid #244e9c;
  background: #eef4ff;
  color: rgba(36, 78, 156, 0.78);
}

.pm-app-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.pm-app-footer-line1 {
  font-size: 0.62rem;
}

.pm-app-footer-line2 {
  font-size: 0.58rem;
  margin-top: 1px;
}

.pm-app-footer-line1 strong {
  color: #244e9c;
  font-weight: 800;
}

html[data-theme="dark"] .pm-app-footer {
  padding: 4px 10px 5px !important;
  background: #000000 !important;
  border-top-color: rgba(255, 255, 255, 0.22) !important;
  color: rgba(255, 255, 255, 0.72) !important;
}

html[data-theme="dark"] .pm-app-footer-line1 strong {
  color: #ffffff !important;
}

html[data-theme="dark"] .footer.pm-app-footer,
html[data-theme="dark"] .pm-app-footer-line2 {
  color: rgba(255, 255, 255, 0.68) !important;
}

/* Sobrescreve regra global que força .tabs-bar e filhos em branco */
html[data-theme="dark"] .censo-integrated .tabs-bar {
  background: rgba(0, 0, 0, 0.96) !important;
}
html[data-theme="dark"] .censo-integrated .tabs-bar * {
  background-color: transparent !important;
  background-image: none !important;
}
html[data-theme="dark"] .censo-integrated .tabs-bar .tab {
  background: #161616 !important;
}
html[data-theme="dark"] .censo-integrated .tabs-bar .tab.active {
  background: #ffffff !important;
  color: #000000 !important;
}

html[data-theme="dark"] .censo-integrated #panel-saude .sau-kc {
  background: #111111 !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
}

/* ── Topbar: remove faixa colorida (gradiente + ::before) no modo escuro ── */
html[data-theme="dark"] .app .topbar {
  background: #0a0a0a !important;
  background-image: none !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

html[data-theme="dark"] .app .topbar::before {
  display: none !important;
}

html[data-theme="dark"] .topbar-pa-logo {
  filter: grayscale(1) contrast(1.08) brightness(1.12) !important;
}

html[data-theme="dark"] .topbar-title-divider {
  background: rgba(255, 255, 255, 0.35) !important;
}

html[data-theme="dark"] .searchbox {
  background: #141414 !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
}

html[data-theme="dark"] .searchbox input {
  color: #f5f5f5 !important;
}

html[data-theme="dark"] .searchbox input::placeholder {
  color: rgba(255, 255, 255, 0.45) !important;
}

html[data-theme="dark"] .searchbox .icon,
html[data-theme="dark"] .searchbox svg,
html[data-theme="dark"] .searchbox svg * {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

/* Reaplica cinza na topbar mesmo com blocos PMPA 2026 em styles.css */
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .censo-integrated .topbar,
html[data-theme="dark"] .source-panel > .topbar {
  background: #0a0a0a !important;
  background-image: none !important;
}

/* Painel mapa: cabeçalho da sidebar sem azul */
html[data-theme="dark"] .pm-sb-header {
  background: #111111 !important;
  border-bottom-color: rgba(255, 255, 255, 0.12) !important;
}

html[data-theme="dark"] .pm-sb-tabs {
  background: #0a0a0a !important;
}

html[data-theme="dark"] .pm-sb-tab {
  color: rgba(255, 255, 255, 0.55) !important;
}

html[data-theme="dark"] .pm-sb-tab:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .pm-sb-tab.active {
  color: #000000 !important;
  background: #ffffff !important;
  border-bottom-color: #ffffff !important;
}

/* Abas inativas da sidebar do mapa: fundo explícito (evita qualquer resíduo azul) */
html[data-theme="dark"] .pm-sb-tab:not(.active) {
  background: #1a1a1a !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* TSE: padrão xadrez do mapa de locais em cinza */
html[data-theme="dark"] .tse-locais-map::before {
  background-image: #2a2a2a, #2a2a2a !important;
  opacity: 0.55 !important;
}

/* OpenLayers: créditos / links sem azul padrão */
html[data-theme="dark"] .ol-attribution,
html[data-theme="dark"] .ol-attribution a,
html[data-theme="dark"] .ol-attribution ul {
  color: rgba(255, 255, 255, 0.55) !important;
  background: rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="dark"] .ol-attribution a {
  text-decoration: underline;
}

/* TSE (HTML/CSS): pirâmide, barras duplas e toolbar sem cores de campanha */
html[data-theme="dark"] #panel-tse .tse-pyramid-side.left span {
  background: #8a8a8a !important;
}
html[data-theme="dark"] #panel-tse .tse-pyramid-side.right span {
  background: #d4d4d4 !important;
}
html[data-theme="dark"] #panel-tse .tse-pyramid-side b,
html[data-theme="dark"] #panel-tse .tse-pyramid-age,
html[data-theme="dark"] #panel-tse .tse-dual-label,
html[data-theme="dark"] #panel-tse .tse-mini-legend,
html[data-theme="dark"] #panel-tse .tse-vbar-label,
html[data-theme="dark"] #panel-tse .tse-map-toolbar span {
  color: rgba(255, 255, 255, 0.68) !important;
}
html[data-theme="dark"] #panel-tse .tse-dual-track {
  background: rgba(255, 255, 255, 0.1) !important;
}
html[data-theme="dark"] #panel-tse .tse-dual-track b {
  color: #f0f0f0 !important;
}
html[data-theme="dark"] #panel-tse .tse-vbar-plot {
  border-bottom-color: rgba(255, 255, 255, 0.16) !important;
}
html[data-theme="dark"] #panel-tse .tse-map-toolbar button {
  background: #161616 !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  color: #ececec !important;
}
html[data-theme="dark"] #panel-tse .tse-map-toolbar button.active {
  background: #ffffff !important;
  border-color: #ffffff !important;
  color: #000000 !important;
}
html[data-theme="dark"] #panel-tse .tse-data-table th,
html[data-theme="dark"] #panel-tse .tse-data-table td {
  color: rgba(255, 255, 255, 0.72) !important;
  border-bottom-color: rgba(255, 255, 255, 0.12) !important;
}
html[data-theme="dark"] #panel-tse .tse-data-table td:last-child,
html[data-theme="dark"] #panel-tse .tse-data-table th:last-child {
  color: #f5f5f5 !important;
}

/* ── Overrides finais PMPA: escuro só preto / branco / cinza ── */
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .topbar.main {
  background: #0a0a0a !important;
  background-image: none !important;
}
html[data-theme="dark"] .topbar::before {
  display: none !important;
  content: none !important;
}
html[data-theme="dark"] .source-panel > .topbar {
  background: #0a0a0a !important;
  background-image: none !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}
html[data-theme="dark"] .topbar .searchbox,
html[data-theme="dark"] .searchbox {
  background: #141414 !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
}
html[data-theme="dark"] .topbar .searchbox input,
html[data-theme="dark"] .searchbox input {
  color: #f5f5f5 !important;
}
html[data-theme="dark"] .searchbox .icon,
html[data-theme="dark"] .searchbox svg,
html[data-theme="dark"] .searchbox svg * {
  color: #ffffff !important;
  stroke: #ffffff !important;
}
html[data-theme="dark"] .searchbox input::placeholder {
  color: rgba(255, 255, 255, 0.48) !important;
}

html[data-theme="dark"] .source-switcher .source-btn,
html[data-theme="dark"] .tabs-bar .tab:not(.active),
html[data-theme="dark"] .tabs-bar button:not(.active) {
  background: #161616 !important;
  color: rgba(255, 255, 255, 0.82) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

html[data-theme="dark"] .map-cat-tile .mct-label {
  color: rgba(255, 255, 255, 0.9) !important;
}
html[data-theme="dark"] .map-layer-empty,
html[data-theme="dark"] .map-layer-empty p,
html[data-theme="dark"] .map-layer-empty small {
  color: rgba(255, 255, 255, 0.75) !important;
  opacity: 1 !important;
}
html[data-theme="dark"] .map-layer-empty .icon,
html[data-theme="dark"] .map-layer-empty svg,
html[data-theme="dark"] .map-layer-empty svg * {
  color: #ffffff !important;
  stroke: #ffffff !important;
  fill: #ffffff !important;
  opacity: 0.9 !important;
}

html[data-theme="dark"] .sb-search .icon,
html[data-theme="dark"] .sb-search-ico {
  color: #ffffff !important;
  stroke: #ffffff !important;
  opacity: 0.92 !important;
}

html[data-theme="dark"] .sidebar.collapsed .nav-item {
  background: #161616 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
}
html[data-theme="dark"] .sidebar.collapsed .nav-item .nav-icon .icon,
html[data-theme="dark"] .sidebar.collapsed .nav-item .icon {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

html[data-theme="dark"] .pm-sb-search svg {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

html[data-theme="dark"] .map-layer-row.focused {
  border-color: rgba(255, 255, 255, 0.26) !important;
  background: rgba(255, 255, 255, 0.06) !important;
}
html[data-theme="dark"] .mlr-status-dot.vis {
  background: #e5e5e5 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .pm-map-area #pmMapCoordsCard,
html[data-theme="dark"] .pm-map-area #pmMapDistanceCard {
  border-color: rgba(255, 255, 255, 0.14) !important;
}
html[data-theme="dark"] .pm-map-area #pmMapCoordsCard .pm-map-coords-icon,
html[data-theme="dark"] .pm-map-area #pmMapCoordsCard .pm-map-coords-icon * {
  color: #f0f0f0 !important;
  stroke: #f0f0f0 !important;
}

/* ==========================================================================
   Ajustes finais do modo escuro (corrige resquícios azuis no mapa/sidebar)
   ========================================================================== */
html[data-theme="dark"] .pm-sb-tab.active,
html[data-theme="dark"] .pm-map-sidebar .pm-sb-tab.active {
  background: #ffffff !important;
  color: #000000 !important;
  border-bottom-color: #ffffff !important;
}

html[data-theme="dark"] .pm-sb-tab.active svg,
html[data-theme="dark"] .pm-sb-tab.active svg *,
html[data-theme="dark"] .pm-map-sidebar .pm-sb-tab.active .icon,
html[data-theme="dark"] .pm-map-sidebar .pm-sb-tab.active .icon * {
  color: #000000 !important;
  stroke: #000000 !important;
}

html[data-theme="dark"] #pmtab-categorias .map-cat-item,
html[data-theme="dark"] #pmtab-categorias .map-cat-item.on,
html[data-theme="dark"] #pmtab-categorias .map-cat-item:hover {
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  background: rgba(255, 255, 255, 0.06) !important;
}

html[data-theme="dark"] #pmtab-categorias .map-cat-item svg,
html[data-theme="dark"] #pmtab-categorias .map-cat-item svg *,
html[data-theme="dark"] #pmtab-categorias .item-check {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

html[data-theme="dark"] .pm-map-area #pmMapCoordsCard .pm-map-coords-meta,
html[data-theme="dark"] .pm-map-area #pmMapCoordsCard .pm-map-coords-values,
html[data-theme="dark"] .pm-map-area #pmMapCoordsCard .pm-map-coords-values span {
  color: #ffffff !important;
}

html[data-theme="dark"] #btnTheme,
html[data-theme="dark"] #btnSettings,
html[data-theme="dark"] .sb-bottom .icon-btn,
html[data-theme="dark"] .sb-bottom .icon-btn .icon,
html[data-theme="dark"] .sb-bottom .icon-btn .icon *,
html[data-theme="dark"] .sb-bottom .icon-btn svg,
html[data-theme="dark"] .sb-bottom .icon-btn svg * {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

html[data-theme="dark"] .pm-map-area .pm-active-bar .pm-active-clear,
html[data-theme="dark"] .pm-map-area .pm-active-bar .pm-active-chip-x {
  background: #ffffff !important;
  color: #000000 !important;
  border-color: rgba(0, 0, 0, 0.22) !important;
}

html[data-theme="dark"] .pm-map-area .pm-active-bar .pm-active-clear svg,
html[data-theme="dark"] .pm-map-area .pm-active-bar .pm-active-clear svg *,
html[data-theme="dark"] .pm-map-area .pm-active-bar .pm-active-chip-x svg,
html[data-theme="dark"] .pm-map-area .pm-active-bar .pm-active-chip-x svg * {
  color: #000000 !important;
  stroke: #000000 !important;
}

html[data-theme="dark"] #tbPopupCat,
html[data-theme="dark"] #tbPopupLayers,
html[data-theme="dark"] #tbPopupCat .map-tb-popup,
html[data-theme="dark"] #tbPopupLayers .map-tb-popup,
html[data-theme="dark"] .pm-map-area .pm-maptype-popover,
html[data-theme="dark"] .pm-map-area .pm-map-mode-popover {
  background: #0f0f0f !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
}

html[data-theme="dark"] #tbPopupCat *,
html[data-theme="dark"] #tbPopupLayers *,
html[data-theme="dark"] .pm-map-area .pm-maptype-popover *,
html[data-theme="dark"] .pm-map-area .pm-map-mode-popover * {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

html[data-theme="dark"] .pm-map-area .pm-maptype-card,
html[data-theme="dark"] .pm-map-area .pm-map-mode-option {
  background: #161616 !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .pm-map-area .pm-maptype-card.active,
html[data-theme="dark"] .pm-map-area .pm-map-mode-option.active {
  background: #ffffff !important;
  color: #000000 !important;
  border-color: #ffffff !important;
}

html[data-theme="dark"] .pm-map-area .pm-maptype-card.active *,
html[data-theme="dark"] .pm-map-area .pm-map-mode-option.active * {
  color: #000000 !important;
  stroke: #000000 !important;
}

html[data-theme="dark"] .pm-sb-search input,
html[data-theme="dark"] .pm-sb-search input::placeholder,
html[data-theme="dark"] .sb-search input,
html[data-theme="dark"] .sb-search input::placeholder {
  color: #ffffff !important;
}

/* Sidebar esquerda expandida (secretarias + busca): remove azul residual */
html[data-theme="dark"] .sidebar:not(.collapsed) .sb-search,
html[data-theme="dark"] .sidebar:not(.collapsed) .sb-search input {
  background: #0f0f0f !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

html[data-theme="dark"] .sidebar:not(.collapsed) .sb-search input::placeholder,
html[data-theme="dark"] .sidebar:not(.collapsed) .sb-search .icon,
html[data-theme="dark"] .sidebar:not(.collapsed) .sb-search .icon *,
html[data-theme="dark"] .sidebar:not(.collapsed) .sb-search-ico,
html[data-theme="dark"] .sidebar:not(.collapsed) .sb-search-ico * {
  color: #ffffff !important;
  stroke: #ffffff !important;
  opacity: 0.92 !important;
}

html[data-theme="dark"] .sidebar:not(.collapsed) .nav-item,
html[data-theme="dark"] .sidebar:not(.collapsed) .nav-item.active {
  background: #141414 !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .sidebar:not(.collapsed) .nav-title,
html[data-theme="dark"] .sidebar:not(.collapsed) .nav-sub,
html[data-theme="dark"] .sidebar:not(.collapsed) .nav-text {
  color: #ffffff !important;
}

html[data-theme="dark"] .sidebar:not(.collapsed) .nav-icon,
html[data-theme="dark"] .sidebar:not(.collapsed) .nav-icon .icon,
html[data-theme="dark"] .sidebar:not(.collapsed) .nav-icon .icon *,
html[data-theme="dark"] .sidebar:not(.collapsed) .nav-icon svg,
html[data-theme="dark"] .sidebar:not(.collapsed) .nav-icon svg * {
  background: transparent !important;
  color: #ffffff !important;
  stroke: #ffffff !important;
}

/* HUD de coordenadas: garante lat/lon brancos no escuro */
html[data-theme="dark"] .pm-map-area #pmMapCoordsCard,
html[data-theme="dark"] .pm-map-area #pmMapDistanceCard {
  background: #161616 !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .pm-map-area #pmMapCoordsCard .pm-map-coords-meta,
html[data-theme="dark"] .pm-map-area #pmMapCoordsCard .pm-map-coords-values,
html[data-theme="dark"] .pm-map-area #pmMapCoordsCard .pm-map-coords-values span,
html[data-theme="dark"] .pm-map-area #pmMapLatValue,
html[data-theme="dark"] .pm-map-area #pmMapLonValue {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

html[data-theme="dark"] .pm-map-area #pmMapCoordsCard .pm-map-coords-icon,
html[data-theme="dark"] .pm-map-area #pmMapCoordsCard .pm-map-coords-icon * {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

/* Sidebar recolhida: ícones das secretarias em preto no modo escuro */
html[data-theme="dark"] .sidebar.collapsed .nav-icon .icon,
html[data-theme="dark"] .sidebar.collapsed .nav-icon svg,
html[data-theme="dark"] .sidebar.collapsed .nav-icon svg *,
html[data-theme="dark"] .sidebar.collapsed .nav-item .icon,
html[data-theme="dark"] .sidebar.collapsed .nav-item .icon * {
  color: #000000 !important;
  stroke: #000000 !important;
}

/* Relatórios: CTA "Criar agora" com texto preto no modo escuro */
html[data-theme="dark"] #pmtab-relatorios .pm-report-option-cta,
html[data-theme="dark"] #pmtab-relatorios .pm-report-option-cta * {
  color: #000000 !important;
  stroke: #000000 !important;
}

/* Demográfico (cards especiais): remover fundo branco/azul no escuro */
html[data-theme="dark"] #pmtab-categorias #mapLayersList .map-layer-special {
  background: #141414 !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
}

html[data-theme="dark"] #pmtab-categorias #mapLayersList .map-layer-special > div:first-child > div,
html[data-theme="dark"] #pmtab-categorias #mapLayersList .map-layer-special > div:first-child > div *,
html[data-theme="dark"] #pmtab-categorias #mapLayersList .map-layer-special .pm-sb-info-label {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

html[data-theme="dark"] #pmtab-categorias #mapLayersList .map-layer-special > div:last-child,
html[data-theme="dark"] #pmtab-categorias #mapLayersList .map-layer-special > div:last-child * {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
  stroke: #ffffff !important;
}

/* Títulos de seção do painel (Recortes territoriais, Domicílios, etc.) */
html[data-theme="dark"] #pmtab-categorias #mapLayersList .map-layer-section,
html[data-theme="dark"] #pmtab-categorias #mapLayersList .map-layer-section * {
  background: #101010 !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  stroke: #ffffff !important;
}

/* Tutu em modo escuro */
html[data-theme="dark"] .tutu-popup {
  background: #0f0f0f !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5) !important;
}

html[data-theme="dark"] .tutu-popup-head {
  background: #161616 !important;
  border-bottom-color: rgba(255, 255, 255, 0.14) !important;
}

html[data-theme="dark"] .tutu-min-btn,
html[data-theme="dark"] .tutu-close-btn {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .tutu-visual {
  background: #1a1a1a !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
}

html[data-theme="dark"] .tutu-visual-badge {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .tutu-avatar {
  background: #1a1a1a !important;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.12) !important;
}

html[data-theme="dark"] .tutu-visual-text {
  color: rgba(255, 255, 255, 0.82) !important;
}

html[data-theme="dark"] .tutu-start-btn,
html[data-theme="dark"] .tutu-send-btn {
  background: #ffffff !important;
  color: #000000 !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
}

html[data-theme="dark"] .tutu-back-btn,
html[data-theme="dark"] .tutu-trash-btn {
  background: #1a1a1a !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
}

html[data-theme="dark"] .tutu-msg.bot {
  background: #1a1a1a !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .tutu-msg.user {
  background: #ffffff !important;
  color: #000000 !important;
}

html[data-theme="dark"] .tutu-typing-dot {
  background: #ffffff !important;
}

html[data-theme="dark"] .tutu-chat-form input {
  background: #111111 !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
}

html[data-theme="dark"] .tutu-chat-form input::placeholder {
  color: rgba(255, 255, 255, 0.5) !important;
}

/* Tutu minimizado: texto escuro (preto) */
html[data-theme="dark"] .tutu-min-tab,
html[data-theme="dark"] .tutu-min-tab span,
html[data-theme="dark"] .tutu-min-tab * {
  background: #ffffff !important;
  color: #000000 !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
}
