* { box-sizing: border-box; }
html, body { margin: 0; background: #f4f9ff; color: #10202e; line-height: 1.4;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
body.pagina-visor { display: flex; flex-direction: column; height: 100vh; overflow: auto; }
#app { display: flex; flex: 1 1 auto; height: auto; min-height: 420px; position: relative; z-index: 0; }
#panel { width: 344px; flex: 0 0 344px; background: #fff; border-right: 1px solid #e3edf7;
  display: flex; flex-direction: column; overflow: hidden; }
input, button { font-family: inherit; }
input[type="checkbox"] { accent-color: #4a90e2; }

.brand { padding: 18px 18px 6px; }
.brand h1, .brand h2 { font-size: 19px; margin: 0 0 4px; font-weight: 800; letter-spacing: -.01em; }
.brand p { margin: 0; color: #93a3b3; font-size: 12px; }

.acciones { display: flex; gap: 8px; padding: 12px 18px; }
.btn { flex: 1; border: 1px solid #e3edf7; background: #fff; border-radius: 999px; padding: 9px 14px;
  font-size: 13px; font-weight: 600; color: #10202e; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.btn:hover { background: #f2f8ff; }
.btn.ghost { color: #5c6b7a; }

.btn.activo { background: #e8f3fd; border-color: #cfe3f8; color: #2f6fd0; }
.oculto { display: none !important; }

.filtros { padding: 0 18px 4px; }
.territorio-trigger { width: 100%; display: flex; align-items: center; gap: 10px; border: 1px solid #e3edf7;
  background: #fff; border-radius: 14px; padding: 9px 12px; cursor: pointer; text-align: left; }
.territorio-trigger:hover { background: #f2f8ff; }
.territorio-trigger.activo { border-color: #a9cdf3; background: #eef6ff; }
.territorio-trigger .tt-ico { font-size: 15px; }
.territorio-trigger .tt-txt { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.territorio-trigger .tt-lbl { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #93a3b3; }
.territorio-trigger .tt-resumen { font-size: 13px; font-weight: 600; color: #10202e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.territorio-trigger .tt-chev { color: #93a3b3; font-size: 18px; line-height: 1; }
.filtro-switch { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 7px 10px;
  border: 1px solid #e3edf7; border-radius: 12px; background: #fff; cursor: pointer; }
.filtro-switch:hover { background: #f2f8ff; }
.filtro-switch input { accent-color: #4a90e2; width: 15px; height: 15px; cursor: pointer; }
.filtro-switch span { font-size: 12.5px; font-weight: 600; color: #33465c; }

/* Rótulos de ciudades, comunas y veredas sobre el mapa */
.etiqueta { width: 0; height: 0; }
.etiqueta span { display: inline-block; transform: translate(-50%, -50%); white-space: nowrap;
  background: rgba(255, 255, 255, .94); border: 1px solid #cfe3f8; border-radius: 999px;
  padding: 1px 8px; font-size: 11px; font-weight: 700; color: #10202e;
  box-shadow: 0 1px 4px rgba(16, 32, 46, .2); }
.etiqueta.etiqueta-suave span { background: rgba(23, 190, 187, .93); border-color: #0b7a75; color: #fff; }
.d-flujo-botones { display: flex; gap: 8px; margin-top: 8px; }
.d-flujo-botones .btn { flex: 1; }
.d-flujo-botones .btn:disabled { opacity: .45; cursor: default; }

#buscar { margin: 6px 18px 4px; padding: 11px 14px; border: 1px solid #e3edf7;
  border-radius: 999px; font-size: 13px; outline: none; background: #f8fbff; }
#buscar:focus { border-color: #a9cdf3; background: #fff; }

.resultados { padding: 0 12px; max-height: 210px; overflow: auto; }
.res { padding: 8px; border-radius: 12px; cursor: pointer; display: flex; flex-direction: column; }
.res:hover { background: #f2f8ff; }
.res small { color: #5c6b7a; font-size: 11px; }
.vacio { color: #93a3b3; font-size: 12px; padding: 8px; }

.lista { overflow: auto; padding: 8px 12px 24px; flex: 1; }
.capa { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 12px; cursor: pointer; }
.capa:hover { background: #f2f8ff; }
.capa .dot { width: 12px; height: 12px; flex: 0 0 12px; border-radius: 5px; }
.capa .nom { flex: 1; display: flex; flex-direction: column; font-size: 13px; line-height: 1.25; color: #10202e; }
.capa .nom small { color: #93a3b3; font-size: 11px; }
.capa .zoom { border: 0; background: transparent; cursor: pointer; color: #5c6b7a; font-size: 14px; }

#mapa { flex: 1; }

.pop { max-height: 260px; overflow: auto; }
.pop table { border-collapse: collapse; font-size: 12px; }
.pop th { text-align: left; color: #5c6b7a; font-weight: 600; padding: 2px 10px 2px 0; vertical-align: top; white-space: nowrap; }
.pop td { padding: 2px 0; }
.muted { color: #93a3b3; }

.abrir-panel, .cerrar-panel { display: none; }

@media (max-width: 760px) {
  body.pagina-visor { height: auto; overflow: visible; }
  #app { flex-direction: column; min-height: 0; }
  #app.panel-abierto { z-index: 60; }
  #panel { position: fixed; top: 0; right: 0; bottom: 0; left: 0; width: 100%; max-height: none;
    z-index: 1100; border-right: 0; transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 0 0 40px rgba(16, 32, 46, .25); }
  #panel.abierto { transform: translateX(0); }
  #mapa { flex: 0 0 auto; height: 72vh; }
  .abrir-panel { display: inline-flex; position: absolute; top: 12px; left: 60px; z-index: 800;
    align-items: center; gap: 6px; border: 1px solid #e3edf7; background: #fff; border-radius: 999px;
    padding: 8px 14px; font-size: 13px; font-weight: 600; color: #10202e; cursor: pointer;
    box-shadow: 0 6px 18px rgba(16, 32, 46, .18); }
  .cerrar-panel { display: inline-flex; position: absolute; top: 12px; right: 12px; z-index: 1;
    align-items: center; justify-content: center; width: 34px; height: 34px; border: 0;
    background: #eef6ff; color: #5c6b7a; border-radius: 999px; font-size: 15px; cursor: pointer; }
  .cerrar-panel:hover { color: #10202e; }
}

.capa .info, .capa .flujo-btn { border: 0; background: transparent; cursor: pointer; color: #5c6b7a; font-size: 14px; }
/* Botón de opacidad: muestra el % actual y cicla 100 → 80 → 40 → 20 */
.capa .opac-btn { border: 0; background: transparent; cursor: pointer; color: #5c6b7a;
  font-size: 11px; font-variant-numeric: tabular-nums; padding: 0 2px; }
.capa .flujo-btn.activo { color: #4a90e2; }
.capa .flujo-btn:hover, .capa .info:hover, .capa .zoom:hover, .capa .opac-btn:hover { color: #10202e; }

.detalle { position: fixed; inset: 0; background: rgba(16, 32, 46, .5);
  display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 1000; }
.detalle.oculto { display: none; }
.detalle-caja { width: 560px; max-width: 100%; max-height: 88vh; background: #fff; border-radius: 20px;
  overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(16, 32, 46, .3); }

.detalle-cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 20px 14px; border-bottom: 1px solid #e3edf7; }
.detalle-titulo { display: flex; gap: 10px; align-items: flex-start; }
.detalle-titulo .dot { width: 14px; height: 14px; border-radius: 5px; margin-top: 5px; flex: 0 0 14px; }
.detalle-cab h2 { margin: 0; font-size: 17px; font-weight: 800; }
.detalle-cab p { margin: 2px 0 0; color: #93a3b3; font-size: 12px; }
.cerrar { border: 0; background: transparent; font-size: 16px; color: #5c6b7a; cursor: pointer; line-height: 1; }
.cerrar:hover { color: #10202e; }

.detalle-cuerpo { padding: 18px 20px; overflow: auto; }
.detalle-cuerpo h3 { font-size: 12px; margin: 20px 0 8px; color: #2f6fd0; text-transform: uppercase; letter-spacing: .08em; }
.resumen { margin: 0; font-size: 14px; line-height: 1.5; }
.resumen b { color: #10202e; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.stat { background: #f4f9ff; border: 1px solid #e8f1fb; border-radius: 14px; padding: 12px; }
.stat .num { font-size: 18px; font-weight: 800; color: #10202e; }
.stat .lbl { font-size: 11px; color: #5c6b7a; margin-top: 2px; }
.extra { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.extra .pill { background: #e8f3fd; color: #2f6fd0; border: 1px solid #cfe3f8; border-radius: 999px;
  padding: 5px 12px; font-size: 12px; font-weight: 600; }
.nota { margin-top: 10px; font-size: 12px; color: #5c6b7a; line-height: 1.5; }

.campos { display: flex; flex-wrap: wrap; gap: 6px; }
.campos .chip { background: #eef6ff; border: 1px solid #e0eefb; border-radius: 8px; padding: 4px 9px; font-size: 12px; color: #2f6fd0; }

.tecnicos { width: 100%; border-collapse: collapse; font-size: 13px; }
.tecnicos th { text-align: left; color: #5c6b7a; font-weight: 600; padding: 6px 12px 6px 0; width: 45%; vertical-align: top; }
.tecnicos td { padding: 6px 0; color: #10202e; }

.detalle-pie { display: flex; gap: 10px; padding: 14px 20px; border-top: 1px solid #e3edf7; background: #fff; }
.detalle-pie .btn { flex: 1; }

@media (max-width: 760px) {
  .detalle { padding: 0; }
  .detalle-caja { width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

.lista-encab { margin: 0; padding: 12px 18px 2px; font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: #93a3b3; }

.cat { margin-bottom: 2px; }
.cat-cab { width: 100%; display: flex; align-items: center; gap: 8px; border: 0; background: transparent;
  padding: 8px; cursor: pointer; text-align: left; border-radius: 12px; }
.cat-cab:hover { background: #f2f8ff; }
.cat-cab .chev { color: #93a3b3; font-size: 11px; transition: transform .18s ease; }
.cat.cerrado .cat-cab .chev { transform: rotate(-90deg); }
.cat-txt { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cat-nom { font-size: 13px; font-weight: 700; color: #10202e; }
.cat-desc { font-size: 11px; color: #93a3b3; }
.cat-n { font-size: 11px; font-weight: 700; color: #2f6fd0; background: #e8f3fd; border-radius: 999px; padding: 2px 9px; }
.cat-cuerpo { padding: 2px 0 4px 8px; margin-left: 10px; border-left: 1px solid #e8f1fb; }
.cat.cerrado .cat-cuerpo { display: none; }

.detalle.borroso { backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.terr-caja { width: 640px; }
.terr-cuerpo { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; flex: 1; min-height: 0; }
.terr-col { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid #e3edf7; }
.terr-col:last-child { border-right: 0; }
.terr-col h3 { margin: 0; padding: 14px 16px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: #2f6fd0; }
.terr-lista { overflow: auto; padding: 0 8px 12px; flex: 1; }
.terr-item { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 10px; cursor: pointer; font-size: 13px; }
.terr-item:hover { background: #f2f8ff; }
.terr-item.on { background: #e8f3fd; }
.terr-item input { accent-color: #4a90e2; flex: 0 0 auto; }
.terr-vacio { color: #93a3b3; font-size: 12px; padding: 8px 16px; }

@media (max-width: 760px) {
  .terr-cuerpo { grid-template-columns: 1fr; }
  .terr-col { border-right: 0; border-bottom: 1px solid #e3edf7; max-height: 38vh; }
  .terr-col:last-child { border-bottom: 0; }
}

/* ── Segmentación minera: filtro y leyenda por tipo de mineral ───────── */
.mine-seg { padding: 4px 18px 2px; }
.mine-seg__cab { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.mine-seg__tt { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #93a3b3; }
.mine-seg__grupos { display: flex; gap: 6px; margin-bottom: 8px; }
.seg-chip { flex: 1; border: 1px solid #e3edf7; background: #fff; border-radius: 999px; padding: 7px 10px;
  font-size: 12px; font-weight: 600; color: #33465c; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s; }
.seg-chip:hover { background: #f2f8ff; }
.seg-chip.activo { background: #e8f3fd; border-color: #cfe3f8; color: #2f6fd0; }
.mine-seg__cats { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-cat { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #e3edf7; background: #fff;
  border-radius: 999px; padding: 5px 10px; font-size: 11.5px; font-weight: 600; color: #33465c; cursor: pointer;
  transition: background .15s, border-color .15s; }
.seg-cat i { width: 10px; height: 10px; border-radius: 4px; display: inline-block; font-style: normal; }
.seg-cat:hover { background: #f2f8ff; }
.seg-cat.activo { border-color: #a9cdf3; background: #eef6ff; }

/* ── Etiquetas de Popayán: barrios y veredas por comuna/corregimiento ─── */
.etiqueta.etiqueta-barrio span { background: rgba(255, 255, 255, .95); border-color: #f0cf8a; color: #7a5a12; }
.etiqueta.etiqueta-vereda span { background: rgba(197, 40, 61, .93); border-color: #8f1c2a; color: #fff; }

.etq-caja { width: 720px; }
.etq-barra { display: flex; gap: 10px; align-items: center; padding: 12px 20px 4px; }
.etq-barra #e-buscar { flex: 1; margin: 0; padding: 11px 14px; border: 1px solid #e3edf7;
  border-radius: 999px; font-size: 13px; outline: none; background: #f8fbff; }
.etq-barra #e-buscar:focus { border-color: #a9cdf3; background: #fff; }
.etq-barra .filtro-switch { margin-top: 0; flex: 0 0 auto; }
.etq-cuerpo { overflow: auto; padding: 4px 16px 14px; flex: 1; min-height: 0; }
.etq-sec { border: 1px solid #e3edf7; border-radius: 14px; margin: 10px 0; overflow: hidden; }
.etq-sec-cab { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #f8fbff; cursor: pointer; }
.etq-sec-cab input { accent-color: #4a90e2; width: 16px; height: 16px; }
.etq-sec-t { display: flex; flex-direction: column; }
.etq-sec-t b { font-size: 13px; color: #10202e; }
.etq-sec-t small { color: #93a3b3; font-size: 11px; }
.etq-items { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; }
.etq-item { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #e3edf7; background: #fff;
  border-radius: 999px; padding: 5px 10px; font-size: 12px; cursor: pointer; color: #33465c; }
.etq-item:hover { background: #f2f8ff; }
.etq-item.on { background: #e8f3fd; border-color: #a9cdf3; color: #2f6fd0; font-weight: 600; }
.etq-sec.oculto { display: none; }
.etq-vacio { color: #93a3b3; font-size: 12px; padding: 10px; }
@media (max-width: 760px) { .etq-sec-cab { padding: 9px 10px; } }
