:root {
    /* هوية بصرية مشتقة من شعار الشركة: كحلي (AFCI/النص العربي) + أزرق زاهي (الشريط السفلي)
       + ذهبي (البرج) + فضي (المبنى الخلفي — يطابق اسم "الفضية") */
    --brand-navy: #000890;
    --brand-blue: #0080f8;
    --brand-gold: #d9a100;
    --gold-gradient: linear-gradient(135deg, #d9a100 0%, #f5c842 100%);

    --primary-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --accent-glow: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-blue) 100%);
    --silver-gloss: linear-gradient(135deg, #e2e8f0 0%, #94a3b8 100%);

    --bg-main: #020617;
    --sidebar-bg: rgba(15, 23, 42, 0.8);
    --card-bg: rgba(30, 41, 59, 0.5);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-soft: rgba(255, 255, 255, 0.08);
    --accent-main: var(--brand-blue);
    --success-main: #10b981;
    --danger-main: #ef4444;

    --sidebar-width: 280px;
    --radius-lg: 1.25rem;
    --radius-md: 0.75rem;
    --transition-smooth: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] {
    --bg-main: #f8fafc;
    --sidebar-bg: rgba(255, 255, 255, 0.9);
    --card-bg: rgba(255, 255, 255, 0.8);
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-soft: rgba(0, 0, 0, 0.06);
}

body {
    font-family: 'Outfit', 'Tajawal', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    margin: 0;
    overflow-x: hidden;
    line-height: 1.6;
    transition: var(--transition-smooth);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 128, 248, 0.2);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 128, 248, 0.4);
}

/* Glassmorphism Background Decoration */
body::before {
    content: '';
    position: fixed;
    top: -10%;
    left: -10%;
    width: 50%;
    height: 50%;
    background: radial-gradient(circle, rgba(0, 128, 248, 0.08) 0%, transparent 70%);
    z-index: -1;
    animation: pulseGradient 15s infinite alternate;
}

body::after {
    content: '';
    position: fixed;
    bottom: -10%;
    right: -10%;
    width: 40%;
    height: 40%;
    background: radial-gradient(circle, rgba(45, 212, 191, 0.05) 0%, transparent 70%);
    z-index: -1;
    animation: pulseGradient 20s infinite alternate-reverse;
}

@keyframes pulseGradient {
    0% { transform: scale(1) translate(0, 0); opacity: 0.5; }
    100% { transform: scale(1.2) translate(5%, 5%); opacity: 0.8; }
}

/* Layout Hierarchy */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* Premium Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    backdrop-filter: blur(12px);
    border-right: 1px solid var(--border-soft);
    border-left: none;
    position: fixed;
    left: 0;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition-smooth);
}

.sidebar.active {
    transform: translateX(0) !important;
}

.sidebar-brand {
    padding: 2.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-logo {
    width: 42px;
    height: 42px;
    /* رقعة بيضاء خفيفة حتى تظهر ألوان الشعار الأصلية (كحلي/ذهبي/فضي) بوضوح فوق الخلفية الداكنة */
    background: #f8fafc;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(0, 128, 248, 0.35);
    padding: 5px;
    flex-shrink: 0;
}

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

.brand-name {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: var(--silver-gloss);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-group {
    padding: 1rem;
    flex-grow: 1;
}

.nav-link {
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none !important;
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    transition: var(--transition-smooth);
    font-weight: 500;
}

.nav-link i {
    width: 24px;
    font-size: 1.25rem;
    margin-left: 1rem;
}

.nav-link:hover, .nav-link.active {
    background: rgba(0, 128, 248, 0.1);
    color: var(--accent-main);
    transform: translateX(5px);
}

/* Main Content Area */
.content-wrapper {
    margin-left: var(--sidebar-width);
    margin-right: 0;
    flex-grow: 1;
    padding: 2rem 3rem;
}

/* Modern Card System */
.card-glass {
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
}

.card-glass:hover {
    border-color: rgba(0, 128, 248, 0.3);
    transform: translateY(-4px);
}

/* Typography & Headers */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.page-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0;
}

/* Premium Tables */
.table-modern {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.75rem;
}

.table-modern th {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    padding: 1rem 1.5rem;
}

.table-modern td {
    background: var(--card-bg);
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
}

.table-modern tr td:first-child {
    border-right: 1px solid var(--border-soft);
    border-top-right-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}

.table-modern tr td:last-child {
    border-left: 1px solid var(--border-soft);
    border-top-left-radius: var(--radius-md);
    border-bottom-left-radius: var(--radius-md);
}

/* Custom Buttons */
.btn-glass {
    background: var(--accent-glow);
    border: none;
    color: white;
    padding: 0.75rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: var(--transition-smooth);
    box-shadow: 0 10px 15px -3px rgba(0, 128, 248, 0.3);
}

.btn-glass:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0, 128, 248, 0.4);
    color: white;
}

/* Floating Notification Count */
.notif-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-main);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 20px;
    border: 2px solid var(--bg-main);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.notif-item {
    transition: var(--transition-smooth);
    border-radius: 10px;
    margin: 4px 8px;
    background: rgba(255, 255, 255, 0.03);
}

.notif-item:hover {
    background: rgba(0, 128, 248, 0.1) !important;
    transform: scale(1.02);
}

.notif-item.unread {
    background: rgba(0, 128, 248, 0.15);
    border-right: 3px solid var(--accent-main) !important;
}

/* RTL Specifics */
[dir="rtl"] .sidebar { right: 0; left: auto; border-left: 1px solid var(--border-soft); border-right: none; }
[dir="rtl"] .content-wrapper { margin-right: var(--sidebar-width); margin-left: 0; }
[dir="rtl"] .nav-link:hover, [dir="rtl"] .nav-link.active { transform: translateX(-5px); }

/* Responsive Media Queries */
@media (max-width: 991.98px) {
    :root {
        --sidebar-width: 0px;
    }
    
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        left: 0;
        right: auto;
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }
    
    [dir="rtl"] .sidebar {
        transform: translateX(100%);
        right: 0;
        left: auto;
        box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    }
    
    .content-wrapper {
        margin-right: 0 !important;
        margin-left: 0 !important;
        padding: 1.5rem;
    }
    
    .page-header {
        flex-direction: column-reverse;
        align-items: flex-start;
        gap: 1.5rem;
        margin-bottom: 2rem;
    }
    
    .page-header > div:last-child {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 767.98px) {
    .page-title {
        font-size: 1.6rem;
    }
    
    .card-glass {
        padding: 1.5rem;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .h3 {
        font-size: 1.5rem;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .table-modern thead {
        display: none;
    }
    
    .table-modern tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--border-soft);
        border-radius: var(--radius-md);
        padding: 1rem;
        background: var(--card-bg);
    }
    
    .table-modern td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border: none !important;
        background: transparent !important;
    }
    
    .table-modern td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-secondary);
        font-size: 0.75rem;
    }
}

/* Animation Utils */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade {
    animation: fadeIn 0.6s ease-out forwards;
}

/* =========================================
   FORM CONTROLS — Dark / Light Theme Aware
   ========================================= */

/* --- Dark Mode (Default) --- */
.form-control,
.form-select {
    background-color: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #f1f5f9 !important;
    border-radius: 0.6rem !important;
    padding: 0.6rem 0.9rem !important;
    transition: border-color 0.25s, box-shadow 0.25s, background-color 0.3s !important;
    backdrop-filter: blur(4px);
}

.form-control::placeholder,
.form-select::placeholder {
    color: rgba(148, 163, 184, 0.55) !important;
}

.form-control:focus,
.form-select:focus {
    background-color: rgba(15, 23, 42, 0.8) !important;
    border-color: rgba(0, 128, 248, 0.55) !important;
    box-shadow: 0 0 0 3px rgba(0, 128, 248, 0.15) !important;
    color: #f8fafc !important;
    outline: none !important;
}

/* Select arrows in dark mode */
.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E") !important;
}

/* Input groups */
.input-group .form-control {
    border-radius: 0.6rem 0 0 0.6rem !important;
}
.input-group .btn {
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    background-color: rgba(30, 41, 59, 0.7) !important;
    color: #94a3b8 !important;
}
.input-group .btn:hover {
    background-color: rgba(0, 128, 248, 0.15) !important;
    color: #3fa8ff !important;
}

/* textarea */
textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* Labels */
.form-label {
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}

/* Form feedback */
.invalid-feedback { font-size: 0.78rem; }
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: rgba(239, 68, 68, 0.5) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

/* --- Light Mode --- */
[data-theme="light"] .form-control,
[data-theme="light"] .form-select {
    background-color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    color: #0f172a !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] .form-control::placeholder,
[data-theme="light"] .form-select::placeholder {
    color: rgba(100, 116, 139, 0.6) !important;
}

[data-theme="light"] .form-control:focus,
[data-theme="light"] .form-select:focus {
    background-color: #ffffff !important;
    border-color: rgba(0, 128, 248, 0.5) !important;
    box-shadow: 0 0 0 3px rgba(0, 128, 248, 0.12) !important;
    color: #0f172a !important;
}

[data-theme="light"] .form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E") !important;
}

[data-theme="light"] .input-group .btn {
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    background-color: #f8fafc !important;
    color: #64748b !important;
}

[data-theme="light"] .form-label {
    color: #475569;
}

/* Theme toggle button */
.theme-toggle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--border-soft);
    background: var(--card-bg);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.theme-toggle:hover {
    border-color: var(--accent-main);
    color: var(--accent-main);
    background: rgba(0, 128, 248, 0.1);
}

/* Stat Cards */
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

/* Smaller utility */
.smaller { font-size: 0.75rem; }

/* Border-soft utility */
.border-soft { border-color: var(--border-soft) !important; }

/* =========================================
   BUTTONS — Dark / Light Theme Aware
   ========================================= */

/* Reset Bootstrap defaults */
.btn {
    border-radius: 0.6rem !important;
    font-weight: 600 !important;
    font-size: 0.875rem !important;
    padding: 0.55rem 1.25rem !important;
    transition: all 0.25s cubic-bezier(0.23, 1, 0.32, 1) !important;
    border: none !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:active { transform: scale(0.97) !important; }

/* ── Primary ── */
.btn-primary {
    background: linear-gradient(135deg, #0080f8 0%, #000890 100%) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(0, 128, 248, 0.35) !important;
}
.btn-primary:hover {
    background: linear-gradient(135deg, #3fa8ff 0%, #0080f8 100%) !important;
    box-shadow: 0 6px 20px rgba(0, 128, 248, 0.45) !important;
    transform: translateY(-2px) !important;
    color: #fff !important;
}

/* ── Success ── */
.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3) !important;
}
.btn-success:hover {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%) !important;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4) !important;
    transform: translateY(-2px) !important;
    color: #fff !important;
}

/* ── Danger ── */
.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3) !important;
}
.btn-danger:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%) !important;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4) !important;
    transform: translateY(-2px) !important;
    color: #fff !important;
}

/* ── Warning ── */
.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: #111 !important;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3) !important;
}
.btn-warning:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%) !important;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4) !important;
    transform: translateY(-2px) !important;
    color: #111 !important;
}

/* ── Secondary (Dark Mode) ── */
.btn-secondary {
    background: rgba(100, 116, 139, 0.2) !important;
    border: 1px solid rgba(100, 116, 139, 0.3) !important;
    color: #94a3b8 !important;
}
.btn-secondary:hover {
    background: rgba(100, 116, 139, 0.3) !important;
    color: #f1f5f9 !important;
    transform: translateY(-1px) !important;
}

/* ── Outline Variants (Dark Mode) ── */
.btn-outline-primary {
    background: transparent !important;
    border: 1px solid rgba(0, 128, 248, 0.5) !important;
    color: #3fa8ff !important;
}
.btn-outline-primary:hover {
    background: rgba(0, 128, 248, 0.12) !important;
    border-color: #0080f8 !important;
    color: #93c5fd !important;
    transform: translateY(-1px) !important;
}

.btn-outline-success {
    background: transparent !important;
    border: 1px solid rgba(16, 185, 129, 0.45) !important;
    color: #34d399 !important;
}
.btn-outline-success:hover {
    background: rgba(16, 185, 129, 0.1) !important;
    color: #6ee7b7 !important;
    transform: translateY(-1px) !important;
}

.btn-outline-danger {
    background: transparent !important;
    border: 1px solid rgba(239, 68, 68, 0.45) !important;
    color: #f87171 !important;
}
.btn-outline-danger:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #fca5a5 !important;
    transform: translateY(-1px) !important;
}

.btn-outline-warning {
    background: transparent !important;
    border: 1px solid rgba(245, 158, 11, 0.45) !important;
    color: #fbbf24 !important;
}
.btn-outline-warning:hover {
    background: rgba(245, 158, 11, 0.1) !important;
    color: #fde68a !important;
    transform: translateY(-1px) !important;
}

.btn-outline-secondary {
    background: transparent !important;
    border: 1px solid rgba(148, 163, 184, 0.3) !important;
    color: #94a3b8 !important;
}
.btn-outline-secondary:hover {
    background: rgba(148, 163, 184, 0.08) !important;
    color: #cbd5e1 !important;
    transform: translateY(-1px) !important;
}

.btn-outline-light {
    background: transparent !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #e2e8f0 !important;
}
.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.07) !important;
    color: #f8fafc !important;
    transform: translateY(-1px) !important;
}

/* ── Small / Large ── */
.btn-sm {
    padding: 0.35rem 0.85rem !important;
    font-size: 0.78rem !important;
    border-radius: 0.5rem !important;
}
.btn-lg {
    padding: 0.75rem 2rem !important;
    font-size: 1rem !important;
    border-radius: 0.75rem !important;
}

/* ── Light Mode Overrides ── */
[data-theme="light"] .btn-secondary {
    background: rgba(100, 116, 139, 0.1) !important;
    border: 1px solid rgba(100, 116, 139, 0.25) !important;
    color: #475569 !important;
}
[data-theme="light"] .btn-secondary:hover {
    background: rgba(100, 116, 139, 0.18) !important;
    color: #1e293b !important;
}

[data-theme="light"] .btn-outline-secondary {
    border: 1px solid rgba(71, 85, 105, 0.3) !important;
    color: #475569 !important;
}
[data-theme="light"] .btn-outline-secondary:hover {
    background: rgba(71, 85, 105, 0.07) !important;
    color: #1e293b !important;
}

[data-theme="light"] .btn-outline-light {
    border: 1px solid rgba(15, 23, 42, 0.15) !important;
    color: #334155 !important;
}
[data-theme="light"] .btn-outline-light:hover {
    background: rgba(15, 23, 42, 0.05) !important;
    color: #0f172a !important;
}

/* =========================================
   MOBILE BOTTOM NAVIGATION BAR
   ========================================= */

/* Extra padding on mobile so content isn't hidden behind nav */
@media (max-width: 991.98px) {
    .pb-mobile-nav {
        padding-bottom: 80px !important;
    }
}

/* The bar itself */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1050;
    height: 64px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 0.5rem;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .mobile-bottom-nav {
    background: rgba(255, 255, 255, 0.92);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

/* Each nav item */
.mob-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 0.4rem 0.75rem;
    border-radius: 14px;
    color: var(--text-secondary);
    text-decoration: none !important;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    min-width: 52px;
    transition: all 0.25s cubic-bezier(0.23, 1, 0.32, 1);
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
}

.mob-nav-item i {
    font-size: 1.25rem;
    transition: all 0.25s cubic-bezier(0.23, 1, 0.32, 1);
    line-height: 1;
}

.mob-nav-item span {
    line-height: 1;
}

.mob-nav-item:hover {
    color: var(--accent-main);
    background: rgba(0, 128, 248, 0.08);
}

.mob-nav-item.active {
    color: var(--accent-main);
}

.mob-nav-item.active i {
    transform: translateY(-2px);
    filter: drop-shadow(0 4px 8px rgba(0, 128, 248, 0.5));
}

/* Active pill indicator */
.mob-nav-item.active::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    background: var(--accent-main);
    border-radius: 0 0 4px 4px;
}

/* =========================================
   MORE MENU BOTTOM SHEET
   ========================================= */

/* Dark overlay */
.mob-more-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1060;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.mob-more-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* The sheet */
.mob-more-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1070;
    background: var(--sidebar-bg, rgba(15, 23, 42, 0.97));
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px 24px 0 0;
    padding: 1rem 1.25rem 2rem;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
    max-height: 80vh;
    overflow-y: auto;
}

[data-theme="light"] .mob-more-sheet {
    background: rgba(248, 250, 252, 0.97);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.12);
}

.mob-more-sheet.open {
    transform: translateY(0);
}

/* Handle bar */
.mob-more-handle {
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    margin: 0 auto 1.25rem;
}

[data-theme="light"] .mob-more-handle {
    background: rgba(0, 0, 0, 0.15);
}

/* Grid of items */
.mob-more-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem 0.75rem;
}

/* Each item in the grid */
.mob-more-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none !important;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center;
    padding: 0.5rem;
    border-radius: 16px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.mob-more-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    transform: scale(1.04);
}

[data-theme="light"] .mob-more-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* Colorful icon boxes */
.mob-more-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.25s ease;
}

.mob-more-item:hover .mob-more-icon {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}
/* =========================================================================
   تحسينات المرحلة 5: إتاحة الوصول + تجربة الجداول + الطباعة (إضافية فقط)
   ========================================================================= */

/* 1) وضوح تركيز لوحة المفاتيح لكل العناصر التفاعلية (مستخدمو الكيبورد/قارئات الشاشة) */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
[role="button"]:focus-visible,
.nav-link:focus-visible,
.dropdown-item:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--accent-main);
    outline-offset: 2px;
    border-radius: var(--radius-md);
}

/* لا نُظهر الحلقة عند النقر بالفأرة فقط (الحفاظ على المظهر) */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
.btn:focus:not(:focus-visible) {
    outline: none;
}

/* 2) رؤوس جداول ثابتة عند التمرير داخل حاوية قابلة للتمرير */
.table-responsive {
    max-height: 70vh;
    overflow-y: auto;
}

.table-responsive .table-modern th,
.table-responsive .table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-main);
}

/* 3) احترام تفضيل تقليل الحركة (النظام مليء بالانتقالات والحركات) */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* 4) أنماط الطباعة: إخفاء الهيكل وإظهار المحتوى بأحبار موفّرة (للتقارير والشهادات) */
@media print {
    .sidebar,
    .mobile-bottom-nav,
    #sidebarToggle,
    .no-print,
    .btn,
    form .btn,
    .dropdown-menu {
        display: none !important;
    }

    .content-wrapper {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    body,
    .content-wrapper {
        background: #fff !important;
        color: #000 !important;
    }

    .table-modern th,
    .table thead th {
        color: #000 !important;
        position: static !important;
    }

    .table-modern td {
        background: #fff !important;
        color: #000 !important;
        border-color: #ccc !important;
    }

    a[href]::after {
        content: "";
    }
}

/* =========================================================================
   حزمة UX الاحترافية (المرحلة 5ب): نماذج، تحقق، حالات فارغة، شريط تقدم
   ========================================================================= */

/* --- نجمة الحقول الإلزامية --- */
.req-star {
    color: var(--danger-main);
    font-weight: 700;
    user-select: none;
}

/* --- تنسيق أخطاء التحقق (jquery-validation-unobtrusive) --- */
.input-validation-error,
.form-control.input-validation-error,
.form-select.input-validation-error {
    border-color: var(--danger-main) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.field-validation-error {
    display: block;
    color: var(--danger-main);
    font-size: 0.8rem;
    margin-top: 0.3rem;
    font-weight: 600;
}

.validation-summary-errors {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    color: var(--danger-main);
}

.validation-summary-errors ul {
    margin: 0;
    padding-inline-start: 1.2rem;
}

/* --- زر بحالة تحميل (بعد إرسال النموذج) --- */
.btn-loading {
    pointer-events: none;
    opacity: 0.75;
    position: relative;
}

.btn-loading::after {
    content: "";
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-inline-start: 0.5em;
    vertical-align: -0.15em;
    border: 2px solid currentColor;
    border-inline-end-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.7s linear infinite;
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

/* --- الحالة الفارغة الموحّدة للجداول --- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 2.5rem;
    opacity: 0.35;
    display: block;
    margin-bottom: 0.75rem;
}

.empty-state-text {
    font-size: 0.95rem;
}

.empty-state-row td {
    background: transparent !important;
    border: none !important;
}

/* --- شريط تقدم رفيع أعلى الصفحة عند التنقل --- */
#topProgressBar {
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    width: 0;
    height: 3px;
    background: var(--accent-glow);
    z-index: 99999;
    opacity: 0;
    transition: none;
}

body.page-leaving #topProgressBar {
    opacity: 1;
    animation: top-progress 6s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
}

@keyframes top-progress {
    0%   { width: 0; }
    30%  { width: 55%; }
    100% { width: 92%; }
}

/* --- شريط تمرير مخصص يطابق الثيم --- */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-soft) transparent;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(148, 163, 184, 0.6);
}

/* --- لون التحديد --- */
::selection {
    background: rgba(0, 128, 248, 0.35);
    color: inherit;
}

/* --- تحسين تباعد صفوف الجداول عند التحويم --- */
.table-modern tbody tr {
    transition: transform 0.15s ease;
}

.table-modern tbody tr:hover td {
    background: rgba(0, 128, 248, 0.07);
}

/* =========================================================================
   تناسق الألوان بين الوضعين (Theme contrast fixes)
   النظام مبني بالوضع الداكن أساساً ويستخدم text-light لنص المحتوى في كل مكان،
   فيختفي في الوضع النهاري. هذه القواعد تجعل أصناف الألوان الثابتة متكيّفة مع الثيم
   دون كسر الأزرار الملوّنة أو النوافذ الداكنة (modals).
   ========================================================================= */

/* أصناف الألوان المتكيّفة (كانت مستخدمة في القوالب لكن غير معرّفة) */
.text-theme-primary { color: var(--text-primary); }
.text-theme-secondary { color: var(--text-secondary); }

/* النص الثانوي: لون بوتستراب الافتراضي شبه أسود يختفي في الوضع الليلي.
   نربطه بلون الثيم الثانوي في الوضعين (النوافذ الداكنة لها قاعدة أخصّ أدناه) */
.text-muted,
.breadcrumb-item + .breadcrumb-item::before,
.breadcrumb-item.active {
    color: var(--text-secondary) !important;
}

/* جداول Bootstrap العادية (بدون .table-modern) تستخدم لوناً افتراضياً شبه أسود
   يختفي على خلفية النظام الداكنة. نربط متغيّراتها بألوان الثيم في الوضعين. */
.table {
    --bs-table-color: var(--text-primary);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--border-soft);
    --bs-table-striped-color: var(--text-primary);
    --bs-table-striped-bg: rgba(128, 128, 128, 0.05);
    --bs-table-hover-color: var(--text-primary);
    --bs-table-hover-bg: rgba(0, 128, 248, 0.06);
    color: var(--text-primary);
}
.table > :not(caption) > * > * {
    color: var(--text-primary);
    border-bottom-color: var(--border-soft);
}
.table > thead th,
.table > thead td,
.table-dark-soft > thead th {
    color: var(--text-secondary);
}
/* .table-dark-soft صنف مخصّص غير معرّف — خلفية خفيفة متكيّفة */
.table-dark-soft > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(128, 128, 128, 0.04);
}

/* ---------- الوضع النهاري: نص المحتوى الأبيض يصبح داكناً ---------- */
[data-theme="light"] .text-light:not(.btn):not(.badge),
[data-theme="light"] .text-white:not(.btn):not(.badge) {
    color: var(--text-primary) !important;
}

/* استثناءات: يجب أن يبقى النص أبيض على سطح داكن فعلي (أزرار ملوّنة، شارات،
   الشريط الجانبي، ونوافذ منبثقة معرّفة يدوياً بخلفية داكنة عبر style مضمّن) */
[data-theme="light"] .btn .text-light,
[data-theme="light"] .btn .text-white,
[data-theme="light"] .badge .text-light,
[data-theme="light"] .badge .text-white,
[data-theme="light"] .badge.text-light,
[data-theme="light"] .badge.text-white,
[data-theme="light"] .sidebar .text-light,
[data-theme="light"] .modal-content[style*="15, 23, 42"] .text-light,
[data-theme="light"] .modal-content[style*="15,23,42"] .text-light,
[data-theme="light"] .modal-content[style*="15, 23, 42"] .text-white,
[data-theme="light"] .modal-content[style*="15,23,42"] .text-white,
[data-theme="light"] .modal-content[style*="15, 23, 42"] .form-label,
[data-theme="light"] .modal-content[style*="15,23,42"] .form-label,
[data-theme="light"] .modal-content[style*="15, 23, 42"] .modal-title,
[data-theme="light"] .modal-content[style*="15,23,42"] .modal-title,
[data-theme="light"] [style*="15, 23, 42"] .text-light,
[data-theme="light"] [style*="15,23,42"] .text-light,
[data-theme="light"] [style*="15, 23, 42"] .text-muted,
[data-theme="light"] [style*="15,23,42"] .text-muted {
    color: #f1f5f9 !important;
}
[data-theme="light"] .modal-content[style*="15, 23, 42"] .text-muted,
[data-theme="light"] .modal-content[style*="15,23,42"] .text-muted,
[data-theme="light"] .modal-content[style*="15, 23, 42"] .form-text,
[data-theme="light"] .modal-content[style*="15,23,42"] .form-text {
    color: #94a3b8 !important;
}
/* حقول الإدخال داخل النوافذ الداكنة تبقى داكنة الخلفية */
[data-theme="light"] .modal-content[style*="15, 23, 42"] .form-control,
[data-theme="light"] .modal-content[style*="15,23,42"] .form-control,
[data-theme="light"] .modal-content[style*="15, 23, 42"] .form-select,
[data-theme="light"] .modal-content[style*="15,23,42"] .form-select {
    background-color: rgba(255, 255, 255, 0.06) !important;
    color: #f1f5f9 !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}

/* لوحات/بطاقات بخلفية bg-dark زخرفية في الوضع النهاري */
[data-theme="light"] .bg-dark:not(.modal-content):not(.btn):not(.dropdown-menu),
[data-theme="light"] .bg-dark-soft:not(.form-control) {
    background-color: rgba(15, 23, 42, 0.04) !important;
}

/* جداول الوضع النهاري: صفوف بخلفية داكنة */
[data-theme="light"] .table-dark {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    color: var(--text-primary);
}
[data-theme="light"] .table-dark > :not(caption) > * > * {
    background-color: transparent !important;
    color: var(--text-primary) !important;
    border-color: var(--border-soft) !important;
}
[data-theme="light"] .table-dark thead th {
    color: var(--text-secondary) !important;
}

/* ---------- الوضع الليلي: نص text-dark الثابت يصبح فاتحاً ---------- */
[data-theme="dark"] .text-dark:not(.btn):not(.badge),
:root:not([data-theme="light"]) .text-dark:not(.btn):not(.badge) {
    color: var(--text-primary) !important;
}
[data-theme="dark"] .bg-light:not(.btn):not(.badge),
:root:not([data-theme="light"]) .bg-light:not(.btn):not(.badge) {
    background-color: var(--card-bg) !important;
    color: var(--text-primary) !important;
}

/* ---------- إصلاح: ألوان bg-teal/bg-indigo/bg-rose/bg-emerald و text-* المقابلة ---------- */
/* هذه الفئات غير موجودة إطلاقاً لا في Bootstrap ولا في هذا الملف سابقاً، فكانت شارات
   نوع الحساب في شجرة الحسابات (أصول/خصوم/مصروفات/إيرادات) وشارات سندات القبض/الصرف
   ومؤشرات تجاوز الميزانية في التحليلات المالية تُطبع بلا أي لون إطلاقاً (خلفية شفافة).
   القيم مأخوذة من لوحة ألوان Bootstrap نفسها حيث توجد (teal/indigo) حتى تبقى متسقة،
   ومُعرَّفة بنفس أسلوب Bootstrap (متغير --bs-bg-opacity) ليعمل معها إصلاح bg-opacity-20 أعلاه تلقائياً. */
:root {
    --brand-teal-rgb: 32, 201, 151;
    --brand-indigo-rgb: 102, 16, 242;
    --brand-rose-rgb: 244, 63, 94;
    --brand-emerald-rgb: 16, 185, 129;
}
.bg-teal {
    --bs-bg-opacity: 1;
    background-color: rgba(var(--brand-teal-rgb), var(--bs-bg-opacity)) !important;
}
.bg-indigo {
    --bs-bg-opacity: 1;
    background-color: rgba(var(--brand-indigo-rgb), var(--bs-bg-opacity)) !important;
}
.bg-rose {
    --bs-bg-opacity: 1;
    background-color: rgba(var(--brand-rose-rgb), var(--bs-bg-opacity)) !important;
}
.bg-emerald {
    --bs-bg-opacity: 1;
    background-color: rgba(var(--brand-emerald-rgb), var(--bs-bg-opacity)) !important;
}
/* ---------- إصلاح: أزرار btn-soft-* غير معرّفة إطلاقاً (لا Bootstrap ولا هذا الملف سابقاً) ---------- */
/* مستخدمة في 17 صفحة على الأقل (شمل ذلك أزرار "تعديل"/"تفاصيل" الجديدة في كروت
   الموظفين) لكنها بلا أي تعريف، فتُطبع بلون Bootstrap الافتراضي شبه الأسود على خلفية
   شفافة تماماً - غير مرئية عملياً في الوضع الليلي، وهذا بالضبط ما أبلغ عنه المستخدم. */
.btn-soft-primary, .btn-soft-secondary, .btn-soft-success,
.btn-soft-danger, .btn-soft-warning, .btn-soft-info, .btn-soft-light {
    border: 1px solid transparent;
}
.btn-soft-primary {
    background-color: rgba(var(--bs-primary-rgb), .15);
    color: rgb(var(--bs-primary-rgb));
    border-color: rgba(var(--bs-primary-rgb), .3);
}
.btn-soft-primary:hover {
    background-color: rgba(var(--bs-primary-rgb), .3);
    color: rgb(var(--bs-primary-rgb));
}
.btn-soft-secondary {
    background-color: rgba(var(--bs-secondary-rgb), .15);
    color: var(--text-primary);
    border-color: rgba(var(--bs-secondary-rgb), .3);
}
.btn-soft-secondary:hover {
    background-color: rgba(var(--bs-secondary-rgb), .3);
    color: var(--text-primary);
}
.btn-soft-success {
    background-color: rgba(var(--bs-success-rgb), .15);
    color: rgb(var(--bs-success-rgb));
    border-color: rgba(var(--bs-success-rgb), .3);
}
.btn-soft-success:hover {
    background-color: rgba(var(--bs-success-rgb), .3);
    color: rgb(var(--bs-success-rgb));
}
.btn-soft-danger {
    background-color: rgba(var(--bs-danger-rgb), .15);
    color: rgb(var(--bs-danger-rgb));
    border-color: rgba(var(--bs-danger-rgb), .3);
}
.btn-soft-danger:hover {
    background-color: rgba(var(--bs-danger-rgb), .3);
    color: rgb(var(--bs-danger-rgb));
}
.btn-soft-warning {
    background-color: rgba(var(--bs-warning-rgb), .15);
    color: rgb(var(--bs-warning-rgb));
    border-color: rgba(var(--bs-warning-rgb), .3);
}
.btn-soft-warning:hover {
    background-color: rgba(var(--bs-warning-rgb), .3);
    color: rgb(var(--bs-warning-rgb));
}
.btn-soft-info {
    background-color: rgba(var(--bs-info-rgb), .15);
    color: rgb(var(--bs-info-rgb));
    border-color: rgba(var(--bs-info-rgb), .3);
}
.btn-soft-info:hover {
    background-color: rgba(var(--bs-info-rgb), .3);
    color: rgb(var(--bs-info-rgb));
}
.btn-soft-light {
    background-color: rgba(var(--bs-light-rgb), .15);
    color: var(--text-primary);
    border-color: rgba(var(--bs-light-rgb), .3);
}
.btn-soft-light:hover {
    background-color: rgba(var(--bs-light-rgb), .3);
    color: var(--text-primary);
}

.text-teal { color: rgb(var(--brand-teal-rgb)) !important; }
.text-indigo { color: rgb(var(--brand-indigo-rgb)) !important; }
.text-rose { color: rgb(var(--brand-rose-rgb)) !important; }
.text-emerald { color: rgb(var(--brand-emerald-rgb)) !important; }

/* ---------- إصلاح: خطوات bg-opacity/border-opacity غير الصحيحة (Bootstrap يدعم فقط 10/25/50/75/100) ---------- */
/* بدون هذه التعريفات يبقى --bs-bg-opacity على قيمته الافتراضية 1، فتصبح خلفية badge
   بنفس لون النص تماماً (مثال: bg-warning + text-warning = نص أصفر على خلفية صفراء ثابتة)
   مما يجعل النص غير مرئي تماماً - وهذا بالضبط ما أبلغ عنه المستخدم في عمود "النوع"
   بصفحة تقارير المخازن (Stores/Reports) وفي صفحات أخرى تستخدم نفس النمط.
   ملاحظة ترتيب مهمة: يجب أن تأتي هذه القواعد بعد تعريفات bg-teal/indigo/rose/emerald
   أعلاه، لأن كلتيهما تضبطان نفس متغير --bs-bg-opacity على نفس العنصر أحياناً
   (مثال: badge bg-teal bg-opacity-20) والقاعدة الأحدث في الترتيب هي التي تفوز. */
.bg-opacity-5 { --bs-bg-opacity: .05; }
.bg-opacity-15 { --bs-bg-opacity: .15; }
.bg-opacity-20 { --bs-bg-opacity: .2; }
.bg-opacity-30 { --bs-bg-opacity: .3; }
.border-opacity-5 { --bs-border-opacity: .05; }
.border-opacity-20 { --bs-border-opacity: .2; }
.border-opacity-30 { --bs-border-opacity: .3; }
