:root {
  --acento: #5b3df5;
  --fondo: #f3f2ef;
  --superficie: #fff;
  --tinta: #18181b;
  --suave: #5f5f68;
  --borde: #e4e2dd;
  --radio: 18px;
  font-family: 'Figtree', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fondo); color: var(--tinta); -webkit-font-smoothing: antialiased; }
p { margin: 0; }
button { font: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; }

.app { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 24px; height: calc(100dvh - var(--muestrario-barra, 0px)); padding: 24px; max-width: 1240px; margin: 0 auto; }

/* ---------- Lista de asistentes ---------- */
.lateral { display: flex; flex-direction: column; gap: 24px; padding: 12px 4px 76px; overflow-y: auto; }
.lateral h1 { margin: 8px 0 10px; font-size: 2.1rem; line-height: 1.05; letter-spacing: -.03em; font-weight: 800; }
.nota { color: var(--suave); line-height: 1.5; }
.bots { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bot { display: flex; gap: 14px; align-items: flex-start; width: 100%; padding: 16px; border: 1.5px solid var(--borde); border-radius: var(--radio); background: var(--superficie); color: inherit; text-align: left; cursor: pointer; transition: border-color .2s, box-shadow .2s, transform .2s; }
.bot:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgb(0 0 0 / 7%); }
.bot[aria-pressed='true'] { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.bot .avatar { background: var(--c); }
.bot__texto { display: grid; gap: 2px; }
.bot__texto small { color: var(--c); font-weight: 700; font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; }
.bot__texto b { font-size: 1.15rem; }
.bot__texto span { color: var(--suave); font-size: .95rem; line-height: 1.4; }
.avatar { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 14px; background: var(--acento); color: #fff; font-weight: 800; font-size: 1.15rem; transition: background .3s; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; min-height: 0; border-radius: 28px; background: var(--superficie); box-shadow: 0 1px 2px rgb(0 0 0 / 5%), 0 20px 60px rgb(0 0 0 / 8%); overflow: hidden; }
.chat__cabeza { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--borde); }
.chat__quien { flex: 1; display: grid; }
.chat__quien b { font-size: 1.05rem; }
.chat__quien small { display: flex; align-items: center; gap: 6px; color: var(--suave); }
.en-linea { width: 8px; height: 8px; border-radius: 50%; background: #22a55a; }
.icono-boton { display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 12px; background: none; color: var(--suave); cursor: pointer; }
.icono-boton:hover { background: var(--fondo); color: var(--tinta); }
.solo-movil { display: none; }

.mensajes { flex: 1; list-style: none; margin: 0; padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
  background: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--acento) 12%, transparent) 1px, transparent 0) 0 0 / 22px 22px; }
.msj { max-width: min(78%, 520px); padding: 11px 15px; border-radius: 20px; line-height: 1.45; animation: entra .25s ease-out; }
.msj--bot { align-self: flex-start; background: var(--fondo); border-bottom-left-radius: 6px; }
.msj--yo { align-self: flex-end; background: var(--acento); color: #fff; border-bottom-right-radius: 6px; }
.msj b { font-weight: 700; }
@keyframes entra { from { opacity: 0; transform: translateY(6px); } }
.puntos { display: inline-flex; gap: 4px; padding: 5px 0; }
.puntos i { width: 7px; height: 7px; border-radius: 50%; background: var(--suave); animation: rebote 1s infinite; }
.puntos i:nth-child(2) { animation-delay: .15s; } .puntos i:nth-child(3) { animation-delay: .3s; }
@keyframes rebote { 0%, 60%, 100% { opacity: .4; transform: none; } 30% { opacity: 1; transform: translateY(-4px); } }

.tarjeta { margin-top: 10px; padding: 14px; border-radius: 14px; background: var(--superficie); border: 1px solid var(--borde); }
.tarjeta__titulo { display: block; font-size: .85rem; color: var(--suave); text-transform: uppercase; letter-spacing: .05em; }
.tarjeta__grande { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; margin: 2px 0 6px; }
.tarjeta dl { margin: 6px 0 0; display: grid; gap: 6px; }
.tarjeta dl div { display: flex; justify-content: space-between; gap: 16px; padding-top: 6px; border-top: 1px dashed var(--borde); }
.tarjeta dl div:first-child { border-top: 0; padding-top: 0; }
.tarjeta dt { color: var(--suave); }
.tarjeta dd { margin: 0; font-weight: 600; text-align: right; }
.tarjeta__pie { margin-top: 8px; color: var(--suave); font-size: .9rem; }
.rojo { color: #c0352b; }

.carrusel { display: flex; gap: 10px; margin: 10px -15px -11px; padding: 0 15px 12px; overflow-x: auto; scroll-snap-type: x mandatory; }
.producto { flex: 0 0 160px; display: grid; gap: 2px; padding: 10px; border-radius: 14px; background: var(--superficie); border: 1px solid var(--borde); scroll-snap-align: start; }
.producto__img { display: grid; place-items: center; height: 84px; margin-bottom: 6px; border-radius: 10px; background: color-mix(in srgb, var(--c) 30%, #fff); color: color-mix(in srgb, var(--c) 70%, #000); font-size: 2rem; font-weight: 800; }
.producto small { color: var(--suave); font-size: .82rem; line-height: 1.3; }
.producto__precio { font-weight: 800; margin: 4px 0 6px; }
.boton-mini { min-height: 36px; border: 0; border-radius: 10px; background: var(--acento); color: #fff; font-weight: 700; cursor: pointer; }

.sugerencias { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 20px; }
.sugerencias:not(:empty) { padding-bottom: 12px; }
.chip { min-height: 38px; padding: 0 14px; border: 1.5px solid color-mix(in srgb, var(--acento) 40%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--acento) 7%, #fff); color: color-mix(in srgb, var(--acento) 80%, #000); font-weight: 600; cursor: pointer; transition: background .15s; }
.chip:hover { background: color-mix(in srgb, var(--acento) 16%, #fff); }
.entrada { display: flex; gap: 10px; padding: 12px 16px 16px; }
.entrada input { flex: 1; min-width: 0; min-height: 50px; padding: 0 18px; border: 1.5px solid var(--borde); border-radius: 999px; background: var(--fondo); color: var(--tinta); font: 1rem 'Figtree', sans-serif; }
.entrada input:focus { outline: 0; border-color: var(--acento); background: #fff; }
.enviar { display: grid; place-items: center; width: 50px; height: 50px; border: 0; border-radius: 50%; background: var(--acento); color: #fff; cursor: pointer; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; padding: 0; gap: 0; }
  .lateral { padding: 24px 16px 88px; }
  .chat { display: none; border-radius: 0; height: 100dvh; }
  body.viendo-chat .lateral { display: none; }
  body.viendo-chat .chat { display: flex; }
  .solo-movil { display: grid; }
  .mensajes { padding: 16px; }
  .msj { max-width: 88%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
/* En el celular, dentro del chat, el botón de volver taparía el campo de texto; ahí se vuelve con la flecha de arriba. */
@media (max-width: 760px) { body.viendo-chat .muestrario-volver { display: none; } }
