/* LL AI v66.12 — PHONE ONLY. Tablet + desktop behavior remains unchanged. */
@media (max-width:699px){
  :root{--ll-phone-edge:max(10px,env(safe-area-inset-left));--ll-phone-edge-r:max(10px,env(safe-area-inset-right))}
  html,body{max-width:100%;overflow-x:hidden!important}

  /* Top bar: never let controls or the title push each other off-screen. */
  .topbar{box-sizing:border-box!important;width:100%!important;min-width:0!important;padding:8px var(--ll-phone-edge-r) 8px var(--ll-phone-edge)!important;gap:7px!important;overflow:hidden!important}
  .topbar #openSide{flex:0 0 44px!important;width:44px!important;min-width:44px!important;height:44px!important;min-height:44px!important}
  .topbar #currentChatName{flex:1 1 auto!important;min-width:0!important;max-width:none!important;margin:0 2px!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important}
  .topbar .topActions,.topbar #topActions{display:flex!important;flex:0 0 auto!important;min-width:0!important;gap:6px!important;align-items:center!important}
  .topbar #topCommands.commandTopBtn,.topbar #tempChatBtn.llTempChatBtn{flex:0 0 44px!important;width:44px!important;min-width:44px!important;height:44px!important;min-height:44px!important}

  /* Once a real chat starts, Temporary Chat leaves the PHONE header just like tablet.
     The feature itself is untouched and returns on a new/empty chat. */
  #tempChatBtn[hidden],body.llChatStarted #tempChatBtn,body.llChatStarted #tempChatBtn.llTempChatBtn{display:none!important}

  /* Sidebar uses the visual phone viewport and is scrollable as one surface. */
  .side,.sidebar{box-sizing:border-box!important;width:min(90vw,360px)!important;max-width:90vw!important;height:100dvh!important;max-height:100dvh!important;overflow-y:auto!important;overflow-x:hidden!important;overscroll-behavior:contain!important;padding-bottom:calc(20px + env(safe-area-inset-bottom))!important}
  .side *,.sidebar *{min-width:0}
  .side .brandRow,.sidebar .brandRow{position:sticky!important;top:0!important;z-index:8!important;background:var(--theme-bg,#080b14)!important}
  .sidebarQuickActions,.sideQuickActions,.sideTools,.sideFooter{box-sizing:border-box!important;width:100%!important;max-width:100%!important}
  .sidebarQuickActions button,.sideQuickActions button,.sideTools button{min-width:0!important;max-width:100%!important}

  /* Message/action rows never clip on narrow phones. */
  .chat{box-sizing:border-box!important;width:100%!important;padding-left:14px!important;padding-right:14px!important;padding-bottom:calc(126px + env(safe-area-inset-bottom))!important;overflow-x:hidden!important}
  .msgrow,.message,.assistantMessage,.userMessage{min-width:0!important;max-width:100%!important}
  .msgrow>.msgActions,.assistantActions{max-width:100%!important;flex-wrap:wrap!important;overflow:visible!important}

  /* Composer: fit plus/text/mic/voice without cutting the right edge. */
  .composer{box-sizing:border-box!important;width:100%!important;padding-left:max(8px,env(safe-area-inset-left))!important;padding-right:max(8px,env(safe-area-inset-right))!important}
  .composebox{box-sizing:border-box!important;max-width:100%!important;min-width:0!important;overflow:hidden!important;gap:4px!important}
  .composebox textarea,#question{min-width:0!important;max-width:100%!important;flex:1 1 0!important}
  .composebox>#attach,.composebox>#voice.composerDictation,.composebox>#send.composerPrimary{flex:0 0 44px!important;width:44px!important;min-width:44px!important;height:44px!important;min-height:44px!important}

  /* Voice controls stay above Android/Chrome bottom UI and toast. */
  #voiceOverlay{width:100vw!important;height:100dvh!important;min-height:100dvh!important;overflow:hidden!important}
  #voiceOverlay:not([hidden])>#closeVoice.llPolishedIcon{right:max(14px,env(safe-area-inset-right))!important;bottom:calc(max(18px,env(safe-area-inset-bottom)) + 4px)!important}
  #voiceOverlay:not([hidden]) .voiceControls{right:84px!important;bottom:calc(max(18px,env(safe-area-inset-bottom)) + 4px)!important}
  #voiceOverlay #voiceStatus,#voiceOverlay .voiceStatus{max-width:calc(100vw - 32px)!important}

  #toast,.toast,.llToast{box-sizing:border-box!important;max-width:calc(100vw - 24px)!important;left:50%!important;right:auto!important;bottom:calc(88px + env(safe-area-inset-bottom))!important}
}
@media (max-width:380px){
  .topbar{gap:5px!important}
  .topbar #openSide,.topbar #topCommands.commandTopBtn,.topbar #tempChatBtn.llTempChatBtn{width:42px!important;min-width:42px!important;height:42px!important;min-height:42px!important;flex-basis:42px!important}
  .topbar #currentChatName{font-size:16px!important}
  .composebox>#attach,.composebox>#voice.composerDictation,.composebox>#send.composerPrimary{width:42px!important;min-width:42px!important;height:42px!important;min-height:42px!important;flex-basis:42px!important}
}
