/* ═══════════════════════════════════════════════════════════
   2NiceDress Design Tokens  (Phase 0 — UI revamp 2026-07)
   Link on MIGRATED pages only, before navbar.css + page styles:
     <link rel="stylesheet" href="/css/tokens.css">
     <script src="/js/theme.js"></script>   ← non-defer, sets data-theme
   Rules:
   - No font-size below 12px anywhere.
   - --font-display / --font-mono are for Latin + numbers ONLY.
     Thai headings use --font-body weight 600.
   ═══════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;

  /* ── Surfaces ── */
  --bg: #f5f3ef;
  --surface: #ffffff;
  --surface-2: #f8f7f4;        /* inset panels on a card */
  --surface-drawer: #faf8f4;
  --hover-bg: #efece5;
  --active-bg: #f1ece1;

  /* ── Text ── */
  --ink: #0a0a0a;
  --ink-2: #49443c;            /* secondary text */
  --muted: #6b6559;            /* dark enough to read at 14px on white */

  /* ── Lines ── */
  --border: #e0ddd7;
  --line: #e8e6e1;

  /* ── Accents / status ── */
  --accent: #c9860a;
  --danger: #d94f4f;
  --danger-bg: #fff5f5;
  --success: #3d8f5f;
  --success-bg: #ecfdf5;
  --warn: #b45309;
  --warn-bg: #fff7ed;
  --info: #3a5fc8;
  --info-bg: #eff6ff;

  /* ── order_items.type badges ── */
  --type-rent-bg: #e8f0fe;        --type-rent-fg: #3a5fc8;
  --type-reserve-bg: #f3e8fd;     --type-reserve-fg: #7c3acd;
  --type-tailorbuy-bg: #fff3e0;   --type-tailorbuy-fg: #b45309;
  --type-tailorrent-bg: #e8fdf0;  --type-tailorrent-fg: #1e7e4a;
  --type-sale-bg: #ecfdf5;        --type-sale-fg: #1e7e4a;

  /* ── Misc ── */
  --fab-bg: #0a0a0a;
  --fab-fg: #ffffff;
  --chip-active-bg: #0a0a0a;
  --chip-active-fg: #ffffff;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, .05);
  --shadow-card-hover: 0 4px 14px rgba(0, 0, 0, .08);
  --shadow-pop: 0 10px 28px rgba(10, 10, 10, .12);
  --overlay: rgba(30, 27, 22, .35);
  --track-bg: rgba(0, 0, 0, .08);         /* progress bar / donut ring track */
  --scanner-bg: #0a0a0a;                  /* fullscreen camera scanner — intentionally dark in both themes */
  --scanner-fg: #ffffff;

  /* ── Dashboard stat & KPI card colors (index.html) ── */
  --green-bg: #d6ecd4;         --green-text: #2d6b29;
  --yellow-bg: #f5e6b0;        --yellow-text: #7a5c00;
  --orange-bg: #f5d9c0;        --orange-text: #8a3d10;
  --card-blue-bg: #d6e8f5;     --card-blue-accent: #2c6fa8;
  --card-pink-bg: #f5d6e8;     --card-pink-accent: #b03070;
  --card-yellow-bg: #f5f0c8;   --card-yellow-accent: #8a7000;
  --card-green-bg: #e8f5e4;    --card-green-accent: #2d6b29;

  /* ── Fonts ── */
  --font-display: 'Cormorant Garamond', Georgia, serif; /* Latin/numbers only */
  --font-body: 'IBM Plex Sans Thai', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace; /* Latin/numbers only */

  /* ── Type scale — EXACTLY 4 sizes, do not add steps ──
     14 = secondary (labels, meta, badges, eyebrow)
     16 = base (body, values, inputs, chips, buttons)
     18 = card titles
     28 = page titles
     (+ --fs-display 40px for big KPI numbers only) */
  --fs-sm: 14px;
  --fs-base: 16px;
  --fs-card-title: 18px;
  --fs-title: 28px;        /* page title — Thai: font-body 600 */
  --fs-display: 40px;      /* numbers only — font-display */

  /* aliases (older names) — all resolve into the 4-step scale */
  --fs-eyebrow: var(--fs-sm);
  --fs-meta: var(--fs-sm);
  --fs-label: var(--fs-sm);
  --fs-body: var(--fs-base);
  --fs-lg: var(--fs-base);
}

/* ═══ Dark theme — warm atelier, not pure black ═══ */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #1b1813;
  --surface: #26221b;
  --surface-2: #2e2921;
  --surface-drawer: #221e17;
  --hover-bg: #332d23;
  --active-bg: #3a3325;

  --ink: #f2ede4;
  --ink-2: #d6cfc2;
  --muted: #b3aa9b;

  --border: #3a342a;
  --line: #332d24;

  --accent: #e0a33b;
  --danger: #f07a72;
  --danger-bg: #3a2320;
  --success: #6fc493;
  --success-bg: #1f322a;
  --warn: #e0a35e;
  --warn-bg: #382c1c;
  --info: #8fb0f5;
  --info-bg: #232c42;

  --type-rent-bg: #232c42;        --type-rent-fg: #9db8ff;
  --type-reserve-bg: #322441;     --type-reserve-fg: #cba4f5;
  --type-tailorbuy-bg: #382c1c;   --type-tailorbuy-fg: #e8b06a;
  --type-tailorrent-bg: #1f322a;  --type-tailorrent-fg: #7fd6a4;
  --type-sale-bg: #1c3329;        --type-sale-fg: #6ee7a8;

  --fab-bg: #f2ede4;
  --fab-fg: #1b1813;
  --chip-active-bg: #f2ede4;
  --chip-active-fg: #1b1813;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, .35);
  --shadow-card-hover: 0 4px 14px rgba(0, 0, 0, .5);
  --shadow-pop: 0 10px 28px rgba(0, 0, 0, .55);
  --overlay: rgba(0, 0, 0, .55);
  --track-bg: rgba(255, 255, 255, .12);
  --scanner-bg: #0a0a0a;                  /* fullscreen camera scanner — intentionally dark in both themes */
  --scanner-fg: #ffffff;

  /* ── Dashboard stat & KPI card colors — dark (warm atelier, muted bg / brighter fg) ── */
  --green-bg: #1f3220;         --green-text: #7ecb82;
  --yellow-bg: #3a2f14;        --yellow-text: #e0c260;
  --orange-bg: #3a2415;        --orange-text: #e0935e;
  --card-blue-bg: #1c2e3d;     --card-blue-accent: #7fb3e0;
  --card-pink-bg: #3a2030;     --card-pink-accent: #e07fb0;
  --card-yellow-bg: #383014;   --card-yellow-accent: #e0c25e;
  --card-green-bg: #223622;    --card-green-accent: #7ecb82;
}

/* Soften photos slightly in dark so they don't glare */
:root[data-theme="dark"] img { filter: brightness(.92); }
