/* ==========================================================================
   EnFeed design tokens (ds v1, 2026-11-11)
   One world for all three apps: customer (/customer), driver (/driver), back office (/admin).
   World: the category-standard delivery app, played straight, at Shopee's craft level, in EnFeed turquoise.
   Light theme only: the apps are used outdoors in morning sun and in a lit office.
   Load order in every index.html:
     1. Google Fonts: https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;600;700&display=swap
     2. /static/ds/tokens.css   3. /static/ds/components.css   4. the app's own style.css
   Contrast notes (WCAG 2.1, against the surface each token is meant for) are written beside the values.
   ========================================================================== */

:root {
  color-scheme: light;

  /* ── Brand turquoise ─────────────────────────────────────────────────────
     600 is the incumbent EnFeed turquoise; 700 is the fill for anything with white text (5.5:1).
     Brand does primary jobs only: primary buttons, the live status banner, the active tab or menu item,
     selection, links. It never colours chart series, semantic states, or every icon. */
  --brand-50:  #EFFBF9;   /* tint ground for selected rows and live chips */
  --brand-100: #D2F7F2;
  --brand-200: #A6EFE6;
  --brand-300: #78DCCF;
  --brand-400: #45C6B7;
  --brand-500: #27B3A4;
  --brand-600: #19A092;   /* icons and large shapes only: 3.2:1 on white, too light for text */
  --brand-700: #10766B;   /* fills with white text 5.5:1 · brand text on white 5.5:1, on brand-50 5.2:1 */
  --brand-800: #0B5A52;   /* hover/pressed fill · focus ring · text on brand-100 7.1:1 */
  --brand-900: #07423C;   /* pressed fill */

  /* ── Neutrals (cool, very slightly toward the brand) ──────────────────── */
  --ink-900: #15191E;     /* primary text 16:1 on the ground */
  --ink-800: #262C33;
  --ink-700: #384049;     /* secondary text (--text-2 since v0.30.0) 10.4:1 on white, default icon colour */
  --ink-600: #545C66;     /* tertiary text (--text-3), inactive tab labels: 6.8:1 on white, 6.2:1 on the ground */
  --ink-500: #646C76;     /* placeholders, radio rings: 5.3:1 on white, 4.9:1 on the ground */
  --ink-400: #8C939C;     /* field and outline-button edges (--border-strong, 3.1:1 non-text), disabled text */
  --ink-300: #C3C8CE;     /* the line between list rows (--divider-strong) */
  --ink-200: #DDE1E5;     /* borders */
  --ink-150: #E8EBEE;     /* dividers, skeleton base, segmented track */
  --ink-100: #F3F5F6;     /* app ground */
  --ink-50:  #F8F9FA;     /* hover tint on white */
  --white:   #FFFFFF;

  /* ── Semantic states (never turquoise; always paired with an icon) ───── */
  --success-700: #145C2C;
  --success-600: #1B7A3A; /* text 5.4:1 on white, 4.8:1 on success-100 */
  --success-500: #23994A; /* icons */
  --success-200: #BFE6CB;
  --success-100: #E3F5E9;

  --warning-700: #7A4800;
  --warning-600: #9A5B00; /* text 5.4:1 on white, 5.0:1 on warning-100 */
  --warning-500: #E59A00; /* icons */
  --warning-200: #FFE3A3;
  --warning-100: #FFF4D6;

  --danger-700: #A61F1F;  /* danger hover/pressed */
  --danger-600: #C62828;  /* danger fill with white text 5.6:1 · text 5.6:1 on white, 4.9:1 on danger-100 */
  --danger-500: #E04848;  /* icons */
  --danger-200: #F7C7C7;
  --danger-100: #FDECEC;

  --info-700: #174A96;
  --info-600: #1F5FBF;    /* text 6.1:1 on white, 5.3:1 on info-100 */
  --info-500: #2F6FE0;    /* icons */
  --info-200: #C6D8FA;
  --info-100: #E8F0FD;

  /* Rating stars: gold fill with a darker rim so a filled star still reads at 3:1 */
  --star:       #F5B400;
  --star-rim:   #C98F00;
  --star-empty: #E3E6EA;
  --star-empty-rim: var(--ink-400);

  /* ── Queue colours (EnFeed plan queues; meanings are fixed product truth) ─
     red = waiting / late · yellow = in progress as planned · gray = truck changed
     sky = substitute confirmed (รับแทน) · green = delivered by the planned truck · navy = delivered by a changed truck
     Use them through .chip--q-* (icon + label), never as a coloured card edge. */
  --q-red: #DC2626;    --q-red-bg: #FEE2E2;    --q-red-ink: #991B1B;
  --q-yellow: #EAB308; --q-yellow-bg: #FEF9C3; --q-yellow-ink: #854D0E;
  --q-gray: #94A3B8;   --q-gray-bg: #F1F5F9;   --q-gray-ink: #475569;
  --q-sky: #0EA5E9;    --q-sky-bg: #E0F2FE;    --q-sky-ink: #075985;
  --q-green: #16A34A;  --q-green-bg: #DCFCE7;  --q-green-ink: #166534;
  --q-navy: #1D4ED8;   --q-navy-bg: #DBEAFE;   --q-navy-ink: #1E3A8A;

  /* ── Reading confidence on number fields (ช่องกรอบแดง = must check) ───── */
  --conf-high: var(--success-500); --conf-high-bg: var(--success-100); --conf-high-ink: var(--success-600);
  --conf-mid:  var(--warning-500); --conf-mid-bg:  var(--warning-100); --conf-mid-ink:  var(--warning-600);
  --conf-low:  var(--danger-600);  --conf-low-bg:  var(--danger-100);  --conf-low-ink:  var(--danger-600);

  /* ── Data series (charts). Series 1 may be brand; the rest never are ──── */
  --chart-1: #10766B;
  --chart-2: #4A6FD6;
  --chart-3: #D99A00;
  --chart-4: #8E64CF;
  --chart-5: #D1527A;
  --chart-6: #6B7785;
  --chart-grid: var(--ink-150);
  --chart-axis: var(--ink-500);

  /* ── Roles (use these in components; reach for the scales only when a role is missing) ── */
  --bg:             var(--ink-100);
  --surface:        var(--white);
  --surface-2:      var(--ink-50);
  --surface-sunken: var(--ink-100);
  /* v0.30.0 (ผู้ใช้ขอ 12 พ.ย. "คนแก่ใช้"): ข้อความรองเข้มขึ้นหนึ่งขั้น และขอบช่องกรอกถึง 3:1 ให้สายตาผู้สูงอายุเห็นชัดกลางแดด */
  --text:           var(--ink-900);
  --text-2:         var(--ink-700);   /* 10.4:1 on white (was ink-600) */
  --text-3:         var(--ink-600);   /* 6.8:1 on white (was ink-500) */
  --text-disabled:  var(--ink-400);
  --text-on-brand:  var(--white);
  --icon:           var(--ink-700);
  --border:         var(--ink-200);
  --border-strong:  var(--ink-400);   /* field and outline-button edges 3.1:1 (was ink-300, 1.6:1) */
  --divider:        var(--ink-150);
  --divider-strong: var(--ink-300);   /* v0.30.0: the line between list rows (ผู้ใช้ขอ "เส้นระหว่างแถวคนขับให้ชัดขึ้น") */
  --primary:        var(--brand-700);
  --primary-hover:  var(--brand-800);
  --primary-press:  var(--brand-900);
  --primary-tint:   var(--brand-50);
  --primary-tint-2: var(--brand-100);
  --link:           var(--brand-700);
  --focus:          var(--brand-800);
  --focus-on-brand: var(--white);
  --scrim:          rgba(12, 18, 24, 0.5);
  --selection:      var(--brand-200);

  /* ── Type ───────────────────────────────────────────────────────────────
     Noto Sans Thai (Google Fonts, 400/600/700): the Android system Thai voice, loopless, sturdy in sun.
     Fixed rem scale (product UI, not fluid). Every count uses tabular numerals (.num or .tnum). */
  --font-sans: "Noto Sans Thai", "Noto Sans", "Leelawadee UI", Tahoma, system-ui, -apple-system, "Segoe UI", sans-serif;

  --fs-12: 0.75rem;     /* badge counts only */
  --fs-13: 0.8125rem;   /* captions, chip text, tab-bar labels */
  --fs-14: 0.875rem;    /* secondary text, meta lines */
  --fs-16: 1rem;        /* body, list titles, inputs (16px stops iOS zoom) */
  --fs-18: 1.125rem;    /* app-bar title, card titles, dialog titles */
  --fs-20: 1.25rem;     /* key numbers in rows */
  --fs-24: 1.5rem;      /* banner title, lead number */
  --fs-32: 2rem;        /* hero number */
  --fs-40: 2.5rem;      /* one giant number per screen at most */

  --fw-regular: 400;
  --fw-semibold: 600;
  --fw-bold: 700;

  --lh-tight: 1.25;     /* numbers and one-line titles */
  --lh-snug: 1.4;       /* titles that may wrap */
  --lh-body: 1.55;      /* Thai body text needs room for stacked marks */

  /* ── Space (4 px base) ─────────────────────────────────────────────────── */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* ── Radii (v0.30.0: one step softer for a more current feel; still climbing with size, never pill-everything) ── */
  --r-xs: 4px;          /* plates, small tags */
  --r-sm: 8px;          /* tooltips, checkboxes */
  --r-md: 12px;         /* buttons, inputs, thumbnails */
  --r-lg: 16px;         /* cards, notices, choice rows */
  --r-xl: 20px;         /* dialogs, sheets (top corners) */
  --r-pill: 999px;      /* chips, badges, toggle chips */

  /* ── Elevation (offset + soft blur; cards stay nearly flat like the category) ── */
  --shadow-1: 0 0 0 1px rgba(16, 24, 32, 0.06), 0 1px 3px rgba(16, 24, 32, 0.08);   /* v0.30.0: hairline + soft lift, so a card's edge survives sunlight (white on the ground is only 1.09:1) */
  --shadow-2: 0 2px 8px rgba(16, 24, 32, 0.10);
  --shadow-3: 0 12px 32px rgba(16, 24, 32, 0.20);
  --shadow-up: 0 -1px 0 var(--ink-150), 0 -4px 16px rgba(16, 24, 32, 0.06);

  /* ── Focus ─────────────────────────────────────────────────────────────── */
  --focus-width: 3px;
  --focus-offset: 2px;

  /* ── Motion: short, exponential ease-out, state only ─────────────────── */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.5, 0, 0.75, 0);
  --ease-std: cubic-bezier(0.2, 0, 0, 1);
  --dur-1: 120ms;       /* press, hover, colour */
  --dur-2: 200ms;       /* toggles, fades, tabs */
  --dur-3: 280ms;       /* sheets and dialogs entering */
  --dur-exit: 180ms;    /* anything leaving */

  /* ── Sizes ───────────────────────────────────────────────────────────────
     v0.30.0: controls are in rem so they grow with the text. The root size is 17 px on desktop and 18 px on
     touch screens (components.css base), so on a phone: tap 49.5 · input 54 · bottom-bar button 58.5 · tab bar 67.5 px. */
  --tap: 2.75rem;            /* minimum touch target, every app (44 px at 16 px) */
  --control-h: 2.75rem;      /* buttons, segmented, toggle rows */
  --control-h-sm: 2.25rem;   /* compact buttons on fine pointers only */
  --control-h-lg: 3.25rem;   /* primary action in bottom bars */
  --input-h: 3rem;
  --appbar-h: 56px;
  --tabbar-h: 3.75rem;
  --actionbar-h: 4.625rem;
  --gutter: 16px;
  --content-max: 720px;      /* one reading column (lists, forms) */
  --wide-max: 1120px;        /* header row and two-pane pages */
  --aside-w: 360px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

  /* ── Layers ────────────────────────────────────────────────────────────── */
  --z-sticky: 10;
  --z-appbar: 20;
  --z-tabbar: 30;
  --z-actionbar: 30;
  --z-overlay: 40;
  --z-toast: 60;
  --z-tip: 70;

  /* Breakpoints (media queries cannot read custom properties; copy these numbers):
     phone < 600 px · tablet 600–1023 px · desktop ≥ 1024 px (two-pane) · wide ≥ 1280 px (one-row top menu)
     Touch mode (bottom tab bar): (max-width: 767.98px), (hover: none) and (pointer: coarse) */
}
