: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; }

.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] { 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); } }

/* ---------- รูปสินค้า ---------- */
.tile.has-img { padding: 0 0 10px; justify-content: flex-start; border-left-width: 1px; border-top: 5px solid var(--tint, var(--line)); overflow: hidden; }
.tile.has-img .pname, .tile.has-img .pprice, .tile.has-img .stock { padding-left: 10px; padding-right: 10px; }
.tile.has-img .pprice { margin-top: auto; font-size: 18px; }
.tile .pimg { display: block; width: 100%; height: 78px; background: #f3f1ec; overflow: hidden; }
.tile .pimg img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile.has-img .qty { z-index: 1; top: 8px; right: 8px; }
.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; }
@media (min-width: 800px) { .tile .pimg { height: 92px; } }
.tile.has-img .pname { margin-top: 2px; }

/* ---------- ออฟไลน์ ---------- */
#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 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.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; }
