/* ===========================================================================
   EVA — estetica inspirada en el robot EVE de WALL-E:
   blanco puro, azules muy claros, grises suaves, superficies glossy y curvas.
   =========================================================================== */
:root {
  --bg: #eef5fe;
  --bg-grad-1: #f7fbff;
  --bg-grad-2: #e6f0fd;
  --surface: #ffffff;
  --surface-2: #f2f8ff;
  --surface-3: #e9f2fe;
  --ink: #1c2a3d;
  --ink-soft: #43536a;
  --muted: #8595ac;
  --line: #e3edf9;
  --line-2: #d4e3f5;
  --blue: #2e6be6;
  --blue-600: #1f57c8;
  --blue-soft: #8ab4ff;
  --blue-050: #eef4ff;
  --blue-100: #dfeaff;
  --cyan: #34c3f2;
  --ok: #17b083;
  --warn: #f0a531;
  --alert: #ef5a6f;
  --alert-050: #fdeef0;
  --shadow-sm: 0 1px 2px rgba(31, 66, 135, 0.06), 0 2px 8px rgba(31, 66, 135, 0.05);
  --shadow: 0 6px 22px rgba(28, 62, 130, 0.10);
  --shadow-lg: 0 18px 48px rgba(28, 62, 130, 0.16);
  --r-sm: 12px;
  --r: 18px;
  --r-lg: 26px;
  --r-pill: 999px;
  --nav-h: 62px;
  --top-h: 58px;
  --maxw: 640px;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(120% 80% at 50% -10%, var(--bg-grad-1) 0%, var(--bg) 55%, var(--bg-grad-2) 100%);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button { font-family: inherit; cursor: pointer; }
h2, h3 { margin: 0 0 6px; letter-spacing: -0.01em; }
.muted { color: var(--muted); }

#app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* --- Topbar --------------------------------------------------------------- */
.topbar {
  height: calc(var(--top-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.72));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-avatar {
  width: 34px; height: 40px;
  border-radius: 50% / 46%;
  background: linear-gradient(160deg, #ffffff, #eaf3ff 70%);
  box-shadow: inset 0 2px 4px #fff, inset 0 -3px 8px #cfe0f6, var(--shadow-sm);
  position: relative;
  flex: none;
}
.brand-avatar::before {
  content: "";
  position: absolute; inset: 26% 22% auto 22%; height: 30%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--blue) 45%, var(--cyan));
  box-shadow: 0 0 8px rgba(52, 195, 242, 0.55);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-size: 17px; letter-spacing: 0.5px; }
.brand-text small { font-size: 11px; color: var(--muted); }

.zone-chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink-soft);
  padding: 7px 12px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  box-shadow: var(--shadow-sm);
  max-width: 55%;
}
.zone-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.zone-chip.ok .dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(23, 176, 131, 0.15); }
.zone-chip.out .dot { background: var(--warn); box-shadow: 0 0 0 4px rgba(240, 165, 49, 0.15); }
.zone-chip.err .dot { background: var(--alert); }
.zone-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Views --------------------------------------------------------------- */
#views { flex: 1; position: relative; display: flex; }
.view {
  display: none;
  flex: 1;
  min-height: 0;
  width: 100%;
  flex-direction: column;
}
.view.is-active { display: flex; }

/* --- Chat ---------------------------------------------------------------- */
.thread {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.msg { display: flex; gap: 9px; max-width: 92%; }
.msg--eva { align-self: flex-start; }
.msg--user { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar {
  width: 30px; height: 34px; flex: none; border-radius: 50% / 46%;
  background: linear-gradient(160deg, #ffffff, #e8f2ff 70%);
  box-shadow: inset 0 -3px 7px #cfe0f6, var(--shadow-sm);
  position: relative; margin-top: 2px;
}
.msg-avatar::before {
  content: ""; position: absolute; inset: 30% 22% auto 22%; height: 26%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--blue) 45%, var(--cyan));
  box-shadow: 0 0 6px rgba(52, 195, 242, 0.5);
}
.bubble {
  padding: 11px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.42;
  box-shadow: var(--shadow-sm);
  white-space: pre-wrap;
  word-break: break-word;
}
.msg--eva .bubble {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top-left-radius: 6px;
  color: var(--ink);
}
.msg--user .bubble {
  background: linear-gradient(160deg, var(--blue), var(--blue-600));
  color: #fff;
  border-top-right-radius: 6px;
}
.bubble b { font-weight: 700; }
.bubble a { color: var(--blue); }

.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--blue-soft); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* Tarjeta-formulario dentro del chat */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 15px;
  margin-top: 2px;
  animation: rise 0.28s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.card h4 { margin: 0 0 3px; font-size: 15.5px; }
.card .sub { font-size: 12.5px; color: var(--muted); margin: 0 0 12px; }
.field { margin-bottom: 11px; }
.field > label { display: block; font-size: 12.5px; color: var(--ink-soft); margin-bottom: 5px; font-weight: 600; }
.field input[type="text"], .field input[type="tel"], .field input[type="number"], .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: 11px 12px;
  font-size: 15px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.field textarea { resize: vertical; min-height: 66px; }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--blue-soft);
  background: #fff;
  box-shadow: 0 0 0 4px var(--blue-050);
}
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--ink-soft);
  border-radius: var(--r-pill);
  padding: 8px 13px;
  font-size: 13.5px;
  transition: all 0.15s;
}
.opt.sel { background: var(--blue); color: #fff; border-color: var(--blue); box-shadow: var(--shadow-sm); }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--ink-soft); padding: 4px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }

.geo-btn {
  display: flex; align-items: center; gap: 9px; width: 100%;
  border: 1px dashed var(--blue-soft);
  background: var(--blue-050);
  color: var(--blue-600);
  border-radius: var(--r-sm);
  padding: 11px 12px; font-size: 14px; font-weight: 600;
}
.geo-btn.ok { border-style: solid; border-color: var(--ok); background: #edfaf5; color: #0d7a5b; }
.geo-btn.err { border-color: var(--alert); background: var(--alert-050); color: #c33; }
.geo-preview { font-size: 12px; color: var(--muted); margin-top: 6px; }

.photo-row { display: flex; align-items: center; gap: 12px; }
.photo-thumb { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line-2); display: none; }
.photo-thumb.show { display: block; }

.card-actions { display: flex; gap: 9px; margin-top: 6px; }

/* Botones */
.btn {
  appearance: none; border: none; border-radius: var(--r-sm);
  padding: 12px 16px; font-size: 14.5px; font-weight: 600;
  background: linear-gradient(160deg, var(--blue), var(--blue-600));
  color: #fff; box-shadow: var(--shadow-sm);
  transition: transform 0.08s, box-shadow 0.15s, opacity 0.15s;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn[disabled] { opacity: 0.5; cursor: default; }
.btn--soft { background: var(--surface-2); color: var(--blue-600); border: 1px solid var(--line-2); box-shadow: none; }
.btn--ghost { background: transparent; color: var(--muted); box-shadow: none; }
.btn--alert { background: linear-gradient(160deg, var(--alert), #d94459); }
.btn--block { width: 100%; }
.btn--sm { padding: 8px 12px; font-size: 13px; }

/* Quick actions */
.quick-actions {
  display: flex; gap: 8px; overflow-x: auto; padding: 8px 14px 6px;
  scrollbar-width: none;
}
.quick-actions::-webkit-scrollbar { display: none; }
.qa {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line-2); background: var(--surface);
  color: var(--ink-soft); border-radius: var(--r-pill);
  padding: 9px 14px; font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.qa .emoji { font-size: 15px; }
.qa.alert { color: var(--alert); border-color: #f6c9d0; background: var(--alert-050); }

/* Composer */
.composer {
  display: flex; gap: 9px; align-items: center;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.7), var(--surface));
  backdrop-filter: blur(10px);
}
.composer-input {
  flex: 1; border: 1px solid var(--line-2); background: var(--surface-2);
  border-radius: var(--r-pill); padding: 13px 16px; font-size: 15px; color: var(--ink); outline: none;
}
.composer-input:focus { border-color: var(--blue-soft); background: #fff; box-shadow: 0 0 0 4px var(--blue-050); }
.composer-send {
  width: 46px; height: 46px; flex: none; border: none; border-radius: 50%;
  background: linear-gradient(160deg, var(--blue), var(--blue-600)); color: #fff;
  display: grid; place-items: center; box-shadow: var(--shadow);
}
.composer-send:active { transform: scale(0.94); }
.composer-mic {
  width: 46px; height: 46px; flex: none; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--blue-600); border-radius: 50%;
  display: grid; place-items: center; transition: transform 0.08s;
}
.composer-mic:active { transform: scale(0.94); }
.composer-mic.rec { background: var(--alert); color: #fff; border-color: var(--alert); animation: pulseRec 1.1s infinite; }
@keyframes pulseRec { 0%, 100% { box-shadow: 0 0 0 0 rgba(239, 90, 111, 0.5); } 50% { box-shadow: 0 0 0 9px rgba(239, 90, 111, 0); } }

/* Acciones de la cabecera (voz + zona) */
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; flex: none; border-radius: 50%; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink-soft); display: grid; place-items: center; font-size: 16px; box-shadow: var(--shadow-sm);
}
.icon-btn[aria-pressed="true"] { background: var(--blue); color: #fff; border-color: var(--blue); }

/* --- Mapa ---------------------------------------------------------------- */
.map { flex: 1; width: 100%; z-index: 1; }
.map-filters { display: flex; gap: 8px; overflow-x: auto; padding: 10px 14px; scrollbar-width: none; }
.map-filters::-webkit-scrollbar { display: none; }
.map-legend {
  display: flex; gap: 14px; flex-wrap: wrap; justify-content: center;
  padding: 9px 14px calc(9px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.leaflet-container { font: inherit; background: var(--surface-3); }
.pin {
  width: 22px; height: 22px; border-radius: 50% 50% 50% 2px;
  transform: rotate(45deg); border: 2px solid #fff; box-shadow: var(--shadow);
}

/* --- Casos --------------------------------------------------------------- */
.casos-head { padding: 12px 14px 6px; display: flex; flex-direction: column; gap: 10px; }
.tabs { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; border: 1px solid var(--line-2); background: var(--surface);
  color: var(--ink-soft); border-radius: var(--r-pill); padding: 8px 14px; font-size: 13px; font-weight: 600;
}
.tab.sel { background: var(--ink); color: #fff; border-color: var(--ink); }
.casos-search {
  width: 100%; border: 1px solid var(--line-2); background: var(--surface-2);
  border-radius: var(--r-pill); padding: 11px 15px; font-size: 14.5px; outline: none; color: var(--ink);
}
.casos-search:focus { border-color: var(--blue-soft); background: #fff; box-shadow: 0 0 0 4px var(--blue-050); }
.casos-list { flex: 1; overflow-y: auto; padding: 8px 14px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }

.caso {
  display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px; box-shadow: var(--shadow-sm);
}
.caso-foto {
  width: 58px; height: 58px; border-radius: 14px; object-fit: cover; flex: none;
  background: var(--surface-3); border: 1px solid var(--line-2);
}
.caso-ph { display: grid; place-items: center; color: var(--blue-soft); font-size: 24px; }
.caso-body { flex: 1; min-width: 0; }
.caso-title { font-size: 15px; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 7px; }
.caso-meta { font-size: 12.5px; color: var(--muted); margin: 3px 0 0; }
.caso-desc { font-size: 13px; color: var(--ink-soft); margin: 6px 0 0; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.caso-actions { margin-top: 9px; display: flex; gap: 8px; flex-wrap: wrap; }

.badge {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--blue-100); color: var(--blue-600); white-space: nowrap;
}
.badge--menor { background: #fff2d9; color: #9a6a00; }
.badge--ok { background: #e2f8f0; color: #0d7a5b; }
.badge--alert { background: var(--alert-050); color: #c33; }
.badge--warn { background: #fff2d9; color: #9a6a00; }
.badge--gray { background: var(--surface-3); color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14px; }

/* --- Mi QR / Stats ------------------------------------------------------- */
.view--qr { overflow-y: auto; padding: 16px 14px calc(20px + env(safe-area-inset-bottom)); gap: 14px; }
.qr-card, .stats-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 20px; text-align: center;
}
.qr-holder { display: grid; place-items: center; margin: 14px 0 6px; }
.qr-holder img { width: 210px; height: 210px; border-radius: var(--r); background: #fff; padding: 10px; box-shadow: var(--shadow-sm); }
.qr-alias { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.stats-card { text-align: left; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 10px; }
.stat {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 13px 14px; display: flex; flex-direction: column; gap: 2px;
}
.stat b { font-size: 22px; color: var(--blue-600); letter-spacing: -0.02em; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.alert b { color: var(--alert); }
.disclaimer { font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.5; padding: 0 8px; }

/* --- Bottom nav ---------------------------------------------------------- */
.bottomnav {
  display: flex; align-items: stretch;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.85), var(--surface));
  backdrop-filter: blur(14px);
  position: sticky; bottom: 0; z-index: 20;
}
.nav-btn {
  flex: 1; border: none; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 10.5px; font-weight: 600; transition: color 0.15s;
}
.nav-btn svg { width: 23px; height: 23px; }
.nav-btn.is-active { color: var(--blue); }
.nav-btn.is-active svg { filter: drop-shadow(0 3px 6px rgba(46, 107, 230, 0.35)); }

/* --- Toast --------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--r-pill);
  font-size: 13.5px; box-shadow: var(--shadow-lg); z-index: 60; max-width: 90%; text-align: center;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast.alert { background: var(--alert); }

/* --- Overlay de bienvenida ----------------------------------------------- */
.gate {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: radial-gradient(120% 90% at 50% 0%, #fbfdff, #e9f2fe);
  padding: 24px; text-align: center;
}
.gate-inner { max-width: 340px; }
.gate .eve {
  width: 92px; height: 112px; margin: 0 auto 22px;
  border-radius: 50% / 44%;
  background: linear-gradient(165deg, #ffffff, #e7f1ff 72%);
  box-shadow: inset 0 4px 8px #fff, inset 0 -8px 18px #cfe0f6, var(--shadow-lg);
  position: relative; animation: float 3.4s ease-in-out infinite;
}
.gate .eve::before {
  content: ""; position: absolute; inset: 30% 20% auto 20%; height: 26%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--blue) 45%, var(--cyan));
  box-shadow: 0 0 16px rgba(52, 195, 242, 0.6); animation: eyes 5s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes eyes { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.15); } }
.gate h1 { font-size: 25px; margin: 0 0 8px; letter-spacing: -0.02em; }
.gate p { color: var(--ink-soft); font-size: 14.5px; line-height: 1.5; margin: 0 0 22px; }
.gate .btn { width: 100%; padding: 14px; font-size: 15.5px; }
.gate .fineprint { font-size: 11.5px; color: var(--muted); margin-top: 16px; line-height: 1.5; }
.gate.hidden { display: none; }

/* --- Selector de ubicacion (pin) ----------------------------------------- */
.picker {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: end center;
  background: rgba(20, 40, 80, 0.35); backdrop-filter: blur(3px);
  animation: fade 0.2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.picker-panel {
  width: 100%; max-width: var(--maxw); background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--shadow-lg);
  padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
  animation: rise 0.28s ease both;
}
.picker-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.picker-map { width: 100%; height: 46vh; min-height: 260px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line-2); }
.picker-status { margin: 10px 0; font-size: 13px; font-weight: 600; padding: 9px 12px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--muted); }
.picker-status.ok { background: #edfaf5; color: #0d7a5b; }
.picker-status.err { background: var(--alert-050); color: #c33; }
.picker-actions { display: flex; gap: 9px; }
.picker-actions .btn { flex: 1; }

/* --- Cara animada de EVA (pupilas + parpadeo) ---------------------------- */
.eva-face {
  position: relative; display: inline-block; vertical-align: middle; flex: none;
  border-radius: 50% / 46%;
  background: linear-gradient(160deg, #ffffff, #e8f2ff 70%);
  box-shadow: inset 0 2px 4px #fff, inset 0 -3px 8px #cfe0f6, var(--shadow-sm);
}
.eva-face--brand { width: 34px; height: 40px; }
.eva-face--msg { width: 30px; height: 34px; margin-top: 2px; }
.eva-face--gate { width: 96px; height: 116px; box-shadow: inset 0 4px 8px #fff, inset 0 -8px 18px #cfe0f6, var(--shadow-lg); animation: float 3.4s ease-in-out infinite; }
.eva-face--xl { width: 122px; height: 148px; box-shadow: inset 0 4px 8px #fff, inset 0 -8px 18px #cfe0f6, var(--shadow-lg); animation: float 3.4s ease-in-out infinite; }
.eva-eye { position: absolute; top: 33%; width: 32%; height: 27%; }
.eva-eye--l { left: 16%; transform: rotate(9deg); }
.eva-eye--r { right: 16%; transform: rotate(-9deg); }
.eva-eyeball {
  position: absolute; inset: 0; border-radius: var(--r-pill); overflow: hidden; transform-origin: center;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  box-shadow: 0 0 8px rgba(52, 195, 242, 0.5);
  animation: evaBlink 4.6s infinite;
}
.eva-pupil { position: absolute; top: 20%; left: 32%; width: 34%; height: 52%; border-radius: 50%; background: rgba(255, 255, 255, 0.92); animation: evaLook 6.4s infinite; }
@keyframes evaBlink { 0%, 91%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }
@keyframes evaLook { 0%, 16% { transform: translate(0, 0); } 26%, 44% { transform: translate(42%, -8%); } 54%, 72% { transform: translate(-38%, 8%); } 82%, 100% { transform: translate(0, 0); } }
@media (prefers-reduced-motion: reduce) { .eva-eyeball, .eva-pupil, .eva-face--gate, .eva-face--xl { animation: none; } }

/* --- Camara -------------------------------------------------------------- */
.cam { position: fixed; inset: 0; z-index: 80; background: #0b1020; display: flex; flex-direction: column; }
.cam-stage { flex: 1; display: grid; place-items: center; overflow: hidden; }
.cam-stage video { width: 100%; height: 100%; object-fit: cover; }
.cam-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px calc(16px + env(safe-area-inset-bottom)); background: #0b1020; }
.cam-shutter { width: 66px; height: 66px; border-radius: 50%; border: 4px solid #fff; background: rgba(255, 255, 255, 0.25); transition: transform 0.08s; }
.cam-shutter:active { transform: scale(0.93); }
.cam-bar .btn { min-width: 82px; }

/* --- Perfiles de voluntario / rescatistas -------------------------------- */
.perfil-foto { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; box-shadow: var(--shadow-sm); background: var(--surface-3); flex: none; }
.foto-lock { display: grid; place-items: center; color: var(--blue-soft); font-size: 22px; }
.habilidad { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: var(--r-pill); background: var(--blue-050); color: var(--blue-600); margin: 2px 4px 0 0; }
.rescate-banner {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  margin: 10px 14px 0; padding: 10px 13px; border-radius: var(--r-sm);
  background: #fdeef0; color: #c33; font-size: 12.5px; font-weight: 600; border: 1px solid #f6c9d0;
}
.chip-link { background: none; border: none; color: var(--blue); font-weight: 700; font-size: 12.5px; padding: 4px; }

/* --- Chats --------------------------------------------------------------- */
.nav-btn { position: relative; }
.nav-badge {
  position: absolute; top: 5px; left: 56%; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--r-pill); background: var(--alert); color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center;
}
.conv {
  display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px; box-shadow: var(--shadow-sm); cursor: pointer;
}
.conv:active { transform: scale(0.995); }
.conv-ava { width: 44px; height: 44px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-size: 20px; flex: none; }
.conv-body { flex: 1; min-width: 0; }
.conv-title { font-size: 15px; font-weight: 700; margin: 0; display: flex; gap: 7px; align-items: center; }
.conv-last { font-size: 13px; color: var(--muted); margin: 3px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.conv-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--alert); }

.chat-overlay { position: fixed; inset: 0; z-index: 75; background: rgba(20, 40, 80, 0.35); backdrop-filter: blur(3px); display: grid; place-items: end center; animation: fade 0.2s ease; }
.chatwin { width: 100%; max-width: var(--maxw); height: 100dvh; background: var(--bg); display: flex; flex-direction: column; }
.chatwin-head { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.72)); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.chatwin-head .icon-btn { font-size: 24px; line-height: 1; }
.chatwin-title { display: flex; flex-direction: column; line-height: 1.15; }
.chatwin-body { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.chatwin-composer { border-top: 1px solid var(--line); }
.msg-time { font-size: 10px; color: var(--muted); margin-top: 2px; padding: 0 4px; }
.msg--user .msg-time { text-align: right; }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 5px; vertical-align: middle; }

@media (min-width: 641px) {
  #app { box-shadow: var(--shadow-lg); border-radius: 0; }
  body { padding: 0; }
}
