.ces-locations {
  --ces-blue: #0a5b9d;
  --ces-blue-dark: #043f71;
  --ces-primary: #00843d;
  --ces-green: #00843d;
  --ces-button: var(--ces-primary);
  --ces-button-hover: var(--ces-blue-dark);
  --ces-text: #123d32;
  --ces-muted: #687570;
  --ces-line: #dfe8e4;
  --ces-panel: #f8fafc;
  color: var(--ces-text);
  font-family: inherit;
  display: flow-root;
  max-width: 1500px;
  margin: 0 auto !important;
  padding-bottom: 0 !important;
  position: relative;
}

.ces-locations + p:empty,
.ces-locations + br {
  display: none !important;
}

.ces-locations *,
.ces-locations *::before,
.ces-locations *::after {
  box-sizing: border-box;
}

.ces-hero {
  align-items: center;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin: 0 0 28px;
}

.ces-hero > div {
  flex: 1 1 auto;
}

.ces-hero-icon,
.ces-card-icon {
  align-items: center;
  background: rgba(var(--ces-primary-rgb), 0.12);
  border-radius: 50%;
  display: inline-flex;
  flex: 0 0 auto;
  justify-content: center;
  position: relative;
}

.ces-hero-icon {
  height: 64px;
  width: 64px;
}

.ces-hero-icon::before,
.ces-card-icon::before {
  border: 3px solid var(--ces-primary);
  border-radius: 50% 50% 50% 0;
  content: "";
  display: block;
  transform: rotate(-45deg);
}

.ces-hero-icon::before {
  height: 24px;
  width: 24px;
}

.ces-hero-icon::after,
.ces-card-icon::after {
  background: var(--ces-primary);
  border-radius: 50%;
  content: "";
  position: absolute;
}

.ces-hero-icon::after {
  height: 7px;
  width: 7px;
}

.ces-hero h2 {
  color: #090d2f;
  font-family: 'Poppins', sans-serif;
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 800;
  line-height: 1.12;
  margin: 0;
}

.ces-filter-bar {
  align-items: end;
  background: #fff;
  border: 1px solid rgba(33, 44, 56, 0.1);
  border-radius: 14px;
  box-shadow: 0 16px 44px rgba(22, 31, 46, 0.1);
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  margin: 0 0 24px;
  padding: 26px clamp(18px, 4vw, 42px);
}

.ces-filter-bar:has(.ces-filter--optional) {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
}

.ces-filter {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.ces-filter span {
  color: #0b1130;
  font-size: 15px;
  font-weight: 700;
}

.ces-filter select {
  appearance: none;
  -webkit-appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23555' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 1px solid #d7dee8;
  border-radius: 8px;
  color: #26314b;
  cursor: pointer;
  font: inherit;
  min-height: 54px;
  padding: 0 44px 0 18px;
  width: 100%;
}

.ces-checkbox-filter {
  align-items: center;
  background: #fff;
  border: 1px solid #d7dee8;
  border-radius: 8px;
  color: #26314b;
  cursor: pointer;
  display: flex;
  font-size: 15px;
  font-weight: 700;
  gap: 10px;
  min-height: 54px;
  padding: 0 18px;
}

.ces-checkbox-filter input {
  accent-color: var(--ces-primary);
  height: 18px;
  width: 18px;
}

.ces-filter-actions {
  align-items: end;
  display: grid;
  gap: 16px;
  grid-column: span 2;
  grid-template-columns: repeat(2, minmax(170px, 1fr));
  justify-content: stretch;
  min-width: 0;
}

.ces-nearby,
.ces-clear {
  align-items: center;
  align-self: end;
  background: transparent;
  border: 1px solid rgba(var(--ces-primary-rgb), 0.45);
  border-radius: 8px;
  color: var(--ces-primary);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  justify-content: center;
  min-height: 54px;
  min-width: 0;
  padding: 0 18px;
  text-align: center;
  white-space: nowrap;
}

.ces-nearby {
  color: var(--ces-primary);
  gap: 10px;
}

.ces-nearby::before {
  background: currentColor;
  content: "";
  display: inline-block;
  flex: 0 0 18px;
  height: 18px;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 22s7-5.33 7-12a7 7 0 1 0-14 0c0 6.67 7 12 7 12Zm0-9a3 3 0 1 1 0-6 3 3 0 0 1 0 6Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 22s7-5.33 7-12a7 7 0 1 0-14 0c0 6.67 7 12 7 12Zm0-9a3 3 0 1 1 0-6 3 3 0 0 1 0 6Z'/%3E%3C/svg%3E") center / contain no-repeat;
  width: 18px;
}

.ces-nearby--hero {
  flex: 0 0 auto;
  min-width: 220px;
}

.ces-locations--filters-hidden .ces-hero {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
}

.ces-locations--filters-hidden .ces-nearby--hero {
  grid-column: auto;
  justify-self: end;
  margin-top: 0;
}

.ces-nearby:hover,
.ces-nearby:focus,
.ces-nearby.is-active,
.ces-clear:hover,
.ces-clear:focus {
  background: rgba(var(--ces-primary-rgb), 0.08);
  color: var(--ces-primary);
}

.ces-nearby:disabled {
  cursor: progress;
  opacity: 0.62;
}

.ces-locations.is-locating::before {
  animation: ces-loading-bar 1.05s ease-in-out infinite;
  background: linear-gradient(90deg, transparent, var(--ces-primary), transparent);
  content: "";
  height: 4px;
  left: 0;
  position: absolute;
  top: -10px;
  width: 38%;
  z-index: 30;
}

@keyframes ces-loading-bar {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(280%); }
}

.ces-location-status {
  color: var(--ces-primary);
  font-size: 13px;
  font-weight: 700;
  grid-column: 1 / -1;
  margin: -8px 0 0;
}

.ces-location-status[hidden] {
  display: none;
}

.ces-map-layout {
  align-items: start;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(300px, 0.55fr) minmax(520px, 1.45fr);
  margin: 0;
  min-height: 0;
}

.ces-locations--map-only .ces-map-layout {
  grid-template-columns: 1fr;
}

@media (min-width: 681px) {
  .ces-locations--hide-desktop-list .ces-results {
    display: none;
  }
}

.ces-results {
  background: #fff;
  border: 1px solid rgba(33, 44, 56, 0.1);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(22, 31, 46, 0.06);
  max-height: 540px;
  overflow-y: auto;
  padding: 16px;
}

.ces-location-card {
  background: #fff;
  border: 1px solid #e4e9f0;
  border-radius: 8px;
  box-shadow: none;
  margin: 0 0 10px;
  overflow: hidden;
}

.ces-location-card.is-active {
  border-color: rgba(var(--ces-primary-rgb), 0.55);
  box-shadow: 0 10px 26px rgba(var(--ces-primary-rgb), 0.12);
}

.ces-card-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--ces-text);
  cursor: pointer;
  display: grid;
  gap: 14px;
  grid-template-columns: 56px 1fr auto;
  min-height: 104px;
  padding: 16px;
  text-align: left;
  width: 100%;
}

.ces-card-icon {
  height: 48px;
  width: 48px;
}

.ces-card-icon::before {
  height: 17px;
  width: 17px;
}

.ces-card-icon::after {
  height: 5px;
  width: 5px;
}

.ces-card-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.ces-card-title {
  color: #070b2d;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.25;
  text-transform: uppercase;
}

.ces-card-category {
  background: var(--ces-primary);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  justify-self: start;
  line-height: 1;
  padding: 6px 10px;
}

.ces-card-meta {
  color: #4a5570;
  display: block;
  font-size: 13px;
  line-height: 1.4;
}

.ces-card-chevron {
  border-bottom: 2px solid #7c8783;
  border-right: 2px solid #7c8783;
  display: block;
  height: 10px;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  width: 10px;
}

.ces-location-card.is-active .ces-card-chevron {
  transform: rotate(225deg);
}

.ces-card-details {
  border-top: 1px solid var(--ces-line);
  display: grid;
  gap: 17px;
  padding: 18px 24px 24px 86px;
}

.ces-card-details[hidden] {
  display: none;
}

.ces-detail,
.ces-popup-row {
  display: grid;
  gap: 10px;
  grid-template-columns: 22px 1fr;
}

.ces-popup-row {
  gap: 8px;
  min-height: 0;
}

.ces-detail strong,
.ces-detail span span,
.ces-popup-row strong,
.ces-popup-row span span {
  display: block;
}

.ces-detail strong,
.ces-popup-row strong {
  color: var(--ces-text);
  font-size: 14px;
  margin-bottom: 2px;
}

.ces-popup-row strong {
  margin-bottom: 0;
}

.ces-detail span span,
.ces-popup-row span span {
  color: #3b4642;
  font-size: 14px;
  line-height: 1.34;
  white-space: pre-line;
}

.ces-popup-row span span {
  line-height: 1.25;
}

.ces-detail-icon {
  border: 2px solid var(--ces-text);
  display: inline-block;
  height: 14px;
  margin-top: 2px;
  position: relative;
  width: 14px;
}

.ces-icon-clock { border-radius: 50%; }
.ces-icon-clock::before,
.ces-icon-clock::after {
  background: var(--ces-text);
  content: "";
  left: 6px;
  position: absolute;
  top: 3px;
}
.ces-icon-clock::before { height: 5px; width: 2px; }
.ces-icon-clock::after { height: 2px; top: 7px; width: 5px; }

.ces-icon-pin {
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
}
.ces-icon-pin::before {
  background: var(--ces-text);
  border-radius: 50%;
  content: "";
  height: 4px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
}

.ces-icon-phone { border: 0; height: 17px; width: 17px; }
.ces-icon-phone::before {
  border: 2px solid var(--ces-text);
  border-left-color: transparent;
  border-top-color: transparent;
  border-radius: 4px;
  content: "";
  height: 13px;
  left: 1px;
  position: absolute;
  top: 0;
  transform: rotate(35deg);
  width: 8px;
}

.ces-icon-department {
  border-radius: 2px;
}
.ces-icon-department::before,
.ces-icon-department::after {
  background: var(--ces-text);
  content: "";
  left: 3px;
  position: absolute;
  width: 6px;
}
.ces-icon-department::before {
  height: 2px;
  top: 4px;
}
.ces-icon-department::after {
  height: 2px;
  top: 8px;
}

.ces-icon-services {
  border-radius: 4px;
}
.ces-icon-services::before,
.ces-icon-services::after {
  background: var(--ces-text);
  content: "";
  position: absolute;
}
.ces-icon-services::before {
  height: 2px;
  left: 3px;
  top: 3px;
  width: 6px;
}
.ces-icon-services::after {
  height: 2px;
  left: 3px;
  top: 8px;
  width: 6px;
}

.ces-route-link {
  color: var(--ces-primary);
  font-weight: 800;
  text-decoration: none;
}
.ces-route-link:hover,
.ces-route-link:focus {
  text-decoration: underline;
}

.ces-results-summary {
  background: rgba(var(--ces-primary-rgb), 0.08);
  border: 1px solid rgba(var(--ces-primary-rgb), 0.08);
  border-radius: 8px;
  color: #27324d;
  display: grid;
  gap: 5px;
  font-size: 13px;
  line-height: 1.45;
  margin: 0 0 14px;
  padding: 18px 18px 18px 48px;
  position: relative;
}

.ces-results-summary::before {
  align-items: center;
  background: var(--ces-primary);
  border-radius: 50%;
  color: #fff;
  content: "i";
  display: flex;
  font-size: 18px;
  font-weight: 900;
  height: 28px;
  justify-content: center;
  left: 14px;
  position: absolute;
  top: 18px;
  width: 28px;
}

.ces-results-summary strong,
.ces-results-summary span {
  display: block;
}

/* ─── Mapa ────────────────────────────────────────────────────────── */

.ces-map-shell {
  /* Altura explícita para que Leaflet inicialice correctamente */
  background: #fff;
  border: 1px solid rgba(33, 44, 56, 0.1);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(22, 31, 46, 0.06);
  display: flex;
  flex-direction: column;
  height: 620px;
  margin: 0;
  min-height: 0;
  overflow: hidden;
  padding: 10px;
  position: relative;
}

.ces-map {
  /* CRÍTICO: altura explícita en px, no en % */
  flex: 1 1 auto;
  height: calc(100% - 58px);
  min-height: 0;
  width: 100%;
  background: #eef2f5;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.ces-map .leaflet-control-layers,
.ces-map .leaflet-bar {
  border: 0;
  box-shadow: 0 4px 18px rgba(20, 41, 34, 0.12);
}

.ces-map .leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(15, 35, 28, 0.24);
  overflow: hidden;
  padding: 0;
}

.ces-map .leaflet-popup-content {
  margin: 0;
  width: auto !important;
}

.ces-map .leaflet-popup-close-button {
  align-items: center;
  background: rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  font-size: 22px;
  height: 30px;
  justify-content: center;
  line-height: 1;
  right: 12px;
  top: 12px;
  width: 30px;
  z-index: 2;
}
.ces-map .leaflet-popup-close-button:hover,
.ces-map .leaflet-popup-close-button:focus {
  color: #fff;
}

/* ─── Clusters y pines ────────────────────────────────────────────── */

.ces-marker-cluster {
  align-items: center;
  border-radius: 50%;
  color: #fff;
  display: flex;
  font-weight: 800;
  height: 50px !important;
  justify-content: center;
  text-align: center;
  width: 50px !important;
}

.ces-marker-cluster-small {
  background: rgba(var(--ces-primary-rgb), 0.76);
}

.ces-marker-cluster-medium {
  background: var(--ces-button);
}

.ces-marker-cluster-large {
  background: var(--ces-button-hover);
}

.ces-marker-cluster div {
  align-items: center;
  border: 3px solid #fff;
  border-radius: 50%;
  display: flex;
  font-size: 14px;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.ces-map-pin.leaflet-div-icon,
.ces-map-pin {
  background: transparent;
  border: 0;
}

.ces-map-pin svg {
  display: block;
  filter: drop-shadow(0 4px 7px rgba(20, 44, 64, 0.28));
}

.ces-user-location-marker.leaflet-div-icon {
  background: transparent;
  border: 0;
}

.ces-user-location-marker {
  align-items: center;
  display: flex;
  gap: 10px;
}

.ces-user-location-dot {
  align-items: center;
  background: #2f6df6;
  border: 4px solid rgba(255, 255, 255, 0.96);
  border-radius: 50%;
  box-shadow: 0 0 0 13px rgba(47, 109, 246, 0.18), 0 10px 24px rgba(19, 58, 145, 0.3);
  display: inline-flex;
  height: 46px;
  justify-content: center;
  width: 46px;
}

.ces-user-location-dot svg {
  display: block;
  flex: 0 0 auto;
}

.ces-user-location-label {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 8px 22px rgba(25, 42, 78, 0.15);
  color: #2164ed;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  padding: 14px 18px;
  position: relative;
  white-space: nowrap;
}

.ces-user-location-label::before {
  border-bottom: 8px solid transparent;
  border-right: 9px solid #fff;
  border-top: 8px solid transparent;
  content: "";
  left: -9px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.ces-map-legend {
  align-items: center;
  background: #fff;
  display: flex;
  flex: 0 0 auto;
  gap: 34px;
  min-height: 58px;
  padding: 12px 28px;
}

.ces-map-legend span {
  align-items: center;
  color: #4f5a7a;
  display: inline-flex;
  font-size: 14px;
  font-weight: 600;
  gap: 12px;
}

.ces-legend-pin,
.ces-legend-user {
  display: inline-block;
  flex: 0 0 auto;
}

.ces-legend-pin {
  background: var(--ces-primary);
  border-radius: 50% 50% 50% 0;
  height: 18px;
  margin: 0 3px 4px 2px;
  position: relative;
  transform: rotate(-45deg);
  width: 18px;
}

.ces-legend-pin::after {
  background: #fff;
  border-radius: 50%;
  content: "";
  height: 7px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 7px;
}

.ces-legend-user {
  align-items: center;
  background: #2f6df6;
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  height: 26px;
  justify-content: center;
  position: relative;
  width: 26px;
}

.ces-legend-user::before {
  background: #fff;
  border-radius: 50%;
  content: "";
  height: 7px;
  left: 50%;
  position: absolute;
  top: 5px;
  transform: translateX(-50%);
  width: 7px;
}

.ces-legend-user::after {
  background: #fff;
  border-radius: 8px 8px 4px 4px;
  content: "";
  height: 8px;
  left: 50%;
  position: absolute;
  top: 14px;
  transform: translateX(-50%);
  width: 14px;
}

/* ─── Popup ───────────────────────────────────────────────────────── */

.ces-popup {
  background: #fff;
  min-width: 280px;
}
.ces-popup-head {
  background: var(--ces-primary);
  color: #fff;
  padding: 20px 54px 20px 20px;
}
.ces-popup-head span {
  display: block;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 8px;
  opacity: 0.92;
}
.ces-popup-head strong {
  color: inherit;
  display: block;
  font-size: 20px;
  line-height: 1.25;
}
.ces-popup-body {
  display: grid;
  gap: 6px;
  padding: 16px 20px 18px;
}
.ces-popup-text {
  color: #3d4743;
  display: block;
  font-size: 13px;
  line-height: 1.22;
  margin: 0 !important;
  padding-left: 32px;
}
.ces-popup-text strong { color: #26312d; }
.ces-map .leaflet-popup-content .ces-popup-text {
  margin: 0 !important;
}
.ces-popup-route {
  background: var(--ces-button);
  border-radius: 25px;
  color: #fff !important;
  display: block;
  font-size: 14px;
  font-weight: 800;
  margin-top: 8px;
  padding: 13px 16px;
  text-align: center;
  text-decoration: none;
}
.ces-popup-route:hover,
.ces-popup-route:focus {
  background: var(--ces-button-hover);
  color: #fff !important;
}

.ces-empty {
  background: #fff;
  border: 1px solid var(--ces-line);
  border-radius: 8px;
  color: var(--ces-muted);
  margin: 0;
  padding: 28px;
}

@media (max-width: 980px) {
  .ces-filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ces-filter-bar:has(.ces-filter--optional) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ces-filter-actions {
    grid-column: 1 / -1;
  }

  .ces-map-layout {
    grid-template-columns: 1fr;
  }
  .ces-locations--map-only .ces-map-layout {
    grid-template-columns: 1fr;
  }
  .ces-map-shell {
    height: 510px;
    min-height: 510px;
  }
  .ces-map {
    height: calc(100% - 58px);
    min-height: 0;
  }
}

@media (max-width: 680px) {
  .ces-hero {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .ces-hero-icon {
    height: 52px;
    width: 52px;
  }
  .ces-hero h2 {
    font-size: 28px;
  }
  .ces-nearby--hero {
    flex-basis: 100%;
  }
  .ces-locations--filters-hidden .ces-hero {
    grid-template-columns: 52px minmax(0, 1fr);
  }
  .ces-locations--filters-hidden .ces-nearby--hero {
    grid-column: 1 / -1;
    justify-self: center;
  }
  .ces-filter-bar,
  .ces-filter-bar:has(.ces-filter--optional),
  .ces-map-layout {
    grid-template-columns: 1fr;
  }
  .ces-filter-actions {
    grid-column: 1;
    grid-template-columns: 1fr;
  }
  .ces-filter-actions .ces-nearby,
  .ces-filter-actions .ces-clear {
    width: 100%;
  }
  .ces-results {
    max-height: none;
    order: 2;
  }
  .ces-locations--hide-mobile-list .ces-results {
    display: none;
  }
  .ces-card-details {
    padding-left: 22px;
  }
  .ces-map-shell {
    order: 1;
  }
  .ces-map-shell {
    height: 690px;
    min-height: 690px;
  }
  .ces-map {
    height: calc(100% - 58px);
    min-height: 0;
  }
  .ces-map-legend {
    gap: 16px;
    overflow-x: auto;
    padding: 12px 16px;
  }
  .ces-map-legend span {
    white-space: nowrap;
  }
  .ces-card-toggle {
    padding: 22px;
  }
}
