/* ==========================================================================
   EnFeed components (ds v1, 2026-11-11) — shared by /customer, /driver and /admin. Needs tokens.css first.
   Naming: .block, .block__part, .block--variant; states through aria-* or .is-*.
   Component selectors stay one class deep so an app's style.css can adjust them; element defaults sit in :where().
   Chrome rule (all apps): touch mode = bottom tab bar = (max-width: 767.98px), (hover: none) and (pointer: coarse);
   everything else gets the top menu (two rows at 768–1279 px, one row from 1280 px).
   Contents: base · layout · brand · app bar + nav · icon button · badge · buttons · chips · plate · cards · rows ·
   kv · order card · status band + step track · timeline · tabs · segmented · forms · choices · switch ·
   confidence fields · pin + numpad · stars · photos · notices · dialog · sheet · viewer · toast · skeleton ·
   empty · table · metric · avatar · route · action bar · illustrations · utilities · motion
   ========================================================================== */

:root { --chrome-top: var(--appbar-h); }

/* ── Base ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
/* v0.30.0 type for older eyes (ผู้ใช้ขอ 12 พ.ย. "คนแก่ใช้"): every font size and control height is in rem, so the root sets
   the whole scale — 17 px on desktop, 18 px on touch screens (phones, iPad) where the drivers and shop owners are. */
/* v0.30.1 (ผู้ใช้ 17 พ.ย. "จอมือถือล้น" = หน้าถูกซูมค้าง): two quick taps (numpad, stars) no longer zoom the page;
   pinch-zoom still works for anyone who needs bigger text. */
:where(html) { font-size: 106.25%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--chrome-top) + 8px); touch-action: manipulation; }
@media (max-width: 767.98px), (hover: none) and (pointer: coarse) { :where(html) { font-size: 112.5%; } }
:where(body) {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--bg); color: var(--text);
  font-family: var(--font-sans); font-size: var(--fs-16); font-weight: var(--fw-regular); line-height: var(--lh-body);
  -webkit-tap-highlight-color: transparent;
}
:where(h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd) { margin: 0; }
:where(h1, h2, h3, h4) { font-weight: var(--fw-bold); line-height: var(--lh-snug); }
:where(ul[class], ol[class]) { margin: 0; padding: 0; list-style: none; }
:where(img, video, canvas) { max-width: 100%; }
:where(button, input, select, textarea) { font: inherit; color: inherit; letter-spacing: inherit; }
:where(button) { cursor: pointer; }
:where(a) { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
:where(input, textarea) { caret-color: var(--primary); }
:where(input, textarea)::placeholder { color: var(--ink-500); opacity: 1; }
:where(hr) { border: 0; border-top: 1px solid var(--divider); margin: 0; }
:where(:focus-visible) { outline: var(--focus-width) solid var(--focus); outline-offset: var(--focus-offset); }
:where(:focus:not(:focus-visible)) { outline: none; }
::selection { background: var(--selection); color: var(--ink-900); }
[hidden] { display: none !important; }
.ico { display: inline-block; flex: none; vertical-align: middle; overflow: visible; }
.num, .tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1, "lnum" 1; }
@media (hover: hover) and (pointer: fine) {
  :where(html) { scrollbar-color: var(--ink-300) transparent; scrollbar-width: thin; }
}

.skip-link {
  position: absolute; left: 8px; top: -64px; z-index: 100; padding: 10px 14px; border-radius: var(--r-md);
  background: var(--surface); color: var(--text); font-weight: var(--fw-semibold); text-decoration: none; box-shadow: var(--shadow-2);
}
.skip-link:focus { top: 8px; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.page {
  width: 100%; max-width: var(--content-max); margin: 0 auto;
  padding: var(--sp-2) var(--sp-2) calc(var(--tabbar-h) + var(--safe-b) + var(--sp-6));
}
.page:focus { outline: none; }
@media (min-width: 1024px) { .page--wide { max-width: var(--wide-max); } }
.no-tabbar .page { padding-bottom: calc(var(--safe-b) + var(--sp-8)); }
/* A fixed action bar must never cover the last row, at any width: body.has-actionbar outranks the desktop
   .no-tabbar rule below. Two-pane screens (>= 1024 px) put the bar in the aside and drop back to the normal gap. */
body.has-actionbar .page { padding-bottom: calc(var(--actionbar-h) + var(--safe-b) + var(--sp-6)); }
@media (min-width: 600px) {
  .page { padding-left: var(--sp-4); padding-right: var(--sp-4); padding-top: var(--sp-4); }
}
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }   /* v0.30.0: 16 px between zones (was 8), wider than any gap inside a zone */
.stack--3 { gap: var(--sp-3); }
.stack--4 { gap: var(--sp-4); }
.stack--6 { gap: var(--sp-6); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
/* Two-pane: one column below 1024 px (main and aside melt into a single list; order with .ord-1 … .ord-9),
   main + 360 px aside from 1024 px. Add .two-pane--sticky only when the aside is short. */
.two-pane { display: flex; flex-direction: column; gap: var(--sp-4); }
.two-pane__main, .two-pane__aside { display: contents; }
@media (min-width: 1024px) {
  .two-pane { display: grid; grid-template-columns: minmax(0, 1fr) var(--aside-w); gap: var(--sp-4); align-items: start; }
  .two-pane__main, .two-pane__aside { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
  .two-pane--sticky .two-pane__aside { position: sticky; top: calc(var(--chrome-top) + var(--sp-4)); }
}
.ord-1 { order: 1; } .ord-2 { order: 2; } .ord-3 { order: 3; } .ord-4 { order: 4; } .ord-5 { order: 5; }
.ord-6 { order: 6; } .ord-7 { order: 7; } .ord-8 { order: 8; } .ord-9 { order: 9; }
.section-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  min-height: 44px; padding: var(--sp-3) var(--sp-2) 0;
}
.section-head__title { font-size: var(--fs-18); font-weight: var(--fw-bold); line-height: var(--lh-snug); }

/* ── Brand lockup: mark + EnFeed + role word, identical in every app ───── */
.brand {
  display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); min-width: 0;
  color: var(--text); text-decoration: none; white-space: nowrap; border-radius: var(--r-md);
}
.brand__mark {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none;
  border-radius: 22.27%; background: var(--primary); color: var(--white);
}
/* v0.32.3: the mark is the whole logo tile (open box + egg on turquoise) drawn edge to edge. The turquoise box
   underneath shows until the icon is drawn and has the logo's own corner (114/512 = 22.27%). */
.brand__mark .ico { width: 100%; height: 100%; }
.brand__name { font-size: var(--fs-18); font-weight: var(--fw-bold); color: var(--ink-900); letter-spacing: -0.005em; }
.brand__role { font-size: var(--fs-18); font-weight: var(--fw-semibold); color: var(--primary); }
.brand__ver { font-size: var(--fs-12); font-weight: var(--fw-semibold); color: var(--text-3); align-self: flex-end; margin-bottom: 9px; }

/* ── App bar and app nav ──────────────────────────────────────────────────
   <header class="appbar"><div class="appbar__row">
     <div class="appbar__lead">brand | back icon-btn + .appbar__title</div>
     <nav class="appnav">….appnav__item…</nav>
     <div class="appbar__actions">icon-btns</div>
   </div></header>
   Touch mode: .appnav is the fixed bottom tab bar (hidden on pushed screens with body.no-tabbar).
   Desktop: .appnav is the top menu, second row below 1280 px, inline from 1280 px.               */
.appbar { position: sticky; top: 0; z-index: var(--z-appbar); background: var(--surface); box-shadow: 0 1px 0 var(--divider); padding-top: var(--safe-t); }
.appbar__row {
  display: flex; align-items: center; gap: var(--sp-1);
  width: 100%; max-width: var(--wide-max); min-height: var(--appbar-h); margin: 0 auto; padding: 0 var(--sp-2) 0 var(--sp-4);
}
.appbar__lead { display: flex; align-items: center; gap: var(--sp-1); flex: 1 1 auto; min-width: 0; height: var(--appbar-h); }
/* v0.30.1: the brand keeps its width (it used to shrink and slide under the plate chip / settings icon on 320 px phones and with
   large phone text). Each app's style.css hides .brand__role below the width its own row needs, in em so it follows text size. */
.appbar .brand { flex-shrink: 0; }
.appbar__title {
  min-width: 0; font-size: var(--fs-18); font-weight: var(--fw-bold); line-height: var(--lh-tight);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.appbar__back { margin-left: calc(-1 * var(--sp-3)); }
.appbar__actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-1); flex: 0 0 auto; }

.appnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-tabbar);
  display: flex; padding-bottom: var(--safe-b); background: var(--surface); box-shadow: 0 -1px 0 var(--divider);
}
.no-tabbar .appnav { display: none; }
.appnav__item {
  position: relative; flex: 1 1 0; min-width: 0; height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 2px 5px;
  border: 0; background: none; color: var(--ink-600); text-decoration: none;
  font-size: var(--fs-13); font-weight: var(--fw-semibold); line-height: 1.2;
  -webkit-tap-highlight-color: transparent; transition: color var(--dur-1) var(--ease-out);
}
.appnav__item .ico { width: 24px; height: 24px; }
.appnav__label { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 5px 0; margin: -5px 0; } /* padding/margin: room for stacked Thai marks (ที่ นี้) inside the clip box, same layout (fix by office-ops) */
.appnav__item:active { background: var(--ink-50); }
.appnav__item[aria-current] { color: var(--primary); }
.appnav__item[aria-current] .ico .b { fill: currentColor; fill-opacity: 0.16; }
.appnav__badge { position: absolute; top: 3px; left: calc(50% + 5px); }
.appnav__item:focus-visible { outline-offset: -4px; border-radius: var(--r-md); }

@media (min-width: 768px) and (hover: hover), (min-width: 768px) and (pointer: fine) {
  :root { --chrome-top: calc(var(--appbar-h) + 48px); }
  .appbar__row { flex-wrap: wrap; padding: 0 var(--sp-4); }
  .appnav, .no-tabbar .appnav {
    position: static; order: 3; flex: 1 0 100%; display: flex; justify-content: center; gap: var(--sp-1);
    height: 48px; padding: 0; background: none; box-shadow: none;
  }
  .appnav__item {
    flex: 0 0 auto; flex-direction: row; gap: var(--sp-2); height: 48px; padding: 0 var(--sp-3);
    border-radius: var(--r-md); font-size: var(--fs-16);
  }
  .appnav__item .ico { width: 20px; height: 20px; }
  .appnav__item:hover { color: var(--ink-900); background: var(--ink-50); }
  .appnav__item[aria-current], .appnav__item[aria-current]:hover { color: var(--primary); background: none; }
  .appnav__item[aria-current]::after {
    content: ""; position: absolute; left: var(--sp-3); right: var(--sp-3); bottom: 0; height: 3px;
    border-radius: 3px 3px 0 0; background: var(--primary);
  }
  .appnav__badge { position: static; margin-left: -2px; }
  .page, .no-tabbar .page { padding-bottom: var(--sp-10); }
}
/* Page title row: on desktop the app bar always shows the brand, so a pushed screen's back + title move into the page.
   <div class="page-head"><button class="icon-btn" aria-label="ย้อนกลับ">…</button><h1 class="page-head__title">…</h1></div> */
.page-head { display: none; }
@media (min-width: 768px) and (hover: hover), (min-width: 768px) and (pointer: fine) {
  .appbar .appbar__title, .appbar .appbar__back { display: none !important; }
  .appbar .brand { display: inline-flex !important; }
  .page-head { display: flex; align-items: center; gap: var(--sp-1); min-height: 48px; margin: 0 0 var(--sp-3); }
  .page-head .icon-btn { margin-left: calc(-1 * var(--sp-2)); }
  .page-head__title { font-size: var(--fs-24); font-weight: var(--fw-bold); line-height: var(--lh-tight); }
  .page-head__title:focus { outline: none; }
}
@media (min-width: 1280px) and (hover: hover), (min-width: 1280px) and (pointer: fine) {
  :root { --chrome-top: var(--appbar-h); }
  .appbar__row { flex-wrap: nowrap; }
  .appbar__lead, .appbar__actions { flex: 1 1 0; }
  .appnav, .no-tabbar .appnav { order: 0; flex: 0 1 auto; height: var(--appbar-h); }
  .appnav__item { height: var(--appbar-h); }
}

/* ── Icon button (header actions: icon only, aria-label + data-tip) ──────── */
.icon-btn {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: var(--tap); height: var(--tap); padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--icon); text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.icon-btn .ico { width: 24px; height: 24px; }
.icon-btn:active { background: var(--ink-150); }
.icon-btn--brand { color: var(--primary); }
.icon-btn--danger { color: var(--danger-600); }
.icon-btn--on-brand { color: var(--white); }
.icon-btn--on-brand:active { background: rgba(255, 255, 255, 0.2); }
.icon-btn--on-brand:focus-visible { outline-color: var(--focus-on-brand); }
.icon-btn--scrim { background: rgba(16, 24, 32, 0.6); color: var(--white); }
.icon-btn:disabled, .icon-btn[aria-disabled="true"] { color: var(--ink-400); background: none; cursor: not-allowed; }
@media (hover: hover) {
  .icon-btn:hover { background: var(--ink-50); color: var(--ink-900); }
  .icon-btn--brand:hover { background: var(--brand-50); color: var(--brand-800); }
  .icon-btn--danger:hover { background: var(--danger-100); color: var(--danger-700); }
  .icon-btn--on-brand:hover { background: rgba(255, 255, 255, 0.14); color: var(--white); }
  .icon-btn--scrim:hover { background: rgba(16, 24, 32, 0.78); color: var(--white); }
  .icon-btn:disabled:hover { background: none; color: var(--ink-400); }
  /* data-tip: the word for an icon-only control, shown on hover and keyboard focus */
  .icon-btn[data-tip]::after, .has-tip[data-tip]::after {
    content: attr(data-tip); position: absolute; top: calc(100% + 6px); left: 50%; z-index: var(--z-tip);
    padding: 4px 8px; border-radius: var(--r-sm); background: var(--ink-900); color: var(--white);
    font-size: var(--fs-13); font-weight: var(--fw-semibold); line-height: 1.4; white-space: nowrap;
    pointer-events: none; opacity: 0; transform: translate(-50%, -2px);
    transition: opacity var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out);
  }
  .icon-btn[data-tip]:hover::after, .icon-btn[data-tip]:focus-visible::after,
  .has-tip[data-tip]:hover::after, .has-tip[data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); transition-delay: 250ms; }
  .appbar__actions > :last-child[data-tip]::after { left: auto; right: 0; transform: translate(0, -2px); }
  .appbar__actions > :last-child[data-tip]:hover::after, .appbar__actions > :last-child[data-tip]:focus-visible::after { transform: none; }
}
@media (min-width: 768px) and (pointer: fine) {
  .appbar .icon-btn { width: 40px; height: 40px; }
}

/* ── Badge (counts on tabs and icons) ──────────────────────────────────── */
.badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--r-pill); background: var(--danger-600); color: var(--white);
  font-size: var(--fs-12); font-weight: var(--fw-bold); line-height: 1; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--surface);
}
.badge--dot { min-width: 10px; width: 10px; height: 10px; padding: 0; }
.badge--neutral { background: var(--ink-150); color: var(--ink-700); box-shadow: none; }
.badge--brand { background: var(--brand-50); color: var(--brand-700); box-shadow: none; }

/* ── Buttons ──────────────────────────────────────────────────────────────
   primary = the one main action (brand fill) · secondary = brand outline · outline = neutral (ยกเลิก)
   ghost = quiet · danger = destructive (ออกจากระบบ) · on-brand = white on the turquoise banner          */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--control-h); padding: 0 var(--sp-5); border: 1px solid transparent; border-radius: var(--r-md);
  background: var(--surface); color: var(--ink-800); font-size: var(--fs-16); font-weight: var(--fw-semibold); line-height: 1.2;
  text-align: center; text-decoration: none; white-space: nowrap; cursor: pointer; user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out),
              color var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.btn .ico { width: 1.25em; height: 1.25em; }
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--primary); color: var(--text-on-brand); }
.btn--primary:active { background: var(--primary-press); }
.btn--secondary { border-color: var(--primary); color: var(--primary); }
.btn--secondary:active { background: var(--brand-100); }
.btn--outline { border-color: var(--border-strong); color: var(--ink-800); }
.btn--outline:active { background: var(--ink-150); }
.btn--ghost { background: transparent; color: var(--ink-700); }
.btn--ghost:active { background: var(--ink-150); }
.btn--danger { background: var(--danger-600); color: var(--white); }
.btn--danger:active { background: var(--danger-700); }
.btn--danger-outline { border-color: var(--danger-600); color: var(--danger-600); }
.btn--danger-outline:active { background: var(--danger-100); }
.btn--on-brand { background: var(--white); color: var(--primary); }
.btn--on-brand:active { background: var(--brand-100); }
.btn--link { min-height: var(--tap); padding: 0 var(--sp-2); background: none; color: var(--link); }
.btn--sm { min-height: var(--tap); padding: 0 var(--sp-4); font-size: var(--fs-14); }
.btn--lg { min-height: var(--control-h-lg); padding: 0 var(--sp-6); font-size: var(--fs-18); }
.btn--block { display: flex; width: 100%; }
@media (hover: hover) {
  .btn--primary:hover { background: var(--primary-hover); }
  .btn--secondary:hover { background: var(--brand-50); }
  .btn--outline:hover { background: var(--ink-50); border-color: var(--ink-400); }
  .btn--ghost:hover { background: var(--ink-50); color: var(--ink-900); }
  .btn--danger:hover { background: var(--danger-700); }
  .btn--danger-outline:hover { background: var(--danger-100); }
  .btn--on-brand:hover { background: var(--brand-50); }
  .btn--link:hover { text-decoration: underline; }
}
@media (min-width: 768px) and (pointer: fine) {
  .btn--sm { min-height: var(--control-h-sm); }
}
.btn:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: var(--focus-offset); }
.btn--on-brand:focus-visible, .status-band .btn:focus-visible { outline-color: var(--focus-on-brand); }
.btn:disabled, .btn:disabled:hover, .btn[aria-disabled="true"], .btn[aria-disabled="true"]:hover {
  background: var(--ink-150); border-color: transparent; color: var(--ink-400); cursor: not-allowed; transform: none;
}
.btn--secondary:disabled, .btn--outline:disabled, .btn--danger-outline:disabled,
.btn--secondary[aria-disabled="true"], .btn--outline[aria-disabled="true"], .btn--danger-outline[aria-disabled="true"] {
  background: var(--surface); border-color: var(--ink-200);
}
.btn--ghost:disabled, .btn--link:disabled { background: transparent; }
.btn.is-loading { pointer-events: none; }
.btn.is-loading .ico { display: none; }
.btn.is-loading::before {
  content: ""; width: 18px; height: 18px; flex: none; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: ds-spin 0.7s linear infinite;
}
.btn-row { display: flex; gap: var(--sp-2); }
.btn-row > .btn { flex: 1 1 0; min-width: 0; }

/* ── Chips: status with an SVG icon (never a glyph) ───────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 4px; min-height: 26px; padding: 2px 10px;
  border-radius: var(--r-pill); background: var(--ink-150); color: var(--ink-700);
  font-size: var(--fs-13); font-weight: var(--fw-semibold); line-height: 1.3; white-space: nowrap; vertical-align: middle;
}
.chip .ico { width: 16px; height: 16px; margin-left: -3px; }
.chip--lg { min-height: 32px; padding: 3px 12px; font-size: var(--fs-14); }
.chip--lg .ico { width: 18px; height: 18px; }
.chip--brand { background: var(--brand-50); color: var(--brand-700); }
.chip--success { background: var(--success-100); color: var(--success-600); }
.chip--warning { background: var(--warning-100); color: var(--warning-600); }
.chip--danger { background: var(--danger-100); color: var(--danger-600); }
.chip--info { background: var(--info-100); color: var(--info-600); }
.chip--outline { background: var(--surface); color: var(--ink-700); box-shadow: inset 0 0 0 1px var(--border-strong); }
.chip--on-brand { background: rgba(255, 255, 255, 0.18); color: var(--white); }
.chip--q-red { background: var(--q-red-bg); color: var(--q-red-ink); }
.chip--q-red .ico { color: var(--q-red); }
.chip--q-yellow { background: var(--q-yellow-bg); color: var(--q-yellow-ink); }
.chip--q-gray { background: var(--q-gray-bg); color: var(--q-gray-ink); box-shadow: inset 0 0 0 1px var(--q-gray); }
.chip--q-sky { background: var(--q-sky-bg); color: var(--q-sky-ink); }
.chip--q-sky .ico { color: var(--q-sky); }
.chip--q-green { background: var(--q-green-bg); color: var(--q-green-ink); }
.chip--q-green .ico { color: var(--q-green); }
.chip--q-navy { background: var(--q-navy-bg); color: var(--q-navy-ink); }
.chip--q-navy .ico { color: var(--q-navy); }

/* Toggle chip (quick tags, filters): a <button aria-pressed> */
.chip-toggle {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 var(--sp-4);
  border: 1px solid var(--border-strong); border-radius: var(--r-pill); background: var(--surface); color: var(--ink-800);
  font-size: var(--fs-16); font-weight: var(--fw-semibold); line-height: 1.25; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: border-color var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.chip-toggle .ico { width: 20px; height: 20px; margin-left: -4px; display: none; }
.chip-toggle[aria-pressed="true"] { border-color: var(--primary); background: var(--brand-50); color: var(--brand-800); box-shadow: inset 0 0 0 1px var(--primary); }
.chip-toggle[aria-pressed="true"] .ico { display: inline-block; }
.chip-toggle:disabled { color: var(--ink-400); border-color: var(--ink-200); cursor: not-allowed; }
@media (hover: hover) { .chip-toggle:hover { border-color: var(--ink-400); } .chip-toggle[aria-pressed="true"]:hover { border-color: var(--primary); } }
@media (min-width: 768px) and (pointer: fine) { .chip-toggle { min-height: 36px; } }
.chip-set { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* License plate token */
.plate {
  display: inline-flex; align-items: center; min-height: 24px; padding: 0 7px; border: 1.5px solid var(--ink-600);
  border-radius: var(--r-xs); background: var(--surface); color: var(--ink-900);
  font-size: var(--fs-14); font-weight: var(--fw-bold); line-height: 1.3; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.plate--lg { min-height: 32px; padding: 0 12px; border-width: 2px; border-color: var(--ink-800); border-radius: var(--r-sm); font-size: var(--fs-18); }

/* ── Cards ────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.card--flat { box-shadow: none; }
/* v0.30.0 zone head: every card names its zone with an icon tile + an 18 px title, so a page reads as labelled blocks.
   .card__value = the zone's own total on the right (e.g. ไข่ 90 ตั้ง), small line under it in <small>. */
.card__head { display: flex; align-items: center; gap: var(--sp-3); min-height: 3.5rem; padding: var(--sp-4) var(--sp-4) var(--sp-2); }
.card__head > .ico {
  width: 36px; height: 36px; padding: 7px; border-radius: 10px; background: var(--ink-100); color: var(--ink-700);
}
.card__title { flex: 1 1 auto; min-width: 0; font-size: var(--fs-18); font-weight: var(--fw-bold); line-height: var(--lh-snug); }
.card__value { flex: none; text-align: right; font-size: var(--fs-18); font-weight: var(--fw-bold); line-height: var(--lh-tight); font-variant-numeric: tabular-nums; white-space: nowrap; }
.card__value small { display: block; margin-top: 2px; font-size: var(--fs-13); font-weight: var(--fw-regular); color: var(--text-2); }
.card__title .opt { margin-left: 4px; font-size: var(--fs-14); font-weight: var(--fw-regular); color: var(--text-3); }   /* "ไม่บังคับ" */
.card__head .counter { flex: none; }
.card__more {
  display: inline-flex; align-items: center; gap: 2px; min-height: var(--tap); margin: -10px -8px -10px 0; padding: 0 6px 0 10px;
  border-radius: var(--r-md); color: var(--text-2); font-size: var(--fs-14); font-weight: var(--fw-semibold); text-decoration: none; white-space: nowrap;
}
.card__more .ico { width: 18px; height: 18px; }
.card__body { padding: var(--sp-2) var(--sp-4) var(--sp-4); }
.card__body--flush { padding: 0; }
.card__foot {
  display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--divider);
}
.card__note { margin-right: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: var(--fs-14); }
a.card { display: block; color: inherit; text-decoration: none; }
@media (hover: hover) { .card__more:hover { background: var(--ink-50); color: var(--ink-900); } a.card:hover { background: var(--ink-50); } }

/* ── List rows ────────────────────────────────────────────────────────── */
.rows > li + li, .rows > .row + .row { border-top: 1px solid var(--divider-strong); }
.rows--inset > li + li, .rows--inset > .row + .row {
  border-top: 0; background-image: linear-gradient(var(--divider-strong), var(--divider-strong));
  background-size: calc(100% - 72px) 1px; background-position: right top; background-repeat: no-repeat;
}
.row {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-height: 56px; padding: var(--sp-3) var(--sp-4);
  border: 0; background: transparent; color: inherit; font: inherit; text-align: left; text-decoration: none;
}
a.row, button.row { cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color var(--dur-1) var(--ease-out); }
a.row:active, button.row:active { background: var(--ink-150); }
@media (hover: hover) { a.row:hover, button.row:hover { background: var(--ink-50); } }
.row__icon {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: var(--r-md); background: var(--ink-100); color: var(--ink-700);
}
.row__icon .ico { width: 24px; height: 24px; }
.row__icon--brand { background: var(--brand-50); color: var(--brand-700); }
.row__icon--success { background: var(--success-100); color: var(--success-600); }
.row__icon--warning { background: var(--warning-100); color: var(--warning-600); }
.row__icon--danger { background: var(--danger-100); color: var(--danger-600); }
.row__icon--info { background: var(--info-100); color: var(--info-600); }
.row__icon--plain { width: 24px; height: 24px; background: none; color: var(--ink-600); }
.row__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row__title { font-size: var(--fs-16); font-weight: var(--fw-semibold); line-height: var(--lh-snug); color: var(--text); overflow-wrap: anywhere; }
.row__meta { font-size: var(--fs-14); line-height: var(--lh-snug); color: var(--text-2); }
.row__trail { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.row__value { font-size: var(--fs-16); font-weight: var(--fw-bold); line-height: var(--lh-tight); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row__sub { font-size: var(--fs-13); color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row__chev { flex: none; width: 20px; height: 20px; margin-right: -4px; color: var(--ink-400); }

/* Key / value pairs */
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-2) var(--sp-4); align-items: baseline; margin: 0; }
.kv dt { font-size: var(--fs-14); color: var(--text-2); }
.kv dd { margin: 0; text-align: right; font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ── Order card (the category's list card: head, goods row, extra, actions) ── */
.order { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.order__link {
  display: block; padding: var(--sp-3) var(--sp-4) var(--sp-4); border-radius: var(--r-lg) var(--r-lg) 0 0;
  color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; transition: background-color var(--dur-1) var(--ease-out);
}
.order__link:only-child { border-radius: var(--r-lg); }
.order__link:active { background: var(--ink-50); }
@media (hover: hover) { .order__link:hover { background: var(--ink-50); } }
.order__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); min-height: 28px; margin-bottom: var(--sp-3); }
.order__date { display: inline-flex; align-items: center; gap: 6px; min-width: 0; color: var(--text-2); font-size: var(--fs-14); font-variant-numeric: tabular-nums; }
.order__date .ico { width: 18px; height: 18px; color: var(--ink-500); }
.order__body { display: flex; align-items: center; gap: var(--sp-3); }
.order__thumb {
  display: grid; place-items: center; width: 56px; height: 56px; flex: none;
  border-radius: var(--r-md); background: var(--brand-50); color: var(--brand-700);
}
.order__thumb .ico { width: 30px; height: 30px; }
.order__thumb .illus { width: 52px; height: 52px; }
.order__thumb--neutral { background: var(--ink-100); color: var(--ink-700); }
/* The picture carries the state (finish review): small size for list rows; a mark for received (check) or an open claim */
.order__thumb { position: relative; }
.order__thumb--sm { width: 40px; height: 40px; }
.order__thumb--sm .ico { width: 22px; height: 22px; }
.order__thumb--sm .illus { width: 36px; height: 36px; }
.order__mark {
  position: absolute; right: -5px; bottom: -5px; display: grid; place-items: center; width: 22px; height: 22px;
  border-radius: 50%; box-shadow: 0 0 0 2px var(--surface); color: var(--white);
}
.order__mark .ico { width: 14px; height: 14px; }
.order__thumb--sm .order__mark { right: -4px; bottom: -4px; width: 18px; height: 18px; }
.order__thumb--sm .order__mark .ico { width: 12px; height: 12px; }
.order__mark--success { background: var(--success-600); }
.order__mark--warning { background: var(--warning-600); }
/* Main goods line under the title (ไข่ไก่คละใหญ่ +2 รายการ) */
.order__goods { display: block; margin-top: 2px; overflow: hidden; color: var(--text); font-size: var(--fs-14); font-weight: var(--fw-semibold); line-height: var(--lh-snug); text-overflow: ellipsis; white-space: nowrap; }
.order__goods-more { color: var(--text-2); font-weight: var(--fw-regular); }
.order__main { flex: 1 1 auto; min-width: 0; }
.order__title { display: block; font-size: var(--fs-16); font-weight: var(--fw-bold); line-height: var(--lh-snug); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; color: var(--text-2); font-size: var(--fs-14); line-height: var(--lh-snug); }
.order__qty { flex: none; text-align: right; }
.order__qty b { display: block; font-size: var(--fs-18); font-weight: var(--fw-bold); line-height: var(--lh-tight); font-variant-numeric: tabular-nums; white-space: nowrap; }
.order__qty small { display: block; margin-top: 2px; font-size: var(--fs-13); color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.order__extra { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: var(--sp-3); }
.order__foot {
  display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--divider);
}
.order__note { margin-right: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: var(--fs-14); font-variant-numeric: tabular-nums; }
.order__note .ico { width: 18px; height: 18px; }
.order__note--brand { color: var(--brand-700); font-weight: var(--fw-semibold); }
.order__note--warning { color: var(--warning-600); font-weight: var(--fw-semibold); }

/* ── Status banner (live delivery state) + step track ─────────────────── */
.status-band {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "text art" "track track";
  column-gap: var(--sp-2); padding: var(--sp-4) var(--sp-4) var(--sp-3); border-radius: var(--r-lg);
  background: var(--primary); color: var(--text-on-brand); overflow: hidden;
}
.status-band__text { grid-area: text; align-self: center; min-width: 0; }
.status-band__title { font-size: var(--fs-24); font-weight: var(--fw-bold); line-height: var(--lh-tight); }
.status-band__sub { margin-top: 6px; font-size: var(--fs-16); line-height: var(--lh-snug); font-variant-numeric: tabular-nums; }
.status-band__sub b { font-weight: var(--fw-bold); }
.status-band__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--sp-2); }
.status-band__art { grid-area: art; align-self: end; width: 128px; margin: -8px -8px -2px 0; }
.status-band__track { grid-area: track; margin-top: var(--sp-3); }
.status-band :focus-visible { outline-color: var(--focus-on-brand); }
.status-band--calm { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
@media (max-width: 399.98px) { .status-band__art { width: 108px; } }
@media (max-width: 599.98px) {
  .status-band--bleed { margin-left: calc(-1 * var(--sp-2)); margin-right: calc(-1 * var(--sp-2)); border-radius: 0; }
}

.step-track { display: grid; grid-template-columns: repeat(var(--steps, 4), minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; }
/* v0.30.0: a done step carries a check in its dot (not only a fill); the current step is the one bold label */
.step-track__step {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0 1px;
  text-align: center; font-size: var(--fs-13); line-height: 1.25; color: var(--text-3);
}
.step-track__step::before {
  content: ""; position: absolute; top: 8px; left: -50%; right: 50%; height: 2px; background: var(--ink-200);
}
.step-track__step:first-child::before { display: none; }
.step-track__dot {
  position: relative; z-index: 1; width: 18px; height: 18px; flex: none; border-radius: 50%;
  background: var(--surface) no-repeat center / 12px; box-shadow: inset 0 0 0 2px var(--ink-400);
}
.step-track__step.is-done { color: var(--ink-900); }
.step-track__step.is-current { color: var(--ink-900); font-weight: var(--fw-bold); }
.step-track__step.is-done::before, .step-track__step.is-current::before { background: var(--primary); }
.step-track__step.is-done .step-track__dot {
  background-color: var(--primary); box-shadow: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
.step-track__step.is-current .step-track__dot { background: var(--primary); box-shadow: 0 0 0 4px var(--brand-100); animation: ds-breathe-brand 2.4s var(--ease-std) infinite; }
/* on the turquoise banner */
.status-band .step-track__step { color: var(--white); }
.status-band .step-track__step::before { background: rgba(255, 255, 255, 0.38); }
.status-band .step-track__step.is-done::before, .status-band .step-track__step.is-current::before { background: var(--white); }
.status-band .step-track__dot { background: var(--primary); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.75); }
.status-band .step-track__step.is-done .step-track__dot {
  background-color: var(--white); box-shadow: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2310766B' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
.status-band .step-track__step.is-current .step-track__dot { background: var(--white); box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.3); animation-name: ds-breathe-white; }
@keyframes ds-breathe-brand { 0%, 100% { box-shadow: 0 0 0 3px var(--brand-100); } 50% { box-shadow: 0 0 0 7px rgba(210, 247, 242, 0.35); } }
@keyframes ds-breathe-white { 0%, 100% { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.34); } 50% { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.08); } }

/* ── Timeline (vertical, newest first) ────────────────────────────────── */
.timeline { margin: 0; padding: 0; list-style: none; }
.timeline__item { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr); column-gap: var(--sp-3); padding-bottom: var(--sp-4); }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before { content: ""; position: absolute; left: 11px; top: 20px; bottom: -6px; width: 2px; background: var(--ink-200); }
.timeline__item:last-child::before { display: none; }
.timeline__dot { grid-column: 1; justify-self: center; width: 10px; height: 10px; margin-top: 7px; border-radius: 50%; background: var(--ink-400); }
.timeline__body { grid-column: 2; min-width: 0; }
.timeline__title { font-size: var(--fs-16); line-height: var(--lh-snug); color: var(--ink-800); }
.timeline__time { margin-top: 2px; font-size: var(--fs-14); color: var(--text-2); font-variant-numeric: tabular-nums; }
.timeline__note { margin-top: 4px; font-size: var(--fs-14); color: var(--text-2); overflow-wrap: anywhere; }
.timeline__item.is-current .timeline__dot { width: 14px; height: 14px; margin-top: 5px; background: var(--primary); box-shadow: 0 0 0 4px var(--brand-100); animation: ds-breathe-brand 2.4s var(--ease-std) infinite; }
.timeline__item.is-current .timeline__title { color: var(--primary); font-weight: var(--fw-bold); }
.timeline__item.is-pending .timeline__dot { background: var(--surface); box-shadow: inset 0 0 0 2px var(--ink-300); }
.timeline__item.is-pending .timeline__title { color: var(--text-3); }
.timeline--success .timeline__item.is-current .timeline__dot { background: var(--success-500); box-shadow: 0 0 0 4px var(--success-100); animation: none; }
.timeline--success .timeline__item.is-current .timeline__title { color: var(--success-600); }

/* ── Tabs (underline, scrollable) ─────────────────────────────────────── */
.tabs {
  display: flex; overflow-x: auto; background: var(--surface); box-shadow: inset 0 -1px 0 var(--divider);
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs__tab {
  position: relative; flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 3rem; padding: 0 var(--sp-3); border: 0; background: none; color: var(--text-2);
  font-size: var(--fs-14); font-weight: var(--fw-semibold); white-space: nowrap; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: color var(--dur-2) var(--ease-out);
}
.tabs__tab[aria-selected="true"], .tabs__tab[aria-current="page"] { color: var(--primary); }
.tabs__tab[aria-selected="true"]::after, .tabs__tab[aria-current="page"]::after {
  content: ""; position: absolute; left: var(--sp-3); right: var(--sp-3); bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary);
}
.tabs__tab:focus-visible { outline-offset: -3px; border-radius: var(--r-md); }
.tabs__count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill);
  background: var(--ink-150); color: var(--ink-700); font-size: var(--fs-12); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums;
}
.tabs__tab[aria-selected="true"] .tabs__count, .tabs__tab[aria-current="page"] .tabs__count { background: var(--brand-50); color: var(--brand-700); }
.tabs--sticky { position: sticky; top: var(--chrome-top); z-index: var(--z-sticky); }
.tabs--card { border-radius: var(--r-lg) var(--r-lg) 0 0; }
@media (hover: hover) { .tabs__tab:hover { color: var(--ink-900); } .tabs__tab[aria-selected="true"]:hover { color: var(--primary); } }
@media (min-width: 600px) { .tabs__tab { font-size: var(--fs-16); padding: 0 var(--sp-4); } }

/* ── Segmented control (radio group: units, views) ────────────────────── */
.seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--r-md); background: var(--ink-150); border: 0; margin: 0; min-inline-size: 0; }
.seg--block { display: flex; }
.seg--block .seg__opt { flex: 1 1 0; }
.seg__opt { position: relative; display: inline-flex; min-width: 0; }
.seg__opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg__opt span {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: var(--tap); min-width: 64px;
  padding: 0 var(--sp-4); border-radius: 6px; color: var(--ink-700); font-size: var(--fs-16); font-weight: var(--fw-semibold); white-space: nowrap;
  transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}
.seg__opt input:checked + span { background: var(--primary); color: var(--text-on-brand); box-shadow: 0 1px 3px rgba(16, 24, 32, 0.14); }   /* v0.30.0: selection = turquoise fill (was white on grey, 1.2:1) */
.seg__opt input:focus-visible + span { outline: var(--focus-width) solid var(--focus); outline-offset: 1px; }
.seg__opt input:disabled + span { color: var(--ink-400); }
.seg--sm .seg__opt span { min-height: 32px; min-width: 52px; padding: 0 var(--sp-3); font-size: var(--fs-14); }
@media (pointer: coarse) { .seg--sm .seg__opt span { min-height: var(--tap); } }

/* ── Forms ────────────────────────────────────────────────────────────── */
/* v0.30.0: labels at body size and full ink, 8 px to their field — the label names the zone of each box */
.field { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.field__label, .label { font-size: var(--fs-16); font-weight: var(--fw-semibold); line-height: var(--lh-snug); color: var(--ink-900); }
.field__label .opt { font-weight: var(--fw-regular); color: var(--text-3); }
.field__row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); }
.field__hint { font-size: var(--fs-14); color: var(--text-3); line-height: var(--lh-snug); }
.field__error { display: flex; align-items: flex-start; gap: 6px; font-size: var(--fs-14); font-weight: var(--fw-semibold); line-height: var(--lh-snug); color: var(--danger-600); }
.field__error .ico { width: 18px; height: 18px; margin-top: 1px; }
.input, .textarea, .select {
  width: 100%; min-width: 0; max-width: 100%; min-height: var(--input-h); padding: 0 14px;
  border: 1.5px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); color: var(--text);
  font-size: var(--fs-16); line-height: 1.4; -webkit-appearance: none; appearance: none;
  transition: border-color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out);
}
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), 0 0 0 4px var(--brand-100); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--danger-600); box-shadow: 0 0 0 1px var(--danger-600); }
.input[aria-invalid="true"]:focus, .textarea[aria-invalid="true"]:focus { box-shadow: 0 0 0 1px var(--danger-600), 0 0 0 4px var(--danger-100); }
.input:disabled, .textarea:disabled, .select:disabled { background: var(--ink-100); border-color: var(--ink-200); color: var(--text-disabled); cursor: not-allowed; }
.input--num { font-size: var(--fs-20); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.textarea { min-height: 104px; padding: 12px 14px; line-height: var(--lh-body); resize: vertical; }
.select {
  padding-right: 42px; background-repeat: no-repeat; background-position: right 12px center; background-size: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23384049' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 9l7 7 7-7'/%3E%3C/svg%3E");
}
@media (hover: hover) { .input:hover:not(:focus):not(:disabled), .textarea:hover:not(:focus):not(:disabled), .select:hover:not(:focus):not(:disabled) { border-color: var(--ink-600); } }
.input-group { display: flex; align-items: stretch; min-width: 0; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group__suffix {
  display: inline-flex; align-items: center; padding: 0 14px; border: 1.5px solid var(--border-strong); border-left: 0;
  border-radius: 0 var(--r-md) var(--r-md) 0; background: var(--ink-50); color: var(--text-2); font-weight: var(--fw-semibold); white-space: nowrap;
}
.counter { font-size: var(--fs-14); color: var(--text-3); font-variant-numeric: tabular-nums; text-align: right; }
.counter.is-over { color: var(--danger-600); font-weight: var(--fw-semibold); }

.check, .radio {
  -webkit-appearance: none; appearance: none; flex: none; display: inline-grid; place-content: center; width: 26px; height: 26px; margin: 0;
  border: 2px solid var(--ink-500); background: var(--surface) no-repeat center / 18px; cursor: pointer; vertical-align: middle;
  transition: background-color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out);
}
.check { border-radius: 6px; }
.radio { border-radius: 50%; }
.check:checked {
  border-color: var(--primary); background-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
.radio:checked { border-color: var(--primary); background: var(--primary); box-shadow: inset 0 0 0 5px var(--surface); }
.check:focus-visible, .radio:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: 2px; }
.check:disabled, .radio:disabled { border-color: var(--ink-300); background-color: var(--ink-100); cursor: not-allowed; }
.check-row { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--tap); cursor: pointer; }

/* Choice rows: big tappable radio/checkbox cards. <label class="choice"><input type="radio"><span class="choice__box">…</span></label> */
.choices { display: grid; gap: var(--sp-2); }
.choices--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice { position: relative; display: block; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.choice > input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.choice__box {
  display: flex; align-items: center; gap: var(--sp-3); min-height: 3.75rem; height: 100%; padding: 10px 16px 10px 12px;
  border: 1.5px solid var(--border); border-radius: var(--r-lg); background: var(--surface);
  transition: border-color var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out);
}
.choice__icon { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: var(--r-md); background: var(--ink-100); color: var(--ink-700); transition: background-color var(--dur-1), color var(--dur-1); }
.choice__icon .ico { width: 26px; height: 26px; }
.choice__label { flex: 1 1 auto; min-width: 0; font-weight: var(--fw-semibold); line-height: var(--lh-snug); }
.choice__label small { display: block; font-weight: var(--fw-regular); font-size: var(--fs-14); color: var(--text-2); }
.choice__mark { width: 26px; height: 26px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--ink-500); transition: box-shadow var(--dur-1), background-color var(--dur-1); }
.choice > input:checked + .choice__box { border-color: var(--primary); background: var(--brand-50); box-shadow: inset 0 0 0 1px var(--primary); }
.choice > input:checked + .choice__box .choice__icon { background: var(--surface); color: var(--primary); }
.choice > input:checked + .choice__box .choice__mark { background: var(--primary); box-shadow: inset 0 0 0 6px var(--surface), inset 0 0 0 8px var(--primary); }
.choice > input:focus-visible + .choice__box { outline: var(--focus-width) solid var(--focus); outline-offset: 2px; }
.choice > input:disabled + .choice__box { opacity: 0.55; cursor: not-allowed; }
@media (hover: hover) { .choice:hover > input:not(:checked) + .choice__box { border-color: var(--ink-300); } }

/* Switch (settings) */
.switch {
  -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 48px; height: 28px; margin: 0;
  border-radius: var(--r-pill); background: var(--ink-300); cursor: pointer; transition: background-color var(--dur-2) var(--ease-out);
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--white); box-shadow: 0 1px 3px rgba(16, 24, 32, 0.25); transition: transform var(--dur-2) var(--ease-out);
}
.switch:checked { background: var(--primary); }
.switch:checked::after { transform: translateX(20px); }
.switch:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: 2px; }
.switch:disabled { opacity: 0.5; cursor: not-allowed; }

/* Reading-confidence number fields (driver check screen). .conf--low = ช่องกรอบแดง (must check) */
.conf { position: relative; }
.conf .input { padding-right: 46px; font-size: var(--fs-20); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.conf__mark { position: absolute; right: 12px; top: 50%; width: 24px; height: 24px; transform: translateY(-50%); pointer-events: none; }
.conf--high .input { border-color: var(--conf-high); box-shadow: inset 0 0 0 1px var(--conf-high); }
.conf--high .conf__mark { color: var(--conf-high-ink); }
.conf--mid .input { border-color: var(--conf-mid); box-shadow: inset 0 0 0 1px var(--conf-mid); background: var(--conf-mid-bg); }
.conf--mid .conf__mark { color: var(--conf-mid-ink); }
.conf--low .input { border: 2px solid var(--conf-low); box-shadow: 0 0 0 3px var(--danger-100); }
.conf--low .conf__mark { color: var(--conf-low-ink); }
.conf .input:focus { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), 0 0 0 4px var(--brand-100); background: var(--surface); }

/* ── PIN dots + number pad (every numeric code: PIN, office code) ─────── */
.pin { display: flex; justify-content: center; gap: var(--sp-4); padding: var(--sp-2) 0; }
.pin__dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink-400); transition: background-color var(--dur-1), border-color var(--dur-1), transform var(--dur-1) var(--ease-out); }
.pin__dot.is-filled { background: var(--ink-900); border-color: var(--ink-900); transform: scale(1.06); }
.pin.is-error .pin__dot { border-color: var(--danger-600); }
.pin.is-error .pin__dot.is-filled { background: var(--danger-600); }
.pin.is-error { animation: ds-shake 320ms var(--ease-std); }
.numpad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); width: 100%; max-width: 340px; margin: 0 auto; }
.numpad__key {
  display: grid; place-items: center; height: 60px; padding: 0; border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink-900); font-size: var(--fs-24); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.numpad__key:active { background: var(--ink-150); transform: scale(0.97); }
.numpad__key--fn { background: transparent; border-color: transparent; color: var(--ink-700); font-size: var(--fs-16); }
.numpad__key--fn .ico { width: 28px; height: 28px; }
.numpad__key--ok { background: var(--primary); border-color: var(--primary); color: var(--white); font-size: var(--fs-16); }
.numpad__key:disabled { color: var(--ink-400); cursor: not-allowed; transform: none; }
@media (hover: hover) { .numpad__key:hover { background: var(--ink-50); } .numpad__key--ok:hover { background: var(--primary-hover); } .numpad__key--fn:hover { background: var(--ink-50); } }

/* ── Stars (display + input) ──────────────────────────────────────────── */
.stars { display: inline-flex; align-items: center; gap: 1px; vertical-align: middle; }
.stars .ico { width: 16px; height: 16px; }
.stars .is-on { color: var(--star); stroke: var(--star-rim); }
.stars .is-off { color: var(--star-empty); stroke: var(--ink-300); }
.stars--lg .ico { width: 22px; height: 22px; }
.star-part { position: relative; display: inline-flex; }                 /* partly filled star (ui.js starsHtml) */
.star-part__on { position: absolute; top: 0; bottom: 0; left: 0; display: inline-flex; overflow: hidden; }
.star-part__on .ico { flex: none; }
.stars__value { margin-left: 6px; font-size: var(--fs-14); font-weight: var(--fw-bold); color: var(--text); }
.star-input { display: flex; justify-content: center; gap: 4px; width: 100%; margin: 0; padding: 0; border: 0; min-inline-size: 0; }
/* v0.30.1: a star is 3.375rem, or a fifth of the row when that is narrower (large phone text on 360 px made the five stars 396 px wide) */
.star-input__opt { position: relative; display: grid; place-items: center; width: min(3.375rem, calc((100% - 16px) / 5)); height: auto; aspect-ratio: 1; border-radius: var(--r-md); cursor: pointer; color: var(--star-empty); stroke: var(--star-empty-rim); -webkit-tap-highlight-color: transparent; }
.star-input__opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.star-input__opt .ico { width: 78%; height: auto; aspect-ratio: 1; stroke: var(--star-empty-rim); transition: transform var(--dur-2) var(--ease-out), color var(--dur-1) var(--ease-out); }
.star-input__opt.is-on { color: var(--star); }
.star-input__opt.is-on .ico { stroke: var(--star-rim); }
.star-input__opt:active .ico { transform: scale(0.9); }
.star-input__opt input:focus-visible + .ico { outline: var(--focus-width) solid var(--focus); outline-offset: 3px; border-radius: var(--r-sm); }
.star-input--sm .star-input__opt { width: 44px; height: 44px; }
.star-input--sm .star-input__opt .ico { width: 32px; height: 32px; }
.star-input__label { min-height: 1.5em; margin-top: var(--sp-1); text-align: center; font-size: var(--fs-18); font-weight: var(--fw-bold); color: var(--ink-900); }

/* ── Photos (claims, sheets) ──────────────────────────────────────────── */
.photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
@media (min-width: 600px) { .photos { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.photo { position: relative; aspect-ratio: 1 / 1; border-radius: var(--r-md); overflow: hidden; background: var(--ink-150); }
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo__open { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.photo__open:focus-visible { outline-offset: -3px; }
.photo__remove { position: absolute; top: 0; right: 0; z-index: 1; display: grid; place-items: center; width: var(--tap); height: var(--tap); padding: 0; border: 0; background: none; color: var(--white); cursor: pointer; }
.photo__remove::before { content: ""; position: absolute; width: 28px; height: 28px; border-radius: 50%; background: rgba(16, 24, 32, 0.68); }
.photo__remove .ico { position: relative; width: 18px; height: 18px; }
.photo.is-busy::after { content: ""; position: absolute; inset: 0; background: var(--ink-150) linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent) no-repeat; background-size: 50% 100%; animation: ds-shimmer 1.2s var(--ease-std) infinite; }
.photo-add {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; aspect-ratio: 1 / 1;
  padding: 4px; border: 1.5px dashed var(--ink-400); border-radius: var(--r-md); background: var(--surface); color: var(--ink-800);
  font-size: var(--fs-14); font-weight: var(--fw-semibold); line-height: 1.25; text-align: center; cursor: pointer;
  transition: border-color var(--dur-1), background-color var(--dur-1);
}
.photo-add .ico { width: 26px; height: 26px; color: var(--primary); }
.photo-add--primary { border-style: solid; border-color: var(--primary); background: var(--brand-50); color: var(--brand-800); }   /* the first thing to tap: take a photo */
.photo-add:active { background: var(--brand-50); }
.photo-add:disabled { color: var(--ink-400); border-color: var(--ink-200); cursor: not-allowed; }
.photo-add:disabled .ico { color: var(--ink-400); }
@media (hover: hover) { .photo-add:hover:not(:disabled) { border-color: var(--primary); background: var(--brand-50); } }

/* ── Notices (inline alerts; no coloured side borders) ────────────────── */
.notice { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-lg); background: var(--info-100); color: var(--ink-900); font-size: var(--fs-14); line-height: var(--lh-snug); }
.notice > .ico { width: 22px; height: 22px; margin-top: 1px; color: var(--info-600); }
.notice__body { flex: 1 1 auto; min-width: 0; }
.notice__title { font-size: var(--fs-16); font-weight: var(--fw-bold); }
.notice__text { margin-top: 2px; color: var(--ink-800); overflow-wrap: anywhere; }
.notice__action { flex: none; align-self: center; }
.notice--success { background: var(--success-100); }
.notice--success > .ico { color: var(--success-600); }
.notice--warning { background: var(--warning-100); }
.notice--warning > .ico { color: var(--warning-600); }
.notice--danger { background: var(--danger-100); }
.notice--danger > .ico { color: var(--danger-600); }
.notice--brand { background: var(--brand-50); }
.notice--brand > .ico { color: var(--brand-700); }

/* ── Strips under the app bar: test mode (driver app + customer test link), new version, offline ── */
.strip {
  display: flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); padding: 6px var(--sp-4);
  font-size: var(--fs-14); line-height: var(--lh-snug);
}
.strip .ico { width: 20px; height: 20px; flex: none; }
.strip__text { flex: 1 1 auto; min-width: 0; }
.strip .btn { flex: none; }
.strip--test { background: var(--warning-100); color: var(--warning-700); }
.strip--update { background: var(--info-100); color: var(--ink-900); }
.strip--update > .ico { color: var(--info-600); }
.strip--offline { background: var(--ink-800); color: var(--white); }

/* ── Dialog (centred, for confirmations: ออกจากระบบ?) ─────────────────── */
.dialog {
  width: min(calc(100vw - 32px), 400px); max-width: none; max-height: calc(100vh - 48px); margin: auto; padding: 0; border: 0;
  border-radius: var(--r-xl); background: var(--surface); color: var(--text); box-shadow: var(--shadow-3); overflow: auto;
}
.dialog::backdrop { background: var(--scrim); }
.dialog[open] { animation: ds-dialog-in var(--dur-3) var(--ease-out); }
.dialog[open]::backdrop { animation: ds-fade-in var(--dur-3) var(--ease-out); }
.dialog.is-closing { animation: ds-dialog-out var(--dur-exit) var(--ease-in) forwards; }
.dialog.is-closing::backdrop { animation: ds-fade-out var(--dur-exit) var(--ease-in) forwards; }
.dialog__body { padding: var(--sp-6) var(--sp-5) var(--sp-5); text-align: center; }
.dialog__art { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto var(--sp-3); border-radius: 50%; background: var(--brand-50); color: var(--brand-700); }
.dialog__art .ico { width: 28px; height: 28px; }
.dialog__art--danger { background: var(--danger-100); color: var(--danger-600); }
.dialog__art--warning { background: var(--warning-100); color: var(--warning-600); }
.dialog__art--success { background: var(--success-100); color: var(--success-600); }
.dialog__title { font-size: var(--fs-18); font-weight: var(--fw-bold); line-height: var(--lh-snug); }
.dialog__text { margin-top: var(--sp-2); color: var(--text-2); font-size: var(--fs-16); overflow-wrap: anywhere; }
.dialog__actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--sp-2); padding: 0 var(--sp-5) var(--sp-5); }
.dialog__actions .btn { padding: 0 var(--sp-3); }

/* ── Bottom sheet (phone) / centred panel (desktop) ───────────────────── */
.sheet {
  width: 100%; max-width: 100%; max-height: calc(100vh - 32px); margin: auto 0 0; padding: 0; border: 0;
  border-radius: var(--r-xl) var(--r-xl) 0 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-3); overflow: hidden;
}
.sheet[open] { display: flex; flex-direction: column; animation: ds-sheet-in var(--dur-3) var(--ease-out); }
.sheet::backdrop { background: var(--scrim); }
.sheet[open]::backdrop { animation: ds-fade-in var(--dur-3) var(--ease-out); }
.sheet.is-closing { animation: ds-sheet-out var(--dur-exit) var(--ease-in) forwards; }
.sheet.is-closing::backdrop { animation: ds-fade-out var(--dur-exit) var(--ease-in) forwards; }
.sheet__grip { flex: none; width: 40px; height: 4px; margin: 8px auto 0; border-radius: 4px; background: var(--ink-300); }
.sheet__head { flex: none; display: flex; align-items: center; gap: var(--sp-2); min-height: 56px; padding: 0 var(--sp-2) 0 var(--sp-5); }
.sheet__title { flex: 1 1 auto; min-width: 0; font-size: var(--fs-18); font-weight: var(--fw-bold); line-height: var(--lh-snug); }
.sheet__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 var(--sp-5) var(--sp-5); overscroll-behavior: contain; }
.sheet__foot { flex: none; display: flex; gap: var(--sp-2); padding: var(--sp-3) var(--sp-5) calc(var(--sp-3) + var(--safe-b)); box-shadow: 0 -1px 0 var(--divider); }
.sheet__foot > .btn { flex: 1 1 0; min-width: 0; }
@media (min-width: 768px) and (hover: hover), (min-width: 768px) and (pointer: fine) {
  .sheet { width: min(calc(100vw - 48px), 480px); max-height: calc(100vh - 64px); margin: auto; border-radius: var(--r-xl); }
  .sheet[open] { animation-name: ds-dialog-in; }
  .sheet.is-closing { animation-name: ds-dialog-out; }
  .sheet__grip { display: none; }
  .sheet__head { padding-top: var(--sp-2); }
  .sheet__foot { padding-bottom: var(--sp-4); }
}

/* ── Image viewer (signed sheet, claim photos) ────────────────────────── */
.viewer { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #0E1114; color: var(--white); }
.viewer[open] { display: flex; flex-direction: column; animation: ds-fade-in var(--dur-2) var(--ease-out); }
.viewer::backdrop { background: #0E1114; }
.viewer.is-closing { animation: ds-fade-out var(--dur-exit) var(--ease-in) forwards; }
.viewer__bar { flex: none; display: flex; align-items: center; gap: var(--sp-1); min-height: 56px; padding: var(--safe-t) var(--sp-2) 0; }
.viewer__title { flex: 1 1 auto; min-width: 0; padding-left: var(--sp-2); font-size: var(--fs-16); font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer__stage { flex: 1 1 auto; min-height: 0; overflow: auto; display: grid; place-items: center; padding-bottom: var(--safe-b); }
.viewer__img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer__stage.is-zoomed { place-items: start; }
.viewer__stage.is-zoomed .viewer__img { max-width: none; max-height: none; width: calc(var(--zoom, 2) * 100vw); }
.viewer__stage.is-zoomed { cursor: grab; }
.viewer__stage.is-panning { cursor: grabbing; user-select: none; }
.viewer__img { -webkit-user-drag: none; user-select: none; }
.viewer .icon-btn { color: var(--white); }
.viewer .icon-btn:focus-visible { outline-color: var(--white); }
@media (hover: hover) { .viewer .icon-btn:hover { background: rgba(255, 255, 255, 0.12); color: var(--white); } }
.viewer .icon-btn:disabled { color: rgba(255, 255, 255, 0.35); }

/* ── Toast ────────────────────────────────────────────────────────────── */
.toasts {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px); z-index: var(--z-toast);
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); padding: 0 var(--sp-4); pointer-events: none;
}
.no-tabbar .toasts { bottom: calc(var(--safe-b) + 16px); }
.has-actionbar .toasts { bottom: calc(var(--actionbar-h) + var(--safe-b) + 12px); }
@media (min-width: 768px) and (hover: hover), (min-width: 768px) and (pointer: fine) {
  .toasts, .no-tabbar .toasts { bottom: 24px; }
  body.has-actionbar .toasts { bottom: calc(var(--actionbar-h) + 12px); }   /* above a fixed action bar */
}
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 440px; min-height: 48px; padding: 12px 16px;
  border-radius: var(--r-lg); background: rgba(21, 25, 30, 0.95); color: var(--white); box-shadow: var(--shadow-3);
  font-size: var(--fs-16); font-weight: var(--fw-semibold); line-height: var(--lh-snug); pointer-events: auto;
  animation: ds-toast-in var(--dur-2) var(--ease-out);
}
.toast .ico { width: 22px; height: 22px; }
.toast--success .ico { color: #7BE0A1; }
.toast--error .ico { color: #FFA3A3; }
.toast--info .ico { color: #A9C7FF; }
.toast.is-leaving { animation: ds-toast-out var(--dur-exit) var(--ease-in) forwards; }

/* ── Skeleton and spinner ─────────────────────────────────────────────── */
.skel {
  display: block; border-radius: var(--r-sm);
  background: var(--ink-150) linear-gradient(90deg, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0) 100%) no-repeat;
  background-size: 45% 100%; background-position: -60% 0; animation: ds-shimmer 1.3s var(--ease-std) infinite;
}
.skel--text { height: 14px; margin: 5px 0; }
.skel--title { height: 20px; width: 55%; margin: 4px 0; }
.skel--block { height: 120px; border-radius: var(--r-lg); }
.skel--thumb { width: 56px; height: 56px; flex: none; border-radius: var(--r-md); }
.skel--circle { border-radius: 50%; }
.skel--band { height: 140px; border-radius: var(--r-lg); background-color: var(--brand-100); }
.spinner { display: inline-block; width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--brand-100); border-top-color: var(--primary); animation: ds-spin 0.8s linear infinite; }

/* ── Empty states (illustration + short title + one line + one action) ─ */
.empty { display: flex; flex-direction: column; align-items: center; padding: var(--sp-8) var(--sp-6) var(--sp-10); text-align: center; }
.empty__art { width: 184px; max-width: 64%; margin-bottom: var(--sp-4); }
.empty__title { font-size: var(--fs-18); font-weight: var(--fw-bold); line-height: var(--lh-snug); }
.empty__text { max-width: 32ch; margin-top: var(--sp-2); color: var(--text-2); font-size: var(--fs-16); }
.empty__action { margin-top: var(--sp-5); }
.empty--page { justify-content: center; min-height: calc(100vh - var(--appbar-h) - 80px); }
.empty--compact { padding: var(--sp-6) var(--sp-4); }
.empty--compact .empty__art { width: 128px; margin-bottom: var(--sp-3); }

/* ── Table (back office) ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-14); }
.table th {
  position: sticky; top: 0; padding: 10px var(--sp-4); border-bottom: 1px solid var(--border); background: var(--ink-50);
  color: var(--text-2); font-size: var(--fs-13); font-weight: var(--fw-semibold); text-align: left; white-space: nowrap;
}
.table td { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--divider); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tr.is-selected td { background: var(--brand-50); }
@media (hover: hover) { .table tbody tr:hover td { background: var(--ink-50); } }

/* ── Metric: one lead number per screen; the rest go in .kv or .rows ──── */
.metric { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.metric__label { font-size: var(--fs-14); color: var(--text-2); }
.metric__value { font-size: var(--fs-32); font-weight: var(--fw-bold); line-height: var(--lh-tight); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.metric__unit { margin-left: 4px; font-size: var(--fs-16); font-weight: var(--fw-semibold); color: var(--text-2); letter-spacing: 0; }
.metric__delta { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-14); font-weight: var(--fw-semibold); }
.metric__delta .ico { width: 18px; height: 18px; }
.metric__delta--up { color: var(--success-600); }
.metric__delta--down { color: var(--danger-600); }

/* ── Avatar ───────────────────────────────────────────────────────────── */
.avatar { display: inline-grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 50%; background: var(--brand-100); color: var(--brand-800); font-size: var(--fs-16); font-weight: var(--fw-bold); }
.avatar .ico { width: 22px; height: 22px; }
.avatar--lg { width: 52px; height: 52px; font-size: var(--fs-20); }
.avatar--lg .ico { width: 26px; height: 26px; }

/* ── Route (farm → shop) ──────────────────────────────────────────────── */
.route { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.route__end { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-weight: var(--fw-semibold); }
.route__end .ico { width: 20px; height: 20px; color: var(--ink-600); }
.route__arrow { width: 18px; height: 18px; color: var(--ink-400); }

/* ── Bottom action bar (pushed screens on phone; inline in the aside from 1024 px) ── */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-actionbar);
  padding: 12px var(--sp-4) calc(12px + var(--safe-b)); background: var(--surface); box-shadow: var(--shadow-up);
}
.actionbar__inner { display: flex; align-items: center; gap: var(--sp-2); width: 100%; max-width: var(--content-max); margin: 0 auto; }
.actionbar__inner > .btn { flex: 1 1 0; min-width: 0; min-height: var(--control-h-lg); }
.actionbar__note { flex: 0 1 auto; min-width: 0; font-size: var(--fs-14); color: var(--text-2); line-height: var(--lh-snug); }
@media (min-width: 1024px) {
  .two-pane .actionbar { position: static; padding: var(--sp-4); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
  .two-pane .actionbar__inner { flex-direction: column; align-items: stretch; }
  .two-pane .actionbar__inner > .btn { flex: none; }
  body.has-actionbar .page:has(.two-pane .actionbar) { padding-bottom: var(--sp-10); }
  body.has-actionbar:has(.two-pane .actionbar) .toasts { bottom: 24px; }
}

/* ── Illustrations (illus.js): palette lives here ─────────────────────── */
.illus {
  --il-ink: #2B3640; --il-paper: #FFFFFF; --il-brand: var(--brand-600); --il-brand-2: var(--brand-700); --il-brand-soft: var(--brand-100);
  --il-glass: #C7EEE8; --il-bg: var(--brand-50); --il-ground: var(--ink-150); --il-egg: #F5E6CC; --il-yolk: var(--star);
  --il-success: var(--success-500); --il-warn: var(--warning-500); --il-danger: var(--danger-500); --il-soft-line: var(--ink-300);
  display: block; width: 100%; height: auto; overflow: visible;
}
.illus .o { fill: none; stroke: var(--il-ink); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.illus .o-thin { fill: none; stroke: var(--il-ink); stroke-width: 1.5; stroke-linecap: round; opacity: 0.32; }
.illus .o-soft { fill: none; stroke: var(--il-soft-line); stroke-width: 3; stroke-linecap: round; }
.illus .o-brand { fill: none; stroke: var(--il-brand-2); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.illus .o-white { fill: none; stroke: #FFFFFF; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.illus .o-cup { stroke: var(--il-ink); stroke-width: 1.75; opacity: 0.85; }
.illus .o-sm { fill: none; stroke: var(--il-ink); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.illus .o-link-out { fill: none; stroke: var(--il-ink); stroke-width: 13; }
.illus .o-link { fill: none; stroke: var(--il-brand); stroke-width: 8; }
.illus .f-paper { fill: var(--il-paper); }
.illus .f-brand { fill: var(--il-brand); }
.illus .f-brand-2 { fill: var(--il-brand-2); }
.illus .f-brand-soft { fill: var(--il-brand-soft); }
.illus .f-glass { fill: var(--il-glass); }
.illus .f-bg { fill: var(--il-bg); }
.illus .f-ground { fill: var(--il-ground); }
.illus .f-egg { fill: var(--il-egg); }
.illus .f-yolk { fill: var(--il-yolk); }
.illus .f-cup { fill: var(--il-cup, var(--brand-200)); }
.illus .f-ink { fill: var(--il-ink); }
.illus .f-success { fill: var(--il-success); }
.illus .f-warn { fill: var(--il-warn); }
.illus .f-danger { fill: var(--il-danger); }
.illus--on-brand, .status-band .illus {
  --il-bg: transparent; --il-ground: rgba(0, 0, 0, 0.16); --il-ink: #063A35; --il-brand: #7EDCCF; --il-brand-2: #0B5A52;
  --il-brand-soft: #D2F7F2; --il-glass: #A6EFE6; --il-soft-line: rgba(255, 255, 255, 0.6);
}
.status-band--calm .illus {
  --il-bg: var(--brand-50); --il-ground: var(--ink-150); --il-ink: #2B3640; --il-brand: var(--brand-600); --il-brand-2: var(--brand-700);
  --il-brand-soft: var(--brand-100); --il-glass: #C7EEE8; --il-soft-line: var(--ink-300);
}

/* ── Utilities ────────────────────────────────────────────────────────── */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.text-brand { color: var(--primary); }
.text-success { color: var(--success-600); }
.text-warning { color: var(--warning-600); }
.text-danger { color: var(--danger-600); }
.truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
/* v0.32.0: a menu path inside a sentence (ลูกค้า > ลิงก์ลูกค้า): a small chevron icon sized by the text, never the › character */
.path-sep { width: 1em; height: 1em; margin: 0 0.05em; vertical-align: -0.15em; color: var(--ink-500); }
.mt-1 { margin-top: var(--sp-1); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }

/* ── Motion ───────────────────────────────────────────────────────────── */
@keyframes ds-spin { to { transform: rotate(360deg); } }
@keyframes ds-shimmer { to { background-position: 160% 0; } }
@keyframes ds-fade-in { from { opacity: 0; } }
@keyframes ds-fade-out { to { opacity: 0; } }
@keyframes ds-dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes ds-dialog-out { to { opacity: 0; transform: scale(0.98); } }
@keyframes ds-sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes ds-sheet-out { to { transform: translateY(100%); } }
@keyframes ds-toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes ds-toast-out { to { opacity: 0; transform: translateY(4px); } }
@keyframes ds-shake { 0%, 100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important;
  }
}
