/* The "Counter" theme: high contrast, large text, large tap targets. */
:root {
  --bg: #ffffff;
  --ink: #111418;
  --mute: #4a5260;
  --line: #c9ced6;
  --bar: #0f1b2d;
  --on-bar: #ffffff;
  --panel: #eef1f5;
  --field: #ffffff;
  --acc: #0b5fd6;
  --on-acc: #ffffff;
  --warn-bg: #fff1dc;
  --warn-ink: #8a3b00;
  --out-bg: #fde8e6;
  --out-ink: #8f1d16;
  --ok-bg: #e6f3e6;
  --ok-ink: #1e5a1e;
  --danger: #b3261e;
  --radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c; --ink: #f1f3f6; --mute: #a7b0bd; --line: #343c48;
    --bar: #0a1220; --panel: #1a2029; --field: #12161c;
    --acc: #4c92ff; --on-acc: #08111f;
    --warn-bg: #3a2a10; --warn-ink: #ffc98a;
    --out-bg: #3b1613; --out-ink: #ffb4ab;
    --ok-bg: #16301a; --ok-ink: #a9e0ae; --danger: #ff8a80;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 "IBM Plex Sans", system-ui, "Noto Sans Myanmar", sans-serif;
}
.num { font-variant-numeric: tabular-nums; }
button, input { font: inherit; color: inherit; }
button {
  min-height: 44px; padding: 0 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--bg); cursor: pointer;
}
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--acc); outline-offset: 2px; }
button.primary {
  background: var(--acc); border-color: var(--acc); color: var(--on-acc);
  font-weight: 500; min-height: 52px; font-size: 16px;
}
button.link { border: 0; background: none; min-height: 44px; color: inherit; text-decoration: underline; padding: 0 8px; }
button.icon { width: 44px; padding: 0; font-size: 20px; line-height: 1; }
button.icon.outline { border-color: var(--acc); color: var(--acc); background: none; }
input {
  width: 100%; min-height: 44px; padding: 0 12px; background: var(--field);
  border: 1px solid var(--line); border-radius: var(--radius);
}
label { display: block; margin: 14px 0 4px; color: var(--mute); font-size: 13px; }
h1, h2 { margin: 0; font-weight: 500; }
.sub, .note { color: var(--mute); }
.center { text-align: center; }
.error { color: var(--danger); margin: 12px 0 0; }

/* sign in */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 2px; }
.login h1 { font-size: 26px; text-align: center; }
.login .sub { text-align: center; margin: 4px 0 8px; }
.login button.primary { margin-top: 20px; }

/* top bar */
.bar {
  background: var(--bar); color: var(--on-bar); display: flex; flex-wrap: wrap;
  gap: 4px 16px; justify-content: space-between; align-items: center; padding: 6px 16px;
}
.bar .who { display: flex; flex-wrap: wrap; align-items: center; font-size: 13px; }

/* the sell screen: products left, receipt right */
.layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); }
.layout .products { grid-column: 1; grid-row: 1; padding: 16px; }
.layout .receipt {
  grid-column: 2; grid-row: 1; background: var(--panel); border-left: 1px solid var(--line);
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
  position: sticky; top: 0; align-self: start; min-height: calc(100vh - 56px);
}
.search { margin-bottom: 10px; }
/* the board: tabs, tiles, pages */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.tab {
  flex: none; min-height: 44px; padding: 0 14px; border-radius: 22px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px;
}
.tab.on { background: var(--acc); border-color: var(--acc); color: var(--on-acc); font-weight: 500; }
.tab-top:not(.on) { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-ink); }
.tab-n { font-size: 12px; opacity: .75; }
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile {
  position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; min-height: 96px; display: flex; flex-direction: column; gap: 8px;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
}
.tile-img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--line); }
.tile.soldout .tile-img { opacity: .55; }
.tile:hover { border-color: var(--acc); }
.tile:active { transform: scale(0.98); }
.tile:focus-visible { outline: 3px solid var(--acc); outline-offset: 2px; }
.tile.picked { border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); }
.tile.stock-low { border-color: var(--warn-ink); }
.tile.stock-out { border-color: var(--out-ink); }
.tile.soldout { cursor: not-allowed; }
.tile.soldout .tile-name, .tile.soldout .tile-meta { opacity: .55; }
.tile.soldout:hover { border-color: var(--out-ink); }
.tile.soldout:active { transform: none; }
.tile-name { font-weight: 500; line-height: 1.25; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: auto; }
.tile-price { color: var(--mute); font-size: 13px; }
.tile-stock { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 10px; font-weight: 500; }
.tag-low { background: var(--warn-bg); color: var(--warn-ink); }
.tag-out { background: var(--out-bg); color: var(--out-ink); }
.tile-stock.stock-low .stock-n { color: var(--warn-ink); font-weight: 500; }
.tile-stock.stock-out .stock-n { color: var(--out-ink); font-weight: 500; }
.qty-badge {
  position: absolute; top: -8px; left: -8px; min-width: 24px; height: 24px; padding: 0 6px;
  border-radius: 12px; background: var(--acc); color: var(--on-acc); font-size: 13px; font-weight: 500;
  display: flex; align-items: center; justify-content: center;
}
/* Tell owner: a pill button tinted like the stock figure it sits under, and the
   quieter marks it turns into once the owner knows. */
.tell-btn, .told-pill {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px;
  min-height: 36px; padding: 0 14px 0 11px; border-radius: 18px;
  font-size: 13px; font-weight: 500;
}
.tell-btn { border: 1px solid transparent; cursor: pointer; }
.tell-btn.tell-low { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-ink); }
.tell-btn.tell-out { background: var(--out-bg); color: var(--out-ink); border-color: var(--out-ink); }
.tell-btn:hover { filter: brightness(0.96); }
.tell-btn:active { transform: scale(0.97); }
.told-pill { background: var(--ok-bg); color: var(--ok-ink); font-weight: 400; cursor: default; }
.told-pill.seen { font-weight: 500; }
.tile .tell-btn, .tile .told-pill { margin-top: 0; width: 100%; justify-content: center; white-space: normal; text-align: center; min-height: 34px; padding: 4px 10px; font-size: 12px; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; gap: 10px; }
.pager-n { color: var(--mute); font-size: 13px; }
.pager-btns { display: flex; gap: 8px; }
/* receipt */
.receipt h2 { font-size: 16px; }
.lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.line { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.line-main { display: flex; align-items: center; gap: 8px; }
.line-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.line-sum { font-weight: 500; }
.remove { font-size: 20px; text-decoration: none; min-width: 44px; padding: 0; }
.stepper { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.qty { min-width: 36px; text-align: center; font-size: 17px; font-weight: 500; }
.each { color: var(--mute); font-size: 13px; margin-left: 6px; }
.rejected {
  background: var(--out-bg); color: var(--out-ink); border: 1px solid var(--out-ink);
  border-radius: var(--radius); padding: 10px 12px; margin: 0 0 8px; font-size: 13px;
}
.rejected ul { margin: 6px 0 8px; padding-left: 18px; }
.rejected button { min-height: 36px; font-size: 13px; background: transparent; color: inherit; border-color: currentColor; }
.stock-warn, .notice.warn { background: var(--warn-bg); color: var(--warn-ink); border-radius: 6px; padding: 6px 10px; margin: 6px 0 0; font-size: 13px; }
.notice { border-radius: 6px; padding: 8px 10px; margin: 0; }
.notice.ok { background: var(--ok-bg); color: var(--ok-ink); }
.spacer { flex: 1; }
.total { display: flex; justify-content: space-between; align-items: baseline; font-size: 20px; gap: 12px; }
.total span { font-size: 14px; color: var(--mute); }

/* phone: products first; the sale is a sheet that slides up from a bar */
.salebar, .sheet-close { display: none; }
.receipt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .layout .products { grid-column: 1; grid-row: 1; padding: 12px 12px 88px; }
  .layout .receipt {
    position: fixed; left: 0; right: 0; bottom: 0; top: 10vh; z-index: 40; grid-column: 1; grid-row: 1;
    min-height: 0; border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0;
    padding: 14px 14px 24px; overflow-y: auto; align-self: auto;
    box-shadow: 0 -10px 34px rgba(0, 0, 0, .35);
    transform: translateY(104%); transition: transform .22s ease;
  }
  .layout .receipt.open { transform: none; }
  @media (prefers-reduced-motion: reduce) { .layout .receipt { transition: none; } }
  .sheet-close { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 22px; }
  .salebar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; justify-content: space-between;
    align-items: center; gap: 12px; min-height: 64px; padding: 10px 18px calc(10px + env(safe-area-inset-bottom));
    border: 0; border-top: 1px solid var(--line); border-radius: 0; background: var(--acc); color: var(--on-acc); font-size: 16px;
  }
  .salebar-t { font-size: 20px; }
  body.sale-open { overflow: hidden; }
  .spacer { display: none; }
}

.offline-bar {
  background: var(--warn-bg);
  color: var(--warn-ink);
  padding: 8px 16px;
  font-weight: 600;
  text-align: center;
}
.offline-bar[hidden] { display: none; }

.sales-panel { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.sales-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.sale-row { background: var(--panel); border-radius: var(--radius); padding: 10px; }
.sale-row.undone { opacity: 0.6; }
.sale-top { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.sale-sum { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.undo-pick { display: grid; gap: 8px; margin-top: 8px; }

.searchrow { display: flex; gap: 8px; margin-bottom: 10px; }
.searchrow .search { flex: 1; margin-bottom: 0; }
.scanbtn { padding: 0 14px; border: 1px solid var(--line, #ccc); border-radius: 8px; background: var(--bg, #fff); color: inherit; font: inherit; cursor: pointer; }
.scanner { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; }
.scan-video { width: 100%; max-width: 480px; max-height: 60vh; border-radius: 12px; background: #111; }
.scan-say { color: #fff; margin: 0; text-align: center; min-height: 1.5em; }
.scan-say.ok { color: #7ee2a8; }
.scan-say.bad { color: #ffb4a8; }

.pay { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.pay-label { font-size: 13px; opacity: .75; margin-right: 2px; }
.pay .chip { padding: 6px 12px; border: 1px solid var(--line, #ccc); border-radius: 99px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.pay .chip.on { background: var(--acc, #1f6e4f); color: #fff; border-color: var(--acc, #1f6e4f); }

.qrscreen { position: fixed; inset: 0; z-index: 60; background: #fff; color: #111; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; text-align: center; }
.qr-title { font-size: 20px; }
.qr-total { font-size: 34px; font-weight: 600; }
.qr-img { width: min(80vw, 62vh); height: min(80vw, 62vh); object-fit: contain; background: #fff; border: 1px solid #ddd; border-radius: 12px; }
.qr-hint { margin: 0; font-size: 14px; opacity: .7; }
.qr-actions { display: flex; gap: 10px; width: 100%; max-width: 420px; }
.qr-actions button { flex: 1; padding: 14px 10px; font: inherit; font-size: 16px; border-radius: 10px; border: 1px solid #bbb; background: #fff; color: #111; cursor: pointer; }
.qr-actions .qr-paid { flex: 2; background: var(--acc, #1f6e4f); color: #fff; border-color: var(--acc, #1f6e4f); }

.sale-pay { font-size: 12px; padding: 1px 8px; border: 1px solid var(--line, #ccc); border-radius: 99px; white-space: nowrap; opacity: .85; }

/* top bar: title, language and sign out on one line; who and the midnight note under */
.bar-title { order: 1; }
.bar .who { order: 2; gap: 6px; }
.bar-note { order: 3; flex-basis: 100%; font-size: 13px; opacity: .85; }
@media (min-width: 761px) { .bar-note { order: 2; flex-basis: auto; margin-left: auto; } .bar .who { order: 3; } }
.langbtn { min-height: 36px; padding: 4px 14px; line-height: 1.8; border: 1px solid currentColor; border-radius: 18px; background: none; color: inherit; font: inherit; font-size: 14px; cursor: pointer; }


/* ==========================================================================
   Design layer: the same sizes, buttons and cards on every screen. Loaded last
   so it settles what the older rules above left uneven. The Counter theme keeps
   its high contrast and its big tap targets.
   ========================================================================== */
:root { --radius: 12px; }
body { font-size: 16px; -webkit-font-smoothing: antialiased; }

button { min-height: 48px; padding: 0 20px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); font-weight: 500; transition: background .12s, border-color .12s, transform .06s; }
button:hover:not(:disabled) { border-color: var(--mute); }
button:active:not(:disabled) { transform: scale(.98); }
button.primary { min-height: 56px; border-radius: 14px; font-size: 17px; font-weight: 600; }
button.quiet { background: transparent; border-color: transparent; color: var(--mute); }
button.quiet:hover:not(:disabled) { background: var(--panel); color: var(--ink); }
button.small { min-height: 40px; padding: 0 16px; font-size: 14px; }
button.iconbtn { width: 44px; min-width: 44px; padding: 0; font-size: 20px; line-height: 1; background: transparent; border-color: transparent; color: var(--mute); }
button.iconbtn:hover:not(:disabled) { background: var(--panel); color: var(--out-ink); border-color: transparent; }
button.signout { min-height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid rgba(255,255,255,.35); background: none; color: inherit; font-size: 14px; }
button.signout:hover { background: rgba(255,255,255,.12); }
.langbtn { min-height: 40px; padding: 4px 16px; font-size: 16px; line-height: 2; border-radius: 20px; }

/* top bar */
.bar { padding: 8px 18px; }
.bar-title { font-size: 17px; letter-spacing: -.1px; }

/* the board */
.search { min-height: 52px; border-radius: 14px; font-size: 16px; }
.tab { min-height: 44px; padding: 0 16px; background: var(--panel); border-color: transparent; font-size: 15px; }
.tab.on { background: var(--acc); color: var(--on-acc); }
.tile { border-radius: 16px; padding: 14px; min-height: 104px; box-shadow: 0 1px 2px rgba(0,0,0,.06); transition: border-color .12s, box-shadow .12s, transform .06s; }
.tile:hover { box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.tile-name { font-size: 16px; }
.tell-btn { min-height: 36px; }
.pager button { min-width: 48px; padding: 0; }

/* the sale */
.layout .receipt { background: var(--panel); }
.receipt h2 { font-size: 18px; }
.line { border-radius: 14px; padding: 12px; }
.line-sum { font-size: 17px; }
.stepper { margin-top: 8px; }
.stepper button { min-width: 44px; padding: 0; font-size: 20px; }
.total { padding-top: 10px; border-top: 1px solid var(--line); font-size: 22px; }
.pay .chip { min-height: 44px; padding: 0 18px; font-size: 15px; background: var(--bg); }
.pay .chip.on { background: var(--acc); color: var(--on-acc); border-color: var(--acc); font-weight: 600; }
.pay-label { font-size: 14px; }

/* today's sales */
.sales-panel { margin-top: 8px; padding-top: 12px; }
.salesbtn { width: 100%; justify-content: space-between; display: flex; align-items: center; background: transparent; border-color: var(--line); }
.salesbtn::after { content: '▾'; color: var(--mute); transition: transform .15s; }
.salesbtn.open::after { transform: rotate(180deg); }
.sale-row { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.sale-top { align-items: center; }
.sale-time { color: var(--mute); font-size: 14px; }
.sale-pay { background: var(--panel); }
.undo-pick select { min-height: 48px; border-radius: 12px; padding: 0 12px; background: var(--bg); border: 1px solid var(--line); font: inherit; }

@media (max-width: 760px) {
  .bar { padding: 8px 14px; }
  .layout .products { padding: 12px 12px 92px; }
}
