/* Presentation only. The CMR list owns its scroll area, including record-card mode. */
@media screen {
 #admin #cmr.mediaWorkspace {height:auto!important;max-height:none!important;min-height:0!important;overflow:auto!important}
 #admin #cmr.mediaWorkspace>.mediaTable {max-height:min(65dvh,800px)!important;min-height:0!important;overflow:auto!important;overscroll-behavior:contain;scrollbar-gutter:stable;-webkit-overflow-scrolling:touch;scroll-padding:12px}
 #admin #cmr.mediaWorkspace>.mediaTable:focus-visible {outline:3px solid #1266d8;outline-offset:2px}

 /* Existing office Back occupies normal header space, ahead of the branding. */
 #admin.officeCompact:not(.officeOnHome)>.top {position:sticky!important;top:0!important;inset-block-start:0!important;z-index:120!important}
 #admin>.top>#officeFixedBack {position:static!important;inset:auto!important;order:-1;flex:0 0 auto!important;align-self:flex-start;min-height:44px;margin:0!important;padding:9px 12px!important;box-shadow:none!important}
 #admin>.top>#officeFixedBack[hidden] {display:none!important}
 #admin>.top>#officeFixedBack~.brand {min-width:0}

 /* Headers stay inside their own dialog; no fixed viewport overlays or cloned controls. */
 body dialog .portalBackHeader {display:flex!important;align-items:center!important;justify-content:flex-start!important;flex-wrap:wrap!important;gap:8px 12px!important;position:sticky!important;top:0!important;z-index:30;flex-shrink:0;background-color:var(--portal-back-background,#fff)}
 body dialog .portalBackHeader>.portalBackButton {order:-1!important;flex:0 0 auto!important;margin:0!important;min-height:44px;max-width:100%}
 body dialog .portalBackHeader>:is(h2,h3,strong,div) {min-width:0;overflow-wrap:anywhere}
 body dialog .portalBackButton[hidden],body dialog .portalBackButton.hidden {display:none!important}
 body dialog.assignmentCompact>.portalBackHeader {position:static!important}
 #driver[data-compact-driver] .compactScreenBar {flex-shrink:0;justify-content:flex-start}
 #driver[data-compact-driver] .compactBack {order:-1}
 #auth .portalFormBack,#officeStaff form>.portalFormBack {display:block;position:sticky;top:0;z-index:5;width:auto;min-height:44px;margin:0 0 12px;background:#fff}
 #officeStaff form>.portalFormBack {top:calc(var(--office-blue-height,150px) + 8px)}
 .portalFormBack[hidden],.portalFormBack.hidden {display:none!important}
}
@media screen and (max-width:900px) {
 #admin.officeCompact:not(.officeOnHome)>.top {position:fixed!important;top:4px!important;left:var(--office-header-left,12px)!important;width:var(--office-header-width,calc(100% - 24px))!important}
 #admin>.top>#officeFixedBack {font-size:14px!important}
}

/* Allow native wheel/touch scrolling to continue into the page at list edges. */
#admin #cmr.mediaWorkspace,#admin #cmr.mediaWorkspace>.mediaTable{overscroll-behavior-y:auto!important;scroll-behavior:auto!important}

/* Consistent blue Back controls, including former Close buttons. */
body .portalBackButton,body .portalFormBack,body #driver .compactBack,#admin#admin#admin#admin>.top .right #officeFixedBack,body:has(#admin:not(.hidden)) dialog .portalBackButton{background:#1666df!important;border:1px solid #1666df!important;color:#fff!important;font-weight:700;box-shadow:none!important}
body dialog .portalBackHeader,body dialog.assignmentCompact>.portalBackHeader{position:sticky!important;top:0!important;z-index:50!important;background:#fff!important;padding:8px 0!important}
body .portalBackButton:focus-visible{outline:3px solid #8ab7ff;outline-offset:2px}

/* The same top-left location for inline details and dialog navigation. */
body #admin .portalBackHeader{display:flex!important;justify-content:flex-start!important;align-items:center!important;gap:10px!important;position:sticky!important;top:0!important;z-index:50;background:#fff!important;padding:8px!important}
body #admin .portalBackHeader>.portalBackButton{order:-1!important;margin:0!important;flex:0 0 auto!important}
body dialog .portalBackHeader>.portalBackButton{align-self:center!important}
