/* ==========================================================================
   CadÚnico — Indicadores socioeconômicos por bairro
   - Aba lateral (.pm-cx): só controles do mapa, no mesmo padrão visual das
     abas Pessoas / Domicílios / Macrorregião (hero azul, cabeçalhos em caixa
     alta, opções .pm-dom-sidebar-option, KPIs .pm-macro-kpi).
   - Cartões da esquerda do mapa (#pmSocioSidePanel, #pmCensoSidePanel): ficha do bairro +
     legenda interativa, com entrada/saída animada.
   ========================================================================== */

#pmtab-categorias #mapLayersList .pm-cx {
  --cx-blue: #2563eb;
  --cx-blue-ink: #1d4ed8;
  --cx-blue-soft: rgba(37, 99, 235, 0.08);
  --cx-line: rgba(37, 99, 235, 0.14);
  --cx-ink: #111827;
  --cx-muted: #6b7a96;
  font-family: Poppins, "Segoe UI", Arial, sans-serif;
  color: var(--cx-ink);
  display: grid;
  gap: 12px;
  min-width: 0;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-sx-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

#pmtab-categorias #mapLayersList .pm-cx [hidden] {
  display: none !important;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-body {
  gap: 12px !important;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-heading-gap {
  margin-top: 6px !important;
  padding-top: 12px !important;
  border-top: 1px solid rgba(15, 23, 42, 0.07) !important;
}

/* ---------- KPIs ---------- */
#pmtab-categorias #mapLayersList .pm-cx .pm-macro-kpi {
  min-height: 70px !important;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-macro-kpi strong {
  color: var(--cx-ink) !important;
  font-variant-numeric: tabular-nums;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-macro-kpi strong small {
  font-size: 11px !important;
  color: var(--cx-muted) !important;
  font-weight: 600 !important;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-empty {
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 12px;
  font-weight: 600;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-textbtn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--cx-blue-ink);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- busca ---------- */
#pmtab-categorias #mapLayersList .pm-cx .pm-cx-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--cx-line);
  background: rgba(255, 255, 255, 0.92);
  color: var(--cx-muted) !important;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-search svg {
  color: var(--cx-muted) !important;
  stroke: currentColor;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-search input::placeholder {
  color: #8a97ad !important;
  -webkit-text-fill-color: #8a97ad !important;
  opacity: 1;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-search:focus-within {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-search svg {
  flex: none;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  font: 500 12.5px/1 Poppins, "Segoe UI", Arial, sans-serif;
  color: var(--cx-ink) !important;
  -webkit-text-fill-color: var(--cx-ink) !important;
}

/* ---------- grupos de indicadores (sempre abertos) ---------- */
#pmtab-categorias #mapLayersList .pm-cx .pm-cx-groups {
  display: grid;
  gap: 14px;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-group {
  display: grid;
  gap: 6px;
  /* Isola o reflow do accordion dos irmãos / scroll do painel */
  contain: layout style;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-group__head span {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--cx-muted);
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-group.has-active .pm-cx-group__head span {
  color: var(--cx-blue-ink);
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-group__head em {
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--cx-blue-soft);
  color: var(--cx-blue-ink);
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-options {
  display: grid !important;
  gap: 6px !important;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-dom-sidebar-option {
  align-items: center !important;
  padding: 9px 11px !important;
  /* Sem transform: evita jank enquanto o accordion anima a altura */
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-dom-sidebar-option:not(.is-active):hover {
  border-color: rgba(37, 99, 235, 0.34) !important;
  background: #ffffff !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

#pmtab-categorias #mapLayersList .pm-cx .pm-dom-sidebar-option.is-active {
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.22);
}

#pmtab-categorias #mapLayersList .pm-cx .pm-dom-sidebar-option:focus-visible {
  outline: 2px solid var(--cx-blue);
  outline-offset: 2px;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-note {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--cx-muted);
  list-style: none;
}

/* ---------- abas de controle ---------- */
#pmtab-categorias #mapLayersList .pm-cx .pm-cx-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid var(--cx-line);
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #4a5b78;
  font: 600 12px/1 Poppins, "Segoe UI", Arial, sans-serif;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-tab:hover {
  color: var(--cx-blue-ink);
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-tab.is-active {
  background: var(--cx-blue);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.24);
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-tab-dot {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f97316;
  box-shadow: 0 0 0 2px #fff;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-tabpanel {
  display: grid;
  gap: 10px;
  outline: none;
  animation: pmCxFade 0.22s ease;
}

@keyframes pmCxFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ---------- cartões de controle ---------- */
#pmtab-categorias #mapLayersList .pm-cx .pm-cx-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(15, 23, 42, 0.07);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-card__head {
  display: grid;
  gap: 2px;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-card__head strong {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--cx-ink);
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-card__head small {
  font-size: 11px;
  font-weight: 500;
  color: var(--cx-muted);
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-card__body {
  display: grid;
  gap: 12px;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-field {
  display: grid;
  gap: 6px;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-field__label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cx-muted);
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-field__hint {
  font-size: 11px;
  line-height: 1.4;
  color: var(--cx-muted);
}

/* controle segmentado */
#pmtab-categorias #mapLayersList .pm-cx .pm-cx-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  background: #f1f5fb;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-seg__btn {
  flex: 1 1 auto;
  min-width: 0;
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #4a5b78;
  font: 600 11.5px/1 Poppins, "Segoe UI", Arial, sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-seg__btn:hover:not(.is-active):not(:disabled) {
  background: rgba(255, 255, 255, 0.8);
  color: var(--cx-blue-ink);
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-seg__btn.is-active {
  background: #ffffff;
  color: var(--cx-blue-ink);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12), inset 0 0 0 1px rgba(37, 99, 235, 0.28);
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-seg__btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* sliders */
#pmtab-categorias #mapLayersList .pm-cx .pm-cx-slider {
  display: grid;
  gap: 6px;
  margin: 0 !important;
  padding: 0 !important;
  background: none !important;
  border: 0 !important;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-slider__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-slider__head label {
  font-size: 12px;
  font-weight: 600;
  color: var(--cx-ink);
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-slider__head output strong {
  font-size: 12px;
  font-weight: 700;
  color: var(--cx-blue-ink);
  font-variant-numeric: tabular-nums;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-slider input[type="range"] {
  width: 100%;
  accent-color: var(--cx-blue);
  margin: 0;
}

/* botões */
#pmtab-categorias #mapLayersList .pm-cx .pm-cx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(37, 99, 235, 0.24);
  background: rgba(37, 99, 235, 0.06);
  color: var(--cx-blue-ink);
  font: 600 12px/1.2 Poppins, "Segoe UI", Arial, sans-serif;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-btn:hover {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.4);
}

/* ---------- ranking de bairros ---------- */
#pmtab-categorias #mapLayersList .pm-cx .pm-cx-ranking {
  display: grid;
  gap: 10px;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-rank-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-rank-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cx-muted);
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-rank {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: thin;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-rank__row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.92);
  text-align: left;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-rank__row:hover {
  background: #ffffff;
  border-color: rgba(37, 99, 235, 0.24);
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-rank__row.is-active {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.4);
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-rank__pos {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef2fb;
  color: #4a5b78;
  font-size: 10.5px;
  font-weight: 700;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-rank__body {
  display: grid;
  gap: 5px;
  min-width: 0;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-rank__name {
  font-size: 12px;
  font-weight: 600;
  color: var(--cx-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-rank__bar {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: #e8edf6;
  overflow: hidden;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-rank__bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-rank__val {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--cx-ink);
  font-variant-numeric: tabular-nums;
}

/* ---------- Sobre os dados ---------- */
#pmtab-categorias #mapLayersList .pm-cx .pm-cx-about {
  margin-top: 4px;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-about .pm-sec-nav-count {
  font-style: italic;
  font-family: Georgia, serif;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-about__text {
  display: grid;
  gap: 8px;
  padding: 2px 4px 6px;
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-about__text p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: #4a5b78;
}

/* ==========================================================================
   Legenda interativa (compartilhada: cartão da esquerda e aba no celular)
   ========================================================================== */
.pm-cx-legend__rows {
  display: grid;
  gap: 5px;
}

.pm-cx-legend__title {
  display: grid;
  gap: 2px;
  margin-bottom: 8px;
}

.pm-cx-legend__title strong {
  font-size: 12px;
  font-weight: 700;
  color: #111827;
}

.pm-cx-legend__title small {
  font-size: 11px;
  color: #6b7a96;
}

.pm-cx-legend__row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 6px 9px;
  border-radius: 9px;
  border: 1px solid color-mix(in srgb, var(--cx-color) 30%, transparent);
  background: var(--cx-soft);
  text-align: left;
  font-family: Poppins, "Segoe UI", Arial, sans-serif;
  cursor: pointer;
  transition: opacity 0.18s ease, transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.pm-cx-legend__row:hover {
  transform: translateX(2px);
  border-color: color-mix(in srgb, var(--cx-color) 60%, transparent);
}

.pm-cx-legend__row:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

.pm-cx-legend__row.is-hidden {
  opacity: 0.5;
  background: #f4f6fa;
  border-color: rgba(15, 23, 42, 0.08);
}

.pm-cx-legend__row.is-hidden .pm-cx-legend__label strong {
  text-decoration: line-through;
}

.pm-cx-legend__swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--cx-color);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.pm-cx-legend__swatch.is-nodata {
  background: repeating-linear-gradient(45deg, #cbd5e1 0 3px, #f1f5f9 3px 6px);
}

.pm-cx-legend__label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.pm-cx-legend__label strong {
  font-size: 11.5px;
  font-weight: 600;
  color: #111827;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pm-cx-legend__label small {
  flex: none;
  font-size: 10.5px;
  font-weight: 600;
  color: #6b7a96;
}

.pm-cx-legend__eye {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #6b7a96;
}

.pm-cx-legend__foot {
  margin: 8px 0 0;
  font-size: 10.5px;
  line-height: 1.4;
  color: #6b7a96;
}

/* ==========================================================================
   Cartão da esquerda do mapa (computador)
   ========================================================================== */
:is(#pmSocioSidePanel, #pmCensoSidePanel).pm-cx-side {
  top: 88px;
  bottom: 64px;
  left: 16px;
  width: min(340px, calc(100% - 32px));
  max-height: none;
  height: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0;
  font-family: Poppins, "Segoe UI", Arial, sans-serif;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  pointer-events: none;
  transform: translate3d(0, 0, 0);
  opacity: 1;
  transition:
    transform 0.46s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.34s ease;
  will-change: transform, opacity;
  z-index: 24;
}

:is(#pmSocioSidePanel, #pmCensoSidePanel).pm-cx-side::before,
:is(#pmSocioSidePanel, #pmCensoSidePanel).pm-cx-side::after {
  display: none !important;
}

:is(#pmSocioSidePanel, #pmCensoSidePanel).pm-cx-side.is-enter-from,
:is(#pmSocioSidePanel, #pmCensoSidePanel).pm-cx-side.is-closing {
  transform: translate3d(calc(-100% - 28px), 0, 0);
  opacity: 0;
}

:is(#pmSocioSidePanel, #pmCensoSidePanel).pm-cx-side.is-closing {
  pointer-events: none !important;
}

:is(#pmSocioSidePanel, #pmCensoSidePanel).pm-cx-side.is-open {
  transform: translate3d(0, 0, 0);
  opacity: 1;
}

/* superfície de vidro dos dois blocos */
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__detail-inner,
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__stack {
  background: rgba(248, 250, 252, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 18px 40px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(26px) saturate(1.12);
  -webkit-backdrop-filter: blur(26px) saturate(1.12);
  border-radius: 20px;
}

/* ficha do bairro: abre/fecha com animação de altura */
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__detail {
  display: grid;
  grid-template-rows: 0fr;
  min-height: 0;
  opacity: 0;
  transform: translate3d(-14px, 10px, 0) scale(0.98);
  transition:
    grid-template-rows 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease,
    transform 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    margin 0.42s ease;
  margin-bottom: 0;
  pointer-events: none;
  flex: 0 1 auto;
}

:is(#pmSocioSidePanel, #pmCensoSidePanel).has-detail .pm-cx-side__detail {
  grid-template-rows: 1fr;
  opacity: 1;
  transform: none;
  margin-bottom: 10px;
  pointer-events: auto;
}

:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__detail-inner {
  position: relative;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

:is(#pmSocioSidePanel, #pmCensoSidePanel).has-detail .pm-cx-side__detail-inner {
  max-height: 100%;
}

:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__body {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  min-height: 0;
}

:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__body.is-swapping {
  animation: pmCxSwap 0.32s ease;
}

@keyframes pmCxSwap {
  from { opacity: 0.2; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: rgba(255, 255, 255, 0.95);
  color: #64748b;
  cursor: pointer;
  transition: color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__close:hover {
  color: #1d4ed8;
  background: #ffffff;
  transform: rotate(90deg);
}

/* bloco inferior: dica + legenda */
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__stack {
  flex: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
  transition: box-shadow 0.24s ease, transform 0.24s ease;
}

:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__stack:hover,
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__detail-inner:hover {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 22px 48px rgba(15, 23, 42, 0.18);
}

:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  overflow: hidden;
  max-height: 80px;
  transition: max-height 0.36s ease, padding 0.36s ease, opacity 0.24s ease;
}

:is(#pmSocioSidePanel, #pmCensoSidePanel).has-detail .pm-cx-side__hint {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  border-bottom-color: transparent;
}

:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__hint-ic {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  animation: pmCxPulse 2.4s ease-in-out infinite;
}

@keyframes pmCxPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.22); }
  50% { box-shadow: 0 0 0 7px rgba(37, 99, 235, 0); }
}

:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__hint > span:last-child {
  display: grid;
  gap: 1px;
  font-size: 11.5px;
  line-height: 1.35;
  color: #6b7a96;
}

:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__hint strong {
  font-size: 12.5px;
  color: #111827;
}

:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__legend-head {
  padding: 8px 8px 8px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06) !important;
}

:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__legend-head .pm-weather-native-panel-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-legend-native-panel-chevron svg {
  transition: transform 0.24s ease;
}

:is(#pmSocioSidePanel, #pmCensoSidePanel).is-legend-collapsed .pm-legend-native-panel-chevron svg {
  transform: rotate(-90deg);
}

:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__legend {
  display: grid;
  grid-template-rows: 1fr;
  padding: 10px 12px 12px;
  max-height: 340px;
  overflow-y: auto;
  scrollbar-width: thin;
  transition: max-height 0.32s ease, padding 0.32s ease, opacity 0.22s ease;
}

:is(#pmSocioSidePanel, #pmCensoSidePanel).is-legend-collapsed .pm-cx-side__legend {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
}

:is(#pmSocioSidePanel, #pmCensoSidePanel).is-legend-collapsed .pm-cx-side__legend-head {
  border-bottom-color: transparent !important;
}

/* a ficha herdada do popup ocupa a largura do cartão */
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-socio-popup {
  padding: 16px 14px 14px;
}

@media (prefers-reduced-motion: reduce) {
  :is(#pmSocioSidePanel, #pmCensoSidePanel).pm-cx-side,
  :is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__detail,
  :is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__hint,
  :is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__legend,
  #pmtab-categorias #mapLayersList .pm-cx .pm-cx-tabpanel,
  #pmtab-categorias #mapLayersList .pm-cx .pm-cx-group__body,
  #pmtab-categorias #mapLayersList .pm-cx .pm-cx-group__chev {
    transition: none !important;
    animation: none !important;
  }
}

@media (max-width: 767px) {
  :is(#pmSocioSidePanel, #pmCensoSidePanel) {
    display: none !important;
  }
}

#pmtab-categorias #mapLayersList .pm-cx .pm-cx-btn svg,
#pmtab-categorias #mapLayersList .pm-cx .pm-cx-tab svg {
  color: inherit !important;
  stroke: currentColor !important;
  flex: none;
}

/* ---------- ficha compacta no cartão da esquerda (sem rolagem) ---------- */
:is(#pmSocioSidePanel, #pmCensoSidePanel).pm-cx-side {
  width: min(372px, calc(100% - 32px));
}
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__body {
  overflow: hidden;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-socio-popup {
  padding: 11px 11px 10px;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-socio-popup-head {
  margin-bottom: 7px;
  gap: 1px;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-socio-popup-title {
  font-size: 15px;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-socio-popup-sub {
  font-size: 10.5px;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-socio-popup-hero {
  padding: 8px 10px;
  gap: 10px;
  border-radius: 12px;
  margin-bottom: 6px;
  align-items: center;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-socio-popup-hero__icon {
  width: 30px;
  height: 30px;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-socio-popup-hero__icon svg {
  width: 14px;
  height: 14px;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-socio-popup-hero__main {
  gap: 1px;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-socio-popup-hero__value {
  font-size: 19px;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-socio-popup-hero__desc {
  font-size: 10.5px;
  line-height: 1.3;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-socio-popup-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-socio-popup-stat {
  padding: 6px 8px 7px;
  border-radius: 10px;
  display: block;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-socio-popup-stat__icon {
  display: none;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-socio-popup-stat__copy {
  gap: 2px;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-socio-popup-stat__label {
  font-size: 9.5px;
  line-height: 1.2;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-socio-popup-stat__value {
  gap: 3px;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-socio-popup-stat__value strong {
  font-size: 12.5px;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-socio-popup-stat__value em {
  font-size: 9px;
  padding: 1px 5px;
}
/* a fonte já está em "Sobre os dados" */
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-socio-popup-foot {
  display: none;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel) .pm-cx-side__close {
  top: 9px;
  right: 9px;
  width: 26px;
  height: 26px;
}
/* legenda mais enxuta enquanto a ficha está aberta */
:is(#pmSocioSidePanel, #pmCensoSidePanel).has-detail .pm-cx-side__legend {
  padding: 8px 10px 10px;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel).has-detail .pm-cx-legend__rows {
  gap: 3px;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel).has-detail .pm-cx-legend__row {
  padding: 4px 9px;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel).has-detail .pm-cx-legend__foot {
  display: none;
}
:is(#pmSocioSidePanel, #pmCensoSidePanel).has-detail .pm-cx-side__legend-head {
  padding-top: 5px;
  padding-bottom: 5px;
}

/* ---------- grupos de indicadores retráteis ---------- */
#pmtab-categorias #mapLayersList .pm-cx .pm-cx-group__head {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 4px 2px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: background 0.16s ease;
}
#pmtab-categorias #mapLayersList .pm-cx .pm-cx-group__head:hover {
  background: rgba(37, 99, 235, 0.05);
}
#pmtab-categorias #mapLayersList .pm-cx .pm-cx-group__head:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}
#pmtab-categorias #mapLayersList .pm-cx .pm-cx-group__meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #6b7a96 !important;
}
#pmtab-categorias #mapLayersList .pm-cx .pm-cx-group__chev {
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8 !important;
}
#pmtab-categorias #mapLayersList .pm-cx .pm-cx-group__chev {
  display: inline-flex;
  transition: transform 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}
#pmtab-categorias #mapLayersList .pm-cx .pm-cx-group__chev svg {
  stroke: currentColor !important;
  color: inherit !important;
}
#pmtab-categorias #mapLayersList .pm-cx .pm-cx-group.is-collapsed .pm-cx-group__chev {
  transform: rotate(-90deg);
}
/* Altura animada via JS (px→0 / 0→px). Estado estático usa height auto/0. */
#pmtab-categorias #mapLayersList .pm-cx .pm-cx-group__body {
  display: block;
  overflow: hidden;
  opacity: 1;
  height: auto;
}
#pmtab-categorias #mapLayersList .pm-cx .pm-cx-group__body.is-animating {
  transition:
    height 0.22s cubic-bezier(0.32, 0.72, 0, 1),
    opacity 0.16s ease;
  will-change: height, opacity;
}
#pmtab-categorias #mapLayersList .pm-cx .pm-cx-group.is-collapsed .pm-cx-group__body {
  height: 0;
  opacity: 0;
  pointer-events: none;
}
/* Busca: abre todos de uma vez sem animar (evita 12 accordions juntos) */
#pmtab-categorias #mapLayersList .pm-cx.is-searching .pm-cx-group .pm-cx-group__body {
  height: auto !important;
  opacity: 1 !important;
  pointer-events: auto;
  transition: none !important;
  will-change: auto;
}
#pmtab-categorias #mapLayersList .pm-cx.is-searching .pm-cx-group .pm-cx-group__chev {
  transform: none;
  transition: none !important;
}

#pmtab-categorias #mapLayersList .pm-cx :is(.pm-cx-group__chev, .pm-cx-tab, .pm-cx-btn, .pm-cx-search) svg,
#pmtab-categorias #mapLayersList .pm-cx :is(.pm-cx-group__chev, .pm-cx-tab, .pm-cx-btn, .pm-cx-search) svg :is(path, circle) {
  color: inherit !important;
  stroke: currentColor !important;
}

/* ==========================================================================
   Pessoas · Censo 2022 por bairro (.pm-cs — reaproveita o padrão .pm-cx)
   ========================================================================== */
#pmtab-categorias #mapLayersList .pm-cs .pm-cs-view {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
  background: var(--cx-blue-soft);
  border: 1px solid var(--cx-line);
}
#pmtab-categorias #mapLayersList .pm-cs .pm-cs-view .pm-cx-seg__btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
#pmtab-categorias #mapLayersList .pm-cs .pm-dom-sidebar-option-label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
#pmtab-categorias #mapLayersList .pm-cs .pm-cs-tags {
  display: inline-flex;
  gap: 3px;
  flex: 0 0 auto;
  margin-left: auto;
}
#pmtab-categorias #mapLayersList .pm-cs .pm-cs-tag {
  font-size: 9px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 5px;
  border-radius: 999px;
  color: #6b7a96;
  background: rgba(107, 122, 150, 0.12);
}
#pmtab-categorias #mapLayersList .pm-cs .pm-cs-tag.is-sex {
  color: #9d174d;
  background: rgba(219, 39, 119, 0.1);
}
#pmtab-categorias #mapLayersList .pm-cs .pm-cs-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--cx-muted);
}
#pmtab-categorias #mapLayersList .pm-cs .pm-cs-status:empty { display: none; }
#pmtab-categorias #mapLayersList .pm-cs .pm-cs-loading {
  padding: 12px;
  border-radius: 12px;
  background: var(--cx-blue-soft);
}
.pm-cs-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(37, 99, 235, 0.2);
  border-top-color: #2563eb;
  animation: pmCsSpin 0.8s linear infinite;
  flex: 0 0 auto;
}
@keyframes pmCsSpin { to { transform: rotate(360deg); } }
#pmtab-categorias #mapLayersList .pm-cs.is-loading .pm-cx-kpis,
#pmtab-categorias #mapLayersList .pm-cs.is-loading .pm-cx-tabs,
#pmtab-categorias #mapLayersList .pm-cs.is-loading .pm-cx-groups,
#pmtab-categorias #mapLayersList .pm-cs.is-loading .pm-cs-view {
  opacity: 0.45;
  pointer-events: none;
}

/* Ficha do bairro (cartão da esquerda e folha do celular) */
.pm-cs-ficha .pm-cs-quality {
  margin: 6px 0 0;
  font-size: 10.5px;
  line-height: 1.35;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid rgba(217, 119, 6, 0.18);
  border-radius: 8px;
  padding: 5px 8px;
}
.pm-cs-ficha .pm-cs-note { font-size: 12px; color: #64748b; }
.pm-cs-ficha .pm-cs-charts {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}
.pm-cs-ficha .pm-cs-sec-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 5px;
}
.pm-cs-pyr__legend {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  font-weight: 600;
  margin-bottom: 3px;
}
.pm-cs-pyr__legend .is-m { color: #2563eb; }
.pm-cs-pyr__legend .is-f { color: #db2777; }
.pm-cs-pyr__row {
  display: grid;
  grid-template-columns: 1fr 34px 1fr;
  align-items: center;
  gap: 4px;
  height: 10px;
  margin-bottom: 2px;
}
.pm-cs-pyr__bar { display: flex; height: 8px; }
.pm-cs-pyr__bar.is-m { justify-content: flex-end; }
.pm-cs-pyr__bar i { display: block; height: 100%; border-radius: 3px; min-width: 1px; }
.pm-cs-pyr__bar.is-m i { background: linear-gradient(270deg, #60a5fa, #2563eb); }
.pm-cs-pyr__bar.is-f i { background: linear-gradient(90deg, #f472b6, #db2777); }
.pm-cs-pyr__age {
  font-size: 9px;
  text-align: center;
  color: #64748b;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pm-cs-race__bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  gap: 1px;
  background: #e2e8f0;
}
.pm-cs-race__bar i { display: block; min-width: 2px; }
.pm-cs-race__keys {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 5px;
  font-size: 10.5px;
  color: #475569;
}
.pm-cs-race__keys span { display: inline-flex; align-items: center; gap: 4px; }
.pm-cs-race__keys b { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.pm-cs-race__keys strong { color: #0f172a; font-weight: 600; }
.pm-cs-ficha .pm-cs-foot { font-size: 10px; }

/* Folha inferior no celular */
.pm-cs-sheet {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(15, 23, 42, 0);
  transition: background 0.22s ease;
  font-family: Poppins, "Segoe UI", Arial, sans-serif;
}
.pm-cs-sheet.is-open { background: rgba(15, 23, 42, 0.28); }
.pm-cs-sheet__card {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 78vh;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.22);
  transform: translateY(100%);
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}
.pm-cs-sheet.is-open .pm-cs-sheet__card { transform: translateY(0); }
.pm-cs-sheet__body { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pm-cs-sheet__close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: #f1f5f9;
  color: #334155;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}
#pmtab-categorias #mapLayersList .pm-cs .pm-dom-sidebar-option.is-active .pm-cs-tag {
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
}

/* Pessoas · dica da pirâmide e da cor/raça */
.pm-cs-tip {
  position: fixed;
  z-index: 10050;
  pointer-events: none;
  display: grid;
  gap: 2px;
  max-width: 240px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.94);
  color: #e2e8f0;
  font: 500 11.5px/1.35 Poppins, "Segoe UI", Arial, sans-serif;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28);
}
.pm-cs-tip[hidden] { display: none; }
.pm-cs-tip strong { color: #fff; font-weight: 600; font-size: 12px; }
.pm-cs-ficha [data-cs-tip] { cursor: default; outline: none; }
.pm-cs-pyr__row { border-radius: 4px; transition: background 0.12s ease; }
.pm-cs-pyr__row:hover { background: rgba(37, 99, 235, 0.06); }
.pm-cs-pyr__bar.is-tip-active i { filter: brightness(1.12) saturate(1.15); box-shadow: 0 0 0 1.5px rgba(15, 23, 42, 0.35); }
.pm-cs-pyr__age.is-tip-active { color: #0f172a; font-weight: 700; }
.pm-cs-pyr__row { height: 12px; }
.pm-cs-pyr__bar { height: 10px; }
.pm-cs-race__bar i.is-tip-active { filter: brightness(1.1); box-shadow: inset 0 0 0 1.5px rgba(15, 23, 42, 0.45); }

/* Pessoas · ficha mais legível no cartão (rola quando não cabe) */
#pmCensoSidePanel .pm-socio-popup { padding: 13px 13px 12px; }
#pmCensoSidePanel .pm-socio-popup-title { font-size: 16.5px; }
#pmCensoSidePanel .pm-socio-popup-sub { font-size: 11px; }
#pmCensoSidePanel .pm-socio-popup-hero__value { font-size: 22px; }
#pmCensoSidePanel .pm-socio-popup-hero__desc { font-size: 11.5px; }
#pmCensoSidePanel .pm-socio-popup-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
#pmCensoSidePanel .pm-socio-popup-stat { padding: 8px 10px 9px; }
#pmCensoSidePanel .pm-socio-popup-stat__label { font-size: 10.5px; }
#pmCensoSidePanel .pm-socio-popup-stat__value strong { font-size: 14.5px; }
#pmCensoSidePanel .pm-socio-popup-stat__value em { font-size: 10px; }
#pmCensoSidePanel .pm-cs-quality { font-size: 11px; }
#pmCensoSidePanel .pm-cs-sec-title { font-size: 11px; }
#pmCensoSidePanel .pm-cs-pyr__legend { font-size: 11.5px; }
#pmCensoSidePanel .pm-cs-pyr__row { height: 14px; grid-template-columns: 1fr 40px 1fr; }
#pmCensoSidePanel .pm-cs-pyr__bar { height: 11px; }
#pmCensoSidePanel .pm-cs-pyr__age { font-size: 10px; }
#pmCensoSidePanel .pm-cs-race__bar { height: 14px; }
#pmCensoSidePanel .pm-cs-race__keys { font-size: 11.5px; }
#pmCensoSidePanel .pm-cx-side__body { padding-right: 2px; }
