/* ==========================================
   1. تهيئة عامة وألوان النظام (ERP Identity)
   ========================================== */
:root {
    --primary-blue: #134e73;       /* لون هوية فجن إي آر بي الأساسية */
    --primary-blue-dark: #0d3751;  /* درجة أغمق للتدرج (login page) - مشتقة حسابيًا من primary-blue */
    --primary-blue-light: #6d91a8; /* درجة فاتحة للتدرج (login page) - مزج 38% أبيض مع primary-blue */
    --accent-orange: #f59e0b;      /* لون الهوية البرتقالي الفرعي */
    --body-bg: #f8fafc;            /* خلفية هادئة للصفحة والمحتوى */
    --white: #ffffff;
    --border-color: #f1f5f9;       /* حدود ناعمة ومطابقة للصورة */
    --text-dark: #334155;          /* لون النصوص الأساسي */
    --text-muted: #94a3b8;         /* لون النصوص الثانوية الباهتة */
    --active-bg: #e8f1f7;          /* خلفية العنصر النشط - مشتقة من لون الشعار الأزرق */
    --active-icon-color: #186493;  /* لون أيقونة العنصر النشط - معاينة فعلية من ألوان شعار VISION ERP (V.png/icon-192.png)، وليس لونًا عامًا */
    --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; /* لمنع ظهور شريط تمرير لكامل الصفحة والحفاظ على ثبات اللوحة */
}

/* Global compact-icon default: any Font Awesome icon that doesn't already have a more specific
   size rule elsewhere in this file (buttons/nav/sidebar/etc. all set their own, higher-specificity
   sizes and are unaffected) renders at a smaller, consistent scale relative to its container. */
i.fa-solid, i.fa-regular, i.fa-brands {
    font-size: 0.85em;
}

/* التخطيط الهيكلي للوحة التحكم بالكامل (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: #1e293b;
    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;
}

/* اسم المنشأة بدلاً من شريط البحث في وسط الهيدر - مطابق لتصميم HR */
.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;
}

.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-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-icon-btn {
    background: none;
    border: none;
    font-size: 15px;
    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);
}

/* 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;
}

.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;
}

.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: #93c5fd;
}

.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;
}

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

/* الكارد الترحيبي */
.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";
    }

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

    /* تحويل شريط الجانب إلى قائمة منزلقة من جهة اليمين تماماً وبطريقة متوافقة */
    .sidebar-aside {
        position: fixed;
        right: -120px; /* مخفي خارج الشاشة يميناً بالتوافق مع الحجم الجديد */
        top: 70px;
        height: calc(100vh - 70px);
        width: 100px;
        z-index: 99;
        transition: var(--transition);
        box-shadow: -5px 0 15px rgba(0,0,0,0.05);
    }

    /* إظهار شريط الجانب عند التفعيل عبر زر الموبايل */
    .sidebar-aside.open {
        right: 0;
    }

    /* الخلفية المعتمة لإغلاق القائمة بالضغط الخارجي */
    .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;
    justify-content: space-between;
    align-items: center;
    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: #0e3b57;
    border-color: #0e3b57;
}

.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;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    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. Hit for real with the Journal Voucher PC/BU modal's Cost Center picker sitting near
       the modal's bottom edge - the same trap exists for any modal on any page combining a tall
       form with a SearchableSelect, not unique to that one screen. */
    margin-top: -20px;
    transition: var(--transition);
    overflow: hidden;
}

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

/* Opt-in wider modal for forms/tables that don't fit the default 500px comfortably (e.g. a
   multi-column add-row form, or a report-style table) - was already referenced via
   ExtraClass="report-modal-box" on 4 existing pages with no matching rule defined anywhere
   (a real, silent no-op bug - those modals have been rendering at the default 500px this whole
   time despite asking for this class), fixed here rather than left broken now that this modal
   needed a real wide variant too. */
.report-modal-box {
    max-width: 750px;
}

/* رأس النافذة المنبثقة */
.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: 20px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

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

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

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

.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: #0e3b57;
}

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

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

/* ==========================================
   تجاوب شريط الإجراءات والنافذة مع الشاشات الصغيرة
   ========================================== */
@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)
   ========================================== */

/* حاوية شريط التبويبات */
/* شريط التبويبات - تصميم مقسّم عصري (segmented pill bar) */
.tabs-navigation-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 25px;
    padding: 6px;
    background: linear-gradient(180deg, #f8fafc, #f1f5f9);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow-x: auto;
    scrollbar-width: none;         /* Firefox: إخفاء شريط التمرير مع الإبقاء على التمرير */
    -ms-overflow-style: none;      /* IE/Edge */
}

.tabs-navigation-bar::-webkit-scrollbar {
    display: none;                 /* Chrome/Safari: إخفاء شريط التمرير الأفقي */
}

/* أزرار التبويبات الفردية - شكل حبة (pill) */
.tab-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    background: none;
    border: none;
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    border-radius: 10px;
    transition: var(--transition);
}

.tab-link-btn i {
    font-size: 13px;
    opacity: 0.85;
}

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

/* حالة التبويب النشط - خلفية زرقاء ممتلئة بدل الخط التحتي */
.tab-link-btn.active {
    color: #fff;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-light));
    box-shadow: 0 5px 12px rgba(19, 78, 115, 0.28);
}

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

/* ألواح التبويبات (مخفية افتراضياً وتظهر عند إضافة 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); }
}

/* ==========================================
   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;
}

/* الهيدر الأزرق الموحد للجداول والفورم */
.table-card-header {
    /* Light bar: the old solid fill colour is now the bottom border; title in the primary colour. */
    position: relative;
    background-color: 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;
}

/* Yellow accent edge at the start side of the header - identical to HR (same soft yellow, hard-coded so
   ERP's own --accent-orange used elsewhere stays untouched). */
.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;
}

/* Fast, Excel-like line-entry grids (Journal Voucher and similar multi-line documents) - tighter
   row height than the default table so many lines fit on screen and entry feels dense/quick,
   matching the explicit "fast as excel" requirement rather than the roomier list-page padding. */
.erp-fast-entry-table th,
.erp-fast-entry-table td {
    padding: 6px 8px;
    font-size: 12.5px;
}

.erp-fast-entry-table .form-control,
.erp-fast-entry-table .searchable-select input {
    padding: 6px 8px;
    font-size: 12.5px;
    min-height: 32px;
}

/* Journal Voucher - quick entry: one Party picker over every party type; the type is a small muted tag beside the name. */
.quick-party-cell { display: flex; align-items: center; gap: 6px; }
.quick-party-cell .searchable-select { flex: 1 1 auto; min-width: 0; }
.quick-party-type { font-size: 10.5px; color: var(--text-muted, #64748b); background: #eef2f7; border-radius: 999px; padding: 1px 7px; white-space: nowrap; flex: 0 0 auto; line-height: 1.5; }
.autocomplete-item .quick-party-type { margin-inline-start: 6px; }
.quick-party-chosen { max-width: 40%; overflow: hidden; text-overflow: ellipsis; }

.line-type-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.line-type-pill.dr {
    background: #dcfce7;
    color: #166534;
}

.line-type-pill.cr {
    background: #e0e7ff;
    color: #3730a3;
}

/* الروابط والنصوص المميزة بداخل الجدول */
.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 {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
}

.table-action-btn-red { color: #f87171; }
.table-action-btn-red:hover { color: #ef4444; }

.table-action-btn-gold { color: #fbbf24; }
.table-action-btn-gold:hover { color: #f59e0b; }

.table-action-btn-blue { color: var(--primary-blue); }
.table-action-btn-blue:hover { color: #2563eb; }


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

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

.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(19, 78, 115, 0.15);
}

/* الحاوية الأساسية لأزرار الفورم - محاذاة نهاية السطر (يمين بالإنجليزية، يسار بالعربية).
   Uses justify-content, not a margin, so the flex spec resolves the direction against the
   container's own dir automatically - a margin-based approach here has no sibling to push
   against (this container isn't itself a flex item), so it silently does nothing. See CLAUDE.md's
   own documented HR fix for this exact trap. */
.form-actions-left {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* أزرار الفورم */
.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);
    /* Default fill for every .erp-form-btn that doesn't opt into one of the specific variants
       below (.btn-dark-blue/.btn-coral/.btn-green/.btn-outline...) - previously unstyled (no
       background at all, just the browser default), which is why plain Search/Save buttons across
       several screens rendered as a flat gray bar instead of a real button. Light blue reuses this
       app's own existing accent color (--active-icon-color, already used for the sidebar's active
       nav icon) rather than inventing a new one, matching the "I prefer light blue" direction. */
    background-color: var(--active-icon-color);
    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-outline):not(.btn-outline-danger):hover {
    background-color: #2563eb;
}

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

.erp-form-btn.btn-coral {
    background-color: #ff5a5a; /* لون المرجان/الأحمر الفاتح من الصورة */
}
.erp-form-btn.btn-coral:hover {
    background-color: #e04444;
}

.erp-form-btn.btn-green {
    background-color: #10b981; /* لون الحفظ الأخضر */
}
.erp-form-btn.btn-green:hover {
    background-color: #059669;
}


/* ==========================================
   التجاوب مع شاشات الموبايل
   ========================================== */
@media (max-width: 768px) {
    .tabs-navigation-bar {
        overflow-x: auto; /* تمكين التمرير الأفقي للتبويبات على الموبايل لعدم تداخلها */
        white-space: nowrap;
        gap: 6px;
    }
    
    .form-inputs-row {
        grid-template-columns: 1fr; /* جعل حقول الإدخال تحت بعضها على الهواتف */
        gap: 15px;
    }
    
    .form-actions-left {
        width: 100%;
        justify-content: space-between; /* تمدد متوازن للأزرار على الموبايل */
    }
    
    .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. Org name in the mobile slide-in menu (not the desktop top navbar) - matches the
   established cross-app convention (CRM/HR). Also makes the mobile sidebar slide in from the
   correct edge for the active text direction (right for RTL, left for LTR).
   ========================================== */
.sidebar-org-name {
    display: none;
}

@media (max-width: 991px) {
    .sidebar-aside {
        position: fixed;
        top: 70px;
        height: calc(100vh - 70px);
        width: 220px;
        z-index: 99;
        transition: var(--transition);
    }

    .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;
    }

    .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-nav-list {
        align-items: stretch;
    }

    .sidebar-item {
        flex-direction: row;
        width: 100%;
        justify-content: flex-start;
        padding: 8px 16px;
        gap: 12px;
    }

    .item-label {
        font-size: 13px;
    }
}

/* ==========================================
   15. Shared component styling carried over from the app shell (toasts, global loading
   overlay, SearchableSelect autocomplete, confirm-dialog specifics) - these components are
   reused across every module and aren't part of the new visual mockup, but must keep working.
   ========================================== */
.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); }
}

/* ==========================================================================
   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(19, 78, 115, 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%); }
@keyframes sk-shimmer { 100% { transform: translateX(100%); } }
[dir="rtl"] .sk::after { animation-name: sk-shimmer-rtl; }
@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; }
}

.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: 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;
}

/* ConfirmDialog.razor's extra classes on top of the shared .modal-overlay/.modal-box chrome */
.confirm-dialog-box {
    max-width: 420px;
}

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

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

.modal-btn.btn-danger {
    background-color: #9c1f3f;
    color: var(--white);
    border: none;
}

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

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

/* ==========================================
   16. Chart of Accounts tree (Finance) - carried over verbatim from the previous pass.
   ========================================== */
.act-coa-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 16px;
    align-items: start;
}

@media (max-width: 900px) {
    .act-coa-layout {
        grid-template-columns: 1fr;
    }
}

.act-tree-panel {
    max-height: 70vh;
    overflow-y: auto;
}

.act-tree-node {
    font-size: 13.5px;
}

.act-tree-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 6px;
    border-radius: 6px;
    cursor: default;
}

.act-tree-row.active {
    background-color: var(--active-bg);
}

.act-tree-toggle {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    border: none;
    background: none;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.act-tree-toggle:disabled {
    visibility: hidden;
}

.act-tree-code {
    font-family: monospace;
    color: var(--text-muted);
    flex-shrink: 0;
}

.act-tree-name {
    flex: 1;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.act-tree-add-btn {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border: none;
    background: none;
    color: var(--primary-blue);
    opacity: 0.6;
    cursor: pointer;
}

.act-tree-add-btn:hover {
    opacity: 1;
}

/* Shared search/filter toolbar - a light row sitting BELOW a .table-card-header (which stays a
   clean dark title bar with only a title + primary "+Add" action), instead of cramming a search
   input and several buttons into the dark header itself. Used by the Chart of Accounts tree
   toolbar and every Finance dashboard tab widget (previously each had its search box and action
   buttons stuffed inline in the dark header - moved out per explicit request). Logical
   (inline-start/end) properties throughout so the layout mirrors correctly in RTL and LTR without
   any [dir="rtl"] override. */
.erp-search-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
    background-color: var(--white);
    border-bottom: 1px solid var(--border-color);
}

.erp-search-toolbar-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.erp-search-box {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 180px;
    max-width: 320px;
}

.erp-search-box .form-control {
    width: 100%;
    padding-inline-end: 36px;
}

.erp-search-icon {
    position: absolute;
    inset-inline-end: 12px;
    color: var(--text-muted);
    font-size: 13px;
    pointer-events: none;
}

@media (max-width: 576px) {
    .erp-search-box {
        max-width: none;
        width: 100%;
    }
}

.act-tree-children {
    padding-inline-start: 20px;
    border-inline-start: 1px dashed var(--border-color);
    margin-inline-start: 9px;
}

/* Initials-circle avatar fallback (no user-photo upload exists yet) - same box as .avatar-img */
.avatar-initials {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--primary-blue);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

/* Outline button variants used by several CRUD screens (New/Cancel/Delete-outline actions) -
   not part of the original mockup's 3 solid variants (dark-blue/coral/green). */
.erp-form-btn.btn-outline {
    background-color: var(--white);
    color: var(--primary-blue);
    border: 1px solid #cbd5e1;
}
.erp-form-btn.btn-outline:hover {
    background-color: var(--active-bg);
    border-color: var(--primary-blue);
}

.erp-form-btn.btn-outline-danger {
    background-color: var(--white);
    color: #dc2626;
    border: 1px solid #fecaca;
}
.erp-form-btn.btn-outline-danger:hover {
    background-color: #fef2f2;
    border-color: #dc2626;
}

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

/* Click-toggled state for .more-dropdown-menu (FavoritesBar.razor) - the container's own
   :hover rule still works as a bonus on desktop, but this class is the primary mechanism since
   hover doesn't work on touch/mobile. */
.more-dropdown-menu.show-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* The "More" list can hold dozens of screens: cap its height and scroll inside it (touch-friendly,
   direction-aware - opens toward the reading direction so it never runs off the screen in RTL or LTR). */
.more-dropdown-menu {
    right: auto;
    inset-inline-start: 0;
    width: min(260px, calc(100vw - 32px));
    max-height: min(60vh, 420px);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.more-dropdown-menu .dropdown-menu-item {
    min-height: 44px;
    text-align: start;
}
.more-dropdown-menu .dropdown-menu-item span { overflow-wrap: anywhere; }

/* ==========================================
   Login Page - ported verbatim from HR/wwwroot/css/dashboard.css so ERP's login screen
   matches HR's design exactly (per explicit user direction) - HR is itself the one that
   established this two-pane visual/form layout for the product suite.
   ========================================== */
.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;
}

.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);
}

/* 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);
}

.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);
}

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

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

/* ==========================================
   General Settings landing - modern icon-card grid
   (used by ERP/Pages/GeneralSettingsPages/GeneralSettingsPage.razor; the per-card
   accent color is passed inline as --gs-accent, everything else is uniform)
   ========================================== */
.gs-page-head {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.gs-head-icon {
    width: 54px;
    height: 54px;
    flex-shrink: 0;
    border-radius: 15px;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-light));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 8px 18px rgba(19, 78, 115, 0.28);
}

.gs-head-text h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.gs-head-text p {
    margin: 3px 0 0;
    color: var(--text-muted);
    font-size: 13.5px;
}

.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 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 4px;
}

.gs-card-desc {
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

.gs-card-count {
    display: inline-block;
    margin-top: 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--gs-accent, var(--primary-blue));
    background: color-mix(in srgb, var(--gs-accent, var(--primary-blue)) 10%, #fff);
    padding: 2px 9px;
    border-radius: 20px;
}

.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 landing grid (grouped icon cards)
   ========================================== */
.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;
}

/* ==========================================
   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;
}

/* ==========================================
   Home dashboard - organization & employee info cards
   ========================================== */
.home-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: 20px;
    margin-top: 8px;
}

.home-info-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.home-info-card-head {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(19, 78, 115, 0.05), transparent);
}

.home-info-logo {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    border-radius: 14px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 6px;
}

.home-info-avatar {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-light));
    box-shadow: 0 6px 14px rgba(19, 78, 115, 0.25);
}

.home-info-headtext {
    min-width: 0;
}

.home-info-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
}

.home-info-subtitle {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 3px;
}

.home-info-body {
    padding: 6px 20px 14px;
}

.home-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px dashed var(--border-color);
}

.home-info-row:last-child {
    border-bottom: none;
}

.home-info-label {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.home-info-label i {
    width: 16px;
    text-align: center;
    color: var(--primary-blue);
    font-size: 13px;
}

.home-info-value {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-dark);
    text-align: end;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Empty/null field: "disabled" look, per request */
.home-info-row.disabled {
    opacity: 0.55;
}

.home-info-row.disabled .home-info-label i {
    color: var(--text-muted);
}

.home-info-row.disabled .home-info-value {
    font-weight: 600;
    color: var(--text-muted);
}

.home-info-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 30px 20px;
    color: var(--text-muted);
    font-size: 13.5px;
}

.home-info-empty i {
    color: var(--text-muted);
}

/* ==========================================================================
   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; }
}


/* 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;
}

/* ==========================================================================
   Form sections (ERP/Shared/FormSection.razor) - a data-entry form is split into titled blocks ordered by the flow of the
   user's choices. The grid auto-fits (no per-page column counts), so it reflows on tablets/phones by itself.
   ========================================================================== */
.form-sections { display: flex; flex-direction: column; gap: 2px; padding: 8px 16px 12px; }
/* compact: no card/header bar per section - just a slim label with a divider line, so long forms stay short */
.doc-section { background: none; border: 0; box-shadow: none; }
.ds-label { display: flex; align-items: center; gap: 10px; margin: 10px 0 6px; font-size: 12px; font-weight: 700; color: var(--primary-blue); }
.doc-section:first-child > .ds-label { margin-top: 2px; }
.ds-title { white-space: nowrap; }
.ds-line { flex: 1; height: 1px; background: #e2e8f0; }
.ds-extra { display: inline-flex; align-items: center; gap: 8px; }
.ds-chevron { font-size: 10px; color: #94a3b8; transition: transform .15s ease; }
.doc-section.is-collapsible .ds-label { cursor: pointer; user-select: none; }
.doc-section.is-collapsed .ds-chevron { transform: rotate(-90deg); }
.doc-section.is-collapsed .ds-label { margin-bottom: 0; }
.fs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 4px 12px; }
.fs-grid > .fs-wide { grid-column: 1 / -1; }
.fs-grid > .form-input-group { margin-bottom: 4px; min-width: 0; }
.fs-grid > .form-input-group > label { font-size: 12px; margin-bottom: 3px; }
.fs-grid .form-control:not(textarea) { min-height: 34px; height: 34px; padding-top: 4px; padding-bottom: 4px; font-size: 13px; }
/* a read-only value the system fills in (e.g. the customer's VAT number) reads as a value, not an empty input */
.fs-grid .form-control[readonly] { background: #f8fafc; color: #334155; }
/* a checkbox + its label as one clickable unit, bottom-aligned with the inputs beside it */
.fs-grid > .fs-check-cell { justify-content: flex-end; }
.fs-check { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; min-height: 34px; font-weight: 600; font-size: 13px; color: #334155; cursor: pointer; }
.fs-check input[type="checkbox"] { width: 16px; height: 16px; flex: none; margin: 0; accent-color: var(--primary-blue); }
@media (max-width: 576px) { .form-sections { padding: 6px 10px 10px; } }

/* ==========================================================================
   Document reports (ERP/Shared/ReportViewer.razor) - 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; }
/* FinanceCompletion track: row kinds from ReportTable.RowKinds (balance sheet sections / totals / indented detail) */
.rpt-table tr.rpt-row-section td { font-weight: 700; background: #dfeaf3; color: var(--primary-blue); }
.rpt-table tr.rpt-row-total td { font-weight: 700; background: #eef3f8; border-top: 1.5px solid var(--primary-blue); }
.rpt-table tr.rpt-row-sub td:first-child { padding-inline-start: 26px; color: #64748b; }
.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; } }

/* ==========================================================================
   Mobile shell fix (<= 991px). The single grid column was `1fr` (= minmax(auto, 1fr)), which never shrinks below its
   content, so any wide child stretched the WHOLE shell past the phone width: the dim overlay covered only part of the
   screen, the bell/avatar were pushed off the header and the page could pan sideways. Same "grid blowout" as HR/CRM.
   minmax(0, 1fr) + min-width:0 lets every track/flex item shrink; wide tables scroll inside their own wrappers.
   ========================================================================== */
@media (max-width: 991px) {
    .dashboard-layout {
        grid-template-columns: minmax(0, 1fr);
        width: 100%; max-width: 100%;
        height: 100vh; height: 100dvh;
        overflow: hidden;
    }
    .top-navbar, .navbar-right, .navbar-center, .navbar-left, .main-page-content { min-width: 0; }
    .top-navbar { padding-inline: 10px; gap: 6px; }
    .main-page-content { padding: 14px 12px 24px; overflow-x: hidden; }
    .main-page-content .container-fluid { padding-inline: 0; }

    /* header: logo smaller, long org names truncate instead of pushing the bell/avatar off-screen */
    .logo-area img { width: 72px !important; }
    .navbar-center { flex: 1 1 0; margin: 0 6px; overflow: hidden; }
    .navbar-org-name, .org-switcher-btn span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
    .org-switcher, .org-switcher-btn { max-width: 100%; }
    .navbar-left { flex: 0 0 auto; gap: 6px; }
    .username { display: none; }

    /* drawer + overlay always span the real visible area, whatever the browser's address bar is doing */
    .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); width: min(260px, 82vw); }
    .dashboard-layout[dir="rtl"] .sidebar-aside { right: calc(-1 * min(280px, 90vw)); }
    .dashboard-layout[dir="ltr"] .sidebar-aside { left: calc(-1 * min(280px, 90vw)); }
    .dashboard-layout[dir="rtl"] .sidebar-aside.open { right: 0; }
    .dashboard-layout[dir="ltr"] .sidebar-aside.open { left: 0; }

    /* wide tables/grids scroll inside their card, never the page */
    .table-card { max-width: 100%; }
    .table-responsive-wrapper { max-width: 100%; }
}

/* ==========================================
   SmallFeatures track - ERP notification bell (ERP/Shared/NotificationBell.razor)
   ========================================== */
.notif-wrap { position: relative; display: inline-flex; }
.notification-btn .badge.notif-badge { width: auto; min-width: 17px; padding: 0 4px; border-radius: 9px; line-height: 1; }
.notif-menu {
    position: absolute;
    top: 48px;
    inset-inline-end: -6px;
    width: 360px;
    max-width: calc(100vw - 24px);
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
    padding: 6px 0 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.2s ease-in-out;
    z-index: 500;
}
.notif-menu.show-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 8px; font-size: 14px; font-weight: 700; color: var(--text-dark); border-bottom: 1px solid var(--border-color); }
.notif-refresh { background: none; border: 0; color: var(--text-muted); cursor: pointer; width: 28px; height: 28px; border-radius: 50%; }
.notif-refresh:hover:not(:disabled) { background: var(--active-bg); color: var(--primary-blue); }
.notif-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 16px; color: var(--text-muted); font-size: 13px; text-align: center; }
.notif-empty i { font-size: 26px; color: #16a34a; }
.notif-list { max-height: min(420px, 70vh); overflow-y: auto; }
.notif-group { padding: 10px 14px 4px; font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--text-muted); }
.notif-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; text-decoration: none; color: var(--text-dark); font-size: 13px; transition: var(--transition); }
.notif-item:hover { background: var(--active-bg); color: var(--primary-blue); }
.notif-icon { width: 22px; text-align: center; color: var(--primary-blue); font-size: 14px; }
.notif-item.warn .notif-icon { color: #d97706; }
.notif-text { flex: 1; line-height: 1.35; }
.notif-count { min-width: 28px; text-align: center; padding: 2px 8px; border-radius: 12px; background: var(--active-bg); color: var(--primary-blue); font-weight: 700; font-size: 12px; }
.notif-item.warn .notif-count { background: #fef3c7; color: #b45309; }
@media (max-width: 520px) {
    .notif-wrap { position: static; }
    .notif-menu { position: fixed; top: 64px; inset-inline: 12px; width: auto; max-width: none; }
}

/* ==========================================================================
   Module dashboards (.mdash-*) - hero KPI row, chart panels, recommendations.
   Shared by every ERP module root page (see docs/plan/MODULE_DASHBOARD_GUIDE.md).
   Tokens fall back to the app palette; chart colours are the colour-blind-safe
   categorical slots 1-6 (blue, orange, aqua, yellow, magenta, green).
   Logical properties everywhere so LTR/RTL mirror; min-width:0 on every grid/flex
   child (grid blowout); numbers are rendered dir=ltr and invariant-formatted.
   ========================================================================== */
.mdash {
    --md-surface: var(--white, #fff);
    --md-surface-2: #f4f7fa;
    --md-border: #e3e9f0;
    --md-text: var(--text-dark, #334155);
    --md-strong: #0f2a3d;
    --md-muted: #64748b;
    --md-brand: var(--primary-blue, #134e73);
    --md-good: #15803d;  --md-good-bg: #dcfce7;
    --md-bad: #b91c1c;   --md-bad-bg: #fee2e2;
    --md-warn: #b45309;  --md-warn-bg: #fef3c7;
    --md-info: #1d5fa8;  --md-info-bg: #e3effb;
    --md-flat: #475569;  --md-flat-bg: #eef2f6;
    --md-c1: #2a78d6; --md-c2: #eb6834; --md-c3: #1baf7a; --md-c4: #eda100; --md-c5: #e87ba4; --md-c6: #008300;
    display: grid;
    gap: 16px;
    margin: 12px 0 16px;
    min-width: 0;
    max-width: 100%;
}
:root[data-theme="dark"] .mdash {
    --md-surface: #1b2430; --md-surface-2: #222d3b; --md-border: #2f3b4b; --md-text: #d5dde7; --md-strong: #f3f6fa; --md-muted: #9fb0c3;
    --md-good: #4ade80; --md-good-bg: #12351f; --md-bad: #f87171; --md-bad-bg: #3a1717; --md-warn: #fbbf24; --md-warn-bg: #3a2a0c; --md-info: #7db6f0; --md-info-bg: #14283f;
    --md-flat: #b6c3d1; --md-flat-bg: #2a3544;
    --md-c1: #3987e5; --md-c2: #d95926; --md-c3: #199e70; --md-c4: #c98500; --md-c5: #d55181; --md-c6: #3aa13a;
}
.mdash > * { min-width: 0; }

/* ---------- toolbar ---------- */
.mdash-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mdash-overview { font-size: 15px; font-weight: 800; color: var(--md-strong); margin: 0; }
.mdash-toolbar-end { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.mdash-updated { font-size: 12px; color: var(--md-muted); display: inline-flex; gap: 6px; align-items: center; }
.mdash-chip { background: var(--md-flat-bg); color: var(--md-flat); border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 700; }
.mdash-refresh {
    display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px;
    border: 1px solid var(--md-border); border-radius: 10px; background: var(--md-surface); color: var(--md-brand);
    font-weight: 700; font-size: 13px; cursor: pointer; transition: var(--transition, all .2s);
}
.mdash-refresh:hover:not(:disabled) { background: var(--active-bg, #e8f1f7); }
.mdash-refresh:disabled { opacity: .6; cursor: progress; }
.mdash-refresh:focus-visible, .mdash-retry:focus-visible, .mdash-recent-toggle:focus-visible, .mdash-kpi:focus-visible, .mdash-rec-action:focus-visible, .mdash-stat:focus-visible, .mdash-card-link:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--md-brand) 55%, transparent); outline-offset: 2px;
}

/* ---------- hero KPI row ---------- */
.mdash-kpi-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 720px)  { .mdash-kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .mdash-kpi-row { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

.mdash-kpi {
    position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; overflow: hidden;
    padding: 14px 14px 12px; background: var(--md-surface); border: 1px solid var(--md-border); border-radius: 14px;
    text-decoration: none; color: var(--md-text); box-shadow: 0 1px 2px rgba(15, 42, 61, .04);
    transition: box-shadow .2s, transform .2s, border-color .2s;
}
.mdash-kpi:hover { box-shadow: 0 6px 18px rgba(15, 42, 61, .10); transform: translateY(-1px); border-color: color-mix(in srgb, var(--md-brand) 35%, var(--md-border)); color: var(--md-text); }
.mdash-kpi.is-warn { border-inline-start: 4px solid var(--md-warn); }
.mdash-kpi.is-crit { border-inline-start: 4px solid var(--md-bad); }
.mdash-kpi-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mdash-kpi-icon { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--active-bg, #e8f1f7); color: var(--md-brand); font-size: 13px; }
.mdash-kpi-label { font-size: 12.5px; font-weight: 700; color: var(--md-muted); line-height: 1.25; min-width: 0; overflow-wrap: anywhere; }
.mdash-kpi-value { display: flex; align-items: baseline; gap: 5px; flex-wrap: wrap; justify-content: flex-start; }
[dir="rtl"] .mdash-kpi-value { justify-content: flex-end; }
.mdash-num { font-size: clamp(20px, 1.9vw, 26px); font-weight: 800; color: var(--md-strong); letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.1; overflow-wrap: anywhere; }
.mdash-cur { font-size: 11px; font-weight: 700; color: var(--md-muted); }
.mdash-kpi-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 20px; }
.mdash-delta { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.mdash-delta i { font-size: 10px; }
.mdash-delta.is-good { background: var(--md-good-bg); color: var(--md-good); }
.mdash-delta.is-bad  { background: var(--md-bad-bg);  color: var(--md-bad); }
.mdash-delta.is-flat { background: var(--md-flat-bg); color: var(--md-flat); }
.mdash-delta-label { font-size: 11px; color: var(--md-muted); min-width: 0; }
.mdash-kpi-sub { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--md-muted); border-top: 1px dashed var(--md-border); padding-top: 6px; flex-wrap: wrap; }
.mdash-kpi-sub b { color: var(--md-strong); font-variant-numeric: tabular-nums; }
.mdash-spark { width: 100%; height: 28px; display: block; margin-top: 2px; }
.mdash-spark-line { fill: none; stroke: var(--md-c1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.mdash-spark-area { fill: color-mix(in srgb, var(--md-c1) 12%, transparent); stroke: none; }

/* ---------- panel grid + cards ---------- */
.mdash-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 760px)  { .mdash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .mdash-panel.is-wide { grid-column: span 2; } }
@media (min-width: 1180px) { .mdash-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.mdash-card { background: var(--md-surface); border: 1px solid var(--md-border); border-radius: 14px; padding: 14px; min-width: 0; box-shadow: 0 1px 2px rgba(15, 42, 61, .04); }
.mdash-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; min-width: 0; }
.mdash-card-head h2 { font-size: 14px; font-weight: 800; color: var(--md-strong); margin: 0; line-height: 1.3; }
.mdash-card-head h2 i { color: var(--md-warn); margin-inline-end: 6px; }
.mdash-card-titles { display: grid; gap: 2px; min-width: 0; }
.mdash-card-sub { font-size: 11.5px; color: var(--md-muted); }
.mdash-card-link { font-size: 12px; font-weight: 700; color: var(--md-brand); text-decoration: none; white-space: nowrap; padding: 6px 4px; }
.mdash-card-link:hover { text-decoration: underline; }
.mdash-card-body { min-width: 0; }
.mdash-count { background: var(--md-brand); color: #fff; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 800; }
.mdash-empty { display: flex; align-items: center; gap: 8px; color: var(--md-muted); font-size: 13px; padding: 18px 4px; }

/* colour slots (swatch / line / dot / area / fill / donut segment) */
.mdash .c1 { --md-slot: var(--md-c1); } .mdash .c2 { --md-slot: var(--md-c2); } .mdash .c3 { --md-slot: var(--md-c3); }
.mdash .c4 { --md-slot: var(--md-c4); } .mdash .c5 { --md-slot: var(--md-c5); } .mdash .c6 { --md-slot: var(--md-c6); } .mdash .c7 { --md-slot: #8a94a3; }
.mdash-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--md-slot); flex: 0 0 auto; }

/* ---------- trend chart ---------- */
.mdash-trend { display: grid; gap: 8px; min-width: 0; }
.mdash-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--md-text); }
.mdash-legend-item { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.mdash-legend-item b { color: var(--md-strong); font-variant-numeric: tabular-nums; }
.mdash-chart-wrap { position: relative; min-width: 0; }
.mdash-svg { width: 100%; height: auto; display: block; overflow: visible; max-height: 300px; }
.mdash-grid-line { stroke: var(--md-border); stroke-width: 1; }
.mdash-grid-line.is-zero { stroke: color-mix(in srgb, var(--md-muted) 55%, transparent); }
.mdash-axis { fill: var(--md-muted); font-size: 11px; font-family: inherit; }
.mdash-line { fill: none; stroke: var(--md-slot); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.mdash-area { fill: color-mix(in srgb, var(--md-slot) 11%, transparent); stroke: none; }
.mdash-dot { fill: var(--md-slot); stroke: var(--md-surface); stroke-width: 2; }
.mdash-cross { stroke: var(--md-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.mdash-hit { fill: transparent; pointer-events: all; cursor: crosshair; }
.mdash-tip {
    position: absolute; top: 0; transform: translateX(-50%); z-index: 3; pointer-events: none;
    min-width: 150px; max-width: 80%; padding: 8px 10px; border-radius: 10px; background: var(--md-strong); color: #fff;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .22); font-size: 12px;
}
.mdash-tip-title { font-weight: 800; margin-bottom: 4px; }
.mdash-tip-row { display: flex; align-items: center; gap: 6px; }
.mdash-tip-row span { flex: 1 1 auto; min-width: 0; }
.mdash-tip-row b { font-variant-numeric: tabular-nums; }
.mdash-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- bars + top list ---------- */
.mdash-bars, .mdash-toplist { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.mdash-bar-head, .mdash-top-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-width: 0; }
.mdash-bar-label, .mdash-top-name { font-size: 13px; color: var(--md-text); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mdash-bar-value, .mdash-top-value { font-size: 13px; color: var(--md-strong); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.mdash-bar-track { height: 8px; background: var(--md-surface-2); border-radius: 999px; overflow: hidden; margin-top: 5px; }
.mdash-bar-fill { height: 100%; background: var(--md-slot, var(--md-c1)); border-radius: 999px; min-width: 3px; transition: width .5s ease; }
.mdash-top-row { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.mdash-top-main { flex: 1 1 auto; min-width: 0; }
.mdash-rank { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--active-bg, #e8f1f7); color: var(--md-brand); font-size: 12px; font-weight: 800; }
.mdash-top-sub { font-size: 11.5px; color: var(--md-muted); min-height: 14px; }

/* ---------- donut ---------- */
.mdash-donut-wrap { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-width: 0; }
.mdash-donut { width: 136px; height: 136px; flex: 0 0 auto; }
.mdash-donut-bg { stroke: var(--md-surface-2); }
.mdash-donut-seg { stroke: var(--md-slot); }
.mdash-donut-total { font-size: 15px; font-weight: 800; fill: var(--md-strong); font-family: inherit; }
.mdash-donut-cap { font-size: 9px; fill: var(--md-muted); font-family: inherit; }
.mdash-donut-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; flex: 1 1 150px; min-width: 0; font-size: 12.5px; }
.mdash-donut-legend li { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mdash-legend-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mdash-donut-legend b { color: var(--md-strong); font-variant-numeric: tabular-nums; }
.mdash-legend-pct { color: var(--md-muted); min-width: 40px; text-align: end; font-variant-numeric: tabular-nums; }

/* ---------- stat grid ---------- */
.mdash-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mdash-stat { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--md-surface-2); border: 1px solid transparent; text-decoration: none; color: var(--md-text); min-width: 0; }
a.mdash-stat[href]:not([href="#"]):hover { border-color: var(--md-border); background: var(--md-surface); }
.mdash-stat-value { font-size: 22px; font-weight: 800; color: var(--md-strong); font-variant-numeric: tabular-nums; line-height: 1.1; }
.mdash-stat-label { font-size: 12px; color: var(--md-muted); font-weight: 600; overflow-wrap: anywhere; }
.mdash-stat-sev { font-size: 11px; font-weight: 800; display: inline-flex; gap: 4px; align-items: center; color: var(--md-good); }
.mdash-stat.is-warning .mdash-stat-sev { color: var(--md-warn); } .mdash-stat.is-warning { background: var(--md-warn-bg); }
.mdash-stat.is-critical .mdash-stat-sev { color: var(--md-bad); }  .mdash-stat.is-critical { background: var(--md-bad-bg); }

/* ---------- recommendations ---------- */
.mdash-rec-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mdash-rec { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--md-surface-2); border-inline-start: 4px solid var(--md-info); min-width: 0; }
.mdash-rec.is-warning  { border-inline-start-color: var(--md-warn); }
.mdash-rec.is-critical { border-inline-start-color: var(--md-bad); }
.mdash-rec-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 15px; background: var(--md-info-bg); color: var(--md-info); }
.mdash-rec.is-warning .mdash-rec-icon  { background: var(--md-warn-bg); color: var(--md-warn); }
.mdash-rec.is-critical .mdash-rec-icon { background: var(--md-bad-bg);  color: var(--md-bad); }
.mdash-rec-body { min-width: 0; }
.mdash-rec-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mdash-rec-title b { color: var(--md-strong); font-size: 14px; }
.mdash-rec-sev { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--md-info); }
.mdash-rec.is-warning .mdash-rec-sev  { color: var(--md-warn); }
.mdash-rec.is-critical .mdash-rec-sev { color: var(--md-bad); }
.mdash-rec-body p { margin: 2px 0 0; font-size: 13px; color: var(--md-text); line-height: 1.45; overflow-wrap: anywhere; }
.mdash-rec-action { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 10px; background: var(--md-brand); color: #fff; font-weight: 700; font-size: 13px; text-decoration: none; white-space: nowrap; }
.mdash-rec-action:hover { filter: brightness(1.12); color: #fff; }
.mdash-allclear { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--md-good-bg); color: var(--md-good); }
.mdash-allclear i { font-size: 22px; }
.mdash-allclear div { display: grid; }
.mdash-allclear span { color: var(--md-text); font-size: 13px; }
@media (max-width: 640px) {
    .mdash-rec { grid-template-columns: auto minmax(0, 1fr); }
    .mdash-rec-action { grid-column: 1 / -1; width: 100%; }
}

/* ---------- loading / error / note ---------- */
.mdash-skel { display: grid; gap: 12px; }
.mdash-skel-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px)  { .mdash-skel-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .mdash-skel-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.mdash-skel-panels { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px)  { .mdash-skel-panels { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .mdash-skel-panels { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.mdash-skel-card { display: grid; gap: 10px; padding: 16px; background: var(--md-surface, #fff); border: 1px solid var(--md-border, #e3e9f0); border-radius: 14px; min-width: 0; }
.mdash-skel-panels .mdash-skel-card { min-height: 170px; }
.mdash-skel-big { height: 26px; }
.mdash-error { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; background: var(--md-bad-bg, #fee2e2); color: var(--md-bad, #b91c1c); font-weight: 600; font-size: 13px; }
.mdash-retry { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid currentColor; background: transparent; color: inherit; font-weight: 700; cursor: pointer; margin-inline-start: auto; }
.mdash-note { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--md-surface-2, #f4f7fa); color: var(--md-muted, #64748b); font-size: 13px; }

/* ---------- lazy "Recent records" ---------- */
.mdash-recent { padding: 0; overflow: hidden; margin-bottom: 16px; }
.mdash-recent-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 0 16px; background: transparent; border: 0; cursor: pointer; color: var(--md-strong, #0f2a3d); font-weight: 800; font-size: 14px; font-family: inherit; }
.mdash-recent-title i { color: var(--md-brand, #134e73); margin-inline-end: 8px; }
.mdash-chevron { transition: transform .2s; }
.mdash-chevron.is-open { transform: rotate(180deg); }
.mdash-recent-body { padding: 0 12px 12px; min-width: 0; }
.mdash-recent-body[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
    .mdash *, .mdash-skel * { transition: none !important; animation: none !important; }
}


/* ==========================================================================
   Home page "My modules" row (ERP/Shared/HomeModuleCards.razor) - reuses the .mdash tokens
   ========================================================================== */
.mhome { margin: 4px 0 16px; }
.mhome-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 720px)  { .mhome-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .mhome-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.mhome-card {
    display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 96px; padding: 12px;
    background: var(--md-surface); border: 1px solid var(--md-border); border-radius: 14px; text-decoration: none; color: var(--md-text);
    box-shadow: 0 1px 2px rgba(15, 42, 61, .04); transition: box-shadow .2s, transform .2s, border-color .2s;
}
.mhome-card:hover { box-shadow: 0 6px 18px rgba(15, 42, 61, .10); transform: translateY(-1px); border-color: color-mix(in srgb, var(--md-brand) 35%, var(--md-border)); color: var(--md-text); }
.mhome-card:focus-visible { outline: 3px solid color-mix(in srgb, var(--md-brand) 55%, transparent); outline-offset: 2px; }
.mhome-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mhome-title { flex: 1 1 auto; min-width: 0; font-size: 13.5px; font-weight: 800; color: var(--md-strong); overflow-wrap: anywhere; line-height: 1.25; }
.mhome-go { flex: 0 0 auto; font-size: 11px; color: var(--md-muted); }
.mhome-nums { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mhome-num { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; flex-wrap: wrap; }
.mhome-num-label { font-size: 11.5px; color: var(--md-muted); min-width: 0; overflow-wrap: anywhere; }
.mhome-num-value { font-size: 15px; font-weight: 800; color: var(--md-strong); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.mhome-num.is-warn .mhome-num-value { color: var(--md-warn); }
.mhome-num.is-crit .mhome-num-value { color: var(--md-bad); }

@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; } }

/* "Coming soon" marker on sidebar entries for modules that are not built yet */
.item-soon-badge { display: inline-block; margin-top: 2px; padding: 0 6px; border-radius: 999px; font-size: 9.5px; line-height: 15px; font-weight: 700; background: var(--accent-orange, #f4a259); color: #fff; }

/* 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; }

/* ===== In-app help (HelpRouteButton / HelpButton / HelpModal) - same block as HR ===== */
/* 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;
}

/* ===== 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; }
