/* ==========================================================================
   MostaERP design tokens — the only place raw values live.
   Components reference these variables, never literals.
   ========================================================================== */

@font-face {
  font-family: "Inter";
  font-weight: 100 900;
  font-display: swap;
  src: url("../../vendor/fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-weight: 100 900;
  font-display: swap;
  src: url("../../vendor/fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Cairo";
  font-weight: 200 1000;
  font-display: swap;
  src: url("../../vendor/fonts/cairo-arabic-wght-normal.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: "Cairo";
  font-weight: 200 1000;
  font-display: swap;
  src: url("../../vendor/fonts/cairo-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;

  /* ---- Typography -------------------------------------------------------- */
  /* Six levels only: page title · section title · body · label · secondary · metadata. Every size below maps to one of them. */
  --font-sans: "Inter", "Cairo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-ar: "Cairo", "Inter", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-family: var(--font-sans);

  --fs-2xs: 0.6875rem;  /* 11 — small metadata */
  --fs-xs: 0.75rem;     /* 12 — labels, secondary text, chips */
  --fs-sm: 0.8125rem;   /* 13 — default UI text (body) */
  --fs-md: 0.875rem;    /* 14 — emphasised body, section titles */
  --fs-lg: 1rem;        /* 16 — large section titles */
  --fs-xl: 1.125rem;    /* 18 — page title */
  --fs-2xl: 1.25rem;    /* 20 — key figures */
  --fs-body: var(--fs-sm);
  --lh-base: 1.45;
  --lh-tight: 1.25;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --ls-title: -0.01em;

  /* ---- Spacing scale (4px base) ------------------------------------------ */
  --sp-0: 0;
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --gap-section: 0.75rem;                 /* between blocks on a page (toolbar → table → footer) */
  --gutter: clamp(0.75rem, 1.4vw, 1.75rem);

  /* ---- Radius ------------------------------------------------------------ */
  --r-sm: 3px;
  --r-md: 5px;
  --r-lg: 8px;
  --r-pill: 999px;

  /* ---- Accent (overridden inline from Settings > Appearance) -------------- */
  --accent: #4f46e5;
  --accent-contrast: #ffffff;
  --accent-hover: color-mix(in srgb, var(--accent) 86%, #000);
  --accent-soft: color-mix(in srgb, var(--accent) 9%, var(--surface));
  --accent-soft-strong: color-mix(in srgb, var(--accent) 16%, var(--surface));
  --accent-text: color-mix(in srgb, var(--accent) 88%, #000);
  --focus-ring: color-mix(in srgb, var(--accent) 32%, transparent);

  /* ---- Surfaces & text (light): soft neutral page, near-white work surfaces ---- */
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafafb;
  --surface-hover: #f1f2f5;
  --surface-active: #e9ebef;
  --border: #e6e8ec;
  --border-strong: #d0d4db;
  --text: #1f2733;
  --text-muted: #4a5463;
  --text-faint: #5f6a7d;
  --overlay: rgb(17 24 39 / 0.42);

  /* ---- Semantic (calm: soft fills, readable text) ------------------------- */
  --success: #137a55;
  --success-soft: #e8f5ee;
  --warning: #9a5a0a;
  --warning-soft: #fcf1df;
  --danger: #bd3a30;
  --danger-solid: #bd3a30;
  --danger-soft: #fbecea;
  --info: #1f6cb0;
  --info-soft: #e8f1f9;
  --neutral-soft: #eceef2;

  /* ---- Shadows (restrained: only floating layers get one) ---------------- */
  --sh-xs: 0 1px 0 rgb(17 24 39 / 0.03);
  --sh-card: 0 1px 2px rgb(17 24 39 / 0.06);
  --sh-menu: 0 6px 20px -4px rgb(17 24 39 / 0.14), 0 0 0 1px rgb(17 24 39 / 0.04);
  --sh-modal: 0 18px 48px -12px rgb(17 24 39 / 0.28);

  /* ---- Layout sizes ------------------------------------------------------ */
  --header-h: 46px;
  --subnav-h: 36px;
  --toolbar-h: 34px;
  --page-max: none;
  --launcher-w: 360px;

  /* ---- Controls & tables (compact density) ------------------------------- */
  --ctl-h-sm: 28px;     /* compact input / button */
  --ctl-h: 32px;        /* standard input / button */
  --ctl-h-lg: 36px;
  --ctl-px: 0.625rem;
  --th-h: 32px;
  --row-h: 36px;
  --cell-px: 0.75rem;
  --cell-py: 0.375rem;
  --card-pad: var(--sp-2) var(--sp-3);      /* 8 / 12 */
  --card-pad-lg: var(--sp-3);               /* 12 — workspaces, forms */
  --form-gap: 0.625rem;                     /* between fields */
  --tab-h: 32px;

  /* ---- Overlays ---------------------------------------------------------- */
  --modal-w-sm: 380px;
  --modal-w: 440px;
  --modal-w-lg: 720px;
  --modal-w-xl: 960px;

  /* ---- Kanban ------------------------------------------------------------ */
  --bk-col-w: 280px;   /* column width, shared by Project Tasks, My Tasks and the CRM pipeline */
  --bk-gap: 10px;      /* gap between columns */
  --bk-col-bg: #f0f1f4;   /* column well: a step darker than the page, so white cards read on it */
  --bk-card-bg: var(--surface);

  /* ---- Layers (the values the app already used, now named) --------------- */
  --z-header: 1030;      /* sticky app header */
  --z-dropdown: 1040;    /* search results */
  --z-launcher: 1050;    /* app switcher popover */
  --z-modal: 2000;       /* modals, the task drawer */
  --z-toast: 2100;       /* toasts, menus opened inside overlays */
  --z-picker: 2190;      /* date / select pickers */
  --z-lookup: 2200;      /* select-or-create menus */
  --z-lightbox: 3000;    /* image lightbox */

  /* ---- Motion ------------------------------------------------------------ */
  --t-fast: 120ms ease;
  --t-base: 180ms ease;

  /* Breakpoints (documentation: custom properties cannot be used inside @media) —
     xs 360 · sm 576 · md 768 · lg 992 · xl 1200 · xxl 1440 */
}

/* Comfortable density (Settings → Appearance): bigger hit-areas, slightly larger text */
:root[data-density="comfortable"] {
  --fs-body: var(--fs-md);
  --ctl-h-sm: 30px;
  --ctl-h: 36px;
  --ctl-h-lg: 42px;
  --ctl-px: 0.75rem;
  --th-h: 38px;
  --row-h: 44px;
  --cell-py: 0.625rem;
  --card-pad: var(--sp-3) var(--sp-4);
  --header-h: 52px;
  --subnav-h: 42px;
}

/* Arabic uses Cairo, which sets taller line boxes: keep the control heights, tighten the line-height instead of growing every element */
:root[lang="ar"] {
  --font-family: var(--font-ar);
  --lh-base: 1.5;
  --lh-tight: 1.3;
  --ls-title: 0;
}

/* ---- Dark theme: charcoal, not black. Surfaces differ by a step, not by a leap ---------------------------------- */
:root[data-theme="dark"] {
  color-scheme: dark;

  --accent-hover: color-mix(in srgb, var(--accent) 82%, #fff);
  --accent-soft: color-mix(in srgb, var(--accent) 14%, var(--surface));
  --accent-soft-strong: color-mix(in srgb, var(--accent) 24%, var(--surface));
  --accent-text: color-mix(in srgb, var(--accent) 60%, #fff);
  --focus-ring: color-mix(in srgb, var(--accent) 48%, transparent);

  --bg: #1b1e28;
  --surface: #262a36;
  --surface-2: #212430;
  --surface-hover: #2d3240;
  --surface-active: #373d4c;
  --border: #323746;
  --border-strong: #414758;
  --text: #e3e6eb;
  --text-muted: #a3aab6;
  --text-faint: #8b93a1;
  --overlay: rgb(0 0 0 / 0.55);

  --success: #46c494;
  --success-soft: #16291f;
  --warning: #eeaa5b;
  --warning-soft: #2c2213;
  --danger: #ee7b72;
  --danger-solid: #c8473d;
  --danger-soft: #2e1c1b;
  --info: #66aff0;
  --info-soft: #16222f;
  --neutral-soft: #2d3240;

  --bk-col-bg: var(--surface-2);
  --bk-card-bg: #262a36;

  --sh-xs: none;
  --sh-card: none;
  --sh-menu: 0 8px 24px -4px rgb(0 0 0 / 0.5), 0 0 0 1px rgb(255 255 255 / 0.05);
  --sh-modal: 0 20px 50px -10px rgb(0 0 0 / 0.65);
}
