/* Mobile overrides are scoped; desktop and permission visibility remain intact. */
.mobile-scrim,.mobile-drawer-close,.mobile-calendar-hint{display:none}
body .topbar [hidden]{display:none!important}
@media(max-width:1100px){
 body .app-shell{display:block}
 body .main{grid-column:1}
 body #mobileMenu{display:inline-grid;place-items:center}
 body .sidebar{transform:translateX(-105%)}
 body .sidebar.open{transform:translateX(0)}
 body .main,body .content,.view{min-width:0}
 body .topbar{display:flex!important;position:sticky!important;top:0;z-index:25;height:auto!important;min-height:64px!important;gap:10px!important;padding:10px 16px!important;padding-top:max(10px,env(safe-area-inset-top))!important;flex-wrap:wrap!important}
 body .topbar .search-box{max-width:none!important;min-width:0!important;flex:1 1 180px!important}
 body .topbar .topbar-actions{gap:6px!important}
 body .topbar .account-top-label,body .topbar .top-add-label{display:none!important}
 body .topbar .account-top-button,body .topbar #topAddLead,body .topbar #topLogout{width:44px!important;height:44px!important;min-height:44px!important;padding:0!important}
 body .topbar .role-switch select{width:150px!important;height:44px!important}
 body .topbar #mobileMenu{width:44px;height:44px;border:1px solid #dce4ef;border-radius:12px;background:white;color:#173763}
 body .sidebar{z-index:80;width:min(330px,88vw);height:100dvh;min-height:0;padding:20px 16px max(16px,env(safe-area-inset-bottom));overscroll-behavior:contain}
 body .sidebar .brand{padding-right:38px}
 body .sidebar .nav-item{min-height:48px;font-size:14px}
 .mobile-drawer-close{display:grid;place-items:center;position:absolute;right:12px;top:16px;width:44px;height:44px;border:1px solid #ffffff30;border-radius:12px;color:white;background:#ffffff10;font-size:24px}
 .mobile-scrim:not([hidden]){display:block;position:fixed;inset:0;z-index:79;border:0;background:rgba(12,24,41,.5);backdrop-filter:blur(3px)}
 body.mobile-menu-open{overflow:hidden}
 .content{padding-bottom:max(28px,env(safe-area-inset-bottom))!important}
 .table-wrap,.fc-table-wrap,[data-calendar-host],.week-calendar-wrap,.month-calendar-wrap{max-width:100%;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
 .mobile-calendar-hint{display:block;color:#62758c;font-size:12px;padding:10px 2px}
 .week-calendar-wrap,[data-calendar-host]:has(.week-calendar){scroll-snap-type:x proximity}
 .week-day{scroll-snap-align:start}
}
@media(max-width:600px){
 body .topbar{padding-inline:12px!important;gap:8px!important}
 body .topbar .search-box{flex:1 1 calc(100% - 60px)!important;height:44px!important}
 body .topbar #mobileMenu{order:0;flex:0 0 44px}
 body .topbar .search-box{order:1}
 body .topbar .topbar-actions{order:2;flex-wrap:nowrap!important}
 body .topbar .topbar-actions{width:100%;justify-content:flex-end!important;margin:0!important}
 body .topbar .role-switch{margin-right:auto!important;flex:1;min-width:0}
 body .topbar .role-switch select{width:100%!important;max-width:180px;font-size:14px!important}
 body .topbar .search-box input{font-size:16px!important}
 body input:not([type=checkbox]):not([type=radio]),body select,body textarea{font-size:16px!important;max-width:100%;min-width:0}
 body button{touch-action:manipulation}
 body :is(.primary-button,.secondary-button,.calendar-toolbar button,.segmented button,.filter-button,.table-tools button){min-height:44px}
 body .content{padding:20px 12px 32px}
 body .page-heading{display:flex;flex-direction:column;align-items:stretch;gap:14px;margin-bottom:20px}
 body .page-heading h1{font-size:26px;line-height:1.2;overflow-wrap:anywhere}
 body .page-heading>.secondary-button,body .filter-button{font-size:13px}
 .page-heading>div,.panel,.table-card,.fc-panel{min-width:0;max-width:100%}
 body .toolbar,body .table-tools,body .calendar-toolbar{flex-wrap:wrap;gap:10px}
 body .segmented{max-width:100%;overflow-x:auto;flex-wrap:nowrap}
 .segmented button{flex-shrink:0}
 body .kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 body .kpi-card{min-height:118px;padding:15px 12px}
 body .kpi-card>strong{font-size:24px}
 body .kpi-card .kpi-label{overflow-wrap:anywhere}
 body .form-grid{grid-template-columns:minmax(0,1fr)!important}
 body .form-grid>*{min-width:0;grid-column:auto!important}
 body .modal-backdrop{padding:0!important;align-items:stretch!important}
 body .modal-backdrop>.modal{width:100%!important;max-width:100%!important;max-height:100dvh!important;height:100dvh;border-radius:0!important;margin:0!important;overflow-y:auto;overscroll-behavior:contain;padding:0 0 env(safe-area-inset-bottom)!important}
 body dialog[open]{max-width:100vw!important;width:100vw!important;max-height:100dvh!important;height:100dvh;margin:0!important;border-radius:0!important;overflow:auto;box-sizing:border-box}
 body .modal-head{padding:18px 16px!important;gap:12px;background:white}
 body .modal-head h2{font-size:23px!important;overflow-wrap:anywhere}
 body .modal-head button{min-width:44px;min-height:44px;flex-shrink:0}
 body .modal form{padding-inline:16px!important}
 body .modal-actions{display:flex;flex-wrap:wrap;gap:10px;padding-bottom:max(16px,env(safe-area-inset-bottom));background:#fff}
 body .modal-actions button{flex:1 1 130px;min-height:48px}
 body .mobile-records{width:100%!important;min-width:0!important;display:block}
 .mobile-records thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
 body .mobile-records tbody{display:grid;gap:12px;padding:12px}
 body .mobile-records tr{display:block;padding:12px;border:1px solid #dce4ef;border-radius:14px;background:white;box-shadow:0 3px 12px #17376306}
 body .mobile-records td{display:grid;grid-template-columns:minmax(90px,32%) minmax(0,1fr);gap:12px;align-items:center;width:auto!important;height:auto;min-height:44px;padding:9px 0!important;white-space:normal!important;border:0;border-bottom:1px solid #edf1f6;overflow-wrap:anywhere;min-width:0!important}
 body .mobile-records td:last-child{border-bottom:0}
 .mobile-records td::before{content:attr(data-mobile-label);color:#62758c;font-size:11px;font-weight:650}
 body .mobile-records td[colspan]{display:block;text-align:center}
 .mobile-records td[colspan]::before{display:none}
 .mobile-records td>*{max-width:100%;min-width:0}
 .mobile-records td button{min-height:44px}
 .mobile-records td input[type=checkbox]{width:22px;height:22px}
 body .week-calendar,body #dashboardSharedCalendar .week-calendar,body #leadCalendarPanel .week-calendar{min-width:0;width:max-content;grid-template-columns:repeat(7,minmax(270px,calc(100vw - 48px)))}
 .week-calendar-wrap{max-height:72dvh;overflow:auto}
 body .month-calendar-weekdays,body .month-calendar-grid{min-width:630px}
 body .calendar-toolbar button{font-size:13px;padding:8px 12px}
 body .workspace-detail-grid,body .role-access-grid,body .permission-grid{grid-template-columns:1fr}
 body #financeCenter .fc-toolbar,body #financeCenter .fc-reportbar{flex-wrap:wrap;gap:12px}
 body #financeCenter #fcTabs{max-width:100%;overflow:auto;flex-wrap:nowrap}
 body #financeCenter #fcTabs button{min-height:44px;flex-shrink:0}
 body #financeCenter .fc-reportbar>div:last-child{flex-wrap:wrap}
 body #financeCenter .fc-reportbar button{min-height:44px}
 body #financeCenter .cost-sources{grid-template-columns:1fr}
 body .teacher-top-nav{width:100%;overflow:auto;min-width:0}
 body .teacher-top-nav button{min-height:44px;flex-shrink:0}
 body .toast{max-width:calc(100vw - 24px);right:12px;bottom:max(16px,env(safe-area-inset-bottom))}
}
@media(prefers-reduced-motion:reduce){.sidebar{transition:none!important}}
