:root {
  --site-bg: #2F3437;
  --site-bg-dark: #1F2326;
  --site-accent: #6B7280;
  --site-accent-soft: rgba(107, 114, 128, 0.16);
  --site-button: #4B5563;
  --site-button-hover: #374151;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  background: #f4f6f8;
  color: #1f2933;
}

#app {
  display: flex;
  flex-direction: column;
  position: relative;
}

/* HEADER */

#main-header {
  min-height: 86px;
  background: #102a43;
  color: #ffffff;
  display: grid;
  grid-template-columns: minmax(260px, 420px) 1fr;
  align-items: center;
  padding: 12px 18px;
  gap: 16px;
  border-bottom: 3px solid #38bdf8;
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#site-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

#site-subtitle {
  font-size: 14px;
  color: #cbd5e1;
  font-weight: 700;
}

#site-description {
  margin: 0;
  color: #dbeafe;
  font-size: 13px;
  line-height: 1.35;
}

#summary-bar {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.summary-item {
  min-width: 130px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px 12px;
  text-align: center;
}

.summary-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
}

.summary-label {
  display: block;
  font-size: 11px;
  color: #cbd5e1;
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

button,
.home-link {
  border: none;
  border-radius: 8px;
  padding: 8px 11px;
  cursor: pointer;
  background: #e2e8f0;
  color: #102a43;
  font-weight: 600;
}

button:hover,
.home-link:hover {
  background: #bae6fd;
}

/* CONTROL BAR */

#control-bar {
  min-height: 52px;
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid #d9e2ec;
}

#control-bar select {
  height: 34px;
  border: 1px solid #bcccdc;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 14px;
}

#control-bar button {
  min-width: 90px;
}

/* MAIN */

#main-layout {
  position: relative;
  flex: 1;
  min-height: 0;
}

#territorial-panel {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 500;
  width: 320px;
  background: #ffffff;
  border: 1px solid #d9e2ec;
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.12);
  overflow-y: auto;
}

#territorial-panel h3 {
  margin: 0 0 14px 0;
  color: #102a43;
}

.panel-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
}

.panel-note {
  font-size: 13px;
  color: #64748b;
  line-height: 1.4;
}

#map-container {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.map-toggle {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1005;
  display: flex;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.72);
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

.map-toggle-btn {
  border: 0;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  color: #ffffff;
  background: transparent;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.map-toggle-btn:hover {
  background: transparent;
  transform: translateY(-1px);
}

.map-toggle-btn.active {
  color: #111111;
  background: #ffffff;
}

.header-actions:empty {
  display: none;
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#geoquery-toast {
  position: absolute;
  right: 14px;
  top: 114px;
  z-index: 1200;
  max-width: min(320px, calc(100% - 28px));
  padding: 10px 14px;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(15, 23, 42, 0.88);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.25);
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

#geoquery-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.mobile-layer-toggle {
  position: absolute;
  top: 66px;
  left: 16px;
  z-index: 2000;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
}

.mobile-layer-toggle:hover,
.mobile-layer-toggle:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.mobile-layer-toggle.is-active {
  border-color: #0ea5e9;
  background: #e0f2fe;
  color: #075985;
}

.mobile-layer-toggle.is-inactive {
  opacity: 0.78;
}

.mobile-layer-toggle-icon {
  font-size: 16px;
  line-height: 1;
}

@media (min-width: 769px) {
  #mobile-layer-toggle {
    display: none;
  }
}

/* GEOFACTORY MI UBICACIÓN */
#btn-my-location {
  position: absolute;
  top: 64px;
  right: 16px;
  z-index: 1002;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid #bcccdc;
  background: #ffffff;
  color: #102a43;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
}

#btn-my-location:hover {
  background: #e0f2fe;
}


/* GEOFACTORY ESCALA GRÁFICA */
.leaflet-control-scale-line {
  background: rgba(255, 255, 255, 0.85);
  border: 2px solid #102a43;
  border-top: none;
  color: #102a43;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
}

/* FOOTER */

#main-footer {
  height: 28px;
  background: #102a43;
  color: #cbd5e1;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

#main-footer a {
  color: inherit;
  text-decoration: none;
}
/* GEOFACTORY PANEL TERRITORIAL */
.panel-territorial-control {
  margin-bottom: 0;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: #102a43;
  cursor: pointer;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: #0ea5e9;
}

.panel-popup {
  font-size: 13px;
  line-height: 1.35;
}

@media (max-width: 768px) {
  #main-header {
    grid-template-columns: 1fr;
  }

  #summary-bar {
    justify-content: flex-start;
    overflow: auto;
  }

  .summary-item {
    min-width: 112px;
  }

  #control-bar {
    overflow: auto;
  }

  .map-toggle {
    top: 12px;
    right: 12px;
    gap: 4px;
    padding: 3px;
    z-index: 1005;
  }

  .map-toggle-btn {
    padding: 6px 10px;
    font-size: 11px;
  }

  #main-layout {
    display: block;
    position: relative;
  }

  #territorial-panel {
    display: none;
  }

  #mobile-layer-toggle {
    top: 66px;
    left: 12px;
  }

  #map-container {
    height: 100%;
    min-height: 420px;
  }

  #btn-my-location {
    top: 64px;
    right: 12px;
    width: 40px;
    height: 40px;
  }
}

/* GEOFACTORY SEARCH SOBRE MAPA */
#search-box-wrapper,
#map-search-wrap,
.map-search-wrap,
#floating-search {
  position: absolute;
  z-index: 2500;
}

#search-box-wrapper {
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(620px, calc(100% - 360px));
}

#search-box-wrapper #search-box {
  width: 100%;
  height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 0 18px;
  font-size: 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

/* RESULTADOS SEARCH BOX */
.map-search-results,
#prc-search-results,
#search-results {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 3000;
  max-height: 240px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #bcccdc;
  border-radius: 10px;
  box-shadow: 0 16px 35px rgba(15, 23, 42, 0.18);
  padding: 6px;
}

/* SEARCH RESPONSIVE COMO GEOIPT */
@media (max-width: 760px) {
  #search-box-wrapper {
    top: 12px;
    left: 12px;
    right: 12px;
    width: auto;
    transform: none;
  }

  #search-box-wrapper #search-box {
    height: 42px;
    border-radius: 14px;
  }

  #search-results {
    max-height: 220px;
  }
}

.map-search-results.is-visible,
.map-search-results.is-open,
#prc-search-results.is-visible,
#prc-search-results.is-open,
#search-results.is-visible,
#search-results.is-open {
  display: block;
}

.search-result-item {
  display: block;
  width: 100%;
  border-radius: 8px;
  background: transparent;
  color: #102a43;
  font-weight: 600;
  text-align: left;
  padding: 9px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-item:hover,
.search-result-item:focus {
  background: #e0f2fe;
  outline: none;
}

.search-results-message {
  padding: 8px 10px 6px;
  color: #486581;
  font-size: 13px;
  font-weight: 700;
}

#map-hint {
  position: absolute;
  left: 50%;
  bottom: 28px;
  z-index: 1200;
  transform: translate(-50%, 10px);
  max-width: min(520px, calc(100% - 32px));
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  padding: 10px 16px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

#map-hint.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.territorial-label {
  font-size: var(--geox-label-font-size, 15.118px);
  font-weight: 700;
  color: #1f2937;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 4px;
  padding: 2px 5px;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}


@media (max-width: 768px) {
  .territorial-label {
    font-size: var(--geox-label-font-size, 15.118px);
    padding: 2px 4px;
  }
}

/* GEOFACTORY MOBILE MAP CONTROLS + SUMMARY */
#mobile-summary-drawer {
  display: none;
}

@media (min-width: 769px) {
  #mobile-summary-drawer {
    display: none !important;
  }

  #mobile-map-controls {
    display: contents;
  }
}

@media (max-width: 768px) {
  .leaflet-control-zoom {
    display: none !important;
  }

  #mobile-map-controls {
    position: absolute;
    inset: 0;
    z-index: 1100;
    pointer-events: none;
  }

  #mobile-map-controls .map-toggle,
  #mobile-map-controls #btn-my-location,
  #mobile-map-controls #mobile-layer-toggle {
    position: absolute;
    pointer-events: auto;
  }

  #mobile-map-controls .map-toggle {
    top: 66px;
    right: 12px;
    left: auto;
    bottom: auto;
    display: flex;
    gap: 4px;
    padding: 3px;
    z-index: 1100;
  }

  #mobile-map-controls #btn-my-location {
    top: 116px;
    right: 12px;
    bottom: auto;
    width: 40px;
    height: 40px;
  }

  #geoquery-toast {
    top: 212px;
    right: 12px;
    left: 12px;
    max-width: none;
    text-align: center;
  }

  #mobile-map-controls #mobile-layer-toggle {
    top: 116px;
    left: 12px;
    right: auto;
    bottom: auto;
    z-index: 1100;
    min-height: 38px;
    padding: 8px 11px;
  }

  #mobile-summary-drawer {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 8px;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
  }

  #mobile-summary-toggle {
    pointer-events: auto;
    border: 1px solid rgba(16, 42, 67, 0.18);
    background: rgba(255, 255, 255, 0.96);
    color: #102a43;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
  }

  #mobile-summary-content {
    pointer-events: auto;
    width: 100%;
    margin-top: 6px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(0, 0, 0, 0.10);
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    opacity: 0;
    transform: translateY(12px);
    max-height: 0;
    overflow: hidden;
    transition: opacity 180ms ease, transform 180ms ease, max-height 180ms ease;
  }

  #mobile-summary-content .summary-item {
    min-width: 0;
    padding: 6px 4px;
    background: rgba(16, 42, 67, 0.06);
  }

  #mobile-summary-content .summary-value {
    color: #102a43;
    font-size: 16px;
  }

  #mobile-summary-content .summary-label {
    color: #52606d;
    font-size: 10px;
  }

  #mobile-summary-drawer.is-open #mobile-summary-content {
    opacity: 1;
    transform: translateY(0);
    max-height: 88px;
  }
}


.geoipt-intro-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.62);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.geoipt-intro-overlay.is-visible {
  display: flex;
}

.geoipt-intro-modal {
  width: min(92vw, 520px);
  max-height: 90vh;
  overflow-y: auto;
  background: #ffffff;
  color: #071225;
  border-radius: 18px;
  padding: 30px 32px 28px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
  text-align: center;
  font-family: inherit;
}

.geoipt-intro-modal h2 {
  margin: 0 0 14px;
  font-size: clamp(1.45rem, 3vw, 1.85rem);
  line-height: 1.15;
  font-weight: 800;
  color: #071225;
}

.geoipt-intro-modal p {
  margin: 0 auto 18px;
  font-size: 1rem;
  line-height: 1.45;
  color: #071225;
}

.geoipt-intro-image {
  display: block;
  width: 100%;
  max-width: 430px;
  height: auto;
  margin: 10px auto 22px;
  border-radius: 12px;
}

.geoipt-intro-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}

.geoipt-intro-button {
  border: 0;
  border-radius: 12px;
  padding: 14px 26px;
  background: #071225;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(7, 18, 37, 0.22);
  transition: transform 160ms ease;
}

.geoipt-intro-button:hover {
  transform: translateY(-1px);
}

.geoipt-intro-button:focus-visible,
.geoipt-intro-check input:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 3px;
}

.geoipt-intro-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #4b5563;
  font-size: 0.95rem;
  cursor: pointer;
}

.geoipt-intro-check input {
  width: 16px;
  height: 16px;
}


@media (max-width: 640px) {
  .geoipt-intro-overlay {
    padding: 12px;
    align-items: center;
  }

  .geoipt-intro-modal {
    width: min(94vw, 420px);
    padding: 24px 20px 22px;
    border-radius: 16px;
  }

  .geoipt-intro-modal p {
    font-size: 0.94rem;
    margin-bottom: 14px;
  }

  .geoipt-intro-image {
    max-width: 100%;
    margin-bottom: 18px;
  }

  .geoipt-intro-actions {
    flex-direction: column;
    gap: 12px;
  }

  .geoipt-intro-button {
    width: 100%;
  }
}


/* GEOX SITE BRANDING */
#main-header,
.site-header,
.header,
.app-header {
  background: linear-gradient(135deg, var(--site-bg-dark), var(--site-bg));
  border-bottom-color: var(--site-accent);
}

.summary-item,
.site-kpi,
.kpi-card,
.summary-card {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#site-title,
.site-title,
.header-title,
h1 {
  color: #ffffff;
}

#site-subtitle,
#site-description,
.site-subtitle,
.header-subtitle,
.site-description,
.header-description {
  color: rgba(255, 255, 255, 0.88);
}

#btn-search,
button.primary,
.btn-primary,
.search-button,
#searchBtn,
.buscar-btn {
  background: var(--site-button);
  color: #ffffff;
  border-color: var(--site-button);
}

#btn-search:hover,
button.primary:hover,
.btn-primary:hover,
.search-button:hover,
#searchBtn:hover,
.buscar-btn:hover {
  background: var(--site-button-hover);
  border-color: var(--site-button-hover);
}

#main-footer,
.portal-footer,
.footer,
.bottom-nav,
.geox-footer {
  background: var(--site-bg-dark);
  border-top: 1px solid var(--site-accent);
}

#main-footer a:hover,
.portal-footer a:hover,
.bottom-nav a:hover,
.geox-footer a:hover {
  color: var(--site-accent);
}

#territorial-panel h3,
#territorial-panel strong,
.panel-territorial strong,
.panel-title,
.layer-group-title {
  color: var(--site-bg);
}

input[type="checkbox"]:checked {
  accent-color: var(--site-accent);
}

.is-active,
.active,
.selected,
.portal-link.active {
  color: var(--site-accent);
}

.badge,
.site-badge,
.layer-badge {
  background: var(--site-accent-soft);
  color: var(--site-bg);
}

.home-link,
.geox-button,
#geoxBtn,
.btn-geox {
  border-color: var(--site-accent);
  color: var(--site-bg);
}

.home-link:hover {
  background: var(--site-accent-soft);
  color: var(--site-bg);
}

.mobile-layer-toggle.is-active,
#mobile-layer-toggle.is-active {
  border-color: var(--site-accent);
  background: var(--site-accent-soft);
  color: var(--site-bg);
}

.toggle-row input {
  accent-color: var(--site-accent);
}

.search-result-item:hover,
.search-result-item:focus {
  background: var(--site-accent-soft);
}

.geoipt-intro-button {
  background: var(--site-button);
}

.geoipt-intro-button:hover {
  background: var(--site-button-hover);
}

/* GEOX STANDARD TERRITORIAL PANEL */
.leaflet-top.leaflet-left,
.leaflet-control-zoom {
  z-index: 1100;
}

#territorial-panel,
.territorial-panel,
.floating-panel {
  position: absolute;
  top: 78px;
  left: 20px;
  z-index: 1000;
  width: 320px;
  min-width: 0;
  max-width: calc(100% - 40px);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  padding: 18px 20px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
  overflow-y: visible;
}

#territorial-panel h2,
#territorial-panel h3,
#panel-title {
  margin: 0 0 14px 0;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
  color: #1f2933;
}

#territorial-panel .panel-section,
#territorial-panel .panel-territorial-control {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.panel-toggle-list,
#territorial-panel .panel-layer-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.panel-toggle-row,
.panel-layer-toggle,
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  color: #1f2933;
  cursor: pointer;
}

.panel-toggle-row input,
.panel-layer-toggle input,
.toggle-row input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.mobile-layer-toggle,
#mobile-layer-toggle,
#map-hint {
  display: none !important;
}

@media (max-width: 768px) {
  #territorial-panel,
  .territorial-panel,
  .floating-panel {
    display: block;
    top: 118px;
    left: 12px;
    width: min(320px, calc(100% - 24px));
    max-width: calc(100% - 24px);
    padding: 16px 18px;
  }
}

/* GEOX STANDARD LABEL CONTROL */
html,
body,
#app {
  max-width: 100%;
  overflow-x: hidden;
}

#main-header {
  min-width: 0;
}

#summary-bar {
  min-width: 0;
  flex-wrap: wrap;
  align-items: stretch;
}

#territorial-panel,
.territorial-panel,
.floating-panel {
  position: absolute;
  top: 78px;
  left: 20px;
  z-index: 1000;
  width: auto;
  min-width: 210px;
  max-width: min(320px, calc(100% - 40px));
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
  overflow: visible;
}

#territorial-panel h2,
#territorial-panel h3,
#panel-title {
  margin: 0 0 10px 0;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  color: #1f2933;
}

#territorial-panel .panel-section,
#territorial-panel .panel-territorial-control {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.panel-toggle-list,
#territorial-panel .panel-layer-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}

.panel-toggle-row,
.panel-layer-toggle,
.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #1f2933;
  cursor: pointer;
}

.panel-toggle-row input,
.panel-layer-toggle input,
.toggle-row input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.mobile-layer-toggle,
#mobile-layer-toggle,
#map-hint {
  display: none !important;
}

@media (max-width: 768px) {
  .leaflet-control-zoom {
    display: none !important;
  }

  #main-header {
    grid-template-columns: minmax(0, 1fr);
    padding: 8px 10px;
    gap: 8px;
  }

  #site-title {
    font-size: 21px;
  }

  #site-subtitle,
  #site-description {
    font-size: 11px;
  }

  #summary-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
    width: 100%;
    gap: 5px;
    justify-content: stretch;
    overflow: visible;
  }

  .summary-item,
  .site-kpi,
  .kpi-card,
  .summary-card {
    min-width: 0;
    padding: 5px 4px;
    border-radius: 8px;
  }

  .summary-value,
  .kpi-value {
    font-size: 14px;
    line-height: 1.1;
    overflow-wrap: anywhere;
  }

  .summary-label,
  .kpi-label {
    font-size: 9px;
    line-height: 1.1;
  }

  #control-bar {
    max-width: 100%;
    overflow-x: auto;
  }

  #search-box-wrapper {
    top: 10px;
    left: 10px;
    right: 118px;
    width: auto;
    min-width: 0;
    transform: none;
  }

  .map-toggle,
  #mobile-map-controls .map-toggle {
    top: 60px;
    right: 10px;
  }

  #btn-my-location,
  #mobile-map-controls #btn-my-location {
    top: 106px;
    right: 10px;
    width: 38px;
    height: 38px;
  }

  #territorial-panel,
  .territorial-panel,
  .floating-panel {
    display: block !important;
    top: 110px;
    left: 10px;
    width: auto;
    min-width: 0;
    max-width: min(250px, calc(100% - 70px));
    padding: 10px 12px;
    border-radius: 14px;
  }

  #territorial-panel h2,
  #territorial-panel h3,
  #panel-title {
    margin-bottom: 7px;
    font-size: 14px;
  }

  .panel-toggle-row,
  .panel-layer-toggle,
  .toggle-row {
    gap: 7px;
    font-size: 12px;
  }

  .panel-toggle-row input,
  .panel-layer-toggle input,
  .toggle-row input {
    width: 15px;
    height: 15px;
  }
}

/* GEOX MOBILE LABEL STANDARD */
.mobile-layer-toggle,
#mobile-layer-toggle {
  display: none;
}

@media (max-width: 768px) {
  .leaflet-control-zoom {
    display: none !important;
  }

  #main-header {
    grid-template-columns: minmax(0, 1fr);
    padding: 7px 9px;
    gap: 6px;
    min-width: 0;
  }

  #site-title { font-size: 20px; line-height: 1.1; }
  #site-subtitle,
  #site-description { font-size: 10px; line-height: 1.15; }

  #summary-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
    width: 100%;
    gap: 4px;
    justify-content: stretch;
    overflow: visible;
    min-width: 0;
  }

  .summary-item,
  .site-kpi,
  .kpi-card,
  .summary-card {
    min-width: 0;
    padding: 4px 3px;
    border-radius: 7px;
  }

  .summary-value,
  .kpi-value { font-size: 12px; line-height: 1.05; overflow-wrap: anywhere; }
  .summary-label,
  .kpi-label { font-size: 8px; line-height: 1.05; }

  #search-box-wrapper {
    top: 10px;
    left: 10px;
    right: 10px;
    width: auto;
    min-width: 0;
    transform: none;
  }

  #search-box-wrapper #search-box,
  #search-box {
    height: 40px;
    border-radius: 14px;
    padding: 0 12px;
    font-size: 13px;
    text-overflow: ellipsis;
  }

  #territorial-panel,
  .territorial-panel,
  .floating-panel { display: none !important; }

  .map-toggle,
  #mobile-map-controls .map-toggle {
    top: auto !important;
    right: 10px !important;
    bottom: 16px !important;
    z-index: 1500;
  }

  #btn-my-location,
  #mobile-map-controls #btn-my-location {
    top: 60px !important;
    right: 10px !important;
    width: 38px;
    height: 38px;
  }

  .mobile-layer-toggle,
  #mobile-layer-toggle {
    position: absolute;
    top: 108px !important;
    right: 10px !important;
    left: auto !important;
    z-index: 1600;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    min-width: 42px;
    padding: 0;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    background: #ffffff;
    color: #334155;
    font-size: 20px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
  }

  .mobile-layer-toggle-text { display: none !important; }
}


/* Mobile map control refinements: master label eye + separated base-map toggle. */
.mobile-layer-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  line-height: 0;
}

.mobile-layer-toggle-svg {
  display: block;
  width: 22px;
  height: 22px;
}

@media (max-width: 768px) {
  #territorial-panel,
  .territorial-panel,
  .floating-panel,
  #territorial-panel .panel-layer-controls,
  #territorial-panel .panel-toggle-list {
    display: none !important;
  }

  .leaflet-control-zoom {
    display: none !important;
  }

  .map-toggle,
  #mobile-map-controls .map-toggle {
    top: auto !important;
    right: max(12px, env(safe-area-inset-right)) !important;
    bottom: max(58px, calc(env(safe-area-inset-bottom) + 42px)) !important;
    z-index: 1700 !important;
    padding: 5px !important;
    background: rgba(15, 23, 42, 0.86) !important;
    border: 1px solid rgba(255, 255, 255, 0.72) !important;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.32) !important;
  }

  .map-toggle-btn {
    min-width: 44px;
    min-height: 34px;
    font-weight: 800;
  }

  #btn-my-location,
  #mobile-map-controls #btn-my-location,
  .mobile-layer-toggle,
  #mobile-layer-toggle {
    right: max(12px, env(safe-area-inset-right)) !important;
    left: auto !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 14px !important;
    background: #ffffff !important;
    color: #1e293b !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.2) !important;
  }

  #btn-my-location,
  #mobile-map-controls #btn-my-location {
    top: 64px !important;
    z-index: 1700 !important;
  }

  .mobile-layer-toggle,
  #mobile-layer-toggle {
    top: 116px !important;
    z-index: 1700 !important;
    padding: 0 !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .mobile-layer-toggle.is-active,
  #mobile-layer-toggle.is-active,
  .mobile-layer-toggle.is-inactive,
  #mobile-layer-toggle.is-inactive {
    background: #ffffff !important;
    color: #1e293b !important;
  }

  .mobile-layer-toggle-text {
    display: none !important;
  }
}

/* Mobile Cross Access visibility guard: keep the GeoX links reserved above the map. */
@media (max-width: 768px) {
  :root {
    --mobile-crossbar-height: 40px;
    --mobile-crossbar-gap: 12px;
  }

  html,
  body,
  #app {
    min-height: 100%;
    overflow-x: hidden;
  }

  #app {
    height: 100%;
  }

  #main-layout {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  #map-container {
    flex: 1 1 auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: calc(100dvh - var(--mobile-crossbar-height)) !important;
    overflow: hidden !important;
  }

  #map {
    inset: 0 0 0 0 !important;
  }

  #main-footer,
  .portal-footer,
  .footer,
  .bottom-nav,
  .geox-footer {
    position: sticky !important;
    bottom: env(safe-area-inset-bottom) !important;
    z-index: 2600 !important;
    flex: 0 0 var(--mobile-crossbar-height) !important;
    width: 100% !important;
    min-height: var(--mobile-crossbar-height) !important;
    height: var(--mobile-crossbar-height) !important;
    padding: 0 max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left)) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    font-size: 12px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    box-shadow: 0 -8px 22px rgba(15, 23, 42, 0.22) !important;
  }

  #main-footer a,
  .portal-footer a,
  .bottom-nav a,
  .geox-footer a {
    flex: 0 1 auto !important;
    min-width: 0 !important;
    padding: 0 2px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .map-toggle,
  #mobile-map-controls .map-toggle {
    top: auto !important;
    right: max(12px, env(safe-area-inset-right)) !important;
    bottom: calc(var(--mobile-crossbar-height) + var(--mobile-crossbar-gap)) !important;
    z-index: 1700 !important;
  }

  .leaflet-control-attribution {
    margin-bottom: calc(var(--mobile-crossbar-height) + 4px) !important;
    max-width: calc(100vw - 130px) !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
}
