.barra-mapa {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 282px;
  column-gap: 14px;
  row-gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}
.titulo-vista { grid-column: 1; }
.titulo-vista h1 { margin: 0; font-size: 21px; line-height: 1.1; }
.titulo-vista p { margin: 5px 0 0; color: var(--secundario); font-size: 11px; }

.filtros {
  grid-column: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-width: 0;
}
.filtro-select { width: 128px; height: 52px; border: 1px solid var(--borde); border-radius: 8px; background: #fff; padding: 7px 10px; display: flex; flex-direction: column; justify-content: center; }
.filtro-select span { color: #60708f; font-size: 9px; line-height: 1; }
.filtro-select select { width: 100%; border: 0; outline: 0; background: transparent; padding: 5px 0 0; font-size: 11px; font-weight: 600; color: #172854; }
.filtro-asociacion-unico { width: 210px; }
.filtro-estatus { width: 170px; }
.boton-aplicar { height: 52px; padding: 0 22px; }
.boton-secundario, .boton-principal { height: 46px; border-radius: 8px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 650; font-size: 11px; white-space: nowrap; }
.boton-secundario { border: 1px solid var(--borde); background: #fff; color: #182956; }
.boton-principal { border: 1px solid var(--azul); background: var(--azul); color: #fff; }
.boton-principal svg, .boton-secundario svg { width: 16px; height: 16px; }

.cuerpo-mapa { display: grid; grid-template-columns: minmax(0, 1fr) 282px; gap: 14px; align-items: stretch; min-width: 0; }
.mapa-columna { min-width: 0; }
.mapa-contenedor { position: relative; min-width: 0; height: calc(100vh - 205px); min-height: 560px; overflow: hidden; border: 1px solid var(--borde); border-radius: 12px; background: #dfeaf4; box-shadow: var(--sombra); }
#mapa { width: 100%; height: 100%; min-height: 510px; background: #e9f0f5; }
.leaflet-container { font-family: inherit; }
.leaflet-control-zoom { border: 0 !important; box-shadow: 0 6px 20px rgba(15, 36, 74, .12) !important; }
.leaflet-control-zoom a { color: #122555 !important; border: 0 !important; }
.leaflet-control-attribution { font-size: 8px; opacity: .65; }

.mapa-herramientas {
  position: absolute;
  z-index: 700;
  right: 12px;
  bottom: 28px;
  display: grid;
  gap: 7px;
}
.mapa-herramientas button { width: 34px; height: 34px; border: 0; background: #fff; border-radius: 5px; box-shadow: 0 4px 14px rgba(16, 38, 80, .13); color: #0b2d70; font-weight: 800; }
.mapa-vista { position: absolute; z-index: 500; left: 58px; bottom: 13px; height: 34px; border-radius: 6px; background: rgba(255,255,255,.96); box-shadow: 0 4px 14px rgba(16, 38, 80, .11); display: flex; align-items: center; gap: 8px; padding: 0 10px; font-size: 10px; }
.mapa-vista span { color: #0b43ff; font-weight: 650; padding: 4px 7px; background: #eff3ff; border-radius: 5px; }
.mapa-vista small { color: #6f7b92; }

.mapa-leyenda { position: absolute; z-index: 700; left: 12px; top: 12px; max-width: 420px; border-radius: 7px; background: rgba(255,255,255,.96); box-shadow: 0 4px 14px rgba(16, 38, 80, .11); padding: 8px 10px; color: #23365f; font-size: 9px; }
.mapa-leyenda-fila { display: flex; align-items: center; gap: 9px; }
.mapa-leyenda-estatus { gap: 12px; flex-wrap: wrap; }
.mapa-leyenda-estatus > span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.mapa-leyenda .leyenda-cluster { width: 14px; height: 14px; box-shadow: 0 0 0 3px #eef3ff; flex: 0 0 auto; }
.mapa-leyenda .punto { display: inline-block; flex: 0 0 auto; }

.pin-electoral { width: 14px; height: 14px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 2px 7px rgba(10, 30, 70, .28); }
.pin-favor { background: var(--verde); }
.pin-otro { background: var(--rojo); }
.pin-pendiente { background: var(--gris); }
.pin-seguimiento { box-shadow: 0 0 0 4px rgba(242,122,10,.18), 0 2px 7px rgba(10, 30, 70, .28); }
.pin-seleccionado { background: #1557ff !important; box-shadow: 0 0 0 5px rgba(21,87,255,.18), 0 2px 8px rgba(10,30,70,.34) !important; transform: scale(1.2); }

.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: rgba(25, 77, 255, .16) !important; }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div {
  width: 38px !important; height: 38px !important; margin: 5px !important; border-radius: 50% !important;
  display: grid !important; place-items: center; background: #fff !important; color: #0b43ff !important;
  font-weight: 800 !important; box-shadow: 0 5px 16px rgba(28, 68, 173, .18); border: 2px solid #cfdcff;
}
.marker-cluster { width: 48px !important; height: 48px !important; }
.marker-cluster span { line-height: 1 !important; }

.panel-derecho { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.panel-card { position: relative; background: #fff; border: 1px solid var(--borde); border-radius: 10px; padding: 14px; box-shadow: 0 3px 12px rgba(20, 42, 84, .025); }
.panel-titulo { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; }
.panel-titulo span { color: #667797; }
.ranking-select { margin-top: 10px; height: 30px; border: 1px solid var(--borde); border-radius: 6px; background: #fff; padding: 0 8px; font-size: 9px; color: #283b67; opacity: 1; }
.ranking { margin-top: 10px; min-height: 180px; }
.ranking-vacio { min-height: 165px; display: grid; place-content: center; text-align: center; color: #7a879e; font-size: 10px; }
.ranking-item { margin-bottom: 13px; }
.ranking-fila { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.ranking-fila strong { font-size: 10px; font-weight: 650; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking-fila span { font-size: 10px; font-weight: 700; }
.ranking-barra { height: 6px; border-radius: 999px; background: #edf0f4; overflow: hidden; }
.ranking-barra span { display: block; height: 100%; background: var(--verde); border-radius: inherit; }
.ranking-conteo { display: block; margin-top: 3px; text-align: right; color: #71809a; font-size: 8px; }
.reporte-detallado { width: 100%; height: 38px; border: 1px solid var(--borde); background: #fff; color: #0b43ff; border-radius: 7px; font-size: 9px; font-weight: 650; opacity: 1; }

.leyenda-cluster { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #0b43ff; box-shadow: 0 0 0 4px #eef3ff; }
.punto { width: 10px; height: 10px; border-radius: 50%; }
.punto-favor { background: var(--verde); }
.punto-otro { background: var(--rojo); }
.punto-pendiente { background: var(--gris); }
.punto-seguimiento { background: var(--naranja); }

.detalle-empresa-card { max-height: calc(100vh - 210px); overflow: auto; }
.cerrar-detalle { position: absolute; right: 9px; top: 8px; width: 28px; height: 28px; border: 0; background: transparent; color: #63708b; font-size: 22px; }
.detalle-empresa-card h2 { margin: 8px 24px 10px 0; font-size: 16px; line-height: 1.25; }
.etiqueta { text-transform: uppercase; letter-spacing: .08em; font-size: 8px; font-weight: 700; color: #7b879d; }
.chip { display: inline-block; padding: 5px 7px; border-radius: 999px; background: #eff3ff; color: #0b43ff; font-size: 9px; font-weight: 650; }
.ficha { margin: 12px 0 0; }
.ficha > div { padding: 10px 0; border-bottom: 1px solid var(--borde); }
.ficha dt { color: #71809a; font-size: 8px; margin-bottom: 3px; }
.ficha dd { margin: 0; font-size: 10px; line-height: 1.4; overflow-wrap: anywhere; }
.boton-ancho { width: 100%; margin-top: 12px; }
.oculto { display: none !important; }

.popup-empresa strong { display: block; max-width: 230px; margin-bottom: 3px; font-size: 11px; line-height: 1.3; }
.popup-empresa span { display: block; color: #6e7b91; font-size: 9px; }

@media (max-width: 1380px) {
  .app-shell { grid-template-columns: 214px minmax(0, 1fr); }
  .encabezado { grid-template-columns: minmax(310px, 1fr) minmax(370px, 1fr) 170px; padding-left: 22px; gap: 14px; }
  .avance { grid-template-columns: 170px 1fr; gap: 14px; }
  .usuario-datos { display: none; }
  .usuario { min-width: 56px; grid-template-columns: 38px auto; }
  .filtro-select { width: 112px; }
  .cuerpo-mapa { grid-template-columns: minmax(0, 1fr) 260px; }
}

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 78px minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar { padding-left: 10px; padding-right: 10px; }
  .marca { justify-content: center; padding: 0; }
  .marca-logo { width: 58px; height: auto; }
  .menu-opcion span, .configuracion span { display: none; }
  .menu-opcion, .configuracion { justify-content: center; padding: 0; }
  .encabezado { grid-template-columns: 1fr auto; row-gap: 8px; }
  .avance { grid-column: 1; }
  .metricas { grid-column: 1 / 3; grid-row: 2; }
  .usuario-area { grid-column: 2; grid-row: 1; }
  .contenido { padding: 16px; }
  .barra-mapa { grid-template-columns: 1fr; }
  .filtros { justify-content: flex-start; flex-wrap: wrap; }
  .cuerpo-mapa { grid-template-columns: 1fr; }
  .panel-derecho { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { min-height: auto; height: 58px; position: sticky; top: 0; z-index: 1200; flex-direction: row; align-items: center; border-right: 0; border-bottom: 1px solid var(--borde); }
  .marca { width: 52px; height: 48px; }
  .marca-logo { width: 48px; height: auto; }
  .menu-principal { margin: 0 0 0 8px; display: flex; }
  .menu-opcion { width: 46px; height: 42px; }
  .configuracion { display: none; }
  .encabezado { display: block; padding: 12px 14px; }
  .avance { display: block; }
  .avance-barra-bloque { margin-top: 8px; }
  .metricas { margin-top: 10px; grid-template-columns: 1fr 1fr 1fr; }
  .metrica { padding: 8px; height: 58px; }
  .metrica-icono { display: none; }
  .usuario-area { position: absolute; right: 10px; top: 68px; }
  .notificacion { display: none; }
  .usuario { min-width: 38px; display: block; }
  .usuario-chevron { display: none; }
  .contenido { padding: 14px 10px; }
  .filtros { display: grid; grid-template-columns: 1fr 1fr; }
  .filtro-select { width: 100%; }
  .boton-principal, .boton-secundario { width: 100%; }
  .mapa-contenedor { height: 60vh; min-height: 420px; }
  #mapa { min-height: 420px; }
  .mapa-vista small { display: none; }
  .panel-derecho { display: block; }
  .panel-card + .panel-card { margin-top: 10px; }
}

/* PATCH 010 — navegación nacional por asociación */
.boton-volver-nacional {
  position: absolute;
  z-index: 600;
  left: 14px;
  top: 56px;
  height: 34px;
  border: 1px solid #d9e1ef;
  border-radius: 7px;
  background: rgba(255,255,255,.97);
  color: #123a85;
  padding: 0 12px;
  font-size: 10px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(16,38,80,.12);
  cursor: pointer;
}
.boton-volver-nacional:hover { background: #f5f8ff; }

.burbuja-asociacion-contenedor {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  transform: translateY(-2px);
}
.burbuja-asociacion {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255,255,255,.97);
  border: 3px solid #194dff;
  box-shadow: 0 0 0 7px rgba(25,77,255,.13), 0 8px 22px rgba(20,54,142,.22);
  color: #1744d7;
  transition: transform .14s ease, box-shadow .14s ease;
}
.burbuja-asociacion strong {
  font-size: 15px;
  line-height: 1;
  font-weight: 800;
}
.burbuja-asociacion-contenedor:hover .burbuja-asociacion {
  transform: scale(1.06);
  box-shadow: 0 0 0 8px rgba(25,77,255,.16), 0 10px 24px rgba(20,54,142,.26);
}
.burbuja-asociacion-nombre {
  margin-top: 9px;
  max-width: 125px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,.95);
  box-shadow: 0 2px 8px rgba(17,38,80,.12);
  color: #263b67;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* PATCH 014 — filtros y controles del mapa */
.mapa-herramientas button:hover { background: #f5f8ff; }

@media (max-width: 900px) {
  .barra-mapa { grid-template-columns: 1fr; }
  .titulo-vista, .filtros { grid-column: 1; }
  .filtros { flex-wrap: wrap; }
  .filtro-asociacion-unico, .filtro-estatus { width: min(100%, 210px); }
}

/* PATCH 015 — primera vista compacta, sin panel de avance */
@media (min-width: 761px) {
  html, body { height: 100%; overflow: hidden; }

  .app-shell {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .sidebar {
    height: 100vh;
    min-height: 0;
  }

  .contenido {
    height: calc(100vh - 102px);
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .barra-mapa {
    grid-template-columns: 1fr;
    flex: 0 0 auto;
  }

  .cuerpo-mapa {
    flex: 1 1 auto;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
  }

  .mapa-columna,
  .mapa-contenedor,
  #mapa {
    height: 100%;
    min-height: 0;
  }

  .mapa-contenedor {
    min-height: 0;
  }

  .panel-derecho { display: none; }
  .cuerpo-mapa:has(.detalle-empresa-card:not(.oculto)) {
    grid-template-columns: minmax(0, 1fr) 282px;
  }
  .cuerpo-mapa:has(.detalle-empresa-card:not(.oculto)) .panel-derecho {
    display: block;
  }
}

.mapa-vista { gap: 0; }


