/*
   =================================================
   Aboughaly Plastic Industries - Premium UI
   =================================================
*/

/* Force all numerals across all elements and fonts to English/Western digits (0-9) */
*, *::before, *::after {
    font-variant-numeric: tabular-nums lining-nums !important;
    -moz-font-feature-settings: "lnum" 1, "tnum" 1 !important;
    -webkit-font-feature-settings: "lnum" 1, "tnum" 1 !important;
    font-feature-settings: "lnum" 1, "tnum" 1 !important;
}

/* Hide number input spinners (up/down stepper arrows) across all browsers */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

input[type="number"] {
    -moz-appearance: textfield !important;
    appearance: textfield !important;
}

/* --- Variables --- */
:root {
    --primary: #123458;
    /* Royal Navy Blue - #123458 */
    --primary-light: #1e477a;
    --primary-dark: #0a203a;
    --accent: #f59e0b;
    /* Warm Orange */
    --accent-hover: #d97706;

    --bg-page: #ffffff;
    /* Clean White */
    --bg-surface: #ffffff;

    --text-dark: #0f172a;
    --text-p: #475569;
    --text-muted: #94a3b8;

    --border: #e2e8f0;
    --border-focus: #cbd5e1;

    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Font Size Scaling --- */
html[data-font-size="xsmall"] {
    font-size: 12.5px !important;
}

html[data-font-size="small"] {
    font-size: 14.5px !important;
}

html[data-font-size="default"] {
    font-size: 16px !important;
}

/* --- Base --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: var(--bg-page);
    color: var(--text-p);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-dark);
    font-weight: 700;
    line-height: 1.3;
}

p {
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    outline: none;
    border: none;
    cursor: pointer;
    background: none;
    font-family: inherit;
}

/* Mobile Requesters Icon Actions (In Department Row) */
.mobile-requester-actions {
    display: none;
    /* hidden by default on desktop */
    align-items: center;
    gap: 1.5rem;
}

.mobile-requester-actions i {
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.5rem;
    transition: transform 0.2s ease;
}

.mobile-requester-actions i:active {
    transform: scale(0.9);
}

.mobile-requester-actions .edit-icon {
    color: #008c44;
    /* Green icon */
}

.mobile-requester-actions .delete-icon {
    color: #ef4444;
    /* Red icon */
}

@media (min-width: 768px) {
    .mobile-only {
        display: none !important;
    }
}

.mobile-cards-container {
    display: none !important;
}

@media (max-width: 767px) {
    .show-on-mobile-flex {
        display: flex !important;
    }
}

@media (min-width: 768px) {
    .show-on-desktop-table-cell {
        display: table-cell !important;
    }
}

/* Modal Base Styles */
.modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.5) !important;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    /* إزالة !important للسماح لـ JS بتغييره عند فتح أكثر من نافذة */
}

.modal.show {
    display: flex !important;
}

/* Fix for shake issue */
body.modal-open {
    overflow: hidden !important;
    padding-right: 0 !important;
    /* Ensure no shift */
}

/* Utilities */
.hidden {
    display: none !important;
}

/* تحسين شبكة الملخص للموبايل والكمبيوتر */
@media (max-width: 768px) {
    .users-summary-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (min-width: 769px) {
    .users-summary-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Role-based Visibility (Moved to bottom for better priority) */

.balance-danger {
    color: #dc2626;
    font-weight: 800;
}

.balance-warning {
    color: #d97706;
    font-weight: 700;
}

.balance-success {
    color: #16a34a;
    font-weight: 700;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.gold-text {
    color: var(--accent);
}

@media (max-width: 767px) {
    .show-on-desktop {
        display: none !important;
    }
}

.danger-text {
    color: var(--danger);
}

/* Show/Hide elements based on screen size */
.show-on-mobile {
    display: none !important;
}

.show-on-desktop {
    display: inline-flex !important;
}

/* إخفاء/إظهار حسب حجم الشاشة */
@media (min-width: 768px) {
    .mobile-only {
        display: none !important;
    }

    .show-on-mobile-only {
        display: none !important;
    }

    .hide-on-mobile {
        display: block !important;
    }
}

@media (max-width: 767px) {
    .desktop-only {
        display: none !important;
    }

    .show-on-mobile-only {
        display: block !important;
    }

    .hide-on-mobile {
        display: none !important;
    }
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mt-5 {
    margin-top: 2rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.px-4 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.ms-2 {
    margin-left: 0.5rem;
}

.me-2 {
    margin-right: 0.5rem;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-dark);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-info {
    background: #0ea5e9;
    color: #fff;
}

.btn-info:hover {
    background: #0284c7;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-purple {
    background: #8b5cf6 !important;
    color: #fff !important;
}

.btn-purple:hover {
    background: #7c3aed !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-warning:hover {
    background: #d97706;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-reset-yellow {
    background: #ffeb3b !important;
    border: 1.5px solid #ffeb3b !important;
    color: #0f172a !important;
    font-weight: 700 !important;
    transition: var(--transition);
}

.btn-reset-yellow:hover {
    background: #fdd835 !important;
    border-color: #fdd835 !important;
    color: #0f172a !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-sm {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: var(--text-p);
    transition: var(--transition);
}

.btn-icon:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.btn-icon.danger {
    color: var(--danger);
}

.btn-icon.danger:hover {
    background: #fef2f2;
    color: var(--danger);
}

.btn-icon.primary {
    color: var(--primary);
}

.btn-icon.primary:hover {
    background: #e0e7ff;
}

.btn-icon.info {
    color: #0ea5e9;
}

.btn-icon.info:hover {
    background: #e0f2fe;
    color: #0284c7;
}

/* --- Forms & Inputs --- */
.form-group {
    margin-bottom: 0.75rem;
    /* تقليل المسافة الرأسية */
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
    /* تقليل المسافة تحت العنوان */
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    height: 44px;
    font-size: 0.9rem;
    background: #ffffff;
    border: 1.5px solid #94a3b8;
    border-radius: 8px;
    transition: all 0.2s ease;
    color: var(--text-dark);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    text-align: center;
    /* ✅ محاذاة النص في المنتصف */
}

/* ✅ محاذاة select و option في المنتصف وتجنب تداخل النصوص */
select.form-control,
.form-control select {
    text-align: center !important;
    text-align-last: center !important;
    /* لمحاذاة القيمة المختارة */
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

select.form-control option,
.form-control select option {
    text-align: center !important;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 140, 68, 0.1);
    outline: none;
    background: #fff;
}

.form-control:focus {
    background: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
    outline: none;
}

/* تحسين عرض select في الموبايل */
@media (max-width: 767px) {

    .form-control select,
    select.form-control {
        font-size: 0.9rem !important;
        padding: 10px 14px 10px 2.5rem !important;
        height: 44px !important;
        min-height: 44px !important;
        line-height: 1.4 !important;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: left 0.75rem center;
        background-size: 1rem;
    }

    /* تحسين عرض حقل المهنة مع الزر في الموبايل */
    #emp-profession,
    #contractor-job,
    #emp-department {
        min-width: 0 !important;
        flex: 1 !important;
        width: 100% !important;
        font-size: 0.9rem !important;
        padding: 10px 14px 10px 2.5rem !important;
        height: 44px !important;
        min-height: 44px !important;
    }

    /* تحسين زر المهن بجانب الحقل (إزالة التقييد بالمربع ليتساوى مع الباقي) */
    #manage-professions-btn,
    #manage-contractor-professions-btn,
    #manage-departments-btn {
        flex-shrink: 0 !important;
        margin: 0 !important;
    }

    /* تحسين container حقل المهنة */
    .form-group div[style*="display: flex"] {
        gap: 0.75rem !important;
        align-items: stretch !important;
        width: 100% !important;
    }

    /* إصلاح عرض select عموماً في الموبايل */
    .modal-body select.form-control,
    .modal select.form-control {
        width: 100% !important;
        min-width: 0 !important;
        flex: 1 !important;
    }

    /* إصلاح خاص لحقل المهنة - أولوية عالية */
    .modal-body #emp-profession,
    .modal-body #contractor-job,
    .modal-body #emp-department {
        width: 100% !important;
        min-width: 0 !important;
        flex: 1 !important;
        max-width: 100% !important;
    }

    /* إصلاح container المهنة */
    .modal-body .form-group div[style*="flex"] {
        display: flex !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}

.input-icon {
    position: relative;
}

.input-icon i {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-icon .form-control,
.input-icon input {
    padding-right: 2.8rem;
    width: 100%;
    border: 1px solid var(--border-focus);
    border-radius: var(--radius-sm);
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    padding-left: 1rem;
    font-size: 0.95rem;
}

/* Fallback */
.input-icon input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
    outline: none;
}

.error-text {
    color: var(--danger);
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.5rem;
    text-align: center;
}

/* Custom Checkbox */
.checkbox-group {
    margin-top: 1rem;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600 !important;
    color: var(--text-dark) !important;
    user-select: none;
    transition: var(--transition);
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    height: 20px;
    width: 20px;
    background-color: #f1f5f9;
    border: 1.5px solid var(--border-focus);
    border-radius: 4px;
    margin-inline-end: 12px;
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.custom-checkbox:hover input:not(:disabled)~.checkmark {
    background-color: #e2e8f0;
    border-color: var(--primary);
}

.custom-checkbox input:checked~.checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.custom-checkbox input:disabled~.checkmark {
    background-color: #f1f5f9;
    border-color: #e2e8f0;
    opacity: 0.6;
    cursor: not-allowed;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.custom-checkbox input:checked~.checkmark:after {
    display: block;
}

/* --- Multi Select Component --- */
.multi-select-container {
    position: relative;
    user-select: none;
}

.multi-select-trigger {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9rem;
    background: #ffffff;
    border: 1.5px solid #94a3b8;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-dark);
    height: 44px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.multi-select-trigger:hover {
    border-color: #cbd5e1;
}

.multi-select-trigger.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 140, 68, 0.1);
}

.multi-select-trigger:hover {
    border-color: var(--primary);
}

.multi-select-trigger.active {
    background: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

.multi-select-trigger span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 0.5rem;
}

.multi-select-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    left: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 350px;
    overflow-y: auto;
    padding: 0.5rem;
    animation: fadeInDown 0.2s ease forwards;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.multi-select-item {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.multi-select-item:hover {
    background: #f1f5f9;
}

.multi-select-item .custom-checkbox {
    margin-bottom: 0;
    pointer-events: none;
    /* Make the whole item clickable */
}

.multi-select-item span {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
}

/* Scrollbar for dropdown */
.multi-select-dropdown::-webkit-scrollbar {
    width: 6px;
}

.multi-select-dropdown::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.multi-select-dropdown::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.multi-select-dropdown::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

@media (max-width: 768px) {
    .multi-select-dropdown {
        min-width: 250px;
        max-width: calc(100vw - 40px);
        right: 0;
        left: auto;
    }

    /* منع خروج القائمة الثانية (الأقسام) عن حافة الشاشة اليسرى */
    #container-department .multi-select-dropdown,
    #salary-department-container .multi-select-dropdown,
    #contractor-department-container .multi-select-dropdown {
        right: auto;
        left: 0;
    }
}

/* --- Layout --- */
#app-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-container {
    flex: 1;
    padding: 2.25rem 2rem 3rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* --- Navbar Core --- */
.navbar {
    background: var(--bg-surface);
    padding: 0 2rem;
    height: 70px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: center;
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--border);
}

.nav-container {
    width: 100%;
    max-width: 1400px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
    cursor: pointer;
    transition: var(--transition);
}

.nav-brand .nav-logo {
    height: 45px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
    transition: var(--transition);
    object-fit: contain;
}

.nav-brand:hover .nav-logo {
    transform: rotate(-5deg) scale(1.1);
}

.nav-brand:hover {
    color: var(--primary-light);
}

.nav-brand i {
    font-size: 1.5rem;
    color: var(--accent);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-greeting {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

/* --- Badges --- */
.badge-role {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.b-admin {
    background: #fed7aa;
    color: #9a3412;
}

.b-manager {
    background: #e6f7ef;
    color: #007038;
}

.b-engineer {
    background: #d1fae5;
    color: #065f46;
}

.b-accountant {
    background: #fef3c7;
    color: #92400e;
}

.b-supervisor {
    background: #fce7f3;
    color: #9f1239;
}

.b-worker {
    background: #f1f5f9;
    color: #475569;
}

.badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    min-width: 80px;
    border: none !important;
    background-image: none !important;
    /* إزالة أي تدرج لوني */
}

.badge-info {
    background: #e0f2fe !important;
    color: #0369a1 !important;
}

.badge-warning {
    background: #fef3c7 !important;
    color: #92400e !important;
}

/* Active inactive badge */
.b-active {
    background: #e0f2fe;
    color: #0369a1;
}

.b-inactive {
    background: #f3f4f6;
    color: #6b7280;
}



/* --- Views Transitions --- */
.view-section {
    animation: fadeUp 0.4s ease forwards;
    display: none;
}

.view-section.active {
    display: block;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Common Headers --- */
.section-header {
    margin-bottom: 2.5rem;
    text-align: center;
}

.section-header h2 {
    font-size: 2rem;
    color: var(--primary);
    margin: 0;
}

.section-header p {
    display: none;
}

.section-header.with-back {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

/* Desktop: sticky section header below navbar */
@media (min-width: 768px) {
    .section-header.with-back {
        position: sticky;
        top: 70px;
        z-index: 25;
        background: var(--bg-page);
        padding: 1rem 0 1rem 0;
        /* Padding instead of margin for solid background */
        margin-bottom: 0;
    }
}

.section-header.with-back .btn-icon {
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 1.2rem;
}

.section-subtitle {
    color: var(--primary);
    font-size: 1.3rem;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
    padding-bottom: 0.4rem;
}

/* --- Dashboard --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.stat-box {
    background: var(--bg-surface);
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: var(--transition);
    border: 2px solid var(--border);
}

.stat-box:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
}

.stat-info p {
    margin-bottom: 0.2rem;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.stat-info h3 {
    font-size: 1.8rem;
    color: var(--primary);
}

/* ==========================================================================
   Company Brand Header & Dashboard Cards (Exact Reference Design)
   ========================================================================== */
.company-brand-header {
    margin: 0 auto 2.5rem auto;
    max-width: 900px;
    width: 100%;
}

.company-brand-header .brand-card-inner {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 1.15rem 1.75rem;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    gap: 1rem;
    flex-wrap: wrap;
}

.company-brand-header .brand-accent-line {
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    background: #133458;
}

.company-brand-header .brand-content-wrapper {
    display: flex;
    align-items: center;
    gap: 1.1rem;
}

.company-brand-header .brand-logo-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: #133458;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.4rem;
    box-shadow: 0 6px 14px rgba(19, 52, 88, 0.25);
    flex-shrink: 0;
}

.company-brand-header .brand-text-wrapper h1 {
    font-size: 1.35rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.company-brand-header .brand-text-wrapper p {
    font-size: 0.9rem;
    font-weight: 600;
    color: #64748b;
    margin: 0.25rem 0 0 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 767px) {
    .company-brand-header {
        max-width: 390px !important;
        width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
        margin-bottom: 1.5rem !important;
    }

    .company-brand-header .brand-card-inner {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0.75rem 1rem !important;
    }

    .company-brand-header .brand-content-wrapper {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        margin: 0 auto !important;
        gap: 0.65rem !important;
    }

    .company-brand-header .brand-logo-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 1.15rem !important;
        border-radius: 10px !important;
        flex-shrink: 0 !important;
    }

    .company-brand-header .brand-text-wrapper {
        text-align: right !important;
    }

    .company-brand-header .brand-text-wrapper h1 {
        font-size: 0.95rem !important;
        font-weight: 700 !important;
        margin: 0 !important;
        line-height: 1.2 !important;
    }

    .company-brand-header .brand-text-wrapper p {
        font-size: 0.75rem !important;
        font-weight: 600 !important;
        margin: 0.15rem 0 0 0 !important;
        gap: 4px !important;
    }
}

/* ==========================================================================
   Dashboard Navigation Cards (Exact Reference Design)
   ========================================================================== */
.nav-cards-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: 1.5rem;
    margin-top: 0.5rem;
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 767px) {
    .nav-cards-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.85rem !important;
        margin-top: 0.5rem !important;
        max-width: 390px !important;
    }

    .nav-card {
        padding: 1rem 0.65rem !important;
        aspect-ratio: 1 !important;
        max-width: 115px !important;
    }

    .card-icon {
        width: 56px !important;
        height: 56px !important;
        font-size: 1.6rem !important;
        margin-bottom: 0.75rem !important;
    }

    .card-content h3 {
        font-size: 0.85rem !important;
    }
}

.nav-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 0.75rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: 1.5px dotted #94a3b8;
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
    user-select: none;
    width: 100%;
    max-width: 140px;
}

.nav-card * {
    pointer-events: none;
}

.nav-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.nav-card:hover::before {
    transform: scaleX(1);
}

.nav-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

.nav-card:active {
    transform: translateY(-4px);
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: #f8fafc;
    color: #133458;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.55rem;
    margin-bottom: 0.55rem;
    position: relative;
    border: 1.5px solid #e2e8f0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-icon i {
    filter: none !important;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-card:hover .card-icon {
    transform: translateY(-3px) scale(1.06);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.05);
}

.nav-card:hover .card-icon i {
    transform: scale(1.08);
    filter: none !important;
}

.nav-card:active .card-icon {
    transform: translateY(0) scale(0.96);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.card-content h3 {
    font-size: 0.85rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-dark);
    line-height: 1.4;
    transition: color 0.3s;
}

.nav-card:hover .card-content h3 {
    color: var(--primary);
}

/* 1. المستخدمين والصلاحيات */
#nav-users .card-icon {
    background: #fef4f4 !important;
    border-color: #fee2e2 !important;
    color: #dc2626 !important;
}

#nav-users:hover .card-content h3 {
    color: #dc2626 !important;
}

/* 2. تحديث النظام */
#nav-system-update .card-icon {
    background: #f0f6ff !important;
    border-color: #dbeafe !important;
    color: #2563eb !important;
}

#nav-system-update:hover .card-content h3 {
    color: #2563eb !important;
}

/* 3. تثبيت التطبيق */
#nav-pwa-install .card-icon {
    background: #f0fdf4 !important;
    border-color: #dcfce7 !important;
    color: #16a34a !important;
}

#nav-pwa-install:hover .card-content h3 {
    color: #16a34a !important;
}

/* 4. إدارة المخازن */
#nav-warehouse .card-icon {
    background: #fffdf5 !important;
    border-color: #fef3c7 !important;
    color: #b45309 !important;
}

#nav-warehouse:hover .card-content h3 {
    color: #b45309 !important;
}

/* 5. سجل العمليات */
#nav-audit-logs .card-icon {
    background: #f1f5f9 !important;
    border-color: #e2e8f0 !important;
    color: #133458 !important;
}

#nav-audit-logs:hover .card-content h3 {
    color: #133458 !important;
}

/* --- New UI Elements (Tabs & Sheets) --- */
.table-tabs-container {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    margin-top: 0;
    overflow-x: auto;
    /* Hide scrollbar */
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
    /* Sticky tabs on desktop */
    position: sticky;
    top: 144px;
    /* 70px navbar + 74px section header (16+42+16) */
    z-index: 20;
}

@media (max-width: 767px) {
    .table-tabs-container {
        display: none !important;
    }

    /* Modal tabs wrapper to 2 columns on mobile */
    .modal-tabs {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1px !important;
        background: var(--border) !important;
        overflow-x: visible !important;
    }

    .modal-tab {
        padding: 0.6rem 0.25rem !important;
        font-size: 0.75rem !important;
        background: #f8fafc !important;
        border: none !important;
        white-space: normal !important;
        box-sizing: border-box !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: 44px !important;
        text-align: center !important;
        color: var(--text-p) !important;
        font-weight: 700 !important;
    }

    .modal-tab.active {
        background: linear-gradient(135deg, var(--primary), var(--primary-light)) !important;
        color: #ffffff !important;
    }
}

.table-tabs-container::-webkit-scrollbar,
.table-tabs::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

.table-tabs {
    display: flex;
    padding: 0.5rem 0.5rem 0 0.5rem;
    gap: 0.25rem;
}

.table-tab {
    padding: 0.6rem 1rem;
    /* تقليل الحشو */
    font-weight: 700;
    font-size: 0.75rem;
    /* تصغير الخط بشكل ملحوظ */
    color: var(--text-p);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: var(--transition);
    white-space: nowrap;
    border: 1px solid transparent;
    border-bottom: none;
    background: transparent;
}

.table-tab:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.table-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border-color: var(--primary);
    position: relative;
    margin-bottom: -1px;
    z-index: 1;
}

/* Modal Tabs */
.modal-tabs {
    display: flex;
    background: #f1f5f9;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    /* Hide scrollbar */
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.modal-tabs::-webkit-scrollbar {
    display: none;
}

.modal-tab {
    flex: 1;
    min-width: 80px;
    /* تقليل العرض الأدنى أكثر */
    padding: 0.5rem 0.15rem;
    /* تقليل المسافات الداخلية أكثر */
    font-weight: 700;
    font-size: 0.65rem;
    /* تصغير الفونت جداً */
    color: var(--text-p);
    transition: var(--transition);
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    text-align: center;
}

.modal-tab:hover {
    background: #e2e8f0;
    color: var(--primary);
}

.modal-tab.active {
    background: var(--primary);
    color: white;
    border-bottom-color: var(--primary-dark);
}

/* Custom Scrollbar for Modal/Details Body */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Autocomplete suggestions improvement */
.suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 1050;
    max-height: 250px;
    overflow-y: auto;
}

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: var(--transition);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.selected {
    background: #f8fafc;
}

.suggestion-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    direction: rtl;
}

.suggestion-item .sug-name {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.suggestion-item .sug-code {
    font-weight: 500;
    color: #64748b;
    font-size: 0.85rem;
    background: #f1f5f9;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    direction: ltr;
    /* English digits in code */
}

/* Details Modal/Overlay Styling */
.details-grid-mobile {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 0.5rem;
}

.detail-header-mobile {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 1.25rem;
    border-radius: 12px;
}

.detail-header-mobile i {
    font-size: 2.5rem;
}

.detail-header-mobile h3 {
    margin: 0;
    font-size: 1.3rem;
}

.detail-group-mobile {
    background: #fff;
    padding: 0;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.detail-group-mobile h4 {
    margin: 0;
    background: #f0fdf4;
    color: #166534;
    border-bottom: 1px solid #bbf7d0;
    padding: 0.85rem 1.25rem;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-group-body {
    padding: 0.5rem 1.25rem 1.25rem 1.25rem;
    background: #fff;
}

.detail-row-mobile {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.95rem;
}

.detail-row-mobile:last-child {
    border-bottom: none;
}

.detail-row-mobile span {
    color: #166534 !important;
    font-weight: 700;
    min-width: 110px;
}

.detail-row-mobile strong {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e293b;
}

@media (min-width: 768px) {
    .details-grid-mobile {
        display: grid;
        grid-template-columns: 1fr !important;
    }

    .detail-header-mobile {
        grid-column: 1 / -1;
    }
}

.card-content h3 {
    font-size: 0.85rem;
    /* تصغير الخط ليتناسب مع الحجم الجديد */
    font-weight: 700;
    margin: 0;
    color: var(--text-dark);
    line-height: 1.4;
    transition: color 0.3s;
}

.nav-card:hover .card-content h3 {
    color: var(--primary);
}

.card-content p {
    display: none;
}

/* Vacation Modal Enhancements */
#vacation-modal .modal-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
}

#vacation-modal .modal-header h3 {
    color: white;
}

#vacation-modal .modal-header .btn-icon {
    color: white;
}

#vacation-modal .modal-body {
    padding: 1.5rem;
}

#vacation-modal .form-group label {
    color: var(--primary-dark);
    font-weight: 700;
}

#vacation-modal .form-control[readonly] {
    background: #f8fafc !important;
    border-color: #e2e8f0;
    color: var(--primary);
    cursor: default;
}

#vacation-modal .autocomplete-wrapper .form-control {
    border-right: 4px solid var(--primary);
}

#vacation-modal .suggestions-list {
    border-radius: 0 0 12px 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

#vacation-modal .suggestion-item {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #f1f5f9;
}

#vacation-modal .suggestion-item:hover {
    background: #ecfdf5;
}

#vacation-modal .suggestion-item .sug-name {
    color: var(--primary-dark);
}

/* --- Internal Sections Tools (Modern Compact Toolbar) --- */
.toolbar-card {
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    min-height: auto !important;
    height: auto !important;
}

.search-wrapper {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    max-width: 480px;
    flex-wrap: nowrap;
}

.search-wrapper input {
    flex: 1;
    min-width: 220px;
    height: 42px;
    padding: 0.5rem 1.1rem;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 600;
    transition: var(--transition);
    outline: none;
    color: var(--text-dark);
}

.search-wrapper input:focus {
    background: #fff;
    border-color: #133458;
    box-shadow: 0 0 0 3px rgba(19, 52, 88, 0.15);
}

.search-wrapper .btn,
#search-user-btn {
    height: 42px;
    padding: 0 1.25rem;
    font-size: 0.88rem;
    font-weight: 700;
    border-radius: 8px;
    background: #133458;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    white-space: nowrap;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(19, 52, 88, 0.2);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.search-wrapper .btn:hover,
#search-user-btn:hover {
    background: #1b497a;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(19, 52, 88, 0.3);
}

.toolbar-buttons-grid {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar-buttons-grid .btn,
#add-user-btn {
    height: 42px;
    padding: 0 1.35rem;
    font-size: 0.88rem;
    font-weight: 700;
    border-radius: 8px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 0 1 auto;
    width: auto;
    min-width: 130px;
    max-width: fit-content;
    box-shadow: 0 2px 6px rgba(19, 52, 88, 0.2);
}

#add-user-btn {
    background: #133458 !important;
    color: #ffffff !important;
}

#add-user-btn:hover {
    background: #1b497a !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(19, 52, 88, 0.3) !important;
}

#manage-roles-btn {
    background: #f1f5f9 !important;
    color: #1e293b !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

#manage-roles-btn:hover {
    background: #e2e8f0 !important;
    transform: translateY(-1px);
}

@media (max-width: 767px) {
    .toolbar-card {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }

    .search-wrapper {
        max-width: 100% !important;
        width: 100% !important;
    }

    .toolbar-buttons-grid {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    .toolbar-buttons-grid .btn,
    #add-user-btn,
    #manage-roles-btn {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: 40px !important;
    }
}

/* --- Autocomplete Wrapper --- */
.autocomplete-wrapper {
    position: relative;
    display: block;
}

.toolbar-card .autocomplete-wrapper {
    flex: 1;
    min-width: 0;
}

.toolbar-card .autocomplete-wrapper input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    background: #f8fafc;
    border: 1px solid var(--border-focus);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    color: var(--text-dark);
}

.toolbar-card .autocomplete-wrapper input:focus {
    background: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
    outline: none;
}

/* --- Autocomplete Suggestions --- */
.autocomplete-suggestions {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--border);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    border: 1px solid var(--border);
}

.autocomplete-suggestions .suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
}

.autocomplete-suggestions .suggestion-item:last-child {
    border-bottom: none;
}

.autocomplete-suggestions .suggestion-item:hover {
    background-color: #f1f5f9;
}

/* --- Search Suggestions --- */
.suggestions-list {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--border);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    border: 1px solid var(--border);
}

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background-color: #f1f5f9;
}

.suggestion-item.keyboard-selected {
    background-color: #008c44 !important;
    border-color: #007038 !important;
}

.suggestion-item.keyboard-selected .sug-name {
    color: white !important;
}

/* عند التحديد بالكيبورد، خلي المربع الرصاصي زي ما هو */
.suggestion-item.keyboard-selected .sug-meta {
    background: #f1f5f9 !important;
    color: #374151 !important;
}

.suggestion-item .sug-name {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.suggestion-item .sug-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-weight: 700;
}

.suggestion-item:hover .sug-meta {
    background: var(--primary);
    color: white;
}

.search-wrapper select {
    padding: 0.75rem 1rem;
    background: #f1f5f9;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
    cursor: pointer;
}

.search-wrapper select:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* --- Premium Tables (Desktop) --- */
.table-container {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 0;
    overflow-x: auto;
    border: 2px solid var(--border);
}

/* Desktop: Sticky table header — no internal scrollbar, page scrolls normally */
@media (min-width: 768px) {

    /* إزالة overflow ليعمل sticky مع تمرير الصفحة */
    #employees-section .table-container,
    #vacations-section .table-container,
    #custodies-section .table-container,
    #professional-documents-section .table-container,
    #special-needs-section .table-container,
    #promotions-section .table-container,
    #bonuses-section .table-container,
    #deductions-section .table-container,
    #deduction-hours-section .table-container,
    #resignations-section .table-container,
    #loans-section .table-container,
    #training-courses-section .table-container,
    #social-contributions-section .table-container,
    #investigations-section .table-container,
    #evaluations-section .table-container,
    #ideal-employees-section .table-container,
    #warehouse-section .table-container,
    #users-section .table-container,
    #employee-credentials-section .table-container,
    #audit-logs-section .table-container {
        overflow: visible;
    }

    /* When tabs are above the table, remove top border-radius */
    #employees-section .table-container {
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    }
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    text-align: center;
    font-size: 0.88rem;
}

.modern-table thead {
    background: #133458 !important;
    position: static;
    display: table-header-group;
    box-shadow: 0 2px 8px rgba(19, 52, 88, 0.1);
}

.modern-table tbody {
    background: white;
    display: table-row-group;
}

.modern-table tbody tr {
    display: table-row;
    transition: background-color 0.15s ease;
    position: relative;
}

/* تلوين الصفوف (أبيض ورصاصي خفيف) */
.modern-table tbody tr:nth-child(even) {
    background-color: #f8fafc !important;
}

.modern-table tbody tr:nth-child(odd) {
    background-color: #ffffff !important;
}

.modern-table tbody tr:hover {
    background-color: #f0f9ff !important;
}

.modern-table th {
    background: #133458 !important;
    color: white !important;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.85rem 0.65rem;
    border-left: 1.5px solid #ffffff !important;
    border-right: 1.5px solid #ffffff !important;
    border-top: 1px solid #ffffff !important;
    border-bottom: 2px solid #ffffff !important;
    letter-spacing: 0.2px;
    white-space: nowrap;
    display: table-cell;
    vertical-align: middle;
    text-align: center;
}

.modern-table th:first-child {
    border-right: 2px solid #ffffff !important;
    border-left: 1.5px solid #ffffff !important;
    text-align: center;
}

.modern-table th:last-child {
    border-left: 2px solid #ffffff !important;
    border-right: 1.5px solid #ffffff !important;
    text-align: center;
    width: auto;
    white-space: nowrap;
}

.modern-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    border-left: 1px solid #e2e8f0;
    color: #1e293b;
    font-weight: 600;
    vertical-align: middle;
    display: table-cell;
    text-align: center;
    font-size: 0.88rem;
}

.modern-table td:first-child {
    border-left: 1px solid #e2e8f0;
    font-weight: 800;
    color: #133458;
    font-size: 0.95rem;
    text-align: right;
    padding-right: 1.5rem;
}

.modern-table td:nth-child(2) {
    text-align: right;
    padding-right: 1.25rem;
    color: #475569;
}

.modern-table td:last-child {
    border-left: none;
    width: 320px;
    min-width: 300px;
    white-space: nowrap;
}

.modern-table tbody tr::before {
    display: none;
}

.modern-table tbody tr:hover {
    background: #eef2ff !important;
    /* هوفر خفيف بلون أزرق باهت */
    transform: none !important;
    box-shadow: none !important;
}

/* تلوين الصفوف النشطة (أخضر) */
.modern-table tbody tr.active-request {
    background-color: #d1fae5 !important;
    background: #d1fae5 !important;
}

/* تلوين الصفوف في الانتظار (أحمر) */
.modern-table tbody tr.pending-request,
.modern-table tbody tr.contractor-on-vacation {
    background-color: #fee2e2 !important;
    background: #fee2e2 !important;
}

/* في الموبايل، نلغي الإطار الأحمر الجانبي للمقاولين */
@media (max-width: 767px) {
    #contractors-section .modern-table tbody tr.contractor-on-vacation {
        border-left: 1px solid #94a3b8 !important;
    }
}

/* إلغاء hover للصفوف الملونة - يجب أن يكون بعد التلوين */
.modern-table tbody tr.active-request:hover {
    background-color: #d1fae5 !important;
    background: #d1fae5 !important;
}

.modern-table tbody tr.pending-request:hover,
.modern-table tbody tr.contractor-on-vacation:hover {
    background-color: #fee2e2 !important;
    background: #fee2e2 !important;
}

.modern-table tbody tr:last-child td {
    border-bottom: none;
}

/* إخفاء badge الحالة في الكمبيوتر - يظهر فقط في الموبايل */
.mobile-only-badge {
    display: none;
}

@media (max-width: 767px) {
    .mobile-only-badge {
        display: inline-block;
    }
}

/* تلوين المستخدمين المعطلين - أحمر */
.modern-table tbody tr.user-inactive {
    background-color: #fecaca !important;
    background: #fecaca !important;
}

.modern-table tbody tr.user-inactive:hover {
    background-color: #fca5a5 !important;
    background: #fca5a5 !important;
}

.modern-table tbody tr.user-inactive td {
    color: #991b1b;
}

.modern-table tbody tr.user-inactive td strong {
    color: #7f1d1d;
}

/* اقتراحات البحث للمستخدمين المعطلين */
.suggestion-item.suggestion-inactive {
    background-color: #fecaca;
    border-left: 3px solid #ef4444;
}

.suggestion-item.suggestion-inactive:hover {
    background-color: #fca5a5;
}

.suggestion-item.suggestion-inactive .sug-name {
    color: #991b1b;
}

.suggestion-item.suggestion-inactive .sug-meta {
    color: #b91c1c;
}

.action-buttons {
    display: flex;
    gap: 0.4rem;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.action-buttons .btn-icon {
    width: auto !important;
    height: 32px !important;
    padding: 0 0.65rem !important;
    border-radius: 6px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.35rem !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    white-space: nowrap !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

.action-buttons .btn-icon i {
    font-size: 0.8rem !important;
}

.action-buttons .btn-icon .btn-text {
    display: inline !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
}

.action-buttons .btn-icon:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
    filter: brightness(1.1) !important;
}

.action-buttons .btn-icon.info {
    background: #0284c7 !important;
}

.action-buttons .btn-icon.warning {
    background: #ea580c !important;
}

.action-buttons .btn-icon.success {
    background: #16a34a !important;
}

.action-buttons .btn-icon.primary {
    background: #2563eb !important;
}

.action-buttons .btn-icon.danger {
    background: #dc2626 !important;
}

.action-buttons .btn-icon.wh-perm {
    background: #0f766e !important;
    color: #ffffff !important;
}

.action-buttons .btn-icon.wh-perm:hover {
    background: #115e59 !important;
    color: #ffffff !important;
}

/* User Management Table Actions Column Fix */
#users-section .modern-table th:last-child,
#users-section .modern-table td:last-child {
    min-width: 440px !important;
    width: 440px !important;
    text-align: center !important;
    padding: 0.5rem 0.65rem !important;
}

#users-section .action-buttons {
    display: flex !important;
    gap: 0.35rem !important;
    justify-content: center !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
}

#users-section .action-buttons .btn-icon {
    height: 30px !important;
    padding: 0 0.55rem !important;
    font-size: 0.78rem !important;
    gap: 0.25rem !important;
    border-radius: 6px !important;
}

/* --- Modals (Sleek) --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.75);
    /* Darker background instead of blur for performance */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow-y: auto;
    padding: 1rem;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    width: 100%;
    max-width: 700px;
    margin: auto;
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 2rem);
}

.modal.show .modal-dialog {
    transform: scale(1);
}

.modal-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    border-radius: 12px;
    overflow: hidden;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #00a350, #008c44);
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    font-size: 1.15rem;
    color: white;
    font-weight: 700;
    line-height: 1;
    display: flex;
    flex-direction: row;
    gap: 0;
    align-items: center;
}

.modal-header h3 div {
    font-size: 1.15rem;
    color: white;
    font-weight: 700;
    display: inline;
}

.modal-header .btn-icon {
    color: white;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.modal-header .btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.modal-body {
    padding: 1.5rem 2rem 2rem 2rem;
    overflow-y: auto;
    flex: 1;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.modal-footer {
    margin-top: 1.5rem;
    padding: 0;
    border-top: none;
    background: transparent;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.modal-footer .btn {
    flex: 1;
    min-width: 120px;
}

/* Login */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-page);
    padding: 1rem;
}

.login-card {
    background: var(--bg-surface);
    width: 100%;
    max-width: 420px;
    padding: 3rem 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 2px solid var(--border);
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-header .logo .login-logo {
    height: 100px;
    width: auto;
    margin-bottom: 1rem;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.1));
    transition: var(--transition);
    object-fit: contain;
}

.login-header .logo .login-logo:hover {
    transform: scale(1.05);
}

.login-header .logo i {
    display: none;
}

/* Toasts */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--primary);
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    z-index: 2000;
    opacity: 0;
    transition: all 0.4s ease;
    font-weight: 600;
    min-width: 300px;
    max-width: 500px;
}

.toast.toast-show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.toast-success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.toast.toast-error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.toast.toast-info {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
}

.toast #toast-icon {
    font-size: 1.5rem;
}

.toast #toast-message {
    flex: 1;
    font-size: 0.95rem;
}

/* Hide mobile-specific elements by default (Desktop view) */
.mobile-label-top,
.mobile-badge-inline,
.mobile-label {
    display: none !important;
}

/* Mobile Responsiveness */
@media (min-width: 1200px) {
    .nav-cards-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .form-control,
    .multi-select-trigger,
    select.form-control {
        height: 40px !important;
        min-height: 40px !important;
        padding: 8px 12px !important;
        font-size: 0.9rem !important;
        line-height: 1.4 !important;
    }

    .form-group label,
    .vacations-filters-grid label,
    .professional-documents-filters-grid label,
    .audit-filters-grid label {
        margin-bottom: 0.1rem !important;
        font-size: 0.75rem !important;
    }

    .vacations-filters-grid,
    .professional-documents-filters-grid,
    .audit-filters-grid {
        gap: 0.4rem !important;
    }

    /* توسيع العرض في الموبايل ليأخذ كامل الشاشة */
    .toolbar-card,
    .main-card,
    .view-section {
        padding-left: 0.25rem !important;
        padding-right: 0.25rem !important;
    }

    body {
        padding: 0.5rem !important;
    }
}

/* Toolbar Buttons Grid - Professional Single Row Layout */
.toolbar-buttons-grid {
    display: flex !important;
    gap: 0.5rem !important;
    flex-wrap: wrap !important;
    /* السماح بالالتفاف في حال وجود أزرار كثيرة */
    align-items: center !important;
    justify-content: flex-start !important;
    /* البدء من اليمين في العربي */
    margin-top: 0.5rem;
}

.toolbar-buttons-grid .btn,
.toolbar-buttons-grid .btn-group {
    flex: 0 1 auto !important;
    /* عدم الإجبار على حجم ثابت، والسماح بالتقلص */
    min-width: 120px !important;
    /* حد أدنى للحفاظ على الشكل */
    max-width: fit-content !important;
    /* منع التمدد المبالغ فيه */
    white-space: nowrap !important;
}

.toolbar-buttons-grid .btn {
    border-radius: 4px !important;
    padding: 0.3rem 0.8rem !important;
    /* حشو موحد لجميع الأزرار */
    font-weight: 700 !important;
    font-size: 0.8rem !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border: none !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    height: 34px !important;
    /* توحيد الارتفاع لجميع الأزرار */
}

.toolbar-buttons-grid .btn-group {
    display: flex !important;
    align-items: center;
}

.toolbar-buttons-grid .btn-group .btn {
    width: 100% !important;
    margin: 0 !important;
}

.toolbar-buttons-grid .btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
    filter: brightness(1.08) !important;
}

.toolbar-buttons-grid .btn i {
    font-size: 1rem !important;
}

/* Toolbar Button Specific Colors - Matching the Image */
.toolbar-buttons-grid .btn-primary {
    background: #316cf4 !important;
    /* Blue as in image */
}

.toolbar-buttons-grid .btn-danger {
    background: #d32223 !important;
    /* Red as in image */
}

.toolbar-buttons-grid .btn-warning {
    background: #df8a09 !important;
    /* Orange/Yellow as in image */
}

.toolbar-buttons-grid .btn-success {
    background: #38a169 !important;
    /* Green as in image */
}

.toolbar-buttons-grid .btn-info {
    background: #31a9e1 !important;
    /* Cyan as in image */
}

/* Hover effects for vibrant buttons */
.toolbar-buttons-grid .btn:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15) !important;
    filter: brightness(1.1);
}

/* أزرار إدارة الوظائف والإدارات والمناطق - تماماً مثل البقية على الموبايل ومرتبة على الحاسوب */
@media (min-width: 768px) {

    #manage-contractor-professions-btn,
    #manage-warehouse-categories-btn {
        width: auto !important;
        flex: initial !important;
        min-width: initial !important;
        border-radius: 4px !important;
        background: #316cf4 !important;
        /* Blue for management */
    }
}

/* أسلوب العرض الموحد لقوائم الإدارة (الوظائف، الإدارات، المناطق) */
.management-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 1.25rem 0 !important;
}

.management-item {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0.85rem 1.25rem !important;
    background: #ffffff !important;
    border: 1.5px solid #94a3b8 !important;
    /* إطار أوضح مثل المكتوب في المناطق */
    border-radius: 12px !important;
    margin-bottom: 0.8rem !important;
    transition: all 0.3s ease !important;
    gap: 1.5rem !important;
    /* فجوة أكبر لمنع الالتصاق */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
}

.management-item:hover {
    border-color: #316cf4 !important;
    background: #f8fafc !important;
    transform: translateX(-4px) !important;
}

.management-item .item-text {
    font-weight: 700 !important;
    color: #1e293b !important;
    font-size: 1rem !important;
    flex: 1 !important;
    text-align: right !important;
    line-height: 1.4 !important;
}

.management-item .item-actions {
    display: flex !important;
    gap: 0.6rem !important;
    flex-shrink: 0 !important;
}

.management-item .btn-icon {
    width: 38px !important;
    height: 38px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
}

.management-item .btn-edit {
    background: #316cf4 !important;
    color: white !important;
}

.management-item .btn-delete {
    background: #dc2626 !important;
    color: white !important;
}

.management-item .btn-icon:hover {
    transform: scale(1.1) !important;
    filter: brightness(1.1) !important;
}

@media (max-width: 767px) {
    .main-container {
        padding: 1rem;
    }

    /* تقليل الفجوات بين البطاقات في وضع الموبايل */
    .toolbar-card {
        margin-bottom: 0.75rem !important;
    }

    .toolbar-card+.toolbar-card,
    .toolbar-card+.alert,
    .toolbar-card+.summary-card,
    .toolbar-card+.record-status-legend {
        margin-top: -0.25rem !important;
    }

    .navbar {
        padding: 0 1rem;
        height: 65px;
    }

    .nav-brand span {
        display: none;
    }

    /* Hide text, keep icon */
    .hide-mobile {
        display: none;
    }

    /* Show/Hide elements based on screen size */
    .show-on-desktop {
        display: none !important;
    }

    .show-on-mobile {
        display: inline-flex !important;
    }

    .user-greeting {
        font-size: 0.9rem;
    }

    .toolbar-card {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 0.75rem;
        /* استخدام الفجوة بدلاً من المارجن لتجنب الفراغات عند اختفاء الأزرار */
    }

    .toolbar-card>* {
        margin-bottom: 0 !important;
        /* إلغاء كافة الهوامش السفلية للعناصر المباشرة لاستخدام gap */
    }

    .search-wrapper {
        max-width: 100%;
        flex-wrap: nowrap;
    }

    .search-wrapper input {
        min-width: 0;
        width: 100%;
    }

    .search-wrapper .btn {
        flex-shrink: 0;
    }

    /* Date filter mobile layout */
    .date-filter-wrapper {
        flex-direction: column !important;
    }

    .date-filter-wrapper>div {
        width: 100% !important;
        min-width: 100% !important;
    }

    .apply-date-btn {
        width: 100% !important;
    }

    /* تنسيق خاص لأزرار الموظفين - 3 أزرار في الصف */
    .employees-toolbar-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }

    /* باقي الأقسام - 2 أزرار في الصف */
    .toolbar-buttons-grid:not(.employees-toolbar-grid) {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
        width: 100% !important;
    }

    /* زر الإضافة لم يعد يأخذ الصف بالكامل للسماح بوجود زر PDF بجانبه */
    #add-emp-btn,
    #add-user-btn,
    #add-warehouse-btn,
    #add-incoming-btn,
    #add-outgoing-btn,
    #add-overtime-btn,
    #add-vacation-btn,
    #add-rental-btn,
    #manage-areas-btn,
    #manage-professions-btn,
    #manage-departments-btn,
    #manage-takaful-btn,
    #manage-insurance-entities-btn,
    #manage-health-insurances-btn {
        grid-column: auto !important;
    }

    .toolbar-buttons-grid .btn,
    .toolbar-buttons-grid .btn-group,
    .toolbar-buttons-grid .btn-group .btn {
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.25rem !important;
        font-size: 0.7rem !important;
        padding: 0.3rem 0.2rem !important;
        height: 30px !important;
        white-space: nowrap !important;
        border-radius: 4px !important;
        font-weight: 700 !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
    }

    /* تصغير الأيقونات على الموبايل */
    .toolbar-buttons-grid .btn i {
        font-size: 0.85rem !important;
    }

    /* تصغير النص داخل الأزرار على الموبايل */
    .employees-toolbar-grid .btn .btn-text {
        font-size: 0.65rem !important;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Resignation Styles */
.details-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.details-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.details-item.full-width {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.details-item .label {
    color: #64748b;
    font-size: 0.85rem;
}

.details-item .value {
    color: #1e293b;
    font-weight: 600;
}

.value-box {
    width: 100%;
    padding: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #334155;
    line-height: 1.5;
}

@media (max-width: 767px) {

    #overtime-settings-btn,
    #apply-overtime-btn {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        min-height: 48px;
    }


    .section-header.with-back h2 {
        font-size: 1.4rem;
    }

    .section-header h2 {
        font-size: 1.5rem;
    }

    .nav-cards-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
        margin-top: 1rem;
        /* الحفاظ على مسافة أقل في الموبايل */
        max-width: 390px;
    }

    .nav-card {
        padding: 1rem 0.65rem;
        aspect-ratio: 1;
        max-width: 115px;
    }

    .card-icon {
        width: 56px;
        height: 56px;
        font-size: 1.6rem;
        margin-bottom: 0.75rem;
    }

    .card-content h3 {
        font-size: 0.85rem;
    }

    /* Elegant Mobile Table -> Card Conversion */
    .table-container {
        padding: 0;
        background: transparent;
        box-shadow: none;
        overflow: visible;
        border: none;
    }

    .modern-table thead {
        display: none;
    }

    #employees-section .modern-table tbody tr,
    #contractors-section .modern-table tbody tr,
    #vacations-section .modern-table tbody tr,
    #custodies-section .modern-table tbody tr,
    #promotions-section .modern-table tbody tr,
    #bonuses-section .modern-table tbody tr,
    #deductions-section .modern-table tbody tr,
    #deduction-hours-section .modern-table tbody tr,
    #salaries-section .modern-table tbody tr,
    #resignations-section .modern-table tbody tr,
    #loans-section .modern-table tbody tr,
    #training-courses-section .modern-table tbody tr,
    #social-contributions-section .modern-table tbody tr,
    #investigations-section .modern-table tbody tr,
    #evaluations-section .modern-table tbody tr,
    #ideal-employees-section .modern-table tbody tr,
    #professional-documents-section .modern-table tbody tr,
    #special-needs-section .modern-table tbody tr {
        display: flex;
        flex-direction: column;
        background: #ffffff;
        margin-bottom: 1.25rem;
        border-radius: 16px;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
        border: 1px solid #94a3b8;
        /* إطار رصاصي أوضح */
        padding: 0;
        overflow: hidden;
        cursor: pointer;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
    }

    #employees-section .modern-table tbody tr:hover,
    #contractors-section .modern-table tbody tr:hover,
    #vacations-section .modern-table tbody tr:hover,
    #custodies-section .modern-table tbody tr:hover,
    #promotions-section .modern-table tbody tr:hover,
    #bonuses-section .modern-table tbody tr:hover,
    #deductions-section .modern-table tbody tr:hover,
    #deduction-hours-section .modern-table tbody tr:hover,
    #salaries-section .modern-table tbody tr:hover,
    #resignations-section .modern-table tbody tr:hover,
    #loans-section .modern-table tbody tr:hover,
    #training-courses-section .modern-table tbody tr:hover,
    #social-contributions-section .modern-table tbody tr:hover,
    #investigations-section .modern-table tbody tr:hover,
    #evaluations-section .modern-table tbody tr:hover,
    #ideal-employees-section .modern-table tbody tr:hover,
    #professional-documents-section .modern-table tbody tr:hover,
    #special-needs-section .modern-table tbody tr:hover {
        transform: translateY(-4px);
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
        border-color: var(--primary-light);
    }

    /* All cells hidden by default except those we want to show */
    .modern-table td {
        display: none;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #f1f5f9;
        font-size: 0.9rem;
    }

    /* Label styling for all cells */
    .modern-table td::before {
        content: attr(data-label);
        font-size: 0.8rem;
        font-weight: 700;
        color: var(--text-muted);
        white-space: nowrap;
    }

    /* 1. Code - Top Field */
    #employees-section .modern-table td:nth-child(1),
    #contractors-section .modern-table td:nth-child(1),
    #vacations-section .modern-table td:nth-child(1),
    #professional-documents-section .modern-table td:nth-child(1),
    #special-needs-section .modern-table td:nth-child(1),
    #custodies-section .modern-table td:nth-child(1),
    #promotions-section .modern-table td:nth-child(1),
    #bonuses-section .modern-table td:nth-child(1),
    #deductions-section .modern-table td:nth-child(1),
    #deduction-hours-section .modern-table td:nth-child(1),
    #salaries-section .modern-table td:nth-child(1),
    #resignations-section .modern-table td:nth-child(1),
    #loans-section .modern-table td:nth-child(1),
    #training-courses-section .modern-table td:nth-child(1),
    #social-contributions-section .modern-table td:nth-child(1),
    #investigations-section .modern-table td:nth-child(1),
    #evaluations-section .modern-table td:nth-child(1),
    #ideal-employees-section .modern-table td:nth-child(1),
    #requesters-modal .modern-table td:nth-child(1) {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        gap: 0.4rem;
        background: rgba(248, 250, 252, 0.5);
        /* Semi-transparent */
        color: var(--text-muted);
        font-weight: 600;
        border-bottom: 1px solid rgba(241, 245, 249, 0.8);
        padding: 0.6rem 1.25rem;
        font-size: 0.8rem;
        width: 100% !important;
        box-sizing: border-box;
    }

    /* Employees specific - Light blue background */
    #employees-section .modern-table td:nth-child(1) {
        background: rgba(219, 234, 254, 0.6);
        /* Light blue */
        border-bottom: 1px solid rgba(147, 197, 253, 0.3);
    }



    /* Vacations and Professional Documents specific - Light green background */
    #vacations-section .modern-table td:nth-child(1),
    #professional-documents-section .modern-table td:nth-child(1) {
        background: rgba(209, 250, 229, 0.6);
        /* Light emerald green */
        border-bottom: 1px solid rgba(16, 185, 129, 0.3);
    }

    /* Special Needs specific - Light indigo background */
    #special-needs-section .modern-table td:nth-child(1) {
        background: rgba(238, 242, 255, 0.6);
        /* Light indigo */
        border-bottom: 1px solid rgba(99, 102, 241, 0.3);
    }

    /* Loans specific - Light blue background */
    #loans-section .modern-table td:nth-child(1) {
        background: rgba(224, 242, 254, 0.6);
        /* Light sky blue */
        border-bottom: 1px solid rgba(2, 132, 199, 0.3);
    }

    /* Training Courses specific - Light green background */
    #training-courses-section .modern-table td:nth-child(1) {
        background: rgba(209, 250, 229, 0.6);
        /* Light green */
        border-bottom: 1px solid rgba(16, 185, 129, 0.3);
    }

    /* Social Contributions specific - Light purple background */
    #social-contributions-section .modern-table td:nth-child(1) {
        background: rgba(245, 243, 255, 0.7);
        /* Light purple */
        border-bottom: 1px solid rgba(124, 58, 237, 0.3);
    }

    /* Investigations specific - Light slate background */
    #investigations-section .modern-table td:nth-child(1) {
        background: rgba(241, 245, 249, 0.7);
        /* Light slate */
        border-bottom: 1px solid rgba(71, 85, 105, 0.3);
    }

    /* Evaluations specific - Light indigo background */
    #evaluations-section .modern-table td:nth-child(1) {
        background: rgba(238, 242, 255, 0.7);
        border-bottom: 1px solid rgba(99, 102, 241, 0.3);
    }

    /* Ideal employees specific - Light gold/yellow background */
    #ideal-employees-section .modern-table td:nth-child(1) {
        background: rgba(254, 243, 199, 0.7);
        border-bottom: 1px solid rgba(217, 119, 6, 0.3);
    }

    /* Custodies specific - Light green background like vacations */
    #custodies-section .modern-table td:nth-child(1) {
        background: rgba(209, 250, 229, 0.6);
        border-bottom: 1px solid rgba(16, 185, 129, 0.3);
    }

    /* Promotions specific - Light green background like vacations */
    #promotions-section .modern-table td:nth-child(1) {
        background: rgba(209, 250, 229, 0.6);
        border-bottom: 1px solid rgba(16, 185, 129, 0.3);
    }

    /* Resignations specific - Light teal background */
    #resignations-section .modern-table td:nth-child(1) {
        background: rgba(204, 251, 241, 0.6);
        /* Light teal */
        border-bottom: 1px solid rgba(20, 184, 166, 0.3);
    }

    /* Bonuses specific - Light green background */
    #bonuses-section .modern-table td:nth-child(1) {
        background: rgba(220, 252, 231, 0.6);
        border-bottom: 1px solid rgba(22, 163, 74, 0.3);
    }

    /* Deductions specific - Light red background */
    #deductions-section .modern-table td:nth-child(1) {
        background: rgba(254, 226, 226, 0.6);
        border-bottom: 1px solid rgba(220, 38, 38, 0.3);
    }

    /* Deduction Hours specific - Light orange background */
    #deduction-hours-section .modern-table td:nth-child(1) {
        background: rgba(255, 237, 213, 0.6);
        border-bottom: 1px solid rgba(234, 88, 12, 0.3);
    }

    /* Salaries specific - Light dark green background */
    #salaries-section .modern-table td:nth-child(1) {
        background: rgba(20, 83, 45, 0.15);
        /* Very light dark green */
        border-bottom: 1px solid rgba(20, 83, 45, 0.2);
        color: #14532d;
    }

    /* Contractors specific - Orange/Yellow background */
    #contractors-section .modern-table td:nth-child(1) {
        background: rgba(254, 243, 199, 0.6);
        /* Light orange/yellow */
        border-bottom: 1px solid rgba(251, 191, 36, 0.3);
    }

    #employees-section .modern-table td:nth-child(1)::before {
        content: "\f007";
        /* User icon for name */
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: var(--primary);
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    #salaries-section .modern-table td:nth-child(1)::before {
        content: "\f007";
        /* User icon (same as employees) */
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: #14532d;
        /* Dark green color */
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    #contractors-section .modern-table td:nth-child(1)::before {
        content: "\f02a";
        /* Barcode for code */
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: var(--primary);
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    #vacations-section .modern-table td:nth-child(1)::before {
        content: "\f133";
        /* Calendar icon */
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: #059669;
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    #professional-documents-section .modern-table td:nth-child(1)::before {
        content: "\f15c";
        /* File signature/alt icon */
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: #059669;
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    #special-needs-section .modern-table td:nth-child(1)::before {
        content: "\f193";
        /* Wheelchair icon */
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: #4f46e5;
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    #loans-section .modern-table td:nth-child(1)::before {
        content: "\f53a";
        /* Money bill wave icon */
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: #0284c7;
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    #training-courses-section .modern-table td:nth-child(1)::before {
        content: "\f19d";
        /* Graduation cap icon */
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: #10b981;
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    #social-contributions-section .modern-table td:nth-child(1)::before {
        content: "\f06b";
        /* Gift icon */
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: #7c3aed;
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    #investigations-section .modern-table td:nth-child(1)::before {
        content: "\f24e";
        /* Balance scale icon */
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: #475569;
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    #evaluations-section .modern-table td:nth-child(1)::before {
        content: "\f005";
        /* Star icon */
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: #6366f1;
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    #ideal-employees-section .modern-table td:nth-child(1)::before {
        content: "\f091";
        /* Trophy icon */
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: #d97706;
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    #custodies-section .modern-table td:nth-child(1)::before {
        content: "\f468";
        /* Boxes icon */
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: #059669;
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    #promotions-section .modern-table td:nth-child(1)::before {
        content: "\f5a2";
        /* Award/medal icon */
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: #059669;
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    #resignations-section .modern-table td:nth-child(2) {
        border-bottom: none !important;
        padding-top: 0.5rem !important;
        display: flex !important;
    }

    #resignations-section .modern-table td:nth-child(1)::before {
        display: none !important;
    }

    #bonuses-section .modern-table td:nth-child(1)::before {
        content: "\f0d6";
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: #16a34a;
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    #resignations-section .modern-table td:nth-child(1)::before {
        content: "\f2f5";
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: #0d9488;
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    #deductions-section .modern-table td:nth-child(1)::before {
        content: "\f068";
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: #dc2626;
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    #deduction-hours-section .modern-table td:nth-child(1)::before {
        content: "\f017";
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: #ea580c;
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    /* 2. Body Details - Simple row below name header */
    #resignations-section .modern-table tbody tr {
        border-right: none !important;
    }

    #employees-section .modern-table td:nth-child(2),
    #vacations-section .modern-table td:nth-child(2),
    #custodies-section .modern-table td:nth-child(2),
    #promotions-section .modern-table td:nth-child(2),
    #bonuses-section .modern-table td:nth-child(2),
    #deductions-section .modern-table td:nth-child(2),
    #deduction-hours-section .modern-table td:nth-child(2),
    #salaries-section .modern-table td:nth-child(2),
    #resignations-section .modern-table td:nth-child(2),
    #loans-section .modern-table td:nth-child(2),
    #training-courses-section .modern-table td:nth-child(2),
    #social-contributions-section .modern-table td:nth-child(2),
    #investigations-section .modern-table td:nth-child(2),
    #evaluations-section .modern-table td:nth-child(2),
    #ideal-employees-section .modern-table td:nth-child(2) {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        font-size: 0.95rem !important;
        font-weight: 500 !important;
        color: #1e293b !important;
        background: #ffffff !important;
        border-bottom: 1.5px dotted #94a3b8 !important;
        /* Dotted line like vacations */
        padding: 0.85rem 1.25rem !important;
        width: 100% !important;
    }

    /* Professional Documents: compact mobile cards view overrides */
    #professional-documents-section .modern-table td:nth-child(1) {
        padding: 0.4rem 1rem !important;
    }

    #professional-documents-section .modern-table td:nth-child(2) {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        font-size: 0.95rem !important;
        font-weight: 500 !important;
        color: #1e293b !important;
        background: #ffffff !important;
        border-bottom: 1.5px dotted #94a3b8 !important;
        padding: 0.45rem 1rem !important;
        width: 100% !important;
    }

    /* Special Needs: compact mobile cards view overrides */
    #special-needs-section .modern-table td:nth-child(1) {
        padding: 0.4rem 1rem !important;
    }

    #special-needs-section .modern-table td:nth-child(2) {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        font-size: 0.95rem !important;
        font-weight: 500 !important;
        color: #1e293b !important;
        background: #ffffff !important;
        border-bottom: 1.5px dotted #94a3b8 !important;
        padding: 0.45rem 1rem !important;
        width: 100% !important;
    }

    #contractors-section .modern-table td:nth-child(2),
    #requesters-modal .modern-table td:nth-child(2) {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 1.1rem;
        font-weight: 700;
        color: #1e293b;
        border-bottom: none;
        padding: 0.85rem 1.25rem;
        gap: 1rem;
    }

    .modern-table td:nth-child(2)::before {
        display: none;
    }

    /* 3. Profession - Show on the same row as Code for contractors */
    #contractors-section .modern-table td:nth-child(3) {
        display: flex;
        position: absolute;
        left: 1.25rem;
        top: 0.65rem;
        /* Aligned with Code row */
        padding: 0;
        border: none;
        background: transparent;
        z-index: 2;
    }

    /* For employees, we've moved details to td:nth-child(2), so hide td:nth-child(3) */
    #employees-section .modern-table td:nth-child(3),
    #salaries-section .modern-table td:nth-child(3),
    #employees-section .modern-table td:nth-child(4),
    #salaries-section .modern-table td:nth-child(4) {
        display: none !important;
    }

    .modern-table td:nth-child(3)::before {
        display: none;
    }

    .modern-table td:nth-child(3) .badge-role {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
        background: #f1f5f9;
        color: var(--text-muted);
        font-weight: 700;
        border-radius: 4px;
    }

    /* Employees specific - Green badge */
    #employees-section .modern-table td:nth-child(3) .badge-role {
        background: #66d9a6;
        /* Medium green */
        color: #005a2e;
        /* Dark blue text */
    }

    /* Contractors specific - Orange badge */
    #contractors-section .modern-table td:nth-child(3) .badge-role {
        background: #fbbf24;
        /* Darker orange/yellow */
        color: #78350f;
        /* Dark brown text */
    }

    /* Hide other cells by default on mobile - Scoped to sections */
    #employees-section .modern-table tbody tr td:nth-child(n+3),
    #vacations-section .modern-table tbody tr td:nth-child(n+3),
    #professional-documents-section .modern-table tbody tr td:nth-child(n+3),
    #special-needs-section .modern-table tbody tr td:nth-child(n+3),
    #custodies-section .modern-table tbody tr td:nth-child(n+3),
    #promotions-section .modern-table tbody tr td:nth-child(n+3),
    #bonuses-section .modern-table tbody tr td:nth-child(n+3),
    #deductions-section .modern-table tbody tr td:nth-child(n+3),
    #deduction-hours-section .modern-table tbody tr td:nth-child(n+3),
    #resignations-section .modern-table tbody tr td:nth-child(n+3),
    #loans-section .modern-table tbody tr td:nth-child(n+3),
    #training-courses-section .modern-table tbody tr td:nth-child(n+3),
    #social-contributions-section .modern-table tbody tr td:nth-child(n+3),
    #investigations-section .modern-table tbody tr td:nth-child(n+3),
    #evaluations-section .modern-table tbody tr td:nth-child(n+3),
    #ideal-employees-section .modern-table tbody tr td:nth-child(n+3),
    #contractors-section .modern-table tbody tr td:nth-child(n+4),
    #salaries-section .modern-table tbody tr td:nth-child(n+4),
    #users-section .modern-table tbody tr td:nth-child(n+4),
    #warehouse-section .modern-table tbody tr td:nth-child(n+4),
    #incoming-section .modern-table tbody tr td:nth-child(n+4) {
        display: none;
    }

    /* Show all detailed fields for employees in mobile cards */
    #employees-section .modern-table td.mobile-only {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding: 0.6rem 1.25rem;
        border-bottom: 1px solid #f1f5f9;
        font-size: 0.9rem;
        width: 100%;
    }

    #salaries-section .modern-table td:nth-child(5) {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding: 0.85rem 1.25rem;
        border-bottom: none;
        font-weight: 700;
        color: #059669;
    }

    /* Requesters Modal Mobile Cards */
    #requesters-modal .modern-table tbody tr {
        display: flex;
        flex-direction: column;
        background: #ffffff;
        margin-bottom: 1.25rem;
        border-radius: 16px;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
        border: 1px solid #94a3b8;
        padding: 0;
        overflow: hidden;
        cursor: pointer;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
    }

    #requesters-modal .modern-table tbody tr:hover {
        transform: translateY(-4px);
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
        border-color: var(--primary-light);
    }

    #requesters-modal .modern-table td {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #f1f5f9;
        font-size: 0.9rem;
    }

    #requesters-modal .modern-table td:nth-child(5) {
        justify-content: center;
        gap: 1rem;
    }

    #requesters-modal .modern-table td:nth-child(5)::before {
        display: none;
    }

    /* Contractors Section Mobile Overrides */
    @media (max-width: 767px) {

        /* Warehouse Section Mobile Cards */
        #warehouse-section .modern-table tbody tr {
            display: flex;
            flex-direction: column;
            background: #ffffff;
            margin-bottom: 1.25rem;
            border-radius: 16px;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
            border: 1px solid #94a3b8;
            /* إطار رصاصي أوضح */
            padding: 0;
            overflow: hidden;
            cursor: pointer;
            transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            position: relative;
        }

        #warehouse-section .modern-table tbody tr:hover {
            transform: translateY(-4px);
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
            border-color: var(--primary-light);
        }

        #warehouse-section .modern-table td:nth-child(1) {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: rgba(254, 243, 199, 0.8) !important;
            /* أصفر هادئ مثل المقاولين */
            color: #78350f !important;
            font-weight: 800;
            border-bottom: 1px dotted #94a3b8;
            /* خط منقط */
            padding: 0.6rem 1.25rem;
            font-size: 1rem;
            order: 1;
        }

        /* أيقونة الصنف في الهيدر */
        #warehouse-section .modern-table td:nth-child(1) i {
            color: #78350f !important;
        }

        #warehouse-section .modern-table td:nth-child(1)::before {
            display: none !important;
        }

        /* بادج القسم في الهيدر - ألوان مختلفة متناسقة مع الهيدر الأصفر */
        .mobile-category-badge {
            padding: 0.2rem 0.6rem;
            border-radius: 6px;
            font-size: 0.75rem;
            font-weight: 700;
            border: 1px solid rgba(0, 0, 0, 0.05);
        }

        /* ألوان الأقسام المخصصة */
        .mobile-category-badge.cat-civil {
            background: #fcd34d !important;
            color: #92400e !important;
        }

        /* أصفر غامق */
        .mobile-category-badge.cat-elec {
            background: #66d9a6 !important;
            color: #005a2e !important;
        }

        /* أزرق */
        .mobile-category-badge.cat-plumb {
            background: #6ee7b7 !important;
            color: #064e3b !important;
        }

        /* أخضر */
        .mobile-category-badge.cat-carp {
            background: #fdba74 !important;
            color: #7c2d12 !important;
        }

        /* برتقالي */
        .mobile-category-badge.cat-iron {
            background: #cbd5e1 !important;
            color: #1e293b !important;
        }

        /* رصاصي */
        .mobile-category-badge.cat-tools {
            background: #f9a8d4 !important;
            color: #702459 !important;
        }

        /* وردي */
        .mobile-category-badge.cat-default {
            background: #e2e8f0 !important;
            color: #475569 !important;
        }

        /* افتراضي */

        #warehouse-section .modern-table td:nth-child(2) {
            display: flex;
            justify-content: flex-start;
            align-items: center;
            padding: 0.75rem 1.25rem;
            border-bottom: 1px dotted #94a3b8;
            /* خط منقط */
            width: 100%;
            order: 2;
        }

        #warehouse-section .modern-table td:nth-child(2)::before {
            display: none !important;
        }

        /* نصوص ليبلات الموبايل الرصاصية */
        .mobile-label-gray {
            color: #64748b;
            font-size: 0.85rem;
            font-weight: 600;
        }

        /* الرصيد الحالي بجانب الكود */
        .mobile-balance-inline {
            display: flex;
            align-items: center;
            gap: 0.4rem;
        }

        /* إخفاء الصف الزائد للرصيد */
        #warehouse-section .modern-table td:nth-child(6) {
            display: none !important;
        }

        #warehouse-section .modern-table td:nth-child(3) {
            display: none !important;
        }

        /* Name Header - Yellow on the right */
        #contractors-section .modern-table td:nth-child(2) {
            order: -2 !important;
            background: rgba(254, 243, 199, 0.8) !important;
            /* Yellow header */
            border-bottom: 1px solid rgba(251, 191, 36, 0.3) !important;
            padding: 0.6rem 1.25rem !important;
            font-size: 1rem !important;
            font-weight: 800 !important;
            justify-content: flex-start !important;
            /* RTL right */
            width: 100% !important;
        }

        /* Name Header when on vacation - Light Green */
        #contractors-section .modern-table tr.contractor-on-vacation td:nth-child(2) {
            background: rgba(209, 250, 229, 0.8) !important;
            /* Light Green header */
            color: #065f46 !important;
            /* Dark green text for contrast */
            border-bottom: 1px solid rgba(167, 243, 208, 0.5) !important;
        }

        /* Code color when on vacation - Dark Green */
        #contractors-section .modern-table tr.contractor-on-vacation td:nth-child(1) {
            color: #065f46 !important;
        }

        /* Code on Top Left */
        #contractors-section .modern-table td:nth-child(1) {
            position: absolute !important;
            left: 1.25rem !important;
            top: 0.65rem !important;
            background: transparent !important;
            border: none !important;
            padding: 0 !important;
            z-index: 5 !important;
            width: auto !important;
            color: #78350f !important;
            font-size: 0.85rem !important;
            justify-content: flex-end !important;
        }

        #contractors-section .modern-table td:nth-child(1)::before {
            display: none !important;
        }

        /* Profession and Vacation Row */
        #contractors-section .modern-table td:nth-child(3) {
            position: static !important;
            display: flex !important;
            order: -1 !important;
            padding: 0.75rem 1.25rem !important;
            border-bottom: 1px solid #f1f5f9 !important;
            justify-content: flex-start !important;
            gap: 1rem !important;
            align-items: center !important;
            background: #ffffff !important;
            width: 100% !important;
        }

        #contractors-section .modern-table td:nth-child(3) .badge-role {
            font-size: 0.85rem !important;
            padding: 0.3rem 0.8rem !important;
            background: #fbbf24 !important;
            color: #78350f !important;
            border-radius: 6px !important;
            font-weight: 700 !important;
        }

        #contractors-section .modern-table td:nth-child(3) .mobile-only {
            display: flex !important;
            align-items: center;
        }
    }


    /* Incoming Section Mobile Cards */
    #incoming-section .modern-table tbody tr {
        display: flex;
        flex-direction: column;
        background: #ffffff;
        margin-bottom: 1.25rem;
        border-radius: 16px;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
        border: 1px solid #94a3b8;
        /* إطار رصاصي أوضح */
        padding: 0;
        overflow: hidden;
        cursor: pointer;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
        min-height: 100px;
    }


    /* التاريخ - Top Field */
    #incoming-section .modern-table tbody tr td:nth-child(1) {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        gap: 0.4rem;
        background: rgba(248, 250, 252, 0.5);
        color: var(--text-muted);
        font-weight: 600;
        border-bottom: 1px dotted #94a3b8 !important;
        /* خط منقط قوي */
        padding: 0.6rem 1.25rem;
        font-size: 0.8rem;
        border-left: none !important;
    }

    #incoming-section .modern-table tbody tr td:nth-child(1)::before {
        content: "\f133" " " attr(data-label) ": ";
        font-family: "Font Awesome 5 Free", "Cairo", sans-serif;
        font-weight: 900;
        color: var(--primary);
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    /* اسم الصنف - Main Title */
    #incoming-section .modern-table tbody tr td:nth-child(4) {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 0.8rem;
        /* تصغير حجم الخط إلى 0.8rem */
        font-weight: 700;
        color: #1e293b;
        border-bottom: 1px dotted #94a3b8 !important;
        /* خط منقط قوي */
        padding: 0.85rem 1.25rem;
        gap: 1rem;
        border-left: none !important;
    }

    #incoming-section .modern-table tbody tr td:nth-child(4)::before {
        display: none;
    }

    /* المستخدم - Badge في الزاوية */
    #incoming-section .modern-table tbody tr td:nth-child(7) {
        display: flex;
        position: absolute;
        left: 1.25rem;
        top: 0.65rem;
        padding: 0;
        border: none;
        background: transparent;
        z-index: 2;
    }

    #incoming-section .modern-table tbody tr td:nth-child(7)::before {
        display: none;
    }

    #incoming-section .modern-table tbody tr td:nth-child(7) .badge-role {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
        font-weight: 700;
        border-radius: 4px;
    }

    /* الكمية - Show as badge */
    #incoming-section .modern-table tbody tr td:nth-child(6) {
        display: flex;
        position: absolute;
        left: 1.25rem;
        top: 3.5rem;
        padding: 0;
        border: none;
        background: transparent;
        z-index: 2;
    }

    #incoming-section .modern-table tbody tr td:nth-child(6)::before {
        display: none;
    }

    #incoming-section .modern-table tbody tr td:nth-child(6) span {
        font-size: 1rem;
        padding: 0.3rem 0.8rem;
        background: #dcfce7;
        color: var(--success);
        font-weight: 700;
        border-radius: 8px;
    }

    /* Outgoing Section Mobile Cards */
    #outgoing-section .modern-table tbody tr {
        display: flex;
        flex-direction: column;
        background: #ffffff;
        margin-bottom: 1.25rem;
        border-radius: 16px;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
        border: 1px solid #94a3b8;
        /* إطار رصاصي أوضح */
        padding: 0;
        overflow: hidden;
        cursor: pointer;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
        min-height: 100px;
    }

    #outgoing-section .modern-table tbody tr:hover {
        transform: none !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05) !important;
        border-color: #94a3b8 !important;
        background: inherit !important;
    }

    /* التاريخ - Top Field */
    #outgoing-section .modern-table tbody tr td:nth-child(1) {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        gap: 0.4rem;
        background: rgba(248, 250, 252, 0.5);
        color: var(--text-muted);
        font-weight: 600;
        border-bottom: 1px dotted #94a3b8 !important;
        /* خط منقط قوي */
        padding: 0.6rem 1.25rem;
        font-size: 0.8rem;
        border-left: none !important;
    }

    #outgoing-section .modern-table tbody tr td:nth-child(1)::before {
        content: "\f133" " " attr(data-label) ": ";
        font-family: "Font Awesome 5 Free", "Cairo", sans-serif;
        font-weight: 900;
        color: var(--primary);
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    /* Upload Info Footer Branding and Styling */
    .mobile-upload-info {
        display: flex !important;
        width: 100% !important;
        padding: 0.5rem 1.25rem !important;
        background: rgba(241, 245, 249, 0.4) !important;
        border-top: 1px dotted #94a3b8 !important;
        /* خط منقط قوي */
        margin-top: auto !important;
    }

    .upload-footer {
        width: 100%;
        display: flex;
        justify-content: flex-end;
        color: #64748b;
        font-size: 0.7rem;
        font-weight: 600;
    }

    .upload-footer span {
        display: flex;
        align-items: center;
        gap: 0.35rem;
    }

    /* اسم الصنف - Main Title */
    #outgoing-section .modern-table tbody tr td:nth-child(4) {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 1.1rem;
        font-weight: 700;
        color: #1e293b;
        border-bottom: 1px dotted #94a3b8 !important;
        /* خط منقط قوي */
        padding: 0.85rem 1.25rem;
        gap: 1rem;
        border-left: none !important;
    }

    #outgoing-section .modern-table tbody tr td:nth-child(4)::before {
        display: none;
    }

    /* المستخدم (Column 9) - Badge في الزاوية */
    #outgoing-section .modern-table tbody tr td:nth-child(9) {
        display: flex;
        position: absolute;
        left: 1.25rem;
        top: 0.65rem;
        padding: 0;
        border: none;
        background: transparent;
        z-index: 2;
    }

    #outgoing-section .modern-table tbody tr td:nth-child(9)::before {
        display: none;
    }

    #outgoing-section .modern-table tbody tr td:nth-child(9) .badge-role {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
        font-weight: 700;
        border-radius: 4px;
    }

    /* الكمية (Column 6) - Show as badge on the left */
    #outgoing-section .modern-table tbody tr td:nth-child(6) {
        display: flex;
        position: absolute;
        left: 1.25rem;
        top: 3.5rem;
        padding: 0;
        border: none;
        background: transparent;
        z-index: 2;
    }

    #outgoing-section .modern-table tbody tr td:nth-child(6)::before {
        display: none;
    }

    #outgoing-section .modern-table tbody tr td:nth-child(6) span {
        font-size: 1rem;
        padding: 0.3rem 0.8rem;
        background: #fef2f2;
        color: var(--danger);
        font-weight: 700;
        border-radius: 8px;
    }

    /* Hide other cells on mobile for Outgoing */
    #outgoing-section .modern-table tbody tr td:nth-child(2),
    #outgoing-section .modern-table tbody tr td:nth-child(3),
    #outgoing-section .modern-table tbody tr td:nth-child(5),
    #outgoing-section .modern-table tbody tr td:nth-child(7),
    #outgoing-section .modern-table tbody tr td:nth-child(8),
    #outgoing-section .modern-table tbody tr td:nth-child(10) {
        display: none !important;
    }



    /* Specific Modern Style for Users Section cards */
    #users-section .modern-table tbody tr {
        display: flex;
        flex-direction: column;
        background: #ffffff;
        margin-bottom: 1rem;
        border-radius: 12px;
        box-shadow: var(--shadow-sm);
        border: 1px solid #94a3b8;
        /* إطار رصاصي أوضح */
        padding: 0.5rem 0;
        cursor: pointer;
        position: relative;
    }

    #users-section .modern-table td:nth-child(1),
    #users-section .modern-table td:nth-child(2),
    #users-section .modern-table td:nth-child(3) {
        display: flex;
        padding: 0.5rem 1rem;
        border: none;
        align-items: center;
        gap: 0.5rem;
    }

    #users-section .modern-table td:nth-child(1) {
        font-weight: 700;
        color: var(--primary);
    }

    #users-section .modern-table td:nth-child(1)::before {
        content: "\f2bd";
        /* User icon */
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        font-size: 0.9rem;
    }



    .modal-content {
        background: #ffffff !important;
        border-radius: inherit;
        border: none;
        box-shadow: none;
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .modal-dialog.bottom-sheet {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0 auto !important;
        padding: 0 !important;
        max-width: 100%;
        width: 100%;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        max-height: 95vh;
        background: #ffffff !important;
        box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.15);
        will-change: transform;
        z-index: 2000;
        border: 1px solid rgba(16, 185, 129, 0.2);
        border-bottom: none;
        overflow: hidden;
    }

    .modal {
        padding: 0 !important;
    }

    .hidden-mobile {
        display: none !important;
    }

    .modal.show .modal-dialog.bottom-sheet {
        transform: translateY(0);
    }

    .details-body {
        padding: 1.25rem 0;
        flex: 1;
        overflow-y: auto;
    }

    .bottom-sheet .details-grid-mobile {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 0.35rem !important;
        gap: 1.25rem;
    }

    .bottom-sheet .detail-employee-profile,
    .bottom-sheet .detail-group-mobile {
        width: 100% !important;
        border-radius: 14px !important;
        border: 1.5px solid #cbd5e1 !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .bottom-sheet .detail-employee-profile {
        padding: 1.25rem 1rem !important;
    }

    .bottom-sheet .detail-group-mobile h4 {
        padding: 0.85rem 1rem !important;
    }

    .bottom-sheet .detail-group-body {
        padding: 0.5rem 1rem 1.25rem 1rem !important;
    }

    .bottom-sheet .detail-row-mobile {
        border-bottom: 1px solid #cbd5e1 !important;
    }

    .detail-item {
        display: flex;
        align-items: center;
        gap: 1.5rem !important;
        /* مسافة كبيرة جداً للتأكد من التغيير */
        padding: 1.1rem !important;
        background: #f8fafc;
        border-radius: 12px;
        margin-bottom: 0.8rem;
        border: 1px solid #e2e8f0;
        transition: all 0.2s ease;
    }

    /* إخفاء جميع الأيقونات من detail-item */
    .detail-item>i,
    .detail-item>i.fas,
    .detail-item>i.fab {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .phone-info {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .comm-actions {
        display: flex;
        gap: 0.5rem;
    }

    .comm-btn {
        width: 36px;
        height: 36px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1rem;
        text-decoration: none;
        transition: all 0.2s;
    }

    .comm-btn.call {
        background: rgba(0, 140, 68, 0.1);
        color: #008c44;
    }

    .comm-btn.whatsapp {
        background: rgba(34, 197, 94, 0.1);
        color: #22c55e;
    }

    .comm-btn:active {
        transform: scale(0.9);
    }

    .detail-info {
        flex: 1;
        min-width: 0;
    }

    .detail-info label {
        display: block;
        font-size: 0.7rem;
        color: #64748b;
        font-weight: 600;
        margin-bottom: 0.15rem;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }

    .detail-info span {
        font-weight: 600;
        color: var(--text-dark);
        font-size: 0.875rem;
        display: block;
        word-break: break-word;
    }

    .action-buttons-overlay {
        display: flex;
        gap: 0.5rem;
        width: 100%;
    }

    .action-buttons-overlay .btn {
        flex: 1;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-header {
        padding: 1.25rem 1.5rem;
        border-bottom: 1px solid #f1f5f9;
    }

    .modal-header h3 {
        font-size: 1.15rem;
        font-weight: 700;
    }

    .modal-header h3 i {
        display: none !important;
    }

    .modal-header h3 div {
        font-size: 0.8rem;
    }

    .modal-footer {
        padding: 0.875rem;
        gap: 0.5rem;
        display: flex;
        flex-direction: row-reverse;
        border-top: 1px solid #e2e8f0;
        background: #ffffff !important;
        position: relative;
        z-index: 100;
        width: 100%;
        margin: 0 !important;
    }

    .modal-footer .btn {
        flex: 1;
        padding: 0.625rem 0.75rem;
        font-weight: 600;
        font-size: 0.875rem;
        border-radius: 8px;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.375rem;
    }

    .modal-footer .btn i {
        font-size: 0.875rem;
    }

    /* Force Delete buttons to be red in mobile overlays */
    .modal-footer .btn-danger {
        background: var(--danger) !important;
        color: white !important;
    }


    .btn-secondary {
        background: #ffffff;
        border: 1px solid var(--border);
        color: var(--text-dark);
    }

    .btn-secondary:hover {
        background: #f8fafc;
    }
}


/* Professions List Styling */
#professions-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

#professions-list li:hover {
    background: #e2e8f0;
}

#professions-list span {
    font-weight: 600;
    color: var(--text-dark);
}

.search-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}


/* Professional Users Table Styling */
@media (min-width: 768px) {

    #users-section .modern-table thead,
    #users-section .modern-table th {
        background: #123458 !important;
        color: #ffffff !important;
    }

    #users-section .modern-table tbody tr:hover::before {
        background: #123458 !important;
    }

    #users-section .modern-table td:first-child {
        color: #123458 !important;
    }

    /* Employees Table Styling */
    #employees-section .modern-table thead {
        background: linear-gradient(135deg, var(--primary), var(--primary-light));
    }
}

/* Mobile Users Table Specific Styling - Matching Original 100% */
@media (max-width: 767px) {

    #users-section .table-container {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    #users-section .modern-table {
        display: block !important;
        width: 100% !important;
        border: none !important;
        background: transparent !important;
    }

    #users-section .modern-table tbody {
        display: block !important;
        width: 100% !important;
    }

    /* Users table mobile cards - Card with clear outer border */
    #users-section .modern-table tbody tr {
        display: flex !important;
        flex-direction: column !important;
        background: #ffffff !important;
        margin-bottom: 1.25rem !important;
        border-radius: 16px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
        border: 1px solid #cbd5e1 !important;
        padding: 1rem 1.25rem !important;
        overflow: hidden !important;
        cursor: pointer !important;
        transition: all 0.3s ease !important;
        position: relative !important;
    }

    #users-section .modern-table tbody tr:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08) !important;
        border-color: #059669 !important;
    }

    /* بطاقات المستخدمين المعطلين في الموبايل */
    #users-section .modern-table tbody tr.user-inactive {
        background: #fef2f2 !important;
        border-color: #fca5a5 !important;
    }

    /* Cell 1: Username & Icon on Right */
    #users-section .modern-table td:nth-child(1) {
        gap: 0.5rem;
        background: transparent;
        color: #059669;
        font-weight: 800;
        font-size: 1.15rem;
        border-bottom: none;
        padding: 0 0 0.4rem 0;
        width: 100%;
        overflow: visible;
    }

    #users-section .modern-table td:nth-child(1)::before {
        content: "\f2bd";
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: #10b981;
        font-size: 1.1rem;
    }

    /* Users table: Employee name with mobile status badge */
    #users-section .modern-table td:nth-child(2) {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 0.95rem;
        font-weight: 700;
        color: #64748b;
        border-bottom: none;
        padding: 0.25rem 0 0 0;
    }

    #users-section .modern-table td:nth-child(2)::before {
        display: none;
    }

    /* Users table: Role badge positioned top left */
    #users-section .modern-table td:nth-child(3) {
        display: flex;
        position: absolute;
        left: 1.25rem;
        top: 0.85rem;
        padding: 0;
        border: none;
        background: transparent;
        z-index: 2;
    }

    #users-section .modern-table td:nth-child(3)::before {
        display: none;
    }

    /* Admin badge styling for mobile */
    #users-section .modern-table td:nth-child(3) .badge-role.b-admin {
        background: #fed7aa !important;
        color: #9a3412 !important;
    }

    /* Manager badge styling for mobile */
    #users-section .modern-table td:nth-child(3) .badge-role.b-manager {
        background: #e6f7ef !important;
        color: #007038 !important;
    }

    /* Worker/Other badge styling for mobile */
    #users-section .modern-table td:nth-child(3) .badge-role.b-worker {
        background: #f1f5f9 !important;
        color: #475569 !important;
    }

    /* Users table: Status & Actions hidden on mobile cards (Shown in Details Overlay on Click) */
    #users-section .modern-table td:nth-child(4),
    #users-section .modern-table td:nth-child(5) {
        display: none !important;
    }

    /* Warehouse Section Mobile Cards */
    #warehouse-section .modern-table tbody tr {
        display: flex;
        flex-direction: column;
        background: #ffffff;
        margin-bottom: 1.25rem;
        border-radius: 16px;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
        border: 1px solid #94a3b8;
        /* إطار رصاصي أوضح */
        padding: 0;
        overflow: hidden;
        cursor: pointer;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
    }

    #warehouse-section .modern-table tbody tr:hover {
        transform: translateY(-4px);
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
        border-color: var(--primary-light);
    }

    /* 1. Code - Top Field */
    #warehouse-section .modern-table td:nth-child(1) {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.4rem;
        background: rgba(248, 250, 252, 0.5);
        color: var(--text-muted);
        font-weight: 600;
        border-bottom: 1px solid rgba(241, 245, 249, 0.8);
        padding: 0.6rem 1.25rem;
        font-size: 0.8rem;
    }

    @media (max-width: 767px) {
        .mobile-label-top {
            display: inline-block !important;
            font-size: 0.75rem;
            color: var(--text-muted);
            font-weight: 700;
            background: #f1f5f9;
            padding: 0.1rem 0.5rem;
            border-radius: 4px;
        }
    }

    #warehouse-section .modern-table td:nth-child(1)::before {
        content: "\f02a";
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: var(--primary);
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    /* 2. Name - Main Title */
    #warehouse-section .modern-table td:nth-child(2) {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 1.1rem;
        font-weight: 700;
        color: #1e293b;
        border-bottom: none;
        padding: 0.85rem 1.25rem;
        gap: 1rem;
    }

    #warehouse-section .modern-table td:nth-child(2)::before {
        display: none;
    }

    /* 3. Balance - Moved inline to Name row */
    #warehouse-section .modern-table tbody tr td:nth-child(5) {
        display: none !important;
    }

    /* Inline Badge Styling (used across sections) */
    /* Mobile specific visibility */
    @media (max-width: 767px) {
        .mobile-badge-inline {
            display: inline-block !important;
        }

        .hide-on-mobile {
            display: none !important;
        }
    }

    /* Warehouse specific colors for inline badge */
    .mobile-badge-inline.balance-danger {
        background: #fee2e2;
        color: #dc2626;
    }

    .mobile-badge-inline.balance-warning {
        background: #fef3c7;
        color: #d97706;
    }

    .mobile-badge-inline.balance-success {
        background: #dcfce7;
        color: #16a34a;
    }

    /* Hide other cells by default on mobile for warehouse */
    #warehouse-section .modern-table tbody tr td:nth-child(n+3):nth-child(-n+4),
    #warehouse-section .modern-table tbody tr td:nth-child(6) {
        display: none;
    }




    /* Utilities Section Mobile Cards */
    @media (max-width: 767px) {

        /* Hide action buttons in mobile card view */
        #overtime-section .action-buttons,
        #warehouse-section .action-buttons,
        #incoming-section .action-buttons,
        #outgoing-section .action-buttons,
        #employees-section .action-buttons,
        #users-section .action-buttons,
        #utilities-section .action-buttons,
        #vacations-section .action-buttons,
        #professional-documents-section .action-buttons,
        #special-needs-section .action-buttons,
        #custodies-section .action-buttons,
        #promotions-section .action-buttons,
        #bonuses-section .action-buttons,
        #deductions-section .action-buttons,
        #deduction-hours-section .action-buttons,
        #resignations-section .action-buttons,
        #loans-section .action-buttons,
        #training-courses-section .action-buttons,
        #social-contributions-section .action-buttons,
        #investigations-section .action-buttons,
        #evaluations-section .action-buttons,
        #ideal-employees-section .action-buttons,
        #departments-section .action-buttons,
        #professions-section .action-buttons,
        #areas-section .action-buttons {
            display: none !important;
        }

        #utilities-section .modern-table tbody tr {
            display: grid;
            grid-template-columns: 1fr 1fr;
            background: #ffffff;
            margin-bottom: 0.5rem;
            border-radius: 10px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
            border: 2px solid #cbd5e1;
            padding: 0;
            overflow: hidden;
            cursor: pointer;
            transition: all 0.2s ease;
            position: relative;
        }

        #utilities-section .modern-table tbody tr:hover {
            border-color: var(--primary-light);
            box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08);
        }

        /* 1. Apartment/Office Header (Full Width) */
        #utilities-section .modern-table td:nth-child(1) {
            grid-column: 1 / span 2;
            grid-row: 1;
            display: flex;
            justify-content: flex-start;
            align-items: center;
            gap: 0.4rem;
            padding: 0.5rem 0.75rem;
            font-size: 0.85rem;
            font-weight: 700;
            border-bottom: 1px dotted #94a3b8 !important;
            /* خط منقط قوي */
            border-left: none !important;
        }

        /* 2. Type Label - Hide it from header */
        #utilities-section .modern-table td:nth-child(2) {
            display: none !important;
        }

        /* 3 & 4. Account Number & Period (Same Row) */
        #utilities-section .modern-table td:nth-child(3) {
            grid-column: 1;
            grid-row: 2;
            padding: 0.4rem 0.75rem 0.4rem 0.25rem;
            font-size: 0.75rem;
            font-weight: 700;
            color: #334155;
            border-bottom: 1px dotted #94a3b8 !important;
            /* خط منقط قوي */
            display: flex;
            align-items: center;
            border-left: none !important;
        }

        #utilities-section .modern-table td:nth-child(3)::before {
            content: "رقم حساب السداد: ";
            font-size: 0.6rem;
            color: #94a3b8;
            font-weight: 600;
            margin-left: 0.15rem;
        }

        #utilities-section .modern-table td:nth-child(4) {
            grid-column: 2;
            grid-row: 2;
            padding: 0.4rem 0.25rem 0.4rem 0.75rem;
            font-size: 0.7rem;
            font-weight: 400;
            color: #64748b;
            border-bottom: 1px dotted #94a3b8 !important;
            /* خط منقط قوي */
            display: flex;
            align-items: center;
            justify-content: flex-end;
            border-left: none !important;
        }

        #utilities-section .modern-table td:nth-child(4)::before {
            content: "|";
            margin-left: 0.4rem;
            color: #e2e8f0;
        }

        /* 5 & 6. Amount and Payment Status (Full Width Footer) */
        #utilities-section .modern-table td:nth-child(5),
        #utilities-section .modern-table td:nth-child(6) {
            grid-column: 1 / span 2;
            grid-row: 3;
            display: flex;
            align-items: center;
            padding: 0.25rem 0.75rem;
            font-size: 0.85rem;
            font-weight: 800;
            border-top: none;
            /* إزالة الخط القديم */
            margin-top: 0;
            min-height: 40px;
        }

        /* Amount on the Right (flex-start in RTL) */
        #utilities-section .modern-table td:nth-child(5) {
            justify-content: flex-start;
        }

        /* Status on the Left (flex-end in RTL) - No background to avoid covering Amount */
        #utilities-section .modern-table td:nth-child(6) {
            justify-content: flex-end;
            background: transparent !important;
            border-top: none !important;
            z-index: 2;
        }

        /* Remove labels for Amount and Status on Mobile Cards */
        #utilities-section .modern-table td:nth-child(5)::before,
        #utilities-section .modern-table td:nth-child(6)::before {
            display: none !important;
        }

        /* Background handles by td:nth-child(5) or shared rules */
        #utilities-section .utility-elec td:nth-child(5) {
            background: #fffcf0 !important;
            color: #92400e;
        }

        #utilities-section .modern-table td:nth-child(7),
        #utilities-section .modern-table td:nth-child(8) {
            display: none !important;
        }

        #utilities-section .modern-table td::before {
            content: attr(data-label);
            font-size: 0.75rem;
            font-weight: 700;
            border-bottom: 1px solid rgba(0, 0, 0, 0.03);
            margin-left: 0.5rem;
        }
    }

    #utilities-section .utility-water td:nth-child(5) {
        background: #e6f7ef !important;
        color: #008c44;
    }

    #utilities-section .utility-elec td:nth-child(6) {
        color: #d97706;
    }

    #utilities-section .utility-water td:nth-child(6) {
        color: #008c44;
    }

    /* Icons and Colors based on class */
    #utilities-section .modern-table tbody tr.utility-elec {
        border-right: 4px solid #fcd34d;
    }

    #utilities-section .modern-table tbody tr.utility-elec td:nth-child(1) {
        background: #fffbeb;
        color: #92400e;
    }

    #utilities-section .modern-table tbody tr.utility-elec td:nth-child(1)::before {
        content: "\f0e7";
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: #fbbf24;
        margin-left: 0.25rem;
    }

    #utilities-section .modern-table tbody tr.utility-water {
        border-right: 4px solid #6ee7b7;
    }

    #utilities-section .modern-table tbody tr.utility-internet {
        border-right: 4px solid #f97316;
    }

    #utilities-section .modern-table tbody tr.utility-water td:nth-child(1) {
        background: #e6f7ef;
        color: #007038;
    }

    #utilities-section .modern-table tbody tr.utility-internet td:nth-child(1) {
        background: #fff7ed;
        color: #9a3412;
    }

    #utilities-section .modern-table tbody tr.utility-water td:nth-child(1)::before {
        content: "\f043";
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: #008c44;
        margin-left: 0.25rem;
    }

    #utilities-section .modern-table tbody tr.utility-internet td:nth-child(1)::before {
        content: "\f7d9";
        /* Wifi icon */
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: #f97316;
        margin-left: 0.25rem;
    }

    /* Colors for Details Modal */
    .elec-bg {
        background: #fffcf0 !important;
        border-color: #fcd34d !important;
    }

    .elec-bg i,
    .elec-bg label,
    .elec-bg .amount-val {
        color: #d97706 !important;
    }

    .water-bg {
        background: #e6f7ef !important;
        border-color: #66d9a6 !important;
    }

    .water-bg i,
    .water-bg label,
    .water-bg .amount-val {
        color: #008c44 !important;
    }

    .highlight-amount .detail-info {
        display: flex;
        flex-direction: row !important;
        align-items: center;
        gap: 0.5rem;
    }

    .highlight-amount .amount-val {
        font-size: 1.2rem;
        font-weight: 800;
    }
}


/* زر تفعيل التعديل السريع في إدارة المخازن */
#toggle-warehouse-inline-edit {
    background-color: #8b5cf6 !important;
    /* بنفسجي */
    border-color: #8b5cf6 !important;
    color: white !important;
}

#toggle-warehouse-inline-edit:hover {
    background-color: #7c3aed !important;
    border-color: #7c3aed !important;
}

/* الحالة المفعلة للزر (أصفر) */
#toggle-warehouse-inline-edit.btn-toggle-active {
    background-color: #fbbf24 !important;
    border-color: #fbbf24 !important;
    color: #000000 !important;
}

#toggle-warehouse-inline-edit.btn-toggle-active:hover {
    background-color: #f59e0b !important;
    border-color: #f59e0b !important;
}

/* Alert Modal */
.alert-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    /* Remove backdrop-filter for performance */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.alert-modal.show {
    opacity: 1;
    visibility: visible;
}

.alert-dialog {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.alert-modal.show .alert-dialog {
    transform: scale(1);
}

.alert-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #fef2f2, #ffffff);
}

.alert-header h3 {
    color: var(--danger);
    font-size: 1.3rem;
    margin: 0;
}

.alert-body {
    padding: 2rem;
    text-align: center;
}

.alert-icon {
    font-size: 4rem;
    color: var(--danger);
    margin-bottom: 1.5rem;
}

.alert-icon.success {
    color: var(--success);
}

.alert-icon.info {
    color: var(--primary);
}

.alert-content {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-dark);
}

.alert-content strong {
    color: var(--danger);
    font-weight: 800;
}

.alert-content .duplicate-info {
    background: #fef2f2;
    border: 2px solid #fecaca;
    border-radius: var(--radius-md);
    padding: 1rem;
    margin: 1rem 0;
    text-align: right;
}

.alert-content .duplicate-info p {
    margin: 0.5rem 0;
    font-weight: 600;
}

.alert-footer {
    padding: 1.5rem;
    border-top: 2px solid var(--border);
    display: flex;
    justify-content: center;
}

.alert-footer .btn {
    min-width: 120px;
}


/* Load More Button */
#load-more-employees,
#load-more-users {
    padding: 1rem;
}

#load-more-employees .btn,
#load-more-users .btn {
    min-width: 200px;
}

/* Success Button */
.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
}

/* Import Preview Modal */
#import-preview-modal .modern-table {
    font-size: 0.9rem;
}

#import-preview-modal .modern-table th,
#import-preview-modal .modern-table td {
    padding: 0.75rem;
}

/* Toolbar responsive */
@media (max-width: 767px) {
    .toolbar-card>div:last-child {
        flex-direction: column;
        width: 100%;
    }

    .toolbar-card>div:last-child .btn {
        width: 100%;
    }
}


/* Info Button (Export) */
.btn-info {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: white;
}

.btn-info:hover {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    transform: translateY(-2px);
}

/* Toolbar buttons responsive */
@media (max-width: 767px) {
    .toolbar-card>div:last-child {
        width: 100%;
    }

    .toolbar-card>div:last-child .btn {
        flex: 1;
        min-width: 0;
        font-size: 0.85rem;
        padding: 0.6rem 0.5rem;
    }

    .toolbar-card>div:last-child .btn i {
        font-size: 0.9rem;
    }
}


/* Import Report Modal */
#import-report-modal .modal-body {
    padding: 2rem;
}

#import-report-content {
    direction: rtl;
}

#import-report-content h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Report scrollable errors */
#import-report-content>div>div {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

#import-report-content>div>div::-webkit-scrollbar {
    width: 8px;
}

#import-report-content>div>div::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

#import-report-content>div>div::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

#import-report-content>div>div::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}


/* Warning Button (Stats) */
.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-2px);
}

/* Professions Stats Modal */
#professions-stats-modal .modal-dialog {
    max-width: 900px;
    max-height: 95vh;
    margin: 1rem auto;
}

#professions-stats-modal .modal-content {
    max-height: 95vh;
    display: flex;
    flex-direction: column;
}

#professions-stats-modal .modal-body {
    overflow-y: auto;
    flex: 1;
}

#professions-stats-content>div:last-child {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

#professions-stats-content>div:last-child::-webkit-scrollbar {
    width: 8px;
}

#professions-stats-content>div:last-child::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

#professions-stats-content>div:last-child::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

#professions-stats-content>div:last-child::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Modal full height */
.modal {
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.6);
    /* Default dark overlay for desktop */
}

@media (max-width: 767px) {
    .modal {
        background: #ffffff !important;
        /* Solid white background for mobile as requested */
    }
}

.modal-dialog {
    margin: 1rem auto;
    width: calc(100% - 2rem);
    /* Added to prevent touching edges */
    max-width: 90%;
}

@media (min-width: 768px) {
    .modal-dialog {
        max-height: 95vh;
        width: 600px;
        /* Default for desktop */
    }

    /* Add New Soiree modal: Unified A4 page look without clipping */
    #overtime-modal .modal-dialog {
        width: 850px;
        max-width: 95%;
        margin: 2rem auto;
    }

    /* Incoming and Outgoing modals: wider on desktop */
    #incoming-modal .modal-dialog,
    #outgoing-modal .modal-dialog {
        width: 720px;
        max-width: 95%;
    }

    /* Ensure equal width for all form fields in outgoing modal */
    #outgoing-modal .form-grid>.form-group:not(.form-col-2) {
        grid-column: span 1 !important;
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
    }

    /* Reduce gap between fields in outgoing and incoming modals */
    #outgoing-modal .form-grid,
    #incoming-modal .form-grid {
        gap: 0.5rem !important;
    }

    #outgoing-modal .form-group,
    #incoming-modal .form-group {
        margin-bottom: 0 !important;
    }

    /* Ensure autocomplete-wrapper takes full width in modal form-groups */
    #outgoing-modal .form-group .autocomplete-wrapper,
    #incoming-modal .form-group .autocomplete-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        display: block !important;
        box-sizing: border-box !important;
        flex: none !important;
    }

    #outgoing-modal .form-group .autocomplete-wrapper input,
    #incoming-modal .form-group .autocomplete-wrapper input {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Ensure all inputs in outgoing modal form-groups have same width */
    #outgoing-modal .form-group .form-control,
    #incoming-modal .form-group .form-control {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    #overtime-modal .modal-content {
        background: #ffffff !important;
        border-radius: 12px;
        box-shadow: var(--shadow-xl);
        overflow: visible;
        /* Ensure footer and body are visible */
        display: flex;
        flex-direction: column;
    }

    #overtime-modal .modal-body {
        max-height: calc(95vh - 200px);
        /* Leave room for header/footer */
        overflow-y: auto;
        background: #ffffff !important;
    }

    #overtime-modal .modal-footer {
        margin-top: 0;
        padding: 1.5rem 2rem;
        background: #ffffff !important;
        border-top: 1px solid #f1f5f9;
        z-index: 10;
        border-radius: 0 0 12px 12px;
    }

    /* General desktop footer fix */
    .modal-footer {
        background: #ffffff !important;
        border-top: 1px solid #f1f5f9;
        padding-top: 1.5rem;
        margin-top: 0;
    }
}


/* Block/Unblock button icons */
.btn-icon.warning {
    background: #f59e0b;
}

.btn-icon.warning:hover {
    background: #d97706;
}

.btn-icon.success {
    background: #10b981;
}

.btn-icon.success:hover {
    background: #059669;
}


/* Autocomplete Search Results */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--primary);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.search-result-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #f8fafc;
}

.search-result-item.no-results {
    cursor: default;
    color: var(--text-muted);
    text-align: center;
}

.search-result-item.no-results:hover {
    background: white;
}

.result-code {
    font-weight: 700;
    color: var(--primary);
    min-width: 100px;
}

.result-name {
    flex: 1;
    color: var(--text-dark);
}

/* Form column span - تم إلغاؤه لصالح عمود واحد */
/* .form-col-2 تم تعريفه في الأعلى */

@media (max-width: 767px) {

    /* على الموبايل، كل الحقول في صف منفصل */
    .form-col-2 {
        grid-column: span 1 !important;
    }

    /* Force all form grids and columns to a single column on mobile */
    #special-need-form div[style*="grid-template-columns"],
    #professional-document-form div[style*="grid-template-columns"],
    #employee-form div[style*="grid-template-columns"],
    #special-need-form .form-grid,
    #special-need-form .form-grid-2,
    #professional-document-form .form-grid,
    #professional-document-form .form-grid-2,
    #employee-form .form-grid,
    #employee-form .form-grid-2,
    #employee-form .form-grid-3,
    #employee-form .form-row {
        grid-template-columns: 1fr !important;
    }

    #special-need-form .form-group,
    #professional-document-form .form-group,
    #employee-form .form-group {
        grid-column: span 1 !important;
    }
}

/* Modern Confirm Delete Modal Styles */
#confirm-modal {
    z-index: 2000;
}

#confirm-modal .modal-content {
    border: none;
    border-radius: 20px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.confirm-icon-wrapper {
    animation: pulse-red 2s infinite;
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes pulse-red {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(0.95);
        opacity: 0.8;
    }
}

#confirm-delete-btn.disabled,
#confirm-delete-btn:disabled {
    background-color: #fca5a5 !important;
    border-color: #fca5a5 !important;
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

#confirm-input:focus {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1) !important;
    outline: none;
}

/* Modern Confirm Delete Modal Styles */
#confirm-modal {
    z-index: 2000;
}

#confirm-modal .modal-content {
    border: none;
    border-radius: 20px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.confirm-icon-wrapper {
    animation: pulse-red 2s infinite;
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes pulse-red {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(0.95);
        opacity: 0.8;
    }
}

#confirm-delete-btn.disabled,
#confirm-delete-btn:disabled {
    background-color: #fca5a5 !important;
    border-color: #fca5a5 !important;
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

#confirm-input:focus {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1) !important;
    outline: none;
}

/* Very small screens */
@media (max-width: 400px) {
    .time-fields-row {
        grid-template-columns: 1.3fr 1.3fr 0.6fr !important;
        gap: 0.4rem !important;
    }

    .time-fields-row label {
        font-size: 0.75rem;
    }

    .time-fields-row .form-group:last-child {
        max-width: 60px;
    }

    .time-fields-row .form-group:last-child select {
        font-size: 0.8rem;
        padding: 0.4rem 0.2rem 0.4rem 0.4rem;
        padding-right: 1.3rem;
    }
}



/* ================================================
   Permissions Modal - Modern Professional Design
   ================================================ */

/* Dialog size */
.perm-modal-dialog {
    max-width: 760px;
}

/* Header */
.perm-modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 1.75rem;
    padding-left: 3.5rem;
    background: #123458 !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    color: white;
    position: relative;
}

.perm-header-icon {
    width: 52px;
    height: 52px;
    min-width: 52px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.perm-header-text h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
}

.perm-header-text p {
    margin: 0.2rem 0 0;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
}

.perm-close-btn {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #dc2626 !important;
    background: #ffffff !important;
    border-radius: 4px !important;
    width: 28px !important;
    height: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
}

.perm-close-btn:hover {
    background: #f87171 !important;
    color: white !important;
}

/* Body */
.perm-modal-body {
    padding: 1.25rem;
    max-height: 70vh;
    overflow-y: auto;
    background: #f1f5f9;
}

/* User Selector */
.perm-user-selector {
    background: white;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
}

.perm-select-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.6rem;
}

.perm-select {
    width: 100%;
    padding: 0.65rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    background: #f8fafc;
    transition: border-color 0.2s;
    appearance: none;
    cursor: pointer;
}

.perm-select:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

/* Permission Cards */
.perm-card {
    background: white;
    border-radius: 14px;
    margin-bottom: 1rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.perm-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.perm-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    color: white;
}

.perm-card-header h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: white;
}

.perm-card-header span {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
}

.perm-card-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Card Color Variants */
.perm-view-color {
    background: linear-gradient(135deg, #0f766e, #14b8a6);
}

.perm-emp-color {
    background: linear-gradient(135deg, #007038, #008c44);
}

.perm-user-color {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
}

.perm-wh-color {
    background: linear-gradient(135deg, #92400e, #d97706);
}

.perm-inc-color {
    background: linear-gradient(135deg, #065f46, #10b981);
}

.perm-out-color {
    background: linear-gradient(135deg, #9f1239, #f43f5e);
}

.perm-ot-color {
    background: linear-gradient(135deg, #312e81, #6366f1);
}

/* Toggle Grid */
.perm-toggles-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
}

.perm-toggles-grid.perm-3col {
    grid-template-columns: repeat(3, 1fr);
}

.perm-toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    border-left: 1px solid #f1f5f9;
    transition: background 0.15s;
}

.perm-toggle-item:hover {
    background: #f8fafc;
}

.perm-toggle-item:last-child,
.perm-toggles-grid.perm-3col .perm-toggle-item:nth-last-child(-n+3) {
    border-bottom: none;
}

.perm-toggle-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
}

.perm-toggle-info i {
    width: 24px;
    text-align: center;
    font-size: 0.8rem;
}

/* Icon Colors */
.perm-icon-emp {
    color: #008c44;
}

.perm-icon-user {
    color: #8b5cf6;
}

.perm-icon-wh {
    color: #f59e0b;
}

.perm-icon-inc {
    color: #10b981;
}

.perm-icon-out {
    color: #ef4444;
}

.perm-icon-ot {
    color: #6366f1;
}

.perm-icon-add {
    color: #059669;
}

.perm-icon-edit {
    color: #008c44;
}

.perm-icon-del {
    color: #dc2626;
}

/* Toggle Switch */
.perm-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    cursor: pointer;
    flex-shrink: 0;
}

.perm-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.perm-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 24px;
    transition: background 0.25s;
}

.perm-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 3px;
    right: 3px;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.perm-switch input:checked+.perm-slider {
    background: #16a34a;
}

.perm-switch input:checked+.perm-slider::before {
    transform: translateX(-18px);
}

.perm-switch input:focus+.perm-slider {
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2);
}

/* Footer */
.perm-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.75rem;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.perm-save-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem !important;
    font-weight: 700 !important;
    background: linear-gradient(135deg, #007038, #008c44) !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 14px rgba(0, 140, 68, 0.35) !important;
    transition: all 0.2s !important;
}

.perm-save-btn:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45) !important;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .perm-modal-dialog {
        max-width: 100% !important;
        margin: 0;
        border-radius: 0;
    }

    .perm-modal-header {
        padding: 1rem 1.25rem;
        border-radius: 0;
    }

    .perm-header-icon {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }

    .perm-header-text h3 {
        font-size: 1rem;
    }

    .perm-modal-body {
        padding: 0.875rem;
        max-height: 65vh;
    }

    .perm-toggles-grid,
    .perm-toggles-grid.perm-3col {
        grid-template-columns: 1fr;
    }

    .perm-toggle-item:last-child {
        border-bottom: none;
    }

    .perm-modal-footer {
        padding: 1rem;
        flex-direction: row-reverse;
    }

    .perm-save-btn {
        flex: 1;
    }
}


.permissions-title {
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 700;
    margin: 0 0 0.625rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
}

.permissions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.625rem;
}

.permissions-grid .custom-checkbox {
    font-size: 0.8125rem;
    padding: 0.5rem 0.625rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    margin: 0;
}

@media (max-width: 768px) {
    .permissions-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .permissions-section {
        padding: 0.75rem;
        margin-bottom: 0.875rem;
    }

    .permissions-title {
        font-size: 0.8125rem;
        padding-bottom: 0.375rem;
        margin-bottom: 0.5rem;
    }

    .permissions-grid .custom-checkbox {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
}


/* Permissions Modal Specific Styles */
#permissions-modal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
    padding: 1rem;
}

#permissions-modal .form-group {
    margin-bottom: 1rem;
}

#permissions-modal .form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

#permissions-modal .form-control {
    font-size: 0.875rem;
    padding: 0.625rem;
}

#permissions-modal .modal-footer {
    padding: 1rem;
    gap: 0.75rem;
}

#permissions-modal .modal-footer .btn {
    font-size: 0.875rem;
    padding: 0.625rem 1.25rem;
}

@media (max-width: 768px) {
    #permissions-modal .modal-dialog {
        max-width: 100% !important;
        width: 100% !important;
        height: 100vh !important;
        margin: 0;
    }

    #permissions-modal .modal-content {
        height: 100vh !important;
        border-radius: 0 !important;
        display: flex;
        flex-direction: column;
    }

    #permissions-modal .modal-body {
        max-height: none !important;
        flex: 1;
        overflow-y: auto;
        padding: 0.875rem;
    }

    #permissions-modal .modal-footer {
        padding: 0.875rem;
    }
}






/* --- Labor Assignments Mobile Improvements --- */
@media (max-width: 767px) {
    .labor-toolbar-buttons {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        width: 100% !important;
        gap: 0.5rem !important;
    }

    .labor-toolbar-buttons .btn {
        width: 100% !important;
        padding: 0.75rem 0.5rem !important;
        font-size: 0.85rem !important;
        min-width: 0 !important;
        white-space: nowrap !important;
    }

    .labor-toolbar-buttons button i {
        margin: 0 !important;
        font-size: 1rem !important;
    }

    .mobile-group-header {
        transition: background-color 0.2s;
    }

    .mobile-group-header:active {
        background-color: #f1f5f9 !important;
    }

    .mobile-child-card {
        transition: transform 0.2s;
    }

    .mobile-child-card:active {
        transform: scale(0.98);
        background-color: #f8fafc !important;
    }
}

/* --- New UI Enhancements --- */
.summary-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.summary-card.hidden {
    opacity: 0;
    transform: translateY(-10px);
    display: none;
}

.mobile-child-card:hover {
    border-color: var(--primary-light) !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.employee-name-hidden {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


/* تنسيق قسم الوارد والمنصرف للموبايل فقط */
@media (max-width: 768px) {

    /* صف البحث - حقل البحث وزر بحث في صف واحد */
    #incoming-section .incoming-search-row,
    #outgoing-section .outgoing-search-row,
    #utilities-section .utility-search-row {
        display: flex !important;
        flex-direction: row !important;
        gap: 0.5rem !important;
        align-items: stretch !important;
    }

    #incoming-section .incoming-search-row .autocomplete-wrapper,
    #outgoing-section .outgoing-search-row .autocomplete-wrapper,
    #utilities-section .utility-search-row .autocomplete-wrapper {
        flex: 1 !important;
    }

    #incoming-section .incoming-search-row .btn,
    #outgoing-section .outgoing-search-row .btn,
    #utilities-section .utility-search-row .btn {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
    }

    /* صف التاريخ - من وإلى في صف واحد، زر تطبيق تحتهم */
    #incoming-section .incoming-date-row,
    #outgoing-section .outgoing-date-row,
    #utilities-section .utility-date-row {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    #incoming-section .incoming-date-row>div:first-child,
    #outgoing-section .outgoing-date-row>div:first-child,
    #utilities-section .utility-date-row>div:first-child {
        display: flex !important;
        gap: 0.5rem !important;
    }

    #incoming-section .incoming-date-row label,
    #outgoing-section .outgoing-date-row label,
    #utilities-section .utility-date-row label {
        font-size: 0.9rem !important;
        font-weight: 600 !important;
        white-space: nowrap !important;
    }

    #incoming-section .incoming-date-row .form-control,
    #outgoing-section .outgoing-date-row .form-control,
    #utilities-section .utility-date-row .form-control {
        font-size: 0.9rem !important;
        padding: 0.5rem 0.75rem !important;
        /* تقليل الارتفاع */
        height: 40px !important;
        /* ارتفاع ثابت ومضغوط */
    }

}


/* Apartment History Modal Styles */
.history-summary {
    margin-bottom: 1.5rem;
}

.summary-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    background: #008c44;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #007038;
    min-height: 60px;
}

#meal-summary-card:not(.alert-mode) {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    display: block !important;
}

.summary-card.alert-mode {
    display: block !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
}

.summary-card .summary-item {
    text-align: center;
}

.summary-card .label {
    display: block;
    font-size: 0.8rem;
    color: #ffffff;
    margin-bottom: 0.25rem;
}

.summary-card .value {
    display: block;
    font-size: 1.1rem;
    font-weight: bold;
    color: #ffffff;
}

.summary-card .value.paid {
    color: #86efac;
}

.summary-card .value.unpaid {
    color: #fca5a5;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    transition: all 0.2s ease;
    margin-bottom: 0.25rem;
}

.history-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-light);
}

.history-item.paid {
    border-left: 4px solid #10b981;
    background: linear-gradient(to right, #f0fdf4, #ffffff);
}

.history-item.unpaid {
    border-left: 4px solid #f59e0b;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid #f1f5f9;
}

.period-amount-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.history-header .month {
    font-weight: bold;
    color: #1f2937;
    font-size: 0.9rem;
}

.history-header .year {
    font-size: 0.75rem;
    color: #6b7280;
}

.history-header .amount {
    font-size: 1rem;
    font-weight: bold;
    color: #059669;
    margin-right: auto;
}

.payment-info {
    margin: 0.25rem 0;
    color: #6b7280;
    font-size: 0.75rem;
}

.payment-info i {
    color: #10b981;
}

.history-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
    align-items: center;
}

/* Status Pill */
.status-pill {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
}

.status-pill.paid {
    background: #dcfce7;
    color: #166534;
}

.status-pill.unpaid {
    background: #fef3c7;
    color: #92400e;
}

/* Mobile responsive for history modal */
@media (max-width: 768px) {
    .summary-card {
        grid-template-columns: repeat(2, 1fr);
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .summary-card .label {
        font-size: 0.7rem;
    }

    .summary-card .value {
        font-size: 0.95rem;
    }

    .history-item {
        padding: 0.75rem;
    }

    .history-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .period-amount-row {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .history-header .month {
        font-size: 0.85rem;
    }

    .history-header .year {
        font-size: 0.7rem;
    }

    .history-header .amount {
        font-size: 0.9rem;
        margin-right: 0;
        margin-left: auto;
    }

    .history-actions {
        flex-direction: column !important;
        gap: 0.5rem !important;
        width: 100%;
        align-items: stretch !important;
    }

    .history-actions>div {
        display: flex !important;
        gap: 0.5rem !important;
        width: 100%;
    }

    .history-actions .btn-sm {
        flex: 1;
        padding: 0.5rem 0.5rem !important;
        font-size: 0.75rem !important;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
        white-space: nowrap;
    }

    .history-actions .btn-sm i {
        font-size: 0.7rem !important;
    }

    .status-pill {
        width: 100%;
        text-align: center;
        padding: 0.4rem;
        font-size: 0.75rem;
        order: -1;
    }
}

/* Mobile Action Buttons with Text */
@media (max-width: 767px) {
    .action-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        width: calc(100% + 1rem);
        margin: 0 -0.5rem;
        padding: 0 0.5rem;
    }

    .btn-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0.5rem;
        border-radius: 8px;
        min-width: 38px;
        height: 38px;
        border: none;
    }

    /* حذف النصوص المضافة برمجياً لضمان بقاء الأيقونات فقط */
    .btn-icon.btn-success::after,
    .btn-icon.btn-info::after,
    .btn-icon.btn-edit::after,
    .btn-icon.btn-delete::after {
        content: none !important;
    }

    /* Make sure icons are visible but smaller */
    .btn-icon i {
        font-size: 0.9rem;
        flex-shrink: 0;
    }

    /* Adjust table cell for mobile */
    .modern-table tbody tr td:last-child {
        padding: 0.75rem 0.25rem;
    }

    /* Full width table in mobile */
    .modern-table {
        width: calc(100% + 1rem);
        margin: 0 -0.5rem;
    }

    .modern-table tbody tr td {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* Desktop - keep icons only */
@media (min-width: 768px) {
    .action-buttons {
        display: flex;
        gap: 0.25rem;
        justify-content: center;
        flex-wrap: wrap;
    }

    .btn-icon {
        width: auto;
        min-width: 32px;
        height: 32px;
        padding: 0.25rem;
    }
}

/* Button Colors for New Actions */
.btn-icon.btn-success {
    background-color: #10b981;
    color: white;
    border: 1px solid #10b981;
}

.btn-icon.btn-success:hover {
    background-color: #059669;
    border-color: #059669;
}

.btn-icon.btn-info {
    background-color: #008c44;
    color: white;
    border: 1px solid #008c44;
}

.btn-icon.btn-info:hover {
    background-color: #007038;
    border-color: #007038;
}

.btn-icon.btn-edit {
    background-color: #f59e0b;
    color: white;
    border: 1px solid #f59e0b;
}

.btn-icon.btn-edit:hover {
    background-color: #d97706;
    border-color: #d97706;
}

.btn-icon.btn-delete {
    background-color: #dc2626;
    color: white;
    border: 1px solid #dc2626;
}

.btn-icon.btn-delete:hover {
    background-color: #b91c1c;
    border-color: #b91c1c;
}

/* Ensure proper spacing in mobile view */
@media (max-width: 767px) {
    .modern-table tbody tr {
        border-bottom: 2px solid #f3f4f6;
        margin-bottom: 1rem;
    }

    .modern-table tbody tr td[data-label="إجراءات"] {
        background: #f8fafc;
        border-radius: 0 0 8px 8px;
    }
}

/* Mobile Buttons Grid for Details Modal */
.mobile-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    width: calc(100% + 2rem);
    margin: 0 -1rem;
    padding: 0 1rem;
}

.mobile-btn {
    padding: 0.75rem 0.5rem !important;
    font-size: 0.9rem !important;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    border: 1px solid transparent;
}

.mobile-btn i {
    font-size: 1rem;
    flex-shrink: 0;
}

/* Ensure danger button is red in modal */
.mobile-btn.btn-danger {
    background-color: #dc2626 !important;
    color: white !important;
    border-color: #dc2626 !important;
}

.mobile-btn.btn-danger:hover {
    background-color: #b91c1c !important;
    border-color: #b91c1c !important;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .btn-icon {
        font-size: 0.75rem;
        padding: 0.35rem 0.4rem;
        height: 38px;
    }

    .btn-icon i {
        font-size: 0.8rem;
    }

    .mobile-btn {
        font-size: 0.8rem !important;
        padding: 0.5rem 0.4rem !important;
        height: 42px;
    }

    .mobile-btn i {
        font-size: 0.85rem;
    }
}

/* Very small screens - stack buttons vertically if needed */
@media (max-width: 360px) {
    .action-buttons {
        grid-template-columns: 1fr;
        width: calc(100% + 0.5rem);
    }

    .mobile-buttons-grid {
        grid-template-columns: 1fr;
        width: calc(100% + 1rem);
    }

    .btn-icon::after {
        display: none;
    }

    .btn-icon {
        width: 100%;
        height: 40px;
        padding: 0.5rem;
    }
}

/* Locked Fields Warning */
.locked-fields-warning {
    margin-bottom: 1rem;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.alert.alert-info {
    background-color: #e6f7ef;
    border: 1px solid #66d9a6;
    color: #007038;
}

.alert.alert-warning {
    background-color: #fef3c7;
    border: 1px solid #fbbf24;
    color: #92400e;
}

.alert i {
    font-size: 1rem;
    flex-shrink: 0;
}

/* Locked field styles */
input[readonly],
select[disabled] {
    cursor: not-allowed !important;
}

/* Full width buttons in mobile */
@media (max-width: 767px) {
    .modern-table {
        margin: 0 -0.5rem;
    }

    .modern-table tbody tr td {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* Latest Bill Display */
.month-year {
    font-weight: bold;
    color: #1f2937;
    font-size: 0.95rem;
}

/* Amount and Payment Status Display */
.amount-payment-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.amount-value {
    font-weight: bold;
    color: #059669;
    font-size: 1rem;
    flex-shrink: 0;
}

.payment-status {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.payment-status.paid {
    background-color: #dcfce7;
    color: #166534;
}

.payment-status.unpaid {
    background-color: #fef3c7;
    color: #92400e;
}

/* Mobile responsive adjustments */
@media (max-width: 767px) {
    .amount-payment-row {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        justify-content: space-between;
    }

    .month-year {
        font-size: 0.9rem;
    }

    .amount-value {
        font-size: 0.85rem;
    }

    .payment-status {
        font-size: 0.65rem;
        padding: 0.1rem 0.4rem;
    }
}

/* Mobile amount and payment display */
.amount-payment-mobile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.amount-payment-mobile .amount-val {
    font-weight: bold;
    color: #059669;
}

.amount-payment-mobile .badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
}

/* History Modal Title Styling */
#apartment-history-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
}

#apartment-history-title span:first-child {
    font-size: 1.3rem;
}

/* Utilities Table Desktop Enhancements */
@media (min-width: 768px) {

    #utilities-section .modern-table th,
    #utilities-section .modern-table td {
        border-left: 1px solid #e2e8f0 !important;
        padding: 1rem 0.75rem !important;
        display: table-cell !important;
        text-align: center;
        vertical-align: middle;
    }

    #utilities-section .modern-table th:first-child,
    #utilities-section .modern-table td:first-child {
        border-left: none !important;
        text-align: right;
    }

    #utilities-section .amount-cell {
        font-weight: 700;
        color: var(--primary);
        font-size: 1rem;
    }

    #utilities-section .status-cell {
        text-align: center;
    }

    #utilities-section .action-buttons {
        display: flex !important;
        justify-content: center;
        gap: 0.5rem;
        padding: 0;
    }

    #utilities-section td[data-label="حالة الدفع"] {
        width: 140px;
    }

    #utilities-section td[data-label="المبلغ"] {
        width: 140px;
    }

    #utilities-section td[data-label="النوع"] {
        width: 100px;
    }
}

/* Improve history modal header */
.modal-header h3 {
    margin: 0;
    line-height: 1.4;
}

/* Main Dashboard Logo Header */
.main-dashboard-header {
    text-align: center;
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.8), transparent);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.dashboard-logo {
    height: 120px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.1));
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dashboard-logo:hover {
    transform: scale(1.1) translateY(-5px);
}

.dashboard-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 600;
    position: relative;
    margin-top: 0.2rem;
}

.dashboard-subtitle::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
}

@media (max-width: 767px) {
    .dashboard-logo {
        height: 100px;
    }

    .dashboard-subtitle {
        font-size: 0.95rem;
    }

    .main-dashboard-header {
        padding: 1.5rem 1rem;
        margin-bottom: 1rem;
    }
}

/* Overtime Summary Card Enhancements */
.ot-summary-alert {
    background: #fffbeb;
    border: 1px solid #fef3c7;
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    color: #92400e;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    width: 100%;
}

.ot-summary-info {
    background: #f0f9ff;
    border: 1px solid #e0f2fe;
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    color: #0369a1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    width: 100%;
}

/* Show summary cards by default */
#overtime-summary-card,
#meal-summary-card {
    opacity: 1;
    visibility: visible;
}

.ot-summary-loading {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    width: 100%;
}

.ot-summary-result {
    background: linear-gradient(135deg, #007038, #008c44);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    width: 100% !important;
    margin: 0 auto;
}

.ot-summary-result>div {
    flex: 1;
    min-width: 0;
}

.ot-summary-result .icon-box {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.ot-summary-result .label-text {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 500;
}

.ot-summary-result .value-name {
    font-size: 1.3rem;
    font-weight: 800;
}

.ot-summary-result .total-val {
    font-size: 2rem;
    font-weight: 900;
    line-height: 1;
}

.ot-summary-result .unit {
    font-size: 1rem;
    font-weight: 600;
}

@media (max-width: 600px) {
    .ot-summary-result {
        flex-direction: column;
        text-align: center;
        gap: 0.6rem;
        /* تقليل المسافة إلى النصف */
        padding: 0.75rem;
        /* تقليل padding إلى النصف */
    }

    .ot-summary-result div {
        text-align: center !important;
    }

    .ot-summary-result .total-val {
        font-size: 1.8rem;
        /* تقليل حجم الخط */
        line-height: 1;
    }

    .ot-summary-result .icon-box {
        width: 35px;
        /* تقليل حجم الأيقونة */
        height: 35px;
        font-size: 1.2rem;
    }

    .ot-summary-result .label-text {
        font-size: 0.8rem;
        /* تقليل حجم الخط */
        margin-bottom: 0.2rem;
    }

    .ot-summary-result .value-name {
        font-size: 1.1rem;
        /* تقليل حجم الخط */
        margin-bottom: 0.3rem;
    }

    .ot-summary-result .unit {
        font-size: 0.9rem;
        /* تقليل حجم الخط */
    }

    .ot-summary-alert,
    .ot-summary-info,
    .ot-summary-loading {
        padding: 1rem;
        font-size: 0.95rem;
    }
}

/* Internet and Meals Visual Alerts */
.row-expired {
    background-color: #fee2e2 !important;
}

.row-warning {
    background-color: #fef3c7 !important;
}

.highlight-danger {
    background-color: #fee2e2;
    border-left: 4px solid #dc2626;
}

.highlight-warning {
    background-color: #fef3c7;
    border-left: 4px solid #f59e0b;
}

/* Permission icon for special actions */
.perm-icon-special {
    color: #10b981;
}

/* 4-column grid for permissions with 4 items */
.perm-4col {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* =================================================
   Mobile Cards Optimization (Internet & Meals) - V3 (Ultra Compact)
   ================================================= */
@media (max-width: 767px) {
    /* Internet Section Mobile Cards */
    #internet-section .modern-table thead,
    #internet-section .modern-table td:last-child,
    #internet-section .modern-table td:nth-child(2),
    /* Router Type */
    #internet-section .modern-table td:nth-child(6)

    /* User */
        {
        display: none !important;
    }

    #internet-section .modern-table tbody {
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
        padding: 0.25rem;
    }

    #internet-section .modern-table tbody tr {
        display: flex;
        flex-direction: column;
        background: #ffffff;
        border-radius: 20px;
        /* شكل بيضاوي */
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
        border: 1px solid #94a3b8;
        /* إطار رصاصي مثل الإجازات */
        overflow: hidden;
        min-height: auto;
        margin-bottom: 0.5rem;
    }

    /* Urgent Styling (Red) */
    #internet-section .modern-table tbody tr.row-urgent {
        border: 2px solid #ef4444 !important;
        background: #fffafa !important;
    }

    #internet-section .modern-table tbody tr.row-urgent td:nth-child(1) {
        background: #fee2e2 !important;
        color: #b91c1c !important;
        border-bottom: 1px dotted #fca5a5 !important;
    }

    #internet-section .modern-table td:nth-child(1) {
        background: #f1f5f9 !important;
        /* هيدر رصاصي مثل الأقسام الأخرى */
        padding: 0.6rem 1rem;
        font-weight: 700;
        color: #475569;
        font-size: 0.95rem;
        border-bottom: 1px dotted #94a3b8 !important;
        /* خط منقط قوي */
        display: flex;
        align-items: center;
        gap: 0.3rem;
        border-left: none !important;
    }

    #internet-section .modern-table td:nth-child(1)::before {
        content: "\f7d9";
        /* Wifi icon */
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: var(--primary);
        font-size: 0.85rem;
    }

    #internet-section .modern-table td:not(:nth-child(1)):not(:last-child) {
        display: flex;
        justify-content: flex-end;
        /* الافتراضي: اليسار */
        align-items: center;
        gap: 0.4rem;
        padding: 0.4rem 1rem;
        border-bottom: 1px dotted #94a3b8 !important;
        /* خط منقط قوي */
        font-size: 0.85rem;
        border-left: none !important;
    }

    /* آخر عنصر بدون خط سفلي */
    #internet-section .modern-table td:nth-child(5) {
        border-bottom: none !important;
    }

    /* رقم الشريحة (3) والمسئول (4) -> اليمين */
    #internet-section .modern-table td:nth-child(3),
    #internet-section .modern-table td:nth-child(4) {
        justify-content: flex-start !important;
    }

    /* Force Label specifically for SIM Number and others */
    #internet-section .modern-table td:not(:nth-child(1)):not(:last-child)::before {
        content: attr(data-label) ": " !important;
        display: inline-block !important;
        font-weight: 600;
        color: #94a3b8;
        font-size: 0.75rem;
    }


}



/* تصغير زر الحذف في إدارة مهن المقاولين والأقسام والمنتجات للموبايل */
/* تحسين عرض قوائم الإدارة على الموبايل */

/* --- Management Lists Formatting (Professions, Departments & Warehouse Categories) --- */
#professions-list li,
#contractor-professions-list li,
#departments-list li,
#warehouse-categories-list li {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 1.5rem !important;
    padding: 0.75rem !important;
    background: #f8fafc !important;
    border-radius: 8px !important;
    margin-bottom: 0.5rem !important;
    border: 1px solid #e2e8f0 !important;
    width: 100% !important;
    direction: rtl !important;
    min-width: 0 !important;
}

#professions-list li span,
#contractor-professions-list li span,
#departments-list li span,
#warehouse-categories-list li span {
    font-weight: 600 !important;
    color: #1e293b !important;
    text-align: right !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    min-width: 0 !important;
    flex: 1 !important;
}

#professions-list li>div:last-child,
#contractor-professions-list li>div:last-child,
#departments-list li>div:last-child,
#warehouse-categories-list li>div:last-child {
    display: flex !important;
    gap: 0.4rem !important;
    align-items: center !important;
    justify-content: flex-end !important;
    flex-shrink: 0 !important;
}

/* تحسين الفواصل بين التنبيهات والأساطير والجداول */
.alert,
.summary-card,
.record-status-legend,
.status-legend-container {
    margin-bottom: 1rem !important;
}

/* في وضع الموبايل نقلل الفواصل أكثر */
@media (max-width: 767px) {

    .alert,
    .summary-card,
    .record-status-legend,
    .status-legend-container {
        margin-bottom: 0.75rem !important;
    }
}

/* Global Hidden Override - MUST BE AT THE BOTTOM AND HIGH SPECIFICITY */
html .hidden,
body .hidden,
.view-section.hidden,
.modal.hidden,
.toolbar-card.hidden,
.toolbar-buttons-grid.hidden,
div.hidden,
button.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    border: none !important;
    width: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
}

/* Fix for mobile specifically */
@media (max-width: 768px) {

    #professions-list li,
    #contractor-professions-list li,
    #departments-list li,
    #warehouse-categories-list li {
        padding: 0.75rem !important;
        gap: 1.25rem !important;
        /* زيادة المسافة في القوائم المنسدلة والمجداول */
    }

    #professions-list .btn-icon,
    #contractor-professions-list .btn-icon,
    #departments-list .btn-icon,
    #warehouse-categories-list .btn-icon {
        padding: 0 !important;
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        font-size: 0.75rem !important;
    }

    #overtime-settings-modal .modern-table thead {
        display: none !important;
    }

    #overtime-settings-modal .modern-table tbody tr {
        display: block !important;
        background: #ffffff !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 12px !important;
        padding: 0.75rem !important;
        margin-bottom: 0.75rem !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
        overflow: hidden !important;
    }

    #overtime-settings-modal .modern-table td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.5rem 0.25rem !important;
        border: none !important;
        border-bottom: 1px solid #f1f5f9 !important;
        font-size: 0.95rem !important;
        text-align: right !important;
        min-height: 40px !important;
    }


}

/* Utilities Section Enhancements */
#utility-modal select.form-control,
#utility-modal select.form-control option:checked {
    background-color: var(--primary) !important;
    color: white !important;
    font-weight: 600 !important;
}

#utility-modal select.form-control option {
    background-color: white !important;
    color: var(--text-dark) !important;
}

/* Service-specific Details Coloring (Darker for White Text) */
.elec-bg {
    background: #f59e0b !important;
    /* Orange-Amber */
    border-color: #d97706 !important;
    color: white !important;
}

.elec-bg label,
.elec-bg .amount-val,
.elec-bg i {
    color: white !important;
}

.water-bg {
    background: #008c44 !important;
    /* Green-Primary */
    border-color: #007038 !important;
    color: white !important;
}

.water-bg label,
.water-bg .amount-val,
.water-bg i {
    color: white !important;
}


/* --- Desktop Layout Enhancements (Computer only) --- */
@media (min-width: 992px) {

    /* Search and Date filter rows in horizontal alignment */
    .incoming-search-row,
    .incoming-date-row,
    .outgoing-search-row,
    .outgoing-date-row,
    .overtime-date-row,
    .vacation-date-row,
    .utility-search-row,
    .utility-date-row {
        flex-direction: row !important;
        align-items: center !important;
        gap: 1.5rem !important;
        padding: 1.25rem !important;
    }

    /* Expand search/date fields container */
    .incoming-search-row>.autocomplete-wrapper,
    .outgoing-search-row>.autocomplete-wrapper,
    .utility-search-row>.autocomplete-wrapper,
    .incoming-date-row>div:first-of-type,
    .outgoing-date-row>div:first-of-type,
    .overtime-date-row>div:first-of-type,
    .vacation-date-row>div:first-of-type,
    .vacation-date-row>div:first-of-type {
        flex: 1 !important;
        margin-bottom: 0 !important;
    }

    /* Standard buttons in desktop horizontal row */
    .incoming-search-row .btn,
    .outgoing-search-row .btn,
    .utility-search-row .btn,
    .apply-date-btn {
        margin-top: 0 !important;
        height: 48px !important;
        min-width: 140px !important;
    }

    /* Ensure internal inputs in date row take space */
    .incoming-date-row>div:first-of-type>div,
    .outgoing-date-row>div:first-of-type>div,
    .overtime-date-row>div:first-of-type>div,
    .vacation-date-row>div:first-of-type>div,
    .vacation-date-row>div:first-of-type>div {
        flex: 1 !important;
        min-width: 0 !important;
    }
}

/* ==========================================================================
   WAREHOUSE VOUCHER FINAL OVERRIDES (ABSOLUTE PRIORITY - NO HOVER)
   ========================================================================== */

/* 1. Base Status Backgrounds (Forced) */
html body #incoming-section .modern-table tbody tr.wh-status-new,
html body #outgoing-section .modern-table tbody tr.wh-status-new,
.wh-status-new {
    background-color: #dcfce7 !important;
    background: #dcfce7 !important;
}

html body #incoming-section .modern-table tbody tr.wh-status-pending,
html body #outgoing-section .modern-table tbody tr.wh-status-pending,
.wh-status-pending {
    background-color: #fef9c3 !important;
    background: #fef9c3 !important;
}

html body #incoming-section .modern-table tbody tr.wh-status-old,
html body #outgoing-section .modern-table tbody tr.wh-status-old,
.wh-status-old {
    background-color: #ffffff !important;
    background: #ffffff !important;
}

/* 2. COMPLETELY DISABLE ALL HOVER EFFECTS (Desktop & Mobile) */
/* This rule is extremely specific (html body #id class tags :hover) to overcome any conflict */
html body #incoming-section .modern-table tbody tr:hover,
html body #outgoing-section .modern-table tbody tr:hover,
html body #incoming-section .modern-table tbody tr.wh-status-new:hover,
html body #outgoing-section .modern-table tbody tr.wh-status-new:hover,
html body #incoming-section .modern-table tbody tr.wh-status-pending:hover,
html body #outgoing-section .modern-table tbody tr.wh-status-pending:hover,
html body #incoming-section .modern-table tbody tr.wh-status-old:hover,
html body #outgoing-section .modern-table tbody tr.wh-status-old:hover {
    transform: none !important;
    -webkit-transform: none !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05) !important;
    /* Flat card shadow */
    border-color: #cbd5e1 !important;
    /* Clearer border */
    transition: none !important;
    cursor: default !important;
    /* Prevent hover feel */
}

/* Forced Backgrounds on Hover - Neutralize's "turning white" */
html body #incoming-section .modern-table tbody tr.wh-status-new:hover,
html body #outgoing-section .modern-table tbody tr.wh-status-new:hover {
    background-color: #dcfce7 !important;
    background: #dcfce7 !important;
    border-color: #10b981 !important;
}

html body #incoming-section .modern-table tbody tr.wh-status-pending:hover,
html body #outgoing-section .modern-table tbody tr.wh-status-pending:hover {
    background-color: #fef9c3 !important;
    background: #fef9c3 !important;
    border-color: #facc15 !important;
}

html body #incoming-section .modern-table tbody tr.wh-status-old:hover,
html body #outgoing-section .modern-table tbody tr.wh-status-old:hover {
    background-color: #ffffff !important;
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    /* Clearer border */
}

/* Also ensure cells don't have hover styles (common conflict in some frameworks) */
html body #incoming-section .modern-table tbody tr:hover td,
html body #outgoing-section .modern-table tbody tr:hover td {
    background: transparent !important;
    background-color: transparent !important;
}

/* 3. Mobile Card Formatting Overrides (Absolute Priority) */
@media (max-width: 768px) {

    /* Header Styling (Light Gray like sessions) - Persistent Always */
    html body #incoming-section .modern-table tbody tr td:nth-child(1),
    html body #outgoing-section .modern-table tbody tr td:nth-child(1) {
        background: #f1f5f9 !important;
        /* Light Gray requested */
        color: #1e293b !important;
        /* Dark text */
        border-bottom: 2px solid rgba(0, 0, 0, 0.05) !important;
        font-weight: 700 !important;
    }

    html body #incoming-section .modern-table tbody tr td:nth-child(1)::before,
    html body #outgoing-section .modern-table tbody tr td:nth-child(1)::before {
        color: var(--primary) !important;
        opacity: 1 !important;
    }

    /* Content styling for readability on mobile cards */
    html body #incoming-section .modern-table tbody tr td,
    html body #outgoing-section .modern-table tbody tr td {
        color: #1e293b !important;
        border-color: rgba(0, 0, 0, 0.05) !important;
    }

    #incoming-section .modern-table tbody tr.wh-status-new .badge-role,
    #outgoing-section .modern-table tbody tr.wh-status-new .badge-role {
        background: #e6f7ef !important;
        color: #007038 !important;
    }

    /* Force height for upload footer */
    html body #incoming-section .modern-table tbody tr,
    html body #outgoing-section .modern-table tbody tr {
        min-height: 125px !important;
    }
}



/* حل مشكلة توقف السكرول العامة وتثبيته في الكمبيوتر */
html,
body {
    height: auto !important;
    min-height: 100% !important;
}

body {
    overflow-y: auto !important;
}

body.modal-open {
    overflow: hidden !important;
}

/* --- Professional Date Filter Styling --- */
.professional-date-row {
    display: flex !important;
    gap: 0.75rem !important;
    width: 100% !important;
    padding: 0.75rem !important;
    background: #ffffff !important;
    border-radius: 12px !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02) !important;
    margin-bottom: 0.75rem !important;
    align-items: center !important;
}

.date-input-group {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    flex: 1 !important;
    background: #f8fafc !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 10px !important;
    padding: 0.5rem 0.85rem !important;
    transition: all 0.3s ease !important;
}

.date-input-group:focus-within {
    border-color: var(--primary) !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
}

.date-input-group label {
    font-weight: 800 !important;
    color: #475569 !important;
    font-size: 0.85rem !important;
    white-space: nowrap !important;
    margin: 0 !important;
}

.date-input-group input[type="date"] {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    font-size: 0.95rem !important;
    width: 100% !important;
    outline: none !important;
    cursor: pointer !important;
}

/* Specific styling for summary export buttons to look more prominent */
#overtime-summary-export-btns {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

@media (max-width: 767px) {
    .professional-date-row {
        flex-direction: column !important;
        gap: 0.6rem !important;
        padding: 0.6rem !important;
    }

    .date-input-group {
        width: 100% !important;
        padding: 0.6rem 0.75rem !important;
    }

    .date-input-group label {
        min-width: 30px !important;
    }
}




/* --- Dropdown Menu Styles --- */
.btn-group {
    position: relative;
    display: inline-block;
}

.btn-group .dropdown-toggle {
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-group .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 1000;
    margin-top: 0.25rem;
    overflow: hidden;
}

.btn-group.show .dropdown-menu {
    display: block;
    animation: dropdownFadeIn 0.2s ease-out;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item,
.btn-group .dropdown-menu .dropdown-item,
.dropdown-menu button.dropdown-item,
.dropdown-menu a.dropdown-item {
    padding: 0.65rem 1rem !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 0.65rem !important;
    color: #1e293b !important;
    text-decoration: none !important;
    transition: background 0.2s, color 0.2s !important;
    border: none !important;
    border-radius: 6px !important;
    background: transparent !important;
    box-shadow: none !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    text-align: right !important;
    font-size: 0.88rem !important;
    font-weight: 600 !important;
    transform: none !important;
    filter: none !important;
}

.dropdown-item:hover,
.btn-group .dropdown-menu .dropdown-item:hover,
.dropdown-menu button.dropdown-item:hover,
.dropdown-menu a.dropdown-item:hover {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
    transform: none !important;
    filter: none !important;
}

.dropdown-item:active,
.btn-group .dropdown-menu .dropdown-item:active,
.dropdown-menu button.dropdown-item:active,
.dropdown-menu a.dropdown-item:active {
    background-color: #e2e8f0 !important;
}

.dropdown-item i,
.btn-group .dropdown-menu .dropdown-item i,
.dropdown-menu button.dropdown-item i,
.dropdown-menu a.dropdown-item i {
    width: 20px !important;
    text-align: center !important;
    font-size: 1rem !important;
    flex-shrink: 0 !important;
}

/* إلغاء أي خلفية سابقة بحسب المعرف الفردي للزر داخل القائمة المنسدلة */
.dropdown-menu #manage-professions-btn,
.dropdown-menu #manage-departments-btn,
.dropdown-menu #manage-areas-btn,
.dropdown-menu #manage-takaful-btn,
.dropdown-menu #manage-insurance-entities-btn,
.dropdown-menu #manage-health-insurances-btn,
.dropdown-menu #show-professions-stats-btn,
.dropdown-menu #show-departments-stats-btn,
.dropdown-menu #show-areas-stats-btn,
.dropdown-menu #show-blood-types-stats-btn {
    background: transparent !important;
    color: #1e293b !important;
    border: none !important;
    box-shadow: none !important;
    width: 100% !important;
    min-width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0.65rem 1rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    border-radius: 6px !important;
    transform: none !important;
    filter: none !important;
}

.dropdown-menu #manage-professions-btn:hover,
.dropdown-menu #manage-departments-btn:hover,
.dropdown-menu #manage-areas-btn:hover,
.dropdown-menu #manage-takaful-btn:hover,
.dropdown-menu #manage-insurance-entities-btn:hover,
.dropdown-menu #manage-health-insurances-btn:hover,
.dropdown-menu #show-professions-stats-btn:hover,
.dropdown-menu #show-departments-stats-btn:hover,
.dropdown-menu #show-areas-stats-btn:hover,
.dropdown-menu #show-blood-types-stats-btn:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    transform: none !important;
    filter: none !important;
}


/* 
=================================================
System Version 5.1.6 - UI Fixes & RBAC
=================================================
*/

/* 1. Global Visibility for Search Bars */
.admin-supervisor-only {
    display: none !important;
}

body.is-admin .admin-supervisor-only,
body.is-admin div.admin-supervisor-only,
body.is-supervisor .admin-supervisor-only,
body.is-supervisor div.admin-supervisor-only {
    display: flex !important;
}

/* 2. Mobile Specific Overrides */
@media (max-width: 767px) {

    /* Permission-based visibility is handled by app.js Logic */
    .toolbar-card:not(.hidden) {
        display: flex !important;
    }

    /* Show empty state messages (No records found) */
    .modern-table tbody tr:has(td.text-center),
    .modern-table tbody tr:has(td[colspan]) {
        display: block !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        margin: 1.5rem 0 !important;
        padding: 0 !important;
    }

    .modern-table tbody tr td.text-center,
    .modern-table tbody tr td[colspan] {
        display: block !important;
        text-align: center !important;
        width: 100% !important;
        color: #64748b !important;
        padding: 3rem 1rem !important;
        background: #f8fafc !important;
        border: 2px dashed #e2e8f0 !important;
        border-radius: 16px !important;
        font-weight: 600 !important;
        font-size: 1.1rem !important;
    }

    /* Ensure the label doesn't show for empty state cells */
    .modern-table tbody tr td.text-center::before,
    .modern-table tbody tr td[colspan]::before {
        display: none !important;
    }
}

/* 
=================================================
Utilities Section (الكهرباء والمياه) - Mobile Cards
=================================================
*/
@media (max-width: 767px) {

    /* بطاقات الكهرباء والمياه - إطار رصاصي ومسافة بين البطاقات */
    #utilities-section .modern-table tbody tr {
        display: flex !important;
        flex-direction: column !important;
        background: #ffffff !important;
        margin-bottom: 1rem !important;
        border-radius: 14px !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05) !important;
        border: 1px solid #94a3b8 !important;
        /* إطار رصاصي مثل بطاقات الموظفين */
        padding: 0 !important;
        overflow: hidden !important;
        cursor: pointer !important;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        position: relative !important;
    }

    #utilities-section .modern-table tbody tr:hover {
        transform: translateY(-3px) !important;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1) !important;
        border-color: var(--primary-light) !important;
    }

    /* كهرباء - شريط علوي أصفر */
    #utilities-section .modern-table tbody tr.utility-elec {
        border-top: 3px solid #f59e0b !important;
    }

    /* مياه - شريط علوي أزرق */
    #utilities-section .modern-table tbody tr.utility-water {
        border-top: 3px solid #0ea5e9 !important;
    }

    /* إخفاء كل الأعمدة افتراضياً */
    #utilities-section .modern-table td {
        display: none !important;
    }

    /* العمود الأول: اسم الشقة - يظهر كعنوان رئيسي */
    #utilities-section .modern-table td:nth-child(1) {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        font-size: 1rem !important;
        font-weight: 700 !important;
        color: #1e293b !important;
        padding: 0.85rem 1.1rem !important;
        border-bottom: 1px solid #f1f5f9 !important;
        background: #f8fafc !important;
    }

    #utilities-section .modern-table td:nth-child(1)::before {
        display: none !important;
    }

    /* العمود الثاني: النوع (كهرباء/مياه) */
    #utilities-section .modern-table td:nth-child(2) {
        display: none !important;
        /* مدمج مع الشقة */
    }

    /* العمود الثالث: رقم حساب السداد */
    #utilities-section .modern-table td:nth-child(3) {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.55rem 1.1rem !important;
        border-bottom: 1px solid #f1f5f9 !important;
        font-size: 0.85rem !important;
        color: #64748b !important;
        direction: ltr !important;
        text-align: left !important;
    }

    #utilities-section .modern-table td:nth-child(3)::before {
        content: attr(data-label) ": " !important;
        font-size: 0.8rem !important;
        font-weight: 700 !important;
        color: var(--text-muted) !important;
        direction: rtl !important;
        display: block !important;
    }

    /* العمود الرابع: آخر فاتورة (الشهر) */
    #utilities-section .modern-table td:nth-child(4) {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.55rem 1.1rem !important;
        border-bottom: 1px solid #f1f5f9 !important;
        font-size: 0.9rem !important;
        color: #374151 !important;
        font-weight: 600 !important;
    }

    #utilities-section .modern-table td:nth-child(4)::before {
        content: attr(data-label) !important;
        font-size: 0.78rem !important;
        font-weight: 700 !important;
        color: var(--text-muted) !important;
    }

    /* العمود الخامس: المبلغ وحالة الدفع المدمجين */
    #utilities-section .modern-table td:nth-child(5) {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.75rem 1.1rem !important;
        border-bottom: none !important;
        /* آخر صف في البيانات قبل الإجراءات */
        font-size: 1rem !important;
        font-weight: 700 !important;
        color: var(--primary) !important;
    }

    #utilities-section .modern-table td:nth-child(5)::before {
        content: attr(data-label) !important;
        font-size: 0.78rem !important;
        font-weight: 700 !important;
        color: var(--text-muted) !important;
    }

    /* إخفاء العمود السادس (حالة الدفع المنفصلة) وعمود المستخدم والإجراءات في الموبايل */
    #utilities-section .modern-table td:nth-child(6),
    #utilities-section .modern-table td:nth-child(7),
    #utilities-section .modern-table td:nth-child(8) {
        display: none !important;
    }
}


/* منع الكتابة في حقل التاريخ - فقط التقويم */
input[type="date"] {
    cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
}


/* ====================================
   Notification Preferences Styling
   ==================================== */
.notify-checkbox {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    background: #fff;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    user-select: none;
}

.notify-checkbox:hover {
    background: #f8fafc;
}

.notify-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.notify-checkbox .checkmark {
    height: 20px;
    width: 20px;
    background-color: #f1f5f9;
    border: 1px solid var(--border-focus);
    border-radius: 4px;
    margin-left: 10px;
    position: relative;
    transition: var(--transition);
    flex-shrink: 0;
}

.notify-checkbox:hover input~.checkmark {
    background-color: #e2e8f0;
}

.notify-checkbox input:checked~.checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.notify-checkbox .checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.notify-checkbox input:checked~.checkmark:after {
    display: block;
}

.notify-checkbox .notify-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    flex: 1;
    font-weight: 600;
    color: var(--text-dark);
}

.notify-checkbox .notify-icon {
    transition: var(--transition);
    font-size: 1.2rem;
}

/* تلوين الأيقونة حسب data-color عندما يكون الـ checkbox محدد */
.notify-checkbox input:checked~.checkmark~.notify-label .notify-icon[data-color="#f59e0b"] {
    color: #f59e0b;
}

.notify-checkbox input:checked~.checkmark~.notify-label .notify-icon[data-color="#06b6d4"] {
    color: #06b6d4;
}

.notify-checkbox input:checked~.checkmark~.notify-label .notify-icon[data-color="#8b5cf6"] {
    color: #8b5cf6;
}

.notify-checkbox input:checked~.checkmark~.notify-label .notify-icon[data-color="#10b981"] {
    color: #10b981;
}

.notify-checkbox input:checked~.checkmark~.notify-label .notify-icon[data-color="#ec4899"] {
    color: #ec4899;
}

.notify-checkbox input:checked~.checkmark~.notify-label .notify-icon[data-color="#ef4444"] {
    color: #ef4444;
}

/* جعل الأيقونة رمادية عندما لا يكون الـ checkbox محدد */
.notify-checkbox input:not(:checked)~.checkmark~.notify-label .notify-icon {
    color: #94a3b8 !important;
    opacity: 0.5;
}

.notify-checkbox input:not(:checked)~.checkmark~.notify-label {
    opacity: 0.6;
    color: #94a3b8;
}

.notify-checkbox input:checked~.checkmark~.notify-label .notify-icon[data-color="#10b981"] {
    color: #10b981;
}

.notify-checkbox input:checked~.checkmark~.notify-label .notify-icon[data-color="#ec4899"] {
    color: #ec4899;
}

.notify-checkbox input:checked~.checkmark~.notify-label .notify-icon[data-color="#ef4444"] {
    color: #ef4444;
}

/* جعل الأيقونة رمادية عندما لا يكون الـ checkbox محدد */
.notify-checkbox input:not(:checked)~.checkmark~.notify-label .notify-icon {
    color: #94a3b8 !important;
    opacity: 0.5;
}

.notify-checkbox input:not(:checked)~.checkmark~.notify-label {
    opacity: 0.6;
    color: #94a3b8;
}

/* ========================================
   Warehouse Outgoing - Mobile Cards
   ======================================== */

@media (max-width: 768px) {
    #outgoing-section .modern-table {
        box-shadow: none;
        overflow: visible;
        border: none;
    }

    #outgoing-section .modern-table thead {
        display: none;
    }

    #outgoing-section .modern-table tbody tr {
        display: flex;
        flex-direction: column;
        background: #ffffff;
        margin-bottom: 1.25rem;
        border-radius: 16px;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
        border: 1px solid #94a3b8;
        padding: 0;
        overflow: hidden;
        cursor: pointer;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
        min-height: auto !important;
    }

    #outgoing-section .modern-table tbody tr:hover {
        transform: translateY(-4px);
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
        border-color: var(--primary-light);
    }

    #outgoing-section .modern-table td {
        display: none;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #f1f5f9;
        font-size: 0.9rem;
    }

    #outgoing-section .modern-table td::before {
        content: attr(data-label);
        font-size: 0.8rem;
        font-weight: 700;
        color: var(--text-muted);
        white-space: nowrap;
    }

    /* 1. تاريخ الصرف */
    #outgoing-section .modern-table td:nth-child(1) {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        gap: 0.4rem;
        background: rgba(254, 243, 199, 0.6);
        color: var(--text-muted);
        font-weight: 600;
        border-bottom: 1px solid rgba(251, 191, 36, 0.3);
        padding: 0.6rem 1.25rem;
        font-size: 0.8rem;
    }

    #outgoing-section .modern-table td:nth-child(1)::before {
        content: "\f073";
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: var(--primary);
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    /* 2. رقم الإذن */
    #outgoing-section .modern-table td:nth-child(2) {
        display: flex;
        position: absolute;
        left: 1.25rem;
        top: 0.65rem;
        padding: 0;
        border: none;
        background: transparent;
        z-index: 2;
    }

    #outgoing-section .modern-table td:nth-child(2)::before {
        display: none;
    }

    #outgoing-section .modern-table td:nth-child(2) strong {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
        background: #fbbf24;
        color: #78350f;
        font-weight: 700;
        border-radius: 4px;
    }

    /* 3. كود الصنف - مخفي */
    #outgoing-section .modern-table td:nth-child(3) {
        display: none;
    }

    /* 4. اسم الصنف */
    #outgoing-section .modern-table tbody tr td:nth-child(4) {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 0.8rem;
        /* تصغير حجم الخط إلى 0.8rem ليتطابق مع الوارد */
        font-weight: 700;
        color: #1e293b;
        border-bottom: none;
        padding: 0.85rem 1.25rem;
        gap: 1rem;
    }

    #outgoing-section .modern-table td:nth-child(4)::before {
        display: none;
    }

    /* 5. طالب الصرف */
    #outgoing-section .modern-table td:nth-child(5) {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 1.25rem;
        background: #f8fafc;
        border-bottom: 1px solid #e2e8f0;
    }

    #outgoing-section .modern-table td:nth-child(5)::before {
        content: "طالب الصرف:";
        color: #64748b;
        font-weight: 600;
    }

    /* 6. الكمية */
    #outgoing-section .modern-table td:nth-child(6) {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 1.25rem;
        background: #fef2f2;
        border-bottom: 1px solid #fecaca;
    }

    #outgoing-section .modern-table td:nth-child(6)::before {
        content: "الكمية:";
        color: #dc2626;
        font-weight: 700;
    }

    #outgoing-section .modern-table td:nth-child(6) span {
        color: #dc2626;
        font-weight: 700;
        font-size: 1.1rem;
    }

    /* 7. مركز التكلفة */
    #outgoing-section .modern-table td:nth-child(7) {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 1.25rem;
        border-bottom: 1px solid #e2e8f0;
    }

    #outgoing-section .modern-table td:nth-child(7)::before {
        content: "مركز التكلفة:";
        color: #64748b;
        font-weight: 600;
    }

    /* 8. المستلم */
    #outgoing-section .modern-table td:nth-child(8) {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 1.25rem;
        border-bottom: 1px solid #e2e8f0;
    }

    #outgoing-section .modern-table td:nth-child(8)::before {
        content: "المستلم:";
        color: #64748b;
        font-weight: 600;
    }

    /* 9. اسم المستخدم */
    #outgoing-section .modern-table td:nth-child(9) {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 1.25rem;
        border-bottom: 1px solid #e2e8f0;
    }

    #outgoing-section .modern-table td:nth-child(9)::before {
        content: "المستخدم:";
        color: #64748b;
        font-weight: 600;
    }

    #outgoing-section .modern-table td:nth-child(9) .badge-role {
        font-size: 0.75rem;
        padding: 0.25rem 0.6rem;
    }

    /* 10. أزرار الإجراءات - مخفية */
    #outgoing-section .modern-table td:nth-child(10) {
        display: none !important;
    }

    /* 11. معلومات الرفع */
    #outgoing-section .modern-table td.mobile-upload-info {
        display: flex !important;
        padding: 0.75rem 1.25rem;
        background: #f1f5f9;
        border-top: 2px solid #e2e8f0;
        border-bottom: none;
    }

    #outgoing-section .modern-table td.mobile-upload-info::before {
        display: none;
    }

    #outgoing-section .modern-table td.mobile-upload-info .upload-footer {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        font-size: 0.75rem;
        color: #64748b;
    }

    #outgoing-section .modern-table td.mobile-upload-info .upload-footer i {
        color: #6366f1;
    }

    /* تلوين البطاقات - المنصرف */
    #outgoing-section .modern-table tbody tr.wh-status-new {
        border-color: #10b981;
        border-width: 2px;
    }

    #outgoing-section .modern-table tbody tr.wh-status-new td:nth-child(1) {
        background: #d1fae5;
        border-bottom-color: #10b981;
    }

    #outgoing-section .modern-table tbody tr.wh-status-pending {
        border-color: #f59e0b;
        border-width: 2px;
    }

    #outgoing-section .modern-table tbody tr.wh-status-pending td:nth-child(1) {
        background: #fef3c7;
        border-bottom-color: #f59e0b;
    }

    #outgoing-section .modern-table tbody tr.wh-status-old {
        border-color: #9ca3af;
        border-width: 2px;
    }

    /* تلوين البطاقات - الوارد */
    #incoming-section .modern-table tbody tr.wh-status-new {
        border-color: #10b981;
        border-width: 2px;
    }

    #incoming-section .modern-table tbody tr.wh-status-new td:nth-child(1) {
        background: #d1fae5;
        border-bottom-color: #10b981;
    }

    #incoming-section .modern-table tbody tr.wh-status-pending {
        border-color: #f59e0b;
        border-width: 2px;
    }

    #incoming-section .modern-table tbody tr.wh-status-pending td:nth-child(1) {
        background: #fef3c7;
        border-bottom-color: #f59e0b;
    }

    #incoming-section .modern-table tbody tr.wh-status-old {
        border-color: #9ca3af;
        border-width: 2px;
    }
}

@media (min-width: 769px) {
    #outgoing-section .modern-table td.mobile-upload-info {
        display: none !important;
    }
}

/* ========================================
   Warehouse Requesters Modal - Table & Cards
   ======================================== */

/* Desktop - Table view */
@media (min-width: 769px) {
    #requesters-modal .modern-table {
        width: 100%;
        border-collapse: collapse;
    }

    #requesters-modal .modern-table thead {
        background: #f8fafc;
    }

    #requesters-modal .modern-table th {
        padding: 0.75rem;
        text-align: right;
        font-weight: 700;
        color: #475569;
        border-bottom: 2px solid #e2e8f0;
    }

    #requesters-modal .modern-table td {
        padding: 0.75rem;
        border-bottom: 1px solid #e2e8f0;
    }

    #requesters-modal .modern-table tbody tr:hover {
        background: #f8fafc;
    }

    #requesters-modal .modern-table .action-buttons {
        display: flex;
        gap: 0.5rem;
        justify-content: center;
    }
}

/* Mobile - Card view */
@media (max-width: 768px) {
    #requesters-modal .modern-table {
        box-shadow: none;
        overflow: visible;
        border: none;
    }

    #requesters-modal .modern-table thead {
        display: none;
    }

    /* Requesters Modal Mobile Cards - Matching Contractors Exactly */
    #requesters-modal .modern-table tbody tr {
        display: flex !important;
        flex-direction: column !important;
        background: #ffffff !important;
        margin-bottom: 1.25rem !important;
        /* نفس مسافة المقاولين */
        border-radius: 16px !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05) !important;
        border: 1px solid #94a3b8 !important;
        /* نفس إطار المقاولين الرصاصي */
        padding: 0 !important;
        overflow: hidden !important;
        cursor: pointer !important;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
        position: relative !important;
    }

    #requesters-modal .modern-table tbody tr:hover {
        transform: translateY(-4px) !important;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1) !important;
        border-color: var(--primary-light) !important;
    }

    #requesters-modal .modern-table td {
        display: none !important;
        /* إخفاء الكل افتراضياً مثل المقاولين */
        padding: 0.75rem 1rem !important;
        border-bottom: 1px solid #f1f5f9 !important;
        font-size: 0.9rem !important;
    }

    /* 1. الهيدر العلوي (الاسم والمهنة) - مثل المقاولين */
    #requesters-modal .modern-table td:nth-child(1) {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        background: rgba(254, 243, 199, 0.6) !important;
        /* نفس خلفية المقاولين البرتقالي الفاتح */
        color: #78350f !important;
        /* نفس لون نص المقاولين */
        font-weight: 700 !important;
        border-bottom: 1px solid rgba(251, 191, 36, 0.3) !important;
        padding: 0.6rem 1.25rem !important;
        font-size: 0.95rem !important;
    }

    #requesters-modal .modern-table td:nth-child(1)::before {
        content: "\f007";
        /* أيقونة مستخدم */
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: #78350f;
        font-size: 0.85rem;
        margin-left: 0.4rem;
        display: inline-block !important;
    }

    #requesters-modal .modern-table td:nth-child(1) strong {
        flex: 1;
        text-align: right;
        font-size: 1rem !important;
    }

    #requesters-modal .modern-table td:nth-child(1) .badge-role {
        background: #fbbf24 !important;
        /* نفس بادج المقاولين */
        color: #78350f !important;
        padding: 0.2rem 0.6rem !important;
        border-radius: 4px !important;
        font-size: 0.7rem !important;
        font-weight: 700 !important;
        margin-right: 0.5rem;
    }

    /* 2. صف القسم مع الأزرار - مثل طلب المستخدم */
    #requesters-modal .modern-table td:nth-child(3) {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        font-size: 1.1rem !important;
        font-weight: 700 !important;
        color: #1e293b !important;
        border-bottom: none !important;
        padding: 0.85rem 1.25rem !important;
        gap: 1rem !important;
    }

    #requesters-modal .modern-table td:nth-child(3)::before {
        display: none !important;
        /* إخفاء كلمة القسم في الموبايل */
    }

    /* إخفاء صف الإجراءات السفلي تماماً في الموبايل */
    #requesters-modal .modern-table td:nth-child(4) {
        display: none !important;
    }
}

/* =================================================
   Audit Logs Responsive Tables - Matching Overtime Style
   ================================================= */
@media (max-width: 767px) {
    #audit-logs-section .modern-table thead {
        display: none !important;
    }

    #audit-logs-section .modern-table tbody tr {
        display: flex !important;
        flex-direction: column !important;
        background: #ffffff !important;
        margin-bottom: 0.5rem !important;
        /* Reduced height */
        border-radius: 20px !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04) !important;
        padding: 0 !important;
        overflow: hidden !important;
        cursor: pointer !important;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
        position: relative !important;
        min-height: 60px !important;
        /* Reduced height */
    }

    #audit-logs-section .modern-table tbody tr.audit-edit {
        border: 2px solid #008c44 !important;
    }

    #audit-logs-section .modern-table tbody tr.audit-delete {
        border: 2px solid #ef4444 !important;
    }

    #audit-logs-section .modern-table tbody tr:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
    }

    /* Column 1: التاريخ والوقت (Header) */
    #audit-logs-section .modern-table td:nth-child(1) {
        display: flex !important;
        justify-content: flex-start !important;
        align-items: center !important;
        width: 100% !important;
        padding: 0.5rem 0.85rem !important;
        font-size: 0.95rem !important;
        font-weight: 700 !important;
        order: -1;
    }

    #audit-logs-section .modern-table tr.audit-edit td:nth-child(1) {
        background: #e6f7ef !important;
        border-bottom: 1px dotted #008c44 !important;
        color: #007038 !important;
    }

    #audit-logs-section .modern-table tr.audit-delete td:nth-child(1) {
        background: #fef2f2 !important;
        border-bottom: 1px dotted #ef4444 !important;
        color: #b91c1c !important;
    }

    #audit-logs-section .modern-table td:nth-child(1)::before {
        content: "\f017" !important;
        display: inline-block !important;
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: inherit;
        font-size: 0.85rem;
        margin-left: 0.5rem;
    }

    /* Column 2: العملية (Badge) */
    #audit-logs-section .modern-table td:nth-child(2) {
        display: flex !important;
        position: absolute !important;
        left: 0.85rem !important;
        top: 0.55rem !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        z-index: 2 !important;
    }

    #audit-logs-section .modern-table td:nth-child(2)::before {
        display: none !important;
    }

    /* Rows 2, 3, 4: القسم، البيان، الموظف */
    #audit-logs-section .modern-table td:nth-child(3),
    #audit-logs-section .modern-table td:nth-child(4),
    #audit-logs-section .modern-table td:nth-child(5) {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.4rem 0.85rem !important;
        border-bottom: 1px dotted #e2e8f0 !important;
        font-size: 0.8rem !important;
        color: #1e293b !important;
        background: transparent !important;
    }

    #audit-logs-section .modern-table td:nth-child(5) {
        border-bottom: none !important;
    }

    #audit-logs-section .modern-table td:nth-child(3)::before {
        content: "\f1c0";
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: var(--primary);
        font-size: 0.8rem;
        margin-left: 0.4rem;
    }

    #audit-logs-section .modern-table td:nth-child(4)::before {
        content: "\f02b";
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: var(--primary);
        font-size: 0.8rem;
        margin-left: 0.4rem;
    }

    #audit-logs-section .modern-table td:nth-child(5)::before {
        content: "\f007";
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: var(--primary);
        font-size: 0.8rem;
        margin-left: 0.4rem;
    }

    #audit-logs-section .modern-table td:nth-child(4) {
        background: rgba(248, 250, 252, 0.5) !important;
    }

    /* Hide Actions column on mobile */
    #audit-logs-section .modern-table td:nth-child(6) {
        display: none !important;
    }

    /* Badge sizes */
    #audit-logs-section .modern-table td .badge {
        font-size: 0.65rem !important;
        padding: 0.15rem 0.5rem !important;
    }
}

/* Custom classes for Audit Log */
.audit-header-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.audit-icon-box {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    color: inherit;
}

.record-label-cell {
    font-weight: 700;
    color: #1e293b;
    font-size: 0.9rem;
    max-width: 100%;
    white-space: normal;
    text-align: right;
}

.user-name-val {
    font-weight: 600;
    color: #475569;
    font-size: 0.8rem;
}

@media (max-width: 767px) {

    .mobile-hide-time,
    .mobile-hide-username {
        display: none !important;
    }
}

/* FIX: Audit Details Modal Table - Ensure it stays as a table on mobile */
#audit-details-modal .modern-table {
    display: table !important;
    width: 100% !important;
    border-collapse: collapse !important;
    margin-top: 1rem !important;
}

#audit-details-modal .modern-table thead {
    display: table-header-group !important;
}

#audit-details-modal .modern-table thead th {
    background: #f1f5f9 !important;
    color: #475569 !important;
    font-size: 0.85rem !important;
    padding: 0.75rem !important;
    border-bottom: 2px solid #e2e8f0 !important;
    text-align: right !important;
}

#audit-details-modal .modern-table tbody tr {
    display: table-row !important;
    background: white !important;
    border: none !important;
    box-shadow: none !important;
}

#audit-details-modal .modern-table td {
    display: table-cell !important;
    padding: 0.75rem !important;
    border-bottom: 1px solid #f1f5f9 !important;
    font-size: 0.9rem !important;
    text-align: right !important;
    width: auto !important;
    color: #1e293b !important;
}

#audit-details-modal .modern-table td::before {
    display: none !important;
}

#audit-details-modal .modern-table tbody tr:hover {
    background: #f8fafc !important;
    transform: none !important;
}

/* =================================================
   Audit Log Filters Grid System
   ================================================= */
.filters-grid,
.audit-filters-grid,
.vacations-filters-grid,
.professional-documents-filters-grid,
.social-contributions-filters-grid,
.investigations-filters-grid {
    display: grid;
    gap: 1rem;
    align-items: flex-end;
    grid-template-columns: repeat(2, 1fr);
}

.audit-filters-grid .form-group {
    margin-bottom: 0;
}

.audit-btn-group {
    display: flex;
    gap: 0.5rem;
}

.audit-btn-group .btn {
    flex: 1;
    height: 42px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

/* Mobile Layout: Requested groups */
@media (max-width: 767px) {

    .audit-filters-grid,
    .vacations-filters-grid,
    .professional-documents-filters-grid,
    .social-contributions-filters-grid,
    .investigations-filters-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem !important;
    }

    /* 1st Row: Date From & Date To (Already 1fr 1fr) */

    /* 2nd Row: Action Type & Department (Already 1fr 1fr) */

    /* 3rd Row: User Filter & Buttons (User should take space, buttons share) */
    .user-filter-group {
        grid-column: span 1;
    }

    .audit-btn-group {
        grid-column: span 1;
    }

    .audit-filters-container {
        padding: 1rem !important;
    }

    .audit-filters-grid,
    .vacations-filters-grid,
    .professional-documents-filters-grid,
    .social-contributions-filters-grid,
    .investigations-filters-grid {
        gap: 0.6rem !important;
    }

    .audit-filters-grid .form-control,
    .vacations-filters-grid .form-control,
    .professional-documents-filters-grid .form-control,
    .social-contributions-filters-grid .form-control,
    .investigations-filters-grid .form-control {
        height: 38px !important;
        padding: 0.4rem 0.75rem !important;
        text-align: center !important;
        /* ✅ محاذاة النص في المنتصف */
    }
}

/* Desktop Layout: 3 items per row */
@media (min-width: 768px) {

    .filters-grid,
    .audit-filters-grid,
    .vacations-filters-grid,
    .professional-documents-filters-grid,
    .social-contributions-filters-grid,
    .investigations-filters-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .audit-btn-group {
        grid-column: span 1;
    }
}

/* نتائج البحث للأصناف المتعددة */
.item-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 0.25rem;
}

.item-row {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* تأثير hover للأصناف */
.item-row {
    transition: all 0.3s ease;
}

.item-row:hover {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
}

/* تأثير hover للأصناف في الصرف */
.outgoing-item-row {
    transition: all 0.3s ease;
}

.outgoing-item-row:hover {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
}

/* نتائج البحث للصرف */
.outgoing-item-results,
.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 250px;
    overflow-y: auto;
    z-index: 99999 !important;
    margin-top: 0.25rem;
}

/* ========================================
   Salaries Section - Mobile Cards
   ======================================== */
@media (max-width: 768px) {
    #salaries-section .modern-table {
        box-shadow: none;
        overflow: visible;
        border: none;
    }

    #salaries-section .modern-table thead {
        display: none;
    }

    #salaries-section .modern-table tbody tr {
        display: flex !important;
        flex-direction: column !important;
        background: #ffffff !important;
        margin-bottom: 1.25rem !important;
        border-radius: 16px !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05) !important;
        border: 1px solid #94a3b8 !important;
        padding: 0 !important;
        overflow: hidden !important;
        cursor: pointer !important;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
        position: relative !important;
        min-height: auto !important;
    }

    #salaries-section .modern-table tbody tr:hover {
        transform: translateY(-4px) !important;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1) !important;
        border-color: #FFF6C0 !important;
    }

    /* 1. Card Header (Employee Name & Code) */
    #salaries-section .modern-table td:nth-child(1) {
        display: flex !important;
        justify-content: flex-start !important;
        align-items: center !important;
        background: #FFF6C0 !important;
        color: #1e293b !important;
        font-weight: 700 !important;
        border-bottom: none !important;
        padding: 0.6rem 1rem !important;
        /* Reduced padding */
        font-size: 1.1rem !important;
        width: 100% !important;
    }

    #salaries-section .modern-table td:nth-child(1)::before {
        content: "\f007" !important;
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: rgba(30, 41, 59, 0.6) !important;
        margin-left: 0.6rem !important;
        font-size: 1rem !important;
        display: inline-block !important;
    }

    .salary-header-wrapper {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
    }

    .mobile-code {
        font-size: 0.8rem !important;
        opacity: 0.9 !important;
        font-weight: 400 !important;
    }

    /* 2. Secondary Data Row (Profession & Salary) */
    #salaries-section .modern-table td:nth-child(7) {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.75rem 1rem !important;
        /* Reduced padding */
        border-bottom: none !important;
        width: 100% !important;
    }

    #salaries-section .modern-table td:nth-child(7)::before {
        display: none !important;
        /* Hide label to save space */
    }

    .salary-body-row {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
    }

    /* Hide intermediate columns on mobile */
    #salaries-section .modern-table td:nth-child(2),
    #salaries-section .modern-table td:nth-child(3),
    #salaries-section .modern-table td:nth-child(4),
    #salaries-section .modern-table td:nth-child(5),
    #salaries-section .modern-table td:nth-child(6) {
        display: none !important;
    }
}

/* --- New UI Elements (Tabs & Sheets) --- */
.table-tabs-container {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    margin-top: 1.5rem;
    overflow-x: auto;
}

.table-tabs {
    display: flex;
    padding: 0.5rem 0.5rem 0 0.5rem;
    gap: 0.25rem;
}

.table-tab {
    padding: 0.75rem 1.5rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-p);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: var(--transition);
    white-space: nowrap;
    border: 1px solid transparent;
    border-bottom: none;
    background: transparent;
}

.table-tab:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.table-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border-color: var(--primary);
    position: relative;
    margin-bottom: -1px;
    z-index: 1;
}

/* Modal Tabs */
.modal-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border);
    border-bottom: 1px solid var(--border);
}

.modal-tab {
    padding: 0.85rem 0.5rem;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-p);
    transition: var(--transition);
    border: none;
    background: #f8fafc;
    text-align: center;
    cursor: pointer;
}

.modal-tab:hover {
    background: #e2e8f0;
    color: var(--primary);
}

.modal-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light)) !important;
    color: #fff !important;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Autocomplete suggestions improvement */
.suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 1050;
    max-height: 250px;
    overflow-y: auto;
}

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: #f8fafc;
}

.suggestion-item .sug-name {
    font-weight: 700;
    color: var(--text-dark);
}

.suggestion-item .sug-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ========================================
   Font Size Utilities
   ======================================== */

/* خط صغير — 13px لكل النصوص */
body.font-small td,
body.font-small th,
body.font-small p,
body.font-small span,
body.font-small label,
body.font-small li,
body.font-small a,
body.font-small h1,
body.font-small h2,
body.font-small h3,
body.font-small h4,
body.font-small h5,
body.font-small h6,
body.font-small input,
body.font-small select,
body.font-small textarea,
body.font-small .btn,
body.font-small button,
body.font-small .section-title,
body.font-small .form-control,
body.font-small .stat-label,
body.font-small .stat-value,
body.font-small .modern-table td,
body.font-small .modern-table th {
    font-size: 13px !important;
}

/* خط صغير جداً — 11px */
body.font-xsmall td,
body.font-xsmall th,
body.font-xsmall p,
body.font-xsmall span,
body.font-xsmall label,
body.font-xsmall li,
body.font-xsmall a,
body.font-xsmall h1,
body.font-xsmall h2,
body.font-xsmall h3,
body.font-xsmall h4,
body.font-xsmall h5,
body.font-xsmall h6,
body.font-xsmall input,
body.font-xsmall select,
body.font-xsmall textarea,
body.font-xsmall .btn,
body.font-xsmall button,
body.font-xsmall .section-title,
body.font-xsmall .form-control,
body.font-xsmall .stat-label,
body.font-xsmall .stat-value,
body.font-xsmall .modern-table td,
body.font-xsmall .modern-table th {
    font-size: 11px !important;
}

/* استثناءات دائمة — لا تتغير أبداً */
.mobile-nav-item span {
    font-size: 0.65rem !important;
}

.mobile-nav-item i {
    font-size: 1.25rem !important;
}

@keyframes slideUpDrawer {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Drawer Overlay */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1055;
    transition: all 0.3s ease;
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
    z-index: 1050;
    flex-direction: row-reverse;
    align-items: stretch;
    justify-content: space-around;
    padding: 0 10px;
}

@media (max-width: 767px) {
    .mobile-bottom-nav {
        display: flex;
    }

    .navbar {
        display: none !important;
    }

    .main-container {
        padding-bottom: 85px !important;
    }

    .mobile-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        background: transparent;
        border: none;
        color: #64748b;
        transition: all 0.2s;
    }

    .mobile-nav-item i {
        font-size: 1.3rem;
    }

    .mobile-nav-item span {
        font-size: 0.65rem;
        font-weight: 700;
    }

    .mobile-nav-item.active {
        color: var(--primary);
    }

    .mobile-nav-divider {
        width: 1px;
        height: 50%;
        background: #e2e8f0;
        align-self: center;
    }
}

/* Hide bottom nav when any modal or drawer is open */
body.modal-open .mobile-bottom-nav,
body:has(.modal.show) .mobile-bottom-nav,
body:has(.mobile-account-drawer:not(.hidden)) .mobile-bottom-nav,
body:has(.mobile-settings-drawer:not(.hidden)) .mobile-bottom-nav {
    display: none !important;
}

/* Drawers */
.mobile-account-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;
    z-index: 1060;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.mobile-account-content {
    background: white;
    width: 100%;
    max-width: 550px;
    min-height: 50vh;
    border-radius: 30px 30px 0 0;
    padding: 2.5rem 1.5rem 2rem;
    position: relative;
    animation: slideUpDrawer 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.drawer-close-indicator {
    width: 40px;
    height: 5px;
    background: #e2e8f0;
    border-radius: 10px;
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
}

.drawer-back-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    cursor: pointer;
}

.mobile-account-avatar {
    width: 75px;
    height: 75px;
    background: #f0f9ff;
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.mobile-account-name {
    font-weight: 800;
    font-size: 1.2rem;
    color: #1e293b;
}

.mobile-account-role {
    font-size: 0.85rem;
    color: #64748b;
    background: #f1f5f9;
    padding: 0.2rem 1rem;
    border-radius: 20px;
}

@media (min-width: 768px) {
    .mobile-account-drawer {
        align-items: flex-start;
        padding-top: 80px;
    }

    .mobile-account-content {
        border-radius: 24px;
        min-height: auto;
        width: 400px;
        animation: fadeInDown 0.3s;
    }
}

/* Vacation Rows (Multi-entry) */
.vacation-row {
    background: #f8fafc;
    border: 2px solid #94a3b8;
    border-radius: 6px;
    padding: 0.75rem 1.25rem;
    /* تقليل الحشو الداخلي الرأسي */
    margin-bottom: 0.75rem;
    /* تقليل المسافة بين الصفوف */
    position: relative;
    transition: all 0.3s ease;
    animation: vacationRowSlideIn 0.3s ease-out forwards;
}

.vacation-row:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.remove-row-btn {
    position: absolute !important;
    top: -15px !important;
    left: -15px !important;
    background: #ef4444 !important;
    border: 2px solid #ffffff !important;
    /* إطار أبيض ليبرز أكثر */
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 100 !important;
    color: #ffffff !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    line-height: 1 !important;
}

.remove-row-btn:hover {
    background: #fee2e2 !important;
    transform: scale(1.1) !important;
}

@keyframes vacationRowSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Vacation Row Helpers */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    /* تقليل الفراغ بين الخانات المتجاورة */
    margin-bottom: 0.5rem;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
}

.row-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.15rem;
    /* تقليل المسافة تحت تسمية الصف */
    display: block;
}

.label-balance {
    color: #b91c1c !important;
    font-weight: 700;
}

.label-salary {
    color: #b45309 !important;
    font-weight: 700;
}

.vacation-row .form-control.row-days {
    background: #fff5f5;
    font-weight: 700;
    text-align: center;
    color: #b91c1c;
}

.vacation-row .form-control.row-non-deducted-days {
    background: #fffbeb;
    font-weight: 700;
    text-align: center;
    color: #b45309;
}

@media (max-width: 767px) {
    .form-grid-2 {
        grid-template-columns: 1fr 1fr;
        /* الحفاظ على عمودين في الموبايل للتواريخ والأرصدة */
        gap: 0.75rem;
    }

    .form-grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Vacation Modal Full Height */
.modal-full-height .modal-dialog {
    max-width: 650px;
    /* العرض المفضل للمستخدم */
    width: 95%;
    height: 100vh;
    margin: 0 auto;
    display: flex;
}

.modal-full-height .modal-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    /* حواف حادة للارتفاع الكامل لتغطي الشاشة */
    overflow: hidden;
}

.modal-full-height .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
}

.modal-full-height .modal-header {
    flex-shrink: 0;
}

.modal-full-height .modal-footer {
    flex-shrink: 0;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

/* Premium Alert Modal Overhaul */
.alert-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(15, 23, 42, 0.6) !important;
    backdrop-filter: blur(8px) !important;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000 !important;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.alert-modal.show {
    display: flex !important;
    opacity: 1 !important;
}

.alert-dialog {
    background: #ffffff !important;
    width: 95% !important;
    max-width: 500px !important;
    border-radius: 28px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3) !important;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.alert-modal.show .alert-dialog {
    transform: scale(1) translateY(0);
}

.alert-header {
    padding: 1.25rem 2rem !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-bottom: 1px solid #f1f5f9 !important;
    background: #fcfdfe;
}

.alert-header h3 {
    font-size: 1.3rem !important;
    font-weight: 800 !important;
    color: #1e293b !important;
    margin: 0 !important;
}

.alert-body {
    padding: 3rem 2rem !important;
    text-align: center !important;
}

/* Ensure Alert Modal & Confirm Dialog always stay on TOP of all open modals, suggestion dropdowns, and overlays */
#alert-modal,
#confirm-modal {
    z-index: 99999999 !important;
    position: fixed !important;
    inset: 0 !important;
}

#alert-modal .modal-dialog,
#confirm-modal .modal-dialog {
    z-index: 100000000 !important;
    position: relative !important;
}

.alert-icon {
    width: 90px !important;
    height: 90px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 3rem !important;
    margin: 0 auto 2rem !important;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1) !important;
}

.alert-icon.error {
    background: linear-gradient(135deg, #fff1f2, #ffe4e6) !important;
    color: #e11d48 !important;
    border: 2px solid #fecaca !important;
}

.alert-icon.warning {
    background: linear-gradient(135deg, #fffbeb, #fef3c7) !important;
    color: #d97706 !important;
    border: 2px solid #fde68a !important;
}

.alert-icon.success {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7) !important;
    color: #16a34a !important;
    border: 2px solid #bbf7d0 !important;
}

.alert-content {
    font-size: 1.2rem !important;
    line-height: 1.8 !important;
    color: #334155 !important;
    font-weight: 700 !important;
}

.alert-footer {
    padding: 1.5rem 2rem !important;
    background: #f8fafc !important;
    display: flex !important;
    gap: 1rem !important;
    justify-content: center !important;
    border-top: 1px solid #e2e8f0 !important;
}

.alert-footer .btn {
    padding: 0.9rem 1.8rem !important;
    font-size: 1.05rem !important;
    font-weight: 800 !important;
    border-radius: 14px !important;
    min-width: 130px !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
}

.alert-footer .btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15) !important;
}

.alert-footer .btn-success {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    border: none !important;
}

.alert-footer .btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    border: none !important;
}

.alert-footer .btn-secondary {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #64748b !important;
}

@media (max-width: 600px) {
    .alert-dialog {
        width: 90% !important;
    }

    .alert-footer {
        flex-direction: column !important;
    }

    .alert-footer .btn {
        width: 100% !important;
    }
}

/* Report Modal Premium Styles */
.report-modal .modal-dialog {
    max-width: 1100px !important;
    width: 96% !important;
    height: 96vh !important;
    margin: 2vh auto !important;
    display: flex !important;
    align-items: center !important;
}

.report-modal .modal-content {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    border-radius: 20px !important;
    overflow: hidden !important;
    border: none !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
}

.report-modal .modal-header {
    background: linear-gradient(135deg, #1e293b, #334155) !important;
    color: white !important;
    padding: 1.5rem 2rem !important;
    border: none !important;
    flex-shrink: 0 !important;
}

.report-modal .modal-header h3 {
    font-size: 1.5rem !important;
    font-weight: 800 !important;
    margin: 0 !important;
}

.report-modal .modal-body {
    padding: 0 !important;
    flex: 1 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    background: #ffffff !important;
}

.report-info-bar {
    padding: 1.5rem 2rem !important;
    background: #ffffff !important;
    border-bottom: 2px solid #f1f5f9 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 2rem !important;
    flex-shrink: 0 !important;
}

.report-modal .table-container {
    padding: 0 1rem !important;
    margin: 0 !important;
    flex: 1 !important;
    overflow-y: auto !important;
}

.report-modal .data-table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

.report-modal .data-table thead th {
    position: sticky !important;
    top: 0 !important;
    background: #f1f5f9 !important;
    color: #475569 !important;
    font-weight: 800 !important;
    padding: 1.25rem 1rem !important;
    border-bottom: 2px solid #cbd5e1 !important;
    border-right: 1px solid #e2e8f0 !important;
    z-index: 20 !important;
    text-align: center !important;
}

.report-modal .data-table thead th:first-child {
    text-align: right !important;
    border-right: none !important;
}

.report-modal .data-table tbody td {
    padding: 1.5rem 1rem !important;
    border-bottom: 1px solid #e2e8f0 !important;
    border-right: 1px solid #f1f5f9 !important;
    vertical-align: middle !important;
    line-height: 1.5 !important;
}

.report-modal .data-table tbody td:first-child {
    border-right: none !important;
}

.report-modal .data-table tbody tr:hover {
    background-color: #f8fafc !important;
}

.badge-total {
    background: #f1f5f9 !important;
    color: #1e293b !important;
    padding: 10px 20px !important;
    border-radius: 50px !important;
    font-weight: 800 !important;
    font-size: 1rem !important;
    border: 1px solid #e2e8f0 !important;
    white-space: nowrap !important;
}

/* ===== Top Vacations Modal - Premium Styles ===== */

/* حدود رصاصية موحدة بين جميع خانات الجدول */
#top-vacations-modal table {
    border-collapse: collapse !important;
}

#top-vacations-modal table thead th {
    border: 1px solid #94a3b8 !important;
    /* لون أغمق للهيدر */
    border-top: none !important;
}

#top-vacations-modal table tbody td {
    border: 1px solid #cbd5e1 !important;
    /* لون أغمق للخانات */
}

#top-vacations-modal table tbody tr:first-child td {
    border-top: 2px solid #94a3b8 !important;
}

/* Scrollbar inside the modal table */
#top-vacations-modal .modal-body::-webkit-scrollbar {
    width: 6px;
}

#top-vacations-modal .modal-body::-webkit-scrollbar-track {
    background: #f1f5f9;
}

#top-vacations-modal .modal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

#top-vacations-modal .modal-body::-webkit-scrollbar-thumb:hover {
    background: #008c44;
}

/* Responsive – Mobile */
@media (max-width: 767px) {
    #top-vacations-modal .modal-dialog {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        height: 100dvh !important;
        display: flex !important;
        align-items: flex-end !important;
    }

    #top-vacations-modal .modal-content {
        border-radius: 20px 20px 0 0 !important;
        max-height: 92dvh !important;
        display: flex !important;
        flex-direction: column !important;
    }

    #top-vacations-modal .modal-body {
        max-height: 55dvh !important;
        overflow-x: auto !important;
    }

    #top-vacations-modal table {
        min-width: unset !important;
        border: none !important;
    }

    #top-vacations-modal table,
    #top-vacations-modal thead,
    #top-vacations-modal tbody,
    #top-vacations-modal th,
    #top-vacations-modal td,
    #top-vacations-modal tr {
        display: block !important;
        width: 100% !important;
    }

    #top-vacations-modal table thead {
        display: none !important;
    }

    #top-vacations-modal tbody {
        padding: 1rem;
        background: #f8fafc;
    }

    #top-vacations-modal tbody tr {
        margin-bottom: 1.25rem !important;
        background: #fff !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 16px !important;
        overflow: hidden;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05) !important;
    }

    #top-vacations-modal tbody tr:first-child td {
        border-top: none !important;
    }

    #top-vacations-modal tbody td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.35rem 0.85rem !important;
        /* تقليل الارتفاع أكثر */
        border: none !important;
        border-bottom: 1px solid #f1f5f9 !important;
        text-align: left !important;
        background: transparent !important;
    }

    #top-vacations-modal tbody td:first-child {
        background: linear-gradient(135deg, #f0fdf4, #dcfce7) !important;
        /* رأس ملون بالأخضر الخفيف */
        border-bottom: 2px solid #bbf7d0 !important;
    }

    #top-vacations-modal tbody td:last-child {
        border-bottom: none !important;
        justify-content: center !important;
        background: #f8fafc !important;
        padding: 0.5rem !important;
    }

    #top-vacations-modal tbody td:last-child::before {
        display: none;
    }

    #top-vacations-modal tbody td::before {
        content: attr(data-label);
        font-weight: 800;
        color: #64748b;
        font-size: 0.8rem !important;
        /* تصغير حجم التسمية */
        padding-left: 0.75rem;
    }

    /* Force children of td to align properly and reduce text size */
    #top-vacations-modal tbody td>div,
    #top-vacations-modal tbody td>span,
    #top-vacations-modal tbody td .badge,
    #top-vacations-modal tbody td button {
        text-align: left !important;
        font-size: 0.8rem !important;
        /* تصغير النصوص داخل الخانات */
    }

    #top-vacations-modal tbody td:first-child>div {
        margin-bottom: 0 !important;
    }

    #top-vacations-modal .modal-header {
        padding: 1.1rem 1.25rem !important;
    }

    #top-vacations-modal .modal-header h3 {
        font-size: 1.05rem !important;
    }
}

/* Animation for the modal entrance */
#top-vacations-modal.show .modal-content {
    animation: slideUpModal 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes slideUpModal {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* Print Styles for Reports */
@media print {
    body * {
        visibility: hidden !important;
    }

    #top-vacations-modal,
    #top-vacations-modal * {
        visibility: visible !important;
    }

    #top-vacations-modal {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        z-index: 9999 !important;
    }

    .report-modal .modal-dialog {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        transform: none !important;
    }

    .report-modal .modal-content {
        height: auto !important;
        border: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    .report-modal .modal-header,
    .report-modal .modal-footer {
        display: none !important;
    }

    .report-modal .modal-body {
        padding: 0 !important;
        background: white !important;
    }

    .report-modal .data-table thead th {
        background: #f1f5f9 !important;
        color: #000 !important;
        border-bottom: 2px solid #000 !important;
    }

    .report-modal .data-table td {
        border-bottom: 1px solid #e2e8f0 !important;
    }
}

/* ==========================================
   Department Permissions Modal Styles
   ========================================== */

.dept-perm-item {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.dept-perm-item:hover {
    transform: translateX(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.dept-perm-select-all {
    margin-bottom: 1rem !important;
}

.dept-perm-item label {
    cursor: pointer;
    user-select: none;
}

.dept-perm-item input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dept-perm-item input[type="checkbox"]:disabled+.checkmark {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Custom Checkbox Styles */
.custom-checkbox {
    position: relative;
    padding-right: 2rem;
    cursor: pointer;
    user-select: none;
}



/* Scrollbar Styling for Department List */
#dept-perm-list::-webkit-scrollbar {
    width: 8px;
}

#dept-perm-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

#dept-perm-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

#dept-perm-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ==========================================
   Action Buttons Text (Desktop/Mobile)
   ========================================== */

/* تحسين مظهر الأزرار مع النص */
.action-buttons .btn-icon {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    min-width: auto;
}

/* إظهار النص في الأزرار على الكمبيوتر */
.btn-icon .btn-text {
    display: inline;
    font-size: 0.85rem;
    font-weight: 600;
}

/* تحسين الأيقونات */
.btn-icon i {
    font-size: 0.9rem;
}

/* تأثيرات hover */
.action-buttons .btn-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ألوان الأزرار */
.action-buttons .btn-icon.primary {
    background: #3b82f6;
    color: white;
}

.action-buttons .btn-icon.info {
    background: #0ea5e9;
    color: white;
}

.action-buttons .btn-icon.success {
    background: #10b981;
    color: white;
}

.action-buttons .btn-icon.warning {
    background: #f59e0b;
    color: white;
}

.action-buttons .btn-icon.danger {
    background: #ef4444;
    color: white;
}

/* إخفاء النص على الموبايل (فقط الأيقونات) */
@media (max-width: 767px) {
    .action-buttons .btn-icon .btn-text {
        display: none;
    }

    .action-buttons .btn-icon {
        min-width: 38px;
        padding: 0.5rem;
        gap: 0;
    }

    .action-buttons .btn-icon i {
        font-size: 1rem;
    }
}

/* تحسين المسافات بين الأزرار */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

/* تحسين تخطيط بطاقات أرصدة الإجازات الـ 6 لتظهر 2 في كل صف على الموبايل */
@media (max-width: 768px) {
    .vacation-cards-grid-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    .vacation-cards-grid-row .summary-card-small {
        padding: 0.65rem 0.75rem !important;
        min-height: 80px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
    }

    .vacation-cards-grid-row .summary-card-small span {
        font-size: 0.8rem !important;
        line-height: 1.2 !important;
    }

    .vacation-cards-grid-row .summary-card-small span[id^="card-"] {
        font-size: 1.35rem !important;
        margin-top: 0.25rem !important;
    }
}

#employees-section .modern-table tbody tr,
#vacations-section .modern-table tbody tr,
#custodies-section .modern-table tbody tr,
#promotions-section .modern-table tbody tr,
#bonuses-section .modern-table tbody tr,
#deductions-section .modern-table tbody tr,
#deduction-hours-section .modern-table tbody tr,
#resignations-section .modern-table tbody tr,
#loans-section .modern-table tbody tr,
#training-courses-section .modern-table tbody tr,
#social-contributions-section .modern-table tbody tr,
#investigations-section .modern-table tbody tr,
#evaluations-section .modern-table tbody tr,
#ideal-employees-section .modern-table tbody tr {
    cursor: pointer;
}

/* تميز الموظف الذي عاد للعمل بلون خلفية أصفر مائل للبرتقالي */
.modern-table tbody tr.returned-row,
.data-table tbody tr.returned-row,
tbody tr.returned-row {
    background-color: #fde68a !important;
    background: #fde68a !important;
}

.modern-table tbody tr.returned-row:hover,
.data-table tbody tr.returned-row:hover,
tbody tr.returned-row:hover {
    background-color: #fcd34d !important;
    background: #fcd34d !important;
}

/* ================================================= */
/* Employee Portal Premium Styling                   */
/* ================================================= */

.portal-profile-hero {
    background: #f2fbf7 !important;
    border-radius: 16px !important;
    padding: 1.25rem 1.75rem !important;
    color: #1e293b !important;
    display: flex !important;
    align-items: center !important;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.04) !important;
    position: relative;
    overflow: hidden;
    border: 1px solid #10b981 !important;
}

.portal-profile-hero::before {
    display: none !important;
}

.portal-hero-main {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 1.25rem !important;
    width: 100% !important;
    z-index: 2;
}

.portal-hero-avatar {
    width: 70px !important;
    height: 70px !important;
    background: #dcfce7 !important;
    border: none !important;
    border-radius: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 2.2rem !important;
    color: #10b981 !important;
    flex-shrink: 0 !important;
}

.portal-hero-details {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.35rem !important;
    text-align: right !important;
}

.portal-hero-details h2,
#portal-emp-name {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    margin: 0 !important;
    line-height: 1.2 !important;
}

#portal-emp-job {
    color: #475569 !important;
    font-weight: 500 !important;
    font-size: 0.95rem !important;
    margin: 0 !important;
    line-height: 1.2 !important;
}

#portal-emp-dept {
    background: #dcfce7 !important;
    color: #15803d !important;
    border: 1px solid #bbf7d0 !important;
    padding: 0.25rem 0.75rem !important;
    border-radius: 6px !important;
    font-weight: 700 !important;
    font-size: 0.8rem !important;
    display: inline-block !important;
}

body.font-small #portal-emp-name,
body.font-small .portal-hero-details h2 {
    font-size: 1.3rem !important;
}

body.font-xsmall #portal-emp-name,
body.font-xsmall .portal-hero-details h2 {
    font-size: 1.1rem !important;
}

.portal-hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.portal-stat-box {
    border-radius: 16px !important;
    padding: 1rem 1.25rem !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 1rem !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02) !important;
    transition: all 0.25s ease !important;
    border: 1px solid transparent !important;
}

.portal-stat-box:hover {
    transform: translateY(-2px) !important;
}

.portal-stat-text {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 0.25rem !important;
    text-align: center !important;
    width: 100% !important;
}

.portal-stat-label {
    font-size: 0.85rem !important;
    color: #475569 !important;
    font-weight: 700 !important;
}

.portal-stat-val {
    font-size: 1.45rem !important;
    font-weight: 800 !important;
}

.portal-stat-icon {
    width: 48px !important;
    height: 48px !important;
    border-radius: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.4rem !important;
    flex-shrink: 0 !important;
}

/* Color Themes */
.stat-red {
    background: #fef2f2 !important;
    border-color: #f87171 !important;
}

.stat-red:hover {
    border-color: #ef4444 !important;
    box-shadow: 0 8px 16px rgba(239, 68, 68, 0.08) !important;
}

.stat-red .portal-stat-val {
    color: #dc2626 !important;
}

.stat-red .portal-stat-icon {
    background: #fee2e2 !important;
    color: #dc2626 !important;
}

.stat-blue {
    background: #f0f7ff !important;
    border-color: #3b82f6 !important;
}

.stat-blue:hover {
    border-color: #1d4ed8 !important;
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.08) !important;
}

.stat-blue .portal-stat-val {
    color: #2563eb !important;
}

.stat-blue .portal-stat-icon {
    background: #dbeafe !important;
    color: #2563eb !important;
}

.stat-yellow {
    background: #fefbe8 !important;
    border-color: #eab308 !important;
}

.stat-yellow:hover {
    border-color: #a16207 !important;
    box-shadow: 0 8px 16px rgba(234, 179, 8, 0.08) !important;
}

.stat-yellow .portal-stat-val {
    color: #ca8a04 !important;
}

.stat-yellow .portal-stat-icon {
    background: #fef3c7 !important;
    color: #ca8a04 !important;
}

.portal-tabs-container {
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.portal-tabs {
    display: flex;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.portal-tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-p);
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 6px !important;
    transition: all 0.2s ease-in-out;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
}

.portal-tab:hover {
    background: #f1f5f9;
    border-color: var(--border-focus);
    color: var(--text-dark);
}

.portal-tab.active {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
    box-shadow: 0 2px 8px rgba(0, 140, 68, 0.15) !important;
    border-radius: 6px !important;
}

.portal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
}

.portal-card-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.portal-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.info-item {
    font-size: 0.95rem;
    color: var(--text-dark);
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-item strong {
    color: var(--primary-dark);
    font-weight: 700;
}

.portal-vacation-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.portal-vacation-summary .summary-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.portal-vacation-summary .summary-box .label {
    font-size: 0.85rem;
    color: var(--text-p);
    font-weight: 700;
}

.portal-vacation-summary .summary-box .val {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-dark);
}

.portal-vacation-summary .summary-box.highlight {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

@media (min-width: 769px) {
    .portal-tabs-container {
        overflow-x: visible !important;
        padding-bottom: 0;
    }

    .portal-tabs {
        display: grid !important;
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 0.75rem !important;
        border-bottom: none !important;
        padding-bottom: 0 !important;
    }

    .portal-tab {
        width: 100% !important;
        justify-content: center !important;
        padding: 0.75rem 0.5rem !important;
        font-size: 0.9rem !important;
        white-space: normal !important;
        text-align: center !important;
        box-sizing: border-box !important;
        height: 100% !important;
        border-radius: 6px !important;
        gap: 0.5rem !important;
    }
}

@media (max-width: 768px) {
    .portal-profile-hero {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        padding: 1rem 1.25rem !important;
        gap: 1rem !important;
        border-radius: 16px !important;
    }

    .portal-hero-main {
        flex-direction: row !important;
        gap: 1rem !important;
    }

    .portal-hero-avatar {
        width: 54px !important;
        height: 54px !important;
        font-size: 1.6rem !important;
        border-radius: 10px !important;
    }

    .portal-hero-details h2,
    #portal-emp-name {
        font-size: 1.2rem !important;
        line-height: 1.2;
        color: #1e293b !important;
    }

    body.font-small #portal-emp-name,
    body.font-small .portal-hero-details h2 {
        font-size: 1.4rem !important;
    }

    body.font-xsmall #portal-emp-name,
    body.font-xsmall .portal-hero-details h2 {
        font-size: 1.2rem !important;
    }

    .portal-hero-details p {
        font-size: 0.95rem !important;
    }

    .portal-hero-stats {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        width: 100% !important;
        gap: 0.5rem !important;
        margin-top: 0.75rem !important;
        margin-bottom: 1.25rem !important;
    }

    .portal-stat-box {
        padding: 0.5rem 0.25rem !important;
        border-radius: 10px !important;
        gap: 0.25rem !important;
        justify-content: center !important;
    }

    .portal-stat-text {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.15rem !important;
        text-align: center !important;
        width: 100% !important;
    }

    .portal-stat-label {
        font-size: 0.7rem !important;
        white-space: normal !important;
        line-height: 1.1 !important;
    }

    .portal-stat-val {
        font-size: 1.1rem !important;
    }

    .portal-info-grid {
        grid-template-columns: 1fr;
    }

    /* Grid Layout for Tab Buttons (2 columns, no scrollbar) */
    .portal-tabs-container {
        overflow-x: visible !important;
        padding-bottom: 0;
    }

    .portal-tabs {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.40rem !important;
        border-bottom: none !important;
        padding-bottom: 0 !important;
    }

    .portal-tab {
        width: 100% !important;
        justify-content: center !important;
        padding: 0.55rem 0.4rem !important;
        font-size: 0.8rem !important;
        white-space: normal !important;
        text-align: center !important;
        box-sizing: border-box !important;
        height: auto !important;
        border-radius: 6px !important;
        gap: 0.5rem !important;
    }

    /* Span the 7th tab button (التقييم) across the entire row if it is the odd one at the end */
    .portal-tab:last-child:nth-child(odd) {
        grid-column: span 2 !important;
    }
}

/* ==========================================================================
   Employee Credentials Section - Premium Styling (Desktop & Mobile)
   ========================================================================== */

/* Professional Employee Credentials Table Styling (Desktop) */
@media (min-width: 768px) {
    #employee-credentials-section .modern-table thead {
        background: linear-gradient(135deg, #059669, #10b981);
    }

    #employee-credentials-section .modern-table tbody tr:hover::before {
        background: #10b981;
    }

    #employee-credentials-section .modern-table td:first-child {
        color: #059669;
    }
}

/* Mobile Employee Credentials Table Specific Styling */
@media (max-width: 767px) {
    #employee-credentials-section .modern-table tbody tr td:nth-child(n+4) {
        display: none;
    }

    #employee-credentials-section .modern-table tbody tr {
        display: flex;
        flex-direction: column;
        background: #ffffff;
        margin-bottom: 1.25rem;
        border-radius: 16px;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
        border: 1px solid #94a3b8;
        padding: 0;
        overflow: hidden;
        cursor: pointer;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
    }

    #employee-credentials-section .modern-table tbody tr:hover {
        transform: translateY(-4px);
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
        border-color: #10b981;
    }

    #employee-credentials-section .modern-table tbody tr.user-inactive:hover {
        border-color: #94a3b8;
    }

    #employee-credentials-section .modern-table tbody tr.user-inactive td:nth-child(1) {
        background: rgba(254, 202, 202, 0.5) !important;
        color: #991b1b !important;
        border-bottom: 1px solid rgba(254, 226, 226, 0.8) !important;
    }

    #employee-credentials-section .modern-table tbody tr.user-inactive td:nth-child(1)::before {
        color: #dc2626 !important;
    }

    /* Employee table: Username code styling */
    #employee-credentials-section .modern-table td:nth-child(1) {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        gap: 0.4rem;
        background: rgba(240, 253, 244, 0.5);
        color: #059669;
        font-weight: 600;
        border-bottom: 1px solid rgba(220, 252, 231, 0.8);
        padding: 0.6rem 1.25rem;
        font-size: 0.8rem;
    }

    #employee-credentials-section .modern-table td:nth-child(1)::before {
        content: "\f2bd";
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        color: #10b981;
        font-size: 0.85rem;
        margin-left: 0.25rem;
    }

    /* Employee table: Employee name with more padding */
    #employee-credentials-section .modern-table td:nth-child(2) {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 1.1rem;
        font-weight: 700;
        color: #1e293b;
        border-bottom: none;
        padding: 0.85rem 1.25rem;
        gap: 1rem;
    }

    #employee-credentials-section .modern-table td:nth-child(2)::before {
        display: none;
    }

    /* Employee table: Employee Code badge positioned next to username */
    #employee-credentials-section .modern-table td:nth-child(3) {
        display: flex;
        position: absolute;
        left: 1.25rem;
        top: 0.65rem;
        padding: 0;
        border: none;
        background: transparent;
        z-index: 2;
    }

    #employee-credentials-section .modern-table td:nth-child(3)::before {
        display: none;
    }

    #employee-credentials-section .modern-table td:nth-child(3) .badge-role.b-worker {
        background: #f1f5f9 !important;
        color: #475569 !important;
    }

    /* Employee table: Status */
    #employee-credentials-section .modern-table td:nth-child(4) {
        display: flex;
        padding: 0.5rem 1.25rem;
        border-bottom: none;
    }

    /* Employee table: Actions */
    #employee-credentials-section .modern-table td:nth-child(5) {
        display: flex;
        justify-content: center;
        padding: 1rem 1.25rem;
        background: #f8fafc;
        gap: 1.5rem;
    }

    #employee-credentials-section .modern-table td:nth-child(5)::before {
        display: none;
    }
}

/* ==========================================================================
   Employee Portal Section - Styling Enhancements
   ========================================================================== */

/* Premium Details Cards grid overrides */
.info-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    transition: all 0.25s ease;
}

.info-item:hover {
    transform: translateY(-2px);
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    background: #ffffff;
}

.info-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(0, 140, 68, 0.08);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.info-content {
    display: flex;
    flex-direction: column;
    text-align: right;
    width: 100%;
}

.info-content label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.info-content span {
    font-size: 0.95rem;
    color: var(--text-dark);
    font-weight: 700;
    word-break: break-word;
}

/* Desktop: Disable sticky table header for employee portal to prevent floating overlapping */
@media (min-width: 768px) {

    #employee-portal-section .modern-table thead,
    #employee-search-portal-section .modern-table thead {
        position: static !important;
        box-shadow: none !important;
    }
}

/* Mobile: Modern card layout for employee portal tables */
@media (max-width: 767px) {

    #employee-portal-section .modern-table,
    #employee-search-portal-section .modern-table {
        display: block;
    }

    #employee-portal-section .modern-table thead,
    #employee-search-portal-section .modern-table thead {
        display: none !important;
    }

    #employee-portal-section .modern-table tbody,
    #employee-search-portal-section .modern-table tbody {
        display: block;
    }

    #employee-portal-section .modern-table tbody tr,
    #employee-search-portal-section .modern-table tbody tr {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        background: #ffffff;
        margin-bottom: 0.75rem !important;
        /* Increased distance between cards */
        border-radius: 10px !important;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02) !important;
        border: 1px solid #94a3b8 !important;
        /* Darker and clearer outer borders */
        padding: 0;
        overflow: hidden;
        position: relative;
        gap: 0 !important;
    }

    #employee-portal-section .modern-table td,
    #employee-search-portal-section .modern-table td {
        display: flex !important;
        /* override the general display: none */
        flex-direction: row !important;
        /* Single line */
        justify-content: center !important;
        align-items: center !important;
        flex-wrap: wrap !important;
        gap: 0.2rem !important;
        padding: 0.25rem 0.35rem !important;
        /* Tight vertical padding to minimize height */
        border-bottom: 1px solid #cbd5e1 !important;
        /* Darker and clearer bottom borders */
        font-size: 0.76rem !important;
        width: auto !important;
        box-sizing: border-box;
    }

    #employee-portal-section .modern-table td::before,
    #employee-search-portal-section .modern-table td::before {
        content: attr(data-label) ": ";
        font-size: 0.7rem !important;
        font-weight: 700;
        color: var(--text-muted);
        margin-inline-end: 0.15rem !important;
        margin-bottom: 0 !important;
        display: inline-block !important;
    }

    /* Force show cell labels for columns that were hidden by global rules */
    #employee-portal-section .modern-table td:nth-child(2)::before,
    #employee-portal-section .modern-table td:nth-child(3)::before,
    #employee-search-portal-section .modern-table td:nth-child(2)::before,
    #employee-search-portal-section .modern-table td:nth-child(3)::before {
        display: block !important;
    }

    /* Style the first cell as a premium header for the card */
    #employee-portal-section .modern-table td:nth-child(1),
    #employee-search-portal-section .modern-table td:nth-child(1) {
        grid-column: span 2 !important;
        flex-direction: row !important;
        justify-content: flex-start !important;
        gap: 0.5rem !important;
        align-items: center !important;
        font-weight: 700;
        font-size: 0.85rem !important;
        padding: 0.45rem 0.75rem !important;
        width: 100% !important;
        box-sizing: border-box;
        border-inline-end: none !important;
    }

    #employee-portal-section .modern-table td:nth-child(1)::before,
    #employee-search-portal-section .modern-table td:nth-child(1)::before {
        font-size: 0.75rem !important;
        margin-bottom: 0 !important;
    }

    /* Vertical line separator between columns for details cells */
    #employee-portal-section .modern-table td:nth-child(even),
    #employee-search-portal-section .modern-table td:nth-child(even) {
        border-inline-end: 1px solid #cbd5e1 !important;
        /* Darker and clearer vertical dividers */
    }

    /* Span last child to two columns if it falls alone on a row */
    #employee-portal-section .modern-table td:last-child:nth-child(even),
    #employee-search-portal-section .modern-table td:last-child:nth-child(even) {
        grid-column: span 2 !important;
        border-inline-end: none !important;
    }

    /* Tab-specific header styling for mobile cards to match admin panel themes */

    /* Vacations & Custodies - Light Emerald Green */
    #portal-vacations .modern-table td:nth-child(1),
    #portal-custodies .modern-table td:nth-child(1),
    #search-portal-vacations .modern-table td:nth-child(1),
    #search-portal-custodies .modern-table td:nth-child(1) {
        background: rgba(209, 250, 229, 0.6);
        color: #0f766e;
        border-bottom: 2px solid rgba(16, 185, 129, 0.3);
    }

    #portal-vacations .modern-table td:nth-child(1)::before,
    #portal-custodies .modern-table td:nth-child(1)::before,
    #search-portal-vacations .modern-table td:nth-child(1)::before,
    #search-portal-custodies .modern-table td:nth-child(1)::before {
        color: #0f766e;
    }

    /* Loans - Light Sky Blue */
    #portal-loans .modern-table td:nth-child(1),
    #search-portal-loans .modern-table td:nth-child(1) {
        background: rgba(224, 242, 254, 0.6);
        color: #0284c7;
        border-bottom: 2px solid rgba(2, 132, 199, 0.3);
    }

    #portal-loans .modern-table td:nth-child(1)::before,
    #search-portal-loans .modern-table td:nth-child(1)::before {
        color: #0284c7;
    }

    /* Bonuses - Light Green */
    #portal-bonuses .modern-table td:nth-child(1),
    #search-portal-bonuses .modern-table td:nth-child(1) {
        background: rgba(220, 252, 231, 0.6);
        color: #16a34a;
        border-bottom: 2px solid rgba(22, 163, 74, 0.3);
    }

    #portal-bonuses .modern-table td:nth-child(1)::before,
    #search-portal-bonuses .modern-table td:nth-child(1)::before {
        color: #16a34a;
    }

    /* Deductions - Light Red */
    #portal-deductions .modern-table td:nth-child(1),
    #search-portal-deductions .modern-table td:nth-child(1) {
        background: rgba(254, 226, 226, 0.6);
        color: #dc2626;
        border-bottom: 2px solid rgba(220, 38, 38, 0.3);
    }

    #portal-deductions .modern-table td:nth-child(1)::before,
    #search-portal-deductions .modern-table td:nth-child(1)::before {
        color: #dc2626;
    }

    /* Evaluations - Light Indigo */
    #portal-evaluations .modern-table td:nth-child(1),
    #search-portal-evaluations .modern-table td:nth-child(1) {
        background: rgba(238, 242, 255, 0.7);
        color: #4f46e5;
        border-bottom: 2px solid rgba(99, 102, 241, 0.3);
    }

    #portal-evaluations .modern-table td:nth-child(1)::before,
    #search-portal-evaluations .modern-table td:nth-child(1)::before {
        color: #4f46e5;
    }

    /* Deduction Hours - Light Amber */
    #portal-deduction-hours .modern-table td:nth-child(1),
    #search-portal-deduction-hours .modern-table td:nth-child(1) {
        background: rgba(254, 243, 199, 0.7);
        color: #d97706;
        border-bottom: 2px solid rgba(217, 119, 6, 0.3);
    }

    #portal-deduction-hours .modern-table td:nth-child(1)::before,
    #search-portal-deduction-hours .modern-table td:nth-child(1)::before {
        color: #d97706;
    }

    /* Social Contributions - Light Purple */
    #portal-social-contributions .modern-table td:nth-child(1),
    #search-portal-social-contributions .modern-table td:nth-child(1) {
        background: rgba(243, 232, 255, 0.7);
        color: #7c3aed;
        border-bottom: 2px solid rgba(124, 58, 237, 0.3);
    }

    #portal-social-contributions .modern-table td:nth-child(1)::before,
    #search-portal-social-contributions .modern-table td:nth-child(1)::before {
        color: #7c3aed;
    }

    /* Training Courses - Light Emerald Green */
    #portal-training-courses .modern-table td:nth-child(1),
    #search-portal-training-courses .modern-table td:nth-child(1) {
        background: rgba(209, 250, 229, 0.6);
        color: #0f766e;
        border-bottom: 2px solid rgba(16, 185, 129, 0.3);
    }

    #portal-training-courses .modern-table td:nth-child(1)::before,
    #search-portal-training-courses .modern-table td:nth-child(1)::before {
        color: #0f766e;
    }

    /* Ideal Employees - Light Gold */
    #search-portal-ideal-employees .modern-table td:nth-child(1) {
        background: rgba(254, 243, 199, 0.7);
        color: #d97706;
        border-bottom: 2px solid rgba(217, 119, 6, 0.3);
    }

    #search-portal-ideal-employees .modern-table td:nth-child(1)::before {
        color: #d97706;
    }

    /* Promotions - Light Indigo */
    #search-portal-promotions .modern-table td:nth-child(1) {
        background: rgba(238, 242, 255, 0.7);
        color: #4f46e5;
        border-bottom: 2px solid rgba(99, 102, 241, 0.3);
    }

    #search-portal-promotions .modern-table td:nth-child(1)::before {
        color: #4f46e5;
    }

    /* Professional Documents - Light Slate */
    #search-portal-professional-documents .modern-table td:nth-child(1) {
        background: rgba(241, 245, 249, 0.8);
        color: #475569;
        border-bottom: 2px solid rgba(71, 85, 105, 0.3);
    }

    #search-portal-professional-documents .modern-table td:nth-child(1)::before {
        color: #475569;
    }

    /* Special Needs (Determined) - Light Teal */
    #search-portal-special-needs .modern-table td:nth-child(1) {
        background: rgba(204, 251, 241, 0.7);
        color: #0d9488;
        border-bottom: 2px solid rgba(13, 148, 136, 0.3);
    }

    #search-portal-special-needs .modern-table td:nth-child(1)::before {
        color: #0d9488;
    }

    /* Investigations - Light Red */
    #search-portal-investigations .modern-table td:nth-child(1) {
        background: rgba(254, 226, 226, 0.7);
        color: #b91c1c;
        border-bottom: 2px solid rgba(185, 28, 28, 0.3);
    }

    #search-portal-investigations .modern-table td:nth-child(1)::before {
        color: #b91c1c;
    }

    /* Resignations (Leaving Work) - Light Orange */
    #search-portal-resignations .modern-table td:nth-child(1) {
        background: rgba(254, 237, 222, 0.7);
        color: #c2410c;
        border-bottom: 2px solid rgba(194, 65, 12, 0.3);
    }

    #search-portal-resignations .modern-table td:nth-child(1)::before {
        color: #c2410c;
    }

    /* Make search suggestions dropdown full width on mobile */
    #general-search-container {
        position: relative !important;
    }

    #general-search-container .autocomplete-wrapper {
        position: static !important;
    }

    #dashboard-emp-suggestions {
        width: 100% !important;
        left: 0 !important;
        right: 0 !important;
        box-sizing: border-box !important;
        border-radius: 12px !important;
    }
}

/* Override first/last child width constraints for employee portal tables on desktop to look proportionate */
@media (min-width: 768px) {

    #employee-portal-section .modern-table th:first-child,
    #employee-portal-section .modern-table td:first-child,
    #employee-portal-section .modern-table th:last-child,
    #employee-portal-section .modern-table td:last-child,
    #employee-search-portal-section .modern-table th:first-child,
    #employee-search-portal-section .modern-table td:first-child,
    #employee-search-portal-section .modern-table th:last-child,
    #employee-search-portal-section .modern-table td:last-child {
        width: auto !important;
        white-space: normal !important;
    }

    /* Center text in all cells of portal tables */
    #employee-portal-section .modern-table th,
    #employee-portal-section .modern-table td,
    #employee-search-portal-section .modern-table th,
    #employee-search-portal-section .modern-table td {
        text-align: center !important;
    }

    /* Balanced widths for portal tables to make them look elegant on wide desktop displays */

    /* Bonuses Table Column Widths (4 columns) */
    #portal-bonuses .modern-table th:nth-child(1),
    #portal-bonuses .modern-table td:nth-child(1),
    #search-portal-bonuses .modern-table th:nth-child(1),
    #search-portal-bonuses .modern-table td:nth-child(1) {
        width: 20% !important;
    }

    #portal-bonuses .modern-table th:nth-child(2),
    #portal-bonuses .modern-table td:nth-child(2),
    #search-portal-bonuses .modern-table th:nth-child(2),
    #search-portal-bonuses .modern-table td:nth-child(2) {
        width: 20% !important;
    }

    #portal-bonuses .modern-table th:nth-child(3),
    #portal-bonuses .modern-table td:nth-child(3),
    #search-portal-bonuses .modern-table th:nth-child(3),
    #search-portal-bonuses .modern-table td:nth-child(3) {
        width: 20% !important;
    }

    #portal-bonuses .modern-table th:nth-child(4),
    #portal-bonuses .modern-table td:nth-child(4),
    #search-portal-bonuses .modern-table th:nth-child(4),
    #search-portal-bonuses .modern-table td:nth-child(4) {
        width: 40% !important;
        text-align: right !important;
    }

    /* Deductions Table Column Widths (5 columns) */
    #portal-deductions .modern-table th:nth-child(1),
    #portal-deductions .modern-table td:nth-child(1),
    #search-portal-deductions .modern-table th:nth-child(1),
    #search-portal-deductions .modern-table td:nth-child(1) {
        width: 15% !important;
    }

    #portal-deductions .modern-table th:nth-child(2),
    #portal-deductions .modern-table td:nth-child(2),
    #search-portal-deductions .modern-table th:nth-child(2),
    #search-portal-deductions .modern-table td:nth-child(2) {
        width: 15% !important;
    }

    #portal-deductions .modern-table th:nth-child(3),
    #portal-deductions .modern-table td:nth-child(3),
    #search-portal-deductions .modern-table th:nth-child(3),
    #search-portal-deductions .modern-table td:nth-child(3) {
        width: 15% !important;
    }

    #portal-deductions .modern-table th:nth-child(4),
    #portal-deductions .modern-table td:nth-child(4),
    #search-portal-deductions .modern-table th:nth-child(4),
    #search-portal-deductions .modern-table td:nth-child(4) {
        width: 35% !important;
        text-align: right !important;
    }

    #portal-deductions .modern-table th:nth-child(5),
    #portal-deductions .modern-table td:nth-child(5),
    #search-portal-deductions .modern-table th:nth-child(5),
    #search-portal-deductions .modern-table td:nth-child(5) {
        width: 20% !important;
    }

    /* Evaluations Table Column Widths (6 columns) */
    #portal-evaluations .modern-table th:nth-child(1),
    #portal-evaluations .modern-table td:nth-child(1),
    #search-portal-evaluations .modern-table th:nth-child(1),
    #search-portal-evaluations .modern-table td:nth-child(1) {
        width: 15% !important;
    }

    #portal-evaluations .modern-table th:nth-child(2),
    #portal-evaluations .modern-table td:nth-child(2),
    #search-portal-evaluations .modern-table th:nth-child(2),
    #search-portal-evaluations .modern-table td:nth-child(2) {
        width: 15% !important;
    }

    #portal-evaluations .modern-table th:nth-child(3),
    #portal-evaluations .modern-table td:nth-child(3),
    #search-portal-evaluations .modern-table th:nth-child(3),
    #search-portal-evaluations .modern-table td:nth-child(3) {
        width: 15% !important;
    }

    #portal-evaluations .modern-table th:nth-child(4),
    #portal-evaluations .modern-table td:nth-child(4),
    #search-portal-evaluations .modern-table th:nth-child(4),
    #search-portal-evaluations .modern-table td:nth-child(4) {
        width: 15% !important;
    }

    #portal-evaluations .modern-table th:nth-child(5),
    #portal-evaluations .modern-table td:nth-child(5),
    #search-portal-evaluations .modern-table th:nth-child(5),
    #search-portal-evaluations .modern-table td:nth-child(5) {
        width: 15% !important;
    }

    #portal-evaluations .modern-table th:nth-child(6),
    #portal-evaluations .modern-table td:nth-child(6),
    #search-portal-evaluations .modern-table th:nth-child(6),
    #search-portal-evaluations .modern-table td:nth-child(6) {
        width: 25% !important;
    }
}

/* ==========================================================================
   Employee Filters - Grid Layout
   ========================================================================== */
.employee-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
    width: 100%;
}

.employee-filters-grid .multi-select-container {
    width: 100%;
    min-width: 0;
}

@media (max-width: 768px) {
    .employee-filters-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    .employee-filters-grid .multi-select-container {
        width: 100% !important;
        min-width: 0 !important;
        flex: none !important;
    }

    /* Make the last filter span full width if the total number of filters is odd */
    .employee-filters-grid .multi-select-container:last-child:nth-child(odd) {
        grid-column: span 2;
    }

    /* Prevent dropdown list from going off-screen to the left on mobile by aligning left column filters dropdowns to the left */
    .employee-filters-grid .multi-select-container:nth-child(even) .multi-select-dropdown {
        right: auto !important;
        left: 0 !important;
    }
}

@media (min-width: 769px) {

    /* Prevent filters dropdown content from being squeezed on desktop */
    .employee-filters-grid .multi-select-dropdown {
        min-width: 200px !important;
        width: max-content !important;
        max-width: 280px !important;
        right: 0 !important;
        left: auto !important;
    }

    /* Left-align the leftmost dropdowns on desktop to prevent going off-screen */
    #container-insurance-entity-filter .multi-select-dropdown,
    #container-health-insurance-filter .multi-select-dropdown,
    #container-probation-result-filter .multi-select-dropdown,
    #container-blood-type-filter .multi-select-dropdown,
    #container-special-needs-filter .multi-select-dropdown {
        right: auto !important;
        left: 0 !important;
    }
}

/* Fix for employee modal positioning (fixed header alignment, no inner scrollbars) */
#employee-modal.modal {
    align-items: flex-start !important;
    overflow-y: auto !important;
    padding: 2rem 1rem !important;
}

#employee-modal .modal-dialog {
    height: auto !important;
    max-height: none !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

#employee-modal .modal-content {
    height: auto !important;
}

#employee-modal .modal-body {
    display: block !important;
    overflow: visible !important;
    padding: 0 !important;
}

#employee-modal #employee-form {
    display: block !important;
    overflow: visible !important;
    padding: 1.5rem !important;
}

#employee-modal .tab-content {
    display: none;
    overflow: visible !important;
    padding: 0 !important;
}

#employee-modal .tab-content.active {
    display: block !important;
}

#employee-modal .modal-footer {
    margin-top: 1.5rem !important;
    padding: 1rem 0 0 0 !important;
    border-top: 1px solid var(--border) !important;
    background: transparent !important;
}

/* ==========================================
   Multi Select Search and Reset Controls Styling
   ========================================== */
.multi-select-search-container {
    position: sticky;
    top: -0.5rem;
    background: #ffffff;
    z-index: 10;
    margin: -0.5rem -0.5rem 0.5rem -0.5rem;
    padding: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.multi-select-search-input {
    width: 100%;
    padding: 8px 12px;
    height: 36px;
    font-size: 0.85rem;
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    transition: all 0.2s ease;
    color: var(--text-dark);
    text-align: right;
    /* محاذاة البحث لليمين */
}

.multi-select-search-input:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 140, 68, 0.1);
    outline: none;
}

.multi-select-clear-btn {
    width: 100%;
    height: 32px;
    font-size: 0.8rem;
    font-weight: 700;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fee2e2;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: all 0.2s ease;
}

.multi-select-clear-btn:hover {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fca5a5;
}

.multi-select-items-container {
    display: flex;
    flex-direction: column;
}

/* ==========================================
   Custom Arabic Datepicker Styles
   ========================================== */
.custom-datepicker-container {
    position: relative;
    width: 100%;
}

.custom-datepicker-calendar {
    position: absolute;
    right: 0;
    left: auto;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    z-index: 1050;
    padding: 1rem;
    width: 320px;
    font-family: inherit;
    direction: rtl;
    user-select: none;
    animation: fadeIn 0.2s ease forwards;
}

.custom-datepicker-calendar.datepicker-open-upwards {
    bottom: calc(100% + 5px);
    top: auto;
    box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.1), 0 -8px 10px -6px rgba(0, 0, 0, 0.1);
}

.custom-datepicker-calendar.datepicker-open-downwards {
    top: calc(100% + 5px);
    bottom: auto;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

@media (max-width: 480px) {
    .custom-datepicker-calendar {
        position: fixed !important;
        width: auto !important;
        max-width: calc(100vw - 20px);
        min-width: 280px;
        padding: 0.75rem;
        border-radius: 10px;
        z-index: 9999 !important;
    }

    .custom-datepicker-calendar .datepicker-header {
        gap: 0.25rem;
        margin-bottom: 0.5rem;
    }

    .custom-datepicker-calendar .datepicker-header button {
        width: 28px;
        height: 28px;
    }

    .custom-datepicker-calendar .datepicker-selectors select {
        font-size: 0.8rem;
        padding: 0.2rem 0.3rem;
    }

    .custom-datepicker-calendar .datepicker-weekdays {
        font-size: 0.75rem;
        margin-bottom: 0.35rem;
    }

    .custom-datepicker-calendar .datepicker-day {
        font-size: 0.8rem;
    }

    .custom-datepicker-calendar.datepicker-open-upwards {
        bottom: auto;
    }

    .custom-datepicker-calendar.datepicker-open-downwards {
        top: auto;
    }
}

.custom-datepicker-calendar.hidden {
    display: none !important;
}

.datepicker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
}

.datepicker-header button {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.datepicker-header button:hover {
    background: #e2e8f0;
    color: var(--primary);
}

.datepicker-selectors {
    display: flex;
    gap: 0.25rem;
    flex: 1;
    justify-content: center;
}

.datepicker-selectors select {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    background: #fff;
    cursor: pointer;
    color: #334155;
    outline: none;
    text-align: center;
}

.datepicker-selectors select:focus {
    border-color: var(--primary);
}

.datepicker-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.datepicker-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.datepicker-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    color: #334155;
    transition: all 0.2s ease;
}

.datepicker-day:hover:not(.empty) {
    background: #f1f5f9;
    color: var(--primary);
}

.datepicker-day.selected {
    background: var(--primary) !important;
    color: #ffffff !important;
}

.datepicker-day.today {
    border: 1.5px solid var(--accent);
    color: var(--accent);
}

.datepicker-day.other-month {
    color: #94a3b8;
    font-weight: 400;
}

.datepicker-day.empty {
    cursor: default;
    background: transparent;
}

.datepicker-weekdays div.friday,
.datepicker-day.friday {
    color: #dc2626 !important;
}

.datepicker-day.friday.selected {
    color: #ffffff !important;
}

/* ==========================================================================
   Searchable Select Dropdowns (Custom Component)
   ========================================================================== */
.searchable-select-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.searchable-select-container {
    position: relative;
    width: 100%;
}

.searchable-select-trigger {
    width: 100%;
    padding: 10px 14px;
    height: 44px;
    font-size: 0.9rem;
    background: #ffffff;
    border: 1.5px solid #94a3b8;
    border-radius: 8px;
    transition: all 0.2s ease;
    color: var(--text-dark);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    box-sizing: border-box;
}

.searchable-select-trigger:hover {
    border-color: var(--primary, #008c44);
}

.searchable-select-trigger.active {
    border-color: var(--accent, #d4af37);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
    outline: none;
}

.searchable-select-text {
    flex-grow: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.searchable-select-text.placeholder {
    color: #94a3b8;
}

.searchable-select-chevron {
    color: #64748b;
    font-size: 0.8rem;
    transition: transform 0.2s ease;
    margin-right: 8px;
}

.searchable-select-trigger.active .searchable-select-chevron {
    transform: rotate(180deg);
}

.searchable-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    max-height: 300px;
    overflow: hidden;
    animation: searchableSelectSlideDown 0.15s ease-out;
}

@keyframes searchableSelectSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.searchable-select-dropdown.hidden {
    display: none !important;
}

.searchable-select-search-wrapper {
    padding: 8px;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
}

.searchable-select-input {
    width: 100%;
    padding: 8px 12px;
    height: 36px;
    font-size: 0.85rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-sizing: border-box;
    text-align: right;
    /* محاذاة النص لليمين لسهولة الكتابة بالعربي */
}

.searchable-select-input:focus {
    border-color: var(--primary, #008c44);
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 140, 68, 0.1);
}

.searchable-select-options {
    flex-grow: 1;
    overflow-y: auto;
    max-height: 200px;
}

.searchable-select-option {
    padding: 10px 14px;
    font-size: 0.9rem;
    cursor: pointer;
    text-align: center;
    border-bottom: 1px solid #f8fafc;
    color: var(--text-dark);
    transition: background 0.15s ease;
}

.searchable-select-option:last-child {
    border-bottom: none;
}

.searchable-select-option:hover {
    background: #f1f5f9;
}

.searchable-select-option.selected {
    background: rgba(0, 140, 68, 0.08);
    color: var(--primary, #008c44);
    font-weight: 600;
}

.searchable-select-option.disabled {
    color: #cbd5e1;
    cursor: not-allowed;
    background: #f8fafc;
}

.searchable-select-no-results {
    padding: 12px;
    text-align: center;
    color: #64748b;
    font-size: 0.85rem;
}

/* =========================================================================
   PRODUCTS & INVENTORY SECTION (Matches aboughaly_hr_admin Employees Page)
   ========================================================================= */

/* 1. Counter Card & Stat Badges */
.emp-count-card-wrapper {
    margin: 0.75rem 0 0.5rem 0;
}

.emp-stat-badge {
    padding: 0.85rem 1.25rem;
    border-radius: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
}

.emp-stat-badge.total-badge {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    color: #1e293b;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.emp-stat-badge.active-filter-badge {
    background: #f0f9ff;
    border: 1.5px solid #bae6fd;
    color: #0369a1;
    box-shadow: 0 2px 4px rgba(2, 132, 199, 0.06);
}

/* 2. Desktop Table Layout & Sticky Header (min-width: 768px) */
@media (min-width: 768px) {
    .mobile-only {
        display: none !important;
    }
    .desktop-only {
        display: inline !important;
    }
    td.desktop-only {
        display: table-cell !important;
    }

    #products-section .table-container {
        background: #ffffff !important;
        border-radius: 16px !important;
        border: 2px solid #e2e8f0 !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05) !important;
        overflow: visible !important;
        margin-top: 0.75rem !important;
    }

    #products-section .modern-table {
        width: 100% !important;
        border-collapse: collapse !important;
    }

    #products-section .modern-table thead {
        background: #133458 !important;
        position: sticky !important;
        top: 144px !important;
        z-index: 15 !important;
        box-shadow: 0 4px 14px rgba(19, 52, 88, 0.22) !important;
    }

    #products-section .modern-table th {
        background: #133458 !important;
        color: #ffffff !important;
        font-size: 0.88rem !important;
        font-weight: 800 !important;
        padding: 0.95rem 0.85rem !important;
        border-left: 1px solid rgba(255, 255, 255, 0.3) !important;
        text-align: center !important;
    }

    /* Teal Blue columns for Code and Product Name */
    #products-section .modern-table th:nth-child(1),
    #products-section .modern-table th:nth-child(2) {
        background: #0e7490 !important;
        color: #ffffff !important;
        border-left: 1px solid rgba(255, 255, 255, 0.3) !important;
    }

    /* First column (الكود) tight width */
    #products-section .modern-table th:first-child,
    #products-section .modern-table td:first-child {
        width: 1% !important;
        white-space: nowrap !important;
        text-align: center !important;
        font-weight: 800 !important;
        color: #0e7490 !important;
        padding: 0.65rem 0.9rem !important;
    }

    #products-section .modern-table th:nth-child(2) {
        text-align: right !important;
        padding-right: 1.25rem !important;
    }

    #products-section .modern-table td {
        padding: 0.65rem 0.85rem !important;
        border-bottom: 1px solid #cbd5e1 !important;
        border-left: 1px solid #cbd5e1 !important;
        font-weight: 600 !important;
        font-size: 0.9rem !important;
        text-align: center !important;
        vertical-align: middle !important;
    }

    #products-section .modern-table td:nth-child(2) {
        text-align: right !important;
        padding-right: 1.25rem !important;
        font-weight: 700 !important;
        color: #0f172a !important;
    }

    /* Last column (إجراءات) tight width */
    #products-section .modern-table th:last-child,
    #products-section .modern-table td:last-child {
        width: 1% !important;
        white-space: nowrap !important;
        text-align: center !important;
        padding: 0.4rem 0.65rem !important;
    }

    #products-section .modern-table tbody tr:nth-child(even) {
        background-color: #f8fafc !important;
    }

    #products-section .modern-table tbody tr:hover {
        background-color: #eef2ff !important;
    }

    /* Inventory Balances Section Desktop Table Layout */
    #inventory-balances-section .table-container {
        background: #ffffff !important;
        border-radius: 16px !important;
        border: 2px solid #e2e8f0 !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05) !important;
        overflow: visible !important;
        margin-top: 0.75rem !important;
    }

    #inventory-balances-section .modern-table {
        width: 100% !important;
        border-collapse: collapse !important;
    }

    #inventory-balances-section .modern-table thead {
        background: #0284c7 !important;
        position: sticky !important;
        top: 144px !important;
        z-index: 15 !important;
        box-shadow: 0 4px 14px rgba(2, 132, 199, 0.22) !important;
    }

    #inventory-balances-section .modern-table th {
        background: #0284c7 !important;
        color: #ffffff !important;
        font-size: 0.88rem !important;
        font-weight: 800 !important;
        padding: 0.95rem 0.85rem !important;
        border-left: 1px solid rgba(255, 255, 255, 0.3) !important;
        text-align: center !important;
    }

    #inventory-balances-section .modern-table th:first-child,
    #inventory-balances-section .modern-table td:first-child {
        width: 1% !important;
        white-space: nowrap !important;
        text-align: center !important;
        font-weight: 800 !important;
        color: #0284c7 !important;
        padding: 0.65rem 0.9rem !important;
    }

    #inventory-balances-section .modern-table th:nth-child(2) {
        text-align: right !important;
        padding-right: 1.25rem !important;
    }

    #inventory-balances-section .modern-table td {
        padding: 0.65rem 0.85rem !important;
        border-bottom: 1px solid #cbd5e1 !important;
        border-left: 1px solid #cbd5e1 !important;
        font-weight: 600 !important;
        font-size: 0.9rem !important;
        text-align: center !important;
        vertical-align: middle !important;
    }

    #inventory-balances-section .modern-table td:nth-child(2) {
        text-align: right !important;
        padding-right: 1.25rem !important;
        font-weight: 700 !important;
        color: #0f172a !important;
    }

    #inventory-balances-section .modern-table th:last-child,
    #inventory-balances-section .modern-table td:last-child {
        width: 1% !important;
        white-space: nowrap !important;
        text-align: center !important;
        padding: 0.4rem 0.65rem !important;
    }

    #inventory-balances-section .modern-table tbody tr:nth-child(even) {
        background-color: #f8fafc !important;
    }

    #inventory-balances-section .modern-table tbody tr:hover {
        background-color: #f0f9ff !important;
    }

    /* Stagnant Inventory Section Desktop Table Layout */
    #stagnant-inventory-section .table-container {
        background: #ffffff !important;
        border-radius: 16px !important;
        border: 2px solid #e2e8f0 !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05) !important;
        overflow: visible !important;
        margin-top: 0.75rem !important;
    }

    #stagnant-inventory-section .modern-table {
        width: 100% !important;
        border-collapse: collapse !important;
    }

    #stagnant-inventory-section .modern-table thead {
        background: #0A7C6E !important;
        position: sticky !important;
        top: 144px !important;
        z-index: 15 !important;
        box-shadow: 0 4px 14px rgba(10, 124, 110, 0.22) !important;
    }

    #stagnant-inventory-section .modern-table th {
        background: #0A7C6E !important;
        color: #ffffff !important;
        font-size: 0.88rem !important;
        font-weight: 800 !important;
        padding: 0.95rem 0.85rem !important;
        border-left: 1px solid rgba(255, 255, 255, 0.3) !important;
        text-align: center !important;
    }

    #stagnant-inventory-section .modern-table th:first-child,
    #stagnant-inventory-section .modern-table td:first-child {
        width: 1% !important;
        white-space: nowrap !important;
        text-align: center !important;
        font-weight: 800 !important;
        color: #0A7C6E !important;
        padding: 0.65rem 0.9rem !important;
    }

    #stagnant-inventory-section .modern-table th:nth-child(2) {
        text-align: right !important;
        padding-right: 1.25rem !important;
    }

    #stagnant-inventory-section .modern-table td {
        padding: 0.65rem 0.85rem !important;
        border-bottom: 1px solid #cbd5e1 !important;
        border-left: 1px solid #cbd5e1 !important;
        font-weight: 600 !important;
        font-size: 0.9rem !important;
        text-align: center !important;
        vertical-align: middle !important;
    }

    #stagnant-inventory-section .modern-table td:nth-child(2) {
        text-align: right !important;
        padding-right: 1.25rem !important;
        font-weight: 700 !important;
        color: #0f172a !important;
    }

    #stagnant-inventory-section .modern-table th:last-child,
    #stagnant-inventory-section .modern-table td:last-child {
        width: 1% !important;
        white-space: nowrap !important;
        text-align: center !important;
        padding: 0.4rem 0.65rem !important;
    }

    #stagnant-inventory-section .modern-table tbody tr:nth-child(even) {
        background-color: #f8fafc !important;
    }

    #stagnant-inventory-section .modern-table tbody tr:hover {
        background-color: #f0fdfa !important;
    }

    /* Product Card Modal Desktop Layout */
    #product-card-modal .modern-table {
        table-layout: fixed !important;
        width: 100% !important;
        border-collapse: separate !important;
        border-spacing: 0 !important;
    }
}

/* Action Buttons Styling (Crisp, High-Contrast & Beautifully Spaced) */
.action-buttons {
    display: inline-flex !important;
    gap: 0.4rem !important;
    justify-content: center !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
}

.action-buttons .btn-icon {
    width: auto !important;
    min-width: auto !important;
    height: 32px !important;
    padding: 0 0.65rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.35rem !important;
    border-radius: 6px !important;
    border: none !important;
    cursor: pointer !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

.action-buttons .btn-icon i {
    font-size: 0.8rem !important;
    margin: 0 !important;
}

.action-buttons .btn-icon .btn-text {
    display: inline !important;
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
}

.action-buttons .btn-icon:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
    filter: brightness(1.1) !important;
}

.action-buttons .btn-icon.info {
    background: #0284c7 !important;
    color: #ffffff !important;
}

.action-buttons .btn-icon.warning {
    background: #ea580c !important;
    color: #ffffff !important;
}

.action-buttons .btn-icon.success {
    background: #16a34a !important;
    color: #ffffff !important;
}

.action-buttons .btn-icon.primary {
    background: #2563eb !important;
    color: #ffffff !important;
}

.action-buttons .btn-icon.danger {
    background: #dc2626 !important;
    color: #ffffff !important;
}

/* Products table square icon buttons */
#products-section .modern-table td.action-buttons .btn-icon {
    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
}

#products-section .modern-table td.action-buttons .btn-icon.primary {
    color: #1e40af !important;
    background: #dbeafe !important;
    border: 1px solid #bfdbfe !important;
}

#products-section .modern-table td.action-buttons .btn-icon.primary:hover {
    background: #1d4ed8 !important;
    color: #ffffff !important;
}

#products-section .modern-table td.action-buttons .btn-icon.danger {
    color: #b91c1c !important;
    background: #fee2e2 !important;
    border: 1px solid #fecaca !important;
}

#products-section .modern-table td.action-buttons .btn-icon.danger:hover {
    background: #dc2626 !important;
    color: #ffffff !important;
}

/* Desktop default: Hide mobile card & mobile labels */
.mobile-only-card,
.mobile-item-header,
.mobile-item-label {
    display: none !important;
}

/* 3. Mobile Card View (max-width: 767px) - Exact aboughaly_hr_admin structure */
@media (max-width: 767px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only-card {
        display: block !important;
        width: 100% !important;
    }

    .mobile-item-header {
        display: flex !important;
    }

    .mobile-item-label {
        display: block !important;
    }

    #products-section .table-container {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        overflow: visible !important;
        padding: 0 !important;
        margin-top: 0.5rem !important;
    }

    #products-section .modern-table {
        display: block !important;
        width: 100% !important;
        background: transparent !important;
        border: none !important;
    }

    #products-section .modern-table thead {
        display: none !important;
    }

    #products-section .modern-table tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }

    /* Product Mobile Card - Header & Body Styled Card */
    #products-section .modern-table tbody tr {
        display: block !important;
        background: transparent !important;
        border: none !important;
        border-radius: 12px !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin-bottom: 0.5rem !important;
        cursor: pointer !important;
        transition: transform 0.2s ease !important;
        position: relative !important;
        text-align: right !important;
    }

    #products-section .modern-table tbody tr:hover,
    #products-section .modern-table tbody tr:active {
        transform: translateY(-2px) !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    /* Suppress any unwanted table pseudo-labels */
    #products-section .modern-table td::before {
        display: none !important;
        content: none !important;
    }

    #products-section .modern-table td {
        padding: 0 !important;
        border: none !important;
        text-align: right !important;
        background: transparent !important;
        display: block !important;
    }

    #products-section .modern-table td:not(:first-child) {
        display: none !important;
    }

    #products-section .toolbar-card {
        padding: 1rem !important;
        border-radius: 14px !important;
    }

    /* Inventory Balances Section Mobile Card View */
    #inventory-balances-section .table-container {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        overflow: visible !important;
        padding: 0 !important;
        margin-top: 0.5rem !important;
    }

    #inventory-balances-section .modern-table {
        display: block !important;
        width: 100% !important;
        background: transparent !important;
        border: none !important;
    }

    #inventory-balances-section .modern-table thead {
        display: none !important;
    }

    #inventory-balances-section .modern-table tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }

    #inventory-balances-section .modern-table tbody tr {
        display: block !important;
        background: transparent !important;
        border: none !important;
        border-radius: 12px !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin-bottom: 0.5rem !important;
        cursor: pointer !important;
        transition: transform 0.2s ease !important;
        position: relative !important;
        text-align: right !important;
    }

    #inventory-balances-section .modern-table tbody tr:hover,
    #inventory-balances-section .modern-table tbody tr:active {
        transform: translateY(-2px) !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    #inventory-balances-section .modern-table td::before {
        display: none !important;
        content: none !important;
    }

    #inventory-balances-section .modern-table td {
        padding: 0 !important;
        border: none !important;
        text-align: right !important;
        background: transparent !important;
        display: block !important;
    }

    #inventory-balances-section .modern-table td:not(:first-child) {
        display: none !important;
    }

    #inventory-balances-section .toolbar-card {
        padding: 1rem !important;
        border-radius: 14px !important;
    }

    /* Stagnant Inventory Section Mobile Card View */
    #stagnant-inventory-section .table-container {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        overflow: visible !important;
        padding: 0 !important;
        margin-top: 0.5rem !important;
    }

    #stagnant-inventory-section .modern-table {
        display: block !important;
        width: 100% !important;
        background: transparent !important;
        border: none !important;
    }

    #stagnant-inventory-section .modern-table thead {
        display: none !important;
    }

    #stagnant-inventory-section .modern-table tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }

    #stagnant-inventory-section .modern-table tbody tr {
        display: block !important;
        background: transparent !important;
        border: none !important;
        border-radius: 12px !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin-bottom: 0.5rem !important;
        cursor: pointer !important;
        transition: transform 0.2s ease !important;
        position: relative !important;
        text-align: right !important;
    }

    #stagnant-inventory-section .modern-table tbody tr:hover,
    #stagnant-inventory-section .modern-table tbody tr:active {
        transform: translateY(-2px) !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    #stagnant-inventory-section .modern-table td::before {
        display: none !important;
        content: none !important;
    }

    #stagnant-inventory-section .modern-table td {
        padding: 0 !important;
        border: none !important;
        text-align: right !important;
        background: transparent !important;
        display: block !important;
    }

    #stagnant-inventory-section .modern-table td:not(:first-child) {
        display: none !important;
    }

    #stagnant-inventory-section .toolbar-card {
        padding: 1rem !important;
        border-radius: 14px !important;
    }

    /* Product Card Modal (Movements Ledger) Mobile Cards View */
    #product-card-modal .modern-table {
        display: block !important;
        width: 100% !important;
        background: transparent !important;
        border: none !important;
    }

    #product-card-modal .modern-table thead {
        display: none !important;
    }

    #product-card-modal .modern-table tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }

    #product-card-modal .modern-table tbody tr {
        display: block !important;
        background: #ffffff !important;
        border: 1.5px solid #e2e8f0 !important;
        border-radius: 12px !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02) !important;
        padding: 0.65rem 0.85rem !important;
        margin-bottom: 0 !important;
        text-align: right !important;
    }

    #product-card-modal .modern-table tbody tr.row-tint-inbound {
        border-right: 4px solid #10b981 !important;
    }

    #product-card-modal .modern-table tbody tr.row-tint-outbound {
        border-right: 4px solid #f97316 !important;
    }

    #product-card-modal .modern-table tbody tr.row-tint-transfer {
        border-right: 4px solid #6366f1 !important;
    }

    #product-card-modal .modern-table td::before {
        display: none !important;
        content: none !important;
    }

    #product-card-modal .modern-table td {
        padding: 0 !important;
        border: none !important;
        text-align: right !important;
        background: transparent !important;
        display: block !important;
    }

    #product-card-modal .modern-table td:not(:first-child) {
        display: none !important;
    }

    /* Vouchers Section Mobile Card View */
    #vouchers-section .table-container {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        overflow: visible !important;
        padding: 0 !important;
        margin-top: 0.5rem !important;
    }

    #vouchers-section .modern-table {
        display: block !important;
        width: 100% !important;
        background: transparent !important;
        border: none !important;
    }

    #vouchers-section .modern-table thead {
        display: none !important;
    }

    #vouchers-section .modern-table tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }

    #vouchers-section .modern-table tbody tr {
        display: block !important;
        background: transparent !important;
        border: none !important;
        border-radius: 12px !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin-bottom: 0.5rem !important;
        cursor: pointer !important;
        transition: transform 0.2s ease !important;
        position: relative !important;
        text-align: right !important;
    }

    #vouchers-section .modern-table tbody tr:hover,
    #vouchers-section .modern-table tbody tr:active {
        transform: translateY(-2px) !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    #vouchers-section .modern-table td::before {
        display: none !important;
        content: none !important;
    }

    #vouchers-section .modern-table td {
        padding: 0 !important;
        border: none !important;
        text-align: right !important;
        background: transparent !important;
        display: block !important;
    }

    #vouchers-section .modern-table td:not(:first-child) {
        display: none !important;
    }

    #vouchers-section .toolbar-card {
        padding: 1rem !important;
        border-radius: 14px !important;
    }

    /* Voucher Register/Edit Modal Mobile Optimization */
    #voucher-modal .modal-dialog,
    #edit-voucher-modal .modal-dialog {
        max-width: 96% !important;
        width: 96% !important;
        margin: 0.5rem auto !important;
    }

    #voucher-modal .modal-content,
    #edit-voucher-modal .modal-content {
        min-height: auto !important;
        max-height: 94vh !important;
        border-radius: 16px !important;
        overflow: hidden !important;
    }

    #voucher-modal .modal-header,
    #edit-voucher-modal .modal-header {
        padding: 0.85rem 1rem !important;
    }

    #voucher-modal .modal-header h3,
    #edit-voucher-modal .modal-header h3 {
        font-size: 1.05rem !important;
    }

    #voucher-modal .modal-body,
    #edit-voucher-modal .modal-body {
        padding: 0.75rem !important;
        max-height: calc(88vh - 130px) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    #voucher-modal .modal-body > div,
    #edit-voucher-modal .modal-body > div {
        padding: 0.75rem !important;
        border-radius: 10px !important;
        margin-bottom: 0.75rem !important;
    }

    #voucher-modal .table-responsive,
    #voucher-modal .table-wrapper {
        overflow: visible !important;
        width: 100% !important;
    }

    /* Voucher Register Multi-Items Form on Mobile (Cards Layout) */
    #voucher-modal table.table {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        border: none !important;
        background: transparent !important;
    }

    #voucher-modal table.table thead {
        display: none !important;
    }

    #voucher-modal table.table tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
        width: 100% !important;
    }

    #voucher-modal table.table tbody tr {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
        background: #ffffff !important;
        border: 1.5px solid #cbd5e1 !important;
        border-radius: 12px !important;
        padding: 0.75rem !important;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04) !important;
        position: relative !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    #voucher-modal table.table tbody td {
        display: block !important;
        padding: 0 !important;
        border: none !important;
        width: 100% !important;
        text-align: right !important;
        background: transparent !important;
    }

    #voucher-modal table.table tbody td.desktop-only {
        display: none !important;
    }

    #voucher-modal .mobile-item-header {
        display: flex !important;
    }

    #voucher-modal .mobile-item-label {
        display: block !important;
    }

    #voucher-modal .modal-footer,
    #edit-voucher-modal .modal-footer {
        padding: 0.75rem 1rem !important;
        flex-direction: column-reverse !important;
        gap: 0.5rem !important;
    }

    #voucher-modal .modal-footer button,
    #edit-voucher-modal .modal-footer button {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Voucher View Modal Mobile Optimization */
    #voucher-view-modal .modal-dialog {
        max-width: 96% !important;
        margin: 0.5rem auto !important;
        width: 96% !important;
    }

    #voucher-view-modal .modal-header {
        padding: 0.85rem 1rem !important;
    }

    #voucher-view-modal .modal-body {
        padding: 0.65rem !important;
        max-height: 80vh !important;
    }

    #printable-voucher-card {
        padding: 0.75rem !important;
        border-radius: 12px !important;
    }

    #printable-voucher-card > div:first-child {
        flex-direction: column !important;
        gap: 0.6rem !important;
        text-align: center !important;
        align-items: center !important;
    }

    #printable-voucher-card > div:first-child > div:last-child {
        text-align: center !important;
    }

    #printable-voucher-card > div:nth-child(2) {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.45rem !important;
        padding: 0.65rem !important;
        font-size: 0.82rem !important;
    }

    /* Voucher View Items Table on Mobile (Cards Layout) */
    #printable-voucher-card table {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        border: none !important;
        background: transparent !important;
    }

    #printable-voucher-card table thead {
        display: none !important;
    }

    #printable-voucher-card table tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }

    #printable-voucher-card table tbody tr {
        display: block !important;
        width: 100% !important;
        border: none !important;
        padding: 0 !important;
        background: transparent !important;
    }

    #printable-voucher-card table tbody td {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
    }

    #printable-voucher-card table tbody td.desktop-only {
        display: none !important;
    }

    #printable-voucher-card table tfoot {
        display: block !important;
        width: 100% !important;
        margin-top: 0.5rem !important;
    }

    #printable-voucher-card table tfoot tr {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.35rem !important;
        width: 100% !important;
        background: #f0f9ff !important;
        border: 1.5px solid #bae6fd !important;
        border-radius: 10px !important;
        padding: 0.75rem !important;
    }

    #printable-voucher-card table tfoot td {
        display: block !important;
        width: 100% !important;
        border: none !important;
        padding: 0 !important;
        background: transparent !important;
        text-align: center !important;
        font-size: 0.95rem !important;
        color: #0284c7 !important;
    }

    #printable-voucher-card > div:last-child {
        gap: 0.4rem !important;
        margin-top: 1rem !important;
        padding-top: 0.65rem !important;
    }

    #printable-voucher-card > div:last-child > div > div:first-child {
        font-size: 0.76rem !important;
        margin-bottom: 1.25rem !important;
    }

    #voucher-view-modal .modal-footer {
        padding: 0.75rem !important;
        flex-direction: row !important;
        gap: 0.6rem !important;
        justify-content: space-between !important;
    }

    #voucher-view-modal .modal-footer button {
        flex: 1 !important;
        justify-content: center !important;
    }
}

/* Custom Autocomplete Suggestions Dropdown for Product Name Modal */
.custom-product-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.15), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
    max-height: 220px;
    overflow-y: auto;
    z-index: 1060;
    padding: 0.35rem 0;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
}

.custom-product-suggestions::-webkit-scrollbar {
    width: 6px;
}

.custom-product-suggestions::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 8px;
}

.custom-product-suggestions::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 8px;
}

.custom-product-suggestions .suggestion-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    transition: all 0.15s ease;
    border-bottom: 1px solid #f1f5f9;
}

.custom-product-suggestions .suggestion-item:last-child {
    border-bottom: none;
}

.custom-product-suggestions .suggestion-item:hover,
.custom-product-suggestions .suggestion-item.selected {
    background: #e0f2fe;
    color: #0369a1;
    padding-right: 1.25rem;
}

.custom-product-suggestions .suggestion-item .sug-icon {
    color: #0284c7;
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

.custom-product-suggestions .suggestion-item .sug-badge {
    font-size: 0.75rem;
    background: #f1f5f9;
    color: #64748b;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-weight: 600;
}

@media (max-width: 768px) {
    .inventory-filters-row {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
    }
    .vouchers-filters-row {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
    }
}

.badge-inbound {
    background: #ecfdf5 !important;
    color: #059669 !important;
    border: 1px solid #a7f3d0 !important;
    padding: 0.2rem 0.45rem !important;
    border-radius: 6px !important;
    font-weight: 800 !important;
    font-size: 0.76rem !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.2rem !important;
    white-space: nowrap !important;
}

.badge-outbound {
    background: #fff7ed !important;
    color: #ea580c !important;
    border: 1px solid #fed7aa !important;
    padding: 0.2rem 0.45rem !important;
    border-radius: 6px !important;
    font-weight: 800 !important;
    font-size: 0.76rem !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.2rem !important;
    white-space: nowrap !important;
}

.badge-transfer {
    background: #eef2ff !important;
    color: #4f46e5 !important;
    border: 1px solid #c7d2fe !important;
    padding: 0.2rem 0.45rem !important;
    border-radius: 6px !important;
    font-weight: 800 !important;
    font-size: 0.76rem !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.2rem !important;
    white-space: nowrap !important;
}

/* Row Background Tints by Movement Type (Soft Pastel) */
/* Row Background & Right Accent Strip by Movement Type (Executive Design) */
.row-tint-inbound {
    background-color: #ffffff !important;
    border-bottom: 1px solid #f1f5f9 !important;
    transition: background-color 0.15s ease;
}
.row-tint-inbound td:first-child {
    border-right: 4.5px solid #10b981 !important;
}
.row-tint-inbound:hover {
    background-color: #f0fdf4 !important;
}

.row-tint-outbound {
    background-color: #ffffff !important;
    border-bottom: 1px solid #f1f5f9 !important;
    transition: background-color 0.15s ease;
}
.row-tint-outbound td:first-child {
    border-right: 4.5px solid #f97316 !important;
}
.row-tint-outbound:hover {
    background-color: #fff7ed !important;
}

.row-tint-transfer {
    background-color: #ffffff !important;
    border-bottom: 1px solid #f1f5f9 !important;
    transition: background-color 0.15s ease;
}
.row-tint-transfer td:first-child {
    border-right: 4.5px solid #8b5cf6 !important;
}
.row-tint-transfer:hover {
    background-color: #faf5ff !important;
}

/* Vouchers Table Fixed Proportional Layout */
#vouchers-section .table-container {
    overflow-x: hidden !important;
    width: 100% !important;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

#vouchers-section table.modern-table {
    table-layout: fixed !important;
    width: 100% !important;
    margin: 0 !important;
    border-collapse: collapse !important;
    font-family: 'Cairo', system-ui, -apple-system, sans-serif !important;
    -webkit-font-smoothing: antialiased !important;
    text-rendering: optimizeLegibility !important;
}

#vouchers-section table.modern-table thead tr {
    background: #1e293b !important;
    color: #ffffff !important;
}

#vouchers-section table.modern-table thead th {
    padding: 0.65rem 0.25rem !important;
    font-size: 0.82rem !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    border: none !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
}

#vouchers-section table.modern-table tbody tr {
    transition: background 0.12s ease !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

#vouchers-section table.modern-table tbody tr:hover {
    background: #f8fafc !important;
}

#vouchers-section table.modern-table tbody td {
    padding: 0.45rem 0.25rem !important;
    font-size: 0.83rem !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    border-bottom: 1px solid #f1f5f9 !important;
    box-sizing: border-box !important;
}

#vouchers-section table.modern-table tbody td.voucher-actions-cell {
    overflow: visible !important;
    text-align: center !important;
    padding: 0.35rem 0.2rem !important;
    white-space: nowrap !important;
}

.voucher-actions-wrapper {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    max-width: 100% !important;
}

.voucher-action-btn {
    width: 25px !important;
    height: 25px !important;
    min-width: 25px !important;
    max-width: 25px !important;
    padding: 0 !important;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 5px !important;
    font-size: 0.72rem !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    transition: transform 0.1s ease !important;
}
.voucher-action-btn:hover {
    transform: scale(1.1) !important;
}

#voucher-modal .modal-dialog {
    max-width: 1050px !important;
    width: 96% !important;
    margin: 1.5rem auto !important;
}

#voucher-modal .modal-content {
    min-height: 82vh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: visible !important;
}

#voucher-modal .modal-body {
    flex: 1 !important;
    max-height: calc(88vh - 140px) !important;
    overflow-y: auto !important;
    overflow-x: visible !important;
    padding-bottom: 5rem !important;
}

#voucher-modal .table-responsive,
#voucher-modal .table-wrapper {
    overflow: visible !important;
}

#voucher-modal table.table {
    overflow: visible !important;
}

#voucher-modal table.table tbody,
#voucher-modal table.table tbody tr,
#voucher-modal table.table tbody td {
    overflow: visible !important;
}

#voucher-modal .custom-product-suggestions {
    position: absolute !important;
    top: calc(100% + 4px) !important;
    right: 0 !important;
    left: 0 !important;
    z-index: 999999 !important;
    max-height: 280px !important;
    min-width: 320px !important;
    overflow-y: auto !important;
    background: #ffffff !important;
    border: 2px solid #0284c7 !important;
    border-radius: 10px !important;
    box-shadow: 0 20px 35px rgba(0, 0, 0, 0.25) !important;
}

#voucher-modal .custom-product-suggestions .suggestion-item:hover {
    background: #f0f9ff !important;
}

@media print {
    body * {
        visibility: hidden !important;
    }
    #printable-voucher-card,
    #printable-voucher-card * {
        visibility: visible !important;
    }
    #printable-voucher-card {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        border: none !important;
        box-shadow: none !important;
        padding: 20px !important;
        margin: 0 !important;
    }
    .modal {
        position: static !important;
        display: block !important;
        background: transparent !important;
    }
    .modal-dialog, .modal-content, .modal-body {
        position: static !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    .modal-header, .modal-footer {
        display: none !important;
    }
}

/* ==========================================
   Custom Arabic Datepicker Styles (Ported from aboughaly_hr_admin)
   ========================================== */
.custom-datepicker-container {
    position: relative;
    width: 100%;
}

.custom-datepicker-calendar {
    position: absolute;
    right: 0;
    left: auto;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    z-index: 9999999 !important;
    padding: 1rem;
    width: 320px;
    font-family: inherit;
    direction: rtl;
    user-select: none;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.2s ease forwards;
}

.custom-datepicker-calendar.datepicker-open-upwards {
    bottom: calc(100% + 5px);
    top: auto;
    box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.15), 0 -8px 10px -6px rgba(0, 0, 0, 0.1);
}

.custom-datepicker-calendar.datepicker-open-downwards {
    top: calc(100% + 5px);
    bottom: auto;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

@media (max-width: 480px) {
    .custom-datepicker-calendar {
        position: fixed !important;
        width: auto !important;
        max-width: calc(100vw - 20px);
        min-width: 280px;
        padding: 0.75rem;
        border-radius: 10px;
        z-index: 9999999 !important;
    }

    .custom-datepicker-calendar .datepicker-header {
        gap: 0.25rem;
        margin-bottom: 0.5rem;
    }

    .custom-datepicker-calendar .datepicker-header button {
        width: 28px;
        height: 28px;
    }

    .custom-datepicker-calendar .datepicker-selectors select {
        font-size: 0.8rem;
        padding: 0.2rem 0.3rem;
    }

    .custom-datepicker-calendar .datepicker-weekdays {
        font-size: 0.75rem;
        margin-bottom: 0.35rem;
    }

    .custom-datepicker-calendar .datepicker-day {
        font-size: 0.8rem;
    }

    .custom-datepicker-calendar.datepicker-open-upwards {
        bottom: auto;
    }

    .custom-datepicker-calendar.datepicker-open-downwards {
        top: auto;
    }
}

.custom-datepicker-calendar.hidden {
    display: none !important;
}

.datepicker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
}

.datepicker-header button {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.datepicker-header button:hover {
    background: #e2e8f0;
    color: var(--primary, #123458);
}

.datepicker-selectors {
    display: flex;
    gap: 0.25rem;
    flex: 1;
    justify-content: center;
}

.datepicker-selectors select {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    background: #fff;
    cursor: pointer;
    color: #334155;
    outline: none;
    text-align: center;
}

.datepicker-selectors select:focus {
    border-color: var(--primary, #123458);
}

.datepicker-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--primary, #123458);
    margin-bottom: 0.5rem;
}

.datepicker-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.datepicker-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    color: #334155;
    transition: all 0.2s ease;
}

.datepicker-day:hover:not(.empty) {
    background: #f1f5f9;
    color: var(--primary, #123458);
}

.datepicker-day.selected {
    background: var(--primary, #123458) !important;
    color: #ffffff !important;
}

.datepicker-day.today {
    border: 1.5px solid var(--accent, #f59e0b);
    color: var(--accent, #f59e0b);
    font-weight: 800;
}

.datepicker-day.other-month {
    color: #94a3b8;
    font-weight: 400;
}

.datepicker-day.empty {
    cursor: default;
    background: transparent;
}

.datepicker-weekdays div.friday,
.datepicker-day.friday {
    color: #dc2626 !important;
}

.datepicker-day.friday.selected {
    color: #ffffff !important;
}