.mapa-camadas-compacta {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  flex-wrap: nowrap !important;
  gap: 4px !important;
  min-height: 38px !important;
  margin-bottom: 8px;
  padding: 4px;
  overflow: visible;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
}

.mapa-camadas-viewport {
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  scroll-behavior: smooth;
}

.mapa-camadas-viewport::-webkit-scrollbar { display: none; }

.mapa-camadas-track {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 7px;
  width: max-content;
  min-width: 100%;
}

.mapa-camadas-nav {
  display: inline-flex;
  flex: 0 0 28px;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #94a3b8;
  border-radius: 50%;
  background: #fff;
  color: #334155;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.mapa-camadas-nav.is-visible { visibility: visible; opacity: 1; pointer-events: auto; }
.mapa-camadas-nav:last-child { margin-right: 2px; }
.mapa-camadas-nav:hover { border-color: #2563eb; color: #1d4ed8; background: #eff6ff; }

.mapa-camadas-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  min-height: 28px;
  max-width: 285px;
  padding: 3px 7px 3px 8px;
  border: 1px solid var(--mapa-camada-borda, #cbd5e1);
  border-radius: 15px;
  background: var(--mapa-camada-fundo, #fff);
  color: #172033;
  cursor: pointer;
  white-space: nowrap;
}

.mapa-camadas-chip:hover,
.mapa-camadas-chip.is-open {
  border-color: var(--mapa-camada-cor, #2563eb);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .10);
}

.mapa-camadas-chip.is-hidden { opacity: .55; filter: grayscale(.35); }
.mapa-camadas-chip-cor { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 2px; background: var(--mapa-camada-cor, #64748b); }
.mapa-camadas-chip-nome { max-width: 150px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; font-weight: 700; }

.mapa-camadas-acao,
.mapa-camadas-m,
.mapa-camadas-seta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  padding: 0 5px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: rgba(255,255,255,.76);
  color: #475569;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  box-sizing: border-box;
}

.mapa-camadas-acao { min-width: 24px; padding: 0 4px; }
.mapa-camadas-m { min-width: 22px; font-size: 10px; font-weight: 900; }
.mapa-camadas-seta { min-width: 20px; border-color: transparent; background: transparent; font-size: 14px; }
.mapa-camadas-acao:hover, .mapa-camadas-m:hover, .mapa-camadas-seta:hover { border-color: #1f57d8; color: #1f57d8; background: #fff; }
.mapa-camadas-m.is-active { border-color: #1f57d8; background: #e8efff; color: #1f57d8; }
.mapa-camadas-chip.is-hidden .mapa-camadas-acao { opacity: .7 !important; }

.mapa-camadas-panel {
  position: fixed;
  z-index: 1300;
  display: none;
  width: min(350px, calc(100vw - 24px));
  max-height: min(500px, calc(100vh - 24px));
  overflow: hidden;
  border: 1px solid #94a3b8;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .24);
}

.mapa-camadas-panel.is-open { display: flex; flex-direction: column; }
.mapa-camadas-panel.is-minimized .mapa-camadas-panel-body { display: none; }
.mapa-camadas-panel.is-minimized { width: min(300px, calc(100vw - 24px)); }

.mapa-camadas-panel-head {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 8px 9px 8px 12px;
  border-bottom: 1px solid #dbe3ea;
  background: var(--mapa-camada-fundo, #f8fafc);
  cursor: move;
  user-select: none;
  touch-action: none;
}

.mapa-camadas-panel-ident { min-width: 0; flex: 1 1 auto; }
.mapa-camadas-panel-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #172033; font-size: 14px; font-weight: 800; }
.mapa-camadas-panel-subtitle { margin-top: 2px; color: #64748b; font-size: 11px; }
.mapa-camadas-panel-actions { display: flex; align-items: center; gap: 4px; }
.mapa-camadas-panel-icon { display: inline-flex; align-items: center; justify-content: center; width: 27px; height: 27px; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.7); color: #334155; font-size: 16px; font-weight: 800; cursor: pointer; }
.mapa-camadas-panel-icon:hover { background: #fff; color: #0f172a; }
.mapa-camadas-panel-body { min-height: 0; padding: 8px 13px 12px; overflow-y: auto; overscroll-behavior: contain; }
.mapa-camadas-panel-label { padding: 3px 0 6px; color: #64748b; font-size: 10px; font-weight: 800; letter-spacing: .04em; }
.mapa-camadas-sub { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 34px; padding: 4px 0; border-top: 1px solid #edf1f5; }
.mapa-camadas-sub-main { display: flex; align-items: center; gap: 7px; min-width: 0; }
.mapa-camadas-sub-cor { flex: 0 0 9px; width: 9px; height: 9px; border-radius: 2px; }
.mapa-camadas-sub-nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #172033; font-size: 12px; }
.mapa-camadas-empty { padding: 14px 4px; color: #64748b; font-size: 12px; text-align: center; }

@media (max-width: 700px) {
  .mapa-camadas-chip { max-width: 250px; }
  .mapa-camadas-panel,
  .mapa-camadas-panel.is-minimized { top: auto !important; right: 8px !important; bottom: 8px !important; left: 8px !important; width: auto; max-height: min(62vh, 500px); }
  .mapa-camadas-panel-head { cursor: default; touch-action: auto; }
}
