.asistente { position: absolute; inset: 0; pointer-events: none; --asistente-borde: rgba(255, 255, 255, .11); }
.asistente-flotante {
  position: fixed; z-index: 115; right: 24px; bottom: calc(24px + var(--zs-abajo));
  display: grid; justify-items: center; gap: 4px; width: 68px; min-height: 68px; padding: 8px 6px;
  border: 1px solid rgba(255, 255, 255, .18); border-radius: 22px; background: #1A2029; color: #F7F8F8;
  box-shadow: 0 18px 48px -14px rgba(0, 0, 0, .85); cursor: pointer; pointer-events: auto; touch-action: none;
  transition: transform .18s var(--ease-mano), box-shadow .18s var(--ease-mano);
}
.asistente-flotante:hover { transform: translateY(-2px); box-shadow: 0 22px 54px -14px rgba(0, 0, 0, .9); }
.asistente-flotante:active, .asistente.is-listening .asistente-flotante { transform: scale(.94); }
.asistente-flotante > span { display: grid; place-items: center; width: 30px; height: 30px; }
.asistente-flotante img { display: block; width: 30px; height: 30px; object-fit: contain; }
.asistente-flotante svg, .asistente-microfono svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.asistente-flotante small { font-size: 10px; font-weight: 650; letter-spacing: -.01em; }
.asistente-flotante::after { content: ""; position: absolute; inset: -6px; border: 1px solid transparent; border-radius: 27px; pointer-events: none; }
.asistente.is-listening .asistente-flotante::after { border-color: rgba(151, 190, 234, .9); box-shadow: 0 0 18px rgba(117, 168, 226, .42); animation: asistente-pulso 1.25s ease-out infinite; }

.asistente-capa { position: fixed; z-index: 110; inset: 0; pointer-events: none; }
.asistente-fondo { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(0, 0, 0, 0); opacity: 0; pointer-events: auto; transition: background-color .22s ease, opacity .22s ease; }
.asistente-hoja {
  position: absolute; right: 24px; bottom: calc(104px + var(--zs-abajo));
  display: grid; grid-template-rows: auto minmax(180px, auto) auto; width: min(410px, calc(100vw - 48px)); max-height: min(590px, calc(100dvh - 142px));
  overflow: hidden; border: 1px solid var(--asistente-borde); border-radius: 24px; background: color-mix(in oklab, var(--bg-2) 94%, #191a1e);
  box-shadow: 0 34px 90px -26px rgba(0, 0, 0, .95); opacity: 0; transform: translateY(14px) scale(.985); transform-origin: bottom right;
  pointer-events: auto; transition: opacity .18s ease, transform .42s var(--ease);
}
.asistente.is-open .asistente-hoja { opacity: 1; transform: none; }
.asistente.is-open .asistente-fondo { background: rgba(0, 0, 0, .22); opacity: 1; }
.asistente-hoja > header { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; padding: 17px 18px 15px; border-bottom: 1px solid var(--asistente-borde); }
.asistente-hoja h2 { margin: 0; font-size: 17px; line-height: 1.2; font-weight: 590; letter-spacing: -.025em; }
.asistente-estado { margin: 3px 0 0; color: var(--fg-3); font-size: 12px; }
.asistente-cerrar { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--fg-3); cursor: pointer; }
.asistente-cerrar:hover { background: rgba(255, 255, 255, .06); color: var(--fg); }
.asistente-cerrar svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.asistente-manos-libres { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 44px; min-height: 44px; color: var(--fg-3); font-size: 11px; cursor: pointer; }
.asistente-manos-libres input { position: relative; width: 32px; height: 18px; margin: 0; border: 0; border-radius: 999px; background: #34363A; appearance: none; }
.asistente-manos-libres input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #8A8F98; transition: transform 150ms cubic-bezier(.2, 0, 0, 1), background-color 150ms cubic-bezier(.2, 0, 0, 1); }
.asistente-manos-libres input:checked { background: #F7F8F8; }
.asistente-manos-libres input:checked::after { background: #08090A; transform: translateX(14px); }
.asistente-manos-libres input:disabled + span { opacity: .55; }
.asistente.is-hands-free .asistente-estado { color: var(--fg-2); }
.asistente.is-hands-free .asistente-flotante::before { content: ""; position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: #df7777; box-shadow: 0 0 0 3px rgba(223, 119, 119, .18); }
.asistente.is-awaiting-command .asistente-flotante::after { border-color: rgba(242, 163, 163, .75); animation: asistente-pulso 1.25s ease-out infinite; }

.asistente-mensajes { display: flex; flex-direction: column; gap: 10px; max-height: min(330px, calc(100dvh - 380px)); overflow-y: auto; padding: 16px 18px 22px; overscroll-behavior: contain; }
.asistente-mensaje { max-width: 88%; padding: 10px 12px; border: 1px solid var(--asistente-borde); border-radius: 15px 15px 15px 5px; background: rgba(255, 255, 255, .035); }
.asistente-mensaje span { display: block; margin-bottom: 3px; color: var(--fg-4); font-size: 10px; font-weight: 600; }
.asistente-mensaje p { margin: 0; color: var(--fg-2); font-size: 14px; line-height: 1.45; }
.asistente-accion { min-height: 44px; margin-top: 10px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--boton); color: var(--boton-texto); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; }
.asistente-accion:disabled { opacity: .55; cursor: wait; }
.asistente-mensaje--persona { align-self: flex-end; border-radius: 15px 15px 5px 15px; background: #1B1C1E; border-color: rgba(255, 255, 255, .13); }
.asistente-mensaje--persona span { color: var(--fg-3); }
.asistente-mensaje--persona p { color: var(--fg); }
.asistente-mensaje--guia { max-width: 100%; padding: 14px; border-style: dashed; }
.asistente-mensaje--guia b { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 590; }
.asistente-mensaje--guia p { color: var(--fg-3); font-size: 13px; }
.asistente-sugerencias { display: grid; gap: 6px; margin-top: 12px; }
.asistente-sugerencias button { min-height: 44px; padding: 0 11px; border: 1px solid var(--asistente-borde); border-radius: 10px; background: #141516; color: var(--fg-2); text-align: left; cursor: pointer; }
.asistente-sugerencias button:hover { border-color: rgba(255, 255, 255, .22); color: var(--fg); }
.asistente-mensaje--pensando { display: flex; align-items: center; gap: 8px; }
.asistente-mensaje--pensando i { width: 7px; height: 7px; border-radius: 50%; background: #F2C94C; animation: asistente-pensando 900ms ease-in-out infinite alternate; }
.asistente-mensaje--pensando p { font-size: 12px; }
.asistente-mensaje--sistema { align-self: center; max-width: 100%; padding: 6px 10px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .05); }
.asistente-mensaje--sistema span { display: none; }
.asistente-mensaje--sistema p { color: var(--fg-3); font-size: 11px; }
.asistente-mensaje--error { border-color: rgba(242, 163, 163, .28); }
.asistente-mensaje--error p { color: var(--peligro); }

.asistente-controles { display: grid; gap: 10px; padding: 12px 14px calc(14px + var(--zs-abajo)); border-top: 1px solid var(--asistente-borde); background: rgba(8, 9, 10, .72); backdrop-filter: blur(18px); }
.asistente-microfono { justify-self: center; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--asistente-borde); border-radius: 999px; background: rgba(255, 255, 255, .06); color: var(--fg); cursor: pointer; touch-action: none; }
.asistente-microfono span { font-size: 13px; font-weight: 540; }
.asistente-microfono svg { width: 18px; height: 18px; }
.asistente.is-listening .asistente-microfono { background: rgba(242, 163, 163, .12); border-color: rgba(242, 163, 163, .42); color: var(--peligro); }
.asistente-formulario { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.asistente-formulario input { min-height: 44px; }
.asistente-formulario button { min-height: 44px; padding: 0 15px; border: 0; border-radius: 999px; background: var(--boton); color: var(--boton-texto); font-size: 13px; font-weight: 590; cursor: pointer; }
.asistente-formulario button:active { transform: scale(.97); }
.asistente.is-thinking .asistente-microfono, .asistente.is-thinking .asistente-formulario { opacity: .48; pointer-events: none; }
.asistente.is-thinking .asistente-flotante { opacity: .55; pointer-events: none; }

@keyframes asistente-pulso { from { opacity: .85; transform: scale(.9); } to { opacity: 0; transform: scale(1.16); } }
@keyframes asistente-pensando { to { opacity: .35; transform: scale(.75); } }

@media (max-width: 720px) {
  .asistente-flotante { right: 14px; bottom: calc(92px + var(--zs-abajo)); width: 52px; min-height: 52px; border-radius: 17px; }
  .app-content { padding-bottom: calc(154px + var(--zs-abajo)); }
  .asistente-flotante small { display: none; }
  .asistente-capa { z-index: 190; }
  .asistente.is-open .asistente-fondo { background: rgba(0, 0, 0, .56); }
  .asistente-hoja {
    right: 0; bottom: 0; width: 100%; height: min(74dvh, 640px); border-width: 1px 0 0; border-radius: 24px 24px 0 0;
    transform: translateY(100%); transform-origin: bottom center;
  }
  .asistente.is-open .asistente-hoja { transform: translateY(0); }
  .asistente-hoja > header { padding-top: 14px; }
  .asistente-manos-libres span { max-width: 72px; line-height: 1.1; }
  .asistente-hoja > header::before { content: ""; position: absolute; top: 7px; left: 50%; width: 34px; height: 3px; border-radius: 3px; background: var(--fg-4); transform: translateX(-50%); }
  .asistente-controles { padding-bottom: calc(12px + var(--zs-abajo)); }
  .app-body:not(:has(.agenda-page)) .asistente-flotante { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .asistente-flotante, .asistente-hoja, .asistente-fondo { transition-duration: .01ms; }
  .asistente.is-listening .asistente-flotante::after, .asistente.is-awaiting-command .asistente-flotante::after { animation: none; opacity: 1; }
  .asistente-mensaje--pensando i { animation: none; }
}
