/*
 * إصلاح ظهور الرئيسية على الجوال — 8.1.5-p4.6
 * النطاق: شاشات الجوال فقط، وصفحة الرئيسية والهيدر وشريط التنقل السفلي.
 * لا يغيّر السايدبار أو أي صفحة أخرى أو منطق التشغيل.
 */

@media (max-width:720px){
  html,
  body{
    max-width:100%;
    overflow-x:hidden;
    overscroll-behavior-x:none;
  }

  body{
    margin:0;
    padding-bottom:0!important;
  }

  .acmnp40-front-shell{
    width:100%;
    max-width:none;
    margin:0;
    padding:0 8px calc(92px + env(safe-area-inset-bottom))!important;
    overflow-x:clip;
  }

  /* تحرير عرض المحتوى بالكامل على الجوال دون تعديل السايدبار نفسه. */
  .acmnp40-front-shell .acmnp40-portal-layout{
    display:block!important;
    width:100%;
    min-width:0;
    margin:8px 0 0!important;
  }
  .acmnp40-front-shell .acmnp40-front-main{
    width:100%!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
    overflow-x:clip!important;
  }

  /* هيدر جوال متوازن: قائمة، عنوان مرن، إشعارات وخروج. */
  .acmnp40-front-shell .acmnp40-p1-topbar{
    position:sticky;
    top:0;
    z-index:10030;
    display:grid!important;
    grid-template-columns:44px minmax(0,1fr) auto;
    align-items:center;
    gap:7px;
    width:calc(100% + 16px);
    min-height:64px;
    margin:0 -8px!important;
    padding:8px max(8px,env(safe-area-inset-right)) 8px max(8px,env(safe-area-inset-left))!important;
    border-radius:0 0 16px 16px!important;
  }
  .acmnp40-front-shell .acmnp40-p1-mobile-menu{
    width:42px;
    height:42px;
    min-width:42px;
    padding:0;
  }
  .acmnp40-front-shell .acmnp40-p1-brand{
    min-width:0;
    width:100%;
    gap:0;
    overflow:hidden;
  }
  .acmnp40-front-shell .acmnp40-p1-brand-mark,
  .acmnp40-front-shell .acmnp40-p1-brand small,
  .acmnp40-front-shell .acmnp40-p1-brand p{
    display:none!important;
  }
  .acmnp40-front-shell .acmnp40-p1-brand>div{
    min-width:0;
    width:100%;
  }
  .acmnp40-front-shell .acmnp40-p1-brand h1{
    display:block;
    width:100%;
    margin:0;
    overflow:hidden;
    color:#123f67;
    font-size:15px!important;
    line-height:1.35;
    text-align:center;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
  .acmnp40-front-shell .acmnp40-p1-userbar{
    display:flex;
    align-items:center;
    gap:5px;
    min-width:0;
  }
  .acmnp40-front-shell .acmnp40-p1-user{
    display:none!important;
  }
  .acmnp40-front-shell .acmnp40-p1-icon-btn{
    width:40px;
    height:40px;
    min-width:40px;
    padding:0;
    border-radius:12px;
    font-size:17px;
  }
  .acmnp40-front-shell .acmnp40-p1-icon-btn>span{
    top:-4px;
    left:-4px;
    min-width:19px;
    width:auto;
    height:19px;
    padding:0 4px;
    border-width:2px;
    border-radius:10px;
    font-size:9px;
    line-height:19px;
  }

  /* الرئيسية: منع الإزاحة، ضغط المسافات، وإظهار بداية الصفحة بوضوح. */
  .acmnp40-front-shell .acmnp40-dashboard-page{
    width:100%;
    min-width:0;
    margin:0;
    padding:0!important;
    gap:10px!important;
    scroll-margin-top:72px;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-heading{
    display:grid!important;
    grid-template-columns:1fr;
    gap:10px;
    width:100%;
    min-width:0;
    margin:0;
    padding:14px!important;
    border-radius:15px!important;
    box-shadow:0 10px 24px rgba(16,61,88,.14);
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-heading>div{
    min-width:0;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-heading small{
    margin-bottom:4px;
    font-size:11px;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-heading h2{
    margin:0 0 5px;
    font-size:20px!important;
    line-height:1.35;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-heading p{
    font-size:12px;
    line-height:1.65;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-heading-actions{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto;
    align-items:center;
    gap:8px;
    width:100%;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-heading-actions span{
    min-width:0;
    overflow:hidden;
    font-size:10px;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-refresh{
    min-height:38px;
    padding:8px 11px;
    border-radius:10px;
    font-size:11px;
    white-space:nowrap;
  }

  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-group{
    width:100%;
    min-width:0;
    margin:0;
    padding:11px!important;
    border-radius:15px!important;
    box-shadow:0 7px 20px rgba(25,72,92,.06);
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-group>header{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto;
    align-items:center!important;
    gap:8px;
    width:100%;
    min-width:0;
    margin:0 0 10px;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-group>header>div{
    min-width:0;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-group>header small{
    font-size:10px;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-group>header h3{
    margin-top:2px;
    font-size:15px!important;
    line-height:1.45;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-group>header button{
    min-height:36px;
    padding:7px 9px;
    border-radius:9px;
    font-size:10px;
    white-space:nowrap;
  }

  /* كروت مدمجة بعمودين بدل الكارت الرأسي الضخم. */
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-cards{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    grid-auto-rows:1fr;
    align-items:stretch;
    gap:8px!important;
    width:100%;
    min-width:0;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-card{
    display:flex!important;
    flex-direction:column;
    align-items:stretch;
    justify-content:center;
    width:100%!important;
    min-width:0!important;
    min-height:105px!important;
    height:auto!important;
    block-size:auto!important;
    margin:0!important;
    padding:11px!important;
    border-radius:14px!important;
    text-align:right!important;
    overflow:hidden;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-card:after,
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-card.is-success:after,
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-card.is-warning:after,
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-card.is-danger:after,
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-card.is-primary:after,
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-card.is-muted:after{
    left:-17px;
    bottom:-19px;
    width:58px;
    height:58px;
    pointer-events:none;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-card:hover{
    transform:none;
    box-shadow:none;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-card span{
    position:relative;
    z-index:1;
    overflow-wrap:anywhere;
    font-size:11px!important;
    line-height:1.45;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-card strong{
    position:relative;
    z-index:1;
    margin:6px 0 4px!important;
    overflow-wrap:anywhere;
    font-size:24px!important;
    line-height:1.05!important;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-card strong.is-money{
    font-size:14px!important;
    line-height:1.45!important;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-card small{
    position:relative;
    z-index:1;
    overflow-wrap:anywhere;
    color:#748994;
    font-size:9.5px!important;
    line-height:1.45;
  }

  /* جدول أداء الاستشاريين يتحول إلى بطاقات قابلة للقراءة بلا تمرير أفقي. */
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-table-wrap{
    width:100%;
    overflow:visible!important;
    border:0;
    background:transparent;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-table{
    display:block;
    width:100%;
    min-width:0!important;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-table thead{
    display:none;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-table tbody{
    display:grid;
    gap:9px;
    width:100%;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-table tr{
    display:grid;
    width:100%;
    overflow:hidden;
    border:1px solid #dce8ec;
    border-radius:13px;
    background:#fff;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-table td{
    display:grid;
    grid-template-columns:105px minmax(0,1fr);
    align-items:center;
    gap:8px;
    width:100%;
    min-width:0!important;
    padding:8px 10px!important;
    border:0!important;
    border-bottom:1px solid #e8eef1!important;
    background:transparent!important;
    font-size:11px!important;
    text-align:right!important;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-table td:last-child{
    border-bottom:0!important;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-table td:before{
    color:#526b77;
    font-weight:800;
    line-height:1.4;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-table td:nth-child(1):before{content:"الاستشاري"}
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-table td:nth-child(2):before{content:"الجمعيات"}
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-table td:nth-child(3):before{content:"المهام"}
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-table td:nth-child(4):before{content:"المنجز"}
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-table td:nth-child(5):before{content:"المتبقي"}
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-table td:nth-child(6):before{content:"المتأخر"}
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-table td:nth-child(7):before{content:"الاجتماعات"}
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-table td:nth-child(8):before{content:"الورش"}
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-table td:nth-child(9):before{content:"الإنجاز"}
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-table td:nth-child(10):before{content:"التفاصيل"}
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-progress{
    min-width:0;
    width:100%;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-detail-btn{
    width:100%;
    min-height:34px;
    padding:7px 9px;
    font-size:10px;
  }

  /* البوب أب على الجوال. */
  .acmnp40-front-shell .acmnp40-dashboard-modal{
    padding:0!important;
  }
  .acmnp40-front-shell .acmnp40-dashboard-modal>section{
    width:100vw!important;
    max-height:100dvh!important;
    min-height:100dvh;
    border-radius:0!important;
  }
  .acmnp40-front-shell .acmnp40-dashboard-modal>section>header{
    padding:13px 14px;
  }
  .acmnp40-front-shell .acmnp40-dashboard-modal h2{
    font-size:19px;
  }
  .acmnp40-front-shell .acmnp40-dashboard-modal-tools{
    display:grid!important;
    grid-template-columns:1fr;
    padding:10px 12px;
  }
  .acmnp40-front-shell .acmnp40-dashboard-modal-body{
    min-height:0;
    padding:12px;
  }

  /* شريط سفلي ثابت دون تغطية آخر المحتوى. */
  .acmnp40-front-shell .acmnp40-p3-mobile-nav{
    min-height:66px;
    padding:5px max(4px,env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(4px,env(safe-area-inset-left));
  }
  .acmnp40-front-shell .acmnp40-p3-mobile-nav button{
    min-width:0;
    padding:3px 1px;
  }
  .acmnp40-front-shell .acmnp40-p3-mobile-nav span{
    font-size:18px;
    line-height:1;
  }
  .acmnp40-front-shell .acmnp40-p3-mobile-nav small{
    overflow:hidden;
    max-width:100%;
    font-size:9px;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
}

@media (max-width:350px){
  .acmnp40-front-shell .acmnp40-p1-topbar{
    grid-template-columns:40px minmax(0,1fr) auto;
    gap:4px;
  }
  .acmnp40-front-shell .acmnp40-p1-brand h1{font-size:13px!important}
  .acmnp40-front-shell .acmnp40-p1-icon-btn,
  .acmnp40-front-shell .acmnp40-p1-mobile-menu{
    width:38px;
    height:38px;
    min-width:38px;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-cards{
    grid-template-columns:1fr!important;
  }
  .acmnp40-front-shell .acmnp40-dashboard-page .acmnp40-dashboard-card{
    min-height:92px!important;
  }
}
