/* إدارة المستودعات — أنماط إضافية لمجموعة الشاشات (e): الجرد والتخطيط والحجز.
   الأصل iv-* في inventory.css و rc-* في record-page.css؛ هنا ما لا يوجد فيهما فقط. */

/* ── اختيار صنف بالبحث ── */
.ie-pick { position: relative; }
.ie-pick__in { position: relative; }
.ie-pick__in i { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); color: #94a3b8; pointer-events: none; }
.ie-pick__in input { width: 100%; min-height: 42px; border: 1px solid #e6ebf1; border-radius: 10px; padding: .5rem 2.1rem .5rem .75rem; font: inherit; font-size: .92rem; background: #fff; color: #0f172a; }
.ie-pick__in input:focus { outline: none; border-color: #1d4ed8; box-shadow: 0 0 0 3px rgba(29, 78, 216, .12); }
.ie-pick__menu { position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 40; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; box-shadow: 0 14px 32px -16px rgba(15, 23, 42, .45); max-height: 300px; overflow-y: auto; padding: 4px; }
.ie-pick__opt { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: none; border-radius: 8px; text-align: start; font: inherit; font-size: .86rem; color: #0f172a; cursor: pointer; }
.ie-pick__opt:hover, .ie-pick__opt:focus-visible { background: #f1f5f9; outline: none; }
.ie-pick__opt > div { flex: 1; min-width: 0; }
.ie-pick__opt b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ie-pick__opt small { color: #64748b; font-size: .74rem; }
.ie-pick__opt .num { font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; }
.ie-pick__none { padding: 10px; color: #64748b; font-size: .84rem; text-align: center; }
.ie-pick__sel { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: .35rem .5rem .35rem .75rem; border: 1px solid #a7f3d0; background: #ecfdf5; border-radius: 10px; }
.ie-pick__sel > div { flex: 1; min-width: 0; }
.ie-pick__sel b { display: block; font-size: .9rem; color: #065f46; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ie-pick__sel small { color: #047857; font-size: .74rem; }

/* ── اختيار نطاق الجرد ببطاقات ── */
.ie-scopes { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.ie-scope { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; cursor: pointer; text-align: start; font: inherit; color: #0f172a; }
.ie-scope:hover { border-color: #a7f3d0; }
.ie-scope.on { border-color: #047857; box-shadow: 0 0 0 3px rgba(4, 120, 87, .12); background: #f6fdf9; }
.ie-scope.on::after { content: "\F26B"; font-family: bootstrap-icons; position: absolute; top: 10px; inset-inline-end: 12px; color: #047857; }
.ie-scope b { font-size: .92rem; display: flex; align-items: center; gap: 6px; }
.ie-scope b i { color: #047857; }
.ie-scope span { font-size: .76rem; color: #64748b; line-height: 1.6; }
.ie-scope em { font-style: normal; font-size: .74rem; font-weight: 800; color: #1d4ed8; }
.ie-seg { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.ie-seg button { height: 38px; min-width: 52px; padding: 0 12px; border-radius: 10px; border: 1px solid #cbd5e1; background: #fff; font: inherit; font-weight: 800; cursor: pointer; color: #334155; }
.ie-seg button.on { background: #0f172a; color: #fff; border-color: #0f172a; }
.ie-seg button small { display: block; font-size: .68rem; font-weight: 600; opacity: .75; }
.ie-chosen { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ie-chosen span { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 10px; border-radius: 999px; background: #f1f5f9; border: 1px solid #e5e7eb; font-size: .8rem; font-weight: 700; }
.ie-chosen button { border: 0; background: none; color: #94a3b8; cursor: pointer; padding: 0 2px; }
.ie-chosen button:hover { color: #b91c1c; }

/* ── مراحل المستند ── */
.ie-steps { display: flex; gap: 0; background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 10px 12px; overflow-x: auto; }
.ie-step { flex: 1; min-width: 120px; display: flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 700; color: #94a3b8; position: relative; }
.ie-step + .ie-step::before { content: ""; width: 22px; height: 2px; background: #e5e7eb; margin-inline-end: 6px; flex: none; }
.ie-step i { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 2px solid #e5e7eb; font-style: normal; font-size: .8rem; flex: none; background: #fff; }
.ie-step.done { color: #065f46; } .ie-step.done i { background: #047857; border-color: #047857; color: #fff; }
.ie-step.done + .ie-step::before { background: #047857; }
.ie-step.now { color: #0f172a; } .ie-step.now i { border-color: #047857; color: #047857; }
.ie-step.bad { color: #b91c1c; } .ie-step.bad i { border-color: #b91c1c; background: #fef2f2; color: #b91c1c; }
.ie-step small { display: block; font-size: .7rem; color: #94a3b8; font-weight: 600; }

/* ── شريط التقدم ── */
.ie-prog { display: flex; flex-direction: column; gap: 6px; }
.ie-prog__bar { height: 10px; border-radius: 99px; background: #f1f5f9; overflow: hidden; display: flex; }
.ie-prog__bar i { display: block; height: 100%; background: #047857; }
.ie-prog__bar i.ap { background: #065f46; }
.ie-prog__bar i.ct { background: #34d399; }
.ie-prog__t { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .8rem; color: #64748b; }
.ie-prog__t b { color: #0f172a; font-variant-numeric: tabular-nums; }

/* ── ورقة العدّ ── */
.ie-scan { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ie-scan .iv-search { flex: 2 1 260px; }
.ie-scan .iv-search input { height: 44px; font-size: .95rem; }
.ie-qty { width: 110px; height: 36px; border: 1px solid #cbd5e1; border-radius: 9px; padding: 0 8px; font: inherit; font-weight: 800; text-align: end; font-variant-numeric: tabular-nums; background: #fff; color: #0f172a; }
.ie-qty:focus { outline: none; border-color: #047857; box-shadow: 0 0 0 3px rgba(4, 120, 87, .14); }
.ie-qty:disabled { background: #f8fafc; color: #64748b; }
.ie-qty.saving { border-color: #f59e0b; }
.ie-note { width: 100%; min-width: 120px; height: 32px; border: 1px solid #e5e7eb; border-radius: 8px; padding: 0 8px; font: inherit; font-size: .8rem; background: #fff; }
.ie-diff { font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ie-diff.pos { color: #047857; } .ie-diff.neg { color: #b91c1c; } .ie-diff.zero { color: #94a3b8; }
.iv-tbl tr.ie-row--hit td { background: #fffbeb !important; }
.iv-tbl tr.ie-row--ap td:first-child { box-shadow: inset -3px 0 0 #047857; }
[dir="ltr"] .iv-tbl tr.ie-row--ap td:first-child { box-shadow: inset 3px 0 0 #047857; }
.ie-apv { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid #cbd5e1; background: #fff; font: inherit; font-size: .78rem; font-weight: 800; color: #334155; cursor: pointer; white-space: nowrap; }
.ie-apv:hover { background: #f1f5f9; }
.ie-apv.on { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.ie-apv:disabled { opacity: .5; cursor: not-allowed; }
.ie-drift { color: #b45309; font-size: .72rem; font-weight: 700; display: block; }
.ie-tol { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.ie-tol label { display: flex; flex-direction: column; gap: 3px; font-size: .74rem; font-weight: 700; color: #64748b; }
.ie-tol input { width: 110px; height: 38px; border: 1px solid #cbd5e1; border-radius: 9px; padding: 0 8px; font: inherit; text-align: end; }
.ie-acts { display: flex; flex-direction: column; gap: 8px; }
.ie-acts .iv-btn { width: 100%; }
.ie-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.ie-sum > div { border: 1px solid #e5e7eb; border-radius: 12px; padding: 10px 12px; background: #fff; }
.ie-sum span { display: block; font-size: .74rem; color: #64748b; font-weight: 700; }
.ie-sum b { font-size: 1.2rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.ie-sum .pos b { color: #047857; } .ie-sum .neg b { color: #b91c1c; }

/* ── ATP في نموذج الحجز ── */
.ie-atp { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ie-atp > div { border: 1px solid #e5e7eb; border-radius: 12px; padding: 10px 12px; background: #f8fafc; }
.ie-atp span { display: block; font-size: .72rem; color: #64748b; font-weight: 700; }
.ie-atp b { font-size: 1.25rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.ie-atp .main { background: #ecfdf5; border-color: #a7f3d0; } .ie-atp .main b { color: #065f46; }
.ie-atp .bad { background: #fef2f2; border-color: #fecaca; } .ie-atp .bad b { color: #b91c1c; }

/* ── نطاق الحدود في القائمة ── */
.ie-range { position: relative; height: 8px; border-radius: 99px; background: #f1f5f9; min-width: 120px; margin: 6px 0 2px; }
.ie-range i { position: absolute; top: 0; bottom: 0; border-radius: 99px; background: #d1fae5; }
.ie-range b { position: absolute; top: -3px; width: 4px; height: 14px; border-radius: 2px; background: #0f172a; transform: translateX(50%); }
.ie-range em { position: absolute; top: -2px; width: 2px; height: 12px; background: #f59e0b; }
.ie-abc { display: inline-flex; width: 28px; height: 28px; border-radius: 8px; align-items: center; justify-content: center; font-weight: 900; font-size: .9rem; }
.ie-abc.a { background: #0f172a; color: #fff; } .ie-abc.b { background: #e0e7ff; color: #3730a3; } .ie-abc.c { background: #f1f5f9; color: #475569; }
.ie-share { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: #f1f5f9; }
.ie-share i { display: block; height: 100%; }
.ie-share i.a { background: #0f172a; } .ie-share i.b { background: #6366f1; } .ie-share i.c { background: #cbd5e1; }

/* ── ورقة العدّ المطبوعة: لا تظهر إلا عند الطباعة، وتخفي ما عداها ── */
.ie-print { display: none; }
@media print {
    body:has(.ie-print) * { visibility: hidden !important; }
    body:has(.ie-print) .ie-print, body:has(.ie-print) .ie-print * { visibility: visible !important; }
    body:has(.ie-print) .ie-print { display: block !important; position: absolute; top: 0; inset-inline: 0; width: 100%; padding: 0 8mm; background: #fff; color: #000; }
    .ie-print h1 { font-size: 16pt; margin: 0 0 2mm; }
    .ie-print p { margin: 0 0 4mm; font-size: 10pt; }
    .ie-print table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
    .ie-print th, .ie-print td { border: 1px solid #555; padding: 2mm 2.5mm; text-align: start; }
    .ie-print th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .ie-print td.box { width: 28mm; }
    .ie-print tr { break-inside: avoid; }
    .ie-print .sig { display: flex; justify-content: space-between; gap: 10mm; margin-top: 10mm; font-size: 10pt; }
    .ie-print .sig div { flex: 1; border-top: 1px solid #000; padding-top: 2mm; }
    @page { size: A4; margin: 12mm 8mm; }
}

@media (max-width: 760px) {
    .ie-atp { grid-template-columns: 1fr; }
    .ie-qty { width: 100%; }
}
