:root {
  --ink: #17212b;
  --muted: #66727c;
  --paper: #f2f4f3;
  --card: #ffffff;
  --line: #dde3e1;
  --pine: #0e5a4c;
  --pine-dark: #0a443a;
  --pine-soft: #e2efec;
  --gold: #f5b301;
  --red: #c0392b;
  --red-soft: #fbe9e6;
  --nav: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'IBM Plex Sans Thai', 'Sarabun', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; text-align: inherit; }
input, select { font: inherit; color: inherit; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

#app { max-width: 960px; margin: 0 auto; }
#main { padding: calc(var(--safe-t) + 0px) 14px calc(var(--nav) + var(--safe-b) + 28px); }

/* ---------- ส่วนหัว ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--paper);
  padding: calc(var(--safe-t) + 12px) 0 8px;
}
.shop { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.shop h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.shop span { color: var(--muted); font-size: 14px; }
.search {
  width: 100%; height: 50px; padding: 0 16px;
  border: 1.5px solid var(--line); border-radius: 14px; background: var(--card);
}
.search:focus { border-color: var(--pine); outline: none; }
/* ช่องค้นหาบนแถบหัวสี: ตัวหนังสือสีเข้มเสมอ (1.25.1) */
.search, .top input, .top select { color: var(--ink); }
.search::placeholder { color: var(--muted); opacity: 1; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 6px 0 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 40px; padding: 0 16px; border-radius: 20px;
  background: var(--card); border: 1.5px solid var(--line); font-weight: 500;
}
.chip.on { background: var(--pine); border-color: var(--pine); color: #fff; }

/* ---------- ตารางสินค้า ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 800px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.tile {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 6px;
  min-height: 104px; padding: 12px 12px 12px 14px;
  background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--tint, var(--line));
  border-radius: 14px;
}
.tile:active { background: var(--pine-soft); }
.tile.out { opacity: .5; }
.pname { font-weight: 600; font-size: 16px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; padding-right: 22px; }
.pprice { font-size: 20px; font-weight: 700; color: var(--pine); }
.stock { font-size: 13px; color: var(--muted); }
.stock.low { color: var(--red); font-weight: 600; }
.stock.out { color: var(--red); font-weight: 600; }
.qty {
  position: absolute; top: -8px; right: -6px; min-width: 28px; height: 28px; padding: 0 7px;
  border-radius: 14px; background: var(--gold); color: var(--ink); font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center; border: 2px solid var(--paper);
}

.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 40px 16px; }

/* ---------- แถบตะกร้า ---------- */
#cartbar { position: fixed; left: 0; right: 0; bottom: calc(var(--nav) + var(--safe-b) + 10px); z-index: 8; padding: 0 12px; pointer-events: none; }
.cartbar {
  pointer-events: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; max-width: 936px; margin: 0 auto; min-height: 60px; padding: 8px 10px 8px 18px;
  background: var(--pine); color: #fff; border-radius: 18px;
  box-shadow: 0 6px 18px rgba(10, 68, 58, .35);
}
.cartbar:active { background: var(--pine-dark); }
.cb-info { display: flex; flex-direction: column; line-height: 1.2; }
.cb-info b { font-size: 16px; }
.cb-info span { font-size: 13px; opacity: .8; }
.cb-total { background: var(--gold); color: var(--ink); font-size: 22px; font-weight: 700; padding: 8px 16px; border-radius: 12px; }

/* ---------- เมนูล่าง ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--card); border-top: 1px solid var(--line);
}
.nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 13px; color: var(--muted); font-weight: 500; }
.nav button svg { width: 24px; height: 24px; }
.nav button.on { color: var(--pine); font-weight: 700; }

/* ---------- ปุ่ม ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 54px; padding: 0 20px; border-radius: 14px; font-size: 17px; font-weight: 600; text-align: center;
  text-decoration: none; border: 1.5px solid transparent;
}
.btn-primary { background: var(--pine); color: #fff; }
.btn-primary:active { background: var(--pine-dark); }
.btn-primary:disabled { background: #a8b8b4; cursor: not-allowed; }
.btn-ghost { background: var(--card); border-color: var(--line); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-block { width: 100%; }

/* ---------- แผ่นล่าง (sheet) ---------- */
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(23, 33, 43, .5); }
.sheet {
  position: fixed; z-index: 21; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px;
  max-height: 92vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--card); border-radius: 22px 22px 0 0;
  padding: 16px 16px calc(18px + var(--safe-b));
  animation: rise .18s ease-out;
}
@keyframes rise { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.sheet.still { animation: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-head h2 { font-size: 20px; font-weight: 700; }
.x { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 22px; background: var(--paper); }
.x svg { width: 20px; height: 20px; }
.actions { display: flex; gap: 10px; margin-top: 16px; }
.actions .btn { flex: 1; }
.actions .btn-primary { flex: 2; }

/* ตะกร้า */
.line { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center; }
.line .ln { font-weight: 600; }
.line .lu { color: var(--muted); font-size: 14px; }
.line .lt { font-weight: 700; text-align: right; min-width: 70px; }
.step { display: flex; align-items: center; gap: 4px; }
.step button { width: 44px; height: 44px; border-radius: 22px; background: var(--paper); font-size: 24px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.step button:active { background: var(--pine-soft); }
.step b { min-width: 30px; text-align: center; font-size: 18px; }
.line-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }

.disc { display: flex; gap: 8px; align-items: center; padding: 14px 0 6px; }
.disc > span { flex: 1; font-weight: 500; }
.seg { display: inline-flex; background: var(--paper); border-radius: 12px; padding: 3px; }
.seg button { min-width: 48px; height: 40px; padding: 0 12px; border-radius: 10px; font-weight: 600; text-align: center; }
.seg button.on { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.12); color: var(--pine); }
.disc input { width: 92px; height: 46px; padding: 0 12px; text-align: right; border: 1.5px solid var(--line); border-radius: 12px; }

.sum { padding: 8px 0 0; }
.sum div { display: flex; justify-content: space-between; padding: 3px 0; color: var(--muted); }
.sum .grand { color: var(--ink); font-size: 24px; font-weight: 700; padding-top: 8px; }

/* ชำระเงิน */
.bigtotal { text-align: center; padding: 6px 0 14px; }
.bigtotal small { display: block; color: var(--muted); font-size: 14px; }
.bigtotal b { font-size: 40px; font-weight: 700; color: var(--pine); letter-spacing: -0.02em; }
.methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 14px; }
.methods.m3 { grid-template-columns: repeat(3, 1fr); margin: 12px 0; }
.methods button { font-size: 15px; padding: 0 4px; }
.methods button { height: 54px; border-radius: 14px; border: 1.5px solid var(--line); font-weight: 600; text-align: center; }
.methods button.on { background: var(--pine); border-color: var(--pine); color: #fff; }
.recv { width: 100%; height: 60px; padding: 0 16px; font-size: 26px; font-weight: 700; text-align: right; border: 1.5px solid var(--line); border-radius: 14px; }
.recv:focus { border-color: var(--pine); outline: none; }
.quick { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.quick button { height: 44px; padding: 0 16px; border-radius: 12px; background: var(--paper); font-weight: 600; }
.quick button:active { background: var(--pine-soft); }
.changebox { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 16px; border-radius: 14px; background: var(--pine-soft); margin-top: 4px; }
.changebox b { font-size: 28px; color: var(--pine); }
.note { color: var(--muted); text-align: center; padding: 10px 0; }
.ppqr { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px 0 2px; }
.ppqr-code { width: min(240px, 70vw); background: #fff; border-radius: 12px; padding: 6px; border: 1px solid var(--line); }
.ppqr-code svg { display: block; width: 100%; height: auto; }
.ppqr-info { text-align: center; font-size: 14px; color: var(--muted); }
.ppqr-info b { color: var(--ink); font-size: 18px; }

/* ใบเสร็จ */
#receipt { padding: 4px 2px 8px; }
.rc-head { text-align: center; padding-bottom: 10px; border-bottom: 1px dashed var(--muted); }
.rc-head b { font-size: 20px; }
.rc-head div { color: var(--muted); font-size: 14px; }
.rc-line { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; }
.rc-items { padding: 8px 0; border-bottom: 1px dashed var(--muted); }
.rc-sum { padding: 8px 0; border-bottom: 1px dashed var(--muted); }
.rc-sum .rc-line.t { font-size: 20px; font-weight: 700; }
.rc-foot { text-align: center; color: var(--muted); padding-top: 10px; }
.badge-void { display: inline-block; background: var(--red-soft); color: var(--red); font-weight: 700; padding: 2px 10px; border-radius: 10px; margin-top: 6px; }

/* ---------- รายการ (สินค้า / บิล) ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  padding: 14px; min-height: 64px; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
}
button.row:active { background: var(--pine-soft); }
.row .l { display: flex; flex-direction: column; min-width: 0; }
.row .l b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.row .l small { color: var(--muted); font-size: 14px; }
.row .r { text-align: right; flex: none; display: flex; flex-direction: column; }
.row .r b { font-weight: 700; font-size: 17px; }
.row .r small { color: var(--muted); font-size: 13px; }
.row .r small.low { color: var(--red); font-weight: 600; }
.row.void { opacity: .6; }
.row.void .r b { text-decoration: line-through; }
.tag { color: var(--red); font-weight: 600; }

.fab {
  position: fixed; right: max(16px, calc(50% - 464px)); bottom: calc(var(--nav) + var(--safe-b) + 16px); z-index: 8;
  width: 60px; height: 60px; border-radius: 30px; background: var(--pine); color: #fff; font-size: 32px; font-weight: 400;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px rgba(10, 68, 58, .4);
}

.datebar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.datebar input { flex: 1; height: 50px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); }
.summary-line { background: var(--pine-soft); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; display: flex; justify-content: space-between; }
.summary-line b { color: var(--pine); }

/* ---------- ฟอร์ม ---------- */
.f { display: block; margin-bottom: 12px; }
.f > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.f input[type=text], .f input:not([type]), .f input[inputmode], .f input[list], .f input[type=password] { width: 100%; height: 50px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; }
.f input:focus { border-color: var(--pine); outline: none; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; font-weight: 500; }
.check input { width: 24px; height: 24px; accent-color: var(--pine); }

/* ---------- สรุปยอด ---------- */
.hero { padding: 18px; background: var(--pine); color: #fff; border-radius: 18px; margin-bottom: 12px; }
.hero small { opacity: .8; }
.hero b { display: block; font-size: 38px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.hero .sub { display: flex; gap: 22px; margin-top: 8px; font-size: 15px; }
.hero .sub b { display: inline; font-size: 15px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.card h2 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.card .rc-line { border-bottom: 1px solid var(--line); }
.card .rc-line:last-child { border-bottom: 0; }

/* ---------- ลูกค้า / แต้ม ---------- */
.custpick { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; margin-top: 12px; padding: 0 14px; border: 1.5px dashed var(--line); border-radius: 14px; color: var(--pine); font-weight: 600; }
.custpick svg { width: 22px; height: 22px; }
.custbox { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 10px 10px 14px; background: var(--pine-soft); border-radius: 14px; }
.custbox .cb-l { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.custbox .cb-l small { color: var(--muted); font-size: 14px; }
.custbox .chip { height: 36px; padding: 0 12px; }
.custbox .x { width: 36px; height: 36px; background: var(--card); }
.muted { color: var(--muted); font-size: 13px; font-weight: 400; }
.disc .chip { height: 40px; padding: 0 12px; font-size: 14px; }
.sum .earn { color: var(--pine); font-weight: 600; }
.list.pick { max-height: 46vh; overflow-y: auto; margin-top: 10px; }
.subh { font-size: 15px; font-weight: 700; margin: 18px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.hint { color: var(--muted); font-size: 13px; margin: -4px 0 6px; }

/* ---------- กะ ---------- */
.shiftchip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 17px; font-size: 14px; font-weight: 600; background: var(--red-soft); color: var(--red); flex: none; }
.shiftchip i { width: 8px; height: 8px; border-radius: 4px; background: currentColor; }
.shiftchip.on { background: var(--pine-soft); color: var(--pine); }
.rc-line.neg { color: var(--red); font-weight: 700; }
.rc-line.pos, span.pos { color: #b26a00; font-weight: 700; }
span.neg { color: var(--red); font-weight: 700; }
button.shrow { width: 100%; text-align: left; align-items: center; }
button.shrow:active { background: var(--pine-soft); }

/* ---------- ตัวเลือกสินค้า ---------- */
.has-opt { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.ogroup { margin-bottom: 14px; }
.og-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.og-head small { color: var(--muted); font-size: 13px; }
.og-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.ochoice { display: flex; justify-content: space-between; align-items: center; gap: 6px; min-height: 50px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 12px; font-weight: 600; }
.ochoice small { color: var(--muted); font-weight: 500; }
.ochoice.on { border-color: var(--pine); background: var(--pine-soft); color: var(--pine); }
.ochoice.on small { color: var(--pine); }
.line .lo { color: var(--pine); font-size: 14px; font-weight: 500; }
.ogedit { border: 1px solid var(--line); border-radius: 14px; padding: 12px 12px 10px; margin-bottom: 10px; background: var(--paper); }
.og-flags { display: flex; flex-direction: column; justify-content: flex-end; }
.og-flags .check { min-height: 32px; font-size: 14px; gap: 8px; }
.og-flags .check input { width: 20px; height: 20px; }
.f textarea { width: 100%; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font: inherit; resize: vertical; }
.f textarea:focus { border-color: var(--pine); outline: none; }
.chip.danger { color: var(--red); border-color: var(--red-soft); height: 36px; font-size: 14px; }

/* ---------- พักบิล / ส่วนลด / แยกจ่าย ---------- */
.chip.tk { background: var(--gold); border-color: var(--gold); color: var(--ink); font-weight: 700; }
.chips.presets { padding: 2px 0 4px; }
.chips.presets .chip { height: 36px; font-size: 14px; }
.trow { display: flex; gap: 8px; align-items: center; }
.trow .row { flex: 1; }
.split { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.sp-row { display: flex; align-items: center; gap: 8px; }
.sp-row > span { flex: 1; font-weight: 600; }
.sp-row .chip { height: 40px; padding: 0 12px; font-size: 14px; }
.sp-row input { width: 130px; height: 50px; padding: 0 12px; text-align: right; font-size: 20px; font-weight: 700; border: 1.5px solid var(--line); border-radius: 12px; }
.sp-row input:focus { border-color: var(--pine); outline: none; }
.seg.wide { display: flex; width: 100%; }
.seg.wide button { flex: 1; font-size: 14px; min-width: 0; padding: 0 6px; }
.actions.wrap { flex-wrap: wrap; }
.actions.wrap .btn { flex: 1 1 40%; }

/* ใบเสร็จ */
.rc-opt { display: block; font-size: 13px; color: var(--muted); }
.rc-opt.neg, .rc-line.neg { color: var(--red); }
.rc-head .pre { white-space: pre-line; }
.rc-head b.sm { font-size: 14px; }
.rc-line.sm { font-size: 13px; color: var(--muted); }

/* ---------- พนักงาน / PIN ---------- */
.shop h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-r { display: flex; gap: 6px; flex: none; align-items: center; }
.staffchip { display: inline-flex; align-items: center; gap: 4px; height: 34px; max-width: 120px; padding: 0 10px; border-radius: 17px; background: var(--card); border: 1.5px solid var(--line); font-size: 14px; font-weight: 600; }
.staffchip svg { width: 18px; height: 18px; flex: none; }
.staffchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lockscreen { position: fixed; inset: 0; z-index: 50; background: var(--pine); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: calc(var(--safe-t) + 16px) 16px calc(var(--safe-b) + 16px); }
.lk-shop { opacity: .8; font-weight: 600; }
.lockscreen h1 { font-size: 22px; text-align: center; }
.lk-msg { min-height: 24px; opacity: .9; text-align: center; }
.lk-dots { display: flex; gap: 16px; margin: 4px 0 8px; }
.lk-dots i { width: 16px; height: 16px; border-radius: 8px; border: 2px solid #fff; }
.lk-dots i.on { background: var(--gold); border-color: var(--gold); }
.lk-pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px; }
.lk-pad button { height: 76px; border-radius: 38px; background: rgba(255,255,255,.12); color: #fff; font-size: 28px; font-weight: 600; text-align: center; }
.lk-pad button:active { background: rgba(255,255,255,.28); }
.lk-pad button[data-k=clr], .lk-pad button[data-k=del] { font-size: 18px; background: none; }
.lk-mode { margin-top: 10px; color: #fff; text-decoration: underline; font-weight: 500; padding: 8px; }

/* ---------- รายงาน ---------- */
.rviews { margin-bottom: 12px; }
.rviews button { height: 38px; }
.hint.rng { margin: 0 0 10px; }
.datebar span { color: var(--muted); flex: none; }
.datebar input { min-width: 0; flex: 1 1 0; padding: 0 10px; }
html { overflow-x: hidden; }
body { overflow-x: clip; }
.bar-row { position: relative; border-bottom: 1px solid var(--line); }
.bar-row:last-child { border-bottom: 0; }
.bar-row .rc-line { border-bottom: 0 !important; position: relative; z-index: 1; }
.bar-row i { display: block; height: 4px; border-radius: 2px; background: var(--pine); opacity: .35; margin: -2px 0 6px; }

/* ---------- ติดตั้งแอป ---------- */
.installbar { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; margin: 2px 0 6px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.installbar img { border-radius: 9px; flex: none; }
.installbar span { flex: 1; display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.installbar small { color: var(--muted); font-size: 13px; }
.installbar .chip { height: 36px; padding: 0 14px; }
.installbar .x { width: 36px; height: 36px; }
.steps { padding-left: 22px; margin: 4px 0 12px; line-height: 1.6; }
.steps li { margin-bottom: 8px; }
.kbd { display: inline-block; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; }

/* ---------- iPad แนวนอน / จอใหญ่ ---------- */
@media (min-width: 1100px) {
  #app { max-width: 1200px; }
  .grid { grid-template-columns: repeat(5, 1fr); }
  .cartbar { max-width: 1176px; }
  .fab { right: max(16px, calc(50% - 584px)); }
}

/* ---------- อื่น ๆ ---------- */
.toast {
  position: fixed; top: calc(var(--safe-t) + 14px); left: 50%; transform: translate(-50%, -120%); z-index: 40;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; max-width: calc(100% - 32px);
  transition: transform .2s ease; font-weight: 500; text-align: center;
}
.toast.show { transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

.gate { max-width: 360px; margin: 0 auto; padding: 20vh 24px 24px; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.gate h1 { font-size: 26px; }
.gate p { color: var(--muted); }
.loading { text-align: center; color: var(--muted); padding: 48px 0; }

@media print {
  /* พิมพ์เฉพาะใบเสร็จ: ซ่อนส่วนอื่นแบบไม่กินพื้นที่ (visibility อย่างเดียวทำให้มีหน้าว่างต่อท้ายตามความยาวหน้าจอ) */
  html, body { height: auto !important; min-height: 0 !important; overflow: visible !important; background: #fff !important; }
  body { padding: 0 !important; margin: 0 !important; }
  body:not(.print-labels):not(.print-kitchen):not(.print-invoice) #app > *:not(#sheet) { display: none !important; }
  body:not(.print-labels):not(.print-kitchen):not(.print-invoice) #sheet .scrim,
  body:not(.print-labels):not(.print-kitchen):not(.print-invoice) #sheet .sheet > *:not(#receipt) { display: none !important; }
  body:not(.print-labels):not(.print-kitchen):not(.print-invoice) #sheet .sheet { position: static; max-height: none; overflow: visible; animation: none; padding: 0; margin: 0; border-radius: 0; max-width: none; box-shadow: none; }
  #receipt { position: static; width: 100%; color: #000; break-inside: auto; }
  #receipt, #receipt * { visibility: visible; }
  .scrim { display: none; }
  @page { margin: 4mm; }
}

/* ---------- สต็อก ใบสั่งซื้อ ซัพพลายเออร์ (1.5.0) ---------- */
.pviews { margin: 0 0 12px; }
.pviews button { height: 38px; position: relative; white-space: nowrap; font-size: 13px; padding: 0 2px; }
.pviews .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); vertical-align: middle; margin-left: 2px; }
.qadj { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 12px; }
.qadj button { padding: 0 4px; font-size: 14px; background: var(--card); border: 1px solid var(--line); }
.hero span { display: block; margin-top: 4px; font-size: 14px; opacity: .85; }
.up { color: var(--pine); font-weight: 700; }
.down { color: var(--red); font-weight: 700; }
.btnline { width: 100%; text-align: left; align-items: center; background: none; }
.btnline span { min-width: 0; }
.rc-line.big { font-size: 18px; color: var(--pine); }
.rc-line.big b { font-size: 20px; }
.card.flat { background: var(--paper); border: 0; }
.card.flat .rc-line { border-color: rgba(0,0,0,.06); }
.adjlines { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.adjline { display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.adjline .al-h { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.adjline .al-h b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adjline .al-h small { color: var(--muted); font-size: 13px; }
.adjline input { width: 76px; height: 44px; padding: 0 8px; border: 1.5px solid var(--line); border-radius: 10px; text-align: right; background: #fff; flex: none; }
.adjline input:focus { border-color: var(--pine); outline: none; }
.adjline .x { width: 36px; height: 36px; flex: none; }
.picker, .f select { width: 100%; height: 50px; padding: 0 12px; border: 1.5px dashed var(--line); border-radius: 12px; background: #fff; margin-bottom: 10px; color: var(--pine); font-weight: 600; }
.f select { border-style: solid; color: inherit; font-weight: 400; margin: 0; }
.f input[type=date], .f input[type=email], .f input[type=tel] { width: 100%; height: 50px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; }
.mvlist { display: flex; flex-direction: column; }
.mv { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.mv .l { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.mv .l small { color: var(--muted); font-size: 13px; }
.mv .r { display: flex; flex-direction: column; align-items: flex-end; flex: none; line-height: 1.35; }
.mv .r small { color: var(--muted); font-size: 13px; }
.po-pending { color: #b26a00; font-weight: 600; }
.po-partial { color: #b26a00; font-weight: 600; }
.po-received { color: var(--pine); font-weight: 600; }
.po-closed { color: var(--muted); }
a.custpick { text-decoration: none; }
.alhead { display: flex; gap: 8px; padding: 0 10px; margin-bottom: -4px; font-size: 12px; color: var(--muted); }
.alhead span:first-child { flex: 1; }
.alhead span { width: 76px; text-align: right; flex: none; }
.alhead span:first-child { width: auto; }
.alhead i { width: 36px; flex: none; }

/* ---------- สินค้าชุด และฉลากบาร์โค้ด (1.6.0) ---------- */
.compbox { border: 1px solid var(--line); border-radius: 14px; padding: 4px 12px 12px; margin: 0 0 12px; background: var(--paper); }
.compbox .summary-line { margin: 0; background: var(--card); }
.lbopts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 10px 0 0; }
.lbprev { display: flex; justify-content: center; padding: 14px; background: var(--paper); border-radius: 14px; margin: 10px 0; }
.lbprev .lbl { outline: 1px dashed #b9b9b9; }
.lbprev.lb-a4 .lbl { width: 63.5mm; height: 33.9mm; }
.lbwarn { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 12px; background: #fff4e0; color: #8a5300; margin-bottom: 10px; font-size: 14px; }
.lblist { display: flex; flex-direction: column; }
.lbrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.lbrow .l { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.lbrow .l b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbrow .l small { color: var(--muted); font-size: 13px; }
.lbl { box-sizing: border-box; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: #000; background: #fff; font-family: "IBM Plex Sans Thai", "Noto Sans Thai", sans-serif; line-height: 1.15; }
.lb-40x30 .lbl { width: 40mm; height: 30mm; padding: 1.5mm 2mm; }
.lb-50x30 .lbl { width: 50mm; height: 30mm; padding: 1.5mm 2.5mm; }
.lb-a4 .lbl { width: 63.5mm; height: 33.9mm; padding: 2mm 3mm; }
.l-shop { font-size: 7pt; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l-name { font-size: 8.5pt; font-weight: 700; max-width: 100%; max-height: 2.3em; overflow: hidden; }
.l-bc { width: 100%; flex: 1 1 auto; min-height: 8mm; display: flex; flex-direction: column; margin: 0.6mm 0; }
.l-bc .bc { width: 100%; flex: 1 1 auto; min-height: 0; display: block; }
.bc-txt { font-family: ui-monospace, Menlo, monospace; font-size: 7pt; letter-spacing: .08em; }
.bc-bad { font-size: 7pt; color: #b00; }
.l-price { font-size: 11pt; font-weight: 700; }
#labelprint { display: none; }
@media print {
  body.print-labels > *:not(#labelprint) { display: none !important; }
  body.print-labels #labelprint, body.print-labels #labelprint * { visibility: visible; }
  body.print-labels #labelprint { display: block; }
  body.print-labels { background: #fff; }
  body.print-labels .lb-40x30 .lbl, body.print-labels .lb-50x30 .lbl { break-after: page; page-break-after: always; }
  body.print-labels #labelprint.lb-a4 { display: grid; grid-template-columns: repeat(3, 63.5mm); column-gap: 2.5mm; }
  body.print-labels .lb-a4 .lbl { break-inside: avoid; }
}

/* ---------- โลโก้ร้าน (1.6.1) ---------- */
.logobox { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; background: var(--card); }
.logoprev { width: 96px; height: 72px; flex: none; display: flex; align-items: center; justify-content: center; background: #fff; border: 1px dashed var(--line); border-radius: 10px; overflow: hidden; }
.logoprev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logoprev span { font-size: 12px; color: var(--muted); text-align: center; padding: 4px; }
.logoact { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.filebtn { cursor: pointer; display: inline-flex; align-items: center; height: 44px; padding: 0 16px; }
.rc-logo { display: block; margin: 0 auto 8px; object-fit: contain; max-height: 120px; }
.rc-logo-S { max-width: 30%; max-height: 70px; }
.rc-logo-M { max-width: 50%; }
.rc-logo-L { max-width: 75%; max-height: 160px; }
@media print { .rc-logo { filter: grayscale(1) contrast(1.2); } }

/* ---------- รูปสินค้า ---------- */
/* รูปสินค้า (1.25.1): สี่เหลี่ยมมุมมนชิดขวาของปุ่ม ชื่อและราคาอยู่ซ้าย */
.tile.has-img { --im: min(96px, 40%); min-height: calc(min(96px, 40vw) + 16px); padding-right: calc(var(--im) + 18px); }
.tile.has-img .pname { padding-right: 0; }
.tile .pimg { position: absolute; top: 8px; right: 8px; width: var(--im); aspect-ratio: 1 / 1; border-radius: 12px; background: #f3f1ec; overflow: hidden; }
.tile .pimg img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile.has-img .qty { z-index: 1; }
.pimgbox { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; background: var(--card); }
.pimgprev { width: 96px; height: 96px; flex: none; display: flex; align-items: center; justify-content: center; background: #f3f1ec; border: 1px dashed var(--line); border-radius: 12px; overflow: hidden; }
.pimgprev img { width: 100%; height: 100%; object-fit: cover; }
.pimgprev span { font-size: 12px; color: var(--muted); }
.pimgbox .hint { margin: 0; }
.row .thumb { width: 44px; height: 44px; flex: none; border-radius: 10px; overflow: hidden; background: #f3f1ec; display: flex; align-items: center; justify-content: center; }
.row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.row .thumb.none { background: color-mix(in srgb, var(--tint) 22%, var(--card)); color: var(--ink, #222); font-weight: 700; font-size: 18px; }
.row .thumb + .l { flex: 1; }

/* ---------- ออฟไลน์ ---------- */
#net:empty { display: none; }
#net { position: sticky; top: 0; z-index: 30; padding: 8px 16px 0; padding-top: max(8px, env(safe-area-inset-top)); background: var(--paper); }
.netbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.4; }
.netbar.off { background: #3b4450; color: #fff; }
.netbar.sync { background: var(--pine-soft); color: var(--pine); }
.netbar.err { background: #fde8e6; color: var(--red); }
.netbar.upd { background: #fff4d6; color: #6b4a00; margin-bottom: 8px; }
.netbar.upd button { background: var(--card); border: 1px solid var(--line); }
.netbar button { flex: none; font: inherit; font-weight: 600; border: 0; border-radius: 10px; padding: 8px 12px; background: rgba(255,255,255,.9); color: var(--ink); cursor: pointer; }
.netbar.sync button, .netbar.err button { background: var(--card); border: 1px solid var(--line); }
.tag.warn { display: inline-block; background: #b45309; color: #fff; font-size: 12px; padding: 1px 7px; border-radius: 6px; font-weight: 600; }
.tag.off { display: inline-block; background: #3b4450; color: #fff; font-size: 12px; padding: 1px 7px; border-radius: 6px; font-weight: 600; }
.offnote { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: #fff6dc; color: #6b5300; font-size: 14px; line-height: 1.5; }
.qrow { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.qerr { display: block; color: var(--red); font-weight: 600; }

/* ---------- ระบบโต๊ะ ---------- */
.sellseg { margin: 0 0 12px; }
.sellseg small { font-weight: 500; opacity: .75; margin-left: 4px; }
.tblbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin: 0 0 12px; border-radius: 12px; background: var(--pine-soft); color: var(--pine); }
.tblbar span { flex: 1; min-width: 0; }
.tblbar .chip { flex: none; }
.tblbar .chip.on { background: var(--pine); color: #fff; border-color: var(--pine); }
.tblbar .chip:disabled { opacity: .45; }
.zone { margin: 14px 0 8px; font-size: 15px; color: var(--muted); font-weight: 600; }
.tgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ttile { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 4px; min-height: 92px; padding: 12px; border-radius: 14px; background: var(--card); border: 2px dashed var(--line); text-align: left; cursor: pointer; font: inherit; color: var(--ink); }
.ttile b { font-size: 22px; font-weight: 700; line-height: 1.1; word-break: break-word; }
.ttile b i { font-style: normal; font-size: 14px; font-weight: 600; margin-left: 4px; opacity: .85; }
.ttile small { font-size: 13px; color: var(--muted); }
.ttile.on { border: 2px solid var(--pine); background: var(--pine); color: #fff; }
.ttile.on small { color: rgba(255,255,255,.85); }
.ttile.on.sub { background: var(--pine-soft); color: var(--pine); }
.ttile.on.sub small { color: var(--pine); }
.ttile .tt-sum { font-size: 17px; font-weight: 700; }
.ttile.own { outline: 3px solid var(--gold); }
.ttile:disabled { opacity: .45; cursor: default; }
.tgrid.sm .ttile { min-height: 64px; }
.tgrid.sm .ttile b { font-size: 18px; }
@media (min-width: 560px) { .tgrid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 800px) { .tgrid { grid-template-columns: repeat(5, 1fr); } .ttile { min-height: 108px; } }
@media (min-width: 1100px) { .tgrid { grid-template-columns: repeat(7, 1fr); } }
.tbill { padding: 12px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; background: var(--card); }
.tb-h { display: flex; justify-content: space-between; gap: 8px; font-size: 18px; }
.tb-items { margin: 10px 0; display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.tb-items div { display: flex; justify-content: space-between; gap: 8px; }
.tb-items small { color: var(--muted); }
.tb-act { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.tbill .chips { margin: 0; }
.sellseg { background: #e3e8e6; }

/* ---------- ครัว / รูปแบบการขาย ---------- */
.nav.six { grid-template-columns: repeat(6, 1fr); }
.nav.six button span { font-size: 11px; white-space: nowrap; }
.dinseg { margin: 0 0 12px; background: #e3e8e6; }
.lnote { display: inline-block; margin: 4px 0 2px; padding: 3px 8px; border-radius: 8px; border: 1px dashed var(--line); background: none; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.lnote.has { border-style: solid; border-color: #e7b300; background: #fff6dc; color: #6b5300; font-weight: 600; }
.kseg { margin: 0 0 10px; background: #e3e8e6; }
.kauto { margin: 0 0 12px; font-size: 14px; }
.kgrid { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: start; }
@media (min-width: 640px) { .kgrid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .kgrid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1400px) { .kgrid { grid-template-columns: repeat(4, 1fr); } }
.kcard { background: var(--card); border: 1px solid var(--line); border-top: 6px solid var(--pine); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.kcard.warn { border-top-color: #e7b300; }
.kcard.late { border-top-color: var(--red); }
.kc-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.kc-h b { font-size: 20px; }
.kc-h span { font-size: 13px; color: var(--muted); white-space: nowrap; }
.kcard.late .kc-h span { color: var(--red); font-weight: 600; }
.kc-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.kc-tags span { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--paper); color: var(--muted); }
.kc-tags .kdin { background: #3b4450; color: #fff; font-weight: 600; }
.kc-items { display: flex; flex-direction: column; gap: 6px; }
.ki { display: flex; gap: 8px; font-size: 17px; line-height: 1.35; }
.ki b { flex: none; min-width: 34px; }
.ki span { display: flex; flex-direction: column; }
.ki small { font-size: 14px; color: var(--muted); }
.ki em { font-style: normal; font-weight: 700; color: #a15c00; font-size: 15px; }
.ki.cancel { color: var(--red); }
.ki.cancel span { text-decoration: line-through; }
.kc-act { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }
#kprint { display: none; }
@media print {
  body.print-kitchen > *:not(#kprint) { display: none !important; }
  body.print-kitchen #kprint, body.print-kitchen #kprint * { visibility: visible; }
  body.print-kitchen #kprint { display: block; width: 72mm; color: #000; font-size: 14px; }
  body.print-kitchen { background: #fff; }
  body.print-kitchen .kslip { break-after: page; page-break-after: always; padding: 2mm 0; }
  body.print-kitchen .ks-h { font-size: 26px; font-weight: 700; }
  body.print-kitchen .ks-d { font-size: 18px; font-weight: 700; border: 2px solid #000; display: inline-block; padding: 0 6px; margin: 2px 0; }
  body.print-kitchen .ks-m { font-size: 12px; margin-bottom: 6px; border-bottom: 1px dashed #000; padding-bottom: 4px; }
  body.print-kitchen .ki { font-size: 18px; color: #000; margin: 3px 0; }
  body.print-kitchen .ki small, body.print-kitchen .ki em { color: #000; }
}

/* ---------- ใบกำกับภาษีเต็มรูป (1.11.0) ---------- */
.ctax { margin: 4px 0 12px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.ctax summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.ctax[open] summary { margin-bottom: 8px; }
.ivwrap { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; margin: 4px 0 12px; }
.ivscale { width: 794px; transform-origin: 0 0; zoom: var(--ivz, .5); }
.ivpage { position: relative; box-sizing: border-box; width: 794px; min-height: 1060px; padding: 48px 52px; background: #fff; color: #000; font-size: 14px; line-height: 1.5; }
.ivpage .pre { white-space: pre-line; }
.iv-top { display: flex; justify-content: space-between; gap: 24px; border-bottom: 2px solid #000; padding-bottom: 14px; }
.iv-shop { display: flex; gap: 12px; align-items: flex-start; max-width: 60%; }
.iv-shop img { width: 72px; height: 72px; object-fit: contain; }
.iv-shop b { font-size: 18px; }
.iv-title { text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.iv-title b { font-size: 20px; }
.iv-title span { font-size: 12px; letter-spacing: .08em; }
.iv-title em { font-style: normal; margin-top: 6px; border: 1.5px solid #000; padding: 1px 14px; border-radius: 4px; font-weight: 700; }
.iv-meta { display: flex; gap: 20px; margin: 16px 0; }
.iv-buyer { flex: 1; border: 1px solid #000; border-radius: 6px; padding: 10px 12px; }
.iv-buyer .k { font-size: 12px; color: #444; }
.iv-no { width: 240px; border: 1px solid #000; border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.iv-no div { display: flex; justify-content: space-between; gap: 8px; }
.iv-no span { color: #444; }
.iv-items { width: 100%; border-collapse: collapse; }
.iv-items th { border-top: 1px solid #000; border-bottom: 1px solid #000; padding: 6px 8px; font-weight: 600; text-align: left; background: #f3f3f3; }
.iv-items td { padding: 5px 8px; border-bottom: 1px solid #ddd; vertical-align: top; }
.iv-items .c, .iv-sum .c { text-align: center; }
.iv-items .r, .iv-sum .r, .iv-items th.r { text-align: right; white-space: nowrap; }
.iv-opt { font-size: 12px; color: #444; }
.iv-bottom { display: flex; justify-content: space-between; gap: 20px; margin-top: 12px; align-items: flex-start; }
.iv-words { flex: 1; border: 1px solid #000; border-radius: 6px; padding: 8px 12px; font-weight: 600; background: #f7f7f7; }
.iv-sum { width: 330px; border-collapse: collapse; }
.iv-sum td { padding: 3px 8px; }
.iv-sum tr.t td { border-top: 2px solid #000; border-bottom: 3px double #000; font-weight: 700; font-size: 16px; }
.iv-sign { display: flex; justify-content: space-around; margin-top: 80px; text-align: center; }
.iv-sign div { display: flex; flex-direction: column; gap: 6px; width: 220px; }
.iv-sign span { border-bottom: 1px dotted #000; height: 28px; }
.iv-void { position: absolute; top: 380px; left: 0; right: 0; text-align: center; font-size: 120px; font-weight: 700; color: rgba(200, 0, 0, .18); transform: rotate(-20deg); pointer-events: none; }
.iv-vr { color: #b00; margin-top: 10px; }
#invprint { display: none; }
@media print {
  body.print-invoice > *:not(#invprint) { display: none !important; }
  body.print-invoice #invprint, body.print-invoice #invprint * { visibility: visible; }
  body.print-invoice #invprint { display: block; position: static; }
  body.print-invoice { background: #fff; }
  body.print-invoice .ivpage { width: 100%; min-height: 0; padding: 0; break-after: page; page-break-after: always; }
  body.print-invoice .ivpage:last-child { break-after: auto; page-break-after: auto; }
}

/* ---------- ใบแจ้งยอดก่อนชำระ ---------- */
.prebtn { margin: 12px 0 0; }
#receipt .pb-tbl { font-size: 22px; font-weight: 700; margin: 2px 0; }
.pb-qr { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 10px 0 4px; }
.pb-qr svg { width: 160px; height: 160px; }
.pb-qr small { font-size: 12px; }

/* ---------- นำเข้าสินค้า (1.12.0) ---------- */
.impbox { display: flex; justify-content: center; padding: 18px 0 6px; }
.impbox .filebtn { min-width: 240px; }
.imphelp { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.imphelp li { margin-bottom: 6px; }
.imphelp code { font-size: 12.5px; background: var(--paper); padding: 1px 4px; border-radius: 4px; word-break: break-word; color: var(--ink); }
.impsum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 14px; }
.impsum div { background: var(--paper); border-radius: 12px; padding: 10px 4px; text-align: center; }
.impsum b { display: block; font-size: 22px; }
.impsum span { font-size: 12px; color: var(--muted); }
.impsum .neg b { color: var(--red); }
.imperr { background: var(--red-soft); color: var(--red); border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; max-height: 180px; overflow-y: auto; }
.imperr b { display: block; margin-bottom: 4px; }
.implist { max-height: 42vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
.improw { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.improw:last-child { border-bottom: 0; }
.improw .l { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.improw .l b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.improw .l small { color: var(--muted); font-size: 12px; }
.itag { flex: none; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.itag.new { background: var(--pine); color: #fff; }
.itag.upd { background: var(--paper); color: var(--ink); border: 1px solid var(--line); }
.itag.skp { background: var(--paper); color: var(--muted); }

/* ---------- ราคาหน้างาน (1.13.0) ---------- */
.pprice .oprice { font-size: 15px; font-weight: 600; }
.opf input { font-size: 22px; font-weight: 700; }

/* ---------- ตัวแปร และชุดตัวเลือก (1.14.0) ---------- */
.pprice .vprice { font-size: 17px; }
.vpick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 8px; }
.vchoice { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 72px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); text-align: left; }
.vchoice b { font-size: 17px; display: flex; align-items: center; gap: 6px; }
.vchoice span { color: var(--pine); font-weight: 700; }
.vchoice small { color: var(--muted); font-size: 13px; }
.vchoice small.low { color: #b26a00; }
.vchoice small.out { color: var(--red); }
.vchoice.out { opacity: .5; }
.vchoice:active { border-color: var(--pine); background: var(--pine-soft); }
.vq { display: inline-flex; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--pine); color: #fff; font-size: 13px; align-items: center; justify-content: center; }
.vedit { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.vrow { border: 1px solid var(--line); border-radius: 14px; padding: 10px; background: var(--paper); }
.vrow-h { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.vrow-h input { flex: 1; min-width: 0; height: 44px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font: inherit; font-weight: 600; }
.vrow-h .x { width: 40px; height: 40px; flex: none; background: var(--card); }
.vrow-f { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 8px; }
.vrow-f label { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.vrow-f span { font-size: 12px; color: var(--muted); }
.vrow-f input { width: 100%; min-width: 0; height: 42px; padding: 0 10px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; font: inherit; }
.vrow-h input:focus, .vrow-f input:focus { border-color: var(--pine); outline: none; }
.vgen { margin-top: 10px; border: 1px dashed var(--line); border-radius: 14px; padding: 10px 14px; }
.vgen summary { cursor: pointer; color: var(--pine); font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.vgen textarea { width: 100%; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font: inherit; margin: 6px 0 8px; }
.mstog { border: 1px solid var(--line); border-radius: 14px; background: var(--card); overflow: hidden; }
.tog { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; padding: 8px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.tog:first-child { border-top: 0; }
.tog span { display: flex; flex-direction: column; min-width: 0; }
.tog small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
input.sw { appearance: none; -webkit-appearance: none; flex: none; width: 48px; height: 28px; border-radius: 14px; background: #c9d1ce; position: relative; transition: background .15s; cursor: pointer; margin: 0; }
input.sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
input.sw:checked { background: var(--pine); }
input.sw:checked::after { transform: translateX(20px); }
input.sw:focus-visible { outline: 2px solid var(--pine); outline-offset: 2px; }
.pprice .punit { font-size: 14px; font-weight: 600; color: var(--muted); }
.f .seg.wide { display: flex; height: 50px; }
.f .seg.wide button { flex: 1; }

/* 1.15.0: เมนูรายงาน ส่วนลด กลุ่มสิทธิ์ */
.chips.rviews { flex-wrap: wrap; overflow: visible; }
.chips.rviews .chip { height: 36px; font-size: 14px; }
.chip:disabled, button.row:disabled { opacity: .45; cursor: not-allowed; }
button.row.on { border-color: var(--pine); box-shadow: inset 0 0 0 1px var(--pine); }
.check.muted { color: var(--muted); }
.subh .chip { height: 30px; font-size: 13px; padding: 0 10px; }
.f .chips { flex-wrap: wrap; overflow: visible; padding: 4px 0 0; }

/* ---------- หลายสาขา (1.16.0) ---------- */
.brtitle { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--pine); padding: 4px 0; }
.brtitle svg { width: 22px; height: 22px; flex: none; }
.brtitle i { font-style: normal; font-size: 13px; flex: none; }
.chips.brscope .chip { font-weight: 600; }
.row.on { border-color: var(--pine); background: var(--pine-soft); }
.xf-transit { color: #b26a00; font-weight: 700; }
.xf-received { color: var(--pine); }
.xf-cancelled { color: var(--muted); }
.tblwrap { overflow-x: auto; margin: 6px 0 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.smx { border-collapse: collapse; width: 100%; font-size: 14px; }
.smx th, .smx td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.smx th:first-child, .smx td:first-child { text-align: left; position: sticky; left: 0; background: var(--card); white-space: normal; min-width: 120px; }
.smx th { font-size: 13px; color: var(--muted); font-weight: 600; }
.smx tr.muted td { color: var(--muted); }
.smx td.down { color: var(--red); font-weight: 700; }
.chips.pcats .chip.off { color: var(--muted); border-style: dashed; }
.chips.pcats .chip.on.off { color: #fff; }
.chips.pcats .chip small { font-size: 11px; }
.catbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; margin: 4px 0 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.catbar span small { display: block; color: var(--pine); font-size: 13px; }
.catbar.off span small { color: var(--red); }
.catbar .btn { flex: none; width: auto; padding: 0 14px; height: 40px; font-size: 14px; }
/* แถบปุ่มเลื่อนแนวนอน: บนคอม (เมาส์) แสดงแถบเลื่อน และเลื่อนด้วยลูกกลิ้งเมาส์ได้ */
@media (pointer: fine) {
  .chips { scrollbar-width: thin; scrollbar-color: #b9c3c0 transparent; padding-bottom: 8px; }
  .chips::-webkit-scrollbar { display: block; height: 8px; }
  .chips::-webkit-scrollbar-thumb { background: #b9c3c0; border-radius: 4px; }
  .chips::-webkit-scrollbar-thumb:hover { background: #8f9c98; }
  .chips::-webkit-scrollbar-track { background: transparent; }
}

/* ---------- ธีมหน้าจอ (1.16.0) ตั้งที่ ตั้งค่าร้าน > ธีมหน้าจอ ----------
 * pine = เขียว (เดิม, ไม่เปลี่ยนหน้าตา) ธีมอื่นเป็นแบบสีสด: หัวจอแถบสีทึบ ช่องค้นหาโค้งมน การ์ดมีเงา
 * --hdink = สีตัวอักษรบนแถบสี (ธีมเหลืองใช้ตัวอักษรเข้ม) ocean (รุ่นแรก) = g_blue */
html[data-theme="red"] { --pine: #e63a1e; --pine-dark: #e02a16; --pine-soft: #fdebe6; --paper: #f7f4f2; --line: #ece4e0; --gold: #ffc72c; --hd1: #ff5a2a; --hd2: #e02a16; --hdink: #fff; --hdshadow: rgba(224, 42, 22, .28); }
html[data-theme="g_green"] { --pine: #1e8e3e; --pine-dark: #1e8e3e; --pine-soft: #e6f4ea; --paper: #f3f7f4; --line: #dfe8e2; --gold: #ffc72c; --hd1: #34a853; --hd2: #1e8e3e; --hdink: #fff; --hdshadow: rgba(30, 142, 62, .28); }
html[data-theme="g_yellow"] { --pine: #a16207; --pine-dark: #fbbc04; --pine-soft: #fef7e0; --paper: #f8f6f0; --line: #ece6d6; --gold: #ffc72c; --hd1: #fdd663; --hd2: #fbbc04; --hdink: #202124; --hdshadow: rgba(251, 188, 4, .28); }
html[data-theme="g_red"] { --pine: #d93025; --pine-dark: #c5221f; --pine-soft: #fce8e6; --paper: #f8f4f4; --line: #ece2e1; --gold: #ffc72c; --hd1: #ea4335; --hd2: #c5221f; --hdink: #fff; --hdshadow: rgba(197, 34, 31, .28); }
html[data-theme="g_blue"], html[data-theme="ocean"] { --pine: #1a73e8; --pine-dark: #1a73e8; --pine-soft: #e8f0fe; --paper: #f3f6fb; --line: #dfe5ef; --gold: #ffc72c; --hd1: #4285f4; --hd2: #1a73e8; --hdink: #fff; --hdshadow: rgba(26, 115, 232, .28); }
html[data-theme="emerald"] { --pine: #059669; --pine-dark: #059669; --pine-soft: #d1fae5; --paper: #f2f7f5; --line: #dce8e3; --gold: #ffc72c; --hd1: #10b981; --hd2: #059669; --hdink: #fff; --hdshadow: rgba(5, 150, 105, .28); }
html[data-theme="indigo"] { --pine: #4f46e5; --pine-dark: #4f46e5; --pine-soft: #e0e7ff; --paper: #f4f4fb; --line: #e2e2f0; --gold: #ffc72c; --hd1: #6366f1; --hd2: #4f46e5; --hdink: #fff; --hdshadow: rgba(79, 70, 229, .28); }
html[data-theme="rose"] { --pine: #e11d48; --pine-dark: #e11d48; --pine-soft: #ffe4e6; --paper: #f9f4f5; --line: #efe1e4; --gold: #ffc72c; --hd1: #f43f5e; --hd2: #e11d48; --hdink: #fff; --hdshadow: rgba(225, 29, 72, .28); }
html[data-theme="orange"] { --pine: #ea580c; --pine-dark: #ea580c; --pine-soft: #ffedd5; --paper: #f9f5f1; --line: #eee4da; --gold: #ffc72c; --hd1: #f97316; --hd2: #ea580c; --hdink: #fff; --hdshadow: rgba(234, 88, 12, .28); }
html[data-theme="teal"] { --pine: #0891b2; --pine-dark: #0891b2; --pine-soft: #cffafe; --paper: #f1f7f8; --line: #dbe8eb; --gold: #ffc72c; --hd1: #06b6d4; --hd2: #0891b2; --hdink: #fff; --hdshadow: rgba(8, 145, 178, .28); }
html[data-theme="slate"] { --pine: #1e293b; --pine-dark: #1e293b; --pine-soft: #e2e8f0; --paper: #f3f4f6; --line: #e1e4ea; --gold: #ffc72c; --hd1: #334155; --hd2: #1e293b; --hdink: #fff; --hdshadow: rgba(30, 41, 59, .28); }
html[data-theme="crimson"] { --pine: #dc2626; --pine-dark: #dc2626; --pine-soft: #fee2e2; --paper: #f9f4f4; --line: #efe1e1; --gold: #ffc72c; --hd1: #ef4444; --hd2: #dc2626; --hdink: #fff; --hdshadow: rgba(220, 38, 38, .28); }

html[data-theme]:not([data-theme="pine"]) body { font-weight: 450; }
html[data-theme]:not([data-theme="pine"]) .top { margin: 0 -14px 10px; padding: calc(var(--safe-t) + 14px) 14px 14px; background: linear-gradient(135deg, var(--hd1), var(--hd2)); color: var(--hdink); border-radius: 0 0 24px 24px; box-shadow: 0 6px 18px var(--hdshadow); }
html[data-theme]:not([data-theme="pine"]) .top .shop { margin-bottom: 12px; }
html[data-theme]:not([data-theme="pine"]) .top .shop h1 { font-weight: 800; letter-spacing: -0.02em; }
html[data-theme]:not([data-theme="pine"]) .top .shop span, html[data-theme]:not([data-theme="pine"]) .top .hint { color: var(--hdink); opacity: .85; }
html[data-theme]:not([data-theme="pine"]) .top .brtitle { color: var(--hdink); }
html[data-theme]:not([data-theme="pine"]) .top .search { border: 0; border-radius: 25px; height: 48px; box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
html[data-theme]:not([data-theme="pine"]) .top .search:focus { box-shadow: 0 0 0 3px rgba(255, 255, 255, .55); }
html[data-theme]:not([data-theme="pine"]) .top .staffchip, html[data-theme]:not([data-theme="pine"]) .top .chip { background: rgba(255, 255, 255, .22); border-color: transparent; color: var(--hdink); }
html[data-theme]:not([data-theme="pine"]) .top .chip.on { background: #fff; color: var(--pine); }
html[data-theme]:not([data-theme="pine"]) .top .shiftchip { background: #fff; color: var(--red); }
html[data-theme]:not([data-theme="pine"]) .top .shiftchip.on { background: #fff; color: #138a4b; }
html[data-theme]:not([data-theme="pine"]) .top .datebar input { border-color: transparent; }
html[data-theme]:not([data-theme="pine"]) .chip { border-color: transparent; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); font-weight: 600; }
html[data-theme]:not([data-theme="pine"]) .chip.on { background: linear-gradient(135deg, var(--hd1), var(--hd2)); color: var(--hdink); box-shadow: 0 3px 10px var(--hdshadow); }
html[data-theme]:not([data-theme="pine"]) .tile { border: 0; border-left: 6px solid var(--tint, var(--line)); border-radius: 18px; box-shadow: 0 2px 10px rgba(30, 20, 15, .08); }
html[data-theme]:not([data-theme="pine"]) .pname { font-weight: 700; }
html[data-theme]:not([data-theme="pine"]) .row, html[data-theme]:not([data-theme="pine"]) .card { border-color: transparent; box-shadow: 0 2px 10px rgba(30, 20, 15, .06); }
html[data-theme]:not([data-theme="pine"]) .hero, html[data-theme]:not([data-theme="pine"]) .cartbar { background: linear-gradient(135deg, var(--hd1), var(--hd2)); color: var(--hdink); }
html[data-theme]:not([data-theme="pine"]) .cartbar { box-shadow: 0 8px 20px var(--hdshadow); }
html[data-theme]:not([data-theme="pine"]) .btn-primary { box-shadow: 0 4px 12px var(--hdshadow); }
html[data-theme]:not([data-theme="pine"]) .btn-primary:disabled { box-shadow: none; }
html[data-theme]:not([data-theme="pine"]) .nav { border-top: 0; box-shadow: 0 -4px 16px rgba(0, 0, 0, .07); }
html[data-theme]:not([data-theme="pine"]) .nav button.on svg { background: var(--pine-soft); border-radius: 12px; padding: 3px; width: 34px; height: 30px; }
html[data-theme]:not([data-theme="pine"]) .rc-line.big { color: var(--ink); }
html[data-theme="g_yellow"] .top .staffchip, html[data-theme="g_yellow"] .top .chip { background: rgba(255, 255, 255, .55); }

/* ตัวเลือกธีมในตั้งค่าร้าน */
.themes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.theme-opt { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 4px; border: 1.5px solid var(--line); border-radius: 14px; font-size: 13px; font-weight: 600; background: var(--card); text-align: center; line-height: 1.2; }
.theme-opt i { width: 100%; height: 28px; border-radius: 9px; }
.theme-opt.on { border-color: var(--pine); box-shadow: inset 0 0 0 1px var(--pine); }
.theme-opt i.rainbow { background: conic-gradient(from 90deg, #ef4444, #f59e0b, #eab308, #22c55e, #06b6d4, #3b82f6, #8b5cf6, #ec4899, #ef4444); }
.tcustom { display: grid; grid-template-columns: 56px 1fr; gap: 8px 10px; align-items: center; margin-top: 10px; }
.tcustom[hidden] { display: none; }
.tcustom input[type="color"] { width: 56px; height: 48px; padding: 2px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; }
.tcustom input[type="text"] { height: 48px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 12px; font-family: ui-monospace, Menlo, monospace; text-transform: lowercase; }
.tcustom small { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }

/* สำรองและกู้คืนข้อมูล (1.17.0) */
.bk-warn { background: #fde8e6; color: var(--red); border-radius: 14px; padding: 12px 14px; margin: 4px 0 12px; line-height: 1.5; }
.bk-warn p { margin: 6px 0 0; color: var(--ink); font-size: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bk-cfg { margin-top: 12px; }
.bkrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.bkrow .bk-i { display: flex; flex-direction: column; min-width: 0; }
.bkrow .bk-i small { color: var(--muted, #6b7772); font-size: 13px; }
.bkrow .bk-b { display: flex; gap: 6px; flex-wrap: wrap; }
.bkrow .chip { height: 36px; font-size: 14px; }

/* ---------- ใบเสร็จดิจิทัล (1.18.0) ---------- */
.erqr { width: min(260px, 70vw); margin: 4px auto 10px; background: #fff; padding: 6px; border-radius: 14px; border: 1px solid var(--line); }
.erqr svg, .erqr img { display: block; width: 100%; height: auto; }
.erlink { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.erlink input { flex: 1; min-width: 0; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; font-size: 14px; }
.erlink .chip { height: 44px; flex: none; }
.ergrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 10px 0 4px; }
.ergrid .btn { width: 100%; justify-content: center; text-decoration: none; }
.btn.erline { background: #06c755; color: #fff; border-color: #06c755; display: inline-flex; align-items: center; }
.rc-qr { text-align: center; margin-top: 10px; }
.rc-qr svg { display: block; width: 120px; height: 120px; margin: 0 auto 2px; }
.rc-qr small { font-size: 11px; color: var(--muted); }
@media print { .rc-qr small { color: #000; } }

/* ---------- แจ้งเตือนสต็อก (1.19.0) ---------- */
.alertbar { display: flex; align-items: stretch; gap: 4px; margin: 0 0 10px; border: 1px solid #f3c77a; background: #fff7e6; border-radius: 14px; overflow: hidden; }
.alertbar.hot { border-color: #f1a7a0; background: #fdeeed; }
.alertbar .ab-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: none; border: 0; text-align: left; color: var(--ink); font: inherit; cursor: pointer; }
.alertbar .ab-main > span:last-child { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.alertbar small { font-size: 13px; color: #6b4e16; }
.alertbar.hot small { color: #7a2a22; }
.alertbar .ab-ic { flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #e59a1a; color: #fff; font-weight: 700; }
.alertbar.hot .ab-ic { background: var(--red, #d92d20); }
.alertbar .x { flex: none; align-self: center; margin-right: 6px; }
.warn { color: #b06000; font-weight: 700; }
.lotline { align-items: center; }
.lotline .lotr { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; text-align: right; }
.lotline .lotr .chip { height: 32px; padding: 0 10px; font-size: 13px; }
.adjline { flex-wrap: wrap; }
.adjline .al-exp { flex-basis: 100%; display: flex; align-items: center; justify-content: flex-end; gap: 8px; font-size: 13px; color: var(--muted); }
.adjline .al-exp input { width: 160px; text-align: left; }

/* ---------- ระบบสมาชิก (1.21.0) ---------- */
.tier { display: inline-block; font-size: 12px; font-weight: 700; line-height: 1.5; padding: 0 8px; border-radius: 9px; vertical-align: 2px; background: var(--pine-soft); color: var(--pine-dark); white-space: nowrap; }
.tier.t1 { background: #e8ebef; color: #45505c; }
.tier.t2 { background: #fdf0c4; color: #7a5800; }
.tier.t3 { background: #2b2f36; color: #f5d27a; }
.tier.bd { background: none; padding: 0 2px; font-size: 14px; }
.card.member { margin: 6px 0 12px; }
.card.member .quick { margin-bottom: 0; }
span.pos { color: var(--pine); font-weight: 700; }
.lyrows { display: grid; gap: 8px; margin-bottom: 8px; }
.lyrow { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .6fr) 36px; gap: 8px; align-items: end; }
.lyrow.rw { grid-template-columns: minmax(0, 2fr) minmax(0, .8fr) 36px; }
.lyrow input { width: 100%; height: 44px; padding: 0 10px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); }
.lyrow input:disabled { background: var(--paper); color: var(--muted); }
.lyrow label small { display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lyrow .x { width: 36px; height: 44px; display: grid; place-items: center; color: var(--muted); }
.lyrow .x svg { width: 18px; height: 18px; }

/* ---------- ราคาแยกสาขา (1.22.0) ---------- */
.tag.bp { color: var(--pine); }
.bplist .subh { margin: 14px 0 6px; }
.bprow { display: grid; grid-template-columns: minmax(0, 1fr) 96px 64px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.bprow.kid { padding-left: 16px; }
.bprow.off .l b { color: var(--muted); text-decoration: line-through; }
.bprow .l { display: flex; flex-direction: column; min-width: 0; }
.bprow .l b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bprow .l small { color: var(--muted); font-size: 12px; }
.bprow input[data-bpp] { width: 100%; height: 42px; padding: 0 8px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); text-align: right; }
.bprow .check { margin: 0; white-space: nowrap; }

/* ---------- ตรวจรับของโอน (1.23.0) ---------- */
.xrows { display: grid; gap: 4px; }
.xrow { display: grid; grid-template-columns: minmax(0, 1fr) 72px 72px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.xrow.xh { border: 0; padding: 0; }
.xrow.xh small { color: var(--muted); font-size: 12px; text-align: center; }
.xrow .l { display: flex; flex-direction: column; min-width: 0; }
.xrow .l b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xrow .l small { color: var(--muted); font-size: 12px; }
.xrow input { width: 100%; height: 42px; padding: 0 8px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); text-align: center; }
.tag.fav { color: #b7791f; }
/* โลโก้ร้านหน้าชื่อร้าน มุมซ้ายบนหน้าขาย (1.25.2) */
.shop:has(.hdlogo) { align-items: center; }
.shopid { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hdlogo { flex: none; display: flex; align-items: center; justify-content: center; height: 44px; min-width: 44px; max-width: 120px; padding: 4px; border-radius: 12px; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); overflow: hidden; }
.hdlogo img { display: block; height: 100%; width: auto; max-width: 112px; object-fit: contain; }
.brtitle .hdlogo { margin-right: 4px; }
@media (max-width: 420px) { .hdlogo { height: 38px; min-width: 38px; max-width: 72px; padding: 3px; } .hdlogo img { max-width: 66px; } }
/* ตัวอย่างโลโก้บนใบเสร็จในตั้งค่าร้าน (1.25.3) */
.rclogo-prev { display: flex; align-items: center; justify-content: center; min-height: 64px; margin-top: 8px; padding: 8px; background: #fff; border: 1px dashed var(--line); border-radius: 10px; }
.rclogo-prev img { max-height: 72px; max-width: 160px; object-fit: contain; }
.rclogo-prev small { color: var(--muted); text-align: center; }
/* เครดิตและเกี่ยวกับ (1.26.0) */
.rc-credit { margin-top: 8px; text-align: center; font-size: 11px; color: #777; }
.lk-about { margin-top: 18px; font-size: 12px; opacity: .6; text-align: center; }
.about { padding: 12px 14px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--muted); font-size: 14px; line-height: 1.6; }
.about b { color: var(--ink); }
/* ล้างข้อมูล (1.26.0) */
.btn.danger-outline { color: var(--red); border-color: var(--red-soft); }
.check.wipe-sc { align-items: flex-start; }
.check.wipe-sc span { display: flex; flex-direction: column; gap: 2px; }
.check.wipe-sc small { color: var(--muted); font-size: 13px; line-height: 1.45; }
.check.wipe-all { padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.check.wipe-sc input { flex: none; margin-top: 2px; }
/* ตัวเลือกเพิ่มเติมตอนขาย (1.27.0) */
.xadd { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 12px; }
.xadd > span { font-size: 14px; color: var(--muted); font-weight: 600; margin-right: 2px; }
.xgroup .og-head small { display: inline-flex; align-items: center; gap: 6px; }
.xrm { width: 24px; height: 24px; border-radius: 12px; background: var(--line); color: var(--ink); font-size: 12px; line-height: 1; }
/* จัดเรียงรายการโปรด (1.27.1) */
.favsort { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.fs-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.fs-row b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.fs-n { width: 24px; text-align: center; color: var(--muted); font-size: 13px; flex: none; }
.fs-row button { width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center; padding: 0; border-radius: 10px; background: var(--paper); color: var(--ink); font-size: 14px; }
.fs-row button:disabled { opacity: .3; }

/* ครัวกลาง / โรงงานกลาง (1.28.0) */
.hubviews { margin-top: 8px; }
.hubintro p { margin: 6px 0 12px; color: var(--muted); }
.rq-submitted { color: #b26a00; font-weight: 700; }
.rq-accepted, .rq-partial { color: #1a73e8; font-weight: 700; }
.rq-shipped { color: #b26a00; font-weight: 700; }
.rq-done { color: var(--pine); }
.rq-cancelled { color: var(--muted); }
.xrow .xq { text-align: center; font-weight: 700; }
.hubplan .row.plan { display: grid; grid-template-columns: 28px minmax(0, 1fr) 76px; gap: 8px; align-items: center; text-align: left; }
.hubplan .row.plan .l { display: flex; flex-direction: column; min-width: 0; }
.hubplan .row.plan input[type=checkbox] { width: 20px; height: 20px; }
.hubplan .row.plan input[inputmode] { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 10px; text-align: center; font: inherit; background: var(--card); color: var(--ink); }
.pdcard .summary-line small { color: var(--muted); }
.pdsteps { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.pdsteps span { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.pdsteps span.done { background: color-mix(in srgb, var(--pine) 14%, transparent); color: var(--pine); border-color: transparent; }
.pdsteps span.cur { background: var(--pine); color: #fff; border-color: var(--pine); font-weight: 700; }
.hint.neg, small.neg, span.neg { color: var(--red); }
.hubrange { margin-top: 10px; }
.pviews, .hubviews { overflow-x: auto; scrollbar-width: none; }
.pviews::-webkit-scrollbar, .hubviews::-webkit-scrollbar { display: none; }
.pviews button, .hubviews button { flex: 1 0 auto; padding: 0 10px; white-space: nowrap; }

/* ออเดอร์ลูกค้า ผลิตตามสั่ง (1.29.0) */
.co-open { color: #b26a00; font-weight: 700; }
.co-making, .co-stalled { color: #1a73e8; font-weight: 700; }
.co-stalled { color: var(--red); }
.co-ready { color: var(--pine); font-weight: 700; }
.co-delivered { color: var(--pine); }
.co-cancelled { color: var(--muted); }
.coline { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin: 8px 0; background: var(--card); }
.coline .al-h { display: flex; justify-content: space-between; align-items: center; }
.bigv { font-size: 22px; padding-top: 6px; }
.co-banner { background: color-mix(in srgb, var(--pine) 10%, transparent); border-radius: 10px; padding: 8px 10px; }

/* ---------- จัดการหมวดหมู่ (1.30.0) ---------- */
.chip.cc { border-color: var(--cc); color: var(--cc); background: color-mix(in srgb, var(--cc) 12%, var(--card)); }
.chip.cc.on { background: var(--cc); border-color: var(--cc); color: #fff; }
.tile.tc { background: color-mix(in srgb, var(--tint) 14%, var(--card)); }
.swfree { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: 17px; background: var(--paper); font-size: 13px; }
.swfree input { width: 28px; height: 24px; padding: 0; border: 0; background: none; }
.catadd { display: flex; gap: 8px; margin: 8px 0 12px; align-items: flex-end; }
.catadd .f { flex: 1; min-width: 0; margin: 0; }
.catlist .fs-row b small { display: block; font-weight: 400; }
.catlist .fs-row b.dim { opacity: .5; }
.cdotb { width: 28px !important; height: 28px !important; border-radius: 50% !important; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); flex: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 4px 10px; }
.swatches button { width: 34px; height: 34px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); padding: 0; }
.swatches button.auto { width: auto; border-radius: 17px; padding: 0 12px; background: var(--paper); color: var(--ink); font-size: 13px; }
.catmenu { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0 10px; }

/* ---------- กราฟยอดขายตามกะ (1.33.0) ---------- */
.chips.shg { padding-bottom: 6px; }
.shtab { margin-top: 6px; }
.shtab .rc-line.tot { border-top: 1.5px solid var(--line); font-weight: 700; margin-top: 4px; }
.chips.shg .chip { height: 36px; padding: 0 11px; font-size: 14px; }
.shnav { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 0 6px; }
.shnav b { flex: 1; text-align: center; font-size: 15px; }
.shnav .chip { height: 36px; padding: 0 14px; }
.shnav .chip:disabled { opacity: .35; }
.shtab .rc-line { width: 100%; text-align: left; }
.shtiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 4px 0 10px; }
.shtile { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; text-align: left; border-radius: 12px; background: var(--paper); border: 1.5px solid var(--line); }
.shtile b { font-size: 19px; }
.shtile small { color: var(--muted); font-size: 12px; }
.shtile.on { border-color: var(--pine); background: var(--pine-soft); }
.cmptab .rc-line { display: grid; grid-template-columns: 1.1fr 1fr 1fr 1.4fr; gap: 6px; align-items: center; font-size: 14px; }
.cmptab .rc-line.head { color: var(--muted); font-size: 12px; }
.cmptab .rc-line > span:last-child { text-align: right; font-size: 13px; }
.cmptab .rc-line b { font-size: 14px; text-align: right; }
.cmplegend { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); margin: 2px 0 8px; }
.cmplegend i { display: inline-block; width: 16px; height: 3px; margin-right: 6px; vertical-align: middle; border-radius: 2px; }
.cmplegend i.dash { background: repeating-linear-gradient(90deg, var(--muted) 0 4px, transparent 4px 7px); }

/* ---------- แดชบอร์ดสด (1.35.0) ---------- */
.livebar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; font-size: 13px; }
.livebar .live-on { color: var(--pine); font-weight: 600; }
.livebar .lv-btns { display: flex; gap: 6px; }
.livebar .chip { height: 34px; padding: 0 12px; font-size: 13px; }
.live-hero b { font-size: 44px; }
.live-hero .lv-cmp { margin-top: 6px; opacity: .95; }
.live-hero .lv-cmp .up, .live-hero .lv-cmp .down { color: #fff; font-weight: 700; }
body.live-full #nav, body.live-full #cartbar, body.live-full .top, body.live-full #alertbar, body.live-full .brscope, body.live-full .rviews { display: none !important; }
body.live-full #main { padding-bottom: 16px; }
@media (min-width: 900px) {
  body.live-full #main .livegrid, body.live-full #main { max-width: 1100px; margin: 0 auto; }
  body.live-full .live-hero b { font-size: 72px; }
}

/* ลูกค้าสแกนสั่งเอง (1.37.0) */
.sobar { border-color: var(--brand, #0e5a4c); }
.socard { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin: 8px 0; background: var(--card); }
.socard.so-pending { border-color: #e0a100; box-shadow: 0 0 0 2px rgba(224, 161, 0, .15); }
.socard.so-rejected, .socard.so-cancelled { opacity: .6; }
.soh { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.solines { margin: 6px 0; font-size: 15px; }
.solines > div { padding: 2px 0; }
.solines em { color: #b05a00; font-style: normal; }
.sonote { margin: 4px 0; color: #b05a00; font-size: 14px; }
.sowarn { margin: 4px 0; color: #c5221f; font-size: 13px; }
.soft { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.soact { display: flex; gap: 6px; }
.soact .btn { padding: 8px 14px; }
.sorej { margin-top: 8px; }
.soqr { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 8px 0; }
.soqi { border: 1px solid var(--line); border-radius: 12px; padding: 8px; text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.soqi .erqr { width: 120px; margin: 0; }
.soqi span { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
#soprint { display: none; }
@media print {
  body.print-so > *:not(#soprint) { display: none !important; }
  body.print-so { background: #fff; }
  body.print-so #soprint { display: grid; grid-template-columns: 1fr 1fr; gap: 8mm; color: #000; }
  body.print-so .sop { border: 1px dashed #999; border-radius: 4mm; padding: 6mm; text-align: center; break-inside: avoid; page-break-inside: avoid; }
  body.print-so .sop svg { width: 55mm; height: 55mm; }
  body.print-so .sop-s { font-size: 13pt; }
  body.print-so .sop-t { font-size: 22pt; font-weight: 700; margin: 1mm 0 2mm; }
  body.print-so .sop-h { font-size: 11pt; margin-top: 2mm; }
}
#sheet .check input[id^="so-"] { flex: none; }
#so-limit, #so-block { width: 100%; }

/* ระบบคิว (1.38.0) */
.qbar.late { border-color: #c5221f; }
.qlate { color: #c5221f; }
.qurow { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; margin: 8px 0; background: var(--card); }
.qurow.q-called { border-color: var(--brand, #0e5a4c); }
.qurow.q-ready { border-color: #e0a100; }
.qurow.late { border-color: #c5221f; background: #fff6f5; }
.qurow.q-done, .qurow.q-cancelled, .qurow.q-seated { opacity: .55; }
.qno { font-size: 24px; font-weight: 700; min-width: 74px; text-align: center; }
.qinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.qinfo small { color: var(--muted, #66727c); }
.qbtns { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.qbtns .btn { padding: 8px 12px; }
.qseat { margin: -4px 0 8px; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 12px; }
.qadd { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.qadd input { flex: 1 1 110px; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; background: var(--card); color: inherit; }
.qfree { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; margin: 8px 0; }
.qft { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 4px 0; }
.qft > span { flex: 1; min-width: 80px; font-weight: 600; }
.qseats { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.qseats label { display: flex; flex-direction: column; font-size: 13px; }
.qseats input { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; background: var(--card); color: inherit; }
.rc-q { text-align: center; margin: 8px 0 4px; padding: 6px 0; border-top: 1px dashed #999; border-bottom: 1px dashed #999; }
.rc-q span { display: block; font-size: 13px; }
.rc-q b { display: block; color: #000; font-size: 44px; line-height: 1.1; letter-spacing: 2px; }
.rc-qqr { width: 110px; margin: 4px auto 0; }
.rc-qqr svg { width: 100%; height: auto; display: block; }
.rc-q small { font-size: 11px; }
#sheet .check input[id^="q-"] { flex: none; }
#q-late, #q-wlate, #q-limit { width: 100%; }

/* เดลิเวอรี่ (1.39.0) */
.dlchips { margin: 0 0 8px; flex-wrap: wrap; }
.dlchips .dlapp { border-left: 4px solid var(--dlc); }
.dlbox { border: 1px dashed var(--line); border-radius: 12px; padding: 8px 10px; margin: 0 0 10px; }
.dlbox .f { margin: 0 0 4px; }
.dlbox.own { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.dlbox.own small { color: var(--muted, #666); white-space: pre-line; }
.dlpay { margin: 0 0 6px; text-align: center; }
.dlphone { display: flex; gap: 8px; align-items: flex-end; }
.dlphone .f { flex: 1; margin-bottom: 0; }
.dlphone + .hint, .dlphone { margin-bottom: 8px; }
.dltabs button { font-size: 13px; }
.dlrow { border: 1px solid var(--line); border-radius: 14px; padding: 10px; margin: 8px 0; background: var(--card); }
.dlrow.dl-new { border-color: #c5221f; }
.dlrow.dl-out { border-color: #e0a100; }
.dlhead { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dlhead small { width: 100%; }
.dltag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #fff; background: var(--dlc, #0f766e); }
.dlinfo { margin: 6px 0; font-size: 14px; line-height: 1.45; white-space: pre-line; }
.dlinfo .chip { padding: 2px 8px; font-size: 12px; }
.dlitems { margin: 6px 0; font-size: 14px; }
.dlitems .miss { color: #c5221f; }
.dlrow .qbtns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.dlrow .qbtns .btn { flex: 1 1 auto; min-width: 0; }
.dlapprow { border: 1px solid var(--line); border-radius: 12px; padding: 8px; margin: 6px 0; }
.dla-top, .dla-bot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dla-top .dla-n { flex: 1; min-width: 0; }
.dla-top .dla-c { width: 40px; height: 36px; padding: 0; border: none; background: none; flex: none; }
.dla-bot { margin-top: 6px; }
.dla-bot label { display: flex; flex-direction: column; gap: 2px; }
.dla-bot input[type="number"] { width: 72px; }
.dla-bot .dla-r { flex-direction: row; align-items: center; gap: 4px; }
.dla-bot .dla-r input { flex: none; }
.dlpre { background: var(--bg, #f6f6f6); border: 1px solid var(--line); border-radius: 10px; padding: 8px; font-size: 12px; overflow-x: auto; white-space: pre; }
.dlprices label { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.dlprices label span { display: flex; flex-direction: column; min-width: 0; }
.dlprices input { width: 100px; flex: none; text-align: right; }
.dlrep { padding: 6px 0; border-bottom: 1px solid var(--line); }
#sheet .check input[id^="dl-"] { flex: none; }
.rc-dl { margin-top: 6px; padding: 6px; border: 1px dashed #000; color: #000; text-align: left; font-size: 12px; }
.rc-cod { font-weight: 700; font-size: 15px; margin-top: 4px; text-align: center; }
@media print {
  body.print-dl > *:not(#soprint) { display: none !important; }
  body.print-dl { background: #fff; }
  body.print-dl #soprint { display: block; color: #000; }
  body.print-dl .dllabel { display: block; width: 72mm; margin: 0 auto; font-size: 12pt; line-height: 1.35; }
  body.print-dl .dll-s { font-size: 10pt; border-bottom: 1px dashed #000; padding-bottom: 1mm; margin-bottom: 2mm; }
  body.print-dl .dll-n { font-size: 18pt; font-weight: 700; }
  body.print-dl .dll-p { font-size: 15pt; font-weight: 700; }
  body.print-dl .dll-a { white-space: pre-line; margin: 1mm 0; }
  body.print-dl .dll-c { font-size: 15pt; font-weight: 700; border: 2px solid #000; text-align: center; padding: 1mm; margin: 2mm 0; }
  body.print-dl .dll-q { text-align: center; }
  body.print-dl .dll-q svg { width: 34mm; height: 34mm; display: block; margin: 0 auto; }
}
.dlapprow input:not([type="checkbox"]):not([type="color"]), .dlprices input { border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; font: inherit; font-size: 15px; background: var(--card); color: var(--ink, inherit); height: 38px; box-sizing: border-box; }
.installbar.pinwarn { border-color: #c5221f; }

/* ---------- สแกนบาร์โค้ดด้วยกล้อง (1.43.0) ---------- */
.qrow { display: flex; gap: 8px; align-items: center; }
.qrow .search { flex: 1; min-width: 0; }
.qcam { flex: none; width: 50px; height: 50px; border-radius: 14px; background: var(--pine); color: #fff; display: flex; align-items: center; justify-content: center; border: 0; }
.qcam.sm { width: 48px; height: 48px; }
.barrow { display: flex; gap: 8px; align-items: center; }
.barrow input { flex: 1; min-width: 0; }
.fab.fab2 { bottom: calc(var(--nav) + var(--safe-b) + 88px); width: 52px; height: 52px; right: max(20px, calc(50% - 460px)); background: var(--card); color: var(--pine); border: 1.5px solid var(--pine); }
#camov { position: fixed; inset: 0; z-index: 200; background: #000; color: #fff; display: flex; flex-direction: column; padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
#camov .camhd { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; font-size: 18px; }
#camov .cambox { position: relative; flex: 1; min-height: 0; border-radius: 16px; overflow: hidden; background: #111; }
#camov video { width: 100%; height: 100%; object-fit: cover; display: block; }
#camov .aim { position: absolute; left: 10%; right: 10%; top: 32%; bottom: 32%; border: 3px solid #f5c542; border-radius: 12px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .3); }
#camov .cammsg { text-align: center; margin: 12px 0 4px; font-size: 16px; }
#camov .camlog { text-align: center; color: #b9e4c9; font-size: 15px; line-height: 1.6; min-height: 24px; }

/* ---------- ประวัติการแก้ไข (1.44.0) ---------- */
.aulist { margin-bottom: 12px; }
.auday { font-size: 13px; color: var(--muted); font-weight: 600; margin: 14px 0 6px; }
.aurow { display: flex; gap: 10px; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 12px; margin-bottom: 6px; }
.aurow .aut { flex: none; width: 44px; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; padding-top: 1px; }
.aurow .aub { flex: 1; min-width: 0; font-size: 15px; line-height: 1.45; word-break: break-word; }
.aurow .aub small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.aurow.au-bill { border-left-color: #c5221f; }
.aurow.au-cash { border-left-color: #e8a317; }
.aurow.au-product, .aurow.au-stock { border-left-color: var(--pine); }
.aurow.au-staff, .aurow.au-settings { border-left-color: #5b6bd6; }

/* ลากเรียงลำดับสินค้า (1.46.0) */
.chip.sortchip { font-weight: 600; }
.sortbar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 0 0 10px; border-radius: 14px; background: var(--pine-soft); border: 1px dashed var(--pine); }
.sortbar .sb-ic { font-size: 20px; color: var(--pine); flex: none; }
.sortbar .sb-tx { flex: 1; min-width: 0; }
.sortbar .sb-tx b { display: block; }
.sortbar .sb-tx small { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; }
.sortbar .btn { flex: none; padding: 8px 14px; }
.grid.sorting .tile { cursor: grab; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; outline: 2px dashed color-mix(in srgb, var(--pine) 40%, transparent); outline-offset: -4px; }
.grid.sorting .tile:active { background: var(--card); }
.grid.sorting .tile.tc:active { background: color-mix(in srgb, var(--tint) 14%, var(--card)); }
.grid.sorting .tile.out { opacity: .7; }
.tile.drag-hold, .fs-row.drag-hold { transform: scale(.97); transition: transform .2s; }
.drag-src { opacity: .3; outline: 2px dashed var(--pine) !important; outline-offset: -2px; }
.drag-ghost { position: fixed !important; left: 0; top: 0; z-index: 80; margin: 0 !important; pointer-events: none; box-shadow: 0 14px 30px rgba(23, 33, 43, .28); opacity: .96; will-change: transform; }
html.is-dragging, html.is-dragging * { cursor: grabbing !important; -webkit-user-select: none !important; user-select: none !important; }
.psort .fs-row { -webkit-user-select: none; user-select: none; }
.psort .fs-row b small { font-weight: 400; }
.psort .fs-row b.dim { opacity: .55; }
.ps-handle { width: 36px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--muted); border-radius: 10px; cursor: grab; touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.ps-handle:active { background: var(--pine-soft); color: var(--pine); }
.ps-actions { position: sticky; bottom: calc(-18px - var(--safe-b)); background: var(--card); margin: 0 -16px calc(-18px - var(--safe-b)); padding: 10px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); z-index: 1; }
@media (prefers-reduced-motion: reduce) { .tile.drag-hold, .fs-row.drag-hold { transition: none; } }

/* ---------- เครื่องตัวกลางพิมพ์ใบเสร็จ / Relay (1.47.0) ---------- */
.rl-on { color: var(--pine); font-weight: 700; font-style: normal; }
.rl-off { color: var(--red); font-weight: 700; font-style: normal; }
.rl-box { align-items: center; gap: 10px; }
.rl-box span { min-width: 0; overflow-wrap: anywhere; }
.rl-box em { text-align: right; font-size: 14px; }
.rl-card { padding: 12px; margin-bottom: 10px; }
.rl-stt { margin: 8px 0 2px; font-size: 14px; }
#rlpill { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(140px + env(safe-area-inset-bottom, 0px)); z-index: 40; max-width: 92vw; padding: 6px 14px; border: 0; border-radius: 999px; background: var(--pine); color: #fff; font: inherit; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 2px 10px rgba(0,0,0,.25); opacity: .92; }
#rlpill.warn { background: #b45309; }
#rlpill.bad { background: var(--red); }
@media print { #rlpill { display: none !important; } }

/* ---------- ระบบหลังร้าน (1.48.0) ---------- */
.nav.seven { grid-template-columns: repeat(7, 1fr); }
.nav.seven button span { font-size: 10.5px; white-space: nowrap; }
.nav.seven button svg { width: 22px; height: 22px; }
.seg .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); vertical-align: middle; margin-left: 2px; }
.bo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 4px; }
@media (min-width: 600px) { .bo-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 880px) { .bo-grid { grid-template-columns: repeat(4, 1fr); } }
.bo-tile { display: flex; flex-direction: column; gap: 2px; padding: 10px; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; min-width: 0; }
.bo-tile.on { border-color: var(--pine); box-shadow: 0 0 0 1px var(--pine) inset; }
.bo-tile img, .bo-tile .bo-ini { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: var(--pine-soft); margin-bottom: 4px; }
.bo-tile .bo-ini { display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; color: var(--pine); }
.bo-tile b { font-weight: 600; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bo-tile small { font-size: 12.5px; color: var(--muted); }
.bo-tile small.down { color: var(--red); }
.bo-add { margin-top: auto; height: 42px; border-radius: 10px; background: var(--pine-soft); color: var(--pine); font-weight: 700; text-align: center; }
.bo-step { display: flex; align-items: center; gap: 4px; margin-top: auto; }
.bo-step button { width: 42px; height: 42px; flex: none; border-radius: 10px; background: var(--pine); color: #fff; font-size: 22px; font-weight: 700; text-align: center; }
.bo-step input { flex: 1; min-width: 0; width: 56px; height: 42px; border: 1.5px solid var(--line); border-radius: 10px; text-align: center; font-weight: 700; background: #fff; }
.adjline .bo-step { margin-top: 0; flex: none; width: 150px; }
.adjline .bo-step input { width: auto; text-align: center; }
#bo-cbar { position: fixed; left: 0; right: 0; bottom: calc(var(--nav) + var(--safe-b) + 10px); z-index: 8; padding: 0 12px; pointer-events: none; }
#bo-cbar:empty { display: none; }
.bo-cbar .cb-total { font-size: 17px; }
.bo-apl, .bo-rl { flex-wrap: wrap; }
.bo-apl .al-h, .bo-rl .al-h { flex: 1 1 100%; }
.bo-apl input, .bo-rl input { flex: 1 1 70px; width: auto; }
.bo-apl .bo-sup { flex: 1 1 100%; height: 44px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; padding: 0 10px; }
.bo-rl .al-exp { flex: 1 1 100%; }
.bo-vt { flex: none; height: 44px; padding: 0 10px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font-size: 13px; font-weight: 600; color: var(--muted); }
.bo-vt.on { background: var(--pine-soft); border-color: var(--pine); color: var(--pine); }
.bo-cam { display: flex; gap: 10px; margin: 6px 0 4px; }
.bo-cam .btn { flex: 1; cursor: pointer; }
.bo-cam .btn-primary { flex: 1.4; }
label.btn { cursor: pointer; }
.bo-thumbs { display: flex; gap: 8px; overflow-x: auto; margin: 8px 0; }
.bo-thumbs button { flex: none; position: relative; }
.bo-thumbs img { width: 84px; height: 110px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.bo-thumbs small { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 0 6px; border-radius: 6px; }
.bo-items { display: flex; flex-direction: column; gap: 8px; }
.bo-it { display: grid; grid-template-columns: 1fr 104px 36px; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); align-items: center; }
.bo-it input, .bo-it select { height: 44px; padding: 0 10px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; min-width: 0; width: 100%; }
.bo-it input[inputmode] { text-align: right; }
.bo-it select { grid-column: 1 / 2; }
.bo-it .bo-vt { grid-column: 2 / 4; }
.bo-it small { grid-column: 1 / -1; }
.bo-it .x { width: 36px; height: 36px; }
.bo-money { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.bo-money .f > span { font-size: 12.5px; min-height: 2.6em; }
@media (max-width: 420px) { .bo-money { grid-template-columns: 1fr 1fr; } }
.bo-bar { position: relative; display: flex; justify-content: space-between; width: 100%; padding: 8px 10px; margin-bottom: 4px; border-radius: 10px; overflow: hidden; }
.bo-bar span, .bo-bar b { position: relative; z-index: 1; }
.bo-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--pine-soft); border-radius: 10px; }
.bo-month { justify-content: space-between; }
.bo-month b { font-size: 18px; }
.bo-proof { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.bo-proof figure { margin: 0; }
.bo-proof img { width: 100%; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; display: block; }
.bo-proof figcaption { font-size: 13px; color: var(--muted); margin-top: 4px; }
.bo-big { width: 100%; border-radius: 10px; display: block; }
.bo-share .actions { margin-top: 10px; }
.bo-line { background: #06c755; }
.bo-line:active { background: #05a948; }
.rq-pending { color: #b26a00; font-weight: 600; }
.rq-approved { color: var(--pine); font-weight: 600; }
.rq-rejected, .rq-cancelled { color: var(--red); font-weight: 600; }
.hint.up { color: var(--pine); }
textarea#bo-cats { width: 100%; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px; font: inherit; }

.bo-f { flex: 1 1 90px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bo-f span { font-size: 12px; color: var(--muted); }
.bo-apl .bo-f input, .bo-rl .bo-f input { flex: none; width: 100%; }
.bo-rl .bo-vt { align-self: flex-end; }

/* รายจ่ายตอนปิดกะ (1.49.0) */
.bo-shexp { margin-top: 14px; }
.bo-shexp .list { margin-top: 10px; }
.bo-drawer { align-items: flex-start; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; margin: 10px 0 14px; background: var(--card); }
.bo-drawer span { display: flex; flex-direction: column; gap: 2px; }
.bo-drawer small { color: var(--muted); font-weight: 400; font-size: 13px; }
