/* MUNJAZ_MOBILE_FINAL_R2_144_4_START
 * الطبقة النهائية لتحسين تجربة مُنجَز على الجوال.
 * لا تغيّر الوظائف أو ترتيب الصفحات على الكمبيوتر.
 */

@media (max-width:760px){
  html{
    -webkit-text-size-adjust:100%;
    text-size-adjust:100%;
    scroll-padding-top:82px;
    scroll-padding-bottom:96px;
  }
  body.ui-government-dashboard{
    overflow-x:hidden!important;
    padding-bottom:calc(88px + env(safe-area-inset-bottom))!important;
  }
  body.ui-government-dashboard main.page-shell,
  body.role-system_admin main.sa-unified-page-shell{
    width:calc(100% - 16px)!important;
    max-width:none!important;
    margin-inline:auto!important;
    padding-top:14px!important;
    padding-bottom:calc(94px + env(safe-area-inset-bottom))!important;
    overflow:visible!important;
  }

  /* هيدر صغير وواضح وثابت أثناء التصفح */
  body.role-manager.ui-government-dashboard .munjaz-header,
  body.role-teacher.ui-government-dashboard .munjaz-header{
    position:sticky!important;
    top:0!important;
    z-index:880!important;
    width:100%!important;
    min-height:68px!important;
    height:68px!important;
    padding-top:env(safe-area-inset-top)!important;
    box-sizing:content-box!important;
    backdrop-filter:saturate(140%) blur(14px);
    -webkit-backdrop-filter:saturate(140%) blur(14px);
  }
  body.role-manager.ui-government-dashboard .munjaz-header-inner,
  body.role-teacher.ui-government-dashboard .munjaz-header-inner{
    width:calc(100% - 20px)!important;
    min-height:68px!important;
    height:68px!important;
    gap:7px!important;
  }
  body.role-manager.ui-government-dashboard .munjaz-brand,
  body.role-teacher.ui-government-dashboard .munjaz-brand{gap:7px!important;min-width:0!important}
  body.role-manager.ui-government-dashboard .munjaz-logo,
  body.role-teacher.ui-government-dashboard .munjaz-logo{
    width:39px!important;height:39px!important;min-width:39px!important;border-radius:12px!important
  }
  body.role-manager.ui-government-dashboard .munjaz-header-wordmark-r3,
  body.role-teacher.ui-government-dashboard .munjaz-header-wordmark-r3{
    width:88px!important;max-width:25vw!important;height:auto!important
  }
  body.role-manager.ui-government-dashboard .manager-account-summary{
    min-height:46px!important;padding:2px 4px!important;border-radius:14px!important
  }
  body.role-manager.ui-government-dashboard .manager-account-summary .munjaz-avatar,
  body.role-teacher.ui-government-dashboard .munjaz-avatar{
    width:42px!important;height:42px!important;min-width:42px!important;border-width:2px!important
  }
  body.role-teacher.ui-government-dashboard .teacher-user-copy-r276 strong{
    max-width:118px!important;font-size:12.5px!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important
  }
  body.role-teacher.ui-government-dashboard .teacher-user-copy-r276>small,
  body.role-manager.ui-government-dashboard .munjaz-brand-copy-r3 small,
  body.role-teacher.ui-government-dashboard .munjaz-brand-copy-r3 small{display:none!important}
  body.role-manager.ui-government-dashboard .manager-account-popover{
    position:fixed!important;top:calc(66px + env(safe-area-inset-top))!important;left:10px!important;right:10px!important;width:auto!important;max-width:none!important;z-index:1200!important
  }

  /* شريط التنقل السفلي: منطقة لمس أكبر وتباين أوضح */
  body.role-manager.ui-government-dashboard .bottom-navigation,
  body.role-teacher.ui-government-dashboard .bottom-navigation{
    position:fixed!important;
    left:6px!important;right:6px!important;bottom:max(6px,env(safe-area-inset-bottom))!important;
    width:auto!important;min-height:66px!important;height:auto!important;
    padding:5px 6px calc(5px + env(safe-area-inset-bottom)/3)!important;
    border-radius:20px!important;
    box-shadow:0 14px 34px rgba(8,52,37,.18)!important;
    backdrop-filter:saturate(145%) blur(16px)!important;
    -webkit-backdrop-filter:saturate(145%) blur(16px)!important;
    z-index:900!important;
    transition:transform .18s ease,opacity .18s ease!important;
  }
  body.role-manager.ui-government-dashboard .bottom-nav-item,
  body.role-teacher.ui-government-dashboard .bottom-nav-item{
    min-width:0!important;min-height:54px!important;padding:5px 2px!important;gap:3px!important;border-radius:14px!important
  }
  body.role-manager.ui-government-dashboard .bottom-nav-item .icon,
  body.role-manager.ui-government-dashboard .bottom-nav-item svg,
  body.role-teacher.ui-government-dashboard .bottom-nav-item .icon,
  body.role-teacher.ui-government-dashboard .bottom-nav-item svg{
    width:21px!important;height:21px!important;flex:0 0 21px!important
  }
  body.role-manager.ui-government-dashboard .bottom-nav-item span,
  body.role-teacher.ui-government-dashboard .bottom-nav-item span{
    max-width:62px!important;font-size:9.5px!important;line-height:1.2!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important
  }
  body.ui-government-dashboard.munjaz-mobile-input-active .bottom-navigation,
  body.ui-government-dashboard.modal-open .bottom-navigation,
  body.ui-government-dashboard:has(.modal-backdrop:not([hidden])) .bottom-navigation{
    opacity:0!important;pointer-events:none!important;transform:translateY(calc(120% + env(safe-area-inset-bottom)))!important
  }

  /* عنوان الصفحة */
  body.ui-government-dashboard .page-title-card{
    min-height:0!important;padding:14px!important;gap:10px!important;border-radius:16px!important;align-items:flex-start!important;flex-direction:column!important
  }
  body.ui-government-dashboard .page-title-main{width:100%!important;gap:10px!important;align-items:flex-start!important}
  body.ui-government-dashboard .page-title-icon{width:42px!important;height:42px!important;min-width:42px!important;border-radius:13px!important}
  body.ui-government-dashboard .page-title-card h1{font-size:19px!important;line-height:1.4!important}
  body.ui-government-dashboard .page-title-card p{font-size:11px!important;line-height:1.75!important}
  body.ui-government-dashboard .page-title-tools{
    width:100%!important;display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:7px!important
  }
  body.ui-government-dashboard .page-title-tools .btn{width:100%!important;min-width:0!important;justify-content:center!important}

  /* بطاقات ولوحات عامة */
  body.ui-government-dashboard :where(.panel,.achievement-card,.settings-section,.login-card,.verify-card){
    border-radius:16px!important;padding:13px!important
  }
  body.ui-government-dashboard .panel-head{
    gap:10px!important;align-items:flex-start!important;flex-direction:column!important
  }
  body.ui-government-dashboard .panel-head>:where(.button-row,form,.actions){width:100%!important}
  body.ui-government-dashboard .panel-head .button-row{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:7px!important}
  body.ui-government-dashboard .panel-head .button-row .btn{width:100%!important;min-width:0!important}
  body.ui-government-dashboard .stats-strip{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}
  body.ui-government-dashboard .metric-card{min-height:80px!important;padding:10px!important;border-radius:15px!important}
  body.ui-government-dashboard .metric-card .metric-copy strong{font-size:20px!important}

  /* النماذج: حجم لمس مناسب ومنع تكبير Safari التلقائي */
  body.ui-government-dashboard :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),select,textarea){
    max-width:100%!important;font-size:16px!important;line-height:1.4!important;border-radius:12px!important
  }
  body.ui-government-dashboard :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),select){min-height:46px!important}
  body.ui-government-dashboard textarea{min-height:108px!important;padding:11px 12px!important;resize:vertical!important}
  body.ui-government-dashboard :where(.form-grid,.review-grid,.meta-grid,.flag-grid,.evidence-grid){grid-template-columns:1fr!important;gap:10px!important}
  body.ui-government-dashboard .filter-bar{
    grid-template-columns:1fr!important;padding:11px!important;gap:9px!important;border-radius:15px!important
  }
  body.ui-government-dashboard .filter-bar .search-wide{grid-column:auto!important}
  body.ui-government-dashboard :where(.filter-field,label){scroll-margin-top:92px}
  body.ui-government-dashboard :where(.filter-field label,.field-label,.form-label){font-size:11px!important;line-height:1.5!important}
  body.ui-government-dashboard :where(.btn,button:not(.bottom-nav-item)){
    min-height:44px;touch-action:manipulation
  }
  body.ui-government-dashboard .btn{padding:9px 12px!important;font-size:12.5px!important;border-radius:11px!important}
  body.ui-government-dashboard .btn.small{min-height:38px!important;padding:7px 9px!important;font-size:11px!important}
  body.ui-government-dashboard .button-row.munjaz-mobile-button-grid{
    display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:7px!important;width:100%!important
  }
  body.ui-government-dashboard .button-row.munjaz-mobile-button-grid>*{min-width:0!important;width:100%!important;margin:0!important}
  body.ui-government-dashboard .button-row.munjaz-mobile-button-grid>form .btn{width:100%!important}

  /* تبويبات قابلة للسحب بدل الضغط والالتفاف */
  body.ui-government-dashboard :where(.tabs,.settings-tabs,.report-tabs,.status-tabs).munjaz-mobile-tabs,
  body.ui-government-dashboard .tabs{
    display:flex!important;flex-wrap:nowrap!important;overflow-x:auto!important;overflow-y:hidden!important;gap:7px!important;
    padding-bottom:4px!important;scroll-snap-type:x proximity;scrollbar-width:none;-webkit-overflow-scrolling:touch
  }
  body.ui-government-dashboard :where(.tabs,.settings-tabs,.report-tabs,.status-tabs).munjaz-mobile-tabs::-webkit-scrollbar,
  body.ui-government-dashboard .tabs::-webkit-scrollbar{display:none}
  body.ui-government-dashboard :where(.tabs,.settings-tabs,.report-tabs,.status-tabs).munjaz-mobile-tabs>* ,
  body.ui-government-dashboard .tabs>*{flex:0 0 auto!important;scroll-snap-align:start;white-space:nowrap!important}

  /* الجداول البسيطة: بطاقات واضحة على الجوال */
  body.ui-government-dashboard .table-responsive.munjaz-mobile-card-wrap{
    overflow:visible!important;margin:0!important;padding:0!important;border:0!important;background:transparent!important
  }
  body.ui-government-dashboard table.munjaz-mobile-card-table{
    display:block!important;width:100%!important;min-width:0!important;border:0!important;background:transparent!important
  }
  body.ui-government-dashboard table.munjaz-mobile-card-table thead{
    position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip:rect(0 0 0 0)!important;white-space:nowrap!important
  }
  body.ui-government-dashboard table.munjaz-mobile-card-table tbody{display:grid!important;gap:10px!important;width:100%!important}
  body.ui-government-dashboard table.munjaz-mobile-card-table tbody tr{
    display:block!important;width:100%!important;margin:0!important;overflow:hidden!important;
    border:1px solid var(--border,#dce8e0)!important;border-radius:15px!important;background:var(--card,#fff)!important;
    box-shadow:0 5px 15px rgba(12,64,44,.04)!important
  }
  body.ui-government-dashboard table.munjaz-mobile-card-table tbody td{
    display:grid!important;grid-template-columns:minmax(86px,34%) minmax(0,1fr)!important;align-items:start!important;gap:9px!important;
    width:100%!important;min-width:0!important;min-height:42px!important;padding:10px 11px!important;
    border:0!important;border-bottom:1px solid var(--border,#e4ece8)!important;text-align:start!important;white-space:normal!important;
    overflow:visible!important;overflow-wrap:anywhere!important;background:transparent!important
  }
  body.ui-government-dashboard table.munjaz-mobile-card-table tbody td:last-child{border-bottom:0!important}
  body.ui-government-dashboard table.munjaz-mobile-card-table tbody td::before{
    content:attr(data-munjaz-mobile-label);display:block!important;color:var(--muted,#687a71)!important;
    font-size:10px!important;font-weight:900!important;line-height:1.55!important
  }
  body.ui-government-dashboard table.munjaz-mobile-card-table tbody td[data-munjaz-mobile-label=""]::before{display:none!important}
  body.ui-government-dashboard table.munjaz-mobile-card-table tbody td :where(.btn,.status,.badge){max-width:100%!important}
  body.ui-government-dashboard table.munjaz-mobile-card-table tbody td .button-row{
    display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:6px!important;width:100%!important
  }
  body.ui-government-dashboard table.munjaz-mobile-card-table tbody td .button-row .btn,
  body.ui-government-dashboard table.munjaz-mobile-card-table tbody td form .btn{width:100%!important}

  /* الجداول المعقدة تبقى قابلة للسحب مع تلميح واضح */
  body.ui-government-dashboard .table-responsive.munjaz-mobile-scroll-wrap{
    position:relative!important;width:100%!important;max-width:100%!important;overflow:auto!important;
    margin-inline:0!important;padding:0 0 8px!important;border-radius:14px!important;
    overscroll-behavior-inline:contain;scrollbar-width:thin;-webkit-overflow-scrolling:touch
  }
  body.ui-government-dashboard .table-responsive.munjaz-mobile-scroll-wrap table{min-width:680px!important}
  .munjaz-mobile-scroll-hint{
    display:flex;align-items:center;justify-content:center;gap:6px;margin:0 0 7px;padding:6px 9px;
    border:1px dashed var(--border,#dce8e0);border-radius:10px;background:var(--card,#fff);color:var(--muted,#66776f);
    font-size:10px;font-weight:800
  }

  /* النوافذ واللوحات العائمة تتحول إلى Bottom Sheet */
  body.ui-government-dashboard .modal-backdrop{
    padding:10px 8px max(8px,env(safe-area-inset-bottom))!important;align-items:flex-end!important
  }
  body.ui-government-dashboard :where(.modal-card,.modal-card.compact){
    width:100%!important;max-width:none!important;max-height:min(90dvh,760px)!important;margin:0!important;
    overflow:auto!important;border-radius:22px 22px 14px 14px!important;padding:18px 14px calc(16px + env(safe-area-inset-bottom))!important
  }
  body.ui-government-dashboard .modal-close{top:10px!important;left:10px!important;width:42px!important;height:42px!important}
  body.ui-government-dashboard .modal-actions{
    display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:7px!important;width:100%!important
  }
  body.ui-government-dashboard .modal-actions .btn,
  body.ui-government-dashboard .modal-actions form,
  body.ui-government-dashboard .modal-actions form .btn{width:100%!important;min-width:0!important}
  body.role-manager.ui-government-dashboard .floating-panel,
  body.role-teacher.ui-government-dashboard .floating-panel{
    position:fixed!important;top:auto!important;left:6px!important;right:6px!important;bottom:calc(80px + env(safe-area-inset-bottom))!important;
    width:auto!important;max-width:none!important;max-height:68dvh!important;padding:14px!important;border-radius:20px!important;z-index:1100!important
  }

  /* وسائط وشواهد */
  body.ui-government-dashboard :where(img,video,canvas){max-width:100%}
  body.ui-government-dashboard :where(iframe,embed,object){max-width:100%!important}
  body.ui-government-dashboard :where(.evidence-preview,.evidence-viewer,.pdf-viewer) iframe{width:100%!important;height:68dvh!important;min-height:360px!important}

  /* إدارة النظام على الجوال */
  body.role-system_admin .sa-app-header{position:sticky!important;top:0!important;z-index:880!important;padding-top:env(safe-area-inset-top)!important}
  body.role-system_admin .sa-mobile-nav{padding-bottom:calc(5px + env(safe-area-inset-bottom))!important}
  body.role-system_admin .sa-context-bar{gap:10px!important;align-items:flex-start!important;flex-direction:column!important}
  body.role-system_admin .sa-context-home{width:100%!important;justify-content:center!important}
  body.role-system_admin .sa-unified-page-shell :where(.table-responsive,.functional-list-table-wrap-r8970214,.users-table-wrap-r8970215){max-width:100%!important}
}

@media (max-width:430px){
  body.role-teacher.ui-government-dashboard .teacher-user-copy-r276 strong{max-width:92px!important;font-size:11.5px!important}
  body.role-manager.ui-government-dashboard .munjaz-header-wordmark-r3,
  body.role-teacher.ui-government-dashboard .munjaz-header-wordmark-r3{width:78px!important;max-width:22vw!important}
  body.ui-government-dashboard .page-title-tools,
  body.ui-government-dashboard .panel-head .button-row,
  body.ui-government-dashboard .modal-actions,
  body.ui-government-dashboard .button-row.munjaz-mobile-button-grid{grid-template-columns:1fr!important}
  body.ui-government-dashboard .stats-strip{gap:7px!important}
  body.ui-government-dashboard table.munjaz-mobile-card-table tbody td{grid-template-columns:minmax(78px,32%) minmax(0,1fr)!important;padding:9px 10px!important}
}

@media (max-width:370px){
  body.role-teacher.ui-government-dashboard .teacher-user-copy-r276{display:none!important}
  body.role-manager.ui-government-dashboard .munjaz-logo,
  body.role-teacher.ui-government-dashboard .munjaz-logo{width:36px!important;height:36px!important;min-width:36px!important}
  body.role-manager.ui-government-dashboard .bottom-nav-item span,
  body.role-teacher.ui-government-dashboard .bottom-nav-item span{font-size:8.8px!important;max-width:50px!important}
}

@media (max-width:920px) and (orientation:landscape){
  body.role-manager.ui-government-dashboard .munjaz-header,
  body.role-teacher.ui-government-dashboard .munjaz-header,
  body.role-manager.ui-government-dashboard .munjaz-header-inner,
  body.role-teacher.ui-government-dashboard .munjaz-header-inner{min-height:58px!important;height:58px!important}
  body.role-manager.ui-government-dashboard .munjaz-logo,
  body.role-teacher.ui-government-dashboard .munjaz-logo{width:34px!important;height:34px!important;min-width:34px!important}
  body.role-manager.ui-government-dashboard .bottom-navigation,
  body.role-teacher.ui-government-dashboard .bottom-navigation{min-height:56px!important}
  body.role-manager.ui-government-dashboard .bottom-nav-item,
  body.role-teacher.ui-government-dashboard .bottom-nav-item{min-height:45px!important}
  body.role-manager.ui-government-dashboard .bottom-nav-item span,
  body.role-teacher.ui-government-dashboard .bottom-nav-item span{display:none!important}
  body.ui-government-dashboard main.page-shell{padding-bottom:70px!important}
}

@media (hover:none) and (pointer:coarse){
  body.ui-government-dashboard :where(a,button,.btn,.bottom-nav-item){-webkit-tap-highlight-color:transparent}
}

@media (prefers-reduced-motion:reduce){
  body.ui-government-dashboard .bottom-navigation{transition:none!important}
}
/* MUNJAZ_MOBILE_FINAL_R2_144_4_END */

/* MUNJAZ_UI_FINAL_AUDIT_R2_144_5_START
 * مراجعة نهائية مشتركة للجوال والكمبيوتر.
 * تعالج تعارضات الثيمات، الجداول غير المغلفة، والنوافذ المخصصة.
 */
/* لا يظهر تلميح السحب على الكمبيوتر حتى لو بقي عنصر من جلسة جوال سابقة. */
.munjaz-mobile-scroll-hint{display:none!important}

@media (max-width:760px){
  .munjaz-mobile-scroll-hint{display:flex!important}

  /* توافق كامل مع كثافة الثيم المضغوطة: تبقى مناطق اللمس آمنة على الجوال. */
  body.ui-government-dashboard[data-munjaz-density="compact"] :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),select){
    min-height:46px!important;font-size:16px!important
  }
  body.ui-government-dashboard[data-munjaz-density="compact"] :where(.btn,button:not(.bottom-nav-item)){
    min-height:44px!important
  }
  body.ui-government-dashboard[data-munjaz-density="compact"] .btn.small{min-height:40px!important}

  /* صيغة Safe Area متوافقة بدون قسمة داخل calc(). */
  body.role-manager.ui-government-dashboard .bottom-navigation,
  body.role-teacher.ui-government-dashboard .bottom-navigation{
    padding:5px 6px calc(5px + env(safe-area-inset-bottom))!important
  }

  /* دعم الجداول المباشرة وغير المغلفة، مع إبقاء الجداول التي لها تصميم جوال أصلي كما هي. */
  body.ui-government-dashboard .munjaz-mobile-card-wrap{
    overflow:visible!important;margin:0!important;padding:0!important;border:0!important;background:transparent!important
  }
  body.ui-government-dashboard .munjaz-mobile-scroll-wrap{
    position:relative!important;width:100%!important;max-width:100%!important;overflow:auto!important;
    margin-inline:0!important;padding:0 0 8px!important;border-radius:14px!important;
    overscroll-behavior-inline:contain;scrollbar-width:thin;-webkit-overflow-scrolling:touch
  }
  body.ui-government-dashboard .munjaz-mobile-scroll-wrap table.munjaz-mobile-scroll-table{min-width:680px!important}
  body.ui-government-dashboard .munjaz-mobile-auto-wrap{width:100%!important;max-width:100%!important}

  /* النوافذ المخصصة في الزيارات الصفية وإدارة المستخدمين تصبح مريحة على الجوال. */
  body.ui-government-dashboard .cv-modal-backdrop{
    padding:8px 6px max(8px,env(safe-area-inset-bottom))!important;align-items:flex-end!important
  }
  body.ui-government-dashboard .cv-modal{
    width:100%!important;max-width:none!important;max-height:92dvh!important;margin:0!important;
    border-radius:22px 22px 14px 14px!important
  }
  body.ui-government-dashboard .users-modal-backdrop-r8970215{
    padding:8px 6px max(8px,env(safe-area-inset-bottom))!important;align-items:flex-end!important
  }
  body.ui-government-dashboard .users-modal-r8970215{
    width:100%!important;max-width:none!important;max-height:92dvh!important;margin:0!important;overflow:auto!important;
    border-radius:22px 22px 14px 14px!important
  }
  body.ui-government-dashboard.munjaz-mobile-overlay-active .bottom-navigation{
    opacity:0!important;pointer-events:none!important;transform:translateY(calc(120% + env(safe-area-inset-bottom)))!important
  }

  /* تحسينات خاصة بالشاشات الصغيرة جدًا داخل النوافذ المخصصة. */
  body.ui-government-dashboard .cv-modal-foot,
  body.ui-government-dashboard .users-modal-actions-r8970215{gap:7px!important}
}

@media (max-width:430px){
  body.ui-government-dashboard .cv-modal-foot,
  body.ui-government-dashboard .users-modal-actions-r8970215{
    display:grid!important;grid-template-columns:1fr!important;width:100%!important
  }
  body.ui-government-dashboard .cv-modal-foot :where(.cv-btn,.btn,form),
  body.ui-government-dashboard .users-modal-actions-r8970215 :where(.btn,form){width:100%!important;min-width:0!important}
  body.ui-government-dashboard .cv-modal-foot form :where(.cv-btn,.btn),
  body.ui-government-dashboard .users-modal-actions-r8970215 form .btn{width:100%!important}
}

@media print{
  .munjaz-mobile-scroll-hint{display:none!important}
}
/* MUNJAZ_UI_FINAL_AUDIT_R2_144_5_END */

