/* ============================================================================
   COREX UI tokens — the top of public/ui.css, verbatim.
   ----------------------------------------------------------------------------
   Source of truth for every colour, size, space, radius, shadow, duration and
   layer on the till. Components (the rest of ui.css) and every screen read
   ONLY these --cx-* names; a hex value anywhere else is lint debt
   (corex-ui-system/scripts/ui-lint.mjs).

   Proven by corex-ui-system/scripts/contrast.mjs: every text/background pair
   used by a component is >= 4.5:1, every UI boundary (input border, focus
   ring, button fill) >= 3:1, in light AND dark, for all three accents. It
   also proves the prefers-color-scheme fallback block is identical to the
   [data-theme="dark"] block, so the two can never drift.

   Theme: data-theme="light" | "dark" on <html>, set by public/ui.js before
   the body paints (ui.js resolves the person's "system" choice into one of
   the two). With no JS yet, the media query below gives system dark.
   Accent: data-accent="sea" (default, today's COREX cyan) | "night" | "plum".
   ========================================================================= */

/* ------------------------------------------------------------- light (default) */
:root{
  color-scheme:light;

  /* surfaces and ink */
  --cx-bg:#f4f6fa;
  --cx-surface:#ffffff;
  --cx-surface-2:#f1f4f9;
  --cx-border:#e2e8f0;          /* dividers only: decorative, no contrast duty */
  --cx-border-strong:#7c8798;   /* input, select, checkbox edges: >= 3:1 */
  --cx-text:#0f172a;
  --cx-text-muted:#526075;
  --cx-inverse-bg:#0f172a;      /* toasts, tooltips */
  --cx-inverse-text:#f8fafc;

  /* status: ink (text and icon), soft (pill and banner fill) */
  --cx-success:#047857;  --cx-success-soft:#e6f6ef;
  --cx-warning:#9a4d05;  --cx-warning-soft:#fef4e6;
  --cx-danger:#b91c1c;   --cx-danger-soft:#fdecec;
  --cx-info:#1d4ed8;     --cx-info-soft:#e8effd;
  --cx-on-solid:#ffffff;        /* text on a solid status fill (toast, danger button) */

  /* the dark sidebar and phone tab bar (dark in both themes) */
  --cx-nav-bg:#0d1626;
  --cx-nav-bg-2:#131f33;
  --cx-nav-border:#1c2b42;
  --cx-nav-text:#a9bbd1;
  --cx-nav-text-muted:#8094ae;

  --cx-overlay:rgba(13,22,38,.55);

  /* accent: sea (today's COREX cyan, deepened so white reads on it) */
  --cx-accent:#0e7490;          /* primary button fill, selected tab */
  --cx-accent-hover:#155e75;
  --cx-accent-text:#ffffff;     /* text on --cx-accent */
  --cx-accent-ink:#0e7490;      /* accent-coloured text/link on a surface */
  --cx-accent-soft:#e0f6fa;     /* selected row, info note */
  --cx-accent-brand:#06b6d4;    /* the logo's C and decorative glow only, never text */
  --cx-focus:#0e7490;           /* focus ring */
  --cx-nav-active-bg:#22d3ee;   /* the nav is dark in BOTH themes, so its pill always uses the light tint */
  --cx-nav-active-text:#062a33;
  --cx-nav-focus:#22d3ee;       /* focus ring inside the dark sidebar/tab bar */

  /* type */
  --cx-font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif;
  --cx-font-ar:"Segoe UI",Tahoma,"Noto Sans Arabic","Geeza Pro","Arial",sans-serif;
  --cx-font-mono:ui-monospace,"Cascadia Mono","Segoe UI Mono",Consolas,monospace;
  --cx-fs-xs:12px;     /* meta lines, table headers — never an input, never money */
  --cx-fs-sm:13px;     /* secondary text, pills */
  --cx-fs-body:14px;   /* body, table cells (15px on phones, below) */
  --cx-fs-input:16px;  /* every input/select/textarea: iOS zooms below 16 */
  --cx-fs-lg:17px;     /* page title, dialog title */
  --cx-fs-xl:20px;     /* card figures */
  --cx-fs-2xl:24px;    /* the basket total */
  --cx-fs-3xl:30px;    /* the basket total on the pay sheet, the cash-up result */
  --cx-fs-4xl:40px;    /* ONE figure per screen, read at arm's length: the change to hand back */
  --cx-fw-regular:400; --cx-fw-medium:500; --cx-fw-semibold:600; --cx-fw-bold:700; --cx-fw-heavy:800;
  --cx-lh-tight:1.2;   /* figures, headings */
  --cx-lh-body:1.45;   /* Latin text */
  --cx-lh-ar:1.7;      /* Arabic text: taller ascenders, dots below the line */
  --cx-num:"tnum" 1, "lnum" 1;   /* font-feature-settings for every amount */

  /* space: a 4-point scale */
  --cx-space-1:4px;  --cx-space-2:8px;  --cx-space-3:12px; --cx-space-4:16px;
  --cx-space-5:20px; --cx-space-6:24px; --cx-space-8:32px; --cx-space-10:40px;
  --cx-space-12:48px; --cx-space-16:64px;

  /* radius */
  --cx-radius-sm:6px;   /* pills inside tables, kbd */
  --cx-radius-md:10px;  /* buttons, inputs */
  --cx-radius-lg:14px;  /* cards, dialogs */
  --cx-radius-xl:18px;  /* phone sheets (top corners) */
  --cx-radius-pill:999px;

  /* elevation 0-3 */
  --cx-shadow-0:none;
  --cx-shadow-1:0 1px 2px rgba(15,23,42,.06),0 1px 3px rgba(15,23,42,.06);   /* cards */
  --cx-shadow-2:0 4px 16px rgba(15,23,42,.10);                               /* popovers, sticky bars */
  --cx-shadow-3:0 12px 40px rgba(15,23,42,.22);                              /* dialogs, sheets, toasts */

  /* motion */
  --cx-dur-fast:120ms;  /* hover, press */
  --cx-dur-base:180ms;  /* toggles, folds, toasts */
  --cx-dur-slow:280ms;  /* sheets, dialogs */
  --cx-ease:cubic-bezier(.2,.8,.2,1);

  /* layers: one ladder, nothing outside it */
  --cx-z-raised:1;      /* sticky table head, badge on a card */
  --cx-z-sticky:10;     /* sticky action bar, COMPLETE */
  --cx-z-nav:100;       /* sidebar, phone tab bar */
  --cx-z-popover:200;   /* tooltips, the "?" pop, menus */
  --cx-z-sheet:300;     /* the phone Menu sheet */
  --cx-z-login:350;     /* the sign-in screen */
  --cx-z-modal:400;     /* .modal-back windows */
  --cx-z-toast:500;     /* toasts: above a window, so a window's own "Saved" is seen */
  --cx-z-banner:600;    /* net-strip, keys-strip, idle warning */
  --cx-z-camera:650;    /* the full-screen barcode camera */
  --cx-z-dialog:700;    /* the question box (dialog.js): above everything */

  /* touch and safe areas */
  --cx-hit:44px;        /* the smallest thing a thumb is asked to press */
  --cx-hit-dense:40px;  /* desktop table rows only — never on the counter */
  --cx-appbar-h:56px;   /* the phone top bar (title + status chip + bell + me) */
  --cx-tabbar-h:64px;   /* the phone tab bar, before the safe-area inset */
  --cx-safe-top:env(safe-area-inset-top,0px);
  --cx-safe-bottom:env(safe-area-inset-bottom,0px);
  --cx-safe-start:env(safe-area-inset-left,0px);
  --cx-safe-end:env(safe-area-inset-right,0px);
}
[dir="rtl"]{
  /* the inset follows the reading side */
  --cx-safe-start:env(safe-area-inset-right,0px);
  --cx-safe-end:env(safe-area-inset-left,0px);
}
@media (max-width:760px){
  :root{--cx-fs-body:15px}
}
@media (prefers-reduced-motion:reduce){
  :root{--cx-dur-fast:0ms;--cx-dur-base:0ms;--cx-dur-slow:0ms}
}

/* --------------------------------------------------------------------- dark */
[data-theme="dark"]{
  color-scheme:dark;
  --cx-bg:#0b1220;
  --cx-surface:#121b2c;
  --cx-surface-2:#18233a;
  --cx-border:#243149;
  --cx-border-strong:#6b7d99;
  --cx-text:#e7edf5;
  --cx-text-muted:#9cadc4;
  --cx-inverse-bg:#e7edf5;
  --cx-inverse-text:#0f172a;
  --cx-success:#34d399;  --cx-success-soft:#0f2f26;
  --cx-warning:#fbbf24;  --cx-warning-soft:#33270b;
  --cx-danger:#f87171;   --cx-danger-soft:#3a1618;
  --cx-info:#93c5fd;     --cx-info-soft:#13254a;
  --cx-on-solid:#0b1220;
  --cx-nav-bg:#070d18;
  --cx-nav-bg-2:#0f1828;
  --cx-nav-border:#1a273c;
  --cx-nav-text:#a9bbd1;
  --cx-nav-text-muted:#8094ae;
  --cx-overlay:rgba(0,0,0,.6);
  --cx-accent:#22d3ee;
  --cx-accent-hover:#67e8f9;
  --cx-accent-text:#062a33;
  --cx-accent-ink:#22d3ee;
  --cx-accent-soft:#0b2e38;
  --cx-accent-brand:#06b6d4;
  --cx-focus:#22d3ee;
  --cx-nav-active-bg:#22d3ee;
  --cx-nav-active-text:#062a33;
  --cx-nav-focus:#22d3ee;
  --cx-shadow-1:0 1px 2px rgba(0,0,0,.4);
  --cx-shadow-2:0 4px 16px rgba(0,0,0,.45);
  --cx-shadow-3:0 12px 40px rgba(0,0,0,.6);
}
/* No JS yet (the first paint), and the phone is in dark mode: the same block.
   contrast.mjs fails if this block and the one above ever differ. */
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    color-scheme:dark;
    --cx-bg:#0b1220;
    --cx-surface:#121b2c;
    --cx-surface-2:#18233a;
    --cx-border:#243149;
    --cx-border-strong:#6b7d99;
    --cx-text:#e7edf5;
    --cx-text-muted:#9cadc4;
    --cx-inverse-bg:#e7edf5;
    --cx-inverse-text:#0f172a;
    --cx-success:#34d399;  --cx-success-soft:#0f2f26;
    --cx-warning:#fbbf24;  --cx-warning-soft:#33270b;
    --cx-danger:#f87171;   --cx-danger-soft:#3a1618;
    --cx-info:#93c5fd;     --cx-info-soft:#13254a;
    --cx-on-solid:#0b1220;
    --cx-nav-bg:#070d18;
    --cx-nav-bg-2:#0f1828;
    --cx-nav-border:#1a273c;
    --cx-nav-text:#a9bbd1;
    --cx-nav-text-muted:#8094ae;
    --cx-overlay:rgba(0,0,0,.6);
    --cx-accent:#22d3ee;
    --cx-accent-hover:#67e8f9;
    --cx-accent-text:#062a33;
    --cx-accent-ink:#22d3ee;
    --cx-accent-soft:#0b2e38;
    --cx-accent-brand:#06b6d4;
    --cx-focus:#22d3ee;
    --cx-nav-active-bg:#22d3ee;
    --cx-nav-active-text:#062a33;
    --cx-nav-focus:#22d3ee;
    --cx-shadow-1:0 1px 2px rgba(0,0,0,.4);
    --cx-shadow-2:0 4px 16px rgba(0,0,0,.45);
    --cx-shadow-3:0 12px 40px rgba(0,0,0,.6);
  }
}

/* ------------------------------------------------------------------ accents */
/* "night" — a deep royal blue */
[data-accent="night"]{
  --cx-accent:#1d4ed8; --cx-accent-hover:#1e40af; --cx-accent-text:#ffffff;
  --cx-accent-ink:#1d4ed8; --cx-accent-soft:#e8effd; --cx-accent-brand:#3b82f6;
  --cx-focus:#1d4ed8; --cx-nav-active-bg:#93c5fd; --cx-nav-active-text:#0b1a3a; --cx-nav-focus:#93c5fd;
}
[data-theme="dark"][data-accent="night"]{
  --cx-accent:#93c5fd; --cx-accent-hover:#bfdbfe; --cx-accent-text:#0b1a3a;
  --cx-accent-ink:#93c5fd; --cx-accent-soft:#13254a; --cx-accent-brand:#3b82f6;
  --cx-focus:#93c5fd; --cx-nav-active-bg:#93c5fd; --cx-nav-active-text:#0b1a3a; --cx-nav-focus:#93c5fd;
}
/* "plum" — a warm violet */
[data-accent="plum"]{
  --cx-accent:#7e22ce; --cx-accent-hover:#6b21a8; --cx-accent-text:#ffffff;
  --cx-accent-ink:#7e22ce; --cx-accent-soft:#f3e8ff; --cx-accent-brand:#a855f7;
  --cx-focus:#7e22ce; --cx-nav-active-bg:#d8b4fe; --cx-nav-active-text:#2e1065; --cx-nav-focus:#d8b4fe;
}
[data-theme="dark"][data-accent="plum"]{
  --cx-accent:#d8b4fe; --cx-accent-hover:#e9d5ff; --cx-accent-text:#2e1065;
  --cx-accent-ink:#d8b4fe; --cx-accent-soft:#2e1a47; --cx-accent-brand:#a855f7;
  --cx-focus:#d8b4fe; --cx-nav-active-bg:#d8b4fe; --cx-nav-active-text:#2e1065; --cx-nav-focus:#d8b4fe;
}

/* ============================================================================
   LEGACY NAMES THAT ARE NOT IN app.css's OWN :root
   corex-v2.css carried a second --ok/--warn and a --bad of its own (a second
   green, #1e9e5a, beside app.css's): its :root block is gone and these point
   at the tokens, so the whole till has one green, one amber, one red.
   ========================================================================= */
:root{
  --bad:var(--cx-danger);
  --r-sm:var(--cx-radius-sm); --r-md:var(--cx-radius-md); --r-lg:var(--cx-radius-lg);
}

/* ============================================================================
   BASE: the page itself
   ========================================================================= */
/* A phone app does not bounce, zoom its text or slide sideways (owner's
   problems 2 and 3): no rubber band on the page (our own pull-to-refresh
   replaces the browser's), no font boosting, and only vertical scrolling —
   a wide table scrolls inside its own box (.cx-scroll-x), never the page. */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%;overscroll-behavior:none;
  -webkit-tap-highlight-color:transparent}
html,body{overscroll-behavior-y:none;overflow-x:hidden}
body.ar{font-family:var(--cx-font-ar)}
/* One focus ring, everywhere, for the keyboard only (components §10). The
   dark sidebar and tab bar use their own light ring. */
:focus-visible{outline:2px solid var(--cx-focus);outline-offset:2px}
.sidebar :focus-visible,.cx-tabbar :focus-visible{outline-color:var(--cx-nav-focus)}
/* iOS zooms the whole page on focus into any box under 16px, and the cashier
   then pinches back out before COMPLETE (MOBILE-CHECK, 43 boxes on 29 Oct).
   Phones and touch screens: every box is 16px, whatever an older rule said. */
@media (max-width:760px), (pointer:coarse){
  input,select,textarea{font-size:var(--cx-fs-input) !important}
}
.cx-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}

/* the one icon set: stroked, 24-unit, follows the text colour (§14) */
.cx-ico{width:20px;height:20px;flex:none;fill:none;stroke:currentColor;stroke-width:1.75;
  stroke-linecap:round;stroke-linejoin:round}
[dir="rtl"] .cx-icon-mirror{transform:scaleX(-1)}

/* ============================================================================
   BUTTONS (§1)
   ========================================================================= */
.cx-btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--cx-space-2);
  min-height:var(--cx-hit);min-width:var(--cx-hit);padding:0 var(--cx-space-4);
  border:1px solid transparent;border-radius:var(--cx-radius-md);background:transparent;color:var(--cx-text);
  font:inherit;font-size:var(--cx-fs-body);font-weight:var(--cx-fw-semibold);line-height:var(--cx-lh-tight);
  white-space:normal;text-align:center;cursor:pointer;text-decoration:none;
  transition:background var(--cx-dur-fast) var(--cx-ease),border-color var(--cx-dur-fast) var(--cx-ease),
             color var(--cx-dur-fast) var(--cx-ease),transform var(--cx-dur-fast) var(--cx-ease)}
.cx-btn:active{transform:scale(.97)}
.cx-btn--primary{background:var(--cx-accent);color:var(--cx-accent-text)}
.cx-btn--primary:hover{background:var(--cx-accent-hover)}
.cx-btn--secondary{background:var(--cx-surface);color:var(--cx-text);border-color:var(--cx-border-strong)}
.cx-btn--secondary:hover{background:var(--cx-surface-2)}
.cx-btn--quiet{background:transparent;color:var(--cx-accent-ink)}
.cx-btn--quiet:hover{background:var(--cx-accent-soft)}
.cx-btn--danger{background:var(--cx-danger);color:var(--cx-on-solid)}
.cx-btn--lg{min-height:56px;font-size:var(--cx-fs-lg);font-weight:var(--cx-fw-bold)}
.cx-btn--sm{min-height:36px;position:relative}
.cx-btn--sm::after{content:"";position:absolute;inset:-4px 0}
.cx-btn--block{display:flex;width:100%}
.cx-btn--icon{padding:0;width:var(--cx-hit)}
.cx-btn .cx-ico{width:20px;height:20px}
.cx-btn:disabled,.cx-btn[aria-disabled="true"]{background:var(--cx-surface-2);color:var(--cx-text-muted);
  border-color:var(--cx-border);cursor:not-allowed;transform:none}
/* loading: the label stays, a spinner leads, nothing can be pressed twice */
.cx-btn[aria-busy="true"]{pointer-events:none}
.cx-btn[aria-busy="true"]::before{content:"";width:16px;height:16px;flex:none;border-radius:50%;
  border:2px solid currentColor;border-inline-end-color:transparent;animation:cx-spin calc(var(--cx-dur-slow) * 3) linear infinite}
@keyframes cx-spin{to{transform:rotate(360deg)}}

/* ============================================================================
   FIELDS AND MONEY BOXES (§2)
   ========================================================================= */
.cx-field{display:flex;flex-direction:column;gap:6px;min-width:0}
.cx-label{font-size:var(--cx-fs-sm);font-weight:var(--cx-fw-semibold);color:var(--cx-text)}
body.ar .cx-label{font-size:var(--cx-fs-body)}
.cx-hint{font-size:var(--cx-fs-sm);color:var(--cx-text-muted)}
.cx-field-error{font-size:var(--cx-fs-sm);color:var(--cx-danger);font-weight:var(--cx-fw-semibold)}
.cx-field-error::before{content:"✕ "}
.cx-input{width:100%;min-height:var(--cx-hit);padding:0 var(--cx-space-3);border:1px solid var(--cx-border-strong);
  border-radius:var(--cx-radius-md);background:var(--cx-surface);color:var(--cx-text);font:inherit;
  font-size:var(--cx-fs-input)}
textarea.cx-input{padding:var(--cx-space-3);min-height:88px}
.cx-input::placeholder{color:var(--cx-text-muted)}
.cx-input:focus{border-color:var(--cx-focus);outline:2px solid var(--cx-focus);outline-offset:1px}
.cx-input[aria-invalid="true"]{border-color:var(--cx-danger)}
.cx-money-in{display:flex;align-items:stretch;direction:ltr;min-height:var(--cx-hit);
  border:1px solid var(--cx-border-strong);border-radius:var(--cx-radius-md);background:var(--cx-surface);overflow:hidden}
.cx-money-in:focus-within{border-color:var(--cx-focus);outline:2px solid var(--cx-focus);outline-offset:1px}
.cx-money-in input{flex:1;min-width:0;border:0;background:transparent;color:var(--cx-text);outline:0;
  font:inherit;font-size:var(--cx-fs-input);text-align:end;font-feature-settings:var(--cx-num);
  padding-block:0;padding-inline:var(--cx-space-3) var(--cx-space-2)}
.cx-money-in .cx-cur{display:flex;align-items:center;padding-inline:var(--cx-space-2) var(--cx-space-3);
  border-inline-start:1px solid var(--cx-border);background:var(--cx-surface-2);color:var(--cx-text-muted);
  font-size:var(--cx-fs-sm);font-weight:var(--cx-fw-bold)}
.cx-money-in.cx-money-in--lg{min-height:56px}
.cx-money-in--lg input{font-size:var(--cx-fs-xl);font-weight:var(--cx-fw-bold)}

/* a money figure: digits lead, the currency mark steps back (§18) */
.cx-money{direction:ltr;unicode-bidi:isolate;white-space:nowrap;font-feature-settings:var(--cx-num)}
.cx-money .cx-cur{font-size:.62em;font-weight:var(--cx-fw-semibold);color:var(--cx-text-muted);vertical-align:.32em}
.cx-money .cx-cur--after{vertical-align:baseline;margin-inline-start:.22em}
.cx-money--neg{color:var(--cx-danger)}

/* ============================================================================
   SEGMENTED, HUB TABS, SWITCH (§3)
   ========================================================================= */
.cx-seg{display:inline-flex;gap:2px;padding:2px;min-height:50px;background:var(--cx-surface-2);
  border:1px solid var(--cx-border);border-radius:var(--cx-radius-md)}
.cx-seg--block{display:flex;width:100%}
.cx-seg>button{flex:1 1 0;min-width:var(--cx-hit);min-height:var(--cx-hit);padding:0 var(--cx-space-3);
  border:0;border-radius:8px;background:transparent;color:var(--cx-text-muted);font:inherit;
  font-weight:var(--cx-fw-medium);line-height:1.15;cursor:pointer}
.cx-seg>button[aria-checked="true"]{background:var(--cx-surface);color:var(--cx-accent-ink);
  font-weight:var(--cx-fw-bold);box-shadow:var(--cx-shadow-1)}

/* The tabs of a place (NAVIGATION.md §2): one row under the title, never
   wrapping; on a phone it scrolls sideways inside itself, never the page. */
.cx-hubtabs{display:flex;gap:var(--cx-space-1);flex:none;overflow-x:auto;overflow-y:hidden;
  scrollbar-width:none;overscroll-behavior-x:contain;background:var(--cx-surface);
  border-block-end:1px solid var(--cx-border);padding-inline:var(--cx-space-4)}
.cx-hubtabs::-webkit-scrollbar{display:none}
.cx-hubtabs[hidden]{display:none}
.cx-hubtab{flex:none;display:inline-flex;align-items:center;justify-content:center;min-height:var(--cx-hit);min-width:var(--cx-hit);padding:0 var(--cx-space-3);
  border:0;border-block-end:3px solid transparent;background:transparent;color:var(--cx-text-muted);
  font:inherit;font-weight:var(--cx-fw-medium);white-space:nowrap;cursor:pointer}
.cx-hubtab:hover{color:var(--cx-text)}
.cx-hubtab:focus-visible{outline-offset:-3px}
.cx-hubtab[aria-selected="true"]{color:var(--cx-text);font-weight:var(--cx-fw-bold);border-block-end-color:var(--cx-accent)}
.cx-hubtab.off{display:none}

.cx-switch{position:relative;display:inline-flex;align-items:center;justify-content:center;
  width:var(--cx-hit);height:var(--cx-hit);padding:0;border:0;background:transparent;cursor:pointer}
.cx-switch::before{content:"";width:44px;height:26px;border-radius:13px;background:var(--cx-border-strong);
  transition:background var(--cx-dur-base) var(--cx-ease)}
.cx-switch::after{content:"";position:absolute;inset-inline-start:3px;top:calc(50% - 10px);width:20px;height:20px;
  border-radius:50%;background:var(--cx-surface);transition:inset-inline-start var(--cx-dur-base) var(--cx-ease)}
.cx-switch[aria-checked="true"]::before{background:var(--cx-accent)}
.cx-switch[aria-checked="true"]::after{inset-inline-start:21px}

/* ============================================================================
   PILLS, CARDS, LISTS (§5, §6)
   ========================================================================= */
.cx-pill{display:inline-flex;align-items:center;gap:var(--cx-space-1);min-height:24px;padding:0 var(--cx-space-2);
  border-radius:var(--cx-radius-pill);background:var(--cx-surface-2);color:var(--cx-text);
  font-size:var(--cx-fs-sm);font-weight:var(--cx-fw-semibold);white-space:nowrap}
.cx-pill--success{background:var(--cx-success-soft);color:var(--cx-success)}
.cx-pill--warning{background:var(--cx-warning-soft);color:var(--cx-warning)}
.cx-pill--danger{background:var(--cx-danger-soft);color:var(--cx-danger)}
.cx-pill--info{background:var(--cx-info-soft);color:var(--cx-info)}
.cx-pill--accent{background:var(--cx-accent-soft);color:var(--cx-accent-ink)}
/* never colour alone: each kind leads with its glyph */
.cx-pill--success::before{content:"✓"}
.cx-pill--warning::before{content:"!"}
.cx-pill--danger::before{content:"✕"}
.cx-pill--info::before{content:"i"}

.cx-card{background:var(--cx-surface);color:var(--cx-text);border:1px solid var(--cx-border);
  border-radius:var(--cx-radius-lg);padding:var(--cx-space-4);box-shadow:var(--cx-shadow-0)}
.cx-card-head{display:flex;align-items:center;justify-content:space-between;gap:var(--cx-space-3);
  margin-block-end:var(--cx-space-3);font-size:var(--cx-fs-body);font-weight:var(--cx-fw-semibold)}
.cx-stat .cx-stat-l{font-size:var(--cx-fs-sm);color:var(--cx-text-muted)}
.cx-stat .cx-stat-v{font-size:var(--cx-fs-xl);font-weight:var(--cx-fw-bold);font-feature-settings:var(--cx-num)}
.cx-rows{display:flex;flex-direction:column}
.cx-row{display:flex;align-items:center;justify-content:space-between;gap:var(--cx-space-3);
  min-height:var(--cx-hit);padding-block:var(--cx-space-2);border-block-end:1px solid var(--cx-border)}
.cx-row:last-child{border-block-end:0}

/* ============================================================================
   EMPTY, LOADING, ERROR, STICKY ACTION BAR (§9, §13)
   ========================================================================= */
.cx-empty{display:flex;flex-direction:column;align-items:center;gap:var(--cx-space-2);text-align:center;
  padding:var(--cx-space-8) var(--cx-space-4);color:var(--cx-text-muted)}
.cx-empty .cx-ico{width:32px;height:32px}
.cx-empty-t{font-weight:var(--cx-fw-semibold);color:var(--cx-text-muted)}
.cx-skel{border-radius:var(--cx-radius-md);min-height:44px;
  background:linear-gradient(90deg,var(--cx-surface-2) 0%,var(--cx-border) 50%,var(--cx-surface-2) 100%);
  background-size:200% 100%;animation:cx-sweep 1.4s linear infinite;animation-delay:300ms}
[dir="rtl"] .cx-skel{animation-direction:reverse}
@keyframes cx-sweep{from{background-position:100% 0}to{background-position:-100% 0}}
.cx-error-state{display:flex;flex-wrap:wrap;align-items:center;gap:var(--cx-space-3);
  padding:var(--cx-space-3) var(--cx-space-4);border-radius:var(--cx-radius-md);
  background:var(--cx-danger-soft);color:var(--cx-danger);border-inline-start:4px solid var(--cx-danger);font-weight:var(--cx-fw-semibold)}
.cx-error-state::before{content:"✕"}
.cx-actionbar{position:sticky;inset-block-end:0;z-index:var(--cx-z-sticky);display:flex;gap:var(--cx-space-2);
  justify-content:flex-end;background:var(--cx-surface);border-block-start:1px solid var(--cx-border);
  box-shadow:var(--cx-shadow-2);padding:var(--cx-space-3) var(--cx-space-4) calc(var(--cx-space-3) + var(--cx-safe-bottom))}
@media (max-width:760px){
  .cx-actionbar .cx-btn--primary{flex:1}
}

/* a wide table on a phone scrolls inside its own box; the shadow at the far
   edge says there is more (a box that just stops looks like the end) */
.cx-scroll-x{overflow-x:auto;overscroll-behavior-x:contain;max-width:100%;
  background:
    linear-gradient(to right,var(--cx-surface) 30%,transparent) left center / 24px 100% no-repeat local,
    linear-gradient(to left,var(--cx-surface) 30%,transparent) right center / 24px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%,var(--cx-border-strong),transparent) left center / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%,var(--cx-border-strong),transparent) right center / 12px 100% no-repeat scroll}
/* on a phone, every box an older screen puts a wide table in scrolls by
   itself, with the same edge shadow (the view itself never scrolls
   sideways): until each screen's own wave turns its rows into cards */
@media (max-width:760px){
  :where(.view) :where(.table-wrap,.mv-wrap,.fold-body,.ax-scroll,.kwi-wrap,.set-card){overflow-x:auto;overscroll-behavior-x:contain;max-width:100%;
  background:
    linear-gradient(to right,var(--cx-surface) 30%,transparent) left center / 24px 100% no-repeat local,
    linear-gradient(to left,var(--cx-surface) 30%,transparent) right center / 24px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%,var(--cx-border-strong),transparent) left center / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%,var(--cx-border-strong),transparent) right center / 12px 100% no-repeat scroll}
}

/* ============================================================================
   THE SHELL: sidebar (computer), tab bar (phone), app bar, sheets
   NAVIGATION.md §2. The sidebar and the tab bar are the SAME buttons
   (.sidebar .nav .nav-item[data-hub]): ten places, laid out as a column on a
   computer and as a row of five on a phone.
   ========================================================================= */
.sidebar{background:var(--cx-nav-bg);color:var(--cx-nav-text)}
.sidebar .brand-sub,.sidebar .version{color:var(--cx-nav-text-muted)}
.sidebar .nav{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;
  scrollbar-color:var(--cx-nav-bg-2) transparent;padding:var(--cx-space-1) var(--cx-space-3);gap:2px}
.sidebar .nav>*{flex-shrink:0}
.sidebar .nav-item{display:flex;align-items:center;gap:var(--cx-space-3);width:100%;min-height:var(--cx-hit);
  padding:0 var(--cx-space-3);border:0;border-radius:var(--cx-radius-md);background:transparent;
  color:var(--cx-nav-text);font:inherit;font-size:var(--cx-fs-body);font-weight:var(--cx-fw-medium);
  text-align:start;cursor:pointer;box-shadow:none}
.sidebar .nav-item .cx-ico,.sidebar .nav-item>svg{width:20px;height:20px;flex:none;opacity:1}
.sidebar .nav-item span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sidebar .nav-item:hover{background:var(--cx-nav-bg-2);color:var(--cx-nav-text)}
.sidebar .nav-item:focus-visible{outline-offset:-3px}
.sidebar .nav-item[aria-current="page"]{background:var(--cx-nav-active-bg);color:var(--cx-nav-active-text);
  font-weight:var(--cx-fw-semibold)}
.sidebar .nav-sep{flex:none;height:1px;border:0;margin:var(--cx-space-1) var(--cx-space-3);background:var(--cx-nav-border)}
.sidebar .nav-sep[hidden]{display:none}
.sidebar .more-btn{display:none}
.sidebar-foot{border-block-start:1px solid var(--cx-nav-border)}
.who-box{width:100%;min-height:52px;border:0;color:var(--cx-nav-text);font:inherit;text-align:start;cursor:pointer;
  background:var(--cx-nav-bg-2)}
.who-box:hover{background:var(--cx-nav-border)}
.who-name{color:var(--cx-nav-text)}
.who-role{color:var(--cx-nav-text-muted);font-size:var(--cx-fs-xs)}
.who-avatar,.cx-avatar{background:var(--cx-nav-active-bg);color:var(--cx-nav-active-text)}

/* the app bar: title, till chip, bell, person (§16) */
.topbar{background:var(--cx-surface);color:var(--cx-text);border-block-end:1px solid var(--cx-border);gap:var(--cx-space-3)}
.topbar .tb-title{flex:1 1 auto;min-width:0}
.topbar h1{font-size:var(--cx-fs-lg);font-weight:var(--cx-fw-bold);letter-spacing:0;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.topbar p{color:var(--cx-text-muted)}
.topbar-right{flex:none}
.cx-iconbtn{position:relative;display:inline-flex;align-items:center;justify-content:center;flex:none;
  width:var(--cx-hit);height:var(--cx-hit);padding:0;border:0;border-radius:var(--cx-radius-md);
  background:transparent;color:var(--cx-text);cursor:pointer}
.cx-iconbtn:hover{background:var(--cx-surface-2)}
.cx-iconbtn .cx-ico{width:22px;height:22px}
.cx-badge{position:absolute;top:4px;inset-inline-end:2px;min-width:18px;height:18px;padding:0 4px;
  border-radius:9px;background:var(--cx-danger);color:var(--cx-on-solid);font-size:var(--cx-fs-xs);
  font-weight:var(--cx-fw-bold);line-height:18px;text-align:center;font-feature-settings:var(--cx-num)}
.cx-avatar{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:50%;
  font-weight:var(--cx-fw-bold);font-size:var(--cx-fs-sm)}
.cx-me-btn{display:none}
/* the till chip: a dot and one word; the amount only on a computer, and
   only when the server sent one (never to a cashier: the count is blind) */
.till-state{display:inline-flex;align-items:center;gap:6px;min-height:var(--cx-hit);padding:0 var(--cx-space-3);
  letter-spacing:0;font-size:var(--cx-fs-sm)}
.till-state::before{content:"";width:8px;height:8px;border-radius:50%;background:currentColor;flex:none}
.till-state.open{background:var(--cx-success-soft);border-color:transparent;color:var(--cx-success)}
.till-state.closed{background:var(--cx-danger-soft);border-color:var(--cx-danger);color:var(--cx-danger)}

/* pull to refresh: the arrow comes down with the thumb */
.cx-ptr{position:fixed;z-index:var(--cx-z-popover);inset-inline:0;margin-inline:auto;
  top:calc(var(--cx-appbar-h) + var(--cx-safe-top) + 4px);width:40px;height:40px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;background:var(--cx-surface);color:var(--cx-accent-ink);
  border:1px solid var(--cx-border);box-shadow:var(--cx-shadow-2);opacity:0;transform:translateY(-56px);
  pointer-events:none;transition:opacity var(--cx-dur-fast) var(--cx-ease)}
.cx-ptr.pulling{transition:none}
.cx-ptr.ready{color:var(--cx-accent-text);background:var(--cx-accent)}
.cx-ptr.busy .cx-ico{animation:cx-spin calc(var(--cx-dur-slow) * 3) linear infinite}

/* a new version is waiting: a strip with one button, never a reload by itself */
.cx-verstrip{position:fixed;z-index:var(--cx-z-banner);inset-inline:var(--cx-space-3);
  bottom:calc(var(--cx-space-3) + var(--cx-safe-bottom));display:flex;align-items:center;justify-content:space-between;
  gap:var(--cx-space-3);flex-wrap:wrap;padding:var(--cx-space-2) var(--cx-space-2) var(--cx-space-2) var(--cx-space-4);
  padding-inline:var(--cx-space-4) var(--cx-space-2);border-radius:var(--cx-radius-lg);
  background:var(--cx-inverse-bg);color:var(--cx-inverse-text);box-shadow:var(--cx-shadow-3);font-weight:var(--cx-fw-semibold)}
.cx-verstrip[hidden]{display:none}
.cx-verstrip::before{content:"i";display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;
  border-radius:50%;border:2px solid currentColor;font-weight:var(--cx-fw-heavy);flex:none}
.cx-verstrip span{flex:1;min-width:0}

/* sheets: More, My account, Needs you (§12, §16). A bottom sheet on a phone,
   a centred card on a computer; above the tab bar, under any window. */
.cx-sheet-back{position:fixed;inset:0;z-index:var(--cx-z-sheet);background:var(--cx-overlay);
  display:flex;align-items:center;justify-content:center;padding:var(--cx-space-4)}
.cx-sheet-back[hidden]{display:none}
.cx-sheet{width:min(520px,100%);max-height:min(88dvh,820px);overflow-y:auto;overscroll-behavior:contain;
  background:var(--cx-surface);color:var(--cx-text);border:1px solid var(--cx-border);border-radius:var(--cx-radius-lg);
  box-shadow:var(--cx-shadow-3);padding:var(--cx-space-2) var(--cx-space-4) var(--cx-space-4);
  animation:cx-up var(--cx-dur-slow) var(--cx-ease)}
.cx-sheet--wide{width:min(760px,100%)}
.cx-sheet:focus{outline:0}
.cx-sheet-head{display:flex;align-items:center;justify-content:space-between;gap:var(--cx-space-2);
  min-height:52px;margin-block-end:var(--cx-space-2)}
.cx-sheet-head h2{font-size:var(--cx-fs-lg);font-weight:var(--cx-fw-bold)}
.cx-sheet-sec{display:flex;flex-direction:column;gap:var(--cx-space-2);padding-block:var(--cx-space-3);
  border-block-start:1px solid var(--cx-border)}
.cx-sheet-sec>h3{font-size:var(--cx-fs-sm);font-weight:var(--cx-fw-semibold);color:var(--cx-text-muted)}
body.ar .cx-sheet-sec>h3{font-size:var(--cx-fs-body)}
/* Arabic in the shell's own surfaces gets its taller line (dots below the line) */
[dir="rtl"] :where(.cx-sheet,.toast,.cx-verstrip,.login-card,.day-card,.cx-empty,.cx-error-state){line-height:var(--cx-lh-ar)}
/* a toast's own line height is set later in this file; Arabic outranks it here */
[dir="rtl"] .toast{line-height:var(--cx-lh-ar)}
/* a fold's own summary (the bell's thresholds) is a 44px row */
.cx-sheet summary{display:flex;align-items:center;gap:var(--cx-space-2);min-height:var(--cx-hit);cursor:pointer}
@keyframes cx-up{from{transform:translateY(24px);opacity:0}to{transform:none;opacity:1}}

/* the person, at the top of My account */
.me-who{display:flex;align-items:center;gap:var(--cx-space-3);padding-block:var(--cx-space-2) var(--cx-space-3)}
.me-who .cx-avatar{width:44px;height:44px;font-size:var(--cx-fs-lg)}
.me-who b{display:block;font-size:var(--cx-fs-lg)}
.me-who small{color:var(--cx-text-muted);font-size:var(--cx-fs-sm)}
.me-pw{display:grid;gap:var(--cx-space-3)}
.me-pw[hidden]{display:none}
/* the colours: a dot AND a word each, the chosen one outlined and bold */
.cx-swatches{display:flex;flex-wrap:wrap;gap:var(--cx-space-2)}
.cx-swatches>button{display:inline-flex;align-items:center;gap:var(--cx-space-2);min-height:var(--cx-hit);
  padding:0 var(--cx-space-3);border:1px solid var(--cx-border-strong);border-radius:var(--cx-radius-md);
  background:var(--cx-surface);color:var(--cx-text);font:inherit;font-weight:var(--cx-fw-medium);cursor:pointer}
.cx-swatches>button[aria-checked="true"]{border:2px solid var(--cx-text);font-weight:var(--cx-fw-bold)}
.cx-swatches i{width:18px;height:18px;border-radius:50%;flex:none;border:1px solid var(--cx-border)}
/* each swatch carries its own data-accent, so the accent tokens of THAT
   colour apply inside it: the dot is the colour itself, from the tokens */
.cx-swatches [data-accent] i{background:var(--cx-accent)}

/* the More sheet: every other place this person may open, 88px tiles */
.more-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--cx-space-2)}
.more-grid .nav-item{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;
  min-height:88px;padding:var(--cx-space-2);border:1px solid var(--cx-border);border-radius:var(--cx-radius-lg);
  background:var(--cx-surface);color:var(--cx-text);font:inherit;font-weight:var(--cx-fw-semibold);
  text-align:center;cursor:pointer}
.more-grid .nav-item svg{width:24px;height:24px;color:var(--cx-accent-ink)}
.more-grid .nav-item span{max-width:100%;overflow-wrap:anywhere}
.more-grid .nav-item[aria-current="page"]{border-color:var(--cx-accent);background:var(--cx-accent-soft)}

/* ------------------------------------------- tablet: the 72px icon rail */
@media (max-width:900px) and (min-width:761px){
  .sidebar .nav-item{justify-content:center;padding:0}
  .sidebar .nav-item span{display:none}
  .who-box{justify-content:center}
}

/* ------------------------------------------------------------- phone */
@media (max-width:760px){
  /* the app bar: a phone's top carries only title, till chip, bell, person */
  /* ".app" in front: these out-rank the computer's own rules in app.css,
     which loads after this file */
  .app .topbar{min-height:calc(var(--cx-appbar-h) + var(--cx-safe-top));height:auto;
    padding-block:var(--cx-safe-top) 0;padding-inline:calc(var(--cx-space-4) + var(--cx-safe-start)) calc(var(--cx-space-1) + var(--cx-safe-end))}
  .app .topbar p,.topbar .stat-chip,.topbar .clock{display:none}
  .topbar-right{gap:2px}
  .till-state .ts-amt{display:none}
  .cx-me-btn{display:inline-flex}
  .cx-hubtabs{padding-inline:calc(var(--cx-space-2) + var(--cx-safe-start)) calc(var(--cx-space-2) + var(--cx-safe-end))}

  /* the tab bar: at most five equal slots, More last; nothing scrolls */
  .app .sidebar{flex-direction:row;align-items:stretch;width:100%;height:auto;
    min-height:calc(var(--cx-tabbar-h) + var(--cx-safe-bottom));
    padding-block:4px var(--cx-safe-bottom);padding-inline:calc(4px + var(--cx-safe-start)) calc(4px + var(--cx-safe-end));
    border-inline-end:0;border-block-start:1px solid var(--cx-nav-border)}
  .sidebar .brand,.sidebar .sidebar-foot,.sidebar .nav-sep{display:none}
  .sidebar .nav{flex-direction:row;flex:1;gap:0;padding:0;overflow:hidden}
  .sidebar .nav-item{display:none}
  .sidebar .nav-item.in-bar,.sidebar .more-btn.in-bar{display:flex;flex:1 1 0;min-width:0;min-height:56px;
    flex-direction:column;align-items:center;justify-content:center;gap:2px;padding:0 2px;
    background:transparent;color:var(--cx-nav-text);font-size:var(--cx-fs-xs);font-weight:var(--cx-fw-medium);border-radius:0;
    order:var(--bar-order,0)}
  .sidebar .more-btn.in-bar{order:9}
  body.ar .sidebar .nav-item.in-bar{font-size:var(--cx-fs-sm)}
  .sidebar .nav-item.in-bar svg{width:22px;height:22px;box-sizing:content-box;padding:4px 15px;border-radius:15px}
  .sidebar .nav-item.in-bar span{max-width:100%;display:block}
  .sidebar .nav-item.in-bar[aria-current="page"]{background:transparent;color:var(--cx-nav-text);font-weight:var(--cx-fw-bold)}
  .sidebar .nav-item.in-bar[aria-current="page"] svg{background:var(--cx-nav-active-bg);color:var(--cx-nav-active-text)}
  .sidebar .nav-item.in-bar:hover{background:transparent}

  /* sheets come up from the bottom, over the tab bar, above the home bar */
  .cx-sheet-back{align-items:flex-end;padding:0}
  .cx-sheet,.cx-sheet--wide{width:100%;max-height:92dvh;border-radius:var(--cx-radius-xl) var(--cx-radius-xl) 0 0;
    border-block-end:0;padding-block-end:calc(var(--cx-space-4) + var(--cx-safe-bottom));
    padding-inline:calc(var(--cx-space-4) + var(--cx-safe-start)) calc(var(--cx-space-4) + var(--cx-safe-end))}

  /* every control a thumb is asked to press is 44px (MOBILE-CHECK) — the
     shell's, and any older one inside a screen until its own wave restyles it */
  /* :where() keeps these at the weight of a bare "button": any screen's own
     rule (a product card's 120px, a tile's size) still wins */
  :where(.view,.modal,.login-card,.cx-sheet,.cx-verstrip) :where(button,select,.btn,[role="button"]){min-height:var(--cx-hit)}
  :where(.view,.modal,.cx-sheet) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"])){min-height:var(--cx-hit)}
  /* the shell's own surfaces (My account, Needs you, Menu, the version strip):
     every button a full 44px both ways, whatever older code drew in them */
  :where(.cx-sheet,.cx-verstrip) :where(button,a[href],select){min-width:var(--cx-hit)}
  /* the small text buttons a thumb still has to hit */
  :where(.view,.modal,.cx-sheet) :where(.link-btn,.mini-btn,.tq-btn,.cline-del,.icon-btn){min-width:var(--cx-hit)}
  /* a checkbox: a 44px target round a 22px box (the margin keeps its old
     footprint, so no row grows) */
  :where(.view,.modal,.cx-sheet) input[type="checkbox"]{appearance:none;-webkit-appearance:none;position:relative;flex:none;
    width:var(--cx-hit);height:var(--cx-hit);margin:-10px;vertical-align:middle;cursor:pointer;background:transparent;border:0}
  :where(.view,.modal,.cx-sheet) input[type="checkbox"]::before{content:"";position:absolute;inset:11px;border:2px solid var(--cx-border-strong);
    border-radius:var(--cx-radius-sm);background:var(--cx-surface)}
  :where(.view,.modal,.cx-sheet) input[type="checkbox"]:checked::before{background:var(--cx-accent);border-color:var(--cx-accent)}
  :where(.view,.modal,.cx-sheet) input[type="checkbox"]:checked::after{content:"";position:absolute;inset-inline-start:18px;top:14px;
    width:6px;height:12px;border:solid var(--cx-accent-text);border-width:0 3px 3px 0;transform:rotate(45deg)}
  :where(.view,.modal,.cx-sheet) input[type="checkbox"]:disabled{opacity:.5;cursor:not-allowed}
  :where(.view,.modal,.cx-sheet) input[type="checkbox"]:focus-visible{outline-offset:-6px}
  /* the "?" beside a figure: the same 18px circle, inside a 44px target
     whose margins give the space back, so nothing moves */
  .qh.qh{width:var(--cx-hit);height:var(--cx-hit);margin-block:-13px;margin-inline:-9px -13px;padding:0;border:0;
    background:transparent;isolation:isolate;vertical-align:middle}
  .qh.qh::before{content:"";position:absolute;inset:13px;z-index:-1;border-radius:50%;
    border:1px solid var(--cx-border-strong);background:var(--cx-surface)}
}
@media (pointer:coarse){
  :where(.view,.modal,.cx-sheet) :where(button,select,[role="button"]){min-height:var(--cx-hit)}
}

/* ============================================================================
   TOAST (§8): one live region (#toast), above every window, glyph + words
   ========================================================================= */
.toast{position:fixed;z-index:var(--cx-z-toast);inset-inline:0;margin-inline:auto;width:max-content;
  max-width:min(92vw,560px);inset-block-end:calc(var(--cx-space-6) + var(--cx-safe-bottom));
  display:flex;align-items:center;gap:var(--cx-space-2);padding:var(--cx-space-3) var(--cx-space-5);
  border-radius:var(--cx-radius-lg);background:var(--cx-inverse-bg);color:var(--cx-inverse-text);
  box-shadow:var(--cx-shadow-3);font-size:var(--cx-fs-body);font-weight:var(--cx-fw-semibold);line-height:var(--cx-lh-body);
  text-align:start;cursor:pointer;animation:cx-toast var(--cx-dur-base) var(--cx-ease)}
.toast::before{content:"i";flex:none;display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;
  border-radius:50%;border:2px solid currentColor;font-size:var(--cx-fs-xs);font-weight:var(--cx-fw-heavy)}
.toast.ok,.toast.err,.toast.warn{color:var(--cx-on-solid)}
.toast.ok{background:var(--cx-success)}
.toast.ok::before{content:"✓"}
.toast.err{background:var(--cx-danger)}
.toast.err::before{content:"✕"}
.toast.warn{background:var(--cx-warning)}
.toast.warn::before{content:"!"}
@keyframes cx-toast{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
@media (max-width:760px){
  /* on a phone it comes in under the app bar: it covers neither the tab bar
     nor COMPLETE, which sit at the bottom where the thumb is */
  .toast{inset-block-start:calc(var(--cx-appbar-h) + var(--cx-safe-top) + var(--cx-space-2));inset-block-end:auto}
  @keyframes cx-toast{from{opacity:0;transform:translateY(-12px)}to{opacity:1;transform:none}}
}

/* ============================================================================
   WINDOWS AND THE QUESTION BOX (§7): one look, one layer each
   ========================================================================= */
.modal-back{z-index:var(--cx-z-modal);background:var(--cx-overlay)}
.modal{background:var(--cx-surface);color:var(--cx-text);border:1px solid var(--cx-border);border-radius:var(--cx-radius-lg)}
.icon-btn{min-width:var(--cx-hit);min-height:var(--cx-hit)}

/* ============================================================================
   PAPER IS ALWAYS LIGHT (THEMES.md §3): the receipt, the Z slip and anything
   printed re-declare the light colours, so a dark till never prints grey on
   black or wastes toner.
   ========================================================================= */
.cx-paper,.receipt,.receipt-scroll{color-scheme:light;
  --cx-bg:#f4f6fa;--cx-surface:#ffffff;--cx-surface-2:#f1f4f9;--cx-border:#e2e8f0;--cx-border-strong:#7c8798;
  --cx-text:#0f172a;--cx-text-muted:#526075;
  --bg:#f4f6fa;--surface:#ffffff;--surface-2:#f1f4f9;--ink:#0f172a;--ink-2:#0f172a;--muted:#526075;--line:#e2e8f0;--line-2:#e2e8f0}
/* :not(#cx-print) carries an id's weight, so this outranks the dark block AND
   the dark-device block (:root:not([data-theme=light])) whatever the look */
@media print{
  :root:not(#cx-print){color-scheme:light;
    --cx-bg:#ffffff;--cx-surface:#ffffff;--cx-surface-2:#f1f4f9;--cx-border:#e2e8f0;--cx-border-strong:#7c8798;
    --cx-text:#0f172a;--cx-text-muted:#526075;--cx-accent:#0e7490;--cx-accent-text:#ffffff;--cx-accent-ink:#0e7490}
}

/* ============================================================================
   REDUCED MOTION: tokens go to 0; every keyframe also stops here
   ========================================================================= */
@media (prefers-reduced-motion:reduce){
  .cx-btn:active{transform:none}
  .cx-btn[aria-busy="true"]::before,.cx-skel,.cx-sheet,.toast,.cx-ptr.busy .cx-ico{animation:none}
  .cx-btn[aria-busy="true"]::after{content:"…"}
}

/* Reports' own tabs (Today, Timeline, The month, Staff sales, Commission)
   are the Reports place's tabs in the row under the title: never a second
   row of tabs (components §12). The old row stays in the page for its
   code, unseen. */
#repTabs{display:none}

/* ============================================================================
   WAVE D2 — the polish: states, the server's English in small print, boxes
   ========================================================================= */
/* a server sentence nobody has put in Arabic: the Arabic line, then its English, smaller */
.toast .toast-en{display:block;margin-block-start:var(--cx-space-1);font-size:var(--cx-fs-sm);font-weight:var(--cx-fw-regular);opacity:.92;text-align:start}
/* the same in a banner or an error state: its own line (dialog.css already keeps line breaks) */
.sale-refusal .sr-msg,.cx-error-msg{white-space:pre-line}
/* empty (§9): what is not there, then what to do */
.cx-empty-h{font-size:var(--cx-fs-sm);color:var(--cx-text-muted);max-width:36em}
.cx-empty .cx-btn{margin-block-start:var(--cx-space-2)}
table tr.cx-empty-row > td{padding:0;border:0}
/* a table that turns into cards on a phone keeps its empty row whole */
@media (max-width:760px){
  table.cx-cards tr.cx-empty-row{display:block;border:0;padding:0;background:none}
  table.cx-cards tr.cx-empty-row > td{display:block}
  table.cx-cards tr.cx-empty-row > td::before{content:none}
}
/* loading (§9): rows shaped like the list that is coming */
.cx-skel-list{display:flex;flex-direction:column;gap:var(--cx-space-2);padding:var(--cx-space-3) 0}
.cx-skel-list .cx-skel:nth-child(2n){width:86%}
.cx-skel-list .cx-skel:nth-child(3n){width:72%}
/* a screen's own state box sits above its content */
.cx-view-state{margin:var(--cx-space-3) var(--cx-space-4) 0}
.cx-view-state:empty{display:none}
.cx-error-state .cx-error-msg{flex:1 1 14em}
.cx-error-state [data-cx-retry]{min-height:var(--cx-hit)}
/* Settings → Hardware: what the till knows, as text that wraps (review pass 2, F-13) */
.hw-val{display:block;min-height:var(--cx-hit);padding:var(--cx-space-2) 0;overflow-wrap:anywhere;color:var(--cx-text)}
/* date boxes wide enough for dd/mm/yyyy in either language (F-13) */
input[type="date"]{min-width:10.5em}
/* the Fix list's count never touches its word (F-13) */
.prod-lensbar .fix-total{margin-inline-start:var(--cx-space-2)}
/* a money box the money parser cannot read (ui.js, on leaving it) */
input[data-num][aria-invalid="true"]{border-color:var(--cx-danger)}
.cx-num-error{display:block;margin-block-start:var(--cx-space-1)}
