/* =====================================================================
   نظام إدارة عملاء CRM — نظام التصميم (فخم: كحلي + ذهبي)
   Readex Pro · RTL · Tailwind-friendly components
   ===================================================================== */

:root {
    /* الهوية اللونية (هادئة ومريحة للعين — بدون أسود وبدون ذهبي):
       لوحة أساس: أزرق بنفسجي هادئ #5b7ae8 · رمادي مزرق #2f3b4d · أخضر مائي #12a191
       خلفية: #f4f6fb   حدود: #e5eaf3   نص: #2f3b4d   ثانوي: #7b879c */
    --ink-900: #1a2130;
    --ink-800: #232b3a;
    --ink-700: #2f3849;
    --ink-600: #3a4457;

    --brand: #5069d8;
    --brand-600: #4054b4;
    --brand-300: #a8bdf7;
    --brand-50: #eef3ff;

    --accent: #12a191;
    --accent-600: #0d8578;
    --accent-300: #74d2c4;

    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #fbfcfe;
    --surface-3: #f1f5fb;
    --border: #e5eaf3;
    --border-soft: #eef2f9;
    --ink: #2f3b4d;
    --muted: #7b879c;

    --radius-lg: 6px;
    --radius: 6px;
    --radius-sm: 6px;

    --shadow-xs: 0 1px 2px rgba(31, 45, 74, .05);
    --shadow-sm: 0 2px 6px -2px rgba(31, 45, 74, .08), 0 1px 2px rgba(31, 45, 74, .04);
    --shadow-md: 0 12px 26px -16px rgba(31, 45, 74, .18), 0 2px 6px -3px rgba(31, 45, 74, .06);
    --shadow-lg: 0 24px 50px -26px rgba(31, 45, 74, .26), 0 8px 18px -12px rgba(31, 45, 74, .1);
    --shadow-brand: 0 12px 26px -16px rgba(80, 105, 216, .42);
    --shadow-accent: 0 12px 26px -16px rgba(18, 161, 145, .42);
}

* { -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Readex Pro', system-ui, -apple-system, sans-serif;
    background:
        radial-gradient(1100px 420px at 100% -10%, rgba(91, 122, 232, .07), transparent 62%),
        radial-gradient(880px 360px at 0% 0%, rgba(18, 161, 145, .06), transparent 58%),
        var(--bg);
    color: var(--ink);
}

[x-cloak] { display: none !important; }
/* مهم: يمنع ظهور المودالات/العناصر المخفية فوق الصفحة (كان يحدث تعارض مع display:flex) */
[hidden] { display: none !important; }

/* ---------- انتقال الصفحة (بدون transform دائم حتى لا يكسر position:fixed) ---------- */
@keyframes pageIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}
.page-enter { animation: pageIn .38s cubic-bezier(.22,.61,.36,1); }

@keyframes floatIn {
    from { opacity: 0; transform: translateY(14px) scale(.985); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.stagger > * { animation: floatIn .45s cubic-bezier(.22,.61,.36,1) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .06s; }
.stagger > *:nth-child(3) { animation-delay: .10s; }
.stagger > *:nth-child(4) { animation-delay: .14s; }
.stagger > *:nth-child(5) { animation-delay: .18s; }
.stagger > *:nth-child(6) { animation-delay: .22s; }

/* ---------- عناوين الصفحات ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.page-title { font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
.page-sub { margin-top: 4px; font-size: .78rem; color: var(--muted); }
.page-head .page-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- البطاقات ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow .25s ease, transform .25s ease, border-color .25s ease;
}
.card-hover:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: #dde3f1; }
.card-head {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
    padding: 16px 18px; border-bottom: 1px solid var(--border-soft);
}
.card-title { font-size: .9rem; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.card-title .tile {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 6px;
    background: linear-gradient(135deg, rgba(91, 122, 232, .12), rgba(18, 161, 145, .12));
    color: var(--brand);
}
.card-body { padding: 18px; }

/* ---------- البانر الرئيسي (Hero) ---------- */
.hero {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    padding: 26px;
    color: #fff;
    background:
        radial-gradient(720px 260px at 88% -30%, rgba(255, 255, 255, .22), transparent 64%),
        radial-gradient(520px 240px at 4% 120%, rgba(18, 161, 145, .35), transparent 66%),
        linear-gradient(135deg, #5b7ae8 0%, #4a5fd0 52%, #0e8d80 100%);
    box-shadow: 0 22px 48px -30px rgba(47, 60, 120, .55);
    border: 1px solid rgba(255, 255, 255, .18);
}
.hero::after {
    content: '';
    position: absolute; inset-inline: 0; bottom: 0; height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .6), transparent);
    opacity: .8;
}
.hero::before {
    content: '';
    position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255,255,255,.10) 1px, transparent 1px);
    background-size: 22px 22px;
    opacity: .4;
    pointer-events: none;
}
.hero h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; }
.hero .hero-sub { margin-top: 6px; font-size: .82rem; color: rgba(255,255,255,.85); }
.hero .hero-chip {
    display: inline-flex; align-items: center; gap: 6px;
    border-radius: 999px; padding: 6px 12px;
    font-size: .72rem; font-weight: 600;
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.22);
    color: #fff;
    backdrop-filter: blur(4px);
}
.hero .hero-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* أزرار داخل البانر: زجاجية بيضاء */
.hero .btn-glass {
    background: rgba(255, 255, 255, .16);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .28);
    backdrop-filter: blur(4px);
}
.hero .btn-glass:hover { background: rgba(255, 255, 255, .26); }

/* ---------- الأزرار (نظام موحّد: أساسي / ثانوي / ناعم / شفاف / خطر) ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    border-radius: 6px; padding: .6rem 1rem;
    font-size: .82rem; font-weight: 600; line-height: 1.2;
    border: 1px solid transparent; cursor: pointer;
    transition: background .18s, box-shadow .18s, color .18s, transform .12s, border-color .18s;
    white-space: nowrap;
}
.btn:active { transform: scale(.975); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-xs { padding: .42rem .6rem; font-size: .72rem; border-radius: 6px; }
.btn-xs svg { width: 14px; height: 14px; }
.btn-sm { padding: .5rem .75rem; font-size: .76rem; border-radius: 6px; }

.btn-primary {
    background: linear-gradient(135deg, #6b87ee 0%, var(--brand) 55%, #4054b4 100%);
    color: #fff; box-shadow: var(--shadow-brand);
}
.btn-primary:hover { filter: brightness(1.04); box-shadow: 0 16px 28px -16px rgba(80, 105, 216, .6); }
.btn-accent {
    background: linear-gradient(135deg, #22b6a4 0%, var(--accent) 60%, var(--accent-600) 100%);
    color: #fff; box-shadow: var(--shadow-accent);
}
.btn-accent:hover { filter: brightness(1.04); box-shadow: 0 16px 28px -16px rgba(18, 161, 145, .55); }
.btn-soft { background: var(--surface-3); border-color: var(--border); color: #485265; }
.btn-soft:hover { background: #e9eefa; border-color: #d8e1f2; color: var(--ink); }
.btn-ghost {
    display: inline-flex; align-items: center; gap: .4rem;
    background: #fff; border: 1px solid var(--border); color: #5c6879;
    border-radius: 6px; padding: .55rem .9rem;
    font-size: .78rem; font-weight: 600; cursor: pointer;
    transition: background .18s, border-color .18s, color .18s, transform .12s;
}
.btn-ghost:hover { background: var(--surface-3); border-color: var(--brand-300); color: var(--brand); }
.btn-ghost:active { transform: scale(.97); }
.btn-outline {
    display: inline-flex; align-items: center; gap: .45rem;
    background: #fff; border: 1px solid var(--border); border-radius: 6px;
    padding: .55rem .95rem; font-size: .78rem; font-weight: 600; color: #485265;
    text-decoration: none; cursor: pointer;
    transition: background .18s, border-color .18s, color .18s, transform .12s;
}
.btn-outline:hover { background: var(--surface-3); border-color: var(--brand-300); color: var(--brand); }
.btn-outline:active { transform: scale(.97); }
.btn-danger { background: #fff; border-color: #f6cfd2; color: #c9433f; }
.btn-danger:hover { background: #fdeeee; border-color: #f0bfc3; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 6px;
    background: #fff; border: 1px solid var(--border); color: var(--muted);
    cursor: pointer; transition: background .16s, color .16s, border-color .16s, transform .12s;
}
.icon-btn:hover { background: var(--surface-3); border-color: var(--brand-300); color: var(--brand); }
.icon-btn:active { transform: scale(.93); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.danger:hover { background: #fdeeee; border-color: #f0bfc3; color: #c9433f; }

/* ---------- حقول الإدخال ---------- */
.input-field {
    border: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 6px;
    padding: .6rem .85rem;
    font-size: .85rem;
    color: var(--ink);
    outline: none;
    transition: border-color .18s, box-shadow .18s, background .18s;
}
.input-field:hover { border-color: #d8e1f2; }
.input-field:focus {
    background: #fff;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(80, 105, 216, .13);
}
.input-field::placeholder { color: var(--muted); }
select.input-field { cursor: pointer; }

/* ---------- تخطيط الكول سنتر ---------- */
/* الفورم انتقل إلى نافذة منبثقة (#modal-new-lead) والجدول يأخذ العرض الكامل */
.cc-form .input-field { padding: .55rem .8rem; font-size: .84rem; }

/* ---------- الأيقونات (Lucide) — سلوك موحّد داخل النصوص والأزرار ---------- */
.ico { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.ico.animate-spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- حقول البحث: أيقونة بمقاس ثابت وموضع صحيح (يمين في RTL) ---------- */
.search-wrap { position: relative; display: block; }
.search-wrap > svg,
.search-wrap > .search-ico {
    position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%);
    width: 16px; height: 16px; flex-shrink: 0; color: var(--muted); pointer-events: none;
}
.search-wrap > input,
.search-wrap > .input-field,
.tbl-toolbar .search-wrap > .input-field { padding-inline-start: 36px; }

/* قائمة اختيار بأيقونة داخلية (مصادر) */
.select-wrap { position: relative; display: inline-flex; align-items: center; }
.select-wrap > select,
.tbl-toolbar .select-wrap > select { padding-inline-start: 36px; }
.select-wrap > .select-ico {
    position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%);
    display: inline-flex; pointer-events: none;
}
.select-wrap > .select-ico.is-empty { display: none; }
.select-wrap > .select-ico svg { width: 16px; height: 16px; }

/* ---------- شريحة المصدر + أيقونات المنصات ---------- */
.src-svg { display: block; }
.src-ico { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.src-chip {
    display: inline-flex; align-items: center; gap: .3rem; max-width: 100%;
    border-radius: 5px; padding: .16rem .45rem .16rem .3rem;
    font-size: .69rem; font-weight: 600; color: var(--ink);
    background: var(--surface-3); border: 1px solid var(--border);
}
.src-chip svg { width: 13px; height: 13px; }
.src-chip > span:last-child { min-width: 0; }

/* ---------- اختيار المصدر كشرائح أيقونية ---------- */
.src-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 8px; }
.src-opt { position: relative; display: block; cursor: pointer; }
.src-opt input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.src-opt > span {
    display: flex; align-items: center; gap: .45rem;
    padding: .5rem .7rem; border-radius: 6px;
    border: 1px solid var(--border); background: var(--surface-2);
    font-size: .78rem; font-weight: 600; color: #485265;
    transition: background .18s, border-color .18s, color .18s, box-shadow .18s;
}
.src-opt > span svg { width: 16px; height: 16px; }
.src-opt:hover > span { background: var(--surface-3); }
.src-opt input:checked + span {
    background: var(--brand-50); border-color: var(--brand-300); color: var(--brand-600);
    box-shadow: 0 0 0 3px rgba(80, 105, 216, .10);
}
.src-opt input:focus-visible + span { outline: 2px solid var(--brand-300); outline-offset: 2px; }

/* ---------- الشارات ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    border-radius: 5px; padding: .18rem .38rem;
    font-size: .67rem; font-weight: 500; white-space: nowrap;
    border: 1px solid transparent;
}
.badge-new       { background: rgba(47, 111, 208, .10); color: #2f6fd0; border-color: rgba(47, 111, 208, .24); }
.badge-opened    { background: rgba(183, 103, 26, .10); color: #b7671a; border-color: rgba(183, 103, 26, .24); }
.badge-contacted { background: rgba(111, 82, 201, .10); color: #6f52c9; border-color: rgba(111, 82, 201, .24); }
.badge-visited   { background: rgba(15, 139, 125, .10); color: #0f8b7d; border-color: rgba(15, 139, 125, .24); }
.badge-purchased { background: rgba(47, 125, 82, .10); color: #2f7d52; border-color: rgba(47, 125, 82, .24); }
.badge-muted     { background: #f2f5fa; color: #64748b; border-color: #e5eaf3; }
.badge-accent    { background: #e8f7f4; color: #0d8578; border-color: #cfeee8; }
.badge-brand     { background: var(--brand-50); color: var(--brand-600); border-color: #dbe5fb; }

/* شريحة المصدر: لون النص حسب المصدر + خلفية شفافة مشتقّة من اللون نفسه (بلا أيقونات) */
.badge-src {
    background: rgba(123, 135, 156, .10);
    border-color: rgba(123, 135, 156, .26);
    font-weight: 500;
}
@supports (background: color-mix(in srgb, red 10%, transparent)) {
    .badge-src {
        background: color-mix(in srgb, var(--src, #7b879c) 10%, transparent);
        border-color: color-mix(in srgb, var(--src, #7b879c) 26%, transparent);
    }
}

/* التنبيه: نقطة نابضة — للحالة «جديد» فقط */
.livedot {
    position: relative; width: 6px; height: 6px; flex-shrink: 0;
    border-radius: 999px; background: currentColor;
    color: rgb(247 106 106) !important;

}
.badge-live .livedot::after {
    content: ''; position: absolute; inset: -4px; border-radius: 999px;
    background: currentColor; opacity: .28; animation: dotRipple 1.0s ease-out infinite;
}
@keyframes dotRipple {
    0%   { transform: scale(.45); opacity: .5; }
    70%  { transform: scale(1.2); opacity: 0; }
    100% { transform: scale(1.2); opacity: 0; }
}

/* ---------- الأفاتار ---------- */
.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; flex-shrink: 0;
    border-radius: 6px; font-size: .8rem; font-weight: 700;
    background: linear-gradient(135deg, #eef3ff, #e6f6f3);
    color: #4054b4; border: 1px solid #dbe5fb;
}
.avatar-sm { width: 32px; height: 32px; border-radius: 6px; font-size: .72rem; }
.avatar-accent { background: linear-gradient(135deg, #22b6a4, #0d8578); color: #fff; border-color: transparent; }
.avatar-brand  { background: linear-gradient(135deg, #6b87ee, #4054b4); color: #fff; border-color: transparent; }

/* ---------- التبويبات ---------- */
.tabs {
    display: flex; gap: 4px; overflow-x: auto;
    padding: 5px; border-radius: var(--radius);
    background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-xs);
}
.tab {
    flex: 1; white-space: nowrap; border: none; cursor: pointer;
    border-radius: 6px; padding: .6rem 1rem;
    font-size: .8rem; font-weight: 600; color: #5c6879;
    background: transparent; transition: background .18s, color .18s, box-shadow .18s;
}
.tab:hover { background: var(--surface-3); color: var(--ink); }
.tab.active {
    background: var(--brand-50); color: var(--brand-600);
    box-shadow: inset 0 0 0 1px #dbe5fb;
}

/* ---------- الترقيم ---------- */
.pagination { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.pagination button {
    min-width: 34px; height: 34px; padding: 0 9px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 6px; border: 1px solid var(--border);
    background: #fff; font-size: .78rem; font-weight: 600; color: #5c6879;
    cursor: pointer; transition: background .16s, color .16s, border-color .16s, transform .12s;
}
.pagination button:hover:not(:disabled) { background: var(--surface-3); border-color: var(--brand-300); color: var(--brand); }
.pagination button:active:not(:disabled) { transform: scale(.95); }
.pagination button.active {
    background: linear-gradient(135deg, #6b87ee, var(--brand));
    border-color: var(--brand); color: #fff;
    box-shadow: 0 8px 16px -10px rgba(80, 105, 216, .6);
}
.pagination button:disabled { opacity: .42; cursor: not-allowed; }
.pagination .dots { color: #a9b4c9; font-size: .78rem; padding: 0 2px; }
.pagination svg { width: 15px; height: 15px; }

/* =====================================================================
   الجداول — تصميم منظّم (رأس ثابت + أعمدة واضحة + شريط أدوات وتذييل)
   موبايل: تتحول الصفوف إلى بطاقات
   ===================================================================== */
.table-wrap { overflow-x: auto; }

.data-table { width: 100%; border-collapse: separate; border-spacing: 0; }

/* رأس الجدول: خلفية ناعمة + عنوان صغير واضح + فاصل قوي */
.data-table thead th {
    position: sticky; top: 0; z-index: 5;
    background: #f7f9fd;
    color: var(--muted);
    font-size: .65rem; font-weight: 700;
    letter-spacing: .01em;
    padding: .46rem .5rem;
    text-align: start;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
.data-table thead th + th { border-inline-start: 1px solid rgba(229, 234, 243, .7); }
.data-table thead th.col-actions { text-align: center; }
.data-table thead th:first-child { border-start-start-radius: 0; }

.data-table tbody td {
    padding: .44rem .5rem;
    border-bottom: 1px solid var(--border-soft);
    color: #3a4457;
    font-size: .78rem;
    vertical-align: middle;
}
.data-table tbody tr { transition: background .16s ease, box-shadow .16s ease; }
.data-table tbody tr:hover { background: #f7f9fe; }
.data-table tbody tr:hover td { border-bottom-color: #e7edf8; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* عمود الإجراءات */
.data-table td.col-actions { white-space: nowrap; }
.data-table tbody td.col-actions { padding-inline: .3rem; }

.cell-lead { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.cell-lead .lead-name { display: block; font-weight: 600; color: var(--ink); }
.cell-lead .lead-phone { display: block; font-size: .68rem; color: var(--muted); }
/* عمود التسلسل # */
.cell-idx {
    width: 42px; text-align: center;
    font-size: .7rem; font-weight: 700; color: #9aa6bb;
    font-variant-numeric: tabular-nums;
}
/* رقم الهاتف — عمود منفصل بلوحة أنيقة موحّدة */
.cell-phone { white-space: nowrap; }
.cell-phone .phone-box {
    display: inline-flex; align-items: center; gap: 5px;
    padding: .12rem .45rem; border-radius: 6px;
    background: var(--surface-3); border: 1px solid var(--border);
    font-size: .72rem; font-weight: 700; color: #48536a;
    letter-spacing: .02em; font-variant-numeric: tabular-nums;
}
.cell-phone .phone-box svg { width: 12px; height: 12px; color: var(--brand); opacity: .8; }
.cell-stack { display: flex; flex-direction: column; gap: 4px; }
.cell-muted { color: var(--muted); font-size: .73rem; }
.cell-num {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 23px; height: 22px; padding: 0 6px;
    border-radius: 6px; background: var(--surface-3); border: 1px solid var(--border);
    font-size: .7rem; font-weight: 700; color: #5c6879;
}
.cell-num.is-hot { background: var(--brand-50); border-color: #dbe5fb; color: var(--brand-600); }

/* شريط الأدوات أعلى الجدول */
.tbl-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    padding: 13px 16px; border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #fbfcfe, #f8fafd);
    border-start-start-radius: var(--radius-lg); border-start-end-radius: var(--radius-lg);
}
.tbl-toolbar .spacer { flex: 1; }
.tbl-toolbar .input-field { padding: .42rem .7rem; font-size: .78rem; }
.tbl-toolbar .select-wrap > select { padding-inline-start: 32px; }

/* تذييل الجدول: النطاق + حجم الصفحة + الترقيم */
.tbl-foot {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
    padding: 11px 16px; border-top: 1px solid var(--border);
    border-end-start-radius: var(--radius-lg); border-end-end-radius: var(--radius-lg);
    background: linear-gradient(0deg, #fbfcfe, #f8fafd);
}
.tbl-foot .tbl-range { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; color: var(--muted); }
.tbl-foot .page-size {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: .74rem; color: var(--muted);
}
.tbl-foot .page-size select {
    border: 1px solid var(--border); background: #fff; border-radius: 6px;
    padding: .28rem .5rem; font-size: .74rem; font-weight: 600; color: #485265; cursor: pointer;
}
.tbl-foot .page-size select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(80, 105, 216, .12); }
.count-chip {
    display: inline-flex; align-items: center; gap: 6px;
    border-radius: 999px; padding: .28rem .7rem;
    background: var(--surface-3); border: 1px solid var(--border);
    font-size: .72rem; font-weight: 600; color: #5c6879;
}
.count-chip strong { color: var(--ink); }

.empty-state { padding: 46px 18px; text-align: center; }
.empty-state .empty-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 56px; height: 56px; border-radius: 6px;
    background: linear-gradient(135deg, #f1f5fc, #e9f1fb);
    color: #a9b4c9; margin-bottom: 12px;
}
.empty-state p { font-size: .82rem; color: var(--muted); }

.skeleton-row td { padding: .85rem 1rem; }

td[dir="ltr"], th[dir="ltr"] { text-align: left; }

/* صناديق المخططات (ECharts) */
.chart-box { position: relative; }
.chart-el { width: 100%; height: 246px; }
.chart-el-sm { height: 214px; }
.chart-el-lg { height: 268px; }

/* ---------- أزرار الإجراءات داخل الجداول (مجموعة منظمة + حالة منجزة برمادي) ---------- */
.action-btn {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center; gap: .25rem;
    height: 26px; min-width: 26px; padding: 0 4px;
    border-radius: 6px; border: 1px solid; background: #fff;
    font-size: .68rem; font-weight: 700; line-height: 1; cursor: pointer;
    transition: transform .12s, background .16s, box-shadow .16s, border-color .16s, color .16s;
}
.action-btn svg { width: 13px; height: 13px; }
.action-btn .lbl { white-space: nowrap; }
.action-btn:active { transform: scale(.94); }
.action-btn:disabled { opacity: .5; cursor: not-allowed; }
/* الخطوة المنجزة: رمادية + غير قابلة للضغط */
.action-btn.done,
.action-btn.is-locked {
    border-color: #dfe4ee; color: #96a0b3; background: #f4f6fa;
}
.action-btn.done:hover,
.action-btn.is-locked:hover { background: #eef1f7; }
.action-btn.is-locked { cursor: not-allowed; }
/* أثناء تنفيذ الطلب */
.action-btn.is-busy { opacity: .8; cursor: progress; }
.action-btn.is-busy:hover { background: #f4f6fa; }
.action-opened    { border-color: #f7ddc6; color: #b7671a; background: #fdf6ef; }
.action-opened:hover { background: #fbead9; }
.action-call      { border-color: #e2d9f9; color: #6f52c9; background: #f6f4fd; }
.action-call:hover { background: #ece7fa; }
.action-visited   { border-color: #cfeee8; color: #0f8b7d; background: #f1faf8; }
.action-visited:hover { background: #e4f5f1; }
.action-purchased { border-color: #d1ebdc; color: #2f7d52; background: #f2faf5; }
.action-purchased:hover { background: #e4f4ea; }
.action-details   { border-color: var(--border); color: #485265; background: #fff; }
.action-details:hover { background: var(--surface-3); border-color: var(--brand-300); color: var(--brand); }
.actions-group {
    display: inline-flex; align-items: center; gap: 2px;
    padding: 1px; border-radius: 6px;
    background: #fafbfe; border: 1px solid var(--border-soft);
}
.actions-sep { width: 1px; height: 16px; background: var(--border); margin-inline: 0; flex-shrink: 0; }
/* مجموعة إجراءات مكتملة المسار (تم البيع) */
.actions-group.is-complete { background: #f6fbf8; border-color: #d1ebdc; }
.actions-done-chip {
    display: inline-flex; align-items: center; gap: .25rem;
    height: 26px; padding: 0 7px; border-radius: 6px;
    background: #eaf6ee; border: 1px solid #d1ebdc; color: #2f7d52;
    font-size: .68rem; font-weight: 700; white-space: nowrap;
}
.actions-done-chip > span { font-size: .7rem; }

/* ---------- ختم «تم البيع»: تصميم كلاسيكي أنيق ---------- */
.sold-stamp {
    position: relative; overflow: hidden;
    display: flex; align-items: center; justify-content: center; gap: .4rem;
    width: 100%; min-width: 118px; height: 24px; padding: 0 .5rem;
    border-radius: 6px; color: #215c3b;
    background: linear-gradient(180deg, #fbfefc, #eff8f2);
    border: 1px solid #cfe6d8;
    box-shadow: inset 0 0 0 1px #fff, 0 1px 2px rgba(33, 92, 59, .08);
}
/* إطار داخلي دقيق يعطي إحساس الختم الكلاسيكي */
.sold-stamp::before {
    content: ''; position: absolute; inset: 3px; border-radius: 4px;
    border: 1px solid rgba(33, 92, 59, .18); pointer-events: none;
}
.sold-stamp .ss-check {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; flex-shrink: 0; border-radius: 999px;
    background: #215c3b; color: #fff; font-size: 9px; font-weight: 700; line-height: 1;
    box-shadow: 0 0 0 2px #fff;
}
.sold-stamp .ss-text {
    font-size: .72rem; font-weight: 700; white-space: nowrap;
    letter-spacing: .08em; text-transform: none;
}
.sold-stamp .ss-unit {
    padding-inline-start: .5rem; border-inline-start: 1px dashed rgba(33, 92, 59, .3);
    padding-block: 1px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .68rem; font-weight: 700; color: #215c3b;
    letter-spacing: .04em; white-space: nowrap;
}
/* لمعة كلاسيكية هادئة تمرّ على الختم */
.sold-stamp .ss-sheen {
    position: absolute; inset-block: 0; inset-inline-start: -45%; width: 34%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .75), transparent);
    transform: skewX(-16deg); animation: soldSheen 4.6s ease-in-out infinite;
}
@keyframes soldSheen {
    0%, 68% { inset-inline-start: -45%; }
    92%, 100% { inset-inline-start: 112%; }
}
/* نسخة كبيرة داخل مودال التفاصيل */
.sold-stamp.is-lg { height: 42px; padding: 0 1rem; gap: .55rem; }
.sold-stamp.is-lg .ss-text { font-size: .92rem; }
.sold-stamp.is-lg .ss-check { width: 22px; height: 22px; font-size: 11px; }
.sold-stamp.is-lg .ss-unit { font-size: .82rem; }
/* الصف المكتمل: تظليل أخضر هادئ + مؤشّر جانبي */
.data-table tbody tr.row-sold { background: linear-gradient(90deg, rgba(47, 125, 82, .05), rgba(47, 125, 82, .015)); }
.data-table tbody tr.row-sold:hover { background: linear-gradient(90deg, rgba(47, 125, 82, .08), rgba(47, 125, 82, .03)); }
.data-table tbody tr.row-sold > td:first-child { box-shadow: inset -3px 0 0 0 #3f9a68; }
.data-table td.cell-sold { padding-inline: .7rem; }

/* تذييل شريط الأدوات (عدّاد النتائج + زر إجراء) */
.tbl-tail { display: inline-flex; align-items: center; gap: 8px; }

/* =====================================================================
   الشريط الجانطي (على اليمين في RTL) — تصميم فاتح حديث بدون أسود
   ===================================================================== */
.sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 50;
    display: flex; flex-direction: column;
    width: 284px;
    color: #485265;
    background:
        radial-gradient(440px 240px at 0% 0%, rgba(91, 122, 232, .06), transparent 62%),
        linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
    border-inline-end: 1px solid var(--border);
    box-shadow: -12px 0 34px -30px rgba(31, 45, 74, .35);
    transition: width .28s cubic-bezier(.22,.61,.36,1), transform .3s cubic-bezier(.22,.61,.36,1);
}
.sidebar-glow {
    position: absolute; inset-inline: 0; top: 0; height: 2px;
    background: linear-gradient(90deg, transparent, rgba(91, 122, 232, .55), rgba(18, 161, 145, .45), transparent);
}

.side-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 18px 16px;
    border-bottom: 1px solid var(--border-soft);
}
.brand-mark {
    display: flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; flex-shrink: 0;
    border-radius: 6px;
    /*
    padding: 3px;
    background: #fff;
    border: 1px solid var(--border-soft);
    box-shadow: 0 10px 22px -14px rgba(80, 105, 216, .55);
    */
}
/* شعار النظام — يُحجَّم ليملأ الإطار مع الحفاظ على النسبة */
.brand-mark .app-logo,
.brand-mark > svg,
.brand-mark > img { width: 100%; /*height: 100%;*/ display: block; object-fit: contain; }
.app-logo { display: block; max-width: 100%; }
.brand-text { min-width: 0; }
.brand-name { font-size: .86rem; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-role { font-size: .68rem; color: var(--muted); }

.side-nav { flex: 1; overflow-y: auto; padding: 14px 12px 8px; }
.side-section {
    padding: 10px 12px 6px;
    font-size: .64rem; font-weight: 700; letter-spacing: .08em;
    color: #9aa5b8;
}
.side-link {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; margin-bottom: 3px;
    border-radius: 6px;
    font-size: .84rem; font-weight: 600;
    color: #5c6879;
    text-decoration: none;
    transition: background .2s ease, color .2s ease, transform .18s ease;
}
.side-link .side-ico {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; flex-shrink: 0;
    border-radius: 6px;
    background: #f5f8fd;
    border: 1px solid #e9eef7;
    color: #7b879c;
    transition: background .2s, color .2s, border-color .2s;
}
.side-link .side-ico svg { width: 18px; height: 18px; }
.side-link:hover { background: var(--surface-3); color: var(--ink); transform: translateX(-2px); }
.side-link:hover .side-ico { background: #e8effd; border-color: #dbe5fb; color: var(--brand); }
.side-link.is-active {
    background: var(--brand-50);
    color: var(--brand-600);
    box-shadow: inset 0 0 0 1px #dbe5fb;
}
.side-link.is-active::before {
    content: ''; position: absolute; inset-inline-end: -12px; top: 50%; transform: translateY(-50%);
    width: 3px; height: 22px; border-radius: 99px;
    background: linear-gradient(180deg, #6b87ee, var(--brand));
}
.side-link.is-active .side-ico { background: #dfe9ff; border-color: #c9d9fb; color: var(--brand-600); }
.side-badge {
    margin-inline-start: auto;
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 999px; background: var(--brand-50);
    border: 1px solid #dbe5fb;
    font-size: .62rem; font-weight: 700; color: var(--brand-600);
}

.side-foot { padding: 12px; border-top: 1px solid var(--border-soft); }
.side-user {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; border-radius: 6px;
    background: var(--surface-3);
    border: 1px solid var(--border-soft);
}
.side-user .u-name { font-size: .78rem; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .u-role { font-size: .66rem; color: var(--muted); }
.side-logout {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; flex-shrink: 0;
    border-radius: 6px; border: 1px solid #f6dcdd;
    background: #fdf3f3; color: #cf4b46;
    cursor: pointer; transition: background .18s, color .18s, border-color .18s;
}
.side-logout:hover { background: #fbe6e6; border-color: #f0c9cb; color: #b23a36; }

/* الوضع المطوي (شاشات كبيرة) */
.sidebar.is-collapsed { width: 88px; }
.sidebar.is-collapsed .brand-text,
.sidebar.is-collapsed .side-section,
.sidebar.is-collapsed .side-link > span.link-label,
.sidebar.is-collapsed .side-badge,
.sidebar.is-collapsed .side-user .u-meta { display: none; }
.sidebar.is-collapsed .side-brand { justify-content: center; padding: 18px 0 16px; }
.sidebar.is-collapsed .side-link { justify-content: center; padding: 8px; }
.sidebar.is-collapsed .side-link:hover { transform: none; }
.sidebar.is-collapsed .side-user { justify-content: center; padding: 8px; }

/* =====================================================================
   الشريط العلوي (Header)
   ===================================================================== */
.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 10px;
    min-height: 68px; padding: 10px 14px;
    background: rgba(255, 255, 255, .84);
    backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--border);
}
.topbar-title { min-width: 0; }
.topbar-title .t-main { font-size: .95rem; font-weight: 700; color: var(--ink); line-height: 1.2; }
.topbar-title .t-sub { font-size: .68rem; color: var(--muted); }
.topbar-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 6px;
    border: 1px solid var(--border); background: #fff; color: #5c6879;
    cursor: pointer; transition: background .18s, color .18s, border-color .18s, transform .12s;
    position: relative;
}
.topbar-btn:hover { background: var(--surface-3); color: var(--brand); border-color: var(--brand-300); }
.topbar-btn:active { transform: scale(.95); }
.topbar-btn svg { width: 19px; height: 19px; }
.topbar-search {
    display: flex; align-items: center; gap: 8px;
    height: 40px; padding-inline: 12px;
    border-radius: 6px; background: var(--surface-3); border: 1px solid var(--border);
    transition: box-shadow .18s, background .18s, border-color .18s;
}
.topbar-search:focus-within { background: #fff; box-shadow: 0 0 0 4px rgba(80, 105, 216, .12); border-color: var(--brand); }
.topbar-search svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--muted); }
.topbar-search input {
    border: none; background: transparent; outline: none;
    font-size: .82rem; color: var(--ink); width: 100%;
}
.topbar-search input::placeholder { color: var(--muted); }
.bell-badge {
    position: absolute; top: -3px; inset-inline-start: -3px;
    min-width: 19px; height: 19px; padding: 0 5px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 999px;
    background: linear-gradient(135deg, #e8705c, #cf4433);
    color: #fff; font-size: .62rem; font-weight: 700;
    box-shadow: 0 0 0 3px #fff;
}
.user-chip {
    display: flex; align-items: center; gap: 9px;
    padding: 5px 10px 5px 6px;
    border-radius: 6px; border: 1px solid var(--border); background: #fff;
    cursor: pointer; transition: background .18s, border-color .18s;
}
.user-chip:hover { background: var(--surface-3); border-color: var(--brand-300); }
.user-chip .u-name { font-size: .76rem; font-weight: 700; color: var(--ink); line-height: 1.2; }
.user-chip .u-role { font-size: .64rem; color: var(--muted); }
.dropdown {
    position: absolute; z-index: 60; min-width: 240px;
    background: #fff; border: 1px solid var(--border);
    border-radius: 6px; box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.dropdown-head { padding: 12px 14px; border-bottom: 1px solid var(--border-soft); background: var(--surface-2); }
.dropdown-head .d-name { font-size: .82rem; font-weight: 700; color: var(--ink); }
.dropdown-head .d-mail { font-size: .7rem; color: var(--muted); }
.dropdown-item {
    display: flex; align-items: center; gap: 9px;
    width: 100%; padding: 11px 14px; border: none; background: #fff;
    font-size: .8rem; font-weight: 600; color: #485265; cursor: pointer;
    text-decoration: none; transition: background .16s, color .16s;
    text-align: start;
}
.dropdown-item:hover { background: var(--surface-3); color: var(--brand); }
.dropdown-item.danger { color: #cf4b46; }
.dropdown-item.danger:hover { background: #fdf3f3; color: #b23a36; }

.notif-list { max-height: 340px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border-soft); transition: background .16s; }
.notif-item:hover { background: var(--surface-3); }
.notif-item.is-unread { cursor: pointer; background: linear-gradient(90deg, rgba(80, 105, 216, .045), rgba(80, 105, 216, .012)); }
.notif-item.is-unread:hover { background: linear-gradient(90deg, rgba(80, 105, 216, .085), rgba(80, 105, 216, .03)); }
.notif-item.is-unread > .notif-dot { box-shadow: 0 0 0 3px rgba(232, 112, 92, .14); }
.notif-item .n-tag {
    display: inline-flex; align-items: center;
    padding: 1px 6px; border-radius: 999px;
    background: #fdf3e9; color: #b7671a; border: 1px solid #f7ddc6;
    font-size: .58rem; font-weight: 700; font-style: normal;
}
.notif-item .n-title { font-size: .78rem; font-weight: 700; color: var(--ink); }
.notif-item .n-body { font-size: .7rem; color: var(--muted); }
.notif-item .n-time { font-size: .64rem; color: #a9b4c9; }
.notif-dot { width: 8px; height: 8px; border-radius: 999px; background: #e8705c; margin-top: 6px; flex-shrink: 0; }
.notif-dot.read { background: transparent; }

/* =====================================================================
   مؤشرات لوحة التحكم
   ===================================================================== */
.kpi {
    position: relative; overflow: hidden;
    padding: 16px; border-radius: var(--radius-lg);
    background: var(--surface); border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s;
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #dbe5fb; }
.kpi::before {
    content: ''; position: absolute; inset-inline: 0; top: 0; height: 3px;
    background: linear-gradient(90deg, var(--kpi-color, #5069d8), transparent 88%);
    opacity: .9;
}
.kpi .kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi .kpi-label { font-size: .72rem; font-weight: 600; color: var(--muted); }
.kpi .kpi-ico {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 6px;
    background: var(--kpi-soft, var(--surface-3)); color: var(--kpi-color, #5069d8);
}
.kpi .kpi-ico svg { width: 17px; height: 17px; }
.kpi .kpi-value { margin-top: 10px; font-size: 1.7rem; font-weight: 700; color: var(--ink); letter-spacing: -.02em; line-height: 1.1; }
.kpi .kpi-sub { margin-top: 4px; font-size: .68rem; color: var(--muted); }
.kpi .kpi-bar { margin-top: 10px; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.kpi .kpi-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--kpi-color, #5069d8); opacity: .85; }

.legend-list { display: flex; flex-direction: column; gap: 8px; }
.legend-row { display: flex; align-items: center; gap: 10px; font-size: .76rem; }
.legend-row .lg-name { width: 118px; flex-shrink: 0; display: flex; align-items: center; gap: 6px; color: #5c6879; }
.legend-row .lg-name .src-ico svg { width: 15px; height: 15px; }
.legend-row .lg-name > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-row .lg-track { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.legend-row .lg-fill { display: block; height: 100%; border-radius: 999px; }
.legend-row .lg-val { width: 84px; text-align: end; font-weight: 700; color: #485265; }

/* =====================================================================
   شريط التقدم (Stepper)
   ===================================================================== */
.stepper { display: flex; align-items: center; gap: 3px; direction: ltr; }
.stepper .step {
    display: inline-flex; align-items: center; justify-content: center;
    width: 19px; height: 19px; border-radius: 999px;
    border: 2px solid #dfe6f2; background: #fff; color: transparent;
    font-size: 9px; font-weight: 700; flex-shrink: 0;
    transition: background .2s, border-color .2s, box-shadow .2s;
}
.stepper .step.done { color: #fff; }
.stepper .step.current { box-shadow: 0 0 0 3px rgba(80, 105, 216, .16); }
.stepper .line { height: 2px; width: 10px; background: #e6ecf6; border-radius: 6px; flex-shrink: 0; transition: background .2s; }
.stepper-lg { gap: 7px; }
.stepper-lg .step { width: 32px; height: 32px; font-size: 12px; }
.stepper-lg .line { width: 38px; }

/* شريط المسار بتسميات + تواريخ المراحل (داخل مودال التفاصيل) */
.stepper.has-lbl { gap: 8px; align-items: flex-start; padding: 2px 0 0; }
.stepper.has-lbl .step-col {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    min-width: 66px; text-align: center;
}
.stepper.has-lbl .step-lbl { font-size: .66rem; font-weight: 700; color: #5c6879; white-space: nowrap; }
.stepper.has-lbl .step-col.is-now .step-lbl { color: var(--brand-600); }
.stepper.has-lbl .step-col.is-done .step-lbl { color: #3a8060; }
.stepper.has-lbl .step-date {
    font-size: .58rem; color: #a9b4c9; white-space: nowrap;
    font-variant-numeric: tabular-nums; letter-spacing: .02em;
}
.stepper.has-lbl .line { align-self: flex-start; margin-top: 15px; }
.det-progress { gap: 9px; }
.stepper-labels { display: flex; justify-content: space-between; direction: ltr; margin-top: 7px; font-size: 10px; color: var(--muted); }
.stepper-labels span { width: 60px; text-align: center; }

/* =====================================================================
   Skeleton / Modal / Toast
   ===================================================================== */
.skeleton { position: relative; overflow: hidden; background: #eef2f9; }
.skeleton::after {
    content: ''; position: absolute; inset: 0; transform: translateX(100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .9), transparent);
    animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 100% { transform: translateX(-100%); } }

.modal-backdrop {
    position: fixed; inset: 0; z-index: 70;
    display: flex; align-items: flex-end; justify-content: center;
    background: rgba(21, 30, 52, .55);
    backdrop-filter: blur(5px);
    padding: 12px; opacity: 0;
    transition: opacity .22s ease;
}
.modal-backdrop.show { opacity: 1; }
@media (min-width: 640px) { .modal-backdrop { align-items: center; } }
.modal-panel {
    background: #fff; border-radius: 6px; padding: 22px;
    box-shadow: 0 30px 70px -28px rgba(21, 30, 52, .45);
    transform: translateY(26px) scale(.97); opacity: 0;
    transition: transform .28s cubic-bezier(.22,.61,.36,1), opacity .22s ease;
    max-height: calc(100vh - 24px); overflow-y: auto;
    border: 1px solid var(--border);
    width: 100%;
}
.modal-backdrop.show .modal-panel { transform: translateY(0) scale(1); opacity: 1; }
.modal-title { font-size: 1rem; font-weight: 700; color: var(--ink); }
/* مودال عريض (التفاصيل) — مساحة أكبر ومسافات أقل */
.modal-wide { max-width: 66rem; padding: 18px 20px; }
@media (max-width: 1024px) { .modal-wide { padding: 14px; } }

@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.96); } }
.toast { animation: toastIn .3s cubic-bezier(.22,.61,.36,1) both; box-shadow: 0 18px 40px -18px rgba(9, 14, 26, .55); border-radius: 6px; }
.toast-out { animation: toastOut .3s ease-in both; }

/* =====================================================================
   هيكل الصفحة + الجداول على الموبايل
   ===================================================================== */
/* الهيكل: عمود يملأ الشاشة — ليبقى الفوتر دائماً في الأسفل */
.content-shell { min-height: 100vh; display: flex; flex-direction: column; }
.content-shell > main { flex: 1 0 auto; }
.content-shell > footer { margin-top: auto; flex-shrink: 0; }

@media (min-width: 1024px) {
    .content-shell { padding-inline-start: 284px; transition: padding-inline-start .28s cubic-bezier(.22,.61,.36,1); }
    body.side-collapsed .content-shell { padding-inline-start: 88px; }
}

@media (max-width: 767px) {
    .data-table { display: block; width: 100%; }
    .data-table thead { display: none; }
    .data-table tbody { display: block; }

    .data-table tbody tr {
        position: relative;
        display: block;
        border: 1px solid var(--border);
        border-radius: 6px;
        margin: 0 0 12px;
        padding: 6px 14px;
        background: #fff;
        box-shadow: var(--shadow-xs);
    }
    .data-table tbody tr:hover { background: #fff; }

    .data-table tbody td {
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        padding: .55rem 0;
        border-bottom: 1px dashed #eef2f9;
        text-align: start;
    }
    .data-table tbody td:last-child { border-bottom: none; }
    .data-table tbody td::before {
        content: attr(data-label);
        flex-shrink: 0;
        font-size: .68rem; font-weight: 700; color: var(--muted);
    }
    .data-table tbody td.no-label::before,
    .data-table tbody td[colspan]::before { content: none; }

    /* أول خلية = عنوان البطاقة */
    .data-table tbody tr > td:first-child {
        border-bottom: 1px solid #eef2f9;
        padding-top: .2rem; padding-bottom: .55rem;
    }
    .data-table tbody tr > td:first-child .cell-lead { width: 100%; }

    td[dir="ltr"] { justify-content: space-between; }
    .cell-num { font-size: .72rem; }
    .stepper { justify-content: flex-end; }
    .stepper .line { width: 11px; }
    .actions-group { flex-wrap: wrap; justify-content: flex-end; }
    /* ختم «تم البيع» يتمدد في بطاقة الجوال */
    .data-table td.cell-sold { padding-inline: 0; }
    .cell-sold .sold-stamp { width: auto; flex: 1; min-width: 0; }
    .data-table tbody tr.row-sold > td:first-child { box-shadow: none; }
    .data-table tbody tr.row-sold { border-color: #cfe7da; }
    /* عمود # مخفي في بطاقة الموبايل — وخلية الاسم تبقى عنوان البطاقة */
    .data-table tbody td.cell-idx { display: none; }
    .data-table tbody tr > td:nth-child(2) {
        border-bottom: 1px solid #eef2f9;
        padding-top: .2rem; padding-bottom: .55rem;
    }
    .data-table tbody tr > td:nth-child(2) .cell-lead { width: 100%; }
    .det-grid { grid-template-columns: 1fr; }
}

@media (min-width: 768px) {
    .data-table tbody td::before { content: none; }
}

/* ---------- تحسينات عامة ---------- */
::selection { background: rgba(91, 122, 232, .22); }

*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: #ccd6e8; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #aab7cd; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

.sidebar::-webkit-scrollbar-thumb,
.side-nav::-webkit-scrollbar-thumb { background: rgba(31, 45, 74, .14); background-clip: content-box; }

input[type="date"] { min-width: 132px; }
.img-quiet { opacity: .5; }
.divider-accent,
.divider-gold { height: 1px; background: linear-gradient(90deg, transparent, rgba(91, 122, 232, .45), rgba(18, 161, 145, .35), transparent); }

@media print {
    .sidebar, .topbar, #toast-root, .no-print { display: none !important; }
    body { background: #fff; }
    .content-shell { padding: 0 !important; }
}

/* =====================================================================
   صفحات العمليات (الكول سنتر · المبيعات)
   رأس قسم قياسي + شرائح تصفية بالحالة + نطاق تاريخ مدمج + مقاطع الفورم
   ===================================================================== */

/* ---------- رأس قسم داخل الصفحة ---------- */
.sec-head {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 10px; margin-bottom: 12px;
}
.sec-head .sec-title { display: flex; align-items: center; gap: 9px; font-size: .9rem; font-weight: 700; color: var(--ink); }
.sec-head .sec-title .tile {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 6px; color: var(--brand);
    background: linear-gradient(135deg, rgba(91, 122, 232, .12), rgba(18, 161, 145, .12));
}
.sec-head .sec-title .tile svg { width: 16px; height: 16px; }
.sec-head .sec-sub { font-size: .7rem; color: var(--muted); }

/* ---------- شرائح التصفية حسب الحالة (أعلى بطاقة الجدول) ---------- */
.tbl-chips {
    display: flex; align-items: center; gap: 7px;
    padding: 10px 14px; overflow-x: auto; scrollbar-width: none;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #fdfdfe, #f9fbfe);
}
.tbl-chips::-webkit-scrollbar { display: none; }
.tbl-chips .chips-label {
    display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0;
    margin-inline-end: 2px; font-size: .68rem; font-weight: 700; color: var(--muted);
}
.tbl-chips .chips-label svg { width: 14px; height: 14px; }

.fchip {
    --fc: var(--brand);
    display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
    padding: .34rem .68rem; border-radius: 999px;
    border: 1px solid var(--border); background: #fff;
    font-family: inherit; font-size: .72rem; font-weight: 600; line-height: 1.1;
    color: #485265; cursor: pointer; white-space: nowrap;
    transition: background .16s, border-color .16s, color .16s, box-shadow .16s, transform .12s;
}
.fchip:active { transform: scale(.96); }
.fchip:hover { border-color: var(--fc); color: var(--fc); }
.fchip:focus-visible { outline: 2px solid var(--brand-300); outline-offset: 2px; }
.fchip .dot { width: 7px; height: 7px; border-radius: 999px; background: var(--fc); flex-shrink: 0; }
.fchip .cnt {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 21px; height: 17px; padding: 0 5px; border-radius: 999px;
    background: var(--surface-3); border: 1px solid var(--border-soft);
    font-size: .63rem; font-weight: 700; color: #5c6879;
    transition: background .16s, color .16s, border-color .16s;
}
.fchip.active {
    background: var(--fc); border-color: var(--fc); color: #fff;
    box-shadow: 0 8px 16px -9px var(--fc);
}
.fchip.active .dot { background: rgba(255, 255, 255, .9); }
.fchip.active .cnt { background: rgba(255, 255, 255, .2); border-color: rgba(255, 255, 255, .3); color: #fff; }

/* ---------- نطاق التاريخ ككبسولة مدمجة ---------- */
.date-range {
    display: inline-flex; align-items: center;
    border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2);
    transition: border-color .18s, box-shadow .18s, background .18s;
}
.date-range:focus-within { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(80, 105, 216, .13); }
.date-range input[type="date"] {
    border: none; background: transparent; outline: none;
    min-width: 122px; padding: .46rem .55rem;
    font-family: inherit; font-size: .76rem; color: var(--ink);
}
.date-range .dr-sep { display: inline-flex; flex-shrink: 0; color: #b6c0d4; }
.date-range .dr-sep svg { width: 12px; height: 12px; }

/* ---------- مقاطع الفورم (عنوان مصغّر + خط فاصل) ---------- */
.form-sec { display: flex; align-items: center; gap: 8px; }
.form-sec .fs-title {
    display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
    font-size: .67rem; font-weight: 700; letter-spacing: .05em; color: var(--muted);
}
.form-sec .fs-title svg { width: 13px; height: 13px; color: var(--brand); }
.form-sec::after { content: ''; flex: 1; height: 1px; background: var(--border-soft); }

/* ---------- تسميات الحقول القياسية ---------- */
.flabel { display: block; margin-bottom: 6px; font-size: .74rem; font-weight: 600; color: #485265; }
.flabel .req { color: #e05a55; font-weight: 700; }

/* ---------- ضبط مقاسات حقول فورم الكول سنتر (داخل النافذة المنبثقة) ---------- */
.cc-form .input-field { padding: .55rem .8rem; font-size: .84rem; }

/* ---------- تلميحات مخصّصة (data-hint) — عنصر واحد عائم لكل الصفحة ---------- */
.hint-pop {
    position: fixed; z-index: 95; max-width: 260px;
    padding: .42rem .6rem; border-radius: 6px;
    background: #1c2740; color: #fff;
    font-size: .7rem; font-weight: 600; line-height: 1.45; text-align: center;
    box-shadow: 0 14px 30px -14px rgba(15, 23, 42, .6);
    opacity: 0; transform: translateY(4px); pointer-events: none;
    transition: opacity .14s ease, transform .14s ease;
}
.hint-pop.show { opacity: 1; transform: translateY(0); }
.hint-pop::after {
    content: ''; position: absolute; inset-inline-start: 50%; bottom: -4px;
    width: 9px; height: 9px; margin-inline-start: -5px;
    background: #1c2740; border-radius: 2px; transform: rotate(45deg);
}
.hint-pop.below::after { bottom: auto; top: -4px; }
.hint-pop .hp-title { display: block; white-space: nowrap; }
.hint-pop .hp-sub { display: block; margin-top: 2px; font-size: .63rem; font-weight: 500; color: #aab6d0; }

/* ---------- أيقونة داخل المودال + زر تأكيد صريح ---------- */
.modal-ico {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border-radius: 6px; flex-shrink: 0;
}
.modal-ico.brand { background: var(--brand-50); color: var(--brand-600); }
.modal-ico.danger { background: #fdeeee; color: #c9433f; }
.modal-ico.accent { background: #e8f7f4; color: #0d8578; }
.btn-danger-solid { background: #c9433f; border: 1px solid #c9433f; color: #fff; }
.btn-danger-solid:hover { background: #b73b37; border-color: #b73b37; color: #fff; }
.modal-panel .modal-title { line-height: 1.5; }

/* =====================================================================
   مودال التفاصيل: أقسام منظّمة + خط زمني لسجل الإجراءات
   ===================================================================== */
.det { display: flex; flex-direction: column; gap: 10px; }
.det-cols { display: grid; gap: 10px; }
@media (min-width: 1024px) {
    .det-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); align-items: start; }
}
.det-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.det-card {
    display: flex; flex-direction: column; gap: 7px;
    padding: 11px 12px; border-radius: 6px;
    background: var(--surface); border: 1px solid var(--border);
}
.det-dim { color: #b6c0d0; }
.det-sec { display: flex; flex-direction: column; gap: 8px; }

.det-head {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 12px; border-radius: 6px;
    background: linear-gradient(180deg, #f8fafd, #f3f6fc);
    border: 1px solid var(--border);
}
.det-head.is-sold { background: linear-gradient(180deg, #f6fbf8, #eef8f2); border-color: #d1ebdc; }
.det-head .det-id { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.det-head .det-name {
    font-size: .95rem; font-weight: 700; color: var(--ink);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.det-head .det-phone { font-size: .74rem; color: var(--muted); letter-spacing: .03em; align-self: flex-start; }
.det-head .det-badge { flex-shrink: 0; }

.det-sec { display: flex; flex-direction: column; gap: 8px; }
.det-title { display: flex; align-items: center; gap: 8px; font-size: .74rem; font-weight: 700; color: #485265; }
.det-title::before {
    content: ''; width: 3px; height: 13px; border-radius: 99px;
    background: linear-gradient(180deg, var(--brand-400), var(--brand-600));
}
.det-count {
    margin-inline-start: auto; padding: .1rem .5rem;
    font-size: .64rem; font-weight: 600; color: var(--muted);
    background: var(--surface-3); border: 1px solid var(--border); border-radius: 999px;
}

.det-stepper { padding: 2px 0 0; }
.det-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.det-cell {
    display: flex; flex-direction: column; gap: 1px; min-width: 0;
    padding: 6px 9px; border-radius: 6px;
    background: var(--surface-2); border: 1px solid var(--border-soft);
}
.det-cell .det-k { font-size: .62rem; font-weight: 600; color: #a9b4c9; }
.det-cell .det-v { font-size: .77rem; font-weight: 600; color: #333c4d; overflow: hidden; text-overflow: ellipsis; }
.det-cell .det-v .src-chip { font-size: .7rem; }
.det-buy .det-cell { background: #f2faf5; border-color: #d1ebdc; }
.det-buy .det-cell .det-v { color: #2f7d52; }

.det-notes {
    padding: 8px 10px; border-radius: 6px;
    background: #fff9ec; border: 1px solid #f3e2c0;
    font-size: .76rem; line-height: 1.7; color: #8a6416;
}
.det-empty { font-size: .74rem; color: #a9b4c9; }

/* ---------- سجل الإجراءات: جدول مضغوط + ترقيم ---------- */
.act-table-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: 6px; }
.act-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.act-table thead th {
    padding: 7px 9px; text-align: start;
    background: var(--surface-2); border-bottom: 1px solid var(--border-soft);
    font-size: .64rem; font-weight: 700; color: #7b879c; white-space: nowrap;
}
.act-table tbody td {
    padding: 6px 9px; border-bottom: 1px solid var(--border-soft);
    font-size: .72rem; color: #485265; vertical-align: middle;
}
.act-table tbody tr:last-child td { border-bottom: none; }
.act-table tbody tr:hover { background: #f9fbfe; }
.act-table .no-label { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.act-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; flex-shrink: 0; border-radius: 999px;
    background: #fff; border: 1px solid var(--border); color: var(--brand-600);
}
.act-badge svg { width: 13px; height: 13px; }
.act-badge.is-sold { background: #eaf6ee; border-color: #d1ebdc; color: #2f7d52; }
.act-table .act-t { font-weight: 700; color: #333c4d; }
.act-note-c { color: #7b879c; max-width: 220px; }
.act-user-c { white-space: nowrap; }
.act-date-c { white-space: nowrap; color: #7b879c; letter-spacing: .02em; }

.act-pager {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    flex-wrap: wrap; padding-top: 2px;
}
.act-info { font-size: .66rem; color: var(--muted); }
.act-pager-btns { display: inline-flex; align-items: center; gap: 6px; }
.act-pg {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 6px; cursor: pointer;
    border: 1px solid var(--border); background: #fff; color: #5c6879;
    transition: background .16s, color .16s, border-color .16s;
}
.act-pg:hover:not(:disabled) { background: var(--brand-50); border-color: #dbe5fb; color: var(--brand-600); }
.act-pg:disabled { opacity: .45; cursor: not-allowed; }
.act-pg svg { width: 14px; height: 14px; }
.act-pg-info { font-size: .68rem; font-weight: 700; color: #5c6879; white-space: nowrap; }

/* ---------- الموبايل ---------- */
@media (max-width: 640px) {
    .date-range { width: 100%; }
    .date-range input[type="date"] { flex: 1; min-width: 0; width: 50%; }
    .sec-head .sec-sub { display: none; }
}

/* =====================================================================
   صفحة تسجيل الدخول — تصميم مستوحى من واجهة Inform Group
   خلفية داكنة تملأ الشاشة + دائرة نيلية عملاقة شبه شفافة على جانب،
   ولوحة دخول بسيطة على الجانب الآخر (حقول بيضاء + زر داكن).
   ===================================================================== */
/* الشاشة كلها: تمتد على كامل العرض والارتفاع */
.auth-screen {
    position: relative;
    z-index: 0;
    display: flex;
    justify-content: flex-start; /* اللوحة على جهة البداية (يمين في RTL) */
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    color: #fff;
    /* القاعدة الداكنة تملأ الشاشة وتُرسم أسفل كل طبقات الخلفية (الصورة/الدائرة/النقشة)
       مشتقّة من لون الشعار rgb(26 19 72) = #1a1348 (أفتح في الأعلى ← أغمق في الأسفل) */
    background: linear-gradient(150deg, #332a7e 0%, #1a1348 46%, #110c31 100%);
}

/* توهّج نيلي ناعم خلف الصورة (بلا أي نسخة مصوّرة حتى لا تظهر أجزاء مكرّرة/
   مقصوصة من الصورة نفسها حولها) */
.auth-photo-bg {
    position: fixed;
    inset: 0;
    z-index: -4;
    background: radial-gradient(58% 78% at 20% 50%, rgba(117, 102, 214, .20), transparent 72%);
    pointer-events: none;
}

/* صورة المشروع (img/Back.png): تملأ الجهة اليسرى (45% = المسافة الأصلية لقسم البيانات
   النيلي) بارتفاع الشاشة الكامل، بلا شرائط ولا حواف ظاهرة:
   • cover لتغطية المساحة كاملة (تملأ كل العرض والارتفاع).
   • مربوطة بالحافة اليسرى (left center) فلا يُقتطع أي جزء من يسار الصورة، وأي تقليم
     بسيط يقع في يمينها داخل منطقة التلاشي نفسها.
   • تلاشٍ ناعم لحافة الصورة اليمنى (آخر 28% من عرضها) يجعلها تندمج مع الدائرة
     النيلية بلا أي خط فاصل ظاهر. */
.auth-photo {
    position: fixed;
    inset: 0 55% 0 0;
    z-index: -3;
    background: url('../img/Back.png') left center / cover no-repeat;
    -webkit-mask-image: linear-gradient(to right, #000 0%, #000 72%, transparent 100%);
    mask-image: linear-gradient(to right, #000 0%, #000 72%, transparent 100%);
    filter: grayscale(1) brightness(.48) contrast(1.06);
    opacity: .62;
    pointer-events: none;
}

/* الخلفية (تحاكي جو الصورة في الموقع المرجعي: نيلي/بنفسجي داكن) */
.auth-screen::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(120% 120% at 10% 6%, rgba(117, 102, 214, .34), transparent 55%),
        radial-gradient(95% 95% at 90% 92%, rgba(61, 46, 158, .55), transparent 58%),
        linear-gradient(to bottom, rgba(26, 19, 72, .50), rgba(17, 12, 49, .82));
}
/* نقشة نقاط خفيفة فوق الخلفية */
.auth-screen::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px);
    background-size: 26px 26px;
    opacity: .45;
    pointer-events: none;
}
/* تحديد النص داخل شاشة الدخول بلون مشتق من الشعار rgb(26 19 72) */
.auth-screen ::selection { background: rgba(117, 102, 214, .38); color: #fff; }

/* الدائرة النيلية العملاقة — حافتها اليسرى عند 45% (المسافة الأصلية لقسم البيانات النيلي)
   وتمتد لخارج الشاشة يميناً (خلف لوحة الدخول) وحافة الصورة تندمج معها بالتدرّج */
.auth-circle {
    position: fixed;
    top: 50%;
    left: 45%;
    width: 110vmax;
    height: 110vmax;
    margin-top: -55vmax;
    border-radius: 100%;
    /* لون الشعار نفسه rgb(26 19 72) = #1a1348 */
    background: rgba(26, 19, 72, .96);
    z-index: -1;
    pointer-events: none;
}

/* خلفية المربعات: شبكة كادر هندسي شفافة جداً تغطي الشاشة كاملة
   (أوضح قليلاً أسفل/يسار، وتخفت تدريجياً تجاه لوحة الدخول) */
.auth-grid {
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, .04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, .04) 1px, transparent 1px);
    background-size: 46px 46px;
    -webkit-mask-image: linear-gradient(45deg, rgba(0, 0, 0, .66) 0%, rgba(0, 0, 0, .22) 60%, rgba(0, 0, 0, .05) 100%);
    mask-image: linear-gradient(45deg, rgba(0, 0, 0, .66) 0%, rgba(0, 0, 0, .22) 60%, rgba(0, 0, 0, .05) 100%);
    pointer-events: none;
}

/* لوحة الدخول تحتل نصف الشاشة على جهة البداية (يمين في RTL)،
   والنصف المقابل تظهر فيه الخلفية/الدائرة كما في الموقع المرجعي */
.auth-side-form {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 0 0 50%;
    max-width: 50%;
    align-items: center;
    justify-content: center;
    padding: 2.25rem 1.5rem;
}

/* لوحة الدخول (أحجام مضبوطة: أصغر قليلاً على الديسكتوب وأصغر بوضوح على الموبايل) */
.auth-panel { width: 100%; max-width: 23rem; }
/* الشعار: موسَّط أفقياً في منتصف قسم البيانات، مع خطَّين رقيقين على الجانبين
   يذوبان في الخلفية (سياق RTL: ::before يمين اللوحة و ::after يسارها،
   والجزء الأفتح من كل خطٍّ يكون ناحية الشعار) */
.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .8rem;
    margin-bottom: 1.9rem;
}
.auth-logo::before,
.auth-logo::after { content: ''; flex: 1 1 auto; height: 1px; }
.auth-logo::before { background: linear-gradient(to left, transparent, rgba(255, 255, 255, .32)); }
.auth-logo::after { background: linear-gradient(to right, transparent, rgba(255, 255, 255, .32)); }

/* قرص أبيض دائري خلف الشعار (الشعار داكن اللون فيظهر بألوانه الصحيحة)
   مع هالة نيلية متدرجة تُبرزه في منتصف اللوحة */
.auth-logo-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 82px;
    height: 82px;
    padding: 13px;
    border-radius: 9999px;
    background: radial-gradient(circle at 50% 28%, #ffffff 0%, #eef2fb 100%);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, .60),
        0 0 0 8px rgba(117, 102, 214, .26),
        0 0 0 18px rgba(117, 102, 214, .11),
        0 24px 46px -20px rgba(9, 14, 26, .90);
}
.auth-logo-chip img,
.auth-logo-chip svg { display: block; width: 100%; height: 100%; object-fit: contain; }

.auth-title {
    margin: 0;
    font-size: .98rem;
    font-weight: 700;
    letter-spacing: .05em;
    color: #fff;
}
.auth-subtitle {
    margin: .35rem 0 0;
    font-size: .76rem;
    color: rgba(255, 255, 255, .62);
}

.auth-field { position: relative; margin-top: 1.05rem; }
.auth-input {
    width: 100%;
    height: 46px;
    padding: 0 .85rem;
    border: 1px solid transparent;
    border-radius: 6px;
    background: #fff;
    color: var(--ink-900);
    font: inherit;
    font-size: .9rem;
    direction: rtl;       /* الحقول RTL: النص و العنصر النائب يبدآن من اليمين */
    text-align: right;
    box-shadow: 0 14px 30px -22px rgba(9, 14, 26, .65);
    transition: box-shadow .18s, border-color .18s;
}
.auth-input::placeholder { color: #97a0b3; }
.auth-input:focus {
    outline: none;
    border-color: #7566d6;                       /* مشتق من لون الشعار rgb(26 19 72) */
    box-shadow: 0 0 0 3px rgba(26, 19, 72, .22);
}
.auth-input.has-icon { padding-inline-end: 2.45rem; }
.auth-input.is-error {
    border-color: #d92644;
    box-shadow: 0 0 0 3px rgba(217, 38, 68, .30);
}

/* زر إظهار/إخفاء كلمة المرور */
.auth-eye {
    position: absolute;
    inset-inline-end: .4rem;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #6b7688;
    cursor: pointer;
    transition: color .16s, background .16s;
}
.auth-eye:hover { color: #3d2e9e; background: var(--surface-3); }
.auth-eye svg { width: 17px; height: 17px; }

/* زر الدخول: بعرض حقل كلمة المرور تماماً (100% من اللوحة) بلون واحد ثابت
   دون أي تدرّج أو تأثير عند المرور */
.auth-actions { margin-top: 1.15rem; }
.auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    height: 46px;
    border: 0;
    border-radius: 6px;
    /* لون ثابت واحد (بنفسجي مشتق من هوية الشعار) بلا تدرّج ولا انتقال ولا ظل */
    background: #3d2e9e;
    color: #fff;
    font: inherit;
    font-size: .86rem;
    font-weight: 500;
    cursor: pointer;
}

/* تنبيه الخطأ */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    margin-top: 1.05rem;
    padding: .65rem .85rem;
    border: 1px solid rgba(255, 159, 170, .55);
    border-radius: 6px;
    background: rgba(217, 38, 68, .18);
    color: #ffd9de;
    font-size: .78rem;
}

/* بيانات الدخول التجريبية: قسم مطوي بعنوان قابل للنقر (زرّان في كل سطر)
   — الفتح والطي بحركة سلسة عبر انتقال grid-template-rows من 0fr إلى 1fr */
.auth-demo {
    margin-top: 1.25rem;
    padding-top: .9rem;
    border-top: 1px solid rgba(255, 255, 255, .14);
}
.auth-demo-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    width: 100%;
    padding: .1rem 0;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, .72);
    font: inherit;
    font-size: .7rem;
    cursor: pointer;
    transition: color .16s;
}
.auth-demo-toggle:hover,
.auth-demo-toggle:focus-visible { outline: none; color: #fff; }
.auth-demo-toggle-label { font-weight: 600; }
.auth-demo-caret { display: inline-flex; transition: transform .3s cubic-bezier(.4, 0, .2, 1); }
.auth-demo-caret.is-open { transform: rotate(180deg); }

/* جسم القسم: صف شبكي يتقلّص من 1fr إلى 0fr فينطوي المحتوى بسلاسة بلا قفزات */
.auth-demo-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .36s cubic-bezier(.4, 0, .2, 1);
}
.auth-demo-body.is-open { grid-template-rows: 1fr; }
.auth-demo-inner {
    min-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-4px);
    visibility: hidden;
    transition: opacity .28s ease, transform .28s ease, visibility 0s linear .3s;
}
.auth-demo-body.is-open .auth-demo-inner {
    opacity: 1;
    transform: none;
    visibility: visible;
    transition-delay: 0s;
}
.auth-demo-hint {
    margin: .65rem 0 .5rem;
    font-size: .68rem;
    color: rgba(255, 255, 255, .55);
}

/* الحسابات: زرّان في كل سطر (عمودان متساويان) وحلقة سطرية للدور والبريد */
.auth-demo-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .4rem;
}
.auth-demo-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .1rem;
    min-width: 0;
    padding: .34rem .5rem;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 6px;
    background: rgba(255, 255, 255, .07);
    color: rgba(255, 255, 255, .9);
    font: inherit;
    text-align: start;
    cursor: pointer;
    transition: background .16s, border-color .16s, color .16s;
}
.auth-demo-btn:hover,
.auth-demo-btn:focus-visible {
    outline: none;
    background: rgba(117, 102, 214, .38);
    border-color: rgba(117, 102, 214, .72);
    color: #fff;
}
.auth-demo-role {
    max-width: 100%;
    color: rgba(255, 255, 255, .55);
    font-size: .6rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.auth-demo-mail,
.auth-demo-pass-code {
    direction: ltr;
    unicode-bidi: embed;
    font-weight: 600;
}
.auth-demo-mail {
    max-width: 100%;
    color: rgba(255, 255, 255, .92);
    font-size: .66rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.auth-demo-pass {
    margin: .55rem 0 0;
    font-size: .68rem;
    color: rgba(255, 255, 255, .5);
}
.auth-demo-pass-code { color: rgba(255, 255, 255, .78); }

/* ================= شاشة التحميل عند الضغط على «دخول» =================
   خلفية شبه شفافة تماماً (تمويه ناعم يُبقي الصفحة ظاهرة خلفها) + الشعار
   نفسه المستخدم في اللوحة داخل حلقة دوّارة بنبض خفيف، تنبثق من مركز الشاشة */
.auth-loading {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 10, 38, .16);          /* شفافية عالية جداً */
    -webkit-backdrop-filter: blur(6px) saturate(115%);
    backdrop-filter: blur(6px) saturate(115%);
}
/* انتقال ظهور/إخفاء الطبقة (تُضاف عبر Alpine) */
.auth-loading-enter { transition: opacity .35s ease; }
.auth-loading-enter-start { opacity: 0; }
.auth-loading-enter-end { opacity: 1; }

/* الصندوق الأوسط: ينبثق من المركز بحركة مرنة */
.auth-loading-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .9rem;
    padding: 1.6rem 2rem 1.4rem;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 6px;
    background: rgba(12, 16, 48, .34);
    box-shadow: 0 30px 70px -34px rgba(3, 6, 24, .85);
    animation: authPop .5s cubic-bezier(.22, 1.15, .36, 1) both;
}

/* حلقتان حول الشعار: قوس دوّار سريع + حلقة متقطّعة بطيئة معاكسة */
.auth-loading-orbit {
    position: relative;
    display: grid;
    place-items: center;
    width: 88px;
    height: 88px;
}
.auth-loading-orbit::before,
.auth-loading-orbit::after {
    content: '';
    position: absolute;
    border-radius: 9999px;
}
.auth-loading-orbit::before {
    inset: 0;
    border: 2px solid rgba(255, 255, 255, .12);
    border-top-color: #8b7bf0;
    border-bottom-color: rgba(139, 123, 240, .5);
    animation: authSpin .95s linear infinite;
}
.auth-loading-orbit::after {
    inset: -11px;
    border: 1px dashed rgba(255, 255, 255, .22);
    animation: authSpin 7s linear infinite reverse;
}
/* قرص الشعار: نفس تنسيق قرص اللوحة (أبيض دائري) مع نبض خفيف */
.auth-loading-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    padding: 9px;
    border-radius: 9999px;
    background: radial-gradient(circle at 50% 28%, #ffffff 0%, #eef2fb 100%);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, .55),
        0 0 0 10px rgba(117, 102, 214, .18),
        0 18px 40px -18px rgba(3, 6, 24, .90);
    animation: authChipPulse 1.5s ease-in-out infinite;
}
.auth-loading-chip img,
.auth-loading-chip svg { display: block; width: 100%; height: 100%; object-fit: contain; }
.auth-loading-text {
    margin: 0;
    font-size: .74rem;
    color: rgba(255, 255, 255, .84);
}
/* شريط تقدّم غير محدّد (نبض أفقي) */
.auth-loading-bar {
    display: block;
    width: 92px;
    height: 3px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, .14);
    overflow: hidden;
}
.auth-loading-bar > span {
    display: block;
    height: 100%;
    border-radius: 9999px;
    background: linear-gradient(90deg, #7566d6, #a99bff);
    animation: authBarPulse 1.3s ease-in-out infinite;
}

/* زر الدخول أثناء الإرسال */
.auth-submit:disabled { opacity: .72; cursor: progress; }

@keyframes authSpin { to { transform: rotate(360deg); } }
@keyframes authChipPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.07); }
}
@keyframes authPop {
    from { opacity: 0; transform: translateY(16px) scale(.82); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes authBarPulse {
    0%, 100% { transform: scaleX(.18); opacity: .55; }
    50%      { transform: scaleX(1);   opacity: 1; }
}
/* احترام تفضيل تقليل الحركة */
@media (prefers-reduced-motion: reduce) {
    .auth-loading-orbit::before,
    .auth-loading-orbit::after,
    .auth-loading-chip,
    .auth-loading-box,
    .auth-loading-bar > span { animation: none; }
    .auth-loading-enter { transition: none; }
    .auth-demo-body,
    .auth-demo-inner,
    .auth-demo-caret { transition: none; }
}

/* حقوق النشر أسفل الشاشة */
.auth-copyright {
    position: fixed;
    bottom: 1.25rem;
    inset-inline: 1.5rem;
    z-index: 2;
    font-size: .7rem;
    line-height: 1.6;
    text-align: start;
    color: rgba(255, 255, 255, .55);
}

/* الشاشات الأفقية القريبة من المربّع (4:3 و5:4): مساحة الصورة أضيق من نسبتها (800×1000)
   فيقتطع cover جزءاً من يمينها، لذا نوسّع التدرّج ليبتلع منطقة الاقتطاع بلا أي حد ظاهر */
@media (min-width: 992px) and (max-aspect-ratio: 3/2) {
    .auth-photo {
        -webkit-mask-image: linear-gradient(to right, #000 0%, #000 66%, transparent 100%);
        mask-image: linear-gradient(to right, #000 0%, #000 66%, transparent 100%);
    }
}

/* الاستجابة: اللوحة تملأ الشاشة على المقاسات الصغيرة أو الشاشات الطولية/شبه المربعة
   (تحوّل الصورة إلى خلفية كاملة لتفادي أي فراغات حولها) */
@media (max-width: 991px), (max-aspect-ratio: 6/5) {
    .auth-side-form { flex: 1 1 100%; max-width: 100%; }
    /* على هذه المقاسات تُمدَّد الصورة كخلفية كاملة للشاشة بلا تلاشٍ جانبي */
    .auth-photo {
        inset: 0;
        width: 100%;
        background-size: cover;
        -webkit-mask-image: none;
        mask-image: none;
    }
    .auth-photo-bg { display: none; }
    /* سطر الحقوق قد يطول فيحتاج عرضاً كاملاً موسّطاً */
    .auth-copyright { inset-inline: 1.25rem; text-align: center; }
}

/* تصغير الحقول والنصوص على الموبايل (تظهر كبيرة الحجم على العرض الضيق) */
@media (max-width: 575px) {
    .auth-side-form { padding: 1.4rem 1rem; }
    .auth-panel { max-width: 100%; }
    .auth-logo { gap: .55rem; margin-bottom: 1.5rem; }
    .auth-logo-chip { width: 66px; height: 66px; padding: 10px; }
    .auth-title { font-size: .92rem; }
    .auth-subtitle { font-size: .72rem; }
    .auth-field { margin-top: .85rem; }
    .auth-input { height: 40px; padding: 0 .75rem; font-size: .84rem; }
    .auth-input.has-icon { padding-inline-end: 2.3rem; }
    .auth-eye { width: 1.65rem; height: 1.65rem; inset-inline-end: .35rem; }
    .auth-eye svg { width: 15px; height: 15px; }
    .auth-actions { margin-top: 1rem; }
    .auth-submit { height: 40px; font-size: .8rem; }
    .auth-alert { font-size: .74rem; }
    .auth-demo { margin-top: 1.05rem; padding-top: .8rem; }
    .auth-demo-toggle { font-size: .66rem; }
    .auth-demo-hint, .auth-demo-pass { font-size: .6rem; }
    .auth-demo-btn { padding: .3rem .45rem; }
    .auth-demo-role { font-size: .55rem; }
    .auth-demo-mail { font-size: .6rem; }
    .auth-loading-box { gap: .75rem; padding: 1.3rem 1.4rem 1.2rem; }
    .auth-loading-orbit { width: 74px; height: 74px; }
    .auth-loading-orbit::after { inset: -9px; }
    .auth-loading-chip { width: 50px; height: 50px; padding: 8px; }
    .auth-loading-text { font-size: .68rem; }
    .auth-loading-bar { width: 78px; }
    .auth-copyright { bottom: 1rem; inset-inline: 1rem; font-size: .63rem; }
}









/* =====================================================================
   صوت الجرس — زر أيقوني للكتم/التفعيل (رأس قائمة الإشعارات)
   ===================================================================== */
.sound-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 27px; height: 27px; padding: 0; flex-shrink: 0;
    border-radius: 999px; border: 1px solid var(--border);
    background: #fff; color: var(--muted); cursor: pointer;
    transition: background .16s, color .16s, border-color .16s, transform .16s;
}
.sound-toggle svg { width: 16px; height: 16px; }
.sound-toggle:hover { transform: translateY(-1px); }
.sound-toggle.is-on { color: var(--accent-600); background: #eaf7f4; border-color: #cfeee8; }
.sound-toggle.is-on:hover { background: #ddf2ed; }
.sound-toggle.is-off { color: #9aa5b8; background: var(--surface-3); }
.sound-toggle.is-off:hover { color: #6b7688; }
.sound-toggle:focus-visible { outline: 2px solid var(--brand-300); outline-offset: 2px; }

/* =====================================================================
   قسم التقارير — نظام تصميم كامل (فلاتر ذكية · تبويبات · جداول أداء · تصدير)
   ===================================================================== */
.rep-shell { display: flex; flex-direction: column; gap: 18px; }

/* ---------- بطاقة الفلاتر ---------- */
.rep-filters .card-head { flex-wrap: wrap; row-gap: 8px; }
.rep-period {
    display: inline-flex; align-items: center; gap: 6px;
    padding: .35rem .7rem; border-radius: 999px;
    background: var(--brand-50); border: 1px solid #dbe5fb;
    font-size: .68rem; font-weight: 600; color: var(--brand-600);
}
.rep-period svg { width: 14px; height: 14px; }
.rep-period b { font-weight: 700; color: var(--brand-600); }

.rep-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.rep-quick .q-chip {
    border: 1px solid var(--border); background: #fff; cursor: pointer;
    border-radius: 999px; padding: .38rem .82rem;
    font-size: .7rem; font-weight: 600; color: #5c6879;
    transition: background .16s, color .16s, border-color .16s, box-shadow .16s;
}
.rep-quick .q-chip:hover { background: var(--surface-3); color: var(--ink); }
.rep-quick .q-chip.is-active {
    background: var(--brand); border-color: var(--brand); color: #fff;
    box-shadow: var(--shadow-brand);
}

.rep-fields { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1024px) {
    .rep-fields { grid-template-columns: repeat(4, minmax(0, 1fr)) 176px; align-items: end; }
}
.rep-field > label { display: block; margin-bottom: 6px; font-size: .68rem; font-weight: 600; color: var(--muted); }
.rep-actions { display: flex; align-items: center; gap: 8px; }
.rep-actions .btn { flex: 1; }
.rep-reset {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 40px; padding: 0 .8rem; border-radius: 6px; flex-shrink: 0;
    border: 1px solid var(--border); background: #fff;
    font-size: .72rem; font-weight: 600; color: #5c6879; cursor: pointer;
    transition: background .16s, color .16s, border-color .16s;
}
.rep-reset:hover { background: var(--surface-3); color: var(--ink); border-color: #dbe5fb; }
.rep-reset svg { width: 15px; height: 15px; }

/* ---------- شريط الأقسام ---------- */
.rep-bar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
    position: sticky; top: 60px; z-index: 20;
    padding: 6px 8px 6px 6px; border-radius: var(--radius);
    background: rgba(255, 255, 255, .88); backdrop-filter: blur(10px);
    border: 1px solid var(--border); box-shadow: var(--shadow-xs);
}
.rep-bar .tabs { flex: 1 1 280px; border: none; box-shadow: none; background: transparent; padding: 0; }
.rep-bar .tab { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.tab-num {
    min-width: 20px; padding: 1px 6px; border-radius: 999px;
    background: var(--surface-3); color: var(--muted);
    font-size: .6rem; font-weight: 700; line-height: 1.5;
    transition: background .16s, color .16s;
}
.tab.active .tab-num { background: #fff; color: var(--brand-600); }
.rep-updated {
    display: inline-flex; align-items: center; gap: 6px;
    padding-inline-end: 6px; font-size: .68rem; color: var(--muted); white-space: nowrap;
}
.rep-updated svg { width: 14px; height: 14px; }
.rep-updated b { color: var(--ink); font-weight: 700; direction: ltr; }

.tab-panel { animation: repIn .28s ease both; }
@keyframes repIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }



/* ---------- نظرة عامة: تخطيط المقارنة ---------- */
.rep-split { display: grid; gap: 16px; }
@media (min-width: 1024px) { .rep-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.rep-note { font-size: .68rem; color: var(--muted); }

/* ---------- منصة التتويج (أفضل ثلاثة) ---------- */
.rep-podium { display: grid; gap: 10px; }
@media (min-width: 640px) { .rep-podium { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pd-card {
    position: relative; overflow: hidden;
    padding: 14px; border-radius: var(--radius-lg);
    background: var(--surface); border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}
.pd-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #dbe5fb; }
.pd-card::before {
    content: ''; position: absolute; inset-inline: 0; top: 0; height: 3px;
    background: var(--pd-color, var(--brand)); opacity: .85;
}
.pd-card.is-first { border-color: #ecdcae; background: linear-gradient(180deg, #fffdf5, #fff); }
.pd-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pd-rank {
    display: inline-flex; align-items: center; justify-content: center;
    width: 27px; height: 27px; border-radius: 999px;
    font-size: .72rem; font-weight: 800; color: #fff;
    background: var(--pd-color, var(--brand));
}
.pd-card.is-first .pd-rank { background: linear-gradient(135deg, #d9a72e, #b8860b); }
.pd-tag { font-size: .62rem; font-weight: 700; color: var(--muted); }
.pd-name { margin-top: 10px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.pd-name .avatar { width: 30px; height: 30px; font-size: .68rem; }
.pd-name strong { display: block; font-size: .8rem; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-name em { display: block; font-size: .62rem; font-style: normal; color: var(--muted); }
.pd-stats { margin-top: 10px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; text-align: center; }
.pd-stat { padding: 6px 4px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border-soft); }
.pd-stat b { display: block; font-size: .88rem; font-weight: 800; color: var(--ink); }
.pd-stat span { display: block; margin-top: 2px; font-size: .58rem; color: var(--muted); }
.pd-track { margin-top: 10px; height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.pd-fill { display: block; height: 100%; border-radius: 999px; background: var(--pd-color, var(--brand)); }
.pd-note { margin-top: 6px; display: flex; align-items: center; justify-content: space-between; font-size: .62rem; color: var(--muted); }
.pd-note b { font-size: .72rem; color: var(--ink); }

/* ---------- الأعلى تحويلاً (شريحة بارزة) ---------- */
.rt-box {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: var(--radius);
    background: linear-gradient(180deg, #fbfdff, #fff);
    border: 1px solid var(--border-soft);
}
.rt-box .avatar { width: 42px; height: 42px; font-size: .84rem; }
.rt-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.rt-k { font-size: .62rem; font-weight: 700; color: var(--muted); }
.rt-name { font-size: .84rem; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-sub { font-size: .66rem; color: var(--muted); }
.rt-val { font-size: 1.2rem; font-weight: 800; color: var(--accent-600); white-space: nowrap; }


/* ---------- جداول الأداء: ترتيب + أشرطة تحويل ---------- */
.data-table thead th.sortable { cursor: pointer; user-select: none; }
.data-table thead th.sortable > span { display: inline-flex; align-items: center; gap: 5px; }
.data-table thead th.sortable .sort-ico { opacity: .35; font-size: .58rem; transition: opacity .16s, transform .16s; }
.data-table thead th.sortable:hover { color: var(--brand-600); }
.data-table thead th.sortable.is-sorted .sort-ico { opacity: 1; color: var(--brand-600); }
.data-table thead th.sortable.is-desc .sort-ico { transform: rotate(180deg); }

.rank-chip {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px;
    background: var(--surface-3); color: #5c6879; border: 1px solid var(--border);
    font-size: .68rem; font-weight: 800;
}
.rank-chip.is-1 { background: linear-gradient(135deg, #f6e3a8, #e2bd52); color: #7a5a06; border-color: #ecd79a; }
.rank-chip.is-2 { background: linear-gradient(135deg, #eef1f6, #d8dfe9); color: #4d5866; border-color: #e0e6ee; }
.rank-chip.is-3 { background: linear-gradient(135deg, #f7e2d3, #e9c3a4); color: #7c4a22; border-color: #eed4bf; }

.perf-cell { display: flex; align-items: center; gap: 9px; min-width: 132px; }
.perf-track { flex: 1; height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.perf-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #40b8a6, #0d8578); }
.perf-fill.is-mid { background: linear-gradient(90deg, #8fa7f2, #5069d8); }
.perf-fill.is-low { background: linear-gradient(90deg, #c9b6f0, #6f52c9); }
.perf-val { font-size: .72rem; font-weight: 800; color: var(--ink); min-width: 40px; text-align: end; }

.row-head-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row-head-cell .avatar { width: 32px; height: 32px; font-size: .72rem; }

/* ---------- مركز التصدير ---------- */
.export-grid { display: grid; gap: 12px; }
@media (min-width: 640px) { .export-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .export-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.export-card {
    display: flex; flex-direction: column; gap: 8px; position: relative;
    padding: 16px; border-radius: var(--radius-lg);
    background: var(--surface); border: 1px solid var(--border);
    box-shadow: var(--shadow-xs); text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}
.export-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #dbe5fb; }
.export-card .ec-ico {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 6px;
    background: var(--brand-50); color: var(--brand-600);
}
.export-card .ec-ico svg { width: 19px; height: 19px; }
.export-card .ec-title { font-size: .84rem; font-weight: 700; color: var(--ink); }
.export-card .ec-desc { flex: 1; font-size: .7rem; color: var(--muted); line-height: 1.7; }
.export-card .btn { margin-top: 4px; pointer-events: none; }

.export-note {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 11px 13px; border-radius: var(--radius);
    background: var(--surface-2); border: 1px dashed var(--border);
    font-size: .7rem; color: var(--muted);
}
.export-note svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--brand); margin-top: 1px; }


/* =====================================================================
   لوحة التحكم — أفضل مندوبي المبيعات (مخطط + لوحة ترتيب)
   ===================================================================== */
.agents-wrap { display: grid; gap: 16px; }
@media (min-width: 1180px) {
    .agents-wrap { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
}
.agents-board { display: flex; flex-direction: column; gap: 8px; }
.agents-board-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    font-size: .68rem; font-weight: 700; color: var(--muted);
}
.lb-row {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 11px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border-soft);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
}
.lb-row:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: #dbe5fb; }
.lb-row.is-first { background: linear-gradient(180deg, #fffdf5, #fff); border-color: #ecdcae; }
.lb-row.is-first:hover { box-shadow: var(--shadow-md); }
.lb-row .avatar { width: 32px; height: 32px; font-size: .72rem; flex-shrink: 0; }
.lb-main { flex: 1; min-width: 0; }
.lb-name {
    display: block; font-size: .78rem; font-weight: 700; color: var(--ink);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lb-sub { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 3px; font-size: .63rem; color: var(--muted); }
.lb-sub b { color: #485265; font-weight: 700; }
.lb-bar { position: relative; height: 6px; margin-top: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.lb-bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #6b87ee, #4054b4); }
.lb-row.is-first .lb-bar > span { background: linear-gradient(90deg, #e2bd52, #b8860b); }
.lb-conv { flex-shrink: 0; text-align: end; }
.lb-conv b { display: block; font-size: .84rem; font-weight: 800; color: var(--accent-600); }
.lb-conv span { display: block; font-size: .58rem; color: var(--muted); }

/* =====================================================================
   صفحة «كل الإشعارات»
   ===================================================================== */
.notif-foot-link {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    padding: 10px 12px; border-top: 1px solid var(--border-soft);
    background: var(--surface-2); color: var(--brand-600);
    font-size: .74rem; font-weight: 700; text-decoration: none;
    transition: background .16s;
}
.notif-foot-link:hover { background: var(--brand-50); }
.notif-foot-link svg { width: 15px; height: 15px; }

.notif-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 992px) {
    .notif-fields { grid-template-columns: 2fr 1fr 132px 190px; align-items: end; }
}

.notif-page { display: flex; flex-direction: column; }
.nf-row {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 13px 16px; border-bottom: 1px solid var(--border-soft);
    transition: background .16s;
}
.nf-row:last-child { border-bottom: none; }
.nf-row:hover { background: var(--surface-2); }
.nf-row.is-unread { background: linear-gradient(90deg, rgba(80, 105, 216, .05), rgba(80, 105, 216, .012)); }
.nf-row.is-unread:hover { background: linear-gradient(90deg, rgba(80, 105, 216, .09), rgba(80, 105, 216, .03)); }
.nf-ico {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; flex-shrink: 0; border-radius: 999px;
    background: #eef3ff; color: var(--brand-600); border: 1px solid #dbe5fb;
}
.nf-ico.is-read { background: var(--surface-3); color: #a9b4c9; border-color: var(--border); }
.nf-ico svg { width: 17px; height: 17px; }
.nf-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.nf-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .82rem; font-weight: 700; color: var(--ink); }
.nf-body { font-size: .73rem; color: var(--muted); }
.nf-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; font-size: .66rem; color: #a9b4c9; }
.nf-lead { display: inline-flex; align-items: center; gap: 5px; color: #5c6879; font-weight: 700; }
.nf-lead svg { width: 13px; height: 13px; color: var(--brand); }
/* اسم الموظف المستقبِل (وضع «كل الإشعارات» لدى المدير) */
.nf-user {
    display: inline-flex; align-items: center; gap: 5px;
    padding: .1rem .45rem; border-radius: 999px;
    background: #f2f5fb; border: 1px solid var(--border);
    color: #56627a; font-weight: 700;
}
.nf-user svg { width: 12px; height: 12px; color: var(--brand); }
.nf-date { letter-spacing: .02em; }
.nf-tag {
    padding: 1px 7px; border-radius: 999px; font-style: normal;
    font-size: .58rem; font-weight: 700;
    background: #fdf3e9; color: #b7671a; border: 1px solid #f7ddc6;
}
.nf-tag.is-unread { background: #eaf2fe; color: #2f6fd0; border-color: #d3e4fb; }
.nf-actions { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.nf-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 6px; cursor: pointer;
    border: 1px solid var(--border); background: #fff; color: #5c6879;
    text-decoration: none; transition: background .16s, color .16s, border-color .16s;
}
.nf-btn:hover { background: var(--brand-50); border-color: #dbe5fb; color: var(--brand-600); }
.nf-btn.is-muted { color: #b6c0d0; background: var(--surface-2); cursor: default; }
.nf-btn svg { width: 15px; height: 15px; }
.notif-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 14px; border-top: 1px solid var(--border-soft);
    background: var(--surface-2); flex-wrap: wrap;
}

.agents-empty { padding: 28px 14px; text-align: center; font-size: .76rem; color: var(--muted); }
