/* Single mobile shell, after desktop/component styles. Business controls stay shared. */
.mobile-toolbar { display:none; }
#mobilePanel:not([open]) { display:none; }
@media (max-width:920px) {
  html:not(.ui-v31) body #app.app-shell { position:fixed; top:var(--mobile-top,0px); left:0; display:block; width:100%; height:var(--mobile-height,100dvh); min-height:0; overflow:hidden; }
  html:not(.ui-v31) #app > .workspace { display:flex; flex-direction:column; width:100%; height:100%; min-height:0; overflow:hidden; }
  html:not(.ui-v31) #app.app-shell, #app > .workspace, #app #workbench, #app #chatPanel { transition:none; }
  html body #app.app-shell .resize-handle { display:none!important; }
  #app .topbar { display:block; flex:none; height:auto; min-height:0; padding:env(safe-area-inset-top) 10px 0; }
  #app .topbar > .global-navigation, #app .topbar > .scope-controls { display:none; }
  #app .mobile-toolbar { display:block; }
  .mobile-toolbar-row { display:flex; align-items:center; gap:4px; min-height:56px; }
  .mobile-toolbar button { flex:none; min-height:44px; min-width:44px; padding:8px; border:0; border-radius:10px; background:transparent; color:#36566f; font:500 13px/1.4 var(--font-ui); }
  .mobile-toolbar button:focus-visible { outline:2px solid #53c0d6; outline-offset:-2px; }
  #mobileScope { flex:1; min-width:0; }
  #mobileScope > .workbench-scope { width:100%; margin:0; padding:5px 8px; min-height:48px; border:0; box-shadow:none; background:#193a59; }
  #mobileScope .workbench-shop-icon, #mobileScope .workbench-shop-label, #mobileScope .workbench-shop-switch { display:none; }
  #mobileScope .workbench-shop-copy { position:relative; padding-right:15px; }
  #mobileScope .workbench-shop-copy::after { content:'⌄'; position:absolute; right:0; top:0; color:#c2edf5; }
  #mobileScope .workbench-shop-copy strong { font-size:15px; line-height:1.5; }
  #mobileScope .workbench-shop-copy small { display:block; font-size:11px; line-height:1.4; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
  .mobile-scope-fallback { display:none; padding:8px; font-size:15px; font-weight:600; }
  #mobileScope:has(>button[hidden]) .mobile-scope-fallback { display:block; }
  #mobileNotifications:empty { display:none; }
  .mobile-section-nav { display:flex; gap:4px; padding:2px 0 6px; }
  .mobile-section-nav button { flex:1; min-width:0; min-height:44px; background:#f3f7fa; }
  .mobile-section-nav button.is-current { color:#245c71; background:linear-gradient(115deg,#eaf7f4,#eef4fa); }
  #app #workbench { flex:1; display:block; height:auto; min-height:0; overflow:hidden; padding:0; }
  #app #workbench > .context-panel { display:none!important; }
  #app #chatPanel { height:100%; min-height:0; max-height:none; border:0; }
  #app #conversation { height:100%; max-height:none; min-height:0; overscroll-behavior:contain; scrollbar-gutter:auto; }
  #app .composer { margin:0; padding:8px 12px max(10px,env(safe-area-inset-bottom)); background:#f6f9fc; }
  #app .composer-box { max-width:none; padding:8px 10px; border-radius:16px; }
  #app .composer textarea { font-size:16px; min-height:40px; max-height:min(140px,25dvh); line-height:1.5; padding:7px 2px; }
  #app .composer-foot { margin:0; gap:8px; }
  #app .composer-foot button, #app .composer-context button { min-width:44px; min-height:44px; font-size:14px; }
  #app .composer-context { max-height:110px; overflow:auto; }
  #app .composer-context small { font-size:12px; }
  #app.mobile-keyboard .mobile-section-nav { display:none; }
  #app.mobile-keyboard .composer { padding-bottom:6px; }
  #app .conversation > .message { margin:16px 12px; padding:0; gap:8px; }
  #app .conversation > .message.assistant { margin-left:12px; margin-right:12px; }
  #app .conversation > .message.assistant > .agent-avatar { width:26px; height:26px; margin-top:5px; }
  #app .conversation > .message.assistant > .agent-avatar img { width:20px; height:20px; }
  #app .conversation > .message.assistant > .message-stack { min-width:0; width:100%; max-width:calc(100% - 34px); }
  #app .message .bubble { font-size:16px; line-height:1.75; padding:13px 14px; border-radius:14px; }
  #app .message.user .message-stack { max-width:90%; }
  #app .markdown-demo :is(h2,h3) { font-size:18px; }
  #app .markdown-demo .md-table::before { content:'左右滑动查看完整表格'; display:block; padding:8px 10px; color:#62788c; font-size:12px; background:#f4f8fb; }
  #app .markdown-demo .md-table :is(th,td) { font-size:13px; padding:10px; }
  #app .markdown-demo .table-scroll { overscroll-behavior-x:contain; }
  #app .markdown-demo .md-table th:first-child { position:sticky; left:0; background:#f1f5f8; z-index:1; }
  #app .markdown-demo .md-table td:first-child { position:sticky; left:0; background:#fff; z-index:1; }
  #app .welcome-start { padding:24px 16px; }
  #app .welcome-start .agent-avatar.hero { width:42px; height:42px; margin-bottom:12px; }
  #app .welcome-start h1 { font-size:23px; }
  #app .welcome-actions { margin-top:18px; }
  #app .welcome-actions .welcome-action { padding:12px; gap:8px; }
  #app .thinking { max-height:28%; overflow:auto; }
  #app .thinking :is(small,b), #app .run-progress-line { font-size:12px; }
  #app .thinking-stop { min-height:44px; }

  /* Native modal supplies focus containment and a single scroll surface. */
  #mobilePanel[open] { position:fixed; inset:0; margin:0; width:100%; max-width:none; height:var(--mobile-height,100dvh); max-height:none; display:flex; flex-direction:column; border:0; border-radius:0; padding:0; color:var(--ink); background:#f6f9fc; }
  #mobilePanel > header { flex:none; display:flex; align-items:center; justify-content:space-between; padding:max(8px,env(safe-area-inset-top)) 16px 8px; border-bottom:1px solid #dfe7ef; background:white; }
  #mobilePanelTitle { font-size:18px; }
  #mobilePanelClose { min-height:44px; min-width:64px; border:0; border-radius:9px; background:#edf5f8; color:#315b72; font-size:14px; }
  #mobilePanelBody { flex:1; min-height:0; display:flex; flex-direction:column; overflow:auto; padding-bottom:env(safe-area-inset-bottom); overscroll-behavior:contain; }
  #mobilePanel .conversation-workspace { display:flex; flex:1; align-items:stretch; width:100%; height:100%; min-height:0; max-height:none; padding:12px 16px; border:0; }
  #mobilePanel .conversation-workspace > nav, #mobilePanel .sidebar-create-actions { flex:none; width:100%; }
  #mobilePanel .conversation-workspace-header, #mobilePanel .conversation-workspace-foot { display:none; }
  #mobilePanel .conversation-workspace :is(.sidebar-create-actions > button,nav button) { height:auto; min-height:44px; font-size:14px; }
  #mobilePanel .sidebar-create-actions button b, #mobilePanel .sidebar-conversation-row strong, #mobilePanel .long-task-row strong { font-size:14px; }
  #mobilePanel .sidebar-conversation-row small, #mobilePanel .long-task-row small { font-size:12px; }
  #mobilePanel .sidebar-conversation-item { grid-template-columns:minmax(0,1fr) 44px; }
  #mobilePanel .sidebar-conversation-more { min-width:44px; min-height:44px; opacity:1; }
  #mobilePanel .context-panel { display:flex; flex-direction:column; flex:1; width:100%; min-height:0; height:auto; padding:14px 16px; overflow:visible; border:0; gap:16px; }
  #mobilePanel .context-panel > * { flex:none; }
  #mobilePanel .section-title > span { font-size:15px; }
  #mobilePanel :is(.section-title button,.workbench-reset-row button,.workbench-customize-card) { min-height:44px; font-size:13px; }
  #mobilePanel .workbench-customize-card strong { font-size:14px; }
  #mobilePanel .workbench-customize-card small, #mobilePanel .workbench-reset-row { font-size:12px; }
  #mobilePanel .workbench-simplified .workbench-flat button { min-height:54px; padding:10px; }
  #mobilePanel .workbench-flat button strong { font-size:14px; }
  #mobilePanel .workbench-flat button small, #mobilePanel .workbench-entry-note { font-size:12px; }
  #mobilePanel .workbench-continuous :is(strong,i) { font-size:14px; }
  #mobilePanel .workbench-continuous :is(small,b) { font-size:12px; }
  #mobilePanel :is(#openBusinessGoalDialog,#openAdsDelegation,#openContinuousWork) { min-height:76px!important; height:auto; padding:12px; line-height:1.5; background:linear-gradient(115deg,#f2fafb,#f6f6fc); }
  #mobilePanel small { font-weight:400; }
  #mobilePanel[data-panel=menu] #mobilePanelBody { padding:18px 16px; gap:16px; }
  #mobilePanel .workspace-modes { display:grid; flex:none; grid-template-columns:1fr; gap:6px; padding:8px; }
  #mobilePanel .workspace-modes button { min-height:48px; font-size:15px; text-align:left; }
  #mobilePanel .workspace-modes button[aria-current=page] { background:#e8f4f8; color:#245c71; }
  #mobilePanel .conversation-tabs button:not(.active) { background:transparent; }
  #mobilePanel .topbar-session-actions { display:grid; gap:8px; }
  #mobilePanel .topbar-tool-button { display:flex; width:100%; min-height:48px; padding:10px; gap:10px; }
  #mobilePanel .topbar-tool-button span { display:inline; font-size:15px; }
  #mobilePanel #memberMenuButton { display:flex; position:static; width:100%; min-height:48px; gap:12px; padding:8px; }
  #mobilePanel #memberMenuButton b { display:block; font-size:15px; }
  #mobilePanel button:focus-visible { outline:2px solid #53c0d6; outline-offset:-2px; }
  #scopeSwitcherPopover :is(input,button) { font-size:16px; min-height:44px; }
  #scopeSwitcherPopover .scope-option strong { font-size:14px; }
  #mobilePanel .sidebar-conversation-menu button { min-height:44px; font-size:14px; }
  #notificationPopover button { min-height:44px; font-size:14px; }
  #notificationPopover :is(p,small) { font-size:12px; }
  #app .composer-attachment { font-size:13px; }
  #app .composer-attachment small { font-size:12px; }
  #app .composer-attachment button { min-width:44px; min-height:44px; }

  #app .single-video-result .script-message-card { margin-top:12px; padding-top:12px; }
  #app .single-video-result .single-result-grid { gap:8px; }
  #app .single-video-result :is(.script-detail-copy,.script-detail-summary) { font-size:15px; }
  #app .single-video-result :is(button,summary) { min-height:44px; }
  #app .single-video-result :is(button,small,.script-detail-note) { font-size:13px; }
  #app .single-video-result .script-detail-toolbar { gap:8px; }
  #app .single-video-result .script-detail-shots > li { padding:12px 0; }
  #app .single-video-result :is(input,textarea,select) { font-size:16px; }
  .single-video-player.is-floating .single-video-player-tools { opacity:1; }
  .single-video-player .single-video-player-tools button { min-width:36px; min-height:40px; }
  .single-video-player .single-video-resize { width:30px; height:30px; }
  .single-video-player.is-floating .single-video-player-tools { padding-inline:32px; }
  #app .ct-scroll { padding:14px 12px; }
  #app .ct-task-toolbar { padding:8px 12px; }
  #app .ct-page :is(button,summary), #app .multi-shop-workspace button { min-height:44px; }
  #app .ct-workspace-tabs { overflow-x:auto; flex-wrap:nowrap; }
  #app .ct-workspace-tabs button { flex:none; font-size:14px; }
  #app .multi-shop-progress { max-height:140px; padding:8px 12px; }
  #app .multi-shop-shops .multi-shop-shop { flex-basis:190px; }
  #app .multi-shop-text { font-size:15px; }
  #app .multi-shop-return { min-height:44px; }
  /* Feature dialogs contain ID-scoped desktop rules. Keep mobile inputs large
     enough for touch and to avoid focus zoom, including dynamically loaded CSS. */
  html:not(.ui-v31) body dialog :is(input,textarea,select) { font-size:16px!important; }
  html:not(.ui-v31) body dialog :is(button,.hy-select-trigger) { min-height:44px!important; }
  html:not(.ui-v31) body dialog.aurora-layer-dialog :is(button,.hy-select-trigger) { font-size:14px!important; }
  html:not(.ui-v31) body dialog.aurora-layer-dialog :is(label,.dialog-intro) { font-size:14px!important; }
}
@media (max-width:600px) {
  html:not(.ui-v31) body dialog[open]:not(#mobilePanel) { width:calc(100vw - 16px); max-width:none; max-height:calc(var(--mobile-height,100dvh) - 16px); border-radius:16px; }
  html:not(.ui-v31) body dialog :is(input,textarea,select) { font-size:16px; }
  html:not(.ui-v31) body dialog :is(button,.hy-select-trigger) { min-height:44px; }
  html:not(.ui-v31) body dialog .dialog-head { position:sticky; top:0; z-index:2; }
  html:not(.ui-v31) body dialog form > footer { position:sticky; bottom:0; padding-bottom:max(12px,env(safe-area-inset-bottom)); background:#fff; }
  html:not(.ui-v31) body :is(#memberDialog,#memoryDialog,#scheduledTaskEditorDialog,#workspaceConfigDialog)[open] { width:100%; height:var(--mobile-height,100dvh); max-height:var(--mobile-height,100dvh); margin:0; border-radius:0; }
  .login-gate .login-visual { min-height:110px; height:110px; padding:20px 24px; }
  .login-gate .login-visual :is(.login-story,.login-visual-foot) { display:none; }
  .login-gate .login-form-panel { min-height:calc(100dvh - 110px); padding:0 12px 32px; }
  .login-gate .auth-card { padding:24px; }
  .login-gate .auth-card > .auth-mark { display:none; }
  .login-gate .auth-card :is(input,button) { font-size:16px; }
  .login-gate .auth-card button { min-height:44px; }
  .login-gate .auth-card :is(label,.auth-security-note) { font-size:13px; }
}
@media (prefers-reduced-motion:reduce) {
  #mobilePanel[open], #mobilePanel[open]::backdrop { animation:none; }
}

@media(max-width:920px) {
  #mobilePanel .workbench-simplified .section-title { gap:5px; }
  #mobilePanel .workbench-simplified .section-title > span { font-size:13px; white-space:nowrap; }
  #mobilePanel .workbench-customization > button { min-height:44px; }
  #mobilePanel .workbench-header-actions button { font-size:11px; padding:5px; min-height:44px; }
  #mobilePanel .workbench-simplified .workbench-tile > [data-workbench-shortcut] { padding-right:48px; }
  #mobilePanel .workbench-simplified .workbench-tile > button.workbench-drag-handle { width:44px; height:calc(100% - 2px); min-height:0; padding:0; border:0; background:transparent; font-size:18px; }
}
