/* One editing surface on narrow screens; real tree/inspector become drawers. */
body.ned-shell :is(#shellViewTools,#mobileWorkspaceBar,#mobileOutlineClose,#mobileInspectorClose){display:none}
@media(max-width:900px){
body.ned-shell>header{flex-wrap:wrap!important;gap:4px 8px!important;padding:4px 8px!important;min-height:40px!important}
body.ned-shell>header>strong{font-size:18px!important}
body.ned-shell #documentHeading{flex:1 1 0;font-size:12px}
body.ned-shell #headerRight{margin-left:auto;font-size:11px!important}
body.ned-shell #cloudStatus{display:none}
body.ned-shell #shellMenus{padding:0 4px;gap:0}
body.ned-shell #shellMenus :is(button,.shellMenu>summary,#fileMenu>summary){min-height:36px!important;padding:7px 8px!important;font-size:12px!important}
body.ned-shell #shellTools{padding:4px;gap:6px;min-height:52px;overflow-x:auto;scrollbar-width:thin;overscroll-behavior-x:contain}
body.ned-shell #shellViewTools{display:block;padding:3px 4px;background:#eef3f9;border-bottom:1px solid var(--nd-border);flex:none;overflow-x:auto;scrollbar-width:thin}
body.ned-shell #shellViewTools #viewControlsDock{position:static!important;display:flex!important;align-items:center;flex-wrap:nowrap!important;transform:none!important;gap:3px;padding:0!important;margin:0!important;max-width:none!important;width:max-content!important;background:transparent!important;box-shadow:none!important}
body.ned-shell #shellViewTools #viewControlsDock button{display:inline-flex!important;flex:none!important;width:44px!important;height:44px!important;min-width:44px!important;min-height:44px!important;padding:8px!important;background:#f8fafd!important;color:#294967!important;border:1px solid #b5c6dc!important}
body.ned-shell #shellViewTools #viewControlsDock button.active{background:#cee3ff!important;color:#125ba9!important}
body.ned-shell #mobileWorkspaceBar{display:flex;gap:6px;padding:4px 6px;background:#e9eff7;border-bottom:1px solid var(--nd-border);flex:none}
body.ned-shell #mobileWorkspaceBar button{display:flex;align-items:center;justify-content:center;gap:8px;min-height:44px;flex:1;padding:8px;min-width:0}
body.ned-shell #mobileWorkspaceBar svg{width:20px;height:20px}
body.ned-shell #mobileWorkspaceBar button[aria-expanded=true]{background:#cee3ff!important;border-color:#8db8ed!important}
body.ned-shell>main,body.ned-shell>main.projectMode:not(.catalogMode){display:flex!important;flex-direction:column!important;padding:4px!important;min-height:0!important;height:auto!important;overflow:auto!important}
body.ned-shell main>.stage{flex:1 0 180px!important;min-height:180px!important;order:0!important}
body.ned-shell #view{min-height:180px!important}
body.ned-shell main:not(.catalogMode)>#outlinePanel{display:none!important}
body.ned-shell #inspectorPanel{display:none}
body.ned-shell.outlineOpen main:not(.catalogMode)>#outlinePanel,body.ned-shell #inspectorPanel.inspectorOpen{display:block!important;position:fixed!important;top:70px!important;bottom:6px!important;width:min(340px,calc(100vw - 12px))!important;max-height:none!important;height:auto!important;z-index:60;box-shadow:0 12px 40px #152e5060;overflow:auto!important}
body.ned-shell.outlineOpen main:not(.catalogMode)>#outlinePanel{left:6px!important;right:auto!important}
body.ned-shell #inspectorPanel.inspectorOpen{right:6px!important;left:auto!important}
body.ned-shell :is(#outlineHeading,#inspectorTitle){padding-right:48px}
body.ned-shell :is(#mobileOutlineClose,#mobileInspectorClose){display:inline-flex;align-items:center;justify-content:center;position:absolute;right:0;top:0;width:40px;height:40px;min-height:40px;padding:8px;border:0!important;background:transparent!important}
body.ned-shell #inspectorPanel input:not([type=checkbox]),body.ned-shell #inspectorPanel select,body.ned-shell #inspectorPanel .inspectorSection>summary{min-height:44px;height:auto}
body.ned-shell #inspectorPanel .inspectorSection>summary button{min-height:28px!important}
body.ned-shell .documentTree .treeItem{min-height:44px}
body.ned-shell #draftRecoveryBar{padding:3px 6px;font-size:10px;gap:4px;flex-wrap:wrap}
body.ned-shell #draftRecoveryBar button{min-height:32px;padding:4px 6px;font-size:11px}
body.ned-shell:has(main.catalogMode) #mobileWorkspaceBar{display:none}
body.ned-shell main.catalogMode>#projectResults{min-height:0!important}
body.ned-shell #shellMenus .documentMenuItems{position:fixed;left:6px;top:100px;max-width:calc(100vw - 12px);max-height:calc(100dvh - 120px);overflow:auto;min-width:220px}
}
@media(max-width:360px){body.ned-shell #shellMenus :is(button,.shellMenu>summary,#fileMenu>summary){padding:6px!important;font-size:11px!important}body.ned-shell #shellTools #shellModes button{padding:8px!important;font-size:11px!important}body.ned-shell #appVersion{font-size:10px}body.ned-shell .brandIcon{margin-right:4px;width:22px;height:22px}}
@media(max-width:900px){
body.ned-shell main>.stage{margin:0!important;inset:auto!important;width:100%!important;max-width:100%!important;grid-column:auto!important;grid-row:auto!important}
body.ned-shell #cloudStatus{display:none!important}
}
body.ned-shell.compactWorkspace>main:not(.catalogMode){display:flex!important;flex-direction:column!important;min-height:0!important;height:auto!important;padding:4px!important;overflow:auto!important}
@media(max-width:900px){body.ned-shell #headerRight{width:auto!important;flex:none!important}body.ned-shell #headerRight #cloudStatus{display:none!important}}

@media(max-width:900px){
 body.ned-shell #headerRight #sharedBaseStatus:not([hidden]){max-width:22vw}
 body.ned-shell #sharedBaseStatus span:last-child{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis}
}

/* Mobile menu: 4×2 grid of 44px targets, dropdown opens directly under its title. */
@media(max-width:900px){
body.ned-shell #shellMenus{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr));gap:2px!important;padding:2px 4px!important;overflow:visible!important;min-height:0}
body.ned-shell #shellMenus>*{min-width:0}
body.ned-shell #shellMenus>#documentMenus{display:contents!important}
body.ned-shell #shellMenus :is(button,.shellMenu>summary,#fileMenu>summary){min-height:44px!important;display:flex!important;align-items:center;justify-content:center;width:100%;padding:6px 2px!important;font-size:12px!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body.ned-shell #shellMenus details>summary::after{margin-left:3px}
body.ned-shell #shellMenus .documentMenuItems{top:auto!important}
body.ned-shell #shellMenus .documentMenuItems button{justify-content:flex-start!important;text-align:left!important;min-height:44px!important;padding:8px 12px!important;font-size:14px!important;white-space:normal}
body.ned-shell #headerRight :is(#cloudLogin,#settingsButton){min-height:44px!important;min-width:44px!important}
body.ned-shell #headerRight #settingsButton{width:44px!important}
}
@media(max-width:360px){body.ned-shell #shellMenus :is(.shellMenu>summary,#fileMenu>summary){font-size:11px!important}body.ned-shell #shellMenus details>summary::after{display:none}}

/* Touch tablets above 900 px (landscape iPad etc.) keep 44px targets without changing the desktop density. */
@media(min-width:901px) and (pointer:coarse){
body.ned-shell #shellMenus :is(button,.shellMenu>summary,#fileMenu>summary){min-height:44px!important}
body.ned-shell #shellMenus .documentMenuItems button{min-height:44px!important}
body.ned-shell #headerRight :is(#cloudLogin,#settingsButton){min-height:44px!important;min-width:44px!important}
html body.ned-shell #shellTools :is(#toolsPanel,#projectTools,.historyTools,#viewControlsDock) button:not([hidden]){width:44px!important;min-width:44px!important;max-width:44px!important;height:44px!important;min-height:44px!important}
}
