/* ---------------- Barra superior: acciones a la derecha ----------------
   Estructura tomada de Emergency Radar: marca a la izquierda y un grupo de acciones
   (fuente de datos y contador de visitas) al final. Colores del portal. */
.topbar-acciones { display: flex; align-items: center; gap: 10px; flex: none; }
.fuente-datos { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  color: var(--texto2); white-space: nowrap; }
.fuente-datos[hidden] { display: none; }
.fd-ic { width: 15px; height: 15px; color: var(--g3); flex: none; }

/* ---------------- Contador de visitas (lo arma visitas.js) ---------------- */
.visitas { display: flex; align-items: center; gap: 6px; min-width: 0; }
.visitas[hidden] { display: none; }
.vis-anchor, .vis-btn { flex: none; }
.vis-btn, .vis-reciente {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--borde); border-radius: 999px; background: var(--sup);
  color: var(--texto2); font: 600 12px/1 inherit; font-family: inherit; white-space: nowrap; cursor: pointer;
}
.vis-btn:hover, .vis-reciente:hover, .vis-btn[aria-expanded="true"] { border-color: var(--g3); }
.vis-btn .vis-ic { width: 16px; height: 16px; color: var(--g3); flex: none; }
.vis-btn b { color: var(--g1); font-weight: 700; font-variant-numeric: tabular-nums; }
.vis-reciente { max-width: 230px; min-width: 0; flex: 0 1 auto; background: var(--sup2); border-color: transparent; }
.vis-reciente[hidden] { display: none; }
.vis-reciente .vis-lugar { overflow: hidden; text-overflow: ellipsis; color: var(--texto); }
.vis-reciente small { flex: none; color: var(--texto3); font-size: 11px; }
.vis-reciente.entra .vis-lugar, .vis-reciente.entra small, .vis-reciente.entra .vis-bandera { animation: vis-entra .35s ease-out; }
@keyframes vis-entra { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.vis-bandera { width: 18px; height: 13px; border-radius: 2px; object-fit: cover; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.12); }
.vis-bandera.vacia { display: inline-flex; align-items: center; justify-content: center; box-shadow: none; color: var(--texto3); }
.vis-bandera.vacia .vis-ic { width: 15px; height: 15px; }

.vis-anchor { position: relative; }
.vis-pop {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 60;
  width: 310px; max-width: calc(100vw - 24px); padding: 14px 16px;
  background: var(--sup); color: var(--texto); text-align: left;
  border: 1px solid var(--borde); border-top: 3px solid var(--g3); border-radius: var(--rc);
  box-shadow: var(--sombra2); font-size: 13px; line-height: 1.4;
}
.vis-pop[hidden] { display: none; }
.vis-titulo { font-weight: 700; font-size: 16px; color: var(--g1); margin-bottom: 8px; }
.vis-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0 0 12px; }
.vis-stats div { background: var(--g6); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vis-stats b { font-size: 1.15rem; color: var(--g1); font-variant-numeric: tabular-nums; }
.vis-stats span { font-size: 10px; font-weight: 700; color: var(--texto3); text-transform: uppercase; letter-spacing: .04em; }
.vis-sub { font-size: 10px; font-weight: 700; color: var(--g2); text-transform: uppercase; letter-spacing: .07em; margin: 2px 0 6px; }
.vis-lista { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.vis-lista li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.vis-lista .vis-lugar { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vis-lista small { color: var(--texto3); font-size: 11px; white-space: nowrap; }
.vis-top { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.vis-chip { display: inline-flex; align-items: center; gap: 5px; background: var(--sup2); border: 1px solid var(--borde); border-radius: 999px; padding: 3px 9px 3px 6px; font-size: 12px; color: var(--texto2); }
.vis-chip b { color: var(--g1); }
.vis-nota { margin: 0; font-size: 11px; line-height: 1.5; color: var(--texto3); }

/* La pastilla de "visita reciente" y la fuente de datos solo en pantallas anchas. */
@media (max-width: 900px) {
  .vis-reciente, .fuente-datos { display: none !important; }
}
/* En teléfonos: popover anclado a la barra para no desbordar. */
@media (max-width: 640px) {
  .vis-btn { height: 30px; padding: 0 10px; }
  .vis-anchor { position: static; }
  .topbar-inner { position: relative; }
  .vis-pop { left: 12px; right: 12px; width: auto; max-width: none; top: calc(100% - 6px); }
}

/* Fecha de datos en el pie, con el mismo icono de la barra superior. */
.pie-fecha { display: inline-flex; align-items: center; gap: 6px; }
.pie-fecha[hidden] { display: none; }
