/* Diagnóstico comunitario · Fundación NABEP · v1.2 — permisos y contactos */
.kpis.three-k { grid-template-columns: repeat(3, 1fr); }
.kpi-value small { font-size: .5em; color: var(--muted); margin-left: 4px; font-weight: 700; }
.select.sm { height: 32px; font-size: 12.5px; padding: 0 28px 0 10px; }
.empty.sm { padding: 24px 12px; }
.req small.blk { display: block; font-weight: 600; margin-top: 2px; }

/* ---------- permisos del proyecto */
.perms { display: flex; flex-direction: column; gap: 10px; }
.perm { border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.perm-top { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.perm-top > div { min-width: 0; }
.perm-top b { display: block; font: 800 14px/1.3 var(--font-ui); color: var(--navy); }
.perm-top small { color: var(--muted); font-size: 12.5px; }
.perm-dates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.perm-dates label { display: flex; flex-direction: column; gap: 4px; font: 700 11.5px var(--font-ui); color: var(--muted); min-width: 0; }
.perm-dates input, .perm-nota, .perm-add input { height: 34px; border: 1px solid var(--line-strong); border-radius: 7px; padding: 0 9px; font: 13px var(--font-body); color: var(--ink); background: var(--surface); min-width: 0; width: 100%; }
.perm-dates input:focus, .perm-nota:focus, .perm-add input:focus { outline: 2px solid var(--sky); outline-offset: 0; border-color: transparent; }
.perm-docs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.perm-docs label.btn { cursor: pointer; }
.pdoc { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; }
.pdoc-open { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--sky-soft); border-radius: 8px; padding: 5px 10px; cursor: pointer; min-width: 0; max-width: 100%; text-align: left; transition: border-color 150ms ease; }
.pdoc-open .gi { width: 16px; height: 16px; color: var(--blue); flex: none; }
.pdoc-open span { font: 700 12.5px var(--font-ui); color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdoc-open small { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
@media (hover: hover) and (pointer: fine) { .pdoc-open:hover { border-color: var(--sky); } }
.perm-add { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.psug { display: flex; flex-direction: column; }
.psug-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.psug-row:last-child { border-bottom: 0; }
.psug-row b { display: block; font: 700 13.5px var(--font-ui); color: var(--navy); }
.psug-row small { color: var(--muted); font-size: 12.5px; }

/* ---------- biblioteca de permisos */
.plib { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.plib-list { display: flex; flex-direction: column; }
.plib-row { display: flex; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.plib-row:last-child { border-bottom: 0; }
.plib-row > div:first-child { min-width: 0; }
.plib-row b { display: block; font: 700 13.5px var(--font-ui); color: var(--navy); }
.plib-row small { color: var(--muted); font-size: 12.5px; }
.plib-row p { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-2); }
.plib-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.plib-meta span { font: 700 11.5px var(--font-ui); color: var(--blue); background: var(--sky-soft); border-radius: 6px; padding: 2px 8px; white-space: nowrap; }
.plib-meta span.muted { background: var(--sunken); color: var(--muted); }

/* ---------- pestañas Comunidades / Contactos */
.ctabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px 0 18px; }
.ctabs a { padding: 10px 14px; font: 700 13.5px var(--font-ui); color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 6px; }
.ctabs a[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--navy); }
.ctabs .n { font: 700 11px/1 var(--font-ui); padding: 2px 6px; border-radius: 10px; background: var(--sunken); color: var(--muted); }
@media (hover: hover) and (pointer: fine) { .ctabs a:hover { color: var(--ink); } }

/* ---------- cobertura de cargos clave */
table.cov td, table.cov th { vertical-align: middle; }
.cov-ok { display: inline-block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 12.5px var(--font-ui); color: var(--low); background: var(--low-soft); border-radius: 6px; padding: 3px 8px; }
.cov-no { font: 700 12px var(--font-ui); color: var(--crit); background: var(--crit-soft); border: 0; border-radius: 6px; padding: 4px 10px; cursor: pointer; transition: transform 140ms var(--ease-out); }
.cov-no:active { transform: scale(0.97); }

/* ---------- formulario de contacto */
.ctform { padding: 0; margin-top: 20px; }
.ctform > summary { list-style: none; cursor: pointer; padding: 16px 20px; font: 800 14px var(--font-ui); color: var(--navy); }
.ctform > summary::-webkit-details-marker { display: none; }
.ctform > summary span { display: inline-flex; align-items: center; gap: 8px; }
.ctform > summary svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }
.ctgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 4px 20px 0; }
.ctgrid .field[hidden] { display: none; }
.ctgrid .field.wide { grid-column: 1 / -1; }
.ctgrid .field input, .ctgrid .field select { width: 100%; min-width: 0; }
.ctform-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px 18px; }

/* ---------- directorio */
.ctgroup { margin-bottom: 18px; }
.ctgroup .section-title .n { font: 700 12px/1 var(--font-ui); padding: 3px 8px; border-radius: 10px; background: var(--sunken); color: var(--muted); vertical-align: middle; }
.ctlist { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); }
.ct { display: grid; grid-template-columns: 38px minmax(0, 1fr) minmax(0, 300px); gap: 14px; padding: 14px 16px; border-top: 1px solid var(--line); align-items: start; }
.ct:first-child { border-top: 0; }
.ct-av { width: 38px; height: 38px; border-radius: 50%; background: var(--sky-soft); display: grid; place-items: center; color: var(--blue); }
.ct-av svg, .ct-links svg, .ctm svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ct-main { min-width: 0; }
.ct-cargo { display: block; font: 700 11.5px var(--font-ui); color: var(--blue); text-transform: uppercase; letter-spacing: .04em; }
.ct-main b { display: block; font: 800 15px var(--font-ui); color: var(--navy); margin-top: 2px; }
.ct-inst { display: block; font-size: 13px; color: var(--ink-2); }
.ct-nota { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.ct-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; min-width: 0; }
.ct-where { font: 700 12px var(--font-ui); color: var(--ink-2); }
.ct-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 12px; }
.ct-links a, .ctm a { display: inline-flex; align-items: center; gap: 5px; font: 700 12.5px var(--font-ui); color: var(--blue); text-decoration: none; }
.ct-ult { color: var(--faint); font-size: 12px; }
.ct-act { display: flex; gap: 6px; align-items: center; margin-top: 4px; }

table.cttable td { vertical-align: top; }
table.cttable .name { display: block; }
table.cttable .ct-cargo { margin-bottom: 1px; }
table.cttable .ct-nota { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); }
.ct-tel { display: inline-flex; align-items: center; gap: 5px; font: 700 12.5px var(--font-ui); color: var(--blue); text-decoration: none; }
.ct-tel.blk { display: flex; margin-top: 3px; }
.ct-tel svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
td.ct-acts { white-space: nowrap; text-align: right; vertical-align: middle; }
td.ct-acts .btn, td.ct-acts .icon-x { vertical-align: middle; display: inline-flex; }
td.ct-acts .btn + .btn, td.ct-acts .icon-x { margin-left: 4px; }

/* ---------- contactos en la ficha de la comunidad */
.ctcols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.ctcols .sub-h { margin-top: 4px; }
.ctcols .sub-h .n { font: 700 11px/1 var(--font-ui); padding: 2px 6px; border-radius: 10px; background: var(--sunken); color: var(--muted); }
.ctmini { display: flex; flex-direction: column; gap: 8px; }
.ctm { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ctm small { font: 700 11px var(--font-ui); color: var(--blue); text-transform: uppercase; letter-spacing: .04em; }
.ctm b { font: 800 13.5px var(--font-ui); color: var(--navy); }
.ctpanel .callout { margin: 0 0 16px; }
.inl-btn { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--blue); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

@media (max-width: 1180px) {
  .plib { grid-template-columns: 1fr; }
  .ctgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .kpis.three-k { grid-template-columns: 1fr; }
  .kpis.three-k .kpi { border-left: 0; border-top: 1px solid var(--line); }
  .kpis.three-k .kpi:first-child { border-top: 0; }
  .perm-dates { grid-template-columns: 1fr 1fr; }
  .perm-add { grid-template-columns: 1fr; }
  .ct { grid-template-columns: 38px minmax(0, 1fr); }
  .ct-side { grid-column: 2; align-items: flex-start; text-align: left; }
  .ct-links { justify-content: flex-start; }
  .ctcols, .ctgrid { grid-template-columns: 1fr; }
  .perm-top { flex-direction: column; }
}

/* ---------- pines del mapa: los que van debajo animan desde su propia posición, y con
   «reducir movimiento» conservan su desplazamiento (antes quedaban corridos) */
@keyframes pop-below { from { opacity: 0; transform: translate(-50%, -8px) scale(0.85); } }
.anim .pin.pop.below { animation-name: pop-below; }
@media (prefers-reduced-motion: reduce) {
  .anim .pin.pop { transform: translate(-50%, -100%); }
  .anim .pin.pop.below { transform: translate(-50%, -8px); }
}
