/* POS ตัวอย่าง — สีชุดเดียวกับเว็บร้าน (ชมพูประจำร้าน = ปุ่มหลักปุ่มเดียว) */
:root {
  --primary: #c2185b; --primary-d: #9c1149; --primary-l: #fce4ec; --bg: #fff5f8; --card: #fff;
  --text: #2b2b2b; --muted: #6b6b6b; --line: #ececec; --green: #2e7d32; --red: #c62828; --orange: #e65100; --blue: #1565c0;
  --r: 14px; --shadow: 0 1px 3px rgba(0,0,0,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: 'Sarabun', 'Noto Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 12px; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.pri { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
button.pri:hover:not(:disabled) { background: var(--primary-d); }
button.ghost { background: transparent; border-color: transparent; }
button.danger { color: var(--red); border-color: #f3c7c7; }
input, select, textarea { border: 1px solid #d9d9d9; border-radius: 10px; padding: 9px 11px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-l); border-color: var(--primary); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.green { color: var(--green); } .red { color: var(--red); } .orange { color: var(--orange); } .blue { color: var(--blue); }
.row { display: flex; gap: 8px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; }
.chip { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #f3f3f3; color: #555; white-space: nowrap; }
.chip.pink { background: var(--primary-l); color: var(--primary); }
.chip.green { background: #e8f5e9; color: var(--green); } .chip.red { background: #ffebee; color: var(--red); } .chip.orange { background: #fff3e0; color: var(--orange); }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* แถบบน */
.bar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--line); }
.bar .title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 48vw; }
@media (max-width: 480px) { #who { display: none; } .demo-banner { font-size: 12px; } .scanbox input { font-size: 17px; } }
.bar .tag { font-size: 12px; background: var(--primary-l); color: var(--primary); border-radius: 99px; padding: 2px 8px; font-weight: 700; }
.bar .sp { flex: 1; }
.bar a.home, .bar button.icon { text-decoration: none; font-size: 20px; padding: 4px 8px; border: none; background: transparent; }
.demo-banner { background: #fff8e1; color: #6d4c00; font-size: 13px; padding: 6px 12px; border-bottom: 1px solid #f3e2a9; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--green); vertical-align: middle; }
.dot.off { background: var(--orange); }

/* หน้าขาย */
.sale { display: grid; grid-template-columns: 1fr; gap: 12px; padding: 12px; max-width: 1280px; margin: 0 auto; padding-bottom: 120px; }
@media (min-width: 900px) { .sale { grid-template-columns: 1fr 360px; padding-bottom: 12px; } }
.sale > section, .sale > aside, .adm > main, .adm > nav { min-width: 0; }
.scanbox { display: flex; gap: 8px; }
.scanbox input { font-size: 20px; padding: 12px 14px; min-width: 0; }
.last { display: flex; gap: 12px; align-items: center; min-height: 64px; }
.last img, .thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; background: #f4f4f4; flex: none; }
.last .nm { font-weight: 700; }
.last .pr { font-size: 26px; font-weight: 800; }
.cart { list-style: none; margin: 0; padding: 0; }
.cart li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.cart li:hover { background: #fffafc; }
.cart li.flash { animation: flash 1s ease-out; }
@keyframes flash { from { background: var(--primary-l); } to { background: transparent; } }
.cart .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart .amt { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.cart .sub { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 28px 8px; }
.side .sum .r { display: flex; justify-content: space-between; padding: 3px 0; }
.side .total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px dashed #ddd; margin-top: 6px; padding-top: 8px; }
.side .total b { font-size: 40px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.paybtn { width: 100%; font-size: 22px; padding: 16px; margin-top: 10px; }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
@media (max-width: 899px) {
  .side .sum { display: none; }
  .paybar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #fff; border-top: 1px solid var(--line); padding: 10px 12px; display: flex; gap: 10px; align-items: center; }
  .paybar .t { flex: 1; } .paybar .t b { font-size: 28px; color: var(--primary); font-weight: 800; }
  .paybar .paybtn { width: auto; margin: 0; padding: 12px 18px; font-size: 18px; }
  .side .paybtn.desk { display: none; }
}
@media (min-width: 900px) { .paybar { display: none; } }

/* แผ่นซ้อน */
.ov { position: fixed; inset: 0; background: rgba(20,10,15,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 1000; }
@media (min-width: 700px) { .ov { align-items: center; } }
.sheet { background: #fff; width: 100%; max-width: 560px; max-height: 92vh; display: flex; flex-direction: column; border-radius: 18px 18px 0 0; box-shadow: 0 -4px 24px rgba(0,0,0,.18); }
@media (min-width: 700px) { .sheet { border-radius: 18px; } }
.sheet.wide { max-width: 980px; }
.sheet .hd { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.sheet .hd b { flex: 1; font-size: 18px; }
.sheet .bd { padding: 14px; overflow: auto; flex: 1; }
.sheet .ft { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); background: #fff; border-radius: 0 0 18px 18px; }
.sheet .ft > * { flex: 1; }
.big { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.list .it { display: flex; gap: 10px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list .it:hover { background: #fffafc; }
.list .it .tx { flex: 1; min-width: 0; }
.list .it .tx b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fld { margin-bottom: 12px; }
.fld > label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.fld .hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
.seg { display: inline-flex; border: 1px solid #d9d9d9; border-radius: 10px; overflow: hidden; }
.seg button { border: none; border-radius: 0; padding: 7px 12px; background: #fff; }
.seg button.on { background: var(--primary); color: #fff; }

/* PIN */
.pin-dots { display: flex; justify-content: center; gap: 12px; margin: 10px 0 14px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--primary); }
.pin-dots i.on { background: var(--primary); }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 320px; margin: 0 auto; }
.pinpad button { font-size: 26px; padding: 14px 0; border-radius: 14px; }
.names { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 8px; }
.names button { padding: 14px 8px; }
.names button.on { border-color: var(--primary); background: var(--primary-l); color: var(--primary); font-weight: 700; }

/* สลิป */
.slip { font-family: 'Courier New', ui-monospace, monospace; font-size: 13px; line-height: 1.35; background: #fffdf7; border: 1px dashed #d8cfb5; border-radius: 8px; padding: 12px; white-space: pre; overflow-x: auto; margin: 0; }
@media print {
  body.printing > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }
  #printArea .slip { border: none; background: #fff; padding: 0; font-size: 11px; }
  @page { margin: 3mm; }
}
#printArea { display: none; }

/* แจ้งเตือนสั้น */
.toasts { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: min(92vw, 520px); }
.toast { background: #333; color: #fff; padding: 9px 14px; border-radius: 10px; box-shadow: 0 4px 14px rgba(0,0,0,.2); font-size: 15px; }
.toast.ok { background: var(--green); } .toast.bad { background: var(--red); } .toast.warn { background: var(--orange); }

/* หลังร้าน */
.adm { display: grid; grid-template-columns: 1fr; gap: 12px; padding: 12px; max-width: 1200px; margin: 0 auto; }
@media (min-width: 900px) { .adm { grid-template-columns: 220px 1fr; } }
.nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
@media (min-width: 900px) { .nav { flex-direction: column; overflow: visible; } }
.nav button { text-align: left; white-space: nowrap; border-color: transparent; background: transparent; }
.nav button.on { background: #fff; border-color: var(--line); color: var(--primary); font-weight: 700; box-shadow: var(--shadow); }
.nav .n { float: right; font-size: 12px; color: var(--muted); margin-left: 6px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: #fff; border-radius: 12px; padding: 12px; box-shadow: var(--shadow); cursor: pointer; }
.kpi b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 13px; color: var(--muted); }
table.t { width: 100%; border-collapse: collapse; }
table.t th, table.t td { padding: 7px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.t th { font-size: 13px; color: var(--muted); font-weight: 600; }
.sku { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px; }
.sku .hd2 { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.prices { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.bcs .chip { margin: 2px; }
pre.json { background: #f7f7f7; border-radius: 8px; padding: 10px; font-size: 12px; overflow: auto; max-height: 50vh; white-space: pre-wrap; word-break: break-all; }
.launch { max-width: 720px; margin: 0 auto; padding: 18px 14px 40px; }
.launch .big-btn { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; padding: 16px; font-size: 18px; margin-bottom: 10px; border-radius: 16px; }
.launch .big-btn i { font-style: normal; font-size: 30px; }
.launch .big-btn small { display: block; color: var(--muted); font-size: 13px; }
.loading { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px; z-index: 5000; font-size: 18px; }
.spin { width: 36px; height: 36px; border: 4px solid var(--primary-l); border-top-color: var(--primary); border-radius: 50%; animation: sp 1s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.qrbox { display: flex; justify-content: center; padding: 8px; }
.qrbox svg { width: 240px; height: 240px; }
