/* Shared responsive safeguards for Cloud Horizon authenticated portals. */
html{max-width:100%;overflow-x:hidden;-webkit-text-size-adjust:100%}
body{max-width:100%;overflow-x:hidden}
img,svg,video,canvas{max-width:100%}
button,a,input,select,textarea{touch-action:manipulation}
.table-wrap,.table,.result-table{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
.student-logout{display:inline-flex;align-items:center;gap:6px;color:#667085;font-size:10px;font-weight:700;white-space:nowrap}
.student-logout span{display:inline}
.portal-menu-toggle{display:none;border:0;background:#eef3fb;color:#071850;width:40px;height:40px;border-radius:10px;align-items:center;justify-content:center;font-size:21px;cursor:pointer}
.global-logout{display:inline-flex!important;align-items:center;justify-content:center;min-height:38px;padding:0 13px!important;border:1px solid #d9e1ec!important;border-radius:9px!important;background:#fff!important;color:#b42318!important;text-decoration:none!important;font-size:10px!important;font-weight:800!important;white-space:nowrap}
.global-logout:hover{background:#fff4f4!important;border-color:#f0bcbc!important}
.portal-floating-logout{position:fixed;top:16px;right:18px;z-index:1100;box-shadow:0 8px 24px #0718501f}

@media(max-width:1200px){
  .admin-content,.institute-content,.student-content,.content{padding:22px!important}
  .kpi-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  .quick-grid{grid-template-columns:repeat(4,minmax(0,1fr))!important}
  .module-card-grid,.class-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .stats{grid-template-columns:repeat(3,minmax(0,1fr))!important}
}

@media(max-width:900px){
  .admin-sidebar,.student-sidebar,.side{position:fixed!important;inset:0 auto 0 0!important;width:min(290px,86vw)!important;height:100dvh!important;transform:translateX(-105%)!important;transition:transform .24s ease!important;z-index:1000!important;overflow-y:auto!important;box-shadow:18px 0 45px #02081740}
  .admin-sidebar.open,.student-sidebar.open,.side.open{transform:translateX(0)!important}
  .admin-main,.institute-main,.student-main,.main{margin-left:0!important;width:100%!important;min-width:0!important}
  .sidebar-toggle,.student-menu,.portal-menu-toggle{display:inline-flex!important;flex:0 0 40px}
  .admin-header,.institute-header,.student-top,.top{position:sticky;top:0;z-index:40;min-height:70px;height:auto!important;padding:14px 18px!important;gap:12px}
  .admin-header>div,.top>div{min-width:0}
  .admin-header h1,.top h1{font-size:20px!important;overflow-wrap:anywhere}
  .header-actions{gap:8px!important}
  .header-actions a{white-space:nowrap}
  .admin-dashboard-grid,.admin-lower-grid,.dashboard-grid,.grid,.layout,.app-grid,.support-layout{grid-template-columns:1fr!important}
  .module-tools,.toolbar{flex-wrap:wrap}
  .module-tools>*,.toolbar>*{min-width:0}
  .applications-panel,.admin-widget,.panel,.card,.app-panel{min-width:0}
  .table table,.table-wrap table,.result-table table{min-width:720px}
  dialog{max-height:90dvh;overflow:auto}
}

@media(max-width:640px){
  .admin-content,.institute-content,.student-content,.content{padding:14px!important}
  .admin-header,.institute-header,.student-top,.top{padding:11px 13px!important}
  .admin-header p,.student-search,.student-account div,.student-account>svg{display:none!important}
  .top-actions{gap:9px!important}
  .student-account{padding-left:8px!important}
  .student-logout span{display:none}
  .kpi-grid,.admin-stats,.summary-grid,.result-summary,.document-grid,.stats,.fields,.module-card-grid,.class-grid,.quick-grid,.profile-details{grid-template-columns:1fr!important}
  .overview-welcome,.welcome-row,.module-hero,.panel-heading,.head,.top{align-items:flex-start!important}
  .overview-welcome,.welcome-row,.module-hero,.head{display:block!important}
  .head nav,.header-actions,.dash-actions,.record-downloads,.actions{display:flex;flex-wrap:wrap!important}
  .head nav a,.header-actions a,.dash-actions a{min-height:40px;align-items:center}
  .global-logout{min-height:40px!important}
  .module-tools form,.module-tools,.toolbar form,.toolbar select{width:100%!important}
  .course,.course-head,.material-item,.profile-card,.assignment-list>article{grid-template-columns:1fr!important}
  .application-timeline{grid-template-columns:1fr 1fr!important}
  .applicant-dash{width:calc(100% - 20px)!important;margin:18px auto!important}
  .applicant-hero,.app-panel{padding:20px!important}
  .inst-header{height:auto!important;min-height:68px;padding:10px 13px!important;gap:10px}
  .inst-header>div{gap:10px!important;flex-wrap:wrap;justify-content:flex-end}
  .inst-brand b{font-size:13px!important}
  .inst-brand img{width:38px!important;height:38px!important}
  .welcome h2,.applicant-hero h1{font-size:25px!important}
  .top>b{font-size:11px;max-width:40%;text-align:right}
  input,select,textarea{font-size:16px!important;max-width:100%}
  button,.btn,a{min-height:38px}
}

@media(max-width:400px){
  .student-account{display:none!important}
  .top-actions>button{padding:4px}
  .application-timeline{grid-template-columns:1fr!important}
}

@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}
}
