/*
 * BixiCash UI shell tokens — plain CSS custom properties.
 * Source: docs/ui-shell-tokens.md. Do not fork this file per segment; add
 * segment-specific tokens (if ever needed) as additional custom properties in
 * the segment's own stylesheet, layered after this one.
 */

@font-face {
  font-family: 'Inter';
  src: url('./fonts/InterVariable.woff2') format('woff2-variations'), url('./fonts/InterVariable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Noto Naskh Arabic';
  src: url('./fonts/NotoNaskhArabic-arabic.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

:root {
  /* Accent — the tenant manifest may override this at render time. */
  --accent: #4656E8;
  --accent-strong: #3646D6;
  --accent-tint: color-mix(in srgb, var(--accent) 12%, transparent);

  /* Ink and surfaces */
  --ink: #374151;
  --ink-strong: #1F2937;
  --ink-muted: #6B7280;
  --page-bg: #F9FAFB;
  --surface: #FFFFFF;
  --hairline: rgba(4, 32, 69, .10);
  --control-border: #6B7280;
  --subtle: #F3F4F6;

  /* Status */
  --success: #1F7A4D;
  --success-tint: rgba(31, 122, 77, .10);
  --danger: #B42318;
  --danger-tint: rgba(180, 35, 24, .10);
  --warning: #B54708;
  --warning-tint: rgba(181, 71, 8, .10);
  --mute-tint: #F3F4F6;
  --mute-text: #4B5563;

  /* Radii */
  --radius-sm: 4px;
  --radius-control: 6px;
  --radius-card: 12px;
  --radius-pill: 999px;

  /* Shadow */
  --shadow-card: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 24px -16px rgba(15, 23, 42, .12);

  /* Type */
  /* Hindi and Chinese use the device's own fonts (Nirmala UI / Noto on Windows and
     Android, PingFang on Apple) rather than multi-megabyte bundled faces. */
  --font-sans: var(--font-text);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text-2xs: 11px;
  --text-2xs-line: 16px;
  --text-xs: 12px;
  --text-xs-line: 16px;
  --text-sm: 14px;
  --text-sm-line: 20px;
  --text-md: 16px;
  --text-md-line: 24px;
  --text-lg: 20px;
  --text-lg-line: 28px;

  /* Rhythm and back-office sizes */
  --gap: 16px;
  --section-gap: 24px;
  --card-pad-y: 16px;
  --card-pad-x: 20px;
  --sidebar-w: 240px;
  --topbar-h: 56px;
  --nav-item-h: 40px;
  --control-h: 40px;
  --control-h-sm: 28px;
  --table-header-h: 33px;
  --table-row-h: 65px;

  /* Till sizes (per docs/ui-shell-tokens.md "The till is different") */
  --till-touch-min: 48px;
  --till-tile-w: 112px;
  --till-tile-h: 80px;
}

/* Category palette. Eight hues assigned to product categories, classes and
   people by a stable hash (shared/media.js), so the same category is the same
   colour on every screen and in every segment. Each hue has a solid, a tint
   for backgrounds and an ink that reads on the tint (WCAG AA). */
:root {
  --cat-0: #F59F00; --cat-0-tint: #FFF3D6; --cat-0-ink: #7A4A00;  /* saffron */
  --cat-1: #12B886; --cat-1-tint: #DDF8EE; --cat-1-ink: #09624A;  /* mint */
  --cat-2: #E64980; --cat-2-tint: #FFE6EF; --cat-2-ink: #9C1B47;  /* rose */
  --cat-3: #228BE6; --cat-3-tint: #E2F0FF; --cat-3-ink: #155A99;  /* sky */
  --cat-4: #7950F2; --cat-4-tint: #EEE8FF; --cat-4-ink: #5234B8;  /* violet */
  --cat-5: #74B816; --cat-5-tint: #EEF8DB; --cat-5-ink: #45700C;  /* leaf */
  --cat-6: #FD7E14; --cat-6-tint: #FFEDDC; --cat-6-ink: #9A4A06;  /* marigold */
  --cat-7: #15AABF; --cat-7-tint: #DDF6F9; --cat-7-ink: #0B6776;  /* teal */
}

/* ---------- Theme layer (docs/prototypes/BATCH-2026-11-THEME-LAYER.md) ----------
   Defaults equal today's values. A theme sets the *-face tokens, never
   --font-sans, --font-display or --font-ur. */
:root {
  --font-text-face: Inter;
  --font-display-face: var(--font-text-face);
  --font-ur: 'Noto Naskh Arabic';          /* fixed: Urdu body and tables are always Naskh */
  --font-ur-display: var(--font-ur);       /* a theme may name 'Noto Nastaliq Urdu' (titles only) */
  --font-fallback: 'Nirmala UI', 'Noto Sans Devanagari', 'Microsoft YaHei', 'PingFang SC', 'Noto Sans SC', system-ui, sans-serif;
  --font-text: var(--font-text-face), var(--font-ur), var(--font-fallback);
  --font-display: var(--font-display-face), var(--font-ur), var(--font-fallback);
  --support: #475569;                      /* no consumer until a theme uses it */
  --support-tint: color-mix(in srgb, var(--support) 12%, transparent);
  --block-gap: 16px;                       /* margin-block-end of kit blocks */
  --section-title-pad-y: 14px;
  --toolbar-pad-y: 12px;
  --toolbar-pad-x: 16px;
  /* Charts (shared/charts.js): slot 1 follows the accent; 2-8 are a validated order (§6). */
  --chart-1: var(--accent);
  --chart-2: #EB6834; --chart-3: #1BAF7A; --chart-4: #EDA100; --chart-5: #E87BA4;
  --chart-6: #008300; --chart-7: #4A3AA7; --chart-8: #E34948;
  --chart-grid: #E5E7EB;                   /* the neutrals equal charts.js's fallbacks */
  --chart-text: var(--ink);
  --chart-muted: var(--ink-muted);
}

/* Segment accents: boot() stamps data-segment on <html>. Each accent keeps
   white text at AA contrast on filled buttons. */
[data-segment='retail']     { --accent: #4656E8; --accent-strong: #3646D6; }
[data-segment='bookshop']   { --accent: #8E3FBF; --accent-strong: #7A33A6; }
[data-segment='restaurant'] { --accent: #C2361F; --accent-strong: #A32D1A; }
[data-segment='school']     { --accent: #1971C2; --accent-strong: #155FA3; }
[data-segment='traders']    { --accent: #B45309; --accent-strong: #92400E; }
[data-segment='pharmacy']   { --accent: #0B7D57; --accent-strong: #086A49; }
[data-segment='fastfood']   { --accent: #E8590C; --accent-strong: #C2410C; }
[data-segment='flourmill']  { --accent: #A16207; --accent-strong: #854D0E; }
[data-segment='lubricants'] { --accent: #0E7490; --accent-strong: #155E75; }
[data-segment='distribution'] { --accent: #BE185D; --accent-strong: #9D174D; }
[data-segment='autoparts']  { --accent: #475569; --accent-strong: #334155; }
[data-segment='fuelstation'] { --accent: #0F766E; --accent-strong: #115E59; }

/* Urdu / RTL: Noto Naskh Arabic leads the stack; direction flips via [dir=rtl]
   on <html>, set by shared/i18n.js. Logical properties in components.css and
   print.css do the rest of the mirroring automatically. */
[dir='rtl'] {
  --font-sans: var(--font-ur), var(--font-text-face), system-ui, sans-serif;
  --font-display: var(--font-ur-display), var(--font-display-face), system-ui, sans-serif;
  --title-line: var(--ur-title-line, var(--text-lg-line));
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  color: var(--ink);
  background: var(--page-bg);
}

.num {
  font-family: var(--font-num, var(--font-mono));
  font-variant-numeric: tabular-nums;
  text-align: end;
}

a {
  color: var(--accent-strong);
}

a:hover {
  color: var(--accent);
}

/* Elements hidden with el.hidden stay hidden even when a class sets display. */
[hidden] { display: none !important; }

/* Density (theme.density). Phones ignore it; tablets stop at standard (48 px rows stay touchable). */
html[data-bx-density='standard']:not(.bx-phone),
html[data-bx-density='compact'].bx-tablet {
  --table-row-h: 48px; --table-header-h: 32px; --card-pad-x: 16px; --section-title-pad-y: 12px;
  --toolbar-pad-y: 8px; --kpi-pad-y: 16px; --kpi-pad-x: 16px;
}
html[data-bx-density='compact'].bx-desktop {
  --table-row-h: 40px; --table-header-h: 32px; --table-text: 13px; --card-pad-y: 12px; --card-pad-x: 16px;
  --section-title-pad-y: 8px; --toolbar-pad-y: 8px; --kpi-pad-y: 12px; --kpi-pad-x: 16px;
  --kpi-icon-size: 40px; --block-gap: 8px; --section-gap: 16px;
}
/* KPI tiles (theme.tiles). 'hue', today's tinted category well, declares nothing. */
html[data-bx-tiles='quiet']  { --kpi-icon-bg: var(--subtle); --kpi-icon-ink: var(--ink-muted); }
html[data-bx-tiles='accent'] { --kpi-icon-bg: var(--accent-tint); --kpi-icon-ink: var(--accent-strong); }
html[data-bx-tiles='figure'] { --kpi-icon-display: none; --kpi-value-size: 24px; --kpi-value-line: 32px; --font-figure: var(--font-display); }
