/* NEX-T POS - tokens + shared components (every screen; the e-receipt page too). docs/client-shell.md lists the classes.
   Light and dark follow the computer's setting (prefers-color-scheme); the till gets stronger contrast (bright halls).
   Every control is at least 44 px tall (--tap). NEX-T look: dark navy bar (#1d2330), blue accent, the NEX-T
   cyan-to-purple line under the top bar - as in the judging app.
   Sections: tokens · base · layout helpers · buttons · forms · cards · tables · badges & pills · banners · tabs &
   chips · empty / loading · dialog · toasts · shell (top bar, menu, drawer) · sign-in · print */

/* ------------------------------------------------------------------ tokens */
:root {
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f1f3f6; --surface-3: #e6e9ee;
  --text: #1d2330; --muted: #5d6573; --line: #dfe3e9; --line-strong: #c3cad5;
  --accent: #2f5bea; --accent-hover: #2349d1; --accent-soft: #e8eefe; --accent-ink: #ffffff;
  --ok: #138a52; --ok-strong: #0f7a47; --ok-soft: #e3f5ec;
  --warn: #b45309; --warn-strong: #9a4705; --warn-soft: #fdf1e1;
  --danger: #c62828; --danger-strong: #b11f1f; --danger-soft: #fdecec;
  --info: #1f62b5; --info-soft: #e2eefc;
  --nav-bg: #1d2330; --nav-bg-2: #283044; --nav-text: #c3c9d5; --nav-line: #343b4b; --nav-focus: #8fa8ff;
  --brand-line: linear-gradient(90deg, #2ee6ff, #c83cff); /* the NEX-T accent */
  --focus: #2f5bea;
  --scrim: rgba(15, 20, 30, .5);
  --radius: 12px; --radius-sm: 8px; --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 14px rgba(20, 30, 50, .06);
  --shadow-lg: 0 10px 40px rgba(15, 20, 30, .28);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  --tap: 44px;               /* the smallest control */
  --topbar-h: 56px; --nav-w: 232px;
  /* the installed app on a phone runs under the status bar / notch / home bar: keep clear of them (0 elsewhere) */
  --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);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f131b; --surface: #171c27; --surface-2: #1e2431; --surface-3: #283042;
    --text: #e8ecf4; --muted: #a2aaba; --line: #2b3242; --line-strong: #414b60;
    --accent: #6d8dff; --accent-hover: #89a3ff; --accent-soft: #1f2a52; --accent-ink: #0b1024;
    --ok: #4cc884; --ok-strong: #1d8a52; --ok-soft: #14301f;
    --warn: #f2b14c; --warn-strong: #b8730f; --warn-soft: #3a2c12;
    --danger: #ff7680; --danger-strong: #d23c48; --danger-soft: #3a1c22;
    --info: #6aa8f5; --info-soft: #172a44;
    --nav-bg: #161b26; --nav-bg-2: #222a3b; --nav-line: #2e3646;
    --focus: #89a3ff;
    --scrim: rgba(0, 0, 0, .6);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
    --shadow-lg: 0 12px 44px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
/* the till: stronger lines and text for a bright hall (and anyone who asks the computer for more contrast) */
body.layout-till { --muted: #464e5c; --line: #c9d0da; --line-strong: #8f99a8; --text: #10141c; --ok: #0d6b3d; }
@media (prefers-color-scheme: dark) {
  body.layout-till { --muted: #c3cad6; --line: #3a4356; --line-strong: #5a667e; --text: #ffffff; --ok: #4cc884; }
}
@media (prefers-contrast: more) {
  :root { --muted: #3f4652; --line: #aab3c0; --line-strong: #6f7a8a; }
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); }
body.layout-till { font-size: 16px; }
img, svg { max-width: 100%; }
a { color: var(--accent); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 24px; } h2 { font-size: 19px; } h3 { font-size: 16px; } h4 { font-size: 15px; }
p { margin: 0 0 .75em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--accent-soft); }
.ico { width: 20px; height: 20px; flex: none; vertical-align: middle; }
.noscript { max-width: 520px; margin: 20vh auto; padding: 16px; text-align: center; }
.boot-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }

/* ------------------------------------------------------------------ layout helpers */
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.row > .grow, .row-wrap > .grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.stack-sm > * + * { margin-top: 6px; }
.stack-lg > * + * { margin-top: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.spacer { flex: 1 1 auto; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.big { font-size: 20px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.ok-text { color: var(--ok); font-weight: 600; }
.warn-text { color: var(--warn); font-weight: 600; }
.danger-text { color: var(--danger); font-weight: 600; }
/* (width / height !important: an <input class="sr-only"> must not take a form's width: 100% and widen a phone page) */
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; min-width: 0 !important; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.kbd { display: inline-block; min-width: 1.6em; padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px;
  font: 600 12px/1.5 var(--mono); text-align: center; color: var(--muted); background: var(--surface); }
/* a back-office page: a heading row with its buttons, then filters, then the content */
.page-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 0 0 16px; }
.page-head h1, .page-title { margin: 0; font-size: 24px; }
.page-head .spacer { min-width: 8px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin: 0 0 14px; }
.toolbar .field { min-width: 160px; }
.section-title { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 20px 0 8px; }

/* ------------------------------------------------------------------ buttons
   .btn (secondary look) + .btn-primary .btn-secondary .btn-danger .btn-ok .btn-ghost .btn-nav (on the dark bar)
   sizes .btn-sm .btn-lg .btn-xl (the till's Charge) · .btn-block · .btn-icon (square, put an aria-label on it) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 9px 16px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font-weight: 600; line-height: 1.2; text-align: center; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color .12s, border-color .12s, box-shadow .12s; -webkit-tap-highlight-color: transparent; user-select: none; }
.btn:hover { background: var(--surface-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-secondary { background: var(--surface); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger-strong); border-color: var(--danger-strong); color: #fff; }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); }
.btn-ok { background: var(--ok-strong); border-color: var(--ok-strong); color: #fff; }
.btn-ok:hover { filter: brightness(1.06); background: var(--ok-strong); }
.btn-warn { background: var(--warn-strong); border-color: var(--warn-strong); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-danger-ghost { background: transparent; border-color: var(--line-strong); color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-nav { background: transparent; border-color: var(--nav-line); color: #fff; }
.btn-nav:hover { background: rgba(255, 255, 255, .08); }
.btn-nav:focus-visible { outline-color: var(--nav-focus); }
.btn-sm { padding: 6px 12px; font-size: 14px; }
@media (pointer: fine) { .btn-sm { min-height: 36px; } }  /* (mouse only: a finger still gets 44 px) */
.btn-lg { min-height: 52px; padding: 12px 22px; font-size: 17px; border-radius: 10px; }
.btn-xl { min-height: 68px; padding: 14px 24px; font-size: 22px; font-weight: 800; border-radius: var(--radius); }
.btn-block { display: flex; width: 100%; }
.btn-icon { width: var(--tap); padding: 0; }
.btn-icon.btn-sm { width: 36px; }
.btn-lg .ico { width: 22px; height: 22px; }
.btn-xl .ico { width: 26px; height: 26px; }
.btn-group { display: inline-flex; flex-wrap: wrap; gap: 8px; }
/* a link that looks like text */
.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; cursor: pointer; }

/* ------------------------------------------------------------------ forms
   .field = label + control + .hint / .field-error · .input (bare inputs are styled too) · .input-lg · .input-money ·
   .input-group (control + button joined) · .check (checkbox / radio with its label) · .switch (an on/off checkbox) */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field + .field { margin-top: 12px; }
.field > label, .field-label { font-weight: 600; font-size: 14px; }
.field .hint { color: var(--muted); font-size: 13px; }
.field-error, .field .error { color: var(--danger); font-size: 13px; font-weight: 600; min-height: 0; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 16px; }
.field-row + .field, .field + .field-row, .field-row + .field-row { margin-top: 12px; }
.field-row > .field + .field { margin-top: 0; }
.input,
input[type=text], input[type=password], input[type=number], input[type=search], input[type=email], input[type=tel],
input[type=url], input[type=date], input[type=time], input[type=datetime-local], input:not([type]), select, textarea {
  width: 100%; min-height: var(--tap); padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; line-height: 1.3; }
textarea { min-height: 88px; resize: vertical; }
select { padding-right: 32px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
.input:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent); outline-offset: 0; border-color: var(--focus); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"], .input.is-invalid { border-color: var(--danger); }
input:disabled, select:disabled, textarea:disabled { opacity: .6; cursor: not-allowed; }
input[type=number] { font-variant-numeric: tabular-nums; }
.input-lg { min-height: 56px; font-size: 22px; font-weight: 700; }
.input-money { text-align: right; font-variant-numeric: tabular-nums; }
.input-group { display: flex; align-items: stretch; min-width: 0; }
.input-group > .input, .input-group > input, .input-group > select { flex: 1 1 auto; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer; font-weight: 500; }
.check input { width: 20px; height: 20px; min-height: 0; margin: 0; flex: none; accent-color: var(--accent); }
.switch { display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer; font-weight: 500; }
.switch input { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 46px; height: 26px; min-height: 0; margin: 0; padding: 0;
  border: 0; border-radius: 999px; background: var(--line-strong); cursor: pointer; transition: background-color .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(20px); }
.switch input:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent); outline-offset: 2px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px 14px; margin: 0; min-width: 0; }
legend { padding: 0 6px; font-weight: 600; font-size: 14px; }
/* 16 px stops phones zooming in when a field is tapped */
@media (pointer: coarse), (max-width: 640px) { .input, input, select, textarea { font-size: 16px; } .input-lg { font-size: 22px; } }

/* ------------------------------------------------------------------ cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 0 0 12px; }
.card-title { margin: 0; font-size: 17px; font-weight: 700; }
.card-sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush > .card-head { padding: 14px 16px 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.cards > .card + .card { margin-top: 0; }
/* a figure on the dashboard: label, value, a line under it */
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-sub { font-size: 13px; color: var(--muted); }
/* label / value pairs (details) */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ tables
   .table-wrap (scrolls sideways on a phone) > table.table · th.num / td.num right-aligned · tr.clickable ·
   tr.is-muted · tr.is-selected · .table-compact · td.actions */
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.card > .table-wrap, .card-flush > .table-wrap { border: 0; border-radius: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 700;
  letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.actions { text-align: right; white-space: nowrap; }
.table td.actions .btn + .btn { margin-left: 6px; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--accent-soft); }
.table tr.clickable:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.table tr.is-muted td { color: var(--muted); }
.table tr.is-selected td { background: var(--accent-soft); }
.table tr.is-warn td { background: var(--warn-soft); }
.table tr.is-danger td { background: var(--danger-soft); }
.table tfoot td { font-weight: 700; border-top: 2px solid var(--line-strong); border-bottom: 0; }
.table-compact th, .table-compact td { padding: 6px 10px; }
.sort-btn { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.sort-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

/* ------------------------------------------------------------------ badges & status pills
   .badge + .badge-ok .badge-warn .badge-error .badge-info .badge-muted .badge-accent
   .pill + .pill-ok .pill-warn .pill-error .pill-busy (the sync status; .pill-dot or a .spinner inside) */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
  line-height: 1.5; white-space: nowrap; background: var(--surface-3); color: var(--muted); vertical-align: middle; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-error { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-accent { background: var(--accent); color: var(--accent-ink); }
.badge-muted { background: var(--surface-3); color: var(--muted); }
.badge .ico { width: 14px; height: 14px; }
.pill { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; max-width: 100%; padding: 6px 14px; border: 1px solid transparent;
  border-radius: 999px; font-size: 14px; font-weight: 700; line-height: 1.2; white-space: nowrap; background: var(--surface-3); color: var(--text); }
button.pill { cursor: pointer; }
.pill-text { overflow: hidden; text-overflow: ellipsis; }
.pill-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
/* (light colours with dark text: readable on the dark top bar and on the page alike) */
.pill-ok { background: #dff5e9; color: #0b6a3c; border-color: #b6e5cb; }
.pill-warn { background: #fdecd2; color: #8a4204; border-color: #f4cf9c; }
.pill-error { background: #fde2e2; color: #a01818; border-color: #f5b5b5; }
.pill-busy { background: #e3eafd; color: #1d44c4; border-color: #bfcff9; }
.pill-error .pill-dot { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ------------------------------------------------------------------ banners (a line of news inside a page) */
.banner { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--surface-2); color: var(--text); font-weight: 500; margin: 0 0 12px; }
.banner > .ico { margin-top: 1px; }
.banner-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.banner-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.banner-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.banner-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.banner-info > .ico { color: var(--info); } .banner-ok > .ico { color: var(--ok); }
.banner-warn > .ico { color: var(--warn); } .banner-error > .ico { color: var(--danger); }

/* ------------------------------------------------------------------ tabs, chips, segmented choice
   .tabs > .tab (a button or link; .on or aria-selected="true")  ·  .chips > .chip (.on or aria-pressed="true")  ·
   .seg > label > input[type=radio] + span */
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 0 0 14px; scrollbar-width: thin; }
.tab { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 8px 14px; border: 0; border-bottom: 3px solid transparent;
  background: transparent; color: var(--muted); font-weight: 700; text-decoration: none; white-space: nowrap; cursor: pointer; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.on, .tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tab .badge { margin-left: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 8px 16px; border: 1px solid var(--line-strong);
  border-radius: 999px; background: var(--surface); color: var(--text); font-weight: 600; white-space: nowrap; cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.chip.on, .chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
.seg label { position: relative; display: flex; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; opacity: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 6px 14px; border-radius: 8px; font-weight: 600; white-space: nowrap; }
.seg label:hover span { background: var(--accent-soft); }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 1px; }

/* ------------------------------------------------------------------ empty / loading / spinner */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 40px 20px; color: var(--muted); }
.empty-ico { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; margin-bottom: 6px; border-radius: 50%;
  background: var(--surface-3); color: var(--muted); }
.empty-ico .ico { width: 28px; height: 28px; }
.empty-title { margin: 0; font-size: 18px; color: var(--text); }
.empty-text { margin: 0; max-width: 460px; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 28px 16px; color: var(--muted); }
.spinner { display: inline-block; flex: none; width: 20px; height: 20px; border: 2.5px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; }
.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
.spinner-lg { width: 36px; height: 36px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
/* the view-loading spot: a blank screen never looks broken */
.view:empty::before { content: ""; display: block; height: 3px; background: var(--brand-line); opacity: .5; animation: grow 1.2s ease-in-out infinite; transform-origin: left; }
@keyframes grow { 0% { transform: scaleX(0); } 60% { transform: scaleX(1); opacity: .6; } 100% { transform: scaleX(1); opacity: 0; } }

/* ------------------------------------------------------------------ dialog (POS.dialog / POS.confirm)
   .dialog-layer > .dialog (.dialog-wide, .dialog-drawer) > .dialog-head (.dialog-title, .dialog-close) .dialog-body .dialog-actions */
.dialog-layer { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: max(16px, var(--safe-t)) max(16px, var(--safe-r)) max(16px, var(--safe-b)) max(16px, var(--safe-l));
  background: var(--scrim); animation: fade-in .14s ease-out; overscroll-behavior: contain; }
.dialog { position: relative; display: flex; flex-direction: column; width: 100%; max-width: 520px; max-height: calc(100dvh - 32px);
  background: var(--surface); color: var(--text); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); outline: none;
  animation: pop-in .16s ease-out; }
.dialog-wide { max-width: 880px; }
.dialog-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 12px 4px 20px; }
.dialog-title { flex: 1; margin: 0; padding-top: 9px; font-size: 19px; font-weight: 800; }
.dialog-close { flex: none; display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); padding: 0;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); }
.dialog-close:hover { background: var(--surface-2); color: var(--text); }
.dialog-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 8px 20px 12px; }
.dialog-body > :last-child { margin-bottom: 0; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; border-top: 1px solid var(--line); }
.dialog.is-busy { cursor: progress; }
.dialog-confirm { max-width: 460px; }
@media (max-width: 520px) {
  .dialog-layer { align-items: flex-end; padding: max(8px, var(--safe-t)) 0 0; }
  .dialog { max-width: none; max-height: calc(100dvh - 8px); border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding-bottom: var(--safe-b); }
  .dialog-actions .btn { flex: 1 1 auto; }
}
/* drawer: a details pane from the right (POS.dialog({ drawer: true })) */
.dialog-layer.is-drawer { justify-content: flex-end; align-items: stretch; padding: 0; }
.dialog-drawer { max-width: 560px; max-height: none; height: 100%; border-radius: 0; padding: var(--safe-t) var(--safe-r) var(--safe-b) 0; animation: slide-in .2s ease-out; }
@media (max-width: 520px) { .dialog-layer.is-drawer { align-items: stretch; } .dialog-drawer { max-width: none; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }
body.dialog-open { overflow: hidden; }

/* ------------------------------------------------------------------ toasts (POS.toast): bottom centre, above dialogs */
.toast-region { position: fixed; left: 50%; bottom: calc(16px + var(--safe-b)); z-index: 200; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 24px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; max-width: min(560px, calc(100vw - 24px)); padding: 4px 4px 4px 16px;
  border-radius: 10px; background: #1d2330; color: #fff; box-shadow: var(--shadow-lg); font-weight: 600; pointer-events: auto;
  animation: toast-in .18s ease-out; transition: opacity .18s, transform .18s; }
.toast-ok { background: #0f7a47; }
.toast-warn { background: #9a4705; }
.toast-error { background: #b11f1f; }
.toast-text { flex: 1; padding: 8px 0; overflow-wrap: anywhere; }
.toast-close { flex: none; display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: inherit; opacity: .8; }
.toast-close:hover { opacity: 1; background: rgba(255, 255, 255, .12); }
.toast-close:focus-visible { outline-color: #fff; }
.toast-close .ico { width: 18px; height: 18px; }
.toast.leaving { opacity: 0; transform: translateY(6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ------------------------------------------------------------------ shell: top bar, banners, back-office menu
   body.layout-till: the till fills the screen under the bar (no menu)
   body.layout-bo: the page scrolls; the menu is a sidebar from 900 px wide, a drawer (☰) below that */
.shell { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 8px; flex: none;
  min-height: calc(var(--topbar-h) + var(--safe-t)); padding: var(--safe-t) max(12px, var(--safe-r)) 0 max(8px, var(--safe-l));
  background: var(--nav-bg); color: #fff; }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--brand-line); opacity: .9; }
.topbar :focus-visible { outline-color: var(--nav-focus); }
.nav-toggle, .nav-close { flex: none; display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap);
  padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: #fff; }
.nav-toggle:hover, .nav-close:hover { background: rgba(255, 255, 255, .08); }
.nav-toggle .ico { width: 24px; height: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 0 8px 0 4px; border-radius: var(--radius-sm);
  color: #fff; text-decoration: none; font-weight: 800; font-size: 17px; letter-spacing: .01em; white-space: nowrap; flex: none; }
.brand:hover { background: rgba(255, 255, 255, .06); }
.brand-logo { width: 30px; height: 30px; border-radius: 7px; flex: none; }
.topbar-counter { display: inline-flex; align-items: center; gap: 8px; min-width: 0; padding: 6px 12px; border: 1px solid var(--nav-line);
  border-radius: 999px; color: #fff; background: var(--nav-bg-2); white-space: nowrap; }
.topbar-counter .ico { width: 18px; height: 18px; color: var(--nav-text); }
.counter-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.counter-code { font-size: 12px; font-weight: 700; color: var(--nav-text); }
.till-tabs { display: flex; gap: 4px; margin-left: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.till-tab { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 14px; border-radius: var(--radius-sm);
  color: var(--nav-text); font-weight: 700; text-decoration: none; white-space: nowrap; }
.till-tab:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.till-tab.on { background: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .till-tab.on { background: #3a5ff0; } }
.topbar-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--nav-text); font-weight: 600;
  padding-left: 10px; border-left: 1px solid var(--nav-line); }
.topbar-title:empty, body.layout-till .topbar-title { display: none; }
.topbar .spacer { min-width: 4px; }
.mode-switch { flex: none; }
.user-menu { position: relative; flex: none; }
.user-btn { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); max-width: 240px; padding: 0 10px; border: 0;
  border-radius: var(--radius-sm); background: transparent; color: #fff; font-weight: 600; }
.user-btn:hover, .user-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .08); }
.user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chev { width: 16px; height: 16px; opacity: .7; }
.user-btn.signed-out { background: #fde2e2; color: #a01818; }
.menu-pop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 50; min-width: 250px; padding: 6px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); animation: pop-in .12s ease-out; }
.menu-head { display: flex; flex-direction: column; padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-head span { font-size: 13px; color: var(--muted); }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: var(--tap); padding: 8px 12px; border: 0;
  border-radius: var(--radius-sm); background: transparent; color: var(--text); text-align: left; font-weight: 600; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.menu-item .ico { color: var(--muted); }
.menu-label { display: flex; flex-direction: column; }
.menu-hint { font-size: 12px; font-weight: 500; color: var(--muted); }
.menu-item.is-disabled { color: var(--muted); }
.menu-item.danger, .menu-item.danger .ico { color: var(--danger); }
/* the lines under the top bar (POS.setBanner): a new version, the clock, a retired counter */
.app-banners { flex: none; }
.app-banner { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 6px max(16px, var(--safe-r)) 6px max(16px, var(--safe-l));
  border-bottom: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.app-banner-text { flex: 1; }
.app-banner.banner-info { background: var(--info-soft); color: var(--text); }
.app-banner.banner-warn { background: var(--warn-soft); color: var(--text); }
.app-banner.banner-error { background: var(--danger-soft); color: var(--text); }
.app-banner.banner-ok { background: var(--ok-soft); color: var(--text); }
.app-banner > .ico { color: var(--accent); }
.app-banner.banner-warn > .ico { color: var(--warn); }
.app-banner.banner-error > .ico { color: var(--danger); }
.shell-body { display: flex; flex: 1 1 auto; min-height: 0; }
.view-host { flex: 1 1 auto; min-width: 0; }
.view { outline: none; }
body.layout-bo .view { max-width: 1240px; margin: 0 auto; padding: 20px max(20px, var(--safe-r)) calc(40px + var(--safe-b)) max(20px, var(--safe-l)); }
@media (max-width: 640px) { body.layout-bo .view { padding: 16px max(16px, var(--safe-r)) calc(32px + var(--safe-b)) max(16px, var(--safe-l)); } }
/* the till: exactly the screen under the bar; each till screen lays itself out inside .view (css/sell.css) */
body.layout-till .shell { height: 100vh; height: 100dvh; }
body.layout-till .view-host { display: flex; flex-direction: column; overflow: auto; }
body.layout-till .view { flex: 1 1 auto; min-height: 0; }
body.layout-till .sidenav, body.layout-till .nav-overlay { display: none !important; }
body.layout-till .topbar { min-height: calc(60px + var(--safe-t)); }
/* back-office menu */
.sidenav { display: none; flex-direction: column; width: var(--nav-w); flex: none; background: var(--nav-bg); color: #fff; overflow-y: auto; overscroll-behavior: contain; }
body.has-sidenav .sidenav { display: flex; }
.sidenav-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; padding: 8px 6px 4px 22px; }
.sidenav-brand { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--nav-text); }
.nav-links { flex: 1; padding: 0 10px 12px; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--nav-text); font-weight: 600; text-decoration: none; }
.nav-item .ico { opacity: .85; }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.on { background: var(--accent); color: #fff; }
/* (after the rule above: dark mode's lighter accent would leave white text at 3:1) */
@media (prefers-color-scheme: dark) { .nav-item.on { background: #3a5ff0; } }
.nav-item.on .ico { opacity: 1; }
.sidenav :focus-visible { outline-color: var(--nav-focus); }
.sidenav-foot { padding: 10px 22px calc(12px + var(--safe-b)); border-top: 1px solid var(--nav-line); }
.nav-version { font-size: 12px; color: var(--nav-text); opacity: .8; }
.nav-overlay { position: fixed; inset: 0; z-index: 55; background: var(--scrim); }
@media (min-width: 900px) {
  body.has-sidenav .sidenav { position: sticky; top: calc(var(--topbar-h) + var(--safe-t)); height: calc(100vh - var(--topbar-h) - var(--safe-t));
    height: calc(100dvh - var(--topbar-h) - var(--safe-t)); padding-left: var(--safe-l); }
  .nav-toggle, .nav-close, .nav-overlay { display: none !important; }
  .topbar-title { display: none; }
}
@media (max-width: 899.98px) {
  /* closed: off screen and out of reach (visibility); open: over the page, which doesn't scroll meanwhile */
  body.has-sidenav .sidenav { position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; width: calc(min(300px, 86vw) + var(--safe-l));
    padding: var(--safe-t) 0 0 var(--safe-l); transform: translateX(-100%); visibility: hidden;
    transition: transform .22s ease, visibility 0s linear .22s; }
  body.nav-open .sidenav { transform: none; visibility: visible; transition: transform .22s ease; box-shadow: 8px 0 28px rgba(0, 0, 0, .3); }
  body.nav-open { overflow: hidden; }
  .brand-name { display: none; }
}
@media (max-width: 640px) {
  .mode-label, .counter-code { display: none; }
  .mode-switch { width: var(--tap); padding: 0; }
  .user-name { max-width: 110px; }
  .user-chev { display: none; }
  .topbar-counter { padding: 6px 10px; }
  .counter-name { max-width: 120px; }
  .topbar .pill { padding: 6px 10px; font-size: 13px; }
  .topbar .pill-text { max-width: 140px; }
}
@media (max-width: 420px) { .topbar .pill-text { display: none; } .user-name { display: none; } }
/* the back office on a phone: the page's name in the bar, not the counter's (the counter is the till's business) */
@media (max-width: 640px) { body.layout-bo .topbar-counter { display: none; } body.layout-bo .brand { padding-right: 4px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------------------------ sign-in */
body.layout-login { background: radial-gradient(ellipse at top, #24304f 0%, #121722 70%) fixed, var(--nav-bg); }
.login-screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.login-screen > .app-banners .app-banner { border-bottom: 0; }
.login-card { width: min(400px, calc(100% - 32px)); margin: auto; padding: 28px 26px 26px; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.login-card.card + .card { margin-top: 0; }
.login-logo { display: block; width: 210px; max-width: 80%; height: auto; margin: 0 auto 6px; }
/* (the wordmark is drawn on white: on a dark card it sits on a white plate) */
@media (prefers-color-scheme: dark) { .login-logo { background: #fff; border-radius: 10px; padding: 6px 12px; } }
.login-title { margin: 0 0 14px; text-align: center; font-size: 15px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.login-counter { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 14px; color: var(--muted); font-weight: 600; text-align: center; }
.login-card .field + .field { margin-top: 14px; }
.login-card .banner { margin: 0 0 14px; }
.login-error { min-height: 22px; margin: 12px 0 10px; color: var(--danger); font-weight: 600; font-size: 14px; }
.login-error:empty { margin: 6px 0; min-height: 0; }
.login-show { min-width: 64px; }
.login-back { margin-top: 10px; }

/* ------------------------------------------------------------------ print (a back-office page printed with Ctrl+P;
   receipts have their own rules in css/receipt.css) */
@media print {
  .topbar, .sidenav, .nav-overlay, .app-banners, .toast-region, .dialog-layer, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  body.layout-bo .view { max-width: none; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  .table th { position: static; }
}
