/* Available space determines the layout; no device-name or pixel-density detection.
   Wider outer displays, unfolded screens and compact windows share this rail. */
@media (min-width:440px) and (max-width:1100px) and (min-aspect-ratio:3/5) {
 :root{--hm-rail-space:calc(80px + env(safe-area-inset-right,0px))}
 .shell>.main{margin-left:0;margin-right:var(--hm-rail-space);min-width:0}
 .shell .workspace-dock{display:flex!important;inset:max(12px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) auto;width:64px;height:auto;padding:8px 4px;border-radius:24px;background:#232824;backdrop-filter:none;-webkit-backdrop-filter:none;box-shadow:none}
 .workspace-dock .dock-brand{display:grid;flex:none;width:44px;height:44px;margin:0 0 8px}
 .workspace-dock .elastic-app-mark{font-size:27px;letter-spacing:-3px}
 .workspace-dock .dock-destinations{display:flex;flex-direction:column;gap:3px;height:auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:none;padding:3px;width:100%}
 .workspace-dock .dock-destinations::-webkit-scrollbar{display:none}
 .workspace-dock .dock-link,.workspace-dock .dock-client-picker>summary.dock-link{display:flex;flex-direction:column;justify-content:center;flex:none;width:100%;height:49px;min-height:49px;padding:3px 0;gap:1px;border-radius:15px}
 .workspace-dock .dock-symbol,.workspace-dock .dock-home .dock-symbol{width:28px;height:27px;margin:0;border:0;box-shadow:none;background:none;color:inherit}
 .workspace-dock .dock-symbol svg{width:22px;height:22px}
 .workspace-dock .dock-home{order:-1;flex:none}
 .workspace-dock .dock-label{display:block;font-size:9px;line-height:12px;font-weight:650;letter-spacing:0}
 .workspace-dock .dock-tooltip{display:none}
 .workspace-dock .dock-client-picker{width:100%;height:auto;flex:none}
 .workspace-dock .dock-client-popover{position:fixed;left:auto;right:calc(var(--hm-rail-space) + 4px);bottom:max(20px,env(safe-area-inset-bottom));width:280px;max-width:calc(100vw - var(--hm-rail-space) - 16px);transform-origin:right bottom}
 .workspace-dock .dock-client-list{max-height:min(320px,calc(100dvh - 150px))}
 .shell .mobile-navigation-toggle{display:none}
 .shell .topbar{justify-content:flex-end;width:auto;margin:max(12px,env(safe-area-inset-top)) 12px 0;max-width:none}
 .shell>.main>.content{padding:22px 20px calc(90px + env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left));max-width:100%}
 .shell .account-header{gap:6px}
 .shell .account-header .client-view-picker>summary{max-width:calc(100vw - var(--hm-rail-space) - 178px)}
 .account-header .overflow-menu-items,.notification-panel,.client-view-popover{right:calc(var(--hm-rail-space) + 12px);max-width:calc(100vw - var(--hm-rail-space) - 24px)}
 .account-header .overflow-menu-items,.client-view-popover{position:fixed;top:calc(max(12px,env(safe-area-inset-top)) + 54px)}
 .chat-dock{right:calc(var(--hm-rail-space) + 12px);bottom:calc(16px + env(safe-area-inset-bottom))}
 .chat-drawer{width:min(460px,calc(100vw - var(--hm-rail-space) - 24px));max-height:calc(100dvh - 110px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}
 .upload-tray{left:max(12px,env(safe-area-inset-left));max-width:calc(100vw - var(--hm-rail-space) - 24px)}
 .shell .brain-columns{grid-template-columns:repeat(var(--pipeline-columns,7),minmax(240px,1fr));scroll-snap-type:x proximity;scroll-padding-inline:4px}
 .shell .brain-column{scroll-snap-align:start}
 .shell :is(.heading-row,.overview-heading,.brain-heading){flex-wrap:wrap;gap:16px}
 .shell :is(.heading-row,.brain-heading)>div{min-width:0;max-width:100%}
 .shell .review-layout{grid-template-columns:minmax(0,1fr)}
}
/* The cover display keeps generous type and one clear column. */
@media (min-width:440px) and (max-width:760px) and (min-aspect-ratio:3/5) {
 .shell>.main>.content{padding-inline:14px}
 .shell .content h1[data-brand-title]{font-size:clamp(30px,6.5vw,42px)}
 .shell .morning-brief .morning-hero{padding:22px 18px}
 .shell .morning-hero h2{font-size:27px}
 .shell .account-header .client-view-picker>summary{width:44px;min-width:44px;max-width:44px;padding:0}
 .shell .client-view-picker>summary>span,.shell .client-view-picker>summary .client-view-chevron{display:none}
 .shell .topbar .top-actions{margin-left:auto}
 .shell .overview-heading::after{width:40px}
 .shell .overview-heading h1{padding-right:46px}
 .shell .brain-columns{grid-template-columns:repeat(var(--pipeline-columns,7),minmax(240px,calc(100vw - var(--hm-rail-space) - 42px)))}
}
/* Two useful panes need actual working width, not simply a tablet breakpoint. */
@media (min-width:761px) and (max-width:940px) {
 .shell .morning-brief .morning-hero{flex-wrap:wrap}
 .shell .morning-brief .day-identity{border:0;padding-left:0}
 .shell .consolidated-day .daily-brief-grid,.shell .overview-summary-grid{grid-template-columns:minmax(0,1fr)}
 #modal .pipeline-detail-layout{grid-template-columns:minmax(0,1fr)}
 .pipeline-conversation{position:static!important}
}
@media (min-width:941px) and (max-width:1100px) {
 .shell .review-layout{grid-template-columns:minmax(0,1.3fr) minmax(280px,1fr);gap:20px}
}
@media print{.shell>.main{margin-right:0!important}}

@media (min-width:600px) and (max-width:760px) and (min-aspect-ratio:3/5) {
 dialog#modal[open]:has(.pipeline-detail-layout){width:calc(100vw - 32px);height:calc(100dvh - 32px);max-height:calc(100dvh - 32px);margin:auto;border-radius:24px}
}

/* Panels respond to their own working width, including beside another app/chat. */
.shell>.main>.content{container:workspace / inline-size}
#modal>.modal-content{container:editor / inline-size}
@container workspace (min-width:660px){
 .shell .media-review .review-workspace,
 .shell .media-review .review-workspace[data-orientation]{grid-template-columns:minmax(0,1.2fr) minmax(280px,1fr);gap:18px;align-items:start}
 .shell .media-review .review-workspace .review-video-block{position:sticky;top:82px;width:100%;min-width:0;max-width:100%;justify-self:stretch}
 .shell .media-review .review-delivery-grid{grid-template-columns:minmax(0,1fr)}
 .shell .media-review .review-stage .player-wrap.native-player{width:min(100%,calc(var(--video-ratio,1.78)*min(58dvh,540px)))}
 .shell .typed-review.review-layout{grid-template-columns:minmax(0,1fr) 280px;gap:18px}
 .shell .typed-review>.content-review-aside{position:sticky;top:82px;max-height:calc(100dvh - 106px);overflow:auto;grid-row:auto}
 .shell .consolidated-day .daily-brief-grid,.shell .overview-summary-grid{grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);gap:18px}
}
@container workspace (max-width:659px){
 .shell :is(.review-layout,.media-review .review-workspace,.media-review .review-workspace[data-orientation],.two-col,.overview-summary-grid,.overview-bottom-grid,.consolidated-day .daily-brief-grid,.studio-settings-grid){grid-template-columns:minmax(0,1fr)}
 .shell .review-video-block,.shell .typed-review>.content-review-aside{position:static;min-width:0;max-height:none}
 .shell .grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr))}
 .shell :is(.heading-row,.brain-heading,.overview-heading,.morning-hero,.toolbar){flex-wrap:wrap;gap:14px}
 .shell .morning-brief .day-identity{border:0;padding-left:0}
 .shell .morning-brief .morning-hero{padding:22px}
 .shell .morning-pulse{flex-wrap:wrap}
 .shell .day-update-strip{grid-template-columns:1fr;margin-inline:20px}
 .shell .brain-filters{flex-wrap:wrap}
 .shell .brain-columns{grid-template-columns:repeat(var(--pipeline-columns,7),minmax(240px,1fr))}
 .shell .visual-calendar{width:100%;margin-inline:0}
 .shell .visual-day,.shell .visual-day.outside{min-height:76px;padding:4px 2px}
 .shell .visual-weekdays>span{text-align:center;padding-inline:0}
 .shell .calendar-day-header{justify-content:center;margin:0;min-height:38px}
 .shell .calendar-day-header .day-num{min-width:0;width:38px;height:38px;font-size:13px}
 .shell .visual-day :is(.calendar-day-count,.calendar-day-add,.calendar-day-items,.calendar-day-more){display:none}
 .shell .calendar-mobile-summary{display:flex;flex-direction:column;align-items:center;gap:5px;min-height:30px;width:100%;padding:3px 0;border:0;background:transparent;color:var(--hm-ink);font:500 10px/1.3 var(--sans)}
 .shell .calendar-mobile-summary img{width:calc(100% - 8px);height:32px;object-fit:cover;border-radius:5px}
 .shell .calendar-mobile-dots{display:flex;justify-content:center;gap:3px}
 .shell .calendar-mobile-dots i{width:5px;height:5px;border-radius:50%}
 .shell .visual-calendar-toolbar{align-items:flex-start}
 .shell .visual-calendar-toolbar>.button-row{flex-wrap:wrap;max-width:100%}
 .shell .visual-calendar-legend small{flex-basis:100%;margin-left:0}
 .shell .calendar-agenda>section{grid-template-columns:1fr;gap:12px}
 .shell .calendar-agenda-items{grid-template-columns:minmax(0,1fr)}
}
@container editor (min-width:680px){
 #modal .pipeline-detail-layout{grid-template-columns:minmax(0,1fr) 260px;gap:20px;align-items:start}
 #modal .pipeline-conversation{position:sticky!important;top:0;padding:16px;max-height:calc(100dvh - 180px);overflow:auto;overscroll-behavior:contain}
 #modal .pipeline-work .task-writing{padding:18px}
 #modal .pipeline-work .task-writing textarea{padding:16px;font-size:16px;min-height:280px}
}
@container editor (max-width:679px){
 #modal .pipeline-detail-layout{grid-template-columns:minmax(0,1fr)}
 #modal .pipeline-conversation{position:static!important;max-height:none}
}
/* An open conversation shares the canvas on roomy screens instead of covering work. */
@media (min-width:820px) and (max-width:1100px) and (min-height:500px) and (min-aspect-ratio:3/5){
 .shell:has(.chat-drawer)>.main{margin-right:calc(var(--hm-rail-space) + 324px)}
 .shell:has(.chat-drawer) .topbar{width:calc(100vw - var(--hm-rail-space) - 24px);max-width:none}
 .shell .chat-dock:has(.chat-drawer){top:86px;bottom:max(16px,env(safe-area-inset-bottom));width:308px}
 .shell .chat-drawer{position:static;width:100%;height:100%;max-height:100%;border-radius:24px;box-shadow:none}
 .shell .chat-dock:has(.chat-drawer)>.chat-launcher{display:none}
 .shell .chat-drawer-head{padding:14px 12px}
 .shell .chat-drawer-head h2{font-size:18px}
 .shell .chat-drawer-head button{min-width:44px;min-height:44px;padding:8px}
 .shell .chat-list-filters{flex-wrap:wrap;gap:8px;padding:12px}
 .shell .chat-list-filters select{max-width:130px}
 .shell .chat-transcript,.shell .chat-thread{padding-inline:14px}
 .shell .chat-composer{padding:12px}
 .shell .chat-composer textarea{font-size:16px}
 .shell .chat-compose-footer{flex-wrap:wrap}
}
@media (min-width:600px) and (max-width:760px) and (min-aspect-ratio:3/5){
 dialog#modal[open]:has(.pipeline-detail-layout){width:calc(100vw - 32px)!important;max-height:calc(100dvh - 32px)!important}
}
@media (pointer:coarse){
 .shell :is(input,textarea,select),#modal :is(input,textarea,select){font-size:16px}
}
@container workspace (max-width:659px){
 .shell .media-review .review-workspace[data-orientation] .review-video-block{position:static;width:100%;min-width:0;max-width:100%}
 .shell .typed-review>.content-review-aside{grid-row:2}
}
