/*
 * NID-313 (POS de-React, Phase 0): the Hotwire POS shell stylesheet.
 *
 * The parity baseline for the conversion — the approved "Mobile POS" design's
 * CSS, lifted out of the vendored React frame (app/views/pos/frame.html.erb)
 * into a Propshaft-served stylesheet. Plus Jakarta Sans is now served locally
 * from the asset pipeline (app/assets/fonts) instead of Google Fonts, and the
 * per-element inline styles the design-tool export used are re-expressed as
 * semantic classes the ERB screens hang off. Only the "minimal" (approved
 * green) variant is carried; the alternate "till" theme is out of scope.
 */

/* ---- Plus Jakarta Sans (local, asset-pipeline) --------------------------
 * Variable woff2 per Unicode subset, covering the 400–800 weight axis the
 * design uses. Propshaft rewrites these url()s to digested asset paths.
 * hi/ta glyphs fall back to system-ui, exactly as the design already did. */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/assets/plus-jakarta-sans-latin-817f351b.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/assets/plus-jakarta-sans-latin-ext-977b89d0.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/assets/plus-jakarta-sans-vietnamese-34b146de.woff2") format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/assets/plus-jakarta-sans-cyrillic-ext-aced9980.woff2") format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* ---- Theme tokens (Flowbite palette — NID-504) --------------------------
 * The POS shell has its own Propshaft-served design system (it loads no app
 * Tailwind), so the Flowbite tokens are reconciled HERE directly rather than
 * referenced from app/assets/tailwind/application.css. Values mirror that
 * file's light `:root` block 1:1 — primary = Flowbite blue, neutrals = the
 * reconciled gray scale — so POS now reads identically to the rest of the app
 * (was the standalone "minimal" green variant lifted from the old React frame).
 * Warn = Flowbite red for the destructive / low-stock surfaces. Scoped to
 * .pos-shell so nothing leaks into app chrome. */
.pos-shell {
  --bg:         #f9fafb;   /* surface-page — gray-50, the phone canvas bg */
  --surface:    #ffffff;   /* surface-raised — cards / rows / sheets */
  --surfacealt: #f3f4f6;   /* surface-inset — gray-100, subtle fills */
  --text:       #111827;   /* text-strong — gray-900 */
  --sub:        #4b5563;   /* text-muted — gray-600 */
  --line:       #e5e7eb;   /* border-subtle — gray-200 */
  --acc:        #1a56db;   /* primary-700 — accent ink (text / icons / borders) */
  --accfill:    #1a56db;   /* primary-700 — accent button + badge fill */
  --accsoft:    #e1effe;   /* primary-100 — accent tint */
  --acctext:    #ffffff;   /* text/icon on accent fills */
  --hbg:        #ffffff;   /* screen header bg — surface */
  --htext:      #111827;   /* screen header text */
  --htotalbg:   #f3f4f6;   /* back / gear icon-button bg — surface-inset */
  --warn:       #e02424;   /* red-600 — destructive ink (text / icons / borders) */
  --warnfill:   #e02424;   /* red-600 — destructive button + badge fill */
  --warntext:   #ffffff;   /* text/icon on warn fills */
  --warnsoft:   #fde8e8;   /* badge-danger-bg — warn tint */
  --warnline:   #f8b4b4;   /* red-300 — warn tint border */
  --ok:         #046c4e;   /* green-700 — confirmed / resolved ink (NID-1214) */
  --r: 16px;
  --font: 'Plus Jakarta Sans', system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', monospace;
}

/* Dark theme. The app applies `.dark` on <html> (see the pre-paint script in
 * layouts/pos_shell.html.erb); this overrides the token VALUES only, so every
 * bespoke POS rule themes by construction — no per-rule `.dark` variants.
 * Values mirror the app CSS `.dark` block. Accent INK goes lighter in dark
 * (primary-400) so it reads on the dark surfaces and tints; the accent FILL
 * stays a saturated blue (primary-600) so its label can remain white. NID-1135:
 * these used to be one token, which turned every big blue button's label black
 * in dark mode. Warn is split the same way, for the same reason. */
.dark .pos-shell {
  --bg:         #000000;   /* surface-page — true black (NID-522) */
  --surface:    #171717;   /* surface-raised — neutral-900 */
  --surfacealt: #262626;   /* surface-inset — neutral-800 */
  --text:       #fafafa;   /* text-strong — neutral-50 */
  --sub:        #a3a3a3;   /* text-muted — neutral-400 */
  --line:       #262626;   /* border-subtle — neutral-800 */
  --acc:        #76a9fa;   /* primary-400 — accent ink on dark surfaces / tints */
  --accfill:    #1c64f2;   /* primary-600 — fill that carries white text (5.1:1) */
  --accsoft:    #1a2c5e;   /* primary-950 — accent tint */
  --acctext:    #ffffff;   /* text/icon on accent fills — white in both themes */
  --hbg:        #171717;   /* header bg — surface */
  --htext:      #fafafa;
  --htotalbg:   #262626;   /* back / gear icon-button bg */
  --warn:       #f98080;   /* red-300 — destructive ink on dark surfaces / tints */
  --warnfill:   #e02424;   /* red-600 — fill that carries white text (4.7:1) */
  --warntext:   #ffffff;   /* text/icon on warn fills — white in both themes */
  --warnsoft:   #4a1515;   /* dark red tint */
  --warnline:   #7f1d1d;   /* warn tint border */
  --ok:         #84e1bc;   /* green-300 — confirmed ink on dark surfaces */
}

/* The toast is an inverted chip (dark bg / light text — see .pos-toast, its bg
 * is var(--text)). In dark mode --text is near-white, so re-invert it here to
 * keep the toast legible. */
.dark .pos-shell .pos-toast { background: #fafafa; color: #171717; }

/* ---- Shell frame (the centred phone canvas) ----------------------------- */
html, body { margin: 0; height: 100%; }
.pos-shell {
  margin: 0;
  min-height: 100%;
  background: #111311;
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
.pos-frame-wrap {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pos-screen {
  position: relative;
  width: min(430px, 100vw);
  height: 100%;
  max-height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
@media (min-width: 520px) {
  .pos-screen {
    height: min(920px, 100vh);
    border-radius: 24px;
    box-shadow: 0 30px 70px -25px rgba(0, 0, 0, .55);
  }
}
.pos-scroll::-webkit-scrollbar { width: 0; }

/* NID-324 (generalising the NID-322 .pos-sheet[hidden] guard): the shell's
   Stimulus controllers toggle visibility with the `hidden` attribute, but any
   class-level `display:` rule out-specifies the UA's [hidden] default. That
   left the invisible .pos-rdone overlay swallowing every tap on the receive
   screen (Confirm receipt + back arrow dead) and a ghost "Cart is empty"
   above the cart. One shell-scoped rule closes the whole bug class. */
.pos-shell [hidden] { display: none !important; }

/* ---- Home hub ----------------------------------------------------------- */
.pos-home { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.pos-home__header {
  flex: none;
  background: var(--hbg);
  color: var(--htext);
  padding: 44px 20px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.pos-home__heading { flex: 1; min-width: 0; }
.pos-home__shop {
  display: block;
  font: 800 20px/1.1 var(--font);
  letter-spacing: -.01em;
}
.pos-home__meta {
  display: block;
  margin-top: 3px;
  font: 500 12px/1 var(--font);
  opacity: .6;
}
.pos-home__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Small square icon button (settings gear / back). */
.pos-iconbtn {
  flex: none;
  cursor: pointer;
  border: none;
  background: var(--htotalbg);
  color: var(--htext);
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pos-iconbtn:active { transform: scale(.92); }

/* Low-stock alert banner. */
.pos-alert {
  cursor: pointer;
  text-align: left;
  border: 1px solid var(--warnline);
  background: var(--warnsoft);
  border-radius: var(--r);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
}
.pos-alert__icon {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--warnfill);
  color: var(--warntext);
  font: 800 18px/1 var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pos-alert__text { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.pos-alert__title { font: 700 13px/1.1 var(--font); color: var(--warn); }
.pos-alert__sub { font: 500 11px/1.1 var(--font); color: var(--sub); }
.pos-alert__chev { font: 700 15px/1 var(--font); color: var(--warn); }

/* Two-up stat cards (today's sales / transactions). */
.pos-stats { display: flex; gap: 10px; }
.pos-stat {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pos-stat__label {
  font: 600 10px/1 var(--font);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--sub);
}
.pos-stat__value {
  font: 800 20px/1 var(--mono);
  color: var(--text);
}

/* Primary "New sale" call-to-action. */
.pos-cta {
  cursor: pointer;
  text-align: left;
  border: none;
  border-radius: var(--r);
  padding: 20px;
  background: var(--accfill);
  color: var(--acctext);
  display: flex;
  align-items: center;
  gap: 14px;
}
.pos-cta__glyph {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .18);
  display: flex;
  align-items: center;
  justify-content: center;
  font: 600 26px/1 var(--font);
}
.pos-cta__text { display: flex; flex-direction: column; gap: 2px; }
.pos-cta__title { font: 800 18px/1.1 var(--font); }
.pos-cta__sub { font: 500 12px/1.2 var(--font); opacity: .85; }

/* Tile grid (history / receive / stock / held / stickers). */
.pos-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pos-tile {
  position: relative;
  cursor: pointer;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  color: var(--text);
}
.pos-tile__icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accsoft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--acc);
}
.pos-tile__text { display: flex; flex-direction: column; gap: 2px; }
.pos-tile__title { font: 700 14px/1.1 var(--font); }
.pos-tile__sub { font: 500 11px/1.2 var(--font); color: var(--sub); }

/* Count badge pinned to a tile's corner. */
.pos-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  box-sizing: border-box;
  border-radius: 10px;
  background: var(--accfill);
  color: var(--acctext);
  font: 700 11px/20px var(--font);
  text-align: center;
}
.pos-badge--warn { background: var(--warnfill); color: var(--warntext); }

/* Full-width row (day close & handover). */
.pos-row {
  cursor: pointer;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 13px;
  color: var(--text);
}
.pos-row__icon {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accsoft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--acc);
}
.pos-row__text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.pos-row__title { font: 700 14px/1.1 var(--font); }
.pos-row__sub { font: 500 11px/1.2 var(--font); color: var(--sub); }
.pos-row__chev { font: 700 15px/1 var(--font); color: var(--sub); }

/* Press feedback the design runtime drove via style-active. */
.pos-cta:active,
.pos-tile:active,
.pos-row:active,
.pos-alert:active { transform: scale(.99); }

/* =========================================================================
 * NID-314 (POS de-React, Phase 1): the read-only screens.
 *
 * The design-tool export styled every element inline; here each screen's markup
 * hangs off semantic classes lifted verbatim from the frame's inline styles, so
 * the Hotwire screens render pixel-faithful to the approved mockup. Screens are
 * swapped inside the pos-screen Turbo Frame the layout owns.
 * ====================================================================== */

/* Links rendered as tiles/rows/buttons inherit type colour, never underline. */
.pos-shell a { text-decoration: none; color: inherit; }

/* The Turbo Frame is the flex column the screen content fills. */
.pos-screen__frame { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pos-screen__frame > * { flex: 1; min-height: 0; }

/* ---- Shared screen chrome (header / scroll body / footer) ---------------- */
.pos-screen-view { display: flex; flex-direction: column; height: 100%; min-height: 0; }

.pos-shead {
  flex: none;
  background: var(--hbg);
  color: var(--htext);
  padding: 40px 16px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.pos-back {
  flex: none;
  cursor: pointer;
  border: none;
  background: var(--htotalbg);
  color: var(--htext);
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font: 600 19px/1 var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pos-back:active { transform: scale(.92); }
.pos-shead__title  { font: 800 16px/1 var(--font); }
.pos-shead__group  { display: flex; flex-direction: column; gap: 2px; }
.pos-shead__title2 { font: 800 15px/1 var(--font); }
.pos-shead__sub    { font: 500 11px/1 var(--font); opacity: .6; }
/* NID-324: the sale screen's running total (+ GST detail) sits at the top
   right corner of the header; the footer keeps only Hold/Charge. */
.pos-shead__totals { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.pos-shead__total  { font: 800 20px/1 var(--mono); color: var(--acc); }
.pos-shead__gst    { font: 500 10.5px/1 var(--font); color: var(--sub); }

.pos-sbody {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 16px 16px 20px;
  gap: 12px;
}
.pos-sbody--list { padding: 14px 14px 20px; gap: 9px; }
.pos-sbody--po   { padding: 14px 14px 20px; gap: 10px; }

.pos-sfoot {
  flex: none;
  padding: 12px 14px 16px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

/* Shared empty state (held sales / stickers). */
.pos-empty {
  height: 100%;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 20px;
}
.pos-empty__icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--surfacealt);
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 22px var(--font);
  color: var(--sub);
}
.pos-empty__text { display: flex; flex-direction: column; gap: 4px; }
.pos-empty__t { font: 700 15px/1.2 var(--font); color: var(--text); }
.pos-empty__b { font: 500 12.5px/1.4 var(--font); color: var(--sub); max-width: 230px; }

/* ---- Sales history ------------------------------------------------------- */
.pos-hrow {
  cursor: pointer;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r);
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}
.pos-hrow:active { transform: scale(.99); border-color: var(--acc); }
.pos-hrow__glyph {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accsoft);
  color: var(--acc);
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 10px/1 var(--font);
}
.pos-hrow__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pos-hrow__name { font: 700 13.5px/1.1 var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-hrow__meta { font: 500 11px/1.1 var(--font); color: var(--sub); }
.pos-hrow__side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.pos-hrow__total { font: 700 14px/1 var(--font); font-family: var(--mono); }
.pos-hrow__mode { font: 600 9.5px/1 var(--font); padding: 3px 7px; border-radius: 6px; background: var(--surfacealt); color: var(--sub); }

/* ---- Sale detail --------------------------------------------------------- */
.pos-dcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.pos-dcard__h { font: 700 12px var(--font); color: var(--text); }
.pos-drow { display: flex; justify-content: space-between; }
.pos-drow__k { font: 500 12px var(--font); color: var(--sub); }
.pos-drow__v { font: 600 12.5px var(--font); color: var(--text); }
.pos-drow__v--mono { font-family: var(--mono); }

.pos-dlines { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.pos-dlines__list { padding: 14px 16px; border-bottom: 1px dashed var(--line); display: flex; flex-direction: column; gap: 11px; }
.pos-dline { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pos-dline__name { font: 500 12.5px/1.3 var(--font); color: var(--text); flex: 1; min-width: 0; }
.pos-dline__name .pos-dline__sub { color: var(--sub); }
.pos-dline__amt { font: 600 12.5px/1 var(--font); font-family: var(--mono); color: var(--text); }
.pos-dline--muted .pos-dline__name,
.pos-dline--muted .pos-dline__amt { color: var(--sub); }
.pos-dtotal { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.pos-dtotal__row { display: flex; align-items: center; justify-content: space-between; }
.pos-dtotal__label { font: 700 14px var(--font); color: var(--text); }
.pos-dtotal__value { font: 800 20px/1 var(--font); font-family: var(--mono); color: var(--acc); }
.pos-dtotal__note { text-align: right; font: 500 10.5px/1.4 var(--font); color: var(--sub); }

.pos-proof { display: flex; gap: 12px; }
.pos-proof__item { display: flex; flex-direction: column; gap: 5px; align-items: center; }
.pos-proof__img { width: 66px; height: 66px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.pos-proof__cap { font: 500 9.5px var(--font); color: var(--sub); }

.pos-banner { text-align: center; padding: 14px; border-radius: 14px; background: var(--warnsoft); color: var(--warn); font: 700 13px var(--font); }
.pos-btn-receipt {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  cursor: pointer;
  border: 1.5px solid var(--acc);
  background: var(--accsoft);
  border-radius: 14px;
  padding: 15px;
  font: 700 14px var(--font);
  color: var(--acc);
}
.pos-btn-receipt:active { transform: scale(.99); }

/* NID-317 (Phase 4): sale-detail void + refund actions. */
.pos-dactions { display: flex; flex-direction: column; gap: 10px; }
.pos-dact { display: flex; gap: 10px; }
.pos-dact__refund, .pos-dact__void {
  flex: 1; box-sizing: border-box; cursor: pointer; border-radius: 14px; padding: 15px;
  font: 700 14px/1 var(--font); text-align: center;
}
.pos-dact__refund { border: none; background: var(--accfill); color: var(--acctext); }
.pos-dact__void { border: 1.5px solid var(--warnline); background: var(--warnsoft); color: var(--warn); }
.pos-dact__refund:active, .pos-dact__void:active { transform: scale(.99); }

/* Void sheet (NID-322): themed bottom-sheet confirm — Cancel / Confirm void.
   The prompt renders as a .pos-field__hint inside the shared .pos-sheet. */
.pos-voidsheet__btns { display: flex; gap: 10px; margin-top: 4px; }
.pos-voidsheet__cancel, .pos-voidsheet__confirm {
  flex: 1; box-sizing: border-box; cursor: pointer; border-radius: 13px; padding: 14px;
  font: 700 14px/1 var(--font); text-align: center;
}
.pos-voidsheet__cancel { border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.pos-voidsheet__confirm { border: none; background: var(--warnfill); color: var(--warntext); }
/* NID-324: the hold-cart confirm reuses the void sheet's layout but is a
   normal (accent) action, not a destructive one. */
.pos-voidsheet__confirm--hold { background: var(--accfill); color: var(--acctext); }
.pos-voidsheet__confirm:disabled { opacity: .55; }
.pos-voidsheet__cancel:active, .pos-voidsheet__confirm:active { transform: scale(.99); }

/* Refund sheet — reason chips + returned-goods photo. */
.pos-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pos-chip {
  cursor: pointer; border: 1px solid var(--line); background: var(--surfacealt); color: var(--sub);
  border-radius: 999px; padding: 9px 14px; font: 700 12px/1 var(--font);
}
.pos-chip--on { border-color: var(--acc); background: var(--accsoft); color: var(--acc); }
.pos-chip:active { transform: scale(.97); }
.pos-refphoto {
  display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line);
  border-radius: 14px; padding: 13px 14px;
}
.pos-refphoto__req { color: var(--warn); }
.pos-refphoto__img { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }

/* ---- Held / parked sales ------------------------------------------------- */
.pos-park__hint { font: 500 12px/1.4 var(--font); color: var(--sub); }
.pos-park {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.pos-park__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pos-park__label { font: 700 13.5px/1.1 var(--font); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-park__meta { font: 500 11px/1 var(--font); color: var(--sub); }
.pos-park__total { flex: none; font: 700 14px/1 var(--font); font-family: var(--mono); color: var(--text); }
.pos-park__resume {
  flex: none; cursor: pointer; border: none; border-radius: 9px;
  background: var(--accfill); color: var(--acctext); padding: 9px 13px;
  font: 700 11px/1 var(--font); text-decoration: none;
}
.pos-park__resume:active { transform: scale(.96); }

/* ---- Receive — PO list --------------------------------------------------- */
.pos-po-h { font: 600 10px/1 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--sub); padding: 2px 2px; }
.pos-po {
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r);
  padding: 14px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.pos-po--done { opacity: .6; }
.pos-po__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.pos-po__top { display: flex; align-items: center; gap: 7px; }
.pos-po__id { font: 700 13.5px/1 var(--font); font-family: var(--mono); color: var(--text); }
.pos-po__src { font: 600 9px/1 var(--font); padding: 3px 7px; border-radius: 5px; background: var(--surfacealt); color: var(--sub); }
.pos-po__meta { font: 500 11px/1.2 var(--font); color: var(--sub); }
.pos-po__side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.pos-pill { font: 700 9px/1 var(--font); padding: 4px 8px; border-radius: 6px; }
.pos-pill--pending { background: var(--accsoft); color: var(--acc); }
.pos-pill--received { background: var(--surfacealt); color: var(--sub); }
.pos-pill--flagged { background: var(--warnsoft); color: var(--warn); }
.pos-po__recv { font: 600 11px/1 var(--font); color: var(--acc); }

/* ---- Print stickers ------------------------------------------------------ */
.pos-sti__hint { font: 500 12px/1.4 var(--font); color: var(--sub); }
.pos-sti {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.pos-sti__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pos-sti__name { font: 700 13.5px/1.1 var(--font); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-sti__meta { font: 500 11px/1 var(--font); color: var(--sub); }
.pos-sti__print {
  flex: none;
  cursor: pointer;
  border: none;
  border-radius: 9px;
  background: var(--accfill);
  color: var(--acctext);
  padding: 9px 13px;
  font: 700 11px var(--font);
  display: inline-flex;
  align-items: center;
}
.pos-sti__reprint {
  flex: none;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--sub);
  padding: 9px 11px;
  font: 600 11px var(--font);
  display: inline-flex;
  align-items: center;
}
.pos-sti__print:active,
.pos-sti__reprint:active { transform: scale(.96); }

/* ---- Thermal test print (Web Bluetooth, NID-360) ------------------------- */
.pos-testprint {
  background: var(--accsoft);
  border: 1px dashed var(--acc);
  border-radius: var(--r);
  padding: 13px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.pos-testprint__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pos-testprint__name { font: 700 13.5px/1.1 var(--font); color: var(--text); }
.pos-testprint__hint { font: 500 11px/1.35 var(--font); color: var(--sub); }
.pos-testprint__status { font: 600 11px/1.35 var(--font); color: var(--acc); }
.pos-testprint__status:empty { display: none; }

/* ---- Settings ------------------------------------------------------------ */
.pos-setcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pos-setcard__name { font: 700 14px/1.1 var(--font); color: var(--text); }
.pos-setcard__sub { font: 500 12px/1.2 var(--font); color: var(--sub); }
.pos-logout {
  width: 100%;
  box-sizing: border-box;
  cursor: pointer;
  text-align: center;
  border: none;
  background: var(--warnfill);
  color: var(--warntext);
  border-radius: 14px;
  padding: 16px;
  font: 700 15px/1 var(--font);
}
.pos-logout:active { transform: scale(.99); }
/* button_to wraps the submit in a form; keep it flush in the flex column. */
.pos-logout-form { margin: 0; }

/* ---- Day close (read-only summary) --------------------------------------- */
.pos-dc-note {
  background: var(--accsoft);
  border: 1px solid var(--acc);
  border-radius: var(--r);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.pos-dc-note__icon {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accfill);
  color: var(--acctext);
  font: 700 13px/1 var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pos-dc-note__text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.pos-dc-note__t { font: 700 12.5px/1.2 var(--font); color: var(--text); }
.pos-dc-note__b { font: 500 11px/1.3 var(--font); color: var(--sub); }
.pos-dc-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.pos-dc-modes { padding: 15px 16px; display: flex; flex-direction: column; gap: 12px; }
.pos-dc-modes__h { font: 700 12px var(--font); color: var(--text); }
.pos-dc-mode { display: flex; align-items: center; justify-content: space-between; }
.pos-dc-mode__l { display: flex; align-items: center; gap: 8px; }
.pos-dc-mode__glyph {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--accsoft);
  color: var(--acc);
  font: 700 8px/1 var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pos-dc-mode__glyph--sm { font-size: 7px; }
.pos-dc-mode__name { font: 500 13px var(--font); color: var(--text); }
.pos-dc-mode__amt { font: 700 14px var(--font); font-family: var(--mono); color: var(--text); }
.pos-dc-gross { padding: 14px 16px; border-top: 1px dashed var(--line); display: flex; align-items: center; justify-content: space-between; }
.pos-dc-gross__l { display: flex; flex-direction: column; gap: 2px; }
.pos-dc-gross__t { font: 700 14px var(--font); color: var(--text); }
.pos-dc-gross__s { font: 500 11px var(--font); color: var(--sub); }
.pos-dc-gross__v { font: 800 22px/1 var(--font); font-family: var(--mono); color: var(--acc); }
/* NID-1081: discount given today — a secondary figure under gross, so it sits
   quieter than the headline takings. */
.pos-dc-gross--sub .pos-dc-gross__t { font-weight: 600; font-size: 13px; }
.pos-dc-gross--sub .pos-dc-gross__v { font-size: 15px; color: var(--text); }
.pos-dc-void {
  background: var(--warnsoft);
  border: 1px solid var(--warnline);
  border-radius: var(--r);
  padding: 13px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pos-dc-void__l { font: 600 12px var(--font); color: var(--warn); }
.pos-dc-void__v { font: 700 13px var(--font); font-family: var(--mono); color: var(--warn); }

/* Day close — Confirm handover footer. */
.pos-dc-foot { flex: none; padding: 12px 14px 16px; background: var(--surface); border-top: 1px solid var(--line); }
.pos-dc-foot .pos-btn-charge { width: 100%; }


/* =========================================================================
 * NID-315 (POS de-React, Phase 2): the live sale/cart screen + its sheets.
 *
 * The cart, loose math and totals live in the pos_sale Stimulus controller;
 * these classes are the design's inline styles lifted into the shell stylesheet
 * (the shell loads no Tailwind, so utility helpers are defined here too). Sheets
 * slide up over the phone canvas; the cart list and sheet contents are painted
 * by the controller into the hooks below.
 * ====================================================================== */

/* Utility helpers the shell's JS toggles (no Tailwind in this stylesheet). */
.pos-shell .hidden { display: none !important; }
.pos-shell .sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---- Sale screen shell --------------------------------------------------- */
.pos-sale { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.pos-sale__body {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 14px 14px 8px; display: flex; flex-direction: column; gap: 9px;
}
.pos-sale .pos-empty { flex: 1; }

/* Cart lines. */
.pos-cart { display: flex; flex-direction: column; gap: 9px; }
.pos-cartline {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 11px 12px; display: flex; align-items: center; gap: 11px;
}
.pos-cartline__tag {
  flex: none; width: 34px; height: 34px; border-radius: 10px;
  background: var(--accsoft); color: var(--acc);
  font: 700 10px/1 var(--font); display: flex; align-items: center; justify-content: center;
}
.pos-cartline__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pos-cartline__name { font: 700 13px/1.15 var(--font); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Scanned id under the product name. Monospace so digits line up when two
   similar codes sit in adjacent rows — that column comparison is the whole
   point of showing it. Mirrors .pos-itemtile__code in the items sheet. */
.pos-cartline__code { font: 500 9.5px/1 var(--mono); color: var(--sub); }
.pos-cartline__sub { font: 500 10.5px/1.2 var(--font); color: var(--sub); }
.pos-cartline__side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.pos-cartline__amt { font: 700 13.5px/1 var(--mono); color: var(--text); }
.pos-cartline__rm {
  cursor: pointer; border: none; background: var(--surfacealt); color: var(--sub);
  width: 24px; height: 24px; border-radius: 8px; font: 700 12px/1 var(--font);
}
.pos-cartline__qty { display: flex; align-items: center; gap: 8px; }
.pos-qtybtn {
  cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  width: 26px; height: 26px; border-radius: 8px; font: 700 14px/1 var(--font);
  display: flex; align-items: center; justify-content: center;
}
.pos-qtybtn:active { transform: scale(.9); }
.pos-qtybtn__n { min-width: 18px; text-align: center; font: 700 13px var(--mono); color: var(--text); }

/* Tool row (Scan / Loose / Items) — sits at the top of the sale screen. */
.pos-sale__tools {
  flex: none; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 9px;
  padding: 14px 14px 4px; background: var(--bg);
}
.pos-tool {
  cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 13px; padding: 11px 6px; display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.pos-tool:active { transform: scale(.97); }
.pos-tool__glyph {
  width: 30px; height: 30px; border-radius: 9px; background: var(--accsoft); color: var(--acc);
  font: 700 15px/1 var(--font); display: flex; align-items: center; justify-content: center;
}
.pos-tool__label { font: 700 11px/1 var(--font); }

/* Charge bar. */
.pos-sale__foot {
  flex: none; padding: 12px 14px 16px; background: var(--surface); border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 10px;
}
.pos-sale__footbtns { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.pos-btn-hold, .pos-btn-charge {
  cursor: pointer; border: none; border-radius: 13px; padding: 15px; font: 700 15px/1 var(--font);
}
.pos-btn-hold { background: var(--surfacealt); color: var(--text); }
.pos-btn-charge { background: var(--accfill); color: var(--acctext); }
.pos-btn-hold:disabled, .pos-btn-charge:disabled { opacity: .45; }
.pos-btn-hold:active, .pos-btn-charge:active { transform: scale(.99); }

/* ---- Sheets (slide-up overlays) ----------------------------------------- */
.pos-sheet { position: absolute; inset: 0; z-index: 30; }
/* A hidden sheet stays hidden: guard the [hidden] toggle against any future
   class-level `display` rule out-specifying the UA [hidden] default (NID-322). */
.pos-sheet[hidden] { display: none !important; }
.pos-sheet__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.35); opacity: 0; transition: opacity .18s ease; }
.pos-sheet--open .pos-sheet__backdrop { opacity: 1; }
.pos-sheet__panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88%;
  background: var(--surface); border-radius: 22px 22px 0 0;
  display: flex; flex-direction: column; min-height: 0;
  transform: translateY(100%); transition: transform .22s ease;
  box-shadow: 0 -12px 40px -20px rgba(0,0,0,.5);
}
.pos-sheet--open .pos-sheet__panel { transform: translateY(0); }
.pos-sheet__head {
  flex: none; padding: 16px 16px 10px; display: flex; align-items: center; justify-content: space-between;
}
/* Back-nav head (customer → pay → proof): back · title · close. */
.pos-sheet__head--nav .pos-sheet__title { flex: 1; text-align: center; }
.pos-sheet__back {
  flex: none; cursor: pointer; border: none; background: none; padding: 0;
  font: 600 13px/1 var(--font); color: var(--sub);
  display: inline-flex; align-items: center; gap: 4px;
}
.pos-sheet__back:active { transform: scale(.96); }
.pos-sheet__title { font: 800 16px/1 var(--font); color: var(--text); }
.pos-sheet__sub { margin: -4px 16px 10px; font: 500 12px/1.3 var(--font); color: var(--sub); }
.pos-sheet__done { margin: 12px 16px 4px; flex: none; }
.pos-sheet__x {
  cursor: pointer; border: none; background: var(--surfacealt); color: var(--sub);
  width: 30px; height: 30px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
}
.pos-sheet__search {
  margin: 0 16px 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  font: 500 14px var(--font); background: var(--surfacealt); color: var(--text);
}
.pos-sheet__body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.pos-sheet__empty { font: 500 13px var(--font); color: var(--sub); text-align: center; padding: 20px; }
/* Sticky action footer for a sheet (NID-323 receipt sheet's Print button). */
.pos-sheet__foot { flex: none; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }

/* NID-323: in-page receipt preview. The receipt visual sits inside the sheet
   body on a neutral backing so the 80mm slip reads as a physical receipt. When
   the Print button tags <body class="pos-print-receipt">, the print media block
   below scopes the printed page to just this receipt — no POS chrome, no new
   tab. Normal Ctrl+P on the shell is untouched (it never sets that class). */
.pos-sheet--receipt .pos-sheet__body { background: #f3f4f6; }
@media print {
  body.pos-print-receipt * { visibility: hidden !important; }
  body.pos-print-receipt .pos-sheet--receipt,
  body.pos-print-receipt .pos-sheet--receipt * { visibility: visible !important; }
  body.pos-print-receipt .pos-sheet--receipt {
    position: absolute; inset: 0; z-index: 999;
  }
  body.pos-print-receipt .pos-sheet--receipt .pos-sheet__backdrop,
  body.pos-print-receipt .pos-sheet--receipt .pos-sheet__head,
  body.pos-print-receipt .pos-sheet--receipt .pos-sheet__foot { display: none !important; }
  body.pos-print-receipt .pos-sheet--receipt .pos-sheet__panel {
    position: static; transform: none; max-height: none; min-height: 0;
    background: #fff; border-radius: 0; box-shadow: none;
  }
  body.pos-print-receipt .pos-sheet--receipt .pos-sheet__body {
    overflow: visible; background: #fff; padding: 0;
  }
  body.pos-print-receipt .pos-sheet--receipt .receipt {
    box-shadow: none; margin: 0; width: auto;
  }
  @page { size: 80mm auto; margin: 4mm; }
}
/* CTA with a trailing amount (Continue to pay ₹X). */
.pos-btn--amt { display: flex; align-items: center; justify-content: center; gap: 8px; }
.pos-btn__amt { font-family: var(--mono); }
/* Items sheet: "Scan barcode" shortcut. */
.pos-scanbar {
  flex: none; margin: 0 16px 8px; cursor: pointer; border: 1.5px solid var(--acc);
  background: var(--accsoft); color: var(--acc); border-radius: 12px; padding: 12px;
  display: flex; align-items: center; justify-content: center; gap: 10px; font: 700 13px var(--font);
}
.pos-scanbar:active { transform: scale(.99); }
.pos-scanbar__bars {
  width: 16px; height: 16px;
  background: repeating-linear-gradient(90deg, var(--acc) 0 2px, transparent 2px 4px);
}

/* Fields shared across the sheets. */
.pos-field {
  box-sizing: border-box; width: 100%; padding: 13px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surfacealt); color: var(--text); font: 500 15px var(--font);
}
.pos-field:focus { outline: none; border-color: var(--acc); }
.pos-field--upper { text-transform: uppercase; }
.pos-field__label { font: 700 11px/1 var(--font); color: var(--sub); letter-spacing: .02em; }
.pos-field__hint { font: 500 11px/1.3 var(--font); color: var(--sub); }
/* NID-1212: an identity we already hold is shown back, not asked for — locked,
   and visibly not an empty box waiting to be filled in. The line under it names
   the business behind a GSTIN we did pay to look up. */
.pos-field[readonly] { color: var(--sub); background: var(--surface); cursor: default; }
/* NID-1214: the business behind a looked-up GSTIN is the one line on this sheet
   the operator has to actually read before completing the sale, so it is bigger
   than a hint and green — a lookup that answered looks different from one that
   did not. GET sits beside the box because the lookup costs money: it happens
   when the operator asks for it, never as a side effect of leaving the field. */
.pos-field__gstname { font: 700 13px/1.3 var(--font); color: var(--ok); margin-top: 4px; }
.pos-field__row { display: flex; align-items: stretch; gap: 8px; }
.pos-field__get {
  flex: none; cursor: pointer; border: 1.5px solid var(--acc); background: var(--accsoft);
  color: var(--acc); border-radius: 12px; padding: 0 16px; font: 800 12px/1 var(--font);
  letter-spacing: .04em;
}
.pos-field__get:active { transform: scale(.98); }
.pos-field__get:disabled { opacity: .45; cursor: default; transform: none; }
.pos-field__group { font: 800 12px/1 var(--font); color: var(--text); margin-top: 6px; }

/* Segmented toggle (loose mode / scan kind). */
.pos-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--surfacealt); border-radius: 12px; padding: 4px; }
.pos-seg__opt {
  cursor: pointer; border: none; background: transparent; color: var(--sub);
  border-radius: 9px; padding: 10px; font: 700 12.5px/1 var(--font);
}
.pos-seg__opt--on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* Loose sheet: product chips + amount⇄qty readout + numeric dial pad. */
.pos-loose__chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.pos-loosechip {
  flex: none; cursor: pointer; display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 12px; padding: 9px 13px;
}
/* Selected good — a strong filled accent so it is unmistakable on a phone
   (NID-318: the faint tint read as "nothing selected"). */
.pos-loosechip--on { border-color: var(--acc); background: var(--accfill); color: var(--acctext); }
.pos-loosechip:active { transform: scale(.97); }
.pos-loosechip__name { font: 600 12.5px/1.1 var(--font); white-space: nowrap; }
.pos-loosechip__rate { font: 500 10.5px/1 var(--mono); opacity: .75; }
.pos-loosechip--on .pos-loosechip__rate { opacity: .9; }
.pos-loose__readout { display: flex; align-items: stretch; gap: 10px; }
.pos-loose__cell {
  flex: none; width: 120px; background: var(--surfacealt); border-radius: 14px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; justify-content: center;
}
.pos-loose__cell--primary { flex: 1; background: var(--accsoft); }
.pos-loose__celllabel { font: 600 10px/1 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--sub); }
.pos-loose__cell--primary .pos-loose__celllabel { color: var(--acc); }
.pos-loose__cellvalue { font: 800 26px/1 var(--mono); color: var(--text); }
.pos-loose__cellvalue--sub { font: 700 18px/1 var(--mono); }
.pos-loose__pad { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.pos-key {
  cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 12px; padding: 15px 0; font: 600 19px/1 var(--mono);
}
.pos-key:active { background: var(--surfacealt); transform: scale(.97); }

/* Buttons inside sheets. */
.pos-btn-primary, .pos-btn-secondary, .pos-btn-ghost {
  box-sizing: border-box; width: 100%; text-align: center; cursor: pointer;
  border-radius: 13px; padding: 15px; font: 700 15px/1 var(--font); display: block;
}
.pos-btn-primary { border: none; background: var(--accfill); color: var(--acctext); }
.pos-btn-primary:disabled { opacity: .45; }
.pos-btn-secondary { border: 1.5px solid var(--acc); background: var(--accsoft); color: var(--acc); }
.pos-btn-ghost { border: 1px solid var(--line); background: var(--surface); color: var(--sub); }
.pos-btn-primary:active, .pos-btn-secondary:active, .pos-btn-ghost:active { transform: scale(.99); }

/* In-flight ring for the proof sheet (photo being read, sale being
   uploaded). The POS shell loads only this stylesheet — never the Tailwind
   bundle — so the app-wide `.submit-spinner` from application.css does not
   exist in here and the ring is redefined. Sized in `em` and painted with
   `currentColor`, so it reads on the accent-filled primary button and the
   outlined secondary one without a per-variant rule, in both themes. */
.pos-spinner {
  display: inline-block; width: .875em; height: .875em;
  border: 2px solid currentColor;
  border-top-color: transparent;   /* the gap that makes the rotation visible */
  border-radius: 9999px; opacity: .85;
  vertical-align: -.125em;          /* sit on the label's baseline */
  margin-right: .5em;
  animation: pos-spin .6s linear infinite;
}
@keyframes pos-spin { to { transform: rotate(360deg); } }
/* Reduced motion still needs the "something is happening" signal — slow the
   turn rather than freezing it into an indistinguishable static ring. */
@media (prefers-reduced-motion: reduce) {
  .pos-spinner { animation-duration: 1.5s; }
}

/* Scan sheet. */
.pos-scan__video { width: 100%; max-height: 240px; border-radius: 14px; background: #000; object-fit: cover; }
.pos-scan__status { font: 500 12px/1.4 var(--font); color: var(--sub); text-align: center; margin: 0; }
.pos-scan__manual { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; align-items: stretch; }
.pos-scan__manual .pos-btn-primary { padding: 13px; }

/* Customer suggestions + credit note. */
.pos-suggests { display: flex; flex-direction: column; gap: 6px; }
.pos-suggest {
  cursor: pointer; text-align: left; border: 1px solid var(--line); background: var(--surfacealt);
  border-radius: 11px; padding: 11px 13px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.pos-suggest__name { font: 700 13px var(--font); color: var(--text); }
.pos-suggest__phone { font: 600 12px var(--mono); color: var(--sub); }
.pos-credit-ok { font: 600 11.5px/1.3 var(--font); color: var(--acc); }
/* NID-946: "Use points" toggle. 44px row — it is tapped with a thumb. */
/* NID-1080: the counter discount entry — % / currency toggle above its amount. */
.pos-disc { display: flex; flex-direction: column; gap: 6px; }

.pos-points { display: flex; align-items: center; gap: 9px; min-height: 44px;
              font: 600 13px/1.3 var(--font); color: var(--text); cursor: pointer; }
.pos-points input { width: 20px; height: 20px; accent-color: var(--acc); }

/* Payment tiles. */
/* Amount-due header above the pay tiles. */
.pos-paydue { text-align: center; display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px; }
.pos-paydue__label { font: 600 11px/1 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--sub); }
.pos-paydue__amt { font: 800 34px/1 var(--mono); color: var(--text); }
.pos-paygrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pos-paytile {
  cursor: pointer; border: 1.5px solid var(--line); background: var(--bg); color: var(--text);
  border-radius: 15px; padding: 16px 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 7px; text-align: left;
}
.pos-paytile:active { transform: scale(.98); border-color: var(--acc); background: var(--accsoft); }
.pos-paytile--off { opacity: .4; }
.pos-paytile__glyph {
  width: 32px; height: 32px; border-radius: 9px; background: var(--accsoft); color: var(--acc);
  font: 700 10px/1 var(--font); display: flex; align-items: center; justify-content: center;
}
.pos-paytile__label { font: 700 14px/1.1 var(--font); }
.pos-paytile__hint { font: 500 11px/1.2 var(--font); color: var(--sub); }

/* Proof capture. */
.pos-proofbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--accsoft); border-radius: 12px; padding: 11px 14px;
}
.pos-proofbar__mode { font: 700 12.5px var(--font); color: var(--text); }
.pos-proofbar__amt { font: 800 18px/1 var(--mono); color: var(--acc); }
.pos-proofcap { display: flex; flex-direction: column; gap: 7px; background: var(--surfacealt); border-radius: 13px; padding: 13px; }
.pos-proofcap__img { width: 90px; height: 90px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.pos-proofcap__ok { font: 700 12px/1 var(--font); color: var(--acc); }

/* Regular-items sheet: 2-column tile grid (design parity). */
.pos-itemgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.pos-itemtile {
  cursor: pointer; text-align: left; border: 1px solid var(--line); background: var(--bg); color: var(--text);
  border-radius: var(--r); padding: 13px; display: flex; flex-direction: column; gap: 5px;
}
.pos-itemtile:active { transform: scale(.98); border-color: var(--acc); }
.pos-itemtile__name { font: 600 13px/1.2 var(--font); color: var(--text); }
.pos-itemtile__code { font: 500 9.5px/1 var(--mono); color: var(--sub); min-height: 10px; }
.pos-itemtile__foot { display: flex; align-items: center; justify-content: space-between; }
.pos-itemtile__rate { font: 700 14px/1 var(--mono); color: var(--acc); }
.pos-itemtile__add {
  width: 22px; height: 22px; border-radius: 7px; background: var(--accfill); color: var(--acctext);
  font: 700 15px/1 var(--font); display: flex; align-items: center; justify-content: center;
}

/* Done confirmation. */
.pos-sheet__panel--done { align-items: stretch; }
.pos-done { padding: 26px 20px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pos-done__check {
  width: 58px; height: 58px; border-radius: 50%; background: var(--accfill); color: var(--acctext);
  font: 700 28px/1 var(--font); display: flex; align-items: center; justify-content: center; margin-bottom: 4px;
}
.pos-done__title { font: 800 18px/1 var(--font); color: var(--text); }
.pos-done__totlabel { font: 600 11px/1 var(--font); color: var(--sub); margin-top: 8px; text-transform: uppercase; letter-spacing: .05em; }
.pos-done__total { font: 800 30px/1 var(--mono); color: var(--acc); margin-bottom: 10px; }
.pos-done__meta { width: 100%; display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; padding: 12px 14px; background: var(--surfacealt); border-radius: 12px; }
.pos-done__metarow { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pos-done__metak { font: 600 10.5px/1 var(--font); text-transform: uppercase; letter-spacing: .05em; color: var(--sub); }
.pos-done__metav { font: 600 12px/1.3 var(--font); color: var(--text); text-align: right; }
.pos-done__metav--mono { font-family: var(--mono); }
.pos-done .pos-btn-primary, .pos-done .pos-btn-secondary { margin-top: 2px; }

/* NID-324: tall bottom sheet (sticker-sheet preview) — nearly full height,
   with the label sheet filling the body via an iframe. */
.pos-sheet--tall .pos-sheet__panel { height: 92%; max-height: 92%; }
.pos-stipreview { flex: 1; min-height: 0; padding: 0 12px 12px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pos-stipreview__frame { flex: 1; width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
/* NID-397: real 50×30 mm sticker preview (5:3). Rendered on a 384×240 canvas,
   shown at label proportions on a white card the way it prints. */
.pos-stipreview__canvas { width: 100%; max-width: 340px; height: auto; aspect-ratio: 5 / 3; border: 1px solid var(--line); border-radius: 12px; background: #fff; margin-top: 4px; }
.pos-stipreview__canvas[hidden] { display: none; }
.pos-stipreview__status { font: 600 12px/1.35 var(--font); color: var(--acc); text-align: center; }
.pos-stipreview__status:empty { display: none; }

/* NID-458: "how many to print" ± stepper above the Print button, and the Print
   button's left→right fill that arms the job over 2s (tap again to cancel). */
.pos-stiqty { flex: none; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px 0; }
.pos-stiqty[hidden] { display: none; }
.pos-stiqty__label { font: 600 13px var(--font); color: var(--sub); }
.pos-stiqty__step { display: flex; align-items: center; gap: 8px; }
.pos-stiqty__step .pos-qtybtn__n { min-width: 28px; font-size: 15px; }
.pos-qtybtn:disabled { opacity: .4; }

/* The fill sits under the label and grows scaleX(0)→(1) over 2s while armed. */
.pos-btn-primary--fill { position: relative; overflow: hidden; }
.pos-btn-primary__fill {
  position: absolute; inset: 0; transform: scaleX(0); transform-origin: left center;
  background: rgba(255, 255, 255, .3); pointer-events: none;
}
.pos-btn-primary__fill--run { transform: scaleX(1); transition: transform 2s linear; }
.pos-btn-primary__label { position: relative; z-index: 1; }
.pos-btn-primary.is-arming { transform: none; }
/* The 2s arming window is JS-timed, so cancel still works with motion reduced —
   here we just drop the sweeping animation and show a static filled state. */
@media (prefers-reduced-motion: reduce) {
  .pos-btn-primary__fill--run { transition: none; }
}

/* NID-324: Stock levels rows (stock vs reorder point + request stepper). */
.pos-stk {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 13px 14px; display: flex; align-items: center; gap: 12px;
}
.pos-stk--low { border-color: var(--warnline); background: var(--warnsoft); }
.pos-stk__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pos-stk__name { font: 700 13.5px/1.1 var(--font); color: var(--text); display: flex; align-items: center; gap: 7px; }
.pos-stk__meta { font: 500 11px/1 var(--font); color: var(--sub); }
.pos-stk__step { flex: none; display: flex; align-items: center; gap: 6px; }
.pos-pill--low { background: var(--warnfill); color: var(--warntext); }

/* Toasts. */
.pos-toasts { position: absolute; left: 16px; right: 16px; bottom: 18px; z-index: 50; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.pos-toast {
  background: var(--text); color: #fff; border-radius: 12px; padding: 12px 15px;
  font: 600 12.5px/1.35 var(--font); opacity: 0; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease;
}
.pos-toast--in { opacity: .96; transform: translateY(0); }

/* NID-315: discard control on a held cart (Phase 2 made parked carts actionable). */
.pos-park__del {
  flex: none; cursor: pointer; border: none; background: var(--surfacealt); color: var(--sub);
  width: 30px; height: 30px; border-radius: 9px; font: 600 13px/1 var(--font);
}
.pos-park__del:active { transform: scale(.9); }

/* ==== NID-316 (POS de-React, Phase 3): receive-stock (PO) flow ============= */

/* Pending PO cards on the list are now links into the receive screen. */
.pos-po--link { text-decoration: none; cursor: pointer; }
.pos-po--link:active { transform: scale(.99); }

/* Receive screen shell. */
.pos-receive { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.pos-receive__body {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 11px;
}
.pos-receive__intro { margin: 0; font: 500 12px/1.4 var(--font); color: var(--sub); }

/* Per-line receive card. */
.pos-rlines { display: flex; flex-direction: column; gap: 9px; }
.pos-rline {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 13px 14px; display: flex; flex-direction: column; gap: 11px;
}
.pos-rline__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pos-rline__id { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pos-rline__name { font: 600 13.5px/1.2 var(--font); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-rline__exp { font: 500 11px/1 var(--font); color: var(--sub); }
.pos-rstatus { flex: none; font: 700 10px/1 var(--font); padding: 4px 8px; border-radius: 6px; background: var(--accsoft); color: var(--acc); }
.pos-rstatus--warn { background: var(--warnsoft); color: var(--warn); }

.pos-rline__counts { display: flex; gap: 8px; }
.pos-rcount {
  flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--surfacealt); border-radius: 10px; padding: 6px 8px 6px 12px;
}
.pos-rcount--dmg { flex: none; padding-left: 11px; }
.pos-rcount__label { font: 600 11px/1 var(--font); color: var(--sub); }
.pos-rcount__label--warn { color: var(--warn); }
.pos-rcount__step { display: flex; align-items: center; gap: 5px; }
.pos-qtybtn--acc { border: none; background: var(--accfill); color: var(--acctext); }
.pos-qtybtn--warn { border: none; background: var(--warnfill); color: var(--warntext); }

/* Damage photos (shown once a line has damaged units). */
.pos-rphotos { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 9px; border-top: 1px dashed var(--line); }
.pos-rphoto { position: relative; width: 52px; height: 52px; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); }
.pos-rphoto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pos-rphoto__rm {
  position: absolute; top: 2px; right: 2px; width: 17px; height: 17px; border: none; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff; font: 600 10px/1 var(--font); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.pos-raddphoto {
  cursor: pointer; height: 36px; padding: 0 13px; display: flex; align-items: center; gap: 7px;
  border: 1.5px dashed var(--warnline); border-radius: 9px; background: var(--warnsoft); color: var(--warn);
  font: 600 11px/1 var(--font);
}
.pos-raddphoto:active { transform: scale(.97); }
.pos-raddphoto__input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

/* Note to owner. */
.pos-rnote {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 15px; display: flex; flex-direction: column; gap: 9px;
}
.pos-rnote__label { font: 700 13px var(--font); color: var(--text); }
.pos-rnote__field {
  box-sizing: border-box; width: 100%; resize: none; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 11px 12px; font: 500 12.5px/1.4 var(--font); color: var(--text); background: var(--bg);
}
.pos-rnote__field:focus { outline: none; border-color: var(--acc); }

/* Confirm bar. */
.pos-receive__foot { flex: none; padding: 12px 14px 16px; background: var(--surface); border-top: 1px solid var(--line); }
.pos-rdisc { display: block; text-align: center; font: 600 11px var(--font); color: var(--warn); margin-bottom: 8px; }
.pos-rconfirm {
  box-sizing: border-box; width: 100%; cursor: pointer; border: none; border-radius: 14px; padding: 16px;
  font: 700 15px var(--font); color: var(--acctext); background: var(--accfill);
}
.pos-rconfirm--warn { background: var(--warnfill); color: var(--warntext); }
.pos-rconfirm:disabled { opacity: .55; }
.pos-rconfirm:active { transform: scale(.99); }

/* Result overlay (full-screen, over the receive screen). */
.pos-rdone {
  position: absolute; inset: 0; z-index: 40; background: var(--bg);
  display: flex; flex-direction: column; opacity: 0; transition: opacity .2s ease;
}
.pos-rdone--open { opacity: 1; }
.pos-rdone__body { flex: 1; min-height: 0; overflow-y: auto; padding: 34px 22px 16px; display: flex; flex-direction: column; align-items: center; }
.pos-rdone__icon {
  width: 66px; height: 66px; border-radius: 50%; background: var(--accfill); color: var(--acctext);
  font: 800 30px/1 var(--font); display: flex; align-items: center; justify-content: center;
}
.pos-rdone__icon--flag { background: var(--warnfill); color: var(--warntext); }
.pos-rdone__title { margin-top: 16px; font: 800 21px/1.1 var(--font); color: var(--text); }
.pos-rdone__sub { margin-top: 5px; font: 500 13px var(--font); color: var(--sub); }

.pos-rsum {
  width: 100%; margin-top: 22px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 15px 16px; display: flex; flex-direction: column; gap: 11px;
}
.pos-rsum__row { display: flex; justify-content: space-between; gap: 10px; }
.pos-rsum__k { font: 500 12px var(--font); color: var(--sub); }
.pos-rsum__v { font: 600 12.5px var(--font); color: var(--text); }
.pos-rsum__v--mono { font-family: var(--mono); }
.pos-rsum__row--warn .pos-rsum__k, .pos-rsum__row--warn .pos-rsum__v { color: var(--warn); }

.pos-rowner {
  width: 100%; margin-top: 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 9px;
}
.pos-rowner__label { font: 600 10px/1 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--acc); }
.pos-rowner__msg { font: 500 12.5px/1.4 var(--font); color: var(--text); }
.pos-rowner__photos { font: 500 11.5px var(--font); color: var(--sub); }

.pos-rdone__foot { flex: none; padding: 12px 22px 20px; display: flex; flex-direction: column; gap: 10px; }
.pos-rsticker {
  box-sizing: border-box; width: 100%; text-align: center; text-decoration: none; cursor: pointer;
  border: 1.5px solid var(--acc); background: var(--accsoft); border-radius: 14px; padding: 15px;
  font: 700 14px var(--font); color: var(--acc);
}
.pos-rsticker:active { transform: scale(.99); }
.pos-rdone__btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pos-rdone__btns .pos-btn-ghost, .pos-rdone__btns .pos-btn-primary { text-decoration: none; }

/* ---- Native bridge transport gating -------------------------------------
   Which print transport is available can only be decided client-side: the
   Hotwire Native Android WebView sends a plain user agent on its HTTP
   requests, so the server cannot detect the app. The bridge JS stamps
   data-bridge-components onto <html> when the native adapter attaches, which
   is the reliable signal — and it is version-aware, so an old APK without the
   thermal-print component correctly keeps the web variant.

   Default (no native bridge): show the Web Bluetooth row, hide the native one.
   ------------------------------------------------------------------------ */
.pos-testprint-native { display: none; }

[data-bridge-components~="thermal-print"] .pos-testprint-native { display: block; }
[data-bridge-components~="thermal-print"] .pos-testprint--web   { display: none; }

/* "Printing needs the app" notice — shown by thermal_print_controller when
   neither the native bridge nor Web Bluetooth is available. */
.pos-appnotice {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}
.pos-appnotice__t { font-weight: 600; }
.pos-appnotice__b { font-size: 13px; color: var(--muted, #666); }
.pos-appnotice__cta {
  align-self: flex-start;
  margin-top: 4px;
  font-weight: 600;
  color: var(--acc, #0a7);
  text-decoration: underline;
}

/* ---- Printer picker (native bridge) ------------------------------------- */
.pos-testprint__change {
  align-self: flex-start;
  margin-top: 2px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--acc);
  text-decoration: underline;
}

.pos-devpicker .pos-sheet__panel { max-height: 70vh; }

.pos-devlist { display: flex; flex-direction: column; gap: 8px; }

.pos-devrow {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line, #e3e3e3);
  border-radius: var(--r);
  background: #fff;
  text-align: left;
}
.pos-devrow--current { border-color: var(--acc); background: var(--accsoft); }
.pos-devrow__name { font-weight: 600; }
.pos-devrow__meta { font-size: 12px; color: var(--muted, #666); }

.pos-devlist__status {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted, #666);
}

/* ---- Paper choice (preview sheet) --------------------------------------- */
.pos-paper {
  flex: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.pos-paper__opt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line, #e3e3e3);
  border-radius: var(--r);
  background: #fff;
  text-align: left;
}
.pos-paper__opt--on { border-color: var(--acc); background: var(--accsoft); }
.pos-paper__t { font-weight: 600; font-size: 14px; }
.pos-paper__b { font-size: 11px; color: var(--muted, #666); line-height: 1.3; }
