
/* Mobile foundation for school system (mainly teacher/student first) */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%;}
body{overflow-x:hidden;}
img,svg{max-width:100%;height:auto;}
@media (max-width: 1024px){
  .pm-main,.container,.wrap,.rec-wrap,.sch-wrap,.cfg-wrap,.sp-wrap,.ss-wrap,.mmg-wrap{max-width:100% !important;padding-left:14px !important;padding-right:14px !important;}
  .pm-grid,.pm-grid--home,.pm-grid--single,.sp-grid,.rec-grid,.sch-cardGrid,.sch-miniGrid,.cfg-miniGrid,.cfg-fieldGrid,.cfg-toggleGrid,.cc-grid-5,.cc-grid-4,.cc-grid-6,.cc-grid-student-accounts,.cc-grid-students-tools,.cc-grid-lessons-tools,.gc-stats{grid-template-columns:1fr !important;}
  .cc-grid-5 > *, .cc-grid-4 > *, .cc-grid-6 > *, .cc-grid-student-accounts > *, .cc-grid-students-tools > *, .cc-grid-lessons-tools > *{grid-column:auto !important;}
  .pm-topin,.topbar-inner,.tm-top-inner,.ss-top,.mmg-top{align-items:stretch !important;}
  .pm-cardin,.card-b,.rec-cardin,.cfg-panel,.sch-card,.sch-create,.sp-card,.ss-card{padding:16px !important;}
}
@media (max-width: 820px){
  input,select,textarea,button{font-size:16px !important;}
  .pm-topin,.topbar-inner,.tm-top-inner,.ss-top{flex-direction:column !important;align-items:stretch !important;gap:8px !important;}
  .pm-brand,.brand,.ss-brand,.sp-brand,.mmg-brand{width:100% !important;min-width:0 !important;}
  .pm-userbar,.nav,.actions,.sp-right,.rec-nav,.cfg-nav,.sch-actions,.sch-chipRow,.cfg-chipRow,.sp-tabs,.pm-actions{display:flex !important;flex-wrap:nowrap !important;overflow-x:auto !important;overflow-y:hidden !important;-webkit-overflow-scrolling:touch;justify-content:flex-start !important;gap:8px !important;padding-bottom:2px !important;scrollbar-width:none;}
  .pm-userbar::-webkit-scrollbar,.nav::-webkit-scrollbar,.actions::-webkit-scrollbar,.sp-right::-webkit-scrollbar,.rec-nav::-webkit-scrollbar,.cfg-nav::-webkit-scrollbar,.sch-actions::-webkit-scrollbar,.sch-chipRow::-webkit-scrollbar,.cfg-chipRow::-webkit-scrollbar,.sp-tabs::-webkit-scrollbar,.pm-actions::-webkit-scrollbar{display:none;}
  .pm-userbar > *, .nav > *, .actions > *, .sp-right > *, .rec-nav > *, .cfg-nav > *, .sch-actions > *, .sch-chipRow > *, .cfg-chipRow > *, .sp-tabs > *, .pm-actions > *{flex:0 0 auto !important;}
  .pm-userbar form,.sp-right form,.actions form,.nav form{flex:0 0 auto !important;}
  .pm-userbar .pm-btn,.pm-userbar .pm-pill,.pm-actions .pm-btn,.pm-actions .pm-pill,.sp-tabs .pm-btn,.sp-tabs .pm-secondary,.sp-tabs .pm-primary,.sp-right .pm-btn,.sp-right .pm-pill,.rec-nav .pm-btn,.cfg-nav a,.sch-actions .pm-btn,.ss-right .ss-topbtn{min-height:40px !important;padding:10px 12px !important;white-space:nowrap !important;}
  .pm-meta,.rec-kv,.sch-pointGrid,.sch-miniGrid,.cfg-miniGrid,.sp-stats,.sp-stats.sp-three{grid-template-columns:repeat(2,minmax(0,1fr)) !important;display:grid !important;gap:8px !important;}
  .pm-list-item,.pm-item{align-items:flex-start !important;}
  .pm-list-right{width:100% !important;display:flex !important;flex-wrap:wrap !important;gap:8px !important;}
  .pm-list-right .pm-btn{flex:1 1 calc(50% - 4px) !important;width:auto !important;min-width:120px !important;}
  .cc-btn-row,.pm-detail-nav{display:flex !important;flex-wrap:wrap !important;gap:8px !important;justify-content:stretch !important;}
  .cc-btn-row > *, .pm-detail-nav > *, .pm-detail-nav form{flex:1 1 calc(50% - 4px) !important;}
  .pm-detail-nav form > *{width:100% !important;}
  .ss-grid2{grid-template-columns:1fr !important;}
  .bar-inner{flex-direction:column !important;align-items:stretch !important;}
  .bar-inner .btn{width:100% !important;}
  .dash-history-grid{grid-template-columns:1fr !important;}
  .pm-mobile-form-grid{grid-template-columns:1fr !important;}
}
@media (max-width: 640px){
  .pm-main,.container,.wrap,.rec-wrap,.sch-wrap,.cfg-wrap,.sp-wrap,.ss-wrap,.mmg-wrap{padding-left:12px !important;padding-right:12px !important;}
  .pm-cardin,.card-b,.rec-cardin,.cfg-panel,.sch-card,.sch-create,.sp-card,.ss-card{padding:14px !important;}
  .pm-title,.pm-h3,.rec-title,.sch-title,.cfg-title,.sp-title{font-size:22px !important;line-height:1.2 !important;}
  .sp-title{font-size:24px !important;}
  .rec-title,.sch-title,.cfg-title{font-size:24px !important;}
  .sp-kv,.rec-kv,.sch-pointGrid,.sch-miniGrid,.cfg-miniGrid,.cfg-toggleGrid,.cfg-fieldGrid{grid-template-columns:1fr !important;}
  .pm-meta,.pm-grid,.pm-grid--home,.pm-grid--single,.sp-grid,.rec-grid,.sch-cardGrid,.cfg-layout,.gc-stats{grid-template-columns:1fr !important;}
  .pm-list-right .pm-btn,.cc-btn-row > *, .pm-detail-nav > *, .pm-detail-nav form{flex:1 1 100% !important;}
  .sp-pill{display:none !important;}
  .sp-right{justify-content:flex-start !important;}
  .rec-head,.cfg-head,.sch-heroTop{align-items:stretch !important;}
  .cfg-savein{flex-direction:column !important;align-items:stretch !important;}
  .cfg-saveActions{width:100% !important;}
  .cfg-saveActions > *{flex:1 1 100% !important;}
  .sch-formGrid,.rec-form-grid,.cc-grid-5,.cc-grid-4,.cc-grid-6,.cc-grid-student-accounts,.cc-grid-students-tools,.cc-grid-lessons-tools{grid-template-columns:1fr !important;}
  .table-mobile thead,.sp-table-mobile thead{display:none !important;}
  .table-mobile,.table-mobile tbody,.table-mobile tr,.table-mobile td,.sp-table-mobile,.sp-table-mobile tbody,.sp-table-mobile tr,.sp-table-mobile td{display:block !important;width:100% !important;}
  .table-mobile tr,.sp-table-mobile tr{padding:12px !important;margin-bottom:10px !important;border:1px solid rgba(148,163,184,.18) !important;border-radius:16px !important;background:#fff !important;}
  .table-mobile td,.sp-table-mobile td{display:flex !important;justify-content:space-between !important;align-items:flex-start !important;gap:10px !important;padding:8px 0 !important;border:0 !important;border-bottom:1px dashed rgba(148,163,184,.18) !important;text-align:left !important;}
  .table-mobile td:last-child,.sp-table-mobile td:last-child{border-bottom:0 !important;padding-bottom:0 !important;}
  .table-mobile td::before,.sp-table-mobile td::before{content:attr(data-label);display:block;flex:0 0 92px;font-size:12px;font-weight:800;color:#64748b;line-height:1.5;}
  .table-mobile td > *, .sp-table-mobile td > *{max-width:calc(100% - 100px);}
  .table-mobile .seg{justify-content:flex-end;}
  .table-mobile .seg label{padding:8px 10px !important;}
}
@media (max-width: 420px){
  .pm-main,.container,.wrap,.rec-wrap,.sch-wrap,.cfg-wrap,.sp-wrap,.ss-wrap,.mmg-wrap{padding-left:10px !important;padding-right:10px !important;}
  .pm-cardin,.card-b,.rec-cardin,.cfg-panel,.sch-card,.sch-create,.sp-card,.ss-card{padding:12px !important;}
  .pm-title,.sp-title,.rec-title,.sch-title,.cfg-title{font-size:20px !important;}
  .pm-chip,.sch-chip,.cfg-chip,.sp-pill,.ss-chip{font-size:12px !important;}
  .pm-input,.cfg-input,.cfg-select,.cfg-textarea,.sch-input,.sch-select,.sp-table,.pm-note input,.pm-note textarea,.pm-note select{font-size:16px !important;}
}
