/* ============================================================================
   POSSupplyChain — DESIGN TOKENS
   Pack: fintech-glass (router score 16, tied with ops-console at 16 -> router
   order resolves to fintech-glass; design_plan.py independently routes
   fintech-glass from the brief lexicon: payment/ledger/accounting/stock/price/
   market/cost/tax). Layout contract: kpi-strip + dense data table + sparkline
   cards. Motion: quick, precise, no bounce. Numerals: tabular, sans.
   Provenance: _meta/design/themes.css (pack palette, extended — never forked)
   + _meta/design/MOTION_BASELINE.md.
   This file carries VALUES ONLY. Structure/behaviour lives in motion.css.
   Every value is RTL-safe: logical properties, no left/right assumptions.
   ========================================================================== */

/* ---------------------------------------------------------------- primitives
   Non-theme scales. Stable across packs so component CSS never hardcodes px. */
:root {
  /* 4px spacing rhythm */
  --m-s-1: .25rem;  --m-s-2: .5rem;   --m-s-3: .75rem;  --m-s-4: 1rem;
  --m-s-5: 1.5rem;  --m-s-6: 2rem;    --m-s-7: 3rem;    --m-s-8: 4rem;

  /* type scale — dense money/data UI, sized to stay legible at 100% zoom.
     Floor is 13px for meta text and 14px for tabular data: Arabic needs the
     extra pixel, and one scale serves both languages. */
  --m-t-xs: .8125rem;  --m-t-sm: .875rem;   --m-t-base: 1rem;
  --m-t-md: 1.125rem;  --m-t-lg: 1.375rem;  --m-t-xl: 1.75rem;
  --m-t-2xl: 2.25rem;  --m-t-3xl: 3rem;
  --m-lh-tight: 1.2;   --m-lh-snug: 1.4;    --m-lh: 1.6;
  --m-fw-regular: 400; --m-fw-medium: 500; --m-fw-semi: 600; --m-fw-bold: 700;
  /* Tracking is for Latin only: Arabic joining collapses under it, so every
     RTL surface resets it (see the rtl block at the end of motion.css). */
  --m-track-wide: .12em; --m-track-tight: -.01em; --m-track-num: -.01em;

  /* depth ladder — one family, three heights */
  --m-z-base: 1; --m-z-sticky: 20; --m-z-nav: 1030; --m-z-toast: 1080;

  /* glass + hairline */
  --m-blur: 12px; --m-blur-lg: 20px;
  --m-hairline: 1px;

  /* motion vocabulary — one contract, three speeds (baseline values) */
  --m-fast: 140ms; --m-base: 220ms; --m-slow: 620ms;
  --m-ease: cubic-bezier(.2, .9, .25, 1);
  --m-ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --m-ease-out: cubic-bezier(.16, 1, .3, 1);

  /* content measure */
  --m-container: 1440px;
  --m-read: 68ch;
}

/* ------------------------------------------------------- pack: fintech-glass
   dense money/data apps: prices, ledgers, risk, portfolios.
   glass surfaces, tabular numerals, teal->violet accent, tight radii. */
[data-theme="fintech-glass"] {
  /* canvas */
  --m-bg: #070a12; --m-bg-2: #0b1020;
  --m-surface: rgba(255,255,255,.05); --m-surface-2: rgba(255,255,255,.085);
  --m-surface-3: rgba(255,255,255,.125);
  --m-border: rgba(148,177,255,.16); --m-border-strong: rgba(148,177,255,.30);
  --m-text: #eaf0ff; --m-muted: #a3b0cc; --m-faint: #8695b6;

  /* accent ramp */
  --m-indigo: #5b8cff; --m-cyan: #2ee6c5; --m-pink: #a78bfa; --m-amber: #ffd166;
  --m-grad: linear-gradient(120deg, #5b8cff, #2ee6c5 60%, #a78bfa);
  --m-grad-soft: linear-gradient(120deg, rgba(91,140,255,.20), rgba(46,230,197,.14) 60%, rgba(167,139,250,.16));
  --m-grad-line: linear-gradient(90deg, transparent, var(--m-border-strong) 12%, var(--m-border-strong) 88%, transparent);

  /* shape — tight radii, money-app precision */
  --m-r-sm: 8px; --m-r: 12px; --m-r-lg: 16px; --m-r-pill: 999px;

  /* depth — dark canvas, so shadow reads as lift, not as grey haze */
  --m-shadow: 0 1px 1px rgba(0,0,0,.35), 0 10px 26px -18px rgba(0,0,0,.85);
  --m-shadow-hi: 0 2px 2px rgba(0,0,0,.4), 0 24px 60px -26px rgba(91,140,255,.55);
  --m-shadow-inset: inset 0 1px 0 rgba(255,255,255,.06);

  /* focus — one visible ring everywhere */
  --m-focus: 0 0 0 2px var(--m-bg), 0 0 0 4px var(--m-cyan);

  /* type voice — Arabic resolves to the self-hosted Plex Arabic face through
     its unicode-range, so Latin keeps the native Windows voice and Arabic
     gets proper Naskh shaping with real weight steps. */
  --m-font-display: "Plex Arabic", "Segoe UI", system-ui, sans-serif;
  --m-font-body: "Plex Arabic", "Segoe UI", system-ui, -apple-system, "Tahoma", sans-serif;
  --m-font-mono: ui-monospace, "Cascadia Mono", "Consolas", "Courier New", monospace;

  /* state semantics — the vocabulary the supply-chain screens speak.
     ok/attention/critical map to stock health, PO ageing, count variance. */
  --m-ok: #2ee6c5;        --m-ok-bg: rgba(46,230,197,.12);
  --m-info: #5b8cff;      --m-info-bg: rgba(91,140,255,.14);
  --m-warn: #ffd166;      --m-warn-bg: rgba(255,209,102,.13);
  --m-danger: #ff6b81;    --m-danger-bg: rgba(255,107,129,.13);
  --m-neutral: #8f9dbb;   --m-neutral-bg: rgba(143,157,187,.12);

  /* data-table density — dense rows for 1440, comfortable for 390 */
  --m-row-h: 40px;
  --m-cell-x: .8rem;
  --m-cell-y: .55rem;
}

/* ------------------------------------------------------------------- bridge
   Map Bootstrap's own variables onto the pack so the 75 existing views
   (card / table / badge / alert / form-control / btn) inherit the system
   without a single .cshtml edit. Bootstrap 5 reads these at :root scope. */
[data-theme] {
  --bs-body-bg: transparent;
  --bs-body-color: var(--m-text);
  --bs-body-color-rgb: 234, 240, 255;
  --bs-emphasis-color: #fff;
  --bs-secondary-color: var(--m-muted);
  --bs-secondary-bg: var(--m-surface-2);
  --bs-tertiary-color: var(--m-faint);
  --bs-tertiary-bg: var(--m-surface);
  --bs-border-color: var(--m-border);
  --bs-border-color-translucent: var(--m-border);
  --bs-heading-color: var(--m-text);
  --bs-link-color: var(--m-cyan);
  --bs-link-color-rgb: 46, 230, 197;
  --bs-link-hover-color: #7cf2dc;
  --bs-primary: var(--m-indigo);
  --bs-primary-rgb: 91, 140, 255;
  --bs-success: var(--m-ok);
  --bs-danger: var(--m-danger);
  --bs-warning: var(--m-warn);
  --bs-info: var(--m-info);
  --bs-card-bg: var(--m-surface);
  --bs-card-border-color: var(--m-border);
  --bs-card-cap-bg: transparent;
  --bs-table-bg: transparent;
  --bs-table-color: var(--m-text);
  --bs-table-border-color: var(--m-border);
  --bs-table-hover-bg: rgba(91,140,255,.09);
  --bs-table-hover-color: var(--m-text);
  --bs-table-striped-bg: rgba(255,255,255,.03);
  /* These three were missing, so .table-striped painted Bootstrap's default
     #212529 text on the dark canvas — every odd row read as "faded away"
     (contrast measured 1.28:1). Stripes must tint the row, never the text. */
  --bs-table-striped-color: var(--m-text);
  --bs-table-active-bg: rgba(91,140,255,.14);
  --bs-table-active-color: var(--m-text);
  --bs-input-bg: rgba(255,255,255,.04);
  --bs-dropdown-bg: #0d1221;
  --bs-dropdown-border-color: var(--m-border-strong);
  --bs-dropdown-link-hover-bg: var(--m-surface-2);
  --bs-modal-bg: #0b1020;
  --bs-radius: var(--m-r);
  --bs-border-radius: var(--m-r-sm);
  --bs-border-radius-sm: var(--m-r-sm);
  --bs-border-radius-lg: var(--m-r);
  --bs-focus-ring-color: rgba(46,230,197,.45);
  --bs-font-sans-serif: var(--m-font-body);
}

/* --------------------------------------------------------------- typography
   Money and quantities must align column-to-column: tabular figures, always. */
[data-theme] body {
  font-family: var(--m-font-body);
  font-size: var(--m-t-base);
  line-height: var(--m-lh);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "cv05" 1;
}
[data-theme] table,
[data-theme] .m-kpi__value,
[data-theme] .m-num,
[data-theme] .text-end,
[data-theme] .font-monospace {
  font-variant-numeric: tabular-nums;
}
[data-theme] small,
[data-theme] .small { font-size: var(--m-t-sm); }
[data-theme] .text-muted { color: var(--m-muted) !important; }
[data-theme] .font-monospace { font-family: var(--m-font-mono); }
[data-theme] ::selection { background: rgba(46,230,197,.28); color: #fff; }

/* --------------------------------------------------------------- scrollbars
   Dark canvas needs a dark bar, or the rail reads as a bright defect. */
[data-theme] * { scrollbar-color: rgba(148,177,255,.28) transparent; scrollbar-width: thin; }
[data-theme] *::-webkit-scrollbar { width: 10px; height: 10px; }
[data-theme] *::-webkit-scrollbar-track { background: transparent; }
[data-theme] *::-webkit-scrollbar-thumb {
  background: rgba(148,177,255,.22);
  border: 2px solid transparent;
  background-clip: content-box;
  border-radius: var(--m-r-pill);
}
[data-theme] *::-webkit-scrollbar-thumb:hover { background: rgba(148,177,255,.4); background-clip: content-box; }
