/* Phone reply composer (Nov 1 2026).
   The full-screen composer used to pin everything to one fixed-height screen and squeeze
   the writing box into whatever space was left. With Email selected (To, From, Subject,
   writing tools, booking buttons, formatting toolbar) nothing was left, so the box
   collapsed to zero height, and vanished entirely once the keyboard opened.
   Now the whole composer scrolls as one page: the name bar stays at the top, Send stays
   at the bottom, and the writing box always keeps a usable height. Loaded last. */
@media (max-width:700px){
  body.mobile-compose-open #inlineReply{
    overflow-x:hidden!important;overflow-y:auto!important;
    -webkit-overflow-scrolling:touch;overscroll-behavior:contain;
  }
  body.mobile-compose-open #inlineReply > *{flex-shrink:0!important}
  body.mobile-compose-open #inlineReply .mobile-compose-header{position:sticky!important;top:0!important;z-index:6!important}

  /* Middle section: natural height, no inner clipping. */
  body.mobile-compose-open #inlineReply .inline-reply-text-wrap{
    flex:0 0 auto!important;height:auto!important;min-height:0!important;overflow:visible!important;
  }
  body.mobile-compose-open #inlineReply .inline-message-editor-shell{
    flex:0 0 auto!important;height:auto!important;max-height:none!important;
    min-height:max(220px,34dvh)!important;overflow:visible!important;
  }
  body.mobile-compose-open #inlineReply #inlineReplyText{
    flex:1 1 auto!important;height:auto!important;max-height:none!important;
    min-height:max(220px,34dvh)!important;overflow-y:visible!important;
  }

  /* Send bar stays reachable at the bottom while the page scrolls. */
  body.mobile-compose-open #inlineReply .inline-reply-footer{
    position:sticky!important;bottom:0!important;z-index:6!important;margin-top:auto!important;
  }

  /* To / From rows: wrap instead of running off the right edge. */
  body.mobile-compose-open #inlineReply .inline-delivery-target-row:not([hidden]){
    display:flex!important;flex-wrap:wrap!important;align-items:center!important;
    gap:4px 10px!important;width:100%!important;max-width:100%!important;min-width:0!important;
    margin:6px 0 0!important;padding:8px 0 0!important;border-top:1px solid #e6ecf1!important;box-sizing:border-box!important;
  }
  body.mobile-compose-open #inlineReply .inline-delivery-target-label{flex:0 0 auto!important;font-weight:700!important}
  body.mobile-compose-open #inlineReply #inlineDeliveryTargetValue{
    flex:1 1 auto!important;min-width:0!important;overflow-wrap:anywhere!important;white-space:normal!important;
  }
  body.mobile-compose-open #inlineReply #inlineEmailFromSelect{
    flex:1 1 auto!important;min-width:0!important;width:auto!important;max-width:100%!important;min-height:42px!important;
  }
  body.mobile-compose-open #inlineReply .inline-delivery-validation-state{
    flex:1 1 100%!important;min-width:0!important;white-space:normal!important;overflow-wrap:anywhere!important;
    font-size:13px!important;line-height:1.35!important;color:#6b7a89!important;
  }
  body.mobile-compose-open #inlineReply .inline-delivery-target-editor:not([hidden]){
    display:flex!important;flex-wrap:wrap!important;gap:8px!important;max-width:100%!important;
  }
  body.mobile-compose-open #inlineReply .inline-delivery-target-editor select,
  body.mobile-compose-open #inlineReply .inline-delivery-target-editor input{flex:1 1 100%!important;min-width:0!important;max-width:100%!important}

  /* Subject: label above the field so the field gets the full width. */
  body.mobile-compose-open #inlineReply .inline-email-subject-row:not([hidden]){
    display:flex!important;flex-direction:column!important;align-items:stretch!important;gap:4px!important;margin:4px 0 10px!important;
  }
  body.mobile-compose-open #inlineReply .inline-email-subject-row input{width:100%!important;min-width:0!important;box-sizing:border-box!important;min-height:44px!important}

  /* Nothing inside the composer may push the page sideways. */
  body.mobile-compose-open #inlineReply .inline-delivery-panel,
  body.mobile-compose-open #inlineReply .inline-reply-text-wrap,
  body.mobile-compose-open #inlineReply #inlineSharedToolbar,
  body.mobile-compose-open #inlineReply .inline-dynamic-fields{max-width:calc(100vw - 24px)!important;min-width:0!important;box-sizing:border-box!important}
  body.mobile-compose-open #inlineReply #inlineSharedToolbar *{max-width:100%}

  /* Writing box first (Nov 4 2026, Mark). On a phone the writing box sat below the
     AI buttons, shortcuts, Dynamic fields and call buttons, so Reply opened with it
     mostly off the bottom of the screen. Same pieces, new order: Subject (email),
     formatting bar, writing box, email closing, then the writing tools below it. */
  body.mobile-compose-open #inlineReply .inline-reply-text-wrap{display:flex!important;flex-direction:column!important}
  body.mobile-compose-open #inlineReply #inlineEmailSubjectRow{order:1!important}
  body.mobile-compose-open #inlineReply #inlineSharedToolbar{order:2!important}
  body.mobile-compose-open #inlineReply .inline-message-editor-shell{order:3!important}
  body.mobile-compose-open #inlineReply #inlineEmailClosingWrap{order:4!important}
  body.mobile-compose-open #inlineReply #inlineMessageEditorChrome{order:5!important}
  body.mobile-compose-open #inlineReply #inlineWritingToolsToggle{order:6!important}
  body.mobile-compose-open #inlineReply #inlineAiAssistant{order:7!important;margin-top:10px!important}
  body.mobile-compose-open #inlineReply #inlineDynamicFields{order:8!important;margin-bottom:10px!important}
}