/* ═══════════════════════════════════════════════════════════════════════
   ختم المنشأة (doc-stamp) والعلامة المائية (doc-wm) على كل المستندات المطبوعة.
   الجذور التي تحتويهما تصير position:relative، والختم يوضع فوق منطقة التوقيعات
   كما يُختم الورق فعلًا، والعلامة فوق المحتوى بشفافية خفيفة لا تعطّل القراءة.
   ═══════════════════════════════════════════════════════════════════════ */

.st-doc, .iv-doc, .pp-sheet, .wop-page, .sln-doc, .invoice-a4-page, .invoice-box, .prc-page, .ct-page, .doc-brand-root { position: relative; }
.st-sign, .iv-sign, .cl-sign, .fm-sign, .mn-sign, .sp-sign, .pp-signs, .wop-sign, .sln-doc__sign,
.inv-signatures, .invoice-signatures, .prc-stamp-area, .ct-sig-stamp-area, .doc-sign-host { position: relative; }

/* صناديق «الختم» الفارغة في العقود: الختم في وسطها */
.prc-stamp-area .doc-stamp, .ct-sig-stamp-area .doc-stamp { inset-inline: 0; margin-inline: auto; bottom: 0; translate: none; }

/* ── الختم ─────────────────────────────────────────────────────────────── */
.doc-stamp {
    position: absolute; bottom: -2mm; z-index: 3; pointer-events: none;
    /* الختم ابن مباشر لصف التوقيعات: لا يرث حدود خلاياه ولا حشوها ولا مكانه في الشبكة */
    border: 0 !important; padding: 0 !important; margin: 0 !important; background: none !important;
    min-height: 0 !important; box-shadow: none !important; grid-area: auto !important;
    width: calc(var(--stamp-w, 38mm) * var(--stamp-scale, 1));
    transform: rotate(var(--stamp-rot, -8deg));
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.doc-stamp img { width: 100%; height: auto; display: block; mix-blend-mode: multiply; opacity: .92; }
/* الأطراف منطقية: start = بداية السطر (يمين في العربية) */
/* صف التوقيعات ثلاث خانات غالبًا: الختم يتوسّط الخانة الأولى أو الأخيرة أو الوسطى */
.doc-stamp--start  { inset-inline-start: calc(16.66% - var(--stamp-w, 38mm) * var(--stamp-scale, 1) / 2); }
.doc-stamp--center { inset-inline-start: calc(50% - var(--stamp-w, 38mm) * var(--stamp-scale, 1) / 2); }
.doc-stamp--end    { inset-inline-end: calc(16.66% - var(--stamp-w, 38mm) * var(--stamp-scale, 1) / 2); }

/* ── العلامة المائية ───────────────────────────────────────────────────── */
.doc-wm {
    position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    opacity: var(--wm-op, .07);
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.doc-wm img { width: var(--wm-size, 55%); max-height: 80%; object-fit: contain; filter: grayscale(.2); }
.doc-wm span {
    font-weight: 900; color: #0f172a; white-space: nowrap; letter-spacing: .02em; line-height: 1;
    font-size: clamp(32px, calc(var(--wm-size-n, 55) * 1.7px), 150px);
}
.doc-wm--diagonal > * { transform: rotate(-32deg); }
.doc-wm--tiled { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; align-items: center; justify-items: center; gap: 4%; padding: 6%; }
.doc-wm--tiled > * { transform: rotate(-28deg); }
.doc-wm--tiled img { width: 70%; max-height: none; }
.doc-wm--tiled span { font-size: 26px; }

@media print {
    /* على الورق: العلامة تتكرّر على كل صفحة مطبوعة */
    .doc-wm { position: fixed; inset: 0; }
}
