/* MATCHSIK v32.31 — mobile navigation / overflow stabilization.
   This is a new immutable asset version. Do not reuse an older immutable filename when changing behavior. */

/* Shared defensive guards for operational/public portal pages. */
body[data-ops-page] img,body[data-portal-page] img,body[data-group-page] img,
body[data-ops-page] video,body[data-portal-page] video,body[data-group-page] video,
body[data-ops-page] canvas,body[data-portal-page] canvas,body[data-group-page] canvas{max-width:100%;height:auto}
body[data-ops-page] input,body[data-ops-page] select,body[data-ops-page] textarea,
body[data-portal-page] input,body[data-portal-page] select,body[data-portal-page] textarea,
body[data-group-page] input,body[data-group-page] select,body[data-group-page] textarea{min-width:0;max-width:100%}
body[data-ops-page] .t28-row,body[data-ops-page] .t28-card,
body[data-portal-page] .card,body[data-group-page] .g-card{min-width:0}
body[data-ops-page] .t28-row b,body[data-ops-page] .t28-row small,
body[data-portal-page] .card h1,body[data-portal-page] .card h2,body[data-portal-page] .card h3,
body[data-group-page] .g-card h1,body[data-group-page] .g-card h2,body[data-group-page] .g-card h3{overflow-wrap:anywhere}

/* Teacher navigation base: all items stay in normal document flow. */
body[data-ops-page="teacher"] .t28-nav>a,
body[data-ops-page="teacher"] .t28-nav>button{
  position:static!important;
  inset:auto!important;
  transform:none!important;
  display:flex!important;
  align-items:center!important;
  justify-content:flex-start!important;
  box-sizing:border-box!important;
  min-width:0!important;
  max-width:100%!important;
  white-space:normal!important;
  overflow:visible!important;
  text-overflow:clip!important;
  line-height:1.35!important;
}
body[data-ops-page="teacher"] .t28-nav>a{color:#536e91!important;text-decoration:none!important}
body[data-ops-page="teacher"] .t28-nav>a:hover{background:#edf4ff!important;color:#195fb9!important}

/* Mobile teacher categories follow the admin portal's three-column grid. */
@media(max-width:980px){
  body[data-ops-page="teacher"] .t28-sidebar{
    width:100%!important;
    max-width:100%!important;
    height:auto!important;
    min-height:0!important;
    padding:8px!important;
    overflow:visible!important;
  }
  body[data-ops-page="teacher"] .t28-nav{
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    align-items:stretch!important;
    gap:7px!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
  }
  body[data-ops-page="teacher"] .t28-nav>a,
  body[data-ops-page="teacher"] .t28-nav>button{
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    min-height:46px!important;
    padding:8px 6px!important;
    border:1px solid #d7e3f3!important;
    border-radius:999px!important;
    background:#fff!important;
    color:#36577e!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
    font-size:12px!important;
    font-weight:850!important;
    text-align:center!important;
    justify-content:center!important;
    box-shadow:none!important;
  }
  body[data-ops-page="teacher"] .t28-nav>button.active{
    background:#1769ff!important;
    border-color:#1769ff!important;
    color:#fff!important;
    box-shadow:0 7px 16px rgba(23,105,255,.16)!important;
  }
  body[data-ops-page="teacher"] .t28-nav>a:hover,
  body[data-ops-page="teacher"] .t28-nav>a:focus-visible,
  body[data-ops-page="teacher"] .t28-nav>button:not(.active):hover,
  body[data-ops-page="teacher"] .t28-nav>button:not(.active):focus-visible{
    background:#edf4ff!important;
    border-color:#bad1f3!important;
    color:#174f9f!important;
  }
}

@media(max-width:680px){
  body[data-ops-page="teacher"] .t28-header{gap:8px!important;padding:10px 12px!important}
  body[data-ops-page="teacher"] .t28-brand{min-width:0!important;gap:9px!important}
  body[data-ops-page="teacher"] .t28-brand-mark{width:42px!important;height:42px!important;flex:0 0 42px!important}
  body[data-ops-page="teacher"] .t28-brand b{font-size:16px!important;white-space:nowrap!important}
  body[data-ops-page="teacher"] .t28-head-actions{min-width:0!important;gap:6px!important}
  body[data-ops-page="teacher"] .t28-head-actions button{min-height:40px!important;padding:0 11px!important;font-size:13px!important;white-space:nowrap!important}
  body[data-ops-page="teacher"] .v288-server-state{max-width:118px!important;padding:7px 9px!important;font-size:11px!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}
  body[data-ops-page="teacher"] .t28-layout{overflow:visible!important}
  body[data-ops-page="teacher"] .t28-main{width:100%!important;max-width:100%!important;overflow:visible!important}
  body[data-ops-page="teacher"] .t28-sidebar{border-radius:18px!important;box-shadow:0 8px 22px rgba(7,27,54,.06)!important}
  body[data-ops-page="teacher"] .t28-nav>a,
  body[data-ops-page="teacher"] .t28-nav>button{min-height:42px!important;padding:7px 5px!important;font-size:11px!important}
  body[data-ops-page="teacher"] .t28-page-head{min-width:0!important}
  body[data-ops-page="teacher"] .t28-page-head h1{font-size:clamp(25px,8vw,34px)!important;overflow-wrap:anywhere!important}
  body[data-ops-page="teacher"] .t28-grid{align-items:stretch!important}
  body[data-ops-page="teacher"] .t28-stat{min-width:0!important}
  body[data-ops-page="teacher"] .t28-stat span,body[data-ops-page="teacher"] .t28-stat b{overflow-wrap:anywhere!important}

  /* Shared mobile micro-polish: contain horizontal content without locking vertical scroll. */
  body[data-portal-page] .portal-main,body[data-portal-page] main,
  body[data-group-page] .g-wrap,body[data-group-page] main{min-width:0;max-width:100%}
  body[data-portal-page] .table-wrap,body[data-portal-page] .schedule-table-wrap,body[data-portal-page] .calendar-scroll,
  body[data-group-page] .g-scroll{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;overscroll-behavior-inline:contain}
  .v31-footer{max-width:100%;overflow-wrap:anywhere}
}

@media(max-width:390px){
  body[data-ops-page="teacher"] .v288-server-state{display:none!important}
  body[data-ops-page="teacher"] .t28-head-actions button{padding:0 10px!important}
}
