/* ==========================================
   1. تهيئة عامة وألوان النظام (ERP Identity)
   ========================================== */
:root {
    /* HR module brand palette, sampled directly from HR/wwwroot/icon-192.png (the blue/orange
       "V" person-pair logo) - HR now has its own distinct identity from CRM's wine/burgundy one
       (see CLAUDE.md section 5's note on CRM's palette; this is HR's equivalent). Values pulled
       via pixel sampling (Pillow), not eyeballed: #186493 and #fcba66 are the two most common
       opaque pixel colors in the logo, #143e52 is the darker navy shadow the logo's own gradient
       already uses along the lower-left stroke of the "V" (reused here as the hover shade
       instead of inventing a new darken formula), and --primary-blue-light is a 38% white-blend
       of the base blue. */
    --primary-blue: #186493;       /* اللون الأساسي لهوية HR (أزرق) - من شعار HR/wwwroot/icon-192.png */
    --primary-blue-dark: #143e52;  /* درجة أغمق للتفاعل (hover) - نفس ظل التدرج السفلي في الشعار */
    --primary-blue-light: #709fbc; /* درجة فاتحة للتمييز والتدرجات */
    --accent-orange: #fcba66;      /* اللون الثانوي لهوية HR (برتقالي) - من نفس الشعار */
    --body-bg: #f8fafc;            /* خلفية هادئة للصفحة والمحتوى */
    --white: #ffffff;
    --border-color: #f1f5f9;       /* حدود ناعمة ومطابقة للصورة */
    --text-dark: #334155;          /* لون النصوص الأساسي */
    --text-muted: #94a3b8;         /* لون النصوص الثانوية الباهتة */
    --active-bg: #e8f1f7;          /* خلفية العنصر النشط (أزرق فاتح متناسق مع الهوية الجديدة) */
    --active-icon-color: #186493;  /* لون أيقونة العنصر النشط */
    --transition: all 0.25s ease-in-out;
}

/* تصفير الهوامش لضبط دقة الأبعاد */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: var(--body-bg);
    color: var(--text-dark);
    overflow: hidden; /* لمنع ظهور شريط تمرير لكامل الصفحة والحفاظ على ثبات اللوحة */
}

/* التخطيط الهيكلي للوحة التحكم بالكامل (Grid Layout)
   تم ضبط الأعمدة ليكون شريط الجانب (100px) على اليمين والمحتوى (1fr) على اليسار */
.dashboard-layout {
    display: grid;
    grid-template-rows: 70px 1fr;
    grid-template-columns: 100px 1fr; 
    grid-template-areas: 
        "header header"
        "sidebar main";
    height: 100vh;
    width: 100vw;
}

/* ==========================================
   2. تنسيق شريط التنقل العلوي (TOP NAVBAR)
   ========================================== */
.top-navbar {
    grid-area: header;
    background-color: var(--white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 100;
}

/* أقصى اليمين: الشعار وزر التحكم الهاتفي */
.navbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.mobile-toggle-btn {
    display: none; /* مخفي في الشاشات الكبيرة ويظهر فقط في الموبايل */
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-dark);
    cursor: pointer;
}

/* بناء اللوجو مطور ومقارب للصورة */
.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 20px;
}

.logo-icon .blue-dot {
    width: 18px;
    height: 18px;
    background-color: var(--primary-blue);
    border-radius: 50% 50% 0 50%;
}

.logo-icon .orange-dot {
    width: 12px;
    height: 12px;
    background-color: var(--accent-orange);
    border-radius: 50% 0 50% 50%;
    margin-right: auto;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary-blue);
    letter-spacing: 0.5px;
}

.brand-sub {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
}

/* وسط الهيدر: شريط البحث الأنيق الدائري */
.navbar-center {
    flex: 1;
    max-width: 500px;
    margin: 0 30px;
}

.search-box {
    position: relative;
    width: 100%;
}

.search-box input {
    width: 100%;
    padding: 10px 15px 10px 45px; /* مساحة لجهة اليسار للأيقونة */
    border: 1px solid #e2e8f0;
    border-radius: 30px; /* حواف دائرية بالكامل مثل الصورة */
    background-color: #fafafa;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
    text-align: right;
}

.search-box input:focus {
    border-color: var(--primary-blue);
    background-color: var(--white);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 16px;
}

.navbar-org-name {
    width: 100%;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-blue);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* يسار الهيدر: الأيقونات والبروفايل */
.navbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-icon-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-dark);
    cursor: pointer;
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.nav-icon-btn:hover {
    background-color: var(--border-color);
}

/* شارة عدد الإشعارات الحمراء */
.notification-btn .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: #ef4444; /* أحمر ناصع */
    color: var(--white);
    font-size: 10px;
    font-weight: bold;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* قائمة المستخدم والبروفايل */
.user-profile-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
    padding: 5px 10px;
    border-radius: 30px;
    transition: var(--transition);
}

.user-profile-menu:hover {
    background-color: var(--border-color);
}

.user-profile-menu .username {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.user-profile-menu .avatar-img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
}

/* تصميم كارد القائمة المنسدلة للبروفايل */
.dropdown-card {
    position: absolute;
    top: 50px;
    left: 0;
    width: 200px;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease-in-out;
    z-index: 500;
}

/* كلاس يتم تفعيله بواسطة الجافاسكريبت */
.dropdown-card.show-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    font-size: 14px;
    color: #475569;
    text-decoration: none;
    transition: var(--transition);
}

.dropdown-item:hover {
    background-color: #f8fafc;
}

.dropdown-item i {
    font-size: 16px;
    color: #64748b;
    width: 20px;
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 8px 0;
}

/* تنسيق خيار الخروج بلون أحمر لطيف كما في الصورة */
.logout-item span {
    color: #f87171;
}

.logout-item i {
    color: #f87171 !important;
}

/* ==========================================
   3. تصميم الشـريط الجانبي الأيمن (SIDEBAR)
   ========================================== */
.sidebar-aside {
    grid-area: sidebar;
    background-color: var(--white);
    border-left: 1px solid var(--border-color); /* خط التقسيم على اليسار لأن السايدبار على اليمين */
    overflow-y: auto; /* لتمكين التمرير الداخلي */
    padding: 15px 0;
}

/* تخصيص السكرول بار ليبدو رفيعاً جداً وهادئاً */
.sidebar-aside::-webkit-scrollbar {
    width: 4px;
}

.sidebar-aside::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-aside::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* Hidden on desktop (the icon rail is narrow, 100px) - shown only in the mobile slide-in menu,
   see @media (max-width: 991px) below, matching CRM's org-name-moves-to-menu pattern. */
.sidebar-org-name {
    display: none;
}

.sidebar-nav-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

/* هيكلة العنصر الواحد داخل القائمة */
.sidebar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 85px; /* تم تصغير العرض الإجمالي ليناسب الحجم الجديد */
    text-decoration: none;
    gap: 6px;
    transition: var(--transition);
}

/* المربع الحاوي للأيقونة (تم تعديل المقاسات لتصبح أصغر وأدق) */
.item-icon-box {
    width: 48px;        /* تم تصغيرها من 65px إلى 48px */
    height: 48px;       /* تم تصغيرها من 65px إلى 48px */
    background-color: var(--white);
    border: 1px solid #e2e8f0;
    border-radius: 10px; /* تدوير زوايا أنعم ومناسب للحجم الصغير */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.item-icon-box i {
    font-size: 16px;    /* تم تصغير الأيقونة لتتناسق مع المربع الجديد */
    color: #64748b; 
    transition: var(--transition);
}

.item-label {
    font-size: 10px;    /* خط هادئ وصغير لمنع التداخل */
    font-weight: 600;
    color: var(--text-dark);
    text-align: center;
    line-height: 1.3;
}

/* عند تمرير الماوس فوق العنصر */
.sidebar-item:hover .item-icon-box {
    background-color: var(--active-bg);
    border-color: var(--primary-blue-light);
}

.sidebar-item:hover .item-icon-box i {
    color: var(--active-icon-color);
}

/* حالة العنصر النشط (Active Item) */
.sidebar-item.active .item-icon-box {
    background-color: var(--active-bg);
    border-color: transparent;
}

.sidebar-item.active .item-icon-box i {
    color: var(--active-icon-color);
}

.sidebar-item.active .item-label {
    color: var(--primary-blue);
    font-weight: 700;
}

/* Grouped submenu (e.g. "Policies & Settings") - the icon rail is narrow/centered so children
   expand as an accordion below the group's own toggle icon rather than a hover flyout. Reuse this
   pattern for any future group of related setup/policy screens instead of flat top-level icons. */
.sidebar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.sidebar-group-toggle {
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    position: relative;
}

.group-chevron {
    width: 12px;
    height: 12px;
    color: #94a3b8;
    margin-top: -2px;
    transition: transform 0.2s ease;
}

.group-chevron.expanded {
    transform: rotate(180deg);
}

.sidebar-submenu {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
    padding-top: 10px;
    padding-inline-start: 0;
    border-top: 1px dashed #e2e8f0;
}

.sidebar-subitem .item-icon-box {
    width: 40px;
    height: 40px;
}

.sidebar-subitem .item-label {
    font-size: 9px;
}

/* ==========================================
   4. مساحة المحتـوى على اليسار (MAIN AREA)
   ========================================== */
.main-page-content {
    grid-area: main;
    padding: 30px 20px;
    overflow-y: auto;
    background-color: var(--body-bg);
}

/* Bootstrap's .container-fluid adds its own left/right gutter (0.75rem) on top of the padding
   above, stacking two separate side margins for no real reason - every HR page wraps its content
   in <div class="container-fluid">, so this is the one place to remove that redundant gutter and
   let .main-page-content's own padding be the single source of the page's side margin. */
.container-fluid {
    padding-left: 0;
    padding-right: 0;
}

@media (max-width: 768px) {
    .main-page-content {
        padding: 18px 10px;
    }
}

/* الكارد الترحيبي */
.page-placeholder-card {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    padding: 40px;
    border-radius: 12px;
    text-align: center;
}

.page-placeholder-card h2 {
    color: var(--primary-blue);
    margin-bottom: 10px;
}

.page-placeholder-card p {
    color: var(--text-muted);
    font-size: 14px;
}

/* ==========================================
   5. تجاوب التصميم مع جميع الشاشات (RESPONSIVE)
   ========================================== */

/* للأجهزة اللوحية والمحمولة الشائعة */
@media (max-width: 991px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "main";
    }

    /* بدون min-width: 0 هنا يفرض هيدر الصفحة (الشعار + اسم المنشأة + الأيقونات)
       عرض التخطيط بالكامل ليتسع لمحتواه الطبيعي (والذي يتجاوز عرض الهاتف)، بدل
       الانضغاط ضمن خلية الشبكة المخصصة له - وهي نفس مشكلة "grid blowout"
       المعروفة، حيث لا تنكمش عناصر الشبكة تحت حجم محتواها الأدنى افتراضياً */
    .top-navbar {
        min-width: 0;
    }

    /* تصغير هوية العلامة التجارية على الموبايل (الأيقونة فقط + اسم مختصر) حتى
       تبقى مساحة كافية لأيقونات التحكم على اليمين بدون ازدحام */
    .brand-sub {
        display: none;
    }

    .brand-title {
        font-size: 14px;
    }

    .navbar-right,
    .navbar-left {
        min-width: 0;
    }

    /* إظهار زر فتح القائمة الجانبية في الموبايل */
    .mobile-toggle-btn {
        display: block;
    }

    /* اسم المنشأة انتقل إلى أعلى القائمة الجانبية المنزلقة على الموبايل (انظر
       .sidebar-org-name) بدل منتصف الهيدر العلوي الضيق جداً لعرضه هنا بوضوح -
       نفس نمط CRM بالضبط. */
    .navbar-center {
        display: none;
    }

    /* تحويل شريط الجانب إلى قائمة منزلقة، من جهة البداية حسب اتجاه اللغة
       (يمين للعربية RTL، يسار للإنجليزية LTR) - أوسع من الرف الجانبي الأيقوني
       الضيق (100px) في سطح المكتب حتى يتسع بشكل مقروء لاسم المنشأة وتسميات
       القوائم الفرعية المنسدلة (Policies & Settings / Payroll) أعلى القائمة. */
    .sidebar-aside {
        position: fixed;
        top: 70px;
        height: calc(100vh - 70px);
        width: 220px;
        z-index: 99;
        transition: var(--transition);
    }

    /* العربية (RTL): القائمة تنزلق من اليمين */
    .dashboard-layout[dir="rtl"] .sidebar-aside {
        right: -240px; /* مخفي خارج الشاشة يميناً */
        left: auto;
        box-shadow: -5px 0 15px rgba(0,0,0,0.05);
    }

    .dashboard-layout[dir="rtl"] .sidebar-aside.open {
        right: 0;
    }

    /* الإنجليزية (LTR): القائمة تنزلق من اليسار */
    .dashboard-layout[dir="ltr"] .sidebar-aside {
        left: -240px; /* مخفي خارج الشاشة يساراً */
        right: auto;
        box-shadow: 5px 0 15px rgba(0,0,0,0.05);
    }

    .dashboard-layout[dir="ltr"] .sidebar-aside.open {
        left: 0;
    }

    /* اسم المنشأة أعلى القائمة الجانبية المنزلقة، قبل قائمة الأيقونات - بدل
       عرضه في منتصف الهيدر العلوي حيث لا تتسع له المساحة على الموبايل */
    .sidebar-org-name {
        display: block;
        padding: 4px 16px 16px;
        margin-bottom: 10px;
        border-bottom: 1px solid var(--border-color);
        font-size: 14px;
        font-weight: 700;
        color: var(--primary-blue);
        text-align: center;
        word-wrap: break-word;
    }

    /* الخلفية المعتمة لإغلاق القائمة بالضغط الخارجي */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 70px;
        left: 0;
        width: 100vw;
        height: calc(100vh - 70px);
        background-color: rgba(0,0,0,0.15);
        z-index: 98;
    }

    .sidebar-overlay.active {
        display: block;
    }
}

/* للهواتف الذكية الصغيرة */
@media (max-width: 550px) {
    /* تصغير اللوجو والبحث لتفادي الازدحام */
    .navbar-center {
        margin: 0 10px;
    }

    .search-box input {
        padding: 8px 10px 8px 30px;
        font-size: 12px;
    }

    .search-icon {
        left: 10px;
        font-size: 14px;
    }

    .username {
        display: none; /* إخفاء اسم المستخدم في شاشات الموبايل الضيقة جداً */
    }
}




/* ==========================================
   6. رأس الصفحة الداخلي (Sub-Header Styling)
   ========================================== */
.content-sub-header {
    display: flex;
    flex-wrap: wrap; /* يمنع تراكب العنوان مع الأزرار (مثال: زر رجوع) على العروض المتوسطة، بدل
                         الاعتماد فقط على استعلام media عند 576px */
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
    padding-bottom: 5px;
}

/* عنوان الصفحة (المالية) */
.page-module-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-blue); /* اللون الأزرق الغامق المعتمد */
}

/* حاوية الأزرار الثلاثة */
.sub-header-actions {
    display: flex;
    gap: 12px; /* مسافة متناسقة بين الأزرار */
}

/* تنسيق الزر الأبيض المشترك (مطابق للصورة بدقة) */
.sub-action-btn {
    background-color: var(--white);
    border: 1px solid #e2e8f0;
    padding: 10px 20px;
    border-radius: 8px; /* حواف دائرية ناعمة */
    color: var(--primary-blue);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px; /* مسافة بين الأيقونة والنص */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03); /* ظل ناعم جداً تحت الزر */
    transition: var(--transition);
}

/* تأثير التمرير (Hover) فوق الأزرار */
.sub-action-btn:hover {
    background-color: var(--active-bg); /* خلفية سماوية خفيفة عند الوقوف بالماوس */
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* حجم أيقونات الأزرار الداخلي */
.sub-action-btn i {
    font-size: 14px;
    color: var(--primary-blue);
}

/* ==========================================
   تجاوب رأس الصفحة مع الأجهزة الصغيرة (Mobile)
   ========================================== */
@media (max-width: 576px) {
    .content-sub-header {
        flex-direction: column; /* ترتيب رأسي بدلاً من أفقي لعدم حدوث تداخل */
        align-items: flex-start;
        gap: 15px;
    }
    
    .sub-header-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap; /* السماح بنزول الأزرار للسطر التالي إذا كانت الشاشة ضيقة جداً */
    }
    
    .sub-action-btn {
        flex: 1; /* جعل الأزرار تتوزع بالتساوي على الموبايل */
        justify-content: center;
        padding: 10px 15px;
    }
}



/* ==========================================
   7. شريط الإجراءات المفضلة (Favorite Actions Bar)
   ========================================== */
.fav-actions-bar {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.01);
}

.fav-right-side {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap; /* تفعيل اللف التلقائي للأزرار على الشاشات الصغيرة */
}

/* عنوان القسم مع النجمة الذهبية */
.fav-title-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.fav-title-label .star-icon {
    color: #f59e0b; /* اللون الذهبي للنجمة */
}

.fav-buttons-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* التنسيق الأساسي للأزرار داخل شريط الإجراءات */
.fav-btn {
    background-color: var(--white);
    border: 1px solid #cbd5e1;
    color: var(--primary-blue);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.fav-btn:hover {
    background-color: #f8fafc;
    border-color: 94a3b8;
}

/* تنسيق زر "التخصيص" (بحدود زرقاء داكنة) */
.btn-outline-blue {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.btn-outline-blue:hover {
    background-color: var(--active-bg);
    border-color: var(--primary-blue);
}

/* تنسيق زر "المزيد" الأزرق الغامق */
.btn-dark-blue {
    background-color: var(--primary-blue);
    color: var(--white);
    border-color: var(--primary-blue);
}

.btn-dark-blue:hover {
    background-color: var(--primary-blue-dark);
    border-color: var(--primary-blue-dark);
}

.chevron-icon {
    font-size: 10px;
}

/* ==========================================
   8. قائمة "المزيد" المنسدلة عند التمرير (Hover Dropdown)
   ========================================== */
.more-dropdown-container {
    position: relative;
}

/* محتوى القائمة المنسدلة */
.more-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0; /* محاذاة لليمين لأن النظام عربي */
    background-color: var(--white);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
    width: 200px;
    padding: 8px 0;
    margin-top: 5px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    z-index: 200;
}

/* تفعيل الظهور عند التمرير بالماوس فوق الأب */
.more-dropdown-container:hover .more-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* عناصر القائمة المنسدلة */
.dropdown-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    text-decoration: none;
    transition: var(--transition);
    text-align: right;
}

.dropdown-menu-item:hover {
    background-color: #f8fafc;
    color: var(--primary-blue);
}

.dropdown-menu-item i {
    font-size: 14px;
    color: var(--primary-blue);
    width: 16px;
    text-align: center;
}

/* ==========================================
   9. تصميم النافذة المنبثقة للتخصيص (Customization Modal)
   ========================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.4); /* تعتيم خلفية الصفحة */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

/* تنشيط الظهور التدريجي */
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background-color: var(--white);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    /* margin-top, NOT transform, drives the slide-in - a `transform` (any value, including
       translateY(0)) makes this box a CSS containing block for `position:fixed` descendants,
       which silently breaks SearchableSelect's dropdown (it computes real viewport coordinates
       via JS and expects `position:fixed` to honor them) - the dropdown ends up positioned
       relative to THIS box instead of the viewport, then gets clipped by the `overflow:hidden`
       below. Found and fixed in ERP first (a modal with a SearchableSelect near the bottom of a
       tall form) - same trap here since this app shares the identical .modal-box/SearchableSelect
       mechanism. */
    margin-top: -20px;
    transition: var(--transition);
    overflow: hidden;
}

.modal-overlay.active .modal-box {
    margin-top: 0;
}

/* Wider variant for modals with a table/grid inside (e.g. Shift Setup's per-day schedule) -
   additive, doesn't change the base .modal-box used everywhere else. Body scrolls internally
   past a viewport-relative height so a 7-row day grid never gets clipped on shorter screens. */
.modal-box-lg {
    max-width: 720px;
}

.modal-box-lg .modal-body {
    max-height: 65vh;
    overflow-y: auto;
}

.shift-week-heading {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 18px 0 10px;
}

/* رأس النافذة المنبثقة */
.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-blue);
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.close-modal-btn:hover {
    color: #ef4444;
}

/* وسط النافذة: الخيارات مع Checkboxes */
.modal-body {
    padding: 20px;
    background-color: #f8fafc;
}

.checkbox-list {
    background-color: var(--white);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: var(--transition);
    gap: 12px;
}

.checkbox-item:last-child {
    border-bottom: none;
}

.checkbox-item:hover {
    background-color: #f8fafc;
}

/* إخفاء الـ Checkbox الافتراضي وتنسيق بديل احترافي ومطابق تماماً */
.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-blue);
    cursor: pointer;
}

.checkbox-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

/* تذييل النافذة المنبثقة */
.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end; /* محاذاة جهة اليمين/البداية */
    gap: 12px;
}

.modal-btn {
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

/* زر الحفظ الأزرق الممتلئ */
.btn-save {
    background-color: var(--primary-blue);
    color: var(--white);
    border: none;
}

.btn-save:hover {
    background-color: var(--primary-blue-dark);
}

/* زر الإلغاء ذو الحدود الرمادية الهادئة */
.btn-cancel {
    background-color: var(--white);
    border: 1px solid #cbd5e1;
    color: var(--text-muted);
}

.btn-cancel:hover {
    background-color: #f1f5f9;
    color: var(--text-dark);
}

/* زر التأكيد الأحمر (حذف/إلغاء) داخل نافذة التأكيد العامة */
.modal-btn.btn-danger {
    background-color: #9c1f3f;
    color: var(--white);
    border: none;
}

.modal-btn.btn-danger:hover {
    background-color: #7a1830;
}

.modal-btn i,
.close-modal-btn i {
    margin-inline-end: 6px;
}

/* نافذة التأكيد العامة (حذف/إلغاء) */
.confirm-dialog-box {
    max-width: 420px;
}

.confirm-dialog-icon {
    color: #9c1f3f;
}

/* Small "?" icon next to a page title, and the header's general help icon - opens HelpModal. */
.help-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex: none;
}

.help-icon-btn:hover {
    background-color: var(--active-bg);
    color: var(--primary-blue);
}

/* Wider modal for prose help content, with a scrollable body so long topics don't push the
   footer/close control off-screen. */
.help-modal-box {
    max-width: 620px;
}

.help-modal-box .modal-body {
    max-height: 62vh;
    overflow-y: auto;
    background-color: var(--white);
    line-height: 1.7;
}

.help-modal-box .modal-body h4 {
    margin: 16px 0 6px;
    color: var(--primary-blue);
    font-size: 15px;
}

.help-modal-box .modal-body h4:first-child {
    margin-top: 0;
}

.help-modal-box .modal-body p {
    margin: 0 0 10px;
    font-size: 14px;
    color: var(--text-dark);
}

.help-modal-box .modal-body ul,
.help-modal-box .modal-body ol {
    margin: 0 0 10px;
    padding-inline-start: 20px;
}

.help-modal-box .modal-body li {
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--text-dark);
}

.help-modal-box .modal-body b {
    color: var(--text-dark);
}

/* Highlighted tip/note box inside a help modal - mirrors the standalone manual's callout style. */
.help-callout {
    border: 1px solid var(--border-color);
    border-inline-start: 3px solid var(--primary-blue);
    background-color: #f8fafc;
    border-radius: 0 8px 8px 0;
    padding: 10px 14px;
    margin: 12px 0;
}

.help-callout .help-callout-label {
    display: block;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--primary-blue);
    margin-bottom: 4px;
}

.help-callout p {
    margin: 0;
}

/* Footer link out to the complete, illustrated manual - always the last thing in a help modal. */
.help-more-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-weight: 600;
    font-size: 13px;
    color: var(--primary-blue);
    text-decoration: none;
}

.help-more-link:hover {
    text-decoration: underline;
}

.confirm-dialog-message {
    margin: 0;
    color: var(--text-dark);
    font-size: 14px;
    line-height: 1.6;
}

/* نافذة تقرير العميل المنبثقة (تفتح من أيقونة العين في بطاقة الموعد) - أوسع من نوافذ
   التأكيد/الحجز العادية لأنها تحتضن جداول تقرير كاملة، مع تمرير رأسي داخلي بدل تمدد
   النافذة خارج الشاشة عند وجود عدد كبير من الفواتير/المواعيد */
.report-modal-box {
    max-width: 900px;
}

.report-modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

.report-modal-body .table-card {
    margin-bottom: 16px;
}

.report-modal-body .table-card:last-child {
    margin-bottom: 0;
}

/* نافذة "تسعير حزمة" - إضافة عدة أصناف بسعر إجمالي متفق عليه بدل السعر الفردي لكل صنف
   (Sales Invoice, زر "تسعير حزمة" أعلى قسم الأصناف) */
.bundle-modal-box {
    max-width: 640px;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

/* يمنع تمدد النافذة خارج الشاشة على الأجهزة القصيرة عند إضافة عدة أصناف - يبقي رأس/تذييل
   النافذة (وزر "إضافة للفاتورة") ظاهرين دائماً، مع تمرير داخلي للمحتوى فقط */
.bundle-modal-box .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.bundle-hint {
    font-size: 12.5px;
    color: var(--text-muted);
    margin: 0 0 16px;
    line-height: 1.6;
}

.bundle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.bundle-row .searchable-select {
    flex: 1 1 auto;
    min-width: 0;
}

.bundle-qty {
    width: 90px;
    flex-shrink: 0;
}

.bundle-orig-price {
    width: 90px;
    flex-shrink: 0;
    text-align: end;
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}

.bundle-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 16px 0;
}

/* ==========================================
   تجاوب شريط الإجراءات والنافذة مع الشاشات الصغيرة
   ========================================== */
@media (max-width: 768px) {
    .fav-actions-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .fav-right-side {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .fav-buttons-group {
        width: 100%;
    }

    .fav-btn {
        flex: 1;
        justify-content: center;
        min-width: 100px;
    }

    .more-dropdown-container {
        width: 100%;
    }

    .more-dropdown-container .fav-btn {
        width: 100%;
    }

    .fav-left-side .fav-btn {
        width: 100%;
        justify-content: center;
    }

    .modal-box {
        width: 90%;
        margin: 0 auto;
    }
}


/* ==========================================
   10. نظام التبويبات والجداول (ERP Tabs & Tables Styling)
   ========================================== */

/* حاوية شريط التبويبات */
.tabs-navigation-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 2px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 25px;
    padding: 0 2px;
}

/* أزرار التبويبات الفردية */
.tab-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    border-radius: 10px 10px 0 0;
    transition: var(--transition);
}

.tab-link-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.7;
    transition: var(--transition);
}

.tab-link-btn:hover {
    color: var(--primary-blue);
    background-color: var(--active-bg);
}

.tab-link-btn:hover svg {
    opacity: 1;
}

/* حالة التبويب النشط (المطابق للصورة بالخط التحتي الأزرق الداكن) */
.tab-link-btn.active {
    color: var(--primary-blue);
    font-weight: 700;
    background-color: var(--active-bg);
}

.tab-link-btn.active svg {
    opacity: 1;
}

.tab-link-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px; /* ينطبق تماماً فوق خط الـ Border الخاص بالحاوية الأب */
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-blue);
    border-radius: 3px;
}

/* ألواح التبويبات (مخفية افتراضياً وتظهر عند إضافة active) */
.tab-content-panel {
    display: none;
}

.tab-content-panel.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   10ب. بطاقات إحصائيات صفحة الموظفين (Employees Grid)
   ========================================== */
.stat-cards-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.stat-card {
    flex: 1 1 220px;
    display: flex;
    align-items: center;
    gap: 14px;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.01);
    padding: 18px 20px;
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    flex-shrink: 0;
}

.stat-card-icon svg {
    width: 22px;
    height: 22px;
}

.stat-card-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.stat-card-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-dark);
}

/* شبكة بطاقات الموظفين - تحل محل جدول "النتائج" السابق، auto-fill يعيد التوزيع تلقائياً حسب
   عرض الشاشة دون الحاجة لاستعلامات media منفصلة لكل نقطة توقف. */
.employee-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    padding: 20px;
}

/* يزيل الخلفية البيضاء/الحدود/الظل عن حاوية "النتائج" (تبقى فقط عنوان الشريط الأزرق) - كل
   بطاقة موظف بها أصلاً خلفية بيضاء وحدود وظل خاص بها، فوضعها داخل بطاقة بيضاء أخرى كان تكراراً
   بصرياً (بطاقة داخل بطاقة) بلا فائدة. */
.employee-results-card {
    background-color: transparent;
    border: none;
    box-shadow: none;
}

.employee-card {
    position: relative;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.01);
    transition: var(--transition);
}

.employee-card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.employee-card-edit-btn {
    position: absolute;
    inset-inline-end: 14px;
    top: 14px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background-color: var(--white);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.employee-card-edit-btn:hover {
    background-color: var(--active-bg);
    color: var(--primary-blue);
    border-color: var(--primary-blue-light);
}

.employee-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding-inline-end: 34px; /* تجنب تراكب اسم الموظف مع زر التعديل العائم */
}

.employee-card-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.employee-card-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-blue);
    color: var(--white);
    font-weight: 700;
    font-size: 16px;
}

.employee-card-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-dark);
    line-height: 1.3;
}

.employee-card-code {
    font-size: 12px;
    color: var(--text-muted);
}

.employee-card-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.badge-pill {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-pill.badge-department {
    background-color: #eef2ff;
    color: #4338ca;
}

.badge-pill.badge-job {
    background-color: var(--active-bg);
    color: var(--primary-blue);
}

.employee-card-meta {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.employee-card-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    gap: 8px;
}

.employee-card-meta-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-weight: 500;
}

.employee-card-meta-label svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.7;
}

.employee-card-meta-value {
    font-weight: 600;
    color: var(--text-dark);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* تنبيه اقتراب انتهاء العقد (أقل من 3 أشهر) - لا يوجد ما يعادله في النظام القديم، إضافة جديدة.
   شارة بخلفية محمرة خفيفة بدل مجرد تلوين النص، لتكون أوضح بصرياً وسط باقي بطاقة الموظف. */
.contract-alert-chip {
    background-color: #fef2f2;
    color: #dc2626 !important;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 12.5px;
}

.contract-alert-chip i {
    font-size: 11px;
}

/* شريط رفيع يوضح نسبة ما مضى من مدة العقد - يتدرج أخضر/كهرماني/أحمر حسب قرب الانتهاء، بنفس
   الحدود الزمنية المستخدمة في تنبيه "أقل من 3 أشهر" أعلاه حتى لا يتعارض المؤشران البصريان. */
.contract-progress-track {
    height: 5px;
    border-radius: 4px;
    background-color: #f1f1f4;
    overflow: hidden;
    margin: 2px 0 4px;
}

.contract-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.status-badge-row {
    display: flex;
    justify-content: center;
    padding-top: 4px;
}

.status-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
}

.status-badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* شاشات الهاتف: 3 بطاقات إحصائيات بجانب بعض بدل التكديس الرأسي، وشبكة موظفين بعمودين بدل عمود
   واحد - كل عنصر يصغر تناسبياً (أيقونات/خطوط/حشوة) حتى يبقى المحتوى مقروءاً بهذه المساحة الأضيق
   بدل تكبيره بلا داعٍ. */
@media (max-width: 768px) {
    .stat-cards-row {
        flex-wrap: nowrap;
        gap: 8px;
    }

    .stat-card {
        flex: 1 1 0;
        min-width: 0; /* يسمح للبطاقة بالانكماش تحت عرض محتواها ضمن صف flex غير ملتف */
        flex-direction: column;
        text-align: center;
        gap: 6px;
        padding: 12px 6px;
    }

    .stat-card-icon {
        width: 34px;
        height: 34px;
    }

    .stat-card-icon svg {
        width: 16px;
        height: 16px;
    }

    .stat-card-label {
        font-size: 10.5px;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .stat-card-value {
        font-size: 17px;
    }

    .employee-cards-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));   /* minmax(0,..): a bare 1fr has an automatic minimum (the card's longest word) and pushed the 2nd column off a 375px screen */
        gap: 10px;
        padding: 12px;
    }

    .employee-card {
        padding: 12px;
    }

    .employee-card-edit-btn {
        width: 24px;
        height: 24px;
        top: 10px;
        inset-inline-end: 10px;
        font-size: 11px;
    }

    .employee-card-top {
        gap: 8px;
        margin-bottom: 10px;
        padding-inline-end: 26px;
    }

    .employee-card-avatar,
    .employee-card-avatar-placeholder {
        width: 38px;
        height: 38px;
        font-size: 13px;
    }

    .employee-card-name {
        font-size: 12.5px;
    }

    .employee-card-code {
        font-size: 10.5px;
    }

    .employee-card-badges {
        gap: 5px;
        margin-bottom: 10px;
    }

    .badge-pill {
        font-size: 10px;
        padding: 3px 8px;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .employee-card-meta {
        gap: 7px;
        padding-top: 10px;
    }

    .employee-card-meta-row {
        font-size: 11px;
        flex-wrap: wrap; /* تتراكب القيمة تحت التسمية تلقائياً فقط عند الحاجة الفعلية للمساحة */
        row-gap: 2px;
    }

    .employee-card-meta-label svg {
        width: 11px;
        height: 11px;
    }

    .contract-alert-chip {
        font-size: 10.5px;
        padding: 2px 7px;
    }

    .status-badge-pill {
        font-size: 11px;
        padding: 5px 12px;
    }
}

/* ==========================================
   11. كروت البيانات والجداول الافتراضية
   ========================================== */
.table-card, .form-card {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.01);
    margin-bottom: 25px;
    overflow: hidden;
}

/* صف يضع بطاقتين (مثال: توزيع الجنسيات وتوزيع الحالات) جنباً إلى جنب بدل تكديسهما رأسياً -
   BreakdownBarChart.razor. تتكدس عمودياً تلقائياً على الشاشات الصغيرة عبر flex-wrap. */
.chart-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.chart-row > .table-card {
    flex: 1 1 320px;
    min-width: 280px;
}

.bar-chart-list {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.bar-chart-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bar-chart-label {
    width: 130px;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-chart-track {
    flex: 1;
    background-color: #f1f1f4;
    border-radius: 6px;
    height: 24px;
    overflow: hidden;
}

.bar-chart-fill {
    height: 100%;
    min-width: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-inline-end: 8px;
    color: var(--white);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    transition: width 0.3s ease;
}

@media (max-width: 768px) {
    .bar-chart-label {
        width: 90px;
    }
}

/* الهيدر الأزرق الموحد للجداول والفورم - تدرج لوني بدل اللون المسطح الواحد، مع شريط جانبي
   برتقالي (لون الهوية الثانوي) يبرز من جهة البداية (يمين/يسار حسب الاتجاه تلقائياً عبر
   inset-inline-start). لا حاجة لتعديل أي صفحة تستخدم هذا الكلاس - كل الـ 30+ استخدام
   الحالي نص عادي بلا أيقونات، فالتحسين هنا في التدرج والظل وليس ببنية جديدة. */
.table-card-header {
    position: relative;
    /* Light bar: the old solid/gradient fill colour is now the bottom border, and the title takes the
       primary colour. */
    background: var(--white);
    color: var(--primary-blue);
    border-bottom: 2px solid var(--primary-blue);
    padding: 15px 20px;
    padding-inline-start: 32px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.table-card-header::before {
    content: "";
    position: absolute;
    inset-inline-start: 10px;
    top: 10px;
    bottom: 10px;
    width: 5px;
    border-radius: 999px;
    background: linear-gradient(180deg, #fdd59a 0%, #fcba66 55%, #f5a63d 100%);
    box-shadow: 0 1px 4px rgba(245, 166, 61, 0.35);
}

/* حاوية الجدول المرنة لمنع تمدد الشاشة على الجوال */
.table-responsive-wrapper {
    width: 100%;
    overflow-x: auto;
}

.erp-custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
}

.erp-custom-table th {
    background-color: #f8fafc;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
    padding: 15px;
    border-bottom: 1px solid #e2e8f0;
}

.erp-custom-table td {
    padding: 15px;
    font-size: 13px;
    color: var(--text-dark);
    border-bottom: 1px solid #f1f5f9;
}

.erp-custom-table tbody tr:hover {
    background-color: #f8fafc;
}

/* الروابط والنصوص المميزة بداخل الجدول */
.table-link-id {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 700;
}

.table-link-id:hover {
    text-decoration: underline;
}

.text-bold {
    font-weight: 700;
}

.text-blue {
    color: #2563eb;
}

/* وسم الحالة الخضراء (نشط) */
.status-badge-green {
    background-color: #f0fdf4;
    color: #16a34a;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 11px;
}

/* نصوص LTR (الأرقام والإنجليزية كالهواتف) */
.ltr-text {
    direction: ltr;
    unicode-bidi: embed;
}

/* أزرار العمليات داخل الجدول */
.table-action-btn-red,
.table-action-btn-gold,
.table-action-btn-blue,
.table-action-btn-green,
.table-action-btn-purple {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    padding: 7px 12px;
    color: var(--white);
    transition: var(--transition);
}

/* لوحة ألوان متدرجة من اللون الأساسي لهوية FutureSystems (خمري/عنابي) بدل الألوان
   المتفرقة السابقة (أزرق/برتقالي/أحمر فاقع) - حتى تبقى أزرار الجدول متناسقة مع الهوية */
.table-action-btn-blue { background-color: var(--primary-blue-light); } /* تحرير: أفتح درجة */
.table-action-btn-blue:hover { background-color: #a8446f; }

.table-action-btn-gold { background-color: var(--primary-blue); } /* متابعة: الدرجة الأساسية */
.table-action-btn-gold:hover { background-color: var(--primary-blue-dark); }

.table-action-btn-red { background-color: #9c1f3f; } /* حذف: أغمق درجة مع ميل أوضح للأحمر للتحذير */
.table-action-btn-red:hover { background-color: #7a1830; }

.table-action-btn-green { background-color: #4d8a63; } /* تأكيد: أخضر مكتوم متناسق مع الهوية */
.table-action-btn-green:hover { background-color: #3c6d4e; }

.table-action-btn-purple { background-color: #6d4d8a; } /* فاتورة جديدة: بنفسجي مكتوم متناسق مع الهوية */
.table-action-btn-purple:hover { background-color: #573c6d; }

.table-action-btn-red:disabled,
.table-action-btn-gold:disabled,
.table-action-btn-blue:disabled,
.table-action-btn-green:disabled,
.table-action-btn-purple:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}


/* ==========================================
   12. تصميم استمارات الإدخال (Forms Styling)
   ========================================== */
.erp-grid-form {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* توزيع حقول الإدخال في صف واحد أفقي - col-3 بمعنى بوتستراب (4 حقول متساوية بالصف) */
.form-inputs-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* تعديل اختياري: شبكة من 12 عمود لصفوف تحتاج نسب أعمدة غير متساوية (مثال: كود الموظف 2
   أعمدة + اسمين 5 أعمدة لكل منهما = 12 كامل العرض). لا يُستخدم إلا صراحة عبر class="cols-12"
   حتى لا يتأثر أي form-inputs-row آخر في باقي الصفحات المعتمدة على التوزيع الافتراضي أعلاه. */
.form-inputs-row.cols-12 {
    grid-template-columns: repeat(12, 1fr);
}

.col-span-2 { grid-column: span 2; }
.col-span-4 { grid-column: span 4; }
.col-span-5 { grid-column: span 5; }

@media (max-width: 768px) {
    .form-inputs-row.cols-12 .col-span-2,
    .form-inputs-row.cols-12 .col-span-4,
    .form-inputs-row.cols-12 .col-span-5 {
        grid-column: span 12; /* عمود واحد كامل العرض على الهواتف، مطابق للصفوف الافتراضية */
    }
}

.form-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-input-group label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dark);
}

.form-input-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background-color: var(--white);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.form-input-group input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 5px rgba(24, 100, 147, 0.15);
}

/* حقل بحث منسدل (SearchableSelect.razor) - يحل محل عناصر <select> العادية في نماذج الموظفين
   ليتيح كتابة نص للبحث ضمن القوائم الطويلة. مطابق لنفس الأسلوب في CRM/wwwroot/css/dashboard.css. */
.searchable-select {
    position: relative;
}

.autocomplete-clear {
    color: var(--text-muted);
    font-style: italic;
}

.autocomplete-empty {
    padding: 8px 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: default;
}

.autocomplete-dropdown {
    /* الموضع (top/left/width) يُضبط عبر JS لكل عنصر (SearchableSelect.razor) باستخدام
       position: fixed عند إحداثيات الحقل الفعلية على الشاشة - القائمة المرتبطة بموضع الحقل عبر
       CSS فقط تنقطع (clipped) إذا كان الحقل داخل حاوية بها overflow، بغض النظر عن z-index. هذا
       الكلاس يحمل فقط المظهر البصري، مع position:absolute كحل احتياطي إذا فشل ضبط JS. */
    position: absolute;
    z-index: 2000;
    max-height: 220px;
    overflow-y: auto;
    background-color: var(--white);
    border: 1px solid #dcdfe6;
    border-radius: 6px;
    margin-top: 4px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.autocomplete-item {
    padding: 8px 12px;
    font-size: 0.88rem;
    cursor: pointer;
}

.autocomplete-item:hover {
    background-color: #f5f5f7;
}

/* الحاوية الأساسية لأزرار الفورم - محاذاة منطقية (logical) تتبع اتجاه اللغة تلقائياً:
   نهاية السطر (يمين في الإنجليزية LTR، يسار في العربية RTL) بدل موضع فعلي ثابت. */
/* هذا العنصر flex نفسه صندوق كامل العرض داخل بطاقته (display:flex بدون inline يمتد افتراضياً
   ليملأ عرض الحاوية الأب بالكامل) - margin-inline-start:auto على الصندوق نفسه لا قيمة له لأنه
   لا مساحة حرة لدفعه بعيداً. المحاذاة الفعلية تأتي من justify-content: flex-end، الذي يتبع
   dir تلقائياً في محور flex الأفقي (نهاية السطر: يمين في LTR الإنجليزية، يسار في RTL العربية)
   دون الحاجة لقاعدة منفصلة لكل اتجاه. */
.form-actions-left {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* زر "رجوع" أعلى الصفحة بجانب عنوان الصفحة داخل .content-sub-header (تعريفها الأصلي أعلى
   الملف) - نفس منطق المحاذاة أعلاه: نهاية السطر (يمين LTR / يسار RTL) تلقائياً. */
.content-sub-header .header-back-btn {
    margin-inline-start: auto;
}

/* أزرار الفورم */
.erp-form-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    color: var(--white);
    transition: var(--transition);
    /* Clear default for every bare .erp-form-btn (no variant class): a solid brand fill, never an unstyled/faded button. */
    background-color: var(--primary-blue);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.erp-form-btn:not(.btn-dark-blue):not(.btn-coral):not(.btn-green):not(.btn-blue):not(.btn-outline):not(.btn-outline-danger):hover {
    background-color: var(--primary-blue-dark);
}
.erp-form-btn:disabled { opacity: .55; cursor: not-allowed; }

.erp-form-btn.btn-dark-blue {
    background-color: var(--primary-blue);
}
.erp-form-btn.btn-dark-blue:hover {
    background-color: var(--primary-blue-dark);
}

.erp-form-btn.btn-coral {
    background-color: var(--primary-blue); /* الحفظ: اللون الأساسي لهوية الشركة بدل المرجان الغريب عن الهوية */
}
.erp-form-btn.btn-coral:hover {
    background-color: var(--primary-blue-dark);
}

.erp-form-btn.btn-green {
    background-color: #4d8a63; /* تأكيد: أخضر مكتوم متناسق مع الهوية، بدل الأخضر الفاقع */
}
.erp-form-btn.btn-green:hover {
    background-color: #3c6d4e;
}

.erp-form-btn.btn-blue {
    background-color: #2563eb;
}
.erp-form-btn.btn-blue:hover {
    background-color: #1d4ed8;
}

/* زر ثانوي بحدود رمادية (إلغاء/رجوع) */
.erp-form-btn.btn-outline {
    background-color: var(--white);
    border: 1px solid #cbd5e1;
    color: var(--text-muted);
}
.erp-form-btn.btn-outline:hover {
    background-color: #f1f5f9;
    color: var(--text-dark);
}

/* زر ثانوي بحدود حمراء لإجراءات الإلغاء الفعلية (مثل إلغاء الفاتورة) - يميزه عن أزرار
   التنقل البسيطة (رجوع/تراجع) التي تستخدم .btn-outline العادي */
.erp-form-btn.btn-outline-danger {
    background-color: var(--white);
    border: 1px solid #9c1f3f;
    color: #9c1f3f;
}
.erp-form-btn.btn-outline-danger:hover {
    background-color: #9c1f3f;
    color: var(--white);
}

.erp-form-btn:disabled,
.modal-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 16px;
}

.pagination-info {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

/* تباعد الأيقونات داخل الأزرار */
.erp-form-btn i,
.modal-btn i,
.login-submit-btn i,
.table-action-btn-red i,
.table-action-btn-gold i,
.table-action-btn-blue i,
.table-action-btn-green i,
.table-action-btn-purple i {
    margin-inline-end: 6px;
}


/* ==========================================
   التجاوب مع شاشات الموبايل
   ========================================== */
@media (max-width: 768px) {
    .tabs-navigation-bar {
        flex-wrap: wrap; /* تلتف التبويبات على أسطر متعددة بدل التمرير الأفقي على الموبايل */
        gap: 2px;
    }

    .tab-link-btn {
        padding: 9px 12px;
        font-size: 13px;
        gap: 6px;
    }

    .tab-link-btn svg {
        width: 15px;
        height: 15px;
    }

    .form-inputs-row {
        grid-template-columns: 1fr; /* جعل حقول الإدخال تحت بعضها على الهواتف */
        gap: 15px;
    }
    
    .form-actions-left {
        width: 100%;
        margin-inline-start: 0;
        justify-content: space-between; /* تمدد متوازن للأزرار على الموبايل */
    }

    /* مقصور على أزرار صف .form-actions-left فقط (حفظ/رجوع/إلغاء تفعيل) - لو ترك بدون تحديد
       .form-actions-left كان يمدد أي .erp-form-btn آخر على الصفحة أيضاً، مثل زر الرجوع أعلى
       الصفحة (.header-back-btn) الذي يجب أن يبقى بحجم محتواه الطبيعي. */
    .form-actions-left .erp-form-btn {
        flex: 1;
        text-align: center;
    }
}




/* ==========================================
   13. تنسيق الهيدر الداخلي والتبويبات الفرعية (Inner Pages Styling)
   ========================================== */

/* كارد هيدر الصفحات الفرعية */
.inner-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

/* زر العودة مع اسم القسم والسهم الموجه */
.back-navigation-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-dark);
    font-size: 20px;
    font-weight: 700;
    transition: var(--transition);
}

.back-navigation-link i {
    font-size: 18px;
    color: var(--text-muted);
    transition: var(--transition);
}

/* حركة بسيطة واحترافية للسهم عند تمرير الماوس */
.back-navigation-link:hover i {
    transform: translateX(4px); /* دفع السهم لليمين لإيحاء العودة للخلف */
    color: var(--primary-blue);
}

.back-navigation-link:hover span {
    color: var(--primary-blue);
}

/* أزرار الإجراءات جهة اليسار للهيدر الداخلي */
.inner-header-actions {
    display: flex;
    gap: 12px;
}

/* حاوية التبويبات الداخلية المطابقة للصورة الجديدة */
.inner-tabs-container {
    display: flex;
    gap: 20px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 25px;
    padding-right: 5px;
}

/* أزرار التبويبات الفرعية (عنوان الاجراء) */
.inner-tab-link {
    background: none;
    border: none;
    padding: 12px 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.inner-tab-link:hover {
    color: var(--primary-blue);
}

/* الحالة النشطة للتبويب الفرعي بالخط التحتي المتناسق */
.inner-tab-link.active {
    color: var(--primary-blue);
    font-weight: 700;
}

.inner-tab-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px; /* لتنطبق مباشرة فوق خط حاوية الأب */
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-blue);
    border-radius: 3px;
}

/* ألواح محتويات التبويبات الفرعية */
.inner-tab-panel {
    display: none;
}

.inner-tab-panel.active {
    display: block;
    animation: fadeInInner 0.25s ease-in-out;
}

@keyframes fadeInInner {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   التجاوب للهواتف والشاشات الصغيرة
   ========================================== */
@media (max-width: 768px) {
    .inner-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .inner-header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .inner-header-actions .sub-action-btn {
        flex: 1;
        justify-content: center;
    }

    .inner-tabs-container {
        overflow-x: auto; /* تفعيل التمرير الأفقي للأزرار لتجنب حدوث أي أخطاء أو تداخل في الموبايل */
        white-space: nowrap;
        gap: 10px;
    }
}

/* ==========================================
   14. أيقونات SVG داخل الشريط الجانبي وشريط التنقل العلوي
   (المشروع لا يحتوي على مكتبة أيقونات خطية، لذا تُستخدم SVG مضمّنة
   بلون currentColor لتتوافق تلقائياً مع حالات hover/active الحالية)
   ========================================== */
.item-icon-box svg {
    width: 18px;
    height: 18px;
    color: #64748b;
    transition: var(--transition);
}

.sidebar-item:hover .item-icon-box svg,
.sidebar-item.active .item-icon-box svg {
    color: var(--active-icon-color);
}

.nav-icon-btn svg {
    width: 18px;
    height: 18px;
}

.dropdown-item svg {
    width: 16px;
    height: 16px;
    color: #64748b;
}

.logout-item svg {
    color: #f87171 !important;
}

.sidebar-brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 6px rgba(24, 100, 147, 0.25);
}

/* زر تبديل اللغة داخل شريط التنقل العلوي */
.lang-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--body-bg);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dark);
    cursor: pointer;
    transition: var(--transition);
}

.lang-toggle-btn:hover {
    background-color: var(--active-bg);
    border-color: var(--primary-blue-light);
    color: var(--primary-blue);
}

.lang-toggle-btn svg {
    width: 16px;
    height: 16px;
}

/* شارة الأحرف الأولى كبديل لصورة أفاتار غير متوفرة */
.avatar-initials {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-light));
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

/* ==========================================
   15. صفحة تسجيل الدخول (Login Page)
   ========================================== */
.login-page {
    min-height: 100vh;
    width: 100%;
    display: flex;
    background-color: var(--white);
    overflow: hidden;
}

.login-visual-pane {
    flex: 1 1 45%;
    max-width: 560px;
    background: radial-gradient(circle at 20% 20%, var(--primary-blue-light) 0%, transparent 45%),
                linear-gradient(150deg, var(--primary-blue-dark) 0%, var(--primary-blue) 60%, var(--primary-blue-light) 130%);
    color: var(--white);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 48px 40px;
    text-align: center;
    gap: 32px;
}

.login-logo-badge {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    padding: 12px;
}

.login-logo-badge img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.login-brand-title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0.3px;
}

.login-brand-tagline {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    max-width: 360px;
    line-height: 1.7;
}

.login-module-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    width: 100%;
    max-width: 420px;
}

.login-module-card {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    padding: 14px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(2px);
    transition: var(--transition);
}

.login-module-card:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.login-module-card svg {
    width: 22px;
    height: 22px;
}

.login-module-card span {
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
}

.login-form-pane {
    flex: 1 1 55%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    position: relative;
}

.login-lang-switch {
    position: absolute;
    top: 28px;
    inset-inline-end: 32px;
}

.login-form-card {
    width: 100%;
    max-width: 400px;
}

.login-form-header {
    margin-bottom: 32px;
}

.login-form-header h1 {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.login-form-header p {
    font-size: 14px;
    color: var(--text-muted);
}

.login-input-group {
    margin-bottom: 20px;
}

.login-input-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.login-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input-wrapper svg {
    position: absolute;
    inset-inline-start: 16px;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.login-input-wrapper input {
    width: 100%;
    padding: 13px 16px 13px 44px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background-color: #fafafa;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

[dir="rtl"] .login-input-wrapper svg {
    inset-inline-start: auto;
    inset-inline-end: 16px;
}

[dir="rtl"] .login-input-wrapper input {
    padding: 13px 44px 13px 16px;
}

.login-input-wrapper input:focus {
    border-color: var(--primary-blue);
    background-color: var(--white);
    box-shadow: 0 0 0 3px rgba(24, 100, 147, 0.1);
}

.login-input-wrapper .toggle-visibility-btn {
    position: absolute;
    inset-inline-end: 14px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
}

[dir="rtl"] .login-input-wrapper .toggle-visibility-btn {
    inset-inline-end: auto;
    inset-inline-start: 14px;
}

.login-remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.login-remember-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-dark);
    cursor: pointer;
}

.login-remember-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-blue);
    cursor: pointer;
}

.login-submit-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-dark));
    color: var(--white);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 8px 20px rgba(24, 100, 147, 0.25);
}

.login-submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(24, 100, 147, 0.32);
}

.login-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.login-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 20px;
}

.login-alert.success {
    background-color: #f0fdf4;
    color: #16a34a;
}

.login-alert.error {
    background-color: #fef2f2;
    color: #dc2626;
}

.login-footer-note {
    margin-top: 28px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* ==========================================
   16. Customer Session Appointments calendar (حجز المواعيد)
   Ported from the legacy screen's own <style> block, re-themed onto
   the shared design tokens above instead of hardcoded colors.
   ========================================== */
.calendar-table {
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0 4px;
}

.calendar-table th {
    white-space: nowrap;
    background-color: var(--primary-blue);
    color: #fff;
    font-size: 0.85rem;
    padding: 8px 6px;
}

.calendar-table .time-header {
    background-color: #f1f5f9;
    font-weight: 700;
    color: var(--text-dark);
    width: 78px;
    white-space: nowrap;
    font-size: 0.8rem;
}

.calendar-table td {
    vertical-align: middle !important;
    padding: 4px 6px !important;
}

.slot-available {
    background-color: var(--white);
    text-align: center;
}

.slot-booked {
    background-color: #fdecec !important;
    border: 1px solid #f3b6b6 !important;
    border-radius: 6px;
    padding: 6px 6px !important;
}

.slot-attend {
    background-color: #eafaf0 !important;
    border: 1px solid #9ee6b8 !important;
    border-radius: 6px;
    padding: 6px 6px !important;
}

.slot-notattend {
    background-color: #fff3e6 !important;
    border: 1px solid #f6c78f !important;
    border-radius: 6px;
    padding: 6px 6px !important;
}

.appointment-card {
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-align: center;
}

.patient-name {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 0.82rem;
    line-height: 1.2;
}

.patient-name-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* أيقونة صغيرة داخل بطاقة الموعد (عين تقرير العميل) - لا تأخذ نفس تنسيق أزرار
   حضور/لم يحضر/إلغاء الملونة، فقط أيقونة رمادية خفيفة بجانب اسم العميل */
.card-icon-btn {
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.72rem;
    line-height: 1;
    padding: 2px 3px;
    border-radius: 3px;
    transition: var(--transition);
}

.card-icon-btn:hover {
    color: var(--primary-blue);
    background-color: var(--border-color);
}

.appointment-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
}

.service-name {
    display: inline-block;
    background-color: var(--primary-blue);
    color: #fff;
    font-size: 0.68rem;
    line-height: 1.3;
    padding: 1px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.mobile-number {
    display: inline-block;
    background-color: #64748b;
    color: #fff;
    font-size: 0.68rem;
    line-height: 1.3;
    padding: 1px 8px;
    border-radius: 10px;
}

/* شارات تنبيه بطاقة الموعد: المبلغ المتبقي على العميل وعدد الجلسات المتبقية لهذه الخدمة */
.appointment-alerts {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
}

.alert-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.65rem;
    line-height: 1.3;
    padding: 1px 7px;
    border-radius: 10px;
    color: #fff;
    white-space: nowrap;
}

.alert-badge.alert-balance { background-color: #b45309; }
.alert-badge.alert-info { background-color: #0d9488; }
.alert-badge.alert-danger { background-color: #9c1f3f; }

.appointment-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 3px;
    justify-content: center;
    margin-top: 2px;
}

.appointment-actions button {
    font-size: 0.65rem;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 4px;
    border: none;
    color: #fff;
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition);
}

.appointment-actions .table-action-btn-blue { background-color: #16a34a; }
.appointment-actions .table-action-btn-blue:hover { background-color: #15803d; }
.appointment-actions .table-action-btn-blue.active { outline: 2px solid #14532d; }

.appointment-actions .table-action-btn-gold { background-color: #f59e0b; }
.appointment-actions .table-action-btn-gold:hover { background-color: #d97706; }
.appointment-actions .table-action-btn-gold.active { outline: 2px solid #92400e; }

.appointment-actions .table-action-btn-red { background-color: #dc2626; }
.appointment-actions .table-action-btn-red:hover { background-color: #b91c1c; }

.appointment-actions button i {
    margin-inline-end: 3px;
    font-size: 0.7em;
}

.btn-book-appointment {
    font-size: 0.78rem;
    padding: 8px 14px;
    white-space: nowrap;
    background-color: transparent;
    border: 1.5px solid #0d9488;
    color: #0d9488;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-book-appointment:hover {
    background-color: #0d9488;
    color: #fff;
}

.btn-book-appointment i {
    margin-inline-end: 4px;
}

/* ==========================================
   17. Global toasts & loading overlay
   Mounted once in App.razor (outside the router, so they cover every
   layout including the login screen) and driven by ToastBus/LoadingBus,
   which BaseViewModel.ShowMessage/ShowProgress broadcast into. Replaces
   the old per-page alert/spinner blocks that could go stale across
   navigation, since Blazor WASM ViewModels live for the whole app session.
   ========================================== */
.toast-stack {
    position: fixed;
    top: 20px;
    inset-inline-end: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
}

.toast-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
    animation: toast-slide-in 0.25s ease-out;
}

.toast-success {
    background-color: #16a34a;
}

.toast-error {
    background-color: #dc2626;
}

.toast-close {
    background: none;
    border: none;
    color: #fff;
    opacity: 0.8;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.toast-close:hover {
    opacity: 1;
}

@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.customer-combobox,
.searchable-select {
    position: relative;
}

.autocomplete-clear {
    color: var(--text-muted);
    font-style: italic;
}

.autocomplete-empty {
    padding: 8px 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: default;
}

.autocomplete-dropdown {
    /* Position (top/left/width) is set inline per-instance via JS (SearchableSelect.razor),
       using `position: fixed` at the input's actual screen coordinates - a dropdown positioned
       relative to its input gets clipped whenever the input sits inside a scrollable container
       (e.g. the Sales Invoice items table), no matter its z-index. This class only carries the
       visual styling, plus a position:absolute fallback for the rare case the JS positioning
       call fails (see the catch block in SearchableSelect.razor). */
    position: absolute;
    z-index: 2000;
    max-height: 220px;
    overflow-y: auto;
    background-color: var(--white);
    border: 1px solid #dcdfe6;
    border-radius: 6px;
    margin-top: 4px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.autocomplete-item {
    padding: 8px 12px;
    font-size: 0.88rem;
    cursor: pointer;
}

.autocomplete-item:hover {
    background-color: #f5f5f7;
}

/* ==========================================================================
   Global loading indicator (LoadingOverlay.razor) - modern branded spinner
   ========================================================================== */
.app-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1900;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background: rgba(248, 250, 252, 0.72);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    animation: app-fade-in 0.2s ease;
}

/* Full-screen boot loader (index.html, before Blazor starts) */
.app-boot {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background: var(--body-bg);
}

.app-loader { position: relative; width: 84px; height: 84px; }

/* Gradient arc that spins, cut into a ring via a radial mask */
.app-loader-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 90deg, var(--primary-blue), var(--primary-blue-light) 55%, rgba(0, 0, 0, 0) 92%);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
            mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
    animation: app-spin 0.9s linear infinite;
}

.app-loader-logo {
    position: absolute;
    inset: 20px;
    width: 44px;
    height: 44px;
    object-fit: contain;
    animation: app-pulse 1.5s ease-in-out infinite;
}

.app-loader-text {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .3px;
    color: var(--primary-blue);
}

@keyframes app-spin { to { transform: rotate(360deg); } }
@keyframes app-pulse { 0%, 100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.09); opacity: 1; } }
@keyframes app-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ==========================================================================
   Modern content skeleton (SkeletonLoader.razor) - shimmering placeholders
   for a screen's own loading state.
   ========================================================================== */
.skeleton-wrap { width: 100%; }

.sk {
    position: relative;
    overflow: hidden;
    background: #e6ebf1;
    border-radius: 8px;
}
.sk::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85) 50%, transparent);
    animation: sk-shimmer 1.35s ease-in-out infinite;
}
[dir="rtl"] .sk::after { transform: translateX(100%); animation-name: sk-shimmer-rtl; }
@keyframes sk-shimmer { 100% { transform: translateX(100%); } }
@keyframes sk-shimmer-rtl { 100% { transform: translateX(-100%); } }

.sk-line { height: 13px; }
.sk-dot { width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto; }
.sk-avatar { width: 54px; height: 54px; border-radius: 14px; flex: 0 0 auto; }
.sk-input { height: 40px; border-radius: 10px; }

/* cards */
.sk-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.sk-card {
    display: flex; gap: 16px; padding: 20px;
    background: var(--white); border: 1px solid var(--border-color); border-radius: 16px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .05);
}
.sk-card-body { flex: 1; display: flex; flex-direction: column; gap: 11px; padding-top: 4px; }

/* table */
.sk-table {
    background: var(--white); border: 1px solid var(--border-color);
    border-radius: 14px; overflow: hidden;
}
.sk-table-head, .sk-table-row {
    display: flex; gap: 18px; padding: 15px 18px; align-items: center;
}
.sk-table-head { background: var(--body-bg); }
.sk-table-row { border-top: 1px solid var(--border-color); }
.sk-table-head > .sk, .sk-table-row > .sk { flex: 1 1 0; min-width: 0; }

/* list */
.sk-list { display: flex; flex-direction: column; gap: 15px; }
.sk-list-row { display: flex; align-items: center; gap: 14px; }

/* form */
.sk-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }
.sk-field { display: flex; flex-direction: column; gap: 8px; }

@media (max-width: 768px) {
    .sk-form { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .login-visual-pane {
        display: none;
    }

    .login-form-pane {
        flex: 1 1 100%;
    }
}

/* ==========================================
   21. لوحة التحكم الرئيسية (Home Dashboard)
   ========================================== */
.dashboard-cards-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.dash-card {
    flex: 1 1 220px;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.dash-card-icon {
    width: 52px;
    height: 52px;
    min-width: 52px;
    border-radius: 12px;
    background-color: var(--active-bg);
    color: var(--primary-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.dash-card-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary-blue);
    line-height: 1.2;
}

.dash-card-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.dash-chart-wrapper {
    padding: 20px;
    overflow-x: auto;
}

.dash-chart-svg {
    width: 100%;
    max-width: 720px;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* دونات نسبة الحالات (تقرير المواعيد) */
.donut-chart-wrapper {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.donut-chart-svg {
    width: 220px;
    height: 220px;
    flex-shrink: 0;
}

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 180px;
}

.donut-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-dark);
}

.donut-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.donut-legend-label {
    font-weight: 600;
}

.donut-legend-value {
    margin-inline-start: auto;
    color: var(--text-muted);
    white-space: nowrap;
}

@media (max-width: 768px) {
    .dashboard-cards-row {
        flex-direction: column;
    }
}

/* شبكة رسوم لوحة التحكم البيانية - عمودان بالصف بدل التكديس الرأسي الكامل */
.dashboard-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.dashboard-charts-grid .table-card {
    margin-bottom: 0;
}

@media (max-width: 900px) {
    .dashboard-charts-grid {
        grid-template-columns: 1fr;
    }
}

/* شارات الحالة الصغيرة (حالة المواعيد وغيرها) */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: var(--white);
    white-space: nowrap;
}

.status-badge.status-green { background-color: #4d8a63; }
.status-badge.status-gold { background-color: #f59e0b; }
.status-badge.status-red { background-color: #9c1f3f; }
.status-badge.status-gray { background-color: #94a3b8; }


/* ==========================================
   16. تصميم فاتورة المبيعات بطراز نقاط البيع (POS)
   عمودان: سلة أصناف/بيانات على اليسار + لوحة ملخص والدفع الثابتة (sticky) على اليمين،
   بنفس ألوان وهوية FutureSystems الحالية بدل الجداول التقليدية.
   ========================================== */
.pos-invoice-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.pos-invoice-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-dark);
}

.pos-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    align-items: start;
    gap: 20px;
}

.pos-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.pos-summary {
    position: sticky;
    top: 20px;
}

/* صف حقول مرن يتقلص تلقائياً حسب المساحة بدل تثبيت 4 أعمدة دائماً */
.pos-fields-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    padding: 20px;
}

.pos-fields-row + .pos-fields-row {
    padding-top: 0;
}

/* سلة الأصناف */
.pos-cart-list {
    display: flex;
    flex-direction: column;
}

.pos-cart-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.pos-cart-item:last-child {
    border-bottom: none;
}

.pos-cart-item-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.pos-cart-item-top .searchable-select {
    flex: 1 1 220px;
    min-width: 0;
}

.pos-cart-item-total {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-blue);
    white-space: nowrap;
}

.pos-cart-item-remove {
    border: none;
    background: none;
    color: #9c1f3f;
    font-size: 15px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    transition: var(--transition);
}

.pos-cart-item-remove:hover {
    background-color: #fef2f2;
}

.pos-cart-item-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
}

.pos-cart-item-details .form-input-group label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

/* عداد الكمية على طراز نقاط البيع (+ / -) بدل حقل رقمي عادي فقط */
.pos-qty-stepper {
    display: flex;
    align-items: center;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    overflow: hidden;
    height: 42px;
}

.pos-qty-stepper button {
    width: 34px;
    height: 100%;
    flex-shrink: 0;
    border: none;
    background-color: #f8fafc;
    color: var(--primary-blue);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.pos-qty-stepper button:hover {
    background-color: var(--border-color);
}

.pos-qty-stepper button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.pos-qty-stepper input {
    flex: 1;
    min-width: 0;
    border: none;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    width: 100%;
    outline: none;
    background: transparent;
    color: var(--text-dark);
}

.pos-empty-cart {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.pos-empty-cart i {
    font-size: 28px;
    display: block;
    margin-bottom: 10px;
    opacity: .5;
}

.pos-add-item-btn {
    width: 100%;
    padding: 14px;
    border: 2px dashed #cbd5e1;
    background-color: #fafbfc;
    color: var(--primary-blue);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
}

.pos-add-item-btn:hover {
    background-color: var(--border-color);
    border-color: var(--primary-blue-light);
}

/* لوحة الملخص والدفع الثابتة */
.pos-summary-card {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .03);
    overflow: hidden;
}

.pos-summary-rows {
    padding: 16px 20px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pos-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
}

.pos-summary-row span:last-child {
    color: var(--text-dark);
    font-weight: 600;
}

.pos-summary-row span:last-child.negative {
    color: #9c1f3f;
}

/* الإجمالي الكبير المميز أسفل الفاتورة - أبرز عنصر باللوحة، بمثابة "الشاشة" في نقاط البيع */
.pos-summary-total {
    margin: 16px 20px;
    padding: 16px;
    background-color: #fdf2f6;
    border-radius: 8px;
    text-align: center;
}

.pos-summary-total .label {
    font-size: 12px;
    color: var(--primary-blue-dark);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.pos-summary-total .value {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary-blue);
    margin-top: 4px;
}

.pos-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 4px 20px;
}

.pos-payments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dark);
}

.pos-payment-row {
    padding: 10px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pos-payment-row:first-of-type {
    border-top: none;
}

.pos-payment-row-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pos-payment-row-line .searchable-select,
.pos-payment-row-line input {
    flex: 1;
    min-width: 0;
}

.pos-add-payment-btn {
    margin: 4px 20px 12px;
    padding: 10px;
    border: 1px dashed #cbd5e1;
    background-color: #fafbfc;
    color: var(--primary-blue);
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    border-radius: 6px;
    width: calc(100% - 40px);
    transition: var(--transition);
}

.pos-add-payment-btn:hover {
    background-color: var(--border-color);
}

.pos-paid-remaining {
    padding: 0 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pos-actions {
    padding: 16px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pos-btn-save {
    width: 100%;
    padding: 15px;
    font-size: 15px;
    border-radius: 8px;
}

.pos-actions-secondary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pos-actions-secondary .erp-form-btn {
    flex: 1;
    min-width: 80px;
    padding: 9px 10px;
    font-size: 12px;
    text-align: center;
}

@media (max-width: 992px) {
    .pos-layout {
        grid-template-columns: 1fr;
    }

    .pos-summary {
        position: static;
    }
}

/* ===== "My Dashboard" (HR landing page) - profile / attendance / leave summary ===== */

.my-dashboard-top-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(300px, 1.15fr);
    gap: 22px;
    margin-bottom: 22px;
    align-items: stretch;
}

@media (max-width: 900px) {
    .my-dashboard-top-grid {
        grid-template-columns: 1fr;
    }
}

/* 4 small stat cards - a dedicated flex row (not sharing a grid row with a tall neighbor) so
   each card sizes to its own content instead of stretching into a big, mostly-empty box. */
.my-dashboard-stats-row {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.my-dashboard-stats-row .stat-card {
    flex: 1 1 220px;
}

.my-dashboard-leave-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(300px, 1.1fr);
    gap: 22px;
    margin-bottom: 22px;
    align-items: stretch;
}

@media (max-width: 900px) {
    .my-dashboard-leave-grid {
        grid-template-columns: 1fr;
    }
}

.dashboard-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.dashboard-card-heading .card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
}

.year-picker-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    background-color: var(--border-color);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dark);
}

/* Profile card - dark header block + lighter details panel below, per the dashboard mockup. */
.profile-card {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.01);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.profile-card-header {
    background: linear-gradient(160deg, var(--primary-blue-dark), var(--primary-blue));
    color: var(--white);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
}

.profile-card-avatar-wrap {
    position: relative;
    width: 76px;
    height: 76px;
}

.profile-card-avatar {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.35);
}

.profile-card-avatar-placeholder {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.35);
    background-color: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: var(--white);
}

.profile-card-online-dot {
    position: absolute;
    bottom: 4px;
    inset-inline-end: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #22c55e;
    border: 2px solid var(--primary-blue-dark);
}

.profile-card-name {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
}

.profile-card-subtitle {
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.75);
}

.profile-card-details {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.profile-detail-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.profile-detail-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background-color: var(--border-color);
    color: var(--primary-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-detail-icon svg {
    width: 15px;
    height: 15px;
}

.profile-detail-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.profile-detail-value {
    font-size: 13.5px;
    color: var(--text-dark);
    font-weight: 600;
    word-break: break-word;
}

/* The two "Leave Details" cards on the dashboard (donut + stats) supply their own padding here,
   since the base .table-card is intentionally unpadded (table/list usages provide their own via
   .table-card-header etc.) - a little extra at the bottom so the last row of content isn't flush
   against the card edge. */
.leave-detail-card {
    padding: 20px 20px 26px;
}

/* Leave Details stats grid (2x3) - each stat is its own soft tile with a colored icon, matching
   the icon-card language already used by the dashboard's 4 hour-summary cards, instead of bare
   numbers floating on the card background. */
.leave-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 14px;
}

.leave-stat-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    background-color: #f8fafc;
}

.leave-stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    flex-shrink: 0;
}

.leave-stat-icon svg {
    width: 17px;
    height: 17px;
}

.leave-stat-cell .leave-stat-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.2;
}

.leave-stat-cell .leave-stat-label {
    font-size: 11.5px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Punch-clock card - orange accent border + light peach background distinguishes it from every
   other card on the page, per the mockup. */
.punch-card {
    background-color: #fff8f0;
    border: 1.5px solid var(--accent-orange);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.01);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.punch-card-timestamp {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    text-align: center;
}

.punch-ring-wrapper {
    position: relative;
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.punch-ring-svg {
    width: 160px;
    height: 160px;
}

.punch-ring-center {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.punch-ring-value {
    font-size: 19px;
    font-weight: 800;
    color: var(--text-dark);
}

.punch-ring-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.punch-production-pill {
    padding: 6px 16px;
    border-radius: 20px;
    background-color: rgba(252, 186, 102, 0.25);
    color: #b45309;
    font-size: 12.5px;
    font-weight: 700;
}

.punch-status-text {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.punch-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background-color: var(--accent-orange);
    color: #7c2d12;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.15s ease;
}

.punch-btn:hover:not(:disabled) {
    filter: brightness(0.95);
}

.punch-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.punch-btn.punch-btn-out {
    background-color: var(--primary-blue);
    color: var(--white);
}

/* 4 small stat cards row - reuses .stat-card/.stat-cards-row, adds a trend indicator */
.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 700;
    margin-top: 4px;
}

.stat-trend.trend-up {
    color: #16a34a;
}

.stat-trend.trend-down {
    color: #dc2626;
}

/* Bottom summary/timeline bar */
.summary-legend-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 16px;
}

.summary-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-dark);
}

.summary-legend-item strong {
    font-weight: 700;
}

.summary-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.timeline-bar-track {
    position: relative;
    height: 26px;
    background-color: var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.timeline-bar-segment {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 4px;
}

.timeline-bar-axis {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 10.5px;
    color: var(--text-muted);
}

/* ===================== Departments — organizational structure (org chart) ===================== */
/* Classic pure-CSS tree: each level is a <ul>, each department a <li> with connector lines drawn
   via ::before/::after instead of an image/JS library - same "no external dependency" approach
   as DonutChart/BreakdownBarChart elsewhere in this file. */
.org-chart-wrap {
    overflow-x: auto;
    padding: 24px 12px 8px;
}

.org-chart, .org-chart ul {
    list-style: none;
    margin: 0;
    padding: 40px 0 0;
    display: flex;
    justify-content: center;
}

.org-chart {
    padding-top: 0;
}

.org-chart li {
    position: relative;
    padding: 40px 14px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.org-chart li::before,
.org-chart li::after {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    width: 50%;
    height: 40px;
    border-top: 2px solid var(--border-color);
}

.org-chart li::after {
    right: auto;
    left: 50%;
    border-left: 2px solid var(--border-color);
}

.org-chart li:only-child {
    padding-top: 0;
}

.org-chart li:only-child::before,
.org-chart li:only-child::after {
    display: none;
}

.org-chart li:first-child::before,
.org-chart li:last-child::after {
    border: 0 none;
}

.org-chart li:last-child::before {
    border-right: 2px solid var(--border-color);
    border-radius: 0 6px 0 0;
}

.org-chart li:first-child::after {
    border-radius: 6px 0 0 0;
}

.org-chart > li {
    padding-top: 0;
}

.org-chart > li::before,
.org-chart > li::after {
    display: none;
}

.org-chart ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid var(--border-color);
    width: 0;
    height: 40px;
}

.org-chart-card {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 170px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--primary-blue);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.org-chart-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
}

.org-chart-card-manager {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text-muted);
}

.org-chart-card-manager i {
    color: var(--accent-orange);
    font-size: 10px;
}

.org-chart-card-manager-empty {
    font-style: italic;
    opacity: 0.75;
}

.org-chart-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-color);
}

.org-chart-card-actions {
    display: flex;
    gap: 4px;
}

.org-chart-card-actions button {
    width: 24px;
    height: 24px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    border-radius: 6px;
}

.org-chart-collapse-btn {
    background: var(--white);
    border: 1px solid var(--border-color);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--primary-blue);
    cursor: pointer;
    margin-top: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* "People" org chart (/org-chart, PeopleOrgChartNode.razor) - reuses the ".org-chart"/".org-chart-card"
   connector-tree rules above as-is; only the card's own inner content needs new, narrowly-scoped rules. */
.people-org-card { padding-top: 14px; }

.people-org-card-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.people-org-card-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-blue);
    color: var(--white);
    font-weight: 700;
    font-size: 14px;
}

.people-org-card-position {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: -2px;
}

/* ===================== Employee Definition — "Position in the Organization" panel ===================== */
.org-position-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    padding: 16px 20px;
}

.org-position-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.org-position-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.org-position-empty {
    font-style: italic;
    font-weight: 400;
    color: var(--text-muted);
}

.org-position-reports {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ===================== My Team — hierarchical view ===================== */
.team-tree-wrap {
    overflow-x: auto;
    padding: 24px 12px 8px;
}

.team-node-card {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 190px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--accent-orange);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.team-node-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-blue);
    color: var(--white);
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.team-node-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-dark);
}

.team-node-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.team-node-actions {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-color);
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
}

.team-node-card {
    cursor: pointer;
}

.team-node-card.selected {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 2px var(--primary-blue-light);
}

.team-node-pending-badge {
    margin-top: 4px;
}

/* Same plain CSS-connector tree technique as .org-chart (see that block above), reused here for
   the "My Team" manager hierarchy so a manager's own reports' reports render nested, not flat. */
.team-tree, .team-tree ul {
    list-style: none;
    margin: 0;
    padding: 40px 0 0;
    display: flex;
    justify-content: center;
}

.team-tree {
    padding-top: 0;
}

.team-tree li {
    position: relative;
    padding: 40px 14px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.team-tree li::before,
.team-tree li::after {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    width: 50%;
    height: 40px;
    border-top: 2px dashed var(--border-color);
}

.team-tree li::after {
    right: auto;
    left: 50%;
    border-left: 2px dashed var(--border-color);
}

.team-tree li:only-child {
    padding-top: 0;
}

.team-tree li:only-child::before,
.team-tree li:only-child::after {
    display: none;
}

.team-tree li:first-child::before,
.team-tree li:last-child::after {
    border: 0 none;
}

.team-tree li:last-child::before {
    border-right: 2px dashed var(--border-color);
    border-radius: 0 6px 0 0;
}

.team-tree li:first-child::after {
    border-radius: 6px 0 0 0;
}

.team-tree > li {
    padding-top: 0;
}

.team-tree > li::before,
.team-tree > li::after {
    display: none;
}

.team-tree ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px dashed var(--border-color);
    width: 0;
    height: 40px;
}
/* ===== Organization document alerts: bell dropdown + dashboard card ===== */
.notification-wrap { position: relative; display: flex; align-items: center; }

.notification-backdrop { position: fixed; inset: 0; z-index: 900; background: transparent; }

.notification-panel {
    position: absolute;
    top: 48px;
    inset-inline-end: -40px;
    width: 320px;
    max-width: calc(100vw - 24px);
    max-height: 420px;
    overflow-y: auto;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    z-index: 901;
}

.notification-panel-title { padding: 12px 16px; font-weight: 700; font-size: 14px; border-bottom: 1px solid var(--border-color); }
.notification-empty { padding: 22px 16px; text-align: center; color: #94a3b8; font-size: 13px; }

.notification-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    border-inline-start: 4px solid #f59e0b;
    text-decoration: none;
    color: var(--text-dark);
}
.notification-item:last-child { border-bottom: none; }
.notification-item:hover { background-color: #f8fafc; }
.notification-item.expired { border-inline-start-color: #ef4444; }
.notification-item-name { font-size: 13px; font-weight: 600; }
.notification-item-sub { font-size: 12px; color: #92400e; }
.notification-item.expired .notification-item-sub { color: #991b1b; }

.doc-alerts-card {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-inline-start: 5px solid #f59e0b;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 18px;
}
.doc-alerts-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.doc-alerts-title { display: flex; align-items: center; gap: 8px; font-weight: 700; color: #92400e; }
.doc-alerts-count { background: #f59e0b; color: #fff; border-radius: 999px; padding: 1px 9px; font-size: 12px; }
.doc-alerts-link { font-size: 13px; font-weight: 600; color: var(--primary-blue); text-decoration: none; }
.doc-alerts-link:hover { text-decoration: underline; }
.doc-alerts-list { list-style: none; margin: 0; padding: 0; }
.doc-alerts-list li { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-top: 1px dashed #fde68a; font-size: 13px; flex-wrap: wrap; }
.doc-alert-name { flex: 1 1 200px; font-weight: 600; color: var(--text-dark); }
.doc-alert-days { font-weight: 600; color: #92400e; }
.doc-alerts-list li.expired .doc-alert-days { color: #b91c1c; }
.doc-alert-date { color: #64748b; }
.doc-alerts-more { font-size: 12px; color: #92400e; padding-top: 6px; }

.org-doc-actions { white-space: nowrap; }
.org-doc-btns { display: inline-flex; gap: 6px; align-items: center; justify-content: center; }
.odb {
    --odb: #186493;
    width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px; border: 1px solid color-mix(in srgb, var(--odb) 28%, transparent);
    background: color-mix(in srgb, var(--odb) 10%, #fff); color: var(--odb);
    font-size: 14px; cursor: pointer; text-decoration: none;
    transition: background .15s, color .15s, transform .15s, box-shadow .15s;
}
.odb:hover { background: var(--odb); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 10px color-mix(in srgb, var(--odb) 35%, transparent); }
.odb:focus-visible { outline: 2px solid var(--odb); outline-offset: 2px; }
.odb-view { --odb: #186493; }
.odb-print { --odb: #475569; }
.odb-edit { --odb: #15803d; }
.odb-archive { --odb: #b45309; }
.odb-delete { --odb: #b91c1c; }
.org-doc-desc { max-width: 260px; }

@media (max-width: 550px) {
    .notification-panel { position: fixed; top: 60px; inset-inline-end: 12px; inset-inline-start: 12px; width: auto; }
}

/* ===== Organization Documents modal form ===== */
.modal-box-lg .modal-body.org-doc-form { padding: 22px 26px; display: flex; flex-direction: column; gap: 18px; }

.org-doc-section { background: #f8fafc; border: 1px solid var(--border-color); border-radius: 12px; padding: 16px 18px; }
.org-doc-section-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--primary-blue); margin-bottom: 14px; }

.org-doc-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.org-doc-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

.org-doc-form .form-input-group { min-width: 0; }
.org-doc-form .form-input-group input,
.org-doc-form .form-input-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: var(--white);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    resize: vertical;
    transition: var(--transition);
}
.org-doc-form .form-input-group input:focus,
.org-doc-form .form-input-group textarea:focus { border-color: var(--primary-blue); box-shadow: 0 0 0 3px rgba(24, 100, 147, 0.12); }

.org-doc-hint { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 9px 12px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; font-size: 12px; color: #92400e; }

.org-doc-drop {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    padding: 22px 16px; border: 2px dashed #b6c8d6; border-radius: 12px; background: var(--white);
    cursor: pointer; text-align: center; transition: var(--transition);
}
.org-doc-drop:hover { border-color: var(--primary-blue); background: #f1f7fb; }
.org-doc-drop input[type="file"] { display: none; }
.org-doc-drop > i { font-size: 28px; color: var(--primary-blue); }
.org-doc-drop-main { font-size: 13px; font-weight: 700; color: var(--text-dark); }
.org-doc-drop-sub { font-size: 11.5px; color: #94a3b8; }

.org-doc-file-chip {
    display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 12px;
    background: #eef4f8; border-radius: 8px; font-size: 12.5px; color: var(--primary-blue); text-decoration: none; word-break: break-all;
}
.org-doc-file-chip.ok { background: #dcfce7; color: #166534; }
.org-doc-file-chip.error { background: #fee2e2; color: #991b1b; }

@media (max-width: 640px) {
    .org-doc-grid-2, .org-doc-grid-3 { grid-template-columns: minmax(0, 1fr); }
    .modal-box-lg .modal-body.org-doc-form { padding: 16px; }
}

/* ===== Organization Document Categories ("folders") + search - 2026-09-29 =====
   .doc-cat-header is a MODIFIER on the app's standard .table-card-header gradient bar (never a
   replacement for it) - an earlier version stripped that bar's background/padding/accent-stripe
   via an inline style to make room for a search box, which made the title look like a disconnected
   floating chip instead of the same header bar every other card in the app uses. Fixed: the real
   .table-card-header bar renders exactly as everywhere else, and the search box sits inside it,
   styled to sit on the bar's own dark gradient instead of assuming a light card background. */
.doc-cat-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

.doc-search-bar { position: relative; width: 260px; max-width: 100%; }
.doc-search-bar i { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: 12.5px; }
.doc-search-bar input { padding-inline-start: 34px; }
.doc-cat-search { width: 220px; }

/* These search boxes live inside the (light) header bar - keep a visible border. */
.doc-cat-header .doc-search-bar input {
    background: #fff; border: 1px solid #cbd5e1; color: var(--text-dark);
    height: 34px; font-size: 12.5px;
}
.doc-cat-header .doc-search-bar input::placeholder { color: #94a3b8; }
.doc-cat-header .doc-search-bar input:focus { background: #fff; box-shadow: 0 0 0 3px rgba(24, 100, 147, .15); }
.doc-cat-header .doc-search-bar i { color: #64748b; }

.doc-cat-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.doc-cat-tile {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
    width: 130px; padding: 16px 10px 12px; border-radius: 14px; border: 1px solid var(--border-color);
    background: #fff; cursor: pointer; transition: var(--transition); text-align: center;
}
.doc-cat-tile:hover { border-color: var(--primary-blue-light); box-shadow: 0 4px 14px rgba(15, 45, 66, .08); transform: translateY(-1px); }
.doc-cat-tile.active { border-color: var(--primary-blue); background: rgba(24, 100, 147, .06); box-shadow: 0 4px 14px rgba(24, 100, 147, .15); }
.doc-cat-tile > i:first-child { font-size: 26px; color: var(--primary-blue); }
.doc-cat-tile.active > i:first-child { color: var(--primary-blue-dark); }
.doc-cat-tile-name { font-size: 12.5px; font-weight: 700; color: var(--text-dark); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.doc-cat-tile-count { font-size: 11px; font-weight: 700; color: #fff; background: var(--primary-blue-light); border-radius: 999px; padding: 1px 9px; }
.doc-cat-tile.active .doc-cat-tile-count { background: var(--primary-blue); }

.doc-cat-tile-actions { position: absolute; top: 6px; inset-inline-end: 6px; display: none; gap: 4px; }
.doc-cat-tile:hover .doc-cat-tile-actions { display: flex; }
.doc-cat-tile-actions button {
    width: 20px; height: 20px; border-radius: 50%; border: none; background: #fff; color: var(--text-muted);
    font-size: 9.5px; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(0,0,0,.15); cursor: pointer;
}
.doc-cat-tile-actions button:last-child:hover { color: #dc2626; }
.doc-cat-tile-actions button:first-child:hover { color: var(--primary-blue); }

.doc-cat-tile-add { border-style: dashed; border-color: #cbd5e1; background: #f8fafc; color: var(--text-muted); }
.doc-cat-tile-add:hover { border-color: var(--primary-blue); background: #eef4f8; }
.doc-cat-tile-add > i:first-child { color: #94a3b8; }
.doc-cat-tile-add:hover > i:first-child { color: var(--primary-blue); }

.doc-cat-picker { display: flex; align-items: center; gap: 8px; }
.doc-cat-picker .searchable-select { flex: 1; min-width: 0; }
.doc-cat-picker-add {
    flex-shrink: 0; width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--primary-blue-light);
    background: #eef4f8; color: var(--primary-blue); font-size: 14px; cursor: pointer; transition: var(--transition);
}
.doc-cat-picker-add:hover { background: var(--primary-blue); color: #fff; }

.doc-no-date-check { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 11.5px; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.doc-no-date-check input { width: 14px; height: 14px; accent-color: var(--primary-blue); cursor: pointer; }

@media (max-width: 640px) {
    .doc-cat-tile { width: calc(50% - 6px); }
    .doc-search-bar, .doc-cat-search { width: 100%; }
}

/* ===== Org chart polish (Departments) ===== */
/* Bug fix: the vertical stub above each child row is an absolutely-positioned ::before on the <ul>,
   but the <ul> itself was never positioned - so the stub anchored to the parent <li> instead and
   drew a stray notch across the top of the parent card rather than the connector below it. */
.org-chart ul,
.team-tree ul { position: relative; }

.org-chart { --border-color: #b7c9d8; }
.org-chart-wrap { padding: 28px 16px 20px; background: linear-gradient(180deg, #f8fbfd 0%, #ffffff 100%); }
.org-chart { width: max-content; min-width: 100%; }
.org-chart li { padding-inline: 12px; }

.org-chart-root {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 22px;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    box-shadow: 0 6px 18px rgba(24, 100, 147, 0.28);
}
.org-chart-root-icon {
    width: 38px; height: 38px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, 0.18); font-size: 17px;
}
.org-chart-root-name { font-size: 15px; font-weight: 700; }
.org-chart-root-count {
    font-size: 11.5px; padding: 3px 10px; border-radius: 999px;
    background: rgba(255, 255, 255, 0.2); white-space: nowrap;
}

.org-chart-card {
    min-width: 200px;
    max-width: 240px;
    padding: 14px 16px 12px;
    border-color: #e2eaf0;
    border-top: 4px solid var(--primary-blue);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.org-chart-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12); }
.org-chart-card-title { font-size: 14px; cursor: pointer; }
.org-chart-card-title:hover { color: var(--primary-blue); }
.org-chart-card-manager { font-size: 11.5px; }
.org-chart-card-meta { border-top-style: solid; border-top-color: #eef2f6; }
.org-chart-collapse-btn { margin-top: 8px; }
.org-chart-collapse-btn:hover { background: var(--primary-blue); color: #fff; border-color: var(--primary-blue); }

@media (max-width: 640px) {
    .org-chart-card { min-width: 170px; }
}

/* ===== Sidebar submenu: smooth tinted panel + animated open/close ===== */
.sidebar-submenu-wrap {
    display: grid;
    grid-template-rows: 0fr;
    width: 100%;
    opacity: 0;
    visibility: hidden;
    transition: grid-template-rows 0.3s ease, opacity 0.25s ease, visibility 0s linear 0.3s;
}

.sidebar-submenu-wrap.open {
    grid-template-rows: 1fr;
    opacity: 1;
    visibility: visible;
    transition: grid-template-rows 0.3s ease, opacity 0.25s ease 0.05s, visibility 0s;
}

.sidebar-submenu-wrap > .sidebar-submenu {
    min-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0 6px;
    gap: 6px;
    border-top: none;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(24, 100, 147, 0.10) 0%, rgba(24, 100, 147, 0.04) 100%);
    box-shadow: inset 0 0 0 1px rgba(24, 100, 147, 0.08);
    transition: padding 0.3s ease, margin 0.3s ease;
}

.sidebar-submenu-wrap.open > .sidebar-submenu {
    margin-top: 8px;
    padding: 10px 6px;
}

.sidebar-subitem {
    padding: 6px 2px;
    border-radius: 12px;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.sidebar-subitem:hover {
    background-color: rgba(255, 255, 255, 0.7);
    transform: translateY(-1px);
}

.sidebar-subitem.active {
    background-color: var(--white);
    box-shadow: 0 2px 8px rgba(24, 100, 147, 0.15);
}

.sidebar-subitem .item-icon-box {
    border-color: transparent;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.sidebar-subitem.active .item-icon-box {
    background-color: var(--primary-blue);
}

.sidebar-subitem.active .item-icon-box svg,
.sidebar-subitem.active .item-icon-box i {
    color: #fff;
}

.group-chevron { transition: transform 0.3s ease; }

@media (prefers-reduced-motion: reduce) {
    .sidebar-submenu-wrap, .sidebar-submenu-wrap > .sidebar-submenu, .sidebar-subitem { transition: none; }
}

/* ===== Employee Definition: Login Account card ===== */
.login-account-hint {
    display: flex; align-items: center; gap: 10px; margin: 16px 20px; padding: 12px 14px;
    background: #eef4f8; border-radius: 10px; color: var(--primary-blue); font-size: 13px;
}
.login-account-status {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; font-size: 13px;
}
.login-account-status.active { background: #dcfce7; color: #166534; }
.login-account-status.none { background: #fef3c7; color: #92400e; }
.login-password-wrap { position: relative; }
.login-password-wrap .form-control { padding-inline-end: 40px; }
.login-password-toggle {
    position: absolute; inset-block: 0; inset-inline-end: 0; width: 40px;
    background: none; border: none; color: #64748b; cursor: pointer;
}
.login-password-toggle:hover { color: var(--primary-blue); }

/* ===== Dashboard top row: profile | punch clock | document alerts, side by side ===== */
/* The alerts card only exists for HR staff with something to flag - :has() switches the row to
   three columns exactly when it's present, otherwise the original two-column layout is untouched. */
.my-dashboard-top-grid:has(> .doc-alerts-card) {
    grid-template-columns: minmax(240px, 1fr) minmax(280px, 1.05fr) minmax(260px, 1fr);
}

@media (max-width: 1200px) {
    .my-dashboard-top-grid:has(> .doc-alerts-card) {
        grid-template-columns: minmax(240px, 1fr) minmax(280px, 1fr);
    }
    .my-dashboard-top-grid:has(> .doc-alerts-card) > .doc-alerts-card { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
    .my-dashboard-top-grid:has(> .doc-alerts-card) { grid-template-columns: 1fr; }
}

/* As a grid cell the alerts card becomes a tall, stacked card matching its neighbours. */
.my-dashboard-top-grid > .doc-alerts-card {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    padding: 20px 20px 16px;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.10);
}
.my-dashboard-top-grid > .doc-alerts-card .doc-alerts-head { margin-bottom: 12px; }
.my-dashboard-top-grid > .doc-alerts-card .doc-alerts-list { flex: 1; overflow-y: auto; }
.my-dashboard-top-grid > .doc-alerts-card .doc-alerts-list li {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 10px;
    padding: 10px 0;
}
.my-dashboard-top-grid > .doc-alerts-card .doc-alert-name { grid-column: 1 / -1; flex: none; }

/* ===== Dashboard: Attendance Overview + Leave Balance cards ===== */
.leave-detail-card {
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
    border: 1px solid #eef2f6;
}

.dashboard-card-heading .card-title { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; }
.card-title-icon {
    width: 32px; height: 32px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center; font-size: 14px;
    color: var(--chip, var(--primary-blue));
    background: color-mix(in srgb, var(--chip, var(--primary-blue)) 12%, white);
}
.year-picker-pill { display: inline-flex; align-items: center; gap: 6px; }
.year-picker-pill i { font-size: 12px; color: var(--primary-blue); }

.leave-balance-hero {
    padding: 16px 18px;
    margin-bottom: 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, #f0f9f4 0%, #f5faff 100%);
    border: 1px solid #e3f1ea;
}
.leave-balance-figure { display: flex; align-items: baseline; gap: 8px; }
.leave-balance-remaining { font-size: 34px; font-weight: 800; color: #15803d; line-height: 1; }
.leave-balance-of { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.leave-balance-caption { font-size: 12px; color: var(--text-muted); margin: 4px 0 12px; font-weight: 600; }
.leave-balance-bar { height: 10px; border-radius: 999px; background: #dcfce7; overflow: hidden; }
.leave-balance-bar-fill {
    height: 100%; border-radius: 999px;
    background: linear-gradient(90deg, var(--accent-orange), #f59e0b);
    transition: width 0.6s ease;
}
.leave-balance-legend { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 12px; color: var(--text-muted); font-weight: 600; }
.leave-balance-legend strong { color: var(--text-dark); margin-inline-start: 4px; }
.leave-balance-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-inline-end: 4px; }
.leave-balance-legend .dot.used { background: var(--accent-orange); }
.leave-balance-legend .dot.left { background: #86efac; }

.leave-stat-cell {
    background-color: color-mix(in srgb, var(--tile, #64748b) 8%, white);
    border: 1px solid color-mix(in srgb, var(--tile, #64748b) 14%, white);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.leave-stat-cell:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08); }
.leave-stat-cell .leave-stat-value { font-size: 20px; }

/* ===== Employee Documents: summary strip + document cards ===== */
.emp-doc-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 18px 0; }
.emp-doc-stat {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px;
    background: var(--white); border: 1px solid #eef2f6; border-radius: 14px; box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
.emp-doc-stat-icon { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; flex-shrink: 0; }
.emp-doc-stat-value { font-size: 22px; font-weight: 800; color: var(--text-dark); line-height: 1.1; }
.emp-doc-stat-label { font-size: 11.5px; color: var(--text-muted); font-weight: 600; }

.emp-doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }

.emp-doc-card {
    display: flex; flex-direction: column; gap: 12px; padding: 16px 18px;
    background: var(--white); border: 1px solid #eef2f6; border-radius: 16px;
    border-top: 4px solid #16a34a; box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.emp-doc-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(15, 23, 42, 0.10); }
.emp-doc-card.expiring { border-top-color: #f59e0b; }
.emp-doc-card.expired { border-top-color: #dc2626; }
.emp-doc-card.noexpiry { border-top-color: #94a3b8; }

.emp-doc-card-top { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.emp-doc-file-icon {
    width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center; font-size: 19px;
    background: #eef4f8; color: var(--primary-blue);
}
.emp-doc-file-icon.pdf { background: #fee2e2; color: #dc2626; }
.emp-doc-file-icon.img { background: #e0f2fe; color: #0284c7; }
.emp-doc-card-titles { flex: 1; min-width: 0; }
.emp-doc-type { font-size: 14.5px; font-weight: 700; color: var(--text-dark); }
.emp-doc-number { font-size: 12.5px; color: var(--text-muted); font-weight: 600; letter-spacing: 0.3px; text-align: start; }

.emp-doc-status { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; background: #dcfce7; color: #166534; }
.emp-doc-status.expiring { background: #fef3c7; color: #92400e; }
.emp-doc-status.expired { background: #fee2e2; color: #991b1b; }
.emp-doc-status.noexpiry { background: #f1f5f9; color: #475569; }

.emp-doc-progress { height: 6px; border-radius: 999px; background: #eef2f6; overflow: hidden; }
.emp-doc-progress-bar { height: 100%; border-radius: 999px; background: #16a34a; }
.emp-doc-card.expiring .emp-doc-progress-bar { background: #f59e0b; }
.emp-doc-card.expired .emp-doc-progress-bar { background: #dc2626; }

.emp-doc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.emp-doc-meta > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.emp-doc-meta span { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.emp-doc-meta strong { font-size: 13px; color: var(--text-dark); word-break: break-word; text-align: start; }

.emp-doc-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid #f1f5f9; margin-top: auto; }
.emp-doc-actions-end { margin-inline-start: auto; display: inline-flex; gap: 6px; }
.emp-doc-actions a.table-action-btn-blue { text-decoration: none; }
.emp-doc-nofile { font-size: 12px; color: #94a3b8; display: inline-flex; align-items: center; gap: 6px; }

.emp-doc-empty {
    display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
    padding: 46px 20px; background: var(--white); border: 2px dashed #cdd9e3; border-radius: 16px;
}
.emp-doc-empty > i { font-size: 44px; color: #b6c8d6; }
.emp-doc-empty-title { font-size: 16px; font-weight: 700; color: var(--text-dark); }
.emp-doc-empty-sub { font-size: 13px; color: var(--text-muted); max-width: 420px; margin-bottom: 8px; }

/* ===== Alerts card: employee-document sub-section ===== */
.doc-alerts-subhead { margin-top: 14px; padding-top: 14px; border-top: 2px solid #fde68a; }
.doc-alerts-none { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #166534; background: #f0fdf4; border-radius: 8px; padding: 8px 12px; margin-bottom: 4px; }
.doc-alerts-list li.doc-alert-emp { cursor: pointer; }
.doc-alerts-list li.doc-alert-emp:hover .doc-alert-name { color: var(--primary-blue); text-decoration: underline; }
.doc-alert-name small { font-weight: 500; color: var(--text-muted); }
/* ===== Pending merge into dashboard.css: Employee Educations / Experiences cards (emp-rec-a-*) ===== */
.emp-doc-card.emp-rec-a-edu { border-top-color: var(--primary-blue); }
.emp-doc-card.emp-rec-a-exp { border-top-color: var(--accent-orange); }
.emp-doc-file-icon.emp-rec-a-icon-edu { background: #eef4f8; color: var(--primary-blue); }
.emp-doc-file-icon.emp-rec-a-icon-exp { background: #fff4e0; color: #b45309; }
/* Subtitle under the card title is free text (institution / job title), not a code - no letter-spacing, wraps. */
.emp-doc-number.emp-rec-a-sub { letter-spacing: 0; word-break: break-word; }
/* Pending CSS for EmployeeVacationsPage / EmployeeFinancialPage card layout (lead to merge into dashboard.css).
   Builds on the existing .emp-doc-* card system. Prefix: emp-rec-b- */

/* Green icon chip (allowance) - .emp-doc-file-icon.pdf (red) is reused for deductions. */
.emp-doc-file-icon.emp-rec-b-green { background: #dcfce7; color: #16a34a; }

/* Prominent amount line on a financial card. */
.emp-rec-b-value {
    display: flex; align-items: baseline; gap: 6px;
    font-size: 24px; font-weight: 800; line-height: 1.1; color: #15803d; text-align: start;
}
.emp-rec-b-value small { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.emp-doc-card.expired .emp-rec-b-value { color: #b91c1c; }
.emp-doc-card.noexpiry .emp-rec-b-value { color: var(--text-dark); }

/* Highlighted metric inside the meta grid (e.g. remaining vacation days). */
.emp-doc-meta strong.emp-rec-b-highlight { font-size: 16px; font-weight: 800; color: #15803d; }
.emp-doc-card.expiring .emp-doc-meta strong.emp-rec-b-highlight { color: #b45309; }
.emp-doc-card.expired .emp-doc-meta strong.emp-rec-b-highlight { color: #b91c1c; }
.emp-doc-card.noexpiry .emp-doc-meta strong.emp-rec-b-highlight { color: var(--text-dark); }

/* ===== Employee pages: banner, tab strip, list toolbar, cards, definition sections ===== */

/* --- profile banner (EmployeeHeaderCard) --- */
.emp-banner {
    display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
    padding: 18px 22px; margin-bottom: 18px; border-radius: 16px; color: #fff;
    background: linear-gradient(120deg, var(--primary-blue-dark) 0%, var(--primary-blue) 70%, #2c86b5 100%);
    box-shadow: 0 8px 22px rgba(24, 100, 147, 0.22);
}
.emp-banner-avatar-wrap { flex-shrink: 0; }
.emp-banner-avatar {
    width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.55); background: rgba(255, 255, 255, 0.18);
}
.emp-banner-avatar-placeholder { display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; color: #fff; }
.emp-banner-main { flex: 1; min-width: 220px; }
.emp-banner-name-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.emp-banner-name { font-size: 20px; font-weight: 800; }
.emp-banner-status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.emp-banner-status-dot { width: 8px; height: 8px; border-radius: 50%; }
.emp-banner-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.emp-banner-chip {
    display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px; border-radius: 999px;
    background: rgba(255, 255, 255, 0.16); font-size: 12.5px; font-weight: 600;
}
.emp-banner-chip i { font-size: 11px; opacity: 0.85; }
.emp-banner-contact { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; opacity: 0.95; }
.emp-banner-contact i { width: 16px; margin-inline-end: 8px; opacity: 0.8; }

/* --- tab strip: segmented pills instead of an underlined row --- */
.tabs-navigation-bar {
    display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding: 6px;
    background: #eef3f7; border: none; border-radius: 14px; margin-bottom: 18px;
    scrollbar-width: thin;
}
.tabs-navigation-bar .tab-link-btn {
    border-radius: 10px; padding: 9px 16px; font-size: 13.5px; flex-shrink: 0;
}
.tabs-navigation-bar .tab-link-btn:hover { background-color: rgba(255, 255, 255, 0.7); }
.tabs-navigation-bar .tab-link-btn.active {
    background-color: var(--white); color: var(--primary-blue);
    box-shadow: 0 2px 8px rgba(24, 100, 147, 0.16);
}
.tabs-navigation-bar .tab-link-btn.active::after { display: none; }

/* --- Employees list: compact filter toolbar --- */
.emp-filter-bar {
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)) auto; gap: 12px; align-items: end;
    padding: 16px 18px; margin: 16px 0; background: var(--white);
    border: 1px solid #eef2f6; border-radius: 14px; box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
.emp-filter-bar .form-input-group label { font-size: 11.5px; color: var(--text-muted); }
.emp-filter-bar .form-input-group input { padding: 9px 12px; }
@media (max-width: 1100px) { .emp-filter-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .emp-filter-bar { grid-template-columns: 1fr 1fr; } }

/* --- employee cards: hover, clickable name, quick links --- */
.employee-card { transition: transform 0.15s ease, box-shadow 0.15s ease; }
.employee-card:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(15, 23, 42, 0.12); }
.employee-card-name { cursor: pointer; }
.employee-card-name:hover { color: var(--primary-blue); }
.employee-card-quick {
    display: flex; justify-content: space-between; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #f1f5f9;
}
.employee-card-quick a {
    flex: 1; display: inline-flex; flex-direction: column; align-items: center; gap: 4px; padding: 7px 2px;
    border-radius: 10px; color: var(--text-muted); text-decoration: none; font-size: 10px; font-weight: 600;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.employee-card-quick a i { font-size: 14px; }
.employee-card-quick a:hover { background: var(--active-bg); color: var(--primary-blue); }

/* --- Employee Definition: light section headers with an icon chip --- */
.emp-def .form-card { border-radius: 16px; overflow: hidden; border: 1px solid #eef2f6; box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05); }
.emp-def .form-card > .table-card-header,
.emp-def .form-card .table-card-header {
    background: #f8fafc; color: var(--primary-blue); border-bottom: 2px solid var(--primary-blue);
    padding-inline-start: 32px;
    display: flex; align-items: center; gap: 10px; font-size: 14.5px;
}
.emp-def .table-card-header .sec-icon {
    width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--primary-blue) 12%, white); color: var(--primary-blue); font-size: 13px;
}
.emp-def .erp-grid-form { padding: 22px; }

/* Equal-height employee cards: push the quick-link row to the bottom of each card. */
.employee-card { display: flex; flex-direction: column; }
.employee-card-quick { margin-top: auto; }
.employee-card-meta { margin-bottom: 12px; }

/* ==========================================================================
   Responsive modals (all pages) - later rules intentionally override the base .modal-* block.
   - The box never taller than the viewport: header/footer stay put, only the body scrolls.
   - Form rows inside a modal reflow by available width (auto-fit) instead of the page-wide fixed
     4-column grid, which squeezed every field into a ~90px sliver in a 500px dialog.
   - Phones get a full-width bottom sheet with wrapping, evenly-sized footer buttons.
   ========================================================================== */
.modal-overlay {
    inset: 0;
    width: auto;
    height: auto;
    padding: 16px;
    box-sizing: border-box;
}

.modal-box {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
}

.modal-box > .modal-header,
.modal-box > .modal-footer { flex-shrink: 0; }

.modal-box > .modal-body,
.modal-box > .modal-box-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    max-height: none;              /* the box's own max-height governs now (overrides .modal-box-lg's 65vh) */
    overscroll-behavior: contain;
}

.modal-box .modal-header { padding: 16px 20px; }
.modal-box .modal-header h3 { margin: 0; overflow-wrap: anywhere; }

/* forms inside a modal: no double padding, fields wrap by width */
.modal-box .erp-grid-form { padding: 0; gap: 16px; }
.modal-box .form-inputs-row { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.modal-box .form-inputs-row.cols-12 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.modal-box .form-inputs-row.cols-12 > * { grid-column: auto; }
.modal-box .form-input-group { min-width: 0; }
.modal-box .form-input-group input,
.modal-box .form-input-group select,
.modal-box .form-input-group textarea,
.modal-box .searchable-select { width: 100%; max-width: 100%; box-sizing: border-box; }
.modal-box .table-responsive-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.modal-footer { flex-wrap: wrap; }

@media (max-width: 576px) {
    .modal-overlay { padding: 0; align-items: flex-end; }

    .modal-box {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 18px 18px 0 0;
        max-height: 92vh;
        max-height: 92dvh;
    }

    .modal-box .modal-header { padding: 14px 16px; }
    .modal-box .modal-header h3 { font-size: 16px; }
    .modal-box .modal-body { padding: 16px; }
    .modal-box .form-inputs-row { grid-template-columns: 1fr; }

    .modal-footer { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); gap: 8px; }
    .modal-footer .modal-btn { flex: 1 1 calc(50% - 8px); min-width: 0; padding: 11px 10px; text-align: center; white-space: nowrap; }
    /* Delete gets its own full-width row above Cancel/Save so the destructive action is never a stray thumb-tap */
    .modal-footer .modal-btn.btn-danger { flex: 1 1 100%; order: -1; }
}

@media (max-height: 520px) and (orientation: landscape) {
    .modal-overlay { padding: 8px; }
    .modal-box { max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); }
}

/* ===== Search / filter forms on ONE row (class "search-row" on the .erp-grid-form, or - automatically - any form
   whose .form-actions-left holds the magnifier Search button, so existing markup needs no edit) =====
   The fields and the action button(s) share a single wrapping flex line instead of the button
   dropping to its own row underneath - display:contents on the inner .form-inputs-row lets its
   fields flow into the same line as the button. Wraps naturally when there are many filters. */
.erp-grid-form:is(.search-row, :has(> .form-actions-left .fa-magnifying-glass)) {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 16px;
    padding: 16px 20px;
}
.erp-grid-form:is(.search-row, :has(> .form-actions-left .fa-magnifying-glass)) > .form-inputs-row { display: contents; }
.erp-grid-form:is(.search-row, :has(> .form-actions-left .fa-magnifying-glass)) .form-input-group { flex: 1 1 140px; min-width: 130px; max-width: 300px; }
.erp-grid-form:is(.search-row, :has(> .form-actions-left .fa-magnifying-glass)) > .form-actions-left {
    flex: 0 0 auto;
    margin: 0 !important;
    padding: 0 !important;
    align-self: flex-end;
}
.erp-grid-form:is(.search-row, :has(> .form-actions-left .fa-magnifying-glass)) .erp-form-btn { min-height: 44px; white-space: nowrap; }

@media (max-width: 576px) {
    .erp-grid-form:is(.search-row, :has(> .form-actions-left .fa-magnifying-glass)) .form-input-group { flex-basis: 100%; max-width: none; }
    .erp-grid-form:is(.search-row, :has(> .form-actions-left .fa-magnifying-glass)) > .form-actions-left { flex: 1 1 100%; }
    .erp-grid-form:is(.search-row, :has(> .form-actions-left .fa-magnifying-glass)) > .form-actions-left .erp-form-btn { width: 100%; justify-content: center; }
}

/* Transparent click-anywhere-to-close backdrop for any open dropdown/popover (user menu,
   Favorites "More" menu, ...) - sits between the page chrome (z-index 100) and the popover
   itself (z-index 500+) so a click anywhere outside the popover closes it, with no JS needed.
   Only visible (and only intercepts clicks) while .active is toggled on. */
.click-away-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 150;
    background: transparent;
}

.click-away-backdrop.active {
    display: block;
}

/* Superadmin organization picker - matches the login inputs above */
.login-org-select {
    width: 100%;
    padding: 13px 16px 13px 44px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background-color: #fafafa;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    appearance: none;
    transition: var(--transition);
}

[dir="rtl"] .login-org-select {
    padding: 13px 44px 13px 16px;
}

.login-org-select:focus {
    border-color: var(--primary-blue);
    background-color: var(--white);
    box-shadow: 0 0 0 3px rgba(24, 100, 147, 0.1);
}

/* ==========================================
   Superadmin organization switcher (navbar center)
   ========================================== */
.org-switcher {
    position: relative;
    display: inline-block;
}

.org-switcher-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 340px;
    background: var(--active-bg);
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 7px 14px;
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-blue);
    cursor: pointer;
    transition: var(--transition);
}

.org-switcher-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.org-switcher-btn i {
    font-size: 11px;
    opacity: 0.8;
}

.org-switcher-btn:hover {
    border-color: var(--primary-blue);
    background: var(--white);
}

.org-switcher-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    width: 320px;
    max-width: 88vw;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    z-index: 500;
    transition: var(--transition);
}

.org-switcher-menu.show-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.org-switcher-head {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 8px 12px 10px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 6px;
}

.org-switcher-list {
    max-height: 340px;
    overflow-y: auto;
}

.org-switcher-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 9px;
    text-decoration: none;
    color: var(--text-dark);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.org-switcher-item span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.org-switcher-icon {
    color: var(--text-muted);
    font-size: 13px;
}

.org-switcher-item:hover {
    background: var(--active-bg);
    color: var(--primary-blue);
}

.org-switcher-item:hover .org-switcher-icon {
    color: var(--primary-blue);
}

.org-switcher-item.active {
    background: var(--active-bg);
    color: var(--primary-blue);
}

.org-switcher-item.active .org-switcher-icon {
    color: var(--primary-blue);
}

.org-switcher-check {
    color: var(--primary-blue);
    font-size: 12px;
}

/* Mobile: the navbar-center slot is hidden (org name lives in the slide-in menu) - but the superadmin's
   organization switcher must stay reachable, so show it there as a compact building button whose menu
   drops down full-width under the header. */
@media (max-width: 991px) {
    .navbar-center:has(.org-switcher) { display: flex; margin: 0; min-width: 0; }
    .org-switcher-btn { padding: 8px 10px; max-width: 46px; }
    .org-switcher-btn span, .org-switcher-btn i.fa-chevron-down { display: none; }
    .org-switcher-menu {
        position: fixed; top: 64px; left: 12px; right: 12px; width: auto; max-width: none;
        transform: translateY(-8px);
    }
    .org-switcher-menu.show-dropdown { transform: translateY(0); }
}
.org-switcher-building { font-size: 13px; }
@media (min-width: 992px) { .org-switcher-building { display: none; } }

/* ===== Home for the cross-organization superadmin (no employee record) ===== */
.superadmin-welcome {
    max-width: 640px; margin: 40px auto; padding: 36px 32px; text-align: center;
    background: var(--white); border: 1px solid #eef2f6; border-radius: 18px; box-shadow: 0 6px 22px rgba(15, 23, 42, 0.07);
}
.superadmin-welcome-icon {
    width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 18px; display: flex; align-items: center; justify-content: center;
    font-size: 28px; color: #fff; background: linear-gradient(135deg, var(--primary-blue-dark), var(--primary-blue));
}
.superadmin-welcome-title { font-size: 20px; font-weight: 800; color: var(--text-dark); margin-bottom: 8px; }
.superadmin-welcome-sub { font-size: 13.5px; color: var(--text-muted); line-height: 1.7; margin-bottom: 22px; }
.superadmin-welcome-links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.superadmin-welcome-links a { text-decoration: none; }

/* ===== Letter Templates / Letter Requests (Official Document Request feature) =====
   Modernized 2026-09-28 - scoped entirely to .letter-* classes and the .letter-modal wrapper
   added to these 3 modals' own .modal-box, so none of this touches the shared .modal-box/
   .org-doc-*/.emp-doc-stat styling used by every other page in the app (Employee sub-records,
   Organization Documents, etc.) - only these letter screens opt in. */

/* Gradient header + softer shell for the 3 letter modals (Add/Edit Template, New Request,
   Review/Approve) - a `transform` on .modal-box itself is deliberately never used here (see the
   big comment above the base .modal-box rule: it breaks SearchableSelect's fixed-position
   dropdown), so the "modern" lift comes from color/shadow/radius only, never motion on the box. */
.letter-modal { border-radius: 18px; box-shadow: 0 24px 60px rgba(15, 45, 66, 0.22); }
.letter-modal .modal-header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    border-bottom: none; padding: 20px 26px;
}
.letter-modal .modal-header h3 { color: #fff; display: flex; align-items: center; gap: 10px; font-size: 17px; }
.letter-modal .modal-header h3 i { font-size: 15px; opacity: .9; }
.letter-modal .close-modal-btn { color: rgba(255,255,255,.8); width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.letter-modal .close-modal-btn:hover { color: #fff; background: rgba(255,255,255,.18); }
.letter-modal .modal-footer { background: #fff; padding: 16px 26px; }
.letter-modal .modal-btn.btn-save {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-dark)); border: none;
    box-shadow: 0 6px 16px rgba(24, 100, 147, .3); transition: transform .15s, box-shadow .15s;
}
.letter-modal .modal-btn.btn-save:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(24, 100, 147, .4); }
.letter-modal .modal-btn.btn-danger { box-shadow: 0 6px 16px rgba(220, 38, 38, .22); transition: transform .15s, box-shadow .15s; }
.letter-modal .modal-btn.btn-danger:hover:not(:disabled) { transform: translateY(-1px); }

/* Section cards inside the letter modals - white "paper" cards instead of the flat grey the
   shared .org-doc-section uses elsewhere, with an icon badge and a soft dashed divider. */
.letter-modal .org-doc-section {
    background: #fff; border: 1px solid #e9eef3; border-radius: 14px; padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(15, 45, 66, .05); transition: box-shadow .2s;
}
.letter-modal .org-doc-section:hover { box-shadow: 0 6px 18px rgba(15, 45, 66, .08); }
.letter-modal .org-doc-section-title {
    font-size: 13.5px; padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px dashed #e2e8f0;
}
.letter-modal .org-doc-section-title i {
    width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
    background: rgba(24, 100, 147, .1); color: var(--primary-blue); border-radius: 8px; font-size: 12px;
}

/* "Available for employees to request" - a colored toggle pill instead of a bare checkbox+label. */
.letter-active-check {
    display: inline-flex; align-items: center; gap: 10px; padding: 9px 16px; border-radius: 999px;
    border: 1px solid var(--border-color); background: #fff; cursor: pointer; font-size: 13px;
    font-weight: 600; color: var(--text-dark); transition: var(--transition);
}
.letter-active-check:has(input:checked) { background: rgba(22, 163, 74, .08); border-color: #86efac; color: #166534; }
.letter-active-check input { width: 17px; height: 17px; accent-color: #16a34a; cursor: pointer; }

.letter-token-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.letter-token-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.letter-token-chip {
    font-family: 'Courier New', monospace; font-size: 11.5px; font-weight: 700; padding: 6px 14px; border-radius: 999px;
    background: #fff; color: var(--primary-blue); border: 1px solid var(--primary-blue-light); cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 45, 66, .05); transition: all .15s ease;
}
.letter-token-chip:hover {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-dark)); color: #fff;
    border-color: transparent; transform: translateY(-1px); box-shadow: 0 6px 14px rgba(24, 100, 147, .3);
}
.letter-token-chip:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(15, 45, 66, .1); }

/* Segmented-control language switcher instead of a plain flat-tab pair. */
.letter-body-tabs { display: inline-flex; gap: 2px; background: #eef2f7; border-radius: 10px; padding: 4px; margin-bottom: 10px; }
.letter-body-tab {
    padding: 8px 22px; border: none; border-radius: 8px; background: transparent; color: var(--text-muted);
    font-size: 12.5px; font-weight: 700; cursor: pointer; transition: var(--transition);
}
.letter-body-tab.active { background: #fff; color: var(--primary-blue); box-shadow: 0 2px 8px rgba(15, 45, 66, .1); }

.letter-body-textarea {
    width: 100%; min-height: 220px; font-family: 'Courier New', monospace; font-size: 13px;
    line-height: 1.6; resize: vertical; border-radius: 10px; border: 1px solid #e2e8f0; padding: 14px 16px;
    transition: border-color .15s, box-shadow .15s;
}
.letter-body-textarea:focus { border-color: var(--primary-blue); box-shadow: 0 0 0 3px rgba(24, 100, 147, .12); outline: none; }

/* Preview - looks like a printed page: a thin brand-color top edge, generous padding, soft shadow. */
.letter-preview-box {
    background: #fff; border: 1px solid #e9eef3; border-radius: 12px; padding: 26px 28px 22px;
    min-height: 120px; font-size: 14px; line-height: 1.9; color: #1e293b; overflow-x: auto;
    box-shadow: 0 4px 16px rgba(15, 45, 66, .07); position: relative;
}
.letter-preview-box::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; border-radius: 12px 12px 0 0;
    background: linear-gradient(90deg, var(--primary-blue), var(--accent-orange));
}
.letter-preview-box img { max-width: 100%; }

.letter-emailed-hint { font-size: 11px; color: #166534; margin-inline-start: 8px; white-space: nowrap; }
.letter-reject-reason { font-size: 12px; color: #991b1b; }

/* Status badges get a leading dot instead of plain text-only pills. */
.letter-status-badge { display: inline-flex; align-items: center; gap: 6px; }
.letter-status-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* Stat row at the top of the HR review page - opt-in polish over the shared .emp-doc-stat (used
   elsewhere too, e.g. Employee/Organization Documents - left completely untouched there). */
.letter-stats-summary .emp-doc-stat {
    border-radius: 16px; box-shadow: 0 1px 3px rgba(15, 45, 66, .06); transition: transform .15s, box-shadow .15s;
}
.letter-stats-summary .emp-doc-stat:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15, 45, 66, .1); }
.letter-stats-summary .emp-doc-stat-icon { width: 46px; height: 46px; border-radius: 14px; font-size: 18px; box-shadow: 0 4px 10px rgba(0, 0, 0, .14); }
.letter-stats-summary .emp-doc-stat-value { font-size: 24px; }

/* Friendlier empty state (icon + message) instead of a bare line of muted text. */
.letter-empty-state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 46px 20px; color: var(--text-muted); }
.letter-empty-state i { font-size: 34px; color: var(--primary-blue-light); }
.letter-empty-state span { font-size: 13.5px; max-width: 360px; text-align: center; line-height: 1.7; }

/* Request/review list tables - a subtle row hover + a clickable-first-cell affordance, scoped by
   id so it doesn't touch .erp-custom-table's other, unrelated usages across the app. */
#letter-requests-table tbody tr,
#letter-requests-admin-table tbody tr { transition: background-color .12s; }
#letter-requests-table tbody tr:hover,
#letter-requests-admin-table tbody tr:hover { background: #f8fafc; }
#letter-requests-table tbody td[role="button"],
#letter-requests-admin-table tbody td[role="button"] { cursor: pointer; color: var(--primary-blue); }


/* Arabic (RTL): letter-spacing breaks the joining of Arabic letters, so it is disabled everywhere in RTL. */
:is([dir="rtl"], [dir="rtl"] *),
:is([dir="rtl"], [dir="rtl"] *)::before,
:is([dir="rtl"], [dir="rtl"] *)::after {
    letter-spacing: 0 !important;
}

/* ==========================================================================
   Mobile shell hardening (<= 991px), same fix as ERP. The main grid column was `1fr` (= minmax(auto, 1fr)) and
   .main-page-content had no min-width:0, so any wide child (tables, cards, employee grids) could stretch the whole shell past
   the phone width: partial overlay, page panning sideways. minmax(0, 1fr) + min-width:0 lets everything shrink; wide tables
   scroll inside their own wrappers. Works for both dir="rtl" and dir="ltr" (drawer side rules already exist above).
   ========================================================================== */
@media (max-width: 991px) {
    .dashboard-layout {
        grid-template-columns: minmax(0, 1fr);
        width: 100%; max-width: 100%;
        height: 100vh; height: 100dvh;
        overflow: hidden;
    }
    .main-page-content { min-width: 0; padding: 14px 12px 24px; overflow-x: hidden; }
    .main-page-content .container-fluid { padding-inline: 0; }
    .top-navbar { padding-inline: 10px; gap: 6px; }
    .logo-area img { max-width: 72px; }
    .username { display: none; }

    .sidebar-overlay { left: 0; right: 0; bottom: 0; width: auto; height: auto; background-color: rgba(15, 23, 42, .35); }
    .sidebar-aside { height: calc(100vh - 70px); height: calc(100dvh - 70px); max-width: 82vw; }

    .table-card { max-width: 100%; }
    .table-responsive-wrapper { max-width: 100%; }
}

/* ==================== Talent management (ATS / reviews / announcements) ==================== */
/* Candidate pipeline stage chips (CandidatesPage) - click to filter by stage. */
.candidate-pipeline { display: flex; gap: 10px; flex-wrap: wrap; }
.candidate-stage-chip {
    display: flex; flex-direction: column; align-items: center; min-width: 96px; padding: 10px 14px;
    background: var(--white); border: 1px solid var(--border-color); border-top: 4px solid var(--stage);
    border-radius: 10px; cursor: pointer; transition: var(--transition); color: var(--text-dark);
}
.candidate-stage-chip .stage-count { font-size: 20px; font-weight: 700; color: var(--stage); }
.candidate-stage-chip .stage-name { font-size: 12px; }
.candidate-stage-chip.active { background: var(--active-bg); box-shadow: 0 0 0 2px var(--stage) inset; }

/* 1-5 rating picker + overall score (ReviewScoresTable). */
.rating-picker { display: inline-flex; align-items: center; gap: 4px; }
.rating-dot {
    width: 30px; height: 30px; border-radius: 50%; border: 1px solid #cbd5e1; background: var(--white);
    font-weight: 600; color: var(--text-dark); cursor: pointer; transition: var(--transition);
}
.rating-dot.on { background: var(--primary-blue); border-color: var(--primary-blue); color: #fff; }
.review-scores-table tfoot th { background: #f8fafc; }
.review-overall {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding: 12px 16px;
    border-radius: 10px; background: var(--active-bg); color: var(--primary-blue-dark);
}
.review-overall strong { font-size: 20px; }

/* Announcements card on the employee dashboard (Home.razor). */
.announcement-list { display: flex; flex-direction: column; gap: 10px; }
.announcement-item { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border-color); background: var(--white); }
.announcement-item.pinned { border-inline-start: 4px solid var(--accent-orange); background: #fffaf2; }
.announcement-item-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.announcement-item-title { font-weight: 700; color: var(--text-dark); }
.announcement-item-date { font-size: 12px; color: var(--text-muted); }
.announcement-item-body { margin-top: 6px; white-space: pre-wrap; color: var(--text-dark); font-size: 14px; }

/* Public careers page (/careers/{orgId}) - BlankLayout, so it owns its own scrolling (body is overflow:hidden). */
.careers-page { height: 100vh; height: 100dvh; overflow-y: auto; background: var(--body-bg); }
.careers-hero { background: linear-gradient(135deg, var(--primary-blue-dark), var(--primary-blue)); color: #fff; padding: 32px 16px; }
.careers-hero-inner { max-width: 960px; margin: 0 auto; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.careers-hero h1 { margin: 0; font-size: 26px; font-weight: 700; }
.careers-hero p { margin: 4px 0 0; opacity: .9; }
.careers-logo { width: 72px; height: 72px; object-fit: contain; background: #fff; border-radius: 14px; padding: 6px; }
.careers-lang-btn { margin-inline-start: auto; background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.4); border-radius: 8px; padding: 6px 14px; cursor: pointer; }
.careers-body { max-width: 960px; margin: 0 auto; padding: 24px 16px 48px; display: flex; flex-direction: column; gap: 14px; }
.careers-count { color: var(--text-muted); font-weight: 600; }
.careers-empty { text-align: center; color: var(--text-muted); padding: 48px 16px; background: var(--white); border-radius: 12px; }
.careers-card { background: var(--white); border: 1px solid var(--border-color); border-radius: 12px; box-shadow: 0 1px 3px rgba(15,23,42,.05); }
.careers-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; cursor: pointer; }
.careers-card-head h2 { margin: 0; font-size: 18px; color: var(--primary-blue-dark); }
.careers-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; font-size: 13px; color: var(--text-muted); }
.careers-meta i { margin-inline-end: 4px; }
.careers-desc { padding: 0 18px 18px; white-space: pre-wrap; color: var(--text-dark); line-height: 1.7; }
@media (max-width: 576px) {
    .careers-hero h1 { font-size: 20px; }
    .careers-lang-btn { margin-inline-start: 0; }
}

/* ==========================================================================
   Document reports (HR/Shared/ReportViewer.razor, copied from ERP) - criteria grid, KPI cards, dense results table.
   ========================================================================== */
.rpt-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 6px 12px; align-items: end; padding: 4px 4px 8px; }
.rpt-filters .form-input-group { margin-bottom: 4px; min-width: 0; }
.rpt-filters .form-input-group > label { font-size: 12px; margin-bottom: 3px; }
.rpt-filters .form-control:not(textarea) { min-height: 34px; height: 34px; padding-top: 4px; padding-bottom: 4px; font-size: 13px; }
.rpt-run .erp-form-btn { width: 100%; justify-content: center; min-height: 34px; }
.rpt-error { margin: 4px 4px 10px; padding: 8px 12px; border-radius: 8px; background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; font-size: 13px; }
.rpt-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 16px; }
.rpt-kpi { background: #fff; border: 1px solid #e2e8f0; border-inline-start: 3px solid var(--primary-blue); border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; box-shadow: 0 1px 2px rgba(15, 23, 42, .03); }
.rpt-kpi-label { font-size: 11.5px; color: #64748b; }
.rpt-kpi-value { font-size: 18px; font-weight: 700; color: var(--primary-blue); direction: ltr; text-align: start; }
.rpt-scroll { max-height: 68vh; overflow: auto; }
.rpt-table th, .rpt-table td { padding: 8px 10px; text-align: start; white-space: nowrap; }
.rpt-table th { position: sticky; top: 0; z-index: 1; }
.rpt-table .rpt-num { text-align: end; }
.rpt-table td.rpt-neg { color: #b91c1c; }
.rpt-table tfoot td { position: sticky; bottom: 0; background: #eef3f8; font-weight: 700; border-top: 2px solid var(--primary-blue); }
.rpt-link { color: var(--primary-blue); font-weight: 600; text-decoration: none; }
.rpt-link:hover { text-decoration: underline; }
.rpt-more { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.rpt-note { padding: 6px 14px; font-size: 12px; color: #64748b; }
.rpt-note i { color: var(--primary-blue); margin-inline-end: 4px; }
@media (max-width: 576px) { .rpt-kpi-value { font-size: 15px; } }

/* ==========================================================================
   HR Dashboard (analytics, HR-staff-facing) - headcount/nationality/attendance/leave/Nitaqat cards.
   ========================================================================== */
/* minmax is deliberately wider than the usual 260px card grid (e.g. .employee-cards-grid) -
   at this page's 5-card count, a narrower minmax packs 4 per row and strands the 5th card
   alone on its own row with three empty column-widths beside it (CSS Grid's auto-fit locks
   the column count for the whole grid, so a lone trailing item never stretches to fill the
   row). The wider minmax below forces 3 columns instead, so 5 cards wrap 3+2 - no lonely
   orphan card, and no dead whitespace. Verified at 1440px (3+2) and narrower widths still
   reflow to 2 or 1 per row normally. */
.hrdash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-bottom: 18px; }
.hrdash-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(15,23,42,.05); }
.hrdash-card-title { font-size: 13px; font-weight: 700; color: #475569; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.hrdash-card-title i { color: var(--primary-blue); }
.hrdash-big { font-size: 26px; font-weight: 800; color: var(--primary-blue); direction: ltr; text-align: start; }
.hrdash-sub { font-size: 12px; color: #64748b; margin-top: 2px; }
.hrdash-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px dashed #e2e8f0; font-size: 13px; }
.hrdash-row:last-child { border-bottom: none; }
.hrdash-row b { direction: ltr; }
.hrdash-bar-track { background: #eef2f7; border-radius: 6px; height: 10px; overflow: hidden; margin-top: 8px; }
.hrdash-bar-fill { height: 100%; border-radius: 6px; background: var(--primary-blue); }
.hrdash-band { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
@media (max-width: 576px) { .hrdash-big { font-size: 21px; } }
/* ==========================================
   HR hubs - modern icon-card grid (ported from ERP's General Settings / SettingsGrid,
   re-tinted with the HR blue palette). The per-group accent is passed inline as --gs-accent.
   ========================================== */
.gs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
    gap: 16px;
}

.gs-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: var(--transition);
}

.gs-card::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--gs-accent, var(--primary-blue));
    opacity: 0;
    transition: var(--transition);
}

.gs-card:hover {
    transform: translateY(-4px);
    border-color: var(--gs-accent, var(--primary-blue));
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.11);
}

.gs-card:hover::before { opacity: 1; }

.gs-card-icon {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    color: var(--gs-accent, var(--primary-blue));
    background: color-mix(in srgb, var(--gs-accent, var(--primary-blue)) 12%, #fff);
    transition: var(--transition);
}

.gs-card:hover .gs-card-icon {
    background: var(--gs-accent, var(--primary-blue));
    color: #fff;
    transform: scale(1.06);
}

.gs-card-body { flex: 1; min-width: 0; }

.gs-card-title {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 4px;
}

.gs-card-arrow {
    flex-shrink: 0;
    align-self: center;
    color: var(--text-muted);
    font-size: 14px;
    transition: var(--transition);
}

.gs-card:hover .gs-card-arrow {
    color: var(--gs-accent, var(--primary-blue));
    transform: translateX(3px);
}

[dir="rtl"] .gs-card:hover .gs-card-arrow { transform: translateX(-3px); }

@media (max-width: 576px) {
    .gs-grid { grid-template-columns: 1fr; }
}

.settings-group { margin-bottom: 26px; }

.settings-group-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
}

.settings-group-bar {
    width: 4px;
    height: 18px;
    border-radius: 4px;
    background: var(--gs-accent, var(--primary-blue));
}

.settings-group-count {
    font-size: 11px;
    font-weight: 700;
    color: var(--gs-accent, var(--primary-blue));
    background: color-mix(in srgb, var(--gs-accent, var(--primary-blue)) 12%, #fff);
    padding: 2px 9px;
    border-radius: 20px;
}

@media (max-width: 991px) { .dropdown-card { max-width: calc(100vw - 16px); } }
/* ===== Mobile: organization switcher moved from the header into the slide-in menu (super admin) ===== */
.sidebar-org-switch { display: none; }
@media (max-width: 991px) {
    .navbar-center { display: none; }   /* org name / switcher no longer lives in the header on phones */
    .sidebar-org-switch { display: block; width: 100%; padding: 0 8px 10px; margin-bottom: 10px; border-bottom: 1px solid var(--border-color); }
    .sidebar-org-switch-btn {
        width: 100%; display: flex; align-items: center; gap: 8px; padding: 10px 12px;
        background: var(--active-bg); border: 1px solid transparent; border-radius: 10px;
        color: var(--primary-blue); font-size: 14px; font-weight: 700; cursor: pointer; text-align: start;
    }
    .sidebar-org-switch-btn span { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
    .sidebar-org-switch-chev { font-size: 11px; opacity: .8; }
    .sidebar-org-switch-list { margin-top: 8px; max-height: 45vh; overflow-y: auto; border: 1px solid var(--border-color); border-radius: 10px; background: var(--white); }
    .sidebar-org-switch-head { padding: 8px 12px; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }
    .sidebar-org-switch-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; font-size: 13px; font-weight: 600; color: var(--text-dark); text-decoration: none; cursor: pointer; border-top: 1px solid var(--border-color); }
    .sidebar-org-switch-item span { min-width: 0; overflow-wrap: anywhere; }
    .sidebar-org-switch-item:hover, .sidebar-org-switch-item.active { background: var(--active-bg); color: var(--primary-blue); }
    .sidebar-org-switch-new { justify-content: flex-start; color: var(--primary-blue); font-weight: 700; }
}

/* ---------- EmptyState (shared empty-list block; see docs/plan/EMPTY_STATE_GUIDE.md) ---------- */
.empty-state-box { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 40px 20px; color: var(--text-dark); min-width: 0; }
.empty-state-icon { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; background: var(--active-bg, #e8f1f7); color: var(--primary-blue); font-size: 26px; flex: none; }
.empty-state-body { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 460px; min-width: 0; }
.empty-state-title { font-size: 17px; font-weight: 800; color: var(--text-dark); overflow-wrap: anywhere; }
.empty-state-message { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text-muted); overflow-wrap: anywhere; }
.empty-state-steps { margin: 4px 0 0; padding: 0; list-style: none; counter-reset: es; display: flex; flex-direction: column; gap: 8px; text-align: start; width: 100%; }
.empty-state-steps li { counter-increment: es; display: flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.empty-state-steps li::before { content: counter(es); flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--primary-blue); color: #fff; font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.empty-state-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin-top: 6px; }
.empty-state-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 10px; border: 1px solid var(--primary-blue); font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; transition: var(--transition, all .2s); }
.empty-state-btn-primary { background: var(--primary-blue); color: #fff; }
.empty-state-btn-primary:hover { background: var(--primary-blue-dark); color: #fff; }
.empty-state-btn:focus-visible, .empty-state-link:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary-blue) 55%, transparent); outline-offset: 2px; }
.empty-state-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: 13px; font-weight: 700; color: var(--primary-blue); text-decoration: none; }
.empty-state-link:hover { text-decoration: underline; }
.empty-state-noperm { margin: 0; font-size: 13px; color: var(--text-muted); }
.empty-state-compact { flex-direction: row; text-align: start; justify-content: center; padding: 16px 12px; gap: 12px; flex-wrap: wrap; }
.empty-state-compact .empty-state-icon { width: 40px; height: 40px; font-size: 17px; }
.empty-state-compact .empty-state-body { align-items: flex-start; gap: 4px; flex: 1 1 220px; }
.empty-state-compact .empty-state-title { font-size: 14px; }
.empty-state-compact .empty-state-message { font-size: 13px; }
.empty-state-compact .empty-state-actions { justify-content: flex-start; margin-top: 2px; gap: 8px; }
.empty-state-compact .empty-state-btn { padding: 0 14px; font-size: 13px; }
.empty-state-kind-noresults .empty-state-icon, .empty-state-kind-nodata .empty-state-icon { background: #f1f5f9; color: #64748b; }
:root[data-theme="dark"] .empty-state-box { color: #d5dde7; }
:root[data-theme="dark"] .empty-state-title { color: #f3f6fa; }
:root[data-theme="dark"] .empty-state-message, :root[data-theme="dark"] .empty-state-noperm { color: #9fb0c3; }
:root[data-theme="dark"] .empty-state-icon { background: #1f3347; color: #7db6f0; }
:root[data-theme="dark"] .empty-state-kind-noresults .empty-state-icon, :root[data-theme="dark"] .empty-state-kind-nodata .empty-state-icon { background: #2a3544; color: #b6c3d1; }
:root[data-theme="dark"] .empty-state-link { color: #7db6f0; }
@media (max-width: 575px) { .empty-state-box:not(.empty-state-compact) { padding: 28px 12px; } .empty-state-actions .empty-state-btn { flex: 1 1 100%; } }

@keyframes empty-state-in { from { opacity: 0; } to { opacity: 1; } }
.empty-state-box { animation: empty-state-in .25s ease .3s both; }
@media (prefers-reduced-motion: reduce) { .empty-state-box { animation: none; } }

/* Back arrow beside the page title (js/back-arrow.js handles the click) */
.page-module-title { cursor: default; }
.page-module-title::before { content: "\f060"; font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", FontAwesome; font-weight: 900; font-size: 18px; color: #94a3b8; margin-inline-end: 12px; cursor: pointer; display: inline-block; vertical-align: middle; transition: color .15s; }
.page-module-title:hover::before { color: var(--primary-blue); }
[dir="rtl"] .page-module-title::before { content: "\f061"; }
body.route-home .page-module-title::before { display: none; }

/* WP7 self-service password recovery link on the sign-in card */
.login-forgot-link { font-size: 13px; font-weight: 600; color: var(--primary-blue); text-decoration: none; }
.login-forgot-link:hover { text-decoration: underline; }
.login-footer-note a { color: var(--primary-blue); font-weight: 600; text-decoration: none; }
.login-footer-note a:hover { text-decoration: underline; }

/* ===== Grid action buttons = compact colour-coded icon buttons (tooltip comes from action-icons.js) ===== */
[data-ai] {
    --odb: #186493;
    font-size: 0 !important; gap: 0 !important;
    width: 34px; height: 34px; padding: 0 !important; margin-inline: 2px;
    border-radius: 10px; border: 1px solid color-mix(in srgb, var(--odb) 28%, transparent) !important;
    background: color-mix(in srgb, var(--odb) 10%, #fff) !important; color: var(--odb) !important;
    text-decoration: none; vertical-align: middle;
}
[data-ai] i, [data-ai] i[class*="fa-"] { font-size: 14px !important; margin: 0 !important; }
[data-ai]:hover:not(:disabled) {
    background: var(--odb) !important; color: #fff !important; transform: translateY(-1px);
    box-shadow: 0 4px 10px color-mix(in srgb, var(--odb) 35%, transparent);
}
[data-ai]:focus-visible { outline: 2px solid var(--odb); outline-offset: 2px; }
[data-ai="edit"] { --odb: #15803d; }
[data-ai="view"] { --odb: #186493; }
[data-ai="print"] { --odb: #475569; }
[data-ai="warn"] { --odb: #b45309; }
[data-ai="ok"] { --odb: #15803d; }
[data-ai="danger"] { --odb: #b91c1c; }
