/* =====================================================================
   Aperture POS — application styles
   Layout targets a 10"–13" tablet in landscape (1024–1366 logical px)
   and scales up to desktop. Every interactive target is >= 44px.
   ===================================================================== */

/* ------------------------------ tokens ------------------------------ */
:root {
  color-scheme: light;

  --surface-0: #f4f4f1;   /* app background            */
  --surface-1: #fcfcfb;   /* panels, cards             */
  --surface-2: #ffffff;   /* raised (tiles, inputs)    */
  --surface-3: #eceae4;   /* sunken wells, hovers      */
  --line:      #dddbd3;
  --line-soft: #e9e7e0;

  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #86847c;
  --text-invert:    #ffffff;

  --accent:      #2a78d6;
  --accent-ink:  #184f95;
  --accent-wash: #e7f0fd;

  --good:     #008300;
  --good-wash:#e2f3e2;
  --warn:     #eda100;
  --warn-wash:#fdf1d6;
  --crit:     #e34948;
  --crit-wash:#fdeaea;

  /* categorical series — validated slot order from the reference palette */
  --series-1:#2a78d6; --series-2:#eb6834; --series-3:#1baf7a; --series-4:#eda100;
  --series-5:#e87ba4; --series-6:#008300; --series-7:#4a3aa7; --series-8:#e34948;

  --radius:   14px;
  --radius-s: 10px;
  --radius-l: 20px;

  --shadow-1: 0 1px 2px rgba(11,11,11,.06), 0 1px 1px rgba(11,11,11,.04);
  --shadow-2: 0 4px 16px rgba(11,11,11,.10), 0 1px 3px rgba(11,11,11,.06);
  --shadow-3: 0 18px 48px rgba(11,11,11,.22);

  --topbar-h: 60px;
  --cart-w:   400px;
  --tap:      44px;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark;
    --surface-0:#121211; --surface-1:#1a1a19; --surface-2:#232321; --surface-3:#2c2c29;
    --line:#383834; --line-soft:#2e2e2b;
    --text-primary:#ffffff; --text-secondary:#c3c2b7; --text-muted:#8f8e84; --text-invert:#0b0b0b;
    --accent:#3987e5; --accent-ink:#86b6ef; --accent-wash:#18293f;
    --good:#008300; --good-wash:#16291a; --warn:#c98500; --warn-wash:#2e2412; --crit:#e66767; --crit-wash:#331a1a;
    --series-1:#3987e5; --series-2:#d95926; --series-3:#199e70; --series-4:#c98500;
    --series-5:#d55181; --series-6:#008300; --series-7:#9085e9; --series-8:#e66767;
    --shadow-1:0 1px 2px rgba(0,0,0,.5); --shadow-2:0 4px 16px rgba(0,0,0,.5);
    --shadow-3:0 18px 48px rgba(0,0,0,.65);
  }
}
:root[data-theme="dark"] { color-scheme: dark;
  --surface-0:#121211; --surface-1:#1a1a19; --surface-2:#232321; --surface-3:#2c2c29;
  --line:#383834; --line-soft:#2e2e2b;
  --text-primary:#ffffff; --text-secondary:#c3c2b7; --text-muted:#8f8e84; --text-invert:#0b0b0b;
  --accent:#3987e5; --accent-ink:#86b6ef; --accent-wash:#18293f;
  --good:#008300; --good-wash:#16291a; --warn:#c98500; --warn-wash:#2e2412; --crit:#e66767; --crit-wash:#331a1a;
  --series-1:#3987e5; --series-2:#d95926; --series-3:#199e70; --series-4:#c98500;
  --series-5:#d55181; --series-6:#008300; --series-7:#9085e9; --series-8:#e66767;
  --shadow-1:0 1px 2px rgba(0,0,0,.5); --shadow-2:0 4px 16px rgba(0,0,0,.5);
  --shadow-3:0 18px 48px rgba(0,0,0,.65);
}

/* ------------------------------ base -------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-primary);
  background: var(--surface-0);
  overflow: hidden;                      /* the app owns its own scroll regions */
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); background-clip: content-box; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0; }

/* ----------------------------- topbar ------------------------------- */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 14px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 30;
}
.brand { display:flex; align-items:center; gap:10px; min-width: 190px; }
.brand-mark {
  width:34px; height:34px; display:grid; place-items:center; flex:none;
  background: var(--accent); color:#fff; border-radius: 10px; font-size: 18px;
}
.brand-text { display:flex; flex-direction:column; line-height:1.15; overflow:hidden; }
.brand-text strong { font-size: 15px; letter-spacing:-.01em; white-space:nowrap; }
.brand-text small { font-size: 11.5px; color: var(--text-muted); white-space:nowrap; }

.tabs { display:flex; gap:4px; flex:1; }
.tab {
  display:flex; align-items:center; gap:8px;
  height: 42px; padding: 0 14px;
  border: 1px solid transparent; border-radius: var(--radius-s);
  background: transparent; color: var(--text-secondary);
  font-weight: 560; font-size: 14px; white-space: nowrap;
}
.tab .ti { font-size: 13px; opacity:.8; }
.tab kbd {
  font-family: var(--mono); font-size: 10px; padding: 1px 5px; border-radius: 5px;
  background: var(--surface-3); color: var(--text-muted); border:1px solid var(--line-soft);
}
.tab:hover { background: var(--surface-3); color: var(--text-primary); }
.tab[aria-selected="true"] { background: var(--accent-wash); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.tab .badge {
  font-style: normal; font-size: 11px; font-weight: 700; min-width: 20px; text-align:center;
  padding: 1px 6px; border-radius: 99px; background: var(--warn); color: #241a00;
}

.topbar-right { display:flex; align-items:center; gap: 10px; }
.shift-chip {
  display:flex; align-items:center; gap:7px; height:34px; padding: 0 12px;
  border-radius: 99px; background: var(--surface-3); border:1px solid var(--line);
  font-size: 12.5px; font-weight: 560; color: var(--text-secondary); white-space:nowrap;
}
.shift-chip .dot { width:8px; height:8px; border-radius:50%; background: var(--text-muted); flex:none; }
.shift-chip.open { background: var(--good-wash); border-color: color-mix(in srgb, var(--good) 35%, transparent); color: var(--good); }
.shift-chip.open .dot { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 20%, transparent); }
.icon-btn {
  width: 38px; height: 38px; display:grid; place-items:center; flex:none;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2);
  font-size: 13px; font-weight: 700; color: var(--text-secondary);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text-primary); }
.clock { font-family: var(--mono); font-size: 13px; color: var(--text-secondary); min-width: 62px; text-align:right; }

/* ---------------------------- view root ----------------------------- */
.view-root { height: calc(100% - var(--topbar-h)); overflow: hidden; }
.pad-view { height:100%; overflow-y:auto; padding: 20px 24px 40px; }
.pad-view > .wrap { max-width: 1240px; margin: 0 auto; }

/* ======================= REGISTER (main sale) ======================== */
.register { height:100%; display: grid; grid-template-columns: 1fr var(--cart-w); }
.catalog { display:flex; flex-direction:column; min-width:0; border-right:1px solid var(--line); }

/* search / scan bar */
.scanbar { display:flex; gap:10px; align-items:center; padding: 12px 14px; border-bottom:1px solid var(--line); background: var(--surface-1); }
.search-wrap { position:relative; flex:1; min-width:0; }
.search-wrap .mag { position:absolute; left:14px; top:50%; transform:translateY(-50%); color:var(--text-muted); font-size:15px; pointer-events:none; }
#searchInput {
  width:100%; height:48px; padding: 0 96px 0 40px;
  border-radius: var(--radius); border:1px solid var(--line); background: var(--surface-2);
  font-size: 15px;
}
#searchInput::placeholder { color: var(--text-muted); }
#searchInput:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-wash); outline:none; }
.search-hint {
  position:absolute; right:10px; top:50%; transform:translateY(-50%);
  display:flex; gap:4px; align-items:center; font-size:10.5px; color:var(--text-muted);
  font-family: var(--mono); pointer-events:none;
}
.search-hint span { border:1px solid var(--line); border-radius:5px; padding:2px 5px; background: var(--surface-3); }
.scan-clear { position:absolute; right:10px; top:50%; transform:translateY(-50%); width:30px; height:30px; border-radius:8px; border:0; background:var(--surface-3); color:var(--text-secondary); display:none; }
.search-wrap.has-text .scan-clear { display:grid; place-items:center; }
.search-wrap.has-text .search-hint { display:none; }

.ordertype { display:flex; background: var(--surface-3); border-radius: var(--radius); padding:3px; gap:3px; }
.ordertype button { height:42px; padding:0 14px; border:0; border-radius: 11px; background:transparent; color:var(--text-secondary); font-weight:560; font-size:13.5px; white-space:nowrap; }
.ordertype button[aria-pressed="true"] { background: var(--surface-2); color: var(--text-primary); box-shadow: var(--shadow-1); }

/* category rail */
.catrail { display:flex; gap:8px; padding: 12px 14px; overflow-x:auto; border-bottom:1px solid var(--line); background: var(--surface-1); scrollbar-width:none; }
.catrail::-webkit-scrollbar { display:none; }
.cat-pill {
  display:flex; align-items:center; gap:8px; flex:none;
  height: 44px; padding: 0 16px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface-2);
  font-weight: 560; font-size: 13.5px; color: var(--text-secondary);
}
.cat-pill .swatch { width:9px; height:9px; border-radius:50%; background: var(--c, var(--accent)); }
.cat-pill .n { font-size:11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.cat-pill:hover { background: var(--surface-3); }
.cat-pill[aria-pressed="true"] { background: var(--text-primary); border-color: var(--text-primary); color: var(--surface-1); }
.cat-pill[aria-pressed="true"] .n { color: color-mix(in srgb, var(--surface-1) 70%, transparent); }

/* product grid */
.grid-scroll { flex:1; overflow-y:auto; padding: 14px; overscroll-behavior: contain; }
.prod-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 12px; }
.prod-card {
  position:relative; display:flex; flex-direction:column; text-align:left;
  min-height: 132px; padding: 12px; gap: 6px;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface-2); box-shadow: var(--shadow-1);
  transition: transform .08s ease, box-shadow .12s ease, border-color .12s ease;
}
.prod-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: var(--shadow-2); }
.prod-card:active { transform: scale(.97); }
.prod-card .thumb {
  width: 100%; height: 46px; border-radius: var(--radius-s);
  display:grid; place-items:center; font-size: 24px; line-height:1;
  background: var(--tint, var(--surface-3));
}
.prod-card .pname { font-size: 13.5px; font-weight: 560; line-height:1.28; flex:1;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.prod-card .prow { display:flex; align-items:baseline; justify-content:space-between; gap:6px; }
.prod-card .price { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.prod-card .sku { font-family: var(--mono); font-size: 10px; color: var(--text-muted); }
.prod-card .qty-flag {
  position:absolute; top:-7px; right:-7px; min-width:26px; height:26px; padding:0 7px;
  border-radius:99px; background: var(--accent); color:#fff; font-size:12.5px; font-weight:700;
  display:grid; place-items:center; box-shadow: var(--shadow-2); border:2px solid var(--surface-1);
}
.prod-card.out { opacity:.5; }
.prod-card .stock-tag { position:absolute; top:8px; right:8px; font-size:10px; font-weight:700; padding:2px 6px; border-radius:6px; }
.stock-tag.low { background: var(--warn-wash); color: var(--warn); }
.stock-tag.zero { background: var(--crit-wash); color: var(--crit); }

.empty-state { padding: 56px 20px; text-align:center; color: var(--text-muted); }
.empty-state .big { font-size: 34px; margin-bottom: 10px; opacity:.55; }

/* ----------------------------- cart --------------------------------- */
.cart { display:flex; flex-direction:column; background: var(--surface-1); min-width:0; }
.cart-head { display:flex; align-items:center; justify-content:space-between; gap:8px; padding: 12px 14px 10px; border-bottom:1px solid var(--line-soft); }
.cart-head h2 { margin:0; font-size: 15px; letter-spacing:-.01em; }
.cart-head .bill-no { font-family: var(--mono); font-size: 11.5px; color: var(--text-muted); }
.mini-btn {
  height: 32px; padding: 0 11px; border-radius: 9px; border:1px solid var(--line);
  background: var(--surface-2); font-size: 12.5px; font-weight: 560; color: var(--text-secondary);
}
.mini-btn:hover { background: var(--surface-3); color: var(--text-primary); }
.mini-btn.danger:hover { background: var(--crit-wash); border-color: var(--crit); color: var(--crit); }

.cart-lines { flex:1; overflow-y:auto; padding: 8px 10px; overscroll-behavior: contain; }
.line {
  display:grid; grid-template-columns: 1fr auto; gap: 4px 10px;
  padding: 10px; border-radius: var(--radius-s); margin-bottom: 6px;
  background: var(--surface-2); border:1px solid var(--line-soft);
}
.line.flash { animation: flash .5s ease; }
@keyframes flash { 0% { background: var(--accent-wash); border-color: var(--accent); } }
.line .l-name { font-size: 13.5px; font-weight: 560; line-height: 1.3; }
.line .l-meta { grid-column: 1 / -1; display:flex; flex-wrap:wrap; gap:6px; align-items:center; font-size: 11px; color: var(--text-muted); }
.line .l-meta .tag { background: var(--surface-3); padding: 1px 6px; border-radius: 5px; font-family: var(--mono); }
.line .l-meta .tag.disc { background: var(--good-wash); color: var(--good); font-family: var(--font); font-weight:700; }
.line .l-amt { font-weight: 700; font-variant-numeric: tabular-nums; text-align:right; font-size: 14px; }
.line .l-amt .was { display:block; font-size: 10.5px; font-weight:500; color: var(--text-muted); text-decoration: line-through; }
.line .l-ctl { grid-column: 1 / -1; display:flex; align-items:center; gap: 6px; margin-top: 2px; }
.stepper { display:flex; align-items:center; gap:2px; background: var(--surface-3); border-radius: 9px; padding: 2px; }
.stepper button { width: 34px; height: 34px; border:0; border-radius: 7px; background: transparent; font-size: 17px; font-weight:600; color: var(--text-secondary); line-height:1; }
.stepper button:hover { background: var(--surface-2); color: var(--text-primary); }
.stepper .qv { min-width: 34px; text-align:center; font-weight: 700; font-variant-numeric: tabular-nums; font-size:14px; }
.line .l-ctl .spacer { flex:1; }
.chip-btn { height:30px; padding:0 9px; border-radius:8px; border:1px solid var(--line); background: var(--surface-1); font-size:11.5px; font-weight:560; color: var(--text-secondary); }
.chip-btn:hover { background: var(--surface-3); color: var(--text-primary); }
.chip-btn.on { background: var(--good-wash); border-color: var(--good); color: var(--good); }
.chip-btn.x:hover { background: var(--crit-wash); border-color: var(--crit); color: var(--crit); }

.cart-empty { display:flex; flex-direction:column; align-items:center; justify-content:center; height:100%; color: var(--text-muted); text-align:center; gap:6px; padding: 20px; }
.cart-empty .big { font-size: 40px; opacity:.4; }
.cart-empty p { margin:0; font-size:13px; max-width: 230px; }

/* totals */
.cart-foot { border-top:1px solid var(--line); padding: 12px 14px 14px; background: var(--surface-1); }
.trow { display:flex; justify-content:space-between; align-items:center; font-size: 13px; padding: 3px 0; color: var(--text-secondary); }
.trow .v { font-variant-numeric: tabular-nums; color: var(--text-primary); font-weight: 560; }
.trow.disc .v, .trow.disc .k { color: var(--good); }
.trow button.linkish { border:0; background:none; padding:0 0 0 6px; color: var(--accent); font-size:12px; font-weight:600; text-decoration: underline; text-underline-offset:2px; }
.trow.grand { margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 15px; color: var(--text-primary); font-weight: 700; }
.trow.grand .v { font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.tax-detail { font-size: 11px; color: var(--text-muted); padding: 2px 0 0 10px; display:flex; justify-content:space-between; }

.cart-actions { display:grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.btn {
  height: var(--tap); display:flex; align-items:center; justify-content:center; gap:8px;
  border-radius: var(--radius-s); border:1px solid var(--line); background: var(--surface-2);
  font-size: 14px; font-weight: 600; color: var(--text-primary);
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity:.45; cursor:not-allowed; }
.btn kbd { font-family: var(--mono); font-size:10px; opacity:.6; border:1px solid currentColor; border-radius:4px; padding:0 4px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color:#fff; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.pay { grid-column: 1 / -1; height: 58px; font-size: 17px; font-weight: 700; border-radius: var(--radius); }
.btn.pay .amt { font-variant-numeric: tabular-nums; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 40%, var(--line)); }
.btn.danger:hover { background: var(--crit-wash); }
.btn.sm { height: 38px; font-size: 13px; padding: 0 14px; }
.btn.block { width: 100%; }

/* =========================== MODALS ================================= */
.modal-host { position: fixed; inset: 0; z-index: 100; }
.modal-backdrop { position:absolute; inset:0; background: rgba(8,8,8,.52); backdrop-filter: blur(3px); animation: fade .15s ease; }
@keyframes fade { from { opacity: 0 } }
.modal-shell {
  position: relative; background: var(--surface-1); border-radius: var(--radius-l);
  box-shadow: var(--shadow-3); max-height: calc(100vh - 48px); width: 100%;
  display:flex; flex-direction:column; overflow:hidden; animation: pop .16s cubic-bezier(.2,.8,.3,1);
}
@keyframes pop { from { opacity:0; transform: translateY(10px) scale(.985) } }
.modal-shell.sm  { max-width: 440px; }
.modal-shell.md  { max-width: 640px; }
.modal-shell.lg  { max-width: 940px; }
.modal-shell.xl  { max-width: 1120px; }
.modal-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding: 16px 20px; border-bottom:1px solid var(--line); }
.modal-head h2 { margin:0; font-size: 17px; letter-spacing:-.01em; }
.modal-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-muted); }
.modal-body { padding: 20px; overflow-y:auto; }
.modal-body.tight { padding: 0; }
.modal-foot { display:flex; gap:10px; justify-content:flex-end; padding: 14px 20px; border-top:1px solid var(--line); background: var(--surface-1); }
.modal-foot .grow { flex:1; }
.x-btn { width:36px; height:36px; border-radius:9px; border:1px solid var(--line); background:var(--surface-2); font-size:16px; color:var(--text-secondary); flex:none; }
.x-btn:hover { background: var(--surface-3); }

/* ----------------------------- forms -------------------------------- */
.field { display:flex; flex-direction:column; gap: 5px; margin-bottom: 14px; }
.field > label { font-size: 12px; font-weight: 640; color: var(--text-secondary); letter-spacing:.01em; }
.field .help { font-size: 11.5px; color: var(--text-muted); }
.input, select.input, textarea.input {
  height: var(--tap); padding: 0 12px; width: 100%;
  border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--surface-2);
  font-size: 14.5px;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; min-height: 76px; }
select.input { appearance:none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-wash); outline:none; }
.input.mono { font-family: var(--mono); }
.form-grid { display:grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .span2 { grid-column: 1 / -1; }
.seg { display:flex; gap:4px; background: var(--surface-3); padding:3px; border-radius: var(--radius-s); }
.seg button { flex:1; height: 38px; border:0; border-radius: 8px; background:transparent; font-size:13px; font-weight:600; color: var(--text-secondary); }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--text-primary); box-shadow: var(--shadow-1); }
.switch-row { display:flex; align-items:center; justify-content:space-between; gap:12px; padding: 11px 0; border-bottom:1px solid var(--line-soft); }
.switch-row:last-child { border-bottom:0; }
.switch-row .t { font-size: 13.5px; font-weight: 560; }
.switch-row .d { font-size: 11.5px; color: var(--text-muted); }
.switch { width: 48px; height: 28px; border-radius: 99px; border:1px solid var(--line); background: var(--surface-3); position:relative; flex:none; transition: background .15s; }
.switch::after { content:""; position:absolute; top:2px; left:2px; width: 22px; height: 22px; border-radius:50%; background: var(--surface-1); box-shadow: var(--shadow-1); transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

/* ---------------------------- numpad -------------------------------- */
.numpad { display:grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.numpad button {
  height: 56px; border-radius: var(--radius-s); border:1px solid var(--line);
  background: var(--surface-2); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.numpad button:hover { background: var(--surface-3); }
.numpad button:active { transform: scale(.96); }
.numpad button.wide { grid-column: span 2; }
.numpad button.act { background: var(--surface-3); font-size: 15px; font-weight: 600; }
.amount-display {
  border-radius: var(--radius); border:1px solid var(--line); background: var(--surface-2);
  padding: 12px 16px; margin-bottom: 12px; text-align:right;
}
.amount-display .lbl { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing:.06em; }
.amount-display .val { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing:-.02em; line-height:1.15; }

/* ---------------------------- payment ------------------------------- */
.pay-layout { display:grid; grid-template-columns: 1fr 320px; min-height: 0; }
.pay-left { padding: 20px; border-right:1px solid var(--line); overflow-y:auto; }
.pay-right { padding: 20px; background: var(--surface-0); overflow-y:auto; display:flex; flex-direction:column; }
.due-hero { text-align:center; padding: 6px 0 16px; }
.due-hero .lbl { font-size: 12px; text-transform:uppercase; letter-spacing:.07em; color: var(--text-muted); }
.due-hero .val { font-size: 42px; font-weight: 760; letter-spacing:-.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.due-hero.settled .val { color: var(--good); }
.due-hero.change .val { color: var(--accent); }
.method-grid { display:grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.method-btn {
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:5px;
  height: 78px; border-radius: var(--radius); border:1px solid var(--line); background: var(--surface-2);
  font-size: 13px; font-weight: 600;
}
.method-btn .mi { font-size: 21px; }
.method-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-wash); color: var(--accent-ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.quick-cash { display:grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.quick-cash button { height: 46px; border-radius: var(--radius-s); border:1px dashed var(--line); background: transparent; font-weight: 640; font-variant-numeric: tabular-nums; font-size: 13.5px; }
.quick-cash button:hover { border-style:solid; border-color: var(--accent); color: var(--accent-ink); background: var(--accent-wash); }
.tender-list { flex:1; margin: 0 0 12px; padding: 0; list-style:none; min-height: 60px; }
.tender-list li { display:flex; align-items:center; gap:10px; padding: 10px 12px; border-radius: var(--radius-s); background: var(--surface-2); border:1px solid var(--line-soft); margin-bottom: 6px; }
.tender-list .mi { width: 30px; height: 30px; border-radius: 8px; display:grid; place-items:center; background: var(--surface-3); font-size: 14px; flex:none; }
.tender-list .tm { flex:1; min-width:0; }
.tender-list .tm b { display:block; font-size: 13px; }
.tender-list .tm small { font-size: 11px; color: var(--text-muted); font-family: var(--mono); }
.tender-list .ta { font-weight: 700; font-variant-numeric: tabular-nums; }
.tender-list .tx { width: 28px; height: 28px; border-radius: 7px; border:0; background: transparent; color: var(--text-muted); flex:none; }
.tender-list .tx:hover { background: var(--crit-wash); color: var(--crit); }
.tender-empty { text-align:center; color: var(--text-muted); font-size: 12.5px; padding: 22px 10px; border: 1px dashed var(--line); border-radius: var(--radius-s); }

/* =========================== TABLES ================================= */
.panel { background: var(--surface-1); border:1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow:hidden; margin-bottom: 18px; }
.panel-head { display:flex; align-items:center; justify-content:space-between; gap: 12px; padding: 14px 16px; border-bottom:1px solid var(--line); flex-wrap: wrap; }
.panel-head h3 { margin:0; font-size: 14.5px; letter-spacing:-.01em; }
.panel-head p { margin:2px 0 0; font-size: 12px; color: var(--text-muted); }
.panel-body { padding: 16px; }
.table-scroll { overflow-x:auto; max-height: 520px; overflow-y:auto; }
table.tbl { width:100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th, table.tbl td { padding: 10px 14px; text-align:left; border-bottom: 1px solid var(--line-soft); white-space:nowrap; }
table.tbl th { font-size: 11px; text-transform: uppercase; letter-spacing:.06em; color: var(--text-muted); font-weight: 700; background: var(--surface-1); position:sticky; top:0; z-index:1; }
table.tbl td.r, table.tbl th.r { text-align:right; font-variant-numeric: tabular-nums; }
table.tbl tbody tr:hover { background: var(--surface-3); }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl td .sub { display:block; font-size: 11px; color: var(--text-muted); }
table.tbl td.wrap { white-space: normal; min-width: 180px; }
.pill { display:inline-flex; align-items:center; gap:5px; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; background: var(--surface-3); color: var(--text-secondary); }
.pill.good { background: var(--good-wash); color: var(--good); }
.pill.warn { background: var(--warn-wash); color: var(--warn); }
.pill.crit { background: var(--crit-wash); color: var(--crit); }
.pill.info { background: var(--accent-wash); color: var(--accent-ink); }
.row-actions { display:flex; gap:6px; justify-content:flex-end; }

/* =========================== DASHBOARD ============================== */
.page-head { display:flex; align-items:flex-end; justify-content:space-between; gap: 16px; flex-wrap:wrap; margin-bottom: 18px; }
.page-head h1 { margin:0; font-size: 24px; letter-spacing:-.02em; }
.page-head p { margin: 4px 0 0; color: var(--text-secondary); font-size: 13.5px; }
.toolbar { display:flex; gap: 8px; align-items:center; flex-wrap:wrap; }

.kpi-row { display:grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi {
  background: var(--surface-1); border:1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-1);
}
.kpi .k { font-size: 11.5px; text-transform:uppercase; letter-spacing:.06em; color: var(--text-muted); font-weight: 700; }
.kpi .v { font-size: 27px; font-weight: 740; letter-spacing:-.025em; font-variant-numeric: tabular-nums; line-height: 1.22; margin-top: 2px; }
.kpi .d { font-size: 12px; color: var(--text-secondary); }
.kpi.accent .v { color: var(--accent-ink); }

/* charts */
.chart-row { display:grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
@media (max-width: 900px) { .chart-row { grid-template-columns: 1fr; } }
.legend { display:flex; flex-wrap:wrap; gap: 4px 14px; margin-bottom: 12px; }
.legend .li { display:inline-flex; align-items:center; gap:6px; font-size: 12px; color: var(--text-secondary); }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex:none; }

/* horizontal bars (magnitude by named category) */
.hbars { display:flex; flex-direction:column; gap: 10px; }
.hbar { display:grid; grid-template-columns: 116px 1fr auto; gap: 10px; align-items:center; font-size: 12.5px; }
.hbar .lab { color: var(--text-secondary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.hbar .track { height: 12px; background: var(--surface-3); border-radius: 99px; overflow:hidden; }
.hbar .fill { height:100%; border-radius: 99px; background: var(--series-1); transition: width .4s cubic-bezier(.2,.8,.3,1); min-width: 3px; }
.hbar .val { font-variant-numeric: tabular-nums; font-weight: 640; min-width: 74px; text-align:right; }
.hbar:hover .track { background: color-mix(in srgb, var(--text-muted) 22%, var(--surface-3)); }

/* vertical column chart (hourly) */
.vchart { display:flex; align-items:flex-end; gap: 4px; height: 168px; padding-top: 22px; }
.vcol { flex:1; display:flex; flex-direction:column; justify-content:flex-end; align-items:center; height:100%; position:relative; min-width:0; }
.vcol .vfill { width: 100%; background: var(--series-1); border-radius: 4px 4px 0 0; min-height: 2px; transition: height .4s cubic-bezier(.2,.8,.3,1); }
.vcol .vlab { font-size: 9.5px; color: var(--text-muted); margin-top: 5px; font-variant-numeric: tabular-nums; white-space:nowrap; }
.vcol .vtip {
  position:absolute; bottom: 100%; left: 50%; transform: translate(-50%, -6px);
  background: var(--text-primary); color: var(--surface-1); font-size: 11px; font-weight: 600;
  padding: 4px 8px; border-radius: 6px; white-space:nowrap; opacity: 0; pointer-events:none; transition: opacity .1s;
  z-index: 3;
}
.vcol:hover .vtip { opacity: 1; }
.vcol:hover .vfill { filter: brightness(1.12); }
.vcol.quiet .vfill { background: var(--surface-3); }

/* stacked share bar (payment mix) */
.stack-bar { display:flex; height: 34px; border-radius: 9px; overflow:hidden; background: var(--surface-3); gap: 2px; }
.stack-bar .seg-fill { position:relative; display:grid; place-items:center; font-size: 11.5px; font-weight: 700; color:#fff; min-width: 2px; }
.stack-bar .seg-fill:first-child { border-radius: 9px 0 0 9px; }
.stack-bar .seg-fill:last-child { border-radius: 0 9px 9px 0; }
.stack-bar .seg-fill .vtip { position:absolute; bottom: calc(100% + 6px); left:50%; transform: translateX(-50%);
  background: var(--text-primary); color: var(--surface-1); font-size:11px; font-weight:600; padding: 4px 8px;
  border-radius:6px; white-space:nowrap; opacity:0; pointer-events:none; transition: opacity .1s; z-index:3; }
.stack-bar .seg-fill:hover .vtip { opacity:1; }

.chart-note { font-size: 11.5px; color: var(--text-muted); margin-top: 12px; }
.chart-empty { padding: 34px 10px; text-align:center; color: var(--text-muted); font-size: 13px; }

/* =========================== SHIFT ================================== */
.shift-hero {
  display:grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: 1px;
  background: var(--line); border:1px solid var(--line); border-radius: var(--radius); overflow:hidden; margin-bottom: 18px;
}
.shift-hero > div { background: var(--surface-1); padding: 16px 18px; }
.shift-hero .k { font-size: 11.5px; text-transform:uppercase; letter-spacing:.06em; color: var(--text-muted); font-weight:700; }
.shift-hero .v { font-size: 22px; font-weight: 720; font-variant-numeric: tabular-nums; letter-spacing:-.02em; }
.recon-row { display:flex; justify-content:space-between; padding: 9px 0; border-bottom:1px solid var(--line-soft); font-size: 13.5px; }
.recon-row.total { border-top: 2px solid var(--line); border-bottom:0; margin-top: 6px; padding-top: 12px; font-weight: 700; font-size: 15px; }
.recon-row .v { font-variant-numeric: tabular-nums; }
.var-box { border-radius: var(--radius); padding: 14px 16px; text-align:center; margin-top: 14px; }
.var-box.ok { background: var(--good-wash); color: var(--good); }
.var-box.short { background: var(--crit-wash); color: var(--crit); }
.var-box.over { background: var(--warn-wash); color: var(--warn); }
.var-box .v { font-size: 26px; font-weight: 750; font-variant-numeric: tabular-nums; }
.var-box .k { font-size: 12px; font-weight: 700; text-transform:uppercase; letter-spacing:.06em; }

/* =========================== HELD =================================== */
.held-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(268px,1fr)); gap: 14px; }
.held-card { background: var(--surface-1); border:1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-1); display:flex; flex-direction:column; gap: 10px; }
.held-card h4 { margin:0; font-size: 15px; }
.held-card .meta { font-size: 11.5px; color: var(--text-muted); display:flex; flex-wrap:wrap; gap: 4px 10px; }
.held-card ul { margin:0; padding: 8px 0 0; list-style:none; font-size: 12.5px; color: var(--text-secondary); border-top:1px dashed var(--line); }
.held-card ul li { display:flex; justify-content:space-between; gap: 8px; padding: 2px 0; }
.held-card ul li span:first-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.held-card .tot { display:flex; justify-content:space-between; align-items:baseline; font-weight:700; border-top:1px solid var(--line); padding-top: 9px; }
.held-card .tot .v { font-size: 19px; font-variant-numeric: tabular-nums; }
.held-card .acts { display:grid; grid-template-columns: 1fr auto; gap:8px; }

/* =========================== TOASTS ================================= */
.toast-stack { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display:flex; flex-direction:column-reverse; gap: 8px; align-items:center; pointer-events:none; }
.toast {
  display:flex; align-items:center; gap: 10px; padding: 11px 16px; border-radius: 99px;
  background: var(--text-primary); color: var(--surface-1); font-size: 13.5px; font-weight: 560;
  box-shadow: var(--shadow-3); animation: toastIn .18s cubic-bezier(.2,.8,.3,1);
  max-width: 78vw;
}
.toast.good { background: var(--good); color: #fff; }
.toast.bad  { background: var(--crit); color: #fff; }
.toast.out  { animation: toastOut .18s ease forwards; }
@keyframes toastIn  { from { opacity:0; transform: translateY(12px) } }
@keyframes toastOut { to   { opacity:0; transform: translateY(8px) } }

/* ====================== RECEIPT (screen preview) ==================== */
.receipt-preview { background: var(--surface-3); padding: 20px; display:grid; place-items:start center; }
.receipt {
  width: 302px;                 /* 80mm thermal roll at ~96dpi */
  background: #fff; color: #111;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.5;
  padding: 16px 14px; box-shadow: var(--shadow-2); border-radius: 4px;
}
.receipt .r-center { text-align:center; }
.receipt .r-store { font-size: 15px; font-weight: 700; letter-spacing: .04em; }
.receipt .r-sub { font-size: 10.5px; }
.receipt hr { border:0; border-top: 1px dashed #999; margin: 8px 0; }
.receipt .r-kv { display:flex; justify-content:space-between; gap: 8px; }
.receipt table { width:100%; border-collapse: collapse; }
.receipt table td { padding: 2px 0; vertical-align: top; }
.receipt td.qty { width: 30px; }
.receipt td.amt { text-align:right; width: 66px; white-space:nowrap; }
.receipt .r-item-sub { font-size: 10px; color: #555; padding-left: 4px; }
.receipt .r-tot { font-size: 14px; font-weight: 700; }
.receipt .r-barcode {
  margin: 10px auto 4px; height: 38px; width: 200px;
  background: repeating-linear-gradient(90deg,#111 0 2px,#fff 2px 4px,#111 4px 5px,#fff 5px 9px,#111 9px 12px,#fff 12px 13px);
}
.receipt .r-foot { font-size: 10px; text-align:center; }

/* ========================= RESPONSIVE =============================== */
@media (max-width: 1180px) { :root { --cart-w: 348px; } .tab kbd { display:none; } }
@media (max-width: 1024px) {
  :root { --cart-w: 320px; }
  .brand-text { display:none; }
  .brand { min-width: 0; }
  .tab { padding: 0 11px; font-size: 13px; }
  .prod-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .pay-layout { grid-template-columns: 1fr; }
  .pay-left { border-right:0; border-bottom:1px solid var(--line); }
}
@media (max-width: 820px) {
  .register { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .catalog { border-right:0; border-bottom:1px solid var(--line); }
  .cart { max-height: 46vh; }
  .clock { display:none; }
  .shift-chip { padding: 0 10px; }
  .shift-chip #shiftChipText { display:none; }
  .form-grid { grid-template-columns: 1fr; }
  .tab .ti { font-size: 15px; }
  .tab > span:not(.ti) { display:none; }
  .pad-view { padding: 16px 14px 32px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration:.01ms !important; transition-duration:.01ms !important; } }

/* the print surface is hidden on screen; print.css reveals it */
.print-area { display: none; }
