/* الموافقات المالية — أنماط الواجهة. خصائص منطقية فقط (inline-start/end) لدعم RTL. */
:root {
  --brand: #1B3A4B;         /* كحلي CRM (--primary) */
  --brand-2: #132A37;       /* --primary-hover */
  --brand-3: #2f6f8f;       /* درجة أفتح للرسوم والمعلومات */
  --accent: #56CFE1;        /* لون التمييز في قائمة CRM الكحلية */
  --accent-soft: #E3EAEE;   /* --primary-transparent */
  --bg: #f3f5f7;
  --surface: #ffffff;
  --line: #e2e7eb;
  --text: #1f2933;
  --muted: #6b7783;
  --success: #1d8a4b;
  --danger: #c0392b;
  --warning: #b7791f;
  --sidebar-w: 268px;
  --font: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}
h1, h2, h3, h4, h5 { font-weight: 600; }
a { color: var(--brand); }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
/* المعرّفات (JV-2026-00054) لا تُقطع عند الشرطة داخل الجداول */
td .ltr:not(.text-break) { white-space: nowrap; }
/* على خلايا الجدول يبقى العنصر خلية — inline-block يُخرج الخلية من الصف فتنزاح الأعمدة */
td.ltr, th.ltr { display: table-cell; text-align: start; white-space: nowrap; }
td.ltr.amount, th.ltr.amount { text-align: end; }
/* الأرقام والمعرّفات داخل الخلية تبقى LTR لكن محاذاتها تتبع الجدول العربي (يمين) */
[dir="rtl"] td.ltr { text-align: right; }
/* حقول الإدخال تبقى كتلاً بعرض كامل */
.form-control.ltr, .form-select.ltr { display: block; }
dd.ltr, div.ltr, h2 > .ltr { display: inline; }
/* الحقل داخل صف flex (شريط التصفية) */
.d-flex > .form-control.ltr { display: block; }
.num { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.text-end-num { text-align: end; }
.muted { color: var(--muted); }
.mono { font-family: Consolas, "Courier New", monospace; }

/* ── الهيكل ─────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--brand);
  color: #9fb3c8;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-content { padding: 22px 26px 40px; flex: 1; }

.app-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px 14px; color: #fff; text-decoration: none;
  border-block-end: 1px solid rgba(255,255,255,.08);
}
.app-brand__mark {
  width: 40px; height: 40px; border-radius: 10px; background: rgba(255,255,255,.12); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: 20px;
}
.app-brand__text { font-weight: 600; font-size: 15px; line-height: 1.2; }
.app-brand__text small { display: block; font-weight: 400; font-size: 11.5px; color: #9fb3c8; margin-block-start: 3px; }

.company-switch { padding: 14px 16px 10px; border-block-end: 1px solid rgba(255,255,255,.08); }
.company-switch__label { font-size: 11px; color: #9fb3c8; margin-block-end: 6px; }
.company-switch__button, .company-switch__static {
  width: 100%; text-align: start; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  color: #fff; border-radius: 8px; padding: 8px 12px; font-size: 13px; display: flex; justify-content: space-between; align-items: center;
}
.company-switch__menu { max-height: 360px; overflow-y: auto; font-size: 13px; }
.company-switch__menu form { margin: 0; }

.app-nav { padding: 10px 10px 24px; }
.app-nav__group { font-size: 11px; color: #fff; opacity: .7; padding: 14px 12px 4px; letter-spacing: .3px; }
.app-nav__link {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px;
  color: #9fb3c8; text-decoration: none; font-size: 13.5px; margin-block: 1px;
}
.app-nav__link:hover { background: rgba(255,255,255,.1); color: var(--accent); }
.app-nav__link.active { background: rgba(255,255,255,.14); color: var(--accent); font-weight: 600; }
.app-nav__icon { width: 18px; text-align: center; font-size: 13px; opacity: .85; }

.app-topbar {
  display: flex; align-items: center; gap: 16px; padding: 12px 26px;
  background: var(--surface); border-block-end: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.app-topbar__title { font-size: 18px; margin: 0; flex: 1; }
.app-topbar__toggle { display: none; background: none; border: 0; font-size: 20px; }
.app-topbar__user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.app-topbar__name { font-weight: 600; }
.app-topbar__role { color: var(--muted); background: var(--bg); padding: 2px 8px; border-radius: 12px; font-size: 12px; }

@media (max-width: 992px) {
  .app-sidebar { position: fixed; inset-inline-start: 0; transform: translateX(100%); transition: transform .2s; z-index: 30; }
  [dir="rtl"] .app-sidebar { transform: translateX(100%); }
  .app-sidebar.open { transform: none; }
  .app-topbar__toggle { display: block; }
  .app-content { padding: 16px; }
}

/* ── البطاقات والجداول ───────────────────────────── */
.card { border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; border-block-end: 1px solid var(--line); font-weight: 600; padding: 12px 18px; border-radius: 12px 12px 0 0 !important; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-block-end: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 20px; margin: 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.table { font-size: 13.5px; }
.table th { font-weight: 600; color: var(--muted); background: #f8fafb; white-space: nowrap; font-size: 12.5px; }
.table td, .table th { vertical-align: middle; }
.table .amount { text-align: end; font-variant-numeric: tabular-nums; direction: ltr; white-space: nowrap; }
.table tr.group-row td { background: #f2f6f7; font-weight: 600; }
.table tr.total-row td { background: var(--accent-soft); font-weight: 700; border-top: 2px solid var(--brand); }
.table tr.level-1 td:first-child { font-weight: 700; }
.indent-1 { padding-inline-start: 0 !important; }
.indent-2 { padding-inline-start: 18px !important; }
.indent-3 { padding-inline-start: 36px !important; }
.indent-4 { padding-inline-start: 54px !important; }
.table-wrap { overflow-x: auto; }

.badge-status { font-size: 11.5px; padding: 4px 9px; border-radius: 12px; font-weight: 600; }
.badge-draft { background: #eef1f4; color: #52606d; }
.badge-posted { background: #e3f5ea; color: var(--success); }
.badge-reversed, .badge-cancelled { background: #fbe9e7; color: var(--danger); }
.badge-partial { background: #fff4dc; color: var(--warning); }
.badge-paid { background: #e3f5ea; color: var(--success); }
.badge-open { background: #e3f5ea; color: var(--success); }
.badge-closed { background: #eef1f4; color: #52606d; }

/* ── لوحة المعلومات ──────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-block-end: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.kpi__label { font-size: 12.5px; color: var(--muted); margin-block-end: 6px; }
.kpi__value { font-size: 22px; font-weight: 700; direction: ltr; text-align: end; font-variant-numeric: tabular-nums; }
.kpi__value.negative { color: var(--danger); }
.kpi__sub { font-size: 12px; color: var(--muted); margin-block-start: 4px; }
.kpi--accent { border-inline-start: 4px solid var(--brand); }
.kpi--success { border-inline-start: 4px solid var(--success); }
.kpi--danger { border-inline-start: 4px solid var(--danger); }
.kpi--info { border-inline-start: 4px solid var(--brand-3); }

.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; align-items: end; height: 200px; padding-block-start: 10px; }
.bars__col { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bars__pair { display: flex; gap: 3px; align-items: end; width: 100%; height: 100%; justify-content: center; }
.bars__bar { width: 40%; border-radius: 4px 4px 0 0; min-height: 2px; }
.bars__bar--rev { background: var(--brand-3); }
.bars__bar--exp { background: #c0392b; opacity: .75; }
.bars__label { font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-inline-end: 6px; vertical-align: middle; }

/* ── النماذج ─────────────────────────────────────── */
.form-label { font-weight: 500; font-size: 13px; }
.form-control, .form-select { font-size: 13.5px; }
.form-control.num, input[type="number"] { direction: ltr; text-align: end; }
input[type="date"] { direction: ltr; }
.lines-table td { padding: 4px; }
.lines-table .form-control, .lines-table .form-select { font-size: 13px; padding: 4px 8px; }
.lines-table .amount-input { width: 130px; }
.totals-box { background: #f8fafb; border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; font-size: 14px; }
.totals-box .row + .row { margin-block-start: 6px; }
.totals-box .total { font-weight: 700; font-size: 16px; border-block-start: 1px solid var(--line); padding-block-start: 8px; margin-block-start: 8px; }
.filter-bar { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-block-end: 14px; }
.filter-bar .form-control, .filter-bar .form-select { font-size: 13px; }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 24px; font-size: 13.5px; }
.dl-grid dt { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.dl-grid dd { margin: 0 0 8px; }
.tree-toggle { cursor: pointer; user-select: none; }
.report-head { text-align: center; margin-block-end: 18px; }
.report-head h3 { margin: 0 0 4px; font-size: 18px; }
.report-head .muted { font-size: 13px; }
.statement td.amount { width: 180px; }

/* ── صفحة الدخول ─────────────────────────────────── */
.login-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand-2) 0%, var(--brand) 60%, #2f6f8f 100%); padding: 20px; }
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 32px 30px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-card h1 { font-size: 22px; margin-block-end: 4px; }
.login-card .hint { font-size: 12.5px; color: var(--muted); }
.login-demo { background: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: 12px; margin-block-start: 16px; }

/* ── الطباعة ──────────────────────────────────────── */
.invoice-print { background: #fff; padding: 28px; border: 1px solid var(--line); border-radius: 12px; max-width: 900px; margin-inline: auto; }
.invoice-print__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; border-block-end: 2px solid var(--brand); padding-block-end: 14px; margin-block-end: 16px; }
.invoice-print__title { font-size: 22px; font-weight: 700; color: var(--brand); }
.invoice-print table { width: 100%; }
@media print {
  .app-sidebar, .app-topbar, .no-print, .alert { display: none !important; }
  .app-content { padding: 0; }
  body { background: #fff; }
  .invoice-print { border: 0; }
  .card { border: 0; box-shadow: none; }
}

/* ── مطابقة Bootstrap مع لوحة CRM الكحلية ─────────────── */
:root {
  --bs-primary: #1B3A4B;
  --bs-primary-rgb: 27, 58, 75;
  --bs-link-color: #1B3A4B;
  --bs-link-hover-color: #132A37;
  --bs-link-color-rgb: 27, 58, 75;
  --bs-link-hover-color-rgb: 19, 42, 55;
}
.btn-primary {
  --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-2); --bs-btn-hover-border-color: var(--brand-2);
  --bs-btn-active-bg: var(--brand-2); --bs-btn-active-border-color: var(--brand-2);
  --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
  --bs-btn-focus-shadow-rgb: 27, 58, 75;
}
.btn-outline-primary {
  --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand);
  --bs-btn-focus-shadow-rgb: 27, 58, 75;
}
.btn-link { --bs-btn-color: var(--brand); --bs-btn-hover-color: var(--brand-2); }
.form-control:focus, .form-select:focus {
  border-color: #6f8ea3; box-shadow: 0 0 0 .2rem rgba(27, 58, 75, .18);
}
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { border-color: #6f8ea3; box-shadow: 0 0 0 .2rem rgba(27, 58, 75, .18); }
.dropdown-item.active, .dropdown-item:active { background-color: var(--brand); }
.nav-tabs .nav-link.active { color: var(--brand); border-bottom-color: var(--brand); }
.page-link { color: var(--brand); }
.page-item.active .page-link { background-color: var(--brand); border-color: var(--brand); }
.text-primary { color: var(--brand) !important; }
.bg-primary { background-color: var(--brand) !important; }
.badge.bg-primary { background-color: var(--brand) !important; }
.table-success { --bs-table-bg: #e6f4ea; }

/* ── عناصر نظام الموافقات ─────────────────────────── */
.app-nav__count { margin-inline-start: auto; background: #e8590c; color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11.5px; font-weight: 700; line-height: 18px; }
.kpi-link { text-decoration: none; color: inherit; display: block; transition: box-shadow .15s; }
.kpi-link:hover { box-shadow: 0 4px 14px rgba(16,24,40,.08); color: inherit; }
.row-link { cursor: pointer; }

/* خمس نغمات دلالية: أخضر معتمد، أزرق بالانتظار، برتقالي معاد، أحمر مرفوض، رمادي مسودة/ملغى */
.status-badge { display: inline-block; font-size: 11.5px; padding: 3px 10px; border-radius: 12px; font-weight: 600; white-space: nowrap; }
.tone-green { background: #e3f5ea; color: #1d8a4b; }
.tone-blue { background: #e3eefb; color: #1f5fa8; }
.tone-orange { background: #fff1de; color: #b4610b; }
.tone-red { background: #fbe9e7; color: #c0392b; }
.tone-grey { background: #eef1f4; color: #52606d; }
.prio { font-size: 10.5px; padding: 1px 7px; border-radius: 8px; margin-inline-start: 6px; font-weight: 600; }
.prio-2 { background: #fff1de; color: #b4610b; }
.prio-3 { background: #fbe9e7; color: #c0392b; }
.role-chip { font-size: 12px; padding: 2px 9px; border-radius: 10px; background: var(--accent-soft); color: var(--brand); font-weight: 600; }
.role-chip.role-9 { background: #1B3A4B; color: #fff; }

.record-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px; margin-block-end: 14px; }
.record-head__number { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); font-weight: 600; }
.record-head__title { font-size: 20px; margin: 6px 0 4px; }
.record-head__amount { text-align: end; }
.record-head__value { font-size: 24px; font-weight: 700; color: var(--brand); }

.stepper { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px 12px 16px; margin-block-end: 14px; }
.stepper__step { position: relative; text-align: center; padding-inline: 8px; }
/* الخط الواصل بين الدوائر يمتد نحو الخطوة التالية (يساراً في RTL) */
.stepper__step:not(:last-child)::after { content: ""; position: absolute; top: 17px; inset-inline-start: calc(50% + 22px); inset-inline-end: calc(-50% + 22px); height: 3px; background: var(--line); border-radius: 2px; }
.stepper__step.done:not(:last-child)::after { background: #1d8a4b; }
.stepper__dot { width: 36px; height: 36px; border-radius: 50%; margin: 0 auto 8px; display: grid; place-items: center; font-weight: 700; background: #eef1f4; color: #8a96a3; border: 2px solid #dfe4e8; }
.stepper__title { font-weight: 600; font-size: 13.5px; }
.stepper__meta { font-size: 12px; color: var(--muted); margin-block-start: 3px; min-height: 34px; }
.stepper__step.done .stepper__dot { background: #1d8a4b; border-color: #1d8a4b; color: #fff; }
.stepper__step.current .stepper__dot { background: #fff; border-color: #1f5fa8; color: #1f5fa8; box-shadow: 0 0 0 4px #e3eefb; }
.stepper__step.current .stepper__title { color: #1f5fa8; }
.stepper__step.rejected .stepper__dot { background: #c0392b; border-color: #c0392b; color: #fff; }
.stepper__step.returned .stepper__dot { background: #e8890c; border-color: #e8890c; color: #fff; }
@media (max-width: 640px) {
  .stepper { grid-template-columns: 1fr 1fr; row-gap: 18px; }
  .stepper__step::after { display: none; }
}

.decision-card { border: 2px solid #1f5fa8; }
.decision-card .card-header { background: #e3eefb; color: #1f5fa8; }
.description { white-space: pre-wrap; line-height: 1.8; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline__item { position: relative; padding-inline-start: 22px; padding-block-end: 14px; border-inline-start: 2px solid var(--line); margin-inline-start: 6px; }
.timeline__item::before { content: ""; position: absolute; inset-inline-start: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: #8a96a3; border: 2px solid #fff; }
.timeline__item:last-child { border-inline-start-color: transparent; }
.timeline__item.act-approved::before { background: #1d8a4b; }
.timeline__item.act-rejected::before { background: #c0392b; }
.timeline__item.act-returned::before { background: #e8890c; }
.timeline__item.act-submitted::before, .timeline__item.act-resubmitted::before { background: #1f5fa8; }
.timeline__head { font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.timeline__at { margin-inline-start: auto; font-size: 12px; color: var(--muted); }
.timeline__comment { background: #f8fafb; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-block-start: 6px; font-size: 13px; white-space: pre-wrap; }

.file-list { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.file-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 0; border-block-end: 1px dashed var(--line); word-break: break-word; }
.file-list li:last-child { border-block-end: 0; }

.pipeline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pipeline__stage { flex: 1; min-width: 110px; text-align: center; background: #f3f6f9; border: 1px solid var(--line); border-radius: 10px; padding: 10px 6px; font-size: 12.5px; color: var(--muted); }
.pipeline__stage--ok { background: #e3f5ea; }
.pipeline__n { font-size: 22px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.pipeline__arrow { color: #a0acb8; font-size: 18px; }
.pipeline__side { display: flex; flex-direction: column; gap: 6px; font-size: 13px; padding-inline-start: 8px; }

/* ── نموذج الطباعة ─────────────────────────────────── */
.print-page { background: #e9edf1; min-height: 100vh; padding-block-end: 30px; }
.print-sheet { background: #fff; max-width: 860px; margin-inline: auto; padding: 32px 36px; border-radius: 6px; box-shadow: 0 4px 20px rgba(0,0,0,.08); }
.print-head { display: flex; justify-content: space-between; align-items: flex-start; border-block-end: 3px solid var(--brand); padding-block-end: 12px; margin-block-end: 18px; }
.print-head__title { font-size: 22px; font-weight: 700; color: var(--brand); }
.print-table th { width: 140px; background: #f3f6f9; font-weight: 600; font-size: 13px; color: var(--text); }
.print-sign { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-block-start: 22px; }
.print-sign__box { border: 1px solid #c9d1d9; border-radius: 6px; padding: 10px; min-height: 140px; text-align: center; font-size: 12.5px; }
.print-sign__role { font-weight: 700; color: var(--brand); border-block-end: 1px solid var(--line); padding-block-end: 6px; margin-block-end: 8px; }
.print-sign__name { font-weight: 600; min-height: 20px; }
.print-sign__state { margin-block: 4px; }
.print-sign__date { color: var(--muted); font-size: 11.5px; }
.print-sign__note { margin-block-start: 6px; font-size: 11.5px; color: var(--muted); text-align: start; }
@media print {
  .print-page { background: #fff; padding: 0; }
  .print-sheet { box-shadow: none; padding: 0; max-width: none; }
  .status-badge { border: 1px solid currentColor; }
}

/* نسخة Bootstrap المحلية تكتب ألوان الأزرار صريحة لا عبر المتغيرات، فتُعاد هنا صراحة */
.btn-primary { background-color: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover, .btn-primary:focus, .btn-primary:active { background-color: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover, .btn-outline-primary:active { background-color: var(--brand); border-color: var(--brand); color: #fff; }
.app-topbar__user .btn-link { color: var(--brand); }
@media (max-width: 640px) {
  .app-topbar { padding: 10px 14px; gap: 10px; }
  .app-topbar__role, .app-topbar__name { display: none; }
  .record-head__amount { text-align: start; }
  .pipeline__arrow { display: none; }
  .pipeline__stage { min-width: 40%; }
}
@media screen and (max-width: 640px) {
  .print-sheet { padding: 18px 16px; border-radius: 0; }
  .print-sign { grid-template-columns: 1fr 1fr; }
  .print-table th { width: auto; }
}

/* ── الشعار ─────────────────────────────────────────── */
/* شعار CRM الأبيض على القائمة الكحلية، واسم النظام تحته — كما في رأس قائمة CRM */
.app-brand { flex-direction: column; align-items: flex-start; gap: 6px; }
.app-brand__logo { block-size: 38px; inline-size: auto; max-inline-size: 100%; object-fit: contain; }
.app-brand__text { font-size: 13px; color: var(--accent); }

.login-logo { height: 60px; width: auto; }
.print-logo { height: 56px; width: auto; }

/* ── زر التنبيهات (الجرس) ─────────────────────────────── */
.bell { position: relative; background: none; border: 1px solid var(--line); border-radius: 10px; width: 38px; height: 38px; display: grid; place-items: center; color: var(--brand); }
.bell:hover, .bell[aria-expanded="true"] { background: var(--accent-soft); }
.bell__count { position: absolute; top: -6px; inset-inline-end: -6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: #e8590c; color: #fff; font-size: 11px; font-weight: 700; line-height: 19px; text-align: center; border: 2px solid #fff; }
.bell__menu { width: 360px; max-width: calc(100vw - 24px); padding: 0; overflow: hidden; border-radius: 12px; box-shadow: 0 10px 30px rgba(16,24,40,.15); }
.bell__head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-block-end: 1px solid var(--line); background: #f8fafb; }
.bell__head form { margin: 0; }
.bell__item { display: block; padding: 10px 14px; border-block-end: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: 13px; }
.bell__item:hover { background: #f3f6f9; color: var(--text); }
.bell__item.unread { background: #eef5fc; border-inline-start: 3px solid #1f5fa8; }
.bell__title { font-weight: 600; }
.bell__text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bell__meta { font-size: 11.5px; color: var(--muted); }
.bell__empty { padding: 22px 14px; text-align: center; color: var(--muted); font-size: 13px; }
.bell__all { display: block; text-align: center; padding: 9px; font-size: 13px; text-decoration: none; }
.notif-row.unread { background: #eef5fc; border-inline-start: 3px solid #1f5fa8; }

.lang-switch { background: none; border: 1px solid var(--line); border-radius: 10px; height: 38px; padding: 0 12px; font-size: 13px; color: var(--brand); font-weight: 600; }
.lang-switch:hover { background: var(--accent-soft); }
.company-chip { display: inline-block; background: var(--accent-soft); color: var(--brand); border-radius: 10px; padding: 1px 9px; font-weight: 600; margin-inline-end: 6px; }

/* ── الاتجاه الإنجليزي ────────────────────────────────── */
[dir="ltr"] body { font-family: var(--font); }
@media (max-width: 992px) {
  [dir="ltr"] .app-sidebar { transform: translateX(-100%); }
  [dir="ltr"] .app-sidebar.open { transform: none; }
}
@media (max-width: 640px) {
  .app-topbar__user .btn-link { display: none; }
}

/* ── التوقيع ─────────────────────────────────────────── */
.signature-box { border: 1px dashed var(--line); border-radius: 10px; background: #fff; min-height: 120px; display: grid; place-items: center; padding: 12px; }
.signature-box img { max-width: 100%; max-height: 110px; object-fit: contain; }
.signature-box--sm { min-height: 70px; width: 160px; padding: 6px; }
.signature-box--sm img { max-height: 60px; }
.print-sign__img { display: block; max-width: 100%; max-height: 54px; margin: 4px auto; object-fit: contain; }

/* أيقونات Tabler كما في CRM */
.app-nav__icon.ti { font-size: 18px; width: 20px; opacity: 1; }
.bell .ti { font-size: 20px; }
.app-topbar__toggle .ti { font-size: 22px; }

/* ── المسار بست مراحل: تجهيز المحاسب والتنفيذ ─────────────── */
.stepper--6 { grid-template-columns: repeat(6, 1fr); }
.stepper--6 .stepper__title { font-size: 12.5px; }
.stepper__step.skipped .stepper__dot { background: #f3f5f7; border-style: dashed; color: #a0acb8; }
@media (max-width: 900px) {
  .stepper--6 { grid-template-columns: repeat(3, 1fr); row-gap: 18px; }
  .stepper--6 .stepper__step::after { display: none; }
}
.decision-card--prep { border-color: #1B3A4B; }
.decision-card--prep .card-header { background: var(--accent-soft); color: var(--brand); }
.pay-progress { block-size: 8px; background: #eef1f4; border-radius: 6px; overflow: hidden; }
.pay-progress__bar { block-size: 100%; background: #1d8a4b; }
.pay-form { border-block-start: 1px dashed var(--line); padding-block-start: 14px; }
.pay-note td { border-block-start: 0; padding-block-start: 0; }
.print-sign { grid-template-columns: repeat(3, 1fr); }
.print-payments th[colspan] { text-align: start; }

/* ── بنود الطلب: نمط أسطر عرض السعر في CRM ─────────────────── */
.doc-lines td { vertical-align: top; padding-block: 0.75rem; }
.doc-lines thead th { background: #fff; font-weight: 600; box-shadow: inset 0 -1px 0 var(--line); }
.doc-lines .form-control, .doc-lines .form-select { min-inline-size: 5rem; }
.doc-lines textarea { resize: vertical; min-block-size: 3.5rem; }
.doc-lines-title, .doc-col-required { border-inline-start: 3px solid #dc3545; padding-inline-start: 0.6rem; }
.doc-line-head { display: flex; align-items: center; gap: 0.35rem; white-space: nowrap; }
.doc-line-drag { cursor: grab; color: #adb5bd; line-height: 1; }
.doc-line-drag:hover { color: #6c757d; }
[data-item-row].is-dragging { opacity: 0.45; }
.doc-line-menu { display: inline-flex; align-items: center; justify-content: center; inline-size: 1.75rem; block-size: 1.75rem; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: #6c757d; }
.doc-line-menu:hover { background: #f1f3f5; }
.doc-line-no { font-variant-numeric: tabular-nums; color: #6c757d; min-inline-size: 1.25rem; text-align: center; }
.doc-amount-box { display: block; padding: 0.3rem 0.6rem; border: 1px solid var(--line); border-radius: 0.375rem; background: #f8f9fa; color: #6c757d; text-align: end; font-variant-numeric: tabular-nums; direction: ltr; }
.doc-amount-total { color: #212529; font-weight: 600; }
.doc-totals-box { inline-size: min(26rem, 100%); border: 1px solid var(--line); border-radius: 0.5rem; }
.doc-total-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 1rem; border-block-end: 1px solid #f1f3f5; }
.doc-total-row:last-child { border-block-end: 0; }
.doc-total-label { flex: 1 1 auto; color: #6c757d; font-size: 0.875rem; }
.doc-total-value { font-variant-numeric: tabular-nums; font-weight: 600; direction: ltr; }
.doc-total-grand .doc-total-label, .doc-total-grand .doc-total-value { color: #212529; font-weight: 700; font-size: 1rem; }
.items-view td { vertical-align: top; }
.print-items { margin-block-end: 14px; }
.print-items .doc-totals-box { inline-size: 18rem; }
@media print { .print-items .table-wrap { overflow: visible; } }
.form-actions .form-text { flex-basis: 100%; margin: 0; }

/* ── نموذج الطباعة بالمسار الحالي (6 مراحل + بنود + سداد) ─────────── */
.print-section-title { font-weight: 700; color: var(--brand); border-block-end: 2px solid var(--accent-soft); padding-block-end: 4px; margin-block: 16px 8px; font-size: 14px; }
.print-table td, .print-table th { font-size: 12.5px; padding: 6px 8px; }
.print-pay-total th, .print-pay-total td { background: #f3f6f9; }
.print-sheet .doc-totals-box { inline-size: 18rem; }
.print-sheet .items-view th { color: var(--text); background: #f3f6f9; }
@page { size: A4; margin: 12mm; }
@media print {
  .print-sign__box, .print-table tr, .items-view tr { break-inside: avoid; }
  .print-section-title { break-after: avoid; }
  .print-sheet .table-wrap { overflow: visible; }
}
.print-section-title + .print-sign { margin-block-start: 0; }

/* ── جدول الطلبات: التحديد والإجراءات ─────────────────── */
.requests-table .col-select { inline-size: 36px; text-align: center; }
.requests-table .col-actions { inline-size: 70px; text-align: center; }
.requests-table tr.is-selected td { background: #eef5fc; }
.selection-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--accent-soft); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; margin-block-end: 10px; }
.selection-bar[hidden] { display: none; }
.selection-bar__count { font-weight: 600; color: var(--brand); margin-inline-end: auto; }
