/* Full viewport workspaces. Screen-only rules preserve document/export layouts. */
@media screen {
  html { -webkit-text-size-adjust:100%; text-size-adjust:100%; }
  body :is(dialog, .overlay, .exit-overlay, .excuse-modal, .medical-page-preview) {
    box-sizing:border-box;
    position:fixed!important; inset:0!important; margin:0!important;
    width:100%!important; max-width:none!important;
    height:100vh!important; height:100dvh!important; max-height:none!important;
    border:0!important; border-radius:0!important;
    overscroll-behavior:contain; -webkit-overflow-scrolling:touch;
  }
  body dialog {
    --workspace-pad:16px;
    padding:max(var(--workspace-pad),env(safe-area-inset-top)) max(var(--workspace-pad),env(safe-area-inset-right)) max(24px,env(safe-area-inset-bottom)) max(var(--workspace-pad),env(safe-area-inset-left))!important;
    overflow:auto!important;
  }
  body :is(.overlay,.exit-overlay,.excuse-modal) {
    padding:0!important; background:#fffdfa; overflow:hidden!important;
    align-items:stretch!important; justify-content:stretch!important; place-items:stretch!important;
  }
  body :is(.overlay>.dialog,.exit-overlay>.exit-dialog,.excuse-modal>.ao-document) {
    box-sizing:border-box; width:100%!important; max-width:none!important;
    height:100%!important; max-height:none!important; margin:0!important;
    border:0!important; border-radius:0!important; overflow:auto!important;
    padding:max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(24px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));
    overscroll-behavior:contain; background:#fffdfa;
  }
  body .exit-overlay>.exit-dialog { padding:0; }
  body .medical-page-preview { background:#f4f0ea; overflow:auto; }
  body :is(.st-dialog-head,.aw-dialog>header,.dialog>.heading) {
    position:sticky; top:-16px; z-index:5; background:#fffdfa;
    display:flex; align-items:center; justify-content:space-between;
    gap:12px; flex-wrap:wrap; padding-block:12px; margin-top:-12px;
    max-width:none;
  }
  body :is(dialog,.dialog,.exit-dialog,.excuse-modal) :is(h2,h3,button,input,select,textarea) { max-width:100%; overflow-wrap:anywhere; }
  body :is(dialog,.dialog,.exit-dialog,.excuse-modal) button { min-height:48px; }
  body :is(dialog,.dialog,.exit-dialog,.excuse-modal) :is(.table-wrap,.st-table-wrap) { max-width:100%; overflow-x:auto; }
  html:has(dialog[open],.overlay,.exit-overlay,.excuse-modal,.medical-page-preview),
  body:has(dialog[open],.overlay,.exit-overlay,.excuse-modal,.medical-page-preview) { overflow:hidden; }
}
@media screen and (max-width:640px) {
  body :is(dialog,.dialog,.excuse-modal) :is(input,select,textarea) { font-size:16px!important; }
}
@media screen {
  body:has(#menuBack:not([hidden])) { border-top:0; }
  body:has(#menuBack:not([hidden]))>.school-portal-return,
  body:has(#menuBack:not([hidden])) .header-row,
  body:has(#menuBack:not([hidden])) #appMain>.banner { display:none; }
  body:has(#menuBack:not([hidden])) .school-header { position:sticky; top:0; z-index:10; background:#faf7f3; }
  body:has(#menuBack:not([hidden])) .school-header .wrap { max-width:none; padding:8px 12px; }
  body:has(#menuBack:not([hidden])) #appMain { max-width:none; width:100%; min-height:calc(100dvh - 68px); padding:0 12px 24px; }
  body:has(#menuBack:not([hidden])) #appMain .hero { margin-top:0; }
}
