/* ============================================================
   Queens Bakery — Unified Design Tokens (platform-ux)
   One token set for platform admin, POS, factory machines, HR.
   Light theme on :root, dark theme on [data-theme="dark"].
   NO network fonts. NO hardcoded colors outside this file.
   ============================================================ */

:root {
  color-scheme: light;

  /* ---- Brand: Queens Fiesta Red ---- */
  --brand: #de2027;
  --brand-deep: #aa182c;
  --brand-soft: #fce8e8;
  --brand-contrast: #ffffff;

  /* ---- Area accents (3px topbar underline only) ---- */
  --accent-pos: #a4541c;      /* POS terracotta heritage */
  --accent-factory: #5a6472;  /* machines workspace */
  --accent-default: var(--brand);

  /* ---- Warm neutrals ---- */
  --bg: #f3f1ed;
  --panel: #ffffff;
  --panel-2: #f8f6f2;
  --ink: #221d1a;
  --muted: #847b71;
  --line: #e7e2da;
  --line-soft: #f0ece6;
  --grid-line: #c4bcb0;

  /* ---- Status semantics (one meaning everywhere) ---- */
  --ok: #1f7a33;       --ok-soft: #e4f3e6;      /* done · delivered · passed */
  --warn: #9a5800;     --warn-soft: #fbeed3;    /* due soon · after-print · auto-post */
  --bad: #c62828;      --bad-soft: #fdeaea;     /* blocked · exception · overdue */
  --info: #1565c0;     --info-soft: #e8f1fb;    /* informational · in transit */
  --auto: #6a4fa3;     --auto-soft: #efeaf8;    /* done by agent/automation */
  --hl-bg: #fff4c2;    --hl-ink: #4d3410;       /* highlight */

  /* ---- Pipeline stage states ---- */
  --stage-done: var(--ok);
  --stage-done-soft: var(--ok-soft);
  --stage-current: var(--brand);
  --stage-current-soft: var(--brand-soft);
  --stage-pending: #b7b0a6;
  --stage-pending-soft: #efece7;
  --stage-blocked: var(--bad);
  --stage-blocked-soft: var(--bad-soft);
  --stage-skipped: #9c948a;

  /* ---- Sidebar (dark in BOTH themes) ---- */
  --sidebar-bg: #18110f;
  --sidebar-surface: #2a2320;
  --sidebar-text: #cdc6bb;
  --sidebar-dim: #8d8479;
  --sidebar-heading: #ffffff;
  --sidebar-active: #f24852;

  /* ---- Typography (system Thai-capable stack — offline) ---- */
  --font: 'Segoe UI', 'Leelawadee UI', 'Sarabun', 'Noto Sans Thai', Tahoma, sans-serif;
  --text-xs: 13px;
  --text-sm: 15px;
  --text-base: 18px;
  --text-lg: 21px;
  --text-xl: 26px;
  --text-2xl: 32px;
  --leading: 1.55;

  /* ---- Spacing scale ---- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;

  /* ---- Shape & elevation ---- */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --pill: 999px;
  --shadow-sm: 0 1px 2px rgba(34, 29, 26, .06);
  --shadow-md: 0 3px 10px rgba(34, 29, 26, .10);
  --shadow-lg: 0 10px 30px rgba(34, 29, 26, .16);
  --focus: 0 0 0 3px rgba(222, 32, 39, .20);

  /* ---- Layout & touch ---- */
  --touch: 44px;
  --topbar-h: 58px;
  --sidebar-w: 188px;   /* compact Thai-only nav (was 232 with EN sublabels) */

  /* ---- Physical label sticker preview (labels.html) ----
     Deliberately theme-invariant: a real white thermal sticker
     looks the same in dark mode, so there is NO dark override. */
  --label-paper: #ffffff;
  --label-ink: #151312;
  --label-preprint: #de2027; /* factory-preprinted red logo / warning strip zones */
}

[data-theme="dark"] {
  color-scheme: dark;

  --brand: #f24852;
  --brand-deep: #d6303c;
  --brand-soft: #3a1f22;
  --brand-contrast: #ffffff;

  --accent-pos: #d98a4f;
  --accent-factory: #93a0b0;

  --bg: #141312;
  --panel: #1e1c1a;
  --panel-2: #262320;
  --ink: #ece7e0;
  --muted: #a29a8f;
  --line: #34302b;
  --line-soft: #2b2824;
  --grid-line: #423d37;

  --ok: #5cc46b;       --ok-soft: #1d3320;
  --warn: #f5c451;     --warn-soft: #3a2d10;
  --bad: #f0676c;      --bad-soft: #3d1d1f;
  --info: #5aa6e8;     --info-soft: #16283a;
  --auto: #a78bdb;     --auto-soft: #2a2138;
  --hl-bg: #4a3d10;    --hl-ink: #ffe9a8;

  --stage-pending: #6e675e;
  --stage-pending-soft: #2b2824;
  --stage-skipped: #6e675e;

  --sidebar-bg: #100c0b;
  --sidebar-surface: #241e1b;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 3px 10px rgba(0, 0, 0, .45);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, .55);
  --focus: 0 0 0 3px rgba(242, 72, 82, .30);
}

/* Motion courtesy */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
