/* SEGaza V3.3 — Student-first mobile workspace */
.student-filter-toggle{display:none}
@media(max-width:760px){
  /* Keep the list as the main workspace. */
  #view-students .section-head{top:64px!important;margin-bottom:6px!important;min-height:52px!important;padding:7px 9px!important}
  #view-students .section-head h3{font-size:17px!important}
  #view-students .section-head{display:grid!important;grid-template-columns:minmax(0,1fr) auto auto!important;align-items:center!important}
  #view-students .student-mobile-more,#view-students .student-filter-toggle{display:inline-flex!important;min-height:37px!important;padding:6px 10px!important;font-size:12px!important}
  #view-students .student-filter-toggle{border:1px solid #dce5ee;border-radius:11px;background:#fff;color:#234966;font-weight:800}

  /* Filters are optional instead of permanently consuming the screen. */
  #view-students .student-filters{display:none!important;position:relative!important;top:auto!important;margin:0 0 7px!important;padding:9px!important;border-radius:13px!important;background:#fff!important;box-shadow:0 8px 22px rgba(16,45,72,.08)!important}
  #view-students.ux-student-filters-open .student-filters{display:grid!important;grid-template-columns:1fr 1fr!important;gap:7px!important}
  #view-students.ux-student-filters-open .student-filters input{grid-column:1/-1!important}
  #view-students.ux-student-filters-open .student-filters .btn{grid-column:1/-1!important}

  /* No permanent bulk toolbar: show it only after selection as a contextual bar. */
  #view-students #studentBulkBar.ux-no-selection{display:none!important}
  #view-students #studentBulkBar:not(.ux-no-selection){
    position:fixed!important;left:10px!important;right:10px!important;bottom:74px!important;top:auto!important;z-index:70!important;
    display:flex!important;flex-direction:column!important;gap:7px!important;padding:9px 10px!important;margin:0!important;
    border:1px solid #dbe6ef!important;border-radius:16px!important;background:rgba(255,255,255,.98)!important;
    box-shadow:0 16px 42px rgba(13,45,72,.2)!important;backdrop-filter:blur(12px)!important;
  }
  #view-students #studentBulkBar .bulk-actions-wrap{display:flex!important;flex-wrap:nowrap!important;overflow-x:auto!important;width:100%!important;gap:6px!important;padding-bottom:2px!important}
  #view-students #studentBulkBar .bulk-actions-wrap .btn{flex:0 0 auto!important;white-space:nowrap!important;min-height:36px!important;font-size:11.5px!important;padding:6px 9px!important}

  /* Give almost the full viewport to the students list. */
  #view-students .table-card{margin-top:4px!important}
  #view-students .table-scroll{max-height:calc(100dvh - 178px)!important;overflow:auto!important;overscroll-behavior:contain!important;-webkit-overflow-scrolling:touch!important}
  #view-students .ux-responsive-table{width:920px!important;min-width:920px!important;table-layout:auto!important}
  #view-students .ux-responsive-table td,#view-students .ux-responsive-table th{padding:7px 8px!important;font-size:12px!important;white-space:nowrap!important}

  /* Only select + student name are fixed. Grade and everything else slide horizontally. */
  #view-students #studentsTable tr>td:nth-child(1),#view-students table thead th:nth-child(1){
    position:sticky!important;right:0!important;left:auto!important;top:auto!important;
    width:42px!important;min-width:42px!important;max-width:42px!important;background:#fff!important;z-index:31!important;border-left:1px solid #e2e8f0!important;text-align:center!important
  }
  #view-students table thead th:nth-child(1){top:0!important;background:#eef3f8!important;z-index:54!important}
  #view-students #studentsTable tr>td:nth-child(2),#view-students table thead th:nth-child(2){
    position:sticky!important;right:42px!important;left:auto!important;top:auto!important;
    width:205px!important;min-width:205px!important;max-width:205px!important;background:#fff!important;z-index:30!important;border-left:1px solid #e2e8f0!important
  }
  #view-students table thead th:nth-child(2){top:0!important;background:#eef3f8!important;z-index:53!important}
  #view-students #studentsTable tr:nth-child(even)>td:nth-child(1),#view-students #studentsTable tr:nth-child(even)>td:nth-child(2){background:#f8fafc!important}

  /* Explicitly release the old fixed grade column. */
  #view-students #studentsTable tr>td:nth-child(3),#view-students table thead th:nth-child(3){
    position:relative!important;right:auto!important;left:auto!important;width:auto!important;min-width:82px!important;max-width:none!important;background:inherit!important;z-index:auto!important;text-align:center!important
  }
  #view-students table thead th:nth-child(3){position:sticky!important;top:0!important;background:#f4f7fb!important;z-index:16!important}
  #view-students #studentsTable tr>td:nth-child(n+3){position:relative!important;right:auto!important;left:auto!important;max-width:none!important}
  #view-students table thead th:nth-child(n+3){position:sticky!important;right:auto!important;left:auto!important;top:0!important;background:#f4f7fb!important;z-index:15!important}

  /* Student identity is the visual anchor. Allow two lines and keep initiative directly underneath. */
  #view-students .student-primary-cell{cursor:pointer!important;padding-top:7px!important;padding-bottom:7px!important;white-space:normal!important}
  #view-students .student-primary-cell .student-name-with-signals{display:flex!important;align-items:flex-start!important;gap:4px!important;white-space:normal!important}
  #view-students .student-primary-cell b{display:-webkit-box!important;-webkit-line-clamp:2!important;-webkit-box-orient:vertical!important;overflow:hidden!important;white-space:normal!important;text-overflow:ellipsis!important;max-width:168px!important;font-size:13.5px!important;line-height:1.35!important;color:#173653!important}
  #view-students .student-row-meta{margin-top:4px!important;min-height:18px!important;white-space:normal!important}
  #view-students .student-primary-cell .initiative-pill{display:inline-flex!important;max-width:168px!important;font-size:9.5px!important;padding:2px 6px!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important}
  #view-students #studentsTable tr>td:nth-child(4){min-width:112px!important}
  #view-students #studentsTable tr>td:nth-child(5){min-width:118px!important}
  #view-students #studentsTable tr>td:nth-child(6){min-width:104px!important}
  #view-students #studentsTable tr>td:nth-child(7){min-width:102px!important}
  #view-students #studentsTable tr>td:nth-child(8){min-width:88px!important}
  #view-students #studentsTable tr>td:nth-child(9){min-width:128px!important}

  #view-students:after{content:'اسم الطالب ثابت — اسحب أفقيًا لباقي البيانات'!important;font-size:10.5px!important;color:#718096!important;padding:5px 2px 0!important}
}
