/* st28 · Asistente en móvil: la pestaña «Chat» abre el chat a pantalla completa (estilo WhatsApp).
   Cabecera compacta (foto + nombre + botón Opciones) · mensajes que llenan · caja de texto fija abajo. Solo ≤760px. */
@media (max-width:760px){
  /* pantalla completa real: cubre topbar y barra inferior; el alto sigue al teclado (visualViewport) */
  #cfg-hub.ch-m-chat{
    position:fixed;left:0;right:0;top:var(--vv-top,0px);height:var(--vv-h,100dvh);bottom:auto;
    z-index:290;display:flex;flex-direction:column;background:var(--bg,#fff);
    margin:0;overflow:hidden;
  }
  body.hub-chat{overflow:hidden;}
  body.hub-chat .mbottom,body.hub-chat #aura-ob-fab,body.hub-chat #nilo-support-bubble{display:none!important;}
  /* cabecera */
  #cfg-hub.ch-m-chat .ch-stage{
    flex:0 0 auto;flex-direction:row;align-items:center;justify-content:space-between;gap:10px;
    padding:calc(8px + env(safe-area-inset-top)) 12px 8px;min-height:0;border-radius:0;border:0;border-bottom:1px solid var(--bg3);
    background:var(--bg2);overflow:visible;
  }
  #cfg-hub.ch-m-chat .ch-who{flex:1 1 auto!important;width:auto!important;min-width:0;flex-direction:row;align-items:center;gap:10px;padding:0!important}
  #cfg-hub.ch-m-chat .ch-who>svg{display:none!important}
  #cfg-hub.ch-m-chat .ch-call{width:42px!important;height:42px;margin:0!important;border-radius:50%!important;overflow:hidden!important;background:color-mix(in srgb,var(--hub-c,#4f8cff) 18%,transparent)!important;flex:0 0 42px}
  #cfg-hub.ch-m-chat .ch-call::after{display:none}
  #cfg-hub.ch-m-chat .ch-call .ch-ph,#cfg-hub.ch-m-chat .ch-call .ch-vid,#cfg-hub.ch-m-chat .ch-call .ch-ph2{
    width:100%!important;height:100%!important;max-height:none!important;object-fit:cover!important;object-position:top!important;filter:none!important;animation:none!important}
  #cfg-hub.ch-m-chat .ch-bubble{background:none;border:0;box-shadow:none;margin:0;padding:0;text-align:left;font-size:.95rem;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  #cfg-hub.ch-m-chat .ch-bubble:after,#cfg-hub.ch-m-chat .ch-bubble>span{display:none}
  #cfg-hub.ch-m-chat .ch-bubble .ch-nm{font-weight:700}
  #cfg-hub.ch-m-chat .ch-bubble:before{content:"";display:inline-block;width:8px;height:8px;border-radius:50%;background:#1fbf8f;margin-right:6px;vertical-align:1px}
  #cfg-hub.ch-m-chat .ch-who{order:0}
  #cfg-hub.ch-m-chat .ch-who .ch-bubble{order:2}
  #cfg-hub.ch-m-chat .ch-mtabs{width:auto;flex:0 0 auto;padding:3px;gap:2px}
  #cfg-hub.ch-m-chat .ch-mtabs button{padding:7px 10px;font-size:.74rem}
  #cfg-hub.ch-m-chat .ch-mtabs button span{display:none}      /* solo íconos ☰ / 💬 para que quepa */
  #cfg-hub.ch-m-chat .ch-arm,#cfg-hub.ch-m-chat .ch-hand,#cfg-hub.ch-m-chat .ch-tiles,#cfg-hub.ch-m-chat .ch-ob{display:none!important}

  /* cuerpo: el chat ocupa todo lo que queda */
  #cfg-hub.ch-m-chat .ch-row{flex:1 1 auto;min-height:0;margin:0;display:flex;flex-direction:column}
  #cfg-hub.ch-m-chat .ch-chat{flex:1 1 auto;min-height:0;margin:0;border:0;border-radius:0;padding:0;display:flex;flex-direction:column;background:var(--bg,#fff)}
  #cfg-hub.ch-m-chat .ch-msgs{
    order:1;flex:1 1 auto;min-height:0;max-height:none;margin:0;padding:14px 12px 8px;gap:8px;
    display:flex!important;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;
    background:var(--bg,#fff);
  }
  #cfg-hub.ch-m-chat .ch-m{max-width:86%;font-size:.92rem;line-height:1.45;padding:10px 14px;border-radius:18px}
  #cfg-hub.ch-m-chat .ch-m.bot{border-bottom-left-radius:5px}
  #cfg-hub.ch-m-chat .ch-m.me{border-bottom-right-radius:5px}
  /* sugerencias: una sola fila deslizable justo encima de la caja de texto */
  #cfg-hub.ch-m-chat .ch-chips{
    order:2;flex:0 0 auto;flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none;
    gap:6px;margin:0;padding:6px 12px 2px;background:var(--bg,#fff);
  }
  #cfg-hub.ch-m-chat .ch-chips::-webkit-scrollbar{display:none}
  #cfg-hub.ch-m-chat .ch-chips button{flex:0 0 auto;white-space:nowrap;font-size:.76rem;padding:7px 13px}
  /* caja de texto fija abajo */
  #cfg-hub.ch-m-chat .ch-form{
    order:3;flex:0 0 auto;gap:8px;align-items:center;padding:8px 12px calc(10px + env(safe-area-inset-bottom));background:var(--bg,#fff);border-top:1px solid var(--bg3);
  }
  #cfg-hub.ch-m-chat .ch-form input{font-size:16px;padding:12px 16px;border-radius:24px}   /* 16px: iOS no hace zoom al enfocar */
  #cfg-hub.ch-m-chat .ch-form button{flex:0 0 auto;height:44px;min-width:44px;padding:0 16px;border-radius:24px}
  body.hub-chat.hub-kb #cfg-hub.ch-m-chat .ch-form{padding-bottom:10px}   /* con teclado no hace falta el margen del home-bar */
}

/* Guía de onboarding en móvil: va DEBAJO de Opciones (no en el chat a pantalla completa) */
@media (max-width:760px){
  #cfg-hub:not(.ch-m-chat) .ch-row{display:block!important;margin-top:12px}
  #cfg-hub:not(.ch-m-chat) .ch-chat{display:none}
  #cfg-hub:not(.ch-m-chat) .ch-ob{display:block!important;flex:none;max-width:none;width:100%}
}

/* Fix: el contenido nunca debe ser más ancho que la pantalla (chips en fila + barrita de guía) */
@media (max-width:760px){
  #cfg-hub.ch-m-chat,#cfg-hub.ch-m-chat .ch-row,#cfg-hub.ch-m-chat .ch-chat,#cfg-hub.ch-m-chat .ch-stage{width:100%;max-width:100%;min-width:0;box-sizing:border-box}
  #cfg-hub.ch-m-chat .ch-chat>*{min-width:0;max-width:100%;box-sizing:border-box}
  #cfg-hub.ch-m-chat .ch-chips{width:100%}
}

/* Chat a pantalla completa: sin barra de invitado ni burbuja de soporte encima (tapaban cabecera y sugerencias) */
@media (max-width:760px){
  body:has(#pg-cfg-bot.cfg-hub-on #cfg-hub.ch-m-chat) #nilo-support-bubble,
  body:has(#pg-cfg-bot.cfg-hub-on #cfg-hub.ch-m-chat) #aura-webchat-host{display:none!important}
}
@media (max-width:760px){ body.hub-chat #s-dash .topbar{display:none!important} }
@media (max-width:760px){ body.hub-chat #aura-guestbar{display:none!important} }

/* Si ya estás viendo la guía (Opciones del asistente), el botón flotante «Continuar configuración» sobra */
@media (max-width:760px){
  body:has(#pg-cfg-bot.cfg-hub-on.active #cfg-hub:not(.ch-m-chat)) #aura-ob-fab{display:none!important}
}

/* Espacio vacío al final del scroll (como en Town): el último elemento puede subir por encima de la barra
   inferior, el botón flotante «Continuar configuración» y la burbuja de soporte. Solo móvil. */
@media (max-width:760px){
  #s-dash .content{ padding-bottom:calc(220px + env(safe-area-inset-bottom)) !important; }
  #s-dash .mp-scroll{ padding-bottom:calc(220px + env(safe-area-inset-bottom)) !important; }
  body.hub-chat #s-dash .content{ padding-bottom:0 !important; }
}

/* los botones heredan la tipografía del panel (evita que los que llevan estilo en línea caigan a la fuente del navegador) */
button,input,select,textarea{font-family:inherit}

/* Scroll fluido y limpio en móvil: inercia nativa, sin rebote que arrastre la página, sin barras visibles,
   y barras fijas en su propia capa para que no "tiemblen" al desplazar. */
@media (max-width:760px){
  #s-dash .content,#s-dash .mp-scroll,#s-dash #conv-list,#s-dash .msgs,#s-dash .tw,#cfg-hub .ch-msgs,
  #inbox-stages,#inbox-areas,#inbox-chips,#cfgtabs,#storetabs{
    -webkit-overflow-scrolling:touch;
    overscroll-behavior:contain;
    scrollbar-width:none;
  }
  #s-dash .content::-webkit-scrollbar,#s-dash .mp-scroll::-webkit-scrollbar,#s-dash #conv-list::-webkit-scrollbar,
  #s-dash .msgs::-webkit-scrollbar,#s-dash .tw::-webkit-scrollbar,#cfg-hub .ch-msgs::-webkit-scrollbar,
  #inbox-stages::-webkit-scrollbar,#inbox-areas::-webkit-scrollbar,#inbox-chips::-webkit-scrollbar,
  #cfgtabs::-webkit-scrollbar,#storetabs::-webkit-scrollbar{display:none;width:0;height:0}
  #s-dash .content{scroll-behavior:smooth;overscroll-behavior-y:none}
  #inbox-stages,#inbox-areas,#inbox-chips,#cfgtabs,#storetabs{scroll-snap-type:none;overscroll-behavior-x:contain}
  .mbottom,#s-dash .topbar{transform:translateZ(0);will-change:transform}
  html,body{-webkit-tap-highlight-color:transparent}
}
@media (prefers-reduced-motion:reduce){ #s-dash .content{scroll-behavior:auto} }
