/* Estilos propios sobre Bootstrap 5.
   Paleta del café: papel cálido de fondo, verde hoja de la marca como único acento fuerte
   y rojo cereza solo para bajas y errores. El protagonista de la página es el mapa. */
:root {
  --verde: #0f5b1e;
  --verde-oscuro: #0a3315;
  --verde-tinte: #e6efe1;
  --verde-tinte-2: #cfe0c8;
  --cereza: #b5312b;
  --tinta: #1b2219;
  --tinta-2: #4a544a;
  --linea: #d6d2c8;
  --linea-fuerte: #b9b4a8;
  --papel: #eeebe4;
  --papel-2: #e4e0d7;
  --blanco: #ffffff;
  --radio: 6px;
  --fuente-titulos: "Red Hat Display", "Segoe UI", system-ui, sans-serif;
  --fuente-texto: "Red Hat Text", "Segoe UI", system-ui, sans-serif;

  --bs-body-font-family: var(--fuente-texto);
  --bs-body-color: var(--tinta);
  --bs-body-bg: var(--papel);
  --bs-border-color: var(--linea);
  --bs-secondary-color: var(--tinta-2);
  --bs-link-color-rgb: 15, 91, 30;
  --bs-link-hover-color-rgb: 10, 51, 21;
}

body { background: var(--papel); color: var(--tinta); }
h1, h2, h3, .marca, .seccion-titulo { font-family: var(--fuente-titulos); text-wrap: balance; }
.text-body-secondary { color: var(--tinta-2) !important; }
main.container-xl { padding-block: 1.75rem 2.5rem; }

/* ---------- barra superior ---------- */
.barra { background: var(--blanco); border-bottom: 1px solid var(--linea); }
.barra-int { display: flex; align-items: stretch; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.barra-izq { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; padding-block: .75rem; }
.marca { font-weight: 700; color: var(--tinta); text-decoration: none; font-size: 1.05rem; padding-left: 1.25rem; border-left: 1px solid var(--linea); line-height: 1.2; }
.marca:hover, .marca:focus-visible { color: var(--verde); }
.marca span { display: block; font-family: var(--fuente-texto); font-weight: 400; font-size: .85rem; color: var(--tinta-2); }

/* Logos institucionales: Plan Nescafé | Fundación | Cohonducafé.
   Cada logo tiene su propia altura para que se vean del mismo peso visual. */
.logos { display: flex; align-items: center; gap: 1rem; }
.logo { display: block; width: auto; }
.logo + .logo { padding-left: 1rem; border-left: 1px solid var(--linea); }
.logo-plan { height: 40px; }
.logo-fundacion { height: 26px; }
.logo-honducafe { height: 48px; }
@media (max-width: 575.98px) {
  .logos { gap: .6rem; }
  .logo + .logo { padding-left: .6rem; }
  .logo-plan { height: 28px; }
  .logo-fundacion { height: 18px; }
  .logo-honducafe { height: 32px; }
  .marca { border-left: 0; padding-left: 0; }
}

/* Navegación como pestañas: la activa lleva una línea verde abajo. */
.barra-nav { display: flex; align-items: stretch; gap: .25rem; flex-wrap: wrap; }
.barra-nav .nav-link { display: flex; align-items: center; color: var(--tinta-2); font-weight: 500; padding: .9rem .75rem; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.barra-nav .nav-link:hover, .barra-nav .nav-link:focus-visible { color: var(--tinta); }
.barra-nav .nav-link.active { color: var(--verde); font-weight: 700; border-bottom-color: var(--verde); }
.usuario { display: flex; align-items: center; gap: .5rem; margin-left: .75rem; padding-left: 1rem; border-left: 1px solid var(--linea); }
.usuario-chip { display: inline-flex; align-items: center; gap: .5rem; color: var(--tinta); text-decoration: none; font-weight: 500; font-size: .92rem; padding: .35rem .5rem; border-radius: var(--radio); }
.usuario-chip svg { width: 28px; height: 28px; padding: 5px; border-radius: 50%; background: var(--verde-tinte); color: var(--verde); }
.usuario-chip:hover, .usuario-chip:focus-visible, .usuario-chip.active { background: var(--verde-tinte); color: var(--verde-oscuro); }
.btn-salir { background: transparent; border: 1px solid var(--linea-fuerte); color: var(--tinta); border-radius: var(--radio); padding: .3rem .75rem; font-weight: 500; font-size: .88rem; }
.btn-salir:hover, .btn-salir:focus-visible { border-color: var(--verde); color: var(--verde); background: var(--verde-tinte); }

/* ---------- indicadores: tarjeta blanca con la fila principal destacada ---------- */
.indicadores { background: var(--blanco); border: 1px solid var(--linea); border-top: 4px solid var(--verde); border-radius: var(--radio); overflow: hidden; margin-bottom: 2.25rem; }
.ind-titulo { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem 1.5rem; flex-wrap: wrap; padding: 1.25rem 1.5rem 1rem; }
.ind-titulo h1 { font-size: clamp(1.4rem, 2.4vw, 1.85rem); font-weight: 800; margin: 0; letter-spacing: -0.015em; }
.ind-titulo p { font-size: .95rem; color: var(--tinta-2); margin: 0; }

.ind-fila { display: grid; border-top: 1px solid var(--linea); padding: 1.25rem 1.5rem .9rem; }
.ind-fila + .ind-fila { background: #f4f7f1; }
.ind-fila-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ind-fila-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ind-item { padding: 0 1.25rem .4rem 0; min-width: 0; }
.ind-item + .ind-item { padding-left: 1.25rem; border-left: 1px solid var(--linea); }
.ind-etiqueta { font-size: .92rem; font-weight: 500; color: var(--tinta-2); margin-bottom: .1rem; }
.ind-valor { font-family: var(--fuente-titulos); font-weight: 800; color: var(--verde-oscuro); font-size: clamp(1.9rem, 3.4vw, 2.8rem); line-height: 1.1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ind-cambio { color: var(--tinta-2); font-size: .85rem; margin-top: .2rem; }
.ind-cambio .sube { color: var(--verde); }
.ind-cambio .baja { color: var(--cereza); }

@media (max-width: 991.98px) {
  .ind-fila-4, .ind-fila-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: .75rem; }
  .ind-item:nth-child(odd) { border-left: 0; padding-left: 0; }
}
@media (max-width: 479.98px) {
  .ind-titulo { padding: 1rem 1rem .75rem; }
  .ind-fila { padding: 1rem 1rem .75rem; }
  .ind-fila-4, .ind-fila-3 { grid-template-columns: minmax(0, 1fr); row-gap: 0; }
  .ind-item { padding-right: 0; }
  .ind-item + .ind-item { border-left: 0; padding-left: 0; border-top: 1px solid var(--linea); padding-top: .75rem; }
}

/* ---------- mapa ---------- */
.seccion-titulo { font-size: 1.35rem; font-weight: 800; margin-bottom: .2rem; letter-spacing: -0.01em; }
.ayuda { color: var(--tinta-2); font-size: .9rem; }
.ruta { font-size: .95rem; }
.ruta .breadcrumb-item.active { color: var(--tinta); font-weight: 700; }
.ruta .breadcrumb-item + .breadcrumb-item::before { color: var(--linea-fuerte); }
.btn-ruta { background: none; border: 0; padding: 0; color: var(--verde); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--verde-tinte-2); }
.btn-ruta:hover { color: var(--verde-oscuro); text-decoration-color: currentColor; }

.mapa-marco { position: relative; border: 1px solid var(--linea); border-radius: var(--radio); overflow: hidden; }
#mapa { height: 640px; font-family: var(--fuente-texto); }
@media (max-width: 991.98px) { #mapa { height: 62vh; min-height: 380px; } }
.mapa-cargando { position: absolute; inset: 0; display: grid; place-items: center; color: var(--tinta-2); background: rgba(255, 255, 255, .85); z-index: 800; }
.leaflet-container .leaflet-control-attribution { background: rgba(255, 255, 255, .8); color: var(--tinta-2); font-size: .7rem; }
.leaflet-bar { border: 1px solid var(--linea) !important; box-shadow: none !important; }
.leaflet-bar a { color: var(--tinta); border-bottom-color: var(--linea) !important; }

.tip { font-family: var(--fuente-texto); font-size: .85rem; border-radius: var(--radio); }

/* Etiquetas de cantidad sobre el mapa */
.etq-ancla { background: none; border: 0; }
/* Punto exacto del municipio; la tarjeta puede moverse a un lado para no taparse con otra */
.etq-ancla::before {
  content: ""; position: absolute; left: -5px; top: -5px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--verde); border: 2px solid var(--blanco); box-shadow: 0 0 0 1px var(--verde);
}
.etq {
  position: absolute; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap;
  padding: .2rem .6rem .2rem .2rem; border-radius: 999px;
  background: var(--blanco); color: var(--tinta); border: 1px solid var(--linea-fuerte);
  box-shadow: 0 1px 2px rgba(27, 34, 25, .18);
  font: 700 .8rem/1 var(--fuente-texto); cursor: pointer;
}
.etq:hover, .etq.activa { border-color: var(--verde); }
.etq.activa { background: var(--verde); color: var(--blanco); }
.etq-n {
  display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.6rem; padding-inline: .3rem;
  border-radius: 999px; background: var(--verde); color: var(--blanco); font-variant-numeric: tabular-nums;
}
.etq.activa .etq-n { background: var(--blanco); color: var(--verde); }
.etq-cab { display: inline-flex; align-items: center; gap: .4rem; }

/* Etiqueta con nombres de socios: tarjeta pequeña en vez de píldora */
.etq.con-socios {
  flex-direction: column; align-items: stretch; gap: .3rem;
  border-radius: var(--radio); padding: .3rem .55rem .4rem .3rem; white-space: normal;
  width: max-content; max-width: 230px;
}
.etq-socios {
  list-style: none; margin: 0; padding: .3rem 0 0 .3rem;
  border-top: 1px solid var(--linea); display: grid; gap: .2rem;
  font: 500 .72rem/1.25 var(--fuente-texto); text-align: left;
}
.etq-socios li { padding-left: .7rem; position: relative; display: grid; }
.etq-nombre { font-weight: 700; }
.etq-detalle { font-weight: 400; opacity: .8; }
.etq-socios li::before { content: ""; position: absolute; left: 0; top: .4em; width: .35rem; height: .35rem; border-radius: 50%; background: var(--verde); }
.etq.activa .etq-socios { border-top-color: rgba(255, 255, 255, .35); }
.etq.activa .etq-socios li::before { background: var(--blanco); }

/* Tarjeta que aparece al pasar el cursor */
.leaflet-tooltip.tip {
  padding: 0; width: 290px; white-space: normal; text-align: left;
  border: 1px solid var(--linea-fuerte); border-radius: var(--radio); color: var(--tinta); background: var(--blanco);
  box-shadow: 0 6px 18px rgba(27, 34, 25, .16); overflow: hidden;
}
.leaflet-tooltip.tip::before { display: none; }
.tip-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; padding: .7rem .85rem .6rem; border-bottom: 1px solid var(--linea); }
.tip-eyebrow { font-size: .75rem; color: var(--tinta-2); }
.tip-titulo { font-family: var(--fuente-titulos); font-weight: 800; font-size: 1.1rem; line-height: 1.2; }
.tip-chip { flex: none; margin-top: .1rem; border-radius: 999px; padding: .15rem .55rem; background: var(--verde); color: var(--blanco); font-size: .72rem; font-weight: 700; }
.tip-chip.vacio { background: var(--papel); color: var(--tinta-2); border: 1px solid var(--linea); }
.tip-cuerpo { padding: .55rem .85rem; display: grid; gap: .6rem; }
.tip-grupo-t { display: flex; justify-content: space-between; font-size: .78rem; font-weight: 700; color: var(--verde-oscuro); margin-bottom: .25rem; }
.tip-grupo-t span { color: var(--tinta-2); font-weight: 500; }
.tip-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.tip-lista li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: .55rem; align-items: center; }
.tip-texto { display: grid; min-width: 0; }
.tip-mini { width: 44px; height: 33px; border-radius: 4px; object-fit: cover; display: block; background: var(--papel); }
.tip-mini.sin-foto { border: 1px dashed var(--linea-fuerte); }
.tip-nombre { font-weight: 700; font-size: .82rem; line-height: 1.25; }
.tip-detalle { font-size: .75rem; color: var(--tinta-2); line-height: 1.3; }
.tip-pie { padding: .4rem .85rem; background: var(--papel); border-top: 1px solid var(--linea); font-size: .74rem; color: var(--tinta-2); }

/* ---------- panel lateral ---------- */
.panel { background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--radio); padding: 1.25rem; max-height: 640px; overflow-y: auto; }
@media (max-width: 991.98px) { .panel { max-height: none; } }
.panel-cab { padding-bottom: 1rem; border-bottom: 1px solid var(--linea); margin-bottom: .75rem; }
.panel-eyebrow { font-size: .85rem; color: var(--tinta-2); }
.panel-cab h3 { font-size: 1.5rem; font-weight: 800; margin: .1rem 0 .25rem; letter-spacing: -0.01em; }
.panel-sub { margin: 0; color: var(--tinta-2); }
.panel-cifras { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin-top: .5rem; }
.panel-cifras b { display: block; font-family: var(--fuente-titulos); font-size: 1.9rem; font-weight: 800; color: var(--verde-oscuro); line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.panel-cifras span { font-size: .85rem; color: var(--tinta-2); }

.lista { list-style: none; padding: 0; margin: 0; display: grid; }
.lista li + li { border-top: 1px solid var(--linea); }
.fila {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: .75rem;
  background: none; border: 0; border-radius: 0; padding: .65rem .5rem; text-align: left; color: var(--tinta); font-weight: 500;
}
.fila:hover, .fila:focus-visible { background: var(--verde-tinte); color: var(--verde-oscuro); }
.fila-n { min-width: 2rem; text-align: center; border-radius: 999px; background: var(--verde); color: var(--blanco); font-weight: 700; font-size: .82rem; padding: .1rem .5rem; font-variant-numeric: tabular-nums; }

.socios { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.socio { border: 1px solid var(--linea); border-radius: var(--radio); padding: .85rem 1rem; overflow: hidden; background: var(--blanco); }
.socio-nombre { font-weight: 700; margin-bottom: .4rem; display: grid; }
.socio-nombre span { font-weight: 400; font-size: .88rem; color: var(--tinta-2); }

/* Foto del lugar, de borde a borde arriba de la tarjeta */
.socio-foto {
  display: block; position: relative; width: calc(100% + 2rem); margin: -.85rem -1rem .75rem;
  aspect-ratio: 16 / 9; max-width: none; padding: 0; border: 0; background: var(--papel); overflow: hidden;
}
.socio-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
button.socio-foto { cursor: zoom-in; }
.socio-foto-zoom {
  position: absolute; right: .5rem; bottom: .5rem; padding: .15rem .5rem; border-radius: 999px;
  background: rgba(27, 34, 25, .78); color: var(--blanco); font-size: .72rem; font-weight: 700;
}
.socio-foto.sin-foto {
  display: grid; place-items: center; aspect-ratio: auto; height: 3rem;
  color: var(--tinta-2); font-size: .8rem; border-bottom: 1px dashed var(--linea-fuerte);
}

/* Foto ampliada */
.foto-modal { overflow: hidden; }
.foto-sub { color: var(--tinta-2); font-size: .9rem; }
.foto-grande { display: block; width: 100%; max-height: 75vh; object-fit: contain; background: #111; }

/* Administración: miniatura y vista previa */
.admin-mini { width: 64px; height: 40px; object-fit: cover; border-radius: 4px; display: block; }
.admin-mini.sin-foto { border: 1px dashed var(--linea-fuerte); background: var(--papel); }
.foto-previa { width: 100%; max-width: 320px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radio); border: 1px solid var(--linea); background: var(--papel); }
.socio dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .2rem .75rem; margin: 0; font-size: .9rem; }
.socio dt { color: var(--tinta-2); font-weight: 500; }
.socio dd { margin: 0; }
.socio-nota { margin: .5rem 0 0; font-size: .82rem; color: var(--tinta-2); }

/* ---------- administración y formularios ---------- */
.tarjeta { background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--radio); padding: 1.5rem; }
.admin-tabla { font-size: .92rem; --bs-table-bg: transparent; --bs-table-color: var(--tinta); --bs-table-hover-bg: var(--verde-tinte); --bs-table-hover-color: var(--tinta); --bs-table-border-color: var(--linea); }
.admin-tabla thead th { font-family: var(--fuente-texto); font-size: .8rem; font-weight: 700; color: var(--tinta-2); white-space: nowrap; border-bottom: 2px solid var(--linea-fuerte); padding-bottom: .6rem; }
.admin-tabla tbody td { padding-block: .65rem; }

.form-label { font-weight: 600; color: var(--tinta); margin-bottom: .3rem; }
.form-control, .form-select { border-color: var(--linea-fuerte); background-color: var(--blanco); color: var(--tinta); border-radius: var(--radio); }
.form-control:focus, .form-select:focus { border-color: var(--verde); box-shadow: 0 0 0 3px var(--verde-tinte-2); }
.form-control::placeholder { color: #8a9086; }
.form-text { color: var(--tinta-2); }

.btn { border-radius: var(--radio); font-weight: 600; }
.btn-verde { --bs-btn-bg: var(--verde); --bs-btn-border-color: var(--verde); --bs-btn-color: #fff; --bs-btn-hover-bg: var(--verde-oscuro); --bs-btn-hover-border-color: var(--verde-oscuro); --bs-btn-hover-color: #fff; --bs-btn-active-bg: var(--verde-oscuro); --bs-btn-active-border-color: var(--verde-oscuro); --bs-btn-active-color: #fff; --bs-btn-focus-shadow-rgb: 15, 91, 30; }
.btn-outline-secondary { --bs-btn-color: var(--tinta); --bs-btn-border-color: var(--linea-fuerte); --bs-btn-hover-bg: var(--papel); --bs-btn-hover-color: var(--tinta); --bs-btn-hover-border-color: var(--linea-fuerte); --bs-btn-active-bg: var(--papel-2); --bs-btn-active-color: var(--tinta); --bs-btn-active-border-color: var(--linea-fuerte); font-weight: 500; }
.btn-outline-danger { --bs-btn-color: var(--cereza); --bs-btn-border-color: #e2b9b6; --bs-btn-hover-bg: #f9ebea; --bs-btn-hover-color: var(--cereza); --bs-btn-hover-border-color: #e2b9b6; --bs-btn-active-bg: #f3d9d7; --bs-btn-active-color: var(--cereza); --bs-btn-active-border-color: #e2b9b6; font-weight: 500; }
.btn-danger { --bs-btn-bg: var(--cereza); --bs-btn-border-color: var(--cereza); --bs-btn-hover-bg: #8f251f; --bs-btn-hover-border-color: #8f251f; --bs-btn-active-bg: #8f251f; --bs-btn-active-border-color: #8f251f; }

.alert { border-radius: var(--radio); }
.alert-success { --bs-alert-bg: var(--verde-tinte); --bs-alert-border-color: var(--verde-tinte-2); --bs-alert-color: var(--verde-oscuro); }
.alert-danger { --bs-alert-bg: #f9ebea; --bs-alert-border-color: #e2b9b6; --bs-alert-color: #7a1d18; }
.modal-content { border: 1px solid var(--linea); border-radius: var(--radio); }
.modal-header { border-bottom-color: var(--linea); }
.modal-footer { border-top-color: var(--linea); }

.pie { color: var(--tinta-2); font-size: .85rem; padding-block: 1.25rem 2rem; border-top: 1px solid var(--linea); }

/* ---------- inicio de sesión ---------- */
.pagina-login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--verde-oscuro); }
.login-marco { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.25rem; padding: 2rem 1rem; }
.login-tarjeta { width: 100%; max-width: 420px; background: var(--blanco); border-radius: 8px; padding: 2rem 2rem 1.75rem; }
.login-logos .logos { justify-content: center; padding-bottom: 1.25rem; border-bottom: 1px solid var(--linea); margin-bottom: 1.5rem; flex-wrap: wrap; }
.login-eyebrow { font-size: .9rem; color: var(--tinta-2); margin: 0 0 .15rem; }
.login-cab h1 { font-size: 1.6rem; font-weight: 800; margin: 0 0 .25rem; letter-spacing: -0.01em; }
.login-sub { color: var(--tinta-2); margin: 0 0 1.25rem; font-size: .95rem; }
.login-tarjeta .form-control-lg { font-size: 1rem; padding: .7rem .85rem; }
.clave-caja { position: relative; }
.clave-caja .form-control { padding-right: 3rem; }
.clave-ver { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--tinta-2); padding: .4rem; border-radius: var(--radio); display: grid; place-items: center; }
.clave-ver:hover, .clave-ver:focus-visible, .clave-ver[aria-pressed="true"] { color: var(--verde); background: var(--verde-tinte); }
.login-volver { display: inline-block; margin-top: 1.25rem; color: var(--verde); font-weight: 500; text-decoration: none; }
.login-volver:hover { text-decoration: underline; text-underline-offset: 3px; }
.login-pie { color: rgba(255, 255, 255, .7); font-size: .85rem; margin: 0; }
@media (max-width: 479.98px) { .login-tarjeta { padding: 1.5rem 1.25rem; } }

:focus-visible { outline: 2px solid var(--verde); outline-offset: 2px; }
.pagina-login :focus-visible { outline-color: var(--verde); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- mapa: agua clara de fondo y leyenda ---------- */
.mapa-marco, #mapa { background: #d9e4e7; }
.mapa-cargando { background: rgba(217, 228, 231, .85); }
.leyenda { background: rgba(255, 255, 255, .94); border: 1px solid var(--linea); border-radius: var(--radio); padding: .6rem .75rem; font: 500 .78rem/1.3 var(--fuente-texto); color: var(--tinta); margin: 0 0 1rem 1rem; }
.leyenda-t { font-weight: 700; margin-bottom: .35rem; }
.leyenda ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; }
.leyenda li { display: flex; align-items: center; gap: .5rem; }
.leyenda i { width: 1rem; height: .8rem; border-radius: 2px; border: 1px solid rgba(27, 34, 25, .18); flex: none; }
@media (max-width: 575.98px) { .leyenda { font-size: .72rem; padding: .45rem .6rem; margin: 0 0 .6rem .6rem; } }

/* Segunda fila de indicadores un poco más discreta que la primera */
.ind-fila + .ind-fila .ind-valor { font-size: clamp(1.6rem, 2.6vw, 2.2rem); }
