/* =====================================================================
   Stitch App — design system
   Clean monochrome: white surfaces, hairline borders, solid black for
   the active / primary state. Plain colours only — no gradients.
   ===================================================================== */

/* Urdu text only: the font downloads the first time Urdu appears on screen */
@font-face { font-family: 'Nastaliq'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(../fonts/nastaliq-arabic.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFC; }

/* ---------- tokens ---------- */
:root {
  --font: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Roboto, Arial, 'Nastaliq', sans-serif;
  --font-ur: 'Nastaliq', 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', 'Urdu Typesetting', serif;

  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --surface-3: #f5f5f5;
  --hover: #f5f5f5;
  --ink: #111111;
  --ink-2: #444444;
  --muted: #777777;
  --faint: #a3a3a3;
  --line: #e5e5e5;
  --line-strong: #d4d4d4;

  --accent: #111111;          /* primary / active */
  --accent-ink: #ffffff;      /* text on primary */
  --accent-soft: #f5f5f5;
  --accent-line: #111111;
  --accent-text: #111111;
  --focus: 0 0 0 3px rgba(17, 17, 17, .08);

  --ok: #16a34a;    --ok-soft: #dcfce7;
  --info: #1d4ed8;  --info-soft: #eff6ff;
  --warn: #c2410c;  --warn-soft: #fff7ed;
  --bad: #dc2626;   --bad-soft: #fee2e2;
  --amber: #a16207; --amber-soft: #fef9c3;
  --grey: #6b7280;  --grey-soft: #f3f4f6;

  --r-xs: 6px; --r-sm: 7px; --r: 8px; --r-lg: 10px; --r-xl: 12px;
  --sb-open: 240px; --sb-rail: 64px; --sb: var(--sb-open);
  --top: 64px;
  --gap: 16px;
  --pad: 32px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --bnav: 0px;
  --sh-pop: 0 12px 32px rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .06);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
/* optional plain accent colours (user menu) */
[data-accent="blue"]   { --accent: #1d4ed8; --accent-line: #1d4ed8; --accent-text: #1d4ed8; --accent-soft: #eff6ff; --focus: 0 0 0 3px rgba(29,78,216,.12); }
[data-accent="green"]  { --accent: #15803d; --accent-line: #15803d; --accent-text: #15803d; --accent-soft: #f0fdf4; --focus: 0 0 0 3px rgba(21,128,61,.12); }
[data-accent="maroon"] { --accent: #9f1239; --accent-line: #9f1239; --accent-text: #9f1239; --accent-soft: #fff1f2; --focus: 0 0 0 3px rgba(159,18,57,.12); }
[data-accent="teal"]   { --accent: #0f766e; --accent-line: #0f766e; --accent-text: #0f766e; --accent-soft: #f0fdfa; --focus: 0 0 0 3px rgba(15,118,110,.12); }

[data-theme="dark"] {
  --bg: #141414; --surface: #1a1a1a; --surface-2: #1d1d1d; --surface-3: #242424; --hover: #242424;
  --ink: #ffffff; --ink-2: #cccccc; --muted: #8a8a8a; --faint: #5f5f5f;
  --line: #2a2a2a; --line-strong: #3a3a3a;
  --accent: #ffffff; --accent-ink: #111111; --accent-soft: #242424; --accent-line: #ffffff; --accent-text: #ffffff;
  --focus: 0 0 0 3px rgba(255, 255, 255, .1);
  --ok: #4ade80;   --ok-soft: #052e16;
  --info: #93c5fd; --info-soft: #172554;
  --warn: #fb923c; --warn-soft: #3f1f08;
  --bad: #f87171;  --bad-soft: #3f1010;
  --amber: #facc15; --amber-soft: #3a2f05;
  --grey: #a1a1aa; --grey-soft: #27272a;
  --sh-pop: 0 12px 32px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
[data-theme="dark"][data-accent="blue"]   { --accent: #60a5fa; --accent-line: #60a5fa; --accent-text: #93c5fd; --accent-soft: #172554; --accent-ink: #0b1220; }
[data-theme="dark"][data-accent="green"]  { --accent: #4ade80; --accent-line: #4ade80; --accent-text: #86efac; --accent-soft: #052e16; --accent-ink: #052e16; }
[data-theme="dark"][data-accent="maroon"] { --accent: #fb7185; --accent-line: #fb7185; --accent-text: #fda4af; --accent-soft: #3b0a17; --accent-ink: #2a0610; }
[data-theme="dark"][data-accent="teal"]   { --accent: #2dd4bf; --accent-line: #2dd4bf; --accent-text: #5eead4; --accent-soft: #042f2e; --accent-ink: #042f2e; }

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100%; font-family: var(--font); font-size: 14px; line-height: 1.45;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums; overflow-x: hidden; transition: background-color .2s;
}
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.3; }
h1 { font-size: 18px; letter-spacing: .3px; } h2 { font-size: 15px; } h3 { font-size: 14px; } h4 { font-size: 13px; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
::selection { background: rgba(17, 17, 17, .14); }
[data-theme="dark"] ::selection { background: rgba(255, 255, 255, .22); }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #b5b5b5; border-radius: 10px; border: 3px solid var(--bg); background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #555; border-width: 2px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #555; }
::-webkit-scrollbar-track { background: transparent; }

.ic { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 14px; height: 14px; } .ic.lg { width: 21px; height: 21px; } .ic.xl { width: 30px; height: 30px; stroke-width: 1.5; }
.ur, [lang="ur"] { font-family: var(--font-ur); line-height: 1.9; }
.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.ok-t { color: var(--ok); } .bad-t { color: var(--bad); } .warn-t { color: var(--warn); } .info-t { color: var(--info); } .accent-t { color: var(--accent-text); }
.b { font-weight: 700; } .sb { font-weight: 600; }
.small { font-size: 12.5px; } .tiny { font-size: 11.5px; }
.right { text-align: right; } .center { text-align: center; }
.mono { font-family: Consolas, 'Courier New', monospace; }

/* =====================================================================
   SHELL — fills the window exactly (like OUP): side panel | main column.
   The page area scrolls inside; nothing below it is ever left empty.
   ===================================================================== */
html, body { height: 100%; }
body { overflow: hidden; }
.shell { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.shell.rail { --sb: var(--sb-rail); }

/* ---------- side panel ---------- */
.sidebar {
  position: relative; z-index: 60; flex: none; width: var(--sb); height: 100%;
  background: var(--surface); color: var(--ink); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding-left: var(--safe-l);
  transition: width .25s ease, transform .25s ease, background-color .2s;
}
.sb-brand {
  display: flex; align-items: center; gap: 12px; height: var(--top); padding: 0 18px; flex: none;
  border-bottom: 1px solid var(--line); overflow: hidden;
}
.sb-logo { width: 30px; height: 30px; border-radius: 7px; flex: none; object-fit: cover; }
.sb-mark { width: 30px; height: 30px; border-radius: 7px; flex: none; display: grid; place-items: center; background: var(--ink); color: var(--bg); }
.sb-mark .ic { width: 16px; height: 16px; }
.sb-name { min-width: 0; line-height: 1.2; transition: opacity .2s; }
.sb-name b { display: block; font-size: 15px; font-weight: 700; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-name span { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; margin-top: 2px; }
.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 0; scrollbar-width: none; }
.sb-nav::-webkit-scrollbar { display: none; }
.sb-group + .sb-group { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.sb-label { display: none; }
.sb-link {
  position: relative; display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 16px;
  border-left: 3px solid transparent; color: var(--ink-2); font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background-color .15s, color .15s; width: 100%; text-align: left;
}
.sb-link .ic { width: 17px; height: 17px; color: var(--muted); transition: color .15s; }
.sb-link:hover { background: var(--hover); color: var(--ink); }
.sb-link:hover .ic { color: var(--ink-2); }
.sb-link.active { background: var(--accent); border-left-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.sb-link.active .ic { color: var(--accent-ink); }
.sb-text { transition: opacity .2s; overflow: hidden; min-width: 0; }
.sb-count {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); transition: opacity .2s;
}
.sb-link.active .sb-count { background: var(--accent-ink); color: var(--accent); }
.sb-foot { flex: none; border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.sb-collapse { height: 50px; }
.sb-collapse .ic { transition: transform .25s ease; }
.shell.rail .sb-collapse .ic { transform: scaleX(-1); }
.shell.rail .sb-name, .shell.rail .sb-text, .shell.rail .sb-count { opacity: 0; pointer-events: none; }
/* collapsed menu: every icon sits in the exact middle, whatever the style. No scrollbar beside the icons
   (it would push them aside; the list still scrolls with the wheel), and the hidden names take no room. */
.shell.rail .sb-nav { scrollbar-width: none; }
.shell.rail .sb-nav::-webkit-scrollbar { display: none; }
.shell.rail .sb-link { justify-content: center; gap: 0; padding: 0; border-left-width: 0; }
.shell.rail .sb-text, .shell.rail .sb-count, .shell.rail .sb-name { position: absolute; width: 0; overflow: hidden; }
.shell.rail .sb-brand { justify-content: center; padding: 0; }
.nav-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .4); opacity: 0; pointer-events: none; transition: opacity .2s; }
/* parts only some screen styles show (ui.css): the gliding menu highlight, the profile card, the shop name over the title */
.sb-ind, .sb-me, .tb-crumb, .rail-tip, .ripple, .auth-side { display: none; }

/* ---------- main column ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; }
.topbar {
  flex: none; position: relative; z-index: 40; height: calc(var(--top) + var(--safe-t)); padding: var(--safe-t) var(--pad) 0;
  padding-right: calc(var(--pad) + var(--safe-r));
  display: flex; align-items: center; gap: 10px; background: var(--surface); border-bottom: 1px solid var(--line);
  transition: background-color .2s, border-color .2s;
}
.topbar .tb-menu { display: none; }
.tb-title { min-width: 0; flex: 1; }
.tb-title h1 { font-size: 18px; font-weight: 700; letter-spacing: .4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-title .sub { display: none; }
.tb-space { display: none; }
.tb-search {
  display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 6px 0 12px; min-width: 0; width: 240px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px; color: var(--muted); font-size: 13px;
  transition: border-color .15s;
}
.tb-search:hover { border-color: var(--ink); }
.tb-search span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 5px; font-size: 10.5px; font-weight: 600; white-space: nowrap; flex: none;
  background: var(--surface-3); color: var(--muted); border: 1px solid var(--line); font-family: var(--font); }
.tb-user { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 4px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2); transition: background-color .15s; flex: none; }
.tb-user:hover { background: var(--hover); }
.tb-user span:not(.avatar) { white-space: nowrap; }
/* theme button is inverted, like OUP */
.btn.tb-theme { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.tb-theme:hover { opacity: .85; background: var(--ink); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-size: 12.5px;
  background: var(--surface-3); color: var(--ink); border: 1px solid var(--line);
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }
.avatar.dark { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.avatar.soft { background: var(--surface-3); color: var(--ink-2); }

/* page area: the view scrolls inside and always fills the height */
.content { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.view {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column;
  padding: 20px var(--pad) 24px; padding-left: calc(var(--pad) + var(--safe-l)); padding-right: calc(var(--pad) + var(--safe-r));
  animation: view-in .2s ease-out;
}
@keyframes view-in { from { opacity: 0; } }
/* Settings → Screen → Animations off (also follows the computer's "reduce motion" setting) */
.no-motion *, .no-motion *::before, .no-motion *::after { animation-duration: 1ms !important; animation-delay: 0s !important; transition-duration: 1ms !important; transition-delay: 0s !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; } }
.view > * { flex-shrink: 0; }
/* the main block of a page stretches to the bottom: tables, order forms, boards, and anything marked .fill */
.view > .fill, .view > .card:has(> .tbl-wrap > table.tbl:not(.keep)), .view > .board, .view > .bf { flex-grow: 1; }
/* .fit pages (dashboard, sales counter) are exactly one screen; their lists scroll inside */
.view.fit > .fill { flex: 1 1 0; min-height: 280px; }
/* cards are columns so their body/list/table fills them — side-by-side cards always end on the same line */
.card:has(> .tbl-wrap), .card:has(> .list), .card:has(> .card-b) { display: flex; flex-direction: column; }
.card > .tbl-wrap, .card > .list, .card > .card-b:last-child, .card > .card-b:has(+ .card-f) { flex: 1 1 auto; }
.view.fit .card > .list, .view.fit .card > .tbl-wrap { flex: 1 1 0; min-height: 0; overflow-y: auto; }
.view.fit .card > .card-b:has(+ .card-f) { flex: 1 1 0; min-height: 0; overflow-y: auto; }

.loadbar { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 300; pointer-events: none; opacity: 0; transition: opacity .2s; overflow: hidden; }
.loadbar::before { content: ''; position: absolute; top: 0; left: 0; width: 35%; height: 100%; background: var(--ink); animation: loadbar 1s ease-in-out infinite; }
body.loading .loadbar { opacity: 1; transition-delay: .15s; }
@keyframes loadbar { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
/* ---------- bottom nav (phones & small tablets) ---------- */
.bnav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  padding: 6px max(6px, var(--safe-l)) calc(6px + var(--safe-b)) max(6px, var(--safe-r));
  background: var(--surface); border-top: 1px solid var(--line);
  grid-template-columns: repeat(5, 1fr); align-items: center;
}
.bnav a, .bnav button {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 0 3px; font-size: 10.5px; font-weight: 600;
  color: var(--muted); position: relative; white-space: nowrap; border-radius: 8px;
}
.bnav .ic { width: 21px; height: 21px; }
.bnav a.active { color: var(--ink); }
.bnav .fab { width: 48px; height: 48px; margin: 0 auto; border-radius: 12px; display: grid; place-items: center; padding: 0; background: var(--accent); color: var(--accent-ink); }
.bnav .fab .ic { width: 22px; height: 22px; stroke-width: 2.2; }
.bnav .fab:active { transform: scale(.95); }
.bnav-badge { position: absolute; top: 0; left: calc(50% + 5px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }

/* =====================================================================
   BUILDING BLOCKS
   ===================================================================== */
.btn {
  --h: 36px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: var(--h); padding: 0 14px; flex: none;
  border-radius: 8px; font-weight: 600; font-size: 13px; white-space: nowrap; line-height: 1;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: background-color .15s, border-color .15s, color .15s, opacity .15s; user-select: none;
}
.btn:hover { background: var(--hover); border-color: var(--line-strong); }
.btn:active { transform: translateY(.5px); }
.btn.primary, .btn.dark { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover, .btn.dark:hover { opacity: .88; background: var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.soft { background: var(--surface-3); border-color: var(--surface-3); color: var(--ink); }
.btn.soft:hover { border-color: var(--line-strong); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { opacity: .9; background: var(--bad); }
.btn.danger-soft { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn.danger-soft:hover { background: var(--bad); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.info { background: var(--info); border-color: var(--info); color: #fff; }
[data-theme="dark"] .btn.ok { color: #052e16; } [data-theme="dark"] .btn.info { color: #0b1220; } [data-theme="dark"] .btn.danger { color: #2a0606; }
.btn.ok:hover, .btn.info:hover { opacity: .9; }
.btn.sm { --h: 32px; padding: 0 11px; font-size: 12.5px; gap: 6px; }
.btn.xs { --h: 28px; padding: 0 9px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn.lg { --h: 44px; padding: 0 18px; font-size: 14px; }
.btn.xl { --h: 52px; padding: 0 22px; font-size: 15px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.icon { width: var(--h); padding: 0; }
.btn[disabled], .btn.busy { opacity: .5; pointer-events: none; }
.btn.busy::after { content: ''; width: 13px; height: 13px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; transition: background-color .2s, border-color .2s; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; min-height: 52px; border-bottom: 1px solid var(--line); }
.card-h h2, .card-h h3 { flex: 1; min-width: 0; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-h .sub { font-size: 12px; color: var(--muted); font-weight: 400; white-space: nowrap; }
.card-h:has(> .sub) > h2, .card-h:has(> .sub) > h3 { flex: 0 1 auto; }
.card-h > .sub { flex: 1; min-width: 0; }
/* an empty list/table sits in the middle of its card, never stuck at the top */
.list:has(> .empty:only-child) { justify-content: center; }
.card > .tbl-wrap:has(tr.empty-row) { display: flex; flex-direction: column; }
.card > .tbl-wrap:has(tr.empty-row) > table { flex: 1; }
.tbl tr.empty-row td { vertical-align: middle; }

/* customer list (OUP style): one full-width card per customer */
.clist { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.view.fit > .clist { overflow-y: auto; padding-right: 2px; }
.clist-sum { font-size: 13px; color: var(--muted); margin: -4px 0 12px; white-space: nowrap; overflow: hidden; }
.clist-sum b { color: var(--ink); font-weight: 700; }
.clist-sum b.bad-t { color: var(--bad); }
.clist-sum .dot-sep { margin: 0 6px; color: var(--faint); }
.code-pill.inv { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.crow {
  display: flex; align-items: center; gap: 18px; padding: 14px 20px; flex: none; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; transition: border-color .15s;
}
.crow:hover { border-color: var(--ink); }
.crow.off { opacity: .55; }
.crow > .code-pill { min-width: 64px; height: 32px; justify-content: center; font-size: 13px; flex: none; }
.crow > .avatar { width: 48px; height: 48px; font-size: 14px; }
.crow-name { flex: 1; min-width: 110px; }
.crow-name b { display: block; font-size: 16px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; }
.crow-name span { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; }
.crow-name span .ic { width: 13px; height: 13px; }
.crow-name em { font-style: normal; }
@media (max-width: 1180px) { .crow-name em { display: none; } } /* tablets: the phone keeps its room; the address is on the customer's page */
.crow-name .ic + em::before { content: '·'; margin: 0 6px 0 2px; color: var(--faint); }
.crow-stats { display: flex; align-self: stretch; align-items: center; border-left: 1px solid var(--line); padding-left: 8px; flex: none; }
.crow-stats .st { width: 104px; text-align: center; min-width: 0; }
.crow-stats .st b { display: block; font-size: 19px; font-weight: 700; line-height: 1.2; color: var(--ink); white-space: nowrap; overflow: hidden; }
.crow-stats .st span, .crow-money .mn span { display: block; font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; white-space: nowrap; }
.crow-stats .st span { margin-top: 2px; }
.crow-money { display: flex; align-self: stretch; align-items: center; gap: 28px; border-left: 1px solid var(--line); padding-left: 28px; flex: none; }
.crow-money .mn { text-align: right; width: 122px; min-width: 0; }
.crow-money .mn span { margin-bottom: 3px; }
.crow-money .mn b { display: block; font-size: 15.5px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; }
.crow-money .mn b.bad-t { color: var(--bad); } .crow-money .mn b.ok-t { color: var(--ok); }
.crow-money .mn b.clear { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.crow .chev { color: var(--faint); flex: none; display: grid; }
@media (max-width: 1280px) {
  .crow { gap: 14px; padding: 14px 16px; }
  .crow-stats .st { width: 92px; }
  .crow-money { gap: 18px; padding-left: 18px; }
  .crow-money .mn { width: 110px; }
}
@media (max-width: 900px) { .crow-stats .st:nth-child(3) { display: none; } .crow > .avatar { display: none; } }
@media (max-width: 640px) {
  .crow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "code name chev" "stats stats stats" "money money money"; gap: 10px 12px; padding: 12px 14px; }
  .crow > .code-pill { grid-area: code; min-width: 44px; height: 28px; }
  .crow-name { grid-area: name; min-width: 0; }
  .crow .chev { grid-area: chev; }
  .crow-stats { grid-area: stats; border-left: 0; padding: 10px 0 0; border-top: 1px solid var(--line); }
  .crow-stats .st, .crow-stats .st:nth-child(3) { display: block; flex: 1; width: auto; }
  .crow-money { grid-area: money; border-left: 0; padding: 0; gap: 12px; }
  .crow-money .mn { flex: 1; width: auto; text-align: left; }
  .crow-money .mn b.clear { justify-content: flex-start; }
  .clist-sum { white-space: normal; }
}
/* page numbers pinned to the bottom of one-screen list pages, like OUP */
.view.fit > #pager { margin: 12px calc(var(--pad) * -1) -24px; padding: 0 var(--pad); border-top: 1px solid var(--line); background: var(--bg); }
.view.fit > #pager .pager { padding: 12px 0; }
@media (max-width: 900px) { .view.fit > #pager { margin: 12px 0 0; padding: 0; border-top: 0; background: none; } }

/* dashboard */
.dash-live { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; padding-left: 10px; }
.dash-live span { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.dash-live b { font-size: 15px; font-weight: 700; white-space: nowrap; }
.dash-lists { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }

/* ---------- dashboard donuts ----------
   Chart colours: five categorical slots + "Other", stepped separately for light and dark and checked with the
   data-viz validator (colour-blind separation, lightness band) for rings of 3–6 parts. Values are always written
   in the legend, so the paler light-mode slots never carry meaning alone. */
:root { --viz-1: #2a78d6; --viz-2: #eb6834; --viz-3: #1baf7a; --viz-4: #eda100; --viz-5: #e87ba4; --viz-other: #b8b7b0; --viz-track: #efefef; }
[data-theme="dark"] { --viz-1: #3987e5; --viz-2: #d95926; --viz-3: #199e70; --viz-4: #c98500; --viz-5: #d55181; --viz-other: #5c5b57; --viz-track: #262626; }
.dash-donuts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); margin-bottom: var(--gap); flex-shrink: 0; }
.dash-donuts:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dn-card { container: dn / inline-size; min-width: 0; }
.dn-card .card-h { min-height: 44px; padding-top: 11px; padding-bottom: 11px; }
.dn { display: flex; align-items: center; gap: 16px; padding: 14px 16px; }
.dn-ring { position: relative; width: 112px; height: 112px; flex: none; }
.dn-ring svg { display: block; width: 100%; height: 100%; overflow: visible; }
.dn-track { fill: none; stroke: var(--viz-track); }
.dn-seg { fill: none; transition: opacity .15s; }
.dn-hit { fill: none; stroke: transparent; stroke-width: 26px; cursor: pointer; outline: none; }
.dn-hit:focus-visible { stroke: var(--line-strong, var(--line)); stroke-opacity: .5; }
.dn.hl .dn-seg:not(.on) { opacity: .28; }
.dn.hl .dn-row:not(.on) { opacity: .45; }
.dn-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; line-height: 1.15; }
.dn-center b { font-size: 17px; font-weight: 700; color: var(--ink); }
.dn-center b small { font-size: 10.5px; font-weight: 600; color: var(--muted); margin-right: 2px; }
.dn-center span { font-size: 11px; color: var(--muted); margin-top: 1px; }
.dn-legend { flex: 1; min-width: 0; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.dn-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 38px; align-items: center; gap: 8px; font-size: 12.5px; padding: 2px 0; transition: opacity .15s; }
.dn-sw { width: 10px; height: 10px; border-radius: 3px; }
.dn-row .nm { color: var(--ink-2, var(--ink)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dn-row .vl { font-weight: 650; color: var(--ink); white-space: nowrap; text-align: right; }
.dn-row .sh { color: var(--muted); text-align: right; white-space: nowrap; font-size: 11.5px; }
.dn-none { color: var(--muted); font-size: 12.5px; }
/* narrow card: the ring sits above its legend */
@container dn (max-width: 380px) {
  .dn { flex-direction: column; align-items: stretch; gap: 12px; }
  .dn-ring { align-self: center; }
}
.viz-tip { position: fixed; z-index: 400; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .12); display: flex; flex-direction: column; gap: 2px; font-size: 12px; white-space: nowrap; }
.viz-tip b { font-size: 14px; font-weight: 700; color: var(--ink); }
.viz-tip .tl { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.viz-tip .tl i { width: 12px; height: 2px; border-radius: 1px; display: inline-block; }
@media (max-width: 1280px) { .dash-donuts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .dash-donuts, .dash-donuts:has(> :nth-child(2):last-child) { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) { .dash-lists { grid-template-columns: minmax(0, 1fr) !important; } .dash-live { display: none; } }
/* three lists side by side on a small laptop or tablet: names and numbers get the room (the Naap No. and phone are on the booking) */
.dash-lists .li .grow > span > i.dl-more { font-style: normal; }
@media (min-width: 901px) and (max-width: 1440px) { .dash-lists .li > .code-pill, .dash-lists .li i.dl-more { display: none; } }
@media (max-width: 600px) { .dash-lists .li i.dl-more { display: none; } }
.card-b { padding: 16px; }
.card-f { padding: 12px 16px; border-top: 1px solid var(--line); }
.card.pad { padding: 16px; }
.card.flat { background: var(--surface-2); }
.card.hover { transition: border-color .15s; cursor: pointer; }
.card.hover:hover { border-color: var(--ink); }
.card > .list:first-child, .card > .tbl-wrap:first-child { border-radius: var(--r-lg); }
.card-h + .list .li:first-child { border-top: 0; }
.stitch { position: relative; }
.divider { height: 0; border-top: 1px solid var(--line); margin: 12px 0; }

.grid { display: grid; gap: var(--gap); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.stack.sm { gap: 8px; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: var(--gap); } .mt-s { margin-top: 8px; } .mb { margin-bottom: var(--gap); }

/* ---------- page toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: var(--gap); min-width: 0; }
.toolbar .search { flex: 1 1 260px; max-width: 380px; }
.toolbar .tb-end { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar .sel.sm { width: auto; min-width: 150px; }
.toolbar > .sel { width: auto; flex: 0 1 230px; min-width: 170px; }

/* ---------- stat cards (figures shrink with the card, never wrap) ---------- */
/* the grid counts its cards so every row is full: 6 → 6 (3+3 on smaller screens), 5 → 5, 4 → 4 … 2 per row on phones */
.stats { --n: 4; display: grid; gap: 12px; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
.stats:has(> :nth-child(1):last-child) { --n: 1; }
.stats:has(> :nth-child(2):last-child) { --n: 2; }
.stats:has(> :nth-child(3):last-child) { --n: 3; }
.stats:has(> :nth-child(5):last-child) { --n: 5; }
.stats:has(> :nth-child(6):last-child) { --n: 6; }
.stats:has(> :nth-child(7):last-child) { --n: 4; }
.stats:has(> :nth-child(8):last-child) { --n: 4; }
.stats:has(> :nth-child(9):last-child) { --n: 3; }
.stats:has(> :nth-child(10):last-child) { --n: 5; }
.stats:has(> :nth-child(12):last-child) { --n: 6; }
@media (max-width: 900px) { .stats:has(> :nth-child(6):last-child), .stats:has(> :nth-child(12):last-child) { --n: 3; } }
.stat {
  container-type: inline-size; position: relative; min-width: 0; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 16px 13px;
  transition: border-color .15s, background-color .2s; display: flex; flex-direction: column;
}
a.stat:hover, button.stat:hover { border-color: var(--ink); }
.stat .lbl { order: 1; display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.stat .lbl .dot { display: none; }
.stat .ico { order: 0; position: absolute; top: 12px; right: 14px; color: var(--faint); }
.stat .ico .ic { width: 15px; height: 15px; }
.stat .ico ~ .lbl { padding-right: 22px; }
.stat .v { order: 2; margin-top: 6px; font-size: clamp(15px, 11cqi, 22px); font-weight: 700; white-space: nowrap; line-height: 1.2; overflow: hidden; text-overflow: clip; color: var(--ink); }
.stat .v small { font-size: .62em; font-weight: 600; color: var(--muted); margin-right: 4px; }
.stat .foot { order: 3; margin-top: 3px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.t-bad .v { color: var(--bad); }
.stat.t-ok .v.ok-t, .stat .v.ok-t { color: var(--ok); }
.stat.t-bad .ico { color: var(--bad); }
.stat.active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

/* ---------- badges & chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 11px; font-weight: 700;
  white-space: nowrap; background: var(--grey-soft); color: var(--grey); line-height: 1; flex: none; vertical-align: middle;
}
.badge:empty { display: none; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge .ic { width: 12px; height: 12px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.accent { background: var(--surface-3); color: var(--ink); }
.badge.solid-bad { background: var(--bad); color: #fff; }
.badge.solid-dark { background: var(--ink); color: var(--bg); }
.badge.lg { height: 26px; padding: 0 12px; font-size: 12px; }
.badge.outline { background: transparent; border: 1px solid var(--line); color: var(--ink-2); }
.st-pending { background: var(--warn-soft); color: var(--warn); }
.st-complete { background: var(--info-soft); color: var(--info); }
.st-delivered { background: var(--ok-soft); color: var(--ok); }
.st-cancelled { background: var(--grey-soft); color: var(--grey); }
.pulse .dot { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 15px; border-radius: 16px; font-size: 12.5px; font-weight: 500;
  border: 1px solid var(--line); background: transparent; color: var(--ink-2); white-space: nowrap; transition: background-color .15s, color .15s, border-color .15s;
}
.chip:hover { background: var(--hover); }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip .ic { width: 13px; height: 13px; }
/* laptops: filter chips and the page's buttons share one row instead of wrapping onto two */
@media (max-width: 1440px) { .toolbar > .chips { gap: 6px; } .toolbar > .chips .chip { padding: 0 12px; } }
.chip .cnt { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 9px; background: var(--surface-3); color: var(--muted); }
.chip.on .cnt { background: rgba(255, 255, 255, .18); color: inherit; }
[data-theme="dark"] .chip.on .cnt { background: rgba(0, 0, 0, .12); }
.chips.scroll { flex-wrap: wrap; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: 9px; max-width: 100%; flex-wrap: wrap; }
.seg button { height: 30px; padding: 0 11px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; transition: background-color .15s, color .15s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
[data-theme="dark"] .seg button.on { background: var(--line-strong); }
.seg button .badge { height: 18px; padding: 0 6px; font-size: 10.5px; }
.seg.block { display: flex; } .seg.block button { flex: 1; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .lbl-t { font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field > label small { color: var(--faint); font-weight: 400; }
.field .hint { font-size: 11.5px; color: var(--muted); }
.field .err { font-size: 12px; color: var(--bad); }
.inp, .sel, .txt {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  font-size: 13.5px; color: var(--ink); transition: border-color .15s, background-color .2s; min-width: 0; outline: none;
}
.txt { height: auto; min-height: 72px; padding: 9px 12px; resize: vertical; line-height: 1.5; }
.inp:hover, .sel:hover, .txt:hover { border-color: var(--line-strong); }
.inp:focus, .sel:focus, .txt:focus { border-color: var(--ink); }
.inp::placeholder, .txt::placeholder { color: var(--faint); }
.inp[readonly] { background: var(--surface-2); }
.inp.lg { height: 46px; font-size: 17px; font-weight: 600; }
.inp.money { text-align: right; font-weight: 700; }
.inp.sm, .sel.sm { height: 32px; font-size: 12.5px; }
.sel { appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238a8f98' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center / 10px 7px; }
.inp-wrap { position: relative; display: flex; align-items: center; min-width: 0; }
.inp-wrap > .ic { position: absolute; left: 12px; color: var(--muted); pointer-events: none; width: 15px; height: 15px; }
.inp-wrap > .inp { padding-left: 36px; }
/* a box that takes a barcode scanner: the barcode symbol, a little stronger than a plain search icon */
.inp-wrap.scan > .ic { color: var(--ink-2); width: 17px; height: 17px; left: 11px; }
.inp-wrap.scan > .inp { padding-left: 37px; }
.inp-wrap > .pre { position: absolute; left: 12px; font-weight: 600; font-size: 12.5px; color: var(--muted); pointer-events: none; }
.inp-wrap > .pre ~ .inp { padding-left: 38px; }
.inp-wrap > .end { position: absolute; right: 6px; }
.inp-wrap .clear-x { position: absolute; right: 7px; width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; color: var(--muted); }
.inp-wrap .clear-x:hover { background: var(--hover); color: var(--ink); }
.form-grid { display: grid; gap: 14px 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.form-grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 500; font-size: 13.5px; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--ink); margin: 0; }
.switch { appearance: none; -webkit-appearance: none; width: 38px; height: 22px; border-radius: 11px; background: var(--line-strong); position: relative; cursor: pointer; transition: background-color .2s; flex: none; margin: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s ease; }
.switch:checked { background: var(--ink); }
[data-theme="dark"] .switch:checked::after { background: #111; }
.switch:checked::after { transform: translateX(16px); }
.set-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row .t { flex: 1; min-width: 0; }
.set-row .t b { display: block; font-size: 13.5px; font-weight: 600; }
.set-row .t span { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }

/* option pills (measurement styles, payment method …) */
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opt {
  position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 3px 13px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); font-weight: 500; font-size: 13px; color: var(--ink-2); transition: background-color .15s, border-color .15s, color .15s; user-select: none;
}
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt:hover { border-color: var(--ink); }
.opt:has(input:checked) { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.opt:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }

.choice-cards { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.choice-card {
  display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; transition: border-color .15s, background-color .15s; min-width: 0; position: relative;
}
.choice-card input { position: absolute; opacity: 0; }
.choice-card .ic { color: var(--muted); }
.choice-card b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.choice-card span { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.choice-card:hover { border-color: var(--line-strong); }
.choice-card:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.choice-card:has(input:checked) .ic { color: var(--ink); }

/* =====================================================================
   TABLES — never scroll sideways. Optional columns hide as the table
   narrows, and rows turn into cards when the space is small.
   ===================================================================== */
.tbl-wrap { container: tbl / inline-size; min-width: 0; overflow: hidden; border-radius: inherit; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px;
  padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface);
}
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; color: var(--ink-2); }
.tbl td:first-child, .tbl th:first-child { padding-left: 16px; }
.tbl td:last-child, .tbl th:last-child { padding-right: 16px; text-align: right; }
.tbl tbody tr { transition: background-color .12s; }
.tbl tbody tr:hover { background: var(--hover); }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .r, .tbl th.r { text-align: right; }
.tbl .c, .tbl th.c { text-align: center; }
/* the one flexible column: shrinks with an ellipsis so the table always fits */
.tbl td.wide, .tbl td.fill { max-width: 0; width: 30%; overflow: hidden; text-overflow: ellipsis; }
.tbl td.wrap { white-space: normal; overflow-wrap: anywhere; text-overflow: clip; } /* long names wrap instead of being cut */
.cell-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; } /* badges under a name, always on their own line */
.tbl td.actions { text-align: right; width: 1%; }
.tbl td.actions .btn-row { justify-content: flex-end; flex-wrap: nowrap; }
.tbl tfoot td { font-weight: 700; color: var(--ink); border-top: 1px solid var(--line); border-bottom: 0; background: var(--surface-2); }
.tbl tr.flash td { animation: flash 1s ease-out; }
@keyframes flash { from { background: var(--surface-3); } }
.tbl b { color: var(--ink); font-weight: 600; }
.tbl .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tbl .who > div { min-width: 0; }
.tbl .who > div > b { display: block; overflow: hidden; text-overflow: ellipsis; font-weight: 600; color: var(--ink); }
.tbl .who > div > span { display: block; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.tbl tr.muted-row td { opacity: .5; }
.tbl td .tiny { margin-top: 2px; }
.code-pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--surface-3); color: var(--ink); font-weight: 700; font-size: 12px; font-family: Consolas, 'Courier New', monospace; white-space: nowrap; border: 1px solid var(--line); }
@container tbl (max-width: 1080px) { .tbl .hide-md { display: none; } }
@container tbl (max-width: 860px) { .tbl .hide-sm { display: none; } }
/* a column that gives way on a tablet (its short form shows inside another cell: .show-w) */
.tbl .show-w { display: none; }
@container tbl (max-width: 1000px) { .tbl .hide-w { display: none; } .tbl .show-w { display: block; } }
/* narrow space → each row becomes a compact card */
@container tbl (max-width: 700px) {
  table.tbl:not(.keep), table.tbl:not(.keep) > tbody, table.tbl:not(.keep) > tfoot { display: block; width: 100%; }
  table.tbl:not(.keep) > thead { display: none; }
  table.tbl:not(.keep) > tbody > tr, table.tbl:not(.keep) > tfoot > tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; padding: 12px 16px; border-bottom: 1px solid var(--line);
  }
  table.tbl:not(.keep) > tbody > tr:last-child { border-bottom: 0; }
  table.tbl:not(.keep) td {
    display: flex; flex-direction: column; gap: 1px; padding: 0 !important; border: 0; min-width: 0; max-width: none; width: auto;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left !important; font-size: 13px;
  }
  table.tbl:not(.keep) td > .badge, table.tbl:not(.keep) td > .code-pill, table.tbl:not(.keep) td > .btn { align-self: flex-start; }
  table.tbl:not(.keep) td.r > .badge { align-self: flex-start; }
  table.tbl:not(.keep) td::before { content: attr(data-label); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  table.tbl:not(.keep) td[data-label=""]::before, table.tbl:not(.keep) td:not([data-label])::before { display: none; }
  table.tbl:not(.keep) td:first-child { grid-column: 1 / -1; font-size: 14px; }
  table.tbl:not(.keep) td:first-child::before { display: none; }
  table.tbl:not(.keep) td.wide, table.tbl:not(.keep) td.fill { grid-column: 1 / -1; }
  table.tbl:not(.keep) td.actions { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; }
  table.tbl:not(.keep) td.actions::before { display: none; }
  table.tbl:not(.keep) td.actions .btn-row { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  table.tbl:not(.keep) td:empty, table.tbl:not(.keep) td.hide-m { display: none; }
  table.tbl:not(.keep) .hide-md, table.tbl:not(.keep) .hide-sm, table.tbl:not(.keep) .hide-w { display: flex; }
  table.tbl:not(.keep) .show-w { display: none; }
  table.tbl:not(.keep) tr.empty-row { display: block; }
  table.tbl:not(.keep) tr.empty-row td { display: block; white-space: normal; overflow: visible; }
  table.tbl:not(.keep) tr.empty-row td * { white-space: normal; }
}

/* ---------- pager ---------- */
.pager { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; padding: 14px 2px 0; font-size: 12px; color: var(--muted); }
.pager .pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pager .pages button { min-width: 30px; height: 30px; padding: 0 10px; border-radius: 7px; font-size: 12px; font-weight: 500; color: var(--ink-2); border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.pager .info b { color: var(--ink-2); font-weight: 600; }
@media (max-width: 560px) { .pager .pages .pg-step span { display: none; } }
.pager .pages button:hover { background: var(--hover); }
.pager .pages button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.pager .pages button[disabled] { opacity: .35; pointer-events: none; }

/* ---------- empty / loading ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
/* list cards (Day Book): a fixed height, the list scrolls inside under its column names; an empty one shows its
   message in the middle — so cards side by side stay short and end on the same line */
.card.db-list { max-height: 400px; }
.card.db-list > .card-h { flex: none; height: 52px; min-height: 0; padding-top: 0; padding-bottom: 0; } /* with or without a small button, every heading is the same height */
.card.db-list > .tbl-wrap { flex: 1 1 auto; min-height: 0; overflow-y: auto; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card.db-list .tbl thead th { position: sticky; top: 0; z-index: 1; }
.card.db-list > .card-b:has(> .empty) { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; }
.card.db-list .empty { padding: 24px 20px; }
.card.db-list .tbl .who > div > b, .card.db-list .tbl .who > div > span { white-space: normal; overflow-wrap: anywhere; } /* names wrap, never cut */
.empty .art { width: 48px; height: 48px; margin: 0 auto 12px; color: var(--faint); display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; }
.empty .art .ic { width: 22px; height: 22px; }
.empty h3 { color: var(--ink); font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.empty p { font-size: 12.5px; max-width: 340px; margin: 0 auto; }
.empty .btn { margin-top: 14px; }
.skel { position: relative; overflow: hidden; background: var(--surface-3); border-radius: 8px; }
.skel::after { content: ''; position: absolute; inset: 0; background: var(--surface-2); opacity: .7; animation: skel 1.2s ease-in-out infinite; }
@keyframes skel { 0%, 100% { opacity: 0; } 50% { opacity: .7; } }
.skel-line { height: 12px; margin: 8px 0; }
.skel-stat { height: 86px; border-radius: var(--r-lg); }
.skel-row { height: 44px; margin: 6px 0; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); min-width: 0; transition: background-color .12s; }
.li:first-child { border-top: 0; }
a.li:hover, button.li:hover, .li.click:hover { background: var(--hover); cursor: pointer; }
button.li { width: 100%; text-align: left; }
.li .grow > b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .grow > span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.held-list .li .grow > span { white-space: normal; } /* held bills: time and who held it wrap, never cut */
.li .end { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.li .end > b { display: block; font-size: 13.5px; white-space: nowrap; }
.li .end > span:not(.badge) { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
/* Naap No. boxes line up whatever the number of digits */
.li > .code-pill, .tbl .who > .code-pill, .mh > .code-pill { min-width: 38px; justify-content: center; flex: none; }
.li-ico { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--ink-2); }
.li-ico .ic { width: 16px; height: 16px; }
.li-ico.ok { background: var(--ok-soft); color: var(--ok); } .li-ico.bad { background: var(--bad-soft); color: var(--bad); }
.li-ico.warn { background: var(--warn-soft); color: var(--warn); } .li-ico.info { background: var(--info-soft); color: var(--info); }
.li-ico.accent { background: var(--surface-3); color: var(--ink); }
.stagger > * { animation: rise .3s ease-out both; animation-delay: calc(var(--i, 0) * 25ms); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* key / value rows */
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px 0; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); white-space: nowrap; padding-right: 16px; }
.kv dd { margin: 0; text-align: right; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl td > .ic, .li .grow b > .ic { display: inline-block; vertical-align: -2px; margin-right: 6px; color: var(--muted); }
.kv.mt { margin-top: var(--gap); } .kv.mt-s { margin-top: 8px; }
.kv .total { font-size: 15px; font-weight: 700; padding-top: 9px; border-top: 1px solid var(--line); color: var(--ink); }

/* summary boxes */
.sumbox { --n: 4; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 8px; }
.sumbox:has(> :nth-child(1):last-child) { --n: 1; }
.sumbox:has(> :nth-child(2):last-child) { --n: 2; }
.sumbox:has(> :nth-child(3):last-child) { --n: 3; }
.sumbox:has(> :nth-child(5):last-child) { --n: 5; }
.sumbox:has(> :nth-child(6):last-child) { --n: 3; }
@media (max-width: 640px) {
  .sumbox:has(> :nth-child(4)) { --n: 2; }
  .sumbox:has(> :nth-child(4)) > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
/* a sumbox in a narrow card (a half-width card on a tablet) goes to two columns, so its labels are never cut */
.card-b:has(> .sumbox), .card > .sumbox { container: sb / inline-size; }
@container sb (max-width: 520px) {
  .sumbox:has(> :nth-child(4)) { --n: 2; }
  .sumbox:has(> :nth-child(4)) > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
.sumbox .tiny { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sumbox > div { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-width: 0; container-type: inline-size; }
.sumbox .l { font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sumbox .v { font-size: clamp(13px, 12cqi, 18px); font-weight: 700; white-space: nowrap; margin-top: 3px; color: var(--ink); }
.sumbox .v.bad-t { color: var(--bad); } .sumbox .v.ok-t { color: var(--ok); }
.sumbox .v small { font-size: .65em; color: var(--muted); font-weight: 600; margin-right: 3px; }
/* Labour & Staff: the "how it works" line, and Count slips — one compact row per naap slip, its pay typed in the row */
.lab-how { display: flex; align-items: flex-start; gap: 7px; } .lab-how .ic { flex: none; margin-top: 2px; }
.cs-list { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.cs-line { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 12px; border-top: 1px solid var(--line); }
.cs-line:first-child { border-top: 0; }
.cs-n { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--surface-3); color: var(--ink-2); }
.cs-who { flex: 1; min-width: 0; line-height: 1.3; }
.cs-who b { display: block; font-size: 13.5px; }
.cs-who span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-who span.warn-t { color: var(--warn-text, #b54708); white-space: normal; }
.cs-suits { flex: none; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.cs-amt { flex: none; width: 124px; }
.cs-amt .inp { height: 34px; text-align: right; }
.cs-empty { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 18px; color: var(--muted); font-size: 13px; }
@media (max-width: 640px) { .cs-line { flex-wrap: wrap; } .cs-who { flex-basis: calc(100% - 32px); } .cs-suits { margin-left: 32px; } .cs-amt { margin-left: auto; } }

/* history timeline */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; border-left: 1px solid var(--line-strong); }
.tl-item { position: relative; padding: 0 0 13px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ''; position: absolute; left: -19px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--faint); }
.tl-item.ok::before { border-color: var(--ok); background: var(--ok); } .tl-item.info::before { border-color: var(--info); background: var(--info); }
.tl-item.warn::before { border-color: var(--warn); } .tl-item.bad::before { border-color: var(--bad); background: var(--bad); }
.tl-item b { font-size: 13px; font-weight: 600; } .tl-item span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }

/* status steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); }
.step { position: relative; text-align: center; font-size: 11.5px; font-weight: 600; color: var(--muted); padding-top: 24px; white-space: nowrap; }
.step::before { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); z-index: 1; }
.step::after { content: ''; position: absolute; top: 7px; left: calc(-50% + 10px); right: calc(50% + 10px); height: 2px; background: var(--line); }
.step:first-child::after { display: none; }
.step.done { color: var(--ink); }
.step.done::before { background: var(--ink); border-color: var(--ink); }
.step.done::after { background: var(--ink); }
.step.now::before { box-shadow: 0 0 0 4px var(--surface-3); }

/* bar chart (pure CSS) */
.bars { display: flex; align-items: flex-end; gap: 5px; height: 160px; padding-top: 8px; border-bottom: 1px solid var(--line); }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; min-width: 0; position: relative; }
.bars .bar .cols { display: flex; gap: 2px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.bars .bar i { display: block; width: min(12px, 40%); border-radius: 3px 3px 0 0; background: var(--line-strong); transform-origin: bottom; animation: grow .5s ease-out both; animation-delay: calc(var(--i, 0) * 15ms); min-height: 1px; }
.bars .bar i.a { background: var(--ink); }
.bars .bar i.b { background: var(--faint); }
.bars .bar .tip { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 6px 9px; border-radius: 6px; font-size: 11.5px; line-height: 1.5; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 2; }
.bars .bar:hover .tip { opacity: 1; }
.bars .bar.tl .tip { left: 0; transform: none; } /* edge bars: the tip opens inwards, never past the card */
.bars .bar.tr .tip { left: auto; right: 0; transform: none; }
.bars-x { display: flex; gap: 5px; margin-top: 6px; }
.bars-x span { flex: 1; text-align: center; font-size: 10.5px; color: var(--muted); white-space: nowrap; min-width: 0; }
@keyframes grow { from { transform: scaleY(0); } }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

.meter { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--ink); transition: width .4s ease; }

/* =====================================================================
   OVERLAYS — side panel / bottom sheet, dialog, toast, menu, search
   ===================================================================== */
.layer { position: fixed; inset: 0; z-index: 100; }
.layer .backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .35); animation: fade .2s ease-out; }
.layer.closing .backdrop { animation: fade .2s ease-in reverse forwards; }
@keyframes fade { from { opacity: 0; } }

.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--line); animation: slide-in .3s ease; padding-right: var(--safe-r);
}
.drawer.sm { width: min(420px, 100vw); } .drawer.lg { width: min(680px, 100vw); } .drawer.xl { width: min(980px, 100vw); }
.layer.closing .drawer { animation: slide-out .22s ease-in forwards; }
@keyframes slide-in { from { transform: translateX(100%); } }
@keyframes slide-out { to { transform: translateX(100%); } }
.dr-head { display: flex; align-items: center; gap: 12px; padding: calc(16px + var(--safe-t)) 20px 15px; border-bottom: 1px solid var(--line); flex: none; }
.dr-head .t { flex: 1; min-width: 0; }
.dr-head h2 { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dr-head .sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.dr-body { flex: 1; overflow-y: auto; padding: 20px; overscroll-behavior: contain; }
.dr-foot { flex: none; display: flex; gap: 8px; align-items: center; padding: 14px 20px calc(14px + var(--safe-b)); border-top: 1px solid var(--line); flex-wrap: wrap; }
.dr-foot .spacer { flex: 1; }
.dr-error { margin: 0 0 16px; padding: 10px 12px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); font-weight: 600; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.dr-note { margin: 0 0 16px; padding: 10px 12px; border-radius: 8px; background: var(--surface-3); color: var(--ink-2); font-size: 13px; display: flex; gap: 8px; align-items: center; }
.handle { display: none; }
.sec { margin-bottom: 20px; }
.sec:last-child { margin-bottom: 0; }
.sec-t { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 10px; }

.modal {
  position: absolute; left: 50%; top: 50%; width: min(400px, calc(100vw - 28px)); transform: translate(-50%, -50%);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh-pop); animation: pop .2s ease-out; overflow: hidden;
  max-height: calc(100dvh - 40px); display: flex; flex-direction: column;
}
.modal.wide { width: min(620px, calc(100vw - 28px)); }
.layer.closing .modal { animation: fade .15s ease-in reverse forwards; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -48%); } }
.modal-b { padding: 24px 24px 8px; overflow-y: auto; }
.modal-b h2 { font-size: 17px; margin-bottom: 6px; }
.modal-b p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.modal-ico { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 14px; background: var(--surface-3); color: var(--ink); }
.modal-ico.bad { background: var(--bad-soft); color: var(--bad); }
.modal-ico.ok { background: var(--ok-soft); color: var(--ok); }
.modal-f { display: flex; gap: 8px; padding: 16px 24px 22px; }
.modal-f .btn { flex: 1; }

/* PIN pad */
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 20px 0 8px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); transition: background-color .12s, border-color .12s; }
.pin-dots i.on { background: var(--ink); border-color: var(--ink); }
.pin-dots.bad i { border-color: var(--bad); background: var(--bad); }
.pin-dots.bad { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.pin-msg { text-align: center; font-size: 12.5px; min-height: 19px; color: var(--muted); font-weight: 600; }
.pin-msg.bad { color: var(--bad); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px auto 4px; max-width: 290px; }
.pin-pad button { height: 54px; border-radius: 10px; font-size: 21px; font-weight: 600; background: var(--surface); border: 1px solid var(--line); transition: background-color .1s; }
.pin-pad button:hover { background: var(--hover); }
.pin-pad button:active { background: var(--surface-3); }
.pin-pad button.fn { font-size: 13px; color: var(--muted); border-color: transparent; }

/* toasts */
.toasts { position: fixed; z-index: 400; right: max(18px, var(--safe-r)); bottom: calc(18px + var(--bnav) + var(--safe-b)); display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; min-height: 42px; max-width: min(420px, calc(100vw - 32px)); padding: 10px 14px 10px 12px;
  border-radius: 9px; background: #111; color: #fff; box-shadow: var(--sh-pop); font-size: 13px; font-weight: 500; animation: toast-in .25s ease-out;
}
[data-theme="dark"] .toast { background: #fff; color: #111; }
.toast .t-ico { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex: none; background: rgba(255, 255, 255, .16); }
.toast .t-ico .ic { width: 12px; height: 12px; stroke-width: 2.4; }
.toast.ok .t-ico { background: #16a34a; color: #fff; } .toast.bad .t-ico { background: #dc2626; color: #fff; } .toast.warn .t-ico { background: #c2410c; color: #fff; }
.toast.out { animation: toast-out .2s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* cookie notice (ui/templates/_cookies.php): bottom centre, asked once on each computer; under pop-ups and drawers */
.ck {
  position: fixed; z-index: 90; left: 50%; bottom: calc(18px + var(--bnav) + var(--safe-b)); width: max-content; max-width: calc(100vw - 24px);
  padding: 8px 8px 8px 14px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--sh-pop);
  opacity: 0; transform: translate(-50%, 14px); transition: opacity .2s ease, transform .25s ease;
}
.ck.in { opacity: 1; transform: translate(-50%, 0); }
.ck[hidden] { display: none; }
.auth ~ .ck { bottom: calc(18px + var(--safe-b)); }
body:has(.auth ~ .ck:not([hidden])) .auth { padding-bottom: calc(96px + var(--safe-b)); } /* the sign-in box stays clear of the notice */
.ck-row { display: flex; align-items: center; gap: 10px; }
.ck-ic { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2, var(--hover)); color: var(--ink); }
.ck-t { font-size: 14px; font-weight: 500; white-space: nowrap; margin-right: 4px; }
.ck-link { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.ck-link:hover { color: var(--ink); }
.ck .btn { flex: none; min-width: 84px; }
.ck-more { max-width: 460px; margin: 4px 6px 10px 0; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.ck-more > b { display: block; font-size: 13.5px; }
.ck-more ul { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 7px; }
.ck-more li { display: flex; align-items: flex-start; gap: 8px; line-height: 1.45; color: var(--ink-2, var(--ink)); }
.ck-more li .ic { flex: none; margin-top: 2px; color: var(--muted); }
.ck-more small { color: var(--muted); font-size: 12px; }
/* phones: the words on one line, the two buttons side by side under them */
@media (max-width: 560px) {
  .ck { width: calc(100vw - 24px); padding: 12px; }
  .ck-row { flex-wrap: wrap; }
  .ck-t { flex: 1 1 calc(100% - 46px); white-space: normal; }
  .ck .btn { flex: 1 1 0; }
  .ck-more { max-width: none; margin-right: 0; }
}
@media print { .ck { display: none !important; } }

/* menus */
.pop { position: fixed; z-index: 120; min-width: 210px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--sh-pop); padding: 5px; animation: fade .12s ease-out; }
.pop .mi { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 10px; border-radius: 7px; font-size: 13px; font-weight: 500; text-align: left; white-space: nowrap; color: var(--ink); }
.pop .mi:hover { background: var(--hover); }
.pop .mi .ic { color: var(--muted); width: 15px; height: 15px; }
.pop .mi.danger { color: var(--bad); } .pop .mi.danger .ic { color: var(--bad); }
.pop .sep { height: 1px; background: var(--line); margin: 5px 0; }
.pop .head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 5px; }
.pop .head b { display: block; font-size: 13.5px; } .pop .head span { font-size: 12px; color: var(--muted); }
.swatches { display: flex; gap: 8px; padding: 8px 10px; flex-wrap: wrap; }
.swatches button { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); }
.swatches button.on { box-shadow: 0 0 0 2px var(--ink); }

/* global search */
.palette { position: absolute; left: 50%; top: max(10vh, 20px); transform: translateX(-50%); width: min(620px, calc(100vw - 24px)); background: var(--surface); border-radius: 12px; box-shadow: var(--sh-pop); overflow: hidden; animation: fade .15s ease-out; border: 1px solid var(--line); }
.layer.closing .palette { animation: fade .12s reverse forwards; }
.palette .p-in { display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.palette .p-in input { flex: 1; height: 54px; border: 0; background: transparent; font-size: 15px; outline: none; min-width: 0; color: var(--ink); }
.palette .p-res { max-height: min(60vh, 440px); overflow-y: auto; padding: 6px; }
.palette .p-grp { font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--faint); padding: 10px 10px 4px; }
.palette .p-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; cursor: pointer; min-width: 0; }
.palette .p-item.on { background: var(--hover); }
.palette .p-item .grow b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette .p-item .grow span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette .p-foot { display: flex; gap: 14px; padding: 9px 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }

/* search-as-you-type list */
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--sh-pop); padding: 4px; max-height: 320px; overflow-y: auto; }
.suggest .s-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; cursor: pointer; min-width: 0; }
.suggest .s-item.on, .suggest .s-item:hover { background: var(--hover); }
.suggest .s-item .grow b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest .s-item .grow span { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest .s-item .grow.wrap b, .suggest .s-item .grow.wrap span { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
.suggest .s-item .badge { flex: none; }
/* customer results: name and balance on top, Naap No. · phone below with the full width */
.suggest .cs-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.suggest .cs-top b { flex: 1; min-width: 0; }
.suggest .cs-top .badge { height: 19px; font-size: 10.5px; }
/* the customer search sits beside a "New" button: its results use that width too (--sug-x is set by customerPicker) */
.inp-wrap > .suggest { right: calc(-1 * var(--sug-x, 0px)); }
.suggest .s-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 12.5px; }

.success-tick { width: 72px; height: 72px; margin: 4px auto 12px; }
.success-tick circle { stroke: var(--ok); stroke-width: 3; fill: var(--ok-soft); stroke-dasharray: 240; stroke-dashoffset: 240; animation: draw .5s ease-out forwards; }
.success-tick path { stroke: var(--ok); stroke-width: 5; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .35s .4s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* =====================================================================
   SHARED WIDGETS — customer card, naap (measurement) form & view, board
   ===================================================================== */
.cust-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); min-width: 0; }
.cust-card .grow { min-width: 0; }
.cust-card .grow b { font-weight: 600; }
.cust-card .meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 3px; min-width: 0; }
.cust-card .meta .code-pill { height: 19px; font-size: 11px; padding: 0 6px; }
.cust-card .meta .badge { height: 19px; font-size: 10.5px; }
@media (max-width: 640px) { .cust-card [data-change] span { display: none; } .cust-card [data-change] { width: 32px; padding: 0; } }

.naap-form[dir="rtl"] .sec-t { letter-spacing: 0; font-size: 13px; text-transform: none; }
/* generic balanced rows for lists of any length: <div class="balance" data-balance="min width"> */
.balance { --c: 3; --g: 14px; display: flex; flex-wrap: wrap; gap: var(--g) calc(var(--g) + 6px); }
.balance > * { flex: 1 1 calc((100% - (var(--c) - 1) * (var(--g) + 6px)) / var(--c) - .5px); min-width: 0; }
/* balanced rows (data-balance): --c boxes per row, last row stretches, so rows are always full */
.naap-nums, .naap-view { --c: 6; display: flex; flex-wrap: wrap; gap: 6px; }
.naap-nums > *, .naap-view > * { flex: 1 1 calc((100% - (var(--c) - 1) * 6px) / var(--c) - .5px); min-width: 0; }
.naap-box { display: flex; flex-direction: column; gap: 2px; padding: 7px 10px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); transition: border-color .15s; cursor: text; min-width: 0; }
.naap-box:focus-within { border-color: var(--ink); }
.naap-box span { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: clip; text-align: center; }
.naap-form[dir="rtl"] .naap-box span { font-size: 14px; line-height: 2.1; font-weight: 500; color: var(--ink-2); }
.naap-box input { border: 0; background: transparent; font-size: 20px; font-weight: 700; text-align: center; width: 100%; padding: 0; outline: none; direction: ltr; min-width: 0; color: var(--ink); }
.naap-chs { display: flex; flex-direction: column; }
.naap-ch { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.naap-ch:last-child { border-bottom: 0; }
.naap-ch .t { flex: 0 0 120px; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.naap-form[dir="rtl"] .naap-ch .t { font-weight: 500; font-size: 15px; line-height: 2; }
.naap-form[dir="rtl"] .opt { line-height: 1.9; padding-top: 0; padding-bottom: 0; }
.naap-ch .opts { flex: 1; min-width: 0; }
/* measurement boxes: label on top, value below — numbers and style choices share one column grid, so they line up */
.naap-v { display: flex; flex-direction: column; justify-content: center; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px 7px; text-align: center; min-width: 0; min-height: 56px; }
.naap-v .l { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: clip; }
[dir="rtl"] .naap-v .l { font-size: 13px; line-height: 1.9; }
.naap-v .v { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; line-height: 1.3; direction: ltr; color: var(--ink); }
.naap-v.ch .v { font-size: 14px; direction: inherit; }
[dir="rtl"] .naap-v.ch .v { font-size: 15px; font-weight: 600; line-height: 1.8; }
.naap-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.naap-tag { display: inline-flex; gap: 5px; align-items: center; padding: 3px 10px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); font-size: 12.5px; white-space: nowrap; }
[dir="rtl"] .naap-tag { line-height: 1.9; font-size: 13.5px; }
.naap-tag b { font-weight: 600; color: var(--ink); }
.meas-card { padding: 14px 16px; }
.meas-row { padding: 14px 16px; border-top: 1px solid var(--line); transition: background-color .12s; }
.meas-row:first-child { border-top: 0; }
.meas-row.click { cursor: pointer; }
.meas-row.click:hover { background: var(--surface-2); }
.meas-row .mh { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; min-width: 0; }
.meas-row .mh .grow b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meas-row .mh .grow span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meas-row .mh > .code-pill { min-width: 38px; justify-content: center; }
.meas-row .mh .grow span { text-overflow: clip; }
@media (max-width: 640px) {
  .meas-row .mh { flex-wrap: wrap; row-gap: 8px; }
  .meas-row .mh .btn-row { width: 100%; justify-content: flex-end; }
}
/* a profile tab's panel runs to the bottom of the page */
.tabfill { display: flex; flex-direction: column; }
.tabfill > .card { flex: 1 0 auto; }
.meas-card .mh { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; min-width: 0; }
.meas-card .mh .grow b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meas-card .mh .grow span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); align-items: stretch; }
.board-col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; display: flex; flex-direction: column; }
.board-col header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.board-col header b { display: block; font-size: 13.5px; } .board-col header span { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.board-col header .li-ico { width: 30px; height: 30px; }
.st-col-pending header .li-ico { background: var(--warn-soft); color: var(--warn); }
.st-col-complete header .li-ico { background: var(--info-soft); color: var(--info); }
.st-col-delivered header .li-ico { background: var(--ok-soft); color: var(--ok); }
.board-list { display: flex; flex-direction: column; gap: 8px; flex: 1 1 0; min-height: 240px; overflow-y: auto; padding: 10px; }
.bk-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: pointer; transition: border-color .15s; min-width: 0; }
.bk-card:hover { border-color: var(--ink); }
.bk-card.urgent { border-left: 3px solid var(--bad); }
.bk-act { margin-top: 9px; display: flex; justify-content: flex-end; }
.board-empty { text-align: center; color: var(--faint); padding: 18px; font-size: 12.5px; }
/* bookings board: the columns reach the bottom of the screen and each one scrolls inside (phones: they stack) */
.view > #body:has(> .board) { flex: 1 1 0; min-height: 280px; display: flex; flex-direction: column; }
#body > .board { flex: 1 1 0; min-height: 0; grid-template-rows: minmax(0, 1fr); }
#body > .board .board-list { min-height: 140px; }

/* order forms (new booking / sale): form on the left, summary on the right */
.bf { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--gap); align-items: start; }
.bf-main { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.bf-side { position: sticky; top: 0; display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.lines { display: flex; flex-direction: column; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) 112px 120px 104px 32px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line:first-child { padding-top: 0; }
.line:last-child { border-bottom: 0; padding-bottom: 0; }
.line .nm { min-width: 0; }
.line .nm b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line .nm span { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line .tot { text-align: right; font-weight: 700; white-space: nowrap; font-size: 13.5px; }
.line .inp { height: 34px; text-align: right; }
.lines-head { display: grid; grid-template-columns: minmax(0, 1fr) 112px 120px 104px 32px; gap: 10px; padding: 0 0 8px; font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.lines-head span:nth-child(n+3) { text-align: right; }
.stepper { display: flex; align-items: center; height: 34px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.stepper button { width: 30px; height: 100%; display: grid; place-items: center; color: var(--ink-2); flex: none; }
.stepper button:hover { background: var(--hover); }
.stepper input { flex: 1; min-width: 0; width: 100%; border: 0; text-align: center; font-weight: 700; font-size: 13.5px; background: transparent; outline: none; height: 100%; color: var(--ink); }
.svc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.svc-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px dashed var(--line-strong); font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--surface); transition: border-color .15s, background-color .15s; }
.svc-chip:hover { border-color: var(--ink); border-style: solid; color: var(--ink); }
.svc-chip small { color: var(--muted); font-weight: 500; }
.meas-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.bf-total { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 12px 0 0; margin-top: 4px; border-top: 1px solid var(--line); container-type: inline-size; }
.bf-total span { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.bf-total b { font-size: clamp(18px, 9cqi, 26px); font-weight: 700; white-space: nowrap; }
.bf-bar { display: none; }
@media (max-width: 1100px) {
  .bf { grid-template-columns: minmax(0, 1fr); }
  .bf-side { position: static; }
}
@media (max-width: 640px) {
  .line, .lines-head { grid-template-columns: minmax(0, 1fr) 104px 32px; grid-template-areas: "nm nm x" "q p t"; row-gap: 8px; }
  .lines-head { display: none; }
  .line .nm { grid-area: nm; } .line .stepper { grid-area: q; } .line .pr { grid-area: p; } .line .tot { grid-area: t; align-self: center; }
  .line .rm { grid-area: x; }
  .line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 90px; grid-template-areas: "nm nm x" "q p t"; }
  .bf-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: calc(var(--bnav) + var(--safe-b)); z-index: 45; align-items: center; gap: 12px;
    padding: 10px 16px; background: var(--surface); border-top: 1px solid var(--line);
  }
  .bf-bar .t { flex: 1; min-width: 0; container-type: inline-size; }
  .bf-bar .t span { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
  .bf-bar .t b { display: block; font-size: clamp(16px, 9cqi, 20px); white-space: nowrap; }
  .bf-pad { height: 64px; }
}

/* sales counter — like OUP: bill panel on the left, cloth on the right, both full height */
.pos { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: var(--gap); align-items: stretch; }
.pos-bill { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.pos-bill .pb-cust { padding: 14px 16px; border-bottom: 1px solid var(--line); flex: none; }
/* the bill is narrow: the change button is just its icon, so name, Naap No., phone and balance fit */
.pos-bill .cust-card [data-change] span { display: none; }
.pos-bill .cust-card [data-change] { width: 32px; padding: 0; flex: none; }
.pos-bill .cart { flex: 1 1 0; min-height: 120px; overflow-y: auto; padding: 0 16px; }
.pos-bill .pb-total { padding: 12px 16px; border-top: 1px solid var(--line); flex: none; }
.pos-bill .card-f { flex: none; }
.pos-items { display: flex; flex-direction: column; gap: 12px; min-height: 0; min-width: 0; padding: 14px 16px 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.pos-items .pgrid { flex: 1 1 0; min-height: 0; overflow-y: auto; align-content: start; padding: 2px 2px 16px; margin: 0 -2px; }
.pos-items .pcard { background: var(--surface-2); }
.pos-items .pcard:hover { background: var(--surface); }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
.pcard { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-align: left; min-width: 0; transition: border-color .15s; }
.pcard:hover { border-color: var(--ink); }
.pcard:active { transform: translateY(1px); }
.pcard b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; display: block; }
.pcard .code { font-size: 11px; color: var(--muted); font-family: Consolas, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .row { justify-content: space-between; }
.pcard .price { font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.pcard.out { opacity: .45; cursor: not-allowed; } /* tapping it buzzes and says "out of stock" */
.pcard.out:hover { border-color: var(--line); transform: none; box-shadow: none; }
.cart { display: flex; flex-direction: column; }
.cline { display: grid; grid-template-columns: minmax(0, 1fr) 96px 28px; grid-template-areas: "nm tot x" "st pr pr"; gap: 6px 8px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; }
.cline:last-child { border-bottom: 0; }
.cline .nm { grid-area: nm; min-width: 0; } .cline .nm b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cline .nm span { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; }
.cline .tot { grid-area: tot; text-align: right; font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.cline .rm { grid-area: x; }
.cline .stepper { grid-area: st; height: 32px; }
.cline .pr { grid-area: pr; }
.cline .pr .inp { height: 32px; text-align: right; }
.cart-empty { height: 100%; min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 20px 8px; text-align: center; color: var(--muted); font-size: 12.5px; }
.cart-empty .ic { width: 28px; height: 28px; color: var(--faint); }
/* return / exchange panel (Sales): cloth coming back, cloth taken instead, and the money */
.rx-lines { display: flex; flex-direction: column; }
.rx-line { display: grid; grid-template-columns: minmax(0, 1fr) 128px 96px 96px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rx-line.rx-new { grid-template-columns: minmax(0, 1fr) 128px 112px 96px 28px; }
.rx-line:last-child { border-bottom: 0; }
.rx-line .nm { min-width: 0; }
.rx-line .nm b { display: block; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.rx-line .nm span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.rx-line .amt { text-align: right; font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.rx-line .rx-step { height: 34px; }
.rx-line .rx-price .inp { height: 34px; text-align: right; }
.rx-line .rx-all { justify-self: end; white-space: nowrap; }
.rx-line:not(.on) .nm b { color: var(--ink-2); }
.rx-sum { padding: 12px 14px; }
.note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm, 8px); font-size: 13px; line-height: 1.4; }
.note .ico, .note svg { flex: none; margin-top: 1px; }
.note.warn { background: var(--warn-soft); border-color: var(--warn); color: var(--ink); }
.note.warn svg { color: var(--warn); }
@media (max-width: 640px) {
  /* name on top; stepper, "All" and the amount on one row below (new cloth: stepper, price, amount; × by the name) */
  .rx-line { grid-template-columns: minmax(0, 1fr) auto 84px; grid-template-areas: "nm nm nm" "st all amt"; row-gap: 8px; }
  .rx-line.rx-new { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 84px; grid-template-areas: "nm nm del" "st pr amt"; }
  .rx-line .nm { grid-area: nm; }
  .rx-line .rx-step { grid-area: st; }
  .rx-line .rx-all { grid-area: all; justify-self: start; }
  .rx-line .amt { grid-area: amt; }
  .rx-line .rx-price { grid-area: pr; }
  .rx-line [data-del] { grid-area: del; justify-self: end; }
}
/* keyboard: key labels on buttons, the chosen bill line, the shortcut sheet (none of it on touch screens) */
kbd.k { display: inline-grid; place-items: center; min-width: 20px; height: 19px; padding: 0 5px; border-radius: 5px; flex: none;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; background: var(--surface); color: var(--muted); font: 600 10.5px/1 var(--font); letter-spacing: 0; }
.btn kbd.k { margin-left: 1px; }
.btn.primary kbd.k, .btn.dark kbd.k { background: transparent; color: inherit; border-color: currentColor; opacity: .65; }
.inp-wrap > kbd.k.in { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.inp-wrap:has(> kbd.k.in) > .inp { padding-right: 40px; }
.keys-modal.modal { width: min(980px, calc(100vw - 28px)); }
.kh { columns: 3 260px; column-gap: 28px; margin: 14px 0 6px; }
.kh-g { break-inside: avoid; margin-bottom: 12px; }
.kh-g h3 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 2px; }
.kh-r { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 10px; align-items: center; min-height: 27px; padding: 3px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.kh-r:last-child { border-bottom: 0; }
.kh-k { display: flex; align-items: center; flex-wrap: wrap; gap: 3px; font-size: 11px; color: var(--muted); }
.kh-k i { font-style: normal; padding: 0 1px; }
.kh-r kbd.k { display: inline-grid !important; } /* the sheet shows keys even where buttons hide them */
@media (pointer: fine) {
  .pos-bill .cline { position: relative; }
  .pos-bill .cline.cur { background: var(--hover); box-shadow: -16px 0 0 var(--hover), 16px 0 0 var(--hover); }
  .pos-bill .cline.cur::before { content: ''; position: absolute; left: -16px; top: 0; bottom: 0; width: 3px; background: var(--ink); }
}
@media (pointer: coarse) { kbd.k, .kb-only { display: none !important; } }
/* stitching at the counter: service cards, bill groups, the details strip and side panel */
.pg-h { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.pg-h:not(:first-child) { padding-top: 8px; }
.pos-items .pcard.svc { background: var(--surface); }
.pcard .kind { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.pcard .kind .ic { width: 12px; height: 12px; flex: none; }
.pcard.in { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.cart-h { display: flex; align-items: center; gap: 6px; padding-top: 12px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.cart-h + .cline { padding-top: 6px; }
.pb-bk { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 16px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface-2); text-align: left; flex: none; color: var(--ink); transition: background-color .15s; }
.pb-bk[hidden] { display: none; }
.pb-bk:hover { background: var(--hover); }
.pb-bk .ico { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--ink); color: var(--surface); flex: none; }
.pb-bk .t { flex: 1; min-width: 0; }
.pb-bk .t b { display: block; font-size: 13px; font-weight: 600; }
.pb-bk .t span { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.pb-bk.need .t span { color: var(--bad); font-weight: 600; }
.pb-bk .badge { flex: none; }
.bkp { display: flex; flex-direction: column; gap: 12px; }
.bkp-s { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.bkp-s.flash { animation: bkp-flash 1.4s ease-out; }
@keyframes bkp-flash { 0%, 40% { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); } }
.bkp-s > :last-child, .bkp-s .dr-note:last-child { margin-bottom: 0; }
.bkp-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.bkp-h .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); font-size: 12px; font-weight: 700; flex: none; }
.bkp-s.ok .bkp-h .n { background: var(--ink); color: var(--surface); }
.bkp-s.need .bkp-h .n { background: var(--bad-soft); color: var(--bad); }
.bkp-h b { flex: 1; min-width: 0; font-size: 14px; font-weight: 700; }
.bkp-h .badge { flex: none; }
.bkp-s .dr-note { margin-bottom: 10px; }
.bkp .choice-card b, .bkp .choice-card span { white-space: normal; }
.bk-recap { align-items: flex-start; line-height: 1.5; }
.bk-recap .ic { margin-top: 2px; flex: none; }
@media (max-width: 900px) {
  .pos { grid-template-columns: minmax(0, 1fr); }
  .pos-items { order: -1; }
  .pos-items .pgrid, .pos-bill .cart { flex: none; overflow: visible; min-height: 0; }
}
@media (max-width: 640px) {
  .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .pcard { padding: 10px; }
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 1280px) {
  :root { --pad: 24px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
  .tb-user > span:not(.avatar), .tb-user > .ic { display: none; }
  .tb-user { padding: 0; }
}
/* laptops & landscape tablets: side panel shows icons only, each in the exact middle (as .shell.rail above) */
@media (max-width: 1100px) and (min-width: 901px) {
  .shell:not(.rail-off) .sb-nav { scrollbar-width: none; }
  .shell:not(.rail-off) .sb-nav::-webkit-scrollbar { display: none; }
  .shell:not(.rail-off) .sb-link { justify-content: center; gap: 0; padding: 0; border-left-width: 0; }
  .shell:not(.rail-off) .sb-text, .shell:not(.rail-off) .sb-count, .shell:not(.rail-off) .sb-name { position: absolute; width: 0; overflow: hidden; }
  .shell:not(.rail-off) .sb-brand { justify-content: center; padding: 0; }
}
@media (max-width: 1100px) {
  .shell:not(.rail-off) { --sb: var(--sb-rail); }
  .shell:not(.rail-off) .sb-name, .shell:not(.rail-off) .sb-text, .shell:not(.rail-off) .sb-count { opacity: 0; pointer-events: none; }
  .sb-foot { display: none; }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tb-search { width: 200px; }
}
/* phones & portrait tablets: normal page scrolling, menu slides in, bottom bar appears */
@media (max-width: 900px) {
  :root { --bnav: 64px; --top: 56px; --pad: 16px; }
  html, body { height: auto; }
  body { overflow-x: hidden; overflow-y: auto; }
  .shell { display: block; height: auto; overflow: visible; }
  .shell, .shell:not(.rail-off) { --sb: 0px; }
  .sidebar { position: fixed; inset: 0 auto 0 0; height: 100%; width: min(280px, 84vw); transform: translateX(-102%); }
  .shell .sb-name, .shell .sb-text, .shell .sb-count { opacity: 1 !important; pointer-events: auto !important; }
  .shell .sb-link { padding: 0 16px !important; }
  .shell .sb-brand { padding: var(--safe-t) 18px 0 !important; height: calc(var(--top) + var(--safe-t)); }
  body.nav-open .sidebar { transform: none; box-shadow: var(--sh-pop); }
  body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  .main { display: block; height: auto; }
  .topbar { position: sticky; top: 0; }
  .topbar .tb-menu { display: inline-flex; }
  .tb-search { width: 36px; padding: 0; justify-content: center; flex: none; }
  .tb-search span, .tb-search .kbd { display: none; }
  .tb-theme-text, .tb-logout-text { display: none; }
  .tb-theme, .tb-logout { width: 36px; padding: 0 !important; }
  .content { display: block; overflow: visible; }
  .view { display: block; overflow: visible; padding: 16px var(--pad) calc(28px + var(--bnav) + var(--safe-b)); }
  .view.fit .card > .list, .view.fit .card > .tbl-wrap, .view.fit .card > .card-b, .view.fit .card > .card-b:has(+ .card-f) { overflow: visible; flex: none; }
  .bnav { display: grid; }
  .drawer, .drawer.sm, .drawer.lg, .drawer.xl { width: 100vw; }
}
/* phones */
@media (max-width: 640px) {
  :root { --gap: 12px; }
  body { font-size: 13.5px; }
  .tb-user { display: none; }
  .g2, .g3, .g4, .form-grid, .form-grid.g3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid.keep2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { --n: 2 !important; gap: 8px; }
  .stats > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stat { padding: 10px 12px; }
  .stat .ico { display: none; }
  .stat .ico ~ .lbl { padding-right: 0; }
  .stat .lbl { font-size: 10.5px; }
  .stat .v { font-size: clamp(14px, 11cqi, 19px); }
  .stat .foot { font-size: 11px; }
  .toolbar .search { max-width: none; flex-basis: 100%; }
  .toolbar .tb-end { margin-left: 0; width: 100%; }
  .toolbar .tb-end > * { flex: 1 1 auto; }
  .toolbar .tb-end > .seg { flex: none; flex-wrap: nowrap; }
  .toolbar .sel.sm { min-width: 0; }
  .toolbar > .sel { flex: 1 1 140px; min-width: 0; }
  .toolbar .qa { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 8px; }
  .toolbar .qa > * { width: 100%; }
  .toolbar .qa > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .toolbar .filters { width: 100%; }
  .toolbar .filters > * { flex: 1 1 140px; }
  .card-h { padding: 12px 14px; min-height: 48px; }
  .card-b { padding: 14px; }
  .li { padding: 11px 14px; }
  .btn-text-sm { display: none; }
  /* bottom sheet */
  .drawer, .drawer.sm, .drawer.lg, .drawer.xl { top: auto; height: auto; max-height: calc(100dvh - 20px - var(--safe-t)); border-radius: 14px 14px 0 0; border-left: 0; border-top: 1px solid var(--line); animation: sheet-in .3s ease; padding-right: 0; }
  .layer.closing .drawer { animation: sheet-out .2s ease-in forwards; }
  .drawer.full { height: calc(100dvh - 12px - var(--safe-t)); }
  .handle { display: block; position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 36px; height: 4px; border-radius: 2px; background: var(--line-strong); z-index: 2; }
  .dr-head { padding: 18px 16px 12px; }
  .dr-body { padding: 16px; }
  .dr-foot { padding: 10px 16px calc(10px + var(--safe-b)); }
  .dr-foot .btn { flex: 1; }
  .dr-foot .btn.icon { flex: none; }
  .dr-foot .spacer { display: none; }
  /* phones: every table row is its own card */
  .card:has(> .tbl-wrap > table.tbl:not(.keep)) { background: transparent; border: 0; }
  .card:has(> .tbl-wrap > table.tbl:not(.keep)) > .card-h { padding-left: 0; padding-right: 0; border-bottom: 0; }
  .card:has(> .tbl-wrap > table.tbl:not(.keep)) > .tbl-wrap { overflow: visible; }
  /* phones: cards stack in one column, so lists simply run at full length (no box to scroll inside) */
  .card.db-list { max-height: none; }
  .card.db-list > .tbl-wrap { overflow: visible; }
  .card > .tbl-wrap > table.tbl:not(.keep) > tbody { display: flex !important; flex-direction: column; gap: 8px; }
  .card > .tbl-wrap > table.tbl:not(.keep) > tbody > tr { border: 1px solid var(--line) !important; border-radius: 10px; background: var(--surface); }
  .card > .tbl-wrap > table.tbl:not(.keep) > tfoot > tr { border: 1px solid var(--line); border-radius: 10px; margin-top: 8px; }
  .card > .tbl-wrap > table.tbl:not(.keep) td:first-child { padding-bottom: 8px !important; border-bottom: 1px solid var(--line); }
  .card > .tbl-wrap > table.tbl:not(.keep) tr.empty-row { border: 0 !important; background: transparent; }
  .card > .tbl-wrap > table.tbl:not(.keep) tr.empty-row td:first-child { border-bottom: 0; }
  .pager { justify-content: center; }
  .pager .info { width: 100%; text-align: center; }
  .modal-f { padding: 14px 20px 20px; }
  .board { grid-template-columns: minmax(0, 1fr); }
  .board-list { max-height: none; }
  .view > #body:has(> .board) { flex: none; display: block; min-height: 0; }
  #body > .board { grid-template-rows: none; }
  #body > .board .board-list { min-height: 240px; }
  .naap-box { padding: 6px 7px 7px; }
  .naap-box input { font-size: 18px; }
  .naap-ch { flex-direction: column; align-items: stretch; gap: 6px; }
  .naap-ch .t { flex: none; }
}
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }
@media (max-width: 380px) { .bnav a, .bnav button { font-size: 9.5px; } }
@media (hover: none) {
  .btn:hover { background: var(--surface); border-color: var(--line); }
  .btn.primary:hover, .btn.dark:hover { background: var(--accent); opacity: 1; }
  .btn.ghost:hover { background: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
/* =====================================================================
   SIGN-IN, BLOCKED PAGE, PROVIDER BANNERS (shop side) and two-step setup
   ===================================================================== */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: calc(24px + var(--safe-t)) 16px calc(24px + var(--safe-b)); background: var(--bg); }
.auth-card { width: min(390px, 100%); border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 30px 28px 24px; animation: view-in .25s ease-out; }
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; margin-bottom: 22px; }
.auth-brand .sb-mark, .auth-brand img { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; }
.auth-brand .sb-mark .ic { width: 26px; height: 26px; }
.auth-brand h1 { font-size: 19px; }
.auth-brand p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.auth form { display: flex; flex-direction: column; gap: 14px; }
.auth .eye { position: absolute; right: 4px; width: 32px; height: 32px; display: grid; place-items: center; color: var(--muted); border-radius: 7px; }
.auth .eye:hover { background: var(--hover); color: var(--ink); }
.auth .inp-wrap > .inp { padding-right: 40px; }
.auth-code { text-transform: uppercase; letter-spacing: .12em; font-weight: 700; font-family: Consolas, 'Courier New', monospace; }
.auth-foot { text-align: center; color: var(--faint); font-size: 11.5px; margin-top: 18px; line-height: 1.6; }
.auth .dr-error, .auth .dr-note { margin-bottom: 14px; }
.otp-input { text-align: center; font-size: 22px; font-weight: 800; letter-spacing: .4em; font-family: Consolas, 'Courier New', monospace; }
.totp-setup { display: flex; gap: 14px; align-items: flex-start; padding: 12px; border: 1px dashed var(--line-strong, var(--line)); border-radius: 10px; background: var(--surface-2); margin-bottom: 4px; }
.totp-qr { flex: none; width: 132px; height: 132px; background: #fff; border-radius: 8px; padding: 4px; }
.totp-qr svg { display: block; width: 100%; height: 100%; }
.totp-setup ol { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--ink-2); display: flex; flex-direction: column; gap: 5px; }
.totp-setup b.mono { word-break: break-all; }
@media (max-width: 420px) { .totp-setup { flex-direction: column; align-items: center; } }
.blocked-card { text-align: center; }
.blocked-ico { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--ink); }
.blocked-card h1 { font-size: 20px; }
.blocked-shop { color: var(--muted); font-size: 13px; margin-top: 4px; }
.blocked-msg { margin: 16px 0 10px; font-size: 14px; color: var(--ink-2); line-height: 1.55; }
.blocked-acts { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.pf-banner { flex: none; display: flex; align-items: center; gap: 10px; padding: 8px var(--pad); font-size: 13px; border-bottom: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); }
.pf-banner .t { flex: 1; min-width: 0; }
/* phones: a notice takes one line (tap it to read all of it), so every page doesn't start three lines lower */
@media (max-width: 640px) { .pf-banner { padding-top: 6px; padding-bottom: 6px; font-size: 12.5px; } .pf-banner:not(.open) .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .pf-banner:not(.open) .t br { display: none; } .pf-banner .t { cursor: pointer; } }
.pf-banner b { color: var(--ink); }
.pf-banner.imp { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.pf-banner.imp b { color: var(--surface); }
.pf-banner.imp .btn { background: var(--surface); color: var(--ink); border-color: var(--surface); }
.pf-banner.warn { background: var(--warn-soft, #fff7e6); }
.pf-banner .btn.icon { flex: none; }

@media print {
  .sidebar, .topbar, .bnav, .toasts, .loadbar, .toolbar, .pager, .no-print, .pf-banner { display: none !important; }
  html, body, .shell, .main, .content, .view { height: auto !important; overflow: visible !important; display: block !important; }
  .view { padding: 0 !important; }
  body { background: #fff; }
}

/* 2.5.7 sign-in by email: long emails cut with … instead of widening rows; a wrong email shows red */
.ell { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.who > div { min-width: 0; }
.inp.bad { border-color: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 18%, transparent); }
