/* ===== الخطوط العربية ===== */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');

/* ===== المتغيرات الأساسية ===== */
:root {
    /* الألوان الرئيسية */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);

    /* ألوان الحالة */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --danger: #f43f5e;
    --danger-bg: rgba(244, 63, 94, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --info: #3b82f6;

    /* ألوان الهوية الملكية للهيدر والفوتر */
    --royal-blue: #1e40af;
    --royal-blue-hover: #2563eb;
    --royal-blue-active: #3b82f6;
    --royal-blue-light: #60a5fa;
    --royal-footer: #172554;

    /* الخلفيات والنصوص */
    --bg-main: #f1f5f9;
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --surface: #ffffff;
    --text-main: #0f172a;
    --text-secondary: #475569;
    --text-light: #94a3b8;

    /* Shadows & Border */
    --border: #e2e8f0;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-md: 12px;
    --radius-lg: 16px;

    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== إعدادات عامة ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    direction: rtl;
    padding-bottom: 40px;
}

/* تعيين الخط الافتراضي لجميع عناصر الإدخال والأزرار لضمان التناسق */
input, select, textarea, button, option, table, th, td,
.modal, .modal-content, .modern-header, .modern-footer, .print-content {
    font-family: 'Tajawal', sans-serif !important;
}

.container {
    max-width: 98%;
    /* Full width as requested */
    margin: 0 auto;
    padding: 0 20px;
}

.page-content {
    max-width: 95%;
    margin: 30px auto;
    padding: 0 20px;
}

/* ===== الهيدر الاحترافي (Modern Header) ===== */
.modern-header {
    background: var(--royal-blue);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 4px 16px rgba(30, 64, 175, 0.18);
    position: sticky;
    top: 0;
    z-index: 1000;
    margin-bottom: 30px;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 32px;
    max-width: 1600px;
    margin: 0 auto;
    transition: padding 0.3s ease;
}

/* الشعار والاسم */
.header-brand {
    display: flex;
    align-items: center;
    gap: 18px;
}

.brand-logo {
    width: 65px;
    height: 65px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.08);
    padding: 6px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-brand:hover .brand-logo {
    transform: none;
    border-color: rgba(255, 255, 255, 0.28);
}

.brand-title {
    font-size: 22px;
    font-weight: 800;
    color: #ffffff;
    margin: 0;
    letter-spacing: 0.5px;
    text-shadow: none;
}

.brand-subtitle {
    font-size: 13px;
    color: #bfdbfe;
    margin: 0;
    font-weight: 500;
    opacity: 0.85;
}

/* شريط التنقل */
.header-nav {
    display: flex;
    align-items: center;
}

.nav-list {
    list-style: none;
    display: flex;
    gap: 8px;
    padding: 0;
    margin: 0;
}

.nav-link {
    color: #dbeafe;
    text-decoration: none;
    font-weight: 600;
    font-size: 14.5px;
    padding: 10px 20px;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid transparent;
}

.nav-link i {
    font-size: 15px;
    color: #bfdbfe;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.16);
}

.nav-link:hover i {
    color: #ffffff;
    transform: none;
}

.nav-link.active {
    background: var(--royal-blue-hover);
    color: #ffffff;
    border-color: var(--royal-blue-light);
    box-shadow: none;
}

.nav-link.active i {
    color: #ffffff;
}

/* زر إضافي مميز في الهيدر */
.btn-add-nav {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white !important;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
    font-family: inherit;
}

.btn-add-nav i {
    color: white !important;
}

.btn-add-nav:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.3);
}

/* زر البحث في السجلات - سماوي (بحث أداة مساعدة، مش إجراء تحذيري) */
.btn-search-nav {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white !important;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
    font-family: inherit;
    margin-right: 8px;
}

.btn-search-nav i {
    color: white !important;
}

.btn-search-nav:hover {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(14, 165, 233, 0.3);
}

.btn-back-home {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: white !important;
    padding: 10px 20px;
    border-radius: 12px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    border: none;
}

.btn-back-home:hover {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    transform: translateX(-5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* قسم المستخدم وتسجيل الخروج */
.header-user {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 16px 6px 6px;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
}

.user-badge:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.2);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--royal-blue-active);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    box-shadow: none;
}

.user-name {
    color: #ffffff;
    font-size: 14.5px;
    font-weight: 600;
}

.btn-logout-modern {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: rgba(244, 63, 94, 0.08);
    color: #fda4af;
    text-decoration: none;
    font-weight: 700;
    font-size: 13.5px;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.btn-logout-modern:hover {
    background: #e11d48;
    color: white;
    box-shadow: 0 4px 15px rgba(225, 29, 72, 0.4);
    border-color: #e11d48;
    transform: translateY(-1px);
}

/* القائمة للهواتف (Mobile Menu) */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.58);
    z-index: 2000;
    display: flex;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-nav-content {
    background: var(--royal-blue);
    width: 280px;
    height: 100%;
    box-shadow: -5px 0 25px rgba(30, 64, 175, 0.24);
    padding: 24px;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.mobile-nav-overlay.active .mobile-nav-content {
    transform: translateX(0);
}

.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.mb-badge {
    background: transparent;
    border: none;
    padding: 0;
}

.mobile-menu-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #cbd5e1;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.mobile-menu-close:hover {
    background: rgba(225, 29, 72, 0.2);
    color: #f43f5e;
}

.mobile-nav-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mobile-nav-list .nav-item {
    width: 100%;
}

.mobile-nav-list .nav-link {
    width: 100%;
    justify-content: flex-start;
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
}

.mobile-nav-list .nav-link.active {
    background: var(--royal-blue-hover);
    border-color: var(--royal-blue-light);
}

.mobile-nav-list .btn-add-nav {
    margin-top: 10px;
    justify-content: flex-start;
}

.mobile-nav-list .btn-search-nav {
    justify-content: flex-start;
}


/* ===== Dashboard Bento Grid Layout ===== */
.dashboard-bento-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-bottom: 40px;
}

@media (min-width: 1200px) {
    .dashboard-bento-grid {
        display: block;
    }
}

/* Base Glass Card */
.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* ===== Bento Stats Cards ===== */
.bento-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.stat-card {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    overflow: hidden;
}

/* Subtle gradient accent lines */
.stat-card::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    opacity: 0.8;
}

.stat-card:nth-child(1)::before {
    background: linear-gradient(90deg, transparent, #8b5cf6);
}

.stat-card:nth-child(2)::before {
    background: linear-gradient(90deg, transparent, #10b981);
}

.stat-card:nth-child(3)::before {
    background: linear-gradient(90deg, transparent, #ef4444);
}

.stat-card.stat-closing::before {
    background: linear-gradient(90deg, transparent, #4f46e5);
    height: 6px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.purple-glow {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

.green-glow {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.red-glow {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

.indigo-glow {
    background: rgba(79, 70, 229, 0.1);
    color: #4f46e5;
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.2);
}

.blue-glow {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

.orange-glow {
    background: rgba(249, 115, 22, 0.1);
    color: #f97316;
    box-shadow: 0 0 20px rgba(249, 115, 22, 0.2);
}

.stat-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-details h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
}

.stat-details p {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.5px;
}

.text-green {
    color: #059669 !important;
}

.text-red {
    color: #dc2626 !important;
}

/* Closing stat emphasis */
.stat-closing {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.05) 0%, rgba(255, 255, 255, 0.8) 100%);
    border-color: rgba(79, 70, 229, 0.2);
}

/* ===== Bento Search ===== */
.bento-search {
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px dashed rgba(148, 163, 184, 0.4);
}

.search-header h3 {
    margin: 0;
    font-size: 18px;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-header h3 i {
    color: #4f46e5;
}

.btn-clear-modern {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-clear-modern:hover {
    background: #ef4444;
    color: white;
    transform: rotate(180deg);
}

.modern-search-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex-grow: 1;
}

.search-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-group i {
    position: absolute;
    right: 14px;
    color: #94a3b8;
    pointer-events: none;
}

.search-input-group input,
.search-input-group select {
    width: 100%;
    padding: 12px 14px 12px 40px;
    /* Padding left 40px for RTL? No, padding right for RTL. In RTL we want padding-right: 40px, padding-left: 14px */
}

/* Adjusting padding for RTL explicitly */
[dir="rtl"] .search-input-group input,
[dir="rtl"] .search-input-group select {
    padding: 12px 14px 12px 40px;
    /* actually we need padding-right 40px to leave space for icon on the right */
    padding-right: 40px;
    padding-left: 14px;
}

.search-input-group input,
.search-input-group select,
.date-input input {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 12px;
    font-size: 14px;
    color: #334155;
    outline: none;
    transition: all 0.3s ease;
}

.search-input-group input:focus,
.search-input-group select:focus,
.date-input input:focus {
    background: white;
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

.search-date-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.date-input {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.date-input label {
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
    padding-right: 4px;
}

.date-input input {
    padding: 10px;
}

.btn-search-modern {
    margin-top: auto;
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
    transition: all 0.3s ease;
}

.btn-search-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
}

/* ===== نموذج الإضافة السريع العصري (Quick Add Modern) ===== */
.quick-add-modern {
    padding: 24px;
    margin-bottom: 25px;
    background: linear-gradient(to right, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.98));
}

.search-horizontal-modern {
    border-right: 4px solid #4f46e5;
}


.quick-add-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.quick-add-header h3 {
    margin: 0;
    font-size: 22px;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 12px;
}

.quick-add-header h3 i {
    color: #10b981;
    font-size: 1.2em;
}

.date-badge {
    background: #f1f5f9;
    color: #475569;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    border: 1px solid #e2e8f0;
}

.modern-entry-form .entry-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
}

.entry-field {
    flex: 1;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.entry-field.note-field {
    flex: 2;
    min-width: 250px;
}

.entry-field.action-field {
    flex: 0 0 auto;
}

.entry-field label {
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    padding-right: 4px;
}

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

.input-wrapper i {
    position: absolute;
    right: 16px;
    font-size: 16px;
    pointer-events: none;
    z-index: 10;
}

.text-gray {
    color: #94a3b8;
}

.input-green i {
    color: #10b981;
}

.input-red i {
    color: #ef4444;
}

.input-wrapper input,
.input-wrapper select {
    width: 100%;
    padding: 14px 16px 14px 16px;
    padding-right: 45px;
    /* RTL spacing for icon */
    background: rgba(248, 250, 252, 0.6);
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.input-wrapper input::placeholder {
    color: #cbd5e1;
    font-weight: 500;
}

.input-wrapper input:focus,
.input-wrapper select:focus {
    background: #ffffff;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.input-green input:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.input-red input:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.btn-submit-modern {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 52px;
    /* Match input height */
}

.btn-submit-modern:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.btn-submit-modern i {
    font-size: 18px;
}


/* Obsolete styles removed */


/* ===== الجدول المطور (Premium Table Redesign) ===== */
#report-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 10px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

#report-table thead th {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #f8fafc;
    font-weight: 700;
    padding: 18px 15px;
    text-align: right;
    font-size: 0.95rem;
    border-bottom: none;
    text-transform: none;
    letter-spacing: 0;
}

#report-table thead th:first-child {
    border-top-right-radius: 12px;
}

#report-table thead th:last-child {
    border-top-left-radius: 12px;
}

#report-table tbody tr {
    transition: all 0.25s ease;
}

#report-table tbody td {
    padding: 12px 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    color: #334155;
    background: rgba(255, 255, 255, 0.45);
    font-weight: 600;
    font-size: 0.85rem; /* تصغير الخط قليلاً لاستيعاب البيانات */
    vertical-align: middle;
    transition: background-color 0.25s ease;
}

/* استثناء عمود الملاحظات ليسمح بالتفاف النص إذا كان طويلاً جداً */
#report-table td.col-notes {
    white-space: normal;
    min-width: 200px;
}

#report-table tbody tr:last-child td:first-child {
    border-bottom-right-radius: 12px;
}

#report-table tbody tr:last-child td:last-child {
    border-bottom-left-radius: 12px;
}

#report-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.82) !important;
}

/* Cell Overrides for coloring */
.cell-income {
    background-color: rgba(16, 185, 129, 0.04) !important;
    color: #059669 !important;
}

.cell-expense {
    background-color: rgba(244, 63, 94, 0.04) !important;
    color: #e11d48 !important;
}

.cell-opening {
    color: #4f46e5 !important;
}

#report-table tbody tr.row-highlight-opening td {
    background: rgba(99, 102, 241, 0.06) !important; /* Indigo tint */
}

#report-table tbody tr.row-highlight-opening td:first-child {
    box-shadow: inset -5px 0 0 #6366f1; /* Solid Indigo-500 border */
}

#report-table tbody tr.row-highlight-opening:hover td {
    background: rgba(99, 102, 241, 0.12) !important;
}

.col-serial {
    color: #94a3b8 !important;
    text-align: center !important;
    font-weight: 800;
}

.highlight-amount {
    background-color: #fef08a !important;
    color: #854d0e !important;
}

/* ضبط عمود الإجراءات */
#report-table td.actions, 
#report-table th.actions {
    text-align: center;
    white-space: nowrap;
    width: 150px; /* عرض ثابت للأزرار لضمان عدم التداخل */
}

.actions .btn-edit,
.actions .btn-delete {
    margin: 2px;
}

/* منع التفاف الأعمدة الحساسة فقط */
.col-timestamp, .record-id-cell, .cell-income, .cell-expense, .cell-opening {
    white-space: nowrap;
}

.btn-edit,
.btn-delete {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 50px;
    /* Full pill shape */
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-edit {
    background: #f1f5f9;
    color: #6366f1;
    border: 1px solid #e2e8f0;
}

.btn-edit:hover {
    background: #6366f1;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-delete {
    background: #fff1f2;
    color: #e11d48;
    border: 1px solid #fee2e2;
}

.btn-delete:hover {
    background: #e11d48;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.3);
}

.btn-edit {
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
}

.btn-edit:hover {
    background: #f59e0b;
    color: white;
}

.btn-delete {
    background: rgba(244, 63, 94, 0.1);
    color: #be123c;
}

.btn-delete:hover {
    background: #f43f5e;
    color: white;
}

/* ===== الإضافة السريعة ===== */
.quick-add-container {
    background: white;
    padding: 25px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 30px;
    border-right: 4px solid var(--success);
}

.quick-add-title {
    margin-top: 0;
    font-size: 18px;
    color: var(--text-main);
}

.form-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-field {
    flex: 1;
    min-width: 150px;
}

.btn-add-new {
    background: var(--success);
    color: white;
    height: 42px;
    width: 100%;
}

.btn-add-new:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

/* ===== نافذة الاعدادات ===== */
.modal,
/* ===== نافذة الاعدادات العصرية (Print Modal Redesign) ===== */
.print-settings-modal {
    display: none;
    position: fixed;
    z-index: 5000; /* Increased z-index */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7); /* Darker backdrop for better contrast */
    backdrop-filter: blur(12px);
    overflow-y: auto;
    padding: 20px;
    animation: modalFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-content {
    background: #ffffff;
    margin: 5% auto;
    padding: 0;
    width: 90%;
    max-width: 800px;
    border-radius: 24px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    animation: modalSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
}

.close-button, .close-search, .print-close {
    color: rgba(255, 255, 255, 0.6);
    font-size: 32px;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.close-button:hover, .close-search:hover, .print-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f43f5e;
}

/* ===== تخصيص نافذة البحث وتجميلها (Search Modal Styling) ===== */
/* ===== تخصيص نافذة البحث والإضافة وتجميلهما (Search & Add Modal Styling) ===== */
#searchModal .modal-content,
#addModal .modal-content {
    border-radius: 32px !important; /* حواف دائرية واضحة واحترافية */
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 30px 60px -15px rgba(15, 23, 42, 0.3) !important;
}

#searchModal .modal-header,
#addModal .modal-header {
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%) !important; /* تدرج لوني احترافي باللون الأزرق النيلي */
    padding: 22px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#searchModal .modal-header h2,
#addModal .modal-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
}

#searchModal .close-search,
#addModal .close-button {
    background: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
    border-radius: 14px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.25s ease;
}

#searchModal .close-search:hover,
#addModal .close-button:hover {
    background: #f43f5e !important;
    color: white !important;
    transform: rotate(90deg);
}

#searchModal .modal-body,
#addModal .modal-body {
    padding: 35px 30px;
    background: #f8fafc; /* خلفية ناعمة ونظيفة داخل النافذة */
}

#searchModal .form-group label,
#addModal .form-group label {
    font-size: 13.5px;
    font-weight: 800;
    color: #475569;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#searchModal .form-group input,
#searchModal .form-group select,
#addModal .form-group input,
#addModal .form-group select {
    border-radius: 16px !important; /* حواف دائرية للمدخلات */
    border: 2px solid #e2e8f0 !important;
    padding: 14px 18px !important;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    background: #ffffff !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#searchModal .form-group input:focus,
#searchModal .form-group select:focus,
#addModal .form-group input:focus,
#addModal .form-group select:focus {
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12) !important;
}

/* أزرار البحث والتصفية الاحترافية */
.search-modal-actions {
    display: flex;
    gap: 16px;
    margin-top: 35px;
}

.btn-search-apply {
    flex: 2;
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%) !important;
    color: white !important;
    border: none !important;
    padding: 15px 30px !important;
    border-radius: 18px !important; /* أزرار دائرية الحواف */
    font-size: 15.5px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.btn-search-apply:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(79, 70, 229, 0.35);
    background: linear-gradient(135deg, #4338ca 0%, #2563eb 100%) !important;
}

.btn-search-apply:active {
    transform: translateY(1px);
}

/* زر الحفظ الأخضر الاحترافي للنافذة المنبثقة للإضافة */
.btn-add-apply {
    width: 100%;
    margin-top: 25px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: white !important;
    border: none !important;
    padding: 15px 30px !important;
    border-radius: 18px !important;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.btn-add-apply:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(16, 185, 129, 0.35);
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
}

.btn-add-apply:active {
    transform: translateY(1px);
}

.btn-search-reset {
    flex: 1;
    background: rgba(148, 163, 184, 0.15) !important;
    color: #475569 !important;
    border: 1px solid rgba(148, 163, 184, 0.2) !important;
    padding: 15px 20px !important;
    border-radius: 18px !important; /* أزرار دائرية الحواف */
    font-size: 15.5px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-search-reset:hover {
    background: rgba(244, 63, 94, 0.1) !important;
    color: #e11d48 !important;
    border-color: rgba(244, 63, 94, 0.2) !important;
    transform: translateY(-2px);
}

.btn-search-reset:active {
    transform: translateY(1px);
}

/* توافق أزرار البحث مع الجوال */
@media (max-width: 576px) {
    .search-modal-actions {
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .btn-search-apply, .btn-search-reset {
        width: 100% !important;
        padding: 14px 20px !important;
    }
}

/* ===== تخصيص نافذة إعدادات الطباعة (Print Settings Modal Styling) ===== */
#printSettingsModal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#printSettingsModal .modal-content {
    background: #ffffff;
    margin: 8% auto;
    padding: 0;
    width: 90%;
    max-width: 650px;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
    animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    direction: rtl;
}

#printSettingsModal .modal-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

#printSettingsModal .modal-header h2 {
    font-size: 1.3rem;
    font-weight: 800;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Tajawal', sans-serif;
}

#printSettingsModal .print-close {
    font-size: 28px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

#printSettingsModal .print-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ef4444;
}

#printSettingsModal .modal-body {
    padding: 25px;
    background: #f8fafc;
}

/* العناوين الفرعية */
.settings-subtitle {
    font-size: 0.95rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 12px;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Tajawal', sans-serif;
}

/* القوالب السريعة */
.preset-group-modern {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.preset-chip {
    background: #ffffff;
    color: #475569;
    border: 1.5px solid #e2e8f0;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease;
    font-family: 'Tajawal', sans-serif;
}

.preset-chip:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #1e293b;
    transform: translateY(-1px);
}

.preset-chip i {
    font-size: 0.9rem;
    color: #6366f1;
}

/* شبكة الأعمدة */
.columns-modern-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

/* تصميم خيارات الاختيار (Custom Checkboxes) */
.custom-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #ffffff !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 12px !important;
    cursor: pointer;
    user-select: none;
    transition: all 0.25s ease;
    font-family: 'Tajawal', sans-serif;
}

.custom-checkbox-item:hover {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    transform: translateY(-1px);
}

/* إخفاء التشيك بوكس الافتراضي بالكامل */
.custom-checkbox-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
}

/* مربع الاختيار المخصص */
.custom-checkbox-item .checkbox-box {
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    display: inline-block;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

/* تنسيق التشيك بوكس المخصص عند التحديد */
.custom-checkbox-item input[type="checkbox"]:checked + .checkbox-box {
    background: #6366f1;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.custom-checkbox-item input[type="checkbox"]:checked + .checkbox-box::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.custom-checkbox-item .checkbox-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #475569;
    transition: color 0.2s ease;
}

.custom-checkbox-item input[type="checkbox"]:checked ~ .checkbox-label {
    color: #1e293b;
}

/* تنبيه أو نصيحة */
.settings-tip {
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.15);
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.8rem;
    color: #4f46e5;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 25px;
    font-weight: 600;
    font-family: 'Tajawal', sans-serif;
}

.settings-tip i {
    font-size: 1rem;
    color: #6366f1;
}

/* أزرار الإجراءات بالأسفل */
.print-modal-actions {
    display: flex;
    gap: 12px;
}

.print-modal-actions .btn-print-apply {
    flex: 2;
    background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transition: all 0.25s ease;
    font-family: 'Tajawal', sans-serif;
}

.print-modal-actions .btn-print-apply:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
}

.print-modal-actions .btn-print-cancel {
    flex: 1;
    background: #e2e8f0;
    color: #475569;
    border: 1.5px solid #cbd5e1;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s ease;
    font-family: 'Tajawal', sans-serif;
}

.print-modal-actions .btn-print-cancel:hover {
    background: #cbd5e1;
    color: #1e293b;
    transform: translateY(-1px);
}

@media (max-width: 576px) {
    .print-modal-actions {
        flex-direction: column !important;
        gap: 10px !important;
    }
    .print-modal-actions button {
        width: 100% !important;
    }
}

.modal-body {
    padding: 30px;
    background: #ffffff;
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Form Groups in Modals */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

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

.form-group label {
    font-size: 14px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 2px;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
    font-size: 15px;
    color: #1e293b;
    font-family: inherit;
    transition: all 0.3s ease;
    appearance: none;
}

.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 15px center; /* RTL positioning */
    background-size: 18px;
    padding-left: 40px; /* Space for the arrow */
}

.form-group input:focus, .form-group select:focus {
    border-color: #6366f1;
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    outline: none;
}

/* ===== الهيدر على شاشات اللابتوب/التابلت الأفقي (بين وضع سطح المكتب الكامل والقائمة الجانبية) ===== */
@media (max-width: 1300px) and (min-width: 993px) {
    .header-container {
        padding: 14px 18px;
    }

    .nav-list {
        gap: 2px;
    }

    .nav-link {
        padding: 8px 12px;
        font-size: 13px;
        gap: 6px;
        white-space: nowrap;
    }

    .header-nav {
        max-width: 52vw;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .header-nav::-webkit-scrollbar {
        display: none;
    }

    .header-user {
        gap: 10px;
    }

    .user-name {
        display: none; /* الاسم بيختفي والأفاتار يفضل ظاهر لتوفير المساحة */
    }

    .brand-subtitle {
        display: none;
    }
}

/* ===== الموبايل ===== */
@media (max-width: 992px) {
    .header-nav {
        display: none;
        /* Hide desktop nav on tablets/mobile */
    }

    .header-user {
        display: none;
        /* Hide user info and logout */
    }

    .mobile-menu-toggle {
        display: block;
        /* Show hamburger menu */
    }

    .header-container {
        padding: 14px 20px;
    }

    .brand-logo {
        width: 50px;
        height: 50px;
        padding: 4px;
        border-radius: 12px;
    }

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

    .ds-card p {
        font-size: 24px;
    }

    .form-row {
        flex-direction: column;
        align-items: stretch;
    }

    .modern-footer {
        padding: 40px 20px 20px;
    }

    .footer-container {
        flex-direction: column;
        gap: 30px;
        text-align: center;
    }

    .footer-nav {
        flex-direction: column;
        align-items: center;
    }

    .footer-info {
        align-items: center;
        text-align: center;
    }

    .footer-brand-text {
        align-items: center;
    }
}

/* ===== الطباعة ===== */
@media print {
    @page {
        size: A4;
        margin: 10mm 10mm 25mm 10mm; /* Increased bottom margin to prevent table from overlapping with the footer */
    }

    body {
        margin: 0;
        padding: 0;
        background: white;
        font-family: 'Tajawal', sans-serif;
    }

    body>*:not(.print-content) {
        display: none !important;
    }

    .print-content {
        display: block !important;
        width: 100% !important;
        background: white !important;
        color: black !important;
        padding: 20px;
    }

    /* Print Header */
    .print-header-enhanced {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 2px solid #333;
        padding-bottom: 20px;
        margin-bottom: 30px;
    }

    .print-logo img {
        height: 80px;
        object-fit: contain;
    }

    .print-titles {
        text-align: left;
    }

    .print-titles h1 {
        font-size: 24px;
        margin: 0;
        color: #000;
    }

    .print-titles h2 {
        font-size: 18px;
        margin: 5px 0 0;
        color: #555;
    }

    /* Print Meta */
    .print-meta-info {
        display: flex;
        justify-content: space-between;
        margin-bottom: 30px;
        font-size: 14px;
        color: #666;
        background: #f9f9f9;
        padding: 10px 20px;
        border-radius: 8px;
        border: 1px solid #eee;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Print Summary */
    .print-summary-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
        margin-bottom: 40px;
    }

    .print-summary-item {
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 15px;
        text-align: center;
        background-color: #fff;
    }

    .print-summary-item h4 {
        margin: 0 0 10px;
        font-size: 14px;
        color: #555;
    }

    .print-summary-item p {
        margin: 0;
        font-size: 18px;
        font-weight: bold;
        color: #000;
    }

    /* Print Table - Optimized to prevent clipping and improve readability */
    .print-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 11px;
        margin-bottom: 30px;
        table-layout: auto;
        direction: rtl !important;
    }

    .print-table th {
        background-color: #f1f5f9 !important;
        color: #000000 !important;
        font-weight: bold;
        padding: 8px 6px;
        border: 1.5px solid #475569 !important;
        text-align: center;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        font-size: 11.5px;
    }

    .print-table td {
        padding: 8px 6px;
        border: 1px solid #64748b !important;
        text-align: center;
        color: #000000 !important;
        font-size: 11px;
        font-weight: 500;
        word-wrap: break-word;
        word-break: break-word;
        overflow-wrap: break-word;
        white-space: normal !important;
        vertical-align: middle;
    }

    .print-table td.col-notes {
        text-align: right;
        max-width: 250px;
        min-width: 140px;
        white-space: normal !important;
    }

    .print-table td.col-timestamp {
        max-width: 110px;
        white-space: normal !important;
    }

    .print-table tr:nth-child(even) {
        background-color: #f8fafc !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .wared-amount {
        color: #166534 !important;
        /* Green 700 */
        font-weight: bold;
    }

    .sader-amount {
        color: #b91c1c !important;
        /* Red 700 */
        font-weight: bold;
    }

    .print-table tr {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    /* Footer - Positioned cleanly inside the bottom page margin */
    .print-footer {
        position: fixed;
        bottom: 5mm;
        left: 0;
        right: 0;
        text-align: center;
        font-size: 10px;
        color: #94a3b8;
        border-top: 1px solid #cbd5e1;
        padding-top: 8px;
        height: 15mm;
    }
}

/* ===== تسجيل الدخول ===== */
.login-page-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg-gradient);
    padding: 20px;
}

.login-wrapper {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    width: 100%;
    max-width: 450px;
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.login-wrapper:hover {
    transform: translateY(-5px);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 15px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.login-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-main);
    margin: 0 0 10px 0;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

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

.login-form input {
    width: 100%;
    padding: 14px 18px;
    border-radius: 12px;
    background: #f8fafc;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.login-form input:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.btn-login {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    margin-top: 10px;
    background: var(--royal-blue-active);
    color: white;
    border-radius: 12px;
    font-weight: 700;
    box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.4);
    border: none;
    cursor: pointer;
}

.btn-login:hover {
    box-shadow: 0 15px 30px -5px rgba(79, 70, 229, 0.5);
    transform: translateY(-2px);
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 25px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid #fecaca;
}

/* ===== إحصائيات النظام ===== */
.stats-header {
    background: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 25px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--primary);
}

.stats-filters {
    background: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 25px;
    box-shadow: var(--shadow-sm);
}

.stats-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card-modern {
    background: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border-bottom: 3px solid transparent;
}

.stat-card-modern:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.stat-card-modern h3 {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-card-modern .value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-main);
}

/* Chart Containers */
.chart-box {
    background: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 25px;
    box-shadow: var(--shadow-sm);
    height: 420px;
    position: relative;
    border: 1px solid var(--border);
}

.chart-box h2 {
    color: var(--text-main);
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== سجل النشاطات ===== */
.activity-filters {
    background: white;
    padding: 20px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.action-badge {
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 700;
    display: inline-block;
    min-width: 80px;
    text-align: center;
}

.badge-add {
    background: var(--success-bg);
    color: var(--success);
}

.badge-edit {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-delete {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-login {
    background: #e0e7ff;
    color: var(--primary);
}

/* Common Footer */
.app-footer {
    background: white;
    padding: 20px 0;
    margin-top: 50px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.app-footer strong {
    color: var(--primary);
}

/* Tabs */
.tabs-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.tab-btn {
    padding: 10px 20px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 50px;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-btn.active,
.tab-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ===== Enhanced Print Settings Modal ===== */
.print-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.print-settings-header h2 {
    margin: 0;
    color: var(--text-main);
    font-size: 20px;
    font-weight: 800;
}

.print-close {
    font-size: 28px;
    font-weight: bold;
    color: #94a3b8;
    cursor: pointer;
    transition: var(--transition);
}

.print-close:hover {
    color: var(--danger);
}

.quick-presets h4,
.print-settings-content h4 {
    margin-bottom: 15px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 700;
}

.preset-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px dashed #e2e8f0;
}

.preset-btn {
    background: white;
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.preset-btn:hover {
    background: #f8fafc;
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

/* Card Style Checkboxes */
.columns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 25px;
}

.column-option {
    position: relative;
    cursor: pointer;
}

.column-option input[type='checkbox'] {
    display: none;
    /* Hide default checkbox */
}

.column-option label {
    display: block;
    padding: 12px 15px;
    background: #f8fafc;
    border: 2px solid transparent;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
    cursor: pointer;
    user-select: none;
}

.column-option input[type='checkbox']:checked+label,
.column-option.checked label {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

.column-option:hover label {
    background: white;
    box-shadow: var(--shadow-sm);
}

.save-settings-note {
    background: #fffbeb;
    color: #92400e;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 20px;
    border: 1px solid #fcd34d;
    display: flex;
    align-items: center;
    gap: 8px;
}

.print-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 20px;
    border-top: 2px solid #f1f5f9;
}


/* --- Enhanced Stats Filters --- */
.stats-filters {
    background: white;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    margin-bottom: 24px;
    border: 1px solid rgba(226, 232, 240, 0.6);
}

.stats-filters form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    align-items: center;
}

.stats-filters select,
.stats-filters input[type="date"] {
    width: 100%;
    padding: 12px 16px;
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    color: #334155;
    transition: all 0.2s ease;
    appearance: none;
    /* Removes default arrow */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    /* Arabic RTL */
    background-size: 16px;
}

.stats-filters input[type="date"] {
    background-image: none;
    /* Standard date picker icon is fine, or customize if needed */
}

.stats-filters select:focus,
.stats-filters input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.stats-filters button[type="submit"] {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 46px;
    /* Match Input Height */
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.2);
}

.stats-filters button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px -3px rgba(99, 102, 241, 0.3);
}

.stats-filters button[type="submit"] i {
    font-size: 16px;
}

/* --- Tab Content Logic --- */
.main-tab-content {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
}

.main-tab-content.active {
    display: block;
}

/* --- Export Buttons --- */
.export-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-excel {
    background: linear-gradient(135deg, #107c41 0%, #0b5e30 100%);
    color: white;
}

.btn-excel:hover {
    background: linear-gradient(135deg, #0b5e30 0%, #073d20 100%);
    transform: translateY(-2px);
    color: white;
    box-shadow: 0 4px 8px rgba(16, 124, 65, 0.3);
}

.btn-pdf {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: white;
}

.btn-pdf:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
    transform: translateY(-2px);
    color: white;
    box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3);
}

.btn-export i {
    font-size: 14px;
}

/* ===== تحسين بطاقات الملخص (الصفحة الرئيسية) ===== */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.summary-item {
    padding: 15px 20px;
    border-radius: 20px;
    color: white;
    /* النص أبيض للخلفيات الملونة */
    text-align: center;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-height: 100px;
}

.summary-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 30px -5px rgba(0, 0, 0, 0.2), 0 10px 15px -5px rgba(0, 0, 0, 0.1);
}

/* طبقة تزيينية للخلفية */
.summary-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
}


.summary-item h4 {
    font-size: 14px;
    /* Reduced from 18px */
    font-weight: 700;
    margin-bottom: 10px;
    /* Reduced from 20px */
    opacity: 0.95;
    color: white;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.summary-item .formatted-number {
    font-size: 24px;
    /* Reduced from 36px */
    font-weight: 800;
    margin: 0;
    line-height: 1.1;
    text-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    color: white !important;
    z-index: 1;
    font-family: 'Tajawal', sans-serif;
}

/* ألوان البطاقات */
.card-opening {
    background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
    /* Indigo */
}

.card-income {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    /* Emerald */
}

.card-expense {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    /* Rose */
}


.card-closing {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    /* Violet */
}

/* ===== قسم إضافة سجل جديد (إصلاح التنسيق) ===== */
.quick-add-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
    margin-bottom: 40px;
    border: 1px solid #f1f5f9;
    position: relative;
    overflow: hidden;
}

.quick-add-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: var(--primary);
}

.quick-add-title {
    font-size: 26px;
    font-weight: 900;
    color: var(--text-main);
    margin: 0 0 25px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.form-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 200px;
}

.form-field label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
}

.form-field input,
.form-field select {
    padding: 12px 16px;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
    width: 100%;
}

.form-field input:focus,
.form-field select:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    outline: none;
}

.btn-submit {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(79, 70, 229, 0.4);
}

/* ===== إصلاح تنسيق هيدر الجدول والملخص ===== */
.table-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.table-header-row h3 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
}

.table-summary-row {
    display: flex;
    gap: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
    border: 1px solid #e2e8f0;
    box-shadow: var(--shadow-sm);
}

.table-summary-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.table-summary-item strong {
    font-size: 16px;
    font-weight: 800;
}

.btn-print-main {
    background: white;
    border: 1px solid #e2e8f0;
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-size: 14px;
}

.btn-print-main:hover {
    background: #f8fafc;
    border-color: var(--text-secondary);
    color: var(--text-main);
}

/* ===== تنسيقات صفحة سجل النشاطات ===== */
.stats-header {
    margin-bottom: 30px;
    position: relative;
}

.stats-header h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.stats-header h1 i {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    padding: 12px;
    border-radius: 12px;
    font-size: 24px;
}

.activity-filters {
    background: white;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e2e8f0;
}

.activity-filters .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.activity-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.activity-table th {
    background: #f8fafc;
    color: var(--text-secondary);
    font-weight: 700;
    padding: 16px;
    text-align: right;
    border-bottom: 2px solid #e2e8f0;
    font-size: 14px;
}

.activity-table td {
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;
    color: var(--text-main);
    font-size: 15px;
    vertical-align: middle;
}

.activity-table tr:last-child td {
    border-bottom: none;
}

.activity-table tr:hover td {
    background: #f8fafc;
}

.badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-action-add {
    background: #ecfdf5;
    color: #10b981;
}

.badge-action-edit {
    background: #eff6ff;
    color: #3b82f6;
}

.badge-action-delete {
    background: #fef2f2;
    color: #ef4444;
}

.badge-action-login {
    background: #f5f3ff;
    color: #8b5cf6;
}

.user-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary-gradient);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* ===== الفوتر الاحترافي (Modern Footer) ===== */
.modern-footer {
    background: var(--royal-footer);
    color: #dbeafe;
    padding: 60px 40px 30px;
    margin-top: 80px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

/* Subtle glow at the top */
.modern-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 100px;
    background: none;
    pointer-events: none;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 40px;
    position: relative;
    z-index: 1;
}

/* الروابط السريعة */
.footer-links {
    flex: 1;
    min-width: 250px;
}

.footer-title {
    font-size: 18px;
    font-weight: 800;
    color: white;
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
}

.footer-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 0;
    width: 24px;
    height: 3px;
    background: var(--royal-blue-light);
    border-radius: 2px;
}

.footer-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-nav li a {
    color: #bfdbfe;
    text-decoration: none;
    font-size: 15px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.footer-nav li a i {
    font-size: 14px;
    color: #93c5fd;
    transition: color 0.3s ease;
}

.footer-nav li a:hover {
    color: #ffffff;
    transform: translateX(-5px);
}

.footer-nav li a:hover i {
    color: #ffffff;
}

/* معلومات النظام والحقوق */
.footer-info {
    flex: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.footer-logo {
    width: 55px;
    height: 55px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.footer-brand:hover .footer-logo {
    transform: none;
    border-color: rgba(255, 255, 255, 0.24);
    box-shadow: none;
}

.footer-brand-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.footer-brand-title {
    font-size: 18px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.footer-brand-subtitle {
    font-size: 12px;
    color: #bfdbfe;
    font-weight: 500;
}

.copyright {
    color: #93c5fd;
    font-size: 14px;
    line-height: 1.8;
    margin: 0;
}

.copyright strong {
    color: #ffffff;
}

/* تأثير التظليل عند الانتقال من سجل النشاطات */
@keyframes highlightFlash {
    0% { background-color: rgba(99, 102, 241, 0.4); box-shadow: 0 0 20px rgba(99, 102, 241, 0.5); }
    100% { background-color: transparent; }
}

.highlight-flash {
    animation: highlightFlash 3s ease-out forwards;
    border: 2px solid #6366f1 !important;
    position: relative;
    z-index: 10;
}

/* ==========================================================================
   📱 شاشات الجوال والأجهزة الذكية المتجاوبة (Responsive Mobile Design Enhancements)
   ========================================================================== */

@media (max-width: 992px) {
    /* تحويل جدول المعاملات الرئيسي إلى نظام بطاقات متجاورة */
    #report-table {
        background: transparent;
        box-shadow: none;
        border: none;
        border-radius: 0;
        display: block;
        width: 100%;
    }

    #report-table thead {
        display: none; /* إخفاء الهيدر */
    }

    #report-table tbody, 
    #report-table tr, 
    #report-table td {
        display: block;
        width: 100%;
    }

    #report-table tr {
        background: rgba(255, 255, 255, 0.75);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border: 1px solid rgba(255, 255, 255, 0.6);
        border-radius: 16px;
        margin-bottom: 20px;
        padding: 15px 20px;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.8);
        position: relative;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    #report-table tr:hover {
        transform: translateY(-2px);
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    }

    #report-table td {
        text-align: left; /* القيمة تظهر على اليسار */
        padding: 10px 0;
        border-bottom: 1px dashed rgba(0, 0, 0, 0.05);
        position: relative;
        padding-right: 45%; /* مساحة للعنوان على اليمين */
        min-height: 42px;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        font-size: 0.9rem;
        white-space: normal !important; /* التفاف النصوص الطويلة */
    }

    #report-table td:last-child {
        border-bottom: none;
    }

    /* كتابة العناوين قبل القيم */
    #report-table td[data-label]::before {
        content: attr(data-label);
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 40%;
        font-weight: 800;
        color: var(--text-secondary);
        text-align: right;
        font-size: 0.85rem;
    }

    /* شارات الرصيد والوارد والصادر */
    #report-table td.cell-income {
        background-color: rgba(16, 185, 129, 0.08) !important;
        color: #059669 !important;
        border-radius: 8px;
        padding-left: 10px;
    }

    #report-table td.cell-expense {
        background-color: rgba(244, 63, 94, 0.08) !important;
        color: #e11d48 !important;
        border-radius: 8px;
        padding-left: 10px;
    }

    #report-table td.cell-opening {
        background-color: rgba(99, 102, 241, 0.08) !important;
        color: #4f46e5 !important;
        border-radius: 8px;
        padding-left: 10px;
    }

    /* إخفاء الصفوف الفارغة بالكامل للمحافظة على صغر حجم الكرت */
    #report-table td[data-label]:empty,
    #report-table td[data-label]:has(:empty) {
        display: none !important;
    }
    
    /* إذا كانت القيمة فارغة من PHP */
    #report-table td.cell-opening:empty,
    #report-table td.cell-income:empty,
    #report-table td.cell-expense:empty,
    #report-table td.col-notes:empty {
        display: none !important;
    }

    /* تنسيق خاص للرقم المسلسل كشارة باليسار العلوي */
    #report-table td.col-serial {
        position: absolute;
        top: 15px;
        left: 20px;
        width: auto;
        height: auto;
        padding: 4px 10px !important;
        background: rgba(148, 163, 184, 0.15) !important;
        color: #475569 !important;
        border-radius: 50px;
        font-size: 0.75rem !important;
        border: none !important;
        z-index: 5;
        font-weight: 800;
        display: inline-block;
        min-height: 0;
        padding-right: 0 !important;
    }
    #report-table td.col-serial::before {
        display: none !important;
    }

    /* تظليل الصف الافتتاحي بشكل مميز */
    #report-table tbody tr.row-highlight-opening {
        border-right: 5px solid #6366f1;
    }
    
    #report-table tbody tr.row-highlight-opening td.col-serial {
        background: rgba(99, 102, 241, 0.15) !important;
        color: #6366f1 !important;
    }

    /* منع تشويه تنسيق صف "لا توجد بيانات" على الموبايل */
    #report-table tr#no-data-row td {
        padding-right: 0 !important;
        justify-content: center !important;
        text-align: center !important;
        display: flex !important;
        border-bottom: none !important;
        font-style: italic;
        color: #64748b !important;
    }

    /* تنسيق الإجراءات (تعديل وحذف) كأزرار متجاورة ومريحة */
    #report-table td.actions {
        padding-right: 0;
        text-align: center;
        justify-content: center;
        border-bottom: none;
        margin-top: 12px;
        padding-top: 15px;
        border-top: 1px solid rgba(0, 0, 0, 0.05);
        gap: 12px;
        width: 100%;
    }
    #report-table td.actions::before {
        display: none !important;
    }
    #report-table td.actions a {
        flex: 1;
        justify-content: center;
        margin: 0;
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    /* الهيدر الموحد وشعار الجوال */
    .brand-title {
        font-size: 16px;
    }
    .brand-subtitle {
        font-size: 11px;
    }
    .modern-header {
        margin-bottom: 20px;
    }
    .header-container {
        padding: 10px 15px;
    }
    .brand-logo {
        width: 42px;
        height: 42px;
        padding: 6px;
        border-radius: 10px;
    }

    /* تنظيم نموذج الإضافة السريع */
    .quick-add-modern {
        padding: 20px;
    }
    .quick-add-header h3 {
        font-size: 18px;
    }
    .modern-entry-form .entry-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    .entry-field {
        min-width: 0 !important;
    }
    .entry-field.note-field,
    .entry-field.action-field {
        grid-column: span 2;
    }
    .btn-submit-modern {
        width: 100%;
        justify-content: center;
    }

    /* شارات تفاصيل البيانات المعروضة */
    .displayed-summary-modern {
        padding: 15px !important;
        margin-top: 20px !important;
    }
    .displayed-summary-modern .search-header h3 {
        font-size: 16px;
    }

    /* التمرير الأفقي للجداول العريضة في الصفحات الأخرى */
    .table-container-modern,
    .section-card {
        padding: 15px !important;
    }

    .user-table,
    .modern-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .user-table th, .user-table td,
    .modern-table th, .modern-table td {
        white-space: nowrap;
    }
}

@media (max-width: 768px) {
    .page-content {
        max-width: 100%;
        margin: 15px auto;
        padding: 0 10px;
    }
    
    .container {
        max-width: 100%;
        padding: 0 10px;
    }

    /* شبكة 2×2 لبطاقات الإحصائيات (Bento Stats) */
    .bento-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 12px 10px;
        gap: 10px;
        flex-direction: column;
        align-items: center;
        text-align: center;
        border-radius: 14px;
    }

    .stat-icon {
        width: 44px;
        height: 44px;
        border-radius: 12px;
        font-size: 18px;
    }

    .stat-details {
        gap: 3px;
        width: 100%;
    }

    .stat-details h4 {
        font-size: 11px;
        font-weight: 700;
    }

    .stat-details p {
        font-size: 16px;
        font-weight: 800;
        word-break: break-all;
    }
    
    /* النوافذ المنبثقة (Modals) */
    .modal-content, .modal-content-premium {
        width: 95%;
        margin: 10% auto;
        border-radius: 16px;
    }
    
    .modal-header, .modal-header-premium {
        padding: 15px 20px;
    }
    
    .modal-body, .modal-body-premium {
        padding: 15px 20px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* صفحة التعديل والزرار */
    .btn-container {
        flex-direction: column;
        gap: 12px !important;
        margin-top: 25px !important;
        padding-top: 20px !important;
    }
    
    .btn-container a, .btn-container button {
        width: 100% !important;
    }
}

@media (max-width: 576px) {
    /* تحويل حقول الإضافة السريع إلى عمود واحد طولي */
    .modern-entry-form .entry-row {
        grid-template-columns: 1fr;
    }
    
    .entry-field.note-field,
    .entry-field.action-field {
        grid-column: span 1;
    }
    
    /* شاشة تسجيل الدخول */
    .login-wrapper {
        padding: 25px 20px;
        border-radius: 16px;
    }
    
    .login-logo {
        width: 60px;
        height: 60px;
    }
    
    .login-title {
        font-size: 20px;
    }

    /* أدوات الجدول وزر الطباعة */
    .table-tools {
        flex-direction: column;
        gap: 12px;
        align-items: stretch !important;
        padding: 10px 5px !important;
    }
    
    .table-tools h3 {
        font-size: 1.1rem !important;
        text-align: center;
    }
    
    .table-tools button {
        width: 100%;
        justify-content: center;
    }
}

/* ===== زر النسخ الاحتياطي في الـ Navbar ===== */
.btn-backup-nav {
    background: rgba(99, 102, 241, 0.1) !important;
    color: #6366f1 !important;
    border: 1px solid rgba(99, 102, 241, 0.2) !important;
    border-radius: 12px;
    padding: 8px 16px !important;
    font-weight: 700;
    transition: all 0.25s ease;
}

.btn-backup-nav:hover {
    background: #6366f1 !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
    transform: translateY(-1px);
}

/* ===== تخصيص نافذة النسخ الاحتياطي (Backup Modal Styling) ===== */
#backupModal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#backupModal .modal-content {
    background: #ffffff;
    margin: 8% auto;
    padding: 0;
    width: 90%;
    max-width: 650px;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
    animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    direction: rtl;
}

#backupModal .modal-header {
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

#backupModal .modal-header h2 {
    font-size: 1.3rem;
    font-weight: 800;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Tajawal', sans-serif;
}

#backupModal .backup-close {
    font-size: 28px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

#backupModal .backup-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ef4444;
}

#backupModal .modal-body {
    padding: 25px;
    background: #f8fafc;
}

/* تنسيق قسم الفلاتر التفاعلية للباك اب */
.backup-filters-section {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 20px;
    display: none; /* يتم إظهاره تفاعلياً بـ JS */
    animation: fadeInSlide 0.3s ease;
}

@keyframes fadeInSlide {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.backup-filters-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 10px;
}

.backup-filters-grid .filter-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.backup-filters-grid label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #475569;
}

.backup-filters-grid input,
.backup-filters-grid select {
    border-radius: 10px !important;
    border: 1.5px solid #cbd5e1 !important;
    padding: 10px 14px !important;
    font-size: 0.85rem;
    color: #1e293b;
    background: #ffffff !important;
    font-family: 'Tajawal', sans-serif;
}

/* أزرار الإجراءات بالأسفل للنسخ الاحتياطي */
.backup-modal-actions {
    display: flex;
    gap: 12px;
}

.backup-modal-actions .btn-backup-apply {
    flex: 2;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transition: all 0.25s ease;
    font-family: 'Tajawal', sans-serif;
}

.backup-modal-actions .btn-backup-apply:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.backup-modal-actions .btn-backup-cancel {
    flex: 1;
    background: #e2e8f0;
    color: #475569;
    border: 1.5px solid #cbd5e1;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s ease;
    font-family: 'Tajawal', sans-serif;
}

.backup-modal-actions .btn-backup-cancel:hover {
    background: #cbd5e1;
    color: #1e293b;
    transform: translateY(-1px);
}

@media (max-width: 576px) {
    .backup-modal-actions {
        flex-direction: column !important;
        gap: 10px !important;
    }
    .backup-modal-actions button {
        width: 100% !important;
    }
    .backup-filters-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================================================== 
   Ledger UI 2.0 - الهيدر والجدول والفوتر المعتمد
   ========================================================================== */

/* الهيدر: صف للهوية والمستخدم وصف مستقل للتنقل والإجراءات */
.modern-header {
    background: var(--royal-blue);
    border-bottom: 0;
    box-shadow: 0 4px 18px rgba(30, 64, 175, 0.14);
    margin-bottom: 30px;
}

.header-container {
    min-height: 72px;
    padding: 12px 32px;
    max-width: 1600px;
}

.header-brand {
    gap: 12px;
}

.brand-logo {
    width: 46px;
    height: 46px;
    padding: 5px;
    border-radius: 11px;
}

.brand-title {
    font-size: 18px;
    font-weight: 800;
}

.brand-subtitle {
    font-size: 12px;
}

.header-user {
    gap: 10px;
}

.header-date {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #dbeafe;
    font-size: 13px;
    white-space: nowrap;
}

.user-badge {
    gap: 8px;
    padding: 5px 8px;
    border-radius: 10px;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--royal-blue);
}

.btn-logout-modern {
    min-height: 36px;
    padding: 7px 11px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    border-radius: 9px;
}

.btn-logout-modern:hover {
    background: rgba(244, 63, 94, 0.9);
}

.header-nav-row {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

.header-nav {
    width: 100%;
    max-width: 1600px;
    min-height: 56px;
    margin: 0 auto;
    padding: 8px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.nav-list {
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.nav-main-list,
.nav-action-list {
    display: flex;
}

.nav-link {
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 9px;
    color: #64748b;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.nav-link i {
    color: #94a3b8;
}

.nav-link:hover {
    color: #1e3a5f;
    background: #f1f5f9;
    border-color: transparent;
}

.nav-link:hover i {
    color: #1e3a5f;
}

.nav-link.active {
    color: #1e4b82;
    background: #eaf2ff;
    border-color: #cfe0f8;
}

.nav-link.active i {
    color: #1e4b82;
}

.btn-add-nav,
.btn-add-nav:hover {
    color: #ffffff !important;
    background: #07845f !important;
    border: 1px solid #07845f !important;
    box-shadow: 0 5px 14px rgba(7, 132, 95, 0.2);
    transform: none;
}

.btn-search-nav,
.btn-search-nav:hover {
    margin-right: 0;
    color: #087ea4 !important;
    background: #e8f7fc !important;
    border: 1px solid #bde4f0 !important;
    box-shadow: none;
    transform: none;
}

.btn-search-nav i {
    color: #087ea4 !important;
}

.btn-backup-nav,
.btn-backup-nav:hover {
    padding: 8px 12px !important;
    color: #5b55a5 !important;
    background: #f0efff !important;
    border: 1px solid #dcd8ff !important;
    box-shadow: none;
    transform: none;
}

/* بطاقة دفتر الحركة */
.report-ledger-card {
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.table-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0;
    padding: 16px 18px;
    border-bottom: 1px solid #e2e8f0;
}

.table-title-group {
    min-width: 0;
}

.table-tools .section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: #142033;
    font-size: 1.15rem;
    font-weight: 800;
}

.table-tools .section-title i {
    color: #1e4b82;
    font-size: 1rem;
}

.table-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 600;
}

.table-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    color: #1e4b82;
    background: #eaf2ff;
    border-radius: 999px;
}

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

.table-filter-button,
.table-print-button {
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.table-filter-button,
.table-filter-button:hover {
    margin: 0 !important;
    color: #334155 !important;
    background: #ffffff !important;
    border: 1px solid #dbe3ee !important;
    box-shadow: none !important;
}

.table-filter-button i {
    color: #64748b !important;
}

.table-print-button {
    color: #ffffff;
    background: #1e4b82;
    border: 1px solid #1e4b82;
    box-shadow: 0 5px 14px rgba(30, 75, 130, 0.18);
}

#report-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    border-spacing: 0;
    border-radius: 0;
    table-layout: fixed;
    overflow: visible;
    background: #ffffff;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

#report-table thead th {
    padding: 12px 10px;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid #dbe3ee;
    font-size: 0.84rem;
    font-weight: 700;
    text-align: right;
}

#report-table thead th:first-child,
#report-table thead th:last-child {
    border-radius: 0;
}

#report-table th.col-reference { width: 8%; }
#report-table th.col-datetime { width: 14%; }
#report-table th.col-section { width: 11%; }
#report-table th.col-notes { width: 23%; }
#report-table th.th-opening,
#report-table th.th-income,
#report-table th.th-expense { width: 11%; }
#report-table th.actions { width: 11%; }

#report-table tbody td {
    padding: 12px 10px;
    color: #334155;
    background: #ffffff;
    border-bottom: 1px solid #e8edf3;
    font-size: 0.86rem;
    font-weight: 600;
    vertical-align: middle;
}

#report-table tbody tr:last-child td {
    border-bottom: 0;
}

#report-table tbody tr:hover td {
    background: #f8fafc !important;
}

#report-table td.col-notes {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
}

.record-reference {
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.record-serial {
    display: inline-grid;
    place-items: center;
    min-width: 25px;
    height: 25px;
    padding: 0 5px;
    color: #64748b;
    background: #f1f5f9;
    border-radius: 7px;
    font-size: 0.75rem;
    font-weight: 800;
}

.record-id {
    color: #1e293b;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
}

.record-date,
.record-time {
    display: block;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.record-date {
    color: #1e293b;
    font-weight: 800;
}

.record-time {
    margin-top: 2px;
    color: #7890aa;
    font-size: 0.75rem;
}

#report-table td.cell-opening,
#report-table td.cell-income,
#report-table td.cell-expense {
    color: inherit !important;
    background: #ffffff !important;
    white-space: nowrap;
}

.money-chip {
    display: block;
    width: 100%;
    padding: 6px 8px;
    border-radius: 8px;
    direction: ltr;
    text-align: left;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
}

.opening-chip {
    color: #5b55a5;
    background: #f0efff;
}

.income-chip {
    color: #087a56;
    background: #e9f8f1;
}

.expense-chip {
    color: #c33a50;
    background: #fff0f2;
}

.empty-value {
    display: block;
    color: #94a3b8;
    text-align: center;
}

#report-table tbody tr.row-highlight-opening td {
    background: #fbfaff !important;
}

#report-table tbody tr.row-highlight-opening td:first-child {
    box-shadow: inset -3px 0 0 #6d5bd0;
}

#report-table tbody tr.row-highlight-opening:hover td {
    background: #f7f5ff !important;
}

#report-table td.actions,
#report-table th.actions {
    width: auto;
    text-align: center;
}

#report-table td.actions {
    display: table-cell;
    white-space: nowrap;
}

#report-table .btn-edit,
#report-table .btn-delete {
    width: 32px;
    height: 32px;
    margin: 2px;
    padding: 0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transform: none;
}

#report-table .btn-edit {
    color: #1e4b82;
    background: #ffffff;
    border: 1px solid #dbe3ee;
}

#report-table .btn-delete {
    color: #d93d55;
    background: #ffffff;
    border: 1px solid #f3cbd1;
}

#report-table .action-label {
    display: none;
}

#report-table .no-data-row td {
    padding: 35px 15px;
    color: #64748b;
    text-align: center;
    font-style: normal;
}

/* الفوتر: مختصر على الديسكتوب فقط */
.modern-footer {
    margin-top: 40px;
    padding: 20px 32px;
    background: var(--royal-footer);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.footer-container {
    max-width: 1600px;
    display: grid;
    grid-template-columns: minmax(230px, 1fr) auto minmax(250px, 1fr);
    align-items: center;
    gap: 24px;
}

.footer-brand {
    margin: 0;
    gap: 10px;
}

.footer-logo {
    width: 38px;
    height: 38px;
    padding: 4px;
    border-radius: 9px;
}

.footer-brand-title {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0;
}

.footer-brand-subtitle {
    font-size: 11px;
}

.footer-links {
    min-width: 0;
}

.footer-nav {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
}

.footer-nav li a {
    gap: 6px;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 12px;
}

.footer-nav li a:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: none;
}

.footer-legal {
    text-align: left;
}

.footer-legal .copyright {
    color: #93c5fd;
    font-size: 11px;
    line-height: 1.7;
}

@media (max-width: 1300px) and (min-width: 993px) {
    .header-container,
    .header-nav {
        padding-inline: 20px;
    }

    .header-nav {
        max-width: 100%;
        overflow-x: auto;
    }

    .nav-list {
        flex-wrap: nowrap;
    }

    .nav-link {
        padding-inline: 10px;
        font-size: 13px;
    }

    .header-date {
        display: none;
    }
}

@media (max-width: 992px) {
    .modern-header {
        margin-bottom: 20px;
    }

    .header-container {
        min-height: 64px;
        padding: 9px 15px;
    }

    .header-nav-row,
    .header-nav,
    .header-user {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 9px;
        background: rgba(255, 255, 255, 0.08);
    }

    .mobile-nav-list .nav-link {
        min-height: 44px;
        color: #dbeafe;
        background: rgba(255, 255, 255, 0.04);
        border-color: transparent;
    }

    .mobile-nav-list .nav-link i {
        color: #bfdbfe;
    }

    .mobile-nav-list .nav-link.active {
        color: #ffffff;
        background: var(--royal-blue-hover);
        border-color: var(--royal-blue-light);
    }

    .mobile-nav-list .btn-search-nav,
    .mobile-nav-list .btn-search-nav:hover {
        color: #ffffff !important;
        background: rgba(14, 165, 233, 0.24) !important;
        border-color: rgba(125, 211, 252, 0.28) !important;
    }

    .mobile-nav-list .btn-search-nav i {
        color: #ffffff !important;
    }

    .mobile-nav-list .btn-add-nav,
    .mobile-nav-list .btn-add-nav:hover {
        margin-top: 0;
        color: #ffffff !important;
        background: #07845f !important;
        border-color: #07845f !important;
    }

    .report-ledger-card {
        overflow: visible;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .table-tools {
        padding: 4px 0 14px;
        border-bottom: 0;
    }

    .table-tools .section-title {
        font-size: 1.05rem;
    }

    .table-print-button {
        display: none;
    }

    .table-filter-button,
    .table-filter-button:hover {
        width: 38px;
        min-width: 38px;
        height: 38px;
        min-height: 38px;
        padding: 0;
    }

    .table-filter-button span {
        display: none;
    }

    #report-table {
        display: block;
        width: 100%;
        background: transparent;
    }

    #report-table thead {
        display: none;
    }

    #report-table tbody {
        display: block;
        width: 100%;
    }

    #report-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 0;
        width: 100%;
        margin-bottom: 12px;
        padding: 0;
        overflow: hidden;
        position: relative;
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 13px;
        box-shadow: 0 7px 18px rgba(15, 23, 42, 0.07);
    }

    #report-table tbody td {
        display: block;
        width: auto;
        min-height: 0;
        padding: 0;
        color: #334155;
        background: transparent !important;
        border: 0;
        text-align: right;
        white-space: normal !important;
    }

    #report-table tbody td::before {
        display: none !important;
    }

    #report-table td.record-reference {
        order: 1;
        flex: 1 1 calc(100% - 130px);
        display: flex;
        align-items: center;
        padding: 13px 14px 2px;
    }

    #report-table .record-serial {
        display: none;
    }

    #report-table .record-id::before {
        content: 'حركة ';
        font-weight: 700;
    }

    #report-table td.cell-opening,
    #report-table td.cell-income,
    #report-table td.cell-expense {
        order: 2;
        flex: 0 0 auto;
        margin: 12px 12px 0 0;
        background: transparent !important;
    }

    #report-table td.cell-opening:has(.empty-value),
    #report-table td.cell-income:has(.empty-value),
    #report-table td.cell-expense:has(.empty-value) {
        display: none;
    }

    #report-table .money-chip {
        width: auto;
        min-width: 86px;
        padding: 7px 9px;
        text-align: center;
    }

    #report-table td.record-datetime {
        order: 3;
        flex: 0 0 100%;
        padding: 2px 14px 11px;
    }

    #report-table .record-date,
    #report-table .record-time {
        display: inline;
        color: #7890aa;
        font-size: 0.75rem;
        font-weight: 600;
    }

    #report-table .record-date::after {
        content: ' · ';
    }

    #report-table td.col-notes {
        order: 4;
        flex: 0 0 100%;
        padding: 4px 14px 5px;
        color: #142033;
        font-size: 0.95rem;
        font-weight: 800;
    }

    #report-table td.col-section {
        order: 5;
        flex: 0 0 100%;
        padding: 2px 14px 13px;
        color: #7890aa;
        font-size: 0.8rem;
    }

    #report-table td.col-section:not(:empty)::before {
        content: '\f1ad' !important;
        display: inline-block !important;
        margin-left: 6px;
        position: static;
        width: auto;
        transform: none;
        color: #7890aa;
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
    }

    #report-table td.actions {
        order: 6;
        flex: 0 0 100%;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 14px;
        margin: 0;
        padding: 9px 12px;
        background: #f8fafc !important;
        border-top: 1px solid #e2e8f0;
        text-align: right;
    }

    #report-table td.actions:empty {
        display: none;
    }

    #report-table td.col-section:empty {
        display: none;
    }

    #report-table .btn-edit,
    #report-table .btn-delete {
        width: auto;
        height: auto;
        margin: 0;
        padding: 5px 7px;
        gap: 6px;
        border: 0;
        background: transparent;
    }

    #report-table .action-label {
        display: inline;
    }

    #report-table tbody tr.row-highlight-opening {
        border-right: 3px solid #6d5bd0;
    }

    #report-table tbody tr.row-highlight-opening td,
    #report-table tbody tr.row-highlight-opening:hover td {
        background: transparent !important;
    }

    #report-table tbody tr.row-highlight-opening td.actions {
        background: #f8fafc !important;
    }

    #report-table tbody tr.row-highlight-opening td:first-child {
        box-shadow: none;
    }

    #report-table tr.no-data-row {
        display: block;
        padding: 20px;
    }

    #report-table tr.no-data-row td {
        display: block !important;
        padding: 10px !important;
        text-align: center !important;
    }

    .modern-footer {
        display: none !important;
    }
}

@media (max-width: 576px) {
    .page-content {
        padding-inline: 12px;
    }

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

    .brand-subtitle {
        font-size: 11px;
    }

    .brand-logo {
        width: 42px;
        height: 42px;
    }

    .table-tools {
        flex-direction: row;
        align-items: flex-start !important;
        gap: 10px;
        padding: 4px 0 12px !important;
    }

    .table-tools h3 {
        text-align: right;
    }

    .table-tools button {
        width: 38px;
    }

    #report-table tbody tr {
        margin-bottom: 12px;
    }
}

/* ===== صفحة البحث المستقلة في السجلات ===== */
.records-search-page {
    display: grid;
    gap: 18px;
    padding-top: 0;
}

.records-search-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 24px;
    color: #ffffff;
    background: linear-gradient(135deg, #173b68 0%, #1e4b82 58%, #087ea4 100%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 16px;
    box-shadow: 0 14px 34px rgba(30, 75, 130, 0.2);
}

.records-search-back,
.records-search-back:hover {
    flex: 0 0 auto;
    margin: 0;
    color: #173b68 !important;
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 7px 18px rgba(15, 23, 42, 0.16);
    transform: none;
}

.records-search-title-group {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.records-search-title-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    font-size: 1.3rem;
}

.records-search-title-group h1 {
    margin: 0;
    color: #ffffff;
    font-size: clamp(1.45rem, 2.5vw, 2rem);
    font-weight: 900;
}

.records-search-title-group p {
    margin: 5px 0 0;
    color: #dbeafe;
    line-height: 1.7;
    font-size: 0.9rem;
    font-weight: 600;
}

.records-search-card {
    padding: 22px 24px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 9px 26px rgba(15, 23, 42, 0.055);
}

.quick-period-card {
    padding-bottom: 24px;
}

.records-search-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 17px;
}

.records-search-section-title h2 {
    margin: 0;
    color: #142033;
    font-size: 1.08rem;
    font-weight: 850;
}

.records-search-section-title h2 i {
    margin-left: 7px;
    color: #1e4b82;
}

.records-search-section-title p {
    margin: 5px 0 0;
    color: #64748b;
    font-size: 0.84rem;
    font-weight: 600;
}

.quick-period-buttons {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.quick-period-button {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 13px;
    color: #334155;
    background: #f8fafc;
    border: 1px solid #dbe3ee;
    border-radius: 11px;
    font-size: 0.9rem;
    font-weight: 800;
    text-decoration: none;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.quick-period-button i {
    color: #087ea4;
}

.quick-period-button small {
    flex-basis: 100%;
    color: #7890aa;
    direction: ltr;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
}

.quick-period-button:hover,
.quick-period-button.active {
    color: #ffffff;
    background: #1e4b82;
    border-color: #1e4b82;
    transform: translateY(-1px);
}

.quick-period-button:hover i,
.quick-period-button.active i,
.quick-period-button:hover small,
.quick-period-button.active small {
    color: #ffffff;
}

.records-search-form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.records-search-field {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.records-search-field-wide {
    grid-column: span 2;
}

.records-search-field-full {
    grid-column: 1 / -1;
}

.records-search-field label {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 800;
}

.records-search-field label i {
    width: 16px;
    color: #087ea4;
    text-align: center;
}

.records-search-field input,
.records-search-field select {
    width: 100%;
    min-height: 46px;
    padding: 10px 13px;
    color: #1e293b;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    outline: none;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 650;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.records-search-field input:focus,
.records-search-field select:focus {
    border-color: #087ea4;
    box-shadow: 0 0 0 3px rgba(8, 126, 164, 0.12);
}

.records-search-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
}

.records-search-submit,
.records-search-reset {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 17px;
    border-radius: 10px;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.records-search-submit {
    color: #ffffff;
    background: #1e4b82;
    border: 1px solid #1e4b82;
    box-shadow: 0 6px 16px rgba(30, 75, 130, 0.18);
}

.records-search-reset {
    color: #475569;
    background: #ffffff;
    border: 1px solid #cbd5e1;
}

.records-search-state {
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 17px;
    padding: 28px;
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    text-align: right;
}

.records-search-state > i {
    color: #87a0b9;
    font-size: 2rem;
}

.records-search-state h2 {
    margin: 0;
    color: #334155;
    font-size: 1.08rem;
}

.records-search-state p {
    margin: 6px 0 0;
    color: #64748b;
    line-height: 1.7;
    font-size: 0.88rem;
    font-weight: 600;
}

.records-search-error {
    justify-content: flex-start;
    min-height: 0;
    color: #991b1b;
    background: #fff7f7;
    border-color: #fecaca;
    border-style: solid;
}

.records-search-error > i,
.records-search-error h2,
.records-search-error p {
    color: #991b1b;
}

.records-results-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.records-result-stat {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 13px;
    box-shadow: 0 7px 20px rgba(15, 23, 42, 0.045);
}

.records-result-stat-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 11px;
}

.records-result-stat div {
    min-width: 0;
}

.records-result-stat div span,
.records-result-stat div strong {
    display: block;
}

.records-result-stat div span {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 700;
}

.records-result-stat div strong {
    margin-top: 3px;
    color: #142033;
    direction: ltr;
    font-size: 1.22rem;
    font-weight: 900;
    text-align: right;
}

.records-result-count .records-result-stat-icon {
    color: #1e4b82;
    background: #eaf2ff;
}

.records-result-income .records-result-stat-icon {
    color: #087a56;
    background: #e9f8f1;
}

.records-result-expense .records-result-stat-icon {
    color: #c33a50;
    background: #fff0f2;
}

.records-result-closing {
    border-bottom: 3px solid #8b5cf6;
}

.records-result-closing .records-result-stat-icon {
    color: #6d5bd0;
    background: #f0efff;
}

.records-applied-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    padding: 12px 15px;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    font-size: 0.8rem;
    font-weight: 700;
}

.records-filter-label {
    color: #334155;
    font-weight: 850;
}

.records-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    color: #1e4b82;
    background: #eaf2ff;
    border-radius: 999px;
}

.records-results-card {
    margin-top: 0;
}

@media (max-width: 992px) {
    .records-search-heading {
        align-items: flex-start;
        flex-direction: column-reverse;
    }

    .records-search-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .records-search-field-wide {
        grid-column: span 2;
    }

    .records-results-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .records-results-card .table-tools {
        padding-top: 14px;
    }
}

@media (max-width: 700px) {
    .quick-period-buttons {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 576px) {
    .records-search-page {
        gap: 14px;
    }

    .records-search-heading,
    .records-search-card {
        padding: 17px 15px;
        border-radius: 13px;
    }

    .records-search-title-icon {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }

    .records-search-title-group h1 {
        font-size: 1.35rem;
    }

    .records-search-back {
        width: 100%;
        justify-content: center;
    }

    .records-search-form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .records-search-field-wide,
    .records-search-field-full {
        grid-column: auto;
    }

    .records-search-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .records-search-submit,
    .records-search-reset {
        width: 100%;
    }

    .quick-period-button {
        min-height: 55px;
        padding-inline: 8px;
        font-size: 0.82rem;
    }

    .records-result-stat {
        padding: 13px;
    }

    .records-result-stat-icon {
        width: 38px;
        height: 38px;
    }

    .records-result-stat div strong {
        font-size: 1rem;
    }

    .records-search-state {
        align-items: center;
        flex-direction: column;
        text-align: center;
    }

    .records-results-card .table-tools {
        padding: 2px 0 11px !important;
    }
}
