/* NexSPA SaaS — ธีมหลัก Deep Forest Green & Champagne Gold */
:root {
  --bg: #F8F6F0;
  --card: #ffffff;
  --ink: #172B26;
  --ink2: #55615B;
  --muted: #77817A;
  --border: #E5DFD2;
  --primary: #123D32;
  --primary-d: #1B5B48;
  --accent: #C9A15B;
  --green: #2E8B57;
  --green-bg: #E6F4EC;
  --red: #C0443E;
  --red-bg: #FBE9E7;
  --amber: #C98B16;
  --amber-bg: #FDF3DC;
  --blue: #3C6FA8;
  --blue-bg: #E5EEF8;
  --side: #123D32;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(18, 61, 50, .06), 0 4px 14px rgba(18, 61, 50, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font, "IBM Plex Sans Thai Looped"), "Noto Sans Thai", system-ui, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.25; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
small, .muted { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.side {
  width: 230px; flex-shrink: 0; background: var(--side); color: #D7E5DF;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side .brand { padding: 18px 18px 10px; font-weight: 700; color: #C9A15B; font-size: 1.1rem; }
.side .brand small { display: block; color: #A6BEB5; font-weight: 400; font-size: .78rem; }
.side nav { display: flex; flex-direction: column; padding: 6px 10px; gap: 4px; flex: 1; }
.side nav a { color: #D7E5DF; padding: 10px 12px; border-radius: 10px; display: flex; gap: 10px; align-items: center; }
.side nav a:hover { background: rgba(255,255,255,.08); }
.side nav a.on { background: var(--accent); color: #123D32; font-weight: 600; }
.side nav .sep { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: #8FA99F; padding: 12px 12px 4px; }
.side .foot { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: .85rem; }
.side .foot button { background: none; border: 0; color: #C9A15B; padding: 0; cursor: pointer; font: inherit; }
.main { flex: 1; min-width: 0; padding: 22px 26px 40px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.menu-toggle { display: none; }
.imp-bar { background: var(--amber); color: #fff; padding: 8px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .9rem; }
.imp-bar button { background: #fff; color: var(--amber); border: 0; border-radius: 8px; padding: 4px 10px; cursor: pointer; font: inherit; }

.mtop { display: none; }

@media (max-width: 900px) {
  .side { position: fixed; left: -260px; width: 250px; z-index: 50; transition: left .2s; }
  .side.open { left: 0; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .main { padding: 14px; }
  .menu-toggle { display: inline-flex; }
  .mtop {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 40;
    background: rgba(248, 246, 240, .96); border-bottom: 1px solid var(--border);
    margin: -14px -14px 14px; padding: 8px 12px; min-height: 52px;
  }
  .mtop .menu-toggle { width: 40px; height: 40px; padding: 0; font-size: 1.2rem; flex-shrink: 0; }
  .mtop b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; }
  .mtop small { color: var(--muted); font-size: .78rem; white-space: nowrap; }
}

/* ---------- components ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .split > .card + .card { margin-top: 0 !important; }
.card h2, .card h3 { margin-top: 0; }
.grid { display: grid; grid-gap: 16px; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .g2, .g3 { grid-template-columns: minmax(0, 1fr); } }
.split { display: grid; gap: 16px; align-items: start; grid-template-columns: minmax(0, 1fr) 320px; }
.split-21 { display: grid; gap: 16px; align-items: start; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 900px) { .split, .split-21 { grid-template-columns: minmax(0, 1fr); } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.right { text-align: right; } .center { text-align: center; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.hidden { display: none !important; }

.stat { padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.6rem; font-weight: 700; margin-top: 2px; }
.stat .sub { font-size: .8rem; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border); background: #fff; color: var(--ink2);
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; transition: transform .05s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(0,0,0,.04); }
.btn-sm { padding: 5px 10px; font-size: .85rem; border-radius: 8px; }
.btn-lg { padding: 14px 22px; font-size: 1.05rem; border-radius: 12px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; font: inherit; }
.link-btn.red { color: var(--red); }

label { display: block; font-size: .88rem; color: var(--ink2); margin-bottom: 4px; font-weight: 500; }
.input, input[type=text], input[type=password], input[type=number], input[type=date], input[type=month], input[type=email], input[type=tel], select, textarea {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); background: #fff;
  font: inherit; color: var(--ink); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary-d); box-shadow: 0 0 0 3px rgba(27, 91, 72, .16); }
input[type=color] { width: 48px; height: 38px; border: 1px solid var(--border); border-radius: 8px; padding: 2px; background: #fff; }
.field { margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.hint { font-size: .8rem; color: var(--muted); margin-top: 3px; }

table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th { text-align: left; color: var(--muted); font-weight: 500; font-size: .82rem; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.t td { padding: 10px; border-bottom: 1px solid #EEE8DC; vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr:hover td { background: #F5F2EA; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .78rem; font-weight: 500; background: #EFECE2; color: var(--ink2); white-space: nowrap; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }

.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; background: var(--green-bg); color: var(--green); border: 1px solid #cfe5ca; }
.flash.err { background: var(--red-bg); color: var(--red); border-color: #f2cdc8; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chip { padding: 7px 14px; border-radius: 99px; background: #fff; border: 1px solid var(--border); cursor: pointer; white-space: nowrap; font: inherit; color: var(--ink2); }
.chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }

.bars { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.bars .bar i { display: block; width: 100%; max-width: 46px; background: linear-gradient(180deg, var(--accent), var(--primary)); border-radius: 8px 8px 3px 3px; min-height: 3px; }
.bars .bar span { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.bars .bar b { font-size: .72rem; font-weight: 500; color: var(--ink2); }

.hbar { height: 8px; background: #EAE4D7; border-radius: 99px; overflow: hidden; }
.hbar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(18, 61, 50, .48); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: var(--card); border-radius: 18px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); animation: pop .18s ease; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h2 { margin: 0; }
.modal-close { background: none; border: 0; font-size: 1.4rem; cursor: pointer; color: var(--muted); line-height: 1; }
@keyframes pop { from { transform: scale(.95); opacity: 0; } to { transform: none; opacity: 1; } }

.toast-wrap { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; box-shadow: var(--shadow); animation: pop .2s ease; }
.toast.err { background: var(--red); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(circle at 20% 10%, #E6EFEA, var(--bg)); }
.auth .card { width: 100%; max-width: 400px; padding: 28px; }
.auth .logo { font-size: 2.4rem; text-align: center; }
.auth h1 { text-align: center; margin-bottom: 4px; }
.auth p.sub { text-align: center; color: var(--muted); margin: 0 0 20px; }

.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.code { font-family: ui-monospace, Consolas, monospace; background: #EFECE2; color: #123D32; padding: 2px 6px; border-radius: 6px; font-size: .88em; word-break: break-all; }
.copy-box { display: flex; gap: 8px; }
.copy-box input { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }

/* ---------- list rows (เมนู / หมวด / ตัวเลือก) ---------- */
.li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid #EEE8DC; }
.card h3 + .li, .card .hint + .li, .card .li:first-of-type { border-top: 0; }
.li .li-main { flex: 1; min-width: 0; }
.li .li-main small { display: block; color: var(--muted); }
.li .li-act { display: flex; gap: 12px; align-items: center; flex-shrink: 0; }
.li .li-act form { margin: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.card-head h3 { margin: 0; }
.pitem { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid #EEE8DC; }
.pitem:first-of-type { border-top: 0; }
.pitem.off { opacity: .5; }
.pitem .pimg { width: 48px; height: 48px; border-radius: 12px; background: #F3EFE6; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; overflow: hidden; }
.pitem .pimg img { width: 100%; height: 100%; object-fit: cover; }
.pitem .pinfo { min-width: 0; }
.pitem .pinfo b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pitem .pinfo small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.pitem .pprice { text-align: right; white-space: nowrap; }
.pitem .pprice small { display: block; color: var(--muted); font-size: .78rem; }
.pitem .pact { display: flex; gap: 6px; }
.li.off { opacity: .45; }
.li .li-act.btns { gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters input, .filters select { width: auto; max-width: 180px; }

/* ---------- ตัวแก้กลุ่มตัวเลือก ---------- */
.opt-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.opt-presets .hint { margin: 0 2px 0 0; }
.opt-presets .chip { padding: 5px 12px; font-size: .85rem; }
.opt-head, .opt-row { display: grid; grid-template-columns: minmax(0, 1fr) 84px 44px 40px; gap: 6px; align-items: center; }
.opt-head span:nth-child(3) { text-align: center; }
.o-av { margin: 0; display: flex; justify-content: center; cursor: pointer; }
.o-av input { position: absolute; opacity: 0; pointer-events: none; }
.o-av span { width: 40px; height: 24px; border-radius: 99px; background: #D8D2C5; position: relative; transition: background .15s; }
.o-av span:after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s; }
.o-av input:checked + span { background: var(--green); }
.o-av input:checked + span:after { left: 19px; }
/* รายการกลุ่ม: ชิปตัวเลือก แตะ = มี/หมด */
.ochips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.ochip { font: inherit; font-size: .78rem; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--border); background: #fff; color: var(--ink2); cursor: pointer; }
.ochip.out { background: #F1EFEA; color: #9DA5A0; text-decoration: line-through; }
.ochip.out:after { content: ' หมด'; text-decoration: none; display: inline-block; margin-left: 3px; color: var(--red); font-weight: 600; }
/* รายการเมนู: ชื่อกลุ่มตัวเลือก */
.pmods { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.pmods i { font-style: normal; font-size: .72rem; padding: 1px 8px; border-radius: 99px; background: #EAF4EE; color: var(--primary-d); }
/* ฟอร์มเมนู: การ์ดกลุ่มตัวเลือก */
.pm-list { display: grid; gap: 8px; }
.pm-card { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; margin: 0; font-weight: 400; background: #fff; }
.pm-card input { position: absolute; opacity: 0; pointer-events: none; }
.pm-body { flex: 1; min-width: 0; }
.pm-body small { display: block; color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-tog { width: 44px; height: 26px; border-radius: 99px; background: #D8D2C5; position: relative; flex-shrink: 0; transition: background .15s; }
.pm-tog:after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s; }
.pm-card input:checked ~ .pm-tog { background: var(--primary); }
.pm-card input:checked ~ .pm-tog:after { left: 21px; }
.pm-card input:checked ~ .pm-body b { color: var(--primary-d); }
/* ฟอร์มกลุ่ม: เมนูที่ใช้ */
.pu-box { border: 1px solid var(--border); border-radius: 12px; max-height: 300px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pu-cat + .pu-cat { border-top: 1px solid var(--border); }
.pu-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: #F5F2EA; position: sticky; top: 0; z-index: 1; font-size: .9rem; }
.pu-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin: 0; font-weight: 400; cursor: pointer; border-top: 1px solid #EEE8DC; }
.pu-item input { width: 20px; height: 20px; accent-color: var(--primary); flex-shrink: 0; }
.opt-head { font-size: .78rem; color: var(--muted); margin: 2px 0 4px; }
.opt-row { margin-bottom: 8px; }
.opt-row .o-price { text-align: right; }
.opt-row .o-del { height: 40px; border: 1px solid var(--border); background: #fff; border-radius: 10px; color: var(--red); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.opt-add { border-style: dashed; color: var(--primary); }
.seg { display: flex; background: #EFECE2; border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 12px; }
.seg label { flex: 1; margin: 0; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 9px 6px; border-radius: 9px; color: var(--ink2); font-weight: 500; }
.seg input:checked + span { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(18, 61, 50, .14); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; font-weight: 400; margin: 0; }
.switch-row small { display: block; color: var(--muted); font-size: .8rem; }
.switch-row input { width: 22px; height: 22px; flex-shrink: 0; accent-color: var(--primary); }

/* หน้าต่างเลือกตัวเลือก (POS + QR ลูกค้า) */
.os-modal { padding-bottom: 0 !important; }
.os-g { padding: 12px 0 14px; border-bottom: 1px solid var(--border); scroll-margin-top: 70px; }
.os-g:last-child { border-bottom: 0; }
.os-gh { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.os-gh b { font-size: 1.02rem; }
.os-rule { font-size: .78rem; padding: 2px 10px; border-radius: 99px; background: #EFECE2; color: var(--muted); white-space: nowrap; }
.os-rule.must { background: var(--red-bg); color: var(--red); font-weight: 600; }
.os-g.done .os-rule.must { background: var(--green-bg); color: var(--green); }
.os-g.done .os-rule.must:before { content: '✓ '; }
.os-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.os-o { display: flex; align-items: center; gap: 8px; min-height: 50px; padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 12px; background: #fff; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.os-o .os-mark { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #C9C2B4; flex-shrink: 0; position: relative; }
.os-o .os-n { flex: 1; min-width: 0; line-height: 1.25; }
.os-o .os-p { font-size: .82rem; color: var(--primary-d); font-weight: 600; white-space: nowrap; }
.os-o.on { border-color: var(--primary); background: #EAF4EE; }
.os-o.on .os-mark { border-color: var(--primary); background: var(--primary); }
.os-o.on .os-mark:after { content: ''; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.os-o:disabled { background: #F1EFEA; color: #9DA5A0; cursor: not-allowed; text-decoration: line-through; }
.os-o:disabled .os-p { color: var(--red); text-decoration: none; }
.os-notes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.os-notes .chip { padding: 6px 12px; font-size: .88rem; }
.os-foot { position: sticky; bottom: 0; background: var(--card); display: flex; gap: 10px; align-items: center; padding: 12px 0 14px; border-top: 1px solid var(--border); margin-top: 4px; z-index: 2; }
.os-qty { display: flex; align-items: center; border: 1.5px solid var(--border); border-radius: 12px; overflow: hidden; flex-shrink: 0; }
.os-qty button { width: 44px; height: 48px; border: 0; background: #fff; font-size: 1.4rem; color: var(--primary); cursor: pointer; }
.os-qty b { min-width: 30px; text-align: center; font-size: 1.1rem; }
.os-add { flex: 1; min-height: 50px; white-space: normal; line-height: 1.25; }
.os-add.wait { background: #A6B5AE; border-color: #A6B5AE; }
.shake { animation: shake .4s; }
.shake .os-rule.must { background: var(--red); color: #fff; }
@keyframes shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- จอเล็ก (Sunmi V2 Pro 5.99" = 360×720 CSS px) ---------- */
@media (max-width: 700px) {
  body { font-size: 14.5px; }
  h1 { font-size: 1.3rem; } h2 { font-size: 1.1rem; } h3 { font-size: 1rem; }
  .main { padding: 12px 12px 32px; }
  .mtop { margin: -12px -12px 12px; }
  .card { padding: 14px; border-radius: 12px; }
  .card + .card { margin-top: 12px; }
  .grid { grid-gap: 12px; gap: 12px; }
  .grid + .card, .card + .grid, .split + .card { margin-top: 12px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-gap: 10px; gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .label { font-size: .8rem; }
  .stat .value { font-size: 1.25rem; }
  .page-head { margin-bottom: 12px; gap: 8px; }
  .page-head > .row { gap: 6px; }
  .page-head .btn { padding: 7px 12px; font-size: .88rem; }
  .btn { padding: 9px 14px; }
  .btn-sm { padding: 6px 10px; }
  .input, input[type=text], input[type=password], input[type=number], input[type=date], input[type=month], input[type=email], input[type=tel], select, textarea { padding: 9px 11px; font-size: 16px; }
  .field { margin-bottom: 10px; }
  /* ตาราง: ไม่ตัดคำทีละพยางค์ — เลื่อนซ้ายขวาแทน */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .card .table-wrap:not(.card) { margin: 0 -14px; padding: 0 14px; }
  .table-wrap table.t th, .table-wrap table.t td { white-space: nowrap; }
  table.t { font-size: .88rem; }
  table.t th { padding: 8px 8px; }
  table.t td { padding: 9px 8px; }
  /* แถบกรอง (วันที่/สถานะ) */
  form.row > input, form.row > select { flex: 1 1 130px; width: auto; max-width: none !important; }
  .filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: 100%; }
  .filters input, .filters select { width: 100%; max-width: none; }
  .filters .full, .filters .chips { grid-column: 1 / -1; }
  .filters .sep { display: none; }
  .li.stack-sm { flex-wrap: wrap; }
  .li.stack-sm .li-main { flex: 1 1 100%; }
  .li.stack-sm .li-act { width: 100%; justify-content: flex-start; }
  /* modal = bottom sheet เต็มกว้าง */
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal, .modal.wide { max-width: none; border-radius: 18px 18px 0 0; max-height: 92vh; padding: 16px 16px 20px; }
  /* modal ที่มีช่องพิมพ์: ลอยตอนบน กันคีย์บอร์ดบัง (Sunmi/มือถือ) */
  .modal-bg.modal-top { align-items: flex-start; padding: 10vh 12px 12px; }
  .modal-bg.modal-top .modal, .modal-bg.modal-top .modal.wide { border-radius: 18px; max-height: 55vh; }
  .modal-bg.modal-top .modal-head { position: static; margin: 0 0 12px; padding: 0; border-bottom: 0; }
  .modal-head { position: sticky; top: -16px; background: var(--card); z-index: 2; margin: -16px -16px 12px; padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
  .modal-close { width: 36px; height: 36px; font-size: 1.6rem; }
  .pitem { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; }
  .pitem .pact { grid-column: 2 / -1; justify-content: flex-end; }
  .auth .card { padding: 22px 18px; }
  .toast-wrap { left: 12px; right: 12px; transform: none; }
}

/* ===== nx-lite: เครื่องอ่อน (Sunmi / WebView เก่า) — ตัดเอฟเฟกต์ที่กิน GPU ออกเฉพาะในแอป ===== */
html.nx-lite *,
html.nx-lite *::before,
html.nx-lite *::after {
  transition: none !important;
  animation: none !important;
}
html.nx-lite .card, html.nx-lite .btn, html.nx-lite .modal, html.nx-lite .chip,
html.nx-lite .qcat-card, html.nx-lite .qp, html.nx-lite .qadd, html.nx-lite .qbadge,
html.nx-lite .qact button, html.nx-lite .qsub button, html.nx-lite .qsearch input,
html.nx-lite .qnext-cat, html.nx-lite input, html.nx-lite select, html.nx-lite textarea,
html.nx-lite .li, html.nx-lite .pitem, html.nx-lite .pcat, html.nx-lite .prod,
html.nx-lite .tbl, html.nx-lite .ticket, html.nx-lite .tile, html.nx-lite table.t {
  box-shadow: 0 1px 3px rgba(0,0,0,.10) !important;
}
html.nx-lite .toast { transition: none !important; }
html.nx-lite .modal-bg, html.nx-lite .pbar, html.nx-lite .qp .info { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
html.nx-lite img { image-rendering: auto; }
html.nx-lite .qcat-card:active, html.nx-lite .qp:active, html.nx-lite .pitem:active,
html.nx-lite .btn:active, html.nx-lite .qadd:active { transform: scale(.97); }
