/* ============================================ */
/*  متغيرات الهوية (Brand Design Tokens)         */
/* ============================================ */
:root {
    /* ألوان الهوية الأساسية */
    --brand-purple: #6e369a;
    --brand-purple-dark: #57297c;
    --brand-purple-light: #d4b8e6;
    --brand-purple-soft: rgba(110, 54, 154, 0.08);
    --brand-purple-border: #e6d9f1;
    --brand-purple-bg: #faf7fd;
    --brand-purple-title-border: #f0e6f7;

    --brand-blue: #244db8;
    --brand-blue-dark: #193c96;

    /* ألوان الحالات */
    --color-success: #057a55;
    --color-success-soft: rgba(5, 122, 85, 0.12);
    --color-danger: #b42318;
    --color-danger-soft: rgba(180, 35, 24, 0.12);
    --color-warning: #e8a82f;
    --color-muted: #6b7280;
    --color-text: #1f2937;
    --color-text-secondary: #475467;
    --color-placeholder: #98a2b3;
    --color-border: #e5e7eb;
    --color-border-light: #f0f0f0;
    --color-bg: #f8f9fa;
    --color-white: #ffffff;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;

    /* Radius */
    --radius-sm: 0.3rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;

    /* Shadows */
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 10px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
    --shadow-modal: 0 12px 48px rgba(0, 0, 0, 0.18);

    /* Fonts */
    --font-ar: 'IBM Plex Sans Arabic', sans-serif;
    --font-riyal: 'SaudiRiyal', sans-serif;

    /* Transitions */
    --transition-fast: 0.15s;
    --transition-med: 0.25s;
}

body {
    background-color: var(--color-bg);
    font-family: var(--font-ar);
}

/* Brand tooltip (purple) */
.brand-tooltip .tooltip-inner {
    background-color: var(--brand-purple);
    font-size: 0.85rem;
    padding: 10px 14px;
    border-radius: 8px;
    max-width: 350px;
    text-align: right;
    line-height: 1.6;
}
.brand-tooltip .tooltip-arrow::before {
    border-bottom-color: var(--brand-purple);
}

@font-face {
  font-family: 'SaudiRiyal';
  src: url('SaudiRiyalFont.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

.sar {
  font-family: 'SaudiRiyal', sans-serif;
}

/* Field hint animations */
.field-hint {
  font-size: 0.85em;
  color: #888;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 2s ease, opacity 2s ease;
  padding: 0;
}
.field-hint.hint-visible {
  max-height: 60px;
  opacity: 1;
  padding-top: 4px;
}
.field-hint.hint-glow {
  animation: hintGlow 2s ease forwards;
}
@keyframes hintGlow {
  0%   { color: #244db8; }
  30%  { color: #6e369a; }
  70%  { color: #8b6baf; }
  100% { color: #888; }
}

.wizard-step {
    display: none;
}

.wizard-step.active {
    display: block;
}

.sidebar {
    height: calc(100vh - 65px);
    max-height: calc(100vh - 65px);
    background-color: #ffffff;
    color: #333333;
    padding: 1rem;
    border-left: 1px solid #dee2e6;
    transition: padding 0.25s ease;
    overflow-y: auto;
    position: sticky;
    top: 0;
}

/* Slim scrollbar for sidebar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: #bbb; }

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f0e6f7;
}

.sidebar-title {
    color: #6e369a;
    font-weight: 700;
    margin: 0;
    font-size: 1rem;
    transition: opacity 0.15s;
}

.sidebar-toggle-btn {
    background: transparent;
    border: 1px solid #e6d9f1;
    color: #6e369a;
    width: 32px;
    height: 32px;
    border-radius: 0.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    background-color: #6e369a;
    color: #ffffff;
    border-color: #6e369a;
}

.sidebar-toggle-btn i {
    font-size: 1rem;
}

.sidebar h5 {
    color: #6e369a;
    margin-bottom: 1rem;
}

.sidebar a {
    color: #333333;
    display: block;
    margin-bottom: 0.5rem;
    text-decoration: none;
    padding: 0.4rem 0.5rem;
    border-radius: 0.3rem;
    transition: background-color 0.2s;
}

.sidebar a:hover {
    background-color: rgba(110, 54, 154, 0.08);
    color: #6e369a;
}

.sidebar a i {
    margin-left: 0.5rem;
}

/* Active link highlight */
.sidebar a.active {
    background-color: rgba(110, 54, 154, 0.14);
    color: #6e369a;
    font-weight: 600;
}

.sidebar-submenu a.active {
    background-color: rgba(110, 54, 154, 0.18);
    color: #6e369a;
}

/* Section labels (small header between groups) */
.sidebar-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
    margin: 1rem 0.5rem 0.35rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid #e6d9f1;
    letter-spacing: 0.03em;
}

body.sidebar-collapsed .sidebar-section-label {
    display: none;
}

/* Super-admin link — distinct styling */
.sidebar-superadmin {
    background-color: rgba(26, 13, 41, 0.04) !important;
    border: 1px solid #1a0d29;
    color: #1a0d29 !important;
}

.sidebar-superadmin:hover {
    background-color: #1a0d29 !important;
    color: #ffffff !important;
}

.sidebar-superadmin i {
    color: inherit;
}

/* القوائم الفرعية */
.sidebar-group {
    margin-bottom: 0.25rem;
}

.sidebar-toggle {
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    position: relative;
}

.sidebar-arrow {
    margin-right: auto;
    margin-left: 0 !important;
    font-size: 0.7rem;
    transition: transform 0.25s;
}

.sidebar-group.open > .sidebar-toggle .sidebar-arrow {
    transform: rotate(180deg);
}

.sidebar-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-group.open > .sidebar-submenu {
    max-height: 500px;
}

.sidebar-submenu a {
    padding-right: 2rem !important;
    font-size: 0.9rem;
    color: #555555 !important;
    margin-bottom: 0.2rem !important;
}

.sidebar-submenu a:hover {
    background-color: rgba(110, 54, 154, 0.08);
    color: #6e369a !important;
}

.sidebar-divider {
    display: block;
    height: 1px;
    background: #e9ecef;
    margin: 0.4rem 1.5rem 0.4rem 0.5rem;
}

.sidebar-logout {
    margin-top: 1rem;
    border-top: 1px solid #dee2e6;
    padding-top: 0.75rem !important;
    color: #dc3545 !important;
}

.sidebar-logout:hover {
    background-color: #fff5f5 !important;
}

.remove-row {
    cursor: pointer;
    color: #b42318;
    font-size: 1.1rem;
    transition: color 0.15s, transform 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 0.3rem;
}

.remove-row:hover {
    color: #ffffff;
    background-color: #b42318;
    transform: scale(1.05);
}

.btn-add-row {
    width: 100%;
    border: 2px dashed #6e369a;
    background-color: transparent;
    color: #6e369a;
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.btn-add-row:hover,
.btn-add-row:focus {
    background-color: rgba(110, 54, 154, 0.08);
    border-color: #57297c;
    color: #57297c;
}

.btn-add-row i {
    margin-left: 0.4rem;
}

/* ============================================ */
/*  جدول بنود عرض السعر — رأس برانديا           */
/* ============================================ */
.quote-items-table thead.brand-head th {
    background-color: rgba(110, 54, 154, 0.08);
    color: #6e369a;
    font-weight: 700;
    border-bottom: 2px solid #6e369a !important;
    font-size: 0.9rem;
    padding: 0.75rem 0.5rem;
}

.quote-items-table tbody tr {
    transition: background-color 0.15s;
}

.quote-items-table tbody tr:hover {
    background-color: #fafafa;
}

.quote-items-table tbody td {
    vertical-align: middle;
    padding: 0.6rem 0.5rem;
}

.quote-items-table tbody td.index {
    color: #6e369a;
    font-weight: 700;
    text-align: center;
}

/* ============================================ */
/*  بطاقة ملخص العرض                            */
/* ============================================ */
.summary-card {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    margin-top: 1.5rem;
}

.summary-card-header {
    background-color: rgba(110, 54, 154, 0.06);
    color: #6e369a;
    font-weight: 700;
    font-size: 1rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid #f0e6f7;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.summary-card-header i {
    font-size: 1.15rem;
}

.summary-card-body {
    padding: 1.25rem 1.5rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.55rem 0;
    font-size: 0.95rem;
    color: #475467;
}

.summary-row .summary-label {
    font-weight: 500;
}

.summary-row .summary-value {
    font-weight: 600;
    color: #1f2937;
    font-variant-numeric: tabular-nums;
}

.summary-row.deduction .summary-value {
    color: #b42318;
}

.summary-row.subtotal {
    border-top: 1px dashed #e5e7eb;
    padding-top: 0.85rem;
    margin-top: 0.25rem;
    font-weight: 600;
}

.summary-row.subtotal .summary-label,
.summary-row.subtotal .summary-value {
    color: #1f2937;
}

.summary-final {
    margin-top: 1rem;
    background: linear-gradient(135deg, #6e369a 0%, #244db8 100%);
    color: #ffffff;
    border-radius: 0.6rem;
    padding: 1.1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 16px rgba(110, 54, 154, 0.25);
}

.summary-final-label {
    font-size: 1rem;
    font-weight: 600;
    opacity: 0.95;
}

.summary-final-value {
    font-size: 2rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.summary-final-value .sar {
    font-size: 1.5rem;
    margin-right: 0.25rem;
}

/* ============================================ */
/*  بطاقة اختيار العميل                          */
/* ============================================ */
.client-card {
    background-color: #faf7fd;
    border: 1px solid #e6d9f1;
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.client-card.is-invalid {
    border-color: #dc3545;
    background-color: #fff5f5;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.client-card-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6e369a;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.client-card-label i {
    font-size: 1.3rem;
}

.client-card-label .required {
    color: #dc3545;
    font-size: 1.1rem;
}

.client-card-controls {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.client-card-controls .form-select {
    flex: 1;
    min-height: 42px;
    border: 1px solid #d4b8e6;
    background-color: #ffffff;
}

.client-card-controls .form-select:focus {
    border-color: #6e369a;
    box-shadow: 0 0 0 0.2rem rgba(110, 54, 154, 0.15);
}

.client-card-controls .btn-new-client {
    background-color: #ffffff;
    color: #6e369a;
    border: 1px solid #6e369a;
    padding: 0 1rem;
    white-space: nowrap;
    font-weight: 600;
    transition: background-color 0.15s, color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.client-card-controls .btn-new-client:hover {
    background-color: #6e369a;
    color: #ffffff;
}

/* معاينة معلومات العميل بعد الاختيار */
.client-info-preview {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    background-color: #ffffff;
    border-radius: 0.5rem;
    border: 1px solid #e6d9f1;
    display: none;
}

.client-info-preview.show {
    display: block;
    animation: fadeInDown 0.25s ease;
}

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

.client-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem 1.5rem;
}

.client-info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #475467;
}

.client-info-item i {
    color: #6e369a;
    font-size: 1rem;
    flex-shrink: 0;
}

.client-info-item .info-label {
    color: #98a2b3;
    margin-left: 0.25rem;
}

.client-info-item .info-value {
    color: #1f2937;
    font-weight: 600;
    word-break: break-word;
}

.client-info-item.placeholder {
    color: #cbd5e0;
}

.client-info-item.placeholder .info-value {
    color: #cbd5e0;
    font-weight: 400;
    font-style: italic;
}

.client-card-error {
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    display: none;
}

.client-card.is-invalid .client-card-error {
    display: block;
}

/* ============================================ */
/*  أقسام النماذج (Form Sections)               */
/* ============================================ */
.form-section {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.form-section-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #6e369a;
    font-weight: 700;
    font-size: 1.05rem;
    padding-bottom: 0.85rem;
    margin-bottom: 1.1rem;
    border-bottom: 1px solid #f0e6f7;
}

.form-section-title i {
    font-size: 1.25rem;
}

.form-section-title .section-hint {
    color: #98a2b3;
    font-weight: 400;
    font-size: 0.85rem;
    margin-right: auto;
}

/* Label عام مع أيقونة ونجمة مطلوب */
.field-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: #475467;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.4rem;
}

.field-label i {
    color: #98a2b3;
    font-size: 0.95rem;
}

.field-label .required {
    color: #dc3545;
    font-weight: 700;
}

/* تحسين الإدخالات */
.form-section .form-control,
.form-section .form-select {
    min-height: 42px;
    border: 1px solid #d1d5db;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-section .form-control:focus,
.form-section .form-select:focus {
    border-color: #6e369a;
    box-shadow: 0 0 0 0.2rem rgba(110, 54, 154, 0.12);
}

.form-section textarea.form-control {
    min-height: 90px;
}

.form-section .form-text {
    font-size: 0.78rem;
    color: #98a2b3;
    margin-top: 0.25rem;
}

/* عنوان الصفحة الكبير */
.page-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.85rem;
    border-bottom: 2px solid #f0e6f7;
}

/* أيقونة العنوان فقط (الابن المباشر) — وليس الأيقونات داخل الأزرار */
.page-header > i {
    color: #6e369a;
    font-size: 1.8rem;
}

.page-header h3 {
    color: #1f2937;
    margin: 0;
    font-weight: 700;
    font-size: 1.5rem;
}

.page-header .header-subtitle {
    color: #98a2b3;
    font-size: 0.9rem;
    margin-right: auto;
}

/* ============================================ */
/*  جداول القوائم البراندية (List Tables)       */
/* ============================================ */
.list-table thead th,
.clients-table thead.brand-head th {
    background-color: rgba(110, 54, 154, 0.08) !important;
    color: #6e369a !important;
    font-weight: 700;
    border-bottom: 2px solid #6e369a !important;
    font-size: 0.9rem;
    padding: 0.85rem 0.6rem;
}

.list-table tbody tr,
.clients-table.has-hover tbody tr {
    transition: background-color 0.15s;
}

.list-table tbody tr:hover,
.clients-table.has-hover tbody tr:hover {
    background-color: #faf7fd;
}

.list-table tbody td {
    vertical-align: middle;
    padding: 0.7rem 0.6rem;
}

/* ============================================ */
/*  Empty State (لا توجد نتائج)                  */
/* ============================================ */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #98a2b3;
}

.empty-state i {
    font-size: 3rem;
    color: #d4b8e6;
    display: block;
    margin-bottom: 0.5rem;
}

.empty-state-title {
    font-size: 1rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.empty-state-text {
    font-size: 0.875rem;
    color: #98a2b3;
}

/* للاستخدام داخل tr عند جدول فارغ */
.empty-state-row td {
    background-color: #fafafa;
}

/* ============================================ */
/*  أزرار الإجراءات في الجداول (Action Buttons) */
/* ============================================ */
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 0.35rem;
    border: 1px solid transparent;
    background-color: transparent;
    transition: all 0.15s;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn-action i {
    font-size: 0.95rem;
}

.btn-action-view {
    color: #6e369a;
    border-color: #d4b8e6;
}
.btn-action-view:hover {
    background-color: #6e369a;
    color: #ffffff;
    border-color: #6e369a;
}

.btn-action-edit {
    color: #244db8;
    border-color: #b8c8e6;
}
.btn-action-edit:hover {
    background-color: #244db8;
    color: #ffffff;
    border-color: #244db8;
}

.btn-action-delete {
    color: #b42318;
    border-color: #fcc;
}
.btn-action-delete:hover {
    background-color: #b42318;
    color: #ffffff;
    border-color: #b42318;
}

.btn-action-download {
    color: #057a55;
    border-color: #b8e6c8;
}
.btn-action-download:hover {
    background-color: #057a55;
    color: #ffffff;
    border-color: #057a55;
}

/* ============================================ */
/*  Badges برانديا                                */
/* ============================================ */
.badge-brand {
    background-color: #6e369a;
    color: #ffffff;
    font-weight: 600;
    padding: 0.35em 0.7em;
    border-radius: 0.35rem;
}

.badge-brand-blue {
    background-color: #244db8;
    color: #ffffff;
    font-weight: 600;
    padding: 0.35em 0.7em;
    border-radius: 0.35rem;
}

.badge-brand-soft {
    background-color: rgba(110, 54, 154, 0.1);
    color: #6e369a;
    font-weight: 600;
    padding: 0.35em 0.7em;
    border-radius: 0.35rem;
}

.badge-status-active {
    background-color: rgba(5, 122, 85, 0.12);
    color: #057a55;
    font-weight: 600;
    padding: 0.35em 0.7em;
    border-radius: 0.35rem;
}

.badge-status-archived {
    background-color: rgba(107, 114, 128, 0.12);
    color: #6b7280;
    font-weight: 600;
    padding: 0.35em 0.7em;
    border-radius: 0.35rem;
}

.badge-status-paid {
    background-color: rgba(5, 122, 85, 0.12);
    color: #057a55;
    font-weight: 600;
    padding: 0.35em 0.7em;
    border-radius: 0.35rem;
}

.badge-status-unpaid {
    background-color: rgba(180, 35, 24, 0.1);
    color: #b42318;
    font-weight: 600;
    padding: 0.35em 0.7em;
    border-radius: 0.35rem;
}

.badge-status-cancelled {
    background-color: rgba(180, 35, 24, 0.12);
    color: #b42318;
    font-weight: 600;
    padding: 0.35em 0.7em;
    border-radius: 0.35rem;
    text-decoration: line-through;
}

.invoice-cancelled-row {
    opacity: 0.62;
}

.badge-status-creditnote {
    background-color: rgba(110, 54, 154, 0.12);
    color: #6e369a;
    font-weight: 600;
    padding: 0.35em 0.7em;
    border-radius: 0.35rem;
}

.credit-note-row {
    background-color: rgba(110, 54, 154, 0.04);
}

.badge-role-admin {
    background-color: #6e369a;
    color: #ffffff;
    font-weight: 600;
    padding: 0.35em 0.7em;
    border-radius: 0.35rem;
}

.badge-role-user {
    background-color: rgba(110, 54, 154, 0.1);
    color: #6e369a;
    font-weight: 600;
    padding: 0.35em 0.7em;
    border-radius: 0.35rem;
}

/* ============================================ */
/*  شريط البحث/الفلترة (Filter Bar)              */
/* ============================================ */
.filter-bar {
    background-color: #faf7fd;
    border: 1px solid #e6d9f1;
    border-radius: 0.6rem;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}

.filter-bar .form-control,
.filter-bar .form-select {
    min-height: 36px;
    border: 1px solid #d4b8e6;
    background-color: #ffffff;
}

.filter-bar .form-control:focus,
.filter-bar .form-select:focus {
    border-color: #6e369a;
    box-shadow: 0 0 0 0.15rem rgba(110, 54, 154, 0.12);
}

/* ============================================ */
/*  مودال إنشاء ملحق العقد — scrollable          */
/* ============================================ */
#createAddendumModal .modal-dialog {
    max-width: 1140px !important;
    width: 95vw !important;
    margin: 1rem auto !important;
}

#createAddendumModal .modal-content {
    max-height: calc(100vh - 2rem) !important;
}

#createAddendumModal .modal-body {
    max-height: calc(100vh - 220px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* ============================================ */
/*  رؤوس جداول قابلة للترتيب (Sortable Headers)  */
/* ============================================ */
th.sortable-th {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.15s;
    white-space: nowrap;
}

th.sortable-th:hover {
    background-color: rgba(110, 54, 154, 0.14) !important;
}

/* أيقونة السهم بعد النص */
th.sortable-th::after {
    content: "\2195";  /* ↕ سهم محايد */
    display: inline-block;
    margin-inline-start: 0.35rem;
    font-size: 0.85em;
    opacity: 0.35;
    color: #6e369a;
    transition: opacity 0.15s;
}

th.sortable-th.sort-asc::after {
    content: "\2191";  /* ↑ */
    opacity: 1;
    font-weight: bold;
}

th.sortable-th.sort-desc::after {
    content: "\2193";  /* ↓ */
    opacity: 1;
    font-weight: bold;
}

/* تمييز العمود النشط بخلفية أقوى قليلاً */
th.sortable-th.sort-asc,
th.sortable-th.sort-desc {
    background-color: rgba(110, 54, 154, 0.18) !important;
    color: #6e369a !important;
}

/* ============================================ */
/*  صفوف الخدمات الفرعية (child rows)            */
/*  تظهر بإزاحة بسيطة وخلفية خفيفة تحت الأم      */
/* ============================================ */
tr.service-child-row > td {
    background-color: #faf7fd;
    border-top: 1px dashed #e6d9f1;
}

tr.service-child-row > td:first-child {
    text-align: center;
    color: #98a2b3;
}

.service-child-indent {
    display: inline-block;
    width: 1.5rem;
    height: 0.9rem;
    margin-inline-end: 0.35rem;
    border-inline-end: 2px solid #d4b8e6;
    border-bottom: 2px solid #d4b8e6;
    border-bottom-right-radius: 0.35rem;
    vertical-align: middle;
}
html[dir="rtl"] .service-child-indent {
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0.35rem;
}

.badge-prereq {
    display: inline-block;
    background-color: rgba(110, 54, 154, 0.12);
    color: #6e369a;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 0.35rem;
    margin-inline-start: 0.35rem;
    white-space: nowrap;
}

.badge-prereq i {
    font-size: 0.75rem;
    margin-inline-end: 0.15rem;
}

/* ============================================ */
/*  قائمة ملاحق العقد (داخل جدول العقود)         */
/* ============================================ */
.addendums-sublist {
    background-color: #faf7fd;
    border: 1px solid #e6d9f1;
    border-radius: 0.5rem;
    padding: 0.5rem 0.85rem;
    margin: 0.25rem 0;
}

.addendum-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.5rem 0.25rem;
    border-bottom: 1px dashed #e6d9f1;
}

.addendum-item-row:last-child {
    border-bottom: none;
}

.addendum-item-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: #475467;
}

.addendum-badge {
    display: inline-block;
    background-color: #6e369a;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 0.3rem;
}

.addendum-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: #6b7280;
    font-size: 0.78rem;
}

.addendum-meta i {
    color: #98a2b3;
    font-size: 0.85rem;
}

.addendum-item-actions {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

/* ============================================ */
/*  مودال معاينة الفواتير — حجم A4               */
/* ============================================ */
/* A4 = 210mm × 297mm */
.invoice-preview-modal .modal-dialog {
    max-width: calc(210mm + 4rem);
    width: 100%;
    margin: 1rem auto;
}

.invoice-preview-modal .modal-content {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
}

.invoice-preview-modal .modal-header {
    background-color: #faf7fd;
    border-bottom: 2px solid #f0e6f7;
    padding: 0.85rem 1.25rem;
}

.invoice-preview-modal .modal-title {
    color: #6e369a;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.invoice-preview-modal .modal-title i {
    font-size: 1.2rem;
}

.invoice-preview-modal .modal-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-inline-start: auto;
    margin-inline-end: 0.75rem;
}

/* جسم المودال: يحوي iframe بحجم A4 على خلفية رمادية */
.invoice-preview-modal .modal-body {
    padding: 1.5rem;
    background-color: #e5e7eb;
    height: calc(100vh - 180px);
    min-height: 600px;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* الـ iframe بحجم A4 الفعلي */
.invoice-preview-iframe {
    width: 210mm;
    min-height: 297mm;
    border: none;
    background-color: #ffffff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    display: block;
}

.invoice-preview-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 297mm;
    color: #6e369a;
    font-weight: 600;
    gap: 0.5rem;
    background-color: #ffffff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.invoice-preview-loading .spinner-border {
    width: 1.5rem;
    height: 1.5rem;
    color: #6e369a;
}

.invoice-preview-modal .modal-footer {
    background-color: #faf7fd;
    border-top: 1px solid #f0e6f7;
    padding: 0.75rem 1.25rem;
}

/* ============================================ */
/*  جدول الخدمات — خلية بسطرين                   */
/* ============================================ */
.cell-stack {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.cell-stack .primary {
    font-weight: 700;
    color: #1f2937;
    font-size: 0.9rem;
    line-height: 1.3;
    word-wrap: break-word;
}

.cell-stack .secondary {
    font-size: 0.75rem;
    color: #98a2b3;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.cell-stack .secondary i {
    font-size: 0.85rem;
}

/* شبكة اسعار مدمجة في خلية واحدة */
.price-grid {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 130px;
}

.price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.78rem;
    line-height: 1.2;
}

.price-row .price-label {
    color: #6b7280;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.price-row .price-label i {
    color: #6e369a;
    font-size: 0.85rem;
}

.price-row .price-value {
    font-weight: 700;
    color: #1f2937;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.price-row.is-empty .price-value {
    color: #cbd5e0;
    font-weight: 400;
}

.price-row.is-primary .price-value {
    color: #6e369a;
    font-size: 0.88rem;
}

/* ============================================ */
/*  زر 3 نقاط (Actions Dropdown)                 */
/* ============================================ */
.btn-action-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    background-color: transparent;
    border: 1px solid #e5e7eb;
    border-radius: 0.35rem;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-action-more:hover,
.btn-action-more.show {
    background-color: #6e369a;
    color: #ffffff;
    border-color: #6e369a;
}

.btn-action-more i {
    font-size: 1rem;
}

.actions-dropdown-menu {
    min-width: 160px;
    border: 1px solid #e6d9f1;
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    padding: 0.3rem;
}

.actions-dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.7rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 0.3rem;
    color: #475467;
    transition: background-color 0.15s, color 0.15s;
}

.actions-dropdown-menu .dropdown-item i {
    font-size: 0.95rem;
    color: #98a2b3;
    transition: color 0.15s;
}

.actions-dropdown-menu .dropdown-item:hover,
.actions-dropdown-menu .dropdown-item:focus {
    background-color: rgba(110, 54, 154, 0.08);
    color: #6e369a;
}

.actions-dropdown-menu .dropdown-item:hover i,
.actions-dropdown-menu .dropdown-item:focus i {
    color: #6e369a;
}

.actions-dropdown-menu .dropdown-item.is-danger {
    color: #b42318;
}

.actions-dropdown-menu .dropdown-item.is-danger i {
    color: #b42318;
}

.actions-dropdown-menu .dropdown-item.is-danger:hover {
    background-color: rgba(180, 35, 24, 0.08);
    color: #8a1a12;
}

.actions-dropdown-menu .dropdown-divider {
    margin: 0.25rem 0;
    border-color: #f0e6f7;
}

/* ============================================ */
/*  رسائل خطأ inline تحت الحقول                  */
/* ============================================ */
.field-error {
    display: none;
    align-items: center;
    gap: 0.35rem;
    color: #b42318;
    font-size: 0.78rem;
    font-weight: 600;
    margin-top: 0.4rem;
    animation: fieldErrorIn 0.2s ease;
}

.field-error.show {
    display: flex;
}

.field-error i {
    font-size: 0.9rem;
    flex-shrink: 0;
}

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

/* تلوين الحقل عند الخطأ */
.form-control.field-invalid,
.form-select.field-invalid {
    border-color: #b42318 !important;
    background-color: #fff5f5;
}

.form-control.field-invalid:focus,
.form-select.field-invalid:focus {
    box-shadow: 0 0 0 0.2rem rgba(180, 35, 24, 0.12) !important;
}

/* تلوين input-group عند الخطأ */
.input-group:has(.field-invalid) .input-group-text {
    border-color: #b42318;
    background-color: #fff5f5;
    color: #b42318;
}

/* تلوين البطاقات والاقسام عند الخطأ */
.service-type-selector.is-invalid .service-type-option {
    border-color: #fcc;
}

.period-card.field-invalid {
    border-color: #b42318;
    background-color: #fff5f5;
}

.period-card.field-invalid .period-card-icon {
    background-color: #fff5f5;
    color: #b42318;
}

/* صندوق ملخص الاخطاء العام (اعلى النموذج) */
.error-summary {
    display: none;
    background-color: #fff5f5;
    border: 1px solid #fcc;
    border-right: 4px solid #b42318;
    border-radius: 0.5rem;
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
    color: #8a1a12;
}

.error-summary.show {
    display: block;
    animation: fieldErrorIn 0.25s ease;
}

.error-summary-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.92rem;
    margin-bottom: 0.4rem;
}

.error-summary-title i {
    font-size: 1.05rem;
    color: #b42318;
}

.error-summary ul {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.83rem;
}

.error-summary ul li {
    padding: 0.15rem 0;
    padding-inline-start: 1.2rem;
    position: relative;
}

.error-summary ul li::before {
    content: "•";
    position: absolute;
    inset-inline-start: 0;
    color: #b42318;
    font-weight: 700;
}

/* ============================================ */
/*  محدد نوع الخدمة (Service Type Selector)     */
/* ============================================ */
.service-type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}

.service-type-option {
    position: relative;
    background-color: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 0.65rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.service-type-option:hover {
    border-color: #d4b8e6;
    background-color: #faf7fd;
}

.service-type-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.service-type-option .type-radio {
    width: 22px;
    height: 22px;
    border: 2px solid #cbd5e0;
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
    transition: border-color 0.2s;
}

.service-type-option .type-radio::after {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background-color: #6e369a;
    transform: scale(0);
    transition: transform 0.2s ease;
}

.service-type-option.is-selected {
    border-color: #6e369a;
    background-color: #faf7fd;
    box-shadow: 0 2px 10px rgba(110, 54, 154, 0.12);
}

.service-type-option.is-selected .type-radio {
    border-color: #6e369a;
}

.service-type-option.is-selected .type-radio::after {
    transform: scale(1);
}

.service-type-option .type-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.45rem;
    background-color: rgba(110, 54, 154, 0.1);
    color: #6e369a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.service-type-option.is-selected .type-icon {
    background-color: #6e369a;
    color: #ffffff;
}

.service-type-option .type-icon i {
    font-size: 1.3rem;
}

.service-type-option .type-text {
    flex: 1;
}

.service-type-option .type-title {
    font-weight: 700;
    color: #1f2937;
    font-size: 1rem;
    margin: 0 0 0.2rem 0;
}

.service-type-option .type-desc {
    font-size: 0.78rem;
    color: #98a2b3;
    margin: 0;
}

/* ============================================ */
/*  السعر المفرد (مرة واحدة) — single price input*/
/* ============================================ */
.once-price-section {
    display: none;
    background-color: #faf7fd;
    border: 1px solid #e6d9f1;
    border-radius: 0.65rem;
    padding: 1.1rem 1.25rem;
}

.once-price-section.show {
    display: block;
    animation: suggestionFadeIn 0.25s ease;
}

.once-price-section .field-label {
    margin-bottom: 0.6rem;
}

.once-price-section .input-group {
    max-width: 320px;
}

.once-price-section .input-group-text {
    background-color: #ffffff;
    border-color: #d4b8e6;
    color: #6e369a;
    font-weight: 700;
}

.once-price-section .form-control {
    border-color: #d4b8e6;
    font-weight: 600;
    font-size: 1rem;
}

.once-price-section .form-control:focus {
    border-color: #6e369a;
    box-shadow: 0 0 0 0.2rem rgba(110, 54, 154, 0.12);
}

/* ============================================ */
/*  البطاقات المتكررة — حاوية منفصلة              */
/* ============================================ */
.recurring-section {
    display: none;
}

.recurring-section.show {
    display: block;
    animation: suggestionFadeIn 0.25s ease;
}

/* ============================================ */
/*  بطاقات الفترات + الأسعار (Period Cards)      */
/* ============================================ */
.period-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
}

/* على الاجهزة الاقل من 992px: عمودين */
@media (max-width: 991px) {
    .period-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* على الموبايل: عمود واحد */
@media (max-width: 575px) {
    .period-cards {
        grid-template-columns: 1fr;
    }
}

.period-card {
    background-color: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 0.65rem;
    padding: 1rem 1.1rem;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
}

.period-card:hover {
    border-color: #d4b8e6;
    background-color: #faf7fd;
}

.period-card.is-active {
    border-color: #6e369a;
    background-color: #faf7fd;
    box-shadow: 0 2px 8px rgba(110, 54, 154, 0.1);
}

.period-card-header {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 0.5rem;
}

/* الـ toggle switch يصير في اقصى اليسار (نهاية السطر في RTL) */
.period-card-header .toggle-switch {
    margin-inline-start: auto;
}

/* ===== Toggle Switch الاكشخ ===== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    margin: 0;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-switch .slider {
    position: absolute;
    inset: 0;
    background-color: #cbd5e0;
    transition: background-color 0.25s ease;
    border-radius: 24px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toggle-switch .slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    inset-inline-start: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: inset-inline-start 0.25s ease, box-shadow 0.2s ease;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .slider {
    background-color: #6e369a;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle-switch input:checked + .slider::before {
    inset-inline-start: 23px;
    box-shadow: 0 2px 6px rgba(110, 54, 154, 0.35);
}

.toggle-switch input:focus-visible + .slider {
    box-shadow: 0 0 0 3px rgba(110, 54, 154, 0.2);
}

.period-card-icon {
    width: 32px;
    height: 32px;
    border-radius: 0.4rem;
    background-color: rgba(110, 54, 154, 0.1);
    color: #6e369a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.period-card.is-active .period-card-icon {
    background-color: #6e369a;
    color: #ffffff;
}

.period-card-icon i {
    font-size: 1rem;
}

.period-card-label {
    flex: 1;
    font-weight: 700;
    color: #1f2937;
    font-size: 0.95rem;
    cursor: pointer;
    margin: 0;
}

.period-card-body {
    margin-top: 0.5rem;
    /* حالة الاخفاء الافتراضية عند عدم التفعيل */
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease, margin-top 0.2s ease;
}

.period-card.is-active .period-card-body {
    max-height: 400px;
    opacity: 1;
    margin-top: 0.5rem;
}

.period-card-body .input-group {
    border-radius: 0.4rem;
    overflow: hidden;
}

.period-card-body .input-group-text {
    background-color: #faf7fd;
    border-color: #d4b8e6;
    color: #6e369a;
    font-weight: 700;
}

.period-card-body .form-control {
    border-color: #d4b8e6;
    font-weight: 600;
    font-size: 1rem;
    text-align: left;
    direction: ltr;
}

.period-card-body .form-control:focus {
    border-color: #6e369a;
    box-shadow: 0 0 0 0.2rem rgba(110, 54, 154, 0.12);
}

.period-card-body .form-text-hint {
    font-size: 0.75rem;
    color: #98a2b3;
    margin-top: 0.35rem;
    display: block;
}

/* السعر المقترح — تخطيط عمودي مدمج مناسب لبطاقات صغيرة */
.price-suggestion {
    display: none;
    margin-top: 0.55rem;
    padding: 0.6rem 0.7rem;
    background-color: rgba(36, 77, 184, 0.06);
    border: 1px dashed #244db8;
    border-radius: 0.45rem;
    font-size: 0.75rem;
    color: #244db8;
    animation: suggestionFadeIn 0.25s ease;
}

.price-suggestion.show {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

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

/* السطر الأول: ايقونة + "مقترح: X ﷼" */
.price-suggestion .suggestion-main {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 500;
}

.price-suggestion .suggestion-main > i {
    color: #244db8;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.price-suggestion .suggestion-value {
    font-weight: 800;
    font-size: 0.88rem;
    color: #193c96;
}

/* السطر الثاني: بادج الإجمالي السنوي */
.price-suggestion .suggestion-total {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.55rem;
    background-color: rgba(36, 77, 184, 0.1);
    border-radius: 0.3rem;
    font-size: 0.7rem;
    color: #244db8;
    font-weight: 500;
}

.price-suggestion .suggestion-total i {
    font-size: 0.85rem;
    color: #244db8;
    flex-shrink: 0;
}

.price-suggestion .suggestion-total-value {
    font-weight: 800;
    color: #193c96;
    font-size: 0.78rem;
}

/* السطر الثالث: زر التطبيق */
.price-suggestion .apply-suggestion {
    background-color: #244db8;
    color: #ffffff;
    border: none;
    padding: 0.35rem 0.75rem;
    border-radius: 0.35rem;
    font-size: 0.73rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s;
    white-space: nowrap;
    width: 100%;
}

.price-suggestion .apply-suggestion:hover {
    background-color: #193c96;
}

.price-suggestion .apply-suggestion i {
    font-size: 0.72rem;
    margin-left: 0.2rem;
}

/* حالة الخطأ (اذا لم يُفعّل أي خيار) */
.period-cards.is-invalid .period-card {
    border-color: #fcc;
}

.period-cards-error {
    display: none;
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.period-cards.is-invalid + .period-cards-error {
    display: block;
}

/* ============================================ */
/*  القائمة الجانبية المطوية (Collapsed Sidebar)*/
/* ============================================ */

/* انتقال سلس لعرض السايدبار والمحتوى */
.sidebar {
    transition: all 0.25s ease;
}

body .col-md-2:has(> .sidebar),
body .col-md-2:has(> #mainSidebar) {
    transition: all 0.25s ease;
}

/* ===== وضع التوسيع (الافتراضي) ===== */
.sidebar-label {
    display: inline;
}

/* ===== وضع الطي ===== */
body.sidebar-collapsed .col-md-2 {
    flex: 0 0 auto !important;
    width: 70px !important;
    max-width: 70px !important;
    transition: all 0.25s ease;
}

body.sidebar-collapsed .col-md-10 {
    flex: 0 0 auto !important;
    width: calc(100% - 70px) !important;
    max-width: calc(100% - 70px) !important;
    transition: all 0.25s ease;
}

body.sidebar-collapsed .sidebar {
    padding: 0.75rem 0.4rem;
}

body.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding-bottom: 0.5rem;
}

body.sidebar-collapsed .sidebar-title {
    display: none;
}

/* اخفاء النصوص وابقاء الايقونات */
body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .sidebar-arrow {
    display: none !important;
}

/* توسيط الايقونات */
body.sidebar-collapsed .sidebar > a,
body.sidebar-collapsed .sidebar-group > .sidebar-toggle {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.65rem 0.25rem;
    margin-bottom: 0.35rem;
    position: relative;
}

body.sidebar-collapsed .sidebar > a i,
body.sidebar-collapsed .sidebar-group > .sidebar-toggle i {
    font-size: 1.35rem;
    margin: 0;
}

/* اخفاء الـ submenu في وضع الطي (سنعرضها كـ flyout عند hover) */
body.sidebar-collapsed .sidebar-submenu {
    display: none;
}

/* ===== Tooltip للعناصر البسيطة عند hover ===== */
body.sidebar-collapsed .sidebar a[data-title]:hover::after {
    content: attr(data-title);
    position: absolute;
    left: auto;
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background-color: #1f2937;
    color: #ffffff;
    padding: 0.4rem 0.75rem;
    border-radius: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    z-index: 1050;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* سهم صغير للـ tooltip */
body.sidebar-collapsed .sidebar a[data-title]:hover::before {
    content: "";
    position: absolute;
    right: calc(100% + 2px);
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: #1f2937;
    z-index: 1050;
    pointer-events: none;
}

/* ===== Flyout للـ sidebar-group عند hover ===== */
body.sidebar-collapsed .sidebar-group {
    position: relative;
}

body.sidebar-collapsed .sidebar-group:hover .sidebar-submenu {
    display: block;
    position: absolute;
    right: calc(100% + 8px);
    top: 0;
    min-width: 200px;
    max-height: none;
    background-color: #ffffff;
    border: 1px solid #e6d9f1;
    border-radius: 0.5rem;
    padding: 0.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1050;
    overflow: visible;
}

body.sidebar-collapsed .sidebar-group:hover .sidebar-submenu a {
    padding: 0.55rem 0.75rem !important;
    margin-bottom: 0.2rem !important;
    border-radius: 0.3rem;
    font-size: 0.9rem;
    color: #333 !important;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.5rem;
}

body.sidebar-collapsed .sidebar-group:hover .sidebar-submenu a .sidebar-label {
    display: inline !important;
}

body.sidebar-collapsed .sidebar-group:hover .sidebar-submenu a:hover {
    background-color: rgba(110, 54, 154, 0.08);
    color: #6e369a !important;
}

/* اخفاء tooltip للـ sidebar-group (يكفي الـ flyout) */
body.sidebar-collapsed .sidebar-group .sidebar-toggle[data-title]:hover::after,
body.sidebar-collapsed .sidebar-group .sidebar-toggle[data-title]:hover::before {
    display: none;
}

/* زر التوسيع يصير ايقونة توسيع */
body.sidebar-collapsed #sidebarToggleBtn i::before {
    content: "\F3D2"; /* bi-layout-sidebar-inset-reverse */
}

/* ===== على الموبايل: دائما موسّع (الـ collapse مو مفيد) ===== */
@media (max-width: 767px) {
    body.sidebar-collapsed .col-md-2,
    body.sidebar-collapsed .col-md-10 {
        width: auto !important;
        max-width: 100% !important;
        flex: 0 0 auto !important;
    }
    body.sidebar-collapsed .sidebar-label,
    body.sidebar-collapsed .sidebar-arrow {
        display: inline !important;
    }
    body.sidebar-collapsed .sidebar-title {
        display: block !important;
    }
}

.wizard-box {
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.wizard-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.wizard-steps .step {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    border-bottom: 3px solid #dee2e6;
    font-weight: bold;
    color: #6c757d;
}

.wizard-steps .step.active {
    border-bottom: 3px solid #6e369a;
    color: #6e369a;
}

#overallDiscount {
    max-width: 80px;
    display: inline-block;
}

.total {
    display: inline-block;
    width: 100%;
    text-align: center;
}

.btn-add-client,
.btn-brand {
    background-color: #6e369a;
    color: #ffffff;
    border-color: #6e369a;
    transition: background-color 0.2s, border-color 0.2s;
}

.btn-add-client:hover,
.btn-brand:hover,
.btn-brand:focus {
    background-color: #57297c;
    border-color: #57297c;
    color: #ffffff;
}

.btn-brand-blue {
    background-color: #244db8;
    color: #ffffff;
    border-color: #244db8;
    transition: background-color 0.2s, border-color 0.2s;
}

.btn-brand-blue:hover,
.btn-brand-blue:focus {
    background-color: #193c96;
    border-color: #193c96;
    color: #ffffff;
}

.btn-brand-outline {
    background-color: transparent;
    color: #6e369a;
    border: 1px solid #6e369a;
    transition: background-color 0.2s, color 0.2s;
}

.btn-brand-outline:hover,
.btn-brand-outline:focus {
    background-color: #6e369a;
    color: #ffffff;
}

.pagination .page-item.active .page-link {
    background-color: #6e369a;
    border-color: #6e369a;
    color: #ffffff;
}

.pagination .page-link {
    color: #6e369a;
}

.pagination .page-link:hover {
    color: #57297c;
}

.clients-table {
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    overflow: hidden;
}

.clients-table th,
.clients-table td {
    border: none;
    border-bottom: 1px solid #dee2e6;
}

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

.top-header {
    background-color: #ffffff;
    border-bottom: 1px solid #dee2e6;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.top-header .header-logo img {
    max-height: 40px;
}

.top-header .header-user {
    font-weight: bold;
}

.top-header .header-user > a {
    color: #6e369a;
    transition: color 0.2s;
}

.top-header .header-user > a:hover,
.top-header .header-user > a:focus {
    color: #57297c;
}

.top-header .header-user > a i {
    font-size: 1.2rem;
    margin-left: 0.25rem;
    vertical-align: middle;
}

.stat-card {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.stat-card-body {
    padding: 2rem 1rem;
}

.stat-icon {
    font-size: 2rem;
    color: #6e369a;
    margin-bottom: 0.5rem;
    display: block;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #333333;
}

.stat-card-footer {
    background-color: #f1f1f1;
    padding: 0.75rem;
    font-weight: bold;
    color: #555555;
}

.client-tabs .nav-link {
    color: #555555;
    font-weight: bold;
}

.client-tabs .nav-link.active {
    color: #6e369a;
    border-bottom: 3px solid #6e369a;
}

.client-tabs .nav-link:hover {
    color: #6e369a;
}

/* ============================================ */
/*  Brand Tabs (العامة)                          */
/* ============================================ */
.brand-tabs {
    border-bottom: 2px solid #f0e6f7;
    margin-bottom: 1.25rem;
    gap: 0.25rem;
}

.brand-tabs .nav-item {
    margin-bottom: -2px;
}

.brand-tabs .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
    font-weight: 600;
    font-size: 0.92rem;
    padding: 0.7rem 1.2rem;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0.4rem 0.4rem 0 0;
    background-color: transparent;
    transition: all 0.15s ease;
    position: relative;
}

.brand-tabs .nav-link i {
    font-size: 1rem;
    transition: color 0.15s;
}

.brand-tabs .nav-link:hover {
    color: #6e369a;
    background-color: rgba(110, 54, 154, 0.05);
}

.brand-tabs .nav-link.active {
    color: #6e369a;
    border-bottom-color: #6e369a;
    background-color: rgba(110, 54, 154, 0.08);
    font-weight: 700;
}

.brand-tabs .nav-link.active i {
    color: #6e369a;
}

.brand-tabs .nav-link .tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 0.4rem;
    background-color: #e5e7eb;
    color: #6b7280;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    margin-inline-start: 0.25rem;
    transition: all 0.15s;
}

.brand-tabs .nav-link.active .tab-count {
    background-color: #6e369a;
    color: #ffffff;
}

.client-tab-content {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem;
    padding: 1.5rem;
}

.btn-upload-contract {
    background-color: #244db8;
    color: #ffffff;
    transition: background-color 0.2s;
}

.btn-upload-contract:hover {
    background-color: #193c96;
    color: #ffffff;
}
