:root {
  --bg: #0a0e23;
  --card: #121836;
  --card-2: #1a2147;
  --line: #262f5e;
  --text: #e8edf6;
  --muted: #93a1b8;
  --accent: #8b9bff;
  --accent-red: #f0435a;
  --grad: linear-gradient(135deg, #2f55e4 0%, #7a3fd6 52%, #e5364a 100%);
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --m1: #22c55e;
  --m2: #eab308;
  --m3: #ec4899;
  --m4: #ef4444;
  --tabbar-h: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-top: env(safe-area-inset-top);
}
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.15rem; margin-bottom: 8px; }
p { margin: 6px 0; }
a { color: var(--accent); }
[hidden] { display: none !important; }

.topbar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  background: rgba(10, 14, 35, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .logo { width: 30px; height: 30px; border-radius: 8px; }
.topbar h1 { font-size: 1.1rem; flex: 1; }
.topbar h1 span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.conn { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.conn.live { background: var(--green); box-shadow: 0 0 8px var(--green); }

.offline { background: #3b2a06; color: #fde68a; padding: 8px 16px; font-size: .9rem; }

main {
  max-width: 640px; margin: 0 auto;
  padding: 12px 14px calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom));
}
.view { display: none; }
.view.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.section-title { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 4px 8px; }
.error { color: #fca5a5; }

/* Estado */
.status { display: flex; gap: 14px; align-items: center; border-width: 2px; }
.status h2 { font-size: 1.35rem; }
.status-light { flex: none; width: 22px; height: 22px; border-radius: 50%; }
.status-green { border-color: rgba(34, 197, 94, .5); background: linear-gradient(135deg, rgba(34, 197, 94, .14), var(--card)); }
.status-green .status-light { background: var(--green); box-shadow: 0 0 14px var(--green); }
.status-yellow { border-color: rgba(234, 179, 8, .55); background: linear-gradient(135deg, rgba(234, 179, 8, .16), var(--card)); }
.status-yellow .status-light { background: var(--yellow); box-shadow: 0 0 14px var(--yellow); }
.status-red { border-color: var(--red); background: linear-gradient(135deg, rgba(239, 68, 68, .28), var(--card)); }
.status-red .status-light { background: var(--red); box-shadow: 0 0 18px var(--red); animation: pulse 1s infinite alternate; }
@keyframes pulse { to { transform: scale(1.25); opacity: .7; } }

.tsunami { display: block; background: #450a0a; border-color: var(--red); color: #fecaca; text-decoration: none; font-weight: 600; }
.cta { border-color: rgba(139, 155, 255, .5); background: linear-gradient(135deg, rgba(47, 85, 228, .16), rgba(229, 54, 74, .1)), var(--card); }

/* Sismo */
.quake { display: flex; gap: 14px; align-items: flex-start; }
.mag {
  flex: none; width: 58px; height: 58px; border-radius: 14px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 1.3rem; color: #0a0e23;
}
.mag.sm { width: 44px; height: 44px; font-size: 1rem; border-radius: 12px; }
.quake-body { flex: 1; min-width: 0; }
.quake-place { font-weight: 600; }
.risks { display: grid; gap: 6px; margin-top: 10px; }
.risk { display: flex; justify-content: space-between; gap: 8px; background: var(--card-2); border-radius: 10px; padding: 8px 10px; font-size: .92rem; }
.badge { font-size: .75rem; padding: 2px 8px; border-radius: 99px; font-weight: 700; white-space: nowrap; }
.badge.bajo { background: rgba(34, 197, 94, .18); color: #86efac; }
.badge.moderado { background: rgba(234, 179, 8, .2); color: #fde047; }
.badge.alto { background: rgba(239, 68, 68, .25); color: #fca5a5; }
.srcs { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.src { font-size: .7rem; text-transform: uppercase; background: var(--card-2); color: var(--muted); padding: 2px 6px; border-radius: 6px; }

/* Listas */
.list { list-style: none; margin: 0; padding: 0; }
.list.card { padding: 4px 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .place { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Botones */
/* Botones tipo iOS: relleno, tintado y gris; ícono SVG a la izquierda. */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 50px; padding: 0 18px; margin: 10px 0 0;
  border: 0; border-radius: 14px;
  background: rgba(139, 155, 255, .14); color: var(--accent);
  font: inherit; font-size: 1.0625rem; font-weight: 600; letter-spacing: -.01em;
  text-align: center; text-decoration: none; line-height: 1.2;
  cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation;
  transition: transform .18s cubic-bezier(.3, 1.4, .5, 1), opacity .15s ease, filter .15s ease;
}
.btn:active { transform: scale(.96); opacity: .82; }
.btn:disabled { opacity: .45; transform: none; }
.btn:focus-visible { outline: 3px solid rgba(139, 155, 255, .6); outline-offset: 2px; }
.bi { flex: none; width: 20px; height: 20px; }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(122, 63, 214, .32), inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn.tinted { background: rgba(139, 155, 255, .14); color: var(--accent); }
.btn.gray { background: rgba(255, 255, 255, .07); color: var(--text); }
.btn.destructive { background: var(--accent-red); color: #fff; box-shadow: 0 6px 18px rgba(229, 54, 74, .3); }
.btn.ok { background: linear-gradient(180deg, #34d399, #16a34a); color: #fff; box-shadow: 0 8px 24px rgba(34, 197, 94, .3), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn.warn { background: rgba(234, 179, 8, .14); color: #fde047; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.big { min-height: 64px; font-size: 1.25rem; margin-top: 18px; border-radius: 20px; }
.btn.big .bi { width: 24px; height: 24px; }
.btn.danger-text { color: #ff6b81; }

/* Celdas tipo Ajustes de iOS */
.cells { margin: 4px -16px -14px; }
.cell {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 16px;
  color: var(--text); text-decoration: none; border-top: 1px solid var(--line);
  transition: background .15s;
}
.cell:active { background: rgba(255, 255, 255, .06); }
.cell .grow { flex: 1; min-width: 0; font-weight: 600; }
.cell small { display: block; font-weight: 400; font-size: .78rem; color: var(--muted); }
.cell b { color: var(--accent); font-weight: 600; }
.tile { flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-size: 17px; background: var(--c); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25); }
.chev { flex: none; width: 14px; height: 14px; color: var(--muted); opacity: .6; }

/* Hoja inferior (confirmaciones) */
.sheet-wrap {
  position: fixed; inset: 0; z-index: 3000; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(3, 5, 15, 0); transition: background .25s ease;
}
.sheet-wrap.open { background: rgba(3, 5, 15, .55); }
.sheet {
  width: min(560px, 100%); padding: 8px 18px calc(18px + env(safe-area-inset-bottom));
  background: rgba(22, 28, 64, .92); backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .08); border-bottom: 0; border-radius: 26px 26px 0 0;
  box-shadow: 0 -20px 50px rgba(0, 0, 0, .45);
  transform: translateY(100%); transition: transform .32s cubic-bezier(.2, .9, .3, 1);
}
.sheet-wrap.open .sheet { transform: none; }
.sheet-grab { width: 38px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .25); margin: 0 auto 14px; }
.sheet h3 { font-size: 1.15rem; text-align: center; }
.sheet p { text-align: center; margin: 8px 0 4px; }
.sheet-input {
  display: block; width: 100%; margin-top: 14px; padding: 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 1.05rem;
}
.sheet .btn:first-of-type { margin-top: 16px; }

/* Sensación de app: sin selección accidental ni zoom por doble toque. */
html { overscroll-behavior-y: none; }
.tabbar, .chip, .cell, .av-opt, .topbar { user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.chip { transition: transform .15s ease; }
.chip:active { transform: scale(.94); }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--muted); transition: background .15s; }
.icon-btn:active { background: rgba(255, 255, 255, .08); }
.icon-btn .bi { width: 20px; height: 20px; }
.danger-icon { color: #ff6b81; }

.form label { display: block; margin-bottom: 12px; color: var(--muted); font-size: .9rem; }
.form input {
  display: block; width: 100%; margin-top: 6px;
  padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
  font: inherit; font-size: 1.05rem;
}
/* ---------- Entrar ---------- */
body.locked .topbar, body.locked .disclaimer { display: none; }
.join.active {
  position: relative; min-height: calc(100vh - 24px - env(safe-area-inset-top));
  display: flex; flex-direction: column; justify-content: center; gap: 22px; padding-bottom: 12px;
}
body.locked main { padding-bottom: 16px; }
.aurora { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.join > :not(.aurora) { position: relative; z-index: 1; }
.aurora i { position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; filter: blur(70px); opacity: .3; animation: drift 18s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { background: #1e3a8a; top: -35vmax; left: -25vmax; }
.aurora i:nth-child(2) { background: #dc2626; bottom: -40vmax; right: -30vmax; animation-delay: -6s; opacity: .35; }
.aurora i:nth-child(3) { background: #7c3aed; top: 30%; left: 40%; width: 40vmax; height: 40vmax; animation-delay: -12s; opacity: .22; }
@keyframes drift { to { transform: translate(8vmax, 6vmax) scale(1.15); } }

.join-hero { text-align: center; }
.rings { position: relative; width: 132px; height: 132px; margin: 0 auto 18px; display: grid; place-items: center; }
.rings span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(239, 68, 68, .5); animation: ripple 3s cubic-bezier(.2, .6, .3, 1) infinite; }
.rings span:nth-child(2) { animation-delay: 1s; }
.rings span:nth-child(3) { animation-delay: 2s; }
@keyframes ripple { from { transform: scale(.55); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.app-icon {
  position: relative; width: 92px; height: 92px; border-radius: 26px; display: grid; place-items: center;
  background: linear-gradient(160deg, #1a2147, #0a0e23); border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .15);
  animation: float 4s ease-in-out infinite;
}
.app-icon { overflow: hidden; padding: 0; }
.app-icon img { width: 100%; height: 100%; }
@keyframes float { 50% { transform: translateY(-6px); } }
.join-title { font-size: 2.1rem; font-weight: 800; letter-spacing: -.02em; }
.join-title b { background: linear-gradient(90deg, #f87171, #ef4444); -webkit-background-clip: text; background-clip: text; color: transparent; }
.join-sub { color: #cbd5e1; font-size: 1.05rem; max-width: 300px; margin: 8px auto 0; }
.seismo { display: block; width: min(300px, 80%); height: 40px; margin: 14px auto 6px; }
.seismo path { fill: none; stroke: #f87171; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round;
  stroke-dasharray: 420; stroke-dashoffset: 420; animation: draw 2.6s ease-in-out .4s infinite; }
@keyframes draw { 60%, 100% { stroke-dashoffset: 0; } 100% { opacity: 0; } }
.pills { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pills span { font-size: .8rem; padding: 6px 12px; border-radius: 99px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); color: #e2e8f0; }

.join-sheet {
  background: rgba(18, 27, 46, .72); backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .1); border-radius: 28px; padding: 22px 20px 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.google-box { display: flex; flex-direction: column; align-items: center; gap: 10px; }
/* El iframe de Google es claro; si hereda "dark" el navegador le pone fondo blanco opaco. */
#google-btn { min-height: 44px; color-scheme: light; }
.code-box { margin-top: 14px; border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 12px; }
.code-box summary { list-style: none; cursor: pointer; text-align: center; color: var(--muted); font-size: .92rem; padding: 6px; }
.code-box summary::-webkit-details-marker { display: none; }
.code-box[open] summary { color: var(--text); margin-bottom: 10px; }
.code-box[open] .form { animation: rise .35s ease both; }
.error-box { background: rgba(239, 68, 68, .15); border: 1px solid rgba(239, 68, 68, .4); color: #fecaca; border-radius: 14px; padding: 10px 12px; margin: 0 0 14px; font-size: .92rem; }
.rise { animation: rise .6s cubic-bezier(.2, .7, .3, 1) both; animation-delay: var(--d, 0s); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ---------- Avatares ---------- */
.av {
  flex: none; display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden;
  background: linear-gradient(140deg, hsl(var(--h) 80% 60%), hsl(calc(var(--h) + 40) 75% 45%));
  color: #fff; font-weight: 700; letter-spacing: .02em; position: relative;
}
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.ring { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--line); }
.av.ring.ok { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--green); }
.av.ring.live { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #3b82f6; }
.top-avatar { display: block; border-radius: 50%; transition: transform .2s; }
.top-avatar:active { transform: scale(.9); }
.family-row { display: flex; gap: 16px; overflow-x: auto; padding: 16px; scrollbar-width: none; }
.family-row::-webkit-scrollbar { display: none; }
.fam { flex: none; width: 76px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  animation: rise .45s ease both; animation-delay: calc(var(--i) * 70ms); }
.fam b { font-size: .85rem; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; }
.fam .small { font-size: .7rem; line-height: 1.2; }
.profile-card { padding: 18px; }
.profile { display: flex; align-items: center; gap: 16px; }
.profile .grow { flex: 1; min-width: 0; }
.profile .chip { margin-left: auto; }
.avatar-btn { position: relative; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%; }
.avatar-btn .cam { position: absolute; right: -4px; bottom: -4px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; background: var(--card-2); border: 2px solid var(--card); }
.profile-editor { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); animation: rise .3s ease both; }
.profile-editor .inline-form { margin: 0 0 12px; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 10px; margin-top: 8px; }
.av-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px 8px; border-radius: 16px;
  border: 2px solid transparent; background: var(--card-2); color: var(--text); font: inherit; cursor: pointer;
  transition: transform .15s ease, border-color .15s ease; }
.av-opt:active { transform: scale(.94); }
.av-opt.selected { border-color: var(--accent); background: rgba(139, 155, 255, .14); }
.av-opt small { font-size: .72rem; color: var(--muted); }
.av-opt .av { background: var(--bg); }
.av-plus { font-size: 24px; }
.pi-photo { background: #fde8de; overflow: hidden; border-radius: 50%; }
.pi-photo img { width: 100%; height: 100%; object-fit: cover; }
.profile-name { font-size: 1.15rem; font-weight: 700; }
.badge.admin { background: var(--grad); color: #fff; vertical-align: middle; }
.with-icon { display: flex; align-items: center; gap: 8px; }
.ic { width: 22px; height: 22px; color: var(--accent); }
.inline-form { display: flex; gap: 8px; margin-top: 10px; }
.inline-form input { margin-top: 0; flex: 1; min-width: 0; }
.inline-form .btn { width: auto; margin: 0; padding: 0 18px; }
.family-create { display: grid; gap: 8px; margin-top: 12px; }
.family-create input { margin-top: 0; }
.family-create .btn { margin-top: 0; }
.family-item { align-items: flex-start !important; }
.fam-icon { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800;
  color: #fff; background: linear-gradient(160deg, #1e3a8a, #dc2626); }
.family-actions { margin-top: 8px; flex-wrap: wrap; }
.family-actions .chip { flex: none; font-size: .8rem; padding: 5px 12px; }
.danger-chip { color: #fca5a5; border-color: rgba(239, 68, 68, .4); }
.danger-text { color: #fca5a5; border-color: rgba(239, 68, 68, .35); margin-top: 4px; }

/* ---------- Íconos de lugar tipo app iOS ---------- */
.pi {
  flex: none; display: inline-grid; place-items: center; border-radius: 28%;
  background: linear-gradient(160deg, #475569, #1e293b); color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
  vertical-align: middle;
}
.pi svg { width: 62%; height: 62%; }
.pi span { font-size: 60%; line-height: 1; transform: scale(1.6); }
.pi-home { background: var(--grad); }
.pi-school { background: linear-gradient(160deg, #60a5fa, #2563eb); }
.risk-name { display: flex; align-items: center; gap: 8px; }
.hint { background: var(--card-2); border-radius: 12px; padding: 10px 12px; font-size: .9rem; margin: 8px 0; }

.range { display: flex; align-items: center; gap: 12px; }
.range input { flex: 1; accent-color: var(--accent); }
.range output { font-weight: 800; font-size: 1.2rem; min-width: 56px; text-align: right; }

.steps { padding-left: 20px; margin: 8px 0; }
.steps li { margin: 6px 0; }
.danger { border-color: rgba(239, 68, 68, .6); }

/* Mapa */
#map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.95) contrast(.9) saturate(.6); }
#map { height: calc(100vh - 250px); min-height: 320px; border-radius: 16px; border: 1px solid var(--line); background: #0e1626; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--card); color: var(--text); }
.leaflet-popup-content { margin: 10px 12px; font-size: .9rem; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.place-pin { background: none; border: 0; }
.place-pin .pi { border: 2px solid #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, .6); }
.chips { display: flex; gap: 8px; margin-bottom: 10px; overflow-x: auto; }
.chip { flex: none; padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-size: .9rem; }
.chip.active { background: var(--grad); border-color: transparent; color: #fff; }
.legend { display: flex; justify-content: center; gap: 14px; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; }

.disclaimer { text-align: center; color: #fcd34d; font-size: .85rem; margin: 20px 0 0; }

/* Barra inferior */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
  display: flex; justify-content: space-around;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 0 max(0px, calc((100vw - 640px) / 2)) env(safe-area-inset-bottom);
  background: rgba(10, 14, 35, .9);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--muted); text-decoration: none; font-size: .7rem; gap: 2px;
}
.tabbar a svg { width: 26px; height: 26px; transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.tabbar a.active { color: var(--accent); }
.tabbar a.active svg { transform: translateY(-2px) scale(1.12); }
body.locked .tabbar { display: none; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  max-width: 90vw; padding: 12px 18px; border-radius: 12px;
  background: #f8fafc; color: #0a0e23; font-weight: 600;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 2000;
}
.toast.show { opacity: 1; transform: translateX(-50%); }

/* Mapa: personas, epicentro y distancias */
.person-pin { border-radius: 50%; border: 3px solid #fff; background: var(--grad); overflow: hidden;
  display: grid !important; place-items: center; color: #fff; font-weight: 800; box-shadow: 0 2px 8px rgba(0,0,0,.6); }
.person-pin.me { border-color: #3b82f6; }
.person-pin img { width: 100%; height: 100%; object-fit: cover; }
.epi-pin { color: #ef4444; font-size: 34px; line-height: 36px; text-align: center; text-shadow: 0 0 3px #fff, 0 0 6px #fff; }
.leaflet-tooltip.dist-label, .leaflet-tooltip.epi-label {
  background: #fff; color: #1d4ed8; border: 2px solid #1d4ed8; border-radius: 8px;
  font-weight: 800; font-size: 14px; padding: 2px 8px; box-shadow: none; }
.leaflet-tooltip.epi-label { color: #b91c1c; border-color: #b91c1c; }
.leaflet-tooltip.dist-label::before, .leaflet-tooltip.epi-label::before { display: none; }
.pick-banner { background: #1d4ed8; color: #fff; padding: 10px 14px; border-radius: 12px; margin-bottom: 10px; font-weight: 600; }
.event-detail { margin-top: 12px; }
.detail-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 6px; }
.x { background: none; border: 0; color: var(--muted); font-size: 1.2rem; cursor: pointer; }
.event-detail .list li { padding: 8px 4px; }

/* Mensaje familiar */
.family-msg { background: var(--card-2); border-radius: 12px; padding: 10px 12px; margin-bottom: 4px; }
.family-msg p { margin: 4px 0; }
.msg-action { font-weight: 700; font-size: 1.05rem; }
.small-btn { padding: 8px 12px; font-size: .9rem; }
.sep { height: 12px; }

.row-btns { display: flex; gap: 8px; }
.row-btns .btn { flex: 1; }
.place-form { margin-top: 10px; }
.place-row { display: flex; gap: 8px; }
.place-row select { width: 64px; font-size: 1.3rem; border-radius: 12px; background: var(--bg); color: var(--text); border: 1px solid var(--line); }
.place-row input { margin-top: 0 !important; }
.icon-btn { background: none; border: 0; font-size: 1.1rem; cursor: pointer; }
.list .emoji { font-size: 1.3rem; }

/* Emergencia familiar */
.btn.sos {
  position: relative; overflow: hidden; margin-top: 18px; padding: 18px; border-radius: 18px;
  font-size: 1.15rem; color: #fff; border-color: transparent;
  background: linear-gradient(135deg, #b91c3a, #e5364a 60%, #f0435a);
  box-shadow: 0 8px 24px rgba(229, 54, 74, .35);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none;
}
.btn.sos .sos-label { position: relative; z-index: 1; }
.btn.sos .sos-fill { position: absolute; inset: 0; background: rgba(255, 255, 255, .28); transform: scaleX(0); transform-origin: left; }
.btn.sos.holding .sos-fill { transform: scaleX(1); transition: transform 2s linear; }
.btn.sos.holding { animation: sos-shake .4s ease-in-out infinite; }
@keyframes sos-shake { 25% { transform: translateX(-1px) scale(.98); } 75% { transform: translateX(1px) scale(.98); } }
.sos-result { border-color: var(--accent-red); margin-top: 12px; }
.sos-result .row-btns { flex-wrap: wrap; }
.btn.sos-call { background: var(--accent-red); border-color: transparent; color: #fff; flex-basis: 100%; }
.sos-banner { border-color: var(--accent-red); background: linear-gradient(135deg, rgba(229, 54, 74, .28), rgba(122, 63, 214, .18)); animation: sos-glow 1.6s ease-in-out infinite alternate; }
.sos-row { display: flex; align-items: center; gap: 12px; }
.sos-row + .sos-row { margin-top: 12px; }
.sos-row .grow { flex: 1; min-width: 0; }
@keyframes sos-glow { to { box-shadow: 0 0 0 1px var(--accent-red), 0 0 26px rgba(240, 67, 90, .45); } }
.av.ring.sos { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-red); animation: sos-ring 1s ease-in-out infinite alternate; }
@keyframes sos-ring { to { box-shadow: 0 0 0 2px var(--bg), 0 0 0 6px rgba(240, 67, 90, .55); } }

/* Avisos oficiales */
.official-grid { display: grid; gap: 12px; }
@media (min-width: 640px) { .official-grid { grid-template-columns: 1fr 1fr; } }
.official-grid .card { margin: 0; }
.official-head { display: flex; align-items: center; gap: 12px; }
.official-logo { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: .85rem; color: #fff; }
.official-logo.sinaproc { background: linear-gradient(135deg, #b91c3a, #f0435a); }
.official-logo.igc { background: var(--grad); }
.official .row-btns .btn { font-size: .9rem; padding: 11px 8px; }
.badge.reviewed { background: rgba(34, 197, 94, .18); color: #86efac; }
.badge.prelim { background: rgba(139, 155, 255, .18); color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .sos-banner, .av.ring.sos, .btn.sos.holding { animation: none; }
}
.small-btn { min-height: 40px; border-radius: 12px; }
.btn.sos .bi { position: relative; z-index: 1; width: 22px; height: 22px; }
.btn.sos { min-height: 60px; }
.official .row-btns .btn { min-height: 44px; }
