/* Keep AI chat inside the viewport; only the message pane scrolls. */
body:is(.chat-ai-mode, .audio-mode) #topbarProjectSwitcher { display: none !important; }
body:is(.chat-ai-mode, .audio-mode) { margin: 0; height: 100dvh; overflow: hidden; overscroll-behavior: none; }
body:is(.chat-ai-mode, .audio-mode) .app { height: 100dvh; min-height: 0; max-height: 100dvh; overflow: hidden; }
body:is(.chat-ai-mode, .audio-mode) .content { box-sizing: border-box; height: 100%; min-height: 0; display: flex; flex-direction: column; padding: 16px 24px; overflow: hidden; }
body:is(.chat-ai-mode, .audio-mode) .topbar { display: none; }
body:is(.chat-ai-mode, .audio-mode) .sidebar { box-sizing: border-box; height: 100%; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
#chatAiView.active { display: flex; flex: 1 1 0; flex-direction: column; min-height: 0; overflow: hidden; }
#chatAiView .chat-ai-shell { box-sizing: border-box; flex: 1 1 0; min-height: 0; min-width: 0; height: 100%; overflow: hidden; }
#chatAiView .chat-ai-header { flex: 0 0 auto; }
#chatAiView .chat-thread { box-sizing: border-box; flex: 1 1 0; min-height: 0; max-height: none; overflow-y: auto; overscroll-behavior: contain; overflow-anchor: none; }
#chatAiView .chat-thread > * { flex-shrink: 0; }
#chatAiView .chat-composer { flex: 0 0 auto; min-width: 0; }
#chatAiView .chat-prompt-input { resize: none; max-height: min(128px, 20dvh); }
#chatAiView .chat-attachment-preview { max-height: min(110px, 20dvh); overflow-y: auto; }
#chatAiView #chatPromptStatus:empty { display: none; }
@media (max-width: 980px) {
  body:is(.chat-ai-mode, .audio-mode) .content { padding: 8px 12px calc(64px + env(safe-area-inset-bottom)); }
  body:is(.chat-ai-mode, .audio-mode) .topbar { display: block; left: auto; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); width: 40px; height: 40px; min-height: 0 !important; margin: 0; padding: 0; }
  body:is(.chat-ai-mode, .audio-mode) .topbar .hamburger { top: 0; right: 0; margin: 0; }
  #chatAiView .chat-ai-shell { padding: 14px; gap: 12px; }
  #chatAiView .chat-thread { padding: 12px; }
  #chatAiView .chat-prompt-input { min-height: 68px; }
}

#audioGenerateView.active { display: flex; flex: 1 1 0; min-height: 0; height: 100%; overflow: hidden; }
#audioGenerateView .audio-iframe { flex: 1 1 0; height: 100%; min-height: 0; border: 0; }
