/* Keep the 3D stage inside the measured viewport without hiding its tools. */
.asset-review-3d {
  height: var(--asset-available-height, calc(100dvh - 238px));
  min-height: 0;
}
@media (max-width: 1100px) {
  .asset-review-3d { overflow: hidden; }
  .asset-review-sidebar { min-height: 0; max-height: none; overflow: auto; }
  .asset-review-view, .asset-review-stage { min-height: 0; }
  .asset-review-view > .agent-result { max-height: 64px; overflow: auto; }
}
@media (max-width: 700px) {
  .asset-review-3d {
    display: grid;
    grid-template-columns: minmax(135px, 36%) minmax(0, 1fr);
    min-height: 0;
  }
  .asset-review-sidebar { min-height: 0; max-height: none; padding: 5px; }
  .asset-review-view, .asset-review-stage { min-height: 0; }
  .asset-review-view > header { max-height: 120px; overflow: auto; }
}
.video-scrubber { touch-action: pan-y; }
#logoutPipeline { flex-shrink: 0; }
#agendaWeek[hidden], #agendaEventList[hidden] { display: none !important; }
.web-modal-actions { flex-wrap: wrap; }
#drawingTools button[aria-pressed="true"] { background: var(--violet); color: white; border-color: var(--cyan); }

/* Fit the shell to its container; wide content scrolls in its own panel. */
.app { width:100%; max-width:100%; grid-template-columns:minmax(0,1fr); grid-template-rows:auto auto auto auto minmax(0,1fr) auto; }
.identity { flex-wrap:wrap; }
.identity .brand { min-width:0; }
.identity label,.identity select,.section label,.section select { min-width:0; max-width:100%; }
.identity label { overflow-wrap:anywhere; }
.commands,.tabs { max-width:100%; overflow-x:auto; overflow-y:hidden; }
.commands>*,.tabs>* { flex-shrink:0; }
.module-page-body>* { min-width:0; max-width:100%; }
.pipeline-form input,.pipeline-form select,.pipeline-form textarea { min-width:0; max-width:100%; }
.web-modal-card { max-width:calc(100vw - 24px); max-height:calc(100dvh - 24px); }
.web-modal-body { min-width:0; overflow:auto; }
.wellness-card canvas { max-width:100%; height:auto; }

/* Review panels must shrink with the viewport, not retain desktop track sizes. */
.app { padding-left:env(safe-area-inset-left,0px); padding-right:env(safe-area-inset-right,0px); }
.app>footer { padding-bottom:max(5px,env(safe-area-inset-bottom,0px)); }
.review-workspace>*,.checker-main>*,.image-review-layout>*,.asset-review-3d>* { min-width:0; }
.review-head,.review-head>div,.checker-head,.checker-transport { flex-wrap:wrap; max-width:100%; }
.review-workspace .screen video { min-height:0; object-fit:contain; }
.review-notes textarea { width:100%; min-width:0; }
@media(max-width:1100px),(pointer:coarse) {
  .review-workspace,.review-workspace.desktop-player-layout,.checker-main,.image-review-layout { grid-template-columns:minmax(0,1fr); height:auto; }
  .review-workspace .screen { flex:none; width:100%; aspect-ratio:16/9; min-height:0; height:auto; }
  .review-workspace .screen video { position:absolute; inset:0; width:100%; height:100%; }
  .player-browser,.review-queue { min-height:0; max-height:40dvh; overflow:auto; }
  .player-browser { grid-template-rows:auto minmax(100px,1fr) auto; }
  .review-workspace .transport,.review-workspace .draw,.player-correction { flex-wrap:wrap; height:auto; }
  .asset-review-3d { height:auto; min-height:0; overflow:visible; }
  .asset-review-stage { height:50dvh; min-height:240px; }
  .asset-review-view>header { flex-wrap:wrap; max-height:none; overflow:visible; }
}

@media(max-width:1366px) {
  html,body { height:auto; min-height:100%; overflow:auto; }
  .app { height:auto; min-height:100dvh; }
  .identity { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .identity .brand { grid-column:1/-1; }
  .identity label { display:flex!important; white-space:normal; }
  .identity select { flex:1; width:100%; }
  .section { position:static; }
  main { overflow:visible; min-width:0; }
  main>.view.active { max-width:100%; }
  body:has(.core.chat-floating) main>.view.active:not(.core),body:has(.core.chat-floating:not(.chat-minimized)) main>.view.active:not(.core) { width:100%; }
  .core.chat-floating { max-height:calc(100dvh - 110px); }
  .view { height:auto; min-height:0; }
  .page,.modules { overflow:visible; padding:12px; }
  .module-page-body { min-height:0; }
  .app>footer { position:static; flex-wrap:wrap; height:auto; min-height:38px; overflow:visible; }
  .app>footer span:nth-of-type(n+3),.app>footer label { display:flex; }
  main footer { position:static; z-index:auto; }
  .module-subtabs,.subtabs,.my-task-tabs,.leave-filters { max-width:100%; overflow-x:auto; }
  .module-subtabs>*,.subtabs>*,.my-task-tabs>* { flex-shrink:0; }
  .module-page-head,.title,.pipeline-search,.agenda-toolbar { flex-wrap:wrap; gap:8px; min-width:0; }
  .module-page-head h1,.title h2,.agent-result { overflow-wrap:anywhere; }
  .web-modal { padding:8px; }
  .pipeline-search input { min-width:0; }
  .scene-fields { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .manager-table,.shot-table,.gantt-board,.agenda-week { max-width:100%; overflow:auto; }
  .draw,.transport,.playerbar { flex-wrap:wrap; max-width:100%; }
  button,select,input,textarea { min-height:44px; }
  input[type=checkbox],input[type=radio] { min-height:0; }
}
@media(max-width:900px) {
  .core .ornament { display:none; }
  .core .agent { width:110px; padding:12px; }
  .selectors { width:100%; max-width:100%; }
  .mail-workspace,.leave-workspace,.wellness-grid,.mimir-workspace { grid-template-columns:minmax(0,1fr); }
  .wellness-card,.mail-workspace>*,.leave-workspace>* { min-width:0; }
}
@media(max-width:700px) {
  .identity label { flex-direction:column; align-items:stretch; }
  .identity .brand b { overflow-wrap:anywhere; }
  .identity select,input,textarea { font-size:16px; }
  .core.view.active { grid-template-columns:minmax(0,1fr); }
  .core .agent { width:auto; }
  .core .center { min-height:0; grid-template-rows:auto minmax(260px,45dvh) auto auto; }
  .core .chat { min-height:0; overflow:auto; }
  #composer { grid-template-columns:repeat(4,minmax(0,1fr)); }
  #composer label { display:flex; }
  #composer textarea { grid-column:1/-1; }
  .scene-fields,.business-form,.studio-settings-grid { grid-template-columns:minmax(0,1fr); }
  .asset-review-3d { display:flex; flex-direction:column; height:auto; min-height:0; overflow:visible; }
  .asset-review-sidebar { width:100%; max-height:38dvh; overflow:auto; }
  .asset-review-view { min-height:0; }
  .asset-review-stage { height:50dvh; min-height:240px; }
  .asset-review-view>header { max-height:none; overflow:visible; }
  .review-workspace,.review-workspace.desktop-player-layout { min-height:0; }
  .player-editor { min-height:0; }
  .screen { min-height:200px; aspect-ratio:16/9; }
  .transport code { margin:0 4px; }
  .web-modal-card { width:calc(100vw - 16px); max-width:calc(100vw - 16px); }
}
