﻿/* =====================================================================
   wwwroot/app.css  -  تصميم ليمون للموقع كله
   ---------------------------------------------------------------------
   الأقسام:
     1) الألوان والخطوط (المتغيرات)   ← لو عايز تغيّر لون، غيّره هنا بس
     2) أساسيات
     3) صفحة الدخول
     4) الإطار: القائمة الجانبية + الشريط العلوى
     5) الرئيسية (كروت الأنظمة) + صفحات الأنظمة
     6) جداول وحقول عامة
     7) حاجات Blazor (أخطاء، فاليديشن)
     8) المساعد (الشات)
     9) الطباعة / PDF
    10) الموبايل + تقليل الحركة
    11) لوحة المتابعة (البطاقات، الرسوم، نافذة التفاصيل)
    12) نوافذ "جارٍ التحميل" + تفاصيل نافذة لوحة المتابعة
    13) لوحة المتابعة v2 + القوائم المنسدلة اللى فيها بحث (SearchSelect)
    14) تقرير الحضور والانصراف (نسخة الويندوز) + الرسائل + الأرشيف
    15) الأزرار بأيقونات + الشاشات المساعدة للتقرير (تعديل الدوام، الجزاء، الدمج، المعاينة ...)
    16) الإدارة: صلاحيات المستخدمين + القوائم والصفحات + "ليس لديك صلاحية"
   ===================================================================== */


/* ---------------------------------------------------------------------
   1) الألوان والخطوط - مأخوذة من لوجو ليمون
   --------------------------------------------------------------------- */
:root {
    --petrol:       #0A5878;   /* لون كلمة ليمون فى اللوجو */
    --petrol-deep:  #073F57;   /* القائمة الجانبية ولوحة الدخول */
    --lemon:        #F8C808;   /* الليمونة */
    --lemon-deep:   #E8A818;   /* ضل الليمونة */
    --lemon-soft:   #FFF6CF;   /* خلفية الرقم الأساسى */
    --leaf:         #389838;   /* الورقة: حاضر / تمام */
    --ink:          #12313F;   /* الكتابة */
    --muted:        #5B7480;   /* كتابة ثانوية */
    --line:         #DCE6EA;   /* الحدود */
    --mist:         #F1F6F7;   /* خلفية الصفحات */
    --warn:         #C2410C;   /* متأخر */
    --danger:       #B42318;

    --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
    --radius: 14px;
    --radius-sm: 8px;
    --side-w: 292px;
    --side-mini: 74px;
}


/* ---------------------------------------------------------------------
   2) أساسيات
   --------------------------------------------------------------------- */
html, body {
    font-family: var(--font);
    color: var(--ink);
    background: var(--mist);
    font-size: 15px;
    line-height: 1.6;
}

h1, h2, h3 { font-weight: 700; color: var(--ink); }
a { color: var(--petrol); }

.num, .num-cell { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

/* الماوس يتحول لإيد على أى حاجة بتتضغط (روابط، أزرار، ليبل، قوائم) */
a[href], button:not(:disabled), label[for], summary, select,
[role="button"], input[type="checkbox"], input[type="radio"],
input[type="submit"], input[type="button"] {
    cursor: pointer;
}
/* والحاجات المقفولة أو "قريبًا": علامة ممنوع */
.is-soon, [aria-disabled="true"], :disabled { cursor: not-allowed; }

:focus-visible {
    outline: 3px solid var(--lemon);
    outline-offset: 2px;
    border-radius: 4px;
}


/* ---------------------------------------------------------------------
   3) صفحة الدخول
   --------------------------------------------------------------------- */
.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(320px, 46%) 1fr;
    background: #fff;
}

/* لوحة البراند */
.auth-brand {
    position: relative;
    overflow: hidden;
    background: radial-gradient(120% 90% at 80% 10%, #0E6A8F 0%, var(--petrol-deep) 55%, #052E40 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
    gap: 18px;
}

.auth-stage {
    position: relative;
    width: min(340px, 70%);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
}

/* قشر الليمون: بيترسم مرة واحدة */
.peel {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    fill: none;
    stroke-linecap: round;
}

.peel path {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: peel-draw 1.8s cubic-bezier(.6, .05, .25, 1) forwards;
}

.peel-green { stroke: var(--leaf); stroke-width: 10; opacity: .85; }
.peel-lemon { stroke: var(--lemon); stroke-width: 14; }
.peel .peel-lemon { animation-delay: .25s; }

@keyframes peel-draw {
    to { stroke-dashoffset: 0; }
}

/* الليمونة: بتظهر بعد القشر وبعدين بتطفو بهدوء */
.auth-mark {
    position: relative;
    width: 42%;
    filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .35));
    opacity: 0;
    transform: translateY(14px) scale(.92);
    animation: mark-in .7s 1.2s ease-out forwards, mark-float 6s 2s ease-in-out infinite;
}

@keyframes mark-in {
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes mark-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%      { transform: translateY(-8px) rotate(-2deg); }
}

.auth-word {
    width: 150px;
    opacity: 0;
    animation: fade-in .6s 1.6s ease-out forwards;
}

.auth-line {
    max-width: 30ch;
    text-align: center;
    color: rgba(255, 255, 255, .78);
    margin: 0;
    opacity: 0;
    animation: fade-in .6s 1.8s ease-out forwards;
}

@keyframes fade-in { to { opacity: 1; } }

/* الفورم */
.auth-form {
    position: relative;   /* عشان زرار اللغة يتثبت فى ركنها */
    display: grid;
    place-items: center;
    padding: 40px 24px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
}

.auth-card-logo { display: none; width: 140px; margin-bottom: 20px; }

.auth-title { font-size: 1.75rem; margin: 0 0 6px; }
.auth-sub   { color: var(--muted); margin: 0 0 28px; }

.auth-error {
    background: #FDECEA;
    color: var(--danger);
    border-inline-start: 4px solid var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    animation: shake .35s ease-in-out;
}

@keyframes shake {
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.auth-fields { display: grid; gap: 18px; }

.field label {
    display: block;
    font-weight: 600;
    font-size: .92rem;
    margin-bottom: 6px;
}

.field-input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    font: inherit;
    color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
}

.field-input:focus {
    outline: none;
    border-color: var(--petrol);
    box-shadow: 0 0 0 4px rgba(248, 200, 8, .35);
}

.field-error { color: var(--danger); font-size: .85rem; margin-top: 4px; }

.remember {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    cursor: pointer;
}

.remember input { width: 18px; height: 18px; accent-color: var(--petrol); }

/* الزرار: بترولى، ولما تقف عليه يتملى أصفر من تحت */
.btn-lemon {
    position: relative;
    overflow: hidden;
    height: 50px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--petrol);
    color: #fff;
    font: inherit;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    isolation: isolate;
    transition: color .25s;
}

.btn-lemon::before {
    content: "";
    position: absolute;
    inset: 100% 0 0 0;
    background: var(--lemon);
    z-index: -1;
    transition: inset .25s ease-out;
}

.btn-lemon:hover { color: var(--petrol-deep); }
.btn-lemon:hover::before { inset: 0; }
.btn-lemon:active { transform: translateY(1px); }
/* زرار فيه أيقونة + كلام: الأيقونة بمقاس ثابت والكلام دايمًا ظاهر جنبها */
.btn-lemon { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 18px; white-space: nowrap; }
.btn-lemon svg { flex: 0 0 auto; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-lemon:disabled { opacity: .55; cursor: not-allowed; }
.btn-lemon:disabled:hover { color: #fff; }
.btn-lemon:disabled:hover::before { inset: 100% 0 0 0; }
/* جوه شريط أدوات: نفس مقاس وشكل الأزرار اللى جنبه */
.hour-filter-btns .btn-lemon, .set-tools .btn-lemon, .td-foot .btn-lemon {
    height: 36px; padding: 0 16px; border-radius: 99px; font-size: .88rem;
}
.hour-filter-btns .btn-lemon svg, .set-tools .btn-lemon svg, .td-foot .btn-lemon svg { width: 16px; height: 16px; }


/* ---------------------------------------------------------------------
   4) الإطار: القائمة الجانبية + الشريط العلوى
   --------------------------------------------------------------------- */
.shell {
    display: flex;
    min-height: 100vh;
}

.nav-toggle { display: none; }

.side {
    width: var(--side-w);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    background: var(--petrol-deep);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    z-index: 30;
}

.side-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    margin-bottom: 14px;
}

.side-mark { height: 46px; }
.side-word { height: 34px; }

/* القائمة بتسكرول لوحدها لو الأنظمة كترت، وزرار الخروج يفضل تحت */
.side-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: grid;
    align-content: start;
    gap: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .2) transparent;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    color: rgba(255, 255, 255, .82);
    text-decoration: none;
    font-weight: 500;
    background: none;
    border: 0;
    width: 100%;
    font: inherit;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }

/* العنصر النشط: شريط أصفر على الطرف */
.nav-item.active {
    background: rgba(248, 200, 8, .14);
    color: #fff;
}

.nav-item.active::before {
    content: "";
    position: absolute;
    inset-inline-start: -14px;
    top: 8px;
    bottom: 8px;
    width: 4px;
    border-radius: 4px;
    background: var(--lemon);
}

.nav-item.active svg { stroke: var(--lemon); }

.nav-item.is-soon { cursor: not-allowed; opacity: .5; }
.nav-item.is-soon:hover { background: none; }
.nav-item small, .nav-subitem small {
    margin-inline-start: auto;
    font-size: .72rem;
    padding: 1px 8px;
    border-radius: 99px;
    background: rgba(255, 255, 255, .12);
}

/* عنوان قسم "الأنظمة" */
.nav-label {
    margin: 16px 14px 6px;
    font-size: .75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, .45);
}

/* مجموعة نظام: <details> بتتفتح وتتقفل */
.nav-group > summary { list-style: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-item.is-current { color: #fff; }
.nav-item.is-current > svg:first-child { stroke: var(--lemon); }

.nav-item .nav-chevron {
    width: 16px;
    height: 16px;
    margin-inline-start: auto;
    opacity: .6;
    transition: transform .2s ease-out;
}
[dir="rtl"] .nav-item .nav-chevron { transform: scaleX(-1); }
.nav-group[open] > summary .nav-chevron { transform: rotate(90deg); }

/* صفحات النظام تحت اسمه */
.nav-sub {
    display: grid;
    gap: 2px;
    margin: 2px 0 8px;
    margin-inline-start: 20px;
    padding-inline-start: 10px;
    border-inline-start: 1px solid rgba(255, 255, 255, .12);
}
.nav-group[open] .nav-sub { animation: drop-in .2s ease-out; }
@keyframes drop-in { from { opacity: 0; translate: 0 -4px; } }

.nav-subitem {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 8px;
    color: rgba(255, 255, 255, .7);
    text-decoration: none;
    font-size: .92rem;
    transition: background .15s, color .15s;
}
.nav-subitem:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-subitem.active { background: rgba(248, 200, 8, .12); color: var(--lemon); font-weight: 600; }
.nav-subitem.is-soon { opacity: .5; }
.nav-subitem.is-soon:hover { background: none; color: rgba(255, 255, 255, .7); }

.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .1); }
.nav-logout:hover { color: var(--lemon); }

.side-scrim { display: none; }

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 0 28px;
    background: rgba(255, 255, 255, .9);
    /* التغبيش فى طبقة خلفية (::before) مش على الشريط نفسه: backdrop-filter على العنصر بيخلّى أى نافذة
       position: fixed جواه (زرار «مساعدة» / الجرس) تتحسب بالنسبة للشريط (ارتفاعه 64px) فتطلع فوق برّه الشاشة */
    border-bottom: 1px solid var(--line);
}
.topbar::before { content: ""; position: absolute; inset: 0; z-index: -1; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); pointer-events: none; }

.menu-btn {
    display: none;
    margin-inline-end: auto;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    place-items: center;
    color: var(--petrol-deep);
    cursor: pointer;
}

/* زرار تبديل اللغة (Components/Shared/LangSwitch.razor) */
.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--petrol-deep);
    font-size: .88rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color .2s, background .2s, color .2s;
}
.lang-switch svg { fill: none; stroke: currentColor; stroke-width: 1.6; }
.lang-switch:hover { border-color: var(--lemon-deep); background: var(--lemon-soft); color: var(--petrol-deep); }
.lang-switch:focus-visible { outline: 2px solid var(--lemon); outline-offset: 2px; }

/* على صفحة الدخول: فوق فى ركن الفورم */
.auth-lang { position: absolute; top: 20px; inset-inline-end: 24px; }

.user-chip { display: flex; align-items: center; gap: 10px; }

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--lemon);
    color: var(--petrol-deep);
    font-weight: 700;
}

.user-text { display: grid; line-height: 1.25; }
.user-name { font-weight: 600; }
.user-role { font-size: .8rem; color: var(--muted); }

.content {
    padding: 28px;
    width: 100%;          /* المحتوى بيملا المساحة كلها جنب القائمة */
}


/* ---------------------------------------------------------------------
   5) الرئيسية (كروت الأنظمة) + صفحات الأنظمة
   --------------------------------------------------------------------- */
.greet h1 { font-size: 1.6rem; margin: 0; }
.greet p  { color: var(--muted); margin: 2px 0 22px; }

/* عنوان صفحة جوه نظام + مسار التنقل */
.page-head h1 { font-size: 1.6rem; margin: 0; }
.page-head p  { color: var(--muted); margin: 2px 0 22px; }
.crumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-size: .85rem;
    color: var(--muted);
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--petrol); }
.crumbs svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
[dir="rtl"] .crumbs svg { transform: scaleX(-1); }

/* كروت الأنظمة فى الرئيسية */
.section-title { font-size: 1rem; color: var(--muted); font-weight: 600; margin: 0 0 12px; }

.modules {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    align-items: start;   /* كروت "قريبًا" ماتتمطّش بطول كارت الحضور */
    gap: 16px;
}

.module-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 22px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: inherit;
    text-decoration: none;
    overflow: hidden;
    /* دخول متتابع: كل كارت بيتأخر شوية عن اللى قبله (--i من الصفحة) */
    opacity: 0;
    animation: rise .5s ease-out forwards;
    animation-delay: calc(var(--i, 0) * 70ms);
    transition: transform .2s ease-out, box-shadow .2s, border-color .2s;
}
@keyframes rise {
    from { opacity: 0; translate: 0 12px; }
    to   { opacity: 1; translate: 0 0; }
}

/* شريط أصفر بيتمد فوق الكارت لما تقف عليه */
a.module-card::before {
    content: "";
    position: absolute;
    inset-inline: 0;
    top: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--lemon), var(--lemon-deep));
    transform: scaleX(0);
    transform-origin: right;
    transition: transform .3s ease-out;
}
[dir="ltr"] a.module-card::before { transform-origin: left; }
a.module-card:hover {
    transform: translateY(-3px);
    border-color: rgba(232, 168, 24, .6);
    box-shadow: 0 14px 30px -16px rgba(7, 63, 87, .4);
}
a.module-card:hover::before { transform: scaleX(1); }

.module-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    margin-bottom: 8px;
    border-radius: 12px;
    background: var(--lemon-soft);
    color: var(--petrol-deep);
    transition: background .2s;
}
a.module-card:hover .module-icon { background: var(--lemon); }
.module-icon svg {
    width: 24px; height: 24px;
    fill: none; stroke: currentColor; stroke-width: 1.8;
    stroke-linecap: round; stroke-linejoin: round;
}

.module-title { font-size: 1.1rem; font-weight: 700; color: var(--ink); }
.module-desc  { font-size: .9rem; color: var(--muted); }

.module-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}
.module-stats > span { display: grid; font-size: .75rem; color: var(--muted); }
.module-stats b { font-size: 1.4rem; line-height: 1.2; color: var(--petrol-deep); }
.module-stats .is-warn b { color: var(--warn); }

.module-go {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    padding-top: 16px;
    font-weight: 600;
    color: var(--petrol);
}
.module-go svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform .2s; }
[dir="rtl"] .module-go svg { transform: scaleX(-1); }
a.module-card:hover .module-go svg { transform: translateX(4px); }
[dir="rtl"] a.module-card:hover .module-go svg { transform: scaleX(-1) translateX(4px); }

/* نظام لسه "قريبًا" */
.module-card.is-soon { background: transparent; border-style: dashed; }
.module-card.is-soon .module-icon  { background: #fff; color: var(--muted); }
.module-card.is-soon .module-title { color: var(--muted); }
.module-badge {
    position: absolute;
    top: 18px;
    inset-inline-end: 18px;
    padding: 2px 10px;
    border-radius: 99px;
    background: #fff;
    border: 1px solid var(--line);
    font-size: .72rem;
    font-weight: 600;
    color: var(--muted);
}

/* شريط النهارده */
.today {
    display: grid;
    grid-template-columns: minmax(240px, 300px) 1fr;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 24px;
}

.today-hero {
    position: relative;
    display: grid;
    align-content: center;
    gap: 2px;
    padding: 24px 26px;
    background:
        radial-gradient(140px 140px at 12% 115%, rgba(248, 200, 8, .55), transparent 70%),
        var(--lemon-soft);
}

.today-hero-label { font-weight: 600; color: var(--petrol-deep); }
.today-hero-value { font-size: 3.4rem; font-weight: 700; line-height: 1.05; color: var(--petrol-deep); }
.today-hero-note  { font-size: .82rem; color: var(--muted); }

/* النقطة الخضرا: بتنبض عشان تقول إن الرقم ده "دلوقتى" */
.live-dot {
    position: absolute;
    top: 22px;
    inset-inline-end: 22px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--leaf);
    box-shadow: 0 0 0 0 rgba(56, 152, 56, .6);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    70%  { box-shadow: 0 0 0 10px rgba(56, 152, 56, 0); }
    100% { box-shadow: 0 0 0 0 rgba(56, 152, 56, 0); }
}

.today-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin: 0;
}

.today-stats > div {
    padding: 22px 22px;
    display: grid;
    align-content: center;
    border-inline-start: 1px solid var(--line);
}

.today-stats dt { font-weight: 500; color: var(--muted); font-size: .9rem; }
.today-stats dd { margin: 0; font-size: 1.9rem; font-weight: 700; color: var(--ink); }
.today-stats .is-warn dd { color: var(--warn); }

/* لوحة الفروع */
.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 22px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.panel-head h2 { font-size: 1.15rem; margin: 0; display: flex; align-items: center; gap: 8px; }

.count-pill {
    font-size: .8rem;
    font-weight: 600;
    padding: 1px 10px;
    border-radius: 99px;
    background: var(--mist);
    color: var(--petrol);
}
.count-pill.is-warn { margin-inline-start: 6px; background: #FFF1E6; color: #9A4300; font-size: .72rem; }

.empty {
    display: grid;
    gap: 4px;
    padding: 28px;
    text-align: center;
    border: 1.5px dashed var(--line);
    border-radius: var(--radius-sm);
    color: var(--muted);
}

.empty strong { color: var(--ink); }


/* ---------------------------------------------------------------------
   6) جداول وحقول عامة
   --------------------------------------------------------------------- */
.search {
    height: 40px;
    min-width: 240px;
    padding: 0 14px;
    border: 1.5px solid var(--line);
    border-radius: 99px;
    font: inherit;
    background: var(--mist);
}

.search:focus { outline: none; border-color: var(--petrol); background: #fff; }

.table-wrap {
    max-height: 460px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

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

.data-table th {
    position: sticky;
    top: 0;
    background: var(--petrol-deep);
    color: #fff;
    font-weight: 600;
    text-align: start;
    padding: 10px 14px;
}

.data-table td { padding: 9px 14px; border-top: 1px solid var(--line); }
.data-table tbody tr:hover td { background: var(--lemon-soft); }
.data-table .num-cell { width: 110px; color: var(--muted); }


/* ---------------------------------------------------------------------
   7) حاجات Blazor
   --------------------------------------------------------------------- */
h1:focus { outline: none; }

.valid.modified:not([type=checkbox]) { outline: 1px solid var(--leaf); }
.invalid { outline: 1px solid var(--danger); }
.validation-message { color: var(--danger); font-size: .85rem; }

.blazor-error-boundary {
    background: var(--danger);
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after { content: "حدث خطأ."; }
[dir="ltr"] .blazor-error-boundary::after { content: "An error has occurred."; }


/* ---------------------------------------------------------------------
   8) المساعد (الشات) - Components/Pages/Chat.razor
   --------------------------------------------------------------------- */

/* مربع السؤال فى الرئيسية */
.ask-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 28px;
    padding: 6px;
    padding-inline-start: 16px;
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 10px 28px -20px rgba(7, 63, 87, .55);
    transition: border-color .2s, box-shadow .2s;
}
.ask-bar:focus-within { border-color: var(--petrol); box-shadow: 0 0 0 4px rgba(248, 200, 8, .25); }
.ask-bar > svg { width: 22px; height: 22px; fill: none; stroke: var(--petrol); stroke-width: 1.8; flex-shrink: 0; }
.ask-bar input { flex: 1; min-width: 0; border: 0; outline: none; font: inherit; padding: 10px 4px; background: transparent; color: var(--ink); }

/* الصفحة كلها: رأس + رسايل (بتسكرول) + مربع كتابة ثابت تحت */
.chat {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 64px - 56px);
}

.chat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}
.chat-head h1 { font-size: 1.4rem; margin: 0; }
.chat-head p  { display: flex; align-items: center; gap: 8px; margin: 2px 0 0; font-size: .85rem; color: var(--muted); }
.live-dot.is-inline { position: static; display: inline-block; width: 8px; height: 8px; }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 99px;
    background: #fff;
    color: var(--petrol-deep);
    font: inherit;
    font-size: .88rem;
    font-weight: 600;
    transition: border-color .2s, background .2s;
}
.btn-ghost svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.btn-ghost:hover:not(:disabled) { border-color: var(--lemon-deep); background: var(--lemon-soft); }
.btn-ghost:disabled { opacity: .5; }

.chat-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 22px 2px;
}

/* الترحيب + الاقتراحات */
.chat-welcome {
    margin: auto;
    max-width: 640px;
    display: grid;
    justify-items: center;
    gap: 6px;
    text-align: center;
    animation: rise .5s ease-out both;
}
.welcome-mark { width: 74px; animation: mark-float 5s ease-in-out infinite; }
.chat-welcome h2 { font-size: 1.5rem; margin: 10px 0 0; }
.chat-welcome p  { margin: 0 0 16px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip {
    padding: 8px 15px;
    border: 1px solid var(--line);
    border-radius: 99px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: .9rem;
    transition: border-color .2s, background .2s, transform .2s;
}
.chip:hover { border-color: var(--lemon-deep); background: var(--lemon-soft); transform: translateY(-2px); }

/* الرسايل */
.msg { display: flex; gap: 10px; animation: rise .3s ease-out both; }
.msg-user { justify-content: flex-end; }
.msg-user .bubble {
    max-width: min(75%, 900px);
    padding: 10px 16px;
    border-radius: 18px;
    border-end-end-radius: 4px;
    background: var(--petrol);
    color: #fff;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.msg-ai { align-items: flex-start; }
.ai-avatar {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    padding: 5px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: #fff;
    object-fit: contain;
}
.ai-body {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 12px;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    border-start-start-radius: 4px;
}

/* المراحل (بدل عرض التفكير) */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.steps li { display: flex; align-items: center; gap: 10px; font-size: .92rem; color: var(--muted); opacity: .5; transition: opacity .3s, color .3s; }
.steps li.is-active { opacity: 1; color: var(--ink); font-weight: 600; }
.steps li.is-done   { opacity: 1; color: var(--leaf); }
.step-dot { width: 14px; height: 14px; flex-shrink: 0; border-radius: 50%; border: 2px solid currentColor; }
.is-active .step-dot { border-color: var(--lemon-deep); border-top-color: transparent; animation: spin .8s linear infinite; }
.is-done .step-dot   { background: var(--leaf); border-color: var(--leaf); box-shadow: inset 0 0 0 2px #fff; }
.step-time { margin-inline-start: auto; font-size: .8rem; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
@keyframes spin { to { transform: rotate(360deg); } }

/* نص الإجابة */
.ai-text { margin: 0; font-size: 1rem; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-text.is-typing::after {
    content: "";
    display: inline-block;
    width: 8px;
    height: 1.1em;
    margin-inline-start: 3px;
    vertical-align: text-bottom;
    background: var(--lemon-deep);
    animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.ai-text.is-error { color: var(--danger); }
.ai-text.is-muted { color: var(--muted); }

/* الجدول + أزرار التصدير */
.result { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; animation: rise .35s ease-out both; }
.result-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: var(--mist);
    border-bottom: 1px solid var(--line);
}
.result-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.result-tools { display: flex; gap: 6px; }
.tool {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--petrol-deep);
    font: inherit;
    font-size: .85rem;
    font-weight: 600;
    transition: background .15s, color .15s, border-color .15s;
}
.tool svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool:hover { background: var(--petrol); border-color: var(--petrol); color: #fff; }

.table-wrap.result-scroll { max-height: 380px; border: 0; border-radius: 0; }
.result-table th,
.result-table td { white-space: nowrap; }          /* الجدول بيسكرول بالعرض بدل ما الخلايا تتكسر */
.result-table td.is-num { font-variant-numeric: tabular-nums; }

/* "متابعة لما سبق": بيوضح إن المساعد ربط السؤال باللى قبله وفهمه إزاى */
.understood {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--lemon-soft);
    color: var(--petrol-deep);
    font-size: .86rem;
    animation: rise .3s ease-out both;
}
.understood svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 3px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[dir="rtl"] .understood svg { transform: scaleX(-1); }
.result-note { margin: 0; padding: 8px 12px; font-size: .82rem; color: var(--muted); background: #fff; border-top: 1px solid var(--line); }

/* الاستعلام (للأدمن) */
.sql-box { font-size: .82rem; }
.sql-box summary { width: fit-content; color: var(--muted); font-weight: 600; }
.sql-box pre {
    margin: 8px 0 0;
    padding: 12px 14px;
    border-radius: 8px;
    background: #0B2533;
    color: #E6F1F5;
    font-size: .8rem;
    white-space: pre-wrap;
    text-align: left;
}
.sql-box pre.is-error { background: #FDECEA; color: var(--danger); }

.ai-meta { display: flex; align-items: center; gap: 14px; font-size: .78rem; color: var(--muted); }
.instant {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 8px;
    border-radius: 99px;
    background: var(--lemon-soft);
    color: var(--petrol-deep);
    font-weight: 700;
}
.instant svg { width: 12px; height: 12px; fill: var(--lemon-deep); }

.link-btn { padding: 0; border: 0; background: none; color: var(--petrol); font: inherit; font-weight: 600; text-decoration: underline; }

/* مربع الكتابة */
.composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px;
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 10px 28px -20px rgba(7, 63, 87, .55);
    transition: border-color .2s, box-shadow .2s;
}
.composer:focus-within { border-color: var(--petrol); box-shadow: 0 0 0 4px rgba(248, 200, 8, .25); }
.composer textarea {
    flex: 1;
    min-height: 42px;
    max-height: 160px;
    padding: 9px 10px;
    border: 0;
    outline: none;
    resize: none;
    background: transparent;
    color: var(--ink);
    font: inherit;
}

.btn-send {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 42px;
    padding: 0 18px;
    border: 0;
    border-radius: 12px;
    background: var(--petrol);
    color: #fff;
    font: inherit;
    font-weight: 600;
    flex-shrink: 0;
    transition: background .2s, transform .1s;
}
.btn-send svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[dir="rtl"] .btn-send svg { transform: scaleX(-1); }
.btn-send:hover:not(:disabled) { background: var(--petrol-deep); }
.btn-send:active:not(:disabled) { transform: translateY(1px); }
.btn-send:disabled { opacity: .45; }
.btn-send.is-stop { background: var(--danger); }
.btn-send.is-stop svg { fill: currentColor; stroke: none; transform: none; }

.composer-note { margin: 6px 0 0; text-align: center; font-size: .75rem; color: var(--muted); }


/* ---------------------------------------------------------------------
   9) الطباعة / PDF  (Components/AiChat/PrintSheet.razor + lemonChat.print)
   ---------------------------------------------------------------------
   على الشاشة: الورقة مخفية.
   وقت الطباعة: كل الصفحة بتستخبى ماعدا #print-root (نسخة من الورقة).
   --------------------------------------------------------------------- */
#print-root { display: none; }

@media print {
    @page { size: A4; margin: 12mm; }

    body.print-mode { background: #fff; }
    body.print-mode > *:not(#print-root) { display: none !important; }
    body.print-mode #print-root { display: block; }

    .print-sheet {
        color: #000;
        font-size: 10.5pt;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .ps-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding-bottom: 10px;
        margin-bottom: 12px;
        border-bottom: 3px solid var(--lemon);
    }
    .ps-logo { height: 48px; }
    .ps-title { text-align: end; }
    .ps-title h1 { margin: 0; font-size: 16pt; color: var(--petrol-deep); }
    .ps-title span { font-size: 9pt; color: #555; }

    .ps-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; margin: 0 0 12px; font-size: 9.5pt; }
    .ps-meta div { display: flex; gap: 6px; }
    .ps-meta div:first-child { grid-column: 1 / -1; }
    .ps-meta dt { font-weight: 700; color: var(--petrol); }
    .ps-meta dt::after { content: ":"; }
    .ps-meta dd { margin: 0; }

    .ps-answer {
        margin-bottom: 12px;
        padding: 8px 12px;
        background: var(--lemon-soft);
        border-inline-start: 4px solid var(--lemon-deep);
        break-inside: avoid;
    }
    .ps-answer h2 { margin: 0 0 2px; font-size: 10pt; color: var(--petrol); }
    .ps-answer p  { margin: 0; white-space: pre-wrap; }

    .ps-table { max-height: none; overflow: visible; border: 0; border-radius: 0; }
    .ps-table table { font-size: 9pt; }
    .ps-table thead { display: table-header-group; }      /* رأس الجدول يتكرر فى كل صفحة */
    .ps-table th { position: static; padding: 5px 7px; background: var(--petrol-deep); color: #fff; }
    .ps-table td { padding: 4px 7px; border-top: 0; border-bottom: 1px solid #DDD; }
    .ps-table th, .ps-table td { white-space: normal; }
    .ps-table tr { break-inside: avoid; }
    .ps-table tbody tr:nth-child(even) td { background: #F4F8F9; }

    .ps-foot { margin-top: 14px; padding-top: 6px; border-top: 1px solid #CCC; font-size: 8pt; color: #666; text-align: center; }
}


/* ---------------------------------------------------------------------
   11) لوحة المتابعة - Components/Pages/Attendance/Dashboard.razor
   --------------------------------------------------------------------- */
:root {
    --good: #2F7D32;   /* حضور / موجود */
    --info: #0A5878;   /* إجازات */
}

.dash-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.dash-head p { margin: 2px 0 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dot-sep { color: var(--line); }

/* الفلاتر */
.dash-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.filter { display: grid; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.filter input, .filter select {
    height: 38px;
    min-width: 170px;
    max-width: 280px;
    padding: 0 12px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: .9rem;
}
.filter input:focus, .filter select:focus { outline: none; border-color: var(--petrol); }
svg.spin { animation: spin 1s linear infinite; }

.dash-alert {
    margin-bottom: 14px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--lemon-soft);
    border: 1px solid rgba(232, 168, 24, .4);
    color: var(--petrol-deep);
}
.dash-alert.is-error { background: #FDECEA; border-color: #F5C2BD; color: var(--danger); }
.dash-alert code { display: block; margin-top: 6px; font-size: .78rem; color: var(--ink); }

/* البطاقات */
.kpi-hero, .kpi-grid { display: grid; gap: 14px; margin-bottom: 14px; transition: opacity .2s; }
.kpi-hero { grid-template-columns: repeat(3, minmax(0, 1fr)); }   /* 3 بطاقات كبيرة (الغياب اتشال) */
.kpi-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.is-refreshing { opacity: .55; pointer-events: none; }

.kpi {
    --tone: var(--petrol);
    --tone-soft: rgba(10, 88, 120, .08);
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 12px;
    align-items: center;
    padding: 16px 18px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: inherit;
    font: inherit;
    text-align: start;
    overflow: hidden;
    opacity: 0;
    animation: rise .45s ease-out forwards;
    animation-delay: calc(var(--i, 0) * 45ms);
    transition: transform .2s ease-out, box-shadow .2s, border-color .2s;
}
.kpi.good   { --tone: var(--good);   --tone-soft: rgba(47, 125, 50, .10); }
.kpi.warn   { --tone: var(--warn);   --tone-soft: rgba(194, 65, 12, .10); }
.kpi.danger { --tone: var(--danger); --tone-soft: rgba(180, 35, 24, .09); }
.kpi.info   { --tone: var(--info);   --tone-soft: rgba(10, 88, 120, .10); }

/* شريط بلون الحالة على الطرف */
.kpi::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 4px;
    background: var(--tone);
    opacity: .85;
}
.kpi:hover { transform: translateY(-2px); border-color: var(--tone); box-shadow: 0 14px 30px -18px rgba(7, 63, 87, .45); }

.kpi-icon {
    grid-row: 1 / span 3;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--tone-soft);
    color: var(--tone);
}
.kpi-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.kpi-label { font-size: .86rem; font-weight: 600; color: var(--muted); }
.kpi-value { font-size: 1.7rem; font-weight: 700; line-height: 1.15; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi-note  { font-size: .76rem; color: var(--muted); }

.kpi-go {
    position: absolute;
    top: 14px;
    inset-inline-end: 14px;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--tone);
    stroke-width: 2;
    opacity: 0;
    transition: opacity .2s;
}
[dir="rtl"] .kpi-go { transform: scaleX(-1); }
.kpi:hover .kpi-go { opacity: 1; }

/* البطاقات الكبيرة */
.kpi.is-hero { padding: 20px 22px; background: linear-gradient(135deg, var(--tone-soft), #fff 70%); }
.kpi.is-hero .kpi-icon { width: 50px; height: 50px; }
.kpi.is-hero .kpi-value { font-size: 2.5rem; }

/* هيكل التحميل */
.kpi.is-skeleton {
    min-height: 92px;
    opacity: 1;
    background: linear-gradient(90deg, #fff 0%, var(--mist) 50%, #fff 100%);
    background-size: 200% 100%;
    animation: shimmer 1.2s linear infinite;
}
.kpi.is-skeleton::before { display: none; }
.kpi.is-hero.is-skeleton { min-height: 120px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.dash-hint { margin: 2px 0 14px; font-size: .8rem; color: var(--muted); }

/* الرسوم */
.dash-charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.chart-panel { display: grid; gap: 10px; align-content: start; }
.chart-panel.is-wide { grid-column: 1 / -1; }
.chart-panel h3 { margin: 0; font-size: 1rem; }
.chart-empty { margin: 0; padding: 30px 0; text-align: center; color: var(--muted); font-size: .9rem; }

/* رسم الأعمدة (سلسلة واحدة، الوقت من الشمال لليمين) */
.colchart { --bar: var(--petrol); position: relative; height: 220px; padding: 22px 0 22px 34px; }
.colchart.warn { --bar: var(--warn); }
.colchart-grid { position: absolute; inset: 22px 0 22px 34px; pointer-events: none; }
.grid-line { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); }
.grid-line span { position: absolute; left: -34px; top: -9px; width: 28px; text-align: right; font-size: .7rem; color: var(--muted); }
.colchart-cols { position: relative; height: 100%; display: flex; align-items: flex-end; gap: 2px; }
.col {
    position: relative;
    flex: 1;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 3px;
    border: 0;
    background: none;
    border-radius: 6px;
}
.col:hover { background: rgba(10, 88, 120, .05); }
.col-bar {
    position: relative;
    width: 100%;
    max-width: 30px;
    min-height: 2px;
    background: var(--bar);
    opacity: .78;
    border-radius: 4px 4px 0 0;
    transition: opacity .15s, height .4s ease-out;
}
.col:hover .col-bar, .col.is-selected .col-bar { opacity: 1; }
.col.is-selected .col-bar { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--lemon); }
.col-value {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 3px;
    font-size: .72rem;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
}
.col-label { position: absolute; bottom: -20px; font-size: .68rem; color: var(--muted); white-space: nowrap; }
.col-tip {
    position: absolute;
    top: -20px;
    z-index: 3;
    display: none;
    padding: 4px 9px;
    border-radius: 8px;
    background: var(--ink);
    color: #fff;
    font-size: .75rem;
    white-space: nowrap;
    pointer-events: none;
}
.col-tip b { margin-inline-start: 4px; }
.col:hover .col-tip { display: block; }

/* قائمة الأعمدة الأفقية */
.barlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.barlist button {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: inherit;
    font: inherit;
    text-align: start;
}
.barlist button:hover { background: var(--mist); }
.bar-label { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 10px; border-radius: 99px; background: var(--mist); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 99px; background: var(--petrol); transition: width .5s ease-out; }
.barlist.warn .bar-fill { background: var(--warn); }
.barlist.info .bar-fill { background: var(--info); }
.bar-value { min-width: 34px; text-align: end; font-weight: 700; font-size: .9rem; }

/* نافذة التفاصيل */
.dlg-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(7, 63, 87, .45);
    backdrop-filter: blur(3px);
    opacity: 0;
    animation: fade-in .2s ease-out forwards;
}
.dlg {
    position: fixed;
    z-index: 91;
    top: 50%;
    left: 50%;
    width: min(1150px, calc(100vw - 32px));
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px 22px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 30px 80px -20px rgba(7, 63, 87, .6);
    transform: translate(-50%, -50%);
    animation: dlg-in .25s ease-out;
    outline: none;
}
@keyframes dlg-in { from { opacity: 0; transform: translate(-50%, -46%) scale(.98); } }

.dlg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dlg-head h2 { margin: 0; font-size: 1.25rem; }
.dlg-head p { margin: 2px 0 0; font-size: .85rem; color: var(--muted); }
.dlg-x {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--muted);
}
.dlg-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.dlg-x:hover { color: var(--danger); border-color: var(--danger); }

.dlg-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dlg-search {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border: 1.5px solid var(--line);
    border-radius: 99px;
    background: var(--mist);
}
.dlg-search:focus-within { border-color: var(--petrol); background: #fff; }
.dlg-search svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; flex-shrink: 0; }
.dlg-search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font: inherit; font-size: .9rem; }
.table-wrap.dlg-table { flex: 1; min-height: 120px; max-height: none; }
.dlg-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 50px 0; color: var(--muted); }
.spinner.is-small { width: 14px; height: 14px; border-width: 2px; display: inline-block; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--petrol); animation: spin .8s linear infinite; }


/* ---------------------------------------------------------------------
   12) نوافذ "جارٍ التحميل" + تفاصيل نافذة لوحة المتابعة
       (Components/Widgets/LoadingOverlay.razor و #page-loader فى App.razor)
   --------------------------------------------------------------------- */
.loader.is-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(241, 246, 247, .6);
    backdrop-filter: blur(4px);
    opacity: 0;
    animation: fade-in .25s ease-out .25s forwards;   /* بتظهر بعد ربع ثانية: مفيش رمشة لو التحميل سريع */
}
.loader.is-inline { display: grid; place-items: center; padding: 34px 0; }

#page-loader { display: none; }
#page-loader.is-on { display: grid; }

.loader-card {
    display: grid;
    justify-items: center;
    gap: 6px;
    width: min(360px, 100%);
    padding: 26px 30px 20px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 24px 60px -24px rgba(7, 63, 87, .45);
    text-align: center;
}
.is-inline .loader-card { border: 0; box-shadow: none; background: transparent; }

.loader-mark { position: relative; width: 84px; height: 84px; display: grid; place-items: center; margin-bottom: 4px; }
.loader-mark img { width: 44px; animation: mark-float 2.4s ease-in-out infinite; }
.loader-ring { position: absolute; inset: 0; width: 100%; height: 100%; animation: spin 1.3s linear infinite; }
.ring-track { fill: none; stroke: var(--mist); stroke-width: 5; }
.ring-arc { fill: none; stroke: var(--lemon); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 62 158; }

.loader-title { font-size: 1.05rem; color: var(--petrol-deep); }
.loader-msg { font-size: .86rem; color: var(--muted); }
.loader-bar { position: relative; width: 100%; height: 4px; margin-top: 8px; border-radius: 99px; background: var(--mist); overflow: hidden; }
.loader-bar i {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--petrol), var(--lemon));
    animation: loader-slide 1.2s ease-in-out infinite;
}
@keyframes loader-slide { from { left: -40%; } to { left: 100%; } }
.loader-time { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* شرائح المعلومات تحت عنوان النافذة */
.dlg-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip-info {
    padding: 2px 10px;
    border-radius: 99px;
    background: var(--mist);
    border: 1px solid var(--line);
    font-size: .78rem;
    color: var(--petrol-deep);
}

/* "ما الذي تعرضه هذه القائمة؟" */
.dlg-def {
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--lemon-soft);
    border: 1px solid rgba(232, 168, 24, .35);
    font-size: .85rem;
}
.dlg-def summary { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--petrol-deep); list-style: none; }
.dlg-def summary::-webkit-details-marker { display: none; }
.dlg-def summary svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.dlg-def p { margin: 4px 0 0; color: var(--ink); line-height: 1.7; }

/* بطاقات الإحصائيات */
.dlg-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.stat {
    display: grid;
    align-content: start;
    gap: 1px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}
.stat-label { font-size: .75rem; font-weight: 600; color: var(--muted); }
.stat-value { font-size: 1.35rem; font-weight: 700; color: var(--petrol-deep); line-height: 1.2; }
.stat-note { font-size: .72rem; color: var(--muted); overflow-wrap: anywhere; }
.dlg-empty { padding: 40px 0; text-align: center; color: var(--muted); }


/* ---------------------------------------------------------------------
   13) لوحة المتابعة v2: الفترة + المقارنة + القوائم اللى فيها بحث
       (SearchSelect, وسوم البطاقات, ▲▼, أكثر 10, مؤشرات الفترة)
   --------------------------------------------------------------------- */
.dash-period { color: var(--petrol-deep); }
.dash-meta { font-size: .8rem; color: var(--muted); }

/* ---- القائمة المنسدلة اللى فيها بحث (Components/Widgets/SearchSelect.razor) ---- */
.ss { position: relative; display: grid; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.ss-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 38px;
    min-width: 190px;
    max-width: 300px;
    padding: 0 12px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: .9rem;
    font-weight: 500;
    text-align: start;
}
.ss-btn:hover:not(:disabled), .ss.is-open .ss-btn { border-color: var(--petrol); }
.ss-value { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ss-chev { flex: none; width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; transition: transform .2s; }
.ss.is-open .ss-chev { transform: rotate(180deg); }
.ss.is-period .ss-btn { min-width: 170px; }
.ss.is-branch .ss-btn { min-width: 230px; }

.ss-backdrop { position: fixed; inset: 0; z-index: 40; }
.ss-pop {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-start: 0;
    z-index: 41;
    width: max(100%, 300px);
    max-width: calc(100vw - 32px);
    padding: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 18px 40px -16px rgba(7, 63, 87, .45);
    animation: ss-in .14s ease-out;
    color: var(--ink);
    font-weight: 400;
}
@keyframes ss-in { from { opacity: 0; transform: translateY(-4px); } }

.ss-search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 10px;
    border: 1.5px solid var(--line);
    border-radius: 9px;
    background: var(--mist);
}
.ss-search:focus-within { border-color: var(--petrol); background: #fff; }
.ss-search svg { flex: none; width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.ss-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; font: inherit; font-size: .9rem; color: var(--ink); }

.ss-list { list-style: none; margin: 6px 0 0; padding: 0; max-height: 300px; overflow-y: auto; scrollbar-width: thin; }
.ss-opt {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    column-gap: 8px;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--ink);
    font: inherit;
    font-size: .9rem;
    text-align: start;
}
.ss-opt.is-active { background: var(--mist); }
.ss-opt.is-selected { background: var(--lemon-soft); font-weight: 700; color: var(--petrol-deep); }
.ss-opt-label { overflow: hidden; text-overflow: ellipsis; }
.ss-opt-hint { grid-column: 1; font-size: .74rem; color: var(--muted); }
.ss-check { grid-column: 2; grid-row: 1 / span 2; width: 16px; height: 16px; fill: none; stroke: var(--petrol); stroke-width: 2.4; }
.ss-empty { margin: 0; padding: 18px 6px; text-align: center; color: var(--muted); font-size: .85rem; }
.ss-count { margin: 6px 4px 0; font-size: .7rem; color: var(--muted); text-align: end; }

/* ---- وسم البطاقة (الآن / هذا الشهر) + التغيّر عن الفترة السابقة ---- */
.kpi-label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kpi-tag {
    padding: 1px 7px;
    border-radius: 99px;
    background: var(--mist);
    color: var(--muted);
    font-size: .66rem;
    font-style: normal;
    font-weight: 700;
}
.kpi-tag.is-now { background: rgba(47, 125, 50, .12); color: var(--good); }
.kpi-value { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.kpi-delta {
    padding: 1px 7px;
    border-radius: 99px;
    background: var(--mist);
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
    white-space: nowrap;
    direction: ltr;
    unicode-bidi: isolate;
}
.kpi-delta.bad  { background: #FDECEA; color: var(--danger); }
.kpi-delta.good { background: rgba(47, 125, 50, .12); color: var(--good); }

/* ---- قوائم الأعمدة: الترتيب + سطر صغير + الوحدة ---- */
.barlist.is-ranked button { grid-template-columns: 24px minmax(0, 1.2fr) minmax(0, 1fr) auto; }
.bar-rank {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--mist);
    color: var(--petrol-deep);
    font-size: .72rem;
    font-weight: 700;
}
.barlist li:nth-child(-n+3) .bar-rank { background: var(--lemon); }
.bar-label { display: grid; }
.bar-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .7rem; color: var(--muted); }
.bar-unit { margin-inline-start: 3px; font-size: .68rem; font-weight: 600; color: var(--muted); }
.barlist.is-ranked .bar-fill { background: var(--petrol); }
.barlist.is-ranked.warn .bar-fill { background: var(--warn); }

/* ---- مؤشرات الفترة ---- */
.chart-panel .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 0; }
.panel-tools { display: flex; gap: 6px; }
.kpi-rates { width: 100%; border-collapse: collapse; font-size: .85rem; }
.kpi-rates th { padding: 6px 4px; font-size: .74rem; font-weight: 600; color: var(--muted); text-align: start; border-bottom: 1px solid var(--line); }
.kpi-rates td { padding: 8px 4px; border-bottom: 1px dashed var(--line); }
.kpi-rates tr:last-child td { border-bottom: 0; }
.kpi-rates td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.kpi-rates td.num b { margin-inline-end: 6px; }

/* ---- النافذة: رجوع + الصفوف القابلة للضغط ---- */
.dlg-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
    padding: 3px 10px 3px 8px;
    border: 1px solid var(--line);
    border-radius: 99px;
    background: #fff;
    color: var(--petrol-deep);
    font: inherit;
    font-size: .8rem;
    font-weight: 600;
}
.dlg-back:hover { background: var(--lemon-soft); border-color: var(--lemon-deep); }
.dlg-back svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; transform: scaleX(-1); }
[dir="rtl"] .dlg-back svg { transform: none; }
.dlg-rowhint { margin: 0 0 6px; font-size: .76rem; color: var(--muted); }
.result-table tr.is-clickable { cursor: pointer; }
.result-table tr.is-clickable:hover td { background: var(--lemon-soft); }

@media (max-width: 900px) {
    .dash-filters { width: 100%; }
    .ss, .filter { flex: 1 1 160px; }
    .ss-btn, .ss.is-period .ss-btn, .ss.is-branch .ss-btn, .filter input { min-width: 0; max-width: none; width: 100%; }
}
@media (max-width: 600px) {
    .barlist button { grid-template-columns: minmax(0, 1.7fr) minmax(0, .8fr) auto; gap: 8px; }
    .barlist.is-ranked button { grid-template-columns: 22px minmax(0, 1.7fr) minmax(0, .8fr) auto; }
}


/* ---------------------------------------------------------------------
   14) تقرير الحضور والانصراف (نسخة شاشة الويندوز) + الرسائل + الأرشيف
       Components/Pages/Attendance/Report.razor و Components/AttReport/*
   --------------------------------------------------------------------- */
.rp { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; max-width: 100%; }
.rp > * { min-width: 0; }

/* شريط الأدوات (tileNavPane بلون 0,84,113) - كل زرار شريحة فاتحة بأيقونة */
.rp-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
    padding: 8px 10px; border-radius: 12px;
    background: linear-gradient(135deg, rgb(0, 84, 113), #073F57); color: #fff;
    box-shadow: 0 10px 24px -18px rgba(7, 63, 87, .9);
}
.rp-toolbar .rp-title { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--lemon); padding: 0 6px; }
.rp-toolbar .rp-title svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.rp-tb-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.rp-tb-btns .xb { height: 34px; min-width: 92px; }

/* pnlTop: الفلاتر ← سطر الأدوات ← المراجعات والرصيد ← الدليل والتصدير
   (المقاسات بتتظبط حسب عرض الصفحة نفسها - container queries - مش عرض الشاشة) */
.rp { container-type: inline-size; container-name: rp; }
.rp-top {
    display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px;
    padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px;
}

/* الفلاتر: شبكة 6 أعمدة متساوية - كل الخانات نفس الارتفاع (32px) */
.rp-fields { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px 10px; align-items: end; }
.rp-fields .is-span2 { grid-column: span 2; }
.rp-field { display: grid; gap: 3px; min-width: 0; font-size: .72rem; font-weight: 700; color: var(--muted); }
.rp-field input {
    width: 100%; height: 32px; min-width: 0; padding: 0 8px;
    border: 1.5px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); font: inherit; font-size: .84rem; font-weight: 600;
}
.rp-field.is-ro input { background: #EEF2F4; color: var(--ink); }
.rp-field.is-btn .xb { width: 100%; }
.rp-fields .ss { gap: 3px; min-width: 0; font-size: .72rem; font-weight: 700; }
.rp-fields .ss-btn { width: 100%; height: 32px; min-width: 0; max-width: none; padding: 0 10px; border-radius: 9px; font-size: .84rem; }
.rp-spin { display: flex; align-items: center; width: 100%; height: 32px; border: 1.5px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.rp-spin input { flex: 1; width: 0; min-width: 0; height: 100%; border: 0; border-radius: 0; text-align: center; font: 700 .95rem Tahoma, sans-serif; color: var(--ink); -moz-appearance: textfield; }
.rp-spin input::-webkit-outer-spin-button, .rp-spin input::-webkit-inner-spin-button { -webkit-appearance: none; }
.rp-spin button { width: 30px; height: 100%; border: 0; background: var(--mist); font-size: 1.05rem; font-weight: 700; color: var(--petrol-deep); }
.rp-spin button:hover { background: var(--lemon-soft); }

/* سطر الأدوات تحت الفلاتر */
.rp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 6px 8px; border-radius: 10px; background: var(--mist); }
.rp-lastupd { display: inline-flex; align-items: center; gap: 5px; font-size: .76rem; font-weight: 700; color: #E0503A; }
.rp-lastupd svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.rp-inline-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-inline-start: auto; }
.rp-check { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; color: var(--ink); }
.rp-check input { width: 16px; height: 16px; accent-color: var(--petrol); }
.rp-filesend small { color: var(--muted); font-weight: 500; }

/* دليل الألوان + التصدير: 3 مربعات بنفس الارتفاع */
.rp-legend-exp { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: stretch; }
.rp-legend { list-style: none; margin: 0; padding: 6px 8px; display: grid; gap: 2px; align-content: center; border: 1px solid var(--line); border-radius: 9px; font: 700 .7rem "Times New Roman", serif; }
.rp-legend li { display: flex; align-items: center; gap: 6px; }
.rp-legend i { width: 11px; height: 11px; border: 1px solid #999; flex: none; }
.rp-group { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-width: 0; margin: 0; padding: 4px 10px 6px; border: 1px solid var(--line); border-radius: 9px; font-size: .76rem; }
.rp-group.is-gray { background: #EEF0F2; }
.rp-group legend { padding: 0 4px; font-weight: 700; font-size: .72rem; color: var(--muted); width: auto; float: none; margin: 0; }
.rp-group label { display: inline-flex; align-items: center; gap: 4px; }
.rp-group .rp-xl-btn { margin-inline-start: auto; }

.rp-notes-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font: .78rem "Times New Roman", serif; }
.rp-vac { font-weight: 700; }
.rp-lastnote-cap { color: var(--muted); }
.rp-lastnote { flex: 1; min-width: 160px; min-height: 24px; padding: 4px 8px; border-radius: 6px; background: var(--mist); white-space: pre-wrap; }

/* المراجعات (3 كروت بنفس المقاس) + الرصيد */
.rp-mid { display: grid; grid-template-columns: minmax(0, 1fr) 176px; gap: 10px; align-items: stretch; }
.rp-reviews { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rp-rev { display: grid; grid-template-rows: auto 1fr auto; gap: 5px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: #FBFCFD; }
.rp-rev-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-height: 26px; }
.rp-rev-head .rp-check { font-size: .72rem; line-height: 1.2; }
.rp-rev textarea { width: 100%; height: 100%; min-height: 64px; padding: 6px; border: 1.5px solid var(--line); border-radius: 8px; font: inherit; font-size: .78rem; resize: none; }
.rp-rev textarea:disabled { background: var(--mist); }
.rp-lastrev { height: 18px; padding: 1px 6px; border-radius: 4px; background: rgb(64, 64, 64); color: #fff; font: 700 .68rem "Times New Roman", serif; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* رصيد الأجازات الأسبوعية + الأرشيف */
.rp-quota { display: grid; gap: 6px; align-content: start; }
.rp-q { width: 100%; border-collapse: collapse; font-size: .74rem; text-align: center; border-radius: 8px; overflow: hidden; }
.rp-q caption { caption-side: top; padding: 3px 4px; font-weight: 700; color: #F5F5F5; border-radius: 8px 8px 0 0; }
.rp-q.is-year caption, .rp-q.is-year th { background: rgb(64, 64, 64); color: #F5F5F5; }
.rp-q.is-month caption, .rp-q.is-month th { background: #008080; color: #F5F5F5; }
.rp-q th { padding: 1px; font-weight: 700; }
.rp-q td { padding: 2px; border: 1px solid var(--line); font-weight: 700; background: #fff; height: 22px; }
.rp-arc { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.rp-arc .xb { width: 100%; padding: 0 4px; }

/* الجريد */
.rp-gridbox { overflow: hidden; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 14px; min-height: 260px; }
.rg-tools { position: relative; display: flex; justify-content: flex-end; margin-bottom: 6px; }
.rg-chooser-btn { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; font: inherit; font-size: .76rem; color: var(--muted); }
.rg-chooser-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.rg-chooser-backdrop { position: fixed; inset: 0; z-index: 30; }
.rg-chooser {
    position: absolute; top: 32px; inset-inline-end: 0; z-index: 31; width: 280px; max-height: 360px; overflow: auto;
    padding: 10px; display: grid; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 10px;
    box-shadow: 0 16px 36px -18px rgba(7, 63, 87, .5); font-size: .8rem;
}
.rg-chooser p { margin: 0 0 6px; color: var(--muted); font-size: .74rem; }
.rg-chooser label { display: flex; align-items: center; gap: 6px; }
.rg-chooser small { color: var(--muted); }

.rg-wrap { overflow: auto; max-height: calc(100vh - 380px); min-height: 220px; border: 1px solid #C9C9C9; }
.rg { border-collapse: separate; border-spacing: 0; table-layout: fixed; font: 12.5px "Segoe UI", Tahoma, sans-serif; color: #000; }
.rg th {
    position: sticky; top: 0; z-index: 2;
    padding: 6px 4px; background: rgb(64, 64, 64); color: rgb(229, 195, 101);
    font: 700 12.5px "Segoe UI", sans-serif; text-align: center; white-space: normal; line-height: 1.25;
    border-inline-end: 1px solid #555; border-bottom: 1px solid #222;
}
.rg td {
    padding: 3px 5px; border-inline-end: 1px solid #E2E2E2; border-bottom: 1px solid #E2E2E2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background-clip: padding-box;
}
.rg td.is-num { text-align: center; font-variant-numeric: tabular-nums; }
.rg tbody tr { cursor: pointer; }
.rg tbody tr.is-focused td { background-color: rgb(214, 214, 214); color: #000; }
.rg tfoot td {
    position: sticky; bottom: 0; z-index: 2; padding: 5px; background: #F3F3F3; border-top: 2px solid #999;
    font-weight: 700; text-align: center;
}
.rg-empty { padding: 30px !important; text-align: center; color: var(--muted); white-space: normal !important; }
.rg-btn { text-align: center; padding: 1px !important; }
.rg-btn button { width: 30px; height: 22px; display: inline-grid; place-items: center; border: 1px solid #BBB; border-radius: 5px; background: #fff; color: var(--petrol-deep); }
.rg-btn button:hover { background: var(--lemon); }
.rg-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.rg-note { padding: 0 !important; }
.rg-note input { width: 100%; height: 26px; padding: 0 6px; border: 0; background: transparent; color: inherit; font: inherit; font-style: inherit; }
.rg-note input::placeholder { color: #C0C0C0; font-style: italic; }
.rg-note.is-ro { padding: 3px 6px !important; white-space: nowrap; }
.rg-note input:focus { outline: 2px solid var(--lemon); background: #fff; color: #000; font-style: normal; }

/* pnlDown */
.rp-down { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.rp-totals { display: flex; flex-wrap: wrap; gap: 4px; }
.rp-totals > div { display: grid; min-width: 96px; text-align: center; }
.rp-totals span { padding: 3px 6px; font: 700 .76rem "Segoe UI", sans-serif; }
.rp-totals b { padding: 3px 6px; font: 700 1rem Tahoma, sans-serif; border: 1px solid var(--line); border-top: 0; }
.rp-down-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.rp-down-btns .xb { height: 38px; }

/* شريط التقدم */
.rp-pbar { display: block; width: 260px; max-width: 70vw; height: 8px; border-radius: 99px; background: var(--mist); overflow: hidden; }
.rp-pbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--lemon), var(--petrol)); transition: width .3s; }
.rp-progress .loader-card { gap: 10px; }

/* ألوان عناصر القوائم (زى تلوين قوائم البرنامج) */
.ss-opt.tone-green, .ss-btn.tone-green   { background: #90EE90; color: #000; }
.ss-opt.tone-yellow, .ss-btn.tone-yellow { background: #FFFF00; color: #000; }
.ss-opt.tone-orange, .ss-btn.tone-orange { background: rgb(255, 177, 21); color: #fff; }
.ss-opt.tone-sent, .ss-btn.tone-sent     { background: rgb(93, 226, 109); color: #fff; }
.ss-opt[class*="tone-"].is-active { outline: 2px solid var(--petrol); outline-offset: -2px; }
.sm-info b.tone-green  { background: #90EE90; color: #000; }
.sm-info b.tone-yellow { background: #FFFF00; color: #000; }
.sm-info b.tone-orange { background: rgb(255, 177, 21); color: #fff; }

/* MsgBox */
.mb-backdrop { position: fixed; inset: 0; z-index: 120; background: rgba(7, 63, 87, .45); }
.mb {
    position: fixed; z-index: 121; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: min(440px, calc(100vw - 32px)); padding: 20px 22px; display: grid; gap: 12px;
    background: #fff; border-radius: 14px; box-shadow: 0 30px 60px -20px rgba(7, 63, 87, .6); animation: rise .2s ease-out;
}
.mb:focus { outline: none; }
.mb h3 { margin: 0; font-size: 1.05rem; color: var(--petrol-deep); }
.mb p { margin: 0; white-space: pre-line; line-height: 1.7; }
.mb-actions { display: flex; gap: 8px; justify-content: flex-end; }
.btn-mb { min-width: 84px; height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font: inherit; font-weight: 700; }
.btn-mb.is-primary { background: var(--petrol); border-color: var(--petrol); color: #fff; }
.btn-mb:hover { filter: brightness(1.05); }
.mb-toast {
    position: fixed; z-index: 125; bottom: 24px; left: 50%; transform: translateX(-50%);
    display: grid; gap: 2px; max-width: min(520px, calc(100vw - 32px)); padding: 12px 18px;
    background: var(--petrol-deep); color: #fff; border-radius: 12px; box-shadow: 0 18px 40px -18px rgba(0,0,0,.6);
    white-space: pre-line; animation: rise .2s ease-out; transition: opacity .3s;
}
.mb-toast b { color: var(--lemon); }
.mb-toast.is-out { opacity: 0; }

/* الأجازات الأسبوعية (شكل Dark Side) */
.dlg.wv { width: min(980px, calc(100vw - 24px)); background: #2B2B2B; color: #EEE; }
.dlg.wv .dlg-head h2 { color: #fff; }
.dlg.wv .dlg-x { color: #ddd; }
.wv-info { display: grid; grid-template-columns: 150px 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.wv-info label { display: grid; gap: 3px; font: 700 .78rem "Segoe UI", sans-serif; color: #ccc; }
.wv-info input { height: 26px; padding: 0 8px; border: 1px solid #555; border-radius: 6px; background: #3A3A3A; color: #fff; font: 700 .82rem "Segoe UI", sans-serif; text-align: center; }
.wv-grid-wrap { overflow: auto; }
.wv-grid { width: 100%; border-collapse: collapse; font-size: .78rem; text-align: center; }
.wv-grid th { padding: 6px 4px; background: rgb(64, 64, 64); color: #fff; border: 1px solid #555; }
.wv-grid td { padding: 3px; border: 1px solid #444; }
.wv-day { width: 100%; min-width: 86px; height: 26px; border: 1px solid #777; border-radius: 4px; background: #4A4A4A; color: #fff; font: 600 .76rem "Segoe UI", sans-serif; }
.wv-day:hover { background: var(--lemon); color: #000; }
.wv-day.is-locked { opacity: .55; }
.wv-st.is-no { background: rgb(214, 69, 102); color: #fff; font-weight: 700; }
.wv-st.is-yes { background: rgb(94, 182, 141); color: #fff; font-weight: 700; }

/* الأرشيف */
.dlg.arc { width: min(940px, calc(100vw - 24px)); }
.arc-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; min-height: 360px; }
.arc-tree { overflow: auto; max-height: 60vh; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #8A8A8A0F; }
.arc-tree ul { list-style: none; margin: 0; padding: 0; }
.arc-tree ul ul { padding-inline-start: 28px; }
.arc-tree li { color: var(--c); }
.arc-node { display: flex; align-items: center; gap: 6px; padding: 2px 0; font-size: .86rem; }
.arc-node label { display: inline-flex; align-items: center; gap: 6px; }
.arc-exp { width: 20px; height: 20px; border: 1px solid var(--line); border-radius: 4px; background: #fff; line-height: 1; }
.arc-side { display: grid; gap: 10px; align-content: start; }
.arc-months { width: 140px; border-collapse: collapse; font-size: .8rem; text-align: center; }
.arc-months caption { caption-side: top; font-weight: 700; padding: 4px; }
.arc-months th { background: rgb(64, 64, 64); color: rgb(229, 195, 101); padding: 4px; }
.arc-months td { border: 1px solid var(--line); padding: 3px; }
.arc-buttons { display: grid; gap: 6px; }
.arc-btn { height: 42px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font: inherit; font-weight: 700; color: var(--petrol-deep); }
.arc-btn:hover { background: var(--lemon-soft); border-color: var(--petrol); }
.arc-btn.is-danger { background: #FFFAFA; color: rgb(192, 0, 0); }

/* الإشعارات */
.nt { width: max-content; min-width: 100%; }
.nt td { white-space: normal; }
.nt-msg { line-height: 1.6; }
.nt-close { width: auto !important; padding: 0 10px; font: inherit; font-size: .76rem; font-weight: 700; }

/* طباعة التقرير */
.rp-print h1 { font-size: 16pt; margin: 0 0 4px; }
.rp-print p { margin: 0 0 8px; }
.rp-print .rg-tools { display: none; }
.rp-print .rg-wrap { max-height: none; overflow: visible; border: 0; }
.rp-print .rg { font-size: 9pt; }
.rp-print .rg th { position: static; }
.rp-print .rg tfoot td { position: static; }

@container rp (max-width: 980px) {
    .rp-fields { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .rp-legend-exp { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .rp-legend { grid-column: 1 / -1; }
}
@container rp (max-width: 760px) {
    .rp-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rp-mid { grid-template-columns: minmax(0, 1fr); }
    .rp-quota { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .rp-arc { grid-template-columns: 1fr; align-content: start; }
    .rp-legend-exp { grid-template-columns: minmax(0, 1fr); }
    .rp-inline-btns { margin-inline-start: 0; }
}
@container rp (max-width: 520px) {
    .rp-fields { grid-template-columns: minmax(0, 1fr); }
    .rp-fields .is-span2 { grid-column: auto; }
    .rp-reviews, .rp-quota { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
    .arc-body { grid-template-columns: 1fr; }
    .wv-info { grid-template-columns: 1fr; }
    .rp-toolbar .rp-title { display: none; }
    .rp-tb-btns { width: 100%; }
    .rp-tb-btns .xb { flex: 1 1 calc(33% - 6px); min-width: 0; }
    .rg-wrap { max-height: 70vh; }
}



/* ---------------------------------------------------------------------
   15) الأزرار بأيقونات + الشاشات المساعدة لتقرير الحضور
       Components/Widgets/IconButton.razor و ToolDialog.razor
       Components/AttReport/*Dialog.razor و ReportPreview.razor
   --------------------------------------------------------------------- */

/* ---- IconButton: زرار بأيقونة ولون فاتح (Tone) ---- */
.xb {
    --xb-bg: #F2F5F7; --xb-fg: #3E5260; --xb-bd: #D9E1E6; --xb-hv: #E6ECF0;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 32px; padding: 0 12px; border: 1px solid var(--xb-bd); border-radius: 9px;
    background: var(--xb-bg); color: var(--xb-fg);
    font: inherit; font-size: .8rem; font-weight: 700; line-height: 1; white-space: nowrap;
    transition: background .15s, box-shadow .15s, transform .1s;
}
.xb:hover:not(:disabled) { background: var(--xb-hv); box-shadow: 0 6px 14px -10px var(--xb-fg); transform: translateY(-1px); }
.xb:active:not(:disabled) { transform: translateY(0); box-shadow: none; }
.xb:focus-visible { outline: 2px solid var(--lemon); outline-offset: 2px; }
.xb:disabled { opacity: .5; cursor: not-allowed; }
.xb svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.xb.is-icon { width: 32px; padding: 0; }
.xb.is-sm { height: 26px; padding: 0 8px; border-radius: 7px; font-size: .72rem; gap: 4px; }
.xb.is-sm.is-icon { width: 26px; padding: 0; }
.xb.is-sm svg { width: 14px; height: 14px; }
.xb.is-lg { height: 40px; padding: 0 16px; font-size: .86rem; border-radius: 10px; }
.xb.is-lg svg { width: 18px; height: 18px; }
.xb.is-wide { width: 100%; }
.xb.t-blue   { --xb-bg: #EAF2FD; --xb-fg: #1D4E89; --xb-bd: #C8DCF5; --xb-hv: #D8E7FB; }
.xb.t-green  { --xb-bg: #E8F6EE; --xb-fg: #1C6B3C; --xb-bd: #BFE3CC; --xb-hv: #D5EFDF; }
.xb.t-teal   { --xb-bg: #E3F4F4; --xb-fg: #0E5E5E; --xb-bd: #B7E0E0; --xb-hv: #CFEBEB; }
.xb.t-amber  { --xb-bg: #FFF5DC; --xb-fg: #855600; --xb-bd: #F3DFA6; --xb-hv: #FDEBBE; }
.xb.t-orange { --xb-bg: #FFEEE2; --xb-fg: #9A4300; --xb-bd: #F6CFB2; --xb-hv: #FDDFCB; }
.xb.t-red    { --xb-bg: #FDECEC; --xb-fg: #A12222; --xb-bd: #F3C5C5; --xb-hv: #FADADA; }
.xb.t-violet { --xb-bg: #F1EDFC; --xb-fg: #4B3A8F; --xb-bd: #D9D0F5; --xb-hv: #E5DEFA; }
.xb.t-gray   { --xb-bg: #F2F5F7; --xb-fg: #3E5260; --xb-bd: #D9E1E6; --xb-hv: #E6ECF0; }
.xb.t-gold   { --xb-bg: #FFF7CC; --xb-fg: #6B5300; --xb-bd: #F1DE8A; --xb-hv: #FFEFA3; }
.xb.t-petrol { --xb-bg: #E4F0F5; --xb-fg: #0A5878; --xb-bd: #BCD8E3; --xb-hv: #D2E6EE; }

/* ---- ToolDialog: إطار الشاشات المساعدة ---- */
.dlg.td {
    width: min(var(--td-w, 640px), calc(100vw - 24px));
    max-height: 92vh; padding: 0; gap: 0; overflow: visible;
    border-radius: 16px;
}
.td-head {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 16px;
    border-radius: 16px 16px 0 0;
    background: linear-gradient(135deg, rgb(0, 84, 113), #073F57); color: #FFC905;
}
.td-head h2 { margin: 0; font-size: 1.05rem; font-weight: 700; color: #FFC905; }
.td-ico { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.td-head-extra { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; color: #fff; }
.td-x {
    display: grid; place-items: center; width: 32px; height: 32px; margin-inline-start: auto; flex: none;
    border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff;
}
.td-head-extra + .td-x { margin-inline-start: 0; }
.td-x svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.td-x:hover { background: #B42318; }
.td-body { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; min-width: 0; min-height: 0; padding: 14px 16px; }
.td-body > * { min-width: 0; }   /* عشان الجداول العريضة تعمل سكرول جوه النافذة بدل ما تخرج برّه */
.er .rp-gridbox, .er .er-grid { min-width: 0; overflow: hidden; }
.td-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--mist); border-radius: 0 0 16px 16px; }
.td-busy {
    position: absolute; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; gap: 10px;
    border-radius: 16px; background: rgba(255, 255, 255, .72); color: var(--petrol-deep); font-weight: 700; backdrop-filter: blur(1px);
}
.td-spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--petrol); animation: td-rot .8s linear infinite; }
@keyframes td-rot { to { transform: rotate(360deg); } }
/* المحتوى الطويل بيعمل سكرول جوه النافذة (العنوان والأزرار تحت ثابتين) بدل ما النافذة تطلع برّه الشاشة */
.dlg.td > .td-head, .dlg.td > .td-foot { flex: 0 0 auto; }
.dlg.td > .td-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
.dlg.td.is-max > .td-body { max-height: none; }

/* Skin "Coffee" (الدمج والتعديل بالمصفوفة) */
.td.is-coffee .td-head { background: linear-gradient(135deg, #7A5638, #5A3E2B); color: #FFE6B8; }
.td.is-coffee .td-head h2 { color: #FFE6B8; }
.td.is-coffee .td-body { background: #FBF7F1; }
/* Skin "Dark Side" (الأجازات بالشهر) */
.td.is-dark { background: #2B2B2B; color: #EEE; }
.td.is-dark .td-head { background: #1D1D1D; color: #EEE; }
.td.is-dark .td-head h2 { color: #fff; }

/* نماذج جوه الشاشات */
.td-form { display: grid; gap: 10px; }
.td-form.is-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.td-field { display: grid; gap: 4px; min-width: 0; font-size: .76rem; font-weight: 700; color: #005471; }
.td-field input, .td-field textarea {
    width: 100%; min-width: 0; height: 34px; padding: 0 10px;
    border: 1.5px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); font: inherit; font-size: .88rem; font-weight: 600;
}
.td-field textarea { height: auto; padding: 8px 10px; resize: vertical; }
.td-field input:focus, .td-field textarea:focus { outline: none; border-color: var(--petrol); }
.td-field input:disabled { background: #EEF2F4; color: var(--muted); }
.td-field.is-row { grid-template-columns: 170px minmax(0, 1fr); align-items: center; }
.td-field.is-row.is-sm { grid-template-columns: 56px minmax(0, 1fr); }
.td-ss { min-width: 0; font-size: .76rem; font-weight: 700; color: #005471; }
.td-ss .ss-btn { width: 100%; min-width: 0; max-width: none; height: 36px; background: #FFF8DC; font-weight: 700; }
.td-ss.is-wide .ss-btn { background: #E8E8E8; }
.td-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.td-actions.is-split > * { flex: 1 1 0; }
.td-check { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 700; color: var(--ink); }
.td-check input { width: 16px; height: 16px; accent-color: var(--petrol); }
.td-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); }
.td-tabs button { height: 34px; padding: 0 16px; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; background: transparent; font: inherit; font-size: .84rem; font-weight: 700; color: var(--muted); }
.td-tabs button.is-on { color: var(--petrol); border-bottom-color: var(--petrol); }
.td-tabpage { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; background: #FCFDFD; }

/* تعديل دوام موظف (ShiftChange) */
dl.sc-info { margin: 0; display: grid; gap: 2px; padding: 8px 12px; border: 1px solid #F5D2C8; border-radius: 10px; background: #FFF8F6; }
.sc-info div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px; align-items: center; min-height: 26px; }
.sc-info dt, .sc-info dd { margin: 0; font: 700 .9rem "Times New Roman", serif; color: Tomato; }
.sc-info dd { color: #C2391F; }
.sc-more { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 10px; }
.sc-radios { display: flex; flex-wrap: wrap; gap: 16px; font-size: .82rem; font-weight: 700; }
.sc-radios label { display: inline-flex; align-items: center; gap: 6px; }
.sc-def { display: grid; }
.sc-times { display: grid; grid-template-columns: minmax(0, 1fr) 130px; gap: 8px; }

/* التعديل بالمصفوفة + الدمج */
.sm-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.sm-info { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; align-items: center; font-size: .82rem; }
.sm-info span { color: #6B5240; font-weight: 700; }
.sm-info b { min-height: 24px; padding: 3px 8px; border-radius: 6px; }
.sm-info b.is-ro { background: #E0E0E0; color: #333; }
.sm-panel { display: grid; gap: 8px; padding: 10px; border: 1px solid #E2D3C1; border-radius: 10px; background: #FFFDF9; }
.sm-note { margin: 0; color: #D00; font: 700 .86rem "Times New Roman", serif; }
.mr-way { margin: 0; padding: 4px 10px 8px; border: 1px solid #E2D3C1; border-radius: 9px; }
.mr-way legend { padding: 0 4px; font-size: .76rem; font-weight: 700; color: #6B5240; }
.mg-wrap { overflow: auto; max-height: 52vh; border: 1px solid #CDBFAE; border-radius: 8px; background: #fff; }
.mg { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font: 12.5px "Segoe UI", Tahoma, sans-serif; color: #000; }
.mg th { position: sticky; top: 0; z-index: 1; padding: 6px 4px; background: #A0A0A0; color: #111; font: 700 11px Tahoma, sans-serif; text-align: center; border-bottom: 1px solid #888; }
.mg td { padding: 4px 6px; border-bottom: 1px solid #E5E5E5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mg tbody tr { cursor: pointer; }
.mg tbody tr:nth-child(even) td { background: Gainsboro; }
.mg tbody tr:hover td { background: #FFF6CF; }
.mg tbody tr.is-sel td { background: #CDE4F7; }
.mg .mg-date { color: Purple; font-weight: 700; text-align: center; font-size: 11px; }
.mg .mg-time { font-weight: 700; text-align: center; font-size: 11px; }
.mg-chk { text-align: center; }
.mg-box { display: inline-grid; place-items: center; width: 16px; height: 16px; border: 1.5px solid #7A6A5A; border-radius: 4px; background: #fff; vertical-align: middle; cursor: pointer; }
.mg-box.is-on { background: var(--petrol); border-color: var(--petrol); }
.mg-box.is-on::after { content: ""; width: 8px; height: 4px; margin-top: -2px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg); }

/* تطبيق جزاء (Punishment) - إطار بترولى */
.td.is-punish { border: 5px solid rgb(0, 84, 113); }
.td.is-punish .td-head { border-radius: 10px 10px 0 0; }
dl.pn-info { margin: 0; display: grid; gap: 2px; }
.pn-info div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px; align-items: center; min-height: 26px; font-weight: 700; }
.pn-info dt { color: #005471; }
.pn-info dd { margin: 0; }
.pn-from { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 700; font-size: .84rem; color: #005471; }
.pn-from label { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 7px; color: #000; font-size: .8rem; }
.pn-from .is-bas { background: rgb(159, 234, 152); }
.pn-from .is-add { background: rgb(255, 224, 0); }
.pn-spin { display: flex; height: 34px; border: 1.5px solid var(--line); border-radius: 9px; overflow: hidden; }
.pn-spin input { flex: 1; width: 0; height: 100%; border: 0 !important; border-radius: 0 !important; background: rgb(255, 255, 192) !important; text-align: center; }
.pn-spin button { width: 34px; border: 0; background: var(--mist); font-weight: 700; font-size: 1rem; color: var(--petrol-deep); }

/* الإشعار (check_notify) */
.nf-who { margin: 0; font-weight: 700; color: var(--petrol-deep); }
.nf-who small { color: var(--muted); font-weight: 500; }
.nf-msg { width: 100%; min-height: 220px; padding: 10px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; font-size: .9rem; resize: vertical; }
.nf-msg:focus { outline: none; border-color: var(--petrol); }
.nf-msg[readonly] { background: var(--mist); }

/* جداول العمل ودوامات الفروع (SectionTimeRep) */
.st-wrap { overflow: auto; max-height: 56vh; border: 1px solid var(--line); border-radius: 8px; }
.st { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font: 12.5px "Segoe UI", Tahoma, sans-serif; }
.st th { position: sticky; top: 0; padding: 7px 6px; background: rgb(64, 64, 64); color: rgb(229, 195, 101); font-weight: 700; text-align: center; }
.st td { padding: 4px 8px; border-bottom: 1px solid #E8E8E8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st tbody tr:nth-child(even) td { background: #F7F9FA; }
.st .is-num { text-align: center; font-variant-numeric: tabular-nums; }
.st .is-on { color: #1C6B3C; font-weight: 700; text-align: center; }
.st .is-off { color: #A12222; font-weight: 700; text-align: center; }

/* الأجازات بالشهر (Dark Side) */
.mw-info { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 4px 8px; align-items: center; }
.mw-info label { display: contents; }
.mw-info label span { font: 700 .78rem "Segoe UI", sans-serif; color: #CCC; }
.mw-info input { height: 26px; padding: 0 8px; border: 1px solid #555; border-radius: 6px; background: #3A3A3A; color: #fff; font: 700 .82rem "Segoe UI", sans-serif; }
.mw-nav { grid-column: 1 / -1; display: flex; gap: 6px; justify-content: flex-end; }
.mw-q { width: 100%; border-collapse: collapse; text-align: center; font-size: .78rem; }
.mw-q th { padding: 4px; background: rgb(64, 64, 64); color: WhiteSmoke; font-weight: 700; border: 1px solid #222; }
.mw-q td { padding: 4px; border: 1px solid #444; background: #333; color: #fff; font-weight: 700; }
.mw-grid-wrap { overflow: auto; max-height: 46vh; border: 1px solid #444; border-radius: 6px; }
.mw-grid { width: 100%; border-collapse: collapse; font-size: .8rem; text-align: center; }
.mw-grid th { position: sticky; top: 0; padding: 6px; background: rgb(97, 161, 184); color: #fff; }
.mw-grid td { padding: 3px 6px; border-bottom: 1px solid #3A3A3A; }
.mw-grid td.is-no { background: rgb(214, 69, 102); color: #fff; font-weight: 700; }
.mw-grid td.is-yes { background: rgb(94, 182, 141); color: #fff; font-weight: 700; }
.mw-day button { width: 100%; height: 26px; border: 1px solid #777; border-radius: 5px; background: #4A4A4A; color: #fff; font: 600 .78rem "Segoe UI", sans-serif; }
.mw-day button:hover { background: var(--lemon); color: #000; }
.mw-day.is-vac button { background: rgb(214, 69, 102); color: #000; }

/* الأجازات الأسبوعية بالسنة (شيت زى الإكسل) */
.yw-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #F7F9FB; }
.yw-sup { display: flex; align-items: center; gap: 8px; font-size: .84rem; }
.yw-sup span { color: var(--muted); font-weight: 700; }
.yw-year { padding: 3px 10px; border-radius: 7px; background: var(--petrol); color: #fff !important; font-weight: 700; }
.yw-show { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0; padding: 4px 10px 6px; border: 1px solid var(--line); border-radius: 9px; font-size: .8rem; }
.yw-show legend { padding: 0 4px; font-size: .74rem; font-weight: 700; color: var(--muted); }
.yw-show label { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.yw-emp { width: 110px; height: 28px; padding: 0 8px; border: 1.5px solid var(--line); border-radius: 7px; font: inherit; }
.yw-months { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.yw-m { display: inline-flex; align-items: center; gap: 3px; height: 26px; padding: 0 7px; border-radius: 6px; font: 700 .72rem "Segoe UI", sans-serif; }
.yw-m input { width: 13px; height: 13px; }
.yw-pager { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: .82rem; font-weight: 700; color: var(--muted); }
.yw-body { display: grid; gap: 8px; }
.yw-empty { padding: 40px; text-align: center; color: var(--muted); border: 1.5px dashed var(--line); border-radius: 10px; }
.yw-sheet-wrap { overflow: auto; max-height: calc(92vh - 260px); border: 1px solid #D4D4D4; background: #fff; }
.yw-sheet { border-collapse: collapse; table-layout: fixed; font: 11.5px Calibri, "Segoe UI", sans-serif; color: #000; }
.yw-sheet thead th { position: sticky; top: 0; z-index: 2; height: 20px; background: #F3F3F3; color: #555; font-weight: 400; border: 1px solid #D4D4D4; }
.yw-sheet tbody th { position: sticky; left: 0; z-index: 1; background: #F3F3F3; color: #555; font-weight: 400; border: 1px solid #D4D4D4; }
.yw-sheet td { height: 20px; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* تقرير الموظف */
.er-who { font-weight: 700; color: #fff; }
.er-who small { color: #C9E3EE; font-weight: 500; }
.er-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--lemon-soft); font-size: .84rem; }
/* الجريد جوه النافذة: ماتخرجش برّه - بيسكرول جوه النافذة بالعرض والطول */
.dlg.td.er .td-body { overflow: hidden; }
.td-body > * { min-width: 0; }
.er-grid { min-width: 0; max-width: 100%; overflow: hidden; }
.er-grid .rg-wrap { max-width: 100%; max-height: calc(92vh - 300px); }
.er-totals { margin-inline-end: auto; }

/* ---- معاينة التقرير بشكل الكريستال (AttendanceReport.rpt) ---- */
.pv-dlg .td-body { background: #E6EBEE; }
.pv-stage { overflow: auto; max-height: calc(92vh - 110px); padding: 6px; }
.pv-page {
    position: relative; display: flex; flex-direction: column; gap: 6px;
    width: 277mm; min-height: 190mm; margin: 0 auto 14px; padding: 7mm 8mm 10mm;
    background: #fff; color: #000; font: 9pt Tahoma, "Segoe UI", sans-serif;
    box-shadow: 0 10px 30px -16px rgba(0, 0, 0, .5);
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.pv-head { display: grid; grid-template-columns: 1fr 1.6fr 1fr; align-items: start; gap: 8px; }
.pv-hr { display: grid; gap: 2px; color: #F28C28; }
.pv-hr b { font-size: 12pt; }
.pv-hr span { font-size: 9.5pt; }
.pv-title { text-align: center; }
.pv-title h1 { margin: 0; font: 700 17pt Tahoma, sans-serif; color: #000; }
.pv-title h2 { margin: 1px 0 4px; font: 700 9.5pt Tahoma, sans-serif; letter-spacing: .06em; color: #000; }
.pv-title p { display: inline-flex; align-items: center; gap: 10px; margin: 0; padding-bottom: 2px; border-bottom: 1.5px solid #F28C28; }
.pv-title p span { color: #F28C28; font-weight: 700; }
.pv-title p b { min-width: 34px; font-size: 11pt; }
.pv-logo { display: grid; justify-items: end; gap: 4px; }
.pv-logo img { width: 92px; height: auto; }
.pv-printed { display: flex; gap: 10px; font-size: 7.5pt; color: #333; }
.pv-emp { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 4px 0; }
.pv-cap { color: #F28C28; font-weight: 700; font-size: 9pt; }
.pv-emp b { min-width: 60px; padding: 1px 8px; border-bottom: 1px dotted #999; font-size: 9.5pt; }
.pv-emp b + .pv-cap { margin-inline-start: 16px; }
.pv-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.pv-table th { padding: 4px 2px; background: rgb(64, 64, 64); color: #fff; font: 700 7.5pt Tahoma, sans-serif; text-align: center; border: 1px solid #222; line-height: 1.2; }
.pv-table td { height: 6.2mm; padding: 1px 3px; border: 1px solid #9A9A9A; font-size: 7.5pt; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-table td.is-num { text-align: center; }
.pv-table tbody tr:nth-child(even) td { background: #F7F7F7; }
.pv-foot { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; align-items: start; margin-top: 8px; }
.pv-revs { display: grid; gap: 4px; }
.pv-revs div { display: grid; grid-template-columns: 150px 90px minmax(0, 1fr); gap: 6px; align-items: start; font-size: 8.5pt; }
.pv-revs p { margin: 0; white-space: pre-wrap; }
.pv-sum { width: 100%; border-collapse: collapse; text-align: center; }
.pv-sum th { padding: 4px; background: #F7941D; color: #fff; font: 700 8.5pt Tahoma, sans-serif; border: 1px solid #C46F10; }
.pv-sum td { padding: 4px; border: 1px solid #555; font: 700 10pt Tahoma, sans-serif; }
.pv-pageno { position: absolute; bottom: 4mm; left: 8mm; font-size: 8pt; color: #333; }

@page pv-landscape { size: A4 landscape; margin: 6mm; }
@media print {
    body.print-mode #print-root .pv-page {
        page: pv-landscape; break-after: page;
        width: auto; min-height: 196mm; margin: 0; box-shadow: none;
    }
    body.print-mode #print-root .pv-page:last-child { break-after: auto; }
}

@media (max-width: 700px) {
    .td-form.is-2, .sc-times { grid-template-columns: minmax(0, 1fr); }
    .td-field.is-row { grid-template-columns: minmax(0, 1fr); }
    .td-actions.is-split > * { flex-basis: 100%; }
    .pv-page { transform-origin: top right; }
}


/* ---------------------------------------------------------------------
   16) الإدارة: صلاحيات المستخدمين + القوائم والصفحات + "ليس لديك صلاحية"
       (Components/Pages/Admin/*.razor و MainLayout.razor)
   --------------------------------------------------------------------- */

a.btn-ghost { text-decoration: none; }

/* القائمة الجانبية: مفيش أنظمة / نظام الإدارة */
.nav-empty { margin: 4px 14px; font-size: .82rem; line-height: 1.5; color: rgba(255, 255, 255, .55); }
.nav-group.is-admin { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, .1); }

/* ليس لديك صلاحية */
.denied {
    max-width: 520px;
    margin: 8vh auto 0;
    display: grid;
    justify-items: center;
    gap: 8px;
    text-align: center;
    animation: rise .4s ease-out both;
}
.denied-icon {
    display: grid; place-items: center;
    width: 76px; height: 76px; margin-bottom: 6px;
    border-radius: 24px;
    background: var(--lemon-soft);
    color: var(--lemon-deep);
}
.denied-icon svg { width: 38px; height: 38px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.denied h1 { font-size: 1.4rem; margin: 0; }
.denied p { color: var(--muted); margin: 0 0 10px; }

/* هيكل شاشة الصلاحيات: عمود المستخدم + الشجرة */
.pm { display: grid; grid-template-columns: minmax(270px, 330px) minmax(0, 1fr); gap: 18px; align-items: start; padding-bottom: 90px; }
.pm-side { display: grid; gap: 14px; position: sticky; top: 16px; }
.pm-card { padding: 18px; }
.pm-h2 { font-size: .95rem; margin: 0 0 12px; color: var(--petrol-deep); }
.pm-note { margin: 10px 0 0; font-size: .8rem; color: var(--muted); }
.pm-loading { display: flex; align-items: center; gap: 10px; color: var(--muted); }

.pm-who { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.pm-who strong { display: block; font-size: 1.02rem; line-height: 1.3; }
.pm-who small { color: var(--muted); font-size: .8rem; }
.pm-avatar {
    flex: none; display: grid; place-items: center;
    width: 46px; height: 46px; border-radius: 14px;
    background: var(--lemon); color: var(--petrol-deep);
    font-weight: 700; font-size: 1.2rem;
}
.pm-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pm-tag { padding: 1px 10px; border-radius: 99px; font-size: .75rem; font-weight: 600; background: var(--mist); color: var(--petrol); }
.pm-tag.is-admin { background: var(--petrol-deep); color: var(--lemon); }

.pm-meter { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.pm-meter-text { display: flex; align-items: baseline; gap: 6px; margin-bottom: 6px; }
.pm-meter-text b { font-size: 1.5rem; color: var(--petrol-deep); font-variant-numeric: tabular-nums; }
.pm-meter-text span { color: var(--muted); font-size: .85rem; }
.pm-meter-bar { display: block; height: 6px; border-radius: 99px; background: var(--mist); overflow: hidden; }
.pm-meter-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--leaf), var(--lemon-deep)); transition: width .35s ease; }

.pm-quick { display: flex; gap: 8px; flex-wrap: wrap; }
.pm-quick .xb { flex: 1; }
.pm-copy { display: flex; align-items: flex-end; gap: 8px; margin-top: 14px; }
.pm-copy .ss { flex: 1; min-width: 0; }

/* سجل التغييرات */
.pm-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 320px; overflow: auto; }
.pm-log li { display: flex; gap: 10px; align-items: flex-start; }
.pm-log-ico {
    flex: none; display: grid; place-items: center;
    width: 22px; height: 22px; border-radius: 7px;
    font-weight: 700; font-size: .95rem; line-height: 1;
}
.pm-log .is-grant .pm-log-ico  { background: #E8F6EE; color: #1C6B3C; }
.pm-log .is-revoke .pm-log-ico { background: #FDECEC; color: #A12222; }
.pm-log-text { display: grid; line-height: 1.35; }
.pm-log-text b { font-size: .86rem; font-weight: 600; }
.pm-log-text small { font-size: .74rem; color: var(--muted); }

/* الشجرة */
.pm-main { display: grid; gap: 12px; }
.pm-empty {
    display: grid; justify-items: center; gap: 6px;
    padding: 70px 24px; text-align: center;
    border: 1.5px dashed var(--line); border-radius: var(--radius);
    color: var(--muted); background: rgba(255, 255, 255, .5);
}
.pm-empty strong { color: var(--ink); font-size: 1.05rem; }
.pm-empty-ico { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; background: #fff; border: 1px solid var(--line); color: var(--petrol); margin-bottom: 6px; }
.pm-empty-ico svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.pm-banner {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: 12px;
    background: var(--petrol-deep); color: #fff; font-size: .9rem;
}
.pm-banner svg { flex: none; width: 22px; height: 22px; fill: none; stroke: var(--lemon); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.pm-search {
    display: flex; align-items: center; gap: 8px;
    height: 42px; padding: 0 14px;
    background: #fff; border: 1px solid var(--line); border-radius: 12px;
}
.pm-search:focus-within { border-color: var(--petrol); box-shadow: 0 0 0 3px rgba(10, 88, 120, .1); }
.pm-search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.pm-search input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; color: var(--ink); }

.pm-mod {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s;
}
.pm-mod.has-on { border-color: rgba(56, 152, 56, .45); box-shadow: 0 8px 22px -18px rgba(56, 152, 56, .8); }
.pm-mod-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.pm-mod:not(.is-folded) .pm-mod-head { border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #FBFDFD, #fff); }
.pm-mod-icon {
    flex: none; display: grid; place-items: center;
    width: 38px; height: 38px; border-radius: 11px;
    background: var(--mist); color: var(--petrol);
}
.pm-mod-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.pm-mod-title { flex: 1; display: grid; line-height: 1.3; min-width: 0; }
.pm-mod-title strong { font-size: 1rem; }
.pm-mod-title small { color: var(--muted); font-size: .78rem; }

.pm-fold {
    flex: none; display: grid; place-items: center;
    width: 32px; height: 32px; border-radius: 9px;
    border: 1px solid var(--line); background: #fff; color: var(--muted);
}
.pm-fold svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; transition: transform .2s; }
.pm-mod.is-folded .pm-fold svg { transform: rotate(-90deg); }
[dir="rtl"] .pm-mod.is-folded .pm-fold svg { transform: rotate(90deg); }
.pm-fold:hover { border-color: var(--lemon-deep); background: var(--lemon-soft); }

/* مربع الصح (3 حالات: true / mixed / false) */
.pm-check {
    flex: none; display: grid; place-items: center;
    width: 24px; height: 24px; padding: 0;
    border: 2px solid #B9C9D0; border-radius: 7px;
    background: #fff; color: transparent;
    transition: background .15s, border-color .15s, color .15s;
}
.pm-check svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.pm-check[aria-checked="true"], .pm-row.is-on .pm-check { background: var(--leaf); border-color: var(--leaf); color: #fff; }
.pm-check[aria-checked="mixed"] { background: var(--lemon); border-color: var(--lemon-deep); color: var(--petrol-deep); }
.pm-check:hover:not(:disabled) { border-color: var(--leaf); }
.pm-check:disabled { opacity: .55; }
.pm-check.is-sm { width: 20px; height: 20px; border-radius: 6px; }
.pm-check.is-sm svg { width: 13px; height: 13px; }

.pm-pages { list-style: none; margin: 0; padding: 6px; display: grid; gap: 2px; }
.pm-row {
    width: 100%;
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    border: 0; border-radius: 10px;
    background: transparent; color: var(--ink);
    font: inherit; text-align: start;
    transition: background .15s;
}
.pm-row:hover:not(:disabled) { background: var(--mist); }
.pm-row:disabled { cursor: default; }
.pm-row.is-on { background: rgba(56, 152, 56, .06); }
.pm-row.is-changed { box-shadow: inset 3px 0 0 var(--lemon-deep); }
[dir="rtl"] .pm-row.is-changed { box-shadow: inset -3px 0 0 var(--lemon-deep); }
.pm-page-icon { flex: none; color: var(--muted); display: grid; }
.pm-page-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pm-page-title { font-weight: 500; }
.pm-href {
    margin-inline-start: auto;
    padding: 1px 8px; border-radius: 6px;
    background: var(--mist); color: var(--muted);
    font-size: .74rem; white-space: nowrap;
}

.pm-badge {
    flex: none;
    padding: 1px 9px; border-radius: 99px;
    font-size: .72rem; font-weight: 600; white-space: nowrap;
    background: var(--mist); color: var(--muted);
}
.pm-badge.is-soon    { background: #FFF5DC; color: #855600; }
.pm-badge.is-hidden  { background: #F2F5F7; color: #3E5260; border: 1px dashed #B9C9D0; }
.pm-badge.is-changed { background: var(--lemon-soft); color: #6B5300; }
.pm-badge.is-ready   { background: #E8F6EE; color: #1C6B3C; }
.pm-badge.is-admin   { background: var(--petrol-deep); color: var(--lemon); }
.pm-badge.is-ai      { background: #F1EDFC; color: #4B3A8F; }
.pm-row.is-ai .pm-page-icon { color: #4B3A8F; }
.pm-row.is-ai .pm-badge.is-ai { margin-inline-start: auto; }
.pm-pages li:has(.pm-row.is-ai) { margin-top: 4px; padding-top: 4px; border-top: 1px dashed var(--line); }
.mn-stat.is-ai b { color: #4B3A8F; }

/* شريط الحفظ */
.pm-bar {
    position: fixed; z-index: 60;
    bottom: 20px; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 10px;
    padding: 10px 10px 10px 18px;
    background: #fff;
    border: 1px solid var(--line); border-radius: 16px;
    box-shadow: 0 22px 50px -20px rgba(7, 63, 87, .55);
    animation: rise .25s ease-out;
}
[dir="rtl"] .pm-bar { padding: 10px 18px 10px 10px; }
.pm-bar-text { font-size: .9rem; color: var(--muted); margin-inline-end: 6px; white-space: nowrap; }
.pm-bar-text b { color: var(--lemon-deep); font-size: 1.05rem; }

/* مفتاح ظاهر/مخفى */
.sw { display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none; font: inherit; color: var(--muted); font-size: .85rem; }
.sw-track { position: relative; width: 38px; height: 22px; border-radius: 99px; background: #CBD7DC; transition: background .2s; }
.sw-knob { position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: inset-inline-start .2s; }
.sw.is-on .sw-track { background: var(--leaf); }
.sw.is-on .sw-knob { inset-inline-start: 19px; }
.sw.is-on { color: var(--ink); }
.sw:disabled { opacity: .5; }

/* شاشة القوائم والصفحات */
.mn-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.mn-stat {
    display: flex; align-items: baseline; gap: 6px;
    padding: 8px 16px; border-radius: 12px;
    background: #fff; border: 1px solid var(--line);
}
.mn-stat b { font-size: 1.3rem; color: var(--petrol-deep); font-variant-numeric: tabular-nums; }
.mn-stat span { color: var(--muted); font-size: .85rem; }
.mn-stat.is-soon b { color: #855600; }

.mn-mod { margin-bottom: 14px; padding: 0; overflow: hidden; }
.mn-mod.is-off { opacity: .7; border-style: dashed; }
.mn-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #FBFDFD, #fff); }
.mn-head > .pm-mod-icon { align-self: center; width: 44px; height: 44px; }
.mn-names { flex: 1; display: flex; flex-wrap: wrap; gap: 10px; min-width: 0; }
.mn-field { display: grid; gap: 3px; flex: 1 1 180px; font-size: .75rem; color: var(--muted); font-weight: 600; }
.mn-field.is-order { flex: 0 0 90px; }
.mn-field input, .mn-table input {
    width: 100%; height: 36px; padding: 0 10px;
    border: 1px solid var(--line); border-radius: 9px;
    background: #fff; font: inherit; font-size: .9rem; font-weight: 500; color: var(--ink);
}
.mn-field input:focus, .mn-table input:focus { outline: 0; border-color: var(--petrol); box-shadow: 0 0 0 3px rgba(10, 88, 120, .1); }
.mn-field input::placeholder, .mn-table input::placeholder { color: #9AAEB7; }
.mn-field input:disabled { background: var(--mist); }
.mn-meta { display: flex; align-items: center; gap: 12px; padding-bottom: 6px; }
.mn-users { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: .85rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.mn-users svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.mn-table-wrap { overflow-x: auto; }
.mn-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.mn-table th {
    padding: 9px 12px; text-align: start; white-space: nowrap;
    font-size: .75rem; font-weight: 600; color: var(--muted);
    background: var(--mist);
}
.mn-table td { padding: 7px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.mn-table .is-order { width: 86px; }
.mn-table .is-num { text-align: center; font-variant-numeric: tabular-nums; width: 90px; }
.mn-table tr.is-off td { background: repeating-linear-gradient(-45deg, #fff, #fff 8px, #FAFBFC 8px, #FAFBFC 16px); }
.mn-table tr.is-off input { color: var(--muted); }
.mn-table tr.is-changed td:first-child { box-shadow: inset 3px 0 0 var(--lemon-deep); }
[dir="rtl"] .mn-table tr.is-changed td:first-child { box-shadow: inset -3px 0 0 var(--lemon-deep); }
.mn-table .pm-href { margin: 0; }
.mn-foot { margin-bottom: 90px; }
.mn-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mn-table .is-act { width: 44px; text-align: center; }
.mn-table input:disabled { background: var(--mist); color: var(--muted); }
.pm-badge.is-custom { background: #E3F4F4; color: #0E5E5E; margin-inline-start: 6px; }
.mn-hint { margin: 0; font-size: .78rem; font-weight: 500; color: var(--muted); }
.mn-path { display: flex; align-items: center; border: 1px solid #C9D6DC; border-radius: 8px; overflow: hidden; background: #fff; }
.mn-path b { padding: 0 10px; height: 34px; display: grid; place-items: center; background: var(--mist); color: var(--petrol); font-weight: 600; font-size: .85rem; white-space: nowrap; }
.mn-path input { flex: 1; border: 0 !important; border-radius: 0 !important; min-width: 0; }
.mn-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.mn-ico {
    display: grid; place-items: center; height: 40px;
    border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--muted);
    transition: border-color .15s, background .15s, color .15s;
}
.mn-ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mn-ico:hover { border-color: var(--lemon-deep); background: var(--lemon-soft); color: var(--petrol-deep); }
.mn-ico.is-on { border-color: var(--petrol); background: var(--petrol); color: #fff; }

@media (max-width: 1000px) {
    .pm { grid-template-columns: 1fr; }
    .pm-side { position: static; }
}
@media (max-width: 600px) {
    .pm-href { display: none; }
    .pm-bar { left: 12px; right: 12px; transform: none; flex-wrap: wrap; justify-content: center; }
    .pm-bar-text { width: 100%; text-align: center; margin: 0; }
    .mn-meta { width: 100%; padding: 0; }
}


/* ---------------------------------------------------------------------
   10) الموبايل + تقليل الحركة
   --------------------------------------------------------------------- */
@media (max-width: 900px) {
    .kpi-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kpi-hero > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }   /* البطاقة التالتة بعرض الصف */
    .dash-charts { grid-template-columns: 1fr; }
    .kpi.is-hero .kpi-value { font-size: 2rem; }
    .dlg { padding: 16px; max-height: 92vh; }
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .chat { height: calc(100dvh - 64px - 32px); }
    .msg-user .bubble { max-width: 88%; }
    .ai-avatar { display: none; }
    .btn-send span { display: none; }       /* على الموبايل: أيقونة بس */
    .btn-send { padding: 0 13px; }
    .today { grid-template-columns: 1fr; }
    .today-stats { grid-template-columns: repeat(2, 1fr); }
    .today-stats > div { border-top: 1px solid var(--line); }
}

@media (max-width: 820px) {
    /* الدخول: لوحة البراند تبقى شريط فوق */
    .auth { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-card-logo { display: block; }

    /* القائمة: بتتفتح من بداية الصفحة بزرار ☰ (يمين فى العربى / شمال فى الإنجليزى) */
    .menu-btn { display: grid; }
    .side {
        position: fixed;
        inset-block: 0;
        inset-inline-start: 0;
        transform: translateX(100%);
        transition: transform .25s ease-out;
    }
    /* فى الإنجليزى القائمة على الشمال، فبتستخبى ناحية الشمال */
    [dir="ltr"] .side { transform: translateX(-100%); }
    .nav-toggle:checked ~ .side { transform: translateX(0); }
    .nav-toggle:checked ~ .side-scrim {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(7, 63, 87, .45);
        z-index: 25;
    }
    .topbar, .content { padding-inline: 16px; }
    .search { min-width: 0; width: 100%; }
}

@media (max-width: 600px) {
    .kpi { grid-template-columns: 1fr; padding: 14px; }
    .kpi-icon { display: none; }
    .kpi.is-hero .kpi-value { font-size: 1.8rem; }
    .kpi-value { font-size: 1.45rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-delay: 0ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* =====================================================================
   17) اختيار متعدد (MultiSelect) - فلتر الوظيفة فى لوحة المتابعة
   ===================================================================== */
.ss.is-job .ss-btn { min-width: 200px; max-width: 280px; }
.ss-btn.has-value { border-color: var(--petrol); background: var(--lemon-soft); color: var(--petrol-deep); }
.ms-badge {
    flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
    background: var(--petrol); color: #fff; font-size: .72rem; font-weight: 700;
    display: inline-grid; place-items: center;
}
.ms-tools { display: flex; align-items: center; gap: 6px; margin: 6px 2px 0; }
.ms-tools button {
    border: 0; background: var(--mist); color: var(--petrol-deep); border-radius: 99px;
    padding: 3px 10px; font: inherit; font-size: .76rem; font-weight: 600; cursor: pointer;
}
.ms-tools button:hover { background: var(--line); }
.ms-picked { margin-inline-start: auto; font-size: .74rem; color: var(--muted); }
.ms-opt { grid-template-columns: auto 1fr; }
.ms-opt .ss-opt-hint { grid-column: 2; }
.ms-box {
    grid-row: 1 / span 2; width: 18px; height: 18px; border: 2px solid var(--line); border-radius: 5px;
    display: grid; place-items: center; background: #fff;
}
.ms-opt.is-selected .ms-box { border-color: var(--petrol); background: var(--petrol); }
.ms-box svg { width: 13px; height: 13px; fill: none; stroke: #fff; stroke-width: 3; }
.ms-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.ms-apply, .ms-cancel {
    height: 32px; padding: 0 16px; border-radius: 99px; font: inherit; font-size: .84rem; font-weight: 700; cursor: pointer;
}
.ms-apply { border: 0; background: var(--petrol); color: #fff; }
.ms-apply:hover { background: var(--petrol-deep); }
.ms-cancel { border: 1px solid var(--line); background: #fff; color: var(--petrol-deep); }
@media (max-width: 760px) { .ss.is-job .ss-btn { max-width: none; } }

/* =====================================================================
   18) شاشات الاعتماد (12 ساعة + إضافى السعوديين) - ApprovalBoard
   ألوان الحالات نفس البرنامج القديم بالظبط
   ===================================================================== */
.st-0   { background: #fff; color: #000; }
.st-1   { background: rgb(252, 250, 3); color: #000; }
.st-2   { background: gold; color: #000; }
.st-2b  { background: rgb(66, 165, 245); color: #fff; }
.st-3   { background: green; color: #fff; }
.st-555 { background: rgb(249, 189, 189); color: #000; }
.st-777 { background: rgb(255, 108, 55); color: #fff; }
.st-999 { background: rgb(239, 57, 57); color: #fff; }
.st-x   { background: #ddd; color: #000; }

.ap { display: grid; gap: 10px; }
.ap-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.ap-fld { display: grid; gap: 3px; font-size: .78rem; color: var(--muted); font-weight: 600; }
.ap-fld select {
    height: 36px; min-width: 120px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px;
    background: #fff; font: inherit; font-size: .88rem; color: var(--ink, #000);
}
.ap-search {
    flex: 1 1 240px; display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px;
    border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.ap-search svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; }
.ap-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: .88rem; }
.ap-role {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px;
    background: var(--mist); color: var(--petrol-deep); font-size: .86rem;
}
.ap-role svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; }
.ap-role small { color: var(--muted); }
.ap-role.is-r0 { background: #FFF4E5; color: #8A5300; }
.ap-tabs em, .ap-st em {
    font-style: normal; display: inline-block; min-width: 20px; padding: 0 6px; margin-inline-start: 4px;
    border-radius: 99px; background: rgba(0, 0, 0, .12); font-size: .74rem; text-align: center;
}
.ap-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.ap-st {
    border: 1px solid rgba(0, 0, 0, .18); border-radius: 99px; padding: 4px 10px; cursor: pointer;
    font: inherit; font-size: .76rem; font-weight: 600;
}
.ap-st.is-on { outline: 3px solid var(--petrol); outline-offset: 1px; }
.ap-clear { border: 0; background: transparent; color: var(--petrol); font: inherit; font-size: .78rem; cursor: pointer; text-decoration: underline; }
.ap-wrap { max-height: calc(100vh - 430px); }
.ap-grid td.ap-stc { font-weight: 700; text-align: center; }
.ap-grid tbody tr.is-focused td.ap-stc { filter: brightness(.9); }
.ap-notes { color: #444; font-size: 11.5px; }
.ap-foot { display: flex; flex-wrap: wrap; gap: 16px; font-size: .82rem; color: var(--muted); }
.ap-foot b { color: var(--petrol-deep); }
.ap-note { flex-basis: 100%; font-size: .76rem; }
.ap-pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-weight: 700; border: 1px solid rgba(0, 0, 0, .15); }
.ap-old { background: #F7F7F7; color: #333; white-space: pre-wrap; }
.ap-ro { margin: 0; color: var(--muted); font-size: .84rem; }
.ap-info { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) {
    .ap-info { grid-template-columns: 1fr; }
    .ap-wrap { max-height: none; }
}
/* زرار IconButton جوه خلية الجدول (.rg-btn): قاعدة .rg-btn button (30×22) كانت بتضغطه
   فالنص والأيقونة مايبانوش - هنا بياخد عرضه الطبيعى وارتفاع مناسب وألوانه */
.rg-btn .xb {
    width: auto; min-width: 0; height: 26px; padding: 0 12px; margin: 2px auto;
    background: var(--xb-bg); border-color: var(--xb-bd); color: var(--xb-fg);
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
}
.rg-btn .xb.is-icon { width: 26px; padding: 0; }
.ap-grid td { height: 32px; vertical-align: middle; }

/* أيقونة جهاز البصمة جنب القسم اللى فيه جهاز (الرئيسية ← أقسامك) */
.fp-ok {
    width: 18px; height: 18px; flex: none;
    fill: none; stroke: #1C8C4E; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
/* اسم القسم + علامة البصمة على الشمال دايمًا (عربى أو إنجليزى) */
/*   عربى: الاسم يمين والعلامة فى أقصى الشمال ، إنجليزى: العلامة شمال الاسم على طول */
.sec-name { display: flex; align-items: center; gap: 8px; }
html[dir="rtl"] .sec-name { justify-content: space-between; }
html[dir="ltr"] .sec-name > svg { order: -1; }
/* القسم اللى عليه جهاز بصمة: خلفية فيروزى فاتح خالص */
.data-table tr.has-fp > td { background: #ECFAF6; }
.data-table tr.has-fp:hover > td { background: #DDF4EE; }
/* الفلتر جنب البحث */
.panel-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search-sel { min-width: 200px; cursor: pointer; padding-inline-end: 30px; }
@media (max-width: 900px) { .panel-tools { width: 100%; } .search-sel { min-width: 0; flex: 1; } }

/* =====================================================================
   19) ألوان مميزة لكل بطاقة فى لوحة المتابعة (KpiCard Accent) + عناوين المجموعات
   كل بطاقة: شريط جانبى + خلفية فاتحة + أيقونة مليانة بلونها - عشان العين تفرّق بينهم بسرعة
   ===================================================================== */
.kpi.kc-teal { --kc: #0F766E; --kc-soft: #E6F4F2; --kc-bd: #B9DFDA; }
.kpi.kc-indigo { --kc: #4338CA; --kc-soft: #ECEBFB; --kc-bd: #C9C5F3; }
.kpi.kc-amber { --kc: #B45309; --kc-soft: #FDF1E3; --kc-bd: #F3D2A9; }
.kpi.kc-rose { --kc: #BE123C; --kc-soft: #FCE8EE; --kc-bd: #F4BCCB; }
.kpi.kc-violet { --kc: #6D28D9; --kc-soft: #F1EAFC; --kc-bd: #D5C2F5; }
.kpi.kc-sky { --kc: #0369A1; --kc-soft: #E5F2FA; --kc-bd: #B5D8EE; }
.kpi.kc-emerald { --kc: #047857; --kc-soft: #E3F4EE; --kc-bd: #AEDCCB; }
.kpi.kc-orange { --kc: #C2410C; --kc-soft: #FDEEE6; --kc-bd: #F6C8B2; }
.kpi.kc-slate { --kc: #475569; --kc-soft: #EEF1F5; --kc-bd: #CDD5DF; }
.kpi.kc-brown { --kc: #7C4A2D; --kc-soft: #F5EDE8; --kc-bd: #DEC8BB; }
.kpi.kc-cyan { --kc: #0E7490; --kc-soft: #E3F3F7; --kc-bd: #B0DCE7; }
.kpi.kc-lime { --kc: #4D7C0F; --kc-soft: #EEF5E3; --kc-bd: #CDE2AE; }
.kpi.kc-plum { --kc: #86198F; --kc-soft: #F7E8F8; --kc-bd: #E5BDE8; }
.kpi.kc-green { --kc: #15803D; --kc-soft: #E6F5EC; --kc-bd: #B5E0C4; }
.kpi.kc-gold { --kc: #A16207; --kc-soft: #FBF3DE; --kc-bd: #EBD6A0; }
.kpi.kc-navy { --kc: #1E3A8A; --kc-soft: #E8EDF8; --kc-bd: #BFCBEA; }
.kpi.kc-pink { --kc: #BE185D; --kc-soft: #FCE7F1; --kc-bd: #F3B9D3; }
.kpi[class*="kc-"] {
    --tone: var(--kc);
    --tone-soft: var(--kc-soft);
    background: linear-gradient(155deg, var(--kc-soft) 0%, #fff 62%);
    border-color: var(--kc-bd);
}
.kpi[class*="kc-"]::before { width: 5px; opacity: 1; }
.kpi[class*="kc-"] .kpi-icon {
    background: var(--kc); color: #fff;
    box-shadow: 0 10px 18px -12px var(--kc);
}
.kpi[class*="kc-"] .kpi-label { color: var(--kc); }
.kpi[class*="kc-"]:hover { border-color: var(--kc); box-shadow: 0 16px 30px -20px var(--kc); }
/* لو فيه حاجة مستنية قرار (Tone=warn) على بطاقة ملونة: حلقة برتقالى خفيفة */
.kpi[class*="kc-"].warn { box-shadow: inset 0 0 0 2px rgba(194, 65, 12, .35); }
.kpi[class*="kc-"].warn .kpi-value { color: var(--warn); }

.kpi-group {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin: 20px 2px 10px; font-size: .98rem; font-weight: 700; color: var(--petrol-deep);
}
.kpi-group svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.kpi-group::after { content: ""; flex: 1 1 40px; height: 1px; background: var(--line); margin-inline-start: 6px; order: 3; }
.kpi-group small { order: 4; font-size: .74rem; font-weight: 500; color: var(--muted); }

.kpi-wait {
    display: inline-block; width: 72px; height: 1em; border-radius: 6px; vertical-align: middle;
    background: linear-gradient(90deg, var(--mist) 0%, #fff 50%, var(--mist) 100%);
    background-size: 200% 100%; animation: shimmer 1.2s linear infinite;
}

/* =====================================================================
   20) صفحة رمز التحقق (LoginVerify)
   ===================================================================== */
.otp-card .auth-sub { margin-bottom: 20px; }
.otp-info {
    background: #E8F6EE; color: #1C6B3C; border-inline-start: 4px solid #2F7D32;
    padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 18px;
}
.otp-email {
    display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px;
    border: 1.5px dashed var(--line); border-radius: var(--radius-sm); background: var(--mist);
    font-weight: 600; color: var(--petrol-deep); word-break: break-all;
}
.otp-email svg, .otp-sent svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--petrol); stroke-width: 2; stroke-linejoin: round; }
.otp-hint { margin: 6px 0 0; font-size: .82rem; color: var(--muted); }
.otp-note { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: #FFF8D6; color: #6B5400; font-size: .88rem; }
.otp-sent {
    display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
    border-radius: var(--radius-sm); background: var(--mist); font-size: .9rem;
}
.otp-sent b { display: block; margin: 2px 0; word-break: break-all; }
.otp-sent small { display: block; margin-top: 4px; color: var(--muted); }
.otp-code { text-align: center; font-size: 1.6rem; letter-spacing: .5em; font-weight: 700; font-variant-numeric: tabular-nums; }
.otp-timer { font-variant-numeric: tabular-nums; color: var(--petrol); }
.otp-timer.is-low { color: var(--warn); }
.otp-timer.is-over { color: var(--danger); }
.otp-links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.otp-link {
    border: 0; background: transparent; padding: 4px 0; font: inherit; font-size: .88rem; font-weight: 600;
    color: var(--petrol); cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.otp-link:hover { color: var(--petrol-deep); }
.otp-cancel { justify-self: center; color: var(--muted); }
.otp-back { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.otp-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 10px; }
.otp-foot .otp-cancel { justify-self: auto; }
.pwd-rules { margin: -4px 0 0; font-size: .82rem; color: var(--muted); }

/* =====================================================================
   21) شاشة بيانات المستخدمين (Admin/Users)
   ===================================================================== */
.us-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; font-size: .8rem; }
.us-stats span { padding: 3px 10px; border-radius: 99px; background: var(--mist); color: var(--petrol-deep); }
.us-stats .is-ok { background: #E8F6EE; color: #1C6B3C; }
.us-stats .is-warn { background: #FFF4E5; color: #8A5300; }
.us-card { padding: 18px 20px; display: grid; gap: 14px; }
.us-card .pm-who { flex-wrap: wrap; }
.us-badge { margin-inline-start: auto; padding: 4px 12px; border-radius: 99px; font-size: .78rem; font-weight: 600; }
.us-badge.is-ok { background: #E8F6EE; color: #1C6B3C; }
.us-badge.is-warn { background: #FFF4E5; color: #8A5300; }
.us-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.us-form input { height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; width: 100%; }
.us-form input:focus { outline: 2px solid var(--lemon); border-color: var(--petrol); }
.us-err { color: var(--danger); font-size: .78rem; }
.us-h3 { margin: 0; font-size: .95rem; color: var(--petrol-deep); }
.us-h3 small { font-weight: 500; color: var(--muted); font-size: .76rem; }
.us-roles { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.us-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.us-all-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.us-all-head .us-h3 { margin-inline-end: auto; }
.us-filter { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.us-filter svg { width: 15px; height: 15px; fill: none; stroke: var(--muted); stroke-width: 2; }
.us-filter input { border: 0; outline: 0; font: inherit; font-size: .85rem; width: 160px; background: transparent; }
.us-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; max-height: 520px; overflow: auto; }
.us-field { display: grid; gap: 2px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; min-width: 0; }
.us-field span { font-size: .72rem; color: var(--muted); font-family: Consolas, monospace; }
.us-field b { font-size: .86rem; font-weight: 600; overflow-wrap: anywhere; }
.us-field.is-empty { background: var(--mist); }
.us-field.is-empty b { color: var(--muted); font-weight: 400; }
.us-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 460px; overflow: auto; }
.us-log li { display: grid; gap: 1px; padding: 7px 10px; border-radius: 9px; background: var(--mist); border-inline-start: 3px solid var(--line); font-size: .82rem; }
.us-log li small { color: var(--muted); font-size: .74rem; overflow-wrap: anywhere; }
.us-log li.is-edit { border-inline-start-color: var(--petrol); }
.us-log li.is-ok { border-inline-start-color: #2F7D32; }
.us-log li.is-bad { border-inline-start-color: var(--danger); background: #FDF1F0; }

/* =====================================================================
   22) موديول المبيعات (Components/Sales + Pages/Sales)
   ===================================================================== */
/* ---- شريط الفلاتر ---- */
.sf-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 12px 14px; margin-bottom: 12px;
          background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.sf-bar .ss.is-short .ss-btn { min-width: 120px; }
.sf-seg { display: grid; gap: 4px; }
.sf-cap { font-size: .8rem; font-weight: 600; color: var(--muted); }
.sf-switches { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; min-height: 40px; }
.sf-go { height: 40px; display: inline-flex; align-items: center; gap: 6px; }
.sf-go svg, .btn-ghost.is-accent svg { width: 16px; height: 16px; fill: currentColor; }
.sf-hint { margin: -4px 0 12px; font-size: .8rem; color: #8A5300; }
.btn-ghost.is-accent { border-color: var(--lemon-deep); background: var(--lemon-soft); font-weight: 700; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 0 14px; height: 38px; font: inherit; font-size: .86rem; color: var(--muted); cursor: pointer; }
.seg button + button { border-inline-start: 1px solid var(--line); }
.seg button.is-on { background: var(--petrol); color: #fff; font-weight: 700; }
.chart-panel .seg button { height: 30px; padding: 0 10px; font-size: .8rem; }

/* ---- تبويبات (المشرفين / مديري البيع / المناطق) ---- */
.tabs { display: flex; gap: 4px; margin: -8px 0 12px; border-bottom: 2px solid var(--line); }
.tabs button { border: 0; background: transparent; padding: 10px 18px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer;
               border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs button.is-on { color: var(--petrol-deep); border-bottom-color: var(--lemon-deep); }

/* ---- شريط الإجماليات (Net Sales | Cash | ...) ---- */
.st-strip { display: grid; grid-template-columns: repeat(var(--n, 8), minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 8px; margin-bottom: 14px; }
@media (max-width: 1100px) { .st-strip { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); } }
.st-cell { display: grid; gap: 2px; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px;
           border-top: 4px solid var(--hc, var(--line)); min-width: 0; }
.st-cell span { font-size: .78rem; color: var(--muted); font-weight: 600; }
.st-cell b { font-size: 1.15rem; color: var(--ink); }
.st-cell small { font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-cell b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.st-cell span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-cell small em { font-style: normal; color: var(--muted); }
.st-cell.is-net { border-top-color: var(--petrol-deep); background: var(--lemon-soft); }
.st-cell.is-net b { font-size: 1.15rem; color: var(--petrol-deep); }
.st-cell.is-ret { border-top-color: #5B7480; }
.st-cell.is-plain { border-top-color: var(--line); }
.is-up { color: #1C7C3A; font-weight: 700; }
.is-down { color: var(--danger); font-weight: 700; }
.chip-warn { display: inline-block; padding: 2px 10px; border-radius: 99px; background: #FFF4E5; color: #8A5300; font-size: .76rem; font-weight: 600; }

/* ---- التقسيمات ---- */
.sales-two { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 14px; margin-bottom: 14px; }
.sales-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
.sales-split.is-wide-first { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.sales-two > .panel, .sales-split > .panel, section.panel, .panel.sec { padding: 14px; }
section.panel, .panel.sec { margin-bottom: 14px; }
.sales-two .panel-head, .sales-split .panel-head, section.panel .panel-head, .panel.sec .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.sales-two h3, .sales-split h3, section.panel h3, .panel.sec h3, .da-main h3 { margin: 0; font-size: 1rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sales-two h3 small, .sales-split h3 small, section.panel h3 small, .panel.sec h3 small, .da-main h3 small { font-weight: 500; font-size: .76rem; }
.sales-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 4px 0 16px; }
.sales-link { display: flex; gap: 12px; align-items: flex-start; padding: 16px; text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s; }
.sales-link:hover { border-color: var(--lemon-deep); transform: translateY(-1px); }
.sales-link svg { flex: none; width: 34px; height: 34px; padding: 6px; border-radius: 10px; background: var(--lemon-soft); fill: none; stroke: var(--petrol); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sales-link div { display: grid; gap: 3px; }
.sales-link span { font-size: .82rem; }
@media (max-width: 1100px) { .sales-two, .sales-split, .sales-split.is-wide-first { grid-template-columns: minmax(0, 1fr); } }

/* ---- الجدول (SalesGrid) ---- */
.sg-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sg-search { height: 34px; min-width: 200px; }
.sg-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.sg { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .84rem; }
.sg th { position: sticky; top: 0; z-index: 1; background: #F4F8F9; color: var(--ink); font-weight: 700; padding: 8px 10px; white-space: nowrap;
         border-bottom: 2px solid var(--line); border-top: 3px solid var(--hc, transparent); cursor: pointer; user-select: none; }
.sg th.is-asc::after { content: " ▲"; font-size: .7em; color: var(--muted); }
.sg th.is-desc::after { content: " ▼"; font-size: .7em; color: var(--muted); }
.sg td { padding: 6px 10px; border-bottom: 1px solid #EEF3F5; white-space: nowrap; }
.sg .is-num { text-align: center; font-variant-numeric: tabular-nums; }
.sg .is-text { text-align: start; }
.sg td.is-text { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.sg tbody tr.is-click { cursor: pointer; }
.sg tbody tr:hover td { background-color: #FAFCE8; }
.sg tbody tr.is-selected td { background-color: #FFF0B3; font-weight: 600; }
.sg tbody tr.is-return td { color: var(--danger); }
.sg tbody tr.is-empty td { text-align: center; color: var(--muted); padding: 24px; }
/* شريط القيمة جوه الخلية (زى SalesGridPanel) - بيبدأ من بداية الخلية فى العربى والإنجليزى */
.sg td.has-bar { background-image: linear-gradient(to left, var(--c) var(--p), transparent var(--p)); background-repeat: no-repeat; }
[dir="ltr"] .sg td.has-bar { background-image: linear-gradient(to right, var(--c) var(--p), transparent var(--p)); }
.sg td.is-bad { color: var(--danger); font-weight: 700; background-color: #FDECEA; }
.sg td.is-good { color: #1C7C3A; font-weight: 700; }
.sg tfoot td { position: sticky; bottom: 0; background: #EEF3F5; font-weight: 700; padding: 8px 10px; border-top: 2px solid var(--line); white-space: nowrap; }
.sg-more { margin: 6px 0 0; font-size: .78rem; }
.arrow.is-up { color: #1C7C3A; font-weight: 700; }
.arrow.is-down { color: var(--danger); font-weight: 700; }

/* ---- الرسم (SalesChart) ---- */
.schart svg { width: 100%; height: auto; display: block; overflow: visible; }
.schart .sc-grid { stroke: #E6EEF1; stroke-width: 1; }
.schart .sc-grid.is-zero { stroke: #B9C9CF; }
.schart .sc-axis { font-size: 12px; fill: var(--muted); font-family: var(--font); }
.schart .sc-cat { font-size: 12px; fill: var(--ink); font-family: var(--font); }
.schart .sc-val { font-size: 12px; font-weight: 700; fill: var(--ink); font-family: var(--font); }
.schart .sc-val.is-total { font-size: 13px; fill: var(--petrol-deep); }
.schart .sc-note { font-size: 11px; fill: #8A5300; font-family: var(--font); font-weight: 600; }
.schart .sc-bar { cursor: pointer; transition: opacity .15s; }
.schart .sc-bar:hover { opacity: .8; }
.schart .sc-hit { fill: transparent; cursor: pointer; }
.schart .sc-hit:hover { fill: rgba(10, 88, 120, .04); }
.schart .sc-hit.is-selected { fill: rgba(248, 200, 8, .18); }
.schart .sc-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.schart .sc-dot { stroke: #fff; stroke-width: 1.5; cursor: pointer; }
.sc-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; margin-top: 6px; }
.sc-legend button { border: 0; background: transparent; font: inherit; font-size: .8rem; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; padding: 2px 4px; }
.sc-legend button.is-off { opacity: .4; text-decoration: line-through; }
.sc-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* ---- خط الاتجاه ---- */
.spark { width: 110px; height: 24px; display: block; margin: auto; }
.spark polyline { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
.spark.is-up polyline { stroke: #1C7C3A; }
.spark.is-down polyline { stroke: var(--danger); }
.spark.is-flat polyline { stroke: #8A989D; }

/* ---- نوافذ المبيعات ---- */
.sd-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin-bottom: 8px; }
.sd-strip div { display: grid; gap: 2px; padding: 8px 12px; border-radius: 10px; background: var(--mist); }
.sd-strip span { font-size: .76rem; color: var(--muted); }
.sd-strip b { font-size: 1.05rem; }
.sd-hint { margin: 0 0 8px; font-size: .8rem; }
.sd-back { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.sd-back .btn-ghost svg { width: 16px; height: 16px; }
.yr-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 10px; }
.yr-years { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.yr-h { margin: 12px 0 6px; font-size: .95rem; color: var(--lemon-deep); }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--petrol); }
.da-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; }
.da-side { display: grid; gap: 10px; align-content: start; }
.da-side .btn-lemon { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; }
.da-side .btn-lemon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.da-tree { max-height: 520px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; background: #fff; }
.da-tree details { margin: 2px 0; }
.da-tree summary { cursor: pointer; font-weight: 700; padding: 3px 0; }
.da-tree details > .chk { display: flex; padding: 2px 18px; }
.da-main { display: grid; gap: 12px; min-width: 0; }
.da-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 12px; }
.da-row.is-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.da-main .panel { padding: 12px; }
@media (max-width: 1100px) { .da-layout, .da-row, .da-row.is-three { grid-template-columns: minmax(0, 1fr); } }

/* زرار إضافى فى رأس نافذة التفاصيل ("فتح شاشة الاعتماد") */
.dlg-head .dlg-action { margin-inline-start: auto; margin-inline-end: 8px; height: 36px; padding: 0 14px; font-size: .88rem; white-space: nowrap; align-self: center; width: auto; }


/* ---------------------------------------------------------------------
   إعدادات التحليلات (/sales/settings)
   --------------------------------------------------------------------- */
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-bottom: 14px; }
.set-card { padding: 16px 18px; }
.set-card h3 { margin: 0 0 10px; font-size: 1rem; color: var(--petrol-deep); }
.set-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 12px; font-size: .9rem; }
.set-dl dt { color: var(--muted); }
.set-dl dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.set-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.set-btn { height: 38px; padding: 0 16px; }
.set-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.set-tools .search { min-width: 220px; flex: 1 1 220px; max-width: 360px; }
.set-wrap { max-height: 62vh; overflow: auto; }
.set-table th { position: sticky; top: 0; z-index: 1; background: var(--petrol-deep); color: #fff; white-space: nowrap; }   /* كان #fff فالعناوين البيضا مختفية */
.set-table tr.is-on td { background: var(--lemon-soft); }
.set-table tr.is-new td { background: #FFF8EC; }
.set-table tr.is-new td:first-child { box-shadow: inset 3px 0 0 var(--lemon-deep); }
[dir="rtl"] .set-table tr.is-new td:first-child { box-shadow: inset -3px 0 0 var(--lemon-deep); }
.set-table tr.is-muted td { color: var(--muted); background: #FAFBFC; }
.set-select { height: 32px; min-width: 150px; border: 1px solid var(--line); border-radius: var(--radius-sm);
              padding: 0 8px; font: inherit; font-size: .85rem; background: #fff; color: var(--ink); }
.set-select:focus { outline: 2px solid var(--lemon); outline-offset: 1px; }
.set-mini { height: 30px; padding: 0 12px; font-size: .8rem; }
.badge-ok { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
            background: #E8F5E9; color: var(--good, #2F7D32); font-weight: 700; font-size: .82rem; }
.small { font-size: .82rem; }
@media (max-width: 640px) {
    .set-dl { grid-template-columns: 1fr; }
    .set-tools .search { max-width: none; }
}
.sales-notice { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; }
.sales-notice svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; }
.sales-notice:hover { border-color: var(--lemon-deep); }


/* ---------------------------------------------------------------------
   التكبير لملء الشاشة (Maximizable + ToolDialog) - منهج كل شاشات التحليلات
   --------------------------------------------------------------------- */
.mx { position: relative; }
.mx-main { display: contents; }
.mx > .mx-main > .panel-head, .mx > .mx-main > h3, .mx > .mx-main > .sg-tools { padding-inline-end: 40px; }
.mx-btn, .td-max {
    display: grid; place-items: center; width: 32px; height: 32px; flex: none;
    border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--petrol);
    cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.mx-btn { position: absolute; top: 12px; inset-inline-end: 12px; z-index: 2; opacity: .75; }
.mx:hover > .mx-btn, .mx-btn:focus-visible { opacity: 1; }
.mx-btn:hover { background: var(--lemon-soft); border-color: var(--lemon-deep); color: var(--petrol-deep); }
.mx-btn svg, .td-max svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.mx-btn:focus-visible, .td-max:focus-visible { outline: 2px solid var(--lemon); outline-offset: 2px; }

.mx.is-max {
    position: fixed; inset: 12px; z-index: 81; margin: 0;
    max-height: none; overflow: auto; overscroll-behavior: contain;
    background: #fff; border-radius: 16px; box-shadow: 0 30px 80px -20px rgba(7, 63, 87, .6);
    animation: mx-in .18s ease-out;
}
.mx.is-max { padding-top: 54px; }
.mx.is-max > .mx-btn { opacity: 1; background: var(--petrol); color: #fff; border-color: var(--petrol); }
.mx-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(7, 63, 87, .45); backdrop-filter: blur(3px); }
@keyframes mx-in { from { opacity: 0; transform: scale(.985); } }
body:has(.mx.is-max), body:has(.td.is-max) { overflow: hidden; }

/* تحت النوافذ (dlg = 90/91) عشان التفاصيل اللى بتفتح من الرسم تظهر فوقه */
.mx.is-max.has-aside { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; align-items: start; }
.mx.is-max.has-aside > .mx-main { display: block; min-width: 0; }
.mx.is-max.has-aside > .mx-aside { min-width: 0; position: sticky; top: 0; }
.mx.is-max.has-aside > .mx-aside > .panel { padding: 14px; border: 1px solid var(--line); }
@media (max-width: 1100px) { .mx.is-max.has-aside { grid-template-columns: minmax(0, 1fr); } }

/* المحتوى جوه الإطار المتكبّر */
.mx.is-max .colchart { height: max(260px, calc(100vh - 220px)); }
.mx.is-max .sg-wrap, .td.is-max .sg-wrap { max-height: none; }
.mx.is-max .bar-label { max-width: none; }

/* ToolDialog متكبّر */
.td-max { margin-inline-start: auto; background: rgba(255, 255, 255, .12); color: #fff; border-color: transparent; border-radius: 50%; }
.td-max:hover { background: rgba(255, 255, 255, .26); }
.td-head-extra + .td-max, .td-max + .td-x { margin-inline-start: 0; }
.dlg.td.is-max { width: calc(100vw - 24px); height: calc(100vh - 24px); max-height: none; }
.dlg.td.is-max .td-body { flex: 1 1 auto; overflow: auto; max-height: none; }
@media (prefers-reduced-motion: reduce) { .mx.is-max { animation: none; } }
/* DetailsModal متكبّرة */
.dlg-max { margin-inline-start: auto; color: var(--petrol); }
.dlg-max:hover { color: var(--petrol-deep); border-color: var(--lemon-deep); background: var(--lemon-soft); }
.dlg-max + .dlg-x, .dlg-action + .dlg-max { margin-inline-start: 0; }
.dlg.is-max:not(.td) { width: calc(100vw - 24px); height: calc(100vh - 24px); max-height: none; }

/* إعدادات التحليلات: الجدولة والتحميل */
.set-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 14px; margin: 6px 0 12px; }
.set-form.is-wide { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.set-form label { display: grid; gap: 4px; font-size: .84rem; color: var(--muted); font-weight: 600; }
.set-input { height: 36px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 10px; font: inherit; font-size: .9rem; color: var(--ink); background: #fff; }
.set-input:focus { outline: 2px solid var(--lemon); outline-offset: 1px; }
.set-input:disabled { background: var(--mist); color: var(--muted); }
.set-check { display: flex !important; align-items: center; gap: 8px; align-self: end; height: 36px; color: var(--ink) !important; }
.set-check input { width: 18px; height: 18px; accent-color: var(--petrol); }
.set-progress { position: relative; height: 22px; border-radius: 999px; background: var(--mist); border: 1px solid var(--line); overflow: hidden; margin: 4px 0 10px; }
.set-progress span { position: absolute; inset-block: 0; inset-inline-start: 0; background: linear-gradient(90deg, var(--lemon), var(--lemon-deep)); transition: width .4s; }
.set-progress b { position: relative; display: block; text-align: center; line-height: 20px; font-size: .78rem; color: var(--petrol-deep); }

/* المهام المجدولة */
.set-group { margin: 18px 0 10px; font-size: 1.02rem; color: var(--petrol-deep); }
.job-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; margin-bottom: 14px; }
.job-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.job-card.is-running { border-color: var(--lemon-deep); box-shadow: 0 0 0 3px var(--lemon-soft); }
.job-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.job-head h4 { margin: 0; font-size: .98rem; color: var(--petrol-deep); }
.job-desc { margin: 0; font-size: .86rem; line-height: 1.7; color: var(--ink); }
.job-dl { font-size: .82rem; margin: 0; }
.job-dl code { font-size: .78rem; white-space: normal; overflow-wrap: anywhere; }
.job-err { color: var(--danger); font-size: .78rem; overflow-wrap: anywhere; }
.job-badge { display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; background: var(--mist); color: var(--muted); }
.job-badge.is-ok { background: #E8F5E9; color: #2F7D32; }
.job-badge.is-err { background: #FDECEA; color: var(--danger); }
.job-badge.is-run { background: var(--lemon-soft); color: #6B5300; }
.job-badge .td-spin { width: 12px; height: 12px; border-width: 2px; }
.job-sched { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line); }
.job-sched .set-check { height: 32px; font-size: .84rem; }
.job-sched .set-select { min-width: 130px; }
.job-num { width: 110px; height: 32px; }
.job-run { margin-inline-start: auto; }
@media (max-width: 640px) { .job-grid { grid-template-columns: 1fr; } }

/* نافذة "جارٍ تنفيذ الإجراء" - بتختفى لو فيه رسالة تأكيد أو مؤشر تحميل خاص بالشاشة ظاهر */
#action-loader { display: none; z-index: 190; }
#action-loader.is-on { display: grid; }
body:has(.mb-backdrop) #action-loader,
body:has(.loader.is-overlay:not(#action-loader):not(#page-loader)) #action-loader,
body:has(.loader.is-inline) #action-loader,
body:has(.td-busy) #action-loader,
body:has(#page-loader.is-on) #action-loader { display: none !important; }

/* خانة التاريخ الموحّدة yyyy-MM-dd (DateBox) */
.datebox { position: relative; display: inline-flex; align-items: stretch; min-width: 170px; max-width: 280px; }
.datebox .db-text {
    flex: 1 1 auto; min-width: 0; width: 100%; height: 38px; padding: 0 12px; padding-inline-end: 42px;
    border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
    font: inherit; font-size: .9rem; font-variant-numeric: tabular-nums; letter-spacing: .02em; text-align: left;
}
.datebox .db-text:focus { outline: none; border-color: var(--petrol); }
.datebox.is-invalid .db-text { border-color: var(--danger); background: #FFF6F5; }
.datebox .db-btn {
    position: absolute; top: 4px; bottom: 4px; inset-inline-end: 4px; width: 32px;
    display: grid; place-items: center; border: 0; border-radius: 8px; background: var(--mist); color: var(--petrol); cursor: pointer;
}
[dir="rtl"] .datebox .db-btn { inset-inline-end: auto; inset-inline-start: auto; right: 4px; left: auto; }
.datebox .db-text { padding-right: 42px; padding-left: 12px; }
.datebox .db-btn:hover { background: var(--lemon-soft); }
.datebox .db-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.datebox .db-native {
    position: absolute !important; right: 4px; bottom: 0; width: 32px !important; min-width: 0 !important; height: 1px !important;
    padding: 0 !important; border: 0 !important; opacity: 0; pointer-events: none;
}
.datebox :disabled { opacity: .6; cursor: not-allowed; }
.filter .datebox, .td-field .datebox { width: 100%; }
.set-form .datebox { max-width: none; width: 100%; }
.set-form .datebox .db-text { height: 36px; border-width: 1px; border-radius: var(--radius-sm); }
@media (max-width: 760px) { .datebox { max-width: none; width: 100%; } }


/* ---- أدوات الجدول: Excel + طباعة (GridTools) ---- */
.grid-tools { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.grid-tools .tool { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
                    background: #fff; color: var(--petrol); font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; }
.grid-tools .tool:hover:not(:disabled) { background: var(--lemon-soft); border-color: var(--lemon-deep); }
.grid-tools .tool:disabled { opacity: .5; cursor: not-allowed; }
.grid-tools .tool svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sg-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.sg-tools .grid-tools { margin-inline-start: auto; }
.sg-tools .sg-count { font-size: .8rem; }

/* ورقة الطباعة بالعرض لما الأعمدة كتير */
@page ps-landscape { size: A4 landscape; margin: 10mm; }
@media print {
    body.print-mode #print-root .print-sheet.is-landscape { page: ps-landscape; }
}
.gt-bar { display: flex; justify-content: flex-end; margin-bottom: 6px; }

/* عمر الصيدلية: جديد / أصيل (عمود "مدة التشغيل" + فوق الاسم فى الرسومات) */
.age-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap;
           background: var(--mist); color: var(--muted); }
.age-tag.is-new { background: #E6F7EF; color: #0F7A4A; box-shadow: inset 0 0 0 1px #9ED9BC; }
.age-tag.is-new::before { content: "✦"; color: #13A463; }
.age-tag.is-est { background: #FFF6CF; color: #7A5A00; box-shadow: inset 0 0 0 1px #F1D77C; }
.age-tag.is-est::before { content: "★"; color: var(--lemon-deep); }
.bar-badge { display: block; width: fit-content; margin-bottom: 2px; font-size: .68rem; padding: 1px 7px; }

/* نافذة التحميل بتقدّم معروف */
.loader-bar.is-known i { animation: none; left: auto; inset-inline-start: 0; transition: width .4s ease; }
.loader-detail { display: block; font-size: .8rem; color: var(--petrol); font-weight: 600; direction: rtl; unicode-bidi: plaintext; }

/* ---- خطوات تحميل الصفحة داخل نافذة التحميل (LoadSteps) ---- */
.loader-card:has(.loader-steps) { width: min(420px, 100%); }
.loader-count { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.loader-steps { list-style: none; margin: 4px 0 0; padding: 0; width: 100%; max-height: 230px; overflow: auto; text-align: start; font-size: .83rem; }
.loader-steps li { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; }
.loader-steps li + li { border-top: 1px dashed var(--line); }
.loader-steps li i { width: 16px; height: 16px; flex: none; display: inline-grid; place-items: center; font-style: normal; font-weight: 700; font-size: .8rem; }
.loader-steps li.is-done i { color: #1A8F4A; }
.loader-steps li.is-fail i { color: #C0392B; }
.loader-steps li.is-run i { border: 2px solid var(--line); border-top-color: var(--lemon-deep); border-radius: 50%; animation: spin .8s linear infinite; }
.loader-steps li span { flex: 1; }
.loader-steps li.is-run span { font-weight: 600; color: var(--petrol-deep); }
.loader-steps li.is-done span { color: var(--muted); }
.loader-steps li small { color: var(--muted); font-variant-numeric: tabular-nums; }
.loader-detail:empty { display: none; }

/* =====================================================================
   30) ساعات الذروة + الفروع الآن (لوحة المبيعات و sales/hours)
   ===================================================================== */
/* 24 عمود صغير */
.hour-bars { display: grid; grid-template-columns: repeat(24, 1fr); align-items: end; gap: 2px; height: var(--h, 46px); direction: ltr; }
.hour-bars .hb { display: block; height: max(2px, var(--v)); background: #BFD9E2; border-radius: 3px 3px 0 0; transition: height .4s ease, background .2s; }
.hour-bars .hb.is-second { background: #F2C46D; }
.hour-bars .hb.is-peak { background: #E0662C; }
.hour-bars.is-click .hb { cursor: pointer; }
.hour-bars .hb:hover { background: var(--petrol); }
.hour-axis { display: flex; justify-content: space-between; direction: ltr; font-size: .66rem; color: var(--muted); margin-top: 2px; }

/* الخريطة الحرارية */
.heat-wrap { overflow-x: auto; }
.heat { border-collapse: separate; border-spacing: 2px; width: 100%; direction: ltr; font-size: .72rem; }
.heat th { font-weight: 600; color: var(--muted); padding: 2px 4px; text-align: center; }
.heat th.heat-lbl { text-align: end; white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; direction: rtl; }
.heat td { --a: 0; min-width: 34px; height: 30px; text-align: center; border-radius: 5px; cursor: pointer; color: var(--ink);
           background: color-mix(in srgb, #E0662C calc(var(--a) * 100%), #F4F8F9); transition: transform .12s; }
.heat td.is-dark { color: #fff; }
.heat td:hover { transform: scale(1.08); box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.heat td.is-peak { outline: 2px solid var(--petrol-deep); outline-offset: -2px; font-weight: 700; }
.heat td.heat-peak, .heat th.heat-peak { background: transparent; cursor: default; white-space: nowrap; color: var(--petrol-deep); font-weight: 700; padding-inline: 8px; }
.heat td.heat-peak:hover { transform: none; box-shadow: none; }
.heat-legend { display: flex; align-items: center; gap: 8px; justify-content: flex-start; direction: ltr; font-size: .72rem; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.heat-key { width: 18px; height: 14px; border-radius: 4px; outline: 2px solid var(--petrol-deep); outline-offset: -2px; background: #F4F8F9; margin-inline-start: 14px; }
.heat-help { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: #F6FAFB; border: 1px dashed var(--line); }
.heat-help p { margin: 0; font-size: .78rem; line-height: 1.7; color: var(--ink); }
.heat th.heat-lbl { position: sticky; inset-inline-start: 0; left: 0; background: #fff; z-index: 1; }
.heat-legend i { width: 120px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #F4F8F9, #E0662C); }

/* كارت ساعات الذروة */
.rush-card { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; cursor: pointer;
             transition: box-shadow .2s, transform .2s; overflow: hidden; }
.rush-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, #E0662C, #F2C46D, var(--petrol)); }
.rush-card:hover, .rush-card:focus-visible { box-shadow: 0 10px 28px rgba(10,88,120,.14); transform: translateY(-2px); outline: none; }
.rush-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.rush-head h3 { margin: 0; font-size: 1.05rem; }
.rush-head p { margin: 2px 0 0; font-size: .8rem; }
.rush-head .kpi-go { margin-inline-start: auto; width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; }
.rush-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: #FDEBDD; color: #C2410C; flex: none; }
.rush-icon svg, .live-icon svg, .live-age svg, .live-staff-h svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rush-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.rush-level { display: grid; gap: 6px; padding: 12px 14px; border-radius: 12px; background: var(--mist); min-height: 150px; }
.rush-level.is-skeleton { background: linear-gradient(90deg, var(--mist) 0%, #fff 50%, var(--mist) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.rush-tag { font-size: .76rem; font-weight: 700; color: var(--petrol); }
.rush-hour { font-size: 1.35rem; color: var(--ink); direction: ltr; text-align: start; }
.rush-sub { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .78rem; color: var(--muted); }
.rush-sub b { color: var(--ink); }
.rush-second { font-size: .74rem; color: var(--muted); }
.rush-msg { margin: 0; color: var(--warn); font-size: .86rem; }
.rush-card.is-busy .rush-levels { opacity: .6; }

/* الفروع الآن */
.live-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.live-card { position: relative; display: flex; flex-direction: column; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
             padding: 16px 18px; cursor: pointer; transition: box-shadow .2s, transform .2s; border-top: 4px solid var(--petrol); min-height: 260px; }
.live-card.is-top { border-top-color: var(--leaf); }
.live-card.is-low { border-top-color: var(--danger); }
.live-card.is-pick { border-top-color: var(--lemon-deep); }
.live-card:hover, .live-card:focus-visible { box-shadow: 0 10px 28px rgba(10,88,120,.14); transform: translateY(-2px); outline: none; }
.live-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.live-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--mist); color: var(--petrol); }
.is-top .live-icon { background: #E8F6EE; color: #1C6B3C; }
.is-low .live-icon { background: #FDECEA; color: var(--danger); }
.is-pick .live-icon { background: var(--lemon-soft); color: #8A6400; }
.live-title { font-weight: 700; color: var(--ink); }
.live-extra { margin-inline-start: auto; min-width: 0; flex: 1 1 180px; }
.live-extra .ss { width: 100%; }
.live-name { display: grid; gap: 2px; }
.live-name b { font-size: 1.06rem; }
.live-name .muted { font-size: .76rem; }
.live-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.live-stats span { display: grid; gap: 2px; padding: 8px; border-radius: 10px; background: var(--mist); }
.live-stats small { font-size: .7rem; color: var(--muted); }
.live-stats b { font-size: .92rem; direction: ltr; text-align: start; }
.live-stats b.is-good { color: #1C6B3C; }
.live-stats b.is-bad { color: var(--danger); }
.live-age { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .8rem; }
.live-age svg { width: 16px; height: 16px; color: var(--muted); }
.live-staff { display: grid; gap: 6px; font-size: .82rem; }
.live-staff-h { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--petrol-deep); }
.live-staff-h svg { width: 16px; height: 16px; }
.live-staff ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.live-staff li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 8px; background: var(--mist); }
.live-staff li.is-ph { background: #E8F3F7; }
.live-staff .st-dot { width: 8px; height: 8px; border-radius: 50%; background: #B9C9D0; }
.live-staff li.is-open .st-dot { background: var(--leaf); box-shadow: 0 0 0 3px #D7EFD7; }
.live-staff .st-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.live-staff .st-job { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.live-staff li.is-ph .st-job { color: var(--petrol); font-weight: 700; }
.live-staff .st-time { font-size: .72rem; color: var(--muted); direction: ltr; }
.live-empty { margin: 0; color: var(--muted); font-size: .86rem; }
.live-skel { display: grid; gap: 10px; }
.live-skel .kpi-wait { width: 100%; height: 22px; }
.live-spin { position: absolute; top: 14px; inset-inline-end: 14px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--petrol); animation: spin .8s linear infinite; }
.live-card:has(.live-extra) .live-spin { top: auto; bottom: 14px; }

/* فلاتر صفحة ساعات الذروة */
.hour-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 8px; }
.filter.is-check { display: flex; align-items: center; gap: 6px; height: 38px; cursor: pointer; white-space: nowrap; }
.filter.is-check input { min-width: 0; width: 18px; height: 18px; accent-color: var(--petrol); }
.hour-filter-btns { display: flex; gap: 8px; margin-inline-start: auto; }
.chip-x { border: 0; background: transparent; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 2px; color: inherit; }

@media (max-width: 1100px) {
    .live-grid, .rush-levels { grid-template-columns: 1fr; }
    .live-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hour-filter-btns { margin-inline-start: 0; width: 100%; }
}

/* نتيجة تشغيل سكريبت من الموقع */
.set-ok  { color: #1C6B3C; font-weight: 700; margin: 0 0 10px; }
.set-err { color: var(--danger); font-weight: 700; margin: 0 0 10px; }
.set-log { background: var(--mist); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; max-height: 320px; overflow: auto;
           white-space: pre-wrap; font-size: .8rem; line-height: 1.6; margin: 0 0 12px; }
.set-log.is-err { background: #FDECEA; border-color: #F5C2BC; color: var(--danger); }
.set-actions { white-space: nowrap; }
.set-actions .btn-ghost, .set-actions .btn-lemon { margin-inline-end: 6px; }
.tabs.is-hidden { display: none; }
.hours-status ul { margin: 6px 0 0; padding-inline-start: 18px; display: grid; gap: 3px; font-weight: 400; }
.hours-status li.is-err { color: var(--danger); }
.script-table { max-height: 360px; overflow: auto; margin-bottom: 12px; }
.script-table td { font-size: .8rem; white-space: nowrap; }
.maint-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 10px; }
.maint-item { display: grid; gap: 6px; align-content: start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--mist); }
.maint-item .set-mini { justify-self: start; }

/* الفروع: الذروة × المداومون */
.cov-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.cov-filter { flex-wrap: wrap; }
.cov-count { display: inline-block; min-width: 20px; padding: 0 6px; margin-inline-start: 4px; border-radius: 10px; background: rgba(10,88,120,.1); font-size: .7rem; font-weight: 700; }
.cov-filter .is-on .cov-count { background: rgba(255,255,255,.3); }
.cov-note { font-size: .76rem; color: var(--muted); margin: 0 0 10px; line-height: 1.7; }
.sg td.is-warn { color: #8A5300; font-weight: 700; background-color: #FFF4E5; }

/* صلاحيات الكروت: لو كارت "الحاضرون الآن" مخفى ← الأرقام تاخد العرض كله */
.today.no-hero { grid-template-columns: 1fr; }

/* صلاحيات الكروت تحت الصفحة (شاشة الصلاحيات) */
.pm-cards { margin: 2px 0 8px; margin-inline-start: 44px; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 10px; background: #FBFCFD; }
.pm-cards.is-off { opacity: .6; }
.pm-cards-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pm-cards-toggle { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 2px 0; font: inherit; font-size: .84rem; color: var(--petrol-deep); font-weight: 600; cursor: pointer; }
.pm-cards-toggle b { padding: 0 8px; border-radius: 99px; background: var(--mist); font-size: .74rem; }
.pm-cards-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pm-cards-toggle .pm-cards-chev { transition: transform .2s; }
.pm-cards-toggle[aria-expanded="false"] .pm-cards-chev { transform: rotate(90deg); }
.pm-cards-head .set-mini { margin-inline-start: auto; }
.pm-cards-head .set-mini + .set-mini { margin-inline-start: 0; }
.pm-card-group { display: grid; grid-template-columns: 150px 1fr; gap: 8px; align-items: start; margin-top: 8px; }
.pm-card-gname { font-size: .76rem; color: var(--muted); font-weight: 600; padding-top: 6px; }
.pm-card-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pm-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 6px; border: 1px solid var(--line); border-radius: 99px; background: #fff;
           font: inherit; font-size: .8rem; color: var(--muted); text-decoration: line-through; cursor: pointer; transition: background .15s, border-color .15s; }
.pm-chip.is-on { color: var(--ink); text-decoration: none; background: rgba(56,152,56,.06); border-color: rgba(56,152,56,.35); }
.pm-chip.is-on .pm-check { background: var(--leaf); border-color: var(--leaf); color: #fff; }
.pm-chip.is-changed { box-shadow: 0 0 0 2px var(--lemon-deep); }
.pm-chip:disabled { cursor: default; }
@media (max-width: 720px) { .pm-cards { margin-inline-start: 0; } .pm-card-group { grid-template-columns: 1fr; } }

/* =====================================================================
   القائمة الجانبية: أعرض + أسماء الصفحات فى سطر واحد + تصغير/فرد
   ===================================================================== */
.nav-item > span, .nav-subitem > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item { white-space: nowrap; }
.side { transition: width .22s ease-out, box-shadow .22s; }

/* زرار التصغير (الكمبيوتر بس) */
.side-collapse { margin-inline-end: auto; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 10px;
                 background: #fff; color: var(--petrol-deep); cursor: pointer; transition: background .15s, border-color .15s; }
.side-collapse:hover { background: var(--lemon-soft); border-color: var(--lemon-deep); }
.side-collapse svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
[dir="ltr"] .side-collapse svg { transform: scaleX(-1); }
.shell.is-mini .side-collapse svg { transform: scaleX(-1); }
[dir="ltr"] .shell.is-mini .side-collapse svg { transform: none; }

@media (min-width: 821px) {
    .shell.is-mini .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--side-mini); padding-inline: 10px; overflow: hidden; }
    .shell.is-mini .main { margin-inline-start: var(--side-mini); }
    .shell.is-mini .side:not(:hover) .side-word,
    .shell.is-mini .side:not(:hover) .nav-label,
    .shell.is-mini .side:not(:hover) .nav-empty,
    .shell.is-mini .side:not(:hover) .nav-sub,
    .shell.is-mini .side:not(:hover) .nav-item > span,
    .shell.is-mini .side:not(:hover) .nav-item > small,
    .shell.is-mini .side:not(:hover) .nav-chevron { display: none; }
    .shell.is-mini .side:not(:hover) .nav-item { justify-content: center; padding-inline: 0; }
    .shell.is-mini .side:not(:hover) .side-brand { justify-content: center; padding-inline: 0; }
    .shell.is-mini .side:not(:hover) .side-mark { height: 38px; }
    .shell.is-mini .side:not(:hover) .nav-item.active::before { inset-inline-start: -10px; }
    /* الوقوف بالماوس: تتفرد فوق الصفحة من غير ما الصفحة تتحرك */
    .shell.is-mini .side:hover { width: var(--side-w); padding-inline: 14px; box-shadow: 0 0 40px rgba(7, 63, 87, .35); overflow: visible; }
}
@media (max-width: 820px) { .side-collapse { display: none; } }

/* تنبيه جهاز المزامنة متوقف (لوحة المبيعات) */
.sync-health { display: flex; align-items: flex-start; gap: 10px; }
.sync-health svg { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; margin-top: 2px; }

/* عرض القائمة على قد أطول اسم شاشة (من 292 لحد 420 بكسل) */
@media (min-width: 821px) {
    .shell:not(.is-mini) .side { width: max-content; min-width: var(--side-w); max-width: 420px; }
    .shell.is-mini .side:hover { width: max-content; min-width: var(--side-w); max-width: 420px; }
    .side .nav-item > span, .side .nav-subitem > span { overflow: visible; }
    .side-nav { overflow-x: hidden; }
}

/* سؤال: فتح الشاشة فى نفس النافذة ولا تبويب جديد */
/* ---------------- تبويبات الشاشات جوه البرنامج (js/app.js - LemonTabs) ---------------- */
.app-tabs {
    position: sticky; top: 64px; z-index: 15;
    display: flex; align-items: flex-end; gap: 4px;
    padding: 8px 20px 0; overflow-x: auto; scrollbar-width: thin;
    background: #eef4f6; border-bottom: 1px solid var(--line);
}
.app-tabs[hidden], .app-frames[hidden] { display: none; }
.app-tab {
    flex: none; display: inline-flex; align-items: center; gap: 6px; max-width: 230px;
    padding: 7px 10px 8px 12px; margin-bottom: -1px; cursor: pointer; user-select: none;
    border: 1px solid transparent; border-bottom: 0; border-radius: 12px 12px 0 0;
    color: var(--muted); font-size: .85rem; white-space: nowrap;
    transition: background .15s, color .15s;
}
.app-tab span { overflow: hidden; text-overflow: ellipsis; }
.app-tab svg { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.app-tab:hover { background: rgba(255, 255, 255, .7); color: var(--ink); }
.app-tab.is-on { background: #fff; color: var(--ink); font-weight: 600; border-color: var(--line); box-shadow: inset 0 3px 0 var(--lemon); }
.app-tab:focus-visible { outline: 2px solid var(--petrol); outline-offset: -2px; }
.app-tab-x {
    flex: none; width: 20px; height: 20px; display: grid; place-items: center; padding: 0;
    border: 0; border-radius: 6px; background: transparent; color: inherit;
    font-size: 16px; line-height: 1; cursor: pointer; opacity: .55;
}
.app-tab-x:hover { background: #fdecea; color: var(--danger); opacity: 1; }
.app-frames { width: 100%; }
.app-frame { display: block; width: 100%; height: calc(100vh - 110px); border: 0; background: var(--bg, #f6f9fa); }
/* شاشة التبويب المفتوح فى القائمة الجانبية */
.side a.is-tab-on { background: rgba(255, 255, 255, .08); color: #fff; }

/* الشاشة جوه تبويب (iframe): من غير القائمة والشريط العلوى */
html.is-embed .side, html.is-embed .side-scrim, html.is-embed .topbar,
html.is-embed .app-tabs, html.is-embed .app-frames { display: none !important; }
html.is-embed .main { margin: 0 !important; }
html.is-embed .content { padding: 20px 24px; }
@media print { .app-tabs, .app-frames { display: none !important; } }

/* =====================================================================
   شاشة جداول قاعدة البيانات (admin/database)
   ===================================================================== */
.db-kpis { margin-bottom: 18px; }
.db-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.db-bar .search { min-width: 220px; flex: 1 1 220px; max-width: 360px; }
.db-wrap { max-height: 640px; overflow: auto; }
.db-table thead th { position: sticky; top: 0; z-index: 1; background: #F3F7F8; }
.db-row { cursor: pointer; }
.db-row:hover td { background: #F7FBFC; }
.db-row.is-locked td { background: #FBFBF6; }
.db-name { font-weight: 600; color: var(--petrol-deep); }
.db-tag { display: inline-block; margin-inline-start: 6px; padding: 0 7px; border-radius: 99px; font-size: .68rem; font-weight: 600; background: var(--mist); color: var(--muted); }
.db-tag.is-ours { background: #E8F6EE; color: #1C6B3C; }
.db-tag.is-locked { background: #FFF5DC; color: #855600; }
.db-size { position: relative; min-width: 120px; }
.db-size b { position: relative; }
.db-bar-fill { position: absolute; inset-block: 6px; inset-inline-end: 4px; width: calc(var(--w) * .9); max-width: 90%; border-radius: 4px; background: linear-gradient(90deg, rgba(224,102,44,.18), rgba(224,102,44,.38)); }
.db-actions { white-space: nowrap; }
.db-btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 3px 10px; font: inherit; font-size: .78rem; cursor: pointer; margin-inline-end: 4px; color: var(--petrol-deep); }
.db-btn:hover:not(:disabled) { background: var(--mist); }
.db-btn.is-warn { color: #8A5300; border-color: #F0D49B; }
.db-btn.is-warn:hover:not(:disabled) { background: #FFF4E5; }
.db-btn.is-danger { color: var(--danger); border-color: #F1B8B3; }
.db-btn.is-danger:hover:not(:disabled) { background: #FDECEA; }
.db-btn:disabled { opacity: .4; cursor: not-allowed; }
.db-confirm p { margin-top: 0; line-height: 1.8; }
.db-type { display: grid; gap: 6px; margin-top: 12px; }
.db-type input { width: 100%; }
.td.is-danger .td-head { background: linear-gradient(135deg, #B42318, #7A1810); }
.td.is-danger .td-head h2 { color: #fff; }
.btn-danger { border: 0; border-radius: 10px; padding: 9px 18px; font: inherit; font-weight: 600; background: var(--danger); color: #fff; cursor: pointer; }
.btn-danger:disabled { opacity: .45; cursor: not-allowed; }
.data-table td.is-bad { color: var(--danger); font-weight: 700; }
.data-table td.is-warn { color: #8A5300; font-weight: 700; }
.data-table td.is-good { color: #1C7C3A; }
@media print { .no-print { display: none !important; } }

/* ===== القاعدة المحلية (admin/local-db) ===== */
.ldb-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.ldb-step { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 18px 18px 16px; }
.ldb-step h3 { margin: 0; font-size: 1.05rem; color: var(--petrol-deep); }
.ldb-step p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.7; flex: 1; }
.ldb-step .btn-primary, .ldb-step .btn-danger { align-self: flex-start; }
.ldb-num { position: absolute; inset-inline-end: 14px; top: 12px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
           font-weight: 700; background: var(--mist); color: var(--petrol); }
.ldb-step.is-done { border-color: var(--leaf); }
.ldb-step.is-done .ldb-num { background: var(--leaf); color: #fff; }
.ldb-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ldb-extra { padding: 12px 16px; margin-bottom: 14px; }
.ldb-log { margin: 0; max-height: 60vh; overflow: auto; white-space: pre-wrap; font-size: .8rem; line-height: 1.6; background: var(--mist); padding: 12px; border-radius: var(--radius-sm); }
.ldb-howto ol { margin: 0; padding-inline-start: 22px; line-height: 2; }
.ldb-code { display: block; margin: 6px 0; padding: 8px 10px; background: var(--mist); border-radius: var(--radius-sm); font-size: .8rem; overflow-wrap: anywhere; }
.ldb-missing { margin: 6px 0 0; font-size: .82rem; }
@media (max-width: 900px) { .ldb-steps { grid-template-columns: 1fr; } }

/* =====================================================================
   تحليل الأصناف + تارجت الأصناف (Pages/Sales/ItemSales.razor - سكريبت 50)
   ===================================================================== */
.itm-tabs { align-self: flex-end; }
.itm-tabs button { display: inline-flex; align-items: center; gap: 6px; height: 40px; }
.itm-tabs svg { width: 16px; height: 16px; fill: currentColor; }
.itm-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; padding: 12px 14px; margin: -4px 0 12px;
           background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.itm-find { position: relative; display: grid; gap: 4px; min-width: 280px; flex: 1 1 280px; max-width: 460px; }
.itm-find .search { height: 40px; width: 100%; }
.itm-hits { position: absolute; inset-inline: 0; top: 100%; z-index: 30; margin: 4px 0 0; padding: 4px; list-style: none;
            background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(7, 63, 87, .16);
            max-height: 320px; overflow: auto; }
.itm-hits li { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.itm-hits li:hover { background: var(--lemon-soft); }
.itm-chip { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 6px 0 12px; border-radius: 10px;
            background: var(--lemon-soft); border: 1px solid var(--lemon-deep); max-width: 100%; }
.itm-chip b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.itm-x { border: 0; background: transparent; font-size: 1.3rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 6px; }
.itm-group { flex-wrap: wrap; }
.itm-group button { height: 34px; padding: 0 10px; font-size: .82rem; }
.itm-kpis { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.itm-tbar { align-items: center; }
.itm-tbar input[type=month] { height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; font: inherit; }
.itm-months { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .82rem; }
.itm-mchip { cursor: pointer; border: 1px solid var(--line); }
.itm-mchip.is-on { background: var(--petrol); color: #fff; }
.itm-spacer { flex: 1 1 auto; }
.itm-upload { display: inline-flex; align-items: center; gap: 6px; height: 40px; cursor: pointer; }
.itm-upload svg, .itm-tbar .btn-ghost svg { width: 16px; height: 16px; fill: currentColor; }
.itm-tbar .btn-ghost { display: inline-flex; align-items: center; gap: 6px; height: 40px; }
.btn-ghost.is-danger { color: #B42318; border-color: #F2B8B5; }
.itm-pv { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip-info.is-good { background: #E6F5EC; color: #15803D; }
.chip-info.is-bad { background: #FDECEA; color: #B42318; }
.itm-h4 { margin: 12px 0 6px; font-size: .9rem; }
.itm-replace { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: .88rem; }
@media (max-width: 720px) {
    .itm-find { min-width: 0; max-width: none; }
    .itm-tabs { width: 100%; }
    .itm-tabs button { flex: 1; justify-content: center; }
}

/* =====================================================================
   تجهيز سيرفر جديد (Pages/Admin/ServerSetup.razor + Widgets/SetupRow.razor)
   ===================================================================== */
.sv-hero { display: flex; gap: 22px; align-items: center; padding: 18px 20px; margin-bottom: 16px; border-radius: var(--radius);
           background: linear-gradient(120deg, #F3FAF8 0%, #FFFBEA 100%); border: 1px solid var(--line); }
.sv-ring { --p: 0; flex: 0 0 auto; width: 112px; height: 112px; border-radius: 50%; display: grid; place-content: center; text-align: center;
           background: radial-gradient(closest-side, #fff 76%, transparent 77% 100%), conic-gradient(var(--petrol) calc(var(--p) * 1%), #E3ECEF 0); }
.sv-ring b { font-size: 2rem; line-height: 1; color: var(--petrol-deep); }
.sv-ring small { color: var(--muted); font-size: .8rem; }
.sv-hero-text { flex: 1 1 auto; min-width: 0; }
.sv-hero-text h2 { margin: 0 0 8px; font-size: 1.25rem; color: var(--petrol-deep); }
.sv-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.sv-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.sv-nav-i { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 999px;
            padding: 4px 12px 4px 4px; font: inherit; font-size: .8rem; cursor: pointer; color: var(--petrol-deep); }
.sv-nav-i span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-content: center; background: #E3ECEF; font-weight: 700; font-size: .75rem; }
.sv-nav-i.is-ok span { background: #15803D; color: #fff; }
.sv-nav-i.is-warn span { background: #D97706; color: #fff; }
.sv-nav-i.is-info span { background: var(--petrol); color: #fff; }

.sv-step { position: relative; background: #fff; border: 1px solid var(--line); border-inline-start: 5px solid #C9D6DB; border-radius: var(--radius);
           padding: 14px 18px 8px; margin-bottom: 14px; scroll-margin-top: 80px; }
.sv-step.is-ok { border-inline-start-color: #15803D; }
.sv-step.is-warn { border-inline-start-color: #D97706; }
.sv-step.is-info { border-inline-start-color: var(--petrol); }
.sv-step > header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.sv-step > header h3 { margin: 0; font-size: 1.08rem; color: var(--petrol-deep); flex: 1 1 auto; }
.sv-num { width: 32px; height: 32px; border-radius: 50%; display: grid; place-content: center; font-weight: 800; background: var(--petrol); color: #fff; }
.sv-step.is-ok .sv-num { background: #15803D; }
.sv-step.is-warn .sv-num { background: #D97706; }
.sv-state { font-style: normal; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #EEF3F5; color: var(--muted); }
.sv-step.is-ok .sv-state { background: #E6F5EC; color: #15803D; }
.sv-step.is-warn .sv-state { background: #FEF3E2; color: #B45309; }
.sv-intro { margin: 0 0 8px; color: var(--muted); font-size: .88rem; line-height: 1.7; }

.sv-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 18px; padding: 12px 0; border-top: 1px dashed var(--line); }
.sv-row:first-of-type { border-top: 0; }
.sv-row-text h4 { margin: 0 0 4px; font-size: .95rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sv-row-text p { margin: 0 0 6px; font-size: .86rem; color: #36505B; line-height: 1.75; }
.sv-dot { width: 10px; height: 10px; border-radius: 50%; background: #C9D6DB; flex: 0 0 auto; }
.sv-row.is-ok .sv-dot { background: #15803D; }
.sv-row.is-warn .sv-dot { background: #D97706; }
.sv-row.is-info .sv-dot { background: var(--petrol); }
.sv-row.is-todo .sv-dot { background: #fff; border: 2px solid #94A9B2; }
.sv-badge { font-style: normal; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--lemon-soft); color: #7A5A00; }
.sv-row-act { display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 170px; }
.sv-row-act .btn-lemon, .sv-row-act .btn-ghost { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; white-space: nowrap; }
.sv-row-act svg { width: 16px; height: 16px; fill: currentColor; }
.sv-file { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; margin: 2px 0 4px; padding: 3px 4px 3px 10px; border-radius: 8px;
           background: #F4F8F9; border: 1px solid var(--line); font-size: .8rem; }
.sv-file + .sv-file { margin-inline-start: 6px; }
.sv-file > svg { width: 14px; height: 14px; fill: var(--muted); flex: 0 0 auto; }
.sv-file code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--petrol-deep); }
.sv-copy { border: 0; background: transparent; cursor: pointer; padding: 2px 4px; border-radius: 6px; display: grid; place-content: center; }
.sv-copy:hover { background: var(--lemon-soft); }
.sv-copy svg { width: 14px; height: 14px; fill: var(--petrol); }
.sv-log { grid-column: 1 / -1; margin: 4px 0 0; padding: 10px 12px; max-height: 280px; overflow: auto; white-space: pre-wrap; word-break: break-word;
          background: #0E2A36; color: #D5F0E6; border-radius: 10px; font-size: .78rem; line-height: 1.6; }
.sv-cmd { max-height: 420px; }
.sv-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px 12px; margin: 6px 0 2px; }
.sv-form label { display: grid; gap: 3px; font-size: .8rem; color: var(--muted); font-weight: 600; }
.sv-form input, .sv-form select { height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font: inherit; font-size: .85rem; color: #1D3540; background: #fff; min-width: 0; }
.sv-form .sv-wide { grid-column: 1 / -1; }
.sv-pwd { display: flex; gap: 6px; }
.sv-pwd input { flex: 1 1 auto; }
.sv-pwd .btn-ghost { height: 36px; }
.sv-check { display: flex !important; align-items: center; gap: 8px; font-weight: 600; color: #1D3540 !important; font-size: .85rem !important; }
.sv-check input { width: 18px; height: 18px; }
.sv-targets { display: grid; gap: 6px; margin: 6px 0; }
.sv-proj { margin-bottom: 4px; }
.sv-found { margin: 4px 0; font-size: .84rem; color: #1D3540; }
.sv-err { color: #B42318; }
.sv-dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 6px 0; font-size: .84rem; }
.sv-dl dt { color: var(--muted); }
.sv-dl dd { margin: 0; word-break: break-all; }
.sv-table { margin-top: 6px; }
.sv-list { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 6px; }
.sv-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .84rem; }
.sv-final { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin: 10px 0 8px; }
.sv-final-i { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); font-size: .84rem; }
.sv-final-i span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-content: center; background: #E3ECEF; font-weight: 700; font-size: .75rem; }
.sv-final-i em { margin-inline-start: auto; font-style: normal; font-size: .74rem; color: var(--muted); }
.sv-final-i.is-ok { background: #F1FAF4; } .sv-final-i.is-ok span { background: #15803D; color: #fff; }
.sv-final-i.is-warn { background: #FFF8EC; } .sv-final-i.is-warn span { background: #D97706; color: #fff; }
.sv-final-i.is-info span { background: var(--petrol); color: #fff; }
@media (max-width: 760px) {
    .sv-hero { flex-direction: column; align-items: flex-start; }
    .sv-row { grid-template-columns: 1fr; }
    .sv-row-act { flex-direction: row; flex-wrap: wrap; min-width: 0; }
    .sv-file { max-width: 100%; }
}

/* =====================================================================
   الجهاز الحالى (Pages/Admin/CurrentMachine.razor + Widgets/ServicePanel.razor)
   ===================================================================== */
.sv-row.is-err .sv-dot { background: #B42318; }
.sv-row.is-err .sv-row-text h4 { color: #B42318; }
.sv-step.is-err { border-inline-start-color: #B42318; }
.sv-step.is-err .sv-num { background: #B42318; }
.sv-step.is-err .sv-state { background: #FDECEA; color: #B42318; }
.sv-nav-i.is-err span { background: #B42318; color: #fff; }
.cm-head-act { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cm-hero.is-err { background: linear-gradient(120deg, #FFF4F2 0%, #FFFBEA 100%); }
.cm-hero.is-err .sv-ring { background: radial-gradient(closest-side, #fff 76%, transparent 77% 100%), conic-gradient(#B42318 calc(var(--p) * 1%), #F6D9D6 0); }
.cm-hero.is-warn .sv-ring { background: radial-gradient(closest-side, #fff 76%, transparent 77% 100%), conic-gradient(#D97706 calc(var(--p) * 1%), #F7E6CC 0); }
.cm-hero.is-ok .sv-ring { background: radial-gradient(closest-side, #fff 76%, transparent 77% 100%), conic-gradient(#15803D calc(var(--p) * 1%), #DCEFE3 0); }
.cm-problems { list-style: none; margin: 4px 0 10px; padding: 0; display: grid; gap: 6px; }
.cm-problems li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.cm-problems li.is-err { border-color: #F2B8B5; }
.cm-problems li.is-warn { border-color: #F5D9A8; }
.cm-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; display: inline-block; margin-inline-end: 6px; background: #94A9B2; }
.is-err > .cm-dot, tr.is-err .cm-dot { background: #B42318; }
.is-warn > .cm-dot, tr.is-warn .cm-dot { background: #D97706; }
tr.is-ok .cm-dot { background: #15803D; }
tr.is-info .cm-dot { background: var(--petrol); }
.cm-go { flex: 1 1 auto; min-width: 0; border: 0; background: transparent; text-align: start; font: inherit; font-size: .85rem; cursor: pointer; color: #1D3540; padding: 0; }
.cm-go span { color: var(--muted); overflow-wrap: anywhere; }
.cm-go:hover b { text-decoration: underline; }
.cm-problems .set-mini { flex: 0 0 auto; white-space: nowrap; }   /* زرار الإصلاح مايتضغطش بسبب طول الرسالة */
/* تفاصيل سطر مشكلة (زى «أخطاء الخدمة»): بتتفتح تحت السطر بزرار «التفاصيل» */
.cm-problems li.cm-more-box { display: block; padding: 10px 12px; background: #FFFBF3; border-color: #F5D9A8; margin-top: -4px; }
.cm-events { display: grid; gap: 6px; }
.cm-events-note { margin: 0 0 4px; font-size: .8rem; color: var(--muted); line-height: 1.6; }
.cm-event { border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.cm-event > summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 7px 10px; cursor: pointer; font-size: .82rem; list-style: none; }
.cm-event > summary::-webkit-details-marker { display: none; }
.cm-event > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
.cm-event[open] > summary::before { transform: rotate(90deg); }
[dir="rtl"] .cm-event > summary::before { content: "◂"; }
[dir="rtl"] .cm-event[open] > summary::before { transform: rotate(-90deg); }
.cm-ev-time { font-weight: 700; color: #B42318; font-variant-numeric: tabular-nums; }
.cm-ev-src { color: var(--petrol); font-weight: 600; }
.cm-ev-first { flex: 1 1 260px; min-width: 0; color: #1D3540; overflow-wrap: anywhere; direction: ltr; text-align: left; unicode-bidi: isolate; }
.cm-event pre { margin: 0; padding: 10px 12px; max-height: 320px; overflow: auto; background: #12313F; color: #E6F1F4; font-size: .74rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word; text-align: left; }
.cm-fixall { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 10px; }
.cm-fixall svg { width: 16px; height: 16px; fill: currentColor; }
.cm-disks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 6px 0; }
.cm-disk { display: grid; gap: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: .82rem; }
.cm-bar { height: 8px; border-radius: 999px; background: #E3ECEF; overflow: hidden; }
.cm-bar i { display: block; height: 100%; background: var(--petrol); }
.cm-disk.is-warn .cm-bar i { background: #D97706; }
.cm-disk.is-err .cm-bar i { background: #B42318; }
.cm-jobs tr.is-err td { background: #FFF6F5; }
.cm-jobs tr.is-warn td { background: #FFFAF0; }
.cm-msg { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.svc-strip { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 14px; margin: 6px 0 10px; border-radius: 12px; border: 1px solid var(--line); background: #F7FAFB; }
.svc-strip.is-ok { background: #F1FAF4; border-color: #BFE3CB; }
.svc-strip.is-err { background: #FFF4F2; border-color: #F2B8B5; }
.svc-strip.is-warn { background: #FFF8EC; border-color: #F5D9A8; }
.svc-strip .sv-chips { flex: 1 1 320px; margin: 0; }
.svc-pill { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1rem; color: var(--petrol-deep); }
.svc-led { width: 14px; height: 14px; border-radius: 50%; background: #94A9B2; box-shadow: 0 0 0 4px rgba(148, 169, 178, .2); }
.svc-strip.is-ok .svc-led { background: #16A34A; box-shadow: 0 0 0 4px rgba(22, 163, 74, .2); animation: svc-pulse 2s infinite; }
.svc-strip.is-err .svc-led { background: #B42318; box-shadow: 0 0 0 4px rgba(180, 35, 24, .2); }
.svc-strip.is-warn .svc-led { background: #D97706; }
@keyframes svc-pulse { 50% { box-shadow: 0 0 0 7px rgba(22, 163, 74, .08); } }
.svc-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.svc-btns .btn-lemon, .svc-btns .btn-ghost { display: inline-flex; align-items: center; gap: 6px; height: 38px; }
.svc-btns svg { width: 16px; height: 16px; fill: currentColor; }
.svc-checks { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 4px; font-size: .85rem; }
.svc-checks li.is-ok { color: #15803D; }
.svc-checks li.is-bad { color: #B42318; }
.svc-events { display: grid; gap: 6px; margin: 6px 0; }
.svc-events details { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: .82rem; background: #fff; }
.svc-events details.is-error { border-color: #F2B8B5; }
.svc-events details.is-warn { border-color: #F5D9A8; }
.svc-events details.is-ok { border-color: #BFE3CB; }
.svc-events summary { cursor: pointer; overflow-wrap: anywhere; }
.svc-events summary em { font-style: normal; color: var(--muted); margin-inline: 6px; }
.svc-events pre { margin: 6px 0 0; padding: 8px 10px; max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word; background: #0E2A36; color: #D5F0E6; border-radius: 8px; font-size: .76rem; }
@media (max-width: 760px) {
    .cm-problems li { flex-wrap: wrap; }
    .cm-msg { max-width: 180px; }
}
.cm-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 8px 0 12px; }
.cm-auto-i { display: grid; gap: 3px; align-content: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.cm-auto-i small { color: var(--muted); font-size: .76rem; font-weight: 600; }
.cm-auto-i b { color: var(--petrol-deep); font-size: .98rem; overflow-wrap: anywhere; }
.cm-auto-i span { font-size: .8rem; color: #36505B; }
.cm-auto-i .set-mini { justify-self: start; margin-top: 4px; }
.cm-auto.is-ok .cm-auto-i:first-child { background: #F1FAF4; border-color: #BFE3CB; }
.cm-auto.is-warn .cm-auto-i:first-child { background: #FFF8EC; border-color: #F5D9A8; }
.cm-auto.is-err .cm-auto-i:first-child { background: #FFF4F2; border-color: #F2B8B5; }
.cm-auto.is-err .cm-auto-i:first-child b { color: #B42318; }
.cm-history { margin: 10px 0 6px; }
.cm-history summary { cursor: pointer; font-weight: 700; color: var(--petrol-deep); font-size: .88rem; padding: 4px 0; }
.cm-history tr.is-err td { background: #FFF6F5; }
.cm-jobs-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; }
.cm-jobs tr.is-run td { background: #F0F7FF; }
tr.is-run .cm-dot { background: #2563EB; animation: svc-pulse 2s infinite; }
tr.is-wait .cm-dot { background: #94A9B2; }
.cm-steps { border: 1px solid #F5D9A8; background: #FFFBF3; border-radius: 12px; padding: 12px 14px; margin: 0 0 12px; }
.cm-steps h4 { margin: 0 0 4px; color: var(--petrol-deep); font-size: .98rem; }
.cm-steps p { margin: 0 0 8px; font-size: .82rem; }
.cm-steps ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cm-steps li { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border-radius: 10px; background: #fff; border: 1px solid var(--line); font-size: .86rem; }
.cm-steps li > span { display: grid; gap: 2px; font-weight: 600; color: #1D3540; }
.cm-steps li small { font-weight: 400; }
.cm-steps li.is-ok { background: #F1FAF4; border-color: #BFE3CB; }
.cm-steps li.is-ok > span { color: #15803D; }
.cm-steps.is-done { border-color: #BFE3CB; background: #F4FBF6; }
.cm-steps.is-done h4 { color: #15803D; }

/* ===== الأرقام الطويلة فى الكروت: تصغر ومتتقصش (كانت أول خانة بتختفى ورا حافة الكارت) ===== */
.kpi { grid-template-columns: auto minmax(0, 1fr); container-type: inline-size; }
.kpi > * { min-width: 0; }
.kpi-value { white-space: nowrap; }
.kpi-value.is-long  { font-size: min(1.45rem, 10.5cqi); }
.kpi-value.is-xlong { font-size: min(1.2rem, 8.5cqi); }
.kpi.is-hero .kpi-value.is-long  { font-size: min(2rem, 10.5cqi); }
.kpi.is-hero .kpi-value.is-xlong { font-size: min(1.6rem, 8.5cqi); }
.kpi-value .kpi-delta { white-space: nowrap; }
@media (max-width: 600px) { .kpi { grid-template-columns: minmax(0, 1fr); } }

/* ===================== شاشة الفروع (sales/branches) ===================== */
.dash-alert.is-ok { background: #E8F5E9; border-color: #BFE3C4; color: #1E5E24; }
.bn-undo { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bn-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 0; max-width: 980px; }
.bn-kpis { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.bn-filters { padding: 12px 14px; }
.bn-filters .bn-search { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--muted); font-weight: 600; }
.bn-filters .bn-search .search { min-width: 230px; height: 38px; }
.bn-days { display: flex; align-items: flex-end; gap: 6px; }
.bn-days label { display: flex; flex-direction: column; gap: 4px; font-size: .78rem; color: var(--muted); font-weight: 600; }
.bn-days .set-input { width: 74px; height: 38px; text-align: center; }
.bn-days small { padding-bottom: 10px; }
.bn-head { flex-wrap: wrap; gap: 10px; }
.bn-head h2 { display: flex; align-items: center; gap: 8px; }
.bn-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.bn-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.bn-sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line); }
.bn-sw.is-bad { background: #FDE7E5; border-color: #F3B8B2; }
.bn-sw.is-cos { background: #FFF6D6; border-color: #F0D98A; }
.bn-wrap { max-height: 68vh; }
.mx.is-max .bn-wrap { max-height: none; flex: 1; }
.bn-table { font-size: .82rem; }
.bn-table thead tr.bn-groups th { top: 0; height: 27px; box-sizing: border-box; text-align: center; font-size: .74rem; letter-spacing: .02em; padding: 5px 8px; border-bottom: 0; }
.bn-table thead tr:nth-child(2) th { top: 27px; cursor: pointer; user-select: none; }
.bn-table th.bn-g-ascon { background: #E6F0F4; color: var(--petrol-deep); }
.bn-table th.bn-g-att { background: #EEF0FB; color: #3B3F8F; }
.bn-table th.bn-g-ops { background: #F3F6EC; color: #43571B; }
.bn-table td.is-text { max-width: 230px; }
.bn-table td.bn-code { position: sticky; inset-inline-start: 0; z-index: 1; background: #fff; font-size: .78rem; color: var(--muted); }
.bn-table th:first-child { position: sticky; inset-inline-start: 0; z-index: 3; }
.bn-table tbody tr:hover td.bn-code { background: #FAFCE8; }
.bn-table td.bn-bad { background-color: #FDE7E5 !important; color: #8E1F15; box-shadow: inset 0 0 0 1px #F6C9C4; }
.bn-table td.bn-cos { background-color: #FFF6D6 !important; box-shadow: inset 0 0 0 1px #F3E2A6; }
.bn-cmp td.bn-bad { background: #FDE7E5; color: #8E1F15; }
.bn-cmp td.bn-cos { background: #FFF6D6; }
.bn-table tr.is-out td { color: var(--muted); }
.bn-table tr.is-out td.bn-code::after { content: "⊘"; margin-inline-start: 4px; color: #8A3FA0; }
.bn-table tr.is-unlinked td { background: #FBFCFD; }
.bn-table tr.is-closed td:not(.bn-bad):not(.bn-cos) { background-color: #FCF7F6; }
.bn-sel { min-width: 130px; height: 28px; font-size: .8rem; }
.bn-fix { height: 26px; padding: 0 8px; white-space: nowrap; }
.bn-okmark { color: #2F7D32; font-weight: 700; padding-inline: 8px; }
.bn-check { width: 18px; height: 18px; accent-color: var(--petrol); cursor: pointer; }
.bn-state { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; }
.bn-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.bn-state.is-open { background: #E6F5EC; color: #15803D; }
.bn-state.is-idle { background: #FFF1DB; color: #9A5B00; }
.bn-state.is-closed { background: #FDECEA; color: #B42318; }
.bn-why { display: block; font-size: .72rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.bn-detail { display: flex; flex-direction: column; gap: 14px; }
.bn-status-card { border-radius: 12px; padding: 12px 16px; border: 1px solid var(--line); }
.bn-status-card b { font-size: 1.05rem; }
.bn-status-card ul { margin: 6px 0 0; padding-inline-start: 20px; font-size: .86rem; }
.bn-status-card.is-open { background: #F1FAF4; border-color: #C9E8D3; color: #155E2E; }
.bn-status-card.is-idle { background: #FFF8EC; border-color: #F4DDB5; color: #7A4800; }
.bn-status-card.is-closed { background: #FEF3F2; border-color: #F5C8C3; color: #8E1F15; }
.bn-cmp td { white-space: normal; }
.bn-dl { grid-template-columns: max-content 1fr; }
.bn-rn-wrap { max-height: 52vh; }
.bn-rn td.bn-old { color: #9B2C1F; text-decoration: line-through; text-decoration-color: rgba(155, 44, 31, .45); }
.bn-rn td.bn-new { color: #17662B; font-weight: 600; }
.bn-rn tr.is-off td { opacity: .5; }
.bn-h4 { margin: 14px 0 6px; color: var(--petrol-deep); }
@media (max-width: 700px) {
    .bn-filters .bn-search .search { min-width: 0; width: 100%; }
    .bn-days { width: 100%; }
}

/* ===================== تنظيم المهام المجدولة (إعدادات التحليلات ← المهام) ===================== */
.jobs-tools { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; margin-bottom: 14px; }
.jobs-tools-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.jobs-tools .jobs-report { min-width: 260px; }
.jobs-search { min-width: 220px; flex: 1 1 220px; max-width: 360px; height: 38px; }
.jobs-areas { display: flex; flex-wrap: wrap; gap: 8px; }
.jobs-area-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
    background: #fff; color: var(--ink); font-size: .84rem; text-decoration: none; cursor: pointer; transition: border-color .15s, background .15s; }
.jobs-area-chip svg { width: 16px; height: 16px; fill: none; stroke: var(--petrol); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.jobs-area-chip b { font-size: .74rem; background: var(--mist); color: var(--muted); border-radius: 999px; padding: 1px 7px; }
.jobs-area-chip em { font-style: normal; font-size: .74rem; font-weight: 700; color: var(--danger); }
.jobs-area-chip:hover { border-color: var(--lemon-deep); background: var(--lemon-soft); }
.jobs-area-chip[aria-pressed="true"] { background: var(--petrol); border-color: var(--petrol); color: #fff; }
.jobs-area-chip[aria-pressed="true"] svg { stroke: #fff; }
.jobs-area-chip.is-bad { border-color: #F5C2BD; }
.jobs-area { margin: 6px 0 18px; scroll-margin-top: 80px; }
.jobs-area-head { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; padding-bottom: 8px; border-bottom: 2px solid var(--line); }
.jobs-area-head h3 { margin: 0; font-size: 1.04rem; color: var(--petrol-deep); }
.jobs-area-head p { margin: 2px 0 0; font-size: .82rem; }
.jobs-area-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--lemon-soft); display: grid; place-items: center; flex: none; }
.jobs-area-ico svg { width: 20px; height: 20px; fill: none; stroke: var(--petrol); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.jobs-area-health { margin-inline-start: auto; display: flex; gap: 6px; }
.job-card.is-h-err { border-color: #F5C2BD; }
.job-card.is-h-late { border-color: #F3D19C; }
.job-badge.is-late { background: #FFF1DB; color: #9A5B00; }
.job-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.job-role { font-style: normal; font-size: .72rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.job-role.is-main { background: #E6F0F4; color: var(--petrol-deep); }
.job-role.is-fix { background: #FFF1DB; color: #8A5300; }
.job-role.is-once { background: #F1ECFA; color: #5B3A99; }
.sv-badge.is-heavy { background: #FDECEA; color: var(--danger); }
.job-feeds { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 10px; background: #F6FAF2; border: 1px dashed #CFE3BD; }
.job-feeds > span { font-size: .78rem; font-weight: 700; color: #43571B; }
.job-feeds.is-none { background: var(--mist); border-color: var(--line); }
.job-feeds.is-none > span { font-weight: 500; color: var(--muted); }
.job-feed { border: 1px solid #CFE3BD; background: #fff; color: #2F4A10; border-radius: 999px; padding: 2px 10px; font: inherit; font-size: .76rem; cursor: pointer; }
.job-feed:hover, .job-feed.is-on { background: #43571B; border-color: #43571B; color: #fff; }
.jobs-reports { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; margin-bottom: 14px; }
.jobs-rep { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.jobs-rep-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.jobs-rep-head h3 { margin: 0; font-size: 1rem; color: var(--petrol-deep); }
.jobs-rep-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.jobs-rep-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.jobs-rep-list li.is-err { border-color: #F5C2BD; background: #FFF8F7; }
.jobs-rep-list li.is-late { border-color: #F3D19C; background: #FFFBF3; }
.jobs-rep-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.jobs-rep-main b { font-size: .88rem; }
.jobs-rep-main small { color: var(--muted); font-size: .76rem; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.jobs-rep-list .cm-dot { flex: none; }
.cm-jobs tr.cm-jobs-group td { background: #F4F8F9; color: var(--petrol-deep); font-weight: 700; font-size: .8rem; padding: 6px 10px; }
.cm-jobs tr.cm-jobs-group svg { width: 15px; height: 15px; vertical-align: -3px; fill: none; stroke: var(--petrol); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; margin-inline-end: 4px; }
.cm-feeds { display: block; color: var(--muted); font-size: .72rem; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 700px) { .jobs-reports { grid-template-columns: 1fr; } .jobs-tools .jobs-report { min-width: 0; width: 100%; } }
.jobs-rep-list li.is-ok .cm-dot { background: #15803D; }
.jobs-rep-list li.is-err .cm-dot { background: #B42318; }
.jobs-rep-list li.is-late .cm-dot { background: #D97706; }
.jobs-rep-list li.is-run .cm-dot { background: var(--petrol); }

/* ===================== متابعة المستخدمين (admin/user-activity) + عناوين الدخول (admin/user-ips) ===================== */
.ua-bar { padding: 12px 14px; }
.ua-bar .datebox { min-width: 150px; }
.ua-bar .filter > span, .ua-search > span { display: block; font-size: .8rem; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.ua-search .search { min-width: 240px; height: 38px; }
.ua-kpis { grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); }
.ua-tabs { display: flex; gap: 6px; margin: 4px 0 12px; border-bottom: 2px solid var(--line); flex-wrap: wrap; }
.ua-tabs button { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 10px 16px; font: inherit; font-weight: 700; color: var(--muted);
    border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer; }
.ua-tabs button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ua-tabs button.is-on { color: var(--petrol-deep); border-bottom-color: var(--lemon-deep); }
.ua-tabs em { font-style: normal; font-size: .72rem; background: var(--mist); border-radius: 999px; padding: 1px 8px; color: var(--muted); }
.ua-tabs em.is-bad { background: #FDECEA; color: var(--danger); }
.ua-user-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 12px 14px; margin-bottom: 12px; }
.ua-user-pick { min-width: 280px; }
.ua-pick-hint { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 34px 20px; text-align: center; color: var(--muted); }
.ua-pick-hint > svg { width: 46px; height: 46px; fill: none; stroke: var(--petrol); stroke-width: 1.5; opacity: .7; }
.ua-top-users { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ua-top-users .chip b { margin-inline-start: 6px; font-size: .74rem; background: var(--lemon-soft); border-radius: 999px; padding: 0 7px; }
.ua-user { display: grid; grid-template-columns: 300px 1fr; gap: 14px; align-items: start; }
.ua-profile { position: sticky; top: 76px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.ua-profile .set-dl { font-size: .86rem; margin: 0; }
.ua-bad { color: var(--danger) !important; }
.ua-h4 { margin: 4px 0 0; font-size: .86rem; color: var(--petrol-deep); }
.ua-ips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: .84rem; }
.ua-ips li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.ua-dev { width: 100%; }
.ua-ipstate { font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: #FFF6D6; color: #7A5A00; }
.ua-ipstate.is-allowed { background: #E6F5EC; color: #15803D; }
.ua-ipstate.is-blocked { background: #FDECEA; color: #B42318; }
.ua-days { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ua-day-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 2px solid var(--line); }
.ua-day-head b { font-size: 1.02rem; color: var(--petrol-deep); }
.ua-sess { padding: 0; margin-bottom: 8px; overflow: hidden; border-inline-start: 4px solid var(--line); }
.ua-sess.is-open { border-inline-start-color: #15803D; }
.ua-sess.is-idle { border-inline-start-color: #D97706; }
.ua-sess.is-closed { border-inline-start-color: #94A9B2; }
.ua-sess-head { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 14px; background: #fff; border: 0; font: inherit; text-align: start; cursor: pointer; }
.ua-sess-head:hover { background: #FAFCE8; }
.ua-span { font-weight: 700; font-variant-numeric: tabular-nums; }
.ua-dur { font-size: .8rem; color: var(--muted); }
.ua-meta { font-size: .8rem; color: var(--ink); background: var(--mist); border-radius: 6px; padding: 2px 8px; }
.ua-counts { display: inline-flex; gap: 8px; margin-inline-start: auto; }
.ua-counts em { font-style: normal; font-size: .78rem; color: var(--muted); }
.ua-chev { color: var(--muted); }
.ua-sess-body { border-top: 1px solid var(--line); padding: 12px 16px; background: #FCFDFD; }
.ua-state { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.ua-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ua-state.is-open { background: #E6F5EC; color: #15803D; }
.ua-state.is-open::before { animation: ua-pulse 1.6s ease-in-out infinite; }
.ua-state.is-idle { background: #FFF1DB; color: #9A5B00; }
.ua-state.is-closed { background: #EEF2F4; color: #5B7480; }
@keyframes ua-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.ua-wrap { max-height: 66vh; }
.mx.is-max .ua-wrap { max-height: none; }
.ua-grid tr.is-open td:first-child { box-shadow: inset 3px 0 0 #15803D; }
.ua-grid tr.is-idle td:first-child { box-shadow: inset 3px 0 0 #D97706; }

/* ---- الجدول الزمنى للجلسة ---- */
.ua-empty { color: var(--muted); padding: 12px; }
.ua-tl { list-style: none; margin: 0; padding: 0 0 0 0; position: relative; }
.ua-tl::before { content: ""; position: absolute; inset-inline-start: 13px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.ua-grp { position: relative; padding-inline-start: 34px; margin-bottom: 12px; }
.ua-grp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ua-grp-head b { color: var(--petrol-deep); }
.ua-grp-head .ua-ico { position: absolute; inset-inline-start: 2px; top: -2px; }
.ua-ico { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: .7rem; flex: none; background: #fff; border: 2px solid var(--line); color: var(--muted); }
.ua-ico svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; }
.ua-ico.is-page { background: var(--petrol); border-color: var(--petrol); color: #fff; }
.ua-ico.is-chat { border-color: #8B5CF6; color: #6D28D9; background: #F3EEFF; }
.ua-ico.is-click { color: var(--petrol); }
.ua-ico.is-change { color: #B45309; }
.ua-ico.is-login { border-color: #15803D; color: #15803D; background: #E6F5EC; }
.ua-ico.is-logout, .ua-ico.is-kicked { border-color: #B42318; color: #B42318; background: #FDECEA; }
.ua-ico.is-close { color: #94A9B2; }
.ua-time { font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ua-grp-head .ua-dur, .ua-cnt { font-style: normal; font-size: .72rem; color: var(--muted); background: var(--mist); border-radius: 999px; padding: 1px 8px; }
.ua-grp.is-system { padding-inline-start: 0; }
.ua-grp.is-system .ua-evs { margin-top: 0; }
.ua-evs { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ua-ev { display: grid; grid-template-columns: 62px 24px 1fr; align-items: start; gap: 8px; font-size: .84rem; padding: 3px 6px; border-radius: 8px; }
.ua-grp.is-system .ua-ev { grid-template-columns: 62px 24px 1fr; margin-inline-start: 0; }
.ua-ev.is-hit { background: #FFF6CF; box-shadow: inset 0 0 0 1px #F0D98A; }
.ua-ev .ua-time { padding-top: 4px; }
.ua-txt { min-width: 0; padding-top: 2px; overflow-wrap: anywhere; }
.ua-k { color: var(--muted); }
.ua-txt mark { background: #FFF1DB; color: #7A4800; border-radius: 4px; padding: 0 4px; }
.ua-txt details summary { cursor: pointer; }
.ua-answer { white-space: pre-wrap; margin: 6px 0; padding: 8px 10px; border-radius: 8px; background: #F7F4FF; border: 1px solid #E4DAFB; font-size: .82rem; line-height: 1.7; }
.ua-table-wrap { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin-top: 6px; }
.ua-table { font-size: .76rem; }

/* ---- نافذة الجلسة ---- */
.ua-dlg { display: flex; flex-direction: column; gap: 12px; }
.ua-dlg-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.ua-card { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.ua-card small { color: var(--muted); font-size: .74rem; }
.ua-card b { font-size: .95rem; color: var(--ink); overflow-wrap: anywhere; }
.ua-card span { font-size: .76rem; color: var(--muted); }
.ua-card.is-open { background: #F1FAF4; border-color: #C9E8D3; }
.ua-card.is-idle { background: #FFF8EC; border-color: #F4DDB5; }
.ua-ua summary { cursor: pointer; font-size: .78rem; color: var(--muted); }
.ua-ua code { display: block; margin-top: 4px; font-size: .74rem; overflow-wrap: anywhere; }
.ua-dlg-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ua-dlg-tools .search { flex: 1 1 220px; max-width: 360px; height: 38px; }
.ua-dlg-tl { max-height: 52vh; overflow: auto; padding: 4px 4px 4px 0; }

/* ---- عناوين الدخول ---- */
.ip-rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 14px; }
.ip-rules > div { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: .82rem; }
.ip-rules b { color: var(--petrol-deep); }
.ip-rules span { color: var(--muted); }
.ip-kpis { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.ip-bar .ip-user { min-width: 260px; }
.ip-grid td.ip-addr { font-weight: 700; }
.ip-grid tr.is-blocked td { background-color: #FFF8F7; }
.ip-grid tr.is-new td:first-child { box-shadow: inset 3px 0 0 #E8A818; }
.ip-grid td.is-bad { color: var(--danger); font-weight: 700; }
.ip-lock { font-style: normal; margin-inline-start: 4px; }
.ip-actions { display: flex; gap: 4px; white-space: nowrap; }
.ip-actions .is-ok { color: #15803D; }
.ip-actions .is-bad { color: var(--danger); }
.ip-form { display: flex; flex-direction: column; gap: 12px; }
.ip-form .filter > span { display: block; font-size: .8rem; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.ip-form .set-input { width: 100%; box-sizing: border-box; }
.pm-ip-lock { font-size: .74rem; font-weight: 700; color: #3B3F8F; margin-inline-start: 6px; }
.pm-ips { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: .84rem; }
.pm-ips li { display: flex; align-items: center; gap: 6px; }
.pm-ip { font-weight: 600; }
.pm-ip-btns { margin-inline-start: auto; display: inline-flex; gap: 4px; }
.pm-ip-btns button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 0 6px; cursor: pointer; font: inherit; font-size: .78rem; }
.pm-ip-links { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 900px) { .ua-user { grid-template-columns: 1fr; } .ua-profile { position: static; } }

/* ---- الفروع: المرجع (اسم القسم) + تعديل العربى ---- */
.bn-sw.is-ref { background: #E6F0F4; border-color: #B9D3DE; }
.bn-table td.bn-ref { background-color: #F1F7FA; font-weight: 600; color: var(--petrol-deep); }
.bn-table td.bn-ar { position: relative; padding-inline-end: 26px; }
.bn-pen { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted);
    cursor: pointer; font-size: .85rem; opacity: 0; transition: opacity .15s; padding: 2px 4px; border-radius: 6px; }
.bn-table tr:hover .bn-pen { opacity: 1; }
.bn-pen:hover { background: var(--lemon-soft); color: var(--petrol); }
.bn-table td.bn-ar.is-editing { padding: 3px 6px; max-width: none; background: #FFFBEA; }
.bn-inline { display: flex; align-items: center; gap: 4px; min-width: 260px; }
.bn-inline .set-input { height: 30px; flex: 1; font-size: .82rem; }
.bn-inline button { border: 1px solid var(--line); background: #fff; border-radius: 6px; width: 28px; height: 28px; cursor: pointer; font-weight: 700; }
.bn-inline .bn-ok { color: #15803D; border-color: #BFE3C4; }
.bn-inline .bn-no { color: var(--danger); }
.bn-edit { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #FCFDFD; }
.bn-edit-ref { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: #F1F7FA; border: 1px solid #D5E6EE; }
.bn-edit-ref small { color: var(--muted); font-size: .76rem; }
.bn-edit-ref b { font-size: 1.02rem; color: var(--petrol-deep); }
.bn-edit-ref span { font-size: .78rem; }
.bn-field { display: flex; flex-direction: column; gap: 4px; }
.bn-field > span:first-child { font-size: .78rem; color: var(--muted); font-weight: 600; }
.bn-field-row { display: flex; gap: 6px; align-items: center; }
.bn-field .set-input { width: 100%; box-sizing: border-box; }
.bn-field.is-bad .set-input { background: #FDE7E5; border-color: #F3B8B2; }
.bn-field.is-ok .set-input { border-color: #BFE3C4; }

/* ===================== تتبع وتحقق التقارير (admin/report-trace) ===================== */
.rt-pick { display: flex; gap: 14px; padding: 16px; align-items: flex-start; flex-wrap: wrap; }
.rt-step, .rt-step-sm { display: inline-grid; place-items: center; border-radius: 50%; background: var(--petrol); color: #fff; font-weight: 800; flex: none; }
.rt-step { width: 34px; height: 34px; font-size: 1rem; }
.rt-step-sm { width: 24px; height: 24px; font-size: .8rem; margin-inline-end: 6px; }
.rt-pick-grid { flex: 1; display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.rt-pick-grid .filter > span { display: block; font-size: .8rem; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.rt-screen { min-width: 260px; }
.rt-element { min-width: 320px; flex: 1 1 320px; }
.rt-store, .rt-user { min-width: 210px; }
.rt-run { height: 40px; padding: 0 22px; font-size: .95rem; }
.rt-desc { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--lemon-soft); font-size: .86rem; }
.rt-kind { font-size: .72rem; font-weight: 800; padding: 2px 9px; border-radius: 999px; background: #fff; color: var(--petrol); border: 1px solid var(--line); }
.rt-kind.is-chart { color: #6D28D9; }
.rt-kind.is-grid { color: #15803D; }
.rt-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.rt-sum { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.rt-sum small { color: var(--muted); font-size: .76rem; }
.rt-sum b { font-size: 1.15rem; color: var(--ink); }
.rt-sum span { font-size: .74rem; color: var(--muted); }
.rt-sum.is-ok { border-color: #BFE3C4; background: #F1FAF4; }
.rt-sum.is-err { border-color: #F5C2BD; background: #FEF3F2; }
.rt-path { padding: 14px 16px; }
.rt-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: rt; }
.rt-entry { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; border-inline-start: 4px solid var(--petrol); }
.rt-entry.is-sql { border-inline-start-color: #2563EB; }
.rt-entry.is-oracle { border-inline-start-color: #EA580C; background: #FFFBF7; }
.rt-entry.is-error { border-inline-start-color: var(--danger); background: #FEF3F2; }
.rt-entry.is-result { border-inline-start-color: #15803D; background: #F4FBF6; }
.rt-entry-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rt-no { width: 24px; height: 24px; border-radius: 50%; background: var(--mist); display: inline-grid; place-items: center; font-size: .74rem; font-weight: 800; color: var(--petrol-deep); }
.rt-at { font-size: .72rem; color: var(--muted); margin-inline-start: auto; }
.rt-ms { font-size: .74rem; font-weight: 700; color: #15803D; background: #E6F5EC; border-radius: 999px; padding: 1px 8px; }
.rt-ms.is-slow { color: #B42318; background: #FDECEA; }
.rt-detail { margin: 6px 0 0; font-size: .84rem; color: var(--ink); white-space: pre-wrap; }
.rt-frames { list-style: none; margin: 6px 0 0; padding: 0 0 0 0; display: flex; flex-direction: column; gap: 2px; }
.rt-frames li { padding-inline-start: 18px; position: relative; font-size: .82rem; }
.rt-frames li::before { content: "↳"; position: absolute; inset-inline-start: 2px; color: var(--muted); }
.rt-frames summary { cursor: pointer; }
.rt-frames code { font-size: .8rem; }
.rt-file { color: #2563EB; background: #EEF4FF; border-radius: 6px; padding: 0 6px; margin-inline-start: 4px; font-size: .74rem; }
.rt-sumtext { color: var(--muted); font-size: .8rem; }
.rt-code { margin: 6px 0; padding: 8px 10px; border-radius: 8px; background: #0F2430; color: #DDEAF0; font-size: .76rem; line-height: 1.55; overflow: auto; max-height: 340px; white-space: pre; text-align: left; }
.rt-code .is-cur { display: inline-block; width: 100%; background: rgba(248, 200, 8, .22); color: #fff; }
.rt-sql { margin-top: 6px; }
.rt-sql summary { cursor: pointer; font-size: .82rem; color: var(--petrol); font-weight: 600; }
.rt-params { margin: 6px 0; font-size: .78rem; width: auto; }
.rt-err { color: var(--danger); font-weight: 600; margin: 6px 0 0; }
.rt-memos { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
.rt-memo-panel { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.rt-memo-panel.is-ora .panel-head h2 { color: #C2410C; }
.rt-memo-tools { display: flex; gap: 6px; }
.rt-memo { width: 100%; box-sizing: border-box; min-height: 300px; resize: vertical; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
    font-family: Consolas, "Cascadia Mono", "Courier New", monospace; font-size: .78rem; line-height: 1.55; background: #FBFCFD; color: var(--ink); text-align: left; white-space: pre; }
.rt-path .rt-memo { min-height: 360px; }
.rt-result-title { font-weight: 800; color: var(--petrol-deep); margin: 6px 0 8px; font-size: 1.05rem; }
.tg { padding: 12px 14px; }
.tg-head { flex-wrap: wrap; gap: 10px; }
.tg-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tg-tools .search { min-width: 220px; height: 34px; }
.tg-group { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
.tg-wrap { max-height: 60vh; }
.mx.is-max .tg-wrap { max-height: none; }
.tg-table td.is-text { max-width: 320px; }
.tg-rn { color: var(--muted); font-size: .72rem; width: 36px; }
.tg-filters th { background: #FAFCFD; padding: 4px 6px; top: 37px; }
.tg-f { width: 100%; min-width: 70px; box-sizing: border-box; height: 26px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font: inherit; font-size: .76rem; }
.tg-more { margin-top: 8px; }
@media (max-width: 1000px) { .rt-memos { grid-template-columns: 1fr; } }
.rt-code, .rt-memo { direction: ltr; }
.rt-frames code, .rt-file { direction: ltr; unicode-bidi: isolate; display: inline-block; }
/* سطور الكود: الرقم شمال والكود بعده — مايتقلبش مع اتجاه الصفحة العربى */
.rt-lines { display: block; white-space: normal; font-family: Consolas, "Cascadia Mono", monospace; }
.rt-ln { display: flex; gap: 14px; direction: ltr; text-align: left; padding: 0 6px; border-radius: 4px; }
.rt-ln .rt-lno { flex: 0 0 2.6em; text-align: right; color: #7FA3B3; user-select: none; font-variant-numeric: tabular-nums; }
.rt-ln .rt-ltx { white-space: pre; unicode-bidi: isolate; direction: ltr; text-align: left; }
.rt-ln.is-cur { background: rgba(248, 200, 8, .22); color: #fff; }
.rt-ln.is-cur .rt-lno { color: var(--lemon); font-weight: 700; }
/* شرح السطور تحت الكود */
.rt-notes { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; gap: 4px; font-size: .82rem; }
.rt-notes li { display: flex; gap: 8px; align-items: baseline; padding: 4px 8px; border-radius: 6px; background: var(--mist); }
.rt-notes li b { flex: 0 0 auto; min-width: 2.4em; text-align: center; font-size: .74rem; color: var(--petrol-deep); background: #fff; border-radius: 99px; padding: 0 6px; }
.rt-notes li.is-cur { background: var(--lemon-soft); border-inline-start: 3px solid var(--lemon-deep); font-weight: 600; }

/* =====================================================================
   مطابقة الأرقام بين التقارير (admin/report-reconcile)
   ===================================================================== */
.rc-pick { display: grid; gap: 12px; }
.rc-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.rc-presets button, .rc-tabs button { height: 32px; padding: 0 14px; border: 1px solid var(--line); border-radius: 99px; background: #fff; color: var(--petrol-deep); font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; }
.rc-presets button.is-on, .rc-tabs button.is-on { background: var(--petrol); border-color: var(--petrol); color: #fff; }
.rc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 12px; align-items: end; }
.rc-grid .filter { display: grid; gap: 4px; }
.rc-grid .filter select { height: 40px; }
.rc-switch { display: grid; gap: 2px; align-self: center; }
.rc-run { height: 40px; font-size: .95rem; }
.rc-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 0; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #fff; }
.rc-summary > b { font-size: 1.2rem; }
.rc-summary.is-ok { border-color: #A6D8B5; background: #F1FAF3; }
.rc-summary.is-ok > b { color: #1E7B3C; }
.rc-summary.is-warn { border-color: #F2D49B; background: #FFF9EC; }
.rc-summary.is-warn > b { color: #9A6700; }
.rc-summary em { color: #B42318; font-style: normal; }
.rc-only { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); cursor: pointer; }
.rc-scroll { overflow: auto; max-height: 70vh; }
.rc-scroll-sm { max-height: 52vh; }
.mx.is-max .rc-scroll { max-height: none; }
.rc-table { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: .84rem; }
.rc-table th, .rc-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rc-table thead th { position: sticky; top: 0; z-index: 2; background: #fff; vertical-align: bottom; text-align: center; min-width: 130px; }
.rc-table thead th b { display: block; font-size: .82rem; color: var(--petrol-deep); }
.rc-table thead th a { text-decoration: none; }
.rc-table thead th a:hover b { text-decoration: underline; }
.rc-table thead th small { display: block; max-width: 190px; margin: 2px auto 4px; white-space: normal; font-weight: 500; color: var(--muted); font-size: .74rem; line-height: 1.35; }
.rc-table th.rc-m { position: sticky; inset-inline-start: 0; z-index: 1; background: #fff; text-align: start; font-weight: 700; min-width: 170px; }
.rc-table thead th.rc-m { z-index: 3; }
.rc-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.rc-tags i, .rc-indep { font-style: normal; font-size: .68rem; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--mist); color: var(--petrol-deep); }
.rc-indep { background: #E8F1FF; color: #1F4E8C; }
.rc-errtag { background: #FDECEC !important; color: #B42318 !important; cursor: help; }
.rc-ms { color: var(--muted) !important; }
.rc-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-inline-end: 6px; vertical-align: middle; }
.rc-v { text-align: right; font-variant-numeric: tabular-nums; }
.rc-v small.rc-delta { display: block; font-size: .7rem; font-weight: 700; color: #9A6700; }
.rc-ref { background: #F5F8FA; }
.rc-table thead th.rc-ref { background: #EEF4F7; }
.rc-diff { background: #FFF4D6 !important; }
.rc-na { text-align: center; color: #B8C4CB; }
.rc-table tbody tr:hover td, .rc-table tbody tr:hover th.rc-m { background-color: rgba(248, 200, 8, .07); }
.rc-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.rc-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; border: 1px solid var(--line); }
.rc-detail { margin-top: 14px; }
.rc-tabs { display: flex; gap: 6px; }
.rc-detail-head { display: flex; align-items: center; gap: 10px; margin: 6px 0 8px; }
.rc-ok { color: #1E7B3C; font-weight: 700; }
.rc-bad { color: #9A6700; font-weight: 700; }
.rc-subhead { margin-bottom: 4px; }
.rc-dtable thead th { min-width: 110px; }
.rc-empty { text-align: center; padding: 18px !important; }
.rc-sql { margin-top: 14px; }
.rc-sql summary { cursor: pointer; font-weight: 700; }
.rc-sql-tools { display: flex; justify-content: flex-end; margin: 8px 0; }
.rc-empty-state ul.rc-places { margin: 8px 0 0; padding-inline-start: 18px; display: grid; gap: 4px; font-size: .88rem; }
@media (max-width: 700px) {
    .rc-only { margin-inline-start: 0; }
    .rc-table th.rc-m { min-width: 130px; }
}

/* إطار تكبير لجدول عادى (من غير panel): زرار التكبير جنب Excel/طباعة مايغطيش عليهم */
.mx-plain { position: relative; }
.mx-plain:not(.is-max) > .mx-btn { top: 0; }
.mx-plain > .mx-main > [data-grid-scope] > .gt-bar { padding-inline-end: 44px; min-height: 34px; }
.mx-plain.rp-gridmx:not(.is-max) > .mx-btn { top: -4px; inset-inline-end: -4px; }
.mx-plain.is-max { padding: 54px 16px 16px; }
.mx-plain.is-max .table-wrap, .mx-plain.is-max .sg-wrap, .mx-plain.is-max .set-wrap, .mx-plain.is-max .rg-wrap { max-height: none; }
.rc-fresh { display: block; margin-top: 3px; font-size: .68rem; color: var(--muted); }
.rc-diag { margin-top: 14px; border-inline-start: 4px solid #F2D49B; }
.rc-diag h2 { font-size: 1rem; margin: 0 0 8px; }
.rc-diag ul { margin: 0; padding-inline-start: 18px; display: grid; gap: 8px; font-size: .88rem; line-height: 1.6; }
.rc-diag li.is-ok { color: #1E7B3C; }

/* =====================================================================
   جداول الاستضافة (admin/host-tables)
   ===================================================================== */
.ht-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
.ht-card { display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #fff; }
.ht-card small { color: var(--muted); font-size: .8rem; }
.ht-card b { font-size: 1.35rem; color: var(--petrol-deep); }
.ht-card span { font-size: .8rem; color: var(--muted); }
.ht-card.is-moved { border-inline-start: 4px solid #F2D49B; }
.ht-card.is-core { border-inline-start: 4px solid #A6D8B5; }
.ht-card.is-sel { border-inline-start: 4px solid #F2B8B5; }
.ht-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; }
.ht-tools .search { flex: 1 1 220px; max-width: 320px; }
.ht-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-inline-start: auto; }
.ht-actions .btn-lemon { height: 36px; padding: 0 16px; border-radius: 99px; font-size: .88rem; }
.ht-actions .btn-lemon svg { width: 16px; height: 16px; }
.ht-drop:not(:disabled) { background: #B42318; }
.ht-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .84rem; }
.ht-table th, .ht-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ht-table thead th { position: sticky; top: 0; z-index: 1; background: #fff; text-align: start; }
.ht-table .ht-chk { width: 34px; text-align: center; }
.ht-table .ht-chk input { width: 17px; height: 17px; accent-color: var(--petrol); }
.ht-table .ht-name { font-family: Consolas, "Cascadia Mono", monospace; font-weight: 600; text-align: left; }
.ht-table tr.is-sel td { background: #FDECEC; }
.ht-table tr.is-gone td { opacity: .55; text-decoration: line-through; }
.ht-table .ht-status { white-space: normal; min-width: 220px; }
.ht-cat { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: .72rem; font-weight: 700; background: var(--mist); color: var(--petrol-deep); }
.ht-cat.is-moved { background: #FFF4D6; color: #8A5A00; }
.ht-cat.is-stage { background: #EEF1F3; color: #556; }
.ht-cat.is-core { background: #E8F6EC; color: #1E7B3C; }
.ht-cat.is-protected { background: #E8F1FF; color: #1F4E8C; }
.ht-ok { color: #1E7B3C; font-weight: 600; }
.ht-block { color: #9A6700; font-size: .8rem; }
.ht-note { color: var(--muted); font-size: .8rem; }
.ht-log { margin-top: 14px; }
.ht-log h2 { font-size: 1rem; margin: 0 0 8px; }
.ht-log ul { margin: 0; padding-inline-start: 18px; display: grid; gap: 4px; font-size: .86rem; }
.ht-log li.is-ok { color: #1E7B3C; }
.ht-log li.is-bad { color: #B42318; }
@media (max-width: 700px) { .ht-actions { margin-inline-start: 0; } }
.ht-fix { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-inline-start: 8px; vertical-align: middle; }
.ht-diff { margin-top: 14px; border-inline-start: 4px solid #F2D49B; }
.ht-diff h2 { font-size: 1rem; margin: 0; }
.ht-diff h3 { font-size: .9rem; margin: 6px 0; }
.ht-diff-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 12px; }
.ht-sample { margin: 0; padding-inline-start: 18px; font-family: Consolas, "Cascadia Mono", monospace; font-size: .78rem; max-height: 300px; overflow: auto; text-align: left; }
.ht-copy { height: 38px; padding: 0 18px; border-radius: 99px; font-size: .9rem; }
@media (max-width: 800px) { .ht-diff-grid { grid-template-columns: minmax(0, 1fr); } }

/* =====================================================================
   الرسومات: أنيميشن (الأعمدة بتطلع، الخطوط بتترسم، الأرقام بتظهر بعدها)
   بيتعاد لما الأرقام تتغير (الرسم بيتعمل من جديد). مين مفضّل حركة أقل ← من غيرها.
   ===================================================================== */
.schart svg { max-width: 100%; }
.schart .sc-bar { transform-box: fill-box; transform-origin: 50% 100%; animation: sc-grow .75s cubic-bezier(.2, .85, .25, 1) both; }
.schart .sc-bar.is-neg { transform-origin: 50% 0; }
.schart .sc-bar:hover { opacity: 1; filter: brightness(1.12) saturate(1.1); }
.schart .sc-val { animation: sc-fade .45s ease-out both; paint-order: stroke; stroke: rgba(255, 255, 255, .85); stroke-width: 3px; stroke-linejoin: round; }
.schart .sc-val.is-v { font-size: 11px; }
.schart .sc-line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: sc-draw 1.1s ease-out forwards; }
.schart .sc-dot { transform-box: fill-box; transform-origin: center; animation: sc-pop .35s ease-out both; transition: r .15s; }
.schart .sc-dot:hover { r: 6.5; }
.schart .sc-cat { font-size: 11.5px; }
.schart.is-lines .sc-hit { display: none; }
@keyframes sc-grow { from { transform: scaleY(0); } }
@keyframes sc-fade { from { opacity: 0; transform: translateY(4px); } }
@keyframes sc-draw { to { stroke-dashoffset: 0; } }
@keyframes sc-pop { from { transform: scale(0); } }

/* أعمدة أفقية / عمودية / ساعات / خط صغير */
.bar-fill { transform-origin: 0 50%; animation: bl-grow .8s cubic-bezier(.2, .85, .25, 1) both; }
[dir="rtl"] .bar-fill { transform-origin: 100% 50%; }
.barlist li:nth-child(2) .bar-fill { animation-delay: .04s; } .barlist li:nth-child(3) .bar-fill { animation-delay: .08s; }
.barlist li:nth-child(4) .bar-fill { animation-delay: .12s; } .barlist li:nth-child(5) .bar-fill { animation-delay: .16s; }
.barlist li:nth-child(n+6) .bar-fill { animation-delay: .2s; }
.barlist .bar-value { animation: sc-fade .5s .35s ease-out both; }
.col-bar { transform-origin: 50% 100%; animation: sc-grow-y .75s cubic-bezier(.2, .85, .25, 1) both; }
.col-value { animation: sc-op .45s .55s ease-out both; }
@keyframes sc-op { from { opacity: 0; } }
.hour-bars .hb { transform-origin: 50% 100%; animation: sc-grow-y .7s cubic-bezier(.2, .85, .25, 1) both; }
.spark polyline { stroke-dasharray: 400; stroke-dashoffset: 400; animation: sc-draw .9s ease-out forwards; }
@keyframes bl-grow { from { transform: scaleX(0); } }
@keyframes sc-grow-y { from { transform: scaleY(0); } }

/* الكروت: ليها ظهور متتابع أصلًا (.kpi ← rise مع --i) - مانلمسهوش.
   (غلطة النسخة اللى فاتت: أنيميشن جديد بدل rise وأول الكارت opacity: 0 ← الكروت فضلت مخفية) */

@media (prefers-reduced-motion: reduce) {
    .schart .sc-bar, .schart .sc-val, .schart .sc-line, .schart .sc-dot, .bar-fill, .barlist .bar-value, .col-bar, .col-value,
    .hour-bars .hb, .spark polyline { animation: none !important; stroke-dashoffset: 0 !important; }
}

/* =====================================================================
   جدول جنب رسمة (أو رسمتين / جدولين جنب بعض): الاتنين بيملوا ارتفاع الصف كله - مفيش فراغ تحت.
   - الجدول: على الأقل ارتفاعه العادى (MaxHeight) ولو الصف أطول بيطول معاه، وصفوفه الكتير scroll جوه.
   - الرسمة: على الأقل ارتفاعها العادى (Height) ولو الصف أطول بترسم نفسها بالارتفاع كله (lemonChart).
   ===================================================================== */
.sales-split > .panel, .sales-two > .panel { display: flex; flex-direction: column; min-width: 0; }
.sales-split > .panel .sg-wrap, .sales-two > .panel .sg-wrap {
    flex: 1 1 auto; min-height: var(--sg-h, 300px); max-height: none !important; contain: size;
}
.sales-split > .panel .schart, .sales-two > .panel .schart { flex: 1 1 auto; min-height: var(--sc-min, 300px); contain: size; display: flex; flex-direction: column; }
.sales-split > .panel .schart > svg, .sales-two > .panel .schart > svg { flex: 0 0 auto; }
.sales-split > .panel .schart > .sc-legend, .sales-two > .panel .schart > .sc-legend { margin-top: auto; }
.mx.is-max .sg-wrap, .mx.is-max .schart { contain: none !important; }

/* صفحة الخطأ: تفاصيل للأدمن */
pre.err-detail { max-width: 100%; white-space: pre-wrap; word-break: break-word; text-align: left; font-size: 12px; background: #FFF4F2; color: #8A2A1B; border: 1px solid #F5C9C0; border-radius: 10px; padding: 10px 12px; margin: 6px 0 0; }
span.err-detail { font-size: 12.5px; color: var(--muted, #5b6b73); }

/* =====================================================================
   الملاحظات والبلاغات (feedback) + تعليم المساعد
   ===================================================================== */
.fb-top { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line);
          background: #fff; color: var(--petrol); font-size: .84rem; font-weight: 600; text-decoration: none; margin-inline-end: 4px; transition: border-color .15s, background .15s; }
.fb-top svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.fb-top:hover { border-color: var(--lemon); background: #FFFBEA; }
@media (max-width: 700px) { .fb-top span { display: none; } .fb-top { padding: 0 9px; } }

.fb-form { padding: 6px 22px 18px; max-width: 980px; }
.fb-step { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 14px; padding: 16px 0; border-bottom: 1px dashed var(--line); }
.fb-num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--petrol); color: #fff; font-weight: 700; font-size: .9rem; }
.fb-chat .fb-num { background: #EDE9FE; font-size: 1rem; }
.fb-body { display: grid; gap: 10px; min-width: 0; }
.fb-body h3 { margin: 4px 0 0; font-size: 1rem; color: var(--ink); }
.fb-req { color: var(--danger); font-style: normal; }
.fb-kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.fb-kind { display: grid; gap: 4px; justify-items: start; text-align: start; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff;
           font: inherit; color: var(--ink); cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.fb-kind:hover { transform: translateY(-1px); border-color: #b8cdd5; }
.fb-kind-ico { font-size: 1.5rem; line-height: 1; }
.fb-kind small { color: var(--muted); font-size: .78rem; line-height: 1.5; }
.fb-kind.is-on { border-color: var(--petrol); box-shadow: 0 0 0 3px rgba(10, 88, 120, .12); background: linear-gradient(135deg, #EEF6F9, #fff 70%); }
.fb-kind.is-bug.is-on { border-color: #C2410C; box-shadow: 0 0 0 3px rgba(194, 65, 12, .12); background: linear-gradient(135deg, #FFF3EC, #fff 70%); }
.fb-kind.is-suggestion.is-on { border-color: #A16207; box-shadow: 0 0 0 3px rgba(248, 200, 8, .25); background: linear-gradient(135deg, #FFFBEA, #fff 70%); }
.fb-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-cat { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1.5px solid var(--line); border-radius: 99px; background: #fff; font: inherit; font-size: .86rem; color: var(--ink); cursor: pointer; }
.fb-cat.is-on { border-color: var(--petrol); background: #EEF6F9; color: var(--petrol); font-weight: 600; }
.fb-page { max-width: 520px; }
.fb-area { width: 100%; min-height: 120px; height: auto; padding: 10px 12px; line-height: 1.7; resize: vertical; }
.fb-area.is-sm { min-height: 64px; }
.fb-form .set-input { width: 100%; }
.fb-pri { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: .85rem; font-weight: 600; color: var(--muted); }
.fb-foot { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding-top: 16px; }
.fb-miss { color: var(--danger); font-weight: 600; font-size: .9rem; }
.fb-send { min-width: 150px; justify-content: center; }
.fb-send svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.fb-done { text-align: center; padding: 34px 20px; display: grid; justify-items: center; gap: 8px; animation: rise .4s ease-out both; }
.fb-done-ico { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: #E6F5EC; color: #15803D; font-size: 2rem; font-weight: 700; }
.fb-done h2 { margin: 6px 0 0; }
.fb-done-btns { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; justify-content: center; }
.fb-mine ul { list-style: none; margin: 0; padding: 0 6px 8px; }
.fb-mine li a { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.fb-mine li a:hover { background: var(--mist); }
.fb-mine li a .fb-st { margin-inline-start: auto; }
@media (max-width: 760px) { .fb-kinds { grid-template-columns: minmax(0, 1fr); } .fb-form { padding: 4px 14px 14px; } }

/* الحالة / الأهمية */
.fb-st { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.fb-st.is-new { background: #FEF3C7; color: #92400E; }
.fb-st.is-in_progress { background: #E0F2FE; color: #075985; }
.fb-st.is-done { background: #DCFCE7; color: #166534; }
.fb-st.is-rejected { background: #FEE2E2; color: #991B1B; }
.fb-pri-tag { font-size: .78rem; font-weight: 600; white-space: nowrap; }
.fb-pri-tag.is-p1 { color: var(--danger); } .fb-pri-tag.is-p1::before { content: "● "; }
.fb-pri-tag.is-p2 { color: #A16207; }
.fb-pri-tag.is-p3 { color: var(--muted); }

/* المتابعة */
.fb-bar { align-items: flex-end; }
.fb-seg button { padding: 0 11px; }
.fb-user { min-width: 220px; }
.fb-grid tbody tr.fb-row { cursor: pointer; }
.fb-grid tbody tr.fb-row:hover > td { background: #F4F9FB; }
.fb-grid tr.is-urgent > td:first-child { box-shadow: inset 4px 0 0 var(--danger); }
[dir="rtl"] .fb-grid tr.is-urgent > td:first-child { box-shadow: inset -4px 0 0 var(--danger); }
.fb-grid tr.is-done > td, .fb-grid tr.is-rejected > td { color: var(--muted); }
.fb-grid tr.is-off > td { opacity: .5; }
.fb-title { max-width: 340px; white-space: normal; font-weight: 600; }
.fb-reply { max-width: 260px; white-space: normal; font-size: .82rem; color: var(--muted); }
.fb-detail { display: grid; gap: 14px; }
.fb-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: .84rem; color: var(--muted); }
.fb-dtitle { margin: 0; font-size: 1.1rem; }
.fb-text { white-space: pre-wrap; margin: 0; line-height: 1.8; }
.fb-chatbox { display: grid; gap: 10px; padding: 12px 14px; border-radius: 12px; background: #F5F3FF; border: 1px solid #E4DEFC; }
.fb-chatbox small { font-weight: 700; color: #6D28D9; font-size: .74rem; }
.fb-chatbox p { margin: 2px 0 0; }
.fb-chatbox .is-expected { padding: 8px 10px; border-radius: 10px; background: #ECFDF5; border: 1px dashed #A7F3D0; }
.fb-chatbox .is-expected small { color: #047857; }
.fb-chatbox code { font-size: .8rem; white-space: pre-wrap; word-break: break-word; }
.fb-replybox { padding: 12px 14px; border-radius: 12px; background: #EEF6F9; border-inline-start: 4px solid var(--petrol); }
.fb-replybox small { color: var(--petrol); font-weight: 700; }
.fb-replybox p { margin: 4px 0 0; white-space: pre-wrap; }
.fb-admin { display: grid; gap: 10px; padding-top: 6px; border-top: 1px solid var(--line); }
.fb-admin h4 { margin: 4px 0 0; font-size: .95rem; }
.fb-status-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-sbtn { padding: 8px 14px; border-radius: 99px; border: 1.5px solid var(--line); background: #fff; font: inherit; font-size: .86rem; cursor: pointer; }
.fb-sbtn.is-on.is-new { border-color: #D97706; background: #FEF3C7; }
.fb-sbtn.is-on.is-in_progress { border-color: #0284C7; background: #E0F2FE; }
.fb-sbtn.is-on.is-done { border-color: #16A34A; background: #DCFCE7; }
.fb-sbtn.is-on.is-rejected { border-color: #DC2626; background: #FEE2E2; }
.fb-history summary { cursor: pointer; font-weight: 600; color: var(--petrol); }
.fb-history ol { margin: 8px 0 0; padding-inline-start: 20px; display: grid; gap: 6px; font-size: .84rem; }
.fb-taught { font-size: .9rem; }

/* تعليم المساعد */
.fb-tabs { margin-bottom: 14px; flex-wrap: wrap; }
.fb-teach { padding: 14px 18px; display: grid; gap: 12px; }
.fb-teach.is-focus { box-shadow: 0 0 0 3px rgba(248, 200, 8, .55); }
.fb-teach-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.fb-teach-head .link-btn { margin-inline-start: auto; }
.fb-chatbox .is-ok code { color: #166534; } .fb-chatbox .is-bad code { color: #B42318; }
.fb-words { display: grid; gap: 8px; padding: 10px 12px; border-radius: 12px; background: #FFFBEA; border: 1px dashed #EBD6A0; }
.fb-words small { color: #92400E; font-weight: 600; }
.fb-word { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fb-word b { min-width: 90px; }
.fb-word .set-input { flex: 1 1 200px; }
.fb-try { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.fb-try .filter { flex: 1 1 320px; }
.fb-try .set-input { width: 100%; }
.fb-test { margin: 0; padding: 8px 12px; border-radius: 10px; font-size: .84rem; }
.fb-test.is-ok { background: #DCFCE7; color: #166534; } .fb-test.is-bad { background: #FEE2E2; color: #991B1B; }
.fb-test code { white-space: pre-wrap; word-break: break-word; }
.fb-teach-foot { display: flex; gap: 16px; justify-content: flex-end; }
.link-btn.is-bad { color: var(--danger); }
.fb-manual { padding: 16px 18px; display: grid; gap: 12px; max-width: 760px; }
.fb-manual .set-input { width: 100%; }

/* الشات: «الرد غلط؟» */
.chat-wrong { color: var(--muted); font-size: .8rem; }
.chat-wrong:hover { color: var(--danger); }
.chat-reported { color: #15803D; font-size: .8rem; font-weight: 600; }
.understood.is-taught { background: #F5F3FF; border-color: #E4DEFC; }

/* صفحة الخطأ: زرار البلاغ */
.err-report { margin-top: 10px; text-decoration: none; }

/* الشات: تقييم الإجابة (صلاحية) */
.chat-rate { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: auto; }
.chat-rate-lbl { font-size: .78rem; color: var(--muted); }
.chat-rate-btn { width: 30px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: .9rem; line-height: 1; filter: grayscale(1); opacity: .7; transition: all .15s; }
.chat-rate-btn:hover { filter: none; opacity: 1; }
.chat-rate-btn.is-good.is-on { filter: none; opacity: 1; background: #DCFCE7; border-color: #86EFAC; }
.chat-rate-btn.is-bad.is-on { filter: none; opacity: 1; background: #FEE2E2; border-color: #FCA5A5; }

/* =====================================================================
   المساعد: أسئلة وإجابات + القاموس (ماستر / تفاصيل)
   ===================================================================== */
.al-grid .al-q { max-width: 340px; white-space: normal; }
.al-grid .al-meaning { max-width: 260px; white-space: normal; color: var(--muted); }
.al-err { display: block; color: var(--danger); font-size: .74rem; }
.al-reason { display: block; font-size: .76rem; color: var(--muted); max-width: 220px; white-space: normal; }
.fb-grid tr.is-bad > td { background: #FFF6F5; }
.fb-grid tr.is-warn > td { background: #FFFBEB; }
.fb-grid tr.is-sel > td { background: #EEF6F9 !important; box-shadow: inset 0 -1px 0 var(--petrol); }
.tc-box { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.tc-box h4 { margin: 0; font-size: .92rem; color: var(--ink); }
.tc-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.tc-row .filter { flex: 1 1 220px; }
.tc-row .set-input { width: 100%; }
.tc-topic { flex: 1 1 280px; min-width: 240px; }
.fb-cat.is-sm { padding: 4px 10px; font-size: .8rem; }
.fb-cat.is-off { opacity: .5; text-decoration: line-through; }
.lx-status { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 16px; font-size: .86rem; }
.lx-src { padding: 4px 12px; border-radius: 99px; font-weight: 700; }
.lx-src.is-db { background: #DCFCE7; color: #166534; } .lx-src.is-file { background: #FEF3C7; color: #92400E; }
.lx-grow { flex: 1; }
.lx-try { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; padding: 12px 16px; }
.lx-try .filter { flex: 1 1 260px; } .lx-try .set-input { width: 100%; }
.lx-full { flex: 1 1 100%; }
.lx-found { display: flex; flex-wrap: wrap; gap: 6px; }
.lx-split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.lx-split > .panel { display: flex; flex-direction: column; min-width: 0; }
.lx-split .sg-wrap { flex: 1 1 auto; max-height: 640px; }
.lx-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 14px 10px; }
.lx-filters .search { flex: 1 1 160px; }
.lx-role { min-width: 200px; }
.lx-meta { padding: 0 14px 8px; font-size: .82rem; color: var(--muted); }
.lx-add { padding: 0 14px 10px; }
.lx-topics td { white-space: normal; }
@media (max-width: 1100px) { .lx-split { grid-template-columns: minmax(0, 1fr); } }

/* نافذة التعليم الموحّدة + الشرح */
.lx-tabs { flex-wrap: wrap; }
.lx-guide-btn { background: #FFFBEA; border-color: #EBD6A0; color: #92400E; }
.lx-sql { font-family: Consolas, "Cascadia Mono", monospace; font-size: .84rem; min-height: 160px; text-align: left; }
.lx-preview { max-height: 240px; margin-top: 6px; }
.lg { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 18px; }
.lg-toc { display: grid; gap: 6px; align-content: start; position: sticky; top: 0; }
.lg-toc button { text-align: start; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font: inherit; font-size: .86rem; cursor: pointer; }
.lg-toc button.is-on { background: var(--petrol); color: #fff; border-color: var(--petrol); }
.lg-body { line-height: 1.85; font-size: .92rem; min-width: 0; }
.lg-body h3 { margin: 0 0 8px; font-size: 1.1rem; color: var(--petrol); }
.lg-body h4 { margin: 16px 0 6px; font-size: .95rem; }
.lg-body code { background: #F1F6F7; padding: 1px 6px; border-radius: 6px; font-size: .84rem; }
.lg-body pre { direction: ltr; text-align: left; background: #0F2A36; color: #E6F1F5; padding: 12px 14px; border-radius: 10px; font-size: .8rem; overflow-x: auto; white-space: pre; }
.lg-body .ok { color: #166534; font-weight: 700; }
.lg-tip { background: #ECFDF5; border: 1px dashed #A7F3D0; padding: 8px 12px; border-radius: 10px; }
.lg-warn { background: #FFF7ED; border: 1px dashed #FDBA74; padding: 8px 12px; border-radius: 10px; }
.lg-table { width: 100%; border-collapse: collapse; font-size: .86rem; margin: 6px 0; }
.lg-table th, .lg-table td { border: 1px solid var(--line); padding: 6px 10px; text-align: start; }
.lg-table th { background: #F1F6F7; }
.lg-flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; margin: 8px 0 12px; }
.lg-flow > div { flex: 1 1 160px; display: grid; gap: 4px; padding: 10px 12px; border-radius: 12px; background: #EEF6F9; border: 1px solid #CFE3EA; font-size: .84rem; }
.lg-flow > i { align-self: center; font-style: normal; color: var(--muted); }
@media (max-width: 760px) { .lg { grid-template-columns: minmax(0, 1fr); } .lg-toc { position: static; grid-auto-flow: column; overflow-x: auto; } }

/* أسئلة وإجابات المساعد: التفاصيل + مساعد الاختيار */
.dt-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px; padding: 12px 14px; border-radius: 12px; background: #F5F8F9; border: 1px solid var(--line); }
.dt-grid > div { display: grid; gap: 2px; min-width: 0; }
.dt-grid small { color: var(--muted); font-weight: 600; font-size: .74rem; }
.dt-full { grid-column: 1 / -1; }
.dt-code { white-space: pre-wrap; word-break: break-word; font-size: .8rem; }
.dt-code.is-bad { color: var(--danger); }
.dt-sql { direction: ltr; text-align: left; background: #0F2A36; color: #E6F1F5; padding: 12px 14px; border-radius: 10px; font-size: .78rem; max-height: 320px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 0; }
.dt-now code { white-space: pre-wrap; }
.dt-now.is-ok code { color: #166534; } .dt-now.is-bad code { color: #B42318; }
.dt-more summary { cursor: pointer; color: var(--petrol); font-weight: 600; font-size: .86rem; margin-bottom: 6px; }
.tc-box h4 { display: flex; align-items: center; gap: 10px; }
.lx-wizard { background: #FFFDF5; border-color: #EBD6A0; }
.lx-word { color: var(--petrol); }
.lx-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.lx-choice { padding: 7px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font: inherit; font-size: .84rem; cursor: pointer; }
.lx-choice.is-on { border-color: var(--petrol); background: #EEF6F9; color: var(--petrol); font-weight: 700; }
.lx-meta-box { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 14px; padding: 10px 12px; border-radius: 10px; background: #fff; border: 1px dashed #CFE3EA; }
.lx-meta-box > div { display: grid; gap: 2px; min-width: 0; }
.lx-meta-box small { color: var(--muted); font-size: .72rem; font-weight: 600; }
.lx-meta-box code { font-size: .78rem; word-break: break-word; }
.lx-meta-full { grid-column: 1 / -1; }
.lx-sugg { display: grid; gap: 6px; }
.lx-sugg > small { color: #92400E; font-weight: 700; }
.lx-sugg-row { display: grid; grid-template-columns: 56px minmax(0, auto) minmax(0, 1fr); align-items: center; gap: 10px; text-align: start; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font: inherit; font-size: .84rem; cursor: pointer; }
.lx-sugg-row:hover { border-color: var(--petrol); background: #F4F9FB; }
.lx-sugg-row small { color: var(--muted); }
.lx-score { font-weight: 700; font-size: .76rem; text-align: center; padding: 3px 0; border-radius: 99px; background: linear-gradient(90deg, #BBF7D0 var(--s), #F1F5F9 var(--s)); }
@media (max-width: 760px) { .dt-grid, .lx-meta-box { grid-template-columns: minmax(0, 1fr); } .lx-sugg-row { grid-template-columns: 50px minmax(0, 1fr); } .lx-sugg-row small { grid-column: 1 / -1; } }
.lg-steps { display: grid; gap: 8px; margin: 6px 0 12px; }
.lg-steps > div { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px 12px; border-radius: 12px; background: #F5F8F9; border: 1px solid var(--line); }
.lg-steps > div > b { width: 28px; height: 28px; border-radius: 50%; background: var(--petrol); color: #fff; display: grid; place-items: center; }
.lg-tree { display: grid; gap: 8px; }
.lg-tree > div { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; display: grid; gap: 4px; }
.lg-tree > div > span { color: var(--petrol); }
.lg-ex { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: #fff; }
.lg-ex h4 { margin: 0 0 8px; }
.lg-ex-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 14px; font-size: .86rem; }
.lg-ex-grid > div { display: grid; gap: 2px; min-width: 0; }
.lg-ex-grid small { color: var(--muted); font-weight: 700; font-size: .72rem; }
.lg-ex-grid .bad { color: #B42318; }
.lg-full { grid-column: 1 / -1; }
.lg-roles td, .lg-cols td { vertical-align: top; }
.lg-cols code { white-space: normal; word-break: break-word; line-height: 1.9; }
@media (max-width: 760px) { .lg-ex-grid { grid-template-columns: minmax(0, 1fr); } }
.lg-body { overflow-x: auto; }
.lg-roles { font-size: .8rem; table-layout: fixed; }
.lg-roles th:nth-child(1) { width: 14%; } .lg-roles th:nth-child(2) { width: 24%; } .lg-roles th:nth-child(3), .lg-roles th:nth-child(4) { width: 19%; } .lg-roles th:nth-child(6) { width: 9%; }
.lg-roles code { white-space: normal; word-break: break-word; }

/* =====================================================================
   التواصل: الرسائل بين المستخدمين + جرس الإشعارات
   ===================================================================== */
/* الصورة */
.dm-av { --sz: 42px; position: relative; flex: 0 0 auto; width: var(--sz); height: var(--sz); border-radius: 50%; display: grid; place-items: center;
         background: linear-gradient(135deg, var(--av), color-mix(in srgb, var(--av) 70%, #000)); color: #fff; font-weight: 700; box-shadow: 0 4px 12px -6px var(--av); }
.dm-av.is-sm { --sz: 32px; font-size: .85rem; } .dm-av.is-md { --sz: 42px; } .dm-av.is-lg { --sz: 48px; font-size: 1.1rem; } .dm-av.is-xl { --sz: 96px; font-size: 2.4rem; }
.dm-av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.dm-av-emoji { font-size: calc(var(--sz) * .55); line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.dm-av:has(.dm-av-emoji) { background: linear-gradient(135deg, #FFF7D6, #FDE68A); }
.dm-dot { position: absolute; inset-inline-end: -1px; bottom: -1px; width: calc(var(--sz) * .3); height: calc(var(--sz) * .3); min-width: 10px; min-height: 10px; border-radius: 50%; border: 2px solid #fff; background: #94A3B8; }
.dm-av.is-online .dm-dot { background: #22C55E; animation: dm-pulse 2s infinite; }
@keyframes dm-pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); } 70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

/* الإطار */
.dm { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100vh - 130px); min-height: 520px; background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: 0 20px 50px -35px rgba(7,63,87,.5); animation: rise .35s ease-out both; }
.dm-side { display: flex; flex-direction: column; min-height: 0; border-inline-end: 1px solid var(--line); background: linear-gradient(180deg, #F7FAFB, #fff); }
.dm-me { padding: 14px; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, #0A5878, #073F57); }
.dm-me-btn { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; color: #fff; font: inherit; cursor: pointer; text-align: start; padding: 0; }
.dm-me-text { display: grid; min-width: 0; } .dm-me-text small { color: rgba(255,255,255,.75); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-search { display: flex; align-items: center; gap: 8px; margin: 12px; padding: 0 12px; height: 40px; border-radius: 99px; background: #EEF3F5; }
.dm-search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; }
.dm-search input { flex: 1; border: 0; background: transparent; font: inherit; font-size: .9rem; outline: none; }
.dm-tabs { display: flex; gap: 6px; padding: 0 12px 8px; }
.dm-tabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font: inherit; font-size: .84rem; cursor: pointer; color: var(--muted); transition: all .15s; }
.dm-tabs button.is-on { background: var(--petrol); border-color: var(--petrol); color: #fff; font-weight: 700; }
.dm-list { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.dm-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 14px; background: transparent; font: inherit; text-align: start; cursor: pointer; transition: background .15s, transform .15s; animation: dm-in .3s ease-out both; }
.dm-row:hover { background: #F1F6F8; transform: translateX(-2px); }
[dir="ltr"] .dm-row:hover { transform: translateX(2px); }
.dm-row.is-on { background: #E6F1F5; box-shadow: inset 3px 0 0 var(--petrol); }
.dm-row-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.dm-row-top { display: flex; justify-content: space-between; gap: 8px; } .dm-row-top b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .92rem; }
.dm-row-top small { color: var(--muted); font-size: .72rem; flex: 0 0 auto; }
.dm-row-sub { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: .8rem; min-width: 0; }
.dm-row-sub > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.dm-row.is-unread .dm-row-top b, .dm-row.is-unread .dm-row-sub > span { color: var(--ink); font-weight: 700; }
.dm-on { color: #16A34A !important; font-weight: 600; }
.dm-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: #EF4444; color: #fff; font-size: .72rem; display: inline-grid; place-items: center; animation: sc-pop .3s ease-out both; }
.dm-tick { font-style: normal; color: #94A3B8; font-size: .75rem; letter-spacing: -2px; } .dm-tick.is-read { color: #0EA5E9; }
.dm-typing-txt { color: #16A34A; font-style: italic; }
.dm-empty-list { display: grid; justify-items: center; gap: 6px; padding: 40px 16px; color: var(--muted); font-size: 2rem; text-align: center; } .dm-empty-list span { font-size: .86rem; }
@keyframes dm-in { from { opacity: 0; transform: translateY(6px); } }

/* المحادثة */
.dm-main { display: flex; flex-direction: column; min-height: 0; min-width: 0;
           background: radial-gradient(circle at 20% 10%, rgba(248,200,8,.07), transparent 40%), radial-gradient(circle at 80% 90%, rgba(10,88,120,.07), transparent 45%), #F4F8F9; }
.dm-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: rgba(255,255,255,.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.dm-head-text { display: grid; min-width: 0; } .dm-head-text small { color: var(--muted); font-size: .78rem; }
.dm-status { font-style: italic; }
.dm-back { display: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.dm-back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.dm-scroll { flex: 1; overflow-y: auto; padding: 16px 18px 10px; display: flex; flex-direction: column; gap: 6px; scroll-behavior: smooth; }
.dm-older { align-self: center; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 5px 14px; font: inherit; font-size: .8rem; cursor: pointer; }
.dm-day { align-self: center; margin: 10px 0 4px; } .dm-day span { padding: 4px 12px; border-radius: 99px; background: rgba(7,63,87,.08); color: var(--petrol); font-size: .74rem; font-weight: 600; }
.dm-msg { display: flex; } .dm-msg.is-mine { justify-content: flex-start; } .dm-msg.is-theirs { justify-content: flex-end; }
[dir="ltr"] .dm-msg.is-mine { justify-content: flex-end; } [dir="ltr"] .dm-msg.is-theirs { justify-content: flex-start; }
.dm-bubble { position: relative; max-width: min(560px, 78%); padding: 8px 12px 6px; border-radius: 18px; box-shadow: 0 2px 6px -3px rgba(7,63,87,.25); display: grid; gap: 6px; }
.dm-bubble p { margin: 0; white-space: pre-wrap; word-break: break-word; line-height: 1.7; }
.is-mine .dm-bubble { background: linear-gradient(135deg, #0A5878, #0C6A8F); color: #fff; border-start-start-radius: 4px; }
.is-theirs .dm-bubble { background: #fff; color: var(--ink); border-start-end-radius: 4px; }
.dm-msg.is-new .dm-bubble { animation: dm-pop .35s cubic-bezier(.2,.9,.3,1.3) both; }
.dm-msg.is-theirs:last-child .dm-bubble { animation: dm-pop .35s cubic-bezier(.2,.9,.3,1.3) both; }
@keyframes dm-pop { from { opacity: 0; transform: scale(.85) translateY(8px); } }
.dm-meta { display: inline-flex; gap: 6px; align-items: center; justify-self: end; font-size: .68rem; opacity: .75; }
.is-mine .dm-tick { color: rgba(255,255,255,.7); } .is-mine .dm-tick.is-read { color: #7DD3FC; }
.dm-img img { display: block; max-width: 100%; max-height: 320px; border-radius: 12px; }
.dm-video { max-width: 100%; max-height: 320px; border-radius: 12px; background: #000; }
.dm-bubble audio { max-width: 280px; }
.dm-file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; text-decoration: none; color: inherit; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2); }
.is-theirs .dm-file { background: #F1F6F8; border-color: var(--line); }
.dm-file-ico { font-size: 1.8rem; }
.dm-file-text { display: grid; min-width: 0; } .dm-file-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; font-size: .86rem; }
.dm-file-text small { opacity: .75; font-size: .72rem; }
.dm-file svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; flex: 0 0 auto; }
.dm-file:hover { filter: brightness(1.05); }
.dm-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.dm-typing i { width: 7px; height: 7px; border-radius: 50%; background: #94A3B8; animation: dm-bounce 1.2s infinite; }
.dm-typing i:nth-child(2) { animation-delay: .15s; } .dm-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dm-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.dm-first { align-self: center; margin: auto; color: var(--muted); font-size: 1rem; }
.dm-welcome { margin: auto; text-align: center; max-width: 440px; padding: 30px; display: grid; gap: 8px; justify-items: center; }
.dm-welcome-art { position: relative; width: 140px; height: 110px; }
.dm-welcome-art span { position: absolute; font-size: 3rem; animation: dm-float 3.5s ease-in-out infinite; }
.dm-welcome-art span:nth-child(1) { inset-inline-start: 30px; top: 20px; font-size: 4rem; }
.dm-welcome-art span:nth-child(2) { inset-inline-end: 0; top: 0; animation-delay: .6s; }
.dm-welcome-art span:nth-child(3) { inset-inline-start: 0; bottom: 0; font-size: 1.6rem; animation-delay: 1.2s; }
@keyframes dm-float { 50% { transform: translateY(-8px) rotate(-4deg); } }
.dm-welcome p { color: var(--muted); line-height: 1.8; }

/* الكتابة */
.dm-pending { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 0; }
.dm-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 99px; background: #fff; border: 1px solid var(--line); font-size: .8rem; animation: dm-in .25s ease-out both; }
.dm-chip b { max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.dm-chip button { border: 0; background: #FEE2E2; color: #B91C1C; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; }
.dm-sending { display: flex; align-items: center; gap: 8px; padding: 6px 16px; font-size: .82rem; color: var(--petrol); }
.dm-composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 14px 14px; }
.dm-composer textarea { flex: 1; resize: none; max-height: 160px; min-height: 44px; padding: 11px 16px; border-radius: 22px; border: 1px solid var(--line); background: #fff; font: inherit; font-size: .95rem; line-height: 1.5; outline: none; transition: border-color .15s, box-shadow .15s; }
.dm-composer textarea:focus { border-color: var(--petrol); box-shadow: 0 0 0 3px rgba(10,88,120,.12); }
.dm-tool { position: relative; width: 44px; height: 44px; flex: 0 0 auto; border-radius: 50%; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; font-size: 1.2rem; transition: transform .15s; overflow: hidden; }
.dm-tool:hover { transform: scale(1.08); }
.dm-tool svg { width: 20px; height: 20px; fill: none; stroke: var(--petrol); stroke-width: 2; stroke-linecap: round; }
.dm-file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dm-send { width: 46px; height: 46px; flex: 0 0 auto; border-radius: 50%; border: 0; background: linear-gradient(135deg, #F8C808, #F59E0B); color: #073F57; display: grid; place-items: center; cursor: pointer; box-shadow: 0 8px 18px -8px rgba(245,158,11,.8); transition: transform .15s; }
.dm-send:hover:not(:disabled) { transform: scale(1.08) rotate(-8deg); }
.dm-send:disabled { opacity: .45; cursor: default; box-shadow: none; }
.dm-send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linejoin: round; }
[dir="rtl"] .dm-send svg { transform: scaleX(-1); }
.dm-emoji-wrap { position: relative; }
.dm-emoji-pop { position: absolute; bottom: 52px; inset-inline-start: 0; z-index: 5; display: grid; grid-template-columns: repeat(6, 36px); gap: 2px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px -18px rgba(7,63,87,.5); animation: dlg-in .2s ease-out both; transform: none; }
.dm-emoji-pop button { border: 0; background: transparent; font-size: 1.3rem; height: 36px; border-radius: 8px; cursor: pointer; } .dm-emoji-pop button:hover { background: #F1F6F8; transform: scale(1.2); }

/* صورتى */
.dm-prof { display: grid; gap: 14px; }
.dm-prof-preview { display: grid; justify-items: center; gap: 8px; }
.dm-colors, .dm-icons { display: flex; flex-wrap: wrap; gap: 8px; }
.dm-colors button { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; background: var(--c); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.dm-colors button.is-on, .dm-icons button.is-on { box-shadow: 0 0 0 3px var(--lemon); transform: scale(1.1); }
.dm-icons button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: #FFFBEA; font-size: 1.5rem; cursor: pointer; transition: transform .15s; }
.dm-icons button:hover { transform: scale(1.12); }
.dm-upload { position: relative; overflow: hidden; justify-self: start; }

/* الجرس فوق */
.cb { position: relative; }
.cb-btn { position: relative; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; transition: transform .15s; }
.cb-btn svg { width: 21px; height: 21px; fill: none; stroke: var(--petrol); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cb-btn:hover { transform: scale(1.06); }
.cb-btn.has-new { border-color: #FCA5A5; }
.cb-btn.is-ring { animation: cb-ring .9s ease-in-out; }
@keyframes cb-ring { 10%, 50% { transform: rotate(-14deg); } 30%, 70% { transform: rotate(14deg); } 90% { transform: rotate(0); } }
.cb-count { position: absolute; top: -4px; inset-inline-end: -4px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: #EF4444; color: #fff; font-size: .68rem; display: grid; place-items: center; border: 2px solid #fff; animation: sc-pop .3s ease-out both; }
.cb-scrim { position: fixed; inset: 0; z-index: 40; }
.cb-pop { position: absolute; top: 48px; inset-inline-end: -60px; z-index: 41; width: 360px; max-width: calc(100vw - 24px); background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px -28px rgba(7,63,87,.55); overflow: hidden; animation: ss-in .2s ease-out both; }
.cb-pop header { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.cb-pop header a { font-size: .82rem; color: var(--petrol); font-weight: 600; }
.cb-empty { padding: 24px; text-align: center; color: var(--muted); }
.cb-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: inherit; text-decoration: none; transition: background .15s; }
.cb-item:hover { background: #F4F9FB; } .cb-item.is-unread { background: #EFF8FF; }
.cb-text { flex: 1; min-width: 0; display: grid; } .cb-text b { font-size: .88rem; } .cb-text small { color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-item.is-unread .cb-text small { color: var(--ink); font-weight: 600; }
.cb-side { display: grid; justify-items: end; gap: 4px; } .cb-side small { color: var(--muted); font-size: .7rem; }
.cb-toasts { position: fixed; bottom: 18px; inset-inline-start: 18px; z-index: 60; display: grid; gap: 10px; width: min(360px, calc(100vw - 36px)); }
.cb-toast { position: relative; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; background: #fff; color: inherit; text-decoration: none; border: 1px solid var(--line); border-inline-start: 4px solid var(--lemon); box-shadow: 0 20px 50px -24px rgba(7,63,87,.6); animation: cb-in .45s cubic-bezier(.2,.9,.3,1.25) both; }
.cb-toast.is-out { animation: cb-out .4s ease-in both; }
.cb-toast em { font-style: normal; font-size: .72rem; color: var(--petrol); font-weight: 700; }
.cb-x { position: absolute; top: 6px; inset-inline-end: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
@keyframes cb-in { from { opacity: 0; transform: translateY(30px) scale(.9); } }
@keyframes cb-out { to { opacity: 0; transform: translateX(-40px); } }

@media (max-width: 860px) {
    .dm { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 110px); }
    .dm.has-peer .dm-side { display: none; } .dm.no-peer .dm-main { display: none; }
    .dm-back { display: grid; place-items: center; }
    .dm-bubble { max-width: 88%; }
}
@media (prefers-reduced-motion: reduce) { .dm-row, .dm-bubble, .cb-toast, .dm-welcome-art span, .dm-av.is-online .dm-dot { animation: none !important; } }

/* ---------- المحادثات الجماعية (الغرف) ---------- */
.dm-me { display: flex; align-items: center; gap: 8px; }
.dm-me-link { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.14); transition: background .15s, transform .15s; }
.dm-me-link:hover { background: rgba(255,255,255,.26); transform: scale(1.06); }
.dm-me-link svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2; }
.dm-tabs button small { font-size: .72rem; }
.dm-new-room { display: flex; align-items: center; justify-content: center; gap: 6px; width: calc(100% - 4px); margin: 2px 2px 8px; height: 40px; border-radius: 12px; border: 1.5px dashed #9CC3D3; background: #F3F9FB; color: var(--petrol); font: inherit; font-weight: 700; font-size: .86rem; cursor: pointer; transition: all .15s; }
.dm-new-room:hover { background: #E6F1F5; border-style: solid; }
.dm-new-room svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.dm-av.dm-av-room, .dm-av.dm-av-room:has(.dm-av-emoji) { border-radius: 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--av) 22%, #fff), color-mix(in srgb, var(--av) 40%, #fff)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--av) 45%, transparent); }
.dm-av.dm-av-room.is-calling { animation: dm-calling 1.6s ease-in-out infinite; }
@keyframes dm-calling { 0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,.55), inset 0 0 0 1.5px #22C55E; } 50% { box-shadow: 0 0 0 6px rgba(34,197,94,0), inset 0 0 0 1.5px #22C55E; } }
.dm-call-txt { color: #15803D; font-style: normal; font-weight: 700; }
.dm-head-tools { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.dm-head .dm-tool { width: 40px; height: 40px; }
.dm-call-btn { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 99px; border: 0; cursor: pointer; font: inherit; font-weight: 700; font-size: .86rem;
               background: linear-gradient(135deg, #22C55E, #16A34A); color: #fff; box-shadow: 0 8px 18px -10px rgba(22,163,74,.9); transition: transform .15s; }
.dm-call-btn:hover:not(:disabled) { transform: translateY(-1px) scale(1.03); }
.dm-call-btn:disabled { opacity: .6; cursor: default; }
.dm-call-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.dm-call-btn.is-live:not(:disabled) { animation: dm-calling 1.6s ease-in-out infinite; }
.dm-callbar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: linear-gradient(90deg, #ECFDF5, #F0FDF4); border-bottom: 1px solid #BBF7D0; color: #14532D; font-size: .86rem; animation: dm-in .3s ease-out both; }
.dm-callbar > span:nth-child(2) { flex: 1; min-width: 0; }
.dm-sys { align-self: center; margin: 4px 0; max-width: 86%; text-align: center; animation: dm-in .3s ease-out both; }
.dm-sys span { display: inline-block; padding: 4px 12px; border-radius: 99px; background: rgba(7,63,87,.06); color: var(--muted); font-size: .76rem; line-height: 1.6; }
.dm-sys.is-call span { background: #ECFDF5; color: #15803D; font-weight: 600; }
.dm-msg.has-from { align-items: flex-end; gap: 6px; margin-top: 6px; }
.dm-from { font-size: .76rem; color: color-mix(in srgb, var(--av) 85%, #000); }
.btn-ghost.is-danger { color: #B91C1C; border-color: #FECACA; }
.btn-ghost.is-danger:hover { background: #FEF2F2; }

/* ---------- شريط المكالمة الصوتية ---------- */
.vc { margin: 10px 12px 0; padding: 12px 14px; border-radius: 18px; color: #fff; background: radial-gradient(circle at 15% 0%, rgba(34,197,94,.35), transparent 55%), linear-gradient(135deg, #0B4F6C, #073F57);
      box-shadow: 0 18px 40px -24px rgba(7,63,87,.9); display: grid; gap: 10px; animation: cb-in .45s cubic-bezier(.2,.9,.3,1.25) both; }
.vc-head { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.vc-head b { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vc-head small { font-variant-numeric: tabular-nums; opacity: .85; }
.vc-live { width: 10px; height: 10px; border-radius: 50%; background: #22C55E; flex: 0 0 auto; animation: dm-pulse 1.6s infinite; }
.vc-min { border: 0; background: rgba(255,255,255,.12); color: #fff; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; }
.vc-peers { display: flex; flex-wrap: wrap; gap: 14px; }
.vc-peer { display: grid; justify-items: center; gap: 4px; width: 74px; text-align: center; animation: dm-pop .35s cubic-bezier(.2,.9,.3,1.3) both; }
.vc-peer small { font-size: .72rem; max-width: 74px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .92; }
.vc-peer .dm-av { transition: box-shadow .12s, transform .12s; box-shadow: 0 0 0 3px rgba(255,255,255,.15); }
.vc-peer[data-speaking="1"] .dm-av { box-shadow: 0 0 0 3px #22C55E, 0 0 18px 4px rgba(34,197,94,.65); transform: scale(1.06); }
.vc-peer.is-wait .dm-av { opacity: .55; }
.vc-peer.is-muted .dm-av { filter: grayscale(.4); }
.vc-alone { align-self: center; font-size: .84rem; opacity: .85; }
.vc-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vc-btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 99px; border: 0; cursor: pointer; font: inherit; font-weight: 700; font-size: .84rem; background: rgba(255,255,255,.15); color: #fff; transition: background .15s, transform .15s; }
.vc-btn:hover { background: rgba(255,255,255,.25); transform: translateY(-1px); }
.vc-btn.is-off { background: #F8C808; color: #073F57; }
.vc-btn.is-leave { background: #EF4444; margin-inline-start: auto; }
.vc-btn.is-leave:hover { background: #DC2626; }
.vc-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vc-vol { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; }
.vc-vol input { width: 100px; accent-color: #F8C808; }
.vc.is-mini { grid-template-columns: 1fr auto; align-items: center; }
.vc.is-mini .vc-actions .vc-btn span, .vc.is-mini .vc-vol { display: none; }
.vc.is-mini .vc-btn.is-leave { margin-inline-start: 0; }

/* ---------- اختيار الأعضاء + شاشة المجموعات ---------- */
.dmp { display: grid; gap: 10px; }
.dmp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dmp-bar .search { flex: 1; min-width: 180px; }
.dmp-groups { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dmp-group { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 99px; border: 1.5px solid color-mix(in srgb, var(--c) 40%, #fff); background: color-mix(in srgb, var(--c) 8%, #fff); color: var(--ink); font: inherit; font-size: .8rem; cursor: pointer; transition: all .15s; }
.dmp-group small { opacity: .7; }
.dmp-group.is-on { background: var(--c); border-color: var(--c); color: #fff; }
.dmp-list { display: grid; gap: 2px; max-height: 340px; overflow-y: auto; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: #FBFDFE; }
.dmp-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 0; border-radius: 10px; background: transparent; font: inherit; text-align: start; cursor: pointer; transition: background .12s; }
.dmp-row:hover:not(:disabled) { background: #EEF5F8; }
.dmp-row.is-on { background: #E6F4EA; }
.dmp-row.is-locked { cursor: default; opacity: .85; }
.dmp-row.is-static { cursor: default; }
.dmp-check { width: 22px; height: 22px; flex: 0 0 auto; border-radius: 7px; border: 2px solid #B6CCD6; display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: .8rem; color: #fff; transition: all .12s; }
.dmp-row.is-on .dmp-check { background: #16A34A; border-color: #16A34A; animation: sc-pop .25s ease-out both; }
.dmp-name { flex: 1; min-width: 0; display: grid; }
.dmp-name b { font-size: .88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dmp-name small { color: var(--muted); font-size: .72rem; }
.dmp-tags { color: var(--petrol); font-size: .7rem; max-width: 40%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cg-form { display: grid; gap: 12px; }
.cg-look { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; }
.cg-hint { margin: 0; font-size: .82rem; }
.cg-name { display: inline-flex; align-items: center; gap: 8px; }
.cg-name i { font-style: normal; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 15%, #fff); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 45%, transparent); }
.cg-names { max-width: 420px; color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cg-off { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--muted); }
.cg-grid tr.is-off td { opacity: .55; }
.cb-toast.is-call { border-inline-start-color: #22C55E; background: linear-gradient(90deg, #F0FDF4, #fff); }
.cb-toast.is-call em { color: #15803D; }
@media (max-width: 860px) {
    .dm-call-btn span { display: none; }
    .dm-call-btn { width: 40px; padding: 0; justify-content: center; }
    .vc-peer { width: 60px; }
    .cg-look { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .dm-av.dm-av-room.is-calling, .dm-call-btn.is-live, .vc, .vc-peer, .vc-live { animation: none !important; } }

/* مجموعات المحادثة: الشرح + «حسب المستخدم» */
.cg-how { margin: 0 0 14px; padding: 14px 18px; border-radius: 16px; background: linear-gradient(135deg, #FFFBEA, #FFF); border: 1px solid #FDE68A; display: grid; gap: 6px; animation: rise .35s ease-out both; }
.cg-how ol { margin: 0; padding-inline-start: 22px; display: grid; gap: 4px; line-height: 1.8; font-size: .9rem; }
.cg-view { margin: 0 0 12px; }
.cg-user { display: inline-flex; align-items: center; gap: 8px; }
.cg-user > span { display: grid; }
.cg-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cg-none { font-style: italic; }

/* القنوات وتصنيف العملاء (/sales/channels) */
.ch-kpis { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.ch-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ch-bulk { position: sticky; top: 8px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; padding: 10px 16px; border-radius: 14px;
           background: linear-gradient(135deg, #0A5878, #073F57); color: #fff; box-shadow: 0 14px 30px -20px rgba(7,63,87,.9); animation: dm-in .25s ease-out both; }
.ch-bulk .set-select { min-width: 170px; }
.ch-grid tr.is-new td { background: #FFFBEA; }
.ch-grid tr.is-sel td { background: #E6F4EA; }
.ch-sel { width: 34px; }
.ch-pick { display: inline-flex; align-items: center; gap: 6px; }
.ch-pick::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: 0 0 auto; }
.ch-more { padding: 8px 12px; margin: 0; }

/* ---------- زرار «مساعدة» + نافذة شرح الشاشة (Components/Shared/HelpButton.razor) ---------- */
.help-top { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line);
            background: #fff; color: var(--petrol); font: inherit; font-size: .84rem; font-weight: 700; cursor: pointer; transition: border-color .15s, background .15s; }
.help-top svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.help-top:hover { border-color: var(--petrol); background: #EEF6F9; }
@media (max-width: 700px) { .help-top span { display: none; } .help-top { padding: 0 9px; } }
.hp { display: grid; gap: 14px; }
.hp-intro { margin: 0; padding: 12px 14px; border-radius: 12px; background: #EEF6F9; border-inline-start: 4px solid var(--petrol); line-height: 1.9; }
.hp-search { width: 100%; max-width: none; min-width: 0; box-sizing: border-box; }
.hp-sec h3 { margin: 0 0 8px; font-size: 1rem; color: var(--petrol); display: flex; align-items: center; gap: 8px; }
.hp-sec h3::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--lemon); }
.hp-sec dl { margin: 0; display: grid; gap: 6px; }
.hp-item { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); gap: 4px 14px; padding: 9px 12px; border-radius: 10px; background: #FBFDFE; border: 1px solid var(--line); }
.hp-item dt { font-weight: 700; color: var(--ink); }
.hp-item dd { margin: 0; line-height: 1.85; color: #33454D; }
.hp-src { display: block; margin-top: 4px; color: var(--muted); }
.hp-src code { font-size: .74rem; background: #EEF3F5; padding: 1px 6px; border-radius: 6px; }
@media (max-width: 700px) { .hp-item { grid-template-columns: 1fr; } }

/* ---------- تعليم المساعد: الخطوات (Components/Widgets/LexiconAddDialog.razor) ---------- */
.tw { display: grid; gap: 14px; }
.tw-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; counter-reset: s; }
.tw-steps li button { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font: inherit; cursor: pointer; color: var(--muted); }
.tw-steps li button:disabled { cursor: default; opacity: .6; }
.tw-steps li b { width: 26px; height: 26px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; background: #EEF3F5; color: var(--petrol); font-size: .85rem; }
.tw-steps li span { font-weight: 700; font-size: .86rem; }
.tw-steps li.is-on button { border-color: var(--petrol); background: #EEF6F9; color: var(--petrol); box-shadow: 0 0 0 2px rgba(10,88,120,.12); }
.tw-steps li.is-on b { background: var(--petrol); color: #fff; }
.tw-steps li.is-done b { background: #16A34A; color: #fff; }
.tw-card { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.tw-card h4 { margin: 0; color: var(--petrol); font-size: 1rem; }
.tw-sub { margin: 0; color: #33454D; line-height: 1.8; font-size: .9rem; }
.tw-ask { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tw-ask .set-input { flex: 1; min-width: 220px; }
.tw-ask .btn-lemon { display: inline-flex; align-items: center; gap: 6px; }
.tw-stamp { justify-self: start; padding: 4px 12px; border-radius: 99px; background: #ECFDF5; color: #15803D; font-size: .8rem; font-weight: 700; }
.tw-stamp.is-flash { animation: tw-flash .9s ease-out; }
@keyframes tw-flash { 0% { transform: scale(.9); background: #BBF7D0; } 100% { transform: none; } }
.tw-warn { padding: 12px 14px; border-radius: 12px; background: #FFFBEA; border: 1px solid #FDE68A; display: grid; gap: 6px; }
.tw-warn p { margin: 0; line-height: 1.8; }
.tw-warn .btn-lemon { justify-self: start; text-decoration: none; }
.tw-verdict { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; background: #F4F8F9; }
.tw-verdict > span { font-weight: 700; margin-inline-end: auto; }
.tw-word { display: inline-block; margin: 0 3px; padding: 2px 10px; border-radius: 99px; border: 1px solid #FCA5A5; background: #FEF2F2; color: #B91C1C; font: inherit; font-weight: 700; cursor: pointer; }
.tw-word.is-on { background: #B91C1C; color: #fff; }
.tw-rec { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: #EEF6F9; border: 1px dashed var(--petrol); }
.tw-rec small { color: var(--muted); flex: 1; min-width: 200px; }
.tw-fixes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.tw-fix { display: flex; gap: 10px; text-align: start; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: #FBFDFE; font: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.tw-fix:hover { border-color: var(--petrol); transform: translateY(-1px); box-shadow: 0 8px 20px -14px rgba(7,63,87,.6); }
.tw-fix.is-on { border-color: var(--petrol); background: #EEF6F9; }
.tw-fix-ico { font-size: 1.5rem; }
.tw-fix-text { display: grid; gap: 3px; min-width: 0; }
.tw-fix-text b { color: var(--ink); }
.tw-fix-text span { font-size: .84rem; color: #33454D; line-height: 1.7; }
.tw-fix-text small { color: var(--muted); font-size: .78rem; }
.tw-fix-text code, .tw-fld-head code { font-size: .7rem; background: #EEF3F5; color: #0B5D7A; padding: 1px 6px; border-radius: 6px; justify-self: start; overflow-wrap: anywhere; }
.tw-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.tw-fld { display: grid; gap: 4px; min-width: 0; }
.tw-fld-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; color: #005471; }
.tw-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; padding: 10px 12px; border-radius: 12px; background: #F4F8F9; }
.tw-meta > div { display: grid; gap: 2px; min-width: 0; } .tw-meta small { color: var(--muted); } .tw-meta code { overflow-wrap: anywhere; font-size: .76rem; }
.tw-meta-full { grid-column: 1 / -1; }
.tw-summary { padding: 10px 12px; border-radius: 12px; background: #FFFBEA; border: 1px solid #FDE68A; display: grid; gap: 6px; overflow-x: auto; }
.tw-summary table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.tw-summary th, .tw-summary td { text-align: start; padding: 4px 8px; border-bottom: 1px solid #F5E6A8; vertical-align: top; }
.tw-summary code { font-size: .76rem; }
.tw-ok { padding: 10px 12px; border-radius: 12px; background: #ECFDF5; color: #14532D; font-weight: 700; }
.tw-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tw-compare h5 { margin: 0 0 6px; display: flex; align-items: center; gap: 8px; font-size: .95rem; }
.tw-before { opacity: .9; } .tw-before h5 { color: #B91C1C; } .tw-after h5 { color: #15803D; }
@media (max-width: 800px) { .tw-steps { grid-template-columns: repeat(2, 1fr); } .tw-compare, .tw-meta { grid-template-columns: 1fr; } }

/* التشخيص (Components/Widgets/DiagView.razor) */
.dv { display: grid; gap: 10px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: #FBFDFE; min-width: 0; }
.dv-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dv-badge { padding: 3px 10px; border-radius: 99px; font-size: .76rem; font-weight: 700; }
.dv-badge.is-ok { background: #DCFCE7; color: #166534; } .dv-badge.is-bad { background: #FEE2E2; color: #991B1B; }
.dv-badge.is-custom { background: #EDE9FE; color: #5B21B6; }
.dv-sentence { font-size: .98rem; line-height: 1.7; }
.dv-rule { margin: 0; padding: 6px 10px; border-radius: 8px; background: #EDE9FE; font-size: .84rem; }
.dv-sec { display: grid; gap: 6px; min-width: 0; } .dv-sec > small { color: var(--muted); font-weight: 700; }
.dv-tokens { display: flex; flex-wrap: wrap; gap: 6px; }
.dv-tok { display: grid; justify-items: center; gap: 1px; padding: 5px 10px; border-radius: 10px; border: 1px solid; font: inherit; max-width: 220px; }
.dv-tok b { font-size: .95rem; } .dv-tok small { font-size: .66rem; opacity: .85; text-align: center; overflow-wrap: anywhere; }
.dv-tok.is-known { background: #ECFDF5; border-color: #86EFAC; color: #14532D; }
.dv-tok.is-sales { background: #EFF6FF; border-color: #93C5FD; color: #1E3A8A; }
.dv-tok.is-number { background: #F0F9FF; border-color: #7DD3FC; color: #075985; }
.dv-tok.is-filler { background: #F4F4F5; border-color: #D4D4D8; color: #52525B; }
.dv-tok.is-unknown { background: #FEF2F2; border-color: #F87171; color: #991B1B; cursor: pointer; animation: tw-pulse 1.8s ease-in-out infinite; }
@keyframes tw-pulse { 50% { box-shadow: 0 0 0 4px rgba(248,113,113,.18); } }
.dv-legend { display: flex; flex-wrap: wrap; gap: 6px; font-size: .72rem; }
.dv-legend span { padding: 1px 8px; border-radius: 99px; border: 1px solid; }
.dv-legend .is-known { background: #ECFDF5; border-color: #86EFAC; } .dv-legend .is-sales { background: #EFF6FF; border-color: #93C5FD; }
.dv-legend .is-number { background: #F0F9FF; border-color: #7DD3FC; } .dv-legend .is-filler { background: #F4F4F5; border-color: #D4D4D8; }
.dv-legend .is-unknown { background: #FEF2F2; border-color: #F87171; }
.dv-facets { display: flex; flex-wrap: wrap; gap: 6px; }
.dv-facets span { display: grid; padding: 5px 10px; border-radius: 10px; background: #fff; border: 1px solid var(--line); max-width: 100%; }
.dv-facets small { color: var(--muted); font-size: .7rem; } .dv-facets b { font-size: .86rem; overflow-wrap: anywhere; }
.dv-answer p { margin: 0; line-height: 1.8; }
.dv-sql pre { margin: 6px 0 0; padding: 10px; border-radius: 10px; background: #0F172A; color: #E2E8F0; font-size: .75rem; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 220px; overflow: auto; }
.dv.is-compact { padding: 10px; gap: 8px; }
.dv.is-compact .dv-tok { padding: 3px 7px; }

/* دليل تعليم المساعد (Components/Widgets/LexiconGuide.razor) - التصميم الجديد (عمود واحد) */
.lg { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.lg-tabs { flex-wrap: wrap; }
.lg-sec { display: grid; gap: 8px; }
.lg-sec h3 { margin: 0; color: var(--petrol); font-size: 1.02rem; }
.lg-sec p { margin: 0; line-height: 1.9; }
.lg-steps { margin: 0; padding-inline-start: 22px; display: grid; gap: 8px; line-height: 1.9; }
.lg-tip { padding: 12px 14px; border-radius: 12px; background: #FFFBEA; border: 1px solid #FDE68A; }
.lg-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.lg-table th { background: var(--petrol); color: #fff; padding: 8px; text-align: start; }
.lg-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.7; }
.lg-table code { font-size: .74rem; overflow-wrap: anywhere; }
.lg-ex { display: grid; gap: 4px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: #FBFDFE; line-height: 1.8; }
.lg-ex small { color: var(--muted); font-weight: 700; margin-inline-end: 4px; }
.lg-ex code { font-size: .74rem; overflow-wrap: anywhere; }
.lg-ex-q { font-size: 1rem; }
.lg-code { margin: 0; padding: 12px; border-radius: 10px; background: #0F172A; color: #E2E8F0; font-size: .78rem; white-space: pre-wrap; overflow-x: auto; }
.lg-list { margin: 0; padding-inline-start: 22px; display: grid; gap: 6px; line-height: 1.9; }

/* ---------- النوافذ المنبثقة: المحتوى مايطلعش برّه إطار النافذة ----------
   الحاوية اللى display: grid من غير أعمدة محددة بتكبر على قد أعرض جدول/رسم جواها وتزق الباقى برّه.
   عمود واحد minmax(0, 1fr) = عرض النافذة بالظبط، والجدول العريض يعمل سكرول جوه إطاره. */
.da-main, .da-side, .ap, .arc-side, .cg-form, .fb-detail, .fb-chatbox, .fb-admin, .fb-history, .hp, .hp-sec, .lg-sec,
.tw, .tw-card, .tw-summary, .tw-warn, .tc-box, .dm-prof, .sm-panel, .td-tabpage, .yw-body, .sv-list, .svc-events, .svc-checks {
    grid-template-columns: minmax(0, 1fr);
}
.td-body .panel, .td-body .chart-panel, .td-body .sg-wrap, .td-body .table-wrap { min-width: 0; max-width: 100%; }
.td-body .schart, .td-body svg { max-width: 100%; }
.tw-note { grid-column: 1 / -1; padding: 8px 12px; border-radius: 10px; background: #FEF2F2; border: 1px solid #FECACA; color: #7F1D1D; }

/* ---------- شرح الشاشة: فلتر الأنواع + شارة النوع + «📍 أرني» ---------- */
.hp-bar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; position: sticky; top: -1px; z-index: 2; background: var(--card, #fff); padding: 6px 0 8px; }
.hp-kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.hp-kinds button { height: 30px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-size: .82rem; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.hp-kinds button small { color: var(--muted); font-size: .72rem; }
.hp-kinds button.is-on { background: var(--petrol); border-color: var(--petrol); color: #fff; }
.hp-kinds button.is-on small { color: #D7EBF1; }
.hp-item dt { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; align-content: flex-start; }
.hp-item dt b { font-weight: 700; }
.hp-kind { font-size: .68rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: #EEF3F5; color: #4A5D65; }
.hk-step .hp-kind { background: #E8F5EC; color: #1E7A3C; }
.hk-filter .hp-kind { background: #F1ECFB; color: #5B3FA8; }
.hk-card .hp-kind { background: #E6F2F6; color: #0F5C74; }
.hk-chart .hp-kind { background: #FFF4DB; color: #8A5A00; }
.hk-grid .hp-kind { background: #FDEBEC; color: #A3303A; }
.hk-term .hp-kind { background: #EAF0FF; color: #2C4FA8; }
.hk-step { border-inline-start: 3px solid #3BA55C; }
.hp-spot-btn { border: 1px dashed var(--petrol); background: transparent; color: var(--petrol); border-radius: 99px; padding: 0 8px; height: 24px; font: inherit; font-size: .74rem; cursor: pointer; }
.hp-spot-btn:hover { background: #EEF6F9; }
.hp-spot { outline: 3px solid #F2B705 !important; outline-offset: 3px; box-shadow: 0 0 0 9px rgba(242, 183, 5, .25) !important; border-radius: 10px; animation: hpPulse 1s ease-in-out 3; position: relative; z-index: 5; }
@keyframes hpPulse { 50% { outline-color: #0F5C74; box-shadow: 0 0 0 14px rgba(15, 92, 116, .18); } }
.hp-toast { position: fixed; inset-inline: 16px; bottom: 24px; margin: 0 auto; max-width: 520px; z-index: 9999; background: #22343B; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.25); text-align: center; line-height: 1.7; }

/* =====================================================================
   تناسق الكنترولز (مراجعة شاملة): نفس الارتفاع والشكل لكل الحقول والأزرار،
   وخصوصًا جوه النوافذ المنبثقة - حقل وزرار جنب بعض بيبقوا على خط واحد (36px).
   ===================================================================== */
.set-select { height: 36px; }
.dlg :is(.btn-lemon, .btn-ghost, .btn-danger) { height: 36px; min-height: 36px; padding: 0 16px; border-radius: 99px; font-size: .88rem; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.dlg :is(.btn-lemon, .btn-ghost, .btn-danger) svg { width: 16px; height: 16px; }
.dlg :is(.set-input, .set-select) { height: 36px; max-width: 100%; box-sizing: border-box; }
.dlg .search { height: 36px; min-width: 0; max-width: 100%; box-sizing: border-box; }
.dlg textarea:is(.set-input, .fb-area), .dlg textarea { height: auto; min-height: 72px; padding: 8px 10px; line-height: 1.7; max-width: 100%; box-sizing: border-box; }
.dlg :is(input, select, textarea):not([type="checkbox"]):not([type="radio"]) { max-width: 100%; }
.dlg :is(input, select, textarea):focus-visible { outline: 2px solid var(--lemon); outline-offset: 1px; }
/* عناوين الحقول جوه النوافذ: نفس الحجم واللون */
.td-body label > span:first-child:not(:only-child), .td-body .fld-label { font-size: .82rem; font-weight: 700; color: #3C5058; }
/* الأزرار تحت: الأساسى آخر واحد ودايمًا على نفس الخط */
.td-foot > * { flex: 0 0 auto; }
.td-foot .btn-ghost { background: #fff; }
@media (max-width: 600px) {
    .td-foot { justify-content: stretch; }
    .td-foot > :is(.btn-lemon, .btn-ghost, .btn-danger) { flex: 1 1 auto; }
    .td-body { padding: 12px; }
}
/* النوافذ القديمة (التفاصيل / الأرشيف / الإجازات الأسبوعية): المحتوى يعمل سكرول جوه النافذة */
.dlg:not(.td) > :is(.arc-body, .wv-grid-wrap, .table-wrap) { min-height: 0; flex: 1 1 auto; overflow: auto; }
.arc-body { min-height: min(360px, 50vh); }
@media (max-width: 760px) {
    .dlg:not(.td) { padding: 14px; width: calc(100vw - 16px); max-height: 92vh; }
    .arc-body { grid-template-columns: minmax(0, 1fr); }
    .wv-info { grid-template-columns: minmax(0, 1fr); }
    .dlg-tools > * { flex: 1 1 100%; }
}

/* =====================================================================
   تعليم المساعد (الاستوديو): طابور الأسئلة يمين + الخطوات (السؤال ← المقصود ← الحلول ← التحقق)
   ===================================================================== */
.ts-explain { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.ts-explain > summary { cursor: pointer; padding: 10px 14px; font-weight: 700; color: var(--petrol); }
.ts-explain-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; padding: 0 14px 14px; }
.ts-explain-grid > div { padding: 10px 12px; border-radius: 12px; background: #F6FAFB; }
.ts-explain-grid p { margin: 4px 0 0; line-height: 1.8; font-size: .88rem; color: #33454D; }
.ts { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 14px; align-items: start; }
.ts-queue { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: hidden; }
.ts-q-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ts-q-head h2 { margin: 0; font-size: 1rem; }
.ts-q-head .set-select { min-width: 0; }
.ts-q-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.ts-q-kpis button { display: grid; gap: 2px; padding: 8px 6px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font: inherit; cursor: pointer; text-align: center; }
.ts-q-kpis button b { font-size: 1.2rem; color: var(--petrol); }
.ts-q-kpis button small { font-size: .72rem; color: var(--muted); }
.ts-q-kpis button.is-on { border-color: var(--petrol); background: #EEF6F9; box-shadow: 0 0 0 2px rgba(10, 88, 120, .12); }
.ts-queue .search { width: 100%; min-width: 0; height: 36px; box-sizing: border-box; }
.ts-q-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; overflow-y: auto; min-height: 120px; max-height: calc(100vh - 360px); }
.ts-q-list li > button { width: 100%; display: grid; gap: 4px; text-align: start; padding: 9px 11px; border-radius: 12px; border: 1px solid var(--line); background: #FBFDFE; font: inherit; cursor: pointer; }
.ts-q-list li > button:hover { border-color: var(--petrol); }
.ts-q-list li.is-on > button { border-color: var(--petrol); background: #EEF6F9; box-shadow: inset 3px 0 0 var(--petrol); }
[dir="rtl"] .ts-q-list li.is-on > button { box-shadow: inset -3px 0 0 var(--petrol); }
.ts-q-list li.is-ok > button, .ts-q-list li.is-taught > button { opacity: .75; }
.ts-q-list b { font-size: .9rem; line-height: 1.6; overflow-wrap: anywhere; }
.ts-q-list small { color: var(--muted); font-size: .72rem; }
.ts-q-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.ts-q-tags i { font-style: normal; font-size: .7rem; padding: 1px 7px; border-radius: 99px; background: #EEF3F5; color: #4A5D65; }
.ts-q-tags i.is-bad, .ts-q-tags i.is-rep { background: #FEE2E2; color: #991B1B; }
.ts-q-tags i.is-pair { background: #FFF4DB; color: #8A5A00; }
.ts-q-tags i.is-ok { background: #DCFCE7; color: #166534; }
.ts-q-empty { padding: 20px 10px; text-align: center; color: var(--muted); }
.ts-new { justify-self: stretch; justify-content: center; }
.ts-studio { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
.ts-step { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.ts-step.is-off { opacity: .55; }
.ts-step > header { display: flex; gap: 10px; align-items: flex-start; }
.ts-step > header h3 { margin: 0; font-size: 1.02rem; color: var(--ink); }
.ts-step > header small { color: var(--muted); line-height: 1.7; }
.ts-n { width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--petrol); color: #fff; font-weight: 700; }
.ts-big { height: 44px !important; font-size: 1.02rem !important; width: 100%; box-sizing: border-box; }
.ts-read { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 12px; }
.ts-read.is-ok { background: #F0FDF4; } .ts-read.is-bad { background: #FEF2F2; }
.ts-read b { line-height: 1.7; }
.ts-report { display: grid; gap: 6px; padding: 10px 12px; border-radius: 12px; background: #FFF7ED; border: 1px solid #FED7AA; }
.ts-report p { margin: 0; line-height: 1.8; }
.ts-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ts-sugs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ts-sugs > small { width: 100%; color: var(--muted); font-weight: 700; }
.ts-sug { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 5px 12px; border-radius: 99px; border: 1px dashed var(--petrol); background: #F4FAFC; font: inherit; font-size: .86rem; cursor: pointer; text-align: start; }
.ts-sug:hover { background: #E3F1F6; }
.ts-sug b { font-weight: 600; overflow-wrap: anywhere; }
.ts-cands { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.ts-cand { display: grid; gap: 8px; align-content: start; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: #fff; }
.ts-cand.is-best { border: 2px solid #16A34A; box-shadow: 0 10px 26px -18px rgba(22, 101, 52, .8); }
.ts-cand > header { display: flex; flex-wrap: wrap; gap: 6px; }
.ts-best { padding: 2px 10px; border-radius: 99px; background: #16A34A; color: #fff; font-size: .76rem; font-weight: 700; }
.ts-scope, .ts-match { padding: 2px 9px; border-radius: 99px; font-size: .74rem; font-weight: 700; }
.ts-scope.is-phrase { background: #E6F2F6; color: #0F5C74; } .ts-scope.is-question { background: #F1ECFB; color: #5B3FA8; }
.ts-match.is-exact { background: #DCFCE7; color: #166534; } .ts-match.is-close { background: #FFF4DB; color: #8A5A00; }
.ts-match.is-partial, .ts-match.is-none { background: #FEE2E2; color: #991B1B; }
.ts-parts { display: grid; gap: 6px; }
.ts-part { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 1.02rem; }
.ts-part b { padding: 3px 10px; border-radius: 10px; background: #FEF2F2; color: #991B1B; overflow-wrap: anywhere; }
.ts-part b.is-to { background: #ECFDF5; color: #166534; }
.ts-part span { color: var(--muted); }
.ts-explain-line, .ts-sim, .ts-diff { margin: 0; line-height: 1.75; font-size: .86rem; color: #33454D; }
.ts-sim small { color: var(--muted); }
.ts-diff { color: #8A5A00; }
.ts-safe { padding: 7px 10px; border-radius: 10px; background: #F4F8F9; font-size: .84rem; line-height: 1.7; }
.ts-safe.is-ok { background: #F0FDF4; color: #14532D; } .ts-safe.is-bad { background: #FEF2F2; color: #991B1B; } .ts-safe.is-warn { background: #FFFBEA; color: #713F12; }
.ts-safe ul { margin: 4px 0 0; padding-inline-start: 18px; }
.ts-cand > footer { display: flex; justify-content: flex-end; }
.ts-done { border: 2px solid #BBF7D0; }
@media (max-width: 980px) {
    .ts { grid-template-columns: minmax(0, 1fr); }
    .ts-queue { position: static; max-height: none; }
    .ts-q-list { max-height: 320px; }
}
/* تتبع التقارير: حقل سؤال المساعد ياخد عرض أكبر */
.rt-pick-grid .rt-question { flex: 1 1 320px; min-width: 0; }
.rt-pick-grid .rt-question .set-input { width: 100%; box-sizing: border-box; }
/* الصلاحيات: ما يظهر للمستخدم في القائمة */
.pm-sees-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pm-sees-list li { display: grid; gap: 2px; padding: 7px 10px; border-radius: 10px; background: #F4F8F9; }
.pm-sees-list li.is-on { background: #F0FDF4; } .pm-sees-list li.is-on b { color: #166534; }
.pm-sees-list li.is-off { background: #FEF2F2; } .pm-sees-list li.is-off b { color: #991B1B; }
.pm-sees-list small { color: var(--muted); }
.pm-sees-pages { font-size: .78rem; color: #33454D; line-height: 1.7; }

/* الصلاحيات: الشجرة ماتخرجش تحت العمود الجانبى ولا برّه الشاشة */
.pm > * { min-width: 0; }
.pm-href { overflow-wrap: anywhere; }
@media (max-width: 1000px) { .pm { grid-template-columns: minmax(0, 1fr); } .pm-side { position: static; } }
/* تاريخ النسخة تحت القائمة */
.nav-build { padding: 4px 18px; font-size: .7rem; color: rgba(255, 255, 255, .55); }
.shell.is-mini .nav-build { display: none; }

/* =====================================================================
   تعليم المساعد: الكلمات قابلة للضغط + «افحص الكلمة» + محرر قوالب الأسئلة
   ===================================================================== */
button.dv-tok { cursor: pointer; transition: transform .12s, box-shadow .12s; }
button.dv-tok:hover { transform: translateY(-1px); box-shadow: 0 6px 14px -10px rgba(7, 63, 87, .6); }
.dv-tok.is-slot { background: #F5F3FF; border-color: #A78BFA; color: #4C1D95; }
.dv-legend .is-slot { background: #F5F3FF; border-color: #A78BFA; }
.dv-tok.is-picked { outline: 3px solid #F2B705; outline-offset: 2px; animation: none; }
.ts-sqlbox { flex: 1 1 320px; min-width: 0; }
.ts-sqlbox pre, .wi-preview pre, .te-match pre { max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word; }

.wi { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 12px 14px; border-radius: 14px; border: 2px solid #F2B705; background: #FFFDF5; }
.wi-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.wi-word { font-size: 1.15rem; color: #7C2D12; }
.wi-verdict { font-weight: 700; color: var(--petrol-deep); flex: 1; min-width: 200px; }
.wi-x { border: 0; background: #F4F4F5; border-radius: 50%; width: 30px; height: 30px; cursor: pointer; }
.wi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.wi-col { display: grid; gap: 6px; align-content: start; padding: 10px; border-radius: 12px; background: #fff; border: 1px solid var(--line); min-width: 0; }
.wi-col h5, .wi-action h5 { margin: 0; font-size: .9rem; color: var(--petrol); }
.wi-hit { margin: 0; display: grid; gap: 1px; padding: 6px 8px; border-radius: 8px; background: #F6FAFB; }
.wi-hit b { font-weight: 600; overflow-wrap: anywhere; } .wi-hit small { color: var(--muted); }
.wi-hit.is-emp { background: #F5F3FF; } .wi-hit.is-branch, .wi-hit.is-area { background: #ECFEFF; } .wi-hit.is-supervisor, .wi-hit.is-manager { background: #FFF7ED; }
.wi-none { margin: 0; color: var(--muted); font-size: .85rem; }
.wi-advice { padding: 10px 12px; border-radius: 12px; background: #EEF6F9; border-inline-start: 4px solid var(--petrol); line-height: 1.8; }
.wi-action { display: grid; gap: 8px; padding: 10px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.wi-action.is-main { border: 2px solid #16A34A; background: #F0FDF4; }
.wi-tpl { margin: 0; font-size: 1.05rem; font-weight: 700; color: #14532D; }
.wi-vals { margin: 0; padding-inline-start: 18px; line-height: 1.9; font-size: .88rem; }
.wi-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wi-chip { display: grid; gap: 1px; text-align: start; padding: 6px 10px; border-radius: 10px; border: 1px dashed var(--petrol); background: #F4FAFC; font: inherit; cursor: pointer; max-width: 320px; }
.wi-chip b { font-size: .86rem; } .wi-chip small { font-size: .72rem; color: var(--muted); }
.wi-syn { flex: 1 1 240px; min-width: 0; }
.wi-preview { display: grid; gap: 4px; padding: 8px 10px; border-radius: 10px; background: #F6FAFB; }
.wi-preview p { margin: 0; }
@media (max-width: 760px) { .wi-grid { grid-template-columns: minmax(0, 1fr); } }

.te { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.te-intro { margin: 0; padding: 10px 12px; border-radius: 12px; background: #EEF6F9; line-height: 1.8; }
.te-row2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 10px; align-items: end; }
.te-row2 .set-input { width: 100%; }
.te-sec { display: grid; gap: 8px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: #FBFDFE; min-width: 0; }
.te-sec h4 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: .98rem; }
.te-sec h4 .ts-n { width: 24px; height: 24px; font-size: .8rem; }
.te-slots { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.te-slots small { color: var(--muted); font-weight: 700; }
.te-slot { height: 28px; padding: 0 10px; border-radius: 99px; border: 1px solid #A78BFA; background: #F5F3FF; color: #4C1D95; font: inherit; font-size: .82rem; cursor: pointer; }
.te-slot.is-ph { border-color: #7DD3FC; background: #F0F9FF; color: #075985; font-family: Consolas, monospace; }
.te-phrases, .te-sql { width: 100%; box-sizing: border-box; }
.te-sql { font-family: Consolas, "Courier New", monospace; font-size: .84rem; line-height: 1.6; min-height: 180px !important; }
.te-q { flex: 1 1 320px; min-width: 0; }
.te-err { margin: 0; color: #B91C1C; font-weight: 600; }
.te-help table { font-size: .82rem; }
.te-lib { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.te-lib > small { width: 100%; color: var(--muted); font-weight: 700; }
.te-libbtn { display: grid; gap: 1px; text-align: start; padding: 7px 11px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font: inherit; cursor: pointer; }
.te-libbtn:hover { border-color: var(--petrol); background: #F4FAFC; }
.te-libbtn b { font-size: .86rem; } .te-libbtn small { font-size: .72rem; color: var(--muted); }
.te-libgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.te-libcol { display: grid; gap: 6px; align-content: start; }
.te-libcol h5 { margin: 0; color: var(--petrol); }
.te-match { display: grid; gap: 6px; }
@media (max-width: 700px) { .te-row2 { grid-template-columns: minmax(0, 1fr); } }
.lx-inspect { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.lx-inspect-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.lx-inspect-row .filter { flex: 1 1 320px; min-width: 0; }
.lx-inspect-row .set-input { width: 100%; box-sizing: border-box; }
.wi-action > .btn-lemon, .wi-action > .btn-ghost { justify-self: start; }
/* الصلاحيات: العمود الجانبى كان محتواه (اختيار المستخدم + النسخ + عناوين IP) أعرض من العمود فبيغطى الشجرة */
.pm { grid-template-columns: minmax(290px, 360px) minmax(0, 1fr); }
.pm-side { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.pm-side > * { min-width: 0; max-width: 100%; box-sizing: border-box; }
.pm-side .ss, .pm-side .search, .pm-side input, .pm-side select { min-width: 0 !important; max-width: 100%; }
.pm-side * { overflow-wrap: anywhere; }
.pm-copy { flex-wrap: wrap; }
.pm-main > * { min-width: 0; }
@media (max-width: 1000px) { .pm { grid-template-columns: minmax(0, 1fr); } }
.pm-side .ss-btn { min-width: 0; width: 100%; max-width: none; }
.pm-ips li > * { min-width: 0; }

/* ===== محرر القوالب: مراحل + كلمات الصيغة + منشئ الاستعلام ===== */
.te-flow { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.te-flow li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 6px; border-radius: 99px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: .84rem; font-weight: 700; }
.te-flow li b { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #E5E7EB; color: #374151; font-size: .76rem; }
.te-flow li.is-on { border-color: var(--petrol); color: var(--petrol); }
.te-flow li.is-on b { background: var(--petrol); color: #fff; }
.te-flow li.is-done { border-color: #86EFAC; color: #166534; background: #F0FDF4; }
.te-flow li.is-done b { background: #16A34A; color: #fff; }
.te-words { display: grid; gap: 6px; }
.te-words > small { color: var(--muted); font-weight: 700; }
.te-word { display: grid; gap: 6px; padding: 8px 10px; border-radius: 10px; border: 1px solid #BBF7D0; background: #F7FEF9; min-width: 0; }
.te-word.is-new { border-color: #FCD34D; background: #FFFBEB; }
.te-word-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.te-word-head b { font-size: .95rem; }
.te-word-head small { flex: 1 1 200px; color: var(--muted); }
.te-syn { flex: 1 1 220px; min-width: 0; }
.te-chk { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; cursor: pointer; }
.te-note { margin: 0; padding: 7px 10px; border-radius: 10px; background: #EEF6F9; font-size: .86rem; }
.te-tabs { flex-wrap: wrap; }
.te-foot-note { margin-inline-end: auto; color: var(--muted); font-size: .84rem; }
.qb { display: grid; gap: 10px; min-width: 0; }
.qb-row { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; min-width: 0; }
.qb-row .set-select { min-width: 220px; max-width: 100%; }
.qb-desc { flex: 1 1 260px; margin: 0; }
.qb-top { width: 110px; }
.qb-chips, .qb-slots, .qb-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px; border-radius: 10px; background: #fff; border: 1px dashed var(--line); min-width: 0; }
.qb-chips > small, .qb-slots > small, .qb-filters > small { width: 100%; color: var(--muted); font-weight: 700; }
.qb-chip { height: 28px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--line); background: #fff; font: inherit; font-size: .83rem; cursor: pointer; }
.qb-chip.is-on { border-color: var(--petrol); background: var(--petrol); color: #fff; }
.qb-col { display: inline-flex; align-items: center; border-radius: 99px; border: 1px solid var(--line); background: #fff; overflow: hidden; }
.qb-col button { height: 28px; padding: 0 11px; border: 0; background: transparent; font: inherit; font-size: .83rem; cursor: pointer; }
.qb-col.is-on { border-color: #0E7490; background: #ECFEFF; }
.qb-col.is-on button { color: #0E7490; font-weight: 700; }
.qb-col select { height: 28px; border: 0; border-inline-start: 1px solid #A5F3FC; background: #CFFAFE; font: inherit; font-size: .8rem; }
.qb-slot { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 10px; background: #F5F3FF; color: #4C1D95; font-size: .84rem; }
.qb-slot select, .qb-filter select { height: 30px; border-radius: 8px; border: 1px solid var(--line); font: inherit; font-size: .83rem; max-width: 220px; }
.qb-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; }
.qb-filter .set-input { flex: 1 1 140px; min-width: 0; height: 30px; }
.sg tr.is-off td { opacity: .55; }
@media (max-width: 700px) { .te-row2 { grid-template-columns: minmax(0, 1fr); } }
.cm-go > span { white-space: pre-line; overflow-wrap: anywhere; }
.hp-adminbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 10px; padding: 8px 12px; border-radius: 12px; background: #FFF7E0; border: 1px solid #F5D77A; font-size: .86rem; }
.hp-adminbar span { flex: 1 1 320px; }
.hp-adminbar a, .hp-admin a { color: var(--petrol); font-weight: 700; }
.hp-admin { display: grid; gap: 4px; margin-top: 6px; padding: 6px 10px; border-radius: 10px; background: #F7FAFC; border-inline-start: 3px solid #F5B800; font-size: .82rem; }
.hp-admin code { overflow-wrap: anywhere; }
/* زر «مساعدة» لكل صفحة فى شجرة الصلاحيات */
.pm-help { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 2px; margin-inline-start: 38px; padding: 3px 10px 3px 6px; border: 1px dashed var(--line); border-radius: 99px;
           background: #fff; color: var(--muted); font: inherit; font-size: .8rem; cursor: pointer; }
.pm-help.is-on { color: #7A5A00; background: #FFF9E6; border-style: solid; border-color: #F5D77A; }
.pm-help.is-on .pm-check { background: #F5B800; border-color: #F5B800; color: #fff; }
.pm-help.is-changed { outline: 2px solid #F59E0B; outline-offset: 1px; }
.pm-help.is-off, .pm-help:disabled { opacity: .6; cursor: default; }
.pm-help.is-on:disabled { opacity: .85; }
/* الدايرة الحمرا: بلاغات واقتراحات جديدة (للأدمن) */
.fb-dot { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: #DC2626; color: #fff;
          font-size: .72rem; font-weight: 800; line-height: 1; box-shadow: 0 0 0 2px rgba(255,255,255,.9); animation: fbPulse 2s ease-in-out infinite; }
.fb-dot.is-nav { margin-inline-start: auto; }
.nav-group > summary .fb-dot.is-nav + .nav-chevron { margin-inline-start: 6px; }
.fb-dot.is-sub { margin-inline-start: auto; min-width: 18px; height: 18px; font-size: .68rem; }
.nav-subitem:has(.fb-dot) { display: flex; align-items: center; gap: 6px; }
.fb-dot.is-title { vertical-align: middle; margin-inline-start: 8px; font-size: .8rem; min-width: 24px; height: 24px; }
@keyframes fbPulse { 0%, 100% { box-shadow: 0 0 0 2px rgba(255,255,255,.9), 0 0 0 0 rgba(220,38,38,.45); } 50% { box-shadow: 0 0 0 2px rgba(255,255,255,.9), 0 0 0 6px rgba(220,38,38,0); } }

/* ===== البيانات الأساسية: ربط مديرى البيع / المشرفين بالفروع ===== */
.ml { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); gap: 14px; align-items: start; margin-bottom: 14px; }
.ml-side { display: grid; gap: 8px; min-width: 0; position: sticky; top: 76px; max-height: calc(100vh - 96px); grid-template-rows: auto auto minmax(0, 1fr); }
.ml-side .search { width: 100%; box-sizing: border-box; }
.ml-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; overflow: auto; min-height: 0; }
.ml-item { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; text-align: start; padding: 8px 10px; border: 1px solid transparent; border-radius: 10px; background: transparent; font: inherit; cursor: pointer; }
.ml-item:hover { background: var(--mist, #F2F6F8); }
.ml-item.is-on { border-color: var(--petrol); background: #EEF6F9; }
.ml-item b { font-size: .9rem; overflow-wrap: anywhere; }
.ml-item small { grid-column: 1; color: var(--muted); font-size: .74rem; }
.ml-counts { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 4px; align-items: center; }
.ml-counts em { font-style: normal; font-size: .72rem; padding: 2px 7px; border-radius: 99px; background: #EEF1F4; color: var(--muted); white-space: nowrap; }
.ml-counts em.is-on { background: #E3F4E8; color: #166534; font-weight: 700; }
.ml-counts em.is-warn { background: #FEF3C7; color: #92400E; }
.ml-main { display: grid; gap: 10px; min-width: 0; }
.ml-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-inline-start: auto; }
.ml-rule { margin: 0; padding: 8px 12px; border-radius: 10px; background: #F4FAFC; font-size: .88rem; }
.ml-rule .is-bad { color: #B91C1C; font-weight: 700; }
.ml-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.ml-bar .search { flex: 1 1 220px; min-width: 0; }
.ml-chips { display: grid; gap: 10px; max-height: 60vh; overflow: auto; padding-inline-end: 4px; }
.ml-group { display: grid; gap: 6px; }
.ml-gname { font-weight: 700; font-size: .84rem; color: var(--petrol); }
.ml-gname small { color: var(--muted); font-weight: 600; margin-inline-start: 6px; }
.ml-also { color: var(--muted); font-size: .7rem; text-decoration: none; }
.pm-chip.is-stopped { border-style: dashed; }
.ml-sups { max-height: 60vh; overflow: auto; }
.ml-none td { background: #FFF5F5; }
.ml-move { display: grid; gap: 8px; padding: 10px 12px; border-radius: 12px; border: 1px solid #F5D77A; background: #FFFBEB; }
.ml-move-head { display: flex; gap: 8px; align-items: center; }
.ml-move-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.ml-move-row .ml-sup { flex: 1 1 240px; min-width: 0; }
.ml-move-row .ml-note { flex: 1 1 200px; }
.ml-move-row .ml-note .set-input { width: 100%; box-sizing: border-box; }
.ml-gridbox { min-width: 0; }
.ml-gridbox .panel-head { flex-wrap: wrap; gap: 8px; }
.ml-gridbox .panel-head .search { flex: 1 1 200px; min-width: 0; }
.ml-row { cursor: pointer; }
.ml-row.is-picked td { background: #FFF7D6; }
@media (max-width: 900px) { .ml { grid-template-columns: minmax(0, 1fr); } .ml-side { position: static; max-height: 360px; } }
.sg-more.is-warn { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 0; padding: 8px 12px; border-radius: 10px;
                   background: #FFF7E0; border: 1px solid #F5D77A; color: #7A5A00; font-size: .84rem; font-weight: 600; }
.sg-more.is-warn span { flex: 1 1 260px; }

/* ===== شاشات التحليل: الجدول اللى بيختار منه «مثبّت» فوق، والتفاصيل تحته على طول ===== */
.pin-btn { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--line); background: #fff;
           font: inherit; font-size: .8rem; color: var(--muted); cursor: pointer; filter: grayscale(1); }
.pin-btn.is-on { filter: none; border-color: #F5D77A; background: #FFF9E6; color: #7A5A00; font-weight: 700; }
.sales-pin.is-pinned { position: sticky; top: 64px; z-index: 6; padding: 8px 0 10px; margin-top: -8px; background: var(--mist);
                       box-shadow: 0 10px 14px -12px rgba(16, 52, 66, .35); }
/* وهو مثبّت: الجدول والرسم أقصر عشان التفاصيل تبان تحته من غير اسكرول */
.sales-pin.is-pinned > .panel .sg-wrap { min-height: 0 !important; height: clamp(170px, 30vh, 430px); }
.sales-pin.is-pinned > .panel .schart { min-height: 0 !important; height: clamp(170px, 30vh, 430px); overflow: hidden; }
.sales-pin.is-pinned > .panel .schart > svg { max-height: 100%; width: auto; max-width: 100%; margin-inline: auto; }
.sales-pin.is-pinned .panel-head { margin-bottom: 6px !important; }
/* لو اتكبّر لملء الشاشة أو شاشة صغيرة ← من غير تثبيت */
.sales-pin:has(.mx.is-max) { position: static; z-index: auto; box-shadow: none; }
@media (max-width: 900px), (max-height: 640px) { .sales-pin.is-pinned { position: static; box-shadow: none; } .pin-btn { display: none; } }
/* الجزء اللى اتغير باختيار صف بيلمع لحظة */
.is-flash { animation: pinFlash 1.1s ease-out; }
@keyframes pinFlash { 0% { box-shadow: 0 0 0 3px rgba(245, 184, 0, .75); } 100% { box-shadow: 0 0 0 3px rgba(245, 184, 0, 0); } }

/* ===== ملف اللوج والأسئلة (عرض فقط) ===== */
.ql-wrap { max-height: 70vh; }
.ql-grid td { vertical-align: top; }
.ql-row { cursor: pointer; }
.ql-row.is-open td { background: #FFF9E6; }
.ql-q { min-width: 220px; max-width: 360px; }
.ql-clip { max-width: 260px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
td.ql-clip { display: table-cell; }
.ql-clip { overflow-wrap: anywhere; }
.ql-err { color: #B91C1C; }
.ql-sql { font-family: Consolas, monospace; font-size: .76rem; }
.ql-detail > td { background: #FBFDFE; padding: 0 !important; }
.ql-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 12px 18px; padding: 12px 14px; border-inline-start: 3px solid #F5B800; }
.ql-card dl { margin: 0; display: grid; gap: 6px; }
.ql-card dl > div { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px; }
.ql-card dt { color: var(--muted); font-weight: 700; font-size: .82rem; }
.ql-card dd { margin: 0; overflow-wrap: anywhere; }
.ql-card .dv-sql { grid-column: 1 / -1; }
.ql-answer h4 { margin: 0 0 6px; font-size: .9rem; }
.ql-pre { white-space: pre-wrap; margin: 0; }
.ql-mini { max-height: 260px; }
@media (max-width: 900px) { .ql-card { grid-template-columns: minmax(0, 1fr); } .ql-card dl > div { grid-template-columns: minmax(0, 1fr); } }

/* رابط بدل تبويب (شاشة اتنقلت لمكان تانى) */
.tabs .tab-link { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; font-weight: 600; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; }
.tabs .tab-link:hover { color: var(--petrol-deep); }
/* القنوات: كارت لكل قناة */
.ch-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 14px; }
.ch-card { display: grid; gap: 3px; text-align: start; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: #fff; font: inherit; cursor: pointer; position: relative; overflow: hidden; }
.ch-card i { position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 5px; background: var(--ch); }
.ch-card b { font-size: .95rem; }
.ch-card span { font-size: .84rem; }
.ch-card small { color: var(--muted); font-size: .78rem; }
.ch-card:hover { border-color: var(--ch); }
.ch-card.is-on { border-color: var(--ch); box-shadow: 0 0 0 2px var(--ch) inset; }

/* ===== حالة الفروع ===== */
.bs-change { margin-bottom: 14px; }
.bs-step { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .8rem; font-weight: 700; background: #EEF1F4; color: #475569; }
.bs-step.is-s1 { background: #E3F4E8; color: #166534; }
.bs-step.is-s2 { background: #FEF3C7; color: #92400E; }
.bs-step.is-s3 { background: #FEE2E2; color: #991B1B; }
.bs-warn { color: #B45309; font-weight: 700; }
.bs-fix { display: inline-flex; gap: 6px; align-items: center; }

/* ===== تاريخ ربط الفروع: الخط الزمنى ===== */
.bh-bar .bh-presets button { font-size: .8rem; }
.bh-time { display: grid; gap: 4px; overflow-x: auto; padding-bottom: 6px; }
.bh-axis, .bh-line { display: grid; grid-template-columns: minmax(150px, 230px) minmax(420px, 1fr); gap: 10px; align-items: center; }
.bh-label { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; gap: 6px; align-items: center; min-width: 0; }
.bh-label b { color: var(--petrol); min-width: 24px; }
.bh-label em { font-style: normal; font-size: .68rem; padding: 0 6px; }
.bh-track { position: relative; height: 26px; border-radius: 6px; background: repeating-linear-gradient(90deg, #F1F5F9 0 1px, transparent 1px 100%); background-color: #F8FAFC; }
.bh-track.is-axis { height: 20px; background: none; border-bottom: 1px solid var(--line); }
.bh-track.is-axis i { position: absolute; bottom: 2px; transform: translateX(50%); font-style: normal; font-size: .68rem; color: var(--muted); white-space: nowrap; }
[dir="ltr"] .bh-track.is-axis i { transform: translateX(-50%); }
.bh-seg { position: absolute; top: 2px; bottom: 2px; min-width: 3px; border: 0; border-radius: 5px; padding: 0 6px; background: var(--c); color: #fff; font: inherit; font-size: .72rem; font-weight: 700;
          overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.bh-seg span { overflow: hidden; text-overflow: ellipsis; display: block; }
.bh-seg:hover { filter: brightness(1.08); z-index: 2; box-shadow: 0 0 0 2px #111827; }
.bh-seg.is-gap { background: repeating-linear-gradient(135deg, #E2E8F0 0 6px, #F8FAFC 6px 12px); color: #64748B; }
.bh-closed { position: absolute; top: -3px; bottom: -3px; width: 3px; background: #DC2626; border-radius: 2px; }
.bh-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: .78rem; color: var(--muted); }
.bh-legend span { display: inline-flex; align-items: center; gap: 5px; }
.bh-legend i { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.bh-legend i.is-gap { background: repeating-linear-gradient(135deg, #CBD5E1 0 3px, #F8FAFC 3px 6px); }
.bh-legend i.is-closed { width: 3px; height: 14px; background: #DC2626; }
.bh-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 6px; vertical-align: middle; }
.bh-grid tr.bh-first td { border-top: 2px solid #CBD5E1; }
.bh-grid tr.bh-cur td { background: #F0FDF4; }
tr.bh-gaprow td { color: #64748B; font-style: italic; }
.bh-list { font-size: .76rem; max-width: 520px; white-space: normal; }

/* خريطة نتيجة الشات (GeoMapView): وهى متكبّرة تاخد الشاشة */
.mx.gm.is-max .gm-map { height: calc(100vh - 230px); min-height: 420px; }
.result-tools .tool.is-on { background: var(--lemon-soft); border-color: var(--lemon-deep); }
