/* The current shell owns layout; older absolute-positioned composer rules must not leak in. */
body.workspace-next #chatOmnibox > :is(button,.input-model-switcher) { position: static !important; inset: auto !important; transform: none !important; flex-shrink: 0; }
body.workspace-next #chatOmnibox .input-model-switcher { min-width: 0 !important; }
body.workspace-next #chatOmnibox .model-switcher { max-width: 100% !important; }
body.workspace-next .workspace-intro img { object-fit: contain; }
body.workspace-next .workspace-intro :is(h1,p), body.workspace-next .specialist-copy { overflow-wrap: anywhere; min-width: 0; }
body.workspace-next .sidebar-brand { min-width: 0; }
body.workspace-next .sidebar-brand > div { min-width: 0; }
body.workspace-next .sidebar-brand strong { overflow-wrap: anywhere; }
body.workspace-next .modal-content { max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
body.workspace-next .modal-content :is(input,select,textarea) { max-width: 100%; min-width: 0; }

@media (max-width:900px) {
    body.workspace-next:not(.tool-open) { height: 100dvh; min-height: 0; }
    body.workspace-next:not(.tool-open) #mainContent,
    body.workspace-next:not(.tool-open) #homeView,
    body.workspace-next:not(.tool-open) .ai-workspace { height: 100%; min-height: 0; }
    body.workspace-next:not(.tool-open) .chat-main { min-height: 0; max-width: 100%; }
    body.workspace-next #aiWorkspace .chat-topbar { display: flex !important; flex-flow: row nowrap !important; align-items: center; gap: 8px; padding: 8px 12px 8px 64px !important; min-height: 64px; flex-shrink: 0; }
    body.workspace-next #aiWorkspace .mobile-brand { position: static !important; inset: auto !important; transform: none !important; width: auto !important; max-width: none !important; min-width: 0; min-height: 44px; padding: 0 !important; margin: 0 !important; justify-content: flex-start; flex: 1; font-size: 17px; overflow-wrap: anywhere; }
    body.workspace-next .mobile-brand span { color: var(--desk-ink); }
    body.workspace-next #aiWorkspace .workspace-top-actions { position: static !important; inset: auto !important; transform: none !important; display: flex; gap: 4px; flex: 0 0 auto; }
    body.workspace-next .workspace-top-actions > button { min-width: 44px; min-height: 44px; margin: 0; }
    body.workspace-next .mobile-sidebar-toggle { width: 44px; height: 44px; min-height: 44px; top: 10px; left: 12px; padding: 0; border-radius: 6px; box-shadow: none; background: var(--desk-bg); color: var(--desk-ink); }
    body.workspace-next .workspace-sidebar,
    body.workspace-next.tool-open .workspace-sidebar { height: 100dvh; width: min(310px, calc(100vw - 48px)); padding: 18px 14px max(16px,env(safe-area-inset-bottom)); z-index: 50; }
    body.workspace-next .workspace-sidebar .sidebar-collapse-btn { display: none; }
    body.workspace-next .workspace-sidebar :is(.workspace-nav-item,.specialist-nav button,.history-item,.new-chat-btn,.sidebar-settings-btn) { min-height: 44px; }
    body.workspace-next.sidebar-collapsed:not(.tool-open) .specialist-nav button span,
    body.workspace-next.sidebar-collapsed:not(.tool-open) .specialist-nav .sidebar-section-title { display: block; }
    body.workspace-next.sidebar-collapsed:not(.tool-open) .specialist-nav button { justify-content: flex-start; padding: 8px 12px; }
    body.workspace-next.sidebar-collapsed .workspace-sidebar :is(.sidebar-brand > div,.new-chat-btn > div,.nav-label,.sidebar-section-title,.chat-history-list,.sidebar-user-meta,.history-section) { display: block; }
    body.workspace-next.sidebar-collapsed .workspace-sidebar .sidebar-brand { display: flex; }
    body.workspace-next.sidebar-collapsed .workspace-sidebar :is(.sidebar-top,.new-chat-btn,.workspace-nav-item) { justify-content: flex-start; }
    body.workspace-next.sidebar-collapsed .workspace-sidebar .sidebar-user { flex-direction: row; justify-content: flex-start; }
    body.workspace-next.sidebar-open .mobile-sidebar-toggle { z-index: 60; left: auto; right: 2px; background: var(--desk-bg); }
    body.workspace-next .chat-main.has-messages { display: flex; flex-direction: column; overflow: hidden; }
    body.workspace-next .chat-main.has-messages .chat-scroll { min-height: 0; flex: 1 1 auto; overflow-y: auto; padding: 16px; }
    body.workspace-next .chat-main.has-messages .chat-view { padding: 0 0 16px !important; }
    body.workspace-next:not(.tool-open) .chat-main .omnibox-shell,
    body.workspace-next:not(.tool-open) .chat-main.has-messages .omnibox-shell { position: relative !important; inset: auto !important; transform: none !important; width: 100% !important; max-width: 100% !important; margin: 0 !important; flex-shrink: 0; padding: 12px 16px max(16px, env(safe-area-inset-bottom)) !important; }
    body.workspace-next:not(.tool-open) .chat-main.is-empty-chat .omnibox-shell { padding: 28px 20px max(28px, env(safe-area-inset-bottom)) !important; }
    body.workspace-next .modal-overlay { padding: max(12px,env(safe-area-inset-top)) 12px max(12px,env(safe-area-inset-bottom)); }
    body.workspace-next .modal-overlay .modal-content { width: 100%; max-width: 580px; padding: 20px; max-height: calc(100dvh - 32px); margin: auto; border-radius: 8px; }
    body.workspace-next .modal-content :is(input,select,textarea) { font-size: 16px; }
    body.workspace-next .modal-content button { min-height: 44px; }
    body.workspace-next .modal-content :is(.setting-row,.settings-grid,.custom-api-grid) { min-width: 0; }
    body.workspace-next .modal-content :is(h3,p,label,code) { overflow-wrap: anywhere; }
    body.workspace-next .agent-filters button { min-height: 44px; }
    body.workspace-next .agent-search { min-height: 44px; }
    body.workspace-next .agent-search input { font-size: 16px; }
    body.workspace-next .artifact-panel { max-height: calc(100dvh - 32px); padding-bottom: max(12px,env(safe-area-inset-bottom)); }
    body.workspace-next .artifact-entry-actions { flex-wrap: wrap; }
    body.workspace-next .artifact-entry :is(h3,p,code) { overflow-wrap: anywhere; }
    body.workspace-next .artifact-version-editor textarea { font-size: 16px; }
}
@media (max-width:900px) {
    body.workspace-next .workspace-intro { grid-template-columns: 48px minmax(0,1fr) !important; column-gap: 12px !important; row-gap: 2px !important; margin-bottom: 24px !important; }
    body.workspace-next .workspace-intro img { width: 48px; height: 48px; grid-row: 1 / 3; }
    body.workspace-next .workspace-intro h1 { font-size: 25px !important; line-height: 1.4; }
    body.workspace-next .workspace-intro p { grid-column: 2; font-size: 14px; line-height: 1.6; margin: 0; }
    body.workspace-next #chatOmnibox { display: grid !important; grid-template-columns: 44px minmax(0,1fr) 44px 44px !important; grid-template-rows: auto 44px 44px !important; gap: 8px !important; padding: 12px !important; width: 100%; min-width: 0; }
    body.workspace-next #chatOmnibox #chatInput { grid-column: 1 / -1 !important; grid-row: 1 !important; order: 0 !important; font-size: 16px !important; line-height: 1.6; min-height: 80px; max-height: min(180px,30dvh); padding: 2px 2px 8px !important; }
    body.workspace-next .chat-main.has-messages #chatOmnibox #chatInput { min-height: 44px; }
    body.workspace-next #chatOmnibox .input-model-switcher { grid-column: 1 / 3 !important; grid-row: 2 !important; order: 0 !important; width: 100% !important; height: 44px !important; max-width: none !important; margin: 0 !important; display: block !important; }
    body.workspace-next #chatOmnibox .model-switcher { width: 100% !important; min-width: 0 !important; height: 44px !important; min-height: 44px !important; padding: 0 10px !important; display: flex; gap: 6px; justify-content: space-between; border-radius: 6px !important; background: var(--desk-soft) !important; color: var(--desk-ink) !important; border: 1px solid var(--desk-line) !important; box-shadow: none !important; }
    body.workspace-next #chatOmnibox .model-switcher span { min-width: 0 !important; max-width: none !important; flex: 1; overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important; font-size: 13px !important; }
    body.workspace-next #chatOmnibox .model-switcher b { flex: 0 0 auto; }
    body.workspace-next #chatOmnibox > :is(button,.input-model-switcher) { order: 0 !important; }
    body.workspace-next #chatOmnibox > button { display: inline-flex !important; align-items: center; justify-content: center; height: 44px !important; min-height: 44px !important; min-width: 44px !important; width: 44px !important; padding: 0 !important; margin: 0 !important; }
    body.workspace-next #chatOmnibox .web-search-toggle { grid-column: 3 / 5 !important; grid-row: 2 !important; width: 100% !important; gap: 4px; padding: 0 4px !important; }
    body.workspace-next #chatOmnibox .web-search-toggle span { font-size: 12px !important; white-space: nowrap; }
    body.workspace-next #chatOmnibox .web-search-toggle i { font-size: 17px; flex: 0 0 auto; }
    body.workspace-next #chatOmnibox .attach-btn { grid-column: 1 !important; grid-row: 3 !important; }
    body.workspace-next #chatOmnibox .voice-btn { grid-column: 2 !important; grid-row: 3 !important; justify-self: start; }
    body.workspace-next #chatOmnibox .send-btn { grid-column: 4 !important; grid-row: 3 !important; background: var(--desk-ink); color: var(--desk-bg); }
    body.workspace-next #modelMenu { position: fixed !important; left: 12px !important; right: 12px !important; top: auto !important; bottom: max(12px,env(safe-area-inset-bottom)) !important; width: auto !important; max-width: none !important; max-height: calc(100dvh - 96px) !important; overflow-y: auto; transform: none !important; z-index: 10000 !important; border-radius: 8px !important; overscroll-behavior: contain; }
    body.workspace-next #modelMenu button { min-height: 48px; white-space: normal; overflow-wrap: anywhere; }
    body.workspace-next .home-specialist { min-width: 0; }
    body.workspace-next .home-specialist strong { font-size: 13px; overflow-wrap: anywhere; }
    body.workspace-next .home-specialists { gap: 8px; }
    body.workspace-next .starter-item { min-height: 64px; }
    body.workspace-next .starter-item strong { font-size: 14px; }
    body.workspace-next .starter-item small { font-size: 12px; }
    body.workspace-next .message-bubble { min-width: 0; overflow-wrap: anywhere; font-size: 16px; }
    body.workspace-next .message-bubble :is(pre,table) { max-width: 100%; overflow-x: auto; }
    body.workspace-next .settings-tabs { display: flex; flex-wrap: wrap; }
    body.workspace-next .settings-grid { grid-template-columns: minmax(0,1fr); }
}
