/* HALLAYM EDU 2026 mobile-density layer.
   Loaded LAST: replaces competing 59vh/370px/100dvh rules without touching media or attendance. */
:root { --m2-compact-radius:4px; --m2-compact-gap:5px; }
html,body { max-width:100%; }
#shell, #shell>main, .page, .conference-shell, .conference-main { min-width:0; }
#lesson, #lesson * { box-sizing:border-box; }
#lesson button, #lesson select, #lesson input { max-width:100%; }
#lesson .page-head, #lesson .conference-shell, #lesson .video-stage,
#lesson #videoMount, #lesson .zoom-dock, #lesson .lesson-student-rail,
#lesson .student-rail-card { border-radius:var(--m2-compact-radius)!important; }
#lesson .page-head { padding:7px 10px!important; gap:7px; min-width:0; }
#lesson .page-head>div:first-child { min-width:0; flex:1 1 200px; }
#lesson .page-head h1 { overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:15px!important; }
#lesson .page-head p { overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10px!important; }
#lesson .page-head .head-actions { min-width:0; flex:0 0 auto; }
#lesson .page-head .head-actions button { padding:5px 8px!important; border-radius:4px!important; font-size:10px!important; }
#lesson .conference-main { overflow:hidden; }
#lesson .zoom-control { border-radius:4px!important; }
#lesson .lesson-side { border-radius:4px 0 0 4px!important; min-width:0; }
#lesson #chatForm { min-width:0; }
#lesson #chatForm input { min-width:0; }
#lesson .student-rail-card { overflow:hidden; }
#lesson .lesson-student-rail-items { min-width:0; max-width:100%; overscroll-behavior-x:contain; }
#lesson .live-more-panel { border-radius:4px!important; }
#lesson .more-grid :is(button,label,select) { border-radius:4px!important; }
#lesson .zoom-status { white-space:nowrap; }

/* Other LMS pages: tables scroll inside their container; no page-wide horizontal overflow. */
#shell>main article, #shell>main .cards>div,
#shell>main .course-topic-plan, #shell>main .course-topic-item,
#shell>main .course-topic-item-copy, #shell>main .page-head>div,
#shell>main .toolbar, #shell>main .modal-fields { min-width:0; }
#shell>main .table-wrap, #shell>main .drill-table,
#shell>main .schedule-sheet-host { max-width:100%; overflow-x:auto; overscroll-behavior-x:contain; }
#shell>main .course-topic-item-copy strong,
#shell>main .course-topic-title b { overflow-wrap:anywhere; }

@media(max-width:900px) {
  #shell, html[data-user-role="student"] #shell,html[data-user-role="teacher"] #shell {
    display:block!important; min-height:100dvh!important; padding-top:52px!important;
  }
  #shell>header, html[data-user-role="student"] #shell>header {
    height:52px!important; min-height:52px!important; padding:0 8px!important;
    gap:5px!important; position:fixed!important; inset:0 0 auto 0!important;
  }
  #shell>header .brand { min-width:0;gap:5px!important; }
  #shell>header .brand>div{ min-width:0; }
  #shell>header .brand b{font-size:12px!important;max-width:133px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  #shell>header .brand small { font-size:9px!important; }
  #shell>header .brand-mark{width:29px!important;height:29px!important;border-radius:4px!important;font-size:11px!important}
  #shell>header #menuBtn {width:32px;height:38px;display:grid;place-items:center;padding:0!important}
  #shell>header .header-actions {gap:2px!important;min-width:0;}
  #shell>header .header-actions>.icon-btn { width:32px;height:38px;padding:4px!important;display:grid;place-items:center; }
  #shell>header .profile-head{padding:3px!important;max-width:75px;overflow:hidden;white-space:nowrap}
  #shell>header #headerName{font-size:10px;max-width:55px;overflow:hidden;text-overflow:ellipsis}
  #shell>header #onlineBadge {display:none!important;}
  #sidebar,html[data-user-role="student"] #sidebar {
    top:52px!important; height:calc(100dvh - 52px)!important;
    border-radius:0!important; overflow-y:auto!important;
  }
  #shell>main, html[data-user-role="student"] #shell>main,
  html[data-user-role="teacher"] #shell>main {
    margin:0!important;width:100%!important;max-width:100%!important;
    min-width:0!important;padding:8px 7px calc(12px + env(safe-area-inset-bottom))!important;
    overflow-x:clip;
  }
  #shell>main .page-head{margin-bottom:7px!important;gap:6px!important}
  #shell>main .page-head h1{font-size:17px!important;line-height:1.2!important}
  #shell>main .page-head p{font-size:10px!important;line-height:1.3!important}
  #shell>main .head-actions{gap:4px!important;flex-wrap:wrap;}
  #shell>main .head-actions button,#shell>main .head-actions select{padding:6px 8px!important;font-size:11px!important;border-radius:4px!important}
  #shell>main article,#shell>main .stat,#shell>main .cards>div,#shell>main .day-card{padding:9px!important;border-radius:4px!important}
  #shell>main .cards,#shell>main .live-room-grid,#shell>main .video-card-grid{gap:7px!important}
  #shell>main .tabs{gap:4px;padding-bottom:3px}
  #shell>main .tabs button{padding:6px 9px!important;font-size:11px;border-radius:4px!important}
  #shell>main .toolbar{gap:5px!important}
  #shell>main .toolbar input,#shell>main .toolbar select{font-size:12px!important;padding:7px 8px!important;border-radius:4px!important}
  #shell>main .stat b{font-size:17px!important}
  #shell>main .stat span{font-size:10px!important}
  .course-topic-card,.course-topic-item,.course-topic-add-menu,
  .course-topic-add-menu button,.quiz-question-card,.quiz-import,.quiz-option-text {
    border-radius:4px!important;
  }
  .course-topic-card-head{padding:8px!important;gap:7px!important}
  .course-topic-number{min-width:27px!important;height:27px!important;border-radius:4px!important;font-size:11px}
  .course-topic-title b{font-size:12px!important}
  .course-topic-body{padding:6px!important}
  .course-topic-item{padding:7px!important;gap:6px!important}
  .course-topic-item-actions{flex:1 1 100%!important;justify-content:flex-start!important}
  .course-topic-item-actions :is(button,a,select){font-size:10px!important;border-radius:4px!important}
  dialog{border-radius:5px!important;max-height:min(94dvh,880px);overflow-y:auto}
  #modalForm{padding:10px!important}
  #modalFields input,#modalFields textarea,#modalFields select{border-radius:4px!important}
  #toast{left:7px!important;right:7px!important;bottom:calc(8px + env(safe-area-inset-bottom))!important;padding:8px 10px!important;border-radius:4px!important;z-index:500}
  /* Conference: a single column of strictly bounded stage, roster, and controls. */
  #lesson {width:100%!important;max-width:100%!important;margin:0!important;padding:0!important}
  #lesson .page-head{display:flex!important;align-items:center!important;flex-wrap:nowrap!important;padding:5px 7px!important;margin:0 0 4px!important;height:43px!important}
  #lesson .page-head h1{font-size:13px!important}
  #lesson .page-head p{font-size:9px!important}
  #lesson .page-head .head-actions{width:auto!important;flex:0 0 auto!important}
  #lesson #backToLive{max-width:45px!important;min-width:40px!important;min-height:31px;padding:5px!important;font-size:0!important;overflow:hidden}
  #lesson #backToLive .ui-icon,#lesson #backToLive svg{width:16px;height:16px;margin:0!important}
  #lesson #endLiveLesson{padding:5px 7px!important;font-size:9px!important;max-width:84px}
  #lesson .conference-shell{
    display:block!important;position:relative!important;height:calc(100dvh - 52px - 43px - 12px - env(safe-area-inset-bottom))!important;
    min-height:0!important;max-height:none!important;overflow:hidden!important;
    border:1px solid #294369!important;
  }
  #lesson .conference-main{
    display:flex!important;flex-direction:column!important;height:100%!important;
    min-height:0!important;min-width:0!important;overflow:hidden!important;
  }
  #lesson .video-stage{
    position:relative!important;flex:1 1 0!important;min-height:0!important;
    height:auto!important;max-height:none!important;overflow:hidden!important;
  }
  #lesson #videoMount.video-mount, #lesson #videoMount{
    height:100%!important;min-height:0!important;max-height:100%!important;
    width:100%!important;max-width:100%!important;padding:3px!important;overflow:hidden!important;
    border-radius:3px!important;
  }
  #lesson .video-placeholder{min-height:0!important;max-width:100%;padding:8px;font-size:12px}
  #lesson #videoMount .ms-grid { min-height:0!important;max-height:100%!important; }
  #lesson #videoMount .ms-stage-badge{top:5px!important;left:5px!important;padding:3px 5px!important;font-size:9px!important;max-width:65%!important}
  #lesson #videoMount .ms-stage-fullscreen{top:5px!important;right:5px!important;border-radius:3px!important}
  #lesson #videoMount .ms-inline-self-stage{width:clamp(88px,25vw,148px)!important;max-width:30%!important;right:5px!important;bottom:5px!important;border-radius:3px!important}
  #lesson #videoMount .ms-teacher-pip-stage{width:clamp(100px,27vw,180px)!important;min-width:0!important;max-width:33%!important;top:5px!important;right:5px!important;border-radius:3px!important}
  #lesson #videoMount .ms-tile{min-height:0!important;border-radius:3px!important}
  #lesson .live-proctor-status{max-width:min(52%,180px)!important;min-width:0!important;top:5px!important;left:5px!important;bottom:auto!important;padding:4px!important;border-radius:3px!important}
  #lesson .live-proctor-status #liveProctorLocalPreview{width:34px!important;height:34px!important}
  #lesson .live-captions{bottom:7px!important;max-width:72%!important;border-radius:3px!important;font-size:11px!important}
  #lesson .raised-hand-alert{z-index:45;max-width:85%!important}
  #lesson .lesson-student-rail{
    position:relative!important;inset:auto!important;z-index:1!important;
    flex:0 0 auto!important;min-height:0!important;height:73px!important;max-height:73px!important;
    padding:3px 5px!important;overflow:hidden!important;
  }
  #lesson .rail-title{margin:0 0 2px!important;font-size:10px!important}
  #lesson .rail-title button{font-size:9px!important;padding:2px 5px!important;border-radius:3px!important}
  #lesson .lesson-student-rail-items{
    display:flex!important;flex-wrap:nowrap!important;overflow-x:auto!important;overflow-y:hidden!important;
    gap:4px!important;height:47px!important;max-height:47px!important;padding:0 0 2px!important;
  }
  #lesson .student-rail-card{
    height:44px!important;min-height:44px!important;max-height:44px!important;
    min-width:84px!important;width:84px!important;max-width:84px!important;flex:0 0 84px!important;
    grid-template-columns:29px minmax(0,1fr)!important;padding:3px!important;gap:3px!important;
    border-radius:3px!important;
  }
  #lesson .student-rail-card .rail-avatar{width:28px!important;height:28px!important;border-radius:3px!important}
  #lesson .student-rail-card>b{font-size:9px!important}
  #lesson .student-rail-card>small{font-size:8px!important}
  #lesson .conference-controls.zoom-dock{
    position:relative!important;inset:auto!important;bottom:auto!important;left:auto!important;right:auto!important;
    flex:0 0 auto!important;width:100%!important;height:auto!important;min-height:0!important;max-height:none!important;
    margin:0!important;padding:3px 3px calc(4px + env(safe-area-inset-bottom))!important;
    display:flex!important;flex-direction:column!important;gap:2px!important;overflow:visible!important;
    border-radius:0!important;
  }
  #lesson .zoom-primary{
    width:100%!important;display:flex!important;flex-wrap:nowrap!important;justify-content:space-evenly!important;
    align-items:stretch!important;gap:2px!important;min-width:0!important;overflow:hidden!important;
  }
  #lesson .zoom-control{
    display:flex!important;align-items:center!important;justify-content:center!important;
    flex:1 1 0!important;min-width:0!important;max-width:none!important;
    width:auto!important;height:43px!important;min-height:43px!important;max-height:43px!important;
    padding:3px 1px!important;margin:0!important;gap:1px!important;
    border-radius:3px!important;line-height:1.05!important;
  }
  #lesson .zoom-control>span:first-child{width:18px!important;height:19px!important;font-size:15px!important}
  #lesson .zoom-control>span:first-child .ui-icon{width:16px!important;height:16px!important}
  #lesson .zoom-control>span:last-child{font-size:clamp(8px,2.2vw,10px)!important;white-space:nowrap;max-width:100%!important;overflow:hidden;text-overflow:ellipsis}
  #lesson .zoom-control.danger{flex:1.12 1 0!important}
  #lesson .zoom-status{display:none!important}
  #lesson #liveMorePanel{
    position:absolute!important;left:4px!important;right:4px!important;bottom:calc(50px + env(safe-area-inset-bottom))!important;
    top:auto!important;width:auto!important;max-width:none!important;
    max-height:min(60dvh,430px)!important;overflow-y:auto!important;overflow-x:hidden!important;
    padding:6px!important;margin:0!important;z-index:70!important;border-radius:4px!important;
  }
  #lesson #liveMorePanel.hidden{display:none!important}
  #lesson .more-grid{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:4px!important}
  #lesson .more-grid>button,#lesson .more-grid>label{
    min-width:0!important;width:100%!important;min-height:37px!important;height:auto!important;
    padding:5px!important;border-radius:3px!important;font-size:10px!important;white-space:normal!important;
    overflow-wrap:anywhere;overflow:hidden;
  }
  #lesson .more-grid select{width:100%!important;min-width:0!important;height:27px!important;padding:2px!important;font-size:11px!important}
  #lesson .lesson-side{
    position:fixed!important;top:52px!important;bottom:0!important;right:0!important;left:auto!important;
    width:min(100vw,360px)!important;max-width:100%!important;
    max-height:calc(100dvh - 52px)!important;z-index:115!important;
    border-radius:4px 0 0 4px!important;overflow:hidden!important;
  }
  #lesson #messages{min-height:0!important}
  #lesson #chatForm{padding:6px!important}
  #lesson .lesson-drawer-head{padding:7px!important}
  #lesson .lesson-side-tabs{padding:4px!important}
  #lesson .lesson-side-tabs button{padding:6px!important}
  #lesson .device-popover,#lesson .live-popover{
    max-width:calc(100vw - 12px)!important;border-radius:4px!important;z-index:120!important;
  }
}
@media(max-width:900px) and (orientation:landscape) {
  #lesson .page-head{display:none!important}
  #lesson .conference-shell{height:calc(100dvh - 52px - 5px - env(safe-area-inset-bottom))!important}
  #lesson .lesson-student-rail{height:51px!important;max-height:51px!important}
  #lesson .lesson-student-rail .rail-title{display:none!important}
  #lesson .lesson-student-rail-items{height:44px!important;max-height:44px!important}
  #lesson #videoMount .ms-teacher-pip-stage{max-width:21%!important}
  #lesson #liveMorePanel{max-height:67dvh!important}
}
@media(max-width:380px){
  #shell>header #headerName{display:none!important}
  #shell>header .header-actions>.icon-btn{width:30px!important}
  #lesson .zoom-control>span:last-child{font-size:8px!important}
  #lesson #liveMorePanel .more-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  #lesson #videoMount .ms-inline-self-stage{width:85px!important}
}
@media(min-width:901px){
  #lesson .conference-shell{height:calc(100dvh - 150px)!important;min-height:420px!important;max-height:none!important}
  #lesson .conference-controls.zoom-dock{padding:6px 9px!important;min-height:58px!important;gap:5px!important}
  #lesson .zoom-control{min-height:42px!important;padding:4px 7px!important;min-width:58px!important;border-radius:4px!important}
  #lesson .zoom-control>span:last-child{font-size:10px!important}
  #lesson #liveMorePanel{max-height:65dvh!important;overflow-y:auto!important}
  #lesson .lesson-student-rail{max-height:105px!important;overflow:hidden!important}
  #lesson .student-rail-card{border-radius:4px!important}
}
/* Accessible focus ring independent of corner radius / visual density. */
#lesson :is(button,input,select,textarea):focus-visible,
#shell>main :is(button,input,select,textarea):focus-visible {outline:2px solid #5ab8fa!important;outline-offset:1px!important}

@media(min-width:901px){
 html[data-user-role="student"] #lesson .conference-shell {height:calc(100dvh - 150px)!important;min-height:420px!important}
 html[data-user-role="student"] #lesson .conference-main {
  display:flex!important;flex-direction:column!important;height:100%!important;min-height:0!important;overflow:hidden!important;
 }
 html[data-user-role="student"] #lesson .video-stage{
  flex:1 1 0!important;min-height:0!important;height:auto!important;max-height:none!important;
 }
 html[data-user-role="student"] #lesson #videoMount{
  height:100%!important;min-height:0!important;max-height:100%!important;overflow:hidden!important;
 }
 html[data-user-role="student"] #lesson .conference-controls.zoom-dock{
  flex:0 0 auto!important;position:relative!important;min-height:52px!important;margin:0!important;
  border-radius:0!important;padding:5px!important;
 }
}

@media(min-width:901px){
 #lesson .conference-controls.zoom-dock{top:0!important;bottom:auto!important;transform:none!important}
}

@media(max-width:900px){
 #lesson .lesson-side.open{transform:translateX(0)!important;visibility:visible!important;pointer-events:auto!important}
 #lesson .lesson-side:not(.open){transform:translateX(110%)!important;pointer-events:none!important}
 #lesson .lesson-drawer-backdrop.show{position:fixed!important;inset:52px 0 0!important;z-index:114!important}
}

@media(min-width:901px){
 #lesson .video-stage{
  display:flex!important;align-items:stretch!important;justify-content:stretch!important;
  min-height:0!important;overflow:hidden!important;
 }
 #lesson #videoMount.video-mount{
  position:relative!important;inset:auto!important;
  top:0!important;left:0!important;right:auto!important;bottom:auto!important;
  transform:none!important;flex:1 1 0!important;
  align-self:stretch!important;height:100%!important;min-height:0!important;max-height:100%!important;
  margin:0!important;overflow:hidden!important;
 }
}
