/**
 * Tayseer ERP — Typography (خط النظام الموحّد)
 * ─────────────────────────────────────────────────
 * Cairo على كل الشاشات — مصدر الحقيقة: brand-tokens.css (--font-family)
 * يُحمَّل آخر CSS في <head> ليفوز على Vuexy / Courier / Inter / Public Sans
 */

/* ── 1. Bootstrap / Vuexy tokens ── */
:root,
[data-bs-theme="light"],
[data-bs-theme="dark"] {
  --bs-font-sans-serif: var(--font-family, 'Cairo', sans-serif);
  --bs-body-font-family: var(--font-family, 'Cairo', sans-serif);
  --font-family-base: var(--font-family, 'Cairo', sans-serif);
  --font-primary: var(--font-family, 'Cairo', sans-serif);
  --font-heading: var(--font-family, 'Cairo', sans-serif);
  --fin-font: var(--font-family-num, var(--font-family, 'Cairo', sans-serif));
}

/* ── 2. الجذر ── */
html {
  font-family: var(--font-family, 'Cairo', sans-serif);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family, 'Cairo', sans-serif) !important;
}

/* ── 3. Cairo على كل واجهة ERP — مع استثناء الأيقونات والكود ── */
body :where(
  .layout-wrapper,
  .layout-wrapper *:not(pre):not(code):not(kbd):not(samp):not(pre *):not(code *):not(kbd *):not(samp *)
):not([class*="fa-"]):not(.fa):not(.fas):not(.far):not(.fab):not(.svg-inline--fa),
body.login-page,
body.login-page *:not(pre):not(code):not(kbd):not(samp):not([class*="fa-"]):not(.svg-inline--fa),
body .modal,
body .modal *:not(pre):not(code):not([class*="fa-"]):not(.svg-inline--fa),
body .dropdown-menu,
body .dropdown-menu *:not([class*="fa-"]),
body .offcanvas,
body .offcanvas *:not([class*="fa-"]),
body .swal2-container,
body .swal2-container *:not([class*="fa-"]),
body .select2-container,
body .select2-container *:not([class*="fa-"]),
body .flatpickr-calendar,
body .flatpickr-calendar *,
body .tippy-box,
body .tippy-box *,
body .tooltip,
body .tooltip *,
body .apexcharts-canvas,
body .apexcharts-canvas * {
  font-family: var(--font-family, 'Cairo', sans-serif) !important;
}

/* ── 4. عناصر UI شائعة (Bootstrap / Kartik / Vuexy) ── */
.btn, .form-control, .form-select, .form-label, .input-group-text,
.navbar, .nav-link, .menu-link, .menu-item, .card, .card-body, .card-title,
.alert, .badge, .list-group-item, .table, .table td, .table th,
.kv-grid-table, .grid-view, .pagination, .page-link,
.select2-selection, .select2-results__option, .select2-search__field,
.swal2-title, .swal2-html-container, .swal2-actions button,
.acc-hub, .acc-kpi, .fin-page, .ocpv2, .inv-pro, .cw-shell {
  font-family: var(--font-family, 'Cairo', sans-serif) !important;
}

/* ── 5. «monospace» في الواجهة = Cairo tabular (ليس Courier) ── */
.font-monospace:not(pre):not(code),
.text-monospace:not(pre):not(code),
.cw-input--mono {
  font-family: var(--font-family-num, var(--font-family, 'Cairo', sans-serif)) !important;
  letter-spacing: normal;
}

/* ── 6. إلغاء خطوط legacy في inline styles ── */
[style*="font-family:Courier"]:not(pre):not(code):not(kbd):not(samp),
[style*="font-family: Courier"]:not(pre):not(code):not(kbd):not(samp),
[style*="font-family:'Courier"]:not(pre):not(code):not(kbd):not(samp),
[style*="font-family: 'Courier"]:not(pre):not(code):not(kbd):not(samp),
[style*='font-family:"Courier']:not(pre):not(code):not(kbd):not(samp),
[style*='font-family: "Courier']:not(pre):not(code):not(kbd):not(samp),
[style*="font-family:Inter"]:not(pre):not(code):not(kbd):not(samp),
[style*="font-family: Inter"]:not(pre):not(code):not(kbd):not(samp),
[style*="font-family:Public Sans"]:not(pre):not(code):not(kbd):not(samp),
[style*="font-family:Public"]:not(pre):not(code):not(kbd):not(samp),
[style*="font-family:Roboto"]:not(pre):not(code):not(kbd):not(samp),
[style*="font-family: Segoe"]:not(pre):not(code):not(kbd):not(samp),
[style*="font-family:Segoe"]:not(pre):not(code):not(kbd):not(samp),
[style*="font-family:system-ui"]:not(pre):not(code):not(kbd):not(samp),
[style*="font-family: system-ui"]:not(pre):not(code):not(kbd):not(samp),
[style*="font-family:ui-monospace"]:not(pre):not(code):not(kbd):not(samp),
[style*="font-family: ui-monospace"]:not(pre):not(code):not(kbd):not(samp),
[style*="font-family:monospace"]:not(pre):not(code):not(kbd):not(samp),
[style*="font-family:Georgia"]:not(pre):not(code):not(kbd):not(samp),
[style*="font-family: Georgia"]:not(pre):not(code):not(kbd):not(samp),
[style*="font-family:IBM Plex"]:not(pre):not(code):not(kbd):not(samp),
[style*="font-family:'SF Mono"]:not(pre):not(code):not(kbd):not(samp),
[style*="font-family: 'SF Mono"]:not(pre):not(code):not(kbd):not(samp) {
  font-family: var(--font-family, 'Cairo', sans-serif) !important;
  letter-spacing: normal;
}

/* ── 7. طباعة داخل المتصفح ── */
@media print {
  body,
  body *:not(pre):not(code):not(kbd):not(samp):not([class*="fa-"]) {
    font-family: var(--font-family, 'Cairo', sans-serif) !important;
  }
}
