/* ============================================================================
   mcw_mobile.css — طبقة الجوال الواحدة لكل الأنظمة (تُحمَّل على مستوى التطبيق بعد أنماط الشاشات)
   ─────────────────────────────────────────────────────────────────────────────
   نقطتا القطع المعتمدتان: ≤768 هاتف/لمس · ≤980 السجلّ بملء الشاشة يتكدّس عموديًّا. (≤480 تفاصيل الهاتف الضيّق)
   تغطّي: العناصر المشتركة (.pur-* · .hr-* · .mcwdv-* · .cb-* · .mdp-* · .mcw-*) — وتُبقي كتلة /*@mobile*/ في mcw_pur.css كما هي
   (يعتمد عليها pur_smartbar.prMobileCss). ما هنا إضافيّ ولا يكسر شاشة قائمة.
   القواعد العامّة: (١) حقول 16px وأهداف لمس ≥40px (٢) الرأس والأدوات تلتفّ (٣) المؤشّرات اثنان في الصفّ والأخير يمتدّ
   (٤) المراحل/التبويبات/الأزرار الذكية/الشرائح تتمرّر أفقيًّا بلا شريط (٥) السجلّ بملء الشاشة كتلة واحدة والخطّ الزمني أسفله
   (٦) صفوف الجداول التفصيلية بطاقات بعنوان الخلية data-label (يضعه MCW_UI.labelTable) (٧) النوافذ ورقة سفلية أو ملء الشاشة
   (٨) الجداول الموحّدة: بطاقات على الهاتف بأزرار الصفّ (٩) سلّم الطبقات الموحّد لشاشات HR
   ========================================================================== */

/* ── (٩) سلّم الطبقات الموحّد — تصحيح شاشات HR القديمة (كانت 9000/9500 فتختفي خلف ملء الشاشة) ── */
.hr-modal{z-index:2147483250 !important}
.hr-toast{z-index:2147483600 !important}
.hr-full{z-index:2147483200}

/* ── (١) اللمس ── */
@media (max-width:768px),(hover:none) and (pointer:coarse){
  .pur input:not([type=checkbox]):not([type=radio]),.pur select,.pur textarea,.hr input:not([type=checkbox]):not([type=radio]),.hr select,.hr textarea,
  .mcwdv input,.mcwdv select,.cb-in,.mdp-in{font-size:16px !important;min-height:42px}
  .pur .pur-btn,.hr .hr-btn,.hr button.hr-btn,.mcwdv-bar button,.mcwdv-ract,.msb-btn,.psb-btn,.pur-chip,.hr-chip,.pur-tab,.hr-tab,.mcw-ch-tabs button,.nf-tabs button,.sl-tabs button{min-height:40px}
  .pur .pur-btn.sm,.hr .hr-btn.sm{min-height:36px}
  .mcwdv-cards .mcwdv-card{padding:12px 14px}
}

/* ── (٢)–(٤) الهاتف ── */
@media (max-width:768px){
  .pur,.hr{padding:10px 10px calc(16px + env(safe-area-inset-bottom))}
  .pur-head,.hr-head{flex-wrap:wrap;gap:10px}
  .pur-title,.hr-title{flex:1 1 100%}
  .pur-tools,.hr-tools{flex:1 1 100%;flex-wrap:wrap;justify-content:flex-start}
  .pur-tools .pur-btn,.hr-tools .hr-btn{flex:1 1 auto}
  .pur-tools .pur-btn.gold,.pur-tools .pur-btn.primary,.hr-tools .hr-btn.primary{flex:1 1 100%}
  /* المؤشّرات (القديمة) — اثنان في الصفّ والأخير الفرديّ يمتدّ؛ الجديد يستعمل بطاقات المكتبة */
  .pur-kpis,.hr-kpis{grid-template-columns:1fr 1fr;gap:8px}
  .pur-kpis>*:last-child:nth-child(odd),.hr-kpis>*:last-child:nth-child(odd){grid-column:1/-1}
  /* شرائح وتبويبات ومراحل تتمرّر أفقيًّا */
  .pur-chips,.hr-chips,.pur-stages,.hr-stages,.pur-tabs,.hr-tabs,.nf-tabs,.sl-tabs,.gj-tabs,.mcw-smartbar,.pur-smartbar,.hr-fnav{
    display:flex;flex-wrap:nowrap;overflow-x:auto;scroll-snap-type:x proximity;scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch}
  .pur-chips::-webkit-scrollbar,.pur-stages::-webkit-scrollbar,.pur-tabs::-webkit-scrollbar,.hr-tabs::-webkit-scrollbar,.nf-tabs::-webkit-scrollbar,.sl-tabs::-webkit-scrollbar,.mcw-smartbar::-webkit-scrollbar,.hr-fnav::-webkit-scrollbar{display:none}
  .pur-stages>*,.hr-stages>*,.pur-tabs>*,.hr-tabs>*,.nf-tabs>*,.sl-tabs>*{flex:0 0 auto;scroll-snap-align:center}
  /* لوحات فلاتر الشاشة */
  .pur.gj-scope,.pur.vc-scope,.pur.nf-scope,.hr-scope{grid-template-columns:1fr !important}
  .mcwdv-s-pop{inset-inline:3vw !important;width:auto !important;max-height:80vh;overflow:auto}
  /* الجداول الموحّدة: البطاقات على الهاتف تعرض أزرار الصفّ صفًّا مستقلًّا */
  .mcwdv-card .acts{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px;padding-top:8px;border-top:1px dashed var(--line,#e0e7df)}
  .mcwdv-card .acts .mcwdv-ract{flex:1 1 auto;justify-content:center}
  .mcwdv-card .sel{position:absolute;top:10px;inset-inline-end:10px}
  .mcwdv-card{position:relative}
  .mcwdv-loadmore{margin:6px 0 10px}
  /* الجداول العادية (pur-grid/hr-tbl) تتمرّر أفقيًّا بعمود أوّل ثابت */
  .pur-tblwrap,.hr-tblwrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
  .pur-tblwrap table th:first-child,.pur-tblwrap table td:first-child,.hr-tblwrap table th:first-child,.hr-tblwrap table td:first-child{position:sticky;inset-inline-start:0;background:var(--paper,#fff);z-index:1}
  /* الرسائل والنوافذ */
  .pur-toast,.hr-toast,.mcw-toast{inset-inline:10px !important;transform:none !important;max-width:none !important;bottom:calc(12px + env(safe-area-inset-bottom)) !important}
  .pur-modal,.hr-modal,.mcw-modal{padding:0 !important;align-items:flex-end !important;place-items:end center !important}
  .pur-mbox,.hr-sheet,.mcw-mbox{width:100vw !important;max-width:none !important;border-radius:16px 16px 0 0 !important;max-height:92vh !important;overflow:auto}
  .pur-mbox .mrow,.mcw-mbox .mrow,.hr-sheet-f{position:sticky;bottom:0;background:var(--paper,#fff);padding-top:10px;margin-top:10px;border-top:1px solid var(--line,#e0e7df)}
  .pur-mbox:has(input:not([type=checkbox])),.mcw-mbox:has(input:not([type=checkbox])),.mcw-mbox.full,.pur-mbox.full{height:100vh;max-height:100vh !important;border-radius:0 !important}
  .mdp-pop{width:min(312px,94vw) !important}
  .cb-menu{max-width:94vw}
  .pur-fg,.hr-fg,.nf-form{grid-template-columns:1fr !important}
}

/* ── (٥) السجلّ بملء الشاشة يتكدّس، والخطّ الزمني أسفله ── */
@media (max-width:980px){
  .pur-full,.hr-full{display:block;overflow:auto;-webkit-overflow-scrolling:touch}
  .pur-fbar,.hr-fbar{position:sticky;top:0;z-index:6;flex-wrap:wrap}
  .pur-fbody,.hr-fbody{display:block}
  .pur-fmain,.hr-fmain{display:block;width:auto;padding:12px}
  .pur-chatter{display:block !important;width:auto;flex:none;border-inline-start:0;border-top:1px solid var(--line,#e0e7df)}
  .pur-chatter .mcw-ch-fab{display:none !important}   /* اللوح ظاهر أسفل النموذج فلا حاجة للزرّ العائم */
  .mcw-smartbar{position:sticky;top:48px;z-index:5}
}
@media (max-width:980px) and (max-height:520px){.pur-fbar,.hr-fbar{position:static}}

/* ── (٦) صفوف الجداول التفصيلية بطاقات — لأي جدول يحمل data-mobile-cards أو الأصناف المعروفة ── */
@media (max-width:768px){
  table[data-mobile-cards],table.pur-lines,table.hr-lines,table.mcw-lines{display:block;width:100% !important;table-layout:auto}
  table[data-mobile-cards] thead,table.pur-lines thead,table.hr-lines thead,table.mcw-lines thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
  table[data-mobile-cards] tbody,table[data-mobile-cards] tr,table.hr-lines tbody,table.hr-lines tr,table.mcw-lines tbody,table.mcw-lines tr{display:block;width:100%}
  table[data-mobile-cards] tr,table.hr-lines tr,table.mcw-lines tr{display:grid;grid-template-columns:repeat(auto-fill,minmax(128px,1fr));gap:6px 10px;border:1px solid var(--line,#e0e7df);border-radius:12px;padding:10px;margin-bottom:8px;background:var(--paper,#fff);counter-increment:mcwrow}
  table[data-mobile-cards] tr::before,table.hr-lines tr::before,table.mcw-lines tr::before{content:"بند " counter(mcwrow);grid-column:1/-1;font-size:11px;font-weight:800;color:var(--mut,#5f7268)}
  table[data-mobile-cards] tbody,table.hr-lines tbody,table.mcw-lines tbody{counter-reset:mcwrow}
  table[data-mobile-cards] td,table.hr-lines td,table.mcw-lines td{display:block;border:0 !important;padding:0 !important;min-width:0}
  table[data-mobile-cards] td[data-label]::before,table.hr-lines td[data-label]::before,table.mcw-lines td[data-label]::before{content:attr(data-label);display:block;font-size:10.5px;font-weight:800;color:var(--mut,#5f7268);margin-bottom:2px}
  table[data-mobile-cards] td.pm-wide,table[data-mobile-cards] td.pm-act,table.hr-lines td.pm-wide,table.hr-lines td.pm-act,table.mcw-lines td.pm-wide,table.mcw-lines td.pm-act{grid-column:1/-1}
  table[data-mobile-cards] td.pm-act,table.hr-lines td.pm-act,table.mcw-lines td.pm-act{display:flex;gap:6px;justify-content:flex-end}
  table[data-mobile-cards] td input,table[data-mobile-cards] td select,table[data-mobile-cards] td .cb,table.hr-lines td input,table.hr-lines td select,table.mcw-lines td input,table.mcw-lines td select{width:100% !important;min-width:0}
  table[data-mobile-cards] tr.pm-span,table.hr-lines tr.pm-span,table.mcw-lines tr.pm-span{display:block}
  table[data-mobile-cards] tr.pm-span::before,table.hr-lines tr.pm-span::before,table.mcw-lines tr.pm-span::before{display:none}
}

/* ── الهاتف الضيّق ── */
@media (max-width:480px){
  .pur-crumb,.hr-crumb{font-size:12px}
  .pur-fbar .pur-nav span,.hr-fbar .hr-nav span{display:none}
  .mcwdv-cards{grid-template-columns:1fr !important}
  .pur-kpis,.hr-kpis{grid-template-columns:1fr 1fr}
}

/* ── طباعة: إخفاء ما لا يُطبع ── */
@media print{.mcw-ch-fab,.pur-fbar,.hr-fbar,.mcw-smartbar,.mcwdv-bar,.pur-chatter,.pur-tools,.hr-tools{display:none !important}}
