:root {
  --navy: #0b2a4a;
  --navy-2: #12406e;
  --ink: #12202f;
  --muted: #5b6b7c;
  --line: #e3e8ee;
  --bg: #ffffff;
  --chip-bg: rgba(255, 255, 255, .94);
  --shadow: 0 6px 24px rgba(11, 42, 74, .18);
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #e9eef3; color: var(--ink); font-family: var(--font); overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }

#map { position: fixed; inset: 0; z-index: 0; background: #e9eef3; }

/* ---------- Top bar ---------- */
.top {
  position: fixed; z-index: 20; left: 12px; right: 12px; top: calc(10px + var(--safe-top));
  display: flex; align-items: center; gap: 10px;
  background: var(--navy); color: #fff; border-radius: var(--radius);
  padding: 10px 10px 10px 16px; box-shadow: var(--shadow);
}
.brand { flex: 1; min-width: 0; }
.brand__ep { display: block; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; opacity: .72; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand__title { margin: 1px 0 0; font-size: 19px; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }
.brand__title b { font-weight: 800; color: #7cc4ff; }
.icon-btn { flex: none; width: 42px; height: 42px; border-radius: 12px; border: 0; background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; }
.icon-btn:active { background: rgba(255,255,255,.22); }

/* ---------- Filter chips ---------- */
.chips {
  position: fixed; z-index: 19; left: 0; right: 0; top: calc(78px + var(--safe-top));
  display: flex; gap: 8px; overflow-x: auto; padding: 6px 12px 10px; scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; scroll-snap-align: start; display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 12px 0 8px; border-radius: 999px; border: 1.5px solid transparent;
  background: var(--chip-bg); box-shadow: 0 2px 8px rgba(11,42,74,.14); font-size: 13.5px; font-weight: 600; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s, opacity .15s;
}
.chip__ico { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: var(--c); }
.chip__n { font-size: 11.5px; font-weight: 700; opacity: .6; }
.chip[aria-pressed="true"] { background: var(--c); color: #fff; border-color: var(--c); }
.chip[aria-pressed="true"] .chip__ico { background: rgba(255,255,255,.22); }
.chip[aria-pressed="true"] .chip__n { opacity: .85; }
.chip[aria-pressed="false"] { opacity: .78; }
.chip.chip--all { padding: 0 14px; background: var(--navy); color: #fff; border-color: var(--navy); opacity: 1; }

/* ---------- Floating buttons ---------- */
.fabs { position: fixed; z-index: 15; right: 12px; bottom: calc(24px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 10px; transition: transform .25s; }
body.sheet-open .fabs { transform: translateY(80px); opacity: 0; pointer-events: none; }
.fab { width: 48px; height: 48px; border-radius: 50%; border: 0; background: #fff; color: var(--navy); box-shadow: var(--shadow); display: grid; place-items: center; }
.fab--brand { background: var(--navy); color: #fff; font-weight: 800; font-size: 20px; }

.hint {
  position: fixed; z-index: 14; left: 12px; bottom: calc(28px + var(--safe-bottom)); max-width: calc(100% - 90px);
  background: #fff; border-radius: 14px; padding: 10px 14px; font-size: 13px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 8px; transition: opacity .3s, transform .3s;
}
.hint.is-hidden { opacity: 0; transform: translateY(10px); pointer-events: none; }
.hint__dot { width: 10px; height: 10px; border-radius: 50%; background: #ff385c; flex: none; box-shadow: 0 0 0 0 rgba(255,56,92,.6); animation: pulse 1.8s infinite; }

/* ---------- Markers ---------- */
.mk { position: absolute; transform: translate(-50%, -50%); cursor: pointer; }
.mk-dot {
  width: 26px; height: 26px; border-radius: 50%; background: var(--c); border: 2.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.28); display: grid; place-items: center; font-size: 12.5px; line-height: 1;
}
.mk-dot.is-psd { outline: 2.5px solid rgba(255, 196, 0, .9); outline-offset: 1px; }

.mk-photo { position: relative; width: 52px; height: 52px; }
.mk-photo__ring { position: absolute; inset: -6px; border-radius: 50%; border: 3px solid var(--c); opacity: .55; animation: ring 2s ease-out infinite; }
.mk-photo__img {
  position: relative; width: 52px; height: 52px; border-radius: 50%; border: 3px solid #fff; background: var(--c) center/cover no-repeat;
  box-shadow: 0 0 0 3px var(--c), 0 6px 16px rgba(0,0,0,.35);
}
.mk-photo__tag {
  position: absolute; left: 50%; top: 100%; transform: translate(-50%, 6px); white-space: nowrap;
  background: var(--c); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px 3px 6px; border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0,0,0,.25); display: flex; align-items: center; gap: 4px;
}
.mk-photo__tag::before { content: '📷'; font-size: 10px; }
.zoom-low .mk-photo { width: 36px; height: 36px; }
.zoom-low .mk-photo__img { width: 36px; height: 36px; border-width: 2px; }
.zoom-low .mk-photo__tag { display: none; }
.zoom-low .mk-dot { width: 18px; height: 18px; font-size: 9px; border-width: 2px; }
.zoom-low .mk-unicpo.is-secondary .mk-unicpo__label { display: none; }
.mk.is-active .mk-photo__img, .mk.is-active .mk-dot { transform: scale(1.18); }

.mk-unicpo { display: flex; flex-direction: column; align-items: center; transform: translateY(-20px); }
.mk-unicpo__pin {
  width: 46px; height: 46px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--navy);
  border: 3px solid #fff; box-shadow: 0 6px 16px rgba(11,42,74,.45); display: grid; place-items: center;
}
.mk-unicpo__pin span { transform: rotate(45deg); color: #fff; font-weight: 800; font-size: 19px; }
.mk-unicpo__label { margin-top: 6px; background: var(--navy); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.mk-unicpo.is-secondary .mk-unicpo__pin { width: 34px; height: 34px; background: var(--navy-2); }
.mk-unicpo.is-secondary .mk-unicpo__pin span { font-size: 14px; }

.mk-me { width: 18px; height: 18px; border-radius: 50%; background: #1a73e8; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(26,115,232,.25); }

.ring-label { background: rgba(11,42,74,.85); color: #fff; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; white-space: nowrap; transform: translate(-50%, -50%); position: absolute; pointer-events: none; }

@keyframes ring { 0% { transform: scale(.9); opacity: .7; } 100% { transform: scale(1.45); opacity: 0; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,56,92,.55); } 100% { box-shadow: 0 0 0 10px rgba(255,56,92,0); } }

/* Leaflet resets for our HTML markers */
.leaflet-div-icon.lf-wrap { background: none; border: 0; }
.leaflet-control-attribution { font-size: 9.5px; }
.leaflet-top.leaflet-left { display: none; }

/* ---------- Bottom sheet ---------- */
.sheet, .list {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; max-height: 64vh; overflow-y: auto;
  background: var(--bg); border-radius: 22px 22px 0 0; box-shadow: 0 -8px 30px rgba(11,42,74,.22);
  padding: 8px 16px calc(18px + var(--safe-bottom)); animation: up .25s ease-out;
}
@media (min-width: 720px) { .sheet, .list { left: auto; right: 16px; bottom: 16px; width: 400px; border-radius: 22px; max-height: calc(100vh - 140px); } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet[hidden], .list[hidden] { display: none; }
.sheet__grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 2px auto 10px; }
.sheet__close { position: absolute; top: 10px; right: 12px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: #f0f3f6; font-size: 22px; line-height: 1; color: var(--muted); }

.gal { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px 12px; padding: 0 16px; scrollbar-width: none; }
.gal::-webkit-scrollbar { display: none; }
.gal img { flex: none; width: 100%; aspect-ratio: 16/9; max-height: 30vh; object-fit: cover; border-radius: 14px; scroll-snap-align: center; background: #eef2f6; }
.gal--multi img { width: 86%; }

.p-cat { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--c); text-transform: uppercase; letter-spacing: .05em; }
.p-name { margin: 4px 40px 6px 0; font-size: 21px; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; }
.p-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; padding: 4px 9px; border-radius: 999px; background: #f0f3f6; color: var(--ink); }
.tag--partner { background: #fff1f4; color: #d70f3f; }
.tag--warn { background: #fff7e0; color: #8a5a00; }
.tag--psd { background: #fff5cc; color: #6b5200; }
.p-info { margin: 0 0 8px; font-size: 14.5px; line-height: 1.5; color: var(--ink); }
.p-row { margin: 0 0 6px; font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.p-row b { color: var(--ink); font-weight: 600; }
.p-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; border-radius: 14px; font-weight: 700; font-size: 14.5px; text-decoration: none; border: 0; padding: 0 12px; text-align: center; }
.btn--primary { background: var(--navy); color: #fff; }
.btn--ghost { background: #f0f3f6; color: var(--ink); }
.btn--wa { background: #25d366; color: #fff; }
.btn--full { grid-column: 1 / -1; }
.club { display: block; margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: linear-gradient(135deg, #ff385c, #ff7a59); color: #fff; text-decoration: none; font-size: 13.5px; line-height: 1.4; }
.club b { display: block; font-size: 14.5px; }

/* ---------- List ---------- */
.list__head { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; }
.list__head h2 { margin: 0; font-size: 19px; font-weight: 800; }
.list__head .sheet__close { position: static; }
.list__sub { margin: 4px 0 10px; color: var(--muted); font-size: 13px; }
.list__items { list-style: none; margin: 0; padding: 0; }
.li { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 0; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; }
.li__ico { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--c) center/cover; display: grid; place-items: center; font-size: 16px; }
.li__txt { flex: 1; min-width: 0; }
.li__name { display: block; font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li__sub { display: block; font-size: 12.5px; color: var(--muted); }
.li__d { flex: none; font-size: 12.5px; font-weight: 700; color: var(--navy-2); }

/* ---------- Instagram ---------- */
.btn--ig { background: linear-gradient(45deg, #f9a825, #e1306c 45%, #833ab4); color: #fff; }
.btn--ig::before { content: ''; width: 16px; height: 16px; flex: none; border: 2px solid #fff; border-radius: 5px; box-sizing: border-box;
  background: radial-gradient(circle, transparent 3px, #fff 3.2px, #fff 4.6px, transparent 4.8px); }

/* ---------- Dos notas: alumnos UniCPO vs Google ---------- */
.rates { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 2px 0 6px; }
.rate { display: flex; flex-direction: column; gap: 1px; padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; }
.rate__who { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.rate__num { font-size: 26px; font-weight: 800; line-height: 1.1; color: var(--ink); }
.rate__num small { font-size: 16px; color: #f5a524; margin-left: 2px; }
.rate__sub { font-size: 12px; color: var(--muted); }
.rate__comm { margin-top: 4px; font-size: 12px; font-weight: 600; color: #0f5132; }
.rate--uni { border-color: #b9d7f5; background: #f2f8ff; }
.rate--uni .rate__who { color: var(--navy-2); }
.rate--empty .rate__num { color: #9aa8b6; }
.g-logo { width: 15px; height: 15px; border-radius: 50%; display: inline-grid; place-items: center; background: #fff; border: 1px solid var(--line);
  font-size: 10px; font-weight: 800; color: #4285f4; letter-spacing: 0; }
.rates__note { margin: 0 0 10px; font-size: 12px; line-height: 1.45; color: var(--muted); }

/* ---------- Votar ---------- */
.vote { margin-top: 10px; }
.btn--rate { width: 100%; background: #fff7e0; color: #7a5200; border: 1.5px solid #f3d27a; }
.vote__form { margin-top: 4px; padding: 12px; border-radius: 16px; background: #f6f8fa; }
.vote__q { margin: 4px 0 8px; font-weight: 700; font-size: 14px; }
.stars { display: flex; gap: 6px; margin-bottom: 10px; }
.star { width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font-size: 24px; line-height: 1; color: #cfd6de; }
.star.is-on { color: #f5a524; border-color: #f3d27a; background: #fffaeb; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.opts--col { flex-direction: column; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt span { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.opts--col .opt span { width: 100%; }
.opt input:checked + span { border-color: var(--navy-2); background: #eaf3ff; color: var(--navy); }
.opt input:focus-visible + span { outline: 2px solid var(--navy-2); outline-offset: 2px; }
.check { display: flex; align-items: flex-start; gap: 8px; margin: 4px 0 10px; font-size: 13px; line-height: 1.4; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--navy); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-msg { margin: 0 0 6px; min-height: 0; font-size: 13px; color: #b42318; }
.form-msg:empty { display: none; }
.form-msg.is-ok { color: #0f5132; }
.vote .p-actions, .report .p-actions { margin-top: 4px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Reportar (soporte) ---------- */
.report { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.report__link { border: 0; background: none; padding: 6px 0; color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.report__box { padding: 12px; border-radius: 16px; background: #f6f8fa; }
.report__box--confirm { background: #fff5f5; border: 1.5px solid #f5c2c0; }
.report__title { margin: 0 0 10px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.report textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px; font: inherit; font-size: 14px; resize: vertical; margin-bottom: 8px; }
.report__summary { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: 12px; background: #fff; margin-bottom: 10px; font-size: 14px; }
.report__summary em { color: var(--muted); font-size: 13px; }
.report__fine { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.report__done { margin: 0; padding: 12px; border-radius: 14px; background: #ecfdf3; color: #0f5132; font-weight: 600; font-size: 14px; }
.btn--danger { background: #c62828; color: #fff; }

/* El cuadro de la nota UniCPO funciona como botón para calificar */
button.rate { font: inherit; text-align: left; cursor: pointer; }
.rate--uni { transition: transform .1s, box-shadow .15s; }
.rate--uni:active { transform: scale(.98); }
.rate__cta { align-self: flex-start; margin-top: 6px; padding: 4px 10px; border-radius: 999px; background: var(--navy); color: #fff; font-size: 12px; font-weight: 700; }

/* El pin de UniCPO no debe robar el toque de los pines pequeños que quedan debajo */
.mk--unicpo { pointer-events: none; }
.mk--unicpo .mk-unicpo__pin { pointer-events: auto; }

/* [hidden] tiene que ganar a display:flex/grid de .btn, .p-actions etc. */
[hidden] { display: none !important; }

/* "Posiblemente cerrado": 3+ alumnos reportaron que cerró y el equipo aún no lo revisó */
.maybe-closed { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 10px; padding: 10px 12px; border-radius: 14px;
  background: #fff4e5; border: 1.5px solid #f5c26b; color: #6b4300; font-size: 13.5px; line-height: 1.45; }
.mk.is-maybe-closed .mk-dot, .mk.is-maybe-closed .mk-photo { opacity: .45; filter: grayscale(1); }

/* "Favorito UniCPO": nota de los alumnos > 4,8 con 10+ votos */
.mk.is-fav .mk-dot, .mk.is-fav .mk-photo { position: relative; }
.mk.is-fav .mk-dot::after, .mk.is-fav .mk-photo::after {
  content: '★'; position: absolute; top: -9px; right: -9px; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; background: #f5b301; color: #fff; font-size: 12px; line-height: 1;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); z-index: 2;
}
.mk.is-fav .mk-photo::after { top: -6px; right: -6px; width: 22px; height: 22px; font-size: 14px; }
.zoom-low .mk.is-fav .mk-dot::after { top: -9px; right: -11px; width: 13px; height: 13px; font-size: 8px; border-width: 1.5px; }
.tag--fav { background: #fff3c4; color: #7a5200; }
.li__fav { font-size: 13px; }
