/* PROGRESS-1 (2026-11-12) — المكوّن الموحد لشريط التقدّم الأخضر الرسمي (مأخوذ من تثبيت شجرة الحسابات).
   شريطٌ ينمو والنصّ بداخله (طبقتان: نصّ داكن على المسار + نصّ أبيض مقصوص داخل الأخضر).
   الأنماط: أ تثبيت العرض · ب تنفيذ بدفعات · ج مهمة خلفية · د رفع ملف. حين لا توجد نسبة حقيقية يعمل الشريط
   «غير محدد» (خطوط متحركة + الزمن المنقضي) ولا يعرض رقمًا مخمَّنًا أبدًا.
   الألوان من رموز المنصة (--erp-primary وما حولها). */
.sp { --sp-primary: var(--erp-primary, #00695a); --sp-ink: var(--erp-text, #17302b); --sp-muted: var(--erp-muted, #5b6d68);
    --sp-line: var(--erp-border, #dfe7e4); --sp-card: var(--erp-card, #fff); --sp-danger: var(--erp-danger, #c0392b);
    --sp-ok: var(--erp-success, #1f8a5b); }

/* PROGRESS-5 — تعارض اسم الصنف: sahel-search-panel.css يعرّف `.sp` أيضًا (flex · width:100% · padding:0 · border:0 …) فكانت النافذة تنكمش ويصير الشريط داخلها
   بعرض 2px («خطٌّ رأسي رفيع») في كل صفحة تحمل لوحة البحث (القوائم والتقارير). تُثبَّت هنا بمحدِّدات أقوى لا يغلبها ترتيب التحميل. */
.sp .sp { display: block; position: relative; flex: none; width: auto; justify-content: normal; align-items: normal; gap: 0; }
.sp.sp-inline { display: grid; flex: none; width: auto; justify-content: normal; align-items: normal; gap: 6px; margin: 2px auto 14px; padding: 12px 14px;
    background: var(--sp-card); border: 1px solid var(--sp-line); }
.sp.sp-chip { position: fixed; display: grid; flex: none; justify-content: normal; align-items: normal; gap: 6px; width: min(92vw, 320px); padding: 10px 12px;
    background: var(--sp-card); border: 1px solid var(--sp-line); }
.sp.sp-dialog { display: block; flex: none; justify-content: normal; align-items: normal; gap: 0; width: min(600px, calc(100vw - 32px)); margin: auto; padding: 0; border: 0;
    background: transparent; box-shadow: none; }
.sp.sp-dialog:not([open]) { display: none; }

/* ---- الشريط */
.sp-bar { position: relative; height: 34px; border-radius: 8px; overflow: hidden; background: color-mix(in oklab, var(--sp-primary) 12%, var(--sp-card));
    border: 1px solid color-mix(in oklab, var(--sp-primary) 28%, var(--sp-line)); }
.sp-fill { position: absolute; inset-block: 0; inset-inline-start: 0; width: 0; overflow: hidden; border-radius: 7px; transition: width .18s ease-out;
    background: linear-gradient(180deg, color-mix(in oklab, var(--sp-primary) 88%, #fff), var(--sp-primary)); }
.sp-fill::after { content: ''; position: absolute; inset: 0; pointer-events: none;
    background: repeating-linear-gradient(115deg, transparent 0 10px, rgb(255 255 255 / 14%) 10px 20px); animation: sp-stripes 1s linear infinite; }
.sp-label { position: absolute; inset-block: 0; inset-inline-start: 0; inline-size: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
    padding-inline: 10px; font-size: 13.5px; font-weight: 700; color: var(--sp-primary); white-space: nowrap; }
.sp-label--on { color: #fff; z-index: 1; text-shadow: 0 1px 1px rgb(0 0 0 / 22%); }
.sp-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sp-pct { min-width: 3.2ch; text-align: center; font-variant-numeric: tabular-nums; font-weight: 800; }
.sp-spin { flex: none; width: 13px; height: 13px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: sp-spin .8s linear infinite; }
.sp-note { margin: 0; text-align: center; font-size: 12px; color: var(--sp-muted); min-height: 1.4em; font-variant-numeric: tabular-nums; }

/* غير محدد: يملأ الشريط كلّه بخطوط متحركة، بلا نسبة */
.sp-bar.is-indeterminate .sp-fill { width: 100% !important; transition: none; }
.sp-bar.is-indeterminate .sp-fill::after { animation-duration: .7s; background: repeating-linear-gradient(115deg, transparent 0 10px, rgb(255 255 255 / 22%) 10px 20px); }
.sp-bar.is-indeterminate .sp-pct { display: none; }
/* PROGRESS-5 — مراحل حقيقية: يتقدّم الشريط عند كل حدثٍ فعلي (إرسال · استلام · بناء)، ويزحف داخل مرحلته أثناء الانتظار؛ لا نسبة مخمَّنة تُعرض */
.sp-bar.is-staged .sp-pct { display: none; }
.sp-bar.is-staged .sp-fill::after { animation-duration: .8s; }

.sp-bar.is-failed { border-color: var(--sp-danger); background: color-mix(in oklab, var(--sp-danger) 10%, var(--sp-card)); }
.sp-bar.is-failed .sp-fill { width: 100% !important; background: var(--sp-danger); }
.sp-bar.is-failed .sp-fill::after, .sp-bar.is-failed .sp-spin, .sp-bar.is-done .sp-spin { animation: none; }
.sp-bar.is-failed .sp-spin, .sp-bar.is-done .sp-spin { display: none; }
.sp-bar.is-done .sp-fill::after { animation: none; }

/* ---- شريط داخل الصفحة (نمط أ) */
.sp-inline { display: grid; gap: 6px; max-width: 720px; margin: 2px auto 14px; padding: 12px 14px; background: var(--sp-card); border: 1px solid var(--sp-line);
    border-radius: 12px; transition: opacity .3s ease, transform .3s ease; }
.sp-inline.is-leaving { opacity: 0; transform: translateY(-4px); }

/* ---- النافذة (أنماط ب ج د) */
/* PROGRESS-5 (2026-11-20) — تظهر في وسط الشاشة بنعومة وتختفي بنعومة، وأعرض قليلًا (600 بدل 480).
   الوسط صريح (لا نتّكل على هامش المتصفح الافتراضي)، و`overflow: visible` كي لا يُقصّ ظلّ البطاقة أثناء التكبير. */
.sp-dialog { border: 0; padding: 0; background: transparent; max-width: none; width: min(600px, calc(100vw - 32px)); color: var(--sp-ink); overflow: visible; }
.sp-dialog[open] { position: fixed; inset: 0; margin: auto; height: fit-content; max-height: calc(100dvh - 24px); }
.sp-dialog::backdrop { background: color-mix(in oklab, #0b1f3a 52%, transparent); backdrop-filter: blur(3px); animation: sp-backdrop-in .4s ease both; }
.sp-dialog.is-leaving::backdrop { animation: sp-backdrop-out .34s ease both; }
.sp-dialog.sp-instant::backdrop, .sp-dialog.sp-instant .sp-card { animation: none; }  /* الصفحة التالية تستأنف النافذة نفسها بلا إعادة ظهور */
.sp-card { display: block; overflow: hidden; text-align: center; border-radius: 20px; background: var(--sp-card);
    box-shadow: 0 30px 70px rgb(8 28 56 / 38%), 0 2px 0 rgb(255 255 255 / 60%) inset; animation: sp-pop .46s cubic-bezier(.16, 1, .3, 1) both; }
.sp-dialog.is-leaving .sp-card { animation: sp-out .32s cubic-bezier(.4, 0, .9, .6) both; }
.sp-head { position: relative; isolation: isolate; display: grid; justify-items: center; gap: 6px; padding: 24px 24px 20px; color: #fff;
    background: linear-gradient(135deg, #0a5c50 0%, #0d7d8c 52%, #4a45d6 100%); }
.sp-head::before { content: ''; position: absolute; inset: 0; z-index: -1; opacity: .55;
    background: radial-gradient(circle at 12% 0, rgb(255 255 255 / 34%), transparent 46%), radial-gradient(circle at 92% 110%, rgb(255 196 61 / 38%), transparent 50%); }
.sp-card.is-ok .sp-head { background: linear-gradient(135deg, #0a7a4a 0%, #14a56b 55%, #55c46c 100%); }
.sp-card.is-bad .sp-head { background: linear-gradient(135deg, #8a2a1c 0%, #c0392b 60%, #d9663b 100%); }
.sp-head h2 { margin: 0; font-size: 19px; font-weight: 800; color: #fff; }
.sp-sub { margin: 0; font-size: 13px; color: rgb(255 255 255 / 86%); }
.sp-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; color: #fff; background: rgb(255 255 255 / 20%);
    box-shadow: 0 0 0 6px rgb(255 255 255 / 12%), 0 8px 18px rgb(0 0 0 / 18%); }
.sp-body { display: grid; gap: 12px; padding: 22px 28px 24px; }
.sp-dialog .sp-bar { height: 38px; border-radius: 10px; }
.sp-dialog .sp-fill { border-radius: 9px; transition: width .55s cubic-bezier(.22, .7, .2, 1); }
.sp-dialog .sp-label { font-size: 14px; }
.sp-count { justify-self: center; margin: 0; padding: 4px 12px; border-radius: 999px; background: #eef4fb; color: #254a78; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.sp-count[hidden] { display: none; }
.sp-error { margin: 0; padding: 8px 12px; border-radius: 10px; text-align: start; font-size: 13px; color: var(--sp-danger);
    background: color-mix(in oklab, var(--sp-danger) 10%, var(--sp-card)); }
.sp-error[hidden] { display: none; }
.sp-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.sp-actions:empty { display: none; }
.sp-dialog :focus-visible { outline: 3px solid #4a45d6; outline-offset: 2px; }
.sp-dialog:focus, .sp-dialog:focus-visible { outline: none; }

/* ---- شارة صغيرة في الركن (نمط ج حين تُغلق النافذة والمهمة تعمل) */
.sp-chip { position: fixed; inset-inline-start: 16px; inset-block-end: 16px; z-index: 1200; display: grid; gap: 6px; width: min(92vw, 320px);
    padding: 10px 12px; border-radius: 12px; background: var(--sp-card); border: 1px solid var(--sp-line); box-shadow: 0 8px 24px rgb(15 23 42 / 18%); }
.sp-chip .sp-bar { height: 28px; }
.sp-chip .sp-label { font-size: 12.5px; }

/* ---- حقول مقفلة أثناء التنفيذ */
.sp-locked { pointer-events: none; }

@keyframes sp-stripes { to { background-position: 28px 0; } }
@keyframes sp-spin { to { transform: rotate(360deg); } }
@keyframes sp-pop { from { opacity: 0; transform: translateY(16px) scale(.93); } }
@keyframes sp-out { to { opacity: 0; transform: translateY(10px) scale(.95); } }
@keyframes sp-backdrop-in { from { opacity: 0; } }
@keyframes sp-backdrop-out { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    .sp-fill::after, .sp-spin, .sp-card, .sp-dialog::backdrop, .sp-dialog.is-leaving::backdrop, .sp-dialog.is-leaving .sp-card { animation: none; }
    .sp-fill, .sp-dialog .sp-fill, .sp-inline { transition: none; }
}
@media (max-width: 560px) {
    .sp-label { font-size: 12.5px; gap: 6px; }
    .sp-body { padding: 16px 16px 18px; }
    .sp-dialog .sp-bar { height: 36px; }
    .sp-head { padding: 20px 16px 16px; }
    .sp-inline { padding: 10px 12px; }
}
