/* Nour Eldin ERP — ONE design system (ADR-036 UI-1 · D-142) for the central panel and the site hubs.
   Every colour, size, radius and space the screens use is a token here; no screen sets its own.
   Arabic-first: IBM Plex Sans Arabic, self-hosted (OFL-1.1 — fonts/OFL.txt), Western digits, tabular amounts.
   Contrast (WCAG AA, D-096 · BR-14 · D-108 #16): every text/background pair ≥ 4.5:1 and every control edge ≥ 3:1,
   light and dark — computed by apps/cloud/test/ui-tokens.test.ts and listed in app/docs/ux/CONTRAST_TABLE.md.
   Brand: pink is an indicator (≥ 3:1, never body text on a tint); brand-coloured text uses --brand-strong; the
   primary action is cocoa. The company's own colours replace --brand only when the server says they are readable. */

@font-face {
  font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/ui/fonts/ibm-plex-sans-arabic-arabic-400.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 600; font-display: swap;
  src: url(/ui/fonts/ibm-plex-sans-arabic-arabic-600.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 700; font-display: swap;
  src: url(/ui/fonts/ibm-plex-sans-arabic-arabic-700.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/ui/fonts/ibm-plex-sans-arabic-latin-400.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 600; font-display: swap;
  src: url(/ui/fonts/ibm-plex-sans-arabic-latin-600.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 700; font-display: swap;
  src: url(/ui/fonts/ibm-plex-sans-arabic-latin-700.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* type — Arabic-first */
  --font-ui: 'IBM Plex Sans Arabic', 'Noto Sans Arabic', 'Segoe UI', Tahoma, system-ui, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --lh: 1.6;

  /* D-097 B · D-142 — the TYPE SCALE: one multiplier (the person's «حجم النص», 90…150 — 100 the baseline) over one set of
     tokens. Body 14px (D-142 amends D-098 item 1); floors keep the smallest text legible at the smallest scale. Spacing
     and the touch targets are pixels: they never shrink with the text. */
  --text-scale: 1;
  --fs-display: calc(22px * var(--text-scale));   /* a dashboard figure */
  --fs-title: calc(18px * var(--text-scale));     /* the page title */
  --fs-heading: calc(16px * var(--text-scale));   /* a card's heading · the company's name */
  --fs-subheading: calc(15px * var(--text-scale));
  --fs-body: max(12px, calc(14px * var(--text-scale)));
  --fs-table: max(12px, calc(13px * var(--text-scale)));
  --fs-label: max(12px, calc(13px * var(--text-scale)));
  --fs-small: max(11px, calc(12px * var(--text-scale)));   /* helper · error · context */
  --fs-badge: max(11px, calc(12px * var(--text-scale)));
  --fs-mono: calc(14px * var(--text-scale));
  --fs-pos: max(16px, calc(16px * var(--text-scale)));     /* the hub's tablets: never below 16px */
  --fs-pos-total: calc(28px * var(--text-scale));          /* the total and the change due */

  /* neutrals — warm, to sit with the brand */
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f4f3f1;
  --border: #e7e5e4;          /* dividers, cards — decoration */
  --border-strong: #8a817c;   /* the edge of a control (≥ 3:1) */
  --text: #1c1917;
  --text-2: #44403c;          /* labels, secondary lines */
  --text-3: #6b6460;          /* hints, timestamps (still ≥ 4.5:1) */

  /* brand — pink and cocoa from the website, bounded by contrast */
  --brand: #b8545f;           /* indicator: the active item, selection edge (≥ 3:1) */
  --brand-strong: #9a3a46;    /* brand-coloured text */
  --brand-soft: #fbe9eb;      /* a tint under ordinary text */
  --primary: #3b2521;         /* cocoa — the primary action */
  --on-primary: #ffffff;

  /* semantics — the same roles everywhere (a pill, a toast, a card's edge) */
  --ok: #15803d;      --ok-bg: #ecfdf3;
  --warn: #b45309;    --warn-bg: #fffbeb;
  --danger: #b91c1c;  --danger-bg: #fef2f2;
  --info: #1d4ed8;    --info-bg: #eff6ff;
  --neutral: #57534e; --neutral-bg: #f5f5f4;
  --ring: #1d4ed8;
  --nav-active: #f3e6e8;
  --overlay: rgb(28 25 23 / 0.45);

  /* shape */
  --r-sm: 6px; --r: 8px; --r-md: 10px; --r-lg: 12px; --r-pill: 999px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.08); --shadow-2: 0 2px 8px rgb(0 0 0 / 0.12);
  --control-h: 44px; --control-h-touch: 48px; --navbar-h: 56px; --sidebar-w: 260px; --rail-w: 72px;

  color-scheme: light dark;
}
html[data-text-scale="90"] { --text-scale: 0.9; }
html[data-text-scale="115"] { --text-scale: 1.15; }
html[data-text-scale="130"] { --text-scale: 1.3; }
html[data-text-scale="150"] { --text-scale: 1.5; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171717;
    --surface: #1f1f1f;
    --surface-2: #262626;
    --border: #2e2e2e;
    --border-strong: #78716c;
    --text: #f5f5f4;
    --text-2: #d6d3d1;
    --text-3: #a8a29e;
    --brand: #f0a3ad;
    --brand-strong: #f0a3ad;
    --brand-soft: #3a2a2c;
    --primary: #f0c9ce;
    --on-primary: #1c1917;
    --ok: #4ade80;      --ok-bg: #14281b;
    --warn: #fbbf24;    --warn-bg: #2e2208;
    --danger: #f87171;  --danger-bg: #341515;
    --info: #93c5fd;    --info-bg: #13233d;
    --neutral: #d6d3d1; --neutral-bg: #292524;
    --ring: #93c5fd;
    --nav-active: #3a2a2c;
    --overlay: rgb(0 0 0 / 0.55);
  }
}
