/* TEMVIO RC2.7.1-HF6 — Android Chat IME Stability
   Keep the composer inside the VisualViewport and never let the document
   jump when the user starts typing. Loaded after legacy chat/keyboard CSS. */

@media (max-width: 760px){
  html.temvio-keyboard-open.temvio-chat-composing,
  html.temvio-keyboard-open.temvio-chat-composing body{
    overscroll-behavior:none !important;
  }

  html.temvio-keyboard-open.temvio-chat-composing body{
    overflow:hidden !important;
    touch-action:pan-x pan-y;
  }

  html.temvio-keyboard-open.temvio-chat-composing #appShell,
  html.temvio-keyboard-open.temvio-chat-composing #view{
    min-height:0 !important;
  }

  html.temvio-keyboard-open.temvio-chat-composing .messages-layout{
    position:fixed !important;
    z-index:80 !important;
    top:calc(var(--temvio-vv-top, 0px) + max(4px,var(--temvio-inset-top-safe,0px))) !important;
    right:max(6px,var(--temvio-inset-right-safe,0px)) !important;
    left:max(6px,var(--temvio-inset-left-safe,0px)) !important;
    bottom:auto !important;
    height:calc(var(--temvio-vv-height,100dvh) - max(4px,var(--temvio-inset-top-safe,0px)) - 4px) !important;
    min-height:0 !important;
    max-height:none !important;
    margin:0 !important;
    overflow:hidden !important;
    transform:none !important;
  }

  html.temvio-keyboard-open.temvio-chat-composing .messages-layout .thread-list{
    display:none !important;
  }

  html.temvio-keyboard-open.temvio-chat-composing .chat-panel{
    display:grid !important;
    grid-template-rows:auto minmax(0,1fr) auto !important;
    height:100% !important;
    min-height:0 !important;
    max-height:100% !important;
    overflow:hidden !important;
    border-radius:16px 16px 0 0 !important;
  }

  html.temvio-keyboard-open.temvio-chat-composing .chat-head{
    min-height:48px !important;
    padding:8px 10px !important;
  }

  html.temvio-keyboard-open.temvio-chat-composing .chat-project-context{
    max-height:90px !important;
    overflow:auto !important;
  }

  html.temvio-keyboard-open.temvio-chat-composing .chat-messages{
    min-height:0 !important;
    overflow-y:auto !important;
    overscroll-behavior:contain !important;
    -webkit-overflow-scrolling:touch;
    padding:10px !important;
    scroll-padding-bottom:12px !important;
  }

  /* Keep textarea + Send on one row even on narrow phones. The previous
     <=480px rule stacked the Send button below the textarea and pushed the
     composer under the Android keyboard. */
  html.temvio-keyboard-open.temvio-chat-composing .chat-compose{
    position:relative !important;
    inset:auto !important;
    z-index:3 !important;
    display:grid !important;
    grid-template-columns:minmax(0,1fr) auto !important;
    align-items:end !important;
    gap:7px !important;
    padding:7px !important;
    padding-bottom:7px !important;
    margin:0 !important;
    background:#fbfaf7 !important;
    transform:none !important;
  }

  html.temvio-keyboard-open.temvio-chat-composing .chat-compose textarea{
    width:100% !important;
    min-width:0 !important;
    min-height:48px !important;
    height:auto !important;
    max-height:min(112px,26vh) !important;
    margin:0 !important;
    scroll-margin:0 !important;
    font-size:16px !important; /* prevents Android/WebView zoom-on-focus */
  }

  html.temvio-keyboard-open.temvio-chat-composing .chat-compose .btn{
    width:auto !important;
    min-width:70px !important;
    height:48px !important;
    margin:0 !important;
    align-self:end !important;
    padding-inline:14px !important;
  }
}
