/* ============================================================
   Kafe Hermes v2 — style.css (shared across all pages)
   Same warm coffee palette as the tested POS v1.
   ============================================================ */

:root {
  --espresso: #2B1B12;
  --espresso-2: #3D2A1D;
  --latte: #F5EDE3;
  --cream: #FBF6EF;
  --caramel: #C08552;
  --caramel-dark: #A06C3F;
  --price: #96562B;        /* price text: 5.73:1 on white, 5.33:1 on cream (caramel-dark was 4.46 — under AA) */
  --amber-ink: #9A5B00;    /* amber as TEXT: 5.05:1 on cream (--amber is 2.62:1 and stays a fill colour only) */
  --mocha: #6B4F3A;
  --white: #FFFFFF;
  --line: #E5D8C8;
  --green: #2F7D52;        /* AA on cream: 4.68:1 text, 5.03:1 with white text */
  --green-dark: #256B45;
  --mut: #7A6449;          /* muted text — AA on cream (5.21:1), was #A08970 (3.10:1) */
  --red: #C0392B;
  --amber: #D68910;
  --shadow: 0 8px 24px rgba(43, 27, 18, 0.12);
  --sans: 'Manrope', -apple-system, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--sans); color: var(--mocha);
  background: var(--cream); -webkit-font-smoothing: antialiased;
}

/* ===== Login ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--espresso); padding: 20px; }
.login-card { background: var(--cream); border-radius: 16px; padding: 40px 36px; width: 100%; max-width: 380px; box-shadow: var(--shadow); }
.login-card .brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 8px; font-weight: 800; font-size: 22px; color: var(--espresso); }
.login-card .brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--caramel); }
.login-sub { text-align: center; color: var(--mocha); font-size: 13px; margin-bottom: 28px; }
.login-card .form-row { margin-bottom: 16px; }
.login-card label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--mocha); margin-bottom: 6px; }
.login-card input { width: 100%; padding: 13px 16px; border: 1px solid var(--line); border-radius: 8px; font-family: var(--sans); font-size: 16px; background: var(--white); outline: none; }
.login-card input:focus { border-color: var(--caramel); }
.login-err { background: #FDEAEA; color: var(--red); padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; display: none; }
.login-err.show { display: block; }
.btn-primary { width: 100%; padding: 14px; border: none; border-radius: 8px; background: var(--espresso); color: #fff; font-family: var(--sans); font-size: 15px; font-weight: 800; cursor: pointer; }
.btn-primary:hover { background: var(--espresso-2); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== Top bar (app pages) ===== */
.topbar { min-height: 56px; flex-shrink: 0; /* the flex column (body.till) was squeezing the header to its
   min-height whenever the nav wrapped to a second row, so the nav overflowed on top of the page content —
   visible on phones and tablets (fixed 2026-10-08). A header must never shrink. */
  background: var(--espresso); color: #F0E4D4; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 8px 16px; gap: 6px 12px; position: sticky; top: 0; z-index: 50; }
.topbar .brand { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.topbar .brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--caramel); }
.topbar .role-pill { font-size: 11px; background: rgba(255,255,255,0.15); padding: 4px 10px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.06em; }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a { color: #D8C4AC; text-decoration: none; font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 8px; white-space: nowrap; }
.topbar nav a:hover { background: var(--espresso-2); color: #fff; }
.topbar nav a.active { background: #96562B; color: #fff; }   /* white on --caramel measured 3.12:1; on this it is 5.73:1 */
.topbar .logout { background: none; border: 1px solid rgba(255,255,255,0.3); color: #F0E4D4; padding: 6px 12px; border-radius: 8px; font-size: 12px; cursor: pointer; }
.topbar .logout:hover { background: rgba(255,255,255,0.15); }

/* ===== Order page layout ===== */
.layout { display: grid; grid-template-columns: 180px 1fr 320px; flex: 1 1 auto; min-height: 0; }
/* body is a flex column: topbar (auto) + layout (fills what's left). The old
   `height: calc(100vh - 56px/72px)` guessed the topbar height and left a strip unused at the bottom
   whenever the guess was wrong (measured 2026-09-23: topbar renders 56px → 16px dead strip). */
body.till { display: flex; flex-direction: column; min-height: 100vh; }
/* Fill the desktop viewport exactly (no page scroll, panels scroll internally).
   Locked at >=1024px only: on tablets/phones the layout stacks and MUST keep scrolling —
   with overflow:hidden at 390px the cart and queue below the fold were unreachable. */
@media (min-width: 1024px) {
  body.till { height: 100vh; min-height: 0; overflow: hidden; }
}
/* The till has FOUR panels (categories · products · cart · incoming orders) but the grid only
   defined 3 columns, so the queue wrapped onto a second row under the categories and left the rest
   of that row empty — the "unused bottom of the screen". Wide tills: queue gets its own column.
   Narrower tills: queue sits under the cart in column 3, and products/sidebar span the full height. */
@media (min-width: 1440px) {
  .layout { grid-template-columns: 180px 1fr 340px 300px; }
}
@media (min-width: 961px) and (max-width: 1439px) {
  .layout { grid-template-columns: 180px 1fr 320px; grid-template-rows: 1fr auto; }
  .sidebar { grid-column: 1; grid-row: 1 / 3; }
  .products { grid-column: 2; grid-row: 1 / 3; }
  .cart-panel { grid-column: 3; grid-row: 1; min-height: 0; }
  .queue-panel { grid-column: 3; grid-row: 2; max-height: 42vh; }
}
.sidebar { background: var(--espresso); padding: 12px; overflow-y: auto; display: flex; flex-direction: column; }
.rail-foot { margin-top: auto; padding: 12px 12px 4px; border-top: 1px solid rgba(255,255,255,.12); display: flex; align-items: baseline; justify-content: space-between; color: #D8C4AC; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.rail-foot b { font-size: 20px; color: #fff; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.cat-btn { display: block; width: 100%; text-align: left; background: none; border: none; color: #D8C4AC; padding: 12px 14px; border-radius: 8px; font-family: var(--sans); font-size: 14px; font-weight: 600; cursor: pointer; margin-bottom: 4px; }
.cat-btn:hover { background: var(--espresso-2); color: #fff; }
.cat-btn.active { background: var(--caramel); color: var(--espresso); }
.products { background: var(--latte); padding: 16px; overflow-y: auto; }
/* The till is a desktop surface: the panels still scroll, but no scrollbar chrome is drawn.
   Hiding the bar (not the overflow) keeps wheel/touch scrolling and the app fills the screen edge to edge. */
.products, .sidebar, .queue-panel, .cart-list, .q-scroll, #queueList, .queue-list { scrollbar-width: none; -ms-overflow-style: none; }
.products::-webkit-scrollbar, .sidebar::-webkit-scrollbar, .queue-panel::-webkit-scrollbar,
.cart-list::-webkit-scrollbar, .q-scroll::-webkit-scrollbar,
#queueList::-webkit-scrollbar, .queue-list::-webkit-scrollbar { width: 0; height: 0; display: none; }
.prod-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.prod-head h2 { color: var(--espresso); font-size: 22px; }
.count { color: var(--mut); font-size: 13px; }
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.prod-tile { background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 11px 8px; text-align: center; cursor: pointer; transition: all .2s; }
.prod-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--caramel); }
.prod-tile:active { transform: scale(0.97); }
.p-name { font-size: 13px; font-weight: 600; display: block; }
.p-price { font-size: 14px; font-weight: 800; color: var(--price); display: block; margin-top: 4px; font-variant-numeric: tabular-nums; }

.cart-panel { background: var(--white); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
/* Two bare inputs read as one grey block; 10px caps labels make them deliberate and match the login form. */
.field-mini { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.field-mini > span { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--mut); }
.field-mini input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-family: var(--sans); font-size: 13px; color: var(--espresso); background: #fff; }
.cart-head h3 { font-size: 15px; color: var(--espresso); }
.link-btn { background: none; border: none; color: var(--mut); font-size: 12.5px; cursor: pointer; }
.table-note-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 14px 0; }
.cart-list { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 12px; }
/* overflow-x:hidden everywhere: with overflow-y:auto, a stray 5px makes the browser draw a
   horizontal scrollbar across the bill list on desktop too. */
.cart-empty { text-align: center; color: var(--mut); font-size: 13px; padding: 30px 10px; }
/* Edit-order sheet: the line rows used to push past the card and raise a horizontal scrollbar. */
.q-scroll { overflow-y: auto; overflow-x: hidden; flex: 1; min-height: 0; padding-right: 2px; }
.q-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--cream); margin-bottom: 8px; min-width: 0; }
.q-row .q-name { flex: 1; min-width: 0; padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; font-weight: 600; font-family: var(--sans); color: var(--espresso); }
.q-row .q-price { font-weight: 800; font-size: 13px; color: var(--price); white-space: nowrap; font-variant-numeric: tabular-nums; }
.q-row .q-step { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; border: 1px solid var(--line); background: #fff; font-size: 16px; font-weight: 800; color: var(--espresso); cursor: pointer; line-height: 1; }
.q-row .q-step:active { transform: scale(.92); }
.q-row .q-qty { min-width: 22px; flex: 0 0 22px; text-align: center; font-weight: 800; font-size: 14px; color: var(--espresso); font-variant-numeric: tabular-nums; }
.q-row .void-line-btn { flex: 0 0 auto; }
/* Empty cart: a dashed drop-zone that fills the void instead of a lone line of text
   floating in white space. */
.cart-list .cart-empty, .cart-empty.dash { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; margin: 14px; padding: 40px 18px; min-height: 180px; border: 1.5px dashed var(--line); border-radius: 12px; background: rgba(245,237,227,.45); color: var(--mut); font-weight: 600; line-height: 1.45; }
.cart-empty.dash svg { width: 26px; height: 26px; color: var(--caramel-dark); opacity: .85; }
.cart-line { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; padding: 8px 4px; border-bottom: 1px dashed var(--line); }
.cl-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* grid items default to min-width:auto, so a long item name pushed the price and the X button
   out of the bill column (horizontal scrollbar on every desktop bill). Let it shrink instead. */
.cart-line .cl-name { min-width: 0; }
.cl-price { font-size: 13px; color: var(--mut); display: block; }
.cl-qty { display: flex; align-items: center; gap: 5px; }
.qty-btn { width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line); background: var(--cream); cursor: pointer; font-size: 16px; font-weight: 700; line-height: 1; color: var(--espresso); }
.qty-btn:hover { background: var(--caramel); color: #fff; }
.qty-num { font-weight: 800; font-size: 14.5px; min-width: 20px; text-align: center; }
.cl-total { font-weight: 800; font-size: 14.5px; min-width: 56px; text-align: right; color: var(--espresso); }
.cl-del { background: none; border: none; color: var(--mocha); cursor: pointer; font-size: 16px; line-height: 1; padding: 6px 8px; min-width: 32px; min-height: 32px; border-radius: 6px; }
.cl-del:hover { background: var(--latte); color: var(--red); }

.cart-totals { border-top: 1px solid var(--line); padding: 10px 14px; }
.total-row { display: flex; justify-content: space-between; font-size: 14px; padding: 3px 0; }
.total-row.total { font-size: 22px; font-weight: 900; color: var(--espresso); border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px; }
.pay-row { display: flex; gap: 8px; margin: 10px 14px 8px; }
.pay-btn { flex: 1; padding: 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--cream); color: var(--espresso); font-weight: 700; font-size: 13px; cursor: pointer; font-family: var(--sans); }
.pay-btn.active { background: var(--espresso); color: #fff; border-color: var(--espresso); }
.charge-btn { margin: 0 14px 12px; padding: 16px; border: none; border-radius: 10px; background: var(--espresso); color: #fff; font-family: var(--sans); font-size: 14px; font-weight: 800; cursor: pointer; }
.charge-btn:disabled { background: #EFE7DC; color: #6B4F3A; cursor: not-allowed; }

/* ===== Incoming orders queue (PC till) ===== */
.queue-panel { background: var(--white); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.queue-head { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.queue-head h3 { font-size: 15px; color: var(--espresso); }
.queue-list { flex: 1; overflow-y: auto; padding: 10px 12px; }
.queue-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--cream); }
/* Ticket header: number/tab on the left, status right, and the three low-stakes actions as
   quiet 28px icon buttons. Before this, Print/Edit/Add were full-width slabs and one card ate
   275px of a 900px column — only two and a half open tabs were visible. */
.queue-item .q-head { display: flex; align-items: center; gap: 8px; }
.queue-item .q-head .q-no { font-weight: 800; font-size: 13.5px; color: var(--espresso); }
.queue-item .q-head .q-st { margin-left: auto; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--mocha); background: rgba(107,79,58,.10); padding: 3px 8px; border-radius: 20px; }
.queue-item .q-tools { display: flex; gap: 8px; }   /* WCAG 2.2 target spacing: 24px circles must not overlap */
.queue-item .q-ico { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; background: #fff; border: 1px solid var(--line); border-radius: 7px; color: var(--mocha); cursor: pointer; padding: 0; }
.queue-item .q-ico:hover { border-color: var(--caramel); color: var(--espresso); }
.queue-item .q-ico:active { transform: scale(.94); }
.queue-item .q-ico svg { width: 14px; height: 14px; }
.queue-item .q-head { display: flex; justify-content: space-between; font-weight: 800; color: var(--espresso); margin-bottom: 6px; }
.queue-item .q-items { font-size: 12.5px; color: var(--mocha); margin-bottom: 8px; }
.queue-item .q-items span { display: block; }
.queue-item .q-total { font-weight: 800; font-size: 15px; color: var(--espresso); font-variant-numeric: tabular-nums; margin-top: 4px; }
/* Action row: fits 2 buttons per line on narrow cards, 4+ on wide — never overflows */
.queue-item .q-actions { display: grid; grid-template-columns: 2fr 1fr auto; gap: 6px; margin-top: 8px; }
.queue-item .q-actions .fulfill-btn,
.queue-item .q-actions .cancel-btn,
.queue-item .q-actions .split-btn { width: 100%; margin-top: 0; padding: 9px 6px; border: none; border-radius: 8px; font-weight: 700; font-size: 12.5px; cursor: pointer; text-align: center; white-space: nowrap; }
.queue-item .q-actions .fulfill-btn { background: var(--green); color: #fff; }
.queue-item .q-actions .fulfill-btn:hover { background: var(--green-dark); }
.queue-item .q-actions .split-btn { background: var(--caramel); color: var(--espresso); }
.queue-item .q-actions .cancel-btn { background: var(--red); color: #fff; }
/* The payment method was already chosen when the tab was opened, so collecting is ONE button.
   It spans the row; split stays available as a quiet secondary for mixed tender. */
.queue-item .q-actions .primary-pay { background: var(--green); color: #fff; font-size: 13px; padding: 10px 8px; }
.queue-item .q-actions .primary-pay:hover { background: var(--green-dark); }
.queue-item .print-btn { width: 100%; margin-top: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--mocha); font-weight: 600; font-size: 12.5px; cursor: pointer; }

/* ===== Toast / confirmation ===== */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--espresso); color: #fff; padding: 14px 22px; border-radius: 10px; font-weight: 700; font-size: 14px; box-shadow: var(--shadow); transition: transform .3s; z-index: 200; }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.green { background: var(--green); }
.toast.amber { background: #D68910; }
.toast.red { background: #C0392B; }

/* ===== Pages (shift, menu) ===== */
.page { max-width: 860px; margin: 0 auto; padding: 24px 16px 60px; }
.page h1 { color: var(--espresso); font-size: 24px; margin-bottom: 6px; }
.page .sub { color: var(--mocha); font-size: 13.5px; margin-bottom: 24px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 20px; }
.card h2 { color: var(--espresso); font-size: 17px; margin-bottom: 14px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--mocha); margin-bottom: 5px; }
.form-row input, .form-row select, .form-row textarea { width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 8px; font-family: var(--sans); font-size: 14px; background: var(--cream); outline: none; }
.form-row input:focus, .form-row select:focus { border-color: var(--caramel); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--cream); border: 1px solid var(--line); border-radius: 10px; padding: 14px; text-align: center; }
.stat .num { font-size: 24px; font-weight: 800; color: var(--espresso); display: block; letter-spacing: -.01em; }
.stat .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--mocha); }
.disc-ok { color: var(--green); font-weight: 800; }
.disc-short { color: var(--red); font-weight: 800; }
.disc-over { color: var(--amber-ink); font-weight: 800; }
table.simple { width: 100%; border-collapse: collapse; }
table.simple th, table.simple td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
table.simple th { text-transform: uppercase; font-size: 11px; letter-spacing: 0.05em; color: var(--mocha); }
.menu-row { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.menu-row input { flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.menu-row .del-btn { background: none; border: none; color: var(--red); font-size: 16px; cursor: pointer; }
.btn-sm { padding: 9px 15px; border: none; border-radius: 8px; background: var(--caramel); color: var(--espresso); font-weight: 700; font-size: 12.5px; cursor: pointer; font-family: var(--sans); }
.btn-sm:hover { background: var(--caramel-dark); }
.btn-sm.green { background: var(--espresso); color: #fff; } /* was inheriting .btn-sm's dark text -> invisible */
.btn-sm.green:hover { background: var(--espresso-2); }
.btn-sm.outline { background: var(--white); border: 1px solid var(--line); color: var(--mocha); }
.err { background: #FDEAEA; color: var(--red); padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; display: none; }
.err.show { display: block; }
.loading { text-align: center; color: var(--mocha); padding: 40px; font-size: 14px; }

/* ===== Responsive ===== */
@media (max-width: 960px) {
  /* Top bar: two rows — row 1: brand + logout, row 2: nav links (scrollable) */
  .topbar { flex-wrap: wrap; padding: 6px 10px; gap: 4px 8px; }
  .topbar .brand { order: 1; flex-shrink: 0; }
  .topbar .logout { order: 2; margin-left: auto; flex-shrink: 0; }
  .topbar .role-pill { display: none; }
  .topbar nav {
    order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; max-width: 100%;
  }
  .topbar nav::-webkit-scrollbar { display: none; }

  .layout { grid-template-columns: 1fr; grid-template-rows: auto auto auto; flex: 0 0 auto; min-height: 0; }
  /* Categories: same look & behavior as the top nav — wrap, no scroll */
  .sidebar { background: var(--espresso); padding: 4px 10px 8px; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .cat-btn {
    white-space: nowrap; width: auto; margin: 0; padding: 7px 12px;
    font-size: 13px; color: #D8C4AC; background: none; border: none;
    border-radius: 8px; font-family: var(--sans); font-weight: 600; cursor: pointer;
  }
  .cat-btn:hover { background: var(--espresso-2); color: #fff; }
  .cat-btn.active { background: var(--caramel); color: var(--espresso); }
  .cart-panel, .queue-panel { border-left: none; border-top: 1px solid var(--line); }
}

/* Phone: tighter product grid + full-width buttons */
@media (max-width: 480px) {
  .products { padding: 10px 8px; }
  .prod-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
  .prod-tile { padding: 12px 6px; }
  .btn-sm { flex: 1; text-align: center; }
}

/* ===== Feature additions: quick code, low stock, stock cell ===== */
.quickpad { display: flex; gap: 6px; padding: 0 8px 8px; }
.quickpad input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 16px; background: #fff; outline: none; }
.quickpad input:focus { border-color: var(--caramel); }
.quick-err { display: none; padding: 0 8px 8px; font-size: 12px; color: #C0392B; font-weight: 700; }

.prod-tile { position: relative; }
.low-badge { position: absolute; top: 4px; right: 4px; background: #C0392B; color: #fff; font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 10px; }

.stock-cell { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; color: var(--green); white-space: nowrap; }
.stock-cell.low { color: #C0392B; }
.stock-cell .btn-sm { padding: 2px 8px; font-size: 12px; }

.menu-row { flex-wrap: wrap; }
.menu-row input[placeholder="code"] { font-size: 12px; }
.menu-row input[placeholder="cost"] { font-size: 12px; }

/* ===== Net Win mobile fixes ===== */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;               /* Firefox: thin visible bar */
  scrollbar-color: var(--caramel, #C08552) transparent;
  position: relative;
}
.table-scroll table { min-width: 560px; }
/* Visible scrollbar (Chrome/Safari/Android) — so users see they can swipe */
.table-scroll::-webkit-scrollbar { height: 8px; }
.table-scroll::-webkit-scrollbar-track { background: #F0E8DC; border-radius: 8px; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--caramel, #C08552); border-radius: 8px; }
.table-scroll::-webkit-scrollbar-thumb:active { background: var(--espresso, #2B1B12); }
/* Edge fade hint — "there's more to the right" */
.table-scroll { mask-image: linear-gradient(90deg, #000 96%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 96%, transparent); }
.table-scroll.scrolled-end { mask-image: none; -webkit-mask-image: none; }
/* "Swipe" chip shown when content overflows */
.scroll-hint {
  display: none;
  font-size: 11px;
  color: var(--caramel, #A06C3F);
  font-weight: 700;
  text-align: right;
  margin-top: 4px;
}
.table-scroll.has-overflow + .scroll-hint { display: block; }
@media (max-width: 480px) {
  #nwStats { grid-template-columns: 1fr 1fr !important; }
  #nwStats .stat:nth-child(3) { grid-column: 1 / -1; }
  #nwStats .num { font-size: 20px; }
  .table-scroll table { min-width: 480px; font-size: 12px; }
  .table-scroll th, .table-scroll td { padding: 7px 5px; }
}

/* Custom stock-add input */
.stock-add { width: 48px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; text-align: center; background: #fff; outline: none; }
.stock-add:focus { border-color: var(--caramel); }

/* Ask BESA — chat bubbles */
.ask-msg { padding:10px 14px; border-radius:12px; font-size:13.5px; line-height:1.5; max-width:88%; white-space:pre-wrap; }
.ask-bot { background:#F3EADF; color:var(--espresso); align-self:flex-start; border-bottom-left-radius:4px; }
.ask-user { background:var(--caramel); color:#fff; align-self:flex-end; border-bottom-right-radius:4px; }
#askInput { padding:10px 12px; border:1px solid var(--line); border-radius:8px; font-size:14px; }

/* ============================================================
   Micro-interactions (B.E.S.A. polish — 140–250ms, transform/opacity only)
   ============================================================ */
/* Universal press feedback — every tappable gives a quick press-down */
.topbar nav a, .logout, .cat-btn, .qty-btn, .cl-del, .link-btn,
.pay-btn, .fulfill-btn, .cancel-btn, .print-btn, .btn-sm, .btn-primary,
.charge-btn:not(:disabled), .prod-tile, .menu-row .del-btn {
  transition: transform .14s ease, box-shadow .2s ease, background .15s ease, color .15s ease;
  will-change: transform;
}
.topbar nav a:active, .logout:active, .cat-btn:active, .qty-btn:active,
.cl-del:active, .link-btn:active, .pay-btn:active, .fulfill-btn:active,
.cancel-btn:active, .print-btn:active, .btn-sm:active, .btn-primary:active,
.charge-btn:not(:disabled):active, .menu-row .del-btn:active { transform: scale(.965); }
.prod-tile:active { transform: scale(.965); } /* tighten from .97 to match spec */

/* New order in the queue slides in + flashes the border ONCE (only fresh arrivals) */
.queue-item.q-new { animation: qNew .9s ease; }
@keyframes qNew {
  0%   { border-color: var(--caramel); box-shadow: 0 0 0 3px rgba(192,133,82,.3); }
  60%  { border-color: var(--caramel); box-shadow: 0 0 0 3px rgba(192,133,82,.3); }
  100% { border-color: var(--line); box-shadow: none; }
}

/* Cart row pulses briefly when a product is added (confirmation feedback) */
.cart-line.pulse { animation: cartPulse .3s ease; }
@keyframes cartPulse {
  0%   { background: rgba(192,133,82,.22); }
  100% { background: transparent; }
}

/* Total flashes on change — staff see the running bill update */
#grandTotal.flash { animation: totFlash .3s ease; }
@keyframes totFlash {
  0%   { transform: scale(1.12); color: var(--caramel-dark); }
  100% { transform: scale(1); }
}

/* Charge button success pop — order placed confirmation moment */
.charge-btn.pop { animation: btnPop .4s ease; }
@keyframes btnPop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* Product grid fades in on category switch (skip on very first load) */
.prod-grid.fadein { animation: gridIn .2s ease-out; }
@keyframes gridIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Respect reduced-motion: kill every animation/transition above */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ===== History page — every order by day, refunds per order ===== */
.hist-wrap { display: grid; grid-template-columns: 270px 1fr; height: calc(100vh - 56px); }
@media (min-width: 961px) { .hist-wrap { height: calc(100vh - 72px); } }
.hist-days { background: var(--espresso); display: flex; flex-direction: column; min-height: 0; }
.hist-days-head { padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,0.12); display: flex; justify-content: space-between; align-items: center; }
.hist-days-head h3 { color: #F0E4D4; font-size: 13px; letter-spacing: .05em; text-transform: uppercase; }
.hist-days-head .count { color: #C0A88C; }
.day-list { flex: 1; overflow-y: auto; padding: 8px; }
.day-list .loading { color: #C0A88C; }
.day-row { display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left; background: none; border: none; border-radius: 10px; padding: 10px 12px; margin-bottom: 6px; cursor: pointer; font-family: var(--sans); color: #D8C4AC; }
.day-row:hover { background: var(--espresso-2); }
.day-row.active { background: var(--caramel); color: var(--espresso); }
.day-row .day-name { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; font-weight: 800; font-size: 13.5px; }
.day-row .day-date { font-weight: 600; font-size: 11px; opacity: .75; }
.day-row .day-meta { font-size: 11.5px; opacity: .92; }
.day-row .day-refund { color: #F2B8B5; margin-left: 6px; }
.day-row.active .day-date, .day-row.active .day-meta { opacity: 1; }
.day-row.active .day-refund { color: #4A1208; opacity: 1; }
.hist-main { padding: 18px; overflow-y: auto; background: var(--latte); min-height: 0; }
.hist-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.hist-title h1 { color: var(--espresso); font-size: 24px; line-height: 1.15; }
.hist-title .sub { color: var(--mocha); font-size: 13px; margin-top: 3px; }
.hist-stats { display: grid; grid-template-columns: repeat(4, minmax(92px, 1fr)); gap: 10px; }
.hist-stats .stat { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; text-align: center; }
.hist-stats .stat .num { display: block; font-size: 22px; font-weight: 800; color: var(--espresso); }
.hist-stats .stat .lbl { font-size: 10.5px; color: var(--mocha); text-transform: uppercase; letter-spacing: .04em; }
.hist-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; }
.hist-list .queue-item { margin-bottom: 0; }
.q-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.q-foot .q-when { font-size: 11.5px; color: var(--mut); margin-left: auto; }
.st-badge { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.st-paid { background: #E3F3E8; color: #2E7D4F; }
.st-new { background: #FDF0DC; color: #8A6116; }
.st-refunded { background: #FDECEA; color: #B02E2E; }
.st-cancelled { background: #EFEAE4; color: #8A7561; }
.q-refund-note { margin-top: 6px; font-size: 12px; font-weight: 700; color: #B02E2E; }
/* Refund is a rare, owner-only action: deliberately small + quiet so it can never be
   hit by accident next to the everyday buttons. The "Are you sure?" popup in history.js
   is the real guard. */
.queue-item .q-refund { display: flex; justify-content: flex-end; margin-top: 6px; }
.queue-item .q-refund .refund-btn { width: auto; padding: 4px 9px; border: 1px solid #E5C3BE; border-radius: 7px; background: #FDF5F4; color: #B03A2E; font-weight: 700; font-size: 11.5px; line-height: 1.35; cursor: pointer; font-family: var(--sans); }
.queue-item .q-refund .refund-btn:hover { background: #F8E4E1; border-color: #C0392B; }
.hist-modal { position: fixed; inset: 0; z-index: 320; display: flex; align-items: center; justify-content: center; background: rgba(30,20,12,.65); padding: 16px; }
.hist-modal-card { background: #fff; border-radius: 16px; padding: 22px; width: 100%; max-width: 430px; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.hist-modal-card h3 { color: var(--espresso); font-size: 17px; margin-bottom: 4px; }
.hist-modal-sub { color: var(--mocha); font-size: 12.5px; margin-bottom: 14px; }
.hist-modal-row { margin-bottom: 10px; }
.hist-modal-row label { display: block; font-size: 12px; font-weight: 700; color: var(--mocha); margin-bottom: 4px; }
.hist-modal-row input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 15px; font-family: var(--sans); color: var(--espresso); }
.hist-modal-note { font-size: 12px; line-height: 1.45; color: #2E7D4F; background: #E3F3E8; border-radius: 9px; padding: 9px 11px; margin: 12px 0 0; }
.hist-modal-note.partial { color: #8A6116; background: #FDF0DC; }
.hist-modal-btns { display: flex; gap: 10px; margin-top: 14px; }
.hist-modal-btns button { flex: 1; }
.pay-split-grid { display:grid; grid-template-columns:1fr 1fr; gap:9px; }
.pay-split-grid label { display:flex; flex-direction:column; gap:4px; color:var(--mocha); font-size:12px; font-weight:700; }
.pay-split-grid input { width:100%; box-sizing:border-box; padding:10px; border:1px solid var(--line); border-radius:8px; font:inherit; font-size:16px; color:var(--espresso); }
.pay-split-grid .pay-tendered { grid-column:1 / -1; }
.pay-live { display:flex; justify-content:space-between; padding:9px 0 0; color:var(--mocha); }
.pay-live b { color:var(--espresso); }
.void-reasons { display:grid; gap:8px; }
.void-reasons label { display:flex; align-items:center; gap:9px; padding:10px 12px; border:1px solid var(--line); border-radius:9px; color:var(--espresso); font-weight:700; cursor:pointer; }
.void-reasons input { width:18px; height:18px; accent-color:var(--espresso); }
.void-line-btn { padding:7px 9px; border:1px solid #E5C3BE; border-radius:7px; background:#FDF5F4; color:#B03A2E; font:700 11.5px var(--sans); cursor:pointer; white-space:nowrap; }
.hist-modal-q { font-size: 15px; color: var(--espresso); margin: 0 0 14px; }
.hist-modal-q b { font-size: 18px; color: #B03A2E; }
.hist-modal-warn { font-size: 11.5px; color: var(--mocha); text-align: center; margin: 10px 0 0; }
.btn-sm.danger { background: #C0392B; color: #fff; }
.btn-sm.danger:hover { background: #A93226; }
@media (max-width: 960px) {
  .hist-wrap { grid-template-columns: 1fr; height: auto; min-height: 100vh; }
  .hist-days { max-height: 40vh; }
  .hist-stats { grid-template-columns: repeat(2, 1fr); }
  .hist-main { overflow: visible; }
}

/* ===== Net Win: per-day profit bars (plain divs — no chart library) ===== */
.nw-wrap { display: flex; gap: 8px; align-items: stretch; margin: 10px 0 4px; }
.nw-scale { display: flex; flex-direction: column; justify-content: space-between; min-width: 42px; padding: 12px 0 20px; font-size: 10.5px; font-weight: 700; color: var(--mut); text-align: right; }
.nw-chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; flex: 1; padding: 8px 2px 0; overflow-x: auto; border-bottom: 1px solid var(--line); }
.nw-col { flex: 1 0 26px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 26px; }
.nw-bar { width: 100%; max-width: 34px; background: var(--caramel); border-radius: 5px 5px 0 0; min-height: 3px; }
.nw-bar.zero { background: #DED2C2; }
.nw-val { font-size: 10.5px; font-weight: 800; color: var(--espresso); margin-bottom: 3px; white-space: nowrap; }
.nw-val.none { color: var(--mut); font-weight: 600; }
.nw-bar.up { background: var(--green); }
.nw-bar.down { background: var(--red); }
.nw-bar.best { outline: 2px solid var(--espresso); outline-offset: 1px; }
.nw-x { font-size: 10.5px; color: var(--mut); margin-top: 4px; white-space: nowrap; }
.nw-line { font-size: 13.5px; color: var(--espresso); margin-top: 6px; font-weight: 600; }
@media (max-width: 700px) { .nw-chart { height: 130px; } .nw-x { font-size: 9.5px; } }

/* Inline SVG icons inside buttons — rule: SVG icons only, never emoji */
.ico-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.ico-btn svg { width: 15px; height: 15px; flex: none; }
.pay-btn svg { width: 16px; height: 16px; flex: none; }
.pay-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }

/* ============================================================================
   TABLET + TOUCH LAYER  (added 2026-10-08)
   Why: at 768–1023px (tablets in portrait) the ≤960px rule stacked everything into one
   column, so the till lost its Order panel below the fold — the cashier had to scroll
   between the items and the cart. Touch targets were also 28–40px, under the 48px floor.
   Nothing here changes the ≤767px phone layout or the ≥1440px desktop layout.
   ============================================================================ */

/* --- Touch targets on any tablet-sized screen, both orientations (768–1439px) --- */
@media (min-width: 768px) and (max-width: 1439px) {
  /* 44px controls don't fit the desktop 320px bill column — widen it, or iPad landscape
     (1024–1279px) clips the price and the remove button on every line. */
  .layout { grid-template-columns: 180px minmax(0, 1fr) 368px; }
  .cart-line { grid-template-columns: minmax(0, 1fr) auto auto 44px; gap: 4px; }
  .cart-list { min-height: 0; overflow-x: hidden; }
  .topbar nav a, .topbar nav button { min-height: 44px; display: inline-flex; align-items: center; }
  .cat-btn { min-height: 44px; padding: 10px 16px; font-size: 14px; display: inline-flex; align-items: center; }
  .quickpad input, .quickpad .btn-sm { min-height: 44px; }
  .pay-btn { min-height: 54px; font-size: 15px; }
  .charge-btn { min-height: 54px; font-size: 16px; }
  .cart-line button, .cart-line .btn-sm { min-width: 44px; min-height: 44px; }
  .queue-item button, .queue-item .btn-sm, .queue-item .btn-full { min-height: 44px; }
  .prod-tile { min-height: 84px; padding: 14px 10px; }
  .topbar .logout { min-height: 44px; padding: 0 14px; }
  /* 'Clear' stays visually quiet but gets a finger-sized hit area on touch screens */
  .cart-head .link-btn { min-height: 44px; min-width: 44px; padding: 0 10px; display: inline-flex;
    align-items: center; justify-content: flex-end; }
}

/* --- Tablets in portrait: restore the two-pane till (items + always-visible order) --- */
@media (min-width: 768px) and (max-width: 1023px) {
  .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 368px;
    grid-template-rows: auto minmax(0, 1fr) auto;
    flex: 1 1 auto; min-height: 0;
  }
  .sidebar { grid-column: 1 / -1; grid-row: 1; padding: 8px 12px 10px; }
  .sidebar nav { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .products { grid-column: 1; grid-row: 2; min-height: 0; overflow-y: auto; }
  /* The order panel fills its grid area and CLIPS: the bill list scrolls inside it, so the
     total / cash-card / Place Order row can never paint over the queue below.
     (iPad bug, 2026-10-20: with overflow visible and a content-height panel, a short Safari
     viewport pushed the Place Order button on top of the Add / Edit / Fulfilled buttons.) */
  .cart-panel {
    grid-column: 2; grid-row: 2 / span 2; border-left: 1px solid var(--line);
    border-top: none; min-height: 0; align-self: stretch; height: 100%;
    position: static; overflow: hidden;
  }
  .cart-list { min-height: 0; overflow-x: hidden; }
  .cart-line { grid-template-columns: minmax(0, 1fr) auto auto 44px; gap: 4px; }
  .cart-line .cl-name { min-width: 0; }
  .queue-panel { grid-column: 1; grid-row: 3; border-top: 1px solid var(--line); border-left: none; max-height: 46vh; }
  .prod-grid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
}

/* --- Notched devices: keep the top bar and bottom controls out of the unsafe areas --- */
@supports (padding: env(safe-area-inset-top)) {
  .topbar {
    padding-top: max(6px, env(safe-area-inset-top));
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }
  .layout { padding-bottom: env(safe-area-inset-bottom); }
  .cart-panel, .queue-panel { padding-bottom: max(0px, env(safe-area-inset-bottom)); }
}
