/* ── بند قائمة منسدلة محدّد ──
      تعبئته بالنايفي الكامل تجعله توأماً لزر المجموعة المفتوح فوقه فيتنافسان.
      هنا: تدرّج خفيف وعلامة صح في الطرف تقول "أنت هنا". ── */
.menu-item { position: relative; }

.menu-item.active {
    background: rgba(13, 59, 102, 0.1);
    color: #0D3B66 !important;
    font-weight: 800;
}
.menu-item.active:hover {
    background: rgba(13, 59, 102, 0.14);
}


/* علامة الصح من خط الأيقونات نفسه */
.menu-item.active::after {
    content: "\e35f";
    font-family: uicons-regular-rounded;
    font-size: 0.5625rem;
    line-height: 1;
    margin-inline-start: auto;
    width: 1rem;
    height: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #0D3B66;
    color: #fff;
    flex-shrink: 0;
}

.menu-item.active .fi { color: #0D3B66; }

/* شارة "قريباً" تسبق علامة الصح، فلا تُدفع خارج الصف */
.menu-item .badge-soon { margin-inline-start: auto; }
.menu-item.active .badge-soon { margin-inline-start: 0; }

/* ── مجموعة أزرار الفلتر ── */
.seg {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border-radius: 0.75rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.seg__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3125rem 0.625rem;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: #64748b;
    font-size: 0.6875rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}
.seg__btn:hover { background: #f1f5f9; color: #0D3B66; }
.seg__btn--on,
.seg__btn--on:hover {
    background: #0D3B66;
    color: #fff;
    box-shadow: 0 4px 10px -4px rgba(13, 59, 102, 0.5);
}
.seg__count {
    font-size: 0.5625rem;
    font-weight: 800;
    padding: 0 0.25rem;
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.12);
    font-variant-numeric: tabular-nums;
}
.seg__btn--on .seg__count { background: rgba(255, 255, 255, 0.22); }

/* ── رأس عمود قابل للفرز ── */
.th-sort {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border: 0;
    background: transparent;
    padding: 0;
    color: #94a3b8;
    font-size: 0.625rem;
    font-weight: 800;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: color 0.15s ease;
}
.th-sort:hover { color: #0D3B66; }
.th-sort__i {
    font-size: 0.5625rem;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.th-sort:hover .th-sort__i { opacity: 0.5; }
.th-sort__i--on { opacity: 1; color: #0D3B66; }

/* ── الحرف الأول بدل صورة ── */
.u-avatar {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 59, 102, 0.08);
    color: #0D3B66;
    font-size: 0.6875rem;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px rgba(13, 59, 102, 0.12);
}

/* ── شارة حالة ── */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3125rem;
    height: 20px;
    padding: 0 0.5rem;
    border-radius: 999px;
    font-size: 0.5625rem;
    font-weight: 800;
    white-space: nowrap;
}
.pill__dot { width: 5px; height: 5px; border-radius: 999px; background: currentColor; }
.pill--on  { background: #ecfdf5; color: #047857; }
.pill--off { background: #f1f5f9; color: #64748b; }

/* ── أزرار داخل صف الجدول ── */
.row-act {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    background: transparent;
    color: #94a3b8;
    font-size: 0.6875rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.row-act:hover          { background: rgba(13, 59, 102, 0.07); color: #0D3B66; }
.row-act--ok:hover      { background: #ecfdf5; color: #047857; }
.row-act--warn:hover    { background: #fffbeb; color: #b45309; }
.row-act--danger:hover  { background: #fff1f2; color: #be123c; }

/* ── حقول النموذج ── */
.field { display: flex; flex-direction: column; gap: 0.3125rem; }
.field__label {
    font-size: 0.6875rem;
    font-weight: 700;
    color: #475569;
}
.field__input {
    width: 100%;
    height: 2.375rem;
    padding: 0 0.75rem;
    border-radius: 0.625rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #0f172a;
    font-size: 0.75rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.field__input::placeholder { color: #94a3b8; }

/*
 | حقول المحتوى اللاتيني (بريد، كلمة مرور، أرقام) تحمل dir=ltr ليبقى ترتيب
 | حروفها منطقياً، لكن النموذج عربي: النص يبدأ من اليمين كبقية الحقول.
 */
.field__input[dir="ltr"] { text-align: right; }
.field__input:focus {
    border-color: rgba(13, 59, 102, 0.35);
    box-shadow: 0 0 0 4px rgba(13, 59, 102, 0.06);
}
.field__hint  { font-size: 0.5625rem; color: #94a3b8; }
.field__error { font-size: 0.5625rem; font-weight: 700; color: #be123c; }

/* ── أزرار ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    height: 2.25rem;
    padding: 0 1rem;
    border-radius: 0.625rem;
    border: 1px solid transparent;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.btn:disabled { opacity: 0.6; cursor: default; }
.btn--primary { background: #0D3B66; color: #fff; }
.btn--primary:hover:not(:disabled) { background: #092a48; }
.btn--danger  { background: #e11d48; color: #fff; }
.btn--danger:hover:not(:disabled)  { background: #be123c; }
.btn--ghost   { background: #fff; color: #475569; border-color: #e2e8f0; }
.btn--ghost:hover:not(:disabled)   { background: #f8fafc; color: #0f172a; }

/* ── نافذة منبثقة ── */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal__backdrop {
    /* absolute داخل .modal يقيس على صندوق حشوها فيبقى شريط غير مغطّى؛
       fixed يغطّي الشاشة كاملة ما دام لا transform على أي أب (انظر .page-enter .modal). */
    position: fixed;
    inset: 0;
    background: rgba(2, 8, 18, 0.42);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    /* بلا forwards ترتدّ الشفافية إلى قيمتها الأصلية عند انتهاء الحركة فتومض */
    animation: modal-fade 0.2s ease forwards;
}
.modal__panel {
    position: relative;
    width: 100%;
    max-width: 26rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 30px 70px -18px rgba(2, 8, 18, 0.45);
    animation: modal-in 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.modal__panel--sm { max-width: 20rem; }

@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
    .modal__backdrop, .modal__panel { animation: none; }
}

/* ── ترقيم الصفحات ── */
.paginate { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.paginate__info { font-size: 0.625rem; font-weight: 600; color: #94a3b8; }
.paginate__nav   { display: inline-flex; align-items: center; gap: 2px; }
.paginate__pages { display: inline-flex; align-items: center; gap: 2px; }

/* موضعُك من العدد — بديلُ سرد الأرقام حين لا يتّسع الشريط */
.paginate__at {
    display: none;
    padding: 0 0.5rem;
    font-size: 0.6875rem;
    font-weight: 700;
    color: #475569;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 639px) {
    .paginate__pages { display: none; }
    .paginate__at    { display: inline-flex; }
    .paginate__info  { font-size: 0.5625rem; }
}
.paginate__link {
    min-width: 1.75rem;
    height: 1.75rem;
    padding: 0 0.375rem;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 700;
    color: #64748b;
    text-decoration: none;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    font-variant-numeric: tabular-nums;
    transition: background 0.15s ease, color 0.15s ease;
}
.paginate__link:hover { background: #f1f5f9; color: #0D3B66; }
.paginate__link--on,
.paginate__link--on:hover { background: #0D3B66; color: #fff; }
.paginate__link--off { color: #cbd5e1; pointer-events: none; }

/* ── تنبيه عائم ── كبسولة أعلى الشاشة، بتصميم القالب */
#toastHost {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: max-content;
    max-width: min(28rem, calc(100vw - 2rem));
    pointer-events: none;
    direction: rtl;
}

@keyframes toast-in  { from { opacity: 0; transform: translateY(-0.75rem); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-0.75rem); } }

.toast {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    width: 100%;
    max-width: 28rem;
    padding: 0.625rem 1.125rem 0.625rem 1rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-0.75rem);
    box-shadow: 0 8px 24px -6px rgba(15, 23, 42, 0.18);
    user-select: none;
    transition: box-shadow 0.15s ease;
}
.toast:hover      { box-shadow: 0 10px 28px -6px rgba(15, 23, 42, 0.22); }
.toast.is-visible { animation: toast-in 0.38s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.toast.is-leaving { animation: toast-out 0.28s cubic-bezier(0.4, 0, 1, 1) forwards; pointer-events: none; }

.toast__icon {
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.75rem;
    line-height: 1;
    color: #fff;
}
.toast__text { flex: 1; text-align: center; }

.toast--success { background: #dcfce7; border: 1px solid #86efac; color: #166534; }
.toast--error   { background: #ffe4e6; border: 1px solid #fda4af; color: #be123c; }
.toast--warning { background: #fef3c7; border: 1px solid #fcd34d; color: #b45309; }
.toast--info    { background: #e0f2fe; border: 1px solid #7dd3fc; color: #0369a1; }

.toast--success .toast__icon { background: #22c55e; box-shadow: 0 2px 6px rgba(34, 197, 94, 0.35); }
.toast--error   .toast__icon { background: #f43f5e; box-shadow: 0 2px 6px rgba(244, 63, 94, 0.35); }
.toast--warning .toast__icon { background: #f59e0b; box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35); }
.toast--info    .toast__icon { background: #0ea5e9; box-shadow: 0 2px 6px rgba(14, 165, 233, 0.35); }

@media (prefers-reduced-motion: reduce) {
    .toast.is-visible, .toast.is-leaving { animation: none; opacity: 1; transform: none; }
}

/* ── مفتاح تبديل ── */
.switch {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    width: 2.375rem;
    height: 1.375rem;
    cursor: pointer;
}
.switch input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}
.switch__track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #cbd5e1;
    transition: background 0.2s ease;
    pointer-events: none;
}
.switch__thumb {
    position: absolute;
    top: 3px;
    inset-inline-start: 3px;
    width: 1rem;
    height: 1rem;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}
.switch input:checked ~ .switch__track { background: #0D3B66; }
/* في RTL يتحرّك الإبهام يساراً، فالإشارة سالبة */
.switch input:checked ~ .switch__thumb { transform: translateX(-1rem); }
.switch input:focus-visible ~ .switch__track { box-shadow: 0 0 0 4px rgba(13, 59, 102, 0.15); }

/* ── بطاقة جانبية ── */
.aside-card {
    border-radius: 0.75rem;
    background: #fff;
    border: 1px solid #f1f5f9;
    box-shadow: 0 2px 15px -3px rgba(0, 0, 0, 0.03);
    overflow: hidden;
}
.aside-card__head {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.6875rem;
    font-weight: 800;
    color: #334155;
}
.aside-card__head i { font-size: 0.75rem; color: #94a3b8; }
.aside-card__body { padding: 1rem; }

/* سطر تسمية/قيمة */
.kv {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.4375rem 0;
    border-top: 1px solid #f8fafc;
}
.kv:first-child { border-top: 0; padding-top: 0; }
.kv:last-child  { padding-bottom: 0; }
.kv__k { font-size: 0.625rem; font-weight: 600; color: #94a3b8; flex-shrink: 0; }
.kv__v { font-size: 0.6875rem; font-weight: 700; color: #334155; text-align: end; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv__v--muted { color: #94a3b8; font-weight: 600; }

/* منطقة خطرة */
.danger-card { border-color: rgba(244, 63, 94, 0.22); }
.danger-card .aside-card__head { color: #be123c; border-bottom-color: rgba(244, 63, 94, 0.16); }
.danger-card .aside-card__head i { color: #e11d48; }

/* ── حقل كلمة المرور: أزرار داخل الحقل وقائمة معايير تحته ──
      الحقل نفسه dir=ltr بينما الغلاف RTL، فالخاصية المنطقية الواحدة تشير
      إلى جهتين متقابلتين. الجهة هنا فيزيائية حتى يلتقي الحشو مع الأزرار. */
.pw-wrap { position: relative; }
.pw-wrap .field__input {
    padding-left: 4.25rem;
    padding-right: 0.75rem;
}

.pw-wrap__actions {
    position: absolute;
    left: 0.375rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 2px;
}
.pw-btn {
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: #94a3b8;
    font-size: 0.75rem;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}
.pw-btn:hover { color: #0D3B66; background: #f1f5f9; }

.pw-rules {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3125rem 0.875rem;
}
.pw-rule {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.625rem;
    font-weight: 600;
    color: #94a3b8;
    transition: color 0.18s ease;
}
.pw-rule__mark {
    width: 0.875rem;
    height: 0.875rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #f1f5f9;
    color: transparent;
    font-size: 0.4375rem;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.pw-rule.is-ok            { color: #047857; }
.pw-rule.is-ok .pw-rule__mark {
    background: #22c55e;
    color: #fff;
    transform: scale(1.08);
}

/* شريط القوة —
   التدرّج ثابت على المسار كله (أحمر عند البداية، أخضر عند النهاية)
   ويُكشف منه بقدر القوة. تحريك عرض القناع وحده أسلس من نقل لون. */
.pw-strength {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.pw-strength__track {
    position: relative;
    flex: 1;
    height: 5px;
    border-radius: 999px;
    overflow: hidden;
    background: linear-gradient(to left, #e11d48 0%, #f97316 30%, #eab308 55%, #22c55e 82%, #059669 100%);
}
.pw-strength__mask {
    position: absolute;
    inset-block: 0;
    inset-inline-end: 0;
    background: #f1f5f9;
    transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.pw-strength__label {
    font-size: 0.5625rem;
    font-weight: 800;
    color: #94a3b8;
    flex-shrink: 0;
    min-width: 3.5rem;
    text-align: start;
}

/* Alpine لا يخفي x-cloak من تلقائه — تحتاج القاعدة */
[x-cloak] { display: none !important; }

/* شارة دور النظام */
.pill--lock { background: #fffbeb; color: #b45309; }

/* ── مصفوفة الصلاحيات ── */
.perm-link {
    border: 0;
    background: transparent;
    padding: 0;
    font-family: inherit;
    font-size: 0.625rem;
    font-weight: 800;
    color: #0D3B66;
    cursor: pointer;
}
.perm-link:hover { text-decoration: underline; }

.perm-module {
    border: 1px solid #f1f5f9;
    border-radius: 0.75rem;
    overflow: hidden;
}
.perm-module__head {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.875rem;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}
.perm-module__name  { font-size: 0.6875rem; font-weight: 800; color: #0f172a; }
.perm-module__count { margin-inline-start: auto; font-size: 0.5625rem; font-weight: 800; color: #94a3b8; }
.perm-module__body  { display: flex; flex-direction: column; }

.perm-row {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.5rem 0.875rem;
    border-top: 1px solid #f8fafc;
}
.perm-row:first-child { border-top: 0; }
.perm-row:hover { background: #fcfdfe; }
.perm-row__name {
    flex: 0 0 9rem;
    font-size: 0.6875rem;
    font-weight: 700;
    color: #475569;
    padding-top: 0.1875rem;
}
.perm-row__actions {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3125rem;
    min-width: 0;
}

/* مربع اختيار الوحدة والمورد — ثلاث حالات: فارغ، جزئي، كامل */
.perm-check {
    flex-shrink: 0;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 0.375rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: transparent;
    font-size: 0.5rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.perm-check:hover:not(:disabled) { border-color: #0D3B66; }
.perm-check.is-on   { background: #0D3B66; border-color: #0D3B66; color: #fff; }
.perm-check.is-some { background: #bfd3e6; border-color: #7aa9cf; color: #0D3B66; }
.perm-check:disabled { cursor: default; opacity: 0.55; }
.perm-check--sm { width: 1rem; height: 1rem; border-radius: 0.3125rem; margin-top: 0.125rem; }

/* شارة الفعل — تُحدَّد بالنقر */
.perm-act {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0.1875rem 0.5rem;
    border-radius: 0.4375rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    font-size: 0.5625rem;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.perm-act input {
    position: absolute;
    inset: 0;
    opacity: 0;
    margin: 0;
    cursor: pointer;
}
.perm-act:hover { border-color: #cbd5e1; color: #0f172a; }
.perm-act:has(input:disabled) { cursor: default; opacity: 0.6; }

/*
 | ما يمنحه الدور: مؤشَّرٌ ومقفل، وبلونٍ يميّزه عمّا مُنح مباشرةً. من يقرأ
 | الشاشة يحتاج أن يعرف من أين جاءت الصلاحية — لا أنها ممنوحة فحسب.
 */
.perm-act--role {
    border-style: dashed;
    border-color: #cbd5e1;
    background: #f8fafc;
    color: #94a3b8;
    opacity: 1;
}
.perm-act--role:has(input:disabled) { opacity: 1; }

/*
 | علامة الصح داخل الشارة: عرضها صفر ما دامت غير ممنوحة فلا تترك فراغاً،
 | وتُفتح بحركة عند التأشير. الخلفية تبقى فاتحة والحدّ هو ما يميّز.
 */
.perm-act::before {
    content: "\e35f";
    font-family: uicons-regular-rounded;
    font-size: 0.5rem;
    line-height: 1;
    width: 0;
    margin-inline-end: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.3);
    transition:
        width 0.24s cubic-bezier(0.16, 1, 0.3, 1),
        margin-inline-end 0.24s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.16s ease 0.04s,
        transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) 0.04s;
}

.perm-act:has(input:checked) {
    background: rgba(13, 59, 102, 0.07);
    border-color: #0D3B66;
    color: #0D3B66;
    font-weight: 800;
}
.perm-act:has(input:checked)::before {
    width: 0.5625rem;
    margin-inline-end: 0.3125rem;
    opacity: 1;
    transform: scale(1);
}

@media (prefers-reduced-motion: reduce) {
    .perm-act::before { transition: none; }
}

/* الأفعال التي لا رجعة عنها تُميَّز بلون التحذير عند تحديدها */
.perm-act--hot:has(input:checked) {
    background: rgba(245, 158, 11, 0.1);
    border-color: #d97706;
    color: #b45309;
}

/* ── اختيار الأدوار ── */
.role-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 0.5rem;
}
.role-chip {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.18s ease, background 0.18s ease;
}
.role-chip input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.role-chip:hover { border-color: #cbd5e1; }
.role-chip:has(input:checked) { border-color: rgba(13, 59, 102, 0.35); background: rgba(13, 59, 102, 0.05); }
.role-chip:has(input:disabled) { cursor: default; opacity: 0.55; }

.role-chip__mark {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    margin-top: 0.125rem;
    border-radius: 0.3125rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: transparent;
    font-size: 0.4375rem;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.role-chip:has(input:checked) .role-chip__mark { background: #0D3B66; border-color: #0D3B66; color: #fff; }

.role-chip__name { display: block; font-size: 0.6875rem; font-weight: 800; color: #334155; }
.role-chip__desc { display: block; font-size: 0.5625rem; color: #94a3b8; margin-top: 0.125rem; line-height: 1.5; }
.role-chip--super:has(input:checked) { border-color: rgba(245, 158, 11, 0.45); background: rgba(245, 158, 11, 0.08); }
.role-chip--super:has(input:checked) .role-chip__mark { background: #d97706; border-color: #d97706; }

/* ── مرشّحات إضافية ── */
.filter-select,
.filter-date {
    height: 2rem;
    border-radius: 0.625rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    font-size: 0.6875rem;
    font-weight: 600;
    font-family: inherit;
    color: #475569;
}
.filter-select {
    padding: 0 0.625rem;
    cursor: pointer;
    outline: none;
}
.filter-select:focus { border-color: rgba(13, 59, 102, 0.35); }

.filter-date {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0 0.625rem;
}
.filter-date > span { color: #94a3b8; font-size: 0.625rem; font-weight: 700; }
.filter-date input {
    border: 0;
    background: transparent;
    outline: none;
    font-family: inherit;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #475569;
    font-variant-numeric: tabular-nums;
}

/* ── أيقونة الحدث ── */
.act-icon {
    flex-shrink: 0;
    width: 1.875rem;
    height: 1.875rem;
    border-radius: 0.625rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
}
.act-icon--ok   { background: #ecfdf5; color: #047857; }
.act-icon--bad  { background: #fff1f2; color: #be123c; }
.act-icon--info { background: rgba(13, 59, 102, 0.08); color: #0D3B66; }
.act-icon--mute { background: #f1f5f9; color: #64748b; }

/* ── جدول الفروق ── */
.diff {
    border: 1px solid #f1f5f9;
    border-radius: 0.625rem;
    overflow: hidden;
    background: #fff;
}
.diff__head,
.diff__row {
    display: grid;
    grid-template-columns: 10rem 1fr 1fr;
    gap: 0.75rem;
    padding: 0.4375rem 0.75rem;
    align-items: baseline;
}
.diff__head {
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.5625rem;
    font-weight: 800;
    color: #94a3b8;
}
.diff__row { border-top: 1px solid #f8fafc; font-size: 0.6875rem; }
.diff__row:first-of-type { border-top: 0; }
.diff__field { font-weight: 700; color: #475569; }
.diff__row > span { min-width: 0; }

/* ── نافذة عريضة ── */
.modal__panel--wide { max-width: 44rem; }

/* ── شارات التفصيل ── */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1875rem 0.5rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.5625rem;
    font-weight: 800;
    white-space: nowrap;
}
.tag--ok   { background: #ecfdf5; color: #047857; }
.tag--bad  { background: #fff1f2; color: #be123c; }
.tag--info { background: rgba(13, 59, 102, 0.08); color: #0D3B66; }
.tag--mute { background: #f1f5f9; color: #64748b; }

/* ── شبكة الحقائق ── */
.det__title {
    font-size: 0.5625rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
    margin: 0 0 0.5rem;
}
.det-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.5rem;
}
.det {
    display: flex;
    flex-direction: column;
    gap: 0.3125rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.625rem;
    border: 1px solid #f1f5f9;
    background: #fff;
    min-width: 0;
}
.det__k { font-size: 0.5625rem; font-weight: 700; color: #94a3b8; }
.det__v { font-size: 0.6875rem; font-weight: 700; color: #334155; min-width: 0; overflow-wrap: anywhere; }
.det__v--mute { color: #94a3b8; font-weight: 600; }
.det__empty {
    margin: 0;
    padding: 0.875rem;
    border-radius: 0.625rem;
    border: 1px dashed #e2e8f0;
    background: #f8fafc;
    text-align: center;
    font-size: 0.6875rem;
    color: #94a3b8;
}

/* ── نص برمجي ── */
.code {
    display: inline-block;
    max-width: 100%;
    padding: 0.0625rem 0.375rem;
    border-radius: 0.375rem;
    background: #f1f5f9;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.625rem;
    color: #334155;
    unicode-bidi: isolate;
    overflow-wrap: anywhere;
}
.code--block { display: block; padding: 0.5rem 0.625rem; line-height: 1.7; }

.raw { margin-top: 0.5rem; }
.raw summary {
    cursor: pointer;
    font-size: 0.5625rem;
    font-weight: 700;
    color: #94a3b8;
    list-style: none;
}
.raw summary::-webkit-details-marker { display: none; }
.raw summary::before { content: '+ '; }
.raw[open] summary::before { content: '− '; }
.raw summary:hover { color: #0D3B66; }
.raw > .code { margin-top: 0.375rem; }

/* ── قيمة قبل/بعد ── */
.val {
    display: inline-block;
    max-width: 100%;
    padding: 0.125rem 0.4375rem;
    border-radius: 0.375rem;
    font-size: 0.625rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}
.val--old { background: #fff1f2; color: #be123c; }
.val--new { background: #ecfdf5; color: #047857; }

/* ── قائمة مجموعات الإعدادات ── */
.set-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem;
    border-radius: 0.75rem;
    background: #fff;
    border: 1px solid #f1f5f9;
    box-shadow: 0 2px 15px -3px rgba(0, 0, 0, 0.03);
}
.set-nav__item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    border: 0;
    border-radius: 0.625rem;
    background: transparent;
    font-family: inherit;
    cursor: pointer;
    text-align: start;
    transition: background 0.15s ease;
}
.set-nav__item:hover { background: #f8fafc; }
.set-nav__item.is-on { background: rgba(13, 59, 102, 0.07); }

.set-nav__icon {
    flex-shrink: 0;
    width: 1.875rem;
    height: 1.875rem;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #64748b;
    font-size: 0.6875rem;
    transition: background 0.15s ease, color 0.15s ease;
}
.set-nav__item.is-on .set-nav__icon { background: #0D3B66; color: #fff; }

.set-nav__name { display: block; font-size: 0.6875rem; font-weight: 800; color: #334155; }
.set-nav__item.is-on .set-nav__name { color: #0D3B66; }
.set-nav__hint { display: block; font-size: 0.5625rem; color: #94a3b8; margin-top: 0.125rem; line-height: 1.5; }

.set-nav__arrow {
    flex-shrink: 0;
    font-size: 0.625rem;
    color: #cbd5e1;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.set-nav__item.is-on .set-nav__arrow,
.set-nav__item:hover .set-nav__arrow { opacity: 1; }

/* حقل نصّي متعدّد الأسطر ولاحقة وحدة */
.field__input--area { height: auto; padding: 0.5rem 0.75rem; line-height: 1.8; resize: vertical; }

.suffix-wrap { position: relative; }
.suffix-wrap .field__input { padding-left: 4.5rem; }
.suffix {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.5625rem;
    font-weight: 700;
    color: #94a3b8;
    pointer-events: none;
}

/* ── شجرة التصنيفات ── */
.tree-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.625rem;
    border-radius: 0.625rem;
    transition: background 0.15s ease;
}
.tree-row:hover { background: #f8fafc; }
.tree-row--off { opacity: 0.55; }

/* يحجز عرضه دائماً فتبقى الأسماء على خط واحد سواء كان للعقدة فروع أم لا */
.tree-row__toggle {
    flex-shrink: 0;
    width: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tree-row__bullet {
    width: 0.3125rem;
    height: 0.3125rem;
    border-radius: 999px;
    background: #cbd5e1;
}
.tree-caret {
    width: 1.5rem;
    height: 1.5rem;
    border: 0;
    border-radius: 0.375rem;
    background: transparent;
    color: #94a3b8;
    font-size: 0.6875rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.15s ease, color 0.15s ease;
}
.tree-caret:hover { background: #f1f5f9; color: #0D3B66; }
/* مغلق يشير إلى بداية السطر، مفتوح يدور إلى الأسفل — والاتجاه يتبع rtl */
.tree-caret--open { transform: rotate(-90deg); }
html[dir="ltr"] .tree-caret i { transform: rotate(180deg); }
html[dir="ltr"] .tree-caret--open { transform: rotate(90deg); }

/* الخط الواصل يُرسم على الحاوية لا على كل عقدة، فيبقى متصلاً بين الإخوة */
.tree-children {
    margin-inline-start: 1.375rem;
    padding-inline-start: 0.75rem;
    border-inline-start: 1px solid #e2e8f0;
}
.tree-node--l1 > .tree-row > .min-w-0 > p:first-child { font-weight: 800; }

/* ── بطاقة اختيار (نوع الصنف) ── */
.type-card {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.75rem 0.875rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.type-card:hover { border-color: #cbd5e1; }
.type-card--on {
    border-color: rgba(13, 59, 102, 0.35);
    background: rgba(13, 59, 102, 0.04);
}
.type-card__check {
    flex-shrink: 0;
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.0625rem;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: transparent;
    font-size: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.type-card--on .type-card__check {
    background: #0D3B66;
    border-color: #0D3B66;
    color: #fff;
}

/* ── قائمة اختيار مخصّصة ──
 | النيتف select يرسم قائمته نظامُ التشغيل، فلا تطاله ألوان القالب ولا خطوطه
 | ولا يقبل سطرين في الخيار الواحد. هذه بديلها بنفس هيئة .field__input.
*/
.wc-select { position: relative; }

.wc-select__trigger {
    width: 100%;
    height: 2.375rem;
    padding: 0 0.75rem;
    border-radius: 0.625rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    outline: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.wc-select__trigger:hover { border-color: #cbd5e1; }
.wc-select__trigger:focus-visible,
.wc-select__trigger[aria-expanded="true"] {
    border-color: rgba(13, 59, 102, 0.35);
    box-shadow: 0 0 0 4px rgba(13, 59, 102, 0.06);
}

.wc-select__value {
    flex: 1;
    min-width: 0;
    text-align: start;
    font-weight: 500;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wc-select__value--empty { color: #94a3b8; font-weight: 400; }

.wc-select__caret {
    flex-shrink: 0;
    font-size: 0.625rem;
    color: #94a3b8;
    transition: transform 0.2s ease;
}
.wc-select__caret--open { transform: rotate(180deg); }

.wc-select__panel {
    /* absolute تحت الحقل: تمشي مع الصفحة بلا JS. القصّ رُفع عن البطاقات
       التي تحمل قوائم، فلا حاجة إلى fixed ولا إلى تطيير. */
    position: absolute;
    top: calc(100% + 0.375rem);
    inset-inline: 0;
    z-index: 50;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    box-shadow: 0 18px 40px -16px rgba(2, 8, 18, 0.28);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
/* قرب أسفل الشاشة تُفتح إلى الأعلى — يُقرَّر مرة عند الفتح */
.wc-select__panel--up {
    top: auto;
    bottom: calc(100% + 0.375rem);
}
/* القائمة المفتوحة ترتفع فوق البطاقات التالية لها في الصفحة */
.wc-select.is-open { z-index: 60; }

/* الحركة من الحالة مباشرةً: x-transition كان يعِد بإخفاءٍ لا يفي به في وقته */
.wc-select.is-open > .wc-select__panel {
    animation: wc-select-in 0.16s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes wc-select-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}

.wc-select__search {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}
.wc-select__search i { font-size: 0.6875rem; color: #94a3b8; flex-shrink: 0; }
.wc-select__search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    background: none;
    font-family: inherit;
    font-size: 0.75rem;
    color: #0f172a;
}
.wc-select__search input::placeholder { color: #cbd5e1; }

.wc-select__list { flex: 1; min-height: 0; max-height: 15rem; overflow-y: auto; padding: 0.25rem; }

/* النصّ يملأ الصفّ ويبدأ من جهة القراءة، فلا يبدو معلّقاً في الوسط */
.wc-select__opt > span { flex: 1; min-width: 0; text-align: start; }

.wc-select__opt {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.625rem;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    font-family: inherit;
    text-align: start;
    cursor: pointer;
    transition: background 0.12s ease;
}
.wc-select__opt--cursor { background: #f8fafc; }
.wc-select__opt--on     { background: rgba(13, 59, 102, 0.06); }
/* الفرع يُزاح عن أبيه بقدر عمقه، والإزاحة منطقية فتنقلب مع اتجاه الصفحة */
.wc-select__opt--d1 { padding-inline-start: 1.75rem; }
.wc-select__opt--d2 { padding-inline-start: 2.875rem; }
.wc-select__opt--d3 { padding-inline-start: 4rem; }
/* الجذر وحده يُعرَض بثقل أعلى، فتُقرأ الشجرة من نظرة */
.wc-select__opt:not([class*="--d"]) .wc-select__opt-label { font-weight: 700; }

.wc-select__tick {
    flex-shrink: 0;
    margin-top: 0.125rem;
    font-size: 0.5625rem;
    color: transparent;
    transition: color 0.12s ease;
}
.wc-select__opt--on .wc-select__tick { color: #0D3B66; }

.wc-select__opt-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #0f172a;
}
.wc-select__opt--on .wc-select__opt-label { color: #0D3B66; }
.wc-select__opt-hint {
    display: block;
    font-size: 0.625rem;
    color: #94a3b8;
    margin-top: 0.0625rem;
}

.wc-select__empty {
    margin: 0;
    padding: 1.25rem 0.75rem;
    text-align: center;
    font-size: 0.6875rem;
    color: #94a3b8;
}

/* ── منطقة إفلات الصورة ── */
.drop {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem;
    border: 1px dashed #cbd5e1;
    border-radius: 0.75rem;
    background: #f8fafc;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.drop:hover { border-color: #94a3b8; }
.drop--over {
    border-color: #0D3B66;
    border-style: solid;
    background: rgba(13, 59, 102, 0.04);
}

/* الحقل يغطّي المنطقة كلها فيصير الضغط في أي مكان فتحاً للمتصفّح،
   ويبقى فوقه ما يُضغط لذاته (زر الحذف) بـ z-index أعلى */
.drop__input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
/* المحتوى فوق الحقل ليُرى، لكنه يمرّر النقر إليه — وإلا وقع الضغط على
   النص ولم يُفتح متصفّح الملفات. ما يُضغط لذاته وحده يستعيد النقر. */
.drop > *:not(.drop__input) { position: relative; z-index: 1; pointer-events: none; }
.drop button,
.drop a { pointer-events: auto; }

.drop__icon {
    flex-shrink: 0;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 0.625rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 1rem;
}
.drop__preview {
    flex-shrink: 0;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 0.625rem;
    object-fit: cover;
    border: 1px solid #e2e8f0;
    background: #fff;
}
.drop__title { margin: 0; font-size: 0.75rem; font-weight: 700; color: #334155; }
.drop__hint  { margin: 0.125rem 0 0; font-size: 0.625rem; color: #94a3b8; }
.drop__link {
    margin-top: 0.25rem;
    border: 0;
    background: none;
    padding: 0;
    font-family: inherit;
    font-size: 0.625rem;
    font-weight: 700;
    color: #0D3B66;
    cursor: pointer;
    text-decoration: underline;
}

/* مصغّرة الصنف في الجدول */
.item-thumb {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    object-fit: cover;
    border: 1px solid #e2e8f0;
    background: #fff;
    flex-shrink: 0;
}
.item-thumb--empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    font-size: 0.6875rem;
    background: #f8fafc;
}

/* ── عارض الصورة ── */
.lightbox {
    position: relative;
    z-index: 1;
    max-width: min(90vw, 56rem);
    max-height: 86vh;
    display: flex;
    animation: modal-in 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.lightbox img {
    max-width: 100%;
    max-height: 86vh;
    border-radius: 0.75rem;
    box-shadow: 0 30px 70px -18px rgba(2, 8, 18, 0.6);
    background: #fff;
    object-fit: contain;
}
.lightbox__close {
    position: absolute;
    top: -0.75rem;
    inset-inline-end: -0.75rem;
    width: 1.875rem;
    height: 1.875rem;
    border-radius: 999px;
    border: 0;
    background: #fff;
    color: #475569;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 18px -6px rgba(2, 8, 18, 0.4);
}
.lightbox__close:hover { background: #f1f5f9; color: #0f172a; }

/* ── نافذة القصّ ── */
/* ارتفاع صريح: Cropper يقيس حاويته، وحاوية بلا ارتفاع تعطيه صفراً */
.cropper-stage {
    height: min(52vh, 24rem);
    background: #0f172a;
    border-radius: 0.625rem;
    overflow: hidden;
}
.cropper-stage img { max-width: 100%; display: block; }

.crop-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.75rem;
}
.crop-tools__sep {
    width: 1px;
    height: 1.25rem;
    background: #e2e8f0;
    margin-inline: 0.25rem;
}
.crop-tool {
    height: 1.875rem;
    padding: 0 0.625rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #fff;
    color: #475569;
    font-family: inherit;
    font-size: 0.6875rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.crop-tool:hover { background: #f8fafc; color: #0f172a; }
.crop-tool--on {
    background: rgba(13, 59, 102, 0.07);
    border-color: rgba(13, 59, 102, 0.3);
    color: #0D3B66;
}

/* أزرار الصورة مجموعة: فجوة منطقة الإفلات (14px) تباعد بينها لو تُركت إخوةً لها */
.drop__actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
    pointer-events: auto;
}

/* ── تفاصيل الصنف ── */
.item-thumb-btn {
    border: 0;
    padding: 0;
    background: none;
    cursor: zoom-in;
    display: inline-flex;
    flex-shrink: 0;
}
.view-thumb {
    width: 3rem;
    height: 3rem;
    border-radius: 0.625rem;
    object-fit: cover;
    border: 1px solid #e2e8f0;
    background: #fff;
    flex-shrink: 0;
}
.view-thumb--empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    background: #f8fafc;
}
/*
 | شبكة أزواج: المفتاح فوق قيمته لا بجانبها.
 | .kv وحدها مصمّمة لقائمة رأسية — حدّ علوي يفصل الصفوف، وقيمة بلا التفاف
 | تُحاذى إلى الطرف. داخل شبكة أفقية يصير الحدّ فاصلاً بلا معنى وتتزاحم
 | القيم على سطر واحد. فتُعاد هنا لما يناسب الشبكة.
*/
/* قائمة أزواج رأسية: الحدّ العلوي يفصل بين الصفوف، ولا حدّ فوق أولها */
.kv-list > .kv:first-child { border-top: 0; padding-top: 0; }
.kv-list > .kv:last-child  { padding-bottom: 0; }

.kv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.625rem;
}
.kv-grid .kv {
    display: block;
    border: 1px solid #f1f5f9;
    border-radius: 0.625rem;
    padding: 0.625rem 0.75rem;
    background: #f8fafc;
}
.kv-grid .kv__k {
    display: block;
    margin-bottom: 0.25rem;
}
.kv-grid .kv__v {
    display: block;
    text-align: start;
    white-space: normal;
    overflow: visible;
    line-height: 1.6;
}
/* صفّ الزوج: المفتاح يثبت والقيمة تأخذ ما بقي، فتستقيم الأعمدة */
.kv--row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

/* ── صورة صفحة الصنف ── */
.show-art {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #f8fafc;
    padding: 0;
    overflow: hidden;
    cursor: zoom-in;
}
.show-art img { width: 100%; height: 100%; object-fit: contain; display: block; }
.show-art--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    font-size: 1.75rem;
    cursor: default;
}
.show-art__zoom {
    position: absolute;
    inset-block-end: 0.5rem;
    inset-inline-end: 0.5rem;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    background: rgba(2, 8, 18, 0.55);
    color: #fff;
    font-size: 0.625rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.show-art:hover .show-art__zoom { opacity: 1; }

.pill--muted { background: #f1f5f9; color: #64748b; }

/* ── بطاقة انتحال الهوية في الشريط العلوي ──
 | بهيئة بطاقة "آخر دخول" نفسها لتستقرّ بجانبها، وبلون العلامة الذهبي
 | لأنها تحذير لا معلومة.
*/
.imp-chip {
    display: none;
    height: 2.5rem;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.5rem 0 0.375rem;
    border-radius: 0.75rem;
    background: rgba(242, 178, 51, 0.16);
    border: 1px solid rgba(242, 178, 51, 0.5);
    color: #6b5313;
}
@media (min-width: 768px) { .imp-chip { display: flex; } }

.imp-chip__icon {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.5rem;
    background: #F2B233;
    color: #3d2f0b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    flex-shrink: 0;
}
.imp-chip__label { font-size: 0.5625rem; font-weight: 600; opacity: 0.75; }
.imp-chip__name  { font-size: 0.625rem; font-weight: 800; white-space: nowrap; }

.imp-chip__back {
    width: 1.5rem;
    height: 1.5rem;
    border: 0;
    border-radius: 0.5rem;
    background: rgba(61, 47, 11, 0.12);
    color: inherit;
    font-size: 0.625rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease;
}
.imp-chip__back:hover { background: rgba(61, 47, 11, 0.24); }
.u-avatar--lg { width: 4rem; height: 4rem; font-size: 1.25rem; }

/* نقطة الحضور على الحرف الأول — حلقة بلون الخلفية تفصلها عن الصورة */
.u-avatar { position: relative; }
.u-avatar--online::after {
    content: "";
    position: absolute;
    inset-block-end: -1px;
    inset-inline-end: -1px;
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 999px;
    background: #10b981;
    box-shadow: 0 0 0 2px #fff;
}

/* صلاحية مفردة في صفحة المستخدم */
.perm-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 0.5625rem;
    font-weight: 700;
    white-space: nowrap;
}

/* ── سطر سند ── */
.doc-line {
    display: grid;
    grid-template-columns: 1.5rem 1fr 1fr auto;
    gap: 0.5rem;
    align-items: start;
    padding: 0.625rem;
    border: 1px solid #f1f5f9;
    border-radius: 0.75rem;
    background: #f8fafc;
}
@media (min-width: 768px) {
    .doc-line { grid-template-columns: 1.5rem minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto; }
}
.doc-line__no {
    align-self: center;
    font-size: 0.625rem;
    font-weight: 800;
    color: #cbd5e1;
    text-align: center;
}
.doc-line__item { grid-column: 2 / -1; min-width: 0; }
.doc-line__qty, .doc-line__cost { grid-column: span 1; min-width: 0; }
.doc-line__del { align-self: center; }
@media (min-width: 768px) {
    .doc-line__item { grid-column: auto; }
}
/* الرصيد الحالي تحت الكمية: رؤيته قبل الترحيل أنفع من رفضٍ بعده */
.doc-line__onhand {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.5625rem;
    font-weight: 600;
    color: #94a3b8;
}
.doc-line__auto {
    display: flex;
    align-items: center;
    height: 2.375rem;
    font-size: 0.625rem;
    color: #94a3b8;
}

/* ألوان حالة السند — تتبع StockDocStatus::tone() */
.pill--slate   { background: #f1f5f9; color: #64748b; }
.pill--emerald { background: #ecfdf5; color: #047857; }
.pill--rose    { background: #fff1f2; color: #be123c; }
/* العنبر لحالٍ مؤقّت: «في إجازة» ليست تعطيلاً ولا عملاً، وبلا هذه القاعدة
   كانت الحبّة تخرج بلا لون لأن tone() يعدها ولا يجد لها تعريفاً */
.pill--amber   { background: #fffbeb; color: #b45309; }
.pill--slate .pill__dot   { background: #94a3b8; }
.pill--emerald .pill__dot { background: #10b981; }
.pill--rose .pill__dot    { background: #f43f5e; }
.pill--amber .pill__dot   { background: #f59e0b; }

/* ── صفّ مرفق ── */
.attach-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.625rem;
    border: 1px solid #f1f5f9;
    border-radius: 0.625rem;
    background: #fff;
}
.attach-row__thumb {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    overflow: hidden;
    flex-shrink: 0;
    padding: 0;
    cursor: zoom-in;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.attach-row__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-row__thumb--file { color: #94a3b8; font-size: 0.875rem; cursor: default; }

/* ── بطاقة رقم في صفحة المخزن ── */
.wh-stat {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    background: #fff;
    border: 1px solid #f1f5f9;
    box-shadow: 0 2px 15px -3px rgba(0, 0, 0, 0.03);
}
.wh-stat__icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.625rem;
    background: rgba(13, 59, 102, 0.08);
    color: #0D3B66;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}
.wh-stat__value { margin: 0; font-size: 0.9375rem; font-weight: 800; color: #0f172a; }
.wh-stat__label { margin: 0.125rem 0 0; font-size: 0.625rem; font-weight: 600; color: #94a3b8; }
.wh-stat--warn .wh-stat__icon  { background: rgba(245, 158, 11, 0.14); color: #b45309; }
.wh-stat--warn .wh-stat__value { color: #b45309; }

/* ── بطاقة حساب ── */
.cash-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 0.875rem;
    border: 1px solid #f1f5f9;
    border-radius: 0.75rem;
    background: #fff;
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.cash-card:hover { border-color: rgba(13, 59, 102, 0.2); background: #f8fafc; }
.cash-card--off { opacity: 0.6; }

.cash-card__icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.625rem;
    background: rgba(13, 59, 102, 0.08);
    color: #0D3B66;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* الأرصدة تتكدّس رأسياً على الضيّق فلا تُقصّ */
.cash-card__balances {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.1875rem;
    flex-shrink: 0;
    min-width: 8.5rem;
}

/*
 | رمز العملة في عمودٍ ثابت والرقم في آخر: أرقامٌ لا تصطفّ تُقرأ واحداً
 | واحداً، والمصطفّة تُقارن بنظرة — وهذا كل غرض هذه الشاشة.
*/
.bal {
    display: grid;
    grid-template-columns: 1.75rem 1fr;
    align-items: baseline;
    gap: 0.375rem;
    white-space: nowrap;
}
.bal__cur {
    font-size: 0.5625rem;
    font-weight: 800;
    color: #94a3b8;
    letter-spacing: 0.02em;
}
.bal__num {
    font-size: 0.75rem;
    font-weight: 800;
    color: #0f172a;
    text-align: end;
    font-variant-numeric: tabular-nums;
}
.bal--neg  .bal__num { color: #be123c; }
.bal--zero .bal__num { color: #cbd5e1; font-weight: 700; }

/* ── صفّ مورّد ── */
/*
 | الصفّ رابطٌ إلى صفحته، والأزرار خارجَه لا داخله: زرٌّ داخل <a> يجعل كل
 | نقرة عليه نقرتين — فتحُ الصفحة وتنفيذُ الأمر معاً.
*/
.sup-row {
    display: flex;
    align-items: stretch;
    gap: 0.25rem;
    border: 1px solid #f1f5f9;
    border-radius: 0.75rem;
    background: #fff;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.sup-row:hover { border-color: rgba(13, 59, 102, 0.2); background: #f8fafc; }
.sup-row--off { opacity: 0.6; }

.sup-row__main {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    flex: 1;
    min-width: 0;
    padding: 0.75rem 0.875rem;
    text-decoration: none;
}

.sup-row__icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.625rem;
    background: rgba(13, 59, 102, 0.08);
    color: #0D3B66;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    flex-shrink: 0;
}

.sup-row__cur {
    font-size: 0.5625rem;
    font-weight: 800;
    color: #64748b;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 0.375rem;
    padding: 0.125rem 0.375rem;
    flex-shrink: 0;
}

.sup-row__docs {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.625rem;
    font-weight: 800;
    color: #94a3b8;
    flex-shrink: 0;
}

.sup-row__acts {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 0.5rem 0.75rem 0.875rem;
    flex-shrink: 0;
}
.sup-row__act {
    width: 1.875rem;
    height: 1.875rem;
    border-radius: 0.5rem;
    border: 1px solid #f1f5f9;
    background: #fff;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.sup-row__act:hover { color: #0D3B66; border-color: rgba(13, 59, 102, 0.2); background: #f8fafc; }
.sup-row__act--danger:hover { color: #be123c; border-color: #fecdd3; background: #fff1f2; }

/* سند في صفحة المورّد */
.sup-doc {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid #f1f5f9;
    border-radius: 0.625rem;
    background: #fff;
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.sup-doc:hover { border-color: rgba(13, 59, 102, 0.2); background: #f8fafc; }

/* ── الموظفون ── */
/* صورة الصفّ: صغيرةٌ تُعرّف ولا تزاحم النصّ */
.emp-thumb {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    object-fit: cover;
    flex-shrink: 0;
    background: #f1f5f9;
}
.emp-thumb--blank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 59, 102, 0.08);
    color: #0D3B66;
    font-size: 0.625rem;
    font-weight: 800;
}

/* ── سطر بند عهدة ── */
.cd-line {
    display: grid;
    grid-template-columns: minmax(0, 2fr) 7rem minmax(0, 1fr) auto;
    align-items: start;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid #f1f5f9;
    border-radius: 0.625rem;
    background: #fff;
}
@media (max-width: 640px) {
    .cd-line { grid-template-columns: 1fr auto; }
    .cd-line__item { grid-column: 1 / -1; }
}
.cd-line__del {
    width: 2.375rem;
    height: 2.375rem;
    border-radius: 0.5rem;
    border: 1px solid #f1f5f9;
    background: #fff;
    color: #cbd5e1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.cd-line__del:hover { color: #be123c; border-color: #fecdd3; background: #fff1f2; }

/* خانةٌ هي زرّ: تدعو إلى الخطوة التالية بدل أن تعرض صفراً */
.stk-cta { text-decoration: none; border-style: dashed; transition: border-color 0.15s ease, background 0.15s ease; }
.stk-cta:hover { border-color: rgba(13, 59, 102, 0.35); background: #f8fafc; }
.stk-cta .emp-stat__v { color: #0D3B66; font-size: 1rem; }

/* ── وَسْم إسناد ── */
/*
 | الحجم من عنصرٍ واحد: font-size على الجذر، وكل ما بداخله يقيس نفسه به
 | (em). فوضعُه في الترويسة أو القائمة أو اللودر تغييرُ رقمٍ واحد.
*/
.isnad {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15em;
    font-size: 1.5rem;
    line-height: 1;
    white-space: nowrap;
    user-select: none;
}
/*
 | اتجاه العلامة من نفسها لا من حاويتها: سطر الاعتماد في القائمة داخل
 | span بـdir=ltr، فكان الرمز ينقلب إلى يسار الاسم بينما هو يمينه في
 | الشعار الكبير — علامتان مختلفتان من مصدرٍ واحد.
*/
.isnad--ar { direction: rtl; }
.isnad--en { direction: ltr; }

.isnad__row { display: inline-flex; align-items: center; gap: 0.3em; }

/* الرمز يقيس نفسه بحجم الخطّ، فلا يُضبط في موضعين */
/* نسبة الرمز 48×32، فعرضُه مرّةً ونصفاً ارتفاعَه */
.isnad__glyph { width: 1.5em; height: 1em; flex-shrink: 0; display: block; color: #0D3B66; }

/* موضعٌ داكن داخل صفحةٍ فاتحة — كبطاقة الشعار الليلي في الإعدادات */
.isnad--on-dark .isnad__glyph { color: #e8eef6; }
.isnad--on-dark .isnad__word  { color: #e8eef6; }

.isnad__word {
    font-weight: 800;
    color: #0D3B66;
}
/* اللاتيني بأحرفٍ كبيرة متباعدة: كتلةٌ واحدة تُقرأ من بعيد */
.isnad--en .isnad__word { letter-spacing: 0.14em; }
/* والعربي لا يُباعد: التباعد يفكّ وصلَ حروفه */
.isnad--ar .isnad__word { letter-spacing: 0; }



/*
 | في المقاس الصغير يُرفع الرمز وحده لا النصّ: الحلقتان تذوبان قبل أن
 | تذوب الحروف، فتبدو العلامة نقطتين لا سلسلة.
*/
.isnad--xs { font-size: 0.75rem; }
.isnad--xs .isnad__glyph { width: 2em; height: 1.34em; }

/* أصغرها: سطر الحقوق — يُقرأ ولا يزاحم */
.isnad--tiny { font-size: 0.625rem; }
.isnad--tiny .isnad__glyph { width: 2.1em; height: 1.4em; }
.isnad--sm { font-size: 1.125rem; }
.isnad--lg { font-size: 2.25rem; }

/* في اللودر يتوسّط بذاته: العنصر عمودي، فالمحاذاة إلى المنتصف لا إلى الحافة */
.loader-mark { align-items: center; font-size: 2.75rem; }

/* ── بطاقة الشعار في الإعدادات ── */
.logo-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem;
    border: 1px solid #f1f5f9;
    border-radius: 0.75rem;
    background: #fff;
}

/* إطار الداكن بخلفية داكنة: شعارُ الليل يُحكم عليه على خلفيته لا على بيضاء */
.logo-card__frame {
    flex: 1;
    min-width: 0;
    height: 4.5rem;
    border-radius: 0.5rem;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.logo-card__frame img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 0.375rem; }
.logo-card--dark .logo-card__frame { background: #0a1424; }
.logo-card--dark .brandmark__a { color: #7dd3fc; }

.logo-card__acts { display: flex; flex-direction: column; gap: 0.25rem; flex-shrink: 0; }
.logo-card__btn {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    border: 1px solid #f1f5f9;
    background: #fff;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.logo-card__btn:hover { color: #0D3B66; border-color: rgba(13, 59, 102, 0.2); background: #f8fafc; }
.logo-card__btn--danger:hover { color: #be123c; border-color: #fecdd3; background: #fff1f2; }

.logo-card__busy {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 0.75rem;
    font-weight: 800;
    color: #64748b;
}

/* ── تقدّم العدّ ── */
.stk-progress { display: flex; align-items: center; gap: 0.5rem; min-width: 7rem; }
.stk-progress__bar {
    flex: 1;
    height: 0.375rem;
    border-radius: 999px;
    background: #f1f5f9;
    overflow: hidden;
    min-width: 3rem;
}
.stk-progress__fill { display: block; height: 100%; border-radius: 999px; background: #0D3B66; transition: width 0.2s ease; }
.stk-progress__text { font-size: 0.625rem; font-weight: 700; color: #64748b; white-space: nowrap; }

/* شريط أرقام الموظّف */
.emp-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 0.625rem;
}
.emp-stat {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.75rem 0.875rem;
    border: 1px solid #f1f5f9;
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: 0 2px 15px -3px rgba(0, 0, 0, 0.03);
    min-width: 0;
}
.emp-stat__k { font-size: 0.5625rem; font-weight: 800; color: #94a3b8; letter-spacing: 0.02em; }
.emp-stat__v {
    font-size: 0.9375rem;
    font-weight: 800;
    color: #0D3B66;
    line-height: 1.3;
    /* الرقم داخل جملته العربية: لا dir=ltr على السطر كلّه وإلّا قفز إلى
       الحافة المقابلة وبدا كأنه في العمود المجاور */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.emp-stat__m {
    font-size: 0.5625rem;
    font-weight: 600;
    color: #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.emp-stat--locked .emp-stat__v { color: #cbd5e1; }

/*
 | سجلّ الحقول: عمودان، كل خليّة تسمية فوق قيمة. و.kv لا تصلح هنا —
 | حدُّها العلوي يُلغى للأولى وحدها، فيبقى للعمود الثاني حدٌّ شاردٌ في رأسه.
*/
.emp-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 0;
    margin: 0;
    padding: 0.5rem 0.75rem;
}
.emp-fact {
    display: flex;
    flex-direction: column;
    gap: 0.0625rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f8fafc;
    min-width: 0;
}
.emp-fact__k { font-size: 0.5625rem; font-weight: 700; color: #94a3b8; }
.emp-fact__v {
    font-size: 0.75rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    overflow-wrap: anywhere;
}
.emp-fact__v--empty { color: #cbd5e1; font-weight: 600; }

/*
 | dir=ltr يرتّب المحارف ويحاذيها معاً: القيمة تقفز إلى الحافة اليسرى بينما
 | تسميتها على اليمين، فيتعرّج العمود. الترتيب لاتيني والمحاذاة عربية —
 | يلزم فصلهما، لا الاستغناء عن أحدهما.
*/
.emp-fact__v[dir="ltr"] { text-align: right; }

/* العمود الجانبي أضيق من أن يحمل عمودين */
.emp-facts--one { grid-template-columns: 1fr; }

/* الصورة في رأس صفحة الموظّف */
.emp-avatar {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 0.875rem;
    object-fit: cover;
    flex-shrink: 0;
    background: #f1f5f9;
}
.emp-avatar--blank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 59, 102, 0.08);
    color: #0D3B66;
    font-size: 1rem;
    font-weight: 800;
}

/* رافع الصورة في النموذج */
.emp-photo {
    position: relative;
    width: 7.5rem;
    height: 7.5rem;
    border-radius: 1rem;
    border: 2px dashed #e2e8f0;
    background: #f8fafc;
    overflow: hidden;
    cursor: pointer;
    display: block;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.emp-photo:hover, .emp-photo--over { border-color: rgba(13, 59, 102, 0.35); background: #f1f5f9; }
.emp-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.emp-photo__blank {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    font-size: 1.75rem;
}
/* الغطاء يظهر عند المرور وحده، فلا يحجب الصورة وقت النظر إليها */
.emp-photo__veil {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 59, 102, 0.55);
    color: #fff;
    font-size: 1.125rem;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.emp-photo:hover .emp-photo__veil { opacity: 1; }

/* ── مجاميع العملات ── */
.cash-totals {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
    gap: 0.625rem;
}
.cash-total {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.75rem 0.875rem;
    border: 1px solid #f1f5f9;
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: 0 2px 15px -3px rgba(0, 0, 0, 0.03);
}
.cash-total__cur {
    font-size: 0.5625rem;
    font-weight: 800;
    color: #94a3b8;
    letter-spacing: 0.04em;
}
.cash-total__value {
    font-size: 1.0625rem;
    font-weight: 800;
    color: #0D3B66;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.cash-total__meta { font-size: 0.5625rem; font-weight: 600; color: #cbd5e1; }
.cash-total--neg .cash-total__value { color: #be123c; }

/* ── تجميع بالنوع ── */
.cash-group { padding: 0.875rem 0.75rem 0.25rem; }
.cash-group + .cash-group { padding-top: 0.25rem; }

.cash-group__head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.25rem 0.5rem;
}
.cash-group__name {
    font-size: 0.625rem;
    font-weight: 800;
    color: #64748b;
    letter-spacing: 0.02em;
}
.cash-group__count {
    font-size: 0.5625rem;
    font-weight: 800;
    color: #94a3b8;
    background: #f8fafc;
    border-radius: 999px;
    padding: 0.0625rem 0.375rem;
}
.cash-group__rule { flex: 1; height: 1px; background: #f1f5f9; }

.cash-group__rows { display: flex; flex-direction: column; gap: 0.375rem; }
.cash-card__hidden {
    font-size: 0.5625rem;
    font-weight: 700;
    color: #cbd5e1;
    flex-shrink: 0;
    white-space: nowrap;
}

/* ── سطر تحويل ── */
/*
 | التحويل واقعةٌ بطرفين، فيُرسم بطرفين: شبكةٌ من جهةٍ ووسطٍ وجهة، تحتها
 | سطر بيان. السطر الواحد المسطّح كان يُلصق الحسابين والمبلغين في ركن
 | فلا يُعرف أيّ مبلغ لأيّ حساب.
*/
.xfer {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto;
    grid-template-areas:
        "from mid to end"
        "meta meta meta end";
    align-items: center;
    gap: 0.25rem 0.875rem;
    padding: 0.75rem 0.875rem;
    border: 1px solid #f1f5f9;
    border-radius: 0.75rem;
    background: #fff;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.xfer:hover { border-color: rgba(13, 59, 102, 0.2); background: #f8fafc; }

/* المعكوس يبقى معروضاً — لا يُخفى، بل يُشطب ليُقرأ أنه كان */
.xfer--off { opacity: 0.6; }
.xfer--off .xfer__out,
.xfer--off .xfer__in { text-decoration: line-through; }

.xfer__side {
    grid-area: from;
    display: flex;
    flex-direction: column;
    gap: 0.0625rem;
    min-width: 0;
}
.xfer__side--in { grid-area: to; }

.xfer__role {
    font-size: 0.5625rem;
    font-weight: 700;
    color: #cbd5e1;
}
.xfer__acc {
    font-size: 0.75rem;
    font-weight: 800;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.xfer__out, .xfer__in {
    /* dir=ltr يرتّب الأرقام ويسحبها إلى يسار عمودها، فتفترق عن حسابها.
       align-self يردّها إلى بداية السطر حيث اسمُ الحساب فوقها. */
    align-self: flex-start;
    font-size: 0.6875rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.xfer__out { color: #be123c; }
.xfer__in  { color: #047857; }

.xfer__mid {
    grid-area: mid;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}
.xfer__arrow {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
}

.xfer__end {
    grid-area: end;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
}

.xfer__meta {
    grid-area: meta;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
    font-size: 0.625rem;
    font-weight: 600;
    color: #94a3b8;
    padding-top: 0.25rem;
    border-top: 1px dashed #f1f5f9;
    margin-top: 0.25rem;
}
.xfer__dot {
    width: 2px;
    height: 2px;
    border-radius: 999px;
    background: #cbd5e1;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .xfer {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "from end"
            "mid  end"
            "to   end"
            "meta meta";
        align-items: start;
    }
    .xfer__mid { flex-direction: row; align-self: start; }
}

.xfer__rate {
    font-size: 0.5625rem;
    font-weight: 700;
    color: #94a3b8;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 0.375rem;
    padding: 0.0625rem 0.3125rem;
    white-space: nowrap;
}

/* حقلٌ لا خياراتٍ له بعد: يُرسم ولا يُخفى، فلا يدخل شقيقٌ بين إعادتي الرسم */
.field--muted { opacity: 0.55; }

/* حقلٌ يُقرأ ولا يُكتب: مظهر الحقل بلا وعد التحرير */
.field__input--locked {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    background: #f8fafc;
    color: #64748b;
    font-weight: 700;
    cursor: default;
}

/* ── اختيار عملة ── */
.cur-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    height: 2rem;
    padding: 0 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #fff;
    color: #64748b;
    font-family: inherit;
    font-size: 0.6875rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.cur-chip:hover  { border-color: #cbd5e1; background: #f8fafc; }
.cur-chip--on    { background: rgba(13, 59, 102, 0.07); border-color: rgba(13, 59, 102, 0.3); color: #0D3B66; }
.cur-chip__code  { font-size: 0.5625rem; opacity: 0.55; }
/* بطاقة رقم قابلة للضغط — تُرشّح كشف الحساب بعملتها */
.wh-stat--on { border-color: rgba(13, 59, 102, 0.3); background: rgba(13, 59, 102, 0.04); }
button.wh-stat { cursor: pointer; font-family: inherit; text-align: start; }


/* ══════════ لوحة المتصلين ══════════ */

/*
 | على الشاشات الواسعة تتدلّى من الزرّ. وعلى الجوّال لا: لوحةٌ عرضُها ٢٢rem
 | معلّقةٌ بزرٍّ قربَ الحافة تخرج عن الشاشة فيُقرأ نصفُها.
 |
 | فيُترك الغلافُ ساكناً في الضيّق، فيصير أقربُ أصلٍ موضوعٍ هو شريطَ الرأس
 | الثابت نفسه — فتنزل اللوحة تحته بعرضه، بلا رقمٍ سحريّ لارتفاعه يُخمَّن
 | اليوم ويُخطئ غداً حين يتغيّر الشريط.
*/
.presence-wrap  { position: relative; }
.presence-panel {
    position: absolute;
    top: calc(100% + 0.375rem);
    inset-inline-end: 0;
    width: min(22rem, calc(100vw - 1.5rem));

    /*
     | تُرسم ولا تُقفز.
     |
     | visibility لا display: عنصرٌ يُخفى بـdisplay لا يُحرَّك — يظهر دفعةً
     | واحدة مهما كُتب له من انتقال. وهذه تبدأ مائلةً إلى أعلى بقليل ثم
     | تستقرّ، فتُقرأ نازلةً من الزرّ الذي فُتحت منه.
    */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-0.375rem) scale(0.98);
    transform-origin: top center;
    transition: opacity 0.16s ease, transform 0.2s cubic-bezier(0.2, 0.8, 0.3, 1), visibility 0.2s;
}
.presence-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    .presence-panel { transition: none; }
}

@media (max-width: 640px) {
    .presence-wrap  { position: static; }
    .presence-panel {
        inset-inline: 0.75rem;
        width: auto;
        max-height: calc(100vh - 6rem);
        display: flex;
        flex-direction: column;
    }
    .presence-panel__list { flex: 1; min-height: 0; }
}

/* ══════════ شريط الجوال السفلي ══════════ */

/*
 | لا شيء منه فوق الشاشات الصغيرة: الشريط العلويّ يحمل كل هذا هناك، وقائمةٌ
 | ثانية عند القدم تكرارٌ للموقع نفسه. ويظهر حيث يختفي الصفّ الأفقيّ — دون
 | lg — فلا يبقى الإبهام بلا طريقٍ قصير.
*/
.bottom-bar { display: none; }

@media (max-width: 1023px) {
    .bottom-bar {
        position: fixed;
        inset-inline: 0;
        bottom: 0;
        z-index: 940;
        display: block;
        /* مؤشّر الصفحة الرئيسية في الهواتف الحديثة يقع تحت الشريط */
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    /*
     | السطح، والعكفةُ المحفورة في حافته العليا ليقف فيها القرص.
     |
     | ليست دائرةً مثقوبةً في الحافة: دائرةٌ مركزُها على خطٍّ مستقيم تلقاه
     | بزاويةٍ قائمة، والركنان الحادّان اللذان يتركهما ليسا في المرجع. الحافة
     | تنزل إلى العكفة بتقويسةٍ من كل جانب وتعود منها كذلك — وهذا مسارٌ لا
     | تدرّج، فالقناع أربع طبقات: الوسطُ المشكَّل، والحافةُ المسطّحة عن
     | جانبيه، وجسمُ الشريط كلُّه تحت العكفة.
     |
     | والقطعة الوسطى ١٤٠×٤٦ لا تتمدّد، فالمنحنى واحدٌ على كل شاشة ولا يمطّ
     | إلا المسطَّحُ عن جانبيه.
    */
    .bottom-bar__plate {
        position: absolute;
        inset: 0;
        background: color-mix(in srgb, #0D3B66 4%, #ffffff);
        border-start-start-radius: 1.75rem;
        border-start-end-radius: 1.75rem;

        --cradle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 140 46'%3E%3Cpath d='M0 0L25.10 0A10 10 0 0 1 34.86 7.83A36 36 0 0 0 105.14 7.83A10 10 0 0 1 114.90 0L140 0L140 46L0 46Z' fill='%23fff'/%3E%3C/svg%3E");
        --flat: linear-gradient(#000, #000);

        /*
         | الجوانب تجري تحت الوسط المشكَّل ببكسل، والقاع تحتهما ببكسل: لو
         | تلاصقت الطبقات الأربع حافةً بحافة لتجمّعت حوافُّها المنعّمة على
         | ما يقارب العتامة عند كل وصل — وذاك خيطٌ يُرسم عبر الشريط.
        */
        mask-image: var(--cradle), var(--flat), var(--flat), var(--flat);
        mask-size: 140px 46px, calc(50% - 69px) 46px, calc(50% - 69px) 46px, 100% calc(100% - 45px);
        mask-position: top center, top left, top right, bottom center;
        mask-repeat: no-repeat;
        -webkit-mask-image: var(--cradle), var(--flat), var(--flat), var(--flat);
        -webkit-mask-size: 140px 46px, calc(50% - 69px) 46px, calc(50% - 69px) 46px, 100% calc(100% - 45px);
        -webkit-mask-position: top center, top left, top right, bottom center;
        -webkit-mask-repeat: no-repeat;

        /* ظلُّ إسقاطٍ لا ظلُّ صندوق: الرمية تتبع القطع، وظلُّ الصندوق يتبع الصندوق */
        filter: drop-shadow(0 -3px 8px rgba(13, 59, 102, 0.12));
    }

    .bottom-bar__row {
        position: relative;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        align-items: end;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .bottom-bar__link {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
        padding: 0.625rem 0.125rem 0.5625rem;
        min-height: 3.875rem;
        border: 0;
        background: transparent;
        cursor: pointer;
        color: #8497ad;
        font-family: inherit;
        font-size: 0.625rem;
        font-weight: 700;
        line-height: 0.875rem;
        text-align: center;
        text-decoration: none;
        transition: color 0.2s ease;
    }

    .bottom-bar__icon {
        font-size: 1.125rem;
        line-height: 1;
        transition: transform 0.2s ease, color 0.2s ease;
    }

    .bottom-bar__label {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        /* سطرٌ أطول من سطر الأيقونات: العربية تنزل تحت الخطّ أكثر من اللاتينية */
        line-height: 1.0625rem;
    }

    /* موضعُك: الأيقونة بلون العلامة ترتفع قليلاً، والكلمة أدكن لا بنفس اللون — لونُ العلامة عند عشرة بكسلات لا يُقرأ */
    .bottom-bar__link.is-active            { color: #0D3B66; }
    .bottom-bar__link.is-active .bottom-bar__icon { color: #1C74B0; transform: translateY(-1px); }

    /* لا رفعَ تحت الإصبع: لا تحويم في الهاتف، وما يرتفع تحت الإبهام يرتفع تحت لا شيء */
    .bottom-bar__link:active .bottom-bar__icon { transform: translateY(1px); }

    .bottom-bar__link:focus-visible {
        outline: 2px solid #1C74B0;
        outline-offset: -3px;
        border-radius: 0.75rem;
    }

    /* ─── القرص في المنتصف ─── */
    .bottom-bar__link--menu { padding-top: 0; }

    /*
     | القرصُ وكلمتُه أقصرُ من أيقونةٍ وكلمتِها، ففضلةُ هذا الموضع وقعت تحت
     | الكلمة فرفعتها عن أخواتها. تُدفع الكلمةُ إلى قدم موضعها حيث بقيّةُ
     | كلمات الصفّ — والقرصُ يُقاس من الأعلى فلا يتحرّك.
    */
    .bottom-bar__link--menu .bottom-bar__label { margin-block-start: auto; }

    .bottom-bar__disc {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 3.375rem;
        height: 3.375rem;
        border-radius: 999px;
        background: linear-gradient(135deg, #0D3B66, #1C74B0);
        color: #fff;
        /* مركزُه يقع على حافة الشريط تماماً، وهناك مركزُ العكفة: نصفُه قائمٌ ونصفُه في المهد، متساوي الفرجة حوله */
        margin-top: -1.6875rem;
        box-shadow: 0 8px 18px -6px rgba(13, 59, 102, 0.55);
        transition: transform 0.2s ease, background 0.2s ease;
    }
    .bottom-bar__disc i { font-size: 1.25rem; line-height: 1; }

    .bottom-bar__link--menu:active .bottom-bar__disc { transform: translateY(2px); }
    .bottom-bar__link--menu[aria-expanded="true"] .bottom-bar__disc {
        background: linear-gradient(135deg, #1C74B0, #F2B233);
    }

    /* والمحتوى لا يختفي تحته */
    .main-content { padding-bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px)) !important; }
}

/* ══════════ لوحات الشريط السفلي ══════════ */

/*
 | لوحةٌ لكل موضع، تصعد من حيث ضُغط الزرّ. قائمةٌ واحدة تجمع كل شيء تُجبر
 | الإبهام على البحث فيها؛ ولوحةُ الموضع تعرض ما تحته وحده.
*/
.bsheet {
    position: fixed;
    inset: 0;
    z-index: 960;
}
@media (min-width: 1024px) { .bsheet { display: none !important; } }

.bsheet__veil {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.28);
    opacity: 0;
    transition: opacity 0.22s ease;
}
.bsheet.is-open .bsheet__veil { opacity: 1; }

.bsheet__panel {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-start-start-radius: 1.75rem;
    border-start-end-radius: 1.75rem;
    box-shadow: 0 -18px 44px -24px rgba(15, 23, 42, 0.5);
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 0.5rem);
    transform: translateY(100%);
    transition: transform 0.26s cubic-bezier(0.32, 0.72, 0.28, 1);
}
.bsheet.is-open .bsheet__panel { transform: translateY(0); }
.bsheet__panel.is-dragging { transition: none; }

.bsheet__grab {
    display: flex;
    justify-content: center;
    padding: 0.625rem 0 0.375rem;
    cursor: grab;
    touch-action: none;
    flex-shrink: 0;
}
.bsheet__grab::before {
    content: "";
    width: 2.5rem;
    height: 0.25rem;
    border-radius: 999px;
    background: #dbe3ec;
}

.bsheet__head {
    position: relative;
    padding: 0.25rem 1.25rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.bsheet__title { margin: 0; font-size: 0.9375rem; font-weight: 800; color: #0f172a; }
.bsheet__hint  { margin: 0.125rem 0 0; font-size: 0.6875rem; color: #94a3b8; }
.bsheet__x {
    position: absolute;
    inset-inline-end: 1rem;
    top: 0;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 0.625rem;
    background: #f8fafc;
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.bsheet__body { overflow-y: auto; overscroll-behavior: contain; }

.bsheet__group + .bsheet__group { border-top: 1px solid #f8fafc; }
.bsheet__group-head {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 800;
    color: #334155;
    text-align: start;
}
.bsheet__group-name { flex: 1; }
.bsheet__chev {
    font-size: 0.75rem;
    color: #94a3b8;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.bsheet__group.is-open .bsheet__chev { transform: rotate(180deg); }

/* الارتفاع يُحرَّك بالسكربت: auto لا يُحرَّك، والقياس الثابت يقصّ ما يزيد */
.bsheet__group-body {
    height: 0;
    overflow: hidden;
    opacity: 0;
    transition: height 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}
.bsheet__group.is-open > .bsheet__group-body { height: auto; opacity: 1; }

.bsheet__links { padding-bottom: 0.5rem; }
.bsheet__link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6875rem 1.25rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #475569;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}
.bsheet__link i { font-size: 0.875rem; color: #94a3b8; flex-shrink: 0; }
.bsheet__link:active { background: rgba(15, 23, 42, 0.04); }
.bsheet__link.is-active { color: #0D3B66; background: rgba(13, 59, 102, 0.05); font-weight: 800; }
.bsheet__link.is-active i { color: #1C74B0; }

.bsheet__empty { margin: 0; padding: 2rem 1.25rem; text-align: center; font-size: 0.75rem; color: #94a3b8; }

@media (prefers-reduced-motion: reduce) {
    .bsheet__panel, .bsheet__veil, .bsheet__group-body, .bsheet__chev { transition: none; }
}

/* ما لم يُبنَ بعد: يُقرأ ولا يُضغط — كقرينه في الشريط العلويّ */
.bsheet__link--soon { color: #b4c0ce; cursor: default; }
.bsheet__link--soon i { color: #cbd5e1; }
.bsheet__soon {
    margin-inline-start: auto;
    padding: 0.0625rem 0.375rem;
    border-radius: 0.375rem;
    background: #fef3c7;
    color: #b45309;
    font-size: 0.5625rem;
    font-weight: 800;
    font-style: normal;
}
