/* LA SUPERFICIE CHAT-FIRST (O1a) + LA PORTADA (T5) + el addendum 12:20 del 08/10.
 *
 * QUÉ CAMBIÓ Y POR QUÉ: la referencia de Naza (t5-ui-ref.png, el "new bot" de Grok) es un chat de fondo
 * BLANCO, a pantalla completa, en una columna centrada de ~640px, con burbujas grises redondeadas, la
 * tarjeta de opciones como panel gris con título y X, las opciones rotuladas A/B/C con título y
 * subtítulo gris, y el campo de respuesta abajo. Este archivo es esa forma, para la portada y para el
 * `/app` chat-first (las dos superficies son el MISMO chat a propósito: una sola implementación).
 *
 * LO QUE NO SE TOCA DESDE ACÁ: el panel de siempre (`public/app.html`) no carga este archivo, sigue con
 * `style.css` y su tema oscuro. Acá solo viven el `.o1-shell` y lo que está adentro.
 *
 * Tres cosas que la referencia no muestra y son del brief, no del gusto: el pie mínimo con
 * `/privacidad` y `/terminos` (los piden Google OAuth, MP y Paddle), el aviso del pie del hilo, y el
 * compositor —que NO existe con el gate cerrado—.
 */

/* Geist self-hosted, igual que la tienda: nada de CDN. */
@font-face {
  font-family: Geist;
  src: url(/static/fonts/geist-latin.woff2) format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Geist;
  src: url(/static/fonts/geist-latin-ext.woff2) format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF,
    U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

html {
  -webkit-text-size-adjust: 100%;
  --vv-h: 100dvh;
  --vv-top: 0px;
  --vv-bottom-inset: 0px;
  --kb-closed: 1;
  --alto-compositor: 68px;
}

.o1-body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Geist, ui-sans-serif, -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* clip (no hidden): hidden en un eje convierte al otro en auto y recorta el halo del anillo. */
  overflow-x: clip;
  min-height: 100vh;
  min-height: 100dvh;
}

/* La columna: a pantalla completa en el teléfono, centrada a 640px en el escritorio.
 * `height: 100dvh` (y no sólo `min-height`) para que la conversación sea la que scrollea y el
 * compositor quede pegado abajo: con `min-height` el panel no repartía el alto y la tarjeta se cortaba
 * contra un scroll interno propio. */
.o1-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 16px calc(14px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  overflow-x: clip;
}

/* La píldora de arriba, centrada: el ícono de Astro y el nombre. */
.o1-topbar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 0 6px; /* Naza 09/10 13:46: la mascota un poco más arriba */
  position: sticky;
  top: 0;
  z-index: 2;
  overflow: visible;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 92%, transparent) 0, color-mix(in srgb, var(--bg) 92%, transparent) 55%, transparent 100%);
}

.o1-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px 4px 5px;
  border-radius: 999px;
  background: var(--bg-sunken);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.o1-pill-logo {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: block;
}

.o1-panel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
}

/* El hilo de la portada es el que scrollea TODA la superficie: `max-height: none` es la corrección de
 * un choque real de especificidad. `public/style.css` trae `.chat-thread { max-height: 340px }` (el
 * panel de siempre) y el `chat-thread` del marcado de la portada también trae esa clase; con la regla
 * vieja —`.o1-shell .chat-thread { max-height: 46vh }`— el hilo quedaba recortado a 46vh y la tarjeta se
 * cortaba abajo ("Escribí tu respuesta" fuera de la caja, con scroll propio del hilo). Ahora el tope
 * vive sólo del lado del chat desbloqueado (`.o1-shell .chat .chat-thread`, más abajo) y este hilo, que
 * es de una sola columna, no tiene tope. */
.o1-thread {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 0 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

/* Los mensajes del sistema (el "hoy" de la referencia) no son contenido: son un separador. */
.o1-sep {
  margin: 8px 0 12px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.o1-thread .bubble {
  max-width: min(88%, 460px);
  margin: 6px 0; /* Naza 09/10 12:38: un poquito menos (antes 8) */
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14.5px;
  line-height: 1.45;
}

.o1-thread .bubble.astro {
  margin-right: auto;
  background: var(--bg-bubble);
  border: 0;
  color: var(--ink);
  border-bottom-left-radius: 6px;
}

.o1-thread .bubble.owner {
  margin-left: auto;
  background: var(--bg-own);
  color: var(--ink-on-own);
  border-bottom-right-radius: 6px;
}
.o1-thread .bubble.owner.is-pending { opacity: 0.62; }

.o1-thread .bubble-media {
  display: block;
  width: min(100%, 240px);
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: 12px;
  margin-top: 8px;
  background: var(--bg-bubble);
}

/* PDF y otros archivos del globo: la misma ficha chica que un adjunto (ícono, nombre, sin hash). */
.o1-thread .bubble-archivo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  max-width: 220px;
  min-width: 44px;
  min-height: 44px;
  margin-top: 8px;
  padding: 8px 12px;
  border: 0;
  border-radius: 12px;
  background: var(--bg-sunken);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}
.o1-thread .bubble-archivo:first-child { margin-top: 0; }
.o1-thread .bubble-archivo-icono {
  flex: none;
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M3.5 1.5h6.2L13.5 5.3V13.5a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1v-11a1 1 0 0 1 1-1z'/%3E%3C/svg%3E") center / 16px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M3.5 1.5h6.2L13.5 5.3V13.5a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1v-11a1 1 0 0 1 1-1z'/%3E%3C/svg%3E") center / 16px no-repeat;
}
.o1-thread .bubble-archivo-nombre {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (hover: hover) {
  .o1-thread .bubble-archivo:hover { opacity: 0.88; filter: none; }
}
.o1-thread .bubble-archivo-audio {
  cursor: default;
}
.o1-thread .bubble-adjuntos .bubble-archivo-audio { margin-top: 0; }
.o1-thread .bubble-audio-icono {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M1 6.2h2.1V9.8H1zM4.3 3.6h2.1v8.8H4.3zM7.6 1.8h2.1v12.4H7.6zM10.9 4.4h2.1v7.2h-2.1z'/%3E%3C/svg%3E") center / 16px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M1 6.2h2.1V9.8H1zM4.3 3.6h2.1v8.8H4.3zM7.6 1.8h2.1v12.4H7.6zM10.9 4.4h2.1v7.2h-2.1z'/%3E%3C/svg%3E") center / 16px no-repeat;
}

/* La burbuja del dueño (Naza 08/10 14:02): lo que eligió, a la derecha y del ancho de su texto.
 * Naza 08/10 17:46: las del Astro también van del ancho de su texto (el tope sigue siendo max-width). */
.o1-thread .bubble.owner,
.o1-thread .bubble.astro { width: fit-content; }

.o1-thread .bubble.owner .bubble-adjuntos {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-top: 8px;
}
.o1-thread .bubble.owner .bubble-adjuntos:first-child { margin-top: 0; }
.o1-thread .bubble.owner:has(.bubble-adjuntos) {
  padding: 8px 12px;
  border-radius: 16px;
  border-bottom-right-radius: 6px;
}
.o1-thread .bubble.owner .bubble-adjunto-foto {
  display: block;
  width: 100%;
  max-width: 220px;
  min-height: 44px;
  border-radius: 12px;
  overflow: hidden;
  line-height: 0;
  text-decoration: none;
  color: inherit;
}
.o1-thread .bubble.owner .bubble-adjunto-img {
  display: block;
  width: 100%;
  max-width: 220px;
  aspect-ratio: 4 / 3;
  height: auto;
  object-fit: cover;
  object-position: center;
  border-radius: 12px;
  background: var(--bg-sunken);
}
.o1-thread .bubble.owner .bubble-adjunto-foto .bubble-adjunto-img { max-width: none; }
.o1-thread .bubble.owner:has(.bubble-adjunto-img) { min-width: 160px; }
.o1-thread .bubble.owner .bubble-adjunto {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  max-width: 220px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--ink-on-own) 16%, transparent);
  color: var(--ink-on-own);
  border-radius: 12px;
  font-size: 13px;
  text-decoration: none;
}
.o1-thread .bubble.owner .bubble-adjunto-icono {
  flex: none;
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M3.5 1.5h6.2L13.5 5.3V13.5a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1v-11a1 1 0 0 1 1-1z'/%3E%3C/svg%3E") center / 16px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M3.5 1.5h6.2L13.5 5.3V13.5a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1v-11a1 1 0 0 1 1-1z'/%3E%3C/svg%3E") center / 16px no-repeat;
}
.o1-thread .bubble.owner .bubble-adjunto-nombre {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (hover: hover) {
  .o1-thread .bubble.owner a.bubble-adjunto-foto:hover,
  .o1-thread .bubble.owner a.bubble-adjunto:hover { opacity: 0.88; }
}

/* Naza 09/10 11:24: mensajes SEGUIDOS del mismo lado, pegaditos (como un chat), no 16px de aire. */
/* Naza 09/10 12:16: entre mensajes SEGUIDOS del bot (burbuja o tarjeta, abierta o plegada) el
 * espacio es SIEMPRE el mismo: 6 px, un poco más que antes y sin el salto grande antes de la tarjeta. */
.o1-thread :is(.bubble.astro, .o1-tarjeta):has(+ :is(.bubble.astro, .o1-tarjeta)),
.o1-thread .bubble.owner:has(+ .bubble.owner) { margin-bottom: 0; }
.o1-thread :is(.bubble.astro, .o1-tarjeta) + :is(.bubble.astro, .o1-tarjeta),
.o1-thread .bubble.owner + .bubble.owner { margin-top: 5px; }

/* --- LA TARJETA (la forma de la referencia) --------------------------------- */

.o1-tarjeta {
  margin: 8px 0 0;
  padding: 16px;
  background: var(--bg-sunken);
  border: 0;
  border-radius: 16px;
}

.o1-tarjeta-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 0 8px;
}

.o1-tarjeta-titulo {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.o1-tarjeta-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* La tarjeta YA CONTESTADA queda en el hilo plegada: sólo su título (sin opciones ni X). */
/* Naza 08/10 17:46: plegada, va del ancho de su título, del lado del Astro (no la columna entera). */
.o1-tarjeta.is-respondida {
  padding: 8px 12px;
  width: fit-content;
  max-width: min(88%, 460px);
  margin-right: auto;
}
.o1-tarjeta.is-respondida .o1-tarjeta-head { padding: 0; }
/* --muted sobre --bg-sunken es 4.40:1. El gris de la tarjeta usa --ink-2 (≥9:1). */
.o1-tarjeta.is-respondida .o1-tarjeta-titulo { color: var(--ink-2); font-weight: 500; }
.o1-tarjeta .muted { color: var(--ink-2); }

.o1-nota {
  margin: 0;
  font-size: 13px;
  color: var(--ink-2);
}
/* Naza 09/10: el error de la tarjeta (contraseña corta, campo vacío, código que no es) en rojo suave. */
.o1-nota.is-error { color: var(--danger); }
.o1-campo input[aria-invalid="true"] { border-color: var(--danger); }

/* La línea gris de abajo del campo (el código en staging): más chica y discreta que la nota. */
.o1-pista {
  margin: 0;
  font-size: 12px;
  color: var(--ink-2);
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 0;
}

.choice {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center; /* Naza 09/10 13:00: letra y texto centrados en la opción */
  gap: 12px;
  width: 100%;
  /* 52px: el dedo también tiene que poder. */
  min-height: 52px;
  margin: 0;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  color: var(--ink);
  text-align: left;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
}

@media (hover: hover) {
  .choice:hover { background: var(--bg-hover); border-color: var(--hairline-strong); }
}
.choice:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.choice:disabled { color: var(--muted); opacity: 0.7; }
.choice.is-recommended { border-color: var(--ink); }
.choice.otra, .choice.undo { color: var(--muted); }
.choice.undo { border-style: dashed; }

.choice-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--letter-bg);
  color: var(--letter-ink);
  font-size: 12px;
  font-weight: 700;
}

.choice-texts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.choice-label { font-weight: 600; font-size: 14px; }
.choice-note { color: var(--ink-2); font-size: 13px; font-weight: 400; line-height: 1.35; }

/**
 * EL CAMPO "Escribí tu respuesta" (addendum, punto 1) — y el punto 2 con todas las letras: con el gate
 * cerrado esto NO es una caja de texto, es un `<button>` que dice la verdad al tocarlo. Se ve igual que
 * la referencia; lo que no puede es recibir texto. El `<input>` de verdad es el compositor.
 */
.o1-respuesta {
  appearance: none;
  display: block;
  width: 100%;
  margin-top: 2px;
  /* El borde de 1px entra en el hueco: el texto queda a --comp-pad-x del canto, igual que el input. */
  padding: 11px 13px 11px calc(var(--comp-pad-x, 16px) - 1px);
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  color: var(--muted);
  font-family: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}

@media (hover: hover) {
  .o1-respuesta:hover { color: var(--muted); }
}
.o1-respuesta[aria-disabled="true"] { color: var(--muted); }

.o1-campo { display: block; margin: 0; }
/* --muted (#71717a) sobre el fondo de la tarjeta (--bg-sunken) da 4.40:1. */
.o1-campo-label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--ink-2); }

.o1-campo input {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: 12px 16px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px; /* Naza 09/10: <16 px hace que Safari iOS haga zoom al tocar el campo */
  line-height: 1.2;
}

.o1-codigo {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 0;
  cursor: text;
}

.o1-celda {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  font-size: 22px;
  font-weight: 600;
  border: 1px solid var(--hairline-strong);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--ink);
  transition: border-color 0.12s ease;
}

.o1-codigo:focus-within .o1-celda:not(.llena) { border-color: var(--hairline-strong); }
.o1-celda.llena { border-color: var(--ink); }
.o1-codigo:focus-within .o1-celda.actual:not(.llena) { border-color: var(--ink); }

.o1-codigo-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  background: transparent;
  font-size: 16px;
  color: transparent;
  caret-color: transparent;
}

.o1-enlace {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  min-height: 44px;
  max-width: 100%;
  margin: 0;
  padding: 8px 0;
  font-size: 14px;
  line-height: 1.35;
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* --- el pago simulado (sólo staging, sólo con el flag prendido) -------------- */

.o1-staging {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 16px 0 0;
  padding: 10px 12px;
  background: var(--bg-elev);
  border: 1px dashed var(--hairline-strong);
  border-radius: 14px;
}

.o1-staging-tag {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.o1-staging-btn {
  appearance: none;
  border: 1px solid var(--hairline-strong);
  background: var(--bg-card);
  border-radius: 10px;
  padding: 7px 10px;
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}

@media (hover: hover) {
  .o1-staging-btn:hover { background: var(--bg-sunken); }
}

.o1-thread[data-modo="unlocked"] {
  display: flex;
  flex-direction: column;
}

/* --- el compositor: SOLO con el pago verificado ------------------------------ */

.o1-shell .chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
  flex: 1 1 auto;
  min-height: 0;
}

.o1-shell .chat .chat-thread {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
}

.o1-shell .chat-composer {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  overflow: visible;
}

.o1-shell:has(.o1-thread[data-modo="unlocked"]) { padding-bottom: 0; }
.o1-shell:has(.o1-thread[data-modo="unlocked"]) .o1-aviso:empty { display: none; }
.o1-thread[data-modo="unlocked"] { padding-bottom: 0; }
.o1-thread[data-modo="unlocked"] .chat { display: contents; }
.o1-thread[data-modo="unlocked"] .chat .chat-thread {
  flex: 0 0 auto;
  overflow: visible;
  margin-top: 6px;
}
.o1-thread[data-modo="unlocked"] .chat .chat-thread:empty { display: none; }
.o1-thread[data-modo="unlocked"] #chat-state:empty,
.o1-thread[data-modo="unlocked"] #chat-state[hidden] { display: none; }
.o1-thread .bubble.chat-estado {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(88%, 460px);
  margin: 8px 0;
  padding: 8px 12px;
  white-space: nowrap;
}
.o1-thread .bubble.chat-estado.is-error {
  color: var(--danger);
  background: var(--bg-bubble);
}
.o1-thread .bubble.chat-estado .bubble-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.o1-thread .chat-reintentar {
  appearance: none;
  flex: none;
  margin: 0;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: color-mix(in srgb, var(--danger) 12%, var(--bg));
  color: var(--danger);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
}
.o1-thread .chat-reintentar:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
@media (hover: hover) {
  .o1-thread .chat-reintentar:hover {
    background: color-mix(in srgb, var(--danger) 18%, var(--bg));
  }
}
.o1-thread[data-modo="unlocked"] .chat-composer {
  z-index: 3;
  margin-top: 10px;
  padding: 0 0 calc(var(--comp-hueco, 8px) + env(safe-area-inset-bottom, 0px) * var(--kb-closed, 1));
  background: transparent;
}

/* Naza 09/10 12:09: al scrollear el input queda QUIETO abajo; sólo se mueve la conversación. En iOS
 * la página entera rebotaba/scrolleaba y el compositor (sticky dentro del hilo) subía con ella. Ahora:
 * la página no scrollea nunca (sólo el hilo), y el compositor va `fixed` al pie de la pantalla, con
 * el hilo dejándole lugar abajo para que el último mensaje no quede tapado. */
html:has(.o1-thread[data-modo="unlocked"]),
body.o1-body:has(.o1-thread[data-modo="unlocked"]) {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
.o1-thread[data-modo="unlocked"] {
  overscroll-behavior: contain;
  padding-top: calc(124px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--alto-compositor, 76px) + env(safe-area-inset-bottom, 0px) * var(--kb-closed, 1));
}
.o1-thread[data-modo="unlocked"] .chat-composer {
  position: fixed;
  left: 50%;
  bottom: var(--vv-bottom-inset, 0px);
  transform: translateX(-50%);
  --comp-hueco: max(8px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  width: 100%;
  max-width: 640px;
  margin: 0;
  padding-left: var(--comp-hueco);
  padding-right: var(--comp-hueco);
  column-gap: var(--comp-hueco);
  box-sizing: border-box;
}

/* Naza 08/10 18:12: el "+" va afuera, a la izquierda; la caja queda un poco más corta. */
.o1-shell .chat-adjuntar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--comp-plus);
  color: var(--comp-plus-ink);
  appearance: none;
  flex: none;
  cursor: pointer;
}
.o1-shell .chat-adjuntar svg { display: block; width: 20px; height: 20px; }
@media (hover: hover) {
  .o1-shell .chat-adjuntar:hover { background-color: var(--bg-hover); }
}
.o1-shell .chat-composer.is-arrastrando { outline: 1px dashed var(--muted); }

.o1-shell .chat-caja {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  position: relative;
  box-sizing: border-box;
  min-height: 44px;
  padding: 0 5px 0 15px;
  background: var(--comp-surface);
  border: 1px solid var(--comp-linea);
  border-radius: 22px;
  box-shadow: var(--comp-sombra);
  overflow: hidden;
}
.o1-shell .chat-composer #chat-text,
.o1-shell .chat-composer textarea,
.o1-shell .chat-composer input[type="text"] {
  flex: 1 1 0;
  min-width: 0;
  width: 0;
  max-width: 100%;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  background: none;
  background-color: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 16px; /* Naza 09/10 12:03: <16px hace que Safari iOS haga zoom al tocar el campo */
  line-height: 22px;
  padding: 11px 0;
  margin: 0;
  min-height: 44px;
  height: 44px;
  max-height: calc(22px * 6 + 22px);
  box-sizing: border-box;
  resize: none;
  overflow-x: hidden;
  overflow-y: hidden;
  outline: none;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}
.o1-shell .chat-composer #chat-text::placeholder,
.o1-shell .chat-composer textarea::placeholder {
  color: var(--comp-ph);
  opacity: 1;
  white-space: nowrap;
  text-overflow: clip;
  overflow: visible;
}
/* Naza 14:49: una sola línea, nunca wrap, nunca ellipsis. --comp-ph-min (22ch) es
 * «Escribile a tu agente». El mic es overlay: el padding reserva el ícono, no el
 * hit de 44, para que la pastilla no envuelva Enviar (flex-wrap). */
.o1-shell .chat-composer #chat-text:placeholder-shown,
.o1-shell .chat-composer textarea:placeholder-shown {
  white-space: nowrap;
  overflow-x: hidden;
  text-overflow: clip;
  overflow-wrap: normal;
  word-break: keep-all;
  padding-right: calc(var(--comp-d, 44px) - 4px);
}
/* Con texto el mic sigue adentro: el mismo hueco, para que lo escrito no lo tape. */
.o1-shell .chat-caja:has(#chat-mic:not([hidden])) #chat-text:not(:placeholder-shown),
.o1-shell .chat-caja:has(#chat-mic:not([hidden])) textarea:not(:placeholder-shown) {
  padding-right: calc(var(--comp-d, 44px) - 4px);
}

.o1-shell .chat-composer #chat-text:focus,
.o1-shell .chat-composer textarea:focus,
.o1-shell .chat-composer input:focus {
  outline: none;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  background: none;
  background-color: transparent;
}
.o1-shell .chat-mic:focus-visible,
.o1-shell .chat-send:focus-visible,
.o1-shell .chat-send.is-foco-teclado,
.choice:focus-visible,
.o1-tarjeta .choice:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* "Enviar" es una flecha hacia arriba. */
.o1-shell .chat-send {
  flex: none;
  appearance: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--comp-send);
  color: var(--comp-send-ink);
  cursor: pointer;
  transition: opacity 120ms ease;
}
.o1-shell .chat-send::before {
  content: "";
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5M5.5 11.5 12 5l6.5 6.5'/%3E%3C/svg%3E") center / 16px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5M5.5 11.5 12 5l6.5 6.5'/%3E%3C/svg%3E") center / 16px no-repeat;
}
.o1-shell .chat-send:disabled {
  opacity: 1;
  filter: none;
  cursor: default;
  background: var(--comp-send-off);
  color: var(--comp-send-off-ink);
}
/* Turno en curso: el mismo gris que disabled, sin cambiar la medida del círculo. */
.o1-shell .chat-send.is-ocupado {
  background: var(--comp-send-off);
  color: var(--comp-send-off-ink);
}
/* H05: el círculo sigue en 30 px. El área activa llega a 44 (inset 7) sin pisar el input: el gap de la caja es 8. */
.o1-shell .chat-send { position: relative; }
.o1-shell .chat-send::after {
  content: "";
  position: absolute;
  inset: -7px;
}

.o1-shell .chat-mic {
  display: none;
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 0;
  box-shadow: none;
  color: var(--ink);
}
.o1-shell .chat-mic:disabled {
  opacity: 0.45;
  cursor: default;
}
/*
 * Mic — glifo 18px (peso de + 20 / enviar 16). Hit --comp-d.
 * Vacío: el botón llena la pastilla y el centro del svg = centro de la pastilla.
 * Al crecer (dictado con texto): height --comp-d + bottom 0 = fila de abajo, Safari.
 * Móvil: el centro del glifo queda a --comp-mic-inset del borde derecho
 * (mismo ratio que el refresh de Safari, 54/1024 del viewport).
 * Escritorio: inset derecho = inset izquierdo del texto (--comp-pad-x, 16).
 */
.o1-shell .chat-mic:not([hidden]) {
  display: grid;
  place-items: center;
  justify-items: end;
  position: absolute;
  right: 0;
  bottom: 0;
  flex: none;
  box-sizing: border-box;
  width: var(--comp-d, 44px);
  height: min(var(--comp-d, 44px), 100%);
  margin: 0;
  padding: 0 16px 0 0;
  --comp-mic-pad: 16px;
  border: 0;
  border-radius: 999px;
  appearance: none;
  -webkit-appearance: none;
  background: none;
  color: var(--ink);
  cursor: pointer;
  line-height: 0;
}
.o1-shell .chat-caja:has(#chat-text:placeholder-shown) .chat-mic:not([hidden]) {
  top: 0;
  height: auto;
}
.o1-shell .chat-mic svg {
  display: block;
  width: 18px;
  height: 18px;
}
.o1-shell .chat-mic.is-grabando { color: var(--comp-rec); }
.o1-shell .chat-mic.is-grabando svg { opacity: 0; }
.o1-shell .chat-mic .mic-vivo {
  display: none;
  position: absolute;
  top: 50%;
  right: calc(var(--comp-mic-pad, 16px) - 5px);
  width: 28px;
  height: 28px;
  margin: -14px 0 0;
  border-radius: 50%;
  background: color-mix(in srgb, currentColor 20%, transparent);
  box-shadow: inset 0 0 0 1.5px currentColor;
  pointer-events: none;
}
.o1-shell .chat-mic.is-grabando .mic-vivo { display: block; }
.o1-shell .chat-mic .mic-ondas {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 10px;
  height: 12px;
  margin: 0;
  transform: translate(-50%, -50%);
}
.o1-shell .chat-mic .mic-ondas > i {
  display: block;
  width: 2px;
  height: 5px;
  border-radius: 1px;
  background: currentColor;
}
.o1-shell .chat-mic .mic-ondas > i:nth-child(1) { height: 4px; }
.o1-shell .chat-mic .mic-ondas > i:nth-child(2) { height: 11px; }
.o1-shell .chat-mic .mic-ondas > i:nth-child(3) { height: 7px; }
@media (prefers-reduced-motion: no-preference) {
  .o1-shell .chat-mic.is-grabando .mic-vivo { animation: mic-pulso 1.1s ease-in-out infinite; }
  .o1-shell .chat-mic.is-grabando .mic-ondas > i { animation: mic-onda 0.9s ease-in-out infinite; }
  .o1-shell .chat-mic.is-grabando .mic-ondas > i:nth-child(2) { animation-delay: 0.15s; }
  .o1-shell .chat-mic.is-grabando .mic-ondas > i:nth-child(3) { animation-delay: 0.3s; }
}
@keyframes mic-pulso {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.12); }
}
@keyframes mic-onda {
  0%, 100% { transform: scaleY(0.55); }
  50% { transform: scaleY(1.15); }
}
.o1-shell .chat-voz-eco {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
  pointer-events: none;
  box-sizing: border-box;
  overflow: hidden;
  color: var(--ink);
  z-index: 1;
}
.o1-shell .chat-voz-interino {
  color: var(--muted);
}
.o1-shell .chat-composer #chat-text.is-dictando,
.o1-shell .chat-composer textarea.is-dictando {
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: var(--ink);
}
.o1-shell .chat-mic-aviso {
  flex: 1 0 100%;
  order: 8;
  margin: -2px 0 0;
  padding: 0 4px 2px;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--muted);
}
.o1-shell .chat-mic-aviso[hidden] { display: none; }

/* Mensaje de voz: absoluto sobre Enviar. No entra en el flex, la pastilla no se mueve. */
.o1-shell .chat-voz { display: none; }
.o1-shell .chat-voz:not([hidden]) {
  display: grid;
  place-items: center;
  position: absolute;
  right: var(--comp-hueco, 8px);
  bottom: calc(var(--comp-hueco, 8px) + env(safe-area-inset-bottom, 0px) * var(--kb-closed, 1));
  z-index: 2;
  box-sizing: border-box;
  width: var(--comp-d, 44px);
  height: var(--comp-d, 44px);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--comp-send);
  color: var(--comp-send-ink);
  cursor: pointer;
  line-height: 0;
  appearance: none;
  -webkit-appearance: none;
}
.o1-shell .chat-voz svg { display: block; width: 18px; height: 18px; }
.o1-shell .chat-voz-vivo[hidden] { display: none; }
.o1-shell .chat-voz-vivo:not([hidden]) {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  padding: 0 6px 0 14px;
  background: var(--comp-surface);
  color: var(--ink);
  border-radius: inherit;
}
.o1-shell .chat-voz-tiempo {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  line-height: 1;
}
.o1-shell .chat-voz-vivo button {
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  place-items: center;
  flex: none;
  box-sizing: border-box;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  line-height: 0;
}
.o1-shell .chat-voz-vivo button svg { display: block; width: 16px; height: 16px; }
.o1-shell .chat-voz-vivo .chat-voz-parar { background: var(--comp-rec); color: #fff; }
@media (hover: hover) {
  .o1-shell .chat-voz:hover,
  .o1-shell .chat-voz-vivo button:hover { filter: none; }
}

/* Por defecto Enviar queda solapado adentro (30px). ≤600 y ≥601 lo sacan afuera. */
.o1-shell .chat-composer:has(> .chat-send) .chat-caja { padding-right: 43px; }
.o1-shell .chat-composer > .chat-send { margin-left: -43px; }

/*
 * Compositor — geometría Safari Compact, material Astro.
 * Naza crop 1024: '<' 80–196 (116), pill 213–811 (598×110), tabs 828–944,
 * gap 17, refresh cx 757 = 54 from the pill's right edge.
 * css = image × (100vw / 1024). --comp-pill-h floors at 44 so the 16/22
 * one-line field stays. Superficies: --comp-* (tema.css). Nada de gris Safari.
 * 390: d 44.18 / side 30.47 / gap 6.47 / pill 44 / mic-inset 20.57.
 * 430: d 48.71 / side 33.59 / gap 7.14 / pill 46.19 / mic-inset 22.68.
 */
@media (max-width: 600px) {
  .o1-thread[data-modo="unlocked"] .chat-composer {
    --comp-d: calc(100vw * 116 / 1024);
    --comp-side: calc(100vw * 80 / 1024);
    --comp-gap: calc(100vw * 17 / 1024);
    --comp-pill-h: max(44px, calc(100vw * 110 / 1024));
    --comp-mic-inset: calc(100vw * 54 / 1024);
    --comp-mic: 18px;
    --sf-d: var(--comp-d);
    --sf-side: var(--comp-side);
    --sf-gap: var(--comp-gap);
    padding-left: var(--comp-hueco);
    padding-right: var(--comp-hueco);
    column-gap: var(--comp-hueco);
    row-gap: 8px;
  }
  .o1-shell .chat-adjuntar {
    width: var(--comp-d, 44px);
    height: var(--comp-d, 44px);
    background: var(--comp-plus);
    color: var(--comp-plus-ink);
    box-shadow: none;
  }
  .o1-shell .chat-caja {
    min-height: var(--comp-pill-h);
    height: auto;
    padding: 0 0 0 16px;
    background: var(--comp-surface);
    border: 0;
    box-shadow: var(--comp-sombra), inset 0 0 0 1px var(--comp-linea);
    overflow: hidden;
  }
  .o1-shell .chat-composer:has(> .chat-send) .chat-caja { padding-right: 0; }
  .o1-shell .chat-composer > .chat-send { margin-left: 0; }
  .o1-shell .chat-send {
    width: var(--comp-d, 44px);
    height: var(--comp-d, 44px);
    background: var(--comp-send);
    color: var(--comp-send-ink);
    box-shadow: none;
  }
  .o1-shell .chat-send:disabled {
    opacity: 1;
    filter: none;
    background: var(--comp-send-off);
    color: var(--comp-send-off-ink);
  }
  .o1-shell .chat-send::after { inset: 0; }
  .o1-shell .chat-mic:not([hidden]) {
    padding: 0 calc(var(--comp-mic-inset) - var(--comp-mic) / 2) 0 0;
    --comp-mic-pad: calc(var(--comp-mic-inset) - var(--comp-mic) / 2);
  }
  .o1-shell .chat-composer #chat-text:placeholder-shown,
  .o1-shell .chat-composer textarea:placeholder-shown {
    padding-right: calc(var(--comp-mic-inset) + var(--comp-mic) / 2);
  }
  .o1-shell .chat-caja:has(#chat-mic:not([hidden])) #chat-text:not(:placeholder-shown),
  .o1-shell .chat-caja:has(#chat-mic:not([hidden])) textarea:not(:placeholder-shown) {
    padding-right: calc(var(--comp-mic-inset) + var(--comp-mic) / 2);
  }
}

/*
 * Tablet/escritorio: la misma geometría (44 / send afuera / mic en la pastilla)
 * y las mismas fichas --comp-* que el móvil. Sin gris Safari.
 */
@media (min-width: 601px) {
  /* 1280 + --pn-semi: --pn-chat baja al piso. El hueco lo manda --comp-hueco
   * (mismo valor a los cuatro lados: borde/+ , +/pastilla, pastilla/enviar, enviar/borde). */
  .o1-thread[data-modo="unlocked"] .chat-composer {
    padding-left: var(--comp-hueco);
    padding-right: var(--comp-hueco);
    column-gap: var(--comp-hueco);
  }
  .o1-shell .chat-adjuntar {
    width: var(--comp-d, 44px);
    height: var(--comp-d, 44px);
    background: var(--comp-plus);
    color: var(--comp-plus-ink);
  }
  .o1-shell .chat-caja {
    padding: 0 0 0 var(--comp-pad-x, 16px);
    background: var(--comp-surface);
    border: 0;
    box-shadow: var(--comp-sombra), inset 0 0 0 1px var(--comp-linea);
  }
  .o1-shell .chat-composer:has(> .chat-send) .chat-caja { padding-right: 0; }
  .o1-shell .chat-mic:not([hidden]) {
    padding: 0 var(--comp-pad-x, 16px) 0 0;
    --comp-mic-pad: var(--comp-pad-x, 16px);
  }
  .o1-shell .chat-composer > .chat-send { margin-left: 0; }
  .o1-shell .chat-send {
    width: var(--comp-d, 44px);
    height: var(--comp-d, 44px);
    background: var(--comp-send);
    color: var(--comp-send-ink);
  }
  .o1-shell .chat-send:disabled {
    opacity: 1;
    filter: none;
    cursor: default;
    background: var(--comp-send-off);
    color: var(--comp-send-off-ink);
  }
  .o1-shell .chat-send::after { inset: 0; }
}

.o1-shell .chat-adjuntos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1 0 100%;
  align-items: center;
  min-height: 44px;
  margin: 0 0 8px;
}
.o1-shell .chat-adjuntos:empty {
  visibility: hidden;
  pointer-events: none;
}
.o1-shell .chat-adjunto {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
  max-width: 220px;
  min-height: 44px;
  padding: 4px 8px 4px 12px;
  font-size: 13px;
  color: var(--ink);
  background: var(--bg-sunken);
  border-radius: 999px;
}
html[data-tema="dark"] .o1-shell .chat-adjunto {
  background: var(--bg-neutro);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--hairline);
}
.o1-shell .chat-adjunto span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o1-shell .chat-adjunto button {
  appearance: none;
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.o1-shell .chat-adjunto button span { overflow: visible; text-overflow: clip; }
.o1-shell .chat-adjunto.is-subiendo {
  position: relative;
  --p: 0;
}
.o1-shell .chat-adjunto.is-subiendo::before {
  content: "";
  position: absolute;
  left: 12px;
  right: 32px;
  bottom: 4px;
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 16%, transparent);
  pointer-events: none;
}
.o1-shell .chat-adjunto-barra {
  position: absolute;
  left: 12px;
  right: 32px;
  bottom: 4px;
  height: 4px;
  width: auto;
  border-radius: 999px;
  transform: scaleX(calc(var(--p) / 100));
  transform-origin: left;
  background: var(--ink);
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .o1-shell .chat-adjunto-barra { transition: transform 160ms ease; }
}
.o1-shell .chat-adjunto.is-error {
  color: var(--danger);
  max-width: 100%;
  align-items: center;
  background: color-mix(in srgb, var(--danger) 12%, var(--bg-sunken));
}
.o1-shell .chat-adjunto.is-error .chat-adjunto-nombre {
  flex: 0 1 auto;
  max-width: 220px;
  min-width: 0;
}
.o1-shell .chat-adjunto.is-error .chat-adjunto-detalle {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (hover: hover) {
  .o1-shell .chat-adjunto button:hover { color: var(--ink); }
}
.o1-shell .chat-adjunto .chat-audio-icono {
  flex: none;
  width: 16px;
  height: 16px;
  background: currentColor;
  overflow: visible;
  text-overflow: clip;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M1 6.2h2.1V9.8H1zM4.3 3.6h2.1v8.8H4.3zM7.6 1.8h2.1v12.4H7.6zM10.9 4.4h2.1v7.2h-2.1z'/%3E%3C/svg%3E") center / 16px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M1 6.2h2.1V9.8H1zM4.3 3.6h2.1v8.8H4.3zM7.6 1.8h2.1v12.4H7.6zM10.9 4.4h2.1v7.2h-2.1z'/%3E%3C/svg%3E") center / 16px no-repeat;
}
.chat-audio-play {
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  place-items: center;
  flex: none;
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 14%, transparent);
  color: inherit;
  cursor: pointer;
  line-height: 0;
}
.o1-shell .chat-adjunto .chat-audio-play {
  width: 28px;
  height: 28px;
  background: color-mix(in srgb, currentColor 14%, transparent);
  color: var(--ink);
}
.chat-audio-play svg { display: block; width: 14px; height: 14px; }
.chat-audio-tiempo,
.o1-shell .chat-adjunto .chat-audio-tiempo {
  flex: none;
  min-width: 2.6em;
  overflow: visible;
  text-overflow: clip;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
}
.chat-audio-el { display: none; }
@media (hover: hover) {
  .chat-audio-play:hover { filter: none; }
}

/* --- el pie mínimo del brief (Google OAuth, MP y Paddle lo piden) ------------ */

.o1-pie {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.o1-pie a { color: var(--muted); text-decoration: none; }
@media (hover: hover) {
  .o1-pie a:hover { text-decoration: underline; }
}

.o1-aviso { min-height: 18px; margin: 8px 0 0; font-size: 13px; color: var(--ink-2); }
.o1-aviso.error { color: var(--danger); }

/* --- la entrada de los mensajes (Naza 08/10) ---------------------------------
 * Primera pintada: sólo la píldora. Después cada mensaje del Astro entra como en un chat: los tres
 * puntitos ("escribiendo") y la burbuja con un fundido y un desplazamiento chico. Los tiempos viven en
 * `app-onboarding.js` (ENTRADA); acá sólo la forma. Con `prefers-reduced-motion` no se mueve nada. */
.o1-entra { animation: o1-entra 320ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }

/* Naza 08/10 17:46: "Volver" desde el pago — lo que vino después de los planes se va (fundido, sube
 * un poco y se cierra su alto, en app-onboarding.js) y la tarjeta de planes vuelve a entrar con
 * `o1-entra`. */
.o1-sale { overflow: hidden; pointer-events: none; }

@keyframes o1-entra {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.o1-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  margin: 8px auto 8px 0;
  padding: 13px 14px;
  background: var(--bg-bubble);
  border-radius: 18px;
  border-bottom-left-radius: 6px;
}

.o1-typing span {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: o1-punto 1.1s ease-in-out infinite;
}

.o1-typing span:nth-child(2) { animation-delay: 0.15s; }
.o1-typing span:nth-child(3) { animation-delay: 0.3s; }

.o1-thread .bubble.astro[aria-busy="true"] {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.o1-saludo-quien {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.o1-saludo-avatar {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex: none;
}
.o1-saludo-nombre {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.o1-thread .bubble.astro[aria-busy="true"] .o1-typing {
  margin: 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
}

@keyframes o1-punto {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-3px); opacity: 1; }
}

/* --- la carga de "Entrar con Google" (Naza 08/10 13:49) ----------------------
 * Sin texto: la letra de la opción tocada se vuelve un spinner, una barra fina avanza por el borde de
 * abajo de esa opción (dura `--o1-carga`, lo pone el cliente) y el resto de la tarjeta se atenúa y no
 * se puede tocar. */
.o1-tarjeta.is-cargando { pointer-events: none; }
.o1-tarjeta.is-cargando .o1-tarjeta-head,
.o1-tarjeta.is-cargando .choice:not(.is-cargando) {
  opacity: 0.4;
  transition: opacity 220ms ease;
}

.choice.is-cargando {
  position: relative;
  overflow: hidden;
  border-color: var(--hairline-strong);
  background: var(--bg-card);
}

.choice.is-cargando .choice-letter {
  position: relative;
  color: transparent;
  background: transparent;
}

.choice.is-cargando .choice-letter::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  border: 2px solid var(--hairline-strong);
  border-top-color: var(--ink);
  animation: o1-gira 0.8s linear infinite;
}

.choice.is-cargando::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: var(--fill);
  transform-origin: left center;
  transform: scaleX(0);
  animation: o1-avanza var(--o1-carga, 2000ms) cubic-bezier(0.3, 0.6, 0.3, 1) forwards;
}

/* El link del débito en el DUMMY (Naza 08/10 13:54): la misma carga, sin texto nuevo. Un spinner a la
 * izquierda del link y la barra fina avanzando debajo; las opciones se atenúan como arriba. */
.o1-enlace.is-cargando {
  position: relative;
  pointer-events: none;
  padding: 0 0 6px 22px;
  text-decoration: none;
}

.o1-enlace.is-cargando::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--hairline-strong);
  border-top-color: var(--ink);
  animation: o1-gira 0.8s linear infinite;
}

.o1-enlace.is-cargando::after {
  content: "";
  position: absolute;
  left: 22px;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--fill);
  transform-origin: left center;
  transform: scaleX(0);
  animation: o1-avanza var(--o1-carga, 2000ms) cubic-bezier(0.3, 0.6, 0.3, 1) forwards;
}

@keyframes o1-gira { to { transform: rotate(360deg); } }
@keyframes o1-avanza {
  from { transform: scaleX(0.04); }
  to { transform: scaleX(0.96); }
}

/* Naza 09/10: después del "Listo!" la caja de escribir entra suave (el `.chat` es `display: contents`
 * en el chat desbloqueado, así que la animación va en el composer mismo). */
.chat.o1-entra { animation: none; }
/* SÓLO opacidad: el composer desbloqueado se centra con `transform: translateX(-50%)`; una animación
 * que toque `transform` (como `o1-entra`) lo corría a la derecha y lo cortaba (Naza 09/10 19:51). */
.chat.o1-entra .chat-composer { animation: o1-aparece 420ms ease-out 80ms both; }
@keyframes o1-aparece {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .o1-entra, .o1-typing span { animation: none; }
  .chat.o1-entra .chat-composer { animation: none; }
  /* Sin giro ni barra que avanza: queda la opción marcada y el resto atenuado mientras carga. */
  .choice.is-cargando .choice-letter::after { animation: none; border-color: var(--ink); }
  .choice.is-cargando::after { animation: none; transform: scaleX(0.5); }
  .o1-enlace.is-cargando::before { animation: none; border-color: var(--ink); }
  .o1-enlace.is-cargando::after { animation: none; transform: scaleX(0.5); }
}

@media (max-width: 520px) {
  .o1-shell { padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); }
  .o1-shell:has(.o1-thread[data-modo="unlocked"]) { padding-left: 0; padding-right: 0; }
  .o1-thread[data-modo="unlocked"] {
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
  }
  .o1-thread .bubble { font-size: 14px; }
  .o1-celda { height: 46px; font-size: 20px; }
}

@media (pointer: coarse) {
  .o1-thread[data-modo="unlocked"] .chat-composer { padding-bottom: calc(var(--comp-hueco, 8px) + env(safe-area-inset-bottom, 0px) * var(--kb-closed, 1)); }
  .o1-thread[data-modo="unlocked"] { padding-bottom: calc(var(--alto-compositor, 66px) + env(safe-area-inset-bottom, 0px) * var(--kb-closed, 1)); }
}

/* Naza 09/10 12:20: la pastilla FLOTA sobre la conversación (que scrollea por detrás, sin franja
 * blanca). El hilo arranca debajo de la pastilla con su propio padding. */
.o1-topbar {
  position: fixed;
  top: var(--vv-top, 0px);
  left: 0;
  right: 0;
  z-index: 10;
  pointer-events: none;
  overflow: visible;
}
.o1-topbar .o1-pill { pointer-events: auto; }
.o1-thread { padding-top: calc(52px + env(safe-area-inset-top, 0px)); }

/* Naza 09/10 12:23: TODAS las tarjetas se ajustan a su contenido: el ancho justo para la línea más
 * larga (título, opción o subtítulo) + su padding, sin aire extra. Las opciones se estiran al ancho
 * de la más ancha para quedar parejas. Tope igual que las burbujas. */
.o1-thread .o1-tarjeta {
  width: fit-content;
  max-width: min(100%, 460px);
  margin-right: auto;
  box-sizing: border-box;
}
.o1-thread .o1-tarjeta .choice { width: 100%; box-sizing: border-box; }

/* Naza 09/10 13:20: la "pastilla" pasa a ser la mascota ENTERA (sin recorte ni círculo) con "Astro" en
 * una pastilla blanca debajo que se monta un poco sobre la imagen, como la referencia de Dalton. */
.o1-topbar .o1-pill {
  flex-direction: column;
  gap: 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
}
.o1-topbar .o1-pill-logo {
  width: 58px;
  height: 60px;
  aspect-ratio: 58 / 60;
  flex: none;
  object-fit: contain;
  border-radius: 0;
  filter: drop-shadow(0 4px 10px rgba(40, 90, 220, 0.18));
}
.o1-topbar .o1-pill > span {
  position: relative;
  margin-top: 8px; /* Naza 09/10 13:46: más separada de la mascota (sube un poco menos que ella) */
  padding: 2px 13px; /* Naza 09/10 13:46: más bajita */
  line-height: 1.35;
  background: var(--pill);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 14px rgba(0, 0, 0, 0.08);
  font-size: 16px; /* Naza 09/10: 16 px, así iOS Safari no hace zoom al editar el nombre */
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.o1-thread { padding-top: calc(112px + env(safe-area-inset-top, 0px)); }
/* El último mensaje del dueño queda entero bajo la pastilla fija (bajarHilo + scrollIntoView). */
.o1-thread[data-modo="unlocked"] { scroll-padding-top: calc(120px + env(safe-area-inset-top, 0px)); }
/* En el chat desbloqueado el hilo scrollea detrás de la mascota: la franja entera
 * sigue transparente. El velo es un círculo del color de tema, centrado en la
 * mascota, con el borde emplumado. */
.o1-shell:has(.o1-thread[data-modo="unlocked"]) .o1-topbar {
  background: transparent;
  padding-top: calc(24px + env(safe-area-inset-top, 0px));
  overflow: visible;
}
/* El anillo (78, sobresale 9px bajo la mascota) no toca la pastilla del nombre.
 * 16px la sube sin cortar el trazo. Sólo en el chat desbloqueado: login / portada
 * siguen con 8px y las alturas reservadas de #239 (94 / 112). */
.o1-shell:has(.o1-thread[data-modo="unlocked"]) .o1-topbar .o1-pill > span {
  margin-top: 16px;
}
/* Círculo detrás de la mascota y la pastilla del nombre. El centro es opaco
 * (los mensajes se apagan al entrar) y el radio se apaga hasta transparente:
 * no es un bloque ni una franja. El núcleo llega a 64px del centro (diámetro
 * 128); la diagonal de la caja 58×60 es 83px, así el borde del dibujo queda
 * adentro del corte. 30px es la mitad de la mascota de 60px: el círculo queda
 * centrado en ella. pointer-events: none para que el toque de «Limpiar chat»
 * llegue a la mascota y al nombre. Sin .is-velo no hay velo: el saludo quieto
 * no se tapa. */
.o1-shell:has(.o1-thread[data-modo="unlocked"]) .o1-topbar.is-velo .o1-pill::before {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  left: 50%;
  top: 30px;
  width: 260px;
  height: 260px;
  transform: translate(-50%, -50%);
  background: var(--bg);
  -webkit-mask-image: radial-gradient(circle at center, #000 0, #000 64px, rgba(0, 0, 0, 0.94) 78px, rgba(0, 0, 0, 0.72) 96px, rgba(0, 0, 0, 0.38) 114px, rgba(0, 0, 0, 0.12) 126px, transparent 130px);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-image: radial-gradient(circle at center, #000 0, #000 64px, rgba(0, 0, 0, 0.94) 78px, rgba(0, 0, 0, 0.72) 96px, rgba(0, 0, 0, 0.38) 114px, rgba(0, 0, 0, 0.12) 126px, transparent 130px);
  mask-repeat: no-repeat;
  mask-size: 100% 100%;
}
.o1-shell:has(.o1-thread[data-modo="unlocked"]) .o1-thread[data-modo="unlocked"] {
  scroll-padding-top: calc(132px + env(safe-area-inset-top, 0px));
}

/* H44: en el onboarding el padding-top del hilo se iba con el scroll y la pastilla (fija, casi sin
 * fondo) pintaba encima del título. El scrollport arranca debajo de la pastilla; el degradado sólo
 * llena esa franja, no las tarjetas. El chat desbloqueado sigue flotando la pastilla sobre la
 * conversación (Naza 09/10). top sigue siendo --vv-top. */
html:has(.o1-thread:not([data-modo="unlocked"])),
html:has(.o1-thread:not([data-modo="unlocked"])) body {
  color-scheme: light;
}
.o1-shell:has(.o1-thread:not([data-modo="unlocked"])) {
  --o1-cabeza: calc(112px + env(safe-area-inset-top, 0px));
  overflow: hidden;
}
.o1-shell:has(.o1-thread:not([data-modo="unlocked"])) .o1-topbar {
  background: linear-gradient(to bottom, var(--bg) 0, var(--bg) calc(100% - 12px), transparent 100%);
}
.o1-thread:not([data-modo="unlocked"]) {
  margin-top: var(--o1-cabeza, calc(112px + env(safe-area-inset-top, 0px)));
  padding-top: 0;
}

/* Portada / auth locked: logo + saludo + tarjeta son UN bloque (~460px).
 * El layout tiene que ser el FINAL desde el primer frame: si la pastilla nace
 * `position:fixed` arriba y el ancla espera a `[data-o1-step=auth]`, en
 * iPhone Safari el grupo aparece y de golpe se mueve. `html.o1-portada` está en el
 * HTML (el body sigue `class="o1-body"`, el postcheck de prod lo exige literal).
 * Estas reglas pintan el bloque ya anclado arriba (sin `--vv-h`: el JS
 * del teclado no puede moverlo después). `100svh` gana a `100dvh` — el alto
 * chico del Safari, estable, no el que cambia con la barra. Desde 768 el
 * bloque sigue arriba: mismo padding-top que la pastilla del chat
 * desbloqueado (24px). La mascota y el nombre no se centran en el alto; el
 * saludo queda debajo. El chat desbloqueado no entra acá.
 * :has() va en el shell, en paralelo — un :has() anidado se tira en Chromium. */
html.o1-portada .o1-shell:has(.o1-thread:not([data-modo="unlocked"])):not(:has([data-o1-step]:not([data-o1-step="auth"]))):not(:has(.o1-tarjeta.is-respondida)),
.o1-shell:has(.o1-thread:not([data-modo="unlocked"])):has([data-o1-step="auth"]):not(:has(.o1-tarjeta.is-respondida)) {
  --o1-portada-w: 460px;
  --o1-saludo-min: 24rem;
  max-width: min(100%, var(--o1-portada-w));
  box-sizing: border-box;
  justify-content: flex-start;
  padding-top: max(28px, env(safe-area-inset-top, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow-x: hidden;
  overflow-y: auto;
  height: 100dvh;
  height: 100svh;
  min-height: 100dvh;
  min-height: 100svh;
}
@media (min-width: 768px) {
  html.o1-portada .o1-shell:has(.o1-thread:not([data-modo="unlocked"])):not(:has([data-o1-step]:not([data-o1-step="auth"]))):not(:has(.o1-tarjeta.is-respondida)),
  .o1-shell:has(.o1-thread:not([data-modo="unlocked"])):has([data-o1-step="auth"]):not(:has(.o1-tarjeta.is-respondida)) {
    justify-content: flex-start;
    padding-top: calc(24px + env(safe-area-inset-top, 0px));
    height: 100dvh;
    min-height: 100dvh;
  }
}
html.o1-portada .o1-shell:has(.o1-thread:not([data-modo="unlocked"])):not(:has([data-o1-step]:not([data-o1-step="auth"]))):not(:has(.o1-tarjeta.is-respondida)) .o1-topbar,
.o1-shell:has(.o1-thread:not([data-modo="unlocked"])):has([data-o1-step="auth"]):not(:has(.o1-tarjeta.is-respondida)) .o1-topbar {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  background: none;
  flex: none;
  min-height: 94px;
  padding: 0 0 16px;
}
html.o1-portada .o1-shell:has(.o1-thread:not([data-modo="unlocked"])):not(:has([data-o1-step]:not([data-o1-step="auth"]))):not(:has(.o1-tarjeta.is-respondida)) .o1-panel,
.o1-shell:has(.o1-thread:not([data-modo="unlocked"])):has([data-o1-step="auth"]):not(:has(.o1-tarjeta.is-respondida)) .o1-panel {
  flex: 0 0 auto;
  min-height: var(--o1-saludo-min, 24rem);
  width: 100%;
}
html.o1-portada .o1-shell:has(.o1-thread:not([data-modo="unlocked"])):not(:has([data-o1-step]:not([data-o1-step="auth"]))):not(:has(.o1-tarjeta.is-respondida)) .o1-aviso:empty,
.o1-shell:has(.o1-thread:not([data-modo="unlocked"])):has([data-o1-step="auth"]):not(:has(.o1-tarjeta.is-respondida)) .o1-aviso:empty {
  display: none;
}
html.o1-portada .o1-thread:not([data-modo="unlocked"]):not(:has([data-o1-step]:not([data-o1-step="auth"]))):not(:has(.o1-tarjeta.is-respondida)),
.o1-thread:not([data-modo="unlocked"]):has([data-o1-step="auth"]):not(:has(.o1-tarjeta.is-respondida)) {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  margin-top: 0;
  padding: 0;
  overflow: visible;
  width: 100%;
  min-height: var(--o1-saludo-min, 24rem);
}
html.o1-portada .o1-thread:not([data-modo="unlocked"]):not(:has([data-o1-step]:not([data-o1-step="auth"]))):not(:has(.o1-tarjeta.is-respondida)) > .bubble,
html.o1-portada .o1-thread:not([data-modo="unlocked"]):not(:has([data-o1-step]:not([data-o1-step="auth"]))):not(:has(.o1-tarjeta.is-respondida)) > .o1-tarjeta,
html.o1-portada .o1-thread:not([data-modo="unlocked"]):not(:has([data-o1-step]:not([data-o1-step="auth"]))):not(:has(.o1-tarjeta.is-respondida)) > .o1-sep,
.o1-thread:not([data-modo="unlocked"]):has([data-o1-step="auth"]):not(:has(.o1-tarjeta.is-respondida)) > .bubble,
.o1-thread:not([data-modo="unlocked"]):has([data-o1-step="auth"]):not(:has(.o1-tarjeta.is-respondida)) > .o1-tarjeta,
.o1-thread:not([data-modo="unlocked"]):has([data-o1-step="auth"]):not(:has(.o1-tarjeta.is-respondida)) > .o1-sep {
  margin-left: 0;
  margin-right: auto;
}

/* Naza 09/10: TU ASTRO (public/astro-identidad.js). La mascota es un botón; «Limpiar chat» se abre
 * A SU DERECHA, en absoluto (la mascota actual no se corre del centro). El nombre se edita en el
 * lugar, con la misma pastilla blanca y nada más que el cursor de texto. */
.o1-topbar .o1-mascota-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  pointer-events: auto;
}
.o1-topbar .o1-mascota-btn {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: 14px;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease;
}
.o1-topbar .o1-mascota-btn:active { transform: scale(0.95); }
.o1-topbar .o1-mascota-btn:focus-visible,
.o1-topbar .o1-mascota-opcion:focus-visible,
.o1-topbar .o1-limpiar-chat:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.o1-topbar .o1-mascotas-alt {
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  opacity: 0;
  transform: translate(-6px, -50%) scale(0.96);
  transform-origin: left center;
  transition: opacity 0.18s ease-out, transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
  white-space: nowrap;
  pointer-events: auto;
}
/* `display: flex` pisa el [hidden] del UA: cerrado = none, abierto = flex. */
.o1-topbar .o1-mascotas-alt:not(.is-abierta),
.o1-topbar .o1-mascotas-alt[hidden] { display: none !important; }
.o1-topbar .o1-mascotas-alt.is-abierta {
  display: flex;
  opacity: 1;
  transform: translate(0, -50%) scale(1);
}
/* Toque ≥44 px; la pastilla visible es la chica de Ampliar (30 px / 12 / 500 + borde), no la del nombre. */
.o1-topbar .o1-limpiar-chat {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 44px;
  min-height: 44px;
  height: 44px;
  margin: 0;
  padding: 0 4px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  transition: transform 0.12s ease;
}
.o1-topbar .o1-limpiar-chat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  background: var(--pill);
  color: var(--ink);
  font: 500 12px/1 Geist, ui-sans-serif, -apple-system, "Segoe UI", system-ui, sans-serif;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  pointer-events: none;
}
.o1-topbar .o1-limpiar-chat-pill::before {
  content: "";
  flex: none;
  width: 13px;
  height: 13px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21'/%3E%3Cpath d='M22 21H7'/%3E%3Cpath d='m5 11 9 9'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21'/%3E%3Cpath d='M22 21H7'/%3E%3Cpath d='m5 11 9 9'/%3E%3C/svg%3E") center / contain no-repeat;
}
@media (hover: hover) {
  .o1-topbar .o1-limpiar-chat:hover .o1-limpiar-chat-pill { background: var(--bg-sunken); }
}
.o1-topbar .o1-limpiar-chat:active { transform: scale(0.96); }
.o1-topbar .o1-mascota-opcion {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 3px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.12s ease, transform 0.12s ease;
}
@media (hover: hover) {
  .o1-topbar .o1-mascota-opcion:hover { background: var(--bg-sunken); }
}
.o1-topbar .o1-mascota-opcion:active { transform: scale(0.92); }
.o1-topbar .o1-mascota-opcion img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.o1-topbar .o1-pill-logo { object-fit: contain; }
.o1-topbar .o1-pill > .o1-nombre {
  cursor: text;
  outline: none;
  min-width: 1ch;
  max-width: 70vw;
  white-space: nowrap;
  overflow: hidden;
  -webkit-user-select: text;
  user-select: text;
  caret-color: var(--ink);
}
.o1-topbar .o1-pill > .o1-nombre:focus { box-shadow: 0 0 0 2px var(--hairline-strong), 0 4px 14px rgba(0, 0, 0, 0.08); }
/* La sombra de la mascota, del color de la elegida (la de la azul es la de siempre). */
.o1-topbar .o1-pill-logo[data-mascota="amarillo"] { filter: drop-shadow(0 4px 10px rgba(210, 160, 20, 0.2)); }
.o1-topbar .o1-pill-logo[data-mascota="rojo"] { filter: drop-shadow(0 4px 10px rgba(220, 40, 70, 0.18)); }
.o1-topbar .o1-pill-logo[data-mascota="verde"] { filter: drop-shadow(0 4px 10px rgba(40, 170, 60, 0.18)); }

/* Naza 09/10: la fila a la derecha entra suave. «Limpiar chat» es la pastilla chica; al cerrar se va con la fila. */
.o1-topbar .o1-mascota-btn { position: relative; }
.o1-topbar .o1-mascota-saliente {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  pointer-events: none;
}
.o1-topbar .o1-mascota-opcion {
  opacity: 0;
  transform: translateX(-4px) scale(0.9);
  transition: opacity 0.16s ease-out, transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.12s ease;
}
.o1-topbar .o1-limpiar-chat {
  opacity: 0;
  transition: opacity 0.16s ease-out, background-color 0.12s ease;
}
.o1-topbar .o1-mascotas-alt.is-abierta .o1-mascota-opcion,
.o1-topbar .o1-mascotas-alt.is-abierta .o1-limpiar-chat { opacity: 1; transform: none; }
.o1-topbar .o1-mascotas-alt.is-abierta .o1-mascota-opcion:nth-child(2) { transition-delay: 0.03s, 0.03s, 0s; }
.o1-topbar .o1-mascotas-alt.is-abierta .o1-mascota-opcion:nth-child(3) { transition-delay: 0.06s, 0.06s, 0s; }
.o1-topbar .o1-mascotas-alt.is-abierta .o1-mascota-opcion:active { transform: scale(0.92); }
.o1-topbar .o1-mascotas-alt.is-abierta .o1-limpiar-chat:active { transform: scale(0.96); }
@media (prefers-reduced-motion: reduce) {
  .o1-topbar .o1-mascotas-alt,
  .o1-topbar .o1-mascota-opcion,
  .o1-topbar .o1-limpiar-chat,
  .o1-topbar .o1-mascota-btn { transition: none; }
  .o1-topbar .o1-mascotas-alt { transform: translate(0, -50%); }
  .o1-topbar .o1-mascota-opcion,
  .o1-topbar .o1-limpiar-chat { transform: none; }
}


/* ==== 15/10 · lanzamiento: tarjetas parejas, decisiones del chat y pulgares ==================== */

/* Las tarjetas abiertas miden lo mismo (el cuenta, el plan y el pago ya no bailan de ancho). */
.o1-thread .o1-tarjeta:not(.is-respondida) { min-width: min(100%, 304px); box-sizing: border-box; }

/* Las decisiones del chat (la tarjeta "Pasar a Profesional / Ahora no") con el mismo idioma que las
 * tarjetas: fondo gris, el texto sin burbuja arriba y las opciones blancas abajo. `.choice` del
 * onboarding es una grilla con letra (22px + texto): acá no hay letra, así que va en columna. */
.o1-shell .decision {
  width: fit-content;
  min-width: min(100%, 304px);
  max-width: min(92%, 460px);
  box-sizing: border-box;
  margin: 8px 0;
  padding: 10px;
  background: var(--bg-sunken);
  border-radius: 18px;
}
.o1-shell .decision .bubble.astro {
  max-width: none;
  margin: 0;
  padding: 4px 8px 12px;
  background: transparent;
  border-radius: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
}
.o1-shell .decision .choices { margin-top: 0; gap: 6px; }
.o1-shell .decision .choice {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  box-shadow: none;
}
@media (hover: hover) {
  .o1-shell .decision .choice:hover { background: var(--bg-elev); }
}
.o1-shell .decision .choice-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.o1-shell .decision .choice-label { font-size: 14px; font-weight: 600; color: var(--ink); }
.o1-shell .decision .choice-mark { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.o1-shell .decision .choice-note { font-size: 12.5px; color: var(--ink-2); }
.o1-shell .decision .choice.otra { color: var(--ink-2); }
.o1-shell .decision .choice.otra .choice-label { font-weight: 500; color: var(--ink-2); }
.o1-shell .decision .choice:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.o1-shell .chat-progress,
.o1-shell .chat-pending { display: none; }

/* Pulgares de las respuestas del Astro: chicos, apagados, con el área de toque de 36 px pero casi
 * invisibles. El HTML lo arma app-chat.js (.astro-thumbs > .astro-thumb.astro-thumb-up/-down); el emoji
 * del botón se oculta y se dibuja el ícono por CSS. */
.o1-shell .astro-thumbs {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 2px 0 -3px -10px;
  transition: opacity 0.15s ease;
}
.o1-shell .astro-thumb {
  appearance: none;
  flex: none;
  width: 36px;
  height: 36px;
  margin: -6px 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100%;
  color: var(--muted);
  font-size: 0;
  line-height: 0;
  opacity: 0.55;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}
.o1-shell .astro-thumb::before {
  content: "";
  width: 15px;
  height: 15px;
  background: currentColor;
  -webkit-mask: var(--ico) center / 15px no-repeat;
  mask: var(--ico) center / 15px no-repeat;
}
.o1-shell .astro-thumb-up {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10v12M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z'/%3E%3C/svg%3E");
}
.o1-shell .astro-thumb-down {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 14V2M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z'/%3E%3C/svg%3E");
}
@media (hover: hover) {
  .o1-shell .astro-thumb:hover { opacity: 1; }
}
.o1-shell .astro-thumb:focus-visible { outline: 2px solid var(--focus); outline-offset: -4px; opacity: 1; }
.o1-shell .astro-thumb.is-selected { opacity: 1; }
.o1-shell .astro-thumb-up.is-selected,
.o1-shell .astro-thumb-down.is-selected {
  color: var(--ink);
  background-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.07) 0 13px, transparent 13.5px);
}
.o1-shell .astro-thumb-up.is-selected {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23000' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10v12M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z'/%3E%3C/svg%3E");
}
.o1-shell .astro-thumb-down.is-selected {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23000' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 14V2M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z'/%3E%3C/svg%3E");
}
.o1-shell .astro-thumbs:has(.is-selected) .astro-thumb:not(.is-selected) { opacity: 0.3; }
/* Mandando: todo el grupo apagado y sin respuesta al toque. */
.o1-shell .astro-thumbs.is-sending { opacity: 0.45; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .o1-shell .astro-thumbs, .o1-shell .astro-thumb { transition: none; }
}
.o1-shell .astro-thumbs { display: none; }

/* Naza 20/10: la tarjeta del saludo del agente (sin título), alineada con la burbuja. */
.saludo-opciones { max-width: 420px; margin: 8px 0 12px; }
.saludo-opciones .choice { display: block; width: 100%; text-align: left; white-space: normal; }
/* 0018 (Naza 14:52, bug de prod): las opciones de Messi salían una palabra por renglón. `.choice` de arriba es
 * la grilla del onboarding (22 px de letra + texto); una opción SIN letra (las de una decisión/seguimiento del
 * agente: sólo .choice-top) que no cae bajo `.o1-shell .decision` metía todo el texto en la columna de 22 px.
 * Sin letra, la opción es una columna y mide lo de su texto más largo (la regla de la casa). */
.choice:not(:has(> .choice-letter)) { display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 2px; }
.choice-label { overflow-wrap: normal; word-break: normal; }
.choices:has(> .choice:not(:has(> .choice-letter))) { width: fit-content; min-width: min(100%, 304px); max-width: min(100%, 460px); }

/* 0020 (Naza 16:30): las opciones del saludo con rótulo A/B/C/D, iguales a las de las tarjetas (letra a la izquierda). */
.saludo-opciones .choice:has(> .choice-letter) { display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 12px; }
.msg-pendiente { margin: 8px 0 10px; padding: 12px 14px; border: 1px solid var(--line, rgba(127,127,127,.3)); border-radius: 14px; }
.msg-pendiente-t { margin: 0 0 8px; font-size: 14px; line-height: 1.4; }
.msg-pendiente .choices { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- turno: ack/cierre visuales + avatar trabajando + tarjeta cerrada ------------------- */
.o1-thread .bubble.turno-ux {
  max-width: min(88%, 460px);
}
/* Naza 2026-11-02: el acuse es primero la burbuja `.o1-typing` (sin un segundo fondo)
 * y después el texto. El cascarón no aporta alto ni margen extra, así el reemplazo
 * no deja un hueco. El movimiento lo apaga el `@media (prefers-reduced-motion)` de arriba. */
.o1-thread .bubble.astro.is-ack-puntos {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  width: fit-content;
  max-width: min(88%, 460px);
}
.o1-thread .bubble.astro.is-ack-puntos[aria-busy="true"] {
  display: block;
  gap: 0;
}
.o1-thread .bubble.astro.is-ack-puntos .o1-typing,
.o1-thread .bubble.astro.is-ack-puntos[aria-busy="true"] .o1-typing {
  margin: 0;
  padding: 13px 14px;
  background: var(--bg-bubble);
  border-radius: 18px;
  border-bottom-left-radius: 6px;
}
/* El turno entero, también después del acuse y en los huecos del stream.
 * Los tres puntos son `.o1-typing` (preparando respuesta). Con
 * `prefers-reduced-motion: reduce` el bounce se apaga y los puntos quedan. */
.turno-trabajando {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: fit-content;
  max-width: min(88%, 460px);
  margin: 8px 0 10px;
}
.turno-trabajando .o1-typing { margin: 0; }
.turno-trabajando-fila {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  gap: 8px;
}
.turno-detener {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 4px 12px 4px 8px;
  min-height: 28px;
  border: 0;
  border-radius: 999px;
  background: var(--bg-sunken);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}
.turno-detener-icono {
  width: 8px;
  height: 8px;
  border-radius: 1.5px;
  background: currentColor;
  flex: none;
}
.turno-detener:disabled {
  color: var(--muted);
  cursor: default;
}
.turno-detener:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
@media (hover: hover) {
  .turno-detener:hover:not(:disabled) { background: var(--bg-hover); }
}
.turno-detener-aviso {
  margin: 0;
  padding: 0 2px;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--danger);
}
.turno-detener-aviso.is-info { color: var(--ink-2); }
.turno-trabajando-leyenda,
.turno-trabajando-reloj {
  margin: 0;
  padding: 0 2px;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--muted);
}
.turno-trabajando-leyenda { color: var(--ink-2); font-weight: 500; }
.turno-trabajando-reloj {
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.turno-trabajando-reloj[hidden] { display: none; }
.o1-topbar .o1-pill.is-trabajando .o1-pill-logo,
.o1-topbar .o1-mascota-btn.is-trabajando img {
  animation: turno-bob 1.7s ease-in-out infinite;
}
.o1-topbar .o1-pill,
.o1-topbar .o1-mascota-wrap,
.o1-topbar .o1-mascota-btn {
  position: relative;
  overflow: visible;
}
.o1-topbar .o1-pill picture,
.pn-fila picture,
.pn-riel-astro picture { display: contents; }
.o1-topbar .o1-pill-logo,
.pn-fila .pn-mini,
.pn-riel-astro img {
  position: relative;
  z-index: 1;
}
.pn-fila,
.pn-riel-astro,
.pn-riel-astro-caja { position: relative; overflow: visible; }
.turno-anillo {
  --turno-anillo: #00B7FF;
  display: none;
  position: absolute;
  z-index: 0;
  box-sizing: border-box;
  padding: 0;
  border: 1.15px solid color-mix(in srgb, color-mix(in srgb, var(--turno-anillo) 52%, white) 48%, transparent);
  border-radius: 30%; /* 12/40, la misma proporción que .pn-riel-astro */
  pointer-events: none;
  line-height: 0;
  font-size: 0;
  background: none;
  box-shadow:
    0 0 6px color-mix(in srgb, var(--turno-anillo) 26%, transparent),
    0 0 14px color-mix(in srgb, var(--turno-anillo) 14%, transparent);
  animation: turno-anillo-pulso 1.6s ease-in-out infinite;
}
.o1-topbar .o1-pill > .turno-anillo,
.o1-topbar .turno-anillo {
  left: 50%;
  top: 30px;
  width: 78px;
  height: 78px;
  margin: -39px 0 0 -39px;
}
.pn-fila > .turno-anillo {
  left: 3px;
  top: 50%;
  width: 42px;
  height: 42px;
  margin: -21px 0 0 0;
}
.pn-riel-astro > .turno-anillo {
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
}
html.is-turno-trabajando .turno-anillo,
.is-trabajando .turno-anillo {
  display: block;
}
@keyframes turno-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
@keyframes turno-anillo-gira {
  to { transform: rotate(360deg); }
}
@keyframes turno-anillo-pulso {
  50% {
    border-color: color-mix(in srgb, color-mix(in srgb, var(--turno-anillo) 58%, white) 56%, transparent);
    box-shadow:
      0 0 8px color-mix(in srgb, var(--turno-anillo) 32%, transparent),
      0 0 18px color-mix(in srgb, var(--turno-anillo) 16%, transparent);
  }
}
.choices .choice {
  max-height: 220px;
  overflow: hidden;
  transition: opacity 0.28s ease, max-height 0.32s ease, margin 0.28s ease, padding 0.28s ease, border-width 0.22s ease, min-height 0.28s ease;
}
.choices.is-cerrada .choice.is-fuera {
  max-height: 0;
  min-height: 0;
  opacity: 0;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
  pointer-events: none;
}
.choice.is-elegida,
.choice.is-elegida:disabled,
.o1-shell .decision .choice.is-elegida,
.o1-shell .decision .choice.is-elegida:disabled {
  background: var(--fill);
  color: var(--ink-on-fill);
  border-color: var(--fill);
  opacity: 1;
  pointer-events: none;
  cursor: default;
}
html[data-tema="dark"] .choice.is-elegida,
html[data-tema="dark"] .choice.is-elegida:disabled,
html[data-tema="dark"] .o1-shell .decision .choice.is-elegida,
html[data-tema="dark"] .o1-shell .decision .choice.is-elegida:disabled {
  background: var(--bg-own);
  color: var(--ink-on-own);
  border-color: var(--bg-own);
}
.choice.is-elegida .choice-label,
.choice.is-elegida .choice-mark,
.choice.is-elegida .choice-note,
.o1-shell .decision .choice.is-elegida .choice-label,
.o1-shell .decision .choice.is-elegida .choice-mark,
.o1-shell .decision .choice.is-elegida .choice-note {
  color: var(--ink-on-fill);
}
html[data-tema="dark"] .choice.is-elegida .choice-label,
html[data-tema="dark"] .choice.is-elegida .choice-mark,
html[data-tema="dark"] .choice.is-elegida .choice-note,
html[data-tema="dark"] .o1-shell .decision .choice.is-elegida .choice-label,
html[data-tema="dark"] .o1-shell .decision .choice.is-elegida .choice-mark,
html[data-tema="dark"] .o1-shell .decision .choice.is-elegida .choice-note {
  color: var(--ink-on-own);
}
.choice.is-elegida .choice-letter {
  background: color-mix(in srgb, var(--ink-on-fill) 22%, transparent);
  color: var(--ink-on-fill);
  font-size: 0;
}
.choice.is-elegida .choice-letter::after {
  content: "✓";
  font-size: 13px;
  font-weight: 700;
}
.choice.is-elegida .choice-top {
  padding-right: 22px;
  position: relative;
}
.choice.is-elegida:not(:has(> .choice-letter)) .choice-top::after {
  content: "✓";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 700;
}
@media (hover: hover) {
  .choice.is-elegida:hover,
  .o1-shell .decision .choice.is-elegida:hover { background: var(--fill); }
  html[data-tema="dark"] .choice.is-elegida:hover,
  html[data-tema="dark"] .o1-shell .decision .choice.is-elegida:hover { background: var(--bg-own); }
}
.choices.sin-anim .choice { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .o1-topbar .o1-pill.is-trabajando .o1-pill-logo,
  .o1-topbar .o1-mascota-btn.is-trabajando img { animation: none; }
  .turno-anillo {
    animation: none;
    box-shadow:
      0 0 6px color-mix(in srgb, var(--turno-anillo, #00B7FF) 24%, transparent),
      0 0 12px color-mix(in srgb, var(--turno-anillo, #00B7FF) 12%, transparent);
  }
  .choices .choice { transition: none; }
}
