/* =====================================================================
   إحصائيات منظومة الجودة ISQM 1
   ===================================================================== */
.ist .page-head{flex-wrap:wrap;gap:10px}
.ist-ctl{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.ist-cur{font-size:12px;padding:5px 10px;border-radius:8px;background:var(--teal-soft);color:var(--ink)}
.ist-sel{display:inline-flex;align-items:center;gap:6px;font-size:12px;color:var(--muted)}
.ist-sel select{font:inherit;font-size:12px;padding:5px 8px;border:1px solid var(--line-2);border-radius:7px;
  background:var(--surface);color:var(--ink);min-width:140px}
.ist-sel select:focus{outline:none;border-color:var(--teal);box-shadow:0 0 0 3px var(--teal-soft)}
.ist-note{font-size:11.5px;color:var(--teal);background:var(--teal-soft);border-radius:8px;padding:7px 11px;margin:0 0 12px}
.ist-note.err{color:var(--high);background:var(--high-bg)}

/* ① المؤشرات */
.ist-kpis{display:grid;grid-template-columns:repeat(auto-fill,minmax(172px,1fr));gap:10px;margin-bottom:18px}
.ist-kpi{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:11px 13px 10px;
  display:flex;flex-direction:column;gap:3px;position:relative;overflow:hidden}
.ist-kpi::before{content:"";position:absolute;inset-inline-start:0;top:0;bottom:0;width:3px;background:var(--line-2)}
.ist-kpi.good::before{background:var(--low)} .ist-kpi.bad::before{background:var(--high)} .ist-kpi.warn::before{background:var(--med)}
.ist-kh{display:flex;align-items:center;gap:6px;font-size:11.5px;color:var(--muted)}
.ist-ki{width:22px;height:22px;border-radius:7px;background:var(--teal-soft);color:var(--teal);display:inline-flex;
  align-items:center;justify-content:center;font-size:12px}
.ist-kv{font-size:24px;font-weight:700;line-height:1.15;color:var(--ink)}
.ist-kc{font-size:11px;display:flex;flex-wrap:wrap;gap:4px 8px;align-items:center;min-height:16px}
.ist-kh2{font-size:10.5px;color:var(--muted)}
.ist-d{font-size:10.5px;font-weight:700;white-space:nowrap}
.ist-d.good{color:var(--low)} .ist-d.bad{color:var(--high)} .ist-d.neu{color:var(--teal)} .ist-d.eq{color:var(--muted);font-weight:600}
.ist-rel{font-weight:500;opacity:.85}

/* الأقسام */
.ist-sec{margin:6px 0 20px}
.ist-sh{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 10px;margin:0 0 10px;padding-bottom:6px;border-bottom:1px solid var(--line)}
.ist-sh h3{margin:0;font-size:14.5px}
.ist-sh>span{font-size:11.5px;color:var(--muted)}
.ist-sh .side{margin-inline-start:auto;display:flex;gap:5px;align-items:center;font-size:11px}
.ist-g2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-bottom:12px}
.ist-g2.users{grid-template-columns:minmax(0,5fr) minmax(0,7fr)}
.ist-g3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
@media (max-width:1100px){.ist-g3{grid-template-columns:repeat(2,minmax(0,1fr))}.ist-g2.users{grid-template-columns:1fr}}
@media (max-width:760px){.ist-g2,.ist-g3{grid-template-columns:1fr}}
.ist-fig{height:100%;box-sizing:border-box}
.ist-card{padding:0;overflow:auto}
.ist-empty{padding:12px 4px;font-size:11.5px}
.ist-sub-h{font-size:11.5px;font-weight:700;color:var(--ink);margin:12px 0 6px}

/* الأعمدة المزدوجة */
.ist-pairs{display:flex;flex-direction:column;gap:9px}
.ist-pr{display:grid;grid-template-columns:minmax(64px,120px) 1fr auto;gap:8px;align-items:center;font-size:11.5px}
.ist-pl{display:flex;align-items:center;gap:6px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ink)}
.ist-pl i{width:9px;height:9px;border-radius:3px;flex:none}
.ist-pbs{display:flex;flex-direction:column;gap:3px}
.ist-pb{display:flex;align-items:center;gap:6px;height:12px}
.ist-pb b{font-size:10.5px;font-weight:700;color:var(--ink);min-width:18px}
.ist-pb.b b{color:var(--muted);font-weight:600}
.ist-pf{display:block;height:100%;background:var(--c);border-radius:0 4px 4px 0;min-width:0}
[dir="rtl"] .ist-pf{border-radius:4px 0 0 4px}
.ist-pb.b .ist-pf{opacity:.38;background:repeating-linear-gradient(135deg,var(--c) 0 3px,transparent 3px 6px);outline:1px solid var(--c);outline-offset:-1px}
.ist-hatch{opacity:.5}
.ist-pd{min-width:54px;text-align:end}

/* الأشرطة المكدّسة */
.ist-stack{display:flex;flex-direction:column;gap:9px;margin:4px 0 12px}
.ist-sr{display:grid;grid-template-columns:minmax(60px,110px) 1fr 38px;gap:9px;align-items:center;font-size:11.5px}
.ist-sl{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600}
.ist-st{display:flex;gap:2px;height:22px;border-radius:6px;overflow:hidden}
.ist-sg{display:flex;align-items:center;justify-content:center;background:var(--c);color:#fff;font-size:10px;font-weight:700;min-width:3px}
.ist-sg.empty{flex:1;background:var(--hover);color:var(--muted)}
.ist-stt{text-align:end;font-size:11px}
.ist-mini{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 14px;font-size:11.5px}
.ist-mini>div{display:flex;align-items:center;gap:6px}
.ist-mini i{width:9px;height:9px;border-radius:3px;flex:none}
.ist-mini b{margin-inline-start:auto}

/* التكرار */
.ist-occ{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.ist-oc{border:1px solid var(--line);border-radius:10px;padding:8px 6px;text-align:center;display:flex;flex-direction:column;gap:2px;
  align-items:center;font-size:10.5px;color:var(--muted)}
.ist-oc .g{color:var(--c);font-size:13px;line-height:1}
.ist-oc b{font-size:18px;color:var(--ink)}
@media (max-width:520px){.ist-occ{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* الجداول */
.ist-tbl{width:100%}
.ist-tbl td,.ist-tbl th{vertical-align:middle}
.ist-go{cursor:pointer}
.ist-go:hover td{background:var(--hover)}
.ist-bar{display:inline-block;width:70px;height:7px;border-radius:9px;background:var(--hover);overflow:hidden;vertical-align:middle;margin-inline-end:6px}
.ist-bar span{display:block;height:100%;background:var(--low);border-radius:9px}
.ist-kinds{white-space:nowrap}
.ist-kinds span{display:inline-block;font-size:10.5px;color:var(--muted);margin-inline-end:7px}

/* رسم الفترات */
.ist-col{transition:opacity .15s}
.ist-col:hover{opacity:.8}
.ist-cv{fill:var(--ink);font-size:9.5px;font-weight:700;font-family:inherit}
.ist-xl.cur{fill:var(--teal);font-weight:700}

@media print{
  .ist-kpis{grid-template-columns:repeat(4,1fr)}
  .ist-g2,.ist-g3,.ist-g2.users{grid-template-columns:1fr 1fr}
  .ist-sec{break-inside:avoid-page}
  .ist-fig,.ist-kpi{break-inside:avoid}
}

/* =====================================================================
   التحليلات المفصّلة — التبويبات والخريطة الحرارية والمؤشر
   ===================================================================== */
.ist .pf-tabs{margin:4px 0 14px}
.ist-body{min-height:200px}
.ist-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch}
.ist-card .ob-table{min-width:640px}
.ist-tbl tr.on td{background:var(--teal-soft)}
.ist-tbl th.cur{color:var(--teal)}
.ist-ch{padding:10px 14px;font-size:12.5px;border-bottom:1px solid var(--line)}
.ist-select{font:inherit;font-size:12px;padding:5px 8px;border:1px solid var(--line-2);border-radius:7px;background:var(--surface);color:var(--ink);max-width:260px}
.ist-g2.hero{grid-template-columns:minmax(0,5fr) minmax(0,7fr)}
.ist-g2.wide{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
@media (max-width:1100px){.ist-g2.hero,.ist-g2.wide{grid-template-columns:1fr}}

/* شارات صغيرة: الأعلى/الأقل وتحسّن/تراجع — نصٌّ ولونٌ معاً */
.ist-chip{display:inline-block;font-size:10.5px;font-weight:600;border-radius:99px;padding:1px 8px;margin-inline-start:4px;
  background:var(--pill);color:var(--muted);white-space:nowrap}
.ist-chip.good{background:var(--low-bg,#E7F3EC);color:var(--low)}
.ist-chip.bad{background:var(--high-bg,#FBEAE8);color:var(--high)}

/* شريطٌ أفقي صغير داخل الخلية بعدد التكرار */
.ist-ob{display:flex;align-items:center;gap:6px;min-width:110px}
.ist-ob span{display:block;height:7px;border-radius:0 4px 4px 0;background:var(--viz-3);min-width:2px}
.ist-ob b{font-size:12px}

/* مؤشر الصحة */
.ist-hero{display:grid;grid-template-columns:auto 1fr;gap:18px;padding:16px 18px;align-items:center;align-content:center;border-inline-start:4px solid var(--line-2)}
.ist-hero.good{border-inline-start-color:var(--low)} .ist-hero.warn{border-inline-start-color:var(--med)} .ist-hero.bad{border-inline-start-color:var(--high)}
.ist-hl{font-size:12px;color:var(--muted)}
.ist-hn{font-size:44px;font-weight:800;line-height:1.05;color:var(--ink)}
.ist-hn small{font-size:15px;color:var(--muted);font-weight:600;margin-inline-start:2px}
.ist-hc{font-size:11.5px;margin-top:2px}
.ist-hs{font-size:10.5px;color:var(--muted);margin-top:6px;max-width:210px}
.ist-hp{display:flex;flex-direction:column;gap:9px}
.ist-hpr{display:grid;grid-template-columns:minmax(120px,170px) minmax(0,1fr) auto auto;gap:8px;align-items:center;font-size:12px}
.ist-hpr .ist-bar{width:100%}
@media (max-width:640px){.ist-hero{grid-template-columns:1fr}.ist-hpr{grid-template-columns:1fr auto}.ist-hpr .ist-bar{display:none}}

/* أبرز الملاحظات */
.ist-ins ul{list-style:none;margin:0;padding:6px 10px 10px}
.ist-ins li{display:flex;gap:9px;align-items:flex-start;padding:7px 6px;border-bottom:1px dashed var(--line);font-size:12.5px;line-height:1.7}
.ist-ins li:last-child{border-bottom:0}
.ist-ins li[data-ist-go]{cursor:pointer}
.ist-ins li[data-ist-go]:hover{background:var(--hover)}
.ist-ins .ic{width:22px;height:22px;border-radius:7px;flex:none;display:inline-flex;align-items:center;justify-content:center;
  background:var(--teal-soft);color:var(--teal);font-size:11px}
.ist-ins li.bad .ic{background:var(--high-bg,#FBEAE8);color:var(--high)}
.ist-ins li.warn .ic{background:var(--med-bg,#FDF1E1);color:var(--med)}
.ist-ins li.good .ic{background:var(--low-bg,#E7F3EC);color:var(--low)}

/* مصفوفة الاحتمال × الأثر — تدرّجٌ واحد للعدد، وشريطٌ علويٌّ للمنطقة */
.ihm{display:grid;grid-template-columns:auto 1fr;grid-template-rows:1fr auto;gap:4px 6px;padding:8px 6px 4px}
.ihm-y{writing-mode:vertical-rl;transform:rotate(180deg);font-size:10.5px;color:var(--muted);text-align:center}
.ihm-x{grid-column:2;text-align:center;font-size:10.5px;color:var(--muted)}
.ihm-grid{display:grid;grid-template-columns:18px repeat(5,minmax(0,1fr));gap:3px}
.ihm-ax{font-size:10.5px;color:var(--muted);display:flex;align-items:center;justify-content:center}
.ihm-c{position:relative;aspect-ratio:1.6/1;min-height:34px;border-radius:5px;border:1px solid var(--line);
  display:flex;align-items:center;justify-content:center;font-size:13px;cursor:default}
.ihm-c::before{content:"";position:absolute;top:0;inset-inline:0;height:3px;border-radius:5px 5px 0 0;background:var(--z);opacity:.9}
.ihm-c b{font-weight:700}
.ihm-leg{display:flex;flex-wrap:wrap;gap:6px 12px;align-items:center;font-size:10.5px;color:var(--muted);padding:2px 8px 8px}
.ihm-ramp{display:inline-block;width:90px;height:8px;border-radius:4px;
  background:linear-gradient(to left,color-mix(in srgb,var(--viz-1) 90%,var(--viz-surface)),color-mix(in srgb,var(--viz-1) 14%,var(--viz-surface)))}
[dir=ltr] .ihm-ramp{background:linear-gradient(to right,color-mix(in srgb,var(--viz-1) 14%,var(--viz-surface)),color-mix(in srgb,var(--viz-1) 90%,var(--viz-surface)))}
.ihm-zl{display:inline-flex;gap:10px;margin-inline-start:auto}
.ihm-zl span{display:inline-flex;align-items:center;gap:4px}
.ihm-zl i{width:10px;height:3px;border-radius:2px;display:inline-block}

/* الجدول الحراري */
.iht-wrap{overflow-x:auto}
.iht{border-collapse:separate;border-spacing:2px;width:100%;font-size:11.5px}
.iht th{font-weight:600;color:var(--muted);padding:4px 6px;white-space:nowrap;text-align:center;font-size:10.5px}
.iht tbody th{text-align:start;color:var(--ink);max-width:230px;overflow:hidden;text-overflow:ellipsis}
.iht td{text-align:center;min-width:30px;height:26px;border-radius:4px;border:1px solid var(--line);font-weight:600}
.iht td.iht-t,.iht th.iht-t{background:transparent;border:0;color:var(--ink);font-weight:700}

@media print{.ist .pf-tabs{display:none}}
.ist-g2 .ist-card .ob-table,.ist-g3 .ist-card .ob-table{min-width:0}
