/* =============================================================================
   إعدادات العملاء: الحالات والتصنيفات (#taxonomyClientsSubView) وتوزيع العملاء (#clientDistributionSubView).
   الأساس العام لصفوف الإعدادات في 02-metrics-mobile-first.css؛ هنا تخطيط الصفحتين وأزرارهما.
   ملاحظة: قاعدة الأزرار والحقول العامة تحت 900px في 03 قاعدة أساس بلا !important تُغلب بالأولوية وحدها؛
   يبقى !important هنا فقط أمام قواعد 03 التي ما زالت بـ !important (.page والبطاقات والشبكات) وألوان الحقول في 02.
   ============================================================================= */

/* ---------- شريط الحفظ أعلى الإعدادات ---------- */
#ayanSettingsSaveCenterHost{
  display:flex;align-items:center;justify-content:center;gap:10px;flex-wrap:wrap;
  width:100%;margin:12px 0 18px;padding:0 12px;box-sizing:border-box;
}
#ayanSettingsSaveCenterHost button{position:relative;z-index:20;min-height:42px;margin:0;cursor:pointer;touch-action:manipulation}
#ayanSettingsSaveCenterHost button:disabled{opacity:.65;cursor:wait}
#ayanSettingsSaveCenterHost #saveClientSettingsBtn{
  min-height:44px;padding:10px 18px;border-radius:11px;
  font-weight:900;font-size:13px;box-shadow:0 7px 18px rgba(22,163,74,.16);
}
@media(min-width:701px){
  #ayanSettingsSaveCenterHost #saveClientSettingsBtn{width:auto;min-width:210px;max-width:360px}
}

/* ---------- الحالات والتصنيفات ---------- */
#taxonomyClientsSubView{overflow-x:hidden}
#taxonomyClientsSubView .page{width:100%;max-width:none;box-sizing:border-box}
#taxonomyClientsSubView .taxonomy-grid{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:18px;align-items:start}
#taxonomyClientsSubView .taxonomy-panel{min-width:0;width:100%;box-sizing:border-box;overflow:hidden}

#statusTaxonomyList,
#categoryTaxonomyList{display:flex;flex-direction:column;gap:9px;width:100%}
/* صف الحالة: الاسم | اللون | حذف — صف التصنيف: الاسم | اللون | مكان الظهور | حذف */
#statusTaxonomyList .taxonomy-row,
#categoryTaxonomyList .taxonomy-row{
  width:100%;min-width:0;display:grid;grid-template-columns:minmax(180px,1fr) 48px 42px;
  align-items:center;gap:8px;padding:7px;margin:0;box-sizing:border-box;
  border:1px solid #e2e8f0;border-radius:12px;background:#fff;
}
#categoryTaxonomyList .taxonomy-row{grid-template-columns:minmax(180px,1fr) 48px minmax(130px,155px) 42px}
:is(#statusTaxonomyList,#categoryTaxonomyList) .taxonomy-row input[type="text"]{
  width:100%;min-width:0;height:42px;margin:0;box-sizing:border-box;
}
#categoryTaxonomyList .taxonomy-row input[type="text"]{border-radius:9px}
#categoryTaxonomyList .taxonomy-row > button{min-height:42px}
:is(#statusTaxonomyList,#categoryTaxonomyList) .taxonomy-row input[type="color"]{
  width:48px;min-width:48px;height:42px;padding:3px;margin:0;box-sizing:border-box;border-radius:9px;
}
:is(#statusTaxonomyList,#categoryTaxonomyList) .taxonomy-row > button{
  position:static;width:42px;min-width:42px;max-width:42px;height:42px;padding:0;margin:0;
  display:flex;align-items:center;justify-content:center;border:0;border-radius:9px;
  background:#b91c1c;color:#fff;font-size:17px;font-weight:900;cursor:pointer;
}
#categoryTaxonomyList .taxonomy-scope-select{
  width:100%;min-width:0;height:42px;min-height:38px;margin:0;padding:0 8px;box-sizing:border-box;
  border:1px solid;border-radius:9px;font-size:12px;font-weight:800;text-align:center;
}
/* ألوان القائمة تغلب ألوان الحقول العامة للثيمين في 02-metrics-mobile-first.css (!important) */
#categoryTaxonomyList .taxonomy-scope-select{background:#f8fafc !important;color:#0f172a !important;border-color:#cbd5e1 !important}
body:not(.theme-light) :is(#statusTaxonomyList,#categoryTaxonomyList) .taxonomy-row{background:#0f172a;border-color:#334155}
body:not(.theme-light) #categoryTaxonomyList .taxonomy-scope-select{background:#172033 !important;color:#e2e8f0 !important;border-color:#475569 !important}

@media(max-width:1100px){
  #taxonomyClientsSubView .taxonomy-grid{grid-template-columns:1fr}
}

/* ---------- توزيع العملاء ---------- */
#ayanDistributionTopActions{
  display:flex;align-items:center;justify-content:center;gap:10px;flex-wrap:wrap;
  width:100%;margin:12px 0 18px;padding:10px;box-sizing:border-box;
  border:1px solid #dbe4ee;border-radius:13px;background:#f8fafc;
}
body:not(.theme-light) #ayanDistributionTopActions{background:#0f172a;border-color:#334155}
#ayanDistributionTopActions button{min-height:42px;padding:9px 16px;border-radius:10px;font-weight:800}
/* معطّل حتى تُجهَّز معاينة: يبقى مقروءًا لا باهتًا */
#executeDistributionBtn:disabled{opacity:.7}

/* ---------- تحت 900px: قاعدة الأزرار والحقول في 03 أساس بلا !important؛ يبقى !important هنا فقط لقواعد .page في 03 ---------- */
@media(max-width:900px){
  #taxonomyClientsSubView .page{max-width:none !important}
  #ayanSettingsSaveCenterHost button{min-height:42px}
  #ayanSettingsSaveCenterHost #saveClientSettingsBtn{min-height:44px;padding:10px 18px;font-size:13px;max-width:none}
  :is(#statusTaxonomyList,#categoryTaxonomyList) .taxonomy-row input[type="color"]{width:48px;min-width:48px}
  :is(#statusTaxonomyList,#categoryTaxonomyList) .taxonomy-row > button{
    width:42px;min-width:42px;max-width:42px;padding:0;font-size:17px;
  }
  #categoryTaxonomyList .taxonomy-row > button{min-height:42px}
  #categoryTaxonomyList .taxonomy-scope-select{width:100%;min-height:38px;font-size:12px}
}
@media(min-width:701px) and (max-width:900px){
  #ayanSettingsSaveCenterHost #saveClientSettingsBtn{width:auto;max-width:360px}
}

/* ---------- الجوال ---------- */
@media(max-width:700px){
  #ayanSettingsSaveCenterHost{
    display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;margin:10px 0 14px;padding:0 8px;
  }
  #ayanSettingsSaveCenterHost button{width:100%;min-width:0;font-size:11px;padding:8px 6px}
  #ayanSettingsSaveCenterHost #saveClientSettingsBtn{min-height:46px;font-size:13px;padding:10px 18px}

  #taxonomyClientsSubView .page{padding-left:10px !important;padding-right:10px !important} /* يغلب 03 (.page) */
  #statusTaxonomyList .taxonomy-row{grid-template-columns:minmax(0,1fr) 44px 40px}
  #categoryTaxonomyList .taxonomy-row{grid-template-columns:minmax(0,1fr) 44px 40px}
  #categoryTaxonomyList .taxonomy-row input[type="text"]{grid-column:1 / -1}
  #categoryTaxonomyList .taxonomy-scope-select{grid-column:1 / 2;grid-row:2;width:100%}
  #categoryTaxonomyList .taxonomy-row input[type="color"]{grid-column:2;grid-row:2;width:44px;min-width:44px}
  #categoryTaxonomyList .taxonomy-row > button{grid-column:3;grid-row:2;width:40px;min-width:40px}

  #ayanDistributionTopActions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;margin:10px 0 14px;padding:7px}
  #ayanDistributionTopActions button{width:100%;min-width:0;padding:8px 6px;font-size:11px}

  /* توزيع العملاء على الجوال: هذه القيم تغلب قواعد الجوال العامة في 02 و03 (!important) */
  #clientDistributionSubView{width:100%;max-width:100%;overflow-x:hidden}
  #clientDistributionSubView > .page{width:100%;max-width:100%;box-sizing:border-box;padding:8px !important}
  #clientDistributionSubView .mgmt-card{width:100%;box-sizing:border-box;padding:12px !important;border-radius:14px !important}
  #clientDistributionSubView .two-cols{display:grid !important;grid-template-columns:1fr !important;gap:10px !important}
  #clientDistributionSubView .two-cols label{min-width:0}
  #clientDistributionSubView .two-cols :is(select,input[type="file"]){width:100% !important;max-width:100%;box-sizing:border-box}
  #distributionEmployees{display:grid !important;grid-template-columns:1fr 1fr !important;gap:7px !important;width:100%;box-sizing:border-box}
  #distributionEmployees > *{min-width:0 !important;width:100% !important;box-sizing:border-box}
  #distributionSummary{display:grid !important;grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:8px !important;width:100%;box-sizing:border-box}
  #distributionSummary > *{min-width:0 !important;width:100% !important;box-sizing:border-box;padding:10px !important;border-radius:12px !important}
  #distributionSummary .mgmt-card strong{font-size:20px !important;overflow-wrap:anywhere}
  #distributionSummary .mgmt-card small{font-size:10px !important}
  #clientDistributionSubView .management-table{width:100% !important;max-width:100% !important;overflow-x:auto !important;-webkit-overflow-scrolling:touch}
  #clientDistributionSubView .management-table table{width:100%;min-width:0}
  #clientDistributionSubView .management-table th:first-child{width:36px}
}
