/* ============================================================================
   SPA-only additions.

   Everything visual comes from pos-shell.css + pos-design.css (the approved
   design). This file adds ONLY what a live app needs and a static mockup did
   not: loading states, error states, modals, and a few list screens the design
   did not draw. Nothing here overrides a design token.
   ============================================================================ */

/* The SPA mounts into #app, one level below #device. The design's
   `#device .app{height:100%}` needs an ancestor with a real height, so give
   the mount point one. */
#device > #app{height:100%}
/* Modal layer is an overlay, not part of the flow. */
#modal-layer{position:absolute;inset:0;pointer-events:none;z-index:80}
/* The layer ignores pointer events so it never blocks the app beneath it;
   the backdrop of an OPEN dialog has to opt back in, or every control
   inside the dialog is click-through and only Escape works. */
#modal-layer .mask-bg{pointer-events:auto}
#modal-layer .mask-bg{
  position:absolute;inset:0;z-index:80;display:flex;align-items:center;justify-content:center;padding:18px;
  background:rgba(30,12,14,.6);backdrop-filter:blur(3px);
}

/* Built to the same shape as the product editor (`.cu-modal`), so every dialog
   in the terminal reads as the same object: 2px border, the design's large
   radius, the pop shadow, and a header/footer that frame a scrolling body. */
.mdl{
  width:100%;max-width:520px;max-height:92%;display:flex;flex-direction:column;
  background:var(--surface);border:2px solid var(--line-strong);border-radius:var(--r-l);
  box-shadow:var(--pop);
  /* Clips header and footer to the corners; the footer used to carry its own
     radius to work around the lack of this. */
  overflow:hidden;
  animation:mdlin .22s cubic-bezier(.2,.9,.25,1) both;
}
.mdl-wide{max-width:820px}
@keyframes mdlin{from{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:none}}

/* Header and footer sit outside the scrolling body, so flex already pins
   them; they only need to refuse to shrink. */
.mdl-h{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:14px 16px;border-bottom:2px solid var(--line);
  flex:none;background:var(--surface);
}
.mdl-h b{font-size:18px;font-weight:800;letter-spacing:-.01em}
.mdl-h .sub{font-size:12.5px;font-weight:700;color:var(--ink-3);margin-top:2px}

.mdl-b{flex:1;padding:16px;overflow:auto;display:flex;flex-direction:column;gap:13px;min-height:0}

.mdl-f{
  display:flex;align-items:center;gap:10px;padding:12px 16px;
  border-top:2px solid var(--line);background:var(--surface);flex:none;
}
/* Cancel sits at the start, the primary action at the end — the same reading
   order the product editor uses. */
.mdl-f .grow{flex:1}

/* Matches `.x` in the product dialog. */
.x-btn{
  width:40px;height:40px;border-radius:6px;border:2px solid var(--line);
  display:grid;place-items:center;color:var(--ink-2);font-size:19px;font-weight:800;flex:none;
}
.x-btn:hover{border-color:var(--brand);color:var(--brand)}

/* ── Buttons and fields ────────────────────────────────────────
   The SPA's generic vocabulary — `.b`, `.fld`, `.inp`, `.sel` — was used at
   ~20 call sites and defined nowhere, so with `button{border:0;background:none}`
   in the reset every one of them rendered as bare text. (The `.pill.b` in
   pos-design.css is a pill modifier, not this.) Defined here in the product
   editor's language so the two read as one app: `.b` takes the shape of
   `.cu-ghost`, `.b-primary` of `.cu-btn`, `.inp` of `.cu-in`, `.fld .k` of
   `.cu-lbl`. */
.b{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  min-height:46px;padding:0 18px;border-radius:var(--r-m);
  border:2px solid var(--line-strong);background:var(--surface-2);
  font-size:14px;font-weight:800;color:var(--ink-2);text-align:center;
  transition:border-color .15s ease,background .15s ease,color .15s ease;
}
.b:hover:not(:disabled){border-color:var(--brand);color:var(--brand)}
.b:active:not(:disabled){transform:scale(.98)}
/* `:disabled`, not `[disabled]` — crud.js disables via the DOM property. */
.b:disabled{opacity:.45;cursor:not-allowed}

/* Filled, and the only filled button on a dialog — one primary action. */
.b-primary{background:var(--brand);border-color:var(--brand);color:#fff}
.b-primary:hover:not(:disabled){background:var(--brand-strong);border-color:var(--brand-strong);color:#fff}

.b-danger{background:var(--danger);border-color:var(--danger);color:#fff}
.b-danger:hover:not(:disabled){background:var(--danger);border-color:var(--danger);color:#fff;filter:brightness(.93)}

/* Row-level actions inside tables and toolbars. Still clears the 44px touch
   minimum a till needs. */
.b-sm{min-height:36px;padding:0 12px;font-size:12.5px;border-width:1.5px}
.b-block{display:flex;width:100%}

/* The primary action sits at the end of the footer, the way the product
   editor puts it — stated on the button, not on the container, so a footer
   with only a cancel in it still reads correctly. */
.mdl-f > .b-primary,
.mdl-f > .b-danger{margin-inline-start:auto}

/* A confirm asks a question; it should read as a sentence, not as a caption. */
.mdl-msg{font-size:14.5px;font-weight:700;line-height:1.55;color:var(--ink-2);margin:0}

.fld{display:flex;flex-direction:column;gap:7px}
/* `.cu-lbl`: a caption above the field, not a placeholder inside it. */
.fld .k{
  font-size:10.5px;font-weight:800;letter-spacing:.07em;text-transform:uppercase;
  color:var(--ink-3);
}
.fld .hint{font-size:11.5px;font-weight:600;color:var(--ink-3);line-height:1.4}

.inp,.sel,.ta{
  width:100%;height:46px;padding:0 13px;border:2px solid var(--line-strong);
  border-radius:var(--r-m);background:var(--surface-2);color:var(--ink);
  font:700 14.5px/1 var(--f-ui);outline:none;
}
textarea.inp{height:auto;min-height:74px;padding:11px 13px;resize:vertical;line-height:1.45}
.inp:focus,.sel:focus,.ta:focus{border-color:var(--brand);background:var(--surface)}
.inp.bad,.sel.bad{border-color:var(--danger);background:var(--danger-soft)}
.sel{cursor:pointer}

/* Secondary text, wherever a list or dialog needs a quieter second line. */
.sub{font-size:12.5px;font-weight:700;color:var(--ink-3)}
.bold{font-weight:800}

@media (prefers-reduced-motion: reduce){
  .b{transition:none}
  .b:active{transform:none}
}

/* ── List screens ──────────────────────────────────────────────
   The scaffold every CRUD screen mounts into — categories, customers,
   employees, branches, stock, sync. Same hole as the button vocabulary above:
   `.pagehead`, `.toolrow`, `.pagebody`, `.tbl`, `.pager`, `.loading`, `.blank`
   and the `.pill-*` tones were all used by ui.js and defined in no stylesheet
   the till loads, so these screens rendered as a bare UA table on the page
   background — shrink-to-fit, hard against the inline-start edge, no card, no
   header treatment. (pos-dashboard.css has `.pagehead`/`.tbl`, but the back
   office is a separate document and never lent them here.)

   Built to match the back office so the same table reads the same in both,
   with the till's larger touch targets. `.screen` is already a flex column
   with its own padding, so these only decide who scrolls. */
.pagehead{display:flex;align-items:flex-end;gap:14px;flex-wrap:wrap;flex:none}
.pagehead h2{font-size:23px;font-weight:800;letter-spacing:-.02em;margin:0}
.pagehead .sub{margin-top:3px}
/* Actions sit at the far end of the row, mirrored in Arabic. */
.pagehead .acts{margin-inline-start:auto;display:flex;gap:8px;flex-wrap:wrap}

.toolrow{display:flex;align-items:center;gap:10px;flex-wrap:wrap;flex:none}
/* The search box asks for a min-width inline; let it take the row it is on
   without stretching to the full width of a 1024px canvas. */
.toolrow .inp{flex:0 1 320px}

/* The card, and the only thing on these screens that scrolls. */
.pagebody{
  flex:1;min-height:0;overflow:auto;
  background:var(--surface);border-radius:var(--r-m);box-shadow:var(--shadow);
}

table.tbl{width:100%;border-collapse:collapse;font-size:13.5px}
table.tbl th{
  /* Sticky against `.pagebody`, so the header survives a long list. */
  position:sticky;inset-block-start:0;z-index:2;background:var(--surface);
  text-align:start;white-space:nowrap;
  font-size:10.5px;font-weight:800;letter-spacing:.07em;text-transform:uppercase;
  color:var(--ink-3);padding:12px 14px;border-bottom:2px solid var(--line);
}
table.tbl td{
  padding:11px 14px;border-bottom:1.5px solid var(--line);
  font-weight:700;vertical-align:middle;color:var(--ink);
}
table.tbl tbody tr:last-child td{border-bottom:0}
/* The identifying first column absorbs the slack. Without this every column
   takes an equal slice of the 1024px canvas, so a short pill or count sits
   alone in a very wide cell and the row reads as ragged. No nowrap — the
   wider screens carry addresses and emails that must still wrap. */
table.tbl th:first-child,table.tbl td:first-child{width:38%}
/* Scoped to the table: `.r` is a different thing in pos-design.css. */
table.tbl th.r,table.tbl td.r{text-align:end}
table.tbl tbody tr:hover{background:var(--surface-2)}
.tbl-click tbody tr{cursor:pointer}

/* `.nm` is the till's tile class and is styled only inside `.cat`/`.tile`;
   in a table it marks the identifying column, so give it that job here. */
table.tbl .nm{font-weight:800;color:var(--ink)}
table.tbl .sub{font-weight:700}

/* Row actions stay on one line and hug the end of their cell. */
.btn-group{display:flex;gap:6px;justify-content:flex-end;flex-wrap:nowrap}

.pager{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:10px 14px;border-top:2px solid var(--line);
  font-size:12.5px;font-weight:800;color:var(--ink-3);
}
.pager-btns{display:flex;gap:6px}

.loading{
  display:flex;align-items:center;justify-content:center;gap:10px;
  padding:44px 20px;color:var(--ink-3);font-size:13.5px;font-weight:700;
}
.sp{
  width:17px;height:17px;flex:none;border-radius:50%;
  border:2.5px solid var(--line-strong);border-top-color:var(--brand);
  animation:spin .7s linear infinite;
}
@keyframes spin{to{transform:rotate(360deg)}}

.blank{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:6px;padding:44px 20px;text-align:center;
}
.blank b{font-size:15px;font-weight:800;color:var(--ink-2)}
.blank span{font-size:13px;font-weight:700;color:var(--ink-3);max-width:44ch;line-height:1.5}

/* `.pill` itself comes from the design; these are only its tones. The border
   is `currentColor` there, so setting the colour tints the whole chip. */
.pill-ok{color:var(--ok);background:var(--ok-soft)}
.pill-warn{color:var(--warn);background:var(--warn-soft)}
.pill-bad{color:var(--danger);background:var(--danger-soft)}
.pill-info{color:var(--info);background:var(--info-soft)}

@media (prefers-reduced-motion: reduce){
  .sp{animation-duration:2s}
}

/* ── Unified dialog chrome ─────────────────────────────────────
   Five dialog families grew up separately: product/customer (`.cu-*`, the
   reference), discounts (`.dc-*`), edit-line (`.nt-*`), refund (`.rt-*`) and
   the SPA's generic `.mdl`. Every one emits the same DOM —

     .X-modal > .X-head > (div > b + .sub) + button.x  …  .X-foot

   — but the panels had drifted into three border widths (2px/3px), four title
   sizes (18/19/20px), two backdrop tints, and two different answers to "what
   scrolls": `.cu-modal` and `.nt-modal` scroll their body, while `.dc-modal`
   and `.rt-modal` scrolled the whole panel, so their headers and footers slid
   away on a long list.

   This settles all of them on `.cu-modal`'s geometry. It is CSS only — the
   shared DOM means no component changes. The refund flow keeps its red border,
   tinted header and darker backdrop: that colour is a deliberate signal that
   money is going back out, not drift. */

/* Panel: one border width, one radius, and a column that clips so the header
   and footer frame a scrolling middle. */
.dc-modal,.nt-modal,.rt-modal{
  display:flex;flex-direction:column;overflow:hidden;
  max-height:100%;border-width:2px;
  animation:pop .22s cubic-bezier(.2,.9,.25,1) both;
}

/* Backdrop: one tint and one inset. `.rt-mask` keeps its red wash. */
.dc-mask,.nt-mask{background:rgba(30,12,14,.6)}
.dc-mask,.nt-mask,.rt-mask,.cu-mask{padding:18px}

/* Header: `.cu-head`'s padding and type scale. */
.dc-head,.nt-head,.rt-head{flex:none;align-items:center;gap:12px;padding:14px 16px}
.dc-head b,.nt-head b,.rt-head b{font-size:18px}
.dc-head .tgt,.nt-head .sub,.rt-head .sub{font-size:12.5px;margin-top:2px}
.rt-head{border-bottom-width:2px}

/* The middle is the only scroller; the strips above it are chrome. Padding
   matches `.cu-form`'s 16px, so a field sits the same distance from the edge
   in every dialog. `.dc-pane` keeps its border-top — that is the seam the tab
   strip above it butts into, not chrome. */
.dc-tabs,.rt-steps{flex:none}
.dc-pane,.nt-body,.rt-body{flex:1;min-height:0;overflow:auto;padding:16px}

/* Footer: pinned, divided from the body, and opaque so content cannot show
   through as it scrolls under. `.dc-foot` and `.nt-foot` had no divider at all
   and padded only the bottom, which read as buttons loose on the panel. */
.dc-foot,.nt-foot,.rt-foot{
  flex:none;padding:12px 16px;
  border-top:2px solid var(--line);background:var(--surface);
}
.rt-foot{border-top-color:var(--ret)}

@media (prefers-reduced-motion: reduce){
  .dc-modal,.nt-modal,.rt-modal{animation:none}
}

/* ---- boot ---- */
.boot{
  height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:14px;background:var(--bg);color:var(--ink-3);
}
.boot .sp{width:30px;height:30px;border-width:3px}

/* ---- inline message boxes ---- */
.err-box{
  padding:11px 14px;border-radius:var(--r-m);font-size:13px;
  background:var(--danger-soft);color:var(--danger);font-weight:600;
}
.warn-box{padding:11px 14px;border-radius:var(--r-m);font-size:13px;background:var(--warn-soft);color:var(--warn);font-weight:600}
.info-box{padding:11px 14px;border-radius:var(--r-m);font-size:13px;background:var(--info-soft);color:var(--info);font-weight:600}

/* Outer wrapper for the list screens that use pageShell(). */
.pagewrap{flex:1;min-height:0;display:flex;flex-direction:column;gap:10px;overflow:hidden}

/* ---- extra form controls ---- */
.ta{min-height:76px;resize:vertical;height:auto;padding:11px 13px;line-height:1.45}
.grid2{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:12px}
.chk{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:700;color:var(--ink-2);cursor:pointer}
.chk input{width:16px;height:16px;accent-color:var(--brand)}

/* ── Open-shift card ───────────────────────────────────────────
   The shifts screen was built out of three borrowed classes: `.pagebody` for
   the card (that is the screen's single scroll region — using it three times
   left the card growing and scrolling against the list below it), `.pagehead`
   for the card's title row (a page-level header, and its action never reached
   the end because the button was a direct child rather than inside `.acts`),
   and `.mdl-b` — a modal body — for the card's padding. `.card__body`,
   `.col` and `.muted` were styled nowhere at all.

   Header geometry matches the dialogs, so a card and a dialog read as the
   same object at rest. */
.shift-slot{flex:none}

.shift-card{
  flex:none;background:var(--surface);border-radius:var(--r-m);
  box-shadow:var(--shadow);overflow:hidden;
}
.shift-head{display:flex;align-items:center;gap:12px;padding:14px 16px;border-bottom:2px solid var(--line)}
.shift-head b{display:block;font-size:18px;font-weight:800;letter-spacing:-.01em}
.shift-head .sub{margin-top:2px}
/* The action sits at the end of the row, mirrored in Arabic. */
.shift-head .b{margin-inline-start:auto}

.shift-body{padding:16px}

/* Tiles inside an already-white card: tint them instead of stacking another
   surface and shadow on top of this one. */
.shift-card .stat{background:var(--surface-2);box-shadow:none}
.shift-card .stat .v{font-size:19px}

.shift-empty{display:flex;flex-direction:column;align-items:flex-start;gap:9px;padding:20px 16px}
.shift-empty b{font-size:16px;font-weight:800}
.shift-empty p{margin:0;font-size:13.5px;font-weight:600;color:var(--ink-3);line-height:1.5;max-width:52ch}

/* ---- stat tiles ---- */
.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px;flex:none}
.stat{padding:14px;background:var(--surface);border-radius:var(--r-m);box-shadow:var(--shadow)}
.stat .k{font-size:10.5px;font-weight:800;text-transform:uppercase;letter-spacing:.05em;color:var(--ink-3)}
.stat .v{margin-top:6px;font-size:23px;font-weight:800;font-variant-numeric:tabular-nums}
.stat .m{margin-top:2px;font-size:11.5px;color:var(--ink-3);font-weight:600}

/* ── Product thumbnails ────────────────────────────────────────
   `.ph` is drawn by pos-design.css as a colour panel with a gradient over it
   (`::after`, z-index 2) sitting above the photo (`.ph-img`, z-index 1). That
   overlay is there to light a flat colour swatch — over real photography it
   is a haze that mutes the product and darkens its bottom third.

   So once a photo has actually loaded, the wash underneath is irrelevant and
   the overlay is cut back to a much lighter version: enough to keep the name
   legible where it overlaps, not enough to grey out the food. */
.cat .ph.has-img::after,
.tile .ph.has-img::after{
  background:linear-gradient(180deg,transparent 62%,rgba(0,0,0,.10));
}
:root[data-theme="dark"] .cat .ph.has-img::after,
:root[data-theme="dark"] .tile .ph.has-img::after{
  background:linear-gradient(180deg,transparent 55%,rgba(0,0,0,.30));
}

/* The initials are the fallback; once the photo is up they would show through
   a transparent PNG. */
.ph.has-img > span:not(.ph-img){opacity:0;transition:opacity .2s}

/* Sharper downscaling of a large source into a small tile. */
.ph-img{image-rendering:auto}

/* ── Till selling grid ─────────────────────────────────────────
   `.tile` is a fixed 120px box with `.ph{flex:1}`, so the image band gets
   whatever the name and price leave it — 56px on a 122px-wide tile, a 2.2:1
   letterbox. Worse, it is not even consistent: a product whose name fits one
   line leaves a taller image than one that wraps to two, so the row of photos
   steps up and down. The catalogue grid already reserves its media by ratio;
   the selling grid should read the same way.

   Scoped with :not(.grid-manage) because the catalogue grid carries both
   classes and has its own sizing. */
.grid:not(.grid-manage) .tile{height:auto}

.grid:not(.grid-manage) .tile .ph{
  flex:none;width:100%;height:auto;aspect-ratio:4/3;font-size:32px;
}

/* Exactly two lines, always — the ragged edge came from letting this vary.
   A long name is clipped rather than allowed to push the price out of line,
   and `title` on the tile still carries the full text. */
.grid:not(.grid-manage) .tile .nm{
  display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;
  overflow:hidden;min-height:2.4em;
}

/* ---- receipt (printed) ---- */
.rcpt{width:290px;margin:0 auto;padding:14px;font-family:var(--f-mono);font-size:12px;line-height:1.55;color:#000;background:#fff}
.rcpt .c{text-align:center}
/* The store's uploaded logo, capped like the printed copy (printReceipt):
   without it the image shows at whatever size it was uploaded. */
.rcpt .logo{display:block;width:auto;height:auto;max-width:60%;max-height:70px;margin:0 auto 6px;object-fit:contain}
.rcpt hr{border:0;border-top:1px dashed #999;margin:8px 0}
.rcpt .r{display:flex;justify-content:space-between;gap:10px}
.rcpt .tot{font-size:14px;font-weight:700}

/* ---- keypad reused outside login (payment) ---- */
.kp{display:grid;grid-template-columns:repeat(3,1fr);gap:7px}
.kp button{
  height:46px;border-radius:var(--r-m);border:1.5px solid var(--line-strong);
  background:var(--surface);font-family:var(--f-mono);font-size:17px;font-weight:700;color:var(--ink);
}
.kp button:hover{border-color:var(--brand);color:var(--brand)}
.kp button:active{transform:scale(.97)}


/* ---- login hero: links sit on the brand-red panel ---- */
.scr-login .hero .hm-txt .link{color:#fff;text-decoration:underline;font-weight:700}
.scr-login .hero .hm-txt .link:hover{opacity:.85}
.scr-login .hero .hm-row .fld .k{color:rgba(255,255,255,.75)}
.scr-login .hero .hm-row .fld .inp{background:rgba(255,255,255,.96);border-color:transparent;color:var(--ink)}

/* ── Form controls inherit the brand face ────────────────────────
   Browsers give input/select/textarea their own system font rather than
   inheriting one, which left fields rendering in the platform default
   beside Plus Jakarta Sans — most visibly in Arabic, where the fallback
   has no Almarai. Bare element selectors, so any component rule that
   deliberately sets a face (the mono amount fields, for one) still wins. */
input, select, textarea, optgroup, option {
  font-family: inherit;
}

/* Placeholders inherit the field, not the UA stylesheet. */
input::placeholder, textarea::placeholder {
  font-family: inherit;
}

/* ── Catalogue product card ────────────────────────────────────
   The selling tile shows a name and a price, because that is all a cashier
   needs mid-sale. Managing the catalogue needs stock, variants and whether
   the row is live — but adding four more lines to a 120px tile produces a
   list of facts with no hierarchy, which is what the first attempt did.

   So the card is in two parts, divided by a hairline: identity above (photo,
   name, price) and state below (stock, variants). The eye reads what the
   product is, then what is true about it, instead of scanning five lines of
   equal weight.

   Flat and touch-first: no elevation beyond the design's own card shadow, and
   press feedback that fires immediately rather than a hover the till will
   never see. */

 /* Six to a row, fixed. The till runs on a pinned 1024x768 canvas, so a
    column count is predictable here in a way auto-fill is not — and a stable
    grid is easier to scan than one that reflows by a pixel of scrollbar. */
.grid-manage { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }

@media (max-width: 820px) { .grid-manage { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.grid-manage .tile {
  height: auto;
  position: relative;
  text-align: start;
  /* Aligns the child boxes by the card's own direction. The price carries
     `.num`, which sets direction:ltr so digits render correctly — and that
     made `text-align:start` inside it resolve to *left* while the Arabic name
     above resolved to *right*. */
  align-items: stretch;
  transition: border-color .15s ease, transform .12s ease;
  border: 2px solid transparent;
  cursor: pointer;
}

.grid-manage .tile:hover { border-color: var(--line-strong); }
.grid-manage .tile:focus-visible { border-color: var(--brand); }

/* Immediate, and no layout shift: transform only. */
.grid-manage .tile:active { transform: scale(.97); }

/* ── media ── */
.grid-manage .tile .ph {
  /* Reserved by ratio rather than a fixed height, so a card is the same size
     before and after its photo loads. */
  aspect-ratio: 4 / 3;
  height: auto;
  flex: none;
  border-radius: 0;
}

/* ── identity ── */
.grid-manage .tile .nm {
  padding: 10px 10px 0;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--ink);
  /* Two lines, then ellipsis. A long name must not change the card's height
     or push the price out of alignment with its neighbours. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}

.grid-manage .tile .pr {
  padding: 2px 10px 10px;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  /* Deliberately physical right, not logical start/end: the price reads as a
     figure in a column and is wanted on the right in both directions. In RTL
     that lines it up with the name; in LTR it sits opposite, the way a price
     tag does. */
  align-self: stretch;
  text-align: right;
}

/* A range is two prices and a dash; it must not wrap mid-figure. */
.grid-manage .tile .pr.range { font-size: 11.5px; white-space: nowrap; }

/* ── state ── */
.grid-manage .tile .card-foot {
  margin-top: auto;
  padding: 8px 10px;
  border-top: 2px solid var(--line);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-2);
  /* One line, always. At six to a row there is not enough width for the stock
     phrase to wrap without breaking mid-sentence, and a footer that changes
     height makes the row look ragged. */
  white-space: nowrap;
  overflow: hidden;
}

.grid-manage .tile .card-foot .stock {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Colour is never the only signal: the dot sits beside its own wording. */
.grid-manage .tile .card-foot .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: var(--ok);
}

.grid-manage .tile .card-foot .dot.warn { background: var(--warn); }
.grid-manage .tile .card-foot .dot.bad { background: var(--danger); }
.grid-manage .tile .card-foot .dot.mute { background: var(--line-strong); }

.grid-manage .tile .card-foot .vars {
  margin-inline-start: auto;
  color: var(--ink-3);
  white-space: nowrap;
  flex: none;
  padding-inline-start: 6px;
}

/* ── exceptions ── */
/* Only for what is wrong with a row — switched off, or not yet accepted
   upstream. Everyday stock lives in the footer, so this stays rare enough to
   still mean something. */
.grid-manage .tile .tag {
  position: absolute;
  inset-block-start: 8px;
  inset-inline-start: 8px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .02em;
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: var(--shadow);
}

.grid-manage .tile .tag.bad { background: var(--danger); color: #fff; }
.grid-manage .tile .tag.info { background: var(--info); color: #fff; }

.grid-manage .tile.out { opacity: 1; }
.grid-manage .tile.out .ph,
.grid-manage .tile.out .nm,
.grid-manage .tile.out .pr { opacity: .45; }

@media (prefers-reduced-motion: reduce) {
  .grid-manage .tile { transition: none; }
  .grid-manage .tile:active { transform: none; }
}

/* The filter strip reuses the floor plan's section chips, so browsing a
   catalogue and browsing a room read the same way. */
.filter-bar {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding-bottom: 12px;
  flex: none;
}

/* ── Checkout layout ───────────────────────────────────────────
   Store setting `checkout_layout: work_first` puts the order panel after the
   products. The payment sheet covers the work area and leaves the order
   visible, so its offset moves to the other side with it. */
.screen.pos.on.swap{flex-direction:row-reverse}
.pos.swap .mask{inset-inline-start:0;inset-inline-end:354px}


/* ══ Customers screen (`.cx`) ══════════════════════════════════
   List beside profile; the address book as cards. Motion here is a soft
   spring — scale overshoots a little and settles — and is scoped to `.cx`
   and the `.cx-sheet` dialog, so no other screen changes how it moves. */
.cx{flex:1;min-height:0;display:flex;flex-direction:column;gap:12px}
.cx{--jelly:cubic-bezier(.34,1.56,.64,1)}

@keyframes cx-rise{
  0%{opacity:0;transform:translateY(10px) scale(.96)}
  55%{opacity:1;transform:translateY(-1px) scale(1.015,.985)}
  78%{transform:scale(.995,1.005)}
  100%{opacity:1;transform:none}
}
@keyframes cx-wobble{
  0%{transform:scale(1)}
  30%{transform:scale(1.035,.965)}
  50%{transform:scale(.975,1.025)}
  70%{transform:scale(1.01,.99)}
  100%{transform:scale(1)}
}
@keyframes cx-shimmer{0%{opacity:.55}50%{opacity:1}100%{opacity:.55}}

/* ── head ── */
.cx-head{display:flex;align-items:center;gap:14px;flex:none}
.cx-head h2{font-size:23px;font-weight:800;letter-spacing:-.02em;margin:0}
.cx-head .sub{margin-top:2px}
.cx-search-wrap{position:relative;margin-inline-start:auto;width:320px}
.cx-search-wrap i{position:absolute;inset-inline-start:13px;top:50%;transform:translateY(-50%);width:18px;height:18px;color:var(--ink-3);pointer-events:none}
.cx-search-wrap svg{width:100%;height:100%;display:block}
.cx .cx-search{padding-inline-start:40px;background:var(--surface)}
.cx-new{flex:none;transition:transform .35s var(--jelly)}
.cx-new:active{transform:scale(.94)}

/* ── body ── */
.cx-body{flex:1;min-height:0;display:grid;grid-template-columns:350px 1fr;gap:12px}
.cx-list,.cx-detail{min-height:0;overflow:auto;border-radius:var(--r-l);background:var(--surface);box-shadow:var(--shadow)}
.cx-list{padding:8px;display:flex;flex-direction:column;gap:4px}
.cx-detail{padding:16px}

/* ── list rows ── */
/* `flex:none`: the list is a scrolling flex column, and flex items shrink by
   default — once the list overflowed, every row was squeezed below the height
   of its own content. */
.cx-row{
  flex:none;min-height:max-content;
  width:100%;display:grid;grid-template-columns:auto 1fr auto;gap:11px;align-items:center;
  padding:10px;border-radius:var(--r-m);border:2px solid transparent;text-align:start;
  transition:background .18s ease,border-color .18s ease,transform .4s var(--jelly);
}
.cx-row:hover{background:var(--surface-2)}
.cx-row:active{transform:scale(.97)}
.cx-row.sel{background:var(--brand-soft);border-color:var(--brand)}
.cx-row.spring{animation:cx-wobble .5s ease both}
.cx-list.enter .cx-row{animation:cx-rise .55s var(--jelly) both;animation-delay:calc(var(--i,0) * 32ms)}
.cx-av{
  width:42px;height:42px;border-radius:999px;display:grid;place-items:center;flex:none;
  background:var(--surface-2);color:var(--ink-2);font-size:14px;font-weight:800;letter-spacing:.02em;
}
.cx-av.tier-silver{background:var(--surface-2);color:var(--ink-2);box-shadow:inset 0 0 0 1.5px var(--line-strong)}
.cx-av.tier-gold{background:var(--warn-soft);color:var(--warn)}
.cx-av.tier-vip{background:var(--brand);color:#fff}
.cx-row.sel .cx-av.tier-regular{background:var(--brand);color:#fff}
.cx-av.xl{width:64px;height:64px;font-size:21px}
.cx-row-main{min-width:0;display:flex;flex-direction:column;gap:2px}
.cx-row-top{display:flex;align-items:center;gap:6px;min-width:0}
.cx-row-top b{font-size:14.5px;font-weight:800;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cx-row-sub{font-size:12.5px;font-weight:700;color:var(--ink-3)}
.cx-row-addr{display:flex;align-items:center;gap:4px;font-size:11.5px;font-weight:600;color:var(--ink-3);min-width:0}
.cx-row-addr i{width:12px;height:12px;flex:none}
.cx-row-addr svg{width:100%;height:100%;display:block}
.cx-row-addr span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cx-row-meta{display:flex;flex-direction:column;align-items:flex-end;line-height:1.15}
.cx-row-meta b{font-size:16px;font-weight:800;color:var(--ink)}
.cx-row-meta span{font-size:10.5px;font-weight:700;color:var(--ink-3)}
.cx-row-meta em{font-style:normal;font-size:10px;font-weight:800;color:var(--brand);margin-top:3px}
.cx-tier{
  flex:none;font-size:9.5px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;
  padding:2px 7px;border-radius:999px;background:var(--surface-2);color:var(--ink-3);
}
.cx-tier.silver{background:var(--surface-2);color:var(--ink-2);box-shadow:inset 0 0 0 1.5px var(--line-strong)}
.cx-tier.gold{background:var(--warn-soft);color:var(--warn)}
.cx-tier.vip{background:var(--brand);color:#fff}
.cx-more{flex:none;margin:6px auto 4px}

.cx-row.skel{pointer-events:none;animation:cx-shimmer 1.2s ease-in-out infinite;animation-delay:calc(var(--i,0) * 90ms)}
.cx-row.skel .cx-av{background:var(--line)}
.cx-skel-lines{display:grid;gap:7px}
.cx-skel-lines i{display:block;height:10px;border-radius:6px;background:var(--line);width:70%}
.cx-skel-lines i+i{width:45%}

.cx-empty{
  height:100%;min-height:220px;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:8px;padding:24px;text-align:center;color:var(--ink-3);
}
.cx-empty b{font-size:15px;color:var(--ink-2)}
.cx-empty span{font-size:13px;font-weight:600;max-width:280px}
.cx-empty-ic{width:54px;height:54px;border-radius:999px;background:var(--surface-2);display:grid;place-items:center;margin-bottom:4px}
.cx-empty-ic svg{width:26px;height:26px}

/* ── profile ── */
.cx-card{display:flex;flex-direction:column;gap:16px}
.cx-card.cx-in{animation:cx-rise .5s var(--jelly) both}
.cx-profile{display:flex;align-items:center;gap:14px}
.cx-id{min-width:0;flex:1}
.cx-name{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.cx-name b{font-size:21px;font-weight:800;letter-spacing:-.015em;color:var(--ink)}
.cx-contact{display:flex;flex-wrap:wrap;gap:4px 16px;margin-top:5px;font-size:13px;font-weight:700;color:var(--ink-2)}
.cx-contact>span{display:inline-flex;align-items:center;gap:6px}
.cx-contact i{width:14px;height:14px;color:var(--ink-3)}
.cx-contact svg{width:100%;height:100%;display:block}
.cx-acts{display:flex;gap:8px;align-self:flex-start}
.cx-icon{
  width:40px;height:40px;border-radius:var(--r-m);border:2px solid var(--line-strong);
  display:grid;place-items:center;color:var(--ink-2);background:var(--surface);
  transition:border-color .15s ease,color .15s ease,transform .4s var(--jelly);
}
.cx-icon svg{width:18px;height:18px}
.cx-icon:hover{border-color:var(--brand);color:var(--brand)}
.cx-icon.danger:hover{border-color:var(--danger);color:var(--danger)}
.cx-icon:active{transform:scale(.88)}
.cx-icon.sm{width:34px;height:34px;border-width:1.5px}
.cx-icon.sm svg{width:15px;height:15px}

.cx-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.cx-stat{background:var(--surface-2);border-radius:var(--r-m);padding:10px 12px;display:flex;flex-direction:column;gap:3px;min-width:0}
.cx-stat span{font-size:10px;font-weight:800;letter-spacing:.07em;text-transform:uppercase;color:var(--ink-3)}
.cx-stat b{font-size:16px;font-weight:800;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.cx-notes{
  display:flex;gap:9px;align-items:flex-start;padding:10px 12px;border-radius:var(--r-m);
  background:var(--warn-soft);color:var(--warn);font-size:13px;font-weight:700;line-height:1.45;
}
.cx-notes i{width:16px;height:16px;flex:none;margin-top:1px}
.cx-notes svg{width:100%;height:100%;display:block}

/* ── address book ── */
.cx-sec{display:flex;flex-direction:column;gap:10px}
.cx-sec-head{display:flex;align-items:center;gap:8px}
.cx-sec-head b{font-size:15px;font-weight:800;color:var(--ink)}
.cx-count{min-width:22px;height:22px;padding:0 6px;border-radius:999px;background:var(--surface-2);display:grid;place-items:center;font-size:11.5px;font-weight:800;color:var(--ink-3)}
.cx-add{margin-inline-start:auto;transition:transform .4s var(--jelly)}
.cx-add:active{transform:scale(.94)}

.cx-addrs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.cx-addrs.enter .cx-addr{animation:cx-rise .5s var(--jelly) both;animation-delay:calc(80ms + var(--i,0) * 45ms)}
.cx-addr{
  display:flex;flex-direction:column;gap:8px;padding:12px 13px 10px;
  border:2px solid var(--line);border-radius:var(--r-l);background:var(--surface);
  transition:border-color .2s ease,box-shadow .2s ease,transform .45s var(--jelly);
}
.cx-addr:hover{border-color:var(--line-strong);transform:translateY(-2px);box-shadow:0 10px 22px -16px rgba(0,0,0,.35)}
.cx-addr.is-default{border-color:var(--brand);background:linear-gradient(180deg,var(--brand-soft),var(--surface) 70%)}
.cx-addr.pop{animation:cx-wobble .6s ease both}
.cx-addr-head{display:flex;align-items:center;gap:8px}
.cx-addr-head b{font-size:14px;font-weight:800;color:var(--ink)}
.cx-addr-ic{width:30px;height:30px;border-radius:9px;display:grid;place-items:center;flex:none;background:var(--surface-2);color:var(--ink-2)}
.cx-addr-ic svg{width:16px;height:16px}
.cx-addr-ic.home{background:var(--info-soft);color:var(--info)}
.cx-addr-ic.work{background:var(--warn-soft);color:var(--warn)}
.cx-addr.is-default .cx-addr-ic{background:var(--brand);color:#fff}
.cx-default{
  margin-inline-start:auto;font-size:9.5px;font-weight:800;letter-spacing:.07em;text-transform:uppercase;
  padding:3px 8px;border-radius:999px;background:var(--brand);color:#fff;
}
.cx-addr.pop .cx-default{animation:cx-wobble .6s .12s ease both}
.cx-addr-body{flex:1;display:flex;flex-direction:column;gap:3px;min-width:0}
.cx-addr-line{font-size:13.5px;font-weight:700;color:var(--ink);line-height:1.4}
.cx-addr-meta{font-size:12px;font-weight:700;color:var(--ink-3)}
.cx-addr-note{font-size:12px;font-weight:600;color:var(--ink-3);font-style:italic}
.cx-addr-foot{display:flex;align-items:center;gap:6px;padding-top:8px;border-top:1.5px dashed var(--line)}
.cx-addr-foot .grow{flex:1}
.cx-addr-hint{font-size:11.5px;font-weight:700;color:var(--brand)}
.cx-link{font-size:12.5px;font-weight:800;color:var(--ink-2);padding:6px 8px;margin-inline-start:-8px;border-radius:var(--r-s);transition:transform .4s var(--jelly)}
.cx-link:hover{color:var(--brand);background:var(--brand-soft)}
.cx-link:active{transform:scale(.93)}

.cx-addr-empty{
  display:flex;flex-direction:column;align-items:center;gap:5px;padding:22px;
  border:2px dashed var(--line-strong);border-radius:var(--r-l);color:var(--ink-3);
  transition:border-color .2s ease,transform .45s var(--jelly);
}
.cx-addr-empty i{width:26px;height:26px}
.cx-addr-empty svg{width:100%;height:100%;display:block}
.cx-addr-empty b{font-size:14px;color:var(--ink-2)}
.cx-addr-empty span{font-size:12.5px;font-weight:700;color:var(--brand)}
.cx-addr-empty:hover:not(:disabled){border-color:var(--brand)}
.cx-addr-empty:active:not(:disabled){transform:scale(.97)}

/* ── dialogs opened from this screen ── */
.cx-sheet .cu-modal{animation:cx-rise .45s cubic-bezier(.34,1.56,.64,1) both}
.cx-form{display:grid;grid-template-columns:1fr 1fr;gap:13px}
.cx-sheet .cu-form{min-height:0}
.cx-sheet .cu-tiers button{transition:transform .35s cubic-bezier(.34,1.56,.64,1),background .15s ease}
.cx-sheet .cu-tiers button:active{transform:scale(.92)}

@media (prefers-reduced-motion:reduce){
  .cx *,.cx-sheet *{animation:none!important;transition:none!important}
}
