/* Khóa tỷ lệ giao diện điện thoại, tránh tự phóng to/thu nhỏ khi nhập liệu */
@media (max-width: 720px){
  :root{
    font-size:16px;
    -webkit-text-size-adjust:100%;
    text-size-adjust:100%;
    --mobile-page-width:100%;
    --mobile-side-gap:14px;
  }

  html{
    width:100%;
    min-width:0;
    max-width:100%;
    overflow-x:hidden;
    overflow-x:clip;
    -webkit-text-size-adjust:100%;
    text-size-adjust:100%;
  }

  body{
    width:100%;
    min-width:0;
    max-width:100%;
    overflow-x:hidden!important;
    overflow-x:clip!important;
    overscroll-behavior-x:none;
  }

  body,#app,#login,#dashboardMain,.student-main,
  .mobile-appbar,.mobile-page-tabs,.mobile-dashboard-home,
  .portal-section,.panel,.toolbar,.finance-dashboard{
    box-sizing:border-box;
    max-width:100%!important;
  }

  *,*::before,*::after{box-sizing:border-box}
  img,svg,video,canvas{max-width:100%;height:auto}
  iframe{max-width:100%}

  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea{
    min-width:0;
    max-width:100%;
    font-size:16px!important;
    line-height:1.35!important;
  }

  input[type="date"],input[type="time"],input[type="datetime-local"]{min-height:48px}
  button,a,input,select,textarea{touch-action:manipulation}

  #dashboardMain,.student-main{
    width:100%!important;
    max-width:100%!important;
    padding-right:var(--mobile-side-gap)!important;
    padding-left:var(--mobile-side-gap)!important;
  }

  .mobile-appbar{width:100%;min-height:66px;flex:none!important}
  .mobile-app-brand img{width:43px!important;height:43px!important;min-width:43px!important;max-width:43px!important}
  .mobile-app-actions>button{width:44px!important;height:44px!important;min-width:44px!important;min-height:44px!important;max-width:44px!important;max-height:44px!important}
  .mobile-page-tabs{width:100%}
  .mobile-page-tabs button{min-height:54px!important;font-size:13px!important}

  .mobile-module-track{grid-auto-columns:178px!important;width:100%;max-width:100%}
  .mobile-module-card{width:178px!important;min-width:178px!important;max-width:178px!important;min-height:180px!important}
  .mobile-action-window,.mobile-recent,.student-hero,.portal-section{width:100%;max-width:100%}

  .admin-profile-dialog{
    position:fixed!important;
    inset:8px!important;
    width:auto!important;
    min-width:0!important;
    max-width:none!important;
    height:auto!important;
    max-height:none!important;
    margin:0!important;
    overflow:hidden!important;
    border-radius:18px!important;
  }

  @supports (height:100svh){
    .admin-profile-dialog{
      top:max(8px,env(safe-area-inset-top))!important;
      right:8px!important;
      bottom:max(8px,env(safe-area-inset-bottom))!important;
      left:8px!important;
      height:calc(100svh - max(8px,env(safe-area-inset-top)) - max(8px,env(safe-area-inset-bottom)))!important;
    }
  }

  .admin-profile-dialog form{
    display:grid;
    width:100%;
    height:100%;
    min-height:0;
    grid-template-rows:auto minmax(0,1fr);
    overflow:hidden;
  }

  .admin-profile-head{min-height:76px;flex:none;padding:14px 15px!important}
  .admin-profile-head-icon{width:42px!important;height:42px!important;min-width:42px!important}
  .admin-profile-head h2{font-size:18px!important;line-height:1.2}
  .admin-profile-head p{font-size:10px!important}
  .admin-profile-close{width:42px!important;height:42px!important;min-width:42px!important;min-height:42px!important}

  .admin-profile-body{
    display:block!important;
    min-height:0;
    padding:12px!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
  }

  .admin-profile-media{display:grid!important;grid-template-columns:1fr!important;gap:12px!important;width:100%}
  .admin-profile-preview-card,.admin-profile-fields,.admin-profile-sync{width:100%;max-width:100%}
  .admin-avatar-preview{width:112px!important;height:112px!important;min-width:112px!important;min-height:112px!important}
  .admin-cover-preview{width:100%;height:150px!important;min-height:150px!important}

  .admin-profile-upload label,
  .admin-profile-fields label,
  .admin-profile-help,
  .admin-profile-sync,
  .admin-profile-error{font-size:12px!important;line-height:1.45!important}

  .admin-profile-upload input,
  .admin-profile-fields input,
  .admin-profile-fields textarea,
  .admin-profile-fields select{
    width:100%!important;
    min-height:48px!important;
    padding:11px 12px!important;
    border-radius:11px!important;
    font-size:16px!important;
  }

  .admin-profile-fields textarea{min-height:110px!important}
  .admin-profile-image-actions{display:grid!important;grid-template-columns:1fr 1fr;gap:8px!important}
  .admin-profile-image-actions button,.admin-profile-actions button{min-height:46px!important;font-size:13px!important}
  .admin-profile-fields{display:block!important;margin-top:12px;padding:13px!important}
  .admin-profile-fields label{display:block!important;margin-bottom:13px!important}

  .admin-profile-actions{
    position:sticky;
    bottom:-12px;
    z-index:5;
    display:grid!important;
    grid-template-columns:1fr 1fr;
    gap:8px!important;
    margin:8px -13px -13px!important;
    padding:12px 13px calc(12px + env(safe-area-inset-bottom))!important;
    border-top:1px solid #dbe7f1;
    background:#fff;
  }

  .admin-profile-actions .primary{min-width:0!important}
  table{max-width:100%}
  .table-wrap,.panel,.card,.student-card,.notice-card{max-width:100%;overflow-x:auto}
  pre,code,.long-text,[data-long-text]{overflow-wrap:anywhere;word-break:break-word}
}

@media (max-width:390px){
  :root{--mobile-side-gap:10px}
  .mobile-module-track{grid-auto-columns:166px!important}
  .mobile-module-card{width:166px!important;min-width:166px!important;max-width:166px!important}
  .mobile-page-tabs button{font-size:12px!important}
  .admin-profile-actions{grid-template-columns:1fr}
}
