/* Alethea v2 — liquid glass demo matching client mockups */
:root {
  --bg: #e9e9ea;
  --ink: #2a2a2c;
  --ink-soft: #8a8a8e;
  --ink-faint: #b0b0b4;
  --red: #e31c23;
  --beige: #c4a484;
  --blue: #3b82f6;
  --glass: rgba(255, 255, 255, 0.42);
  --glass-strong: rgba(255, 255, 255, 0.72);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
  --radius-pill: 999px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", system-ui, "Helvetica Neue", Arial, sans-serif;
  --font-serif: var(--font); /* single app-wide family */
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100%;
}
body { min-height: 100dvh; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }
img { display: block; max-width: 100%; }

.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
  background: var(--bg);
}

/* ---------- Liquid glass ---------- */
.glass {
  background: var(--glass);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    inset 0 -1px 0 rgba(255, 255, 255, 0.15),
    0 8px 32px rgba(0, 0, 0, 0.08);
}
html.is-ios .glass-liquid {
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.55) 0%,
    rgba(255, 255, 255, 0.22) 40%,
    rgba(255, 255, 255, 0.35) 100%
  );
  backdrop-filter: blur(40px) saturate(180%) brightness(1.05);
  -webkit-backdrop-filter: blur(40px) saturate(180%) brightness(1.05);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.85),
    inset -1px -1px 0 rgba(255, 255, 255, 0.2),
    0 20px 60px rgba(0, 0, 0, 0.12);
}
html.is-android .glass-liquid {
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
}

/* ---------- HOME ---------- */
.page-home {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  padding: calc(12px + var(--safe-t)) 16px calc(18px + var(--safe-b));
  overflow: hidden; /* clip soft bleed of droplet */
}

/* ---------- Category panel overlay ---------- */
.panel {
  width: min(100%, 380px);
  max-height: min(86dvh, 720px);
  border-radius: 36px;
  padding: 1.35rem 1.4rem 1.1rem;
  display: flex;
  flex-direction: column;
  transform: translateY(18px) scale(0.98);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}

/* city picker sheet */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,0.28);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 50%; bottom: 0; z-index: 51;
  width: min(100%, 430px);
  transform: translate(-50%, 110%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  border-radius: 28px 28px 0 0;
  padding: 1rem 1.1rem calc(1.2rem + var(--safe-b));
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.sheet-backdrop.open + .sheet,
.sheet.open { transform: translate(-50%, 0); }
.sheet h3 {
  margin: 0.2rem 0 0.8rem;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  color: var(--ink-soft);
}   /* v108.5: «Alethea» en textos; AletheA solo en el logo */

/* v108.7: Destacado = solo orden; sin etiqueta visual ni pin más grande en masonry */

/* action sheet on profile */
.action-sheet-wrap {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
  pointer-events: none;
}
.action-sheet-wrap.open { pointer-events: auto; }
.action-dim {
  position: absolute; inset: 0;
  background: rgba(40,40,45,0.25);
  opacity: 0; transition: opacity 0.28s ease;
}
.action-sheet-wrap.open .action-dim { opacity: 1; }
.action-sheet {
  position: relative;
  width: min(100%, 430px);
  border-radius: 40px 40px 28px 28px;
  padding: 1.6rem 1.2rem calc(1.3rem + var(--safe-b));
  margin: 0 8px 8px;
  transform: translateY(110%);
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}
.action-sheet-wrap.open .action-sheet { transform: none; }
html.is-ios .action-sheet {
  /* subtle concave top via mask-ish border */
  border-top-left-radius: 44px;
  border-top-right-radius: 44px;
}

.toast {
  position: fixed;
  left: 50%; bottom: calc(100px + var(--safe-b));
  transform: translateX(-50%) translateY(20px);
  background: rgba(20,20,22,0.88);
  color: #fff;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 80;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* keep old card styles for whatsapp sim if needed */
.card {
  background: #fff; border-radius: 16px; padding: 14px;
  margin-bottom: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}
.avatar { width: 64px; height: 76px; border-radius: 14px; object-fit: cover; }
.btn { display: inline-flex; align-items: center; justify-content: center;
  padding: 0.55rem 0.9rem; border-radius: 12px; font-weight: 600; font-size: 0.85rem; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.bio { font-size: 0.85rem; color: var(--ink-soft); margin: 6px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chips button, .chips a {
  padding: 0.4rem 0.75rem; border-radius: 999px;
  background: #fff; font-size: 0.8rem; border: 1px solid rgba(0,0,0,0.06);
}
.hero h1 { font-size: 1.5rem; margin: 0 0 0.4rem; }
.hero p { color: var(--ink-soft); margin: 0 0 1rem; }
.tag { font-size: 0.7rem; padding: 0.15rem 0.45rem; border-radius: 6px; background: #f0f0f2; margin-right: 4px; }
.tag.verificado { background: #ffe5e6; color: var(--red); }
.empty { text-align: center; padding: 2rem 1rem; color: var(--ink-soft); }

@media (min-width: 500px) {
  .app, .sheet, .action-sheet {
    /* already max-width constrained */
  }
}

/* ===== Legacy: medicos.html + whatsapp.html ===== */
:root {
  --muted: #5a6b7c;
  --primary: #e31c23;
  --featured: #7c3aed;
  --featured-soft: #ede9fe;
  --ink-legacy: #1a1a1c;
}
.plans { display: flex; flex-direction: column; gap: 12px; }
.plan {
  background: #fff; border-radius: 16px; padding: 16px;
  border: 1px solid rgba(0,0,0,0.06);
}
.plan.popular { border-color: var(--featured); box-shadow: 0 8px 28px rgba(124,58,237,.15); }
.plan h3 { margin: 0 0 4px; }
.plan .price { font-size: 1.6rem; font-weight: 800; }
.plan .price span { font-size: 0.9rem; font-weight: 500; color: var(--muted); }
.plan ul { margin: 12px 0; padding-left: 18px; color: var(--muted); font-size: 0.92rem; }
.stat { background: #f6f6f8; border-radius: 12px; padding: 12px; text-align: center; }
.stat .n { font-size: 1.4rem; font-weight: 800; }
.stat .l { font-size: 0.78rem; color: var(--muted); }
.tag.destacado { background: var(--featured-soft); color: var(--featured); }

/* ===== Home v2 (2026-09-24): full-screen glass-drop background + 361x83 capsule ===== */
.page-home {
  background-color: #e9e9ea;
  background-image: url("/img/brand/home-bg.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* ===== Home no-scroll lock (home only; html.home-lock set in index.html) ===== */
html.home-lock,
html.home-lock body {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
}
html.home-lock .page-home {
  height: 100vh;            /* fallback */
  height: 100dvh;           /* Android dynamic toolbar-safe */
  height: var(--app-h, 100dvh);   /* v53: measured visible height (js/platform.js), re-measured on pageshow/resize */
  min-height: 0;
  max-height: 100dvh;
  max-height: var(--app-h, 100dvh);
  overflow: hidden;
  overscroll-behavior: none;
}

/* ===== v12: app-wide system font + new pet icon ===== */
input, textarea, select, button { font-family: inherit; }

/* ===== v23: WELLNESS panel layout (health & pets unchanged) ===== */
.panel[data-cat="wellness"] {
  border-radius: 50px;
  height: min(600px, 76dvh);
  padding: 2rem 1.4rem 1.25rem;
}

/* v24: wellness panel height fits its content (no empty space at bottom) */
.panel[data-cat="wellness"] { height: auto !important; max-height: 76dvh; }

/* ===== v25: PETS panel layout (health & wellness unchanged) ===== */
.panel[data-cat="pets"] {
  position: relative;
  border-radius: 50px;
  height: min(480px, 76dvh);
  padding: 2rem 1.4rem 1.2rem;
  overflow: hidden;
}

/* ===== v27: bottom row — Club (left) + AletheA Voice (right) ===== */
@keyframes aw-idle { 0%, 100% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } }

/* ===== v27: voice assistant overlay ===== */
.voice-sheet {
  position: relative;
  width: min(100%, 380px);
  border-radius: 44px;
  padding: 22px 22px 18px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  transform-origin: 50% 100%;
}
@keyframes vo-pulse { 0% { transform: scale(0.8); opacity: 0.9; } 100% { transform: scale(1.5); opacity: 0; } }  /* removed small photo/icon */

/* ===== v34: SENESCYT uses the same bottom sheet component as the "+" contact sheet
   (.action-sheet-wrap / .action-dim / .action-sheet.glass.glass-liquid). Only content styles below,
   using the "+" sheet's row style (.share-pill: white pill, 1.02rem/600) and typography scale. ===== */
.action-sheet-wrap .action-sheet { touch-action: none; }
/* glass highlight + fine rim on top of the colours */
@keyframes so-spin { to { transform: rotate(360deg); } }
@keyframes so-breathe { 0%, 100% { transform: scale(0.94); } 50% { transform: scale(1.04); } }
@keyframes so-orbit-a {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.16); }
  100% { transform: rotate(360deg) scale(1); }
}
@keyframes so-orbit-b {
  0%   { transform: rotate(0deg) scale(1.12); }
  50%  { transform: rotate(-180deg) scale(0.94); }
  100% { transform: rotate(-360deg) scale(1.12); }
}

/* ===== v44: voice — liquid morph pill ⇄ sheet + ChatGPT-voice-style sphere ===== */
.voice-sheet { z-index: 2; }
/* CSS fallback (no WebGL): rotating soft gradients + grain */
@keyframes gpt-swirl { to { transform: rotate(360deg); } }

/* ===== v47: ANDROID ONLY (html.is-android) — bottom breathing room + no stray page scroll.
   iOS is untouched: every rule below is scoped to html.is-android. ===== */
html.is-android {
  /* Chrome/Android (non edge-to-edge PWA) reports safe-area-inset-bottom = 0: the viewport already ends
     right on the gesture bar, so bottom rows looked glued to it. Floor the bottom inset at 14px; every
     bar/sheet that uses var(--safe-b) (home row, profile row, bottom-bar, voice sheet, "+"/SENESCYT
     sheets, location sheet, WhatsApp composer) gets the extra air, and the profile photo --pw reserve
     accounts for it automatically. If Chrome draws edge-to-edge and reports a real inset, that wins. */
  --safe-b: max(14px, env(safe-area-inset-bottom, 0px));
  overscroll-behavior: none;                 /* no glow/bounce/pull-to-refresh on the document */
}
html.is-android body { overscroll-behavior: none; }

/* Pages that must never scroll as a document: home (already home-lock), profile, WhatsApp chat.
   Lock html/body and size the page box to the *dynamic* viewport (100vh fallback → 100dvh), so a
   fractional viewport (DPR 3.5 → 891.43 css px) or a large-viewport 100vh can't leave a 1px scroll. */
html.is-android:has(body[data-page="profile"]),
html.is-android:has(body[data-page="whatsapp"]),
html.is-android:has(body[data-page="specialty"]),
html.is-android:has(body[data-page="club"]),
html.is-android:has(body[data-page="medicos"]),
html.is-android:has(body[data-page="profile"]) body,
html.is-android:has(body[data-page="whatsapp"]) body,
html.is-android:has(body[data-page="specialty"]) body,
html.is-android:has(body[data-page="club"]) body,
html.is-android:has(body[data-page="medicos"]) body {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

/* Floating sheets: a little more gap to the gesture bar than the iOS 8px */
html.is-android .action-sheet { margin-bottom: 12px; }

/* ===== v51: ANDROID bottom rows (Samsung S25 Ultra: profile row glued to / cut by the gesture bar).
   Chrome/PWA on Android usually reports safe-area-inset-bottom = 0 even when the page ends right on (or,
   edge-to-edge, under) the gesture handle. Real floor of 24px, or the reported inset + 12px when there is one.
   Every bottom row reads var(--safe-b): home row, profile row (← · AletheA verificated · +), results
   bottom-bar, voice sheet, "+"/SENESCYT sheets. iOS untouched (scoped to html.is-android). ===== */
html.is-android {
  --safe-b: max(24px, calc(env(safe-area-inset-bottom, 0px) + 12px));
}

/* ===== v51: AletheA Voice dock (grid + profile, js/voice-dock.js) — only during a voice session ===== */
@keyframes vdockIn { from { opacity: 0; transform: translateX(-50%) translateY(10px) scale(0.97); } }
@keyframes vdockInTop { from { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(0.97); } }

/* ===== v54: AletheA Voice EN VIVO (js/voice-live.js) — escenario (iframe) + cápsula con temporizador ===== */
html.vlive-staged, html.vlive-staged body { overflow: hidden; }   /* borde derecho alineado con la píldora */
/* b) blindaje: nada puede asomar por el borde derecho de la cuadrícula */
html:has(body[data-page="specialty"]), body[data-page="specialty"] { overflow-x: clip; }   /* 8px bajo el botón, borde derecho alineado con él */

/* ===== v77: AletheA Voice — orbe de humo (maqueta aprobada /workspace/mock-orb; js/smoke-orb.js) =====
   Reemplaza a la esfera naranja/violeta (.gpt-orb, v44) SOLO en la hoja de voz; el dock y la barra de la voz en vivo
   siguen con js/voice-orb.js. La hoja es más alta (como en la maqueta: 54px bajo el borde superior) para que el orbe
   quede centrado; si no cabe (pantallas bajas), la hoja se desplaza con el scroll nativo (iOS: momentum + contain).
   El rojo del sello (#FD3B3B) solo va en el hilo del humo (shader) y en la mancha b5 del respaldo CSS. */
.voice-sheet {
  --orb: min(300px, 78vw, 42vh);
  height: calc(100vh - 68px - var(--safe-t) - var(--safe-b));
  height: calc(var(--app-h, 100dvh) - 68px - var(--safe-t) - var(--safe-b));
  max-height: calc(var(--app-h, 100dvh) - 68px - var(--safe-t) - var(--safe-b));
  overflow-x: hidden; overflow-y: auto;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  scrollbar-width: none;
}
@supports (height: 1dvh) { .voice-sheet { --orb: min(300px, 78vw, calc(var(--app-h, 100dvh) * 0.42)); } }
.voice-sheet::-webkit-scrollbar { display: none; }
.voice-sheet > * { flex-shrink: 0; }
/* botón central (vidrio esmerilado + aro azul suave); anula el tamaño de la .voice-orb antigua */
@keyframes smoke-ring { 0% { box-shadow: 0 0 0 1.5px rgba(122,165,230,0.6), 0 0 0 0 rgba(122,165,230,0.35), inset 0 1px 0 rgba(255,255,255,0.6), 0 6px 18px rgba(40,60,90,0.18); }
  100% { box-shadow: 0 0 0 1.5px rgba(122,165,230,0.6), 0 0 0 16px rgba(122,165,230,0), inset 0 1px 0 rgba(255,255,255,0.6), 0 6px 18px rgba(40,60,90,0.18); } }   /* hilo del sello */
@keyframes smoke-drift { 0% { transform: translate(0,0) rotate(0deg) scale(calc(1 + var(--lv,0)*.25)); }
  50% { transform: translate(8%, -6%) rotate(40deg) scale(calc(1.08 + var(--lv,0)*.3)); }
  100% { transform: translate(-6%, 7%) rotate(-30deg) scale(calc(0.96 + var(--lv,0)*.25)); } }
/* textos como en la maqueta (mismos textos; solo el ancho para que no queden en una línea larga) */
@media (max-height: 700px) { .voice-sheet { height: calc(var(--app-h, 100dvh) - 38px - var(--safe-t) - var(--safe-b)); max-height: calc(var(--app-h, 100dvh) - 38px - var(--safe-t) - var(--safe-b)); } }

/* ===== v85: AletheA Pet (maqueta /workspace/mock-pets) — Emergencias 24/7 (punto verde) · Veterinarias · SERVICIOS ===== */
.panel[data-cat="pets"] { height: auto !important; max-height: 82dvh; display: flex; flex-direction: column; }   /* v93: más rápido, que no asome bajo la apertura */
html.vc-on .h8-cats { pointer-events: none; }
.h8-cats { transition: opacity 0.25s ease; }
html.vc-on .h8-cats { opacity: 0.45; }   /* v108.4 (Senior UI): la pastilla «ubicación» igual que las burbujas */   /* el ojo se encoge hacia abajo al parpadear */
@keyframes vc-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }   /* v108.3 (Pancho): WhatsApp blanco de línea fina sobre el gris oscuro */
/* v108.4 (Senior UI): el estado vuelve a gris oscuro (#3a3a3c, como el contador) para que se lea sobre el fondo claro (en v108.3 iba en blanco) */   /* últimos VOICE_LIVE_WARN_SEC (20 s) */
@keyframes vc-dot { 50% { opacity: 0.45; } }

/* ===================================================================================================================
   v94 — diseño final de Pancho para el inicio (referencia mock-home-thea, 434×930). Fondo: difuso pastel gris/celeste/durazno
   a pantalla completa (cover) en lugar de la gota de vidrio. Medidas tomadas de la referencia (en 434×930):
   píldora Club 12,27 · 99×24 | ubicación 104×36 | barra 372×85 (fichas 70×70) | WhatsApp 48 + 8 + cápsula de voz 124×48,
   con 38px entre ubicación y barra, 25px entre barra y cápsulas y ≈7.6% del alto bajo las cápsulas (71px en 930).
   El botón de menú (4 puntos) se queda: es el único acceso al menú «¿Eres médico? Únete» / «Mi perfil».
   ================================================================================================================ */
.page-home {
  background-color: #e4e6e5;
  background-image: url("/img/brand/home-bg94.jpg");
  background-image: image-set(url("/img/brand/home-bg94.webp") type("image/webp"), url("/img/brand/home-bg94.jpg") type("image/jpeg"));
}
/* aire bajo las cápsulas: 7.63% del alto (71px en 930, como la referencia), nunca menos que el piso de la barra de gestos + 18px */
html.home-lock body .app.page-home { padding-bottom: max(calc(18px + var(--safe-b)), calc(var(--app-h, 100dvh) * 0.0763)); }
/* brillo muy sutil que respira sobre la aurora (solo transform/opacity → compositor, 60 fps) */
@keyframes vp-aurora-drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(-2.5px, 0.6px, 0) scale(1.045); }
}
@keyframes vp-sheen {
  0%   { transform: translate3d(6px, 2px, 0) scale(0.92); opacity: 0.25; }
  100% { transform: translate3d(-10px, -2px, 0) scale(1.06); opacity: 0.7; }
}   /* Safari: recorta también el lienzo WebGL */
@keyframes vp-fb {
  0%   { transform: translate3d(-12%, 4%, 0) scale(.9); }
  100% { transform: translate3d(14%, -6%, 0) scale(1.12); }
}
/* Al pausar, oculta la Thea del home (paciente) si no entra en h8-tray rules */
html.vc-on #voicePill { visibility: hidden; }
