/* K Stall POS — styled per DESIGN.md (Uber design system).
   Black & white, pill buttons, whisper shadows, compact layout.
   Status colours (paid / void / sold out) are the only colour in the UI,
   used as small functional tags. */

:root {
  --black: #000000;
  --white: #ffffff;
  --chip: #efefef;
  --hover: #e2e2e2;
  --hover-light: #f3f3f3;
  --body: #4b4b4b;
  --muted: #757575;
  --line: #e2e2e2;
  --ok: #05944f;
  --ok-soft: #e6f4ed;
  --warn: #9a6a00;
  --warn-soft: #fff3d6;
  --err: #e11900;
  --err-soft: #fde9e6;
  --shadow-1: 0 4px 16px rgba(0, 0, 0, .12);
  --shadow-2: 0 4px 16px rgba(0, 0, 0, .16);
  --shadow-float: 0 2px 8px rgba(0, 0, 0, .16);
  --r-card: 8px;
  --r-feature: 12px;
  --pill: 999px;
  --font: "UberMoveText", Inter, system-ui, -apple-system, "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-head: "UberMove", Inter, system-ui, -apple-system, "Helvetica Neue", Helvetica, Arial, "PingFang SC", sans-serif;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--white);
  color: var(--black);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-head); font-weight: 700; line-height: 1.25; }
h1 { font-size: 32px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
code { font-size: 13px; background: var(--chip); padding: 1px 6px; border-radius: 4px; }
.muted { color: var(--body); }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.hide { display: none !important; }
.m-only { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px; border-radius: var(--pill);
  border: 0; background: var(--chip); color: var(--black); cursor: pointer;
  font-weight: 500; white-space: nowrap; transition: background .15s, transform .08s;
}
.btn:hover { background: var(--hover); }
.btn:active { box-shadow: inset 0 0 0 999px rgba(0, 0, 0, .08); }
.btn:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn.primary, .btn.dark { background: var(--black); color: var(--white); }
.btn.primary:hover, .btn.dark:hover { background: #282828; }
.btn.primary:focus-visible, .btn.dark:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--white), 0 0 0 2px var(--black); }
.btn.white { background: var(--white); box-shadow: inset 0 0 0 1px var(--black); }
.btn.white:hover { background: var(--hover-light); }
.btn.ok { background: var(--black); color: var(--white); }
.btn.danger { background: var(--err); color: var(--white); }
.btn.danger:hover { background: #c41600; }
.btn.danger-ghost { background: transparent; color: var(--err); box-shadow: inset 0 0 0 1px var(--hover); }
.btn.danger-ghost:hover { background: var(--err-soft); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--hover-light); }
.btn.sm { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.btn.lg { min-height: 56px; font-size: 18px; font-weight: 700; padding: 14px 20px; }
.btn.block { width: 100%; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--chip); display: inline-grid; place-items: center; cursor: pointer; font-size: 20px; line-height: 1; }
.icon-btn:hover { background: var(--hover); }

/* ---------- inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 14px; font-weight: 500; color: var(--body); }
.input, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: 8px;
  border: 1px solid var(--black); background: var(--white); outline: none; font-size: 16px;
}
.input::placeholder { color: var(--muted); }
/* Safari ignores height/padding on native selects unless the default look is removed */
select.input {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 44px; line-height: 1.3;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}
select.input::-ms-expand { display: none; }
textarea.input { min-height: 88px; resize: vertical; }
.input:focus { box-shadow: 0 0 0 1px var(--black); }
.input.big { font-size: 28px; font-weight: 700; min-height: 64px; text-align: right; font-family: var(--font-head); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

/* ---------- chips & tags ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  min-height: 44px; padding: 10px 16px; border-radius: var(--pill); border: 0;
  background: var(--chip); cursor: pointer; font-weight: 500; font-size: 14px; white-space: nowrap;
}
.chip:hover { background: var(--hover); }
.chip.on { background: var(--black); color: var(--white); }
.chip .count { opacity: .6; margin-left: 6px; }

.tag { display: inline-block; padding: 3px 10px; border-radius: var(--pill); font-size: 12px; font-weight: 700; white-space: nowrap; }
.tag.PAID, .tag.approved, .tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.VOID, .tag.rejected, .tag.err { background: var(--err-soft); color: var(--err); }
.tag.REFUNDED, .tag.pending, .tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.suspended, .tag.grey { background: var(--chip); color: var(--body); }

/* ---------- cards ---------- */
.card { background: var(--white); border-radius: var(--r-feature); box-shadow: var(--shadow-1); }
.card-pad { padding: 24px; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--black); }
.auth-card { width: 100%; max-width: 440px; padding: 32px 28px; }
.brand-lg { display: flex; align-items: center; gap: 12px; font: 700 28px/1.2 var(--font-head); margin-bottom: 6px; }
.logo { display: block; width: 40px; height: 40px; flex: none; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--chip); border-radius: var(--pill); padding: 4px; margin: 24px 0; }
.seg button { border: 0; background: transparent; min-height: 40px; border-radius: var(--pill); font-weight: 500; cursor: pointer; color: var(--body); }
.seg button.on { background: var(--black); color: var(--white); }
.status-card { text-align: center; }
.status-icon { width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 50%; background: var(--chip); display: grid; place-items: center; font-size: 32px; }

/* ---------- login / register ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; background: var(--white); }
.auth-hero { display: grid; place-items: center; padding: 40px; background: var(--black); color: var(--white); }
.hero-mark { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.hero-mark img { width: 200px; height: 200px; display: block; }
.hero-mark span { font: 700 40px/1 var(--font-head); letter-spacing: -.01em; }

.auth-panel { display: flex; flex-direction: column; padding: 24px 40px 40px; }
.auth-top { display: flex; justify-content: flex-end; }
.lang-pill {
  min-height: 40px; padding: 8px 34px 8px 16px; border: 0; border-radius: var(--pill); cursor: pointer; font-size: 14px; font-weight: 500;
  background: var(--chip) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center;
  appearance: none; -webkit-appearance: none;
}
.lang-pill:hover { background-color: var(--hover); }
.auth-form { width: 100%; max-width: 420px; margin: auto; padding: 32px 0; }
.auth-form h2 { font-size: 36px; }
.auth-sub { margin: 8px 0 28px; }
.auth .input { border: 0; background: var(--hover-light); box-shadow: inset 0 0 0 1px transparent; min-height: 52px; transition: box-shadow .15s, background .15s; }
.auth .input:hover { background: #ececec; }
.auth .input:focus { background: var(--white); box-shadow: inset 0 0 0 2px var(--black); }
.auth .btn.lg { margin-top: 8px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 52px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.pw-eye:hover { color: var(--black); }
.pw-eye.on { color: var(--black); }
.pw-eye svg { width: 20px; height: 20px; }
.auth-switch { margin: 24px 0 0; text-align: center; color: var(--body); }
.link { border: 0; background: none; padding: 4px 2px; font-weight: 700; color: var(--black); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 20px;
  min-height: 64px; padding: 10px 24px; background: var(--white); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand b { display: block; font: 700 18px/1.3 var(--font-head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.brand small { display: block; color: var(--body); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs { display: flex; gap: 6px; flex: 1; }
.tabs button {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 16px;
  border: 0; border-radius: var(--pill); background: transparent; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.tabs button:hover { background: var(--hover-light); }
.tabs button.on { background: var(--black); color: var(--white); }
.tabs svg { width: 20px; height: 20px; flex: none; }
.top-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 12px; border-radius: var(--pill); background: var(--chip); color: var(--body); font-size: 13px; font-weight: 500; white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.live { color: var(--black); }
.pill.live .dot { background: var(--ok); }
.pill.sync.ok .dot { background: var(--ok); }
.pill.sync.busy .dot { background: #f5a623; animation: blink 1s infinite; }
.pill.sync.off { background: var(--warn-soft); color: var(--warn); }
.pill.sync.off .dot { background: var(--warn); }
@keyframes blink { 50% { opacity: .3; } }

main.page { padding: 32px 24px 48px; max-width: 1136px; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .muted { margin-top: 4px; }

/* ---------- open business ---------- */
.open-biz { max-width: 480px; margin: 24px auto; }
.open-biz h1 { margin-bottom: 4px; }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: 1fr 400px; gap: 24px; padding: 24px; height: calc(100vh - 65px); height: calc(100dvh - 65px); }
.pos-left { display: flex; flex-direction: column; min-height: 0; }
.pos-left .chips { margin-bottom: 16px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.pos-left .chips::-webkit-scrollbar { display: none; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; overflow-y: auto; padding: 4px 4px 16px; margin: -4px; align-content: start; }
.pcard {
  position: relative; background: var(--white); border-radius: var(--r-card); box-shadow: var(--shadow-1);
  padding: 16px; min-height: 140px; cursor: pointer; display: flex; flex-direction: column; gap: 2px;
  transition: box-shadow .15s, transform .08s; user-select: none;
}
.pcard:hover { box-shadow: var(--shadow-2); }
.pcard:active { transform: scale(.98); }
.pcat { font-size: 12px; font-weight: 500; color: var(--body); }
.pname { font: 700 17px/1.3 var(--font-head); padding-right: 28px; }
.pstock { font-size: 13px; color: var(--body); }
.pstock.low { color: var(--warn); font-weight: 700; }
.pfoot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; padding-top: 8px; }
.pprice { font: 700 17px var(--font-head); }
.pcard .badge { position: absolute; top: 12px; right: 12px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: var(--pill); background: var(--black); color: var(--white); font-size: 13px; font-weight: 700; display: grid; place-items: center; }
.pcust { background: var(--chip); border-radius: var(--pill); padding: 3px 10px; font-size: 12px; font-weight: 500; color: var(--body); }
.pcard:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }
.pcard.soldout { cursor: not-allowed; box-shadow: none; background: var(--hover-light); }
.pcard.soldout .pname, .pcard.soldout .pprice, .pcard.soldout .pcat { color: var(--muted); }
.so-tag { position: absolute; inset: 0; display: grid; place-items: center; }
.so-tag span { background: var(--black); color: var(--white); font: 700 13px var(--font-head); letter-spacing: .04em; padding: 6px 14px; border-radius: var(--pill); }

.cart { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.cart-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.cart-head b { font: 700 18px var(--font-head); }
.cart-list { flex: 1; overflow-y: auto; }
.edit-banner { padding: 10px 20px; background: var(--black); color: var(--white); font-size: 13px; }
.cart-empty { padding: 48px 24px; text-align: center; color: var(--body); }
.cline { padding: 14px 20px; border-bottom: 1px solid var(--line); }
.cline-top { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
.cline-mods { font-size: 13px; color: var(--body); margin: 2px 0 10px; }
.cline-mods .add { color: var(--black); font-weight: 500; }
.cline-ctrl { display: flex; align-items: center; gap: 6px; }
.qty { display: inline-flex; align-items: center; background: var(--chip); border-radius: var(--pill); padding: 2px; }
.qty button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; font-size: 18px; font-weight: 700; }
.qty button:hover { background: var(--hover); }
.qty span { min-width: 32px; text-align: center; font-weight: 700; }
.cart-foot { border-top: 1px solid var(--line); padding: 16px 20px; padding-bottom: calc(16px + var(--safe-b)); }
.trow { display: flex; justify-content: space-between; margin-bottom: 4px; }
.trow.total { font: 700 26px var(--font-head); margin: 4px 0 14px; }
.pay-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* mobile cart bar (hidden on desktop) */
.cart-bar { display: none; }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .5); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: 100%; max-width: 480px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--white); border-radius: var(--r-feature); box-shadow: var(--shadow-2); animation: pop .18s; }
.modal.wide { max-width: 640px; }
.m-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px 18px 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--white); z-index: 1; }
.m-head h2 { font-size: 20px; }
.m-body { padding: 24px; }
.m-foot { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding: 16px 24px; padding-bottom: calc(16px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--white); position: sticky; bottom: 0; }
.cust-foot { flex-wrap: nowrap; align-items: center; }
.cust-foot .qty button { width: 44px; height: 44px; }
.cust-foot .btn { flex: 1; }
.x { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--chip); font-size: 22px; line-height: 1; cursor: pointer; flex: none; }
.x:hover { background: var(--hover); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
@keyframes up { from { transform: translateY(100%); } }

.opt-group { margin-bottom: 20px; }
.opt-group h4 { margin: 0 0 10px; font-size: 16px; }
.opt { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 12px 16px; border-radius: var(--r-card); background: var(--hover-light); margin-bottom: 8px; cursor: pointer; }
.opt:has(input:checked) { background: var(--black); color: var(--white); }
.opt:has(input:checked) .p { color: var(--white); }
.opt input { width: 20px; height: 20px; accent-color: var(--black); flex: none; }
.opt-hint { display: block; font-size: 13px; color: var(--body); }
.opt:has(input:checked) .opt-hint { color: #cfcfcf; }
.opt input[type=radio] { accent-color: var(--white); }
.opt .p { margin-left: auto; font-weight: 500; color: var(--body); white-space: nowrap; }

.pay-total { text-align: center; padding: 4px 0 20px; }
.pay-total .amt { font: 700 44px/1.1 var(--font-head); }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; margin-bottom: 16px; }
.change-box { display: flex; justify-content: space-between; align-items: center; min-height: 60px; padding: 14px 20px; border-radius: var(--r-card); background: var(--chip); font: 700 20px var(--font-head); }
.change-box.ok { background: var(--black); color: var(--white); }
.change-box.short { background: var(--err-soft); color: var(--err); }
.qr-box { display: grid; place-items: center; padding: 16px; border-radius: var(--r-feature); box-shadow: inset 0 0 0 1px var(--line); margin-bottom: 16px; }
.qr-box img { width: 100%; max-width: 280px; height: auto; display: block; }
.qr-empty { padding: 32px 12px; text-align: center; color: var(--body); }
.done { text-align: center; padding: 8px 0; }
.done .tick { width: 72px; height: 72px; border-radius: 50%; background: var(--black); color: var(--white); display: grid; place-items: center; font-size: 34px; margin: 0 auto 16px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th, .t td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t th { font-size: 13px; color: var(--body); font-weight: 500; }
.t .right { text-align: right; }
.t tr.click { cursor: pointer; }
.t tr.click:hover td { background: var(--hover-light); }
.t td.wrap { white-space: normal; min-width: 180px; }
.t tbody tr:last-child td { border-bottom: 0; }
.empty { padding: 48px 24px; text-align: center; color: var(--body); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat { padding: 20px; }
.stat .k { font-size: 14px; font-weight: 500; color: var(--body); }
.stat .v { font: 700 28px/1.2 var(--font-head); margin-top: 6px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat .s { font-size: 13px; color: var(--body); margin-top: 2px; }
.stat.hl { background: var(--black); color: var(--white); }
.stat.hl .k, .stat.hl .s { color: #afafaf; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.section-title { font: 700 18px var(--font-head); padding: 18px 20px; border-bottom: 1px solid var(--line); }
.bar-row { padding: 16px 20px; }
.bar-row .lbl { display: flex; justify-content: space-between; gap: 8px; font-weight: 500; margin-bottom: 8px; }
.bar { height: 8px; border-radius: var(--pill); background: var(--chip); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: var(--pill); background: var(--black); }
.bar i.b2 { background: var(--body); }

.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 20px; }
.kv div span { display: block; font-size: 13px; color: var(--body); }
.kv div b { font-variant-numeric: tabular-nums; font-weight: 500; }
.sum-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sum-row.strong { font: 700 18px var(--font-head); border-bottom: 0; }
.notice { padding: 12px 16px; border-radius: var(--r-card); background: var(--warn-soft); color: var(--warn); font-size: 14px; margin-bottom: 16px; }
.notice.plain { background: var(--hover-light); color: var(--body); }

/* ---------- operator switcher ---------- */
.op-select { position: relative; display: inline-flex; white-space: nowrap; align-items: center; gap: 4px; max-width: 100%; padding: 2px 6px; margin-left: -6px; border-radius: 6px; font-size: 13px; color: var(--body); cursor: pointer; }
.op-select:hover { background: var(--hover-light); }
.op-select b { flex: none; max-width: 36vw; color: var(--black); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op-select .chev { flex: none; width: 10px; height: 6px; margin-left: 2px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center; }
/* The native select sits invisibly on top so phones show their own picker */
.op-select select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.op-select:has(select:focus-visible) { outline: 2px solid var(--black); }
.op-open { margin: 0 0 16px -6px; font-size: 15px; }
.op-open b { max-width: 60vw; }
/* No spinner arrows on number fields */
.input[type=number] { -moz-appearance: textfield; }
.input[type=number]::-webkit-outer-spin-button, .input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.op-list { display: flex; flex-direction: column; }
.op-row { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 4px 0; border-bottom: 1px solid var(--line); font-weight: 500; }
.op-row:last-child { border-bottom: 0; }
.op-row .icon-btn { width: 36px; height: 36px; font-size: 14px; }

/* ---------- order calling ---------- */
.call-btn { position: relative; flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--black); color: var(--white); display: inline-grid; place-items: center; cursor: pointer; }
.call-btn:hover { background: #282828; }
.call-btn:active { transform: scale(.94); }
.call-btn svg { width: 20px; height: 20px; }
.call-n { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--pill); background: var(--white); color: var(--black); box-shadow: 0 0 0 1px var(--line); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.t td .call-btn { width: 38px; height: 38px; }
.btn svg { flex: none; }

/* ---------- language picker ---------- */
.auth-card { position: relative; }
.lang-mini {
  position: absolute; top: 16px; right: 16px; min-height: 36px; padding: 6px 30px 6px 14px; border: 0; border-radius: var(--pill);
  background: var(--chip) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  appearance: none; -webkit-appearance: none; font-size: 14px; font-weight: 500; cursor: pointer;
}
.lang-mini.static { position: static; }

.empty-menu { grid-column: 1 / -1; padding: 48px 24px; text-align: center; }
.empty-menu h3 { margin-bottom: 6px; }
.empty-menu p { margin: 0 0 18px; }

/* ---------- orders by day ---------- */
.day-nav { display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 12px; }
.day-nav .icon-btn:disabled { opacity: .3; cursor: default; }
.day-pick { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 120px; padding: 4px 12px; border-radius: var(--r-card); cursor: pointer; }
.day-pick:hover { background: var(--hover-light); }
.day-pick b { font: 700 18px var(--font-head); }
/* The real date input sits invisibly on top so phones open their own date picker */
.day-pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; font-size: 16px; }
.day-sum { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.day-sum b { font: 700 20px var(--font-head); }
.t tr.day-row td { background: var(--hover-light); font-weight: 700; padding: 8px 16px; }
.olist-day { padding: 8px 16px; background: var(--hover-light); font-weight: 700; font-size: 14px; }
.export-opts { display: flex; flex-direction: column; gap: 10px; }
.opt-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 16px 18px; border: 0; border-radius: var(--r-card); background: var(--hover-light); text-align: left; cursor: pointer; font-size: 16px; }
.opt-btn:hover { background: var(--hover); }

/* ---------- mobile order list ---------- */
.olist { display: flex; flex-direction: column; }
.orow-wrap { display: flex; align-items: center; gap: 4px; padding-right: 14px; border-bottom: 1px solid var(--line); }
.orow-wrap:last-child { border-bottom: 0; }
.orow { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; padding: 14px 16px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.orow:active { background: var(--hover-light); }
.orow-top { display: flex; align-items: center; gap: 8px; }
.orow-amt { margin-left: auto; font-family: var(--font-head); font-size: 17px; }
.orow.is-off .orow-amt { color: var(--muted); text-decoration: line-through; }
.orow-items { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orow-meta { font-size: 13px; color: var(--body); }

/* ---------- menu page ---------- */
.chip-edit { background: var(--white); box-shadow: inset 0 0 0 1px var(--black); }
.chip-edit:hover { background: var(--hover-light); }
.menu-group { margin-bottom: 20px; }
.menu-group-head { display: flex; align-items: baseline; gap: 8px; margin: 0 4px 8px; font-family: var(--font-head); }
.menu-list { overflow: hidden; }
.menu-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 4px; border-bottom: 1px solid var(--line); }
.menu-row:last-child { border-bottom: 0; }
.menu-info { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 6px 12px; border: 0; background: transparent; border-radius: var(--r-card); text-align: left; cursor: pointer; }
.menu-info:hover { background: var(--hover-light); }
.menu-info b { font-size: 16px; overflow-wrap: anywhere; }
.menu-info .tag { margin-left: 4px; }
.menu-row.is-out .menu-info b { color: var(--muted); }
.mini-step { display: inline-flex; align-items: center; background: var(--chip); border-radius: var(--pill); padding: 2px; flex: none; }
.mini-step button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; font-size: 18px; font-weight: 700; cursor: pointer; }
.mini-step button:hover { background: var(--hover); }
.mini-step input { width: 44px; height: 36px; border: 0; background: transparent; text-align: center; font-weight: 700; font-size: 16px; padding: 0; -moz-appearance: textfield; }
.mini-step input::-webkit-outer-spin-button, .mini-step input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mini-step input:focus { outline: 2px solid var(--black); border-radius: 8px; }
.switch { position: relative; width: 52px; height: 32px; flex: none; border: 0; border-radius: var(--pill); background: var(--hover); cursor: pointer; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--white); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s; }
.switch.on { background: var(--black); }
.switch.on::after { transform: translateX(20px); }
.switch:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }
.cat-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cat-row .input { flex: 1; text-transform: uppercase; min-width: 0; }
.cat-n { width: 56px; flex: none; text-align: right; }
.icon-btn.danger { color: var(--err); }
.icon-btn.danger:hover { background: var(--err-soft); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar .input { width: 240px; min-height: 44px; }

.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.settings h3 { margin-bottom: 8px; }
.qr-preview { width: 180px; height: 180px; border-radius: var(--r-feature); box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; overflow: hidden; margin: 12px 0 16px; }
.qr-preview img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- toast ---------- */
#toasts { position: fixed; z-index: 90; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--black); color: var(--white); padding: 12px 20px; border-radius: var(--pill); font-weight: 500; font-size: 15px; box-shadow: var(--shadow-2); animation: pop .15s; text-align: center; }
.toast.err { background: var(--err); }

/* =====================================================================
   TABLET
   ===================================================================== */
@media (max-width: 1119px) {
  .hero-mark img { width: 160px; height: 160px; }
  .pos { grid-template-columns: 1fr 340px; gap: 16px; padding: 16px; }
  .tabs button { padding: 10px 12px; }
  .tabs .t-label { display: none; }
  .tabs button.on .t-label { display: inline; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

/* =====================================================================
   MOBILE
   ===================================================================== */
@media (max-width: 767px) {
  .m-only { display: revert !important; }
  .d-only { display: none !important; }
  h1 { font-size: 24px; }
  h2 { font-size: 20px; }

  /* top bar + bottom tab bar */
  .top { gap: 10px; min-height: 56px; padding: 8px 16px; }
  .brand b { font-size: 16px; max-width: 46vw; }
  .logo { width: 36px; height: 36px; font-size: 18px; }
  .top .btn.sm { min-height: 36px; padding: 6px 12px; }
  .pill .lbl { display: none; }
  .pill { padding: 4px 10px; min-height: 28px; }
  .has-nav { padding-bottom: calc(var(--nav-h) + var(--safe-b)); }
  .tabs {
    position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; gap: 0;
    height: calc(var(--nav-h) + var(--safe-b)); padding: 6px 4px var(--safe-b);
    background: var(--white); border-top: 1px solid var(--line);
  }
  .tabs button {
    flex: 1; flex-direction: column; justify-content: center; gap: 2px; min-height: 0; padding: 4px 0;
    border-radius: var(--r-card); font-size: 11px; color: var(--muted);
  }
  .tabs button:hover { background: transparent; }
  .tabs button.on { background: transparent; color: var(--black); }
  .tabs .t-label, .tabs button.on .t-label { display: block; }
  .tabs svg { width: 24px; height: 24px; }

  main.page { padding: 20px 16px 32px; }
  .page-head { margin-bottom: 16px; align-items: center; flex-wrap: nowrap; gap: 8px; }
  .page-head .toolbar { flex-wrap: nowrap; }
  .page-head .btn { min-height: 40px; padding: 8px 14px; font-size: 14px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -16px; margin-right: -16px; padding: 2px 16px; }
  .chips::-webkit-scrollbar { display: none; }

  /* login: black header band, white sheet overlapping it */
  .auth { position: relative; display: block; background: var(--black); }
  .auth-hero { position: static; padding: 56px 20px 64px; }
  .hero-mark { gap: 12px; }
  .hero-mark img { width: 96px; height: 96px; }
  .hero-mark span { font-size: 26px; }
  .auth-panel { position: static; margin-top: -28px; min-height: calc(100dvh - 160px); padding: 16px 20px calc(32px + var(--safe-b)); border-radius: 24px 24px 0 0; background: var(--white); }
  .auth-top { position: absolute; top: 16px; right: 16px; }
  .auth-top .lang-pill { background-color: #1c1c1c; color: var(--white); box-shadow: inset 0 0 0 1px #3a3a3a; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
  .auth-form { margin: 0 auto; padding: 16px 0 0; }
  .auth-form h2 { font-size: 26px; }
  .auth-sub { margin-bottom: 20px; }

  /* auth */
  .auth-wrap { padding: 0; place-items: stretch; background: var(--white); }
  .auth-card { max-width: none; box-shadow: none; border-radius: 0; padding: 32px 20px calc(32px + var(--safe-b)); }
  .grid2 { grid-template-columns: 1fr; }

  /* POS: products full width, cart becomes a bottom sheet */
  .pos { display: block; height: auto; padding: 16px 16px calc(96px + var(--nav-h) + var(--safe-b)); }
  .pos-left .chips { margin: 0 -16px 12px; padding: 2px 16px; }
  .pgrid { overflow: visible; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; }
  .pcard { min-height: 128px; padding: 14px; }
  .pname { font-size: 16px; }
  .pfoot { flex-wrap: wrap; }
  .menu-row { gap: 8px; padding-right: 10px; }
  .menu-info { padding: 6px 8px 6px 12px; }
  .mini-step button { width: 32px; }
  .mini-step input { width: 38px; }
  .cat-n { display: none; }

  .cart {
    position: fixed; z-index: 55; left: 0; right: 0; bottom: 0; max-height: 88vh; max-height: 88dvh;
    border-radius: 16px 16px 0 0; box-shadow: 0 -4px 24px rgba(0, 0, 0, .16);
    transform: translateY(105%); transition: transform .25s ease; visibility: hidden;
  }
  .cart.open { transform: none; visibility: visible; }
  .cart-head { padding: 12px 16px; }
  .cart-head::before { content: ""; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--hover); }
  .cline { padding: 14px 16px; }
  .cart-foot { padding: 14px 16px calc(14px + var(--safe-b)); }
  .cart-scrim { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .5); animation: fade .15s; }

  .cart-bar {
    position: fixed; z-index: 45; left: 12px; right: 12px; bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
    display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 8px 8px 20px;
    border: 0; border-radius: var(--pill); background: var(--black); color: var(--white);
    box-shadow: var(--shadow-2); cursor: pointer; font-weight: 500; text-align: left;
  }
  .cart-bar[disabled] { background: var(--chip); color: var(--body); box-shadow: var(--shadow-float); }
  .cart-bar .cnt { min-width: 28px; height: 28px; padding: 0 8px; border-radius: var(--pill); background: var(--white); color: var(--black); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
  .cart-bar[disabled] .cnt { background: var(--hover); }
  .cart-bar .amt { margin-left: auto; font: 700 18px var(--font-head); padding: 10px 16px; border-radius: var(--pill); background: rgba(255, 255, 255, .14); }
  .cart-bar[disabled] .amt { background: transparent; }

  /* bottom-sheet modals */
  .overlay { place-items: end stretch; padding: 0; }
  .modal, .modal.wide { max-width: none; max-height: 92vh; max-height: 92dvh; border-radius: 16px 16px 0 0; animation: up .22s ease; }
  .m-head { padding: 14px 16px 14px 20px; }
  .m-body { padding: 20px; }
  .m-foot { padding: 12px 16px calc(12px + var(--safe-b)); }
  .m-foot .btn { flex: 1; }
  .m-foot .spacer { display: none; }
  .pay-total .amt { font-size: 38px; }

  /* tables become stacked cards */
  .card.table-wrap.stack-wrap { background: transparent; box-shadow: none; overflow: visible; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tr { background: var(--white); border-radius: var(--r-feature); box-shadow: var(--shadow-1); padding: 12px 16px; margin-bottom: 12px; }
  table.stack td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border: 0; white-space: normal; text-align: right; min-width: 0; }
  table.stack td.right { text-align: right; }
  table.stack td[data-label]::before { content: attr(data-label); color: var(--body); font-size: 13px; text-align: left; flex: none; }
  table.stack td.head { display: block; text-align: left; font-size: 17px; padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
  table.stack td.head::before { display: none; }
  table.stack td.wrap { min-width: 0; }
  table.stack td.full { display: block; text-align: left; padding-top: 10px; }
  table.stack td.full::before { display: none; }
  table.stack td.full .toolbar > .btn { flex: 1; }
  table.stack tr.click:hover td { background: transparent; }
  table.stack tr.click:active { box-shadow: var(--shadow-2); }
  table.stack.compact tr { padding: 10px 16px; }

  /* plain tables inside cards (receipt, top items) stay tables */
  .modal .t th, .modal .t td { padding: 10px 8px; }
  .modal .t td.wrap { min-width: 0; }

  .stats { grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
  .day-nav { gap: 4px; padding: 8px; }
  .day-pick { min-width: 0; flex: 1; padding: 4px 6px; }
  .day-sum b { font-size: 17px; }
  .stat { padding: 16px; }
  .stat .v { font-size: 22px; }
  .two-col, .settings { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: 1fr 1fr; }
  .open-biz { margin: 0 auto; box-shadow: none; padding: 4px 0; }

  #toasts { bottom: calc(var(--nav-h) + var(--safe-b) + 84px); }
}

@media (max-width: 360px) {
  .pgrid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .pcard { padding: 12px; }
  .stat .v { font-size: 19px; }
}

/* ---------- print (receipt) ---------- */
@media print {
  body * { visibility: hidden; }
  .receipt, .receipt * { visibility: visible; }
  .receipt { position: absolute; left: 0; top: 0; width: 80mm; }
}
