/* * ========================================
 * ملف التصميم الاحترافي (النسخة 4.0)
 * يتضمن: (تصميم صفحة الدخول) + (تصميم لوحة التحكم)
 * ========================================
 */

/* 1. استدعاء خط كايرو */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');

/* 2. متغيرات الألوان */
:root {
    --primary-color: #1F4E79;  /* كحلي مهني */
    --accent-color: #2E7D32;   /* أخضر معتدل */
    --danger-color: #D32F2F;   /* أحمر للخطر أو الحذف */

    --color-bg: #F9FAFB;
    --color-card-bg: #FFFFFF;
    --color-text: #1F2937;
    --color-text-muted: #6B7280;
    --color-border: #D1D5DB;
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* 3. الإعدادات العامة */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Cairo', -apple-system, sans-serif;
    line-height: 1.6;
    font-size: 16px;
    direction: rtl;
    background-color: var(--color-bg);
    color: var(--color-text);
}

a {
    text-decoration: none;
    color: var(--primary-color);
}

/* 4. ======================================== */
/* تنسيقات صفحة الدخول والتسجيل (V3.0)      */
/* ======================================== */
.login-page-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 0;
}
.login-container {
    width: 100%;
    max-width: 420px;
    margin: 0 1rem;
}
.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.login-logo h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}
.login-card {
    background-color: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-lg);
}
.login-form-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1.5rem;
}
form {
    display: flex;
    flex-direction: column;

}
form div {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
form label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}
input[type="email"],
input[type="password"],
input[type="text"],
input[type="date"],  /* <-- تمت إضافة هذا */
input[type="number"], /* <-- تمت إضافة هذا */
input[type="tel"] /* <-- تمت إضافة هذا */
{
    width: 100%;
    padding: 0.75rem 1rem; /* <-- هذا هو الارتفاع الموحد */
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    color: var(--color-text);
    background-color: #FFF;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="email"]:focus,
input[type="password"]:focus,
input[type="text"]:focus,
input[type="date"]:focus,  /* <-- تمت إضافة هذا */
input[type="number"]:focus, /* <-- تمت إضافة هذا */
input[type="tel"]:focus /* <-- تمت إضافة هذا */
{
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(31, 78, 121, 0.2);
}
.forgot-password {
    font-size: 0.9rem;
    text-align: left;
    margin-top: -0.5rem;
}
.divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2rem 0;
}
.register-section {
    text-align: center;
}
.register-section p {
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}
/* 5. ======================================== */
/* تنسيقات الأزرار (عامة)                  */
/* ======================================== */
.btn {
    display: inline-block;
    width: 100%;
    padding: 0.85rem 1.5rem;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease;
}
.btn-primary {
    background-color: var(--primary-color);
    color: #FFF;
}
.btn-primary:hover {
    background-color: #1a4061;
}
.btn-accent-outline {
    background-color: transparent;
    color: var(--accent-color);
    border-color: var(--accent-color);
}
.btn-accent-outline:hover {
    background-color: var(--accent-color);
    color: #FFF;
}
.btn-danger {
    background-color: var(--danger-color);
    color: #FFF;
}
.btn-danger:hover {
    background-color: #a02323;
}
/* زر بعرض غير كامل */
.btn-auto {
    width: auto;
}

/* 6. ======================================== */
/* تنسيقات لوحة التحكم (الجديدة)             */
/* ======================================== */
.dashboard-header {
   background-color: var(--color-card-bg);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: flex-start; /* <-- بهذا السطر (flex-start يعني اليمين في RTL) */
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}
.dashboard-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-right: 1rem; /* <-- لإضافة مسافة بين الزر واللوجو */
}

/* القائمة الجانبية (Hamburger) */
.menu-toggle {
    cursor: pointer;
    background: none;
    border: none;
    z-index: 102;
}
.hamburger {
    display: block;
    width: 28px;
    height: 3px;
    background-color: var(--color-text);
    margin: 5px 0;
    transition: 0.4s ease-in-out;
}

.dashboard-sidebar {
   
    position: fixed;
    top: 0;
    right: -300px; /* تبدأ خارج الشاشة */
    width: 280px;
    height: 100vh;
    background-color: var(--color-card-bg);
    box-shadow: var(--shadow-lg);
    padding-top: 60px;
    z-index: 101;
    transition: right 0.3s ease-in-out;
}

.dashboard-sidebar.is-active {
    right: 0;
}
.dashboard-sidebar ul {
    list-style: none;
}
.dashboard-sidebar ul li a {
    display: block;
    padding: 1rem 1.5rem;
    text-decoration: none;
    color: var(--color-text);
    font-weight: 600;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--color-border);
}
.dashboard-sidebar ul li a:hover {
    background-color: var(--primary-color);
    color: #FFF;
}
/* كلاس 'is-active' يضاف بـ JS */
.dashboard-sidebar.is-active {
    right: 0;
}
.menu-toggle.is-active .hamburger:nth-child(1) {
    transform: rotate(-45deg) translate(-6px, 6px);
}
.menu-toggle.is-active .hamburger:nth-child(2) {
    opacity: 0;
}
.menu-toggle.is-active .hamburger:nth-child(3) {
    transform: rotate(45deg) translate(-7px, -7px);
}

/* محتوى لوحة التحكم */
.dashboard-content {
    padding: 2rem 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* كروت لوحة التحكم */
.card {
    background-color: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.card h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 1rem;
}
/* 7. ======================================== */
/* تنسيقات الجداول والكروت الإضافية          */
/* ======================================== */

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: right;
    border-bottom: 1px solid var(--color-border);
}

.data-table thead th {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-text-muted);
    background-color: var(--color-bg);
}

.data-table tbody tr:hover {
    background-color: var(--color-bg);
}

.btn-small {
    padding: 0.25rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    background-color: var(--primary-color);
    color: #FFF;
    border-radius: 6px;
    border: 1px solid var(--primary-color);
    width: auto; /* <-- هذا هو السطر الجديد. يلغي العرض 100% */
    
    
}
.btn-small + .btn-small {
    margin-right: 0.5rem; 
}

.btn-small:hover {
    background-color: #1a4061;
}
.card h2 .user-name {
    color: var(--primary-color);
    display: inline-block; /* لضمان بقائه في نفس السطر */
}

/* 8. ======================================== */
/* تنسيقات إضافية للنماذج (Forms)           */
/* ======================================== */

/* تنسيق القوائم المنسدلة (Select) */
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    color: var(--color-text);
    background-color: #FFF;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    -webkit-appearance: none; /* لإخفاء السهم الافتراضي في كروم */
    -moz-appearance: none;    /* لإخفاء السهم الافتراضي في فايرفوكس */
    appearance: none;
    /* إضافة سهم مخصص */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236B7280'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd' /%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 0.5rem center; /* (left لأننا RTL) */
    background-size: 1.5em 1.5em;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(31, 78, 121, 0.2);
}

/* تنسيق منطقة الأزرار في نهاية الفورم */
.form-actions {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    margin-top: 1rem;
}
/* 9. ======================================== */
/* تنسيقات لوحة التحكم (الإحصائيات)          */
/* ======================================== */

.stat-cards-container {
    display: grid;
    /* * سينشئ أعمدة بحد أدنى 250 بكسل وتتوسع لتملأ المساحة
     * سيعرضها بجانب بعضها على الشاشات الكبيرة وفوق بعضها على الموبايل
    */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

/* رقم الإحصائية (مثل عدد الشركات) */
.stat-card .stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* اسم الباقة */
.stat-card .stat-plan {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color); /* باللون الأخضر المميز */
}
/* 10. ======================================== */
/* تنسيقات القائمة الفرعية للشركة (Sub-menu) */
/* ======================================== */

.company-submenu-container {
    /* * هذا الكود يلصق القائمة الفرعية أسفل الترويسة الرئيسية
     * ويجعلها بعرض الشاشة مع ظل سفلي
    */
    background-color: var(--color-card-bg);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 65px; /* ارتفاع الترويسة الرئيسية (تقريباً) */
    z-index: 90; /* أقل من الترويسة الرئيسية */
    
    /* * نستخدم هذا لسحب القائمة للأعلى لتلتصق بالهيدر
     * وإلغاء مسافة .dashboard-content
    */
    margin-top: -2rem; 
    margin-bottom: 2rem;
}

.company-submenu ul {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-x: auto; /* للموبايل */
}

.company-submenu ul li a {
    display: block;
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-text-muted);
    text-decoration: none;
    border-bottom: 3px solid transparent; /* حد سفلي شفاف */
    transition: all 0.2s ease;
}

.company-submenu ul li a:hover {
    color: var(--primary-color);
}

/* الرابط النشط (Active) */
.company-submenu ul li a.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* 11. ======================================== */
/* تنسيقات إضافية للنماذج (Grid Forms)       */
/* ======================================== */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* (إلغاء المسافات الافتراضية داخل الكارت عند استخدام الجريد) */
.card .form-grid {
    gap: 1.5rem;
}
.card > .form-grid {
    gap: 1.5rem;
}

/* 12. ======================================== */
/* تنسيقات إضافية للأزرار (Outline)          */
/* ======================================== */

.btn-danger-outline {
    background-color: transparent;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}
.btn-danger-outline:hover {
    background-color: var(--danger-color);
    color: #FFF;
}

/* 14. ======================================== */
/* تنسيقات صفحة قيود اليومية (Journals)       */
/* ======================================== */

.journal-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

.journal-table th,
.journal-table td {
    padding: 0.5rem;
    text-align: right;
    border-bottom: 1px solid var(--color-border);
}

.journal-table thead th {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-text-muted);
    background-color: var(--color-bg);
}

/* جعل الحقول تملأ الخلية */
.journal-table .form-select,
.journal-table .form-input {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.9rem;
    border-radius: 6px;
    border: 1px solid var(--color-border);
}

.journal-table input[type="number"] {
    text-align: left;
}

.journal-table .delete-row-btn {
    width: auto;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

/* شريط الإجماليات */
.totals-bar {
    display: flex;
    justify-content: space-around;
    padding: 1rem;
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    margin-top: 1.5rem;
    font-weight: 700;
}
.totals-bar div {
    font-size: 1.2rem;
    color: var(--color-text);
}
.totals-bar span {
    color: var(--primary-color);
}
/* 15. ======================================== */
/* تنسيقات Select2 (لجعله متوافقاً)       */
/* ======================================== */

/* جعل حقل Select2 يملأ الخلية */
.select2-container {
    width: 100% !important;
    height: auto;
}

/* تنسيق الحقل ليتطابق مع حقولنا */
.select2-container .select2-selection--single {
    width: 100%;
    /* (جديد) جعل الارتفاع يتطابق مع الحقول الأخرى */
    height: auto; 
    padding: 0.75rem 1rem;
    /* (نهاية الجديد) */

    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

/* تنسيق السهم */
.select2-container .select2-selection--single .select2-selection__arrow {
    /* (جديد) تعديل ارتفاع السهم ليتوسط */
    height: calc((0.75rem * 2) + 1.6rem); 
    left: 0.5rem;
    top: 0;
}

/* إزالة ارتفاع الحقل الثابت القديم */
.journal-table .form-select {
    height: auto;
}

/* تنسيق النص المختار */
.select2-container .select2-selection--single .select2-selection__rendered {
    line-height: 1.6;
    padding-right: 0 !important;
    color: var(--color-text);
}

/* تنسيق القائمة المنسدلة (التي تظهر في body) */
.select2-dropdown {
    direction: rtl; /* دعم اللغة العربية في القائمة */
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}
.select2-container .select2-search--dropdown {
    padding: 0.5rem;
}
.select2-container .select2-search--dropdown .select2-search__field {
     border: 1px solid var(--color-border);
     border-radius: 6px;
     padding: 0.5rem;
     width: 100%;
}
/* 16. ======================================== */
/* تنسيقات زر "إضافة جديد" داخل Select2    */
/* ======================================== */

/* تنسيق الرسالة نفسها لإعطاء مساحة للزر */
.select2-results__option--no-results {
    padding: 1rem !important; /* مساحة للرسالة والزر */
    text-align: center;
}

/* تصميم الزر (الرابط) */
.select2-add-new {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin-top: 0.75rem;
    width: 100%;
    text-align: center;
    background-color: var(--accent-color); /* لون أخضر */
    color: #FFF !important; /* نص أبيض */
    border: none;
    border-radius: 6px;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 0.2s ease;
}
.select2-add-new:hover {
    background-color: #256a2a; /* أخضر أغمق */
    color: #FFF !important;
}
/* 17. ======================================== */
/* تنسيقات النافذة المنبثقة (Modal)           */
/* ======================================== */

.modal-overlay {
    display: none; /* مخفي افتراضياً */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1040; /* فوق كل شيء */
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #FFF;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 800px; /* عرض أكبر للـ form-grid */
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--color-border);
}
.modal-header h2 {
    margin-bottom: 0;
    color: var(--primary-color);
}
.modal-close-btn {
    background: none;
    border: none;
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--color-text-muted);
    cursor: pointer;
}
.modal-body {
    padding: 2rem;
}
.modal-footer {
    padding: 1.5rem 2rem;
    background-color: var(--color-bg);
    border-top: 1px solid var(--color-border);
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}
/* 18. ======================================== */
/* تنسيق زر "إضافة" الدائم في Select2     */
/* (استبدل أي كود قديم لـ .select2-add-new) */
/* ======================================== */

/* (جديد) جعل القائمة المنسدلة مرنة (Flex) */
.select2-dropdown {
    direction: rtl;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    
    /* (جديد) هذا هو السر لجعل الزر يلتصق بالأسفل */
    display: flex;
    flex-direction: column;
}
/* (جديد) جعل قائمة النتائج تملأ المساحة المتاحة */
.select2-results {
    flex-grow: 1;
}

/* حاوية الزر */
.select2-add-new-btn-container {
    padding: 0.75rem;
    background-color: var(--color-bg);
    border-top: 1px solid var(--color-border);
    /* (جديد) يجعله في الأسفل */
    margin-top: auto; 
}

/* تصميم الزر نفسه */
.select2-add-new-btn {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    text-align: center;
    background-color: var(--accent-color);
    color: #FFF !important;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}
.select2-add-new-btn:hover {
    background-color: #256a2a;
}
/* 19. ======================================== */
/* تنسيق زر "+" بجوار القائمة المنسدلة       */
/* (v5 - Simpler Flex Approach) */
/* ======================================== */

.account-cell {
    display: flex;
    /* align-items: stretch; is the default, let's rely on it */
    gap: 0.5rem;
}

.account-cell .account-dropdown {
    flex-grow: 1; /* Take available space */
    width: auto !important;
    min-width: 150px;
    /* Let height be determined naturally by padding/font/border inherited */
}

.account-cell .add-account-btn {
    flex-shrink: 0; /* Don't shrink */
    width: auto;    /* Natural width */
    
    /* Remove explicit height/padding-top/bottom initially */
    /* Let's add minimal horizontal padding */
    padding-left: 0.8rem;
    padding-right: 0.8rem;

    /* (جديد) استخدام Flexbox داخل الزر لمحاذاة الـ "+" رأسياً */
    display: inline-flex;   /* Treat button like a flex container */
    align-items: center;    /* Center the '+' vertically */
    justify-content: center; /* Center the '+' horizontally (optional) */

    font-size: 1.1rem;
    font-weight: bold;
    /* line-height: 1; /* Removed for now, rely on flex alignment */

    background-color: var(--primary-color);
    color: #FFF;
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    box-sizing: border-box;
}
.account-cell .add-account-btn:hover {
     background-color: #1a4061;
}

/* Ensure consistent box-sizing */
.account-cell select,
.account-cell input,
.account-cell button {
    box-sizing: border-box;
}
/* زر ثانوي (مثل العودة أو إلغاء) */
.btn-secondary {
    background-color: var(--color-text-muted); /* رمادي */
    color: #FFF;
    border-color: var(--color-text-muted);
}
.btn-secondary:hover {
    background-color: #5a6268; /* أغمق قليلاً */
    border-color: #5a6268;
}
/* ======================================== */
/* قواعد الطباعة (@media print)            */
/* ======================================== */
@media print {
    /* إخفاء العناصر غير المرغوبة */
    .dashboard-header, 
    .dashboard-sidebar, 
    .company-submenu-container, 
    .form-actions,
    .btn {
        display: none !important; /* إخفاء تام */
    }

    /* تعديل تنسيق الكارت ليأخذ عرض الصفحة */
    .dashboard-content {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
    }
    .card {
        box-shadow: none !important;
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 0 !important;
    }

    /* (اختياري) تحسين مظهر الجدول للطباعة */
    .data-table, .data-table th, .data-table td {
        border: 1px solid #ccc !important; /* إضافة حدود واضحة */
    }
    .data-table thead th {
         background-color: #eee !important; /* خلفية خفيفة للهيدر */
    }
}
/* ======================================== */
/* 20. تنسيقات صفحة الفاتورة (النسخة البسيطة) */
/* ======================================== */

.invoice-table-simple {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}
.invoice-table-simple th,
.invoice-table-simple td {
    padding: 0.5rem;
    text-align: right;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}
.invoice-table-simple thead th {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-text-muted);
    background-color: var(--color-bg);
}
.invoice-table-simple .form-input,
.invoice-table-simple .form-select,
.invoice-table-simple .select2-container .select2-selection--single {
    width: 100%;
    padding: 0.75rem 1rem; /* استخدام الحجم القياسي */
    font-size: 1rem;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    height: auto;
}
.invoice-table-simple input[type="number"] { text-align: right; }
.invoice-table-simple .delete-invoice-row-btn {
    width: auto; padding: 0.25rem 0.5rem; font-size: 0.8rem; margin-top: 0.5rem;
}

/* تنسيق Select2 ليتطابق */
.invoice-table-simple .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: calc((0.75rem * 2) + 1.6rem); top: 0;
}

/* قسم الإجماليات (النسخة البسيطة) */
.invoice-totals-simple {
    width: 100%;
    max-width: 400px;
    margin-right: auto; /* لليمين (لأننا RTL) */
    margin-left: 0; /* (جديد) لضمان المحاذاة لليمين */
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 1.1rem;
}
.invoice-totals-simple div {
    display: flex; justify-content: space-between; margin-bottom: 0.75rem; color: var(--color-text-muted);
}
.invoice-totals-simple span:last-child { font-weight: bold; color: var(--color-text); }
.invoice-totals-simple .grand-total span {
    font-size: 1.4rem; font-weight: bold; color: var(--primary-color);
}