/* =====================================================================
   Cafe POS - "Liquid Glass" theme
   Frosted translucent panels over a soft colour field, iOS-style controls.
   ===================================================================== */
:root {
  --ink: #1c1c1e;
  --ink-2: rgba(60, 60, 67, .72);
  --ink-3: rgba(60, 60, 67, .45);
  --line: rgba(60, 60, 67, .12);
  --fill: rgba(118, 118, 128, .12);
  --fill-2: rgba(118, 118, 128, .2);

  --glass: rgba(255, 255, 255, .52);
  --glass-strong: rgba(255, 255, 255, .74);
  --glass-solid: rgba(255, 255, 255, .86);
  --glass-edge: rgba(255, 255, 255, .75);
  --blur: blur(28px) saturate(180%);
  --glass-shadow: 0 10px 40px rgba(30, 35, 60, .12), 0 1px 2px rgba(30, 35, 60, .06),
                  inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -1px 0 rgba(255, 255, 255, .3);

  --accent: #007aff;
  --accent-2: #0062cc;
  --accent-soft: rgba(0, 122, 255, .12);
  --ok: #1f9d4c;
  --ok-2: #188040;
  --danger: #e0352b;
  --danger-soft: rgba(255, 59, 48, .12);
  --warn: #c77700;

  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;

  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI Variable Text",
               "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  -webkit-tap-highlight-color: transparent;
  background:
    radial-gradient(900px 700px at 0% 0%, rgba(255, 196, 140, .75), transparent 60%),
    radial-gradient(900px 700px at 100% 0%, rgba(150, 200, 255, .75), transparent 60%),
    radial-gradient(1000px 800px at 80% 100%, rgba(200, 170, 255, .6), transparent 60%),
    radial-gradient(900px 700px at 0% 100%, rgba(140, 225, 200, .55), transparent 60%),
    #eef0f5;
  background-attachment: fixed;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 20px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .8);
  background: rgba(255, 255, 255, .6);
  box-shadow: 0 2px 8px rgba(30, 35, 60, .08), inset 0 1px 0 rgba(255, 255, 255, .9);
  font-weight: 600; font-size: 15px; letter-spacing: -.01em;
  text-decoration: none; color: var(--ink); user-select: none;
  transition: transform .12s ease, background .2s, box-shadow .2s;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px rgba(0, 122, 255, .35), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn.ok, .btn.pay { background: var(--ok); border-color: transparent; color: #fff;
  box-shadow: 0 8px 22px rgba(31, 157, 76, .35), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn.danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn.danger-outline { color: var(--danger); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; }
.btn.ghost:hover { background: var(--fill); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn.icon { width: 44px; min-height: 44px; padding: 0; font-size: 18px; }
.btn.on { background: var(--accent); color: #fff; border-color: transparent; }
.btn.block { width: 100%; }

input[type=text], input[type=password], input[type=search], input[type=number], input[type=date], input[type=email],
input[type=datetime-local], input[type=time],
input:not([type]), select, textarea {
  min-height: 48px; padding: 0 16px; border-radius: var(--r-sm);
  border: 1px solid rgba(255, 255, 255, .8); background: rgba(255, 255, 255, .65);
  box-shadow: inset 0 1px 3px rgba(30, 35, 60, .08);
  width: 100%; font-size: 16px; outline: none;
}
textarea { padding: 12px 16px; min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 0 0 6px 4px; }
.field small { display: block; color: var(--ink-2); margin: 5px 0 0 4px; font-size: 12.5px; }
.check { display: flex; align-items: flex-start; gap: 12px; padding: 9px 2px; cursor: pointer; }
.check b { display: block; font-weight: 600; }
.check small { color: var(--ink-2); font-size: 13px; }

/* iOS switch */
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 51px; height: 31px; border-radius: 999px;
  background: var(--fill-2); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 1px 1px rgba(0, 0, 0, .1); transition: transform .2s; }
.switch:checked { background: #34c759; }
.switch:checked::after { transform: translateX(20px); }
.switch:disabled { opacity: .5; }

/* Segmented control */
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--fill); gap: 2px; }
.seg button { min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent;
  font-weight: 600; font-size: 14.5px; color: var(--ink); white-space: nowrap; transition: background .2s, box-shadow .2s; }
.seg button.on { background: #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, .1), 0 1px 2px rgba(0, 0, 0, .06); }
.seg button .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 12px; line-height: 20px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 10px; z-index: 20; margin: 10px 12px 0; height: 60px; border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: space-between; padding: 0 10px 0 16px; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.brand small { font-weight: 600; color: var(--ink-2); font-size: 15px; }
.brand-logo { height: 36px; max-width: 110px; object-fit: contain; border-radius: 8px; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.top-actions .btn { min-height: 42px; padding: 0 16px; }
.user-chip { font-size: 14px; color: var(--ink-2); padding: 0 8px; white-space: nowrap; }
#clock { font-variant-numeric: tabular-nums; color: var(--ink-2); padding: 0 6px; font-weight: 600; }

/* ---------- POS layout ---------- */
body.pos-page { overflow: hidden; user-select: none; }
.pos { display: flex; gap: 12px; padding: 12px; height: calc(100vh - 70px); height: calc(100dvh - 70px); }
.menu-panel { flex: 1 1 62%; display: flex; flex-direction: column; min-width: 0; border-radius: var(--r-xl); overflow: hidden; }
.menu-tools { display: flex; gap: 10px; padding: 12px 12px 8px; align-items: center; }
.cat-tabs { display: flex; gap: 8px; overflow-x: auto; flex: 1; scrollbar-width: none; padding: 2px; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  flex: none; min-height: 46px; padding: 0 18px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .7);
  background: rgba(255, 255, 255, .5); font-weight: 600; white-space: nowrap; font-size: 15px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9);
}
.cat-tab.on { background: var(--ink); color: #fff; border-color: transparent; }
.cat-tab .dot { width: 10px; height: 10px; margin-right: 8px; vertical-align: 0; }
.cat-tab.recent { color: var(--warn); }
.cat-tab.recent.on { background: #ff9f0a; color: #fff; }
.search { max-width: 210px; user-select: text; border-radius: 999px !important; }
.item-grid {
  flex: 1; overflow-y: auto; padding: 6px 12px 16px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; align-content: start;
}

/* ---------- Item tiles ----------
   Name (2 lines max)          (qty)
   size · tags            [faint icon]
   Price                 12 left      */
.tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start;
  min-height: 100px; padding: 13px 14px 12px; border-radius: 18px; text-align: left; overflow: hidden; isolation: isolate;
  background: rgba(255, 255, 255, .8); border: 1px solid rgba(255, 255, 255, .95);
  box-shadow: 0 1px 2px rgba(30, 35, 60, .06), 0 6px 18px rgba(30, 35, 60, .06);
  transition: transform .12s ease, box-shadow .2s, border-color .2s;
}
.tile:active { transform: scale(.96); }
/* thin category-colour line on the left */
.tile::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--c, var(--accent)); opacity: .75; }
/* the icon: big, faint, upright, tucked into the right edge behind the text */
.tile .t-bg { position: absolute; right: -8px; top: 50%; width: 66px; height: 66px; transform: translateY(-50%);
  z-index: -1; pointer-events: none; color: var(--c, var(--accent)); opacity: .11; }
.tile .t-bg .ico { width: 100%; height: 100%; stroke-width: 1.3; }
.tile .t-name {
  font-weight: 650; font-size: 15px; line-height: 1.25; letter-spacing: -.01em; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tile .t-sub { font-size: 12px; color: var(--ink-2); margin-top: 3px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .t-foot { margin-top: auto; padding-top: 8px; width: 100%; display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.tile .t-price { font-size: 16px; font-weight: 750; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tile .t-stock { font-size: 11.5px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.tile .t-stock.low { color: #c77700; }
.tile .t-stock.out { color: #d92d20; }
.tile .t-qty {
  position: absolute; top: 10px; right: 10px; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 13px;
  display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff; background: var(--ink);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .2);
}
.tile.in-bill { border-color: var(--c, var(--accent));
  box-shadow: inset 0 0 0 1.5px var(--c, var(--accent)), 0 8px 20px rgba(30, 35, 60, .1); }
.tile.bump { animation: bump .28s; }
@keyframes bump { 40% { transform: scale(.94); } }
.empty { color: var(--ink-2); padding: 40px 20px; text-align: center; grid-column: 1 / -1; }

.bill-panel {
  flex: 0 0 38%; max-width: 470px; min-width: 340px; border-radius: var(--r-xl);
  display: flex; flex-direction: column; overflow: hidden;
}
.bill-panel > div { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.panel-head { display: flex; gap: 8px; padding: 12px; align-items: center; border-bottom: 1px solid var(--line); }
.panel-head .grow { flex: 1; min-width: 0; }
.bill-title { flex: 1; min-width: 0; text-align: center; }
.bill-title b { display: block; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bill-title small { color: var(--ink-2); font-size: 12.5px; }
.bills-body { flex: 1; overflow-y: auto; padding: 12px; }
.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.tbl-tile {
  min-height: 92px; border-radius: var(--r-md); padding: 12px; text-align: left; border: 1px solid rgba(255, 255, 255, .85);
  background: rgba(255, 255, 255, .55); box-shadow: inset 0 1px 0 #fff; display: flex; flex-direction: column; justify-content: space-between;
}
.tbl-tile b { font-size: 18px; letter-spacing: -.02em; }
.tbl-tile small { color: var(--ink-2); font-size: 12.5px; }
.tbl-tile.busy { background: linear-gradient(150deg, rgba(0, 122, 255, .9), rgba(88, 86, 214, .88)); color: #fff;
  box-shadow: 0 8px 22px rgba(0, 122, 255, .3), inset 0 1px 0 rgba(255, 255, 255, .4); }
.tbl-tile.busy small { color: rgba(255, 255, 255, .85); }
.tbl-tile:active { transform: scale(.96); }
.tbl-tile.ta-new { border: 1.5px dashed rgba(0, 122, 255, .55); background: rgba(255, 255, 255, .35); color: var(--accent);
  align-items: center; justify-content: center; text-align: center; }
.tbl-tile.ta-new b { font-size: 30px; line-height: 1; }
.tbl-tile.ta-new small { color: var(--accent); font-weight: 600; }
.area-label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; margin: 14px 4px 8px; }
.area-label:first-child { margin-top: 0; }
.ta-list { display: flex; flex-direction: column; gap: 8px; }
.ta-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; min-height: 64px;
  border-radius: var(--r-md); border: 1px solid rgba(255, 255, 255, .85); background: rgba(255, 255, 255, .6);
  box-shadow: inset 0 1px 0 #fff; text-align: left; width: 100%;
}
.ta-card b { display: block; font-size: 16px; }
.ta-card small { color: var(--ink-2); }
.ta-card .amt { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 17px; }
.ta-card.new { justify-content: center; border-style: dashed; border-color: rgba(0, 122, 255, .5); color: var(--accent); font-weight: 700; background: rgba(255, 255, 255, .35); }

.bill-lines { flex: 1; overflow-y: auto; padding: 4px 0; }
.line { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.line .l-name { font-weight: 600; }
.line .l-unit { color: var(--ink-2); font-size: 13px; }
.line .l-total { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.line .l-ctrl { display: flex; align-items: center; gap: 6px; justify-content: flex-end; grid-column: 2; }
.qbtn {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .85); background: rgba(255, 255, 255, .7);
  box-shadow: 0 2px 6px rgba(30, 35, 60, .08); font-size: 21px; font-weight: 600; line-height: 1; display: grid; place-items: center;
}
.qbtn:active { transform: scale(.9); }
.qbtn.del { color: var(--danger); font-size: 16px; }
.qty { min-width: 30px; text-align: center; font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.bill-empty { color: var(--ink-2); text-align: center; padding: 50px 24px; line-height: 1.5; }
.bill-note { margin: 8px 14px; padding: 8px 12px; border-radius: var(--r-sm); background: rgba(255, 204, 0, .18); font-size: 14px; }
.bill-totals { border-top: 1px solid var(--line); padding: 10px 16px; background: rgba(255, 255, 255, .35); }
.t-row { display: flex; justify-content: space-between; padding: 3px 0; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.t-row.grand { font-size: 26px; font-weight: 800; padding-top: 8px; color: var(--ink); letter-spacing: -.02em; }
.t-row .rm { color: var(--danger); border: 0; background: none; font-weight: 600; padding: 0 6px; }
.bill-actions { display: grid; grid-template-columns: 1fr 1fr 1.8fr; gap: 8px; padding: 12px; }
.bill-actions .btn { min-height: 60px; font-size: 16px; border-radius: 20px; }
.bill-actions .btn.pay { font-size: 19px; }

/* ---------- Modals (sheets) ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(20, 24, 40, .28); z-index: 50;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .18s;
}
.modal {
  background: rgba(255, 255, 255, .8); -webkit-backdrop-filter: blur(40px) saturate(180%); backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .85); border-radius: var(--r-xl); width: 100%; max-width: 460px;
  max-height: calc(100dvh - 32px); overflow-y: auto; padding: 22px;
  box-shadow: 0 30px 80px rgba(20, 24, 40, .3), inset 0 1px 0 #fff; animation: pop .22s cubic-bezier(.2, .9, .3, 1.2);
}
.modal.wide { max-width: 900px; }
.modal.form-modal { max-width: 640px; }
.modal h2 { margin: 0 0 14px; font-size: 22px; letter-spacing: -.02em; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.modal-actions .btn { min-width: 110px; }
.confirm-msg { font-size: 17px; margin: 4px 0 8px; line-height: 1.45; }
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-list .btn { justify-content: flex-start; border-radius: var(--r-md); min-height: 54px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(8px); } }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key {
  min-height: 58px; border-radius: var(--r-md); border: 1px solid rgba(255, 255, 255, .85);
  background: rgba(255, 255, 255, .65); box-shadow: 0 2px 6px rgba(30, 35, 60, .07), inset 0 1px 0 #fff;
  font-size: 24px; font-weight: 500;
}
.key:active { background: rgba(0, 122, 255, .15); transform: scale(.96); }
.display {
  font-size: 34px; font-weight: 700; text-align: right; padding: 10px 16px; border-radius: var(--r-md);
  background: rgba(255, 255, 255, .6); box-shadow: inset 0 1px 4px rgba(30, 35, 60, .1); margin-bottom: 10px;
  font-variant-numeric: tabular-nums; min-height: 62px; letter-spacing: -.02em;
}
.display.placeholder { color: var(--ink-3); font-size: 20px; line-height: 42px; }
.pay-total { font-size: 17px; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: baseline; color: var(--ink-2); }
.pay-total b { font-size: 32px; color: var(--ink); letter-spacing: -.02em; }
.methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 8px; margin-bottom: 14px; }
.methods .btn { min-height: 54px; border-radius: var(--r-md); }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.quick .btn { min-height: 48px; padding: 0 6px; border-radius: var(--r-sm); }
.change-row { display: flex; justify-content: space-between; font-size: 21px; margin-top: 12px; font-weight: 700; }
.change-row.short { color: var(--danger); }
/* Receive stock mode */
.recv-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.recv-fields input { min-height: 44px; }
.recv-actions { grid-template-columns: 1fr 2fr; }
.qty.tap { border: 1px solid rgba(255, 255, 255, .85); background: rgba(255, 255, 255, .7); border-radius: 12px; min-width: 56px;
  height: 42px; font-size: 18px; font-weight: 700; }
body.receiving .menu-panel { box-shadow: var(--glass-shadow), 0 0 0 3px rgba(31, 157, 76, .55); }
body.receiving .tile .t-qty { background: var(--ok); }
.mode-banner { font-size: 13px; font-weight: 700; color: var(--ok-2); background: rgba(52, 199, 89, .16); padding: 4px 12px; border-radius: 999px; }

/* Payment window: details on the left, keypad on the right - sized to never scroll */
.modal.pay-sheet { max-width: 860px; padding: 20px; }
.pay-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: stretch; }
.pay-grid.single { grid-template-columns: minmax(0, 1fr); max-width: 520px; margin: 0 auto; }
.pay-main { display: flex; flex-direction: column; min-width: 0; }
.pay-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.pay-head h2 { margin: 0; font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pay-head .pay-total { margin: 0; gap: 10px; }
.pay-sheet .methods { margin-bottom: 12px; }
.pay-sheet .display { margin-bottom: 0; }
.pay-pad { display: flex; }
.pay-pad .keypad { flex: 1; grid-auto-rows: 1fr; }
.pay-pad .key { min-height: 0; font-size: 26px; }
.pay-actions { margin-top: auto; padding-top: 14px; }
.pay-actions .btn.pay { min-height: 58px; min-width: 190px; font-size: 18px; }
.pay-sheet .cust-list { max-height: min(260px, 40vh); }
@media (max-height: 640px) {
  .modal.pay-sheet { padding: 14px; }
  .pay-sheet .methods .btn, .pay-sheet .quick .btn { min-height: 44px; }
  .pay-sheet .display { min-height: 50px; font-size: 28px; padding: 6px 14px; }
  .pay-sheet .display.placeholder { line-height: 38px; }
  .pay-actions .btn.pay { min-height: 50px; }
}
@media (max-width: 700px) {
  .pay-grid { grid-template-columns: 1fr; gap: 10px; }
  .pay-pad { order: 2; }
  .pay-pad .key { min-height: 48px; font-size: 22px; }
  .modal.pay-sheet { overflow-y: auto; }
}
.cust-list { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.cust-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: var(--r-sm);
  border: 1px solid rgba(255, 255, 255, .85); background: rgba(255, 255, 255, .6); text-align: left; width: 100%; }
.cust-item.on { background: var(--accent); color: #fff; }
.cust-item.on small { color: rgba(255, 255, 255, .85); }
.cust-item small { color: var(--ink-2); }
.receipt-wrap { background: rgba(118, 118, 128, .12); border-radius: var(--r-md); padding: 16px; display: flex; justify-content: center; overflow: auto; max-height: 60vh; }
.receipt-wrap > div { background: #fff; box-shadow: 0 6px 24px rgba(0, 0, 0, .12); flex: none; }
.tpl-pick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }

/* ---------- Receipt (roll paper) ---------- */
.receipt { font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Courier New", monospace; line-height: 1.35; color: #000; padding: 3mm 3mm 5mm; }
.r-center { text-align: center; }
.r-logo { display: block; margin: 0 auto 4px; max-width: 60%; max-height: 22mm; object-fit: contain; }
.r-title { font-size: 1.35em; font-weight: 700; }
.r-head { font-weight: 700; text-align: center; margin: 4px 0; letter-spacing: .05em; white-space: pre-line; }
.r-row { display: flex; justify-content: space-between; gap: 8px; }
.r-row span:last-child { text-align: right; white-space: nowrap; }
.r-item { margin: 3px 0; }
.r-total { font-weight: 700; font-size: 1.25em; margin-top: 4px; }
.r-sep { border-top: 1px dashed #000; margin: 6px 0; }
.r-void { text-align: center; font-weight: 700; border: 2px solid #000; margin-top: 8px; padding: 4px; }
.r-foot { text-align: center; white-space: pre-line; }
.r-credit { text-align: center; font-size: .78em; opacity: .7; margin-top: 8px; letter-spacing: .02em; }
.inv-credit { text-align: center; font-size: .8em; color: #888; margin-top: 4mm; }
.r-sign { margin-top: 16px; border-top: 1px solid #000; padding-top: 3px; text-align: center; font-size: .9em; }

/* ---------- Invoice (A4 / A5 / wide) ---------- */
.invoice { font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: #111; padding: 12mm; line-height: 1.45; }
.inv-head { display: flex; justify-content: space-between; gap: 10mm; align-items: flex-start; padding-bottom: 6mm; border-bottom: 2px solid #111; }
.inv-co { max-width: 60%; }
.inv-co img { max-height: 24mm; max-width: 60mm; object-fit: contain; display: block; margin-bottom: 3mm; }
.inv-co b { font-size: 1.5em; display: block; }
.inv-co div { color: #444; }
.inv-meta { text-align: right; }
.inv-meta h1 { margin: 0 0 3mm; font-size: 1.8em; letter-spacing: .04em; white-space: pre-line; }
.inv-meta table { margin-left: auto; border-collapse: collapse; }
.inv-meta td { padding: 1px 0 1px 6mm; }
.inv-meta td:first-child { color: #666; }
.inv-items { width: 100%; border-collapse: collapse; margin: 6mm 0; }
.inv-items th { text-align: left; border-bottom: 1px solid #111; padding: 2mm 1mm; font-size: .85em; text-transform: uppercase; letter-spacing: .03em; }
.inv-items td { padding: 2mm 1mm; border-bottom: 1px solid #ddd; }
.inv-items .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.inv-totals { margin-left: auto; width: 45%; min-width: 60mm; }
.inv-totals .r-row { padding: 1mm 0; }
.inv-totals .r-total { border-top: 2px solid #111; padding-top: 2mm; margin-top: 1mm; }
.inv-pay { margin-top: 6mm; color: #444; }
.inv-foot { margin-top: 10mm; padding-top: 4mm; border-top: 1px solid #ddd; text-align: center; color: #444; white-space: pre-line; }
.inv-void { color: #c00; font-weight: 700; font-size: 1.3em; border: 3px solid #c00; display: inline-block; padding: 2mm 5mm; margin-top: 4mm; }

#print-area { display: none; }

/* ---------- Tables / cards ---------- */
.card { border-radius: var(--r-lg); overflow: hidden; }
.card > h3 { margin: 0; padding: 14px 18px; font-size: 16px; border-bottom: 1px solid var(--line); letter-spacing: -.01em; }
.card .card-body { padding: 16px 18px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th, .tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl th.num, .tbl td.num { text-align: right; }
.tbl th { font-size: 12.5px; color: var(--ink-2); font-weight: 600; background: rgba(255, 255, 255, .55); position: sticky; top: 0;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); text-transform: uppercase; letter-spacing: .03em; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.void td { color: var(--ink-3); text-decoration: line-through; }
.tbl tr.void td.keep { text-decoration: none; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: rgba(255, 255, 255, .45); }
.tbl-wrap { overflow: auto; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--fill); }
.badge.ok { background: rgba(52, 199, 89, .18); color: #157a36; }
.badge.off { background: var(--danger-soft); color: #c0271e; }
.badge.info { background: var(--accent-soft); color: var(--accent-2); }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -1px; margin-right: 10px; }
.yes { color: var(--ok); font-weight: 800; }
.no { color: var(--ink-3); }
.neg { color: var(--danger); }

/* ---------- Admin layout ---------- */
.admin { display: flex; gap: 12px; padding: 12px; min-height: calc(100vh - 70px); align-items: flex-start; }
.side { width: 236px; flex: none; border-radius: var(--r-xl); padding: 10px; position: sticky; top: 82px; }
.side a {
  display: flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 14px;
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; margin-bottom: 2px;
}
.side a:hover { background: rgba(255, 255, 255, .5); }
.side a.on { background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(0, 122, 255, .3); }
.side .sep { height: 1px; background: var(--line); margin: 8px 10px; }
.nav-group { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; padding: 0 14px;
  border: 0; border-radius: 14px; background: transparent; font-weight: 700; font-size: 15px; color: var(--ink); text-align: left; }
.nav-group:hover { background: rgba(255, 255, 255, .5); }
.nav-group.active { color: var(--accent); }
.nav-group .chev { font-size: 20px; line-height: 1; transition: transform .2s; color: var(--ink-2); }
.nav-group.open .chev { transform: rotate(90deg); }
.nav-sub { margin: 2px 0 4px 10px; padding-left: 8px; border-left: 2px solid var(--line); }
.side a.sub { min-height: 40px; font-size: 14.5px; font-weight: 600; }
.subnav { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px; margin-bottom: 16px; border-radius: 999px; background: var(--fill); width: fit-content; max-width: 100%; }
.subnav a { padding: 8px 16px; border-radius: 999px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 14.5px; white-space: nowrap; }
.subnav a.on { background: #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, .1); }
@media screen { [data-theme="dark"] .subnav a.on { background: rgba(255, 255, 255, .2); } [data-theme="dark"] .nav-group:hover { background: rgba(255, 255, 255, .05); } }
@media (max-width: 760px) {
  .subnav { border-radius: var(--r-md); }
}

/* Management panel (Exsia Manage) */
/* Exsia logos (light/dark copies follow the app theme) */
.th-dark { display: none; }
@media screen { [data-theme="dark"] .th-light { display: none; } [data-theme="dark"] .th-dark { display: block; } }
.brand .logo-full { height: 34px; width: auto; aspect-ratio: 24051.65 / 4540.94; flex: none; }
.brand .logo-short { height: 26px; width: auto; aspect-ratio: 6197.87 / 4540.94; flex: none; }
.brand-full { display: flex; flex: none; }
/* POS / Admin: cafe name with a small "powered by Exsia POS" line under it */
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.brand-text #cafeName { overflow: hidden; text-overflow: ellipsis; }
.powered { display: flex; align-items: center; gap: 5px; margin-top: 2px; font-size: 11px; font-weight: 600;
  letter-spacing: .02em; color: var(--ink-2); }
.powered img { height: 16px; width: auto; aspect-ratio: 24051.65 / 4540.94; }
.brand-short { display: none; flex: none; }
.login-brand { display: flex; justify-content: center; margin: 4px 0 10px !important; }
.login-brand .logo-full { height: 48px; width: auto; aspect-ratio: 24051.65 / 4540.94; }
/* Manage top bar on phones: the short mark instead of the full wordmark */
@media (max-width: 520px) { .brand-full { display: none; } .brand-short { display: flex; } }
.side-label { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding: 6px 14px 4px; }
.cafe-pick { width: calc(100% - 8px); margin: 2px 4px 8px; }
.cafe-banner { display: inline-block; margin-bottom: 12px; padding: 6px 14px; border-radius: 999px; background: var(--accent-soft); font-size: 14px; }
.cafe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.cafe-card h3 { margin: 0 0 2px; font-size: 18px; }
.cafe-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.cafe-top a { font-size: 14px; word-break: break-all; }
.cafe-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.cafe-stats div { background: var(--fill); border-radius: 12px; padding: 8px 10px; }
.cafe-stats b { display: block; font-size: 17px; }
.cafe-stats small { color: var(--ink-2); font-size: 12px; }
.login-card { display: grid; gap: 10px; padding: 14px; border-radius: 14px; background: var(--fill); margin: 12px 0; }
.login-card small { display: block; color: var(--ink-2); font-size: 12px; }
.login-card a { word-break: break-all; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 17px; letter-spacing: .03em; user-select: all; }

/* Phones and small tablets: side menu becomes a slide-in drawer (button added by initMobileMenu) */
.menu-btn, .side-back { display: none; }
@media (max-width: 900px) {
  .menu-btn { display: inline-flex; flex-direction: column; justify-content: center; gap: 4px; flex: none; }
  .menu-btn span { display: block; width: 18px; height: 2px; margin: 0 auto; border-radius: 2px; background: var(--ink);
    transition: transform .25s, opacity .2s; }
  .menu-open .menu-btn span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .menu-open .menu-btn span:nth-child(2) { opacity: 0; }
  .menu-open .menu-btn span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .topbar { justify-content: flex-start; padding-left: 6px; gap: 8px; }
  .topbar .brand { flex: 1; }
  .admin { display: block; padding: 8px; }
  .side {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60; width: min(300px, 84vw); overflow-y: auto;
    display: flex; flex-direction: column; border-radius: 0 var(--r-xl) var(--r-xl) 0; background: var(--glass-solid);
    padding: calc(14px + env(safe-area-inset-top)) 10px calc(14px + env(safe-area-inset-bottom));
    transform: translateX(-105%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); visibility: hidden;
  }
  .menu-open .side { transform: none; visibility: visible; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
  .side a, .side .nav-group { flex: none; }
  .side-back { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .35);
    opacity: 0; pointer-events: none; transition: opacity .25s; }
  .menu-open .side-back { opacity: 1; pointer-events: auto; }
  body.menu-open { overflow: hidden; }
  .side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
  .side-foot .btn { width: 100%; justify-content: flex-start; }
  .side-foot .user-chip { display: block; padding: 4px 14px; font-weight: 600; }
  .admin-main { padding: 4px 2px 40px; }
  .view-head h1 { font-size: 26px; }
}
@media (max-width: 900px) and (prefers-reduced-motion: reduce) { .side, .side-back, .menu-btn span { transition: none; } }
.admin-main { flex: 1; padding: 8px 8px 40px; min-width: 0; }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.view-head h1 { margin: 0; font-size: 30px; letter-spacing: -.03em; }
.view-head p { margin: 4px 0 0; color: var(--ink-2); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { width: auto; }
.toolbar label { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink-2); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { border-radius: var(--r-lg); padding: 16px 18px; }
.stat .k { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.stat .v { font-size: 27px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.stat .s { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-bottom: 16px; }
.bar { height: 8px; background: var(--fill); border-radius: 4px; overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #5ac8fa); border-radius: 4px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .9); box-shadow: 0 2px 6px rgba(0, 0, 0, .15); }
.swatch.on { outline: 3px solid var(--ink); outline-offset: 1px; }
.presets { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.form-card { max-width: 680px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.report-title { display: none; }
.logo-box { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-preview { width: 160px; height: 100px; border-radius: var(--r-md); background: rgba(255, 255, 255, .7);
  display: grid; place-items: center; overflow: hidden; border: 1px dashed var(--ink-3); color: var(--ink-3); font-size: 13px; }
.logo-preview img { max-width: 92%; max-height: 92%; object-fit: contain; }
.tpl-layout { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 16px; align-items: start; }
.tpl-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.tpl-list button { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: var(--r-sm);
  border: 1px solid rgba(255, 255, 255, .85); background: rgba(255, 255, 255, .55); text-align: left; font-weight: 600; }
.tpl-list button.on { background: var(--accent); color: #fff; }
.tpl-list button small { opacity: .75; font-weight: 500; }
.tpl-list button.on .badge { background: #fff; color: var(--ok-2); }
.tpl-preview { border-radius: var(--r-lg); padding: 18px; position: sticky; top: 82px; }
.tpl-preview .receipt-wrap { max-height: 72vh; }
.flags { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 100%; max-width: 400px; border-radius: 32px; padding: 30px; }
.login-box h1 { margin: 0 0 4px; font-size: 30px; text-align: center; letter-spacing: -.03em; }
.login-box p { margin: 0 0 22px; color: var(--ink-2); text-align: center; }
.login-box .btn { width: 100%; min-height: 54px; font-size: 17px; margin-top: 10px; }
.login-box .keypad { margin-top: 14px; }
.login-logo { display: block; max-height: 70px; max-width: 200px; margin: 0 auto 14px; object-fit: contain; }
.err { color: var(--danger); min-height: 22px; font-weight: 600; text-align: center; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: rgba(28, 28, 30, .82); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); color: #fff;
  padding: 13px 22px; border-radius: 999px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); transition: opacity .4s, transform .4s; max-width: 90vw; animation: pop .25s; }
.toast.error { background: rgba(224, 53, 43, .92); }
.toast.ok { background: rgba(31, 157, 76, .92); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- Item tile extras: stock, size, recommended ---------- */
.tag-ic { font-size: 12px; margin-left: 2px; }
/* Item icons (bundled SVG sprite) */
.ico { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.t-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; flex: none; font-size: 22px;
  color: var(--c, var(--accent)); background: rgba(255, 255, 255, .75);
  background: color-mix(in srgb, var(--c, #888) 16%, rgba(255, 255, 255, .85)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .8); }
.t-ico.big { width: 44px; height: 44px; font-size: 26px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; max-height: 52vh; overflow-y: auto; padding: 2px; }
.icon-grid button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 14px;
  border: 1px solid transparent; background: var(--fill); font-size: 26px; color: var(--ink); }
.icon-grid button small { font-size: 10.5px; color: var(--ink-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-grid button.on { background: var(--accent); color: #fff; }
.icon-grid button.on small { color: rgba(255, 255, 255, .85); }
.icon-pick { display: flex; align-items: center; gap: 12px; }
.icon-pick .t-ico { width: 48px; height: 48px; font-size: 28px; }
.icon-pick .t-ico.none { color: var(--ink-3); font-size: 13px; }
.list-ico { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; font-size: 16px; vertical-align: middle;
  margin-right: 8px; color: var(--c); background: color-mix(in srgb, var(--c, #888) 16%, transparent); }
.warn { color: var(--warn); }
.badge.warn { background: rgba(255, 159, 10, .2); color: #a15c00; }
.form-sec { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3);
  margin: 6px 0 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.modal h2 + .form-sec { border-top: 0; padding-top: 0; }
.tag-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-chip { position: relative; }
.tag-chip input { position: absolute; opacity: 0; pointer-events: none; }
.tag-chip span { display: inline-block; padding: 8px 14px; border-radius: 999px; background: var(--fill); font-weight: 600; font-size: 14px; cursor: pointer; }
.tag-chip input:checked + span { background: var(--accent); color: #fff; }
.tag-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.item-info dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.item-info dt { color: var(--ink-2); font-weight: 600; }
.item-info dd { margin: 0; }

/* ---------- Selfie camera & staff switcher ---------- */
.cam { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 20px; overflow: hidden; background: #111;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); }
.cam video, .cam img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam video { transform: scaleX(-1); }
.cam img { display: none; }
.cam.taken img { display: block; }
.cam .cam-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 16px;
  color: #fff; font-weight: 600; cursor: pointer; background: rgba(0, 0, 0, .35); }
.cam.live .cam-msg, .cam.taken .cam-msg { display: none; }
.cam .cam-hint { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; color: #fff; font-size: 13px; font-weight: 600;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .7); }
.switch-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; }
.staff-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-top: 12px; max-height: 26vh; overflow-y: auto; }
.staff-pick button { min-height: 54px; border-radius: var(--r-md); border: 1px solid rgba(255, 255, 255, .85); background: rgba(255, 255, 255, .6);
  font-weight: 650; padding: 6px 10px; text-align: left; }
.staff-pick button small { display: block; font-weight: 500; color: var(--ink-2); font-size: 12px; }
.staff-pick button.on { background: var(--accent); color: #fff; border-color: transparent; }
.staff-pick button.on small { color: rgba(255, 255, 255, .85); }
.pin-dots { font-size: 30px; letter-spacing: 10px; text-align: center; min-height: 52px; line-height: 52px; border-radius: var(--r-md);
  background: rgba(255, 255, 255, .6); box-shadow: inset 0 1px 4px rgba(30, 35, 60, .1); margin-bottom: 10px; }
.switch-grid .keypad .key { min-height: 54px; }
.att-photo { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--fill); display: block; cursor: zoom-in; }
.att-none { width: 44px; height: 44px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; color: var(--ink-3); font-size: 11px; }
.big-photo { width: 100%; border-radius: var(--r-lg); display: block; }
.amt-in { color: var(--ok); font-weight: 700; }
.amt-out { color: var(--danger); font-weight: 700; }
.recv-table td { padding: 6px 8px; }
.recv-table input { min-height: 40px; padding: 0 10px; }
@media (max-width: 760px) { .switch-grid { grid-template-columns: 1fr; } }

/* Lower-power devices: drop the blur */
@media (prefers-reduced-transparency: reduce) {
  .glass, .modal, .toast { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--glass-solid); }
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .user-chip, #clock { display: none; }
  .item-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }
  .bill-panel { min-width: 310px; }
  .tpl-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body.pos-page { overflow: auto; }
  .pos { flex-direction: column; height: auto; }
  .item-grid { max-height: 52vh; }
  .bill-panel { max-width: none; min-width: 0; min-height: 70vh; }
  .search { max-width: 130px; }
  .form-grid, .flags { grid-template-columns: 1fr; }
  .top-actions .btn { padding: 0 12px; }
}

/* ---------- Dark mode (screen only - printing always uses light colours) ---------- */
@media screen {
  :root[data-theme="dark"] {
    color-scheme: dark;
    --ink: #f2f2f7;
    --ink-2: rgba(235, 235, 245, .68);
    --ink-3: rgba(235, 235, 245, .34);
    --line: rgba(255, 255, 255, .09);
    --fill: rgba(118, 118, 128, .26);
    --fill-2: rgba(118, 118, 128, .4);
    --glass: rgba(28, 28, 33, .58);
    --glass-strong: rgba(38, 38, 44, .72);
    --glass-solid: rgba(28, 28, 30, .94);
    --glass-edge: rgba(255, 255, 255, .1);
    --glass-shadow: 0 10px 40px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .07);
    --accent: #0a84ff;
    --accent-2: #409cff;
    --accent-soft: rgba(10, 132, 255, .22);
    --ok: #248a3d;
    --ok-2: #30d158;
    --danger: #ff453a;
    --danger-soft: rgba(255, 69, 58, .18);
  }
  [data-theme="dark"] body {
    background:
      radial-gradient(900px 700px at 0% 0%, rgba(255, 140, 60, .22), transparent 60%),
      radial-gradient(900px 700px at 100% 0%, rgba(60, 120, 255, .28), transparent 60%),
      radial-gradient(1000px 800px at 80% 100%, rgba(150, 90, 255, .22), transparent 60%),
      radial-gradient(900px 700px at 0% 100%, rgba(40, 180, 150, .18), transparent 60%),
      #0c0d11;
    background-attachment: fixed;
  }
  [data-theme="dark"] .btn { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); }
  [data-theme="dark"] .btn.primary, [data-theme="dark"] .btn.on { background: var(--accent); }
  [data-theme="dark"] .btn.ok, [data-theme="dark"] .btn.pay { background: var(--ok); }
  [data-theme="dark"] .btn.danger { background: var(--danger); }
  [data-theme="dark"] .btn.ghost { background: transparent; border-color: transparent; }
  [data-theme="dark"] input:not([type=checkbox]):not([type=file]), [data-theme="dark"] select, [data-theme="dark"] textarea {
    background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .1); box-shadow: none; }
  [data-theme="dark"] select option { background: #1c1c1e; }
  [data-theme="dark"] .seg button.on { background: rgba(255, 255, 255, .2); }
  [data-theme="dark"] .cat-tab { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .1); box-shadow: none; }
  [data-theme="dark"] .cat-tab.on { background: #f2f2f7; color: #000; }
  [data-theme="dark"] .tile { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .08);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
  [data-theme="dark"] .tile.in-bill { border-color: var(--c, var(--accent)); box-shadow: inset 0 0 0 1.5px var(--c, var(--accent)); }
  [data-theme="dark"] .tile .t-qty { background: #f2f2f7; color: #000; }
  [data-theme="dark"] .tile .t-bg { opacity: .16; color: color-mix(in srgb, var(--c, #888) 60%, #fff); }
  [data-theme="dark"] .t-ico { background: color-mix(in srgb, var(--c, #888) 28%, rgba(0, 0, 0, .3)); box-shadow: none;
    color: color-mix(in srgb, var(--c, #888) 55%, #fff); }
  [data-theme="dark"] .list-ico { color: color-mix(in srgb, var(--c, #888) 55%, #fff); }
  [data-theme="dark"] .tile .t-stock.out { color: #ff6961; }
  [data-theme="dark"] .tile .t-stock.low, [data-theme="dark"] .badge.warn { color: #ffb340; }
  [data-theme="dark"] .warn { color: #ffb340; }
  [data-theme="dark"] .tbl-tile, [data-theme="dark"] .ta-card, [data-theme="dark"] .cust-item, [data-theme="dark"] .tpl-list button,
  [data-theme="dark"] .staff-pick button { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .1); box-shadow: none; }
  [data-theme="dark"] .tbl-tile.busy { background: linear-gradient(150deg, rgba(10, 132, 255, .9), rgba(94, 92, 230, .88)); }
  [data-theme="dark"] .tbl-tile.ta-new { background: transparent; }
  [data-theme="dark"] .staff-pick button.on, [data-theme="dark"] .cust-item.on, [data-theme="dark"] .tpl-list button.on { background: var(--accent); }
  [data-theme="dark"] .qbtn, [data-theme="dark"] .key, [data-theme="dark"] .qty.tap { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .1); box-shadow: none; }
  [data-theme="dark"] .display, [data-theme="dark"] .pin-dots { background: rgba(0, 0, 0, .28); box-shadow: none; }
  [data-theme="dark"] .modal { background: rgba(30, 30, 35, .86); border-color: rgba(255, 255, 255, .1); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
  [data-theme="dark"] .modal-back { background: rgba(0, 0, 0, .45); }
  [data-theme="dark"] .bill-totals { background: rgba(0, 0, 0, .15); }
  [data-theme="dark"] .bill-note { background: rgba(255, 204, 0, .14); }
  [data-theme="dark"] .tbl th { background: rgba(30, 30, 35, .75); }
  [data-theme="dark"] .tbl tr.click:hover td, [data-theme="dark"] .side a:hover { background: rgba(255, 255, 255, .05); }
  [data-theme="dark"] .logo-preview { background: rgba(255, 255, 255, .06); }
  [data-theme="dark"] .receipt-wrap { background: rgba(0, 0, 0, .28); }
  [data-theme="dark"] .badge.ok { color: #4cd964; }
  [data-theme="dark"] .badge.off { color: #ff6961; }
  [data-theme="dark"] .badge.info { color: #64a8ff; }
  [data-theme="dark"] .toast { background: rgba(60, 60, 67, .9); }
}

/* ---------- Printing ---------- */
@media print {
  body { background: #fff !important; }
  body.printing-receipt > *:not(#print-area) { display: none !important; }
  body.printing-receipt #print-area { display: block; }
  body.printing-receipt #print-area > div { box-shadow: none; }
  body:not(.printing-receipt) .topbar, body:not(.printing-receipt) .side, .no-print, #toasts { display: none !important; }
  body:not(.printing-receipt) .admin { padding: 0; }
  body:not(.printing-receipt) .admin-main { padding: 0; }
  .glass, .card, .stat { box-shadow: none !important; background: #fff !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; border-color: #ddd !important; break-inside: avoid; }
  .report-title { display: block; }
}
