/*
   =================================================
   Aboughaly Plastic Industries - Premium UI
   =================================================
*/

/* --- Variables --- */
:root {
    --primary: #008c44;
    /* Modern Green */
    --primary-light: #00a350;
    --primary-dark: #007038;
    --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: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --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);
}

/* --- 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 (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.5rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    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-sm {
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    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: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.form-control {
    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);
}

.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: 16px !important;
        /* منع zoom في iOS */
        padding: 0.9rem 1rem;
        min-height: 48px;
        /* ارتفاع مناسب للمس */
        -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;
        padding-left: 2.5rem;
    }

    /* تحسين عرض حقل المهنة مع الزر في الموبايل */
    #emp-profession,
    #contractor-job,
    #emp-department {
        min-width: 0 !important;
        flex: 1 !important;
        width: auto !important;
        font-size: 16px !important;
        padding: 0.9rem 2.5rem 0.9rem 1rem !important;
        min-height: 48px !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: calc(100% - 56px) !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;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.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);
}

.custom-checkbox:hover input~.checkmark {
    background-color: #e2e8f0;
}

.custom-checkbox input:checked~.checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.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: 0.75rem 1rem;
    font-size: 0.95rem;
    background: #f8fafc;
    border: 1px solid var(--border-focus);
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-dark);
    min-height: 45px;
}

.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: 250px;
    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: 0.5rem 2rem 2rem 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: #d1fae5;
    color: #065f46;
}

.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;
}

.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);
}

.nav-cards-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
    /* تقليل الفجوة لتناسب العرض الأصغر */
    margin-top: 2rem;
    max-width: 1000px;
    /* تقييد العرض الكلي ليناسب شاشات 1080 بكسل بشكل أفضل */
    margin-left: auto;
    margin-right: auto;
}

.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: 2px solid var(--border);
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
    user-select: none;
}

.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);
}

.nav-card:hover .card-icon {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    transform: scale(1.15) rotate(5deg);
}

/* Custom red color for users card */
#nav-users .card-icon {
    color: #dc2626 !important;
}

#nav-users:hover .card-icon {
    background: linear-gradient(135deg, #dc2626, #ef4444) !important;
    color: white !important;
}

#nav-users:hover .card-content h3 {
    color: #dc2626 !important;
}

.card-icon {
    width: 55px;
    /* تصغير حجم الحاوية ليناسب عرض 1080 بكسل */
    height: 55px;
    border-radius: 14px;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    /* تصغير حجم الأيقونة */
    margin-bottom: 0.5rem;
}

/* --- 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;
    /* Hide scrollbar */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

@media (max-width: 767px) {
    .table-tabs-container {
        display: none !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: #fff;
    color: var(--primary);
    border-color: var(--border);
    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: #f8fafc;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.detail-group-mobile h4 {
    margin-bottom: 0.75rem;
    color: var(--primary);
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 0.4rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-row-mobile {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.95rem;
}

.detail-row-mobile:last-child {
    border-bottom: none;
}

.detail-row-mobile span {
    color: var(--text-muted);
}

@media (min-width: 768px) {
    .details-grid-mobile {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .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;
}

/* --- Internal Sections Tools --- */
.toolbar-card {
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    margin-bottom: 1.25rem;
    min-height: auto !important;
    /* إزالة أي حد أدنى للارتفاع */
    height: auto !important;
    /* ضمان الارتفاع التلقائي */
}

/* تقليل المسافة بين البطاقات المتتالية */
.toolbar-card+.toolbar-card,
.toolbar-card+.alert,
.toolbar-card+.summary-card,
.toolbar-card+.record-status-legend {
    margin-top: -0.5rem;
}

.search-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    max-width: 100%;
    flex-wrap: nowrap;
}

.search-wrapper input {
    flex: 1;
    min-width: 250px;
    padding: 0.75rem 1rem;
    background: #f1f5f9;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.search-wrapper input:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* --- 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);
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    text-align: center;
    font-size: 0.8rem;
}

.modern-table thead {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    position: sticky;
    top: 0;
    z-index: 10;
    display: table-header-group;
}

.modern-table tbody {
    background: white;
    display: table-row-group;
}

.modern-table tbody tr {
    display: table-row;
    transition: none;
    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 th {
    background: transparent;
    color: white;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.8rem 0.5rem;
    border-left: 1px solid rgba(255, 255, 255, 0.4);
    /* خطوط فاصلة أغمق للرؤوس */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    display: table-cell;
    vertical-align: middle;
    text-align: center;
}

.modern-table th:first-child {
    border-left: none;
}

.modern-table th:last-child {
    text-align: center;
}

.modern-table td {
    padding: 0.7rem 0.5rem;
    border-bottom: 1px solid #cbd5e1;
    /* خطوط فاصلة أغمق للجدول */
    border-left: 1px solid #cbd5e1;
    /* خطوط فاصلة أغمق للجدول */
    color: var(--text-dark);
    font-weight: 600;
    vertical-align: middle;
    display: table-cell;
    text-align: center;
}

.modern-table td:first-child {
    border-left: none;
    font-weight: 800;
    color: var(--primary);
    font-size: 0.9rem;
    /* تصغير خط أول عمود */
}

.modern-table tbody tr::before {
    display: none;
}

.modern-table tbody tr:hover {
    background: inherit !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.5rem;
    justify-content: center;
}

/* --- 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 !important; /* عمود واحد فقط على جميع الشاشات */
    gap: 1.25rem;
}

/* إلغاء تأثير form-col-2 - كل الحقول بنفس العرض */
.form-col-2 {
    grid-column: span 1 !important;
}

.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) {
    .nav-cards-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* تم إلغاء التخطيط بعمودين - كل حقل في صف منفصل */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .form-col-2 {
        grid-column: span 1;
    }
}

/* 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: 12px !important;
    padding: 0.75rem 1.25rem !important;
    /* حشو موحد لجميع الأزرار */
    font-weight: 700 !important;
    font-size: 0.9rem !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: 44px !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-professions-btn,
    #manage-departments-btn,
    #manage-areas-btn,
    #manage-contractor-professions-btn,
    #manage-warehouse-categories-btn {
        width: auto !important;
        flex: initial !important;
        min-width: initial !important;
        border-radius: 12px !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 {
        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.6rem 0.3rem !important;
        white-space: nowrap !important;
        border-radius: 12px !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;
    }

    #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: 100%;
    }

    .nav-card {
        padding: 1.5rem 1rem;
        aspect-ratio: 1;
    }

    .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,
    #salaries-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,
    #salaries-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),
    #salaries-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;
    }

    /* 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);
    }

    /* 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;
    }

    /* 2. Body Details - Simple row below name header */
    #employees-section .modern-table td:nth-child(2),
    #salaries-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;
    }

    #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),
    #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 !important;
        padding: 0 !important;
        max-width: 100%;
        width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        transform: translateY(100%);
        transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        max-height: 92vh;
        background: #ffffff !important;
        box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.15);
        /* Reduced blur for performance */
        will-change: transform;
        /* Hardware acceleration */
        z-index: 2000;
        border: none;
    }

    .modal {
        padding: 0 !important;
    }

    .modal.show .modal-dialog.bottom-sheet {
        transform: translateY(0);
    }

    .details-body {
        padding: 1.25rem;
        flex: 1;
        overflow-y: auto;
    }

    .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 {
        background: linear-gradient(135deg, #059669, #10b981);
    }

    #users-section .modern-table tbody tr:hover::before {
        background: #10b981;
    }

    #users-section .modern-table td:first-child {
        color: #059669;
    }

    /* Employees Table Styling */
    #employees-section .modern-table thead {
        background: linear-gradient(135deg, var(--primary), var(--primary-light));
    }
}

/* Mobile Users Table Specific Styling */
@media (max-width: 767px) {

    /* Users table mobile cards */
    #users-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;
    }

    #users-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;
    }

    /* بطاقات المستخدمين المعطلين في الموبايل - فقط الجزء الأخضر يتحول لأحمر */
    #users-section .modern-table tbody tr.user-inactive:hover {
        border-color: #94a3b8;
    }

    #users-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;
    }

    #users-section .modern-table tbody tr.user-inactive td:nth-child(1)::before {
        color: #dc2626 !important;
    }

    /* Users table: Username code styling */
    #users-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;
    }

    #users-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;
    }

    /* Users table: Employee name with more padding */
    #users-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;
    }

    #users-section .modern-table td:nth-child(2)::before {
        display: none;
    }

    /* Users table: Role badge positioned next to username */
    #users-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;
    }

    #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 */
    #users-section .modern-table td:nth-child(4) {
        display: flex;
        padding: 0.5rem 1.25rem;
        border-bottom: none;
    }

    /* Users table: Actions (The key fix) */
    #users-section .modern-table td:nth-child(5) {
        display: flex;
        justify-content: center;
        padding: 1rem 1.25rem;
        background: #f8fafc;
        gap: 1.5rem;
    }

    #users-section .modern-table td:nth-child(5)::before {
        display: none;
    }

    /* 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 {
            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;
    }
}

/* 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: linear-gradient(135deg, #005a2e 0%, #008c44 100%);
    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 {
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #374151;
    text-decoration: none;
    transition: background 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: right;
    font-size: 0.95rem;
}

.dropdown-item:hover {
    background-color: #f3f4f6;
}

.dropdown-item:active {
    background-color: #e5e7eb;
}

.dropdown-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}


/* 
=================================================
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
   ================================================= */
.audit-filters-grid {
    display: grid;
    gap: 1rem;
    align-items: flex-end;
}

.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 {
        grid-template-columns: 1fr 1fr;
    }

    /* 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 label {
        font-size: 0.75rem;
        margin-bottom: 0.25rem;
    }

    .audit-filters-grid .form-control {
        height: 42px;
        font-size: 0.85rem;
        padding: 0.5rem;
    }
}

/* Desktop Layout: 3 items per row */
@media (min-width: 768px) {
    .audit-filters-grid {
        grid-template-columns: repeat(3, 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: #fff;
    color: var(--primary);
    border-color: var(--border);
    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;
}

.modal-tab {
    flex: 1;
    padding: 1rem;
    font-weight: 700;
    font-size: 0.95rem;
    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: #fff;
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.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);
}
