/* MATCHSIK v32.17 — final site-wide rendering QA guards.
   This layer is intentionally narrow: it fixes intrinsic sizing, viewport escape,
   modal containment and unstyled operational controls without replacing page designs.
   Component typography is deliberately preserved: global QA must never reset a
   component's font-size/family/weight through the font shorthand. */

body[data-sitewide-qa="v32.17"]{min-inline-size:0;max-inline-size:100%}
body[data-sitewide-qa="v32.17"] *,
body[data-sitewide-qa="v32.17"] *::before,
body[data-sitewide-qa="v32.17"] *::after{box-sizing:border-box}

/* Intrinsic-width guards: long labels, URLs and flex/grid children must shrink instead of widening the document. */
body[data-sitewide-qa="v32.17"] :where(main,section,article,aside,header,footer,nav,form,fieldset,div,ul,ol,li){min-inline-size:0}
body[data-sitewide-qa="v32.17"] :where(img,video,canvas,svg,iframe){max-inline-size:100%}
body[data-sitewide-qa="v32.17"] :where(input,select,textarea,button){max-inline-size:100%}
body[data-sitewide-qa="v32.17"] :where(h1,h2,h3,h4,p,li,dd,dt,label,small,strong,a,button,.badge,.chip,.pill){overflow-wrap:anywhere}
body[data-sitewide-qa="v32.17"] :where(pre,code){max-inline-size:100%;overflow-wrap:anywhere;white-space:pre-wrap}

/* Wide data is allowed to scroll inside its own shell, never at document level. */
body[data-sitewide-qa="v32.17"] :where(.table-wrap,.schedule-table-wrap,.calendar-scroll,.table-scroll,.admin-table-wrap,.g-table-wrap,.t28-table-wrap){
  max-inline-size:100%;overflow-x:auto;overscroll-behavior-inline:contain;-webkit-overflow-scrolling:touch
}

/* Dialogs and sheets stay usable on both short laptops and mobile browser chrome. */
body[data-sitewide-qa="v32.17"] :where(dialog[open],.modal-card,.dialog-card,.sheet-card,.popup-card,.t28-modal-card,.t28-login-card,.m28-teacher-login-card,.g-modal-card){
  max-inline-size:calc(100vw - 24px);max-block-size:calc(100dvh - 24px);overflow:auto;overscroll-behavior:contain
}
body[data-sitewide-qa="v32.17"] dialog[open]{margin:auto}

/* Legacy operational pages occasionally expose a browser-default gray button. Give only unclassed controls a neutral MATCHSIK treatment. */
body[data-sitewide-qa="v32.17"][data-ops-page] button:not([class]),
body[data-sitewide-qa="v32.17"][data-portal-page] button:not([class]),
body[data-sitewide-qa="v32.17"][data-group-page] button:not([class]){
  min-block-size:40px;padding:0 14px;border:1px solid #cfdded;border-radius:11px;background:#fff;color:#23466f;font-weight:800;cursor:pointer
}
body[data-sitewide-qa="v32.17"][data-ops-page] button:not([class]):focus-visible,
body[data-sitewide-qa="v32.17"][data-portal-page] button:not([class]):focus-visible,
body[data-sitewide-qa="v32.17"][data-group-page] button:not([class]):focus-visible{outline:3px solid rgba(23,105,255,.25);outline-offset:2px}

@media(max-width:760px){
  html{max-inline-size:100%;overflow-x:clip}
  body[data-sitewide-qa="v32.17"]{inline-size:100%;max-inline-size:100%;overflow-x:clip}
  body[data-sitewide-qa="v32.17"] :where(.container,.wrap,.shell,.page,.layout,.content,.portal-shell,.portal-main,.t28-main,.g-main){max-inline-size:100%;min-inline-size:0}
  body[data-sitewide-qa="v32.17"] :where(input,select,textarea){font-size:max(16px,1em)}
  body[data-sitewide-qa="v32.17"] :where(.modal-card,.dialog-card,.sheet-card,.popup-card,.t28-modal-card,.t28-login-card,.m28-teacher-login-card,.g-modal-card){
    inline-size:min(100%,calc(100vw - 20px));max-block-size:calc(100dvh - 20px);margin-inline:auto
  }
  body[data-sitewide-qa="v32.17"] :where(.sticky-actions,.fixed-actions,.mobile-actions,.bottom-actions,.bottom-nav,.mobile-bottom-nav){
    max-inline-size:100vw;padding-bottom:max(env(safe-area-inset-bottom),0px)
  }
  body[data-sitewide-qa="v32.17"] :where(.topbar,.portal-topbar,.t28-header,.g-header,.site-header){max-inline-size:100vw}
}