/* ==============================================
   ATLAS DE TÉCNICAS DEL ARTE TEXTIL — ESTILOS
   ============================================== */

:root {
  /* ── Paleta principal ── */
  --magenta:  #B50552;
  --azul-mar: #035A79;
  --naranja:  #FB4801;
  --verde:    #05B794;
  --ocre:     #FFA329;
  --gris:     #C8B8C0;
  --cyan:     #00B2C0;
  --rosa:     #DE599B;

  /* ── Neutros ── */
  --negro:    #1A1018;
  --tinta:    #2A1E24;
  --crema:    #FFF8F5;
  --arena:    #8C7A80;

  /* ── Roles semánticos ── */
  --bg-page:    #FFF8F5;
  --bg-card:    #FFFFFF;
  --bg-dark:    var(--negro);
  --text-main:  var(--tinta);
  --text-soft:  var(--arena);
  --text-light: var(--crema);
  --border:     rgba(26,16,24,.10);

  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;

  --shadow-sm:  0 1px 4px rgba(26,16,24,.08);
  --shadow-md:  0 4px 16px rgba(26,16,24,.13);
  --shadow-lg:  0 12px 40px rgba(26,16,24,.20);

  --font-display: 'Fraunces', Georgia, serif;
  --font-mono:    'Space Mono', monospace;
  --font-body:    'DM Sans', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--bg-page);
  color: var(--text-main);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==============================================
   HEADER
   ============================================== */
.header { background: #8B0440; padding: 0; position: relative; overflow: hidden; }

.header-inner {
  position: relative; z-index: 1; width: 100%;
  padding: 12px 28px; display: flex; align-items: center; gap: 22px;
  justify-content: space-between;
}

.header-wordmark { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.header-wordmark h1 {
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 900;
  color: var(--crema); line-height: 1.05; letter-spacing: -0.3px;
}

.header-wordmark h1 .word-highlight { color: var(--ocre); font-style: normal; }

.header-wordmark p {
  font-size: 0.72rem; color: rgba(255,248,245,.40);
  font-weight: 400; letter-spacing: 0.2px; line-height: 1.4; max-width: 480px;
}

.header-divider { width: 1px; height: 36px; background: rgba(255,255,255,.12); flex-shrink: 0; }

.header-stats { display: flex; gap: 28px; align-items: center; }

.hstat { display: flex; flex-direction: column; align-items: center; }

.hstat-num {
  font-family: var(--font-display); font-size: 1.55rem; font-weight: 900;
  color: var(--ocre); line-height: 1;
}

.hstat-lbl {
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 1.2px;
  color: rgba(255,248,245,.38); margin-top: 2px;
}

/* Logos institucionales (esquina superior derecha del header) */
.header-logos {
  margin-left: auto;
  display: flex; align-items: center;
  flex-shrink: 0;
}
.header-logos img {
  height: 50px; width: auto; display: block;
}

/* ==============================================
   NAVIGATION TABS
   ============================================== */
.nav-tabs {
  background: var(--negro); border-top: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; padding: 0 32px; gap: 2px; overflow-x: auto;
}

.nav-tab {
  padding: 12px 22px; font-size: 0.82rem; font-weight: 500;
  color: rgba(255,248,245,.45); cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
  transition: all .2s ease; letter-spacing: 0.2px;
  font-family: var(--font-body); background: none;
  border-top: none; border-left: none; border-right: none;
}
.nav-tab:hover { color: rgba(255,248,245,.80); }
.nav-tab.active { color: var(--ocre); border-bottom-color: var(--ocre); }

/* ==============================================
   MAIN LAYOUT
   ============================================== */
.view { display: none; }
.view.active { display: block; }

#view-mapa.active {
  display: flex;
  position: relative;
  height: calc(100vh - var(--chrome-h, 96px));
  height: calc(100dvh - var(--chrome-h, 96px));
  min-height: 420px;
}

/* ==============================================
   MAP PANEL
   ============================================== */
.map-panel { flex: 1; position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #dcecf1; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 260px; }

.map-search-wrap {
  position: absolute; top: 14px; left: 50%;
  transform: translateX(-50%); z-index: 500; width: 260px;
}

.map-search {
  width: 100%; padding: 9px 16px; border-radius: 40px; border: none;
  background: var(--negro); color: var(--crema); font-size: 0.82rem;
  outline: none; box-shadow: var(--shadow-lg); font-family: var(--font-body);
}
.map-search::placeholder { color: rgba(255,248,245,.35); }

.map-legend {
  position: absolute; bottom: 18px; left: 18px;
  background: var(--negro); padding: 14px 18px;
  border-radius: var(--radius-md); font-size: 0.75rem;
  z-index: 500; border-left: 3px solid var(--magenta);
}

.map-legend h4 {
  font-family: var(--font-display); color: var(--ocre);
  font-size: 0.78rem; margin-bottom: 10px; font-weight: 700;
}

.legend-item { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; color: rgba(255,248,245,.65); }
.legend-dot { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

/* Toggle de capa Comunidades — esquina superior izquierda del mapa */
.map-layer-toggle {
  position: absolute; top: 14px; left: 14px;
  z-index: 500;
  background: white; border-radius: var(--radius-md);
  padding: 8px 12px; box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.map-layer-checkbox {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
}
.map-layer-checkbox input {
  position: absolute; opacity: 0; pointer-events: none;
}
.map-layer-checkbox-track {
  position: relative;
  width: 32px; height: 18px;
  background: var(--border);
  border-radius: 9px;
  transition: background .18s ease;
  flex-shrink: 0;
}
.map-layer-checkbox-track::after {
  content: ''; position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: white; border-radius: 50%;
  transition: transform .18s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.map-layer-checkbox input:checked + .map-layer-checkbox-track {
  background: var(--magenta);
}
.map-layer-checkbox input:checked + .map-layer-checkbox-track::after {
  transform: translateX(14px);
}
.map-layer-checkbox-label {
  font-family: var(--font-body);
  font-size: 0.78rem; font-weight: 600;
  color: var(--negro);
}
.map-layer-checkbox.loading .map-layer-checkbox-label::after {
  content: ''; display: inline-block;
  width: 10px; height: 10px; margin-left: 6px;
  border: 2px solid var(--magenta); border-top-color: transparent;
  border-radius: 50%; vertical-align: -1px;
  animation: spinner 0.7s linear infinite;
}
@keyframes spinner { to { transform: rotate(360deg); } }

/* ==============================================
   SIDE PANEL
   ============================================== */
.side-panel {
  width: 390px; flex-shrink: 0;
  border-left: 2px solid var(--negro);
  display: flex; flex-direction: column;
  background: var(--bg-page); overflow: hidden;
}

.panel-header {
  padding: 18px 22px 14px; border-bottom: 1px solid var(--border);
  flex-shrink: 0; background: white;
}

.panel-title { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; color: var(--negro); line-height: 1.2; }
.panel-subtitle { font-size: 0.75rem; color: var(--arena); margin-top: 3px; }
.panel-subtitle:empty { display: none; }
.panel-body { flex: 1; overflow-y: auto; padding: 18px 20px; min-height: 0; }

/* Lista de estados (siempre visible en el panel derecho) */
.states-list-wrap {
  flex-shrink: 0;
  background: white;
  padding: 12px 18px 14px;
  border-bottom: 1px solid var(--border);
  max-height: 38vh;
  display: flex; flex-direction: column;
  min-height: 0;
}
.states-list-label {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.4px; color: var(--arena); margin-bottom: 8px;
  flex-shrink: 0;
}
.states-list {
  display: flex; flex-wrap: wrap; gap: 4px;
  overflow-y: auto;
  padding-right: 4px;
}
.state-item {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 14px;
  border: 1.5px solid var(--border);
  background: white; color: var(--negro);
  font-size: 0.72rem; font-weight: 500;
  font-family: var(--font-body); cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.state-item:hover {
  border-color: var(--magenta); color: var(--magenta);
  transform: translateY(-1px);
}
.state-item.active {
  background: var(--magenta); border-color: var(--magenta); color: white;
}
.state-item .state-count {
  font-size: 0.65rem; opacity: 0.65; font-weight: 600;
}
.state-item.active .state-count { opacity: 0.9; }
.state-item.disabled { opacity: 0.4; cursor: not-allowed; }
.state-item.disabled:hover { border-color: var(--border); color: var(--negro); transform: none; }

.welcome-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; text-align: center; padding: 40px 20px; gap: 12px;
}
.welcome-state h3 { font-family: var(--font-display); font-size: 1.1rem; color: var(--negro); }
.welcome-state p { font-size: 0.82rem; color: var(--arena); line-height: 1.65; }

/* Technique chips */
.grupo-section { margin-bottom: 18px; }

.grupo-label {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.8px; color: var(--arena); margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.grupo-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.chips-wrap { display: flex; flex-wrap: wrap; gap: 5px; }

.tecnica-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 4px; border: 1.5px solid;
  font-size: 0.78rem; font-weight: 500; cursor: pointer;
  transition: all .18s ease; background: white;
  font-family: var(--font-body); line-height: 1.3;
}
.tecnica-chip:hover, .tecnica-chip.active { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.has-img-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.45; flex-shrink: 0; }

/* Chip colors por CAT-N-1 */
.chip-tejido        { border-color: var(--azul-mar); color: var(--azul-mar); }
.chip-tejido.active        { background: var(--azul-mar); color: white; }
.chip-decorativas   { border-color: var(--magenta);  color: var(--magenta);  }
.chip-decorativas.active   { background: var(--magenta);  color: white; }
.chip-acabados      { border-color: var(--ocre);     color: var(--ocre);     }
.chip-acabados.active      { background: var(--ocre);     color: white; }
.chip-tenidos       { border-color: var(--verde);    color: var(--verde);    }
.chip-tenidos.active       { background: var(--verde);    color: white; }
.chip-other         { border-color: var(--arena);    color: var(--arena);    }
.chip-other.active         { background: var(--arena);    color: white; }

/* Etiqueta CAT-N-2 dentro del panel lateral */
.cat2-label {
  font-size: 0.62rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1.5px; margin: 6px 0 5px 2px;
  opacity: 0.8;
}

/* ==============================================
   FICHA MODAL
   ============================================== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(26,16,24,.72);
  z-index: 2000; display: none; align-items: flex-start;
  justify-content: center; padding: 24px 16px 40px;
  overflow-y: auto; backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }

.modal-card {
  background: var(--bg-page); width: 100%; max-width: 860px;
  border-radius: var(--radius-lg); overflow: hidden; position: relative;
  box-shadow: var(--shadow-lg); animation: slideUp .28s cubic-bezier(.34,1.4,.64,1); margin: auto;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── HERO — Carrusel ──────────────────────────── */
.modal-hero {
  height: 300px;
  background: var(--negro);
  position: relative;
  overflow: hidden;
}

/* Track deslizable */
.carousel-track {
  display: flex;
  height: 100%;
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  will-change: transform;
}

.carousel-slide {
  flex-shrink: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.carousel-img {
  width: 100%; height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  display: block;
  transition: transform .3s ease;
}
.carousel-img:hover { transform: scale(1.02); }

/* Botones anterior / siguiente */
.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(26,16,24,.65); border: none;
  color: white; font-size: 26px; line-height: 1;
  cursor: pointer; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  transition: background .2s, opacity .2s;
  font-family: var(--font-body);
  padding: 0;
}
.carousel-btn:hover { background: var(--magenta); }
.carousel-prev { left: 12px; }
.carousel-next { right: 12px; }

/* Dots indicadores */
.carousel-dots {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; z-index: 5;
}
.carousel-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,248,245,.35); border: none; cursor: pointer;
  padding: 0; transition: background .2s, transform .2s;
}
.carousel-dot.active {
  background: var(--ocre); transform: scale(1.3);
}

/* Contador esquina derecha */
.carousel-counter {
  position: absolute; bottom: 12px; right: 14px;
  background: rgba(26,16,24,.7); color: rgba(255,248,245,.75);
  padding: 3px 9px; border-radius: 4px;
  font-size: 0.68rem; font-family: var(--font-mono);
  backdrop-filter: blur(4px); z-index: 5;
}

.gallery-placeholder {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; color: rgba(255,248,245,.25);
}
.textile-icon { font-size: 48px; opacity: 0.18; display: block; }
.gallery-placeholder p { font-size: 0.75rem; color: rgba(255,248,245,.3); }

.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(26,16,24,.7); border: none; color: var(--crema);
  font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 10; transition: background .2s;
  backdrop-filter: blur(4px); font-family: var(--font-body);
}
.modal-close:hover { background: var(--magenta); }

.modal-badge {
  position: absolute; bottom: 12px; left: 14px;
  background: rgba(26,16,24,.8); color: var(--ocre);
  padding: 4px 12px; border-radius: 4px;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.5px;
  border-left: 2px solid var(--ocre); backdrop-filter: blur(4px);
  z-index: 5;
}

.modal-body { position: relative; padding: 28px 44px 36px 32px; }

.modal-titulo {
  font-family: var(--font-display); font-size: 1.9rem; font-weight: 900;
  color: var(--negro); line-height: 1.1; margin-bottom: 6px;
}

.modal-grupo {
  display: inline-block; padding: 3px 12px; border-radius: 3px;
  font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
  color: white; margin-bottom: 16px;
}

.estados-row { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 20px; }

.estado-tag {
  padding: 4px 10px; border-radius: 3px; font-size: 0.72rem; font-weight: 500;
  background: rgba(3,90,121,.08); color: var(--azul-mar);
  border: 1px solid rgba(3,90,121,.20); cursor: pointer; transition: background .15s;
}
.estado-tag:hover { background: rgba(3,90,121,.16); }

/* Stats — un solo color para todos los números */
.stats-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px; margin-bottom: 24px;
}

.stat-box {
  background: white; border-radius: var(--radius-sm);
  padding: 12px; text-align: center; border: 1px solid var(--border);
}

.stat-box .val {
  font-family: var(--font-display); font-size: 1.7rem; font-weight: 900;
  line-height: 1; margin-bottom: 3px;
  color: var(--magenta);  /* un solo color para todos los números */
}

.stat-box .key {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 1px; color: var(--arena);
}

/* Lengua tags */
.tags-row { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 20px; }

.lengua-tag {
  padding: 4px 10px; border-radius: 3px; font-size: 0.72rem; font-weight: 500;
  background: rgba(0,178,192,.10); color: var(--cyan); border: 1px solid rgba(0,178,192,.28);
}

/* Sections — título y línea con un solo color */
.section { margin-bottom: 24px; }

.section-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px; padding-bottom: 7px;
  border-bottom: 1.5px solid var(--magenta);
}

.section-title {
  font-family: var(--font-display); font-size: 0.95rem; font-weight: 700;
  color: var(--magenta);
}
/* ── CLASIFICACIÓN EN FICHA ── */
.clasificacion-tree {
  display: flex; flex-direction: column; gap: 6px;
}

.clas-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: white;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}

.clas-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
}

.clas-level {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--arena); min-width: 72px; flex-shrink: 0;
}

.clas-val {
  font-size: 0.84rem; font-weight: 600; color: var(--negro);
}



/* Voice quotes */
.voces-list { display: flex; flex-direction: column; gap: 8px; }

.voz-card {
  background: white; border-radius: var(--radius-sm);
  padding: 12px 16px; font-size: 0.84rem; line-height: 1.65;
  color: var(--negro); border-left: 3px solid var(--magenta); position: relative;
}

/* Tags */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 5px; }

.mat-tag {
  padding: 4px 10px; border-radius: 3px; font-size: 0.72rem; font-weight: 500;
  background: rgba(5,183,148,.08); color: var(--verde); border: 1px solid rgba(5,183,148,.22);
}

.prenda-tag {
  padding: 4px 10px; border-radius: 3px; font-size: 0.72rem; font-weight: 500;
  background: rgba(251,72,1,.08); color: var(--naranja); border: 1px solid rgba(251,72,1,.22);
}

/* Bar chart */
.bar-chart { display: flex; flex-direction: column; gap: 7px; }

.bar-row {
  display: grid; grid-template-columns: 110px 1fr 32px;
  align-items: center; gap: 10px; font-size: 0.76rem;
}

.bar-label { text-align: right; color: var(--arena); font-weight: 500; }

.bar-track {
  height: 8px; background: rgba(26,16,24,.07);
  border-radius: 40px; overflow: hidden;
}

.bar-fill { height: 100%; border-radius: 40px; transition: width .7s cubic-bezier(.34,1.4,.64,1); }
.bar-val { font-weight: 700; font-size: 0.76rem; }

/* ==============================================
   CATALOG VIEW
   ============================================== */
.catalog-view { max-width: 1400px; margin: 0 auto; padding: 36px 48px; }

.catalog-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 28px; }

.catalog-search {
  flex: 1; min-width: 200px; padding: 10px 18px; border-radius: 40px;
  border: 1.5px solid var(--border); font-size: 0.86rem; background: white;
  font-family: var(--font-body); outline: none; transition: border .2s; color: var(--negro);
}
.catalog-search:focus { border-color: var(--azul-mar); }
.catalog-search::placeholder { color: var(--arena); }

.filter-btn {
  padding: 8px 18px; border-radius: 4px; border: 1.5px solid var(--border);
  font-size: 0.76rem; font-weight: 600; cursor: pointer; transition: all .18s;
  background: white; font-family: var(--font-body); color: var(--arena);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.filter-btn:hover { border-color: var(--arena); color: var(--negro); }
.filter-btn.active { background: var(--negro); color: var(--crema); border-color: var(--negro); }

.catalog-results { font-size: 0.75rem; color: var(--arena); margin-bottom: 18px; font-family: var(--font-mono); }

.tecnicas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }

.tec-card {
  background: white; border-radius: var(--radius-md); overflow: hidden;
  cursor: pointer; transition: all .22s ease; border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.tec-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--magenta); }

.tec-card-img {
  height: 150px; background: var(--negro); overflow: hidden;
  position: relative; display: flex; align-items: center; justify-content: center;
}
.tec-card-img img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; transition: transform .4s ease; }
.tec-card:hover .tec-card-img img { transform: scale(1.04); }
.tec-card-no-img { color: rgba(255,248,245,.15); font-size: 36px; }

.tec-card-body { padding: 14px 16px; }
.tec-card-grupo { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--arena); margin-bottom: 4px; }
.tec-card-name { font-family: var(--font-display); font-size: 0.98rem; font-weight: 700; color: var(--negro); line-height: 1.25; margin-bottom: 8px; }
.tec-card-meta { display: flex; flex-wrap: wrap; gap: 4px; }
.tec-card-tag { padding: 2px 7px; border-radius: 3px; font-size: 0.68rem; background: rgba(26,16,24,.06); color: var(--arena); }

/* ==============================================
   NETWORK VIEW — pantalla completa, paneles flotantes
   ============================================== */
.network-view {
  position: relative;
  width: 100%;
  height: calc(100vh - var(--chrome-h, 107px));
  height: calc(100dvh - var(--chrome-h, 107px));
  min-height: 420px;
  background: #FDFAF8;
  overflow: hidden;
}

/* Canvas a pantalla completa */
#network-canvas {
  width: 100%; height: 100%;
  display: block; cursor: grab;
  touch-action: none; /* el gesto de arrastrar/pinch lo maneja el propio canvas */
}
#network-canvas:active { cursor: grabbing; }

/* Panel flotante (izquierda): búsqueda, dropdown de capa, subcategorías */
.network-side-panel {
  position: absolute; top: 16px; left: 16px; z-index: 20;
  display: flex; flex-direction: column; gap: 10px;
  width: 300px;
  max-height: calc(100% - 32px);
}

/* Dropdown de layers */
.network-dropdown {
  position: relative;
}
.network-dropdown-trigger {
  width: 100%; box-sizing: border-box;
  display: flex; align-items: center; justify-content: space-between;
  background: white; border: 1.5px solid var(--border);
  border-radius: var(--radius-md); padding: 9px 14px;
  cursor: pointer; font-family: var(--font-body);
  box-shadow: var(--shadow-md); transition: all .15s ease;
  text-align: left;
}
.network-dropdown-trigger:hover { border-color: var(--negro); }
.network-dropdown.open .network-dropdown-trigger {
  border-color: var(--negro);
  border-bottom-left-radius: 0; border-bottom-right-radius: 0;
}
.network-dropdown-label {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0; flex: 1;
}
.network-dropdown-label-key {
  font-size: 0.6rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--arena);
}
.network-dropdown-label-value {
  font-size: 0.88rem; font-weight: 600;
  color: var(--negro); line-height: 1.2;
}
.network-dropdown-chevron {
  font-size: 0.85rem; color: var(--negro);
  margin-left: 10px; flex-shrink: 0;
  transition: transform .2s ease;
}
.network-dropdown.open .network-dropdown-chevron { transform: rotate(180deg); }

.network-dropdown-menu {
  position: absolute; top: 100%; left: 0; right: 0;
  background: white;
  border: 1.5px solid var(--negro); border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: none; flex-direction: column;
  z-index: 30; max-height: 320px; overflow-y: auto;
}
.network-dropdown.open .network-dropdown-menu { display: flex; }

.network-dropdown-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; cursor: pointer;
  border: none; background: white; text-align: left;
  font-family: var(--font-body); width: 100%;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.network-dropdown-item:last-child { border-bottom: none; }
.network-dropdown-item:hover { background: var(--bg-page); }
.network-dropdown-item.active { background: rgba(181,5,82,.06); }
.network-dropdown-item-icon {
  font-size: 1rem; line-height: 1.2;
  width: 20px; flex-shrink: 0;
  color: var(--magenta);
}
.network-dropdown-item-text { flex: 1; min-width: 0; }
.network-dropdown-item-label {
  font-size: 0.85rem; font-weight: 600;
  color: var(--negro); line-height: 1.2;
}
.network-dropdown-item-desc {
  font-size: 0.72rem; color: var(--arena);
  margin-top: 2px; line-height: 1.4;
}

/* Sección de subcategorías */
.network-sublayer-section {
  background: white; border-radius: var(--radius-md);
  padding: 12px 16px; box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  display: flex; flex-direction: column;
  min-height: 0; flex: 1;
}
.network-sublayer-label {
  font-size: 0.66rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--arena); margin-bottom: 8px;
  flex-shrink: 0;
}
.network-sublayer-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  overflow-y: auto;
  margin-bottom: 8px;
  flex: 1; min-height: 0;
  padding-right: 4px;
}
.network-sublayer-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 14px;
  border: 1.5px solid var(--chip-color, var(--border));
  background: white; cursor: pointer;
  font-family: var(--font-body); font-size: 0.72rem;
  font-weight: 500; color: var(--negro);
  transition: all .15s ease;
}
.network-sublayer-chip:hover {
  background: var(--chip-color, var(--negro));
  color: white; transform: translateY(-1px);
}
.network-sublayer-chip.active {
  background: var(--chip-color, var(--negro));
  color: white;
}
.network-sublayer-chip-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--chip-color, var(--arena));
  flex-shrink: 0;
}
.network-sublayer-chip.active .network-sublayer-chip-dot { background: white; }

/* Tooltip y controles */
.network-tooltip {
  position: absolute; background: var(--negro); color: var(--crema);
  padding: 8px 14px; border-radius: var(--radius-sm); font-size: 0.78rem;
  pointer-events: none; opacity: 0; transition: opacity .15s; max-width: 240px;
  border-left: 3px solid var(--ocre); z-index: 30;
}
.network-tooltip.visible { opacity: 1; }
.network-tooltip strong { display: block; font-family: var(--font-display); font-size: 0.85rem; margin-bottom: 2px; }

.network-legend-hint {
  display: block;
  font-size: 0.66rem; color: var(--arena);
  line-height: 1.5; margin-top: 6px; flex-shrink: 0;
}

/* Controles de zoom: lado derecho (panel ahora a la izquierda) */
.network-controls {
  position: absolute; top: 16px; right: 16px;
  display: flex; flex-direction: column; gap: 6px;
  z-index: 20;
}

.net-ctrl-btn {
  width: 34px; height: 34px; background: white; border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm); transition: background .15s; font-family: var(--font-body); color: var(--negro);
}
.net-ctrl-btn:hover { background: var(--bg-page); }

/* ==============================================
   LOADING / ERROR STATE
   ============================================== */
#loading-overlay {
  position: fixed; inset: 0; background: var(--bg-page); z-index: 9000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; transition: opacity .4s;
}
#loading-overlay.hidden { opacity: 0; pointer-events: none; }

.loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border); border-top-color: var(--magenta);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-msg { font-family: var(--font-display); font-size: 1rem; color: var(--arena); }

.error-banner {
  background: #fff0f0; border: 1px solid var(--magenta);
  border-radius: var(--radius-md); padding: 20px 28px; max-width: 480px;
  text-align: center; display: none;
}
.error-banner.visible { display: block; }
.error-banner h3 { color: var(--magenta); font-family: var(--font-display); margin-bottom: 8px; }
.error-banner p { font-size: .85rem; color: var(--tinta); line-height: 1.6; }

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==============================================
   LIGHTBOX
   ============================================== */
.lightbox {
  position: fixed; inset: 0; background: rgba(26,16,24,.95); z-index: 3000;
  display: none; align-items: center; justify-content: center; flex-direction: column; gap: 14px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 88vw; max-height: 82vh; object-fit: contain; border-radius: var(--radius-sm); }

.lightbox-close {
  position: absolute; top: 18px; right: 18px; background: none;
  border: 1.5px solid rgba(255,248,245,.4); color: var(--crema);
  width: 38px; height: 38px; border-radius: 50%; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .2s, background .2s; font-family: var(--font-body);
}
.lightbox-close:hover { background: var(--magenta); border-color: var(--magenta); }

/* Botones anterior / siguiente en lightbox */
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255,248,245,.1); border: 1.5px solid rgba(255,248,245,.25);
  color: white; font-size: 30px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .2s; font-family: var(--font-body); padding: 0;
}
.lightbox-nav:hover { background: var(--magenta); border-color: var(--magenta); }
.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }

.lightbox-counter {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  color: rgba(255,248,245,.5); font-size: .75rem; font-family: var(--font-mono);
  letter-spacing: 1px;
}

/* ==============================================
   SCROLLBAR
   ============================================== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(26,16,24,.15); border-radius: 40px; }
::-webkit-scrollbar-thumb:hover { background: rgba(26,16,24,.3); }

.leaflet-container { background: #dcecf1; }

/* ==============================================
   LEAFLET CUSTOM
   ============================================== */
.leaflet-tooltip-atlas {
  background: var(--negro); color: var(--crema); border: none;
  box-shadow: var(--shadow-md); font-family: var(--font-body);
  font-size: 0.78rem; border-radius: var(--radius-sm); padding: 6px 12px;
}
.leaflet-tooltip-atlas b { color: var(--ocre); }
.leaflet-tooltip-atlas::before { display: none; }

/* ==============================================
   RESPONSIVE
   ============================================== */

/* V16 — tarjetas de panorama dentro de la introducción */
.atlas-intro-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 14px;
}
.atlas-intro-stat {
  min-width: 0;
  background: #fff;
  border: 1px solid rgba(181,5,82,.13);
  border-radius: 16px;
  padding: 14px 15px 13px;
  box-shadow: 0 8px 22px rgba(26,16,24,.08);
}
.atlas-intro-stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.75rem;
  line-height: 1;
  color: var(--magenta);
}
.atlas-intro-stat span {
  display: block;
  margin-top: 7px;
  color: var(--arena);
  font-size: .68rem;
  line-height: 1.35;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
}

@media (max-width: 960px) {
  #view-mapa.active {
    flex-direction: column;
    height: auto;
    min-height: 0;
  }
  .map-panel {
    order: 1;
    min-height: 70dvh;
    height: 70dvh;
    border-bottom: 2px solid var(--negro);
  }
  .side-panel {
    order: 2;
    width: 100%;
    min-height: 34vh;
    max-height: none;
    border-left: none;
  }
  .map-filter-sidebar {
    top: 12px; left: 12px; right: 12px; width: auto; max-height: calc(100% - 24px);
  }
  .states-list-wrap { max-height: 28vh; }
  .header-inner { padding: 10px 18px; }
  .header-stats { display: none; }
  .nav-tabs { padding: 0 16px; }
  .catalog-view { padding: 24px 20px; }
  .network-side-panel { width: calc(100% - 70px); left: 8px; right: auto; max-height: 60%; }
  .network-controls { top: 8px; right: 8px; left: auto; flex-direction: row; }
  .atlas-intro-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ==============================================
   BOTÓN "ACERCA DEL ATLAS" EN NAV
   ============================================== */
.nav-tab-report {
  margin-left: auto;
  color: var(--ocre) !important;
  border-bottom-color: transparent !important;
  opacity: 0.85;
}
.nav-tab-report:hover { opacity: 1; }

/* ==============================================
   DRAWER — REPORTE
   ============================================== */
.report-overlay {
  position: fixed; inset: 0;
  background: rgba(26,16,24,.55);
  z-index: 4000;
  opacity: 0; pointer-events: none;
  transition: opacity .3s ease;
  backdrop-filter: blur(2px);
}
.report-overlay.open { opacity: 1; pointer-events: all; }

.report-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(860px, 92vw);
  background: var(--bg-page);
  z-index: 4100;
  display: flex; flex-direction: column;
  box-shadow: -8px 0 40px rgba(26,16,24,.25);
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
}
.report-drawer.open { transform: translateX(0); }

.report-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px;
  background: var(--magenta);
  flex-shrink: 0;
}

.report-drawer-title {
  font-family: var(--font-display);
  font-size: 1rem; font-weight: 700;
  color: white; letter-spacing: 0.2px;
}

.report-drawer-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.15); border: none;
  color: white; font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s; font-family: var(--font-body);
  flex-shrink: 0;
}
.report-drawer-close:hover { background: rgba(255,255,255,.28); }

.report-drawer-body {
  flex: 1; overflow-y: auto;
  padding: 0;
}

/* ── Estilos del reporte DENTRO del drawer ── */
.report-drawer-body #progress-bar { display: none; } /* la barra de progreso del reporte no aplica */
.report-drawer-body nav { display: none; }           /* nav del reporte: ocultar, usamos el de la plataforma */

.report-drawer-body #intro {
  padding: 48px 40px 36px;
}

.report-drawer-body .report-wrap {
  padding: 0 40px 60px;
}

/* Reducir títulos un poco para el panel lateral */
.report-drawer-body .intro-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}
.report-drawer-body .section-title {
  font-size: clamp(1.3rem, 2.5vw, 1.9rem);
}

/* Nav interna del reporte — convertirla en tabs horizontales sticky dentro del drawer */
.report-drawer-body .report-internal-nav {
  position: sticky; top: 0; z-index: 10;
  background: var(--negro);
  display: flex; overflow-x: auto; gap: 2px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.report-drawer-body .report-internal-nav a {
  padding: 10px 18px;
  font-size: 0.78rem; font-weight: 500;
  color: rgba(255,248,245,.45);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all .2s; text-decoration: none;
  font-family: var(--font-body);
}
.report-drawer-body .report-internal-nav a:hover { color: rgba(255,248,245,.8); }
.report-drawer-body .report-internal-nav a.active { color: var(--ocre); border-bottom-color: var(--ocre); }

@media (max-width: 640px) {
  .report-drawer { width: 100vw; }
  .report-drawer-body #intro { padding: 36px 20px 24px; }
  .report-drawer-body .report-wrap { padding: 0 20px 48px; }
}

/* ==============================================
   BOTÓN NAV — ACERCA DEL ATLAS
   ============================================== */
.nav-tab-info {
  margin-left: 0;
  color: var(--ocre) !important;
  border-bottom-color: transparent !important;
}
.nav-tab-info:hover { color: white !important; }
.nav-tab-info-first { margin-left: auto; }

/* ==============================================
   OVERLAY + MODAL IFRAME
   ============================================== */
.info-overlay {
  position: fixed; inset: 0;
  background: rgba(26,16,24,.70);
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(3px);
}
.info-overlay.open { display: flex; }

.info-modal {
  position: relative;
  width: 100%; max-width: 1100px;
  height: 90vh;
  background: #FFF8F5;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(26,16,24,.35);
  animation: modalIn .28s cubic-bezier(.34,1.4,.64,1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(16px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}

.info-iframe {
  width: 100%; height: 100%;
  border: none; display: block;
}

.info-close {
  position: absolute; top: 14px; right: 14px;
  z-index: 10;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--magenta); border: none;
  color: white; font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(26,16,24,.3);
  transition: background .2s; font-family: var(--font-body);
}
.info-close:hover { background: #8a0340; }

/* ── Temporalidad badge en ficha ── */
.modal-temporalidad {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 3px;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .4px;
  color: white;
  margin: 4px 0 12px;
  text-transform: uppercase;
}

/* ── Párrafo en ficha (Historia y Origen) ── */
.ficha-parrafo {
  font-size: .9rem;
  line-height: 1.75;
  color: var(--tinta);
  max-width: 680px;
  margin: 0;
}

/* ── Chips de Significado ── */
.sig-tag {
  display: inline-block;
  padding: 5px 13px;
  border-radius: 4px;
  font-size: .8rem;
  line-height: 1.4;
  background: rgba(181,5,82,.07);
  color: var(--magenta);
  border: 1px solid rgba(181,5,82,.18);
  margin: 3px 3px 3px 0;
}

/* ==============================================
   BOTÓN NAV — CONTRIBUIR
   ============================================== */
.nav-tab-contribuir {
  color: var(--ocre) !important;
  border-bottom-color: transparent !important;
  font-weight: 700 !important;
}
.nav-tab-contribuir:hover { color: white !important; }
.nav-tab-contribuir.active {
  color: var(--ocre) !important;
  border-bottom-color: var(--ocre) !important;
}

/* ==============================================
   VIEW: CONTRIBUIR
   ============================================== */
.contribuir-view {
  max-width: 780px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}
.contribuir-header {
  margin-bottom: 36px;
}
.contribuir-header h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--negro);
  margin: 0 0 10px;
}
.contribuir-header p {
  font-size: .95rem;
  color: var(--arena);
  margin: 0;
  line-height: 1.6;
}
.contribuir-cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.contribuir-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--crema);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 24px;
  cursor: pointer;
  transition: box-shadow .18s, transform .18s, border-color .18s;
}
.contribuir-card:hover {
  box-shadow: 0 6px 28px rgba(26,16,24,.10);
  transform: translateY(-2px);
  border-color: var(--arena);
}
.contribuir-card-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  color: white;
  font-size: 1.4rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.contribuir-card-body { flex: 1; }
.contribuir-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--negro);
  margin-bottom: 4px;
}
.contribuir-card-desc {
  font-size: .86rem;
  color: var(--arena);
  line-height: 1.5;
}
.contribuir-card-arrow {
  font-size: 1.3rem;
  color: var(--arena);
  transition: transform .18s, color .18s;
}
.contribuir-card:hover .contribuir-card-arrow {
  transform: translateX(4px);
  color: var(--negro);
}

/* ==============================================
   VIEW: ÁRBOL DE CLASIFICACIÓN
   ============================================== */
.arbol-view {
  padding: 32px 28px 48px;
  max-width: 1260px;
  margin: 0 auto;
}
.arbol-header {
  margin-bottom: 26px;
}
.arbol-header h2 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--negro);
  margin: 0 0 8px;
}
.arbol-header p {
  font-size: .92rem;
  color: var(--arena);
  margin: 0;
  max-width: 72ch;
  line-height: 1.6;
}
.arbol-loading {
  color: var(--arena);
  font-size: .9rem;
  padding: 32px;
}
.arbol-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 920px) {
  .arbol-layout { grid-template-columns: 1fr; }
}
.arbol-tree {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.arbol-node {
  border: 1.5px solid var(--border);
  border-radius: 16px;
  background: white;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(26,16,24,.04);
}
.arbol-node[open] {
  border-color: color-mix(in srgb, var(--node-color, var(--magenta)) 18%, var(--border));
}
.arbol-node-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
  padding: 14px 16px;
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,1) 0%, rgba(250,247,245,1) 100%);
}
.arbol-node-summary::-webkit-details-marker { display: none; }
.arbol-node-summary::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--node-color, var(--magenta));
  flex-shrink: 0;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--node-color, var(--magenta)) 16%, white);
}
.arbol-node-summary::after {
  content: '▾';
  color: var(--arena);
  font-size: .9rem;
  margin-left: auto;
  transition: transform .16s ease;
}
.arbol-node:not([open]) .arbol-node-summary::after { transform: rotate(-90deg); }
.arbol-node-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.arbol-node-level {
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--arena);
  font-weight: 700;
}
.arbol-node-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--negro);
  line-height: 1.25;
}
.arbol-node-count {
  font-size: .78rem;
  font-weight: 700;
  color: white;
  background: var(--node-color, var(--magenta));
  border-radius: 999px;
  padding: 4px 10px;
  min-width: 36px;
  text-align: center;
  flex-shrink: 0;
}
.arbol-node-children {
  padding: 0 14px 14px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid rgba(26,16,24,.05);
}
.arbol-level-1 > .arbol-node-summary { background: linear-gradient(180deg, rgba(255,249,252,1) 0%, rgba(250,247,245,1) 100%); }
.arbol-level-2 { margin-left: 18px; }
.arbol-level-3 { margin-left: 36px; }
.arbol-level-4 { margin-left: 54px; }
.arbol-leaf {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--crema);
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: transform .12s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
  text-align: left;
}
.arbol-leaf:hover {
  background: white;
  border-color: var(--leaf-color, var(--magenta));
  transform: translateX(2px);
  box-shadow: 0 5px 14px rgba(26,16,24,.06);
}
.arbol-leaf.active {
  border-color: var(--leaf-color, var(--magenta));
  background: white;
  box-shadow: 0 8px 18px rgba(26,16,24,.09);
}
.arbol-leaf-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.arbol-leaf-eyebrow {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--arena);
  font-weight: 700;
}
.arbol-leaf-name {
  font-size: .92rem;
  font-weight: 700;
  color: var(--negro);
  line-height: 1.28;
}
.arbol-leaf.active .arbol-leaf-name {
  color: var(--leaf-color, var(--magenta));
}
.arbol-leaf-count {
  font-size: .76rem;
  font-weight: 700;
  background: var(--leaf-color, var(--magenta));
  color: white;
  border-radius: 999px;
  padding: 4px 10px;
  min-width: 34px;
  text-align: center;
  flex-shrink: 0;
}
.arbol-panel {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  position: sticky;
  top: 72px;
  box-shadow: 0 8px 26px rgba(26,16,24,.05);
}
.arbol-panel-empty {
  padding: 28px 22px;
  color: var(--arena);
  font-size: .9rem;
  line-height: 1.7;
}
.arbol-panel-empty p { margin: 0 0 10px; }
.arbol-panel-header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: start;
  padding: 16px 18px 12px;
  border-left: 4px solid var(--magenta);
  background: linear-gradient(180deg, rgba(255,255,255,1) 0%, rgba(250,247,245,1) 100%);
}
.arbol-panel-path {
  font-size: .72rem;
  color: var(--arena);
  margin-bottom: 4px;
  line-height: 1.5;
}
.arbol-panel-title {
  font-size: 1rem;
  font-weight: 800;
  display: block;
}
.arbol-panel-count {
  font-size: .75rem;
  color: var(--arena);
  white-space: nowrap;
  align-self: center;
}
.arbol-panel-close {
  background: none;
  border: none;
  color: var(--arena);
  font-size: .9rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.arbol-panel-close:hover { background: var(--border); color: var(--negro); }
.arbol-panel-note {
  font-size: .78rem;
  color: var(--arena);
  padding: 10px 18px 0;
  line-height: 1.6;
}
.arbol-panel-list {
  max-height: 62vh;
  overflow-y: auto;
  padding: 12px 10px 16px;
}
.arbol-tec-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: .88rem;
  color: var(--negro);
  transition: background .12s;
}
.arbol-tec-item:hover { background: rgba(26,16,24,.05); }
.arbol-tec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
@media (max-width: 720px) {
  .arbol-view { padding: 24px 18px 36px; }
  .arbol-level-2, .arbol-level-3, .arbol-level-4 { margin-left: 0; }
  .arbol-node-children { padding-left: 14px; }
}

/* ════════════════════════════════════════════════
   MAP FILTER — SIDEBAR FIJO (columna izquierda)
   ════════════════════════════════════════════════ */

/* Panel flotante de filtros sobre el mapa */
.map-filter-sidebar {
  position: absolute;
  top: 14px;
  left: 14px;
  width: min(340px, calc(100% - 28px));
  max-height: calc(100% - 28px);
  z-index: 780;
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.map-filter-panel {
  background: transparent;
  padding: 14px 14px 16px;
  overflow-y: auto;
  flex: 1;
  display: flex; flex-direction: column; gap: 0;
}

.map-filter-sidebar.mobile-collapsed {
  max-height: none;
}
.map-filter-sidebar.mobile-collapsed .map-filter-body {
  display: none;
}


.map-filter-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; flex-shrink: 0;
}
.map-filter-title {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--arena);
}
.map-filter-clear {
  font-size: .68rem; color: var(--magenta); background: none; border: none;
  cursor: pointer; font-family: var(--font-body); font-weight: 600;
  padding: 2px 6px; border-radius: 3px;
  transition: background .15s;
}
.map-filter-clear:hover { background: rgba(181,5,82,.08); }

.map-filter-actions { display:flex; align-items:center; gap: 8px; }
.map-filter-mobile-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; flex: 0 0 32px;
  font-size: 1rem; line-height: 1; color: var(--negro); background: white;
  border: 1px solid var(--border); cursor: pointer; font-family: var(--font-body); font-weight: 700;
  border-radius: 50%; transition: all .15s;
}
.map-filter-mobile-toggle:hover { border-color: var(--magenta); color: var(--magenta); }
.map-filter-body { display: flex; flex-direction: column; gap: 0; }


.map-filter-levels { display: flex; flex-direction: column; gap: 12px; }

.map-filter-level { display: flex; flex-direction: column; gap: 5px; }
.map-filter-level-label {
  font-size: .62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--arena);
}

/* Search box in filter */
.map-filter-search {
  width: 100%; padding: 7px 12px; border-radius: 6px;
  border: 1.5px solid var(--border); font-size: .78rem;
  background: var(--bg-page); font-family: var(--font-body);
  color: var(--negro); outline: none; transition: border .18s;
  box-sizing: border-box;
}
.map-filter-search:focus { border-color: var(--azul-mar); }
.map-filter-search::placeholder { color: var(--arena); }

/* Autocomplete dropdown */
.map-filter-autocomplete {
  position: absolute; z-index: 900;
  background: white; border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow-md);
  width: 100%; max-height: 220px; overflow-y: auto;
  display: none;
}
.map-filter-level { position: relative; }
.map-ac-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; cursor: pointer; font-size: .78rem;
  transition: background .12s;
}
.map-ac-item:hover { background: rgba(181,5,82,.05); }
.map-ac-name { flex: 1; color: var(--negro); font-weight: 500; }
.map-ac-cat { font-size: .65rem; font-weight: 700; }

/* Chips */
.map-filter-chips {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.map-chip {
  padding: 4px 10px; border-radius: 20px; font-size: .72rem;
  font-weight: 500; cursor: pointer; border: 1.5px solid var(--chip-color, var(--border));
  color: var(--chip-color, var(--arena)); background: white;
  font-family: var(--font-body); transition: all .15s; line-height: 1.3;
}
.map-chip:hover { background: color-mix(in srgb, var(--chip-color, var(--arena)) 10%, white); }
.map-chip.active {
  background: var(--chip-color, var(--arena)); color: white;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--chip-color, var(--arena)) 40%, transparent);
}
.map-chip-tec { font-size: .68rem; padding: 3px 8px; }

/* Active filter badge */
.map-filter-active {
  margin-top: 10px; padding: 6px 10px; border-radius: 6px;
  background: rgba(181,5,82,.07); font-size: .72rem;
  color: var(--magenta); font-weight: 600; line-height: 1.4;
  flex-shrink: 0;
}


/* ════════════════════════════════════════════════
   REPORTE — Constructor de reportes personalizados
   Wizard de 3 pasos con stepper visual.
   ════════════════════════════════════════════════ */
.reporte-view {
  max-width: 1100px; margin: 0 auto;
  padding: 36px 32px 60px;
  display: flex; flex-direction: column; gap: 28px;
}

.reporte-header h2 {
  font-family: var(--font-display); font-size: 1.7rem; font-weight: 800;
  color: var(--negro); line-height: 1.15; margin-bottom: 8px;
}
.reporte-header h2 em { color: var(--magenta); font-style: italic; }
.reporte-header p {
  font-size: 0.88rem; color: var(--arena); max-width: 720px; line-height: 1.55;
}

/* ─── Stepper ─── */
.reporte-stepper {
  display: flex; gap: 6px; list-style: none;
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px;
  box-shadow: var(--shadow-sm);
}
.reporte-step {
  flex: 1; display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius-md);
  cursor: pointer; transition: background .15s;
  border: 1.5px solid transparent;
  position: relative;
}
.reporte-step:hover { background: var(--bg-page); }
.reporte-step.active {
  background: rgba(181,5,82,.06);
  border-color: var(--magenta);
}
.reporte-step.done {
  background: rgba(5,183,148,.06);
}
.reporte-step-num {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--border); color: var(--negro);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 0.95rem;
  flex-shrink: 0; transition: all .2s;
}
.reporte-step.active .reporte-step-num {
  background: var(--magenta); color: white;
}
.reporte-step.done .reporte-step-num {
  background: var(--verde); color: white;
}
.reporte-step.done .reporte-step-num::before {
  content: '✓';
}
.reporte-step.done .reporte-step-num {
  font-size: 0;
}
.reporte-step.done .reporte-step-num::before { font-size: 1rem; }
.reporte-step-label {
  font-family: var(--font-display); font-weight: 700; font-size: 0.95rem;
  color: var(--negro); line-height: 1.1;
}
.reporte-step-desc {
  font-size: 0.7rem; color: var(--arena);
  margin-top: 2px; display: block;
  font-family: var(--font-body);
}
.reporte-step-label, .reporte-step-desc {
  display: block;
}
.reporte-step > span:not(.reporte-step-num) {
  display: flex; flex-direction: column;
}

/* ─── Cuerpo del wizard ─── */
.reporte-body {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-height: 380px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.reporte-panel {
  display: none;
  padding: 36px 40px;
  animation: reporte-fade .25s ease;
}
.reporte-panel.active { display: block; }
@keyframes reporte-fade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.reporte-panel-placeholder {
  text-align: center;
  padding: 60px 20px;
  color: var(--arena);
}
.reporte-panel-placeholder h3 {
  font-family: var(--font-display); font-size: 1.2rem;
  color: var(--negro); margin-bottom: 12px; font-weight: 700;
}
.reporte-panel-placeholder p {
  font-size: 0.88rem; line-height: 1.6;
  max-width: 520px; margin: 0 auto 8px;
}
.reporte-placeholder-note {
  margin-top: 18px !important;
  display: inline-block;
  background: rgba(252,188,82,.16);
  color: #8B6914;
  padding: 6px 14px; border-radius: 20px;
  font-size: 0.78rem !important; font-weight: 600;
}

/* ─── Botones de navegación ─── */
.reporte-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.reporte-progress {
  font-family: var(--font-mono); font-size: 0.75rem;
  color: var(--arena); letter-spacing: 0.5px;
  text-transform: uppercase;
}
.reporte-btn {
  padding: 11px 22px; border-radius: 30px;
  font-family: var(--font-body); font-size: 0.85rem; font-weight: 600;
  border: 1.5px solid var(--border); background: white;
  color: var(--negro); cursor: pointer;
  transition: all .15s ease;
}
.reporte-btn:hover:not(:disabled) {
  border-color: var(--negro);
  transform: translateY(-1px);
}
.reporte-btn:disabled {
  opacity: 0.4; cursor: not-allowed;
}
.reporte-btn-primary {
  background: var(--magenta); color: white; border-color: var(--magenta);
}
.reporte-btn-primary:hover:not(:disabled) {
  background: #9B0445; border-color: #9B0445;
}

/* ─── Responsive ─── */
@media (max-width: 800px) {
  .reporte-view { padding: 24px 20px; }
  .reporte-stepper { flex-direction: column; gap: 4px; padding: 8px; }
  .reporte-step { padding: 12px; }
  .reporte-panel { padding: 24px 18px; }
  .reporte-nav { flex-wrap: wrap; }
}

/* ════════════════════════════════════════════════
   REPORTE — Paso 1: Selección
   ════════════════════════════════════════════════ */

/* Metadata: título y autor */
.reporte-meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  margin-bottom: 24px;
}
.reporte-field {
  display: flex; flex-direction: column; gap: 6px;
}
.reporte-field label {
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--arena);
}
.reporte-field input {
  padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-md); font-size: 0.88rem;
  font-family: var(--font-body); color: var(--negro);
  background: white; outline: none;
  transition: border-color .15s;
}
.reporte-field input:focus { border-color: var(--magenta); }

/* Presets de selección rápida */
.reporte-presets {
  display: flex; flex-wrap: wrap; gap: 6px;
  align-items: center;
  margin-bottom: 22px;
  padding: 12px 14px;
  background: var(--bg-page);
  border-radius: var(--radius-md);
}
.reporte-presets-label {
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--arena); margin-right: 4px;
}
.reporte-preset {
  padding: 5px 12px; border-radius: 14px;
  border: 1.5px solid var(--border);
  background: white; color: var(--negro);
  font-family: var(--font-body); font-size: 0.74rem;
  font-weight: 600; cursor: pointer;
  transition: all .15s ease;
}
.reporte-preset:hover {
  border-color: var(--magenta); color: var(--magenta);
}
.reporte-preset-clear {
  margin-left: auto;
  border-color: transparent;
  color: var(--arena);
}
.reporte-preset-clear:hover {
  background: rgba(255,0,0,.06);
  border-color: rgba(255,0,0,.2);
  color: #B0181E;
}

/* Bloques de filtros */
.reporte-filtros {
  display: flex; flex-direction: column; gap: 22px;
  margin-bottom: 28px;
}
.reporte-filter-block {
  background: var(--bg-page);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.reporte-filter-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 10px;
}
.reporte-filter-head h4 {
  font-family: var(--font-display); font-size: 0.95rem;
  font-weight: 700; color: var(--negro);
}
.reporte-filter-hint {
  font-size: 0.68rem; color: var(--arena);
  font-family: var(--font-mono); letter-spacing: 0.3px;
}
.reporte-chips {
  display: flex; flex-wrap: wrap; gap: 5px;
  max-height: 180px; overflow-y: auto;
  padding-right: 4px;
}

/* Chips */
.reporte-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 14px;
  border: 1.5px solid var(--chip-color, var(--border));
  background: white; cursor: pointer;
  font-family: var(--font-body); font-size: 0.74rem;
  font-weight: 500; color: var(--negro);
  transition: all .12s ease;
  white-space: nowrap;
}
.reporte-chip:hover {
  background: var(--chip-color, var(--negro));
  color: white; transform: translateY(-1px);
}
.reporte-chip.active {
  background: var(--chip-color, var(--magenta));
  color: white; border-color: var(--chip-color, var(--magenta));
}
.reporte-chip-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--chip-color, var(--arena));
  flex-shrink: 0;
}
.reporte-chip.active .reporte-chip-dot { background: white; }
.reporte-chip-cat1 { font-weight: 700; }
.reporte-chip-cat2 {
  font-size: 0.7rem;
  background: white;
  border-style: dashed;
  border-width: 1.2px;
}
.reporte-chip-cat2.active {
  border-style: solid;
  border-width: 1.5px;
}
.reporte-chip-arrow {
  color: var(--arena); font-size: 0.85rem;
  margin-right: -2px;
}
.reporte-chip.active .reporte-chip-arrow { color: white; }
.reporte-chip-count {
  font-size: 0.66rem; opacity: 0.65;
  font-weight: 600; margin-left: 3px;
}
.reporte-chip.active .reporte-chip-count { opacity: 0.95; }
.reporte-chip-x {
  margin-left: 4px; font-size: 0.95rem;
  font-weight: 700; line-height: 1;
}

/* Buscador de técnicas */
.reporte-search-wrap {
  position: relative; margin-bottom: 8px;
}
.reporte-search-wrap input {
  width: 100%; box-sizing: border-box;
  padding: 8px 14px; border-radius: 30px;
  border: 1.5px solid var(--border);
  font-family: var(--font-body); font-size: 0.82rem;
  background: white; outline: none;
  transition: border-color .15s;
}
.reporte-search-wrap input:focus { border-color: var(--magenta); }
.reporte-search-ac {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  z-index: 100; display: none;
  max-height: 280px; overflow-y: auto;
}
.reporte-ac-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem; transition: background .12s;
}
.reporte-ac-item:last-child { border-bottom: none; }
.reporte-ac-item:hover { background: rgba(181,5,82,.04); }
.reporte-ac-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.reporte-ac-name { flex: 1; color: var(--negro); font-weight: 500; }
.reporte-ac-cat {
  font-size: 0.68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--arena);
}

/* Contador en vivo */
.reporte-counter {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 18px;
  background: linear-gradient(135deg, var(--magenta) 0%, #8B0440 100%);
  border-radius: var(--radius-md);
  color: white;
}
.reporte-counter-num {
  text-align: center;
  position: relative;
}
.reporte-counter-num span {
  font-family: var(--font-display); font-size: 2rem;
  font-weight: 900; line-height: 1; display: block;
  color: var(--ocre);
}
.reporte-counter-num::after {
  content: attr(data-label);
  display: block; margin-top: 4px;
  font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px;
  opacity: 0.85;
}
.reporte-counter-num:nth-child(1)::after { content: 'Técnicas'; }
.reporte-counter-num:nth-child(2)::after { content: 'Estados'; }
.reporte-counter-num:nth-child(3)::after { content: 'Registros'; }

/* ════════════════════════════════════════════════
   REPORTE — Paso 2: Secciones del documento
   ════════════════════════════════════════════════ */
.reporte-panel-intro {
  margin-bottom: 22px;
}
.reporte-panel-intro h3 {
  font-family: var(--font-display); font-size: 1.1rem;
  font-weight: 700; color: var(--negro); margin-bottom: 6px;
}
.reporte-panel-intro p {
  font-size: 0.84rem; color: var(--arena); line-height: 1.55;
}

.reporte-secciones {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; margin-bottom: 22px;
}
.reporte-seccion-card {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  background: var(--bg-page);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer; transition: all .15s ease;
  position: relative;
}
.reporte-seccion-card:hover { border-color: var(--negro); }
.reporte-seccion-card.selected {
  background: rgba(181,5,82,.05);
  border-color: var(--magenta);
}
.reporte-seccion-card input {
  position: absolute; opacity: 0; pointer-events: none;
}
.reporte-seccion-icon {
  font-size: 1.4rem; line-height: 1;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: white; border-radius: 8px;
  color: var(--magenta); flex-shrink: 0;
  border: 1px solid var(--border);
}
.reporte-seccion-card.selected .reporte-seccion-icon {
  background: var(--magenta); color: white;
  border-color: var(--magenta);
}
.reporte-seccion-text { flex: 1; min-width: 0; }
.reporte-seccion-label {
  font-family: var(--font-display); font-weight: 700;
  font-size: 0.92rem; color: var(--negro); line-height: 1.2;
  margin-bottom: 4px;
}
.reporte-seccion-desc {
  font-size: 0.74rem; color: var(--arena); line-height: 1.5;
}
.reporte-seccion-check {
  position: absolute; top: 12px; right: 12px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--magenta); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.75rem;
  opacity: 0; transition: opacity .15s;
}
.reporte-seccion-card.selected .reporte-seccion-check { opacity: 1; }

.reporte-seccion-acciones {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.78rem; color: var(--arena);
}
.reporte-btn-link {
  background: none; border: none; padding: 0;
  font-family: var(--font-body); font-size: 0.78rem;
  font-weight: 600; color: var(--magenta);
  cursor: pointer; text-decoration: underline;
  text-decoration-color: rgba(181,5,82,.3);
  text-underline-offset: 3px;
  transition: text-decoration-color .15s;
}
.reporte-btn-link:hover { text-decoration-color: var(--magenta); }
.reporte-sep { color: var(--border); }

/* Responsive */
@media (max-width: 800px) {
  .reporte-meta { grid-template-columns: 1fr; }
  .reporte-secciones { grid-template-columns: 1fr; }
  .reporte-counter { grid-template-columns: 1fr; gap: 10px; padding: 14px; }
  .reporte-counter-num span { font-size: 1.6rem; }
}

/* ════════════════════════════════════════════════
   REPORTE — Paso 3: Vista previa y descarga
   ════════════════════════════════════════════════ */
.reporte-paso3-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 14px 18px;
  background: var(--bg-page);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}
.reporte-paso3-info h3 {
  font-family: var(--font-display); font-size: 1.05rem;
  font-weight: 700; color: var(--negro); line-height: 1.2;
}
.reporte-paso3-info p {
  font-size: 0.78rem; color: var(--arena);
  font-family: var(--font-mono); margin-top: 4px;
}
.reporte-paso3-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.reporte-paso3-actions .reporte-btn { padding: 9px 18px; font-size: 0.82rem; }

.reporte-preview-frame {
  background: #f5f3f0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-height: 75vh;
  overflow-y: auto;
  padding: 30px;
}
.reporte-preview-empty {
  padding: 80px 20px; text-align: center;
  color: var(--arena); font-size: 0.9rem;
}

/* ════════════════════════════════════════════════
   DOCUMENTO RENDERIZADO — estilos del PDF/HTML del reporte
   Estos selectores se aplican tanto en la vista previa
   como en el PDF generado (html2pdf usa el mismo DOM).
   ════════════════════════════════════════════════ */
.rep-doc {
  background: white;
  max-width: 800px; margin: 0 auto;
  padding: 0;
  font-family: 'Lora', 'DM Sans', Georgia, serif;
  color: #1A1018;
  line-height: 1.55;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
}
.rep-doc * { box-sizing: border-box; }

/* Portada */
.rep-cover {
  padding: 80px 60px 60px;
  text-align: center;
  border-bottom: 6px solid #B50552;
  page-break-after: always;
  display: flex; flex-direction: column; align-items: center;
  min-height: 90vh;
  justify-content: center;
}
.rep-cover-logos {
  background: #1A1018;
  padding: 14px 22px;
  border-radius: 10px;
  margin-bottom: 50px;
  display: inline-block;
}
.rep-cover-logos img {
  height: 44px; width: auto; display: block;
}
.rep-cover-eyebrow {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 2.5px;
  color: #B50552; margin-bottom: 16px;
}
.rep-cover-title {
  font-family: 'Fraunces', 'Lora', Georgia, serif;
  font-size: 2.4rem; font-weight: 800;
  color: #1A1018; line-height: 1.1;
  margin-bottom: 18px;
  max-width: 600px;
}
.rep-cover-subtitle {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.92rem; color: #6B5D62;
  margin-bottom: 50px;
  max-width: 520px; line-height: 1.5;
}
.rep-cover-stats {
  display: flex; justify-content: center; gap: 50px;
  margin-bottom: 40px;
  padding: 28px 40px;
  background: #FFF8F5;
  border-radius: 8px;
}
.rep-stat-num {
  font-family: 'Fraunces', serif; font-size: 2.4rem;
  font-weight: 900; color: #B50552; line-height: 1;
}
.rep-stat-lbl {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: #6B5D62; margin-top: 6px;
}
.rep-cover-meta {
  display: flex; flex-direction: column; gap: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem; color: #1A1018;
  margin-top: 30px;
}
.rep-cover-meta div span {
  display: inline-block;
  font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.4px;
  color: #6B5D62; margin-right: 10px;
}

/* Secciones */
.rep-section {
  padding: 50px 60px;
  page-break-inside: auto;
}
.rep-section + .rep-section {
  border-top: 1px solid #EDE7E0;
}
.rep-section-head {
  display: flex; align-items: baseline; gap: 16px;
  margin-bottom: 26px;
  padding-bottom: 14px;
  border-bottom: 2px solid #1A1018;
}
.rep-section-num {
  font-family: 'Fraunces', serif; font-size: 1.6rem;
  font-weight: 900; color: #B50552; line-height: 1;
}
.rep-section-head h2 {
  font-family: 'Fraunces', serif; font-size: 1.6rem;
  font-weight: 800; color: #1A1018; line-height: 1.1;
}
.rep-lead {
  font-size: 1rem; line-height: 1.65;
  margin-bottom: 24px; color: #1A1018;
}
.rep-prose {
  font-size: 0.92rem; line-height: 1.65;
  margin-bottom: 18px; color: #1A1018;
}

/* Tarjetas de estadísticas */
.rep-stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 14px; margin: 20px 0;
}
.rep-stat-card {
  background: #FFF8F5;
  border-left: 4px solid #B50552;
  padding: 18px 20px;
  border-radius: 0 6px 6px 0;
}
.rep-stat-card-num {
  font-family: 'Fraunces', serif; font-size: 1.9rem;
  font-weight: 900; color: #B50552; line-height: 1;
  margin-bottom: 6px;
}
.rep-stat-card-lbl {
  font-family: 'DM Sans', sans-serif; font-size: 0.78rem;
  color: #1A1018; line-height: 1.4;
}
.rep-stat-card-lbl em { font-style: italic; color: #6B5D62; }

/* Tablas */
.rep-table {
  width: 100%; border-collapse: collapse;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  margin: 12px 0 20px;
}
.rep-table th, .rep-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #EDE7E0;
}
.rep-table th {
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: #6B5D62;
  border-bottom: 2px solid #1A1018;
}
.rep-table td.num { font-family: 'Space Mono', monospace; font-size: 0.78rem; }
.rep-bar-cell {
  position: relative; width: 100%; height: 18px;
  background: #F5F0EC; border-radius: 3px;
  overflow: hidden;
}
.rep-bar-fill {
  position: absolute; top: 0; left: 0; height: 100%;
  background: linear-gradient(90deg, #B50552, #FB4801);
  border-radius: 3px;
}
.rep-bar-cell span {
  position: absolute; right: 6px; top: 0;
  height: 18px; line-height: 18px;
  font-size: 0.7rem; font-weight: 600;
  color: #1A1018;
}

/* Catálogo de tarjetas */
.rep-cards {
  display: grid; grid-template-columns: 1fr;
  gap: 14px; margin: 14px 0 24px;
}
.rep-cat-divider {
  margin: 24px 0 12px;
  padding: 8px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 2px;
  border-left: 4px solid;
  background: #FFF8F5;
}
.rep-card {
  border: 1px solid #EDE7E0;
  border-radius: 6px;
  background: white;
  padding: 14px 18px;
  page-break-inside: avoid;
}
.rep-card-body {
  display: flex; flex-direction: column; gap: 6px;
}
.rep-card-breadcrumb {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.66rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: #6B5D62;
}
.rep-card-title {
  font-family: 'Fraunces', serif;
  font-size: 1.05rem; font-weight: 700;
  color: #1A1018; line-height: 1.2;
}
.rep-card-meta {
  display: flex; flex-wrap: wrap; gap: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem; color: #1A1018;
  margin-top: 2px;
}
.rep-card-meta strong { color: #B50552; }
.rep-card-tag {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem;
  padding: 3px 8px; border-radius: 3px;
  display: inline-block;
  margin-top: 2px;
}
.rep-card-tag-lengua { background: rgba(3,90,121,0.08); color: #035A79; }
.rep-card-tag-mat { background: rgba(200,147,42,0.08); color: #8B6914; }

/* Charts */
.rep-charts-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 24px; margin: 16px 0 8px;
}
.rep-chart-wrap {
  background: #FAFAFA;
  border-radius: 6px;
  padding: 14px 14px 18px;
  page-break-inside: avoid;
}
.rep-chart-wrap h4 {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: #6B5D62; margin-bottom: 10px;
}
.rep-chart-canvas-wrap {
  position: relative; height: 220px;
}
.rep-chart-tall { height: 320px; }

/* Testimonios */
.rep-testimonios {
  display: flex; flex-direction: column; gap: 12px;
}
.rep-testim {
  background: #FFF8F5;
  border-left: 3px solid #B50552;
  padding: 12px 18px;
  border-radius: 0 4px 4px 0;
  page-break-inside: avoid;
  margin: 0;
}
.rep-testim p {
  font-family: 'Lora', Georgia, serif;
  font-style: italic;
  font-size: 0.92rem; line-height: 1.55;
  color: #1A1018; margin: 0 0 6px;
}
.rep-testim cite {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.74rem; font-weight: 700;
  font-style: normal;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: #B50552;
}

/* Pie del documento */
.rep-footer {
  padding: 30px 60px 50px;
  text-align: center;
}
.rep-footer-line {
  width: 100px; height: 3px;
  background: #B50552;
  margin: 0 auto 18px;
}
.rep-footer p {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.74rem; line-height: 1.6;
  color: #6B5D62;
}

/* Page breaks para PDF */
@media print {
  .rep-doc { box-shadow: none; }
  .rep-section { page-break-before: auto; }
  .rep-card, .rep-testim, .rep-chart-wrap { page-break-inside: avoid; }
}

/* Responsive vista previa */
@media (max-width: 900px) {
  .reporte-preview-frame { padding: 14px; }
  .rep-cover, .rep-section { padding-left: 24px; padding-right: 24px; }
  .rep-stat-grid { grid-template-columns: 1fr; }
  .rep-charts-grid { grid-template-columns: 1fr; }
  .rep-cards { grid-template-columns: 1fr; }
}

/* ==============================================================
   ADAPTACIÓN MÓVIL — ajustes adicionales
   No modifica funcionalidad ni contenido: sólo tamaños, espaciados
   y comportamiento táctil para que la plataforma sea completamente
   usable en teléfonos y tablets.
   ============================================================== */

/* Evita que iOS Safari haga zoom automático al enfocar un campo de
   texto: cualquier <input>/<textarea> con font-size menor a 16px
   dispara ese comportamiento. Se homologa a 16px sólo en pantallas
   táctiles/angostas para no alterar la densidad visual en escritorio. */
@media (max-width: 900px) {
  .map-filter-search,
  .catalog-search,
  .network-search-input,
  .reporte-field input,
  .reporte-search-wrap input,
  #reporte-search-tec {
    font-size: 16px;
  }
}

/* ── Header: evita que se rompa a varias líneas en teléfonos ── */
@media (max-width: 640px) {
  .header-inner { padding: 8px 14px 10px; gap: 8px; flex-direction: column; align-items: center; text-align: center; }
  .header-wordmark { order: 2; width: 100%; align-items: center; }
  .header-wordmark h1 { font-size: 1.08rem; text-align: center; }
  .header-divider { display: none; }
  .header-logos { order: 1; margin-left: 0; justify-content: center; width: 100%; }
  .header-logos img { height: 34px; }
  .nav-tabs { padding: 0 10px; }
  .nav-tab { padding: 10px 12px; font-size: 0.74rem; }
}

@media (max-width: 400px) {
  .header-wordmark h1 { font-size: .97rem; }
  .header-logos img { height: 30px; }
}

/* ── Mapa: sidebar de filtros y panel lateral más compactos ── */
@media (max-width: 640px) {
  .map-filter-sidebar { top: 10px; left: 10px; right: 10px; width: auto; border-radius: 16px; }
  .map-panel { min-height: 74dvh; height: 74dvh; }
  .side-panel { min-height: 28vh; }
  .map-legend { padding: 10px 14px; font-size: 0.7rem; max-width: calc(100% - 20px); left: 10px; bottom: 10px; }
  .map-search-wrap { width: calc(100% - 32px); }
  .panel-header { padding: 14px 16px 12px; }
  .panel-body { padding: 14px 14px 18px; }
  .map-filter-panel { padding: 12px; }
  .map-filter-mobile-toggle { font-size: .7rem; }
}

/* ── Red de técnicas: panel flotante no debe tapar el lienzo ── */
@media (max-width: 640px) {
  .network-side-panel { width: calc(100% - 24px); max-height: 46%; }
  .network-controls { flex-direction: row; gap: 8px; }
}

/* ── Catálogo: tarjetas más angostas en teléfonos pequeños ── */
@media (max-width: 480px) {
  .catalog-view { padding: 20px 14px; }
  .tecnicas-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .tec-card-img { height: 120px; }
}

/* ── Modales e iframes (Acerca del Atlas, Kobo, manuales): a pantalla
   completa en teléfonos para aprovechar todo el espacio disponible ── */
@media (max-width: 640px) {
  .info-overlay { padding: 0; }
  .info-modal { height: 100%; height: 100dvh; max-width: 100%; border-radius: 0; }
  .modal-overlay { padding: 0; align-items: stretch; }
  .modal-card { max-width: 100%; min-height: 100%; border-radius: 0; margin: 0; }
  .modal-hero { height: 220px; }
}

/* ── Lightbox: controles más pequeños y a los bordes ── */
@media (max-width: 480px) {
  .lightbox-nav { width: 38px; height: 38px; font-size: 24px; }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
  .lightbox-close { top: 10px; right: 10px; }
}

/* ── Reporte: portada y tablas no deben desbordar horizontalmente ── */
@media (max-width: 640px) {
  .rep-cover-stats { flex-wrap: wrap; gap: 24px; padding: 20px; }
  .rep-cover-title { font-size: 1.6rem; }
  .rep-section { padding: 32px 20px; }
  .reporte-preview-frame { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .rep-table { min-width: 480px; }
}

/* ── Contribuir: encabezado un poco más compacto ── */
@media (max-width: 480px) {
  .contribuir-header h2 { font-size: 1.5rem; }
  .contribuir-view { padding: 32px 16px 48px; }
  .contribuir-card { padding: 16px 16px; gap: 14px; }
}

/* ── Objetivos táctiles: chips y botones pequeños ganan área de toque
   sin cambiar su tamaño visual, usando un padding invisible ── */
@media (max-width: 640px) {
  .state-item, .reporte-chip, .network-sublayer-chip, .map-chip {
    min-height: 30px;
  }
  .nav-tab, .filter-btn, .reporte-btn, .carousel-btn, .net-ctrl-btn {
    min-height: 40px;
  }
}

/* ════════════════════════════════════════════════
   MAPA — DRIVERS TERRITORIALES
   Estado · Lengua · Ecosistema
   ════════════════════════════════════════════════ */
.map-driver-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 9px;
  flex-shrink: 0;
}
.map-driver-btn,
.ecosystem-source-btn {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--arena);
  padding: 7px 5px;
  font-family: var(--font-body);
  font-size: .68rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.map-driver-btn:hover,
.ecosystem-source-btn:hover { color: var(--magenta); }
.map-driver-btn.active,
.ecosystem-source-btn.active {
  background: white;
  color: var(--magenta);
  box-shadow: var(--shadow-sm);
}
.map-driver-btn:disabled,
.ecosystem-source-btn:disabled {
  cursor: not-allowed;
  opacity: .42;
}
.map-driver-filter { display: none; min-height: 0; }
.map-driver-filter.active { display: block; }
.map-driver-note {
  padding: 9px 10px;
  border-left: 3px solid var(--azul-mar);
  border-radius: 4px;
  background: rgba(30, 111, 127, .07);
  color: var(--arena);
  font-size: .69rem;
  line-height: 1.45;
}
.map-driver-note.warning {
  border-left-color: var(--ocre);
  background: rgba(252, 188, 82, .12);
  color: var(--negro);
}
.map-driver-scroll-chips {
  max-height: 31vh;
  overflow-y: auto;
  align-content: flex-start;
  padding-right: 4px;
}
.ecosystem-source-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-page);
}
.map-driver-status {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 650;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 18px;
  background: var(--negro);
  color: var(--crema);
  font-size: .72rem;
  box-shadow: var(--shadow-md);
  pointer-events: none;
}
.map-driver-status.visible { display: flex; }
.map-driver-status::before {
  content: '';
  width: 11px;
  height: 11px;
  border: 2px solid rgba(255,255,255,.45);
  border-top-color: var(--ocre);
  border-radius: 50%;
  animation: spinner .7s linear infinite;
}
.map-legend-note {
  color: rgba(255,248,245,.62);
  line-height: 1.4;
  max-width: 220px;
}
.legend-circle {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--magenta);
  border: 1.5px solid white;
}
.state-item .state-meta {
  font-size: .61rem;
  opacity: .58;
  font-weight: 500;
}
.state-item.driver-unavailable {
  opacity: .48;
  border-style: dashed;
}

/* Evita que los polígonos de contexto reciban un énfasis visual excesivo
   mientras se exploran puntos lingüísticos o regiones ecológicas. */
.map-driver-context .leaflet-interactive { transition: fill-opacity .15s ease; }

@media (max-width: 960px) {
  .map-driver-scroll-chips { max-height: 20vh; }
}

@media (max-width: 640px) {
  .map-driver-switch { position: sticky; top: 0; z-index: 2; }
  .map-driver-btn { font-size: .64rem; }
  .map-driver-status { top: 8px; max-width: calc(100% - 28px); }
}

/* Driver Lengua: la selección vive en la barra izquierda y el panel derecho
   queda reservado para los resultados de la lengua activa. */
.side-panel.driver-language .states-list-wrap {
  display: none;
}

/* Lectura territorial de las localidades como concentración continua. */
.legend-language-area {
  width: 20px;
  height: 11px;
  flex-shrink: 0;
  border-radius: 999px;
  background: rgba(181, 5, 82, .42);
  box-shadow: 0 0 6px rgba(181, 5, 82, .46);
}

/* Simbología ecológica: los colores se identifican directamente en el mapa y en la lista de unidades. */
.ecosystem-list-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.ecosystem-list-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: 0 0 10px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.12);
}
.state-item.ecosystem-item.active .ecosystem-list-swatch {
  box-shadow: 0 0 0 1px rgba(255,255,255,.9);
}

/* Revisión 5: filtros combinados de clasificación para Lengua y Ecosistema. */
.map-driver-technique-chips {
  max-height: 18vh;
  overflow-y: auto;
  align-content: flex-start;
  padding-right: 4px;
}
.map-chip.filter-disabled,
.map-chip:disabled {
  cursor: not-allowed;
  opacity: .34;
  box-shadow: none;
}

/* ════════════════════════════════════════════════
   MAPA — REDISEÑO TERRITORIAL v6
   ════════════════════════════════════════════════ */
.map-language-cloud-chips,
.map-material-chips,
.map-ecosystem-unit-chips {
  max-height: 19vh;
}

.map-material-level {
  padding-top: 10px;
  margin-top: 3px;
  border-top: 1px solid var(--border);
}

.map-filter-count {
  float: right;
  color: var(--arena);
  font-size: .61rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.map-language-chip,
.map-ecosystem-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.map-chip-swatch {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 9px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.14);
}

.map-material-chip.active {
  background: var(--negro);
  color: var(--crema);
  border-color: var(--negro);
}

.driver-list-note {
  padding: 10px 12px;
  color: var(--arena);
  font-size: .67rem;
  line-height: 1.4;
}

.atlas-language-canvas {
  opacity: 1;
  mix-blend-mode: multiply;
}

@media (max-width: 960px) {
  .map-language-cloud-chips,
  .map-material-chips,
  .map-ecosystem-unit-chips { max-height: 16vh; }
}

/* ════════════════════════════════════════════════
   MAPA — AJUSTES TERRITORIALES v7
   ════════════════════════════════════════════════ */
.ecosystem-dropdown {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}
.ecosystem-dropdown summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  cursor: pointer;
  color: var(--negro);
  font-size: .74rem;
  font-weight: 600;
  user-select: none;
}
.ecosystem-dropdown summary::-webkit-details-marker { display: none; }
.ecosystem-dropdown[open] summary { border-bottom: 1px solid var(--border); }
.ecosystem-dropdown-chevron {
  color: var(--arena);
  font-size: 1rem;
  line-height: 1;
  transition: transform .15s ease;
}
.ecosystem-dropdown[open] .ecosystem-dropdown-chevron { transform: rotate(180deg); }
.ecosystem-checkbox-list {
  max-height: 260px;
  overflow-y: auto;
  padding: 5px;
}
.ecosystem-checkbox-item {
  display: grid;
  grid-template-columns: 16px 10px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--negro);
  font-size: .71rem;
  line-height: 1.35;
}
.ecosystem-checkbox-item:hover { background: rgba(181,5,82,.05); }
.ecosystem-checkbox-item input {
  margin: 2px 0 0;
  accent-color: var(--magenta);
}
.ecosystem-checkbox-item .map-chip-swatch { margin-top: 2px; }
.ecosystem-checkbox-name {
  text-align: left;
  overflow-wrap: anywhere;
}

/* Las familias de materiales son pocas: se muestran completas, sin buscador. */
.map-material-chips {
  max-height: none;
  overflow: visible;
}


/* ════════════════════════════════════════════════
   MAPA — MULTISELECCIÓN Y RESUMEN INICIAL v8
   ════════════════════════════════════════════════ */
.map-filter-hint {
  float: right;
  font-size: .58rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--arena);
}

.side-panel.initial-overview .states-list-wrap {
  display: none;
}
.side-panel.initial-overview .panel-body {
  background:
    radial-gradient(circle at 85% 8%, rgba(251,72,1,.09), transparent 32%),
    radial-gradient(circle at 12% 80%, rgba(181,5,82,.07), transparent 34%),
    var(--bg-page);
}
.map-initial-overview {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 12px 4px 24px;
}
.map-initial-kicker {
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--magenta);
}
.map-initial-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 8px;
}
.map-initial-stat {
  min-width: 0;
  padding: 17px 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,.9);
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.map-initial-stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.7rem;
  line-height: 1;
  color: var(--magenta);
}
.map-initial-stat span {
  display: block;
  margin-top: 7px;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .9px;
  text-transform: uppercase;
  color: var(--arena);
}
.map-initial-overview > p {
  margin: 0;
  max-width: 30ch;
  color: var(--arena);
  font-size: .82rem;
  line-height: 1.65;
}

/* La multiselección se refuerza visualmente manteniendo todos los chips activos. */
.map-chip.active,
.state-item.active {
  box-shadow: 0 0 0 1px rgba(255,255,255,.45), 0 2px 7px rgba(26,16,24,.12);
}

@media (max-width: 640px) {
  .map-initial-stats { grid-template-columns: 1fr; }
  .map-initial-stat { display:flex; align-items:baseline; justify-content:space-between; text-align:left; padding:12px 14px; }
  .map-initial-stat strong { font-size:1.4rem; }
  .map-initial-stat span { margin-top:0; }
}

/* ════════════════════════════════════════════════
   MAPA — FILTROS DESPLEGABLES + INTRODUCCIÓN v9
   ════════════════════════════════════════════════ */
.map-driver-filter {
  display: none;
  flex-direction: column;
  gap: 9px;
}
.map-driver-filter.active { display: flex; }

.map-common-filters {
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.map-common-filters-title {
  font-size: .61rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--arena);
  margin-bottom: 1px;
}

.filter-dropdown {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}
.filter-dropdown summary {
  list-style: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 14px;
  align-items: center;
  gap: 7px;
  padding: 9px 10px;
  cursor: pointer;
  user-select: none;
}
.filter-dropdown summary::-webkit-details-marker { display: none; }
.filter-dropdown[open] summary { border-bottom: 1px solid var(--border); }
.filter-dropdown-label {
  min-width: 0;
  color: var(--negro);
  font-size: .72rem;
  font-weight: 700;
}
.filter-dropdown-value {
  min-width: 0;
  max-width: 112px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--arena);
  font-size: .62rem;
  font-weight: 600;
  text-align: right;
}
.filter-dropdown-chevron {
  color: var(--arena);
  line-height: 1;
  transition: transform .15s ease;
}
.filter-dropdown[open] .filter-dropdown-chevron { transform: rotate(180deg); }
.filter-dropdown-search-wrap {
  padding: 8px 8px 4px;
  background: rgba(255,248,245,.55);
}
.filter-checkbox-list {
  max-height: 235px;
  overflow-y: auto;
  padding: 5px;
  background: white;
}
.filter-checkbox-item {
  display: grid;
  grid-template-columns: 16px 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 5px 6px;
  border-radius: 6px;
  color: var(--negro);
  font-size: .69rem;
  line-height: 1.25;
}
.filter-checkbox-item:hover { background: rgba(181,5,82,.05); }
.filter-checkbox-item.disabled { opacity: .42; }
.filter-checkbox-item input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--magenta);
  cursor: pointer;
}
.filter-checkbox-name {
  min-width: 0;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.filter-checkbox-meta {
  color: var(--arena);
  font-size: .58rem;
  font-weight: 700;
  white-space: nowrap;
}
.material-filter-swatch {
  border-radius: 3px;
  background: linear-gradient(135deg, var(--magenta), var(--ocre));
}
.filter-technique-item {
  grid-template-columns: 16px 10px minmax(0, 1fr) auto;
  align-items: center;
}
.filter-row-action {
  border: 1px solid rgba(181,5,82,.22);
  border-radius: 999px;
  padding: 4px 7px;
  background: rgba(181,5,82,.05);
  color: var(--magenta);
  font-family: var(--font-body);
  font-size: .57rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.filter-row-action:hover {
  background: var(--magenta);
  color: white;
}
.map-material-level {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* Introducción inicial: aparece en cada carga y desaparece por completo al cerrar. */
.atlas-intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 8500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(26,16,24,.78);
  backdrop-filter: blur(8px);
}
.atlas-intro-overlay.open { display: flex; }
.atlas-intro-card {
  position: relative;
  width: min(720px, 100%);
  max-height: min(760px, calc(100dvh - 40px));
  overflow-y: auto;
  border-radius: 18px;
  background:
    radial-gradient(circle at 92% 8%, rgba(251,72,1,.10), transparent 30%),
    radial-gradient(circle at 8% 95%, rgba(181,5,82,.08), transparent 32%),
    #fff;
  box-shadow: 0 26px 80px rgba(0,0,0,.34);
  padding: 32px 36px 26px;
}
.atlas-intro-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(26,16,24,.06);
  color: var(--negro);
  cursor: pointer;
  font-size: .9rem;
}
.atlas-intro-close:hover { background: var(--magenta); color: white; }
.atlas-intro-progress {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
}
.atlas-intro-dot {
  display: block;
  width: 24px;
  height: 4px;
  border-radius: 999px;
  background: rgba(26,16,24,.12);
  transition: width .2s ease, background .2s ease;
}
.atlas-intro-dot.active { width: 42px; background: var(--magenta); }
.atlas-intro-slide { display: none; animation: atlasIntroIn .2s ease; }
.atlas-intro-slide.active { display: block; }
@keyframes atlasIntroIn { from { opacity:0; transform:translateY(5px); } to { opacity:1; transform:none; } }
.atlas-intro-kicker {
  margin-bottom: 8px;
  color: var(--magenta);
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.atlas-intro-slide h2 {
  max-width: 16ch;
  margin-bottom: 16px;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  line-height: 1.06;
  color: var(--negro);
}
.atlas-intro-slide > p {
  max-width: 64ch;
  margin: 0 0 13px;
  color: #5f5158;
  font-size: .91rem;
  line-height: 1.65;
}
.atlas-intro-lead { font-size: 1.02rem !important; color: var(--negro) !important; }
.atlas-intro-callout {
  margin-top: 20px;
  padding: 14px 16px;
  border-left: 4px solid var(--magenta);
  border-radius: 8px;
  background: rgba(181,5,82,.06);
  color: var(--negro);
  font-weight: 700;
  line-height: 1.5;
}
.atlas-intro-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 10px;
  margin: 19px 0 18px;
}
.atlas-intro-grid > div {
  padding: 15px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,.85);
}
.atlas-intro-grid strong {
  display: block;
  margin-bottom: 6px;
  color: var(--magenta);
  font-size: .8rem;
}
.atlas-intro-grid span {
  display: block;
  color: var(--arena);
  font-size: .73rem;
  line-height: 1.45;
}
.atlas-intro-small { font-size: .78rem !important; color: var(--arena) !important; }
.atlas-intro-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 18px 0;
}
.atlas-intro-steps > div {
  display: grid;
  grid-template-columns: 30px minmax(0,1fr);
  align-items: start;
  gap: 10px;
}
.atlas-intro-steps span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--negro);
  color: var(--ocre);
  font-size: .68rem;
  font-weight: 900;
}
.atlas-intro-steps p { margin: 3px 0 0; color: #5f5158; font-size: .83rem; line-height: 1.5; }
.atlas-intro-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 26px;
  padding-top: 17px;
  border-top: 1px solid var(--border);
}
.atlas-intro-actions button {
  border-radius: 999px;
  padding: 9px 18px;
  font-family: var(--font-body);
  font-size: .74rem;
  font-weight: 800;
  cursor: pointer;
}
.atlas-intro-secondary { border: 1px solid var(--border); background: white; color: var(--negro); }
.atlas-intro-secondary:disabled { opacity: .3; cursor: default; }
.atlas-intro-primary { border: 1px solid var(--magenta); background: var(--magenta); color: white; margin-left: auto; }

@media (max-width: 640px) {
  .atlas-intro-overlay { padding: 0; align-items: stretch; }
  .atlas-intro-card { width: 100%; max-height: 100dvh; border-radius: 0; padding: 28px 22px 22px; }
  .atlas-intro-grid { grid-template-columns: 1fr; }
  .atlas-intro-slide h2 { max-width: 20ch; }
  .filter-checkbox-list { max-height: 190px; }
}
body.atlas-intro-open { overflow: hidden; }

/* ════════════════════════════════════════════════
   V11 — CARRUSEL DE PERFILES TERRITORIALES
   ════════════════════════════════════════════════ */
.territory-profile-panel .panel-body {
  padding: 14px 16px 18px;
  background:
    radial-gradient(circle at 96% 0%, rgba(181,5,82,.045), transparent 34%),
    var(--bg-page);
}
.territory-carousel { min-height: 100%; }
.territory-carousel-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
  color: var(--arena); font-size: .68rem; font-weight: 700;
  letter-spacing: .5px;
}
.territory-carousel-btn {
  width: 34px; height: 30px; border-radius: 9px;
  border: 1px solid var(--border); background: white; color: var(--negro);
  font: 700 1.25rem/1 var(--font-body); cursor: pointer;
  transition: .15s ease;
}
.territory-carousel-btn:hover:not(:disabled) {
  border-color: var(--magenta); color: var(--magenta); transform: translateY(-1px);
}
.territory-carousel-btn:disabled { opacity: .3; cursor: default; }
.territory-profile-card {
  background: white; border: 1px solid var(--border); border-radius: 16px;
  padding: 18px; box-shadow: 0 7px 22px rgba(26,16,24,.045);
}
.territory-profile-kicker {
  color: var(--magenta); text-transform: uppercase; letter-spacing: 1.35px;
  font-size: .6rem; font-weight: 800; margin-bottom: 7px;
}
.territory-profile-card h3 {
  font-family: var(--font-display); margin: 0; color: var(--negro);
  font-size: 1.22rem; line-height: 1.18;
}
.territory-profile-pueblo {
  color: var(--arena); font-size: .7rem; margin-top: 5px;
}
.territory-profile-stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;
  margin: 16px 0 13px;
}
.territory-profile-stats > div {
  background: var(--bg-page); border-radius: 10px; padding: 10px 7px;
  min-width: 0;
}
.territory-profile-stats strong {
  display: block; font-family: var(--font-display); color: var(--negro);
  font-size: 1.15rem; line-height: 1;
}
.territory-profile-stats span {
  display: block; margin-top: 5px; color: var(--arena); font-size: .58rem;
  line-height: 1.2;
}
.territory-profile-method {
  margin: 0 0 15px; padding: 10px 11px; border-left: 3px solid var(--azul, #027A9E);
  background: #f5fafb; color: #5f666b; font-size: .69rem; line-height: 1.45;
}
.territory-profile-section {
  border-top: 1px solid var(--border); padding-top: 13px; margin-top: 13px;
}
.territory-profile-section h4 {
  margin: 0 0 8px; color: var(--negro); font-size: .68rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .8px;
}
.territory-profile-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.territory-profile-chip, .territory-profile-more {
  display: inline-flex; align-items: center; min-height: 25px;
  border: 1px solid var(--border); border-radius: 13px; background: var(--bg-page);
  padding: 4px 8px; font-size: .65rem; color: var(--negro); line-height: 1.2;
}
.territory-profile-more { color: var(--arena); font-weight: 700; }
.territory-tech-list { display: grid; gap: 5px; }
.territory-tech-item {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  text-align: left; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px;
  background: white; color: var(--negro); font: 500 .68rem/1.25 var(--font-body);
  cursor: pointer; transition: .13s ease;
}
.territory-tech-item:hover:not(.static) { border-color: var(--magenta); color: var(--magenta); }
.territory-tech-item strong {
  min-width: 22px; text-align: center; border-radius: 10px; padding: 2px 5px;
  background: var(--bg-page); color: var(--arena); font-size: .6rem;
}
.territory-tech-item.static { cursor: default; }
.territory-transmission p {
  margin: 5px 0; color: #5f555d; font-size: .68rem; line-height: 1.4;
}
.territory-profile-empty {
  border: 1px dashed var(--border); border-radius: 10px; padding: 12px;
  margin-top: 12px; background: #fffdfb;
}
.territory-profile-empty strong { font-size: .72rem; color: var(--negro); }
.territory-profile-empty p { margin: 5px 0 0; font-size: .67rem; line-height: 1.4; color: var(--arena); }
.territory-profile-source {
  margin-top: 16px; font-size: .59rem; line-height: 1.35; color: var(--arena);
}
.territory-carousel-dots {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 5px; margin-top: 12px;
}
.territory-carousel-dot {
  width: 6px; height: 6px; padding: 0; border: 0; border-radius: 50%;
  background: #d4ccc7; cursor: pointer;
}
.territory-carousel-dot.active { background: var(--magenta); transform: scale(1.25); }
.community-map-popup strong { font-size: .82rem; }
.community-map-popup span { color: #6f6269; font-size: .7rem; }
.community-map-popup small { color: #8d7e86; font-size: .64rem; }

@media (max-width: 900px) {
  .territory-profile-stats { grid-template-columns: repeat(3, 1fr); }
  .territory-profile-card { padding: 15px; }
}


/* Ajustes visuales para la introducción v12 */
.atlas-intro-photo-hero {
  margin-top: 18px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(26,16,24,.08);
}
.atlas-intro-photo-hero img,
.atlas-intro-photo-grid img {
  display: block;
  width: 100%;
  height: auto;
}
.atlas-intro-photo-grid {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}
.atlas-intro-photo-grid img {
  border-radius: 12px;
  border: 1px solid rgba(26,16,24,.08);
}
.atlas-intro-photo-grid-3 { grid-template-columns: repeat(3, 1fr); }
.atlas-intro-photo-grid-2 { grid-template-columns: repeat(2, 1fr); }
.atlas-intro-grid-process { grid-template-columns: repeat(3, 1fr); }
.atlas-intro-grid-process > div { min-height: 100%; }
@media (max-width: 780px) {
  .atlas-intro-photo-grid-3,
  .atlas-intro-photo-grid-2,
  .atlas-intro-grid-process { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════
   V12 — INTRODUCCIÓN VISUAL + CLASIFICACIÓN INTERACTIVA
   ════════════════════════════════════════════════ */

/* Introducción: fotografía + texto, con una lectura más cercana al ejercicio de Original. */
.atlas-intro-card.atlas-intro-card-photo {
  width: min(1020px, calc(100vw - 40px));
  max-height: min(760px, calc(100dvh - 40px));
  padding: 24px 26px 22px;
  overflow: auto;
}
.atlas-intro-card-photo .atlas-intro-slide.active {
  display: grid;
  grid-template-columns: minmax(300px, 46%) minmax(0, 1fr);
  gap: 30px;
  align-items: center;
  min-height: 455px;
}
.atlas-intro-photo-wrap {
  height: 410px;
  border-radius: 16px;
  overflow: hidden;
  background: #ece6e1;
}
.atlas-intro-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.atlas-intro-copy {
  min-width: 0;
  padding: 6px 8px 6px 0;
}
.atlas-intro-copy h2 {
  max-width: 18ch;
  margin-bottom: 16px;
}
.atlas-intro-copy > p {
  color: #5f5158;
  font-size: .94rem;
  line-height: 1.65;
  margin: 0 0 13px;
}
.atlas-intro-copy .atlas-intro-lead {
  color: var(--negro);
  font-size: 1.03rem;
}
.atlas-intro-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}
.atlas-intro-pill-row span {
  border: 1px solid var(--border);
  background: var(--crema);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: .76rem;
  font-weight: 700;
  color: var(--negro);
}
.atlas-intro-card-photo .atlas-intro-steps {
  margin-top: 18px;
}
.atlas-intro-card-photo .atlas-intro-actions {
  margin-top: 14px;
}
@media (max-width: 760px) {
  .atlas-intro-card.atlas-intro-card-photo {
    width: 100%;
    max-height: 100dvh;
    border-radius: 0;
    padding: 22px 18px 18px;
  }
  .atlas-intro-card-photo .atlas-intro-slide.active {
    grid-template-columns: 1fr;
    min-height: 0;
    gap: 18px;
  }
  .atlas-intro-photo-wrap { height: 220px; }
  .atlas-intro-copy { padding: 0; }
  .atlas-intro-copy h2 { max-width: none; }
}

/* Clasificación como esquema interactivo. */
.arbol-view {
  max-width: 1400px;
  padding: 30px 28px 50px;
}
.arbol-header {
  max-width: 900px;
  margin-bottom: 24px;
}
.arbol-kicker {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--magenta);
  margin-bottom: 6px;
}
.arbol-header p {
  line-height: 1.55;
  max-width: 78ch;
}
.arbol-guide {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 15px;
  font-size: .74rem;
  color: var(--arena);
}
.arbol-guide span {
  background: var(--crema);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px;
  font-weight: 700;
  color: var(--negro);
}
.arbol-guide b { color: var(--magenta); }
.class-schema-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 26px;
  align-items: start;
}
.class-schema {
  min-width: 0;
  position: relative;
}
.class-schema-root {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  max-width: 100%;
  background: var(--negro);
  color: white;
  border-radius: 12px;
  padding: 12px 16px;
  position: relative;
  z-index: 2;
}
.class-schema-root-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--magenta-claro, #ef6ca2);
  flex: 0 0 auto;
}
.class-schema-root div { display: flex; flex-direction: column; }
.class-schema-root small {
  text-transform: uppercase;
  letter-spacing: 1.1px;
  opacity: .65;
  font-size: .62rem;
}
.class-schema-root strong { font-size: .9rem; }
.class-schema-root-count {
  margin-left: 12px;
  min-width: 30px;
  text-align: center;
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(255,255,255,.14);
  font-size: .72rem;
  font-weight: 800;
}
.class-schema-trunk {
  width: 2px;
  height: 22px;
  margin-left: 29px;
  background: var(--border);
}
.class-schema-branches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  position: relative;
}
.class-branch-card {
  border: 1px solid var(--border);
  border-top: 4px solid var(--branch-color);
  border-radius: 13px;
  background: white;
  padding: 12px 12px 14px;
  min-width: 0;
}
.class-tree-node { position: relative; }
.class-node-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  position: relative;
  z-index: 1;
}
.class-node-toggle,
.class-node-terminal {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  margin-top: 8px;
}
.class-node-toggle {
  border: 1px solid var(--border);
  border-radius: 50%;
  background: white;
  color: var(--node-color);
  font-weight: 800;
  cursor: pointer;
  line-height: 1;
}
.class-node-toggle:hover { border-color: var(--node-color); background: var(--crema); }
.class-node-terminal {
  position: relative;
}
.class-node-terminal::after {
  content: '';
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--node-color);
  top: 11px;
  left: 10px;
}
.class-node-main {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--crema);
  border-radius: 9px;
  padding: 8px 10px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  text-align: left;
  transition: border-color .14s, background .14s, transform .14s;
}
.class-node-main:hover {
  background: white;
  border-color: var(--node-color);
  transform: translateX(2px);
}
.class-tree-node.active > .class-node-row .class-node-main {
  background: white;
  border-color: var(--node-color);
  box-shadow: inset 3px 0 0 var(--node-color);
}
.class-node-level {
  grid-column: 1;
  font-size: .59rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .8px;
  font-weight: 800;
  color: var(--node-color);
}
.class-node-name {
  grid-column: 1;
  font-size: .82rem;
  font-weight: 700;
  color: var(--negro);
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.class-node-count {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  min-width: 27px;
  text-align: center;
  color: white;
  background: var(--node-color);
  border-radius: 999px;
  padding: 3px 7px;
  font-size: .67rem;
  font-weight: 800;
}
.class-node-children {
  display: none;
  margin-left: 13px;
  padding: 8px 0 0 22px;
  border-left: 1.5px solid var(--border);
  gap: 7px;
}
.class-node-children.open {
  display: flex;
  flex-direction: column;
}
.class-node-children > .class-tree-node::before {
  content: '';
  position: absolute;
  left: -22px;
  top: 21px;
  width: 20px;
  border-top: 1.5px solid var(--border);
}
.class-level-1 > .class-node-row .class-node-main {
  background: color-mix(in srgb, var(--node-color) 9%, white);
  border-color: color-mix(in srgb, var(--node-color) 40%, var(--border));
}
.class-level-1 > .class-node-row .class-node-name { font-size: .9rem; }
.class-detail-panel {
  position: sticky;
  top: 76px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--crema);
  padding: 20px;
  max-height: calc(100vh - 120px);
  overflow: auto;
}
.class-detail-panel h3 {
  font-family: var(--font-display);
  margin: 3px 0 8px;
  font-size: 1.25rem;
  color: var(--negro);
}
.class-detail-kicker {
  color: var(--magenta);
  text-transform: uppercase;
  font-size: .64rem;
  letter-spacing: 1px;
  font-weight: 800;
}
.class-detail-path {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  font-size: .7rem;
  color: var(--arena);
  margin-bottom: 15px;
}
.class-detail-path b { color: var(--magenta); }
.class-detail-summary {
  display: flex;
  align-items: baseline;
  gap: 9px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.class-detail-summary strong {
  font-family: var(--font-display);
  font-size: 1.65rem;
  color: var(--magenta);
}
.class-detail-summary span { color: var(--arena); font-size: .76rem; }
.class-detail-note,
.class-detail-empty p {
  color: var(--arena);
  font-size: .78rem;
  line-height: 1.5;
}
.class-detail-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 12px;
}
.class-detail-tech {
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 9px 2px;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  text-align: left;
  cursor: pointer;
  color: var(--negro);
  font-size: .8rem;
}
.class-detail-tech:hover span { color: var(--magenta); }
.class-detail-tech b {
  white-space: nowrap;
  font-size: .65rem;
  color: var(--magenta);
  text-transform: uppercase;
  letter-spacing: .4px;
}
@media (max-width: 980px) {
  .class-schema-layout { grid-template-columns: 1fr; }
  .class-detail-panel { position: static; max-height: none; }
}
@media (max-width: 680px) {
  .arbol-view { padding: 24px 16px 40px; }
  .class-schema-branches { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .atlas-intro-stats { grid-template-columns: 1fr; }
}


/* V17 — la leyenda no compite con el panel flotante de filtros en escritorio */
@media (min-width: 961px) {
  .map-legend {
    left: auto;
    right: 58px;
    bottom: 18px;
    max-width: 220px;
  }
}

/* ==============================================
   GALERÍA FOTOGRÁFICA
   ============================================== */
.gallery-view {
  max-width: 1440px;
  margin: 0 auto;
  padding: 30px 32px 52px;
}
.gallery-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}
.gallery-kicker {
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--magenta);
  margin-bottom: 6px;
}
.gallery-header h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--negro);
  margin-bottom: 6px;
}
.gallery-header p {
  max-width: 760px;
  color: var(--arena);
  font-size: .86rem;
  line-height: 1.6;
}
.gallery-count {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--arena);
}
.gallery-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.gallery-filter {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: white;
  color: var(--arena);
  font-family: var(--font-body);
  font-size: .76rem;
  font-weight: 700;
  padding: 8px 14px;
  cursor: pointer;
  transition: .16s ease;
}
.gallery-filter:hover { border-color: var(--magenta); color: var(--magenta); }
.gallery-filter.active { background: var(--negro); border-color: var(--negro); color: white; }
.gallery-secondary-filters {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 20px;
}
.gallery-select-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 230px;
}
.gallery-select-wrap > span {
  font-size: .64rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--arena);
}
.gallery-select-wrap select {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 34px 8px 11px;
  background: white;
  color: var(--tinta);
  font-family: var(--font-body);
  font-size: .76rem;
  outline: none;
}
.gallery-select-wrap select:focus { border-color: var(--magenta); }
.gallery-reset-filters {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 13px;
  background: transparent;
  color: var(--magenta);
  font-family: var(--font-body);
  font-size: .72rem;
  font-weight: 700;
  cursor: pointer;
}
.gallery-reset-filters:hover { background: rgba(181,5,82,.05); border-color: rgba(181,5,82,.25); }
.gallery-note {
  margin: 0 0 18px;
  padding: 10px 12px;
  border-left: 3px solid var(--magenta);
  background: rgba(181,5,82,.045);
  color: var(--arena);
  font-size: .75rem;
  line-height: 1.55;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.gallery-card {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: white;
  box-shadow: var(--shadow-sm);
  text-align: left;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-body);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.gallery-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(181,5,82,.28);
}
.gallery-card-image {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--negro);
}
.gallery-card-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .25s ease;
}
.gallery-card:hover .gallery-card-image img { transform: scale(1.025); }
.gallery-category-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(26,16,24,.84);
  color: white;
  font-size: .63rem;
  font-weight: 800;
  letter-spacing: .4px;
}
.gallery-card-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 13px 14px;
}
.gallery-card-copy strong {
  font-family: var(--font-display);
  color: var(--negro);
  font-size: 1rem;
  line-height: 1.25;
}
.gallery-card-copy span { color: var(--tinta); font-size: .78rem; }
.gallery-card-copy small { color: var(--arena); font-size: .68rem; line-height: 1.35; }
.gallery-loading,
.gallery-empty {
  grid-column: 1 / -1;
  padding: 48px 24px;
  text-align: center;
  color: var(--arena);
}
.gallery-empty h3 { font-family: var(--font-display); color: var(--negro); margin-bottom: 6px; }

/* Lightbox con ficha de crédito */
.lightbox-content {
  width: min(1180px, calc(100vw - 110px));
  max-height: calc(100vh - 76px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: stretch;
}
.lightbox-image-wrap {
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.lightbox .lightbox-image-wrap img {
  max-width: 100%;
  max-height: calc(100vh - 76px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
}
.lightbox-credit {
  align-self: center;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  background: rgba(255,248,245,.98);
  color: var(--negro);
  border-radius: 14px;
  padding: 20px 18px;
}
.lightbox-credit-kicker {
  color: var(--magenta);
  font-size: .64rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.35px;
  margin-bottom: 7px;
}
.lightbox-credit h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.18;
  margin-bottom: 16px;
}
.lightbox-credit dl { display: flex; flex-direction: column; gap: 10px; }
.lightbox-credit dl > div { border-top: 1px solid var(--border); padding-top: 9px; }
.lightbox-credit dt {
  font-size: .61rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--arena);
}
.lightbox-credit dd { margin: 3px 0 0; font-size: .82rem; line-height: 1.4; }
.lightbox-credit p {
  margin-top: 16px;
  color: var(--arena);
  font-size: .68rem;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .gallery-view { padding: 22px 14px 40px; }
  .gallery-header { align-items: flex-start; flex-direction: column; gap: 6px; }
  .gallery-header h2 { font-size: 1.65rem; }
  .gallery-toolbar { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .gallery-filter { flex: 0 0 auto; }
  .gallery-secondary-filters { display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: 8px; }
  .gallery-select-wrap { min-width: 0; }
  .gallery-select-wrap select { width: 100%; font-size: 16px; }
  .gallery-reset-filters { grid-column: 1 / -1; justify-self: start; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .gallery-card-copy { padding: 10px 10px 12px; }
  .gallery-card-copy strong { font-size: .9rem; }
  .gallery-card-copy span { font-size: .7rem; }
  .gallery-card-copy small { font-size: .62rem; }

  .lightbox { padding: 54px 12px 18px; justify-content: flex-start; overflow-y: auto; }
  .lightbox-content {
    width: 100%;
    max-height: none;
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .lightbox-image-wrap { min-height: 42vh; max-height: 58vh; }
  .lightbox .lightbox-image-wrap img { max-height: 58vh; }
  .lightbox-credit { width: 100%; max-height: none; align-self: stretch; padding: 16px; }
  .lightbox-counter { position: fixed; bottom: 10px; }
}

@media (max-width: 420px) {
  .gallery-grid { grid-template-columns: 1fr 1fr; }
  .gallery-category-badge { font-size: .58rem; left: 7px; bottom: 7px; padding: 4px 7px; }
}





/* V23 — diagrama de llaves interactivo para clasificación */
.brace-layout { grid-template-columns: minmax(0, 1fr) 340px; }
.brace-schema { min-width: 0; }
.brace-root { margin-bottom: 18px; }
.brace-toolbar {
  display:flex; justify-content:space-between; align-items:center; gap:14px; margin-bottom:18px;
  padding:12px 14px; border:1px solid var(--border); border-radius:14px; background:white;
}
.brace-toolbar-copy { font-size:.78rem; color:var(--arena); line-height:1.45; }
.brace-toolbar-actions { display:flex; flex-wrap:wrap; gap:8px; }
.brace-toolbar-btn {
  border:1px solid var(--border); background:var(--crema); color:var(--negro); border-radius:999px;
  padding:8px 12px; font-size:.72rem; font-weight:700; cursor:pointer;
}
.brace-toolbar-btn:hover { background:white; border-color:var(--magenta); }
.brace-groups { display:flex; flex-direction:column; gap:20px; }
.brace-group { display:grid; grid-template-columns:minmax(240px, 300px) 58px minmax(0, 1fr); gap:0; align-items:stretch; }
.brace-cat-col { display:flex; flex-direction:column; gap:10px; }
.brace-cat-main, .brace-subcat-row, .brace-type-row, .brace-variant-row { display:grid; grid-template-columns:36px minmax(0,1fr); gap:12px; align-items:start; }
.brace-mini-toggle {
  width:36px; height:36px; border-radius:50%; border:1px solid var(--border); background:white;
  color:var(--magenta); font-size:1.15rem; line-height:1; cursor:pointer; display:flex; align-items:center; justify-content:center;
  margin-top:4px;
}
.brace-mini-toggle:hover { border-color:var(--magenta); box-shadow:0 8px 18px rgba(26,16,24,.08); }
.brace-cat-card {
  border:2px solid color-mix(in srgb, var(--brace-color) 58%, #eadfdc); background:color-mix(in srgb, var(--brace-color) 8%, white);
  border-radius:16px; padding:14px 16px; text-align:left; cursor:pointer; display:grid; grid-template-columns:1fr auto; gap:10px;
  transition:transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.brace-cat-card:hover, .brace-cat-card.is-active {
  transform:translateY(-1px); border-color:var(--brace-color); box-shadow:0 10px 24px rgba(26,16,24,.08); background:white;
}
.brace-cat-name { font-size:1.05rem; font-weight:800; color:var(--negro); line-height:1.2; }
.brace-cat-count, .brace-subcat-count {
  align-self:center; min-width:30px; text-align:center; border-radius:999px; padding:4px 8px;
  background:var(--brace-color); color:white; font-size:.73rem; font-weight:800;
}
.brace-link { position:relative; min-height:100%; }
.brace-link::before {
  content:''; position:absolute; left:10px; right:8px; top:20px; bottom:20px;
  border-left:2px solid color-mix(in srgb, var(--brace-color) 65%, white);
  border-top:2px solid color-mix(in srgb, var(--brace-color) 65%, white);
  border-bottom:2px solid color-mix(in srgb, var(--brace-color) 65%, white);
  border-radius:24px 0 0 24px;
}
.brace-subcats-wrap {
  border:1px solid var(--border); border-radius:18px; background:white; padding:12px 14px 12px; min-width:0;
}
.brace-subcats-wrap.collapsed { display:none; }
.compact-head { margin-bottom:10px; }
.compact-head strong { display:block; color:var(--arena); font-size:.76rem; font-weight:700; }
.brace-subcats-list { display:none; flex-direction:column; gap:12px; }
.brace-subcats-list.open, .brace-type-list.open, .brace-variant-list.open { display:flex; }
.brace-subcat-node, .brace-type-node { display:flex; flex-direction:column; gap:10px; }
.brace-subcat-card, .brace-type-card, .brace-variant-card {
  width:100%; border:1px solid var(--border); border-radius:14px; background:color-mix(in srgb, var(--subcat-color, var(--brace-color)) 6%, white);
  padding:10px 12px; text-align:left; cursor:pointer; display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; align-items:center;
  transition:border-color .14s ease, transform .14s ease, background .14s ease;
}
.brace-subcat-card:hover, .brace-subcat-card.is-active, .brace-type-card:hover, .brace-type-card.is-active, .brace-variant-card:hover, .brace-variant-card.is-active { border-color:var(--subcat-color, var(--brace-color)); background:white; transform:translateX(2px); }
.brace-subcat-card.is-active, .brace-type-card.is-active, .brace-variant-card.is-active { box-shadow:inset 3px 0 0 var(--subcat-color, var(--brace-color)); }
.brace-subcat-copy, .brace-level-copy, .brace-type-card, .brace-variant-card { min-width:0; }
.brace-subcat-name, .brace-level-name { display:block; font-size:.95rem; font-weight:800; color:var(--negro); line-height:1.22; }
.brace-level-copy { display:flex; flex-direction:column; gap:2px; min-width:0; }
.brace-level-label { display:block; font-size:.62rem; line-height:1; text-transform:uppercase; letter-spacing:1px; font-weight:800; color:var(--arena); margin-bottom:4px; }
.brace-type-list {
  display:none; flex-direction:column; gap:10px; margin-left:28px; padding-left:14px; border-left:1px solid #d8cfcc;
}
.brace-variant-list {
  display:none; flex-direction:column; gap:8px; margin-left:28px; padding-left:14px; border-left:1px solid #ddd4d1;
}
.brace-variant-bullet {
  width:8px; height:8px; border-radius:50%; background:#9f8e96; margin:14px 0 0 12px; display:block;
}
.class-detail-mini-grid {
  display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:10px; margin:14px 0 0;
}
.class-detail-mini-grid div {
  border:1px solid var(--border); border-radius:12px; background:white; padding:10px 12px; display:flex; flex-direction:column; gap:4px;
}
.class-detail-mini-grid b { color:var(--negro); font-family:var(--font-display); font-size:1rem; }
.class-detail-mini-grid span { font-size:.72rem; color:var(--arena); }
.class-detail-list.compact .class-detail-tech { padding:10px 2px; }
.class-detail-list.compact .class-detail-tech b {
  min-width:26px; text-align:center; color:white; background:var(--magenta); border-radius:999px; padding:4px 7px;
}
@media (max-width: 1180px) {
  .brace-layout { grid-template-columns:1fr; }
  .brace-group { grid-template-columns:1fr; gap:10px; }
  .brace-link { display:none; }
  .class-detail-panel { position:static; max-height:none; }
}
@media (max-width: 760px) {
  .brace-toolbar { flex-direction:column; align-items:flex-start; }
  .brace-toolbar-actions { width:100%; }
  .brace-toolbar-btn { flex:1 1 auto; text-align:center; }
  .brace-type-list, .brace-variant-list { margin-left:18px; padding-left:10px; }
}
@media (max-width: 560px) {
  .brace-cat-main, .brace-subcat-row, .brace-type-row, .brace-variant-row { grid-template-columns:30px minmax(0,1fr); gap:8px; }
  .brace-mini-toggle { width:30px; height:30px; font-size:1rem; }
  .class-detail-mini-grid { grid-template-columns:1fr; }
}

/* ==============================================
   FICHAS — FUENTES: TESTIMONIOS / BIBLIOGRAFÍA
   ============================================== */
.ficha-source-switch {
  position: absolute;
  top: 22px;
  right: -28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  z-index: 8;
}
.ficha-source-btn {
  appearance: none;
  position: relative;
  width: 50px;
  height: 50px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px;
  background: rgba(26,16,24,.88);
  color: var(--crema);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: var(--font-body);
  box-shadow: 0 10px 20px rgba(26,16,24,.18);
  transition: transform .15s, background .15s, border-color .15s, box-shadow .15s;
  overflow: visible;
}
.ficha-source-btn:hover {
  transform: translateY(-1px);
  background: rgba(61,34,48,.95);
  border-color: rgba(255,255,255,.18);
}
.ficha-source-btn.active {
  background: var(--magenta);
  border-color: var(--magenta);
  box-shadow: 0 10px 22px rgba(181,5,82,.28);
}
.ficha-source-btn img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex: 0 0 24px;
  display:block;
}
.ficha-source-btn::after {
  content: attr(data-label);
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(8px);
  background: rgba(26,16,24,.92);
  color: var(--crema);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: .68rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s, transform .15s;
}
.ficha-source-btn:hover::after,
.ficha-source-btn.active::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
.ficha-source-note {
  margin: 0 0 22px;
  padding: 10px 12px;
  border-left: 3px solid var(--azul-mar);
  background: rgba(3,90,121,.045);
  color: var(--arena);
  font-size: .74rem;
  line-height: 1.55;
}
.ficha-source-note strong { color: var(--negro); }
.ficha-source-note.biblio-note {
  border-left-color: var(--magenta);
  background: rgba(181,5,82,.045);
}
.biblio-section .section-head { border-bottom-color: var(--magenta); }
.biblio-reference-list {
  margin: 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--arena);
  font-size: .78rem;
  line-height: 1.55;
}
.biblio-reference-list li::marker {
  color: var(--magenta);
  font-weight: 800;
}
.ficha-return-row {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.ficha-return-btn,
.taxonomy-biblio-btn,
.taxonomy-back-btn {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  color: var(--negro);
  font-family: var(--font-body);
  cursor: pointer;
}
.ficha-return-btn {
  padding: 9px 13px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: .76rem;
  font-weight: 700;
}
.ficha-return-btn img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}
.ficha-return-btn:hover,
.taxonomy-biblio-btn:hover,
.taxonomy-back-btn:hover { border-color: var(--magenta); }

/* Ficha bibliográfica dentro del panel de Clasificación */
.taxonomy-biblio-btn {
  width: 100%;
  margin: 4px 0 14px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  background: rgba(181,5,82,.035);
}
.taxonomy-biblio-btn img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex: 0 0 30px;
}
.taxonomy-biblio-btn span {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.taxonomy-biblio-btn b {
  font-size: .75rem;
  color: var(--magenta);
}
.taxonomy-biblio-btn small {
  color: var(--arena);
  font-size: .64rem;
}
.taxonomy-biblio-panel .section {
  margin-bottom: 20px;
}
.taxonomy-biblio-panel .section-title {
  font-size: .86rem;
}
.taxonomy-biblio-panel .ficha-parrafo,
.taxonomy-biblio-panel .biblio-reference-list {
  font-size: .75rem;
  line-height: 1.55;
}
.taxonomy-back-btn {
  width: 100%;
  padding: 10px 12px;
  color: var(--magenta);
  font-size: .72rem;
  font-weight: 800;
  margin-top: 4px;
}

@media (max-width: 600px) {
  .ficha-source-switch { top: 14px; right: 10px; flex-direction: row; gap: 8px; }
  .ficha-source-btn { width: 44px; height: 44px; border-radius: 12px; }
  .ficha-source-btn img { width: 20px; height: 20px; flex-basis: 20px; }
  .ficha-source-btn::after { display: none; }
}

/* ==============================================
   AJUSTES V28 — FUENTES Y MODAL BIBLIOGRÁFICO
   ============================================== */
/* Permite que los controles de fuente sobresalgan sin quedar recortados. */
.modal-card { overflow: visible; }
.modal-hero {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-body {
  background: var(--bg-page);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Botón bibliográfico de clasificación: oscuro, con icono blanco. */
.taxonomy-biblio-btn {
  background: rgba(26,16,24,.94);
  border-color: rgba(26,16,24,.94);
  color: var(--crema);
  box-shadow: 0 8px 18px rgba(26,16,24,.12);
}
.taxonomy-biblio-btn b,
.taxonomy-biblio-btn small { color: var(--crema); }
.taxonomy-biblio-btn small { opacity: .72; }
.taxonomy-biblio-btn:hover {
  background: var(--magenta);
  border-color: var(--magenta);
  transform: translateY(-1px);
}

/* Modal documental de la clasificación. */
.taxonomy-biblio-overlay {
  position: fixed;
  inset: 0;
  z-index: 2300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 28px 18px;
  background: rgba(26,16,24,.72);
  backdrop-filter: blur(4px);
  overflow-y: auto;
}
.taxonomy-biblio-overlay.open { display: flex; }
.taxonomy-biblio-modal {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  background: var(--bg-page);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  animation: slideUp .24s cubic-bezier(.34,1.2,.64,1);
}
.taxonomy-biblio-modal-body { padding: 34px 38px 40px; }
.taxonomy-biblio-modal-close {
  position: sticky;
  top: 14px;
  float: right;
  margin: 14px 14px -48px 0;
  z-index: 3;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(26,16,24,.92);
  color: var(--crema);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.taxonomy-biblio-modal-close:hover { background: var(--magenta); }
.taxonomy-modal-kicker {
  padding-right: 46px;
  color: var(--magenta);
  font-size: .69rem;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.taxonomy-modal-title {
  padding-right: 46px;
  margin: 0 0 18px;
  color: var(--negro);
  font-family: var(--font-display);
  font-size: 1.7rem;
  line-height: 1.12;
}
.taxonomy-biblio-modal .section { margin-bottom: 24px; }
.taxonomy-biblio-modal .section-title { font-size: 1rem; }
.taxonomy-biblio-modal .ficha-parrafo,
.taxonomy-biblio-modal .biblio-reference-list {
  font-size: .82rem;
  line-height: 1.65;
}

@media (max-width: 600px) {
  .modal-card { overflow: hidden; }
  .taxonomy-biblio-overlay { padding: 0; align-items: stretch; }
  .taxonomy-biblio-modal {
    width: 100%;
    max-height: none;
    min-height: 100vh;
    border-radius: 0;
  }
  .taxonomy-biblio-modal-body { padding: 72px 22px 34px; }
  .taxonomy-biblio-modal-close { position: absolute; top: 14px; right: 14px; margin: 0; float: none; }
}


/* ==============================================
   AJUSTES V29 — INTRODUCCIÓN Y LEYENDAS
   ============================================== */
/* Quitar rótulos laterales de los botones de fuente. */
.ficha-source-btn::after,
.ficha-source-btn:hover::after,
.ficha-source-btn.active::after {
  display: none !important;
  content: none !important;
}
.ficha-source-note {
  font-weight: 700;
  color: var(--negro);
}
.ficha-source-note strong {
  color: inherit;
  font-weight: 800;
}

/* Modal de introducción: visual de foto a pantalla completa con velo magenta. */
.atlas-intro-card.atlas-intro-card-photo {
  width: min(1100px, calc(100vw - 32px));
  max-height: min(860px, calc(100dvh - 32px));
  height: min(860px, calc(100dvh - 32px));
  padding: 0;
  overflow: hidden;
  border-radius: 22px;
  background: #2b0d1d;
}
.atlas-intro-card-photo .atlas-intro-slide {
  position: relative;
  min-height: 100%;
}
.atlas-intro-card-photo .atlas-intro-slide.active {
  display: block;
  min-height: 100%;
}
.atlas-intro-card-photo .atlas-intro-photo-wrap {
  position: absolute;
  inset: 0;
  height: auto;
  border-radius: 0;
  background: #3d1630;
}
.atlas-intro-card-photo .atlas-intro-photo-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(78, 6, 42, 0.88) 0%, rgba(116, 7, 63, 0.80) 35%, rgba(136, 10, 75, 0.76) 100%),
    linear-gradient(180deg, rgba(35, 8, 22, 0.28) 0%, rgba(35, 8, 22, 0.42) 100%);
}
.atlas-intro-card-photo .atlas-intro-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.atlas-intro-progress {
  position: absolute;
  top: 22px;
  left: 28px;
  z-index: 3;
  margin: 0;
}
.atlas-intro-dot {
  background: rgba(255,255,255,.35);
}
.atlas-intro-dot.active {
  background: #fff;
}
.atlas-intro-close {
  z-index: 3;
  top: 18px;
  right: 18px;
  background: rgba(255,255,255,.16);
  color: #fff;
  backdrop-filter: blur(6px);
}
.atlas-intro-close:hover {
  background: rgba(255,255,255,.28);
  color: #fff;
}
.atlas-intro-copy {
  position: relative;
  z-index: 2;
  min-width: 0;
  height: calc(100% - 96px);
  margin: 62px 24px 92px;
  padding: 18px 20px 22px;
  border-radius: 22px;
  background: rgba(91, 11, 55, .18);
  backdrop-filter: blur(2px);
  overflow-y: auto;
}
.atlas-intro-copy::-webkit-scrollbar {
  width: 10px;
}
.atlas-intro-copy::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.24);
  border-radius: 999px;
}
.atlas-intro-kicker,
.atlas-intro-slide h2,
.atlas-intro-subtitle,
.atlas-intro-copy > p,
.atlas-intro-copy .atlas-intro-lead,
.atlas-intro-small,
.atlas-intro-steps p,
.atlas-intro-pill-row span {
  color: #fff !important;
}
.atlas-intro-kicker {
  color: rgba(255,255,255,.92) !important;
}
.atlas-intro-copy h2 {
  max-width: 10ch;
  margin-bottom: 12px;
  font-size: clamp(2.6rem, 5.4vw, 4.6rem);
  line-height: .95;
}
.atlas-intro-subtitle {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1.2;
  font-weight: 500;
}
.atlas-intro-text-flow {
  max-width: 860px;
}
.atlas-intro-copy > p,
.atlas-intro-text-flow p {
  margin: 0 0 14px;
  font-size: .98rem;
  line-height: 1.72;
  color: rgba(255,255,255,.96);
}
.atlas-intro-copy .atlas-intro-lead,
.atlas-intro-text-flow .atlas-intro-lead {
  margin-top: 18px;
  font-size: 1.15rem !important;
  font-weight: 700;
}
.atlas-intro-closing {
  margin-bottom: 6px;
  font-weight: 700;
}
.atlas-intro-stat-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
  max-width: 940px;
}
.atlas-intro-stat-card {
  min-height: 118px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.10);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.atlas-intro-stat-card strong {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3vw, 2.6rem);
  line-height: .95;
  color: #fff;
}
.atlas-intro-stat-card span {
  display: block;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: .92rem;
  font-weight: 800;
  color: rgba(255,255,255,.94);
}
.atlas-intro-pill-row span,
.atlas-intro-steps > div {
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.22);
}
.atlas-intro-steps span {
  background: rgba(255,255,255,.18);
  color: #fff;
}
.atlas-intro-actions {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 20px;
  z-index: 3;
  margin: 0;
  padding-top: 0;
  border-top: 0;
}
.atlas-intro-actions button {
  min-width: 118px;
  padding: 11px 18px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}
.atlas-intro-secondary {
  border: 1px solid rgba(255,255,255,.24);
  background: rgba(255,255,255,.16);
  color: #f7f0f4;
}
.atlas-intro-secondary:disabled {
  opacity: .38;
  background: rgba(255,255,255,.10);
  color: rgba(255,255,255,.72);
}
.atlas-intro-primary {
  border: 1px solid rgba(255,255,255,.30);
  background: rgba(56, 56, 64, .72);
  color: #fff;
  margin-left: auto;
}
.atlas-intro-primary:hover,
.atlas-intro-secondary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0,0,0,.18);
}
.atlas-intro-overlay {
  padding: 16px;
}
@media (max-width: 960px) {
  .atlas-intro-card.atlas-intro-card-photo {
    width: min(100%, calc(100vw - 20px));
    height: min(100dvh - 20px, 900px);
    max-height: min(100dvh - 20px, 900px);
  }
  .atlas-intro-copy {
    margin: 62px 16px 86px;
    padding: 16px 16px 18px;
  }
  .atlas-intro-copy h2 {
    max-width: 12ch;
    font-size: clamp(2.2rem, 7vw, 3.6rem);
  }
  .atlas-intro-stat-panel {
    grid-template-columns: 1fr;
  }
  .atlas-intro-stat-card {
    min-height: 104px;
  }
}
@media (max-width: 760px) {
  .atlas-intro-card.atlas-intro-card-photo {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .atlas-intro-overlay {
    padding: 0;
  }
  .atlas-intro-progress {
    top: 18px;
    left: 18px;
  }
  .atlas-intro-close {
    top: 14px;
    right: 14px;
  }
  .atlas-intro-copy {
    height: calc(100% - 92px);
    margin: 54px 12px 82px;
    border-radius: 18px;
  }
  .atlas-intro-text-flow p,
  .atlas-intro-copy > p {
    font-size: .92rem;
    line-height: 1.64;
  }
  .atlas-intro-actions {
    left: 12px;
    right: 12px;
    bottom: 14px;
  }
  .atlas-intro-actions button {
    min-width: 104px;
  }
}


/* ==============================================
   AJUSTES V30 — CONSISTENCIA DE TARJETAS INTRO
   ============================================== */
.atlas-intro-copy {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}
.atlas-intro-copy.atlas-intro-copy-intro {
  padding-bottom: 34px;
}
.atlas-intro-copy-compact {
  justify-content: space-between;
}
.atlas-intro-copy-compact h2 {
  max-width: 12ch;
}
.atlas-intro-text-flow-short p,
.atlas-intro-copy-compact > p,
.atlas-intro-copy-compact .atlas-intro-small {
  font-size: 1.08rem !important;
  line-height: 1.75;
}
.atlas-intro-copy-compact .atlas-intro-small {
  color: rgba(255,255,255,.94) !important;
  margin: 6px 0 0;
}
.atlas-intro-steps-wide {
  gap: 12px;
  margin: 20px 0 8px;
}
.atlas-intro-steps-wide > div {
  padding: 10px 12px;
  border-radius: 14px;
}
.atlas-intro-steps-wide p {
  font-size: 1rem;
  line-height: 1.55;
}
.atlas-intro-stat-panel {
  margin-top: auto;
  padding-top: 18px;
}
/* asegurar que el texto largo del primer panel pueda seguir creciendo */
.atlas-intro-text-flow {
  flex: 0 0 auto;
}
.atlas-intro-card-photo .atlas-intro-slide.active {
  overflow: hidden;
}
@media (max-width: 960px) {
  .atlas-intro-text-flow-short p,
  .atlas-intro-copy-compact > p,
  .atlas-intro-copy-compact .atlas-intro-small,
  .atlas-intro-steps-wide p {
    font-size: 1rem !important;
  }
}
@media (max-width: 760px) {
  .atlas-intro-copy-compact h2 {
    max-width: 13ch;
  }
  .atlas-intro-text-flow-short p,
  .atlas-intro-copy-compact > p,
  .atlas-intro-copy-compact .atlas-intro-small,
  .atlas-intro-steps-wide p {
    font-size: .97rem !important;
    line-height: 1.65;
  }
}


/* ==============================================
   AJUSTES V31 — INDICADORES SOLO EN TARJETA 2 + SCROLL INTRO
   ============================================== */
.atlas-intro-slide[data-intro-slide="0"] .atlas-intro-copy {
  overflow-y: scroll !important;
  overflow-x: hidden !important;
  max-height: calc(100% - 154px) !important;
  height: calc(100% - 154px) !important;
  padding-right: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.45) rgba(255,255,255,.10);
}
.atlas-intro-slide[data-intro-slide="0"] .atlas-intro-copy::-webkit-scrollbar {
  width: 10px;
}
.atlas-intro-slide[data-intro-slide="0"] .atlas-intro-copy::-webkit-scrollbar-track {
  background: rgba(255,255,255,.10);
  border-radius: 999px;
}
.atlas-intro-slide[data-intro-slide="0"] .atlas-intro-copy::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.46);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.atlas-intro-slide[data-intro-slide="1"] .atlas-intro-stat-panel {
  display: grid;
}
.atlas-intro-slide[data-intro-slide="0"] .atlas-intro-stat-panel,
.atlas-intro-slide[data-intro-slide="2"] .atlas-intro-stat-panel,
.atlas-intro-slide[data-intro-slide="3"] .atlas-intro-stat-panel {
  display: none !important;
}
@media (max-width: 760px) {
  .atlas-intro-slide[data-intro-slide="0"] .atlas-intro-copy {
    max-height: calc(100% - 140px) !important;
    height: calc(100% - 140px) !important;
  }
}

/* ==============================================
   AJUSTES V32 — SCROLL FUNCIONAL EN INTRODUCCIÓN
   ============================================== */
.atlas-intro-slide[data-intro-slide="0"] .atlas-intro-copy {
  position: absolute !important;
  top: 70px !important;
  left: 24px !important;
  right: 24px !important;
  bottom: 86px !important;
  width: auto !important;
  height: auto !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 18px 20px 34px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.48) rgba(255,255,255,.12);
}
.atlas-intro-slide[data-intro-slide="0"] .atlas-intro-copy::-webkit-scrollbar {
  width: 10px;
}
.atlas-intro-slide[data-intro-slide="0"] .atlas-intro-copy::-webkit-scrollbar-track {
  background: rgba(255,255,255,.12);
  border-radius: 999px;
}
.atlas-intro-slide[data-intro-slide="0"] .atlas-intro-copy::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.52);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
@media (max-width: 760px) {
  .atlas-intro-slide[data-intro-slide="0"] .atlas-intro-copy {
    top: 56px !important;
    left: 12px !important;
    right: 12px !important;
    bottom: 78px !important;
    padding: 16px 16px 28px !important;
  }
}


/* ==============================================
   AJUSTES V33 — INDICADORES VERTICALES TARJETA 2 + SCROLL EN TODAS
   ============================================== */
/* Todas las tarjetas usan un área interna desplazable, útil también en pantallas pequeñas. */
.atlas-intro-slide .atlas-intro-copy {
  position: absolute !important;
  top: 70px;
  left: 24px;
  right: 24px;
  bottom: 86px;
  width: auto !important;
  height: auto !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 18px 20px 30px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.48) rgba(255,255,255,.12);
}
.atlas-intro-slide .atlas-intro-copy::-webkit-scrollbar {
  width: 10px;
}
.atlas-intro-slide .atlas-intro-copy::-webkit-scrollbar-track {
  background: rgba(255,255,255,.12);
  border-radius: 999px;
}
.atlas-intro-slide .atlas-intro-copy::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.52);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.atlas-intro-slide[data-intro-slide="0"] .atlas-intro-copy {
  padding-right: 16px !important;
}

/* Tarjeta 2: texto a la izquierda, indicadores en columna a la derecha. */
.atlas-intro-slide[data-intro-slide="1"] .atlas-intro-copy {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 280px;
  grid-template-areas:
    "kicker stats"
    "title stats"
    "text stats";
  column-gap: 26px;
  row-gap: 8px;
  align-content: start;
}
.atlas-intro-slide[data-intro-slide="1"] .atlas-intro-kicker { grid-area: kicker; }
.atlas-intro-slide[data-intro-slide="1"] h2 { grid-area: title; max-width: 8ch; margin-bottom: 8px; }
.atlas-intro-slide[data-intro-slide="1"] .atlas-intro-text-flow { grid-area: text; }
.atlas-intro-slide[data-intro-slide="1"] .atlas-intro-stat-panel {
  grid-area: stats;
  display: grid !important;
  grid-template-columns: 1fr;
  gap: 14px;
  align-self: center;
  margin-top: 0;
  padding-top: 0;
  max-width: 100%;
}
.atlas-intro-slide[data-intro-slide="1"] .atlas-intro-stat-card {
  min-height: 112px;
}

/* Las demás tarjetas siguen sin indicadores visibles. */
.atlas-intro-slide[data-intro-slide="0"] .atlas-intro-stat-panel,
.atlas-intro-slide[data-intro-slide="2"] .atlas-intro-stat-panel,
.atlas-intro-slide[data-intro-slide="3"] .atlas-intro-stat-panel {
  display: none !important;
}

/* Ajustes para que las pantallas 3 y 4 respiren un poco más. */
.atlas-intro-slide[data-intro-slide="2"] h2,
.atlas-intro-slide[data-intro-slide="3"] h2 {
  max-width: 9ch;
}
.atlas-intro-slide[data-intro-slide="2"] .atlas-intro-text-flow-short p,
.atlas-intro-slide[data-intro-slide="3"] .atlas-intro-text-flow-short p,
.atlas-intro-slide[data-intro-slide="3"] .atlas-intro-steps-wide p,
.atlas-intro-slide[data-intro-slide="3"] .atlas-intro-small {
  font-size: 1.03rem !important;
}

/* Tablet y móvil: una sola columna y scroll seguro. */
@media (max-width: 980px) {
  .atlas-intro-slide[data-intro-slide="1"] .atlas-intro-copy {
    grid-template-columns: 1fr;
    grid-template-areas:
      "kicker"
      "title"
      "text"
      "stats";
  }
  .atlas-intro-slide[data-intro-slide="1"] h2 {
    max-width: 11ch;
  }
  .atlas-intro-slide[data-intro-slide="1"] .atlas-intro-stat-panel {
    grid-template-columns: 1fr;
    margin-top: 14px;
  }
}
@media (max-width: 760px) {
  .atlas-intro-slide .atlas-intro-copy {
    top: 56px !important;
    left: 12px !important;
    right: 12px !important;
    bottom: 78px !important;
    padding: 16px 16px 26px !important;
    border-radius: 18px;
  }
  .atlas-intro-slide[data-intro-slide="1"] .atlas-intro-stat-card {
    min-height: 96px;
  }
  .atlas-intro-slide[data-intro-slide="2"] .atlas-intro-text-flow-short p,
  .atlas-intro-slide[data-intro-slide="3"] .atlas-intro-text-flow-short p,
  .atlas-intro-slide[data-intro-slide="3"] .atlas-intro-steps-wide p,
  .atlas-intro-slide[data-intro-slide="3"] .atlas-intro-small {
    font-size: .97rem !important;
  }
}


/* ==============================================
   AJUSTES V35 — TÍTULOS Y SUBTÍTULOS DE INTRO
   ============================================== */
.atlas-intro-subtitle-card {
  margin: -2px 0 18px;
  max-width: 28ch;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  line-height: 1.18;
  font-weight: 500;
  color: #fff;
}
.atlas-intro-slide[data-intro-slide="1"] h2,
.atlas-intro-slide[data-intro-slide="2"] h2,
.atlas-intro-slide[data-intro-slide="3"] h2 {
  max-width: none !important;
  font-size: clamp(3rem, 5.8vw, 5.4rem);
  line-height: .95;
  margin-bottom: 10px;
}
.atlas-intro-slide[data-intro-slide="1"] .atlas-intro-subtitle-card {
  grid-area: subtitle;
}
.atlas-intro-slide[data-intro-slide="1"] .atlas-intro-copy {
  grid-template-areas:
    "kicker stats"
    "title stats"
    "subtitle stats"
    "text stats";
}
@media (max-width: 980px) {
  .atlas-intro-slide[data-intro-slide="1"] .atlas-intro-copy {
    grid-template-areas:
      "kicker"
      "title"
      "subtitle"
      "text"
      "stats";
  }
}
@media (max-width: 760px) {
  .atlas-intro-slide[data-intro-slide="1"] h2,
  .atlas-intro-slide[data-intro-slide="2"] h2,
  .atlas-intro-slide[data-intro-slide="3"] h2 {
    font-size: clamp(2.5rem, 12vw, 4rem);
  }
  .atlas-intro-subtitle-card {
    font-size: clamp(1.2rem, 5vw, 1.6rem);
    max-width: 24ch;
  }
}


/* ==============================================
   AJUSTES V36 — ILUSTRACIÓN EN MAPEO COLECTIVO
   ============================================== */
.atlas-intro-slide[data-intro-slide="2"] .atlas-intro-copy-map {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 40%);
  gap: 34px;
  align-items: center;
}
.atlas-intro-map-text { min-width: 0; }
.atlas-intro-map-illustration {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.atlas-intro-map-illustration img {
  display: block;
  width: min(100%, 500px);
  height: auto;
  max-height: 520px;
  object-fit: contain;
  filter: drop-shadow(0 16px 28px rgba(0,0,0,.2));
}
@media (max-width: 980px) {
  .atlas-intro-slide[data-intro-slide="2"] .atlas-intro-copy-map {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .atlas-intro-map-illustration img {
    width: min(90%, 520px);
    max-height: 360px;
  }
}
@media (max-width: 760px) {
  .atlas-intro-map-illustration img {
    width: min(94%, 460px);
    max-height: 300px;
  }
}
