/* Mall SOS — "¡Al toque!"  Identidad: naranja del MALL, rojo de emergencia, escudo de energía y radar. */

@font-face { font-family: 'Montserrat'; font-weight: 400; font-style: normal; font-display: swap; src: url('/vendor/fonts/montserrat-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-weight: 600; font-style: normal; font-display: swap; src: url('/vendor/fonts/montserrat-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-weight: 700; font-style: normal; font-display: swap; src: url('/vendor/fonts/montserrat-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-weight: 800; font-style: normal; font-display: swap; src: url('/vendor/fonts/montserrat-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-weight: 900; font-style: normal; font-display: swap; src: url('/vendor/fonts/montserrat-latin-900-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-weight: 700; font-style: italic; font-display: swap; src: url('/vendor/fonts/montserrat-latin-700-italic.woff2') format('woff2'); }

:root {
  --bg: #060912;
  --bg2: #0B1020;
  --panel: rgba(13, 18, 34, 0.78);
  --panel-solid: #0E1426;
  --panel-2: rgba(22, 28, 50, 0.85);
  --line: rgba(255, 138, 50, 0.24);
  --line-soft: rgba(255, 255, 255, 0.08);
  --orange: #FF7A1A;
  --orange-2: #FFB255;
  --orange-deep: #D9480F;
  --red: #FF2D3D;
  --red-deep: #B3101F;
  --text: #F5EFE8;
  --muted: #AEB6CB;
  --ok: #3DDC97;
  --warn: #FFC23D;
  --blue: #4DB8FF;
  --radius: 18px;
  --nav-h: 72px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--orange-2); }
a:hover { color: #FFD29A; }
:focus-visible { outline: 3px solid var(--orange-2); outline-offset: 3px; border-radius: 10px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Fondo animado ---------- */
#fondo { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; display: block; pointer-events: none; }
.vignette { position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(120% 80% at 50% 0%, rgba(255,122,26,0.10), transparent 60%),
              radial-gradient(90% 70% at 50% 110%, rgba(255,45,61,0.10), transparent 60%); }

/* ---------- Estructura ---------- */
#app { position: relative; z-index: 1; min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: linear-gradient(180deg, rgba(6,9,18,0.92), rgba(6,9,18,0.55));
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-width: 0; }
.brand svg { flex: 0 0 auto; filter: drop-shadow(0 0 8px rgba(255,122,26,0.45)); }
.brand .name { font-weight: 900; font-size: 20px; letter-spacing: -0.5px; line-height: 1; }
.brand .name .m { color: var(--orange); }
.brand .name .s { color: var(--red); }
.brand .slogan { font-style: italic; font-weight: 700; font-size: 12px; color: var(--muted); }
.top-right { display: flex; align-items: center; gap: 10px; }
.net { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 6px 10px; border-radius: 99px; border: 1px solid var(--line-soft); background: rgba(255,255,255,0.04); }
.net .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.net.off .dot { background: var(--red); box-shadow: 0 0 10px var(--red); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 14px; color: #0B0E18; flex: 0 0 auto; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }

main#vista { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 14px 16px calc(var(--nav-h) + 24px + var(--safe-b)); }
main#vista.full { max-width: 560px; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(7, 10, 20, 0.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 700; position: relative; }
.nav a svg { width: 24px; height: 24px; }
.nav a.on { color: var(--orange-2); }
.nav a.on::before { content: ''; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; border-radius: 0 0 4px 4px; background: var(--orange); box-shadow: 0 0 12px var(--orange); }
.nav a.sos { color: var(--text); }
.nav a.sos .pill { width: 46px; height: 30px; border-radius: 99px; display: grid; place-items: center; background: linear-gradient(135deg, var(--red), var(--red-deep)); font-weight: 900; font-size: 12px; box-shadow: 0 0 16px rgba(255,45,61,0.5); }
.nav .badge { position: absolute; top: 8px; right: calc(50% - 22px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 900; display: grid; place-items: center; padding: 0 4px; box-shadow: 0 0 10px var(--red); }

/* ---------- Componentes ---------- */
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-size: 26px; font-weight: 900; letter-spacing: -0.5px; }
h2 { font-size: 19px; font-weight: 800; }
h3 { font-size: 16px; font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.lg { gap: 18px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 2px 0; }
.section-title h2 { font-size: 15px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--orange-2); }

.card {
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 16px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.card.glow { border-color: var(--line); box-shadow: 0 0 0 1px rgba(255,122,26,0.08), 0 12px 40px rgba(255,122,26,0.08); }
.card.danger { border-color: rgba(255,45,61,0.55); background: linear-gradient(135deg, rgba(120,10,24,0.55), rgba(13,18,34,0.85)); }
.card.ok { border-color: rgba(61,220,151,0.45); }
.card.warn { border-color: rgba(255,194,61,0.5); }
a.card { display: block; text-decoration: none; color: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line-soft);
  background: rgba(255,255,255,0.06); color: var(--text); font-weight: 800; font-size: 15px;
  cursor: pointer; text-decoration: none; transition: transform .12s ease, background .2s ease, box-shadow .2s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; flex: 0 0 auto; }
.btn.primary { background: linear-gradient(135deg, var(--orange-2), var(--orange) 45%, var(--orange-deep)); color: #160A02; border: 0; box-shadow: 0 6px 24px rgba(255,122,26,0.35); }
.btn.primary:hover { box-shadow: 0 8px 30px rgba(255,122,26,0.5); }
.btn.red { background: linear-gradient(135deg, #FF5A4A, var(--red) 45%, var(--red-deep)); color: #fff; border: 0; box-shadow: 0 6px 24px rgba(255,45,61,0.4); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { min-height: 40px; padding: 0 12px; font-size: 13px; border-radius: 12px; }
.btn.icon { width: 44px; padding: 0; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 14px;
  border-radius: 99px; border: 1px solid var(--line-soft); background: rgba(255,255,255,0.05);
  font-weight: 700; font-size: 14px; cursor: pointer; color: var(--text);
}
.chip svg { width: 16px; height: 16px; }
.chip[aria-pressed="true"] { border-color: var(--orange); background: rgba(255,122,26,0.18); box-shadow: inset 0 0 0 1px var(--orange), 0 0 16px rgba(255,122,26,0.25); }
.chip .count { font-size: 12px; color: var(--muted); }
.chip.add { border-style: dashed; color: var(--orange-2); }

.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 800; background: rgba(255,255,255,0.07); border: 1px solid var(--line-soft); white-space: nowrap; }
.tag svg { width: 13px; height: 13px; }
.tag.leader { color: #FFD29A; border-color: rgba(255,178,85,0.45); background: rgba(255,122,26,0.14); }
.tag.admin { color: #9FD8FF; border-color: rgba(77,184,255,0.45); background: rgba(77,184,255,0.12); }
.tag.ok { color: #9FF0CB; border-color: rgba(61,220,151,0.45); background: rgba(61,220,151,0.12); }
.tag.warn { color: #FFE29A; border-color: rgba(255,194,61,0.5); background: rgba(255,194,61,0.12); }
.tag.bad { color: #FFB3B9; border-color: rgba(255,45,61,0.5); background: rgba(255,45,61,0.14); }
.tag.live { color: #fff; background: var(--red); border-color: var(--red); animation: pulse 1.4s ease-in-out infinite; }

label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14); background: rgba(5,8,16,0.65); color: var(--text); font-size: 16px;
}
textarea.input { min-height: 88px; resize: vertical; }
.input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,122,26,0.25); }
.pass-wrap { position: relative; }
.pass-wrap .input { padding-right: 52px; }
.pass-wrap button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--orange); flex: 0 0 auto; margin-top: 1px; }

.error-box { padding: 12px 14px; border-radius: 12px; background: rgba(255,45,61,0.14); border: 1px solid rgba(255,45,61,0.45); color: #FFD0D4; font-weight: 600; font-size: 14px; }
.info-box { padding: 12px 14px; border-radius: 12px; background: rgba(77,184,255,0.10); border: 1px solid rgba(77,184,255,0.35); color: #D3ECFF; font-size: 14px; }
.warn-box { padding: 12px 14px; border-radius: 12px; background: rgba(255,194,61,0.12); border: 1px solid rgba(255,194,61,0.45); color: #FFEBB8; font-size: 14px; }

.list { display: flex; flex-direction: column; }
.list > .item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.list > .item:last-child { border-bottom: 0; }

.lock-ic { display: inline-grid; place-items: center; width: 40px; color: var(--muted); }
.lock-ic svg { width: 18px; height: 18px; }

.divider { height: 1px; background: var(--line-soft); margin: 4px 0; }

/* ---------- Ingreso ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 28px 18px calc(28px + var(--safe-b)); position: relative; z-index: 1; }
.auth .box { width: 100%; max-width: 420px; }
.logo-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 20px; }
.logo-hero svg.shield { width: 150px; height: 175px; filter: drop-shadow(0 0 22px rgba(255,122,26,0.55)); animation: rise .9s cubic-bezier(.2,.9,.25,1.2) both; }
.wordmark { font-weight: 900; font-size: 44px; letter-spacing: -1.5px; line-height: 1; }
.wordmark .m { color: var(--orange); }
.wordmark .s { color: var(--red); text-shadow: 0 0 18px rgba(255,45,61,0.45); }
.slogan-big { font-style: italic; font-weight: 700; font-size: 20px; color: var(--text); opacity: .92; }
.temp-note { font-size: 12px; color: var(--muted); text-align: center; margin-top: 14px; }

@keyframes rise { from { transform: translateY(18px) scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* ---------- Pantalla del botón ---------- */
.sos-zone { position: relative; display: grid; place-items: center; padding: 16px 0 6px; }
.sos-zone .radar-glow { position: absolute; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, rgba(255,45,61,0.22), transparent 65%); filter: blur(4px); pointer-events: none; }
.sos-btn {
  position: relative; width: 236px; height: 236px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: radial-gradient(circle at 38% 32%, #FF7B6E 0%, #F0263A 45%, #A80F1C 100%);
  box-shadow: 0 0 0 10px rgba(255,45,61,0.12), 0 0 0 22px rgba(255,45,61,0.06), 0 18px 60px rgba(255,45,61,0.45), inset 0 -10px 30px rgba(0,0,0,0.35), inset 0 8px 20px rgba(255,255,255,0.18);
  color: #fff; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  display: grid; place-items: center; transition: transform .15s ease;
}
.sos-btn:disabled { filter: grayscale(.6) brightness(.7); cursor: not-allowed; }
.sos-btn.holding { transform: scale(0.96); }
.sos-btn .inner { display: flex; flex-direction: column; align-items: center; gap: 2px; pointer-events: none; }
.sos-btn .big { font-weight: 900; font-size: 64px; letter-spacing: 2px; line-height: 1; text-shadow: 0 2px 10px rgba(0,0,0,0.35); }
.sos-btn .hint { font-weight: 800; font-size: 13px; opacity: .95; }
.sos-btn .count { font-weight: 900; font-size: 92px; line-height: 1; }
.sos-ring { position: absolute; width: 284px; height: 284px; pointer-events: none; transform: rotate(-90deg); }
.sos-ring .track { stroke: rgba(255,255,255,0.10); }
.sos-ring .prog { stroke: url(#ringGrad); stroke-linecap: round; filter: drop-shadow(0 0 8px rgba(255,178,85,0.9)); }
.sos-status { min-height: 44px; text-align: center; font-weight: 700; font-size: 14px; padding: 0 10px; }
.sos-status.bad { color: #FFB3B9; }

.emergency { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.emergency a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 76px;
  border-radius: 16px; text-decoration: none; color: var(--text); border: 1px solid var(--line-soft); background: var(--panel);
}
.emergency a svg { width: 22px; height: 22px; color: var(--orange-2); }
.emergency a strong { font-size: 20px; font-weight: 900; line-height: 1.1; }
.emergency a span { font-size: 12px; color: var(--muted); font-weight: 700; }

/* ---------- Alerta entrante ---------- */
.incoming {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; justify-content: space-between;
  padding: calc(24px + var(--safe-t)) 20px calc(24px + var(--safe-b));
  background: radial-gradient(circle at 50% 35%, rgba(255,45,61,0.65), rgba(90,6,16,0.95) 55%, #120206 100%);
  animation: flash 1s ease-in-out infinite;
}
@keyframes flash { 0%, 100% { background-color: #120206; } 50% { background-color: #3B0610; } }
.incoming .rings { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.incoming .rings span { position: absolute; left: 50%; top: 34%; width: 160px; height: 160px; margin: -80px 0 0 -80px; border-radius: 50%; border: 3px solid rgba(255,178,85,0.8); animation: wave 2.4s linear infinite; }
.incoming .rings span:nth-child(2) { animation-delay: .8s; }
.incoming .rings span:nth-child(3) { animation-delay: 1.6s; }
@keyframes wave { from { transform: scale(.6); opacity: 1; } to { transform: scale(4.2); opacity: 0; } }
.incoming .who { position: relative; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 8vh; }
.incoming .who .label { font-weight: 900; letter-spacing: 3px; font-size: 14px; color: #FFD29A; }
.incoming .who h1 { font-size: 34px; }
.incoming .who .msg { font-size: 22px; font-weight: 800; background: rgba(0,0,0,0.25); padding: 10px 16px; border-radius: 14px; }
.incoming .actions { position: relative; display: flex; flex-direction: column; gap: 12px; }
.incoming .btn.primary { min-height: 64px; font-size: 18px; }

/* ---------- Alerta activa / detalle ---------- */
.alert-head { display: flex; flex-direction: column; gap: 8px; }
.alert-head .msg { font-size: 22px; font-weight: 900; }
.steps { display: flex; flex-direction: column; gap: 2px; }
.step { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.step .ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; border: 2px solid rgba(255,255,255,0.18); color: var(--muted); }
.step .ic svg { width: 16px; height: 16px; }
.step.done .ic { border-color: var(--ok); background: rgba(61,220,151,0.16); color: var(--ok); }
.step.wait .ic { border-color: var(--warn); color: var(--warn); animation: pulse 1.4s infinite; }
.step.bad .ic { border-color: var(--red); color: var(--red); }
.step .t { font-weight: 800; }
.step .d { font-size: 13px; color: var(--muted); }

.map { height: 260px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #0A0F1C; }
.map.tall { height: 320px; }
.leaflet-container { background: #0A0F1C; font-family: inherit; }
.leaflet-tile-pane { filter: invert(1) hue-rotate(185deg) brightness(.82) contrast(.92) saturate(.55); }
.leaflet-control-attribution { background: rgba(6,9,18,0.75) !important; color: var(--muted) !important; font-size: 10px; }
.leaflet-control-attribution a { color: var(--orange-2) !important; }
.leaflet-bar a { background: #10172B !important; color: var(--text) !important; border-color: #1E2742 !important; }
.pin { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 12px; color: #0B0E18; border: 3px solid #fff; box-shadow: 0 0 0 3px rgba(0,0,0,0.3), 0 4px 14px rgba(0,0,0,0.5); }
.pin.sender { background: var(--red); color: #fff; box-shadow: 0 0 0 0 rgba(255,45,61,0.7); animation: pinpulse 1.6s infinite; }
@keyframes pinpulse { 0% { box-shadow: 0 0 0 0 rgba(255,45,61,0.7); } 70% { box-shadow: 0 0 0 18px rgba(255,45,61,0); } 100% { box-shadow: 0 0 0 0 rgba(255,45,61,0); } }
.pin.me { background: var(--blue); }

.person { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.person:last-child { border-bottom: 0; }
.person .info { flex: 1; min-width: 0; }
.person .name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .sub { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 2px; }
.person .sub .tag { white-space: normal; line-height: 1.3; }

.timeline { display: flex; flex-direction: column; gap: 10px; }
.bubble { padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,0.06); border: 1px solid var(--line-soft); max-width: 92%; }
.bubble.mine { align-self: flex-end; background: rgba(255,122,26,0.14); border-color: rgba(255,122,26,0.35); }
.bubble.sys { align-self: center; background: transparent; border-style: dashed; font-size: 13px; color: var(--muted); text-align: center; }
.bubble .who { font-size: 12px; font-weight: 800; color: var(--orange-2); }
.bubble .when { font-size: 11px; color: var(--muted); margin-left: 6px; font-weight: 600; }

.loc-line { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.loc-line svg { width: 16px; height: 16px; flex: 0 0 auto; }

/* ---------- Grupos ---------- */
.group-card { display: flex; align-items: center; gap: 14px; }
.group-ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; flex: 0 0 auto;
  background: linear-gradient(135deg, rgba(255,178,85,0.25), rgba(255,122,26,0.08)); border: 1px solid var(--line); color: var(--orange-2); }
.group-ic svg { width: 26px; height: 26px; }

/* ---------- Ventanas ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 90; background: rgba(2,4,10,0.72); backdrop-filter: blur(4px); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease; }
.modal { width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 22px 22px 0 0; padding: 20px 18px calc(20px + var(--safe-b)); animation: up .22s cubic-bezier(.2,.9,.3,1); }
@media (min-width: 600px) { .modal-bg { align-items: center; } .modal { border-radius: 22px; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

.toasts { position: fixed; left: 0; right: 0; top: calc(70px + var(--safe-t)); z-index: 120; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; max-width: 520px; width: 100%; padding: 12px 14px; border-radius: 14px; background: #121A30; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,0.5); font-weight: 700; font-size: 14px; animation: up .2s ease; }
.toast.bad { border-color: rgba(255,45,61,0.6); }
.toast.ok { border-color: rgba(61,220,151,0.6); }

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; text-decoration: none; color: var(--text); }
.banner.red { background: linear-gradient(135deg, rgba(255,45,61,0.85), rgba(150,10,24,0.9)); box-shadow: 0 0 24px rgba(255,45,61,0.45); animation: pulse 1.6s infinite; }
.banner.orange { background: linear-gradient(135deg, rgba(255,122,26,0.30), rgba(255,122,26,0.10)); border: 1px solid var(--line); }
.banner svg { width: 26px; height: 26px; flex: 0 0 auto; }

/* ---------- Manual ---------- */
.manual details { background: var(--panel); border: 1px solid var(--line-soft); border-radius: 16px; overflow: hidden; }
.manual details + details { margin-top: 10px; }
.manual summary { list-style: none; cursor: pointer; padding: 14px 16px; display: flex; align-items: center; gap: 12px; font-weight: 800; }
.manual summary::-webkit-details-marker { display: none; }
.manual summary .num { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,122,26,0.16); color: var(--orange-2); font-weight: 900; flex: 0 0 auto; }
.manual summary .chev { margin-left: auto; transition: transform .2s; color: var(--muted); }
.manual details[open] summary .chev { transform: rotate(90deg); }
.manual summary .chev svg { width: 20px; height: 20px; }
.manual .body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 12px; font-size: 15px; }
.manual .body ol, .manual .body ul { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.manual .illus { border-radius: 14px; border: 1px solid var(--line); background: rgba(5,8,16,0.6); padding: 10px; display: grid; place-items: center; }
.manual .illus svg { width: 100%; max-width: 360px; height: auto; }
.manual .who-tag { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

/* ---------- Panel ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { padding: 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line-soft); }
.stat .v { font-size: 30px; font-weight: 900; color: var(--orange-2); line-height: 1.1; }
.stat .l { font-size: 13px; color: var(--muted); font-weight: 700; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: 8px; }
.bars .b { flex: 1; min-width: 4px; background: linear-gradient(180deg, var(--orange-2), var(--orange-deep)); border-radius: 4px 4px 0 0; position: relative; }
.perm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.perm-table th, .perm-table td { padding: 8px 6px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
.perm-table td.c, .perm-table th.c { text-align: center; }
.perm-table input { width: 22px; height: 22px; accent-color: var(--orange); }
.table-wrap { overflow-x: auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* Botón hacia El Point (mensajería del MALL) */
.btn.point { background: linear-gradient(135deg, rgba(77,184,255,0.22), rgba(255,122,26,0.18)); border: 1px solid rgba(77,184,255,0.5); color: #DDF1FF; }
.btn.point:hover { box-shadow: 0 0 22px rgba(77,184,255,0.35); }

/* ---------- Movimiento y vida (v0.2) ---------- */
@property --ang { syntax: '<angle>'; initial-value: 0deg; inherits: false; }

/* Entrada de cada pantalla: los bloques aparecen en cascada. */
.view-in > * { animation: viewIn .42s cubic-bezier(.2,.8,.25,1) both; animation-delay: calc(var(--i, 0) * 55ms); }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px) scale(.985); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }

/* Borde de energía que gira alrededor de las tarjetas destacadas. */
.card.glow { position: relative; isolation: isolate; }
.card.glow::before {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px; z-index: -1; pointer-events: none;
  background: conic-gradient(from var(--ang), transparent 0 55%, rgba(255,178,85,0.95) 70%, rgba(255,45,61,0.8) 78%, transparent 90%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: spinBorder 5s linear infinite;
}
.card.danger { animation: dangerGlow 2.2s ease-in-out infinite; }
@keyframes spinBorder { to { --ang: 360deg; } }
@keyframes dangerGlow { 0%, 100% { box-shadow: 0 0 0 1px rgba(255,45,61,0.25), 0 10px 30px rgba(255,45,61,0.15); } 50% { box-shadow: 0 0 0 1px rgba(255,45,61,0.6), 0 10px 40px rgba(255,45,61,0.35); } }

/* Brillo que cruza los botones principales. */
.btn.primary, .btn.red, .btn.point { position: relative; overflow: hidden; }
.btn.primary::after, .btn.red::after, .btn.point::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.45), transparent);
  transform: skewX(-18deg); animation: shine 4.5s ease-in-out infinite;
}
@keyframes shine { 0%, 70% { left: -60%; } 100% { left: 130%; } }

/* El botón SOS "respira" mientras espera. */
.sos-btn:not(.holding):not(:disabled) { animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 10px rgba(255,45,61,0.12), 0 0 0 22px rgba(255,45,61,0.06), 0 18px 60px rgba(255,45,61,0.45), inset 0 -10px 30px rgba(0,0,0,0.35), inset 0 8px 20px rgba(255,255,255,0.18); }
  50% { box-shadow: 0 0 0 14px rgba(255,45,61,0.18), 0 0 0 32px rgba(255,45,61,0.07), 0 18px 80px rgba(255,45,61,0.65), inset 0 -10px 30px rgba(0,0,0,0.35), inset 0 8px 20px rgba(255,255,255,0.22); }
}
.sos-btn.holding { box-shadow: 0 0 0 16px rgba(255,178,85,0.22), 0 0 90px rgba(255,122,26,0.75), inset 0 -10px 30px rgba(0,0,0,0.35); }

/* Logo de la barra superior con pulso suave. */
.brand svg { animation: brandPulse 3.2s ease-in-out infinite; }
@keyframes brandPulse { 0%, 100% { filter: drop-shadow(0 0 6px rgba(255,122,26,0.4)); } 50% { filter: drop-shadow(0 0 14px rgba(255,122,26,0.85)); } }

/* Chips y tarjetas reaccionan al toque. */
.chip { transition: transform .15s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease; }
.chip:active { transform: scale(.96); }
a.card { transition: transform .18s ease, border-color .2s ease, box-shadow .2s ease; }
a.card:hover { transform: translateY(-2px); border-color: var(--line); box-shadow: 0 14px 40px rgba(255,122,26,0.12); }
a.card:active { transform: scale(.99); }
.stat .v { background: linear-gradient(120deg, #FFE0A8, var(--orange) 60%, #FF5A3A); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav a { transition: color .2s ease; }
.nav a.on svg { filter: drop-shadow(0 0 8px rgba(255,178,85,0.8)); }
