:root {
  --bg: #101217;
  --surface: #181b22;
  --surface2: #20242d;
  --sunk: #14171d;
  --line: #2a2f3a;
  --line2: #3a4150;
  --text: #f1f1ec;
  --muted: #a0a6b2;
  --dim: #8c93a0;
  --accent: #c8f03c;
  --accent-ink: #101217;
  --accent-fg: #c8f03c;
  --accent-hover: #e2ff7a;
  --accent-soft: #1a2310;
  --accent-line: #3f4f1a;
  --amber: #f5b84b;
  --amber-bg: #2a2213;
  --amber-line: #5a4520;
  --amber-text: #f5d9a0;
  --red: #ff9a80;
  --red-bg: #1f1512;
  --red-line: #4a2419;
  --red-text: #e8d5cf;
  --blue-bg: #1e2945;
  --blue-line: #334a7a;
  --blue-text: #d5e0ff;
  --blue-icon: #9db8ff;
  --violet: #c9a6ff;
  --violet-bg: #241c36;
  --violet-line: #4b3b70;
  --green-text: #e4edcc;
  --pill-text: #c9cdd4;
  --ok-bg: #243012;
  --bad-bg: #3a1a12;
  --warn-bg: #33280f;
  --new-bg: #1c2016;
  --online: #d8f59a;
  --tabbar-bg: rgba(20, 23, 29, .96);
  --shadow: rgba(0, 0, 0, .4);
  --tile-bg: #000;
  --tile-line: #3a3f4b;
  --tile-fg: #fff;
  --tile-on-bg: #fff;
  --tile-on-fg: #000;
  color-scheme: dark;
  --radius: 14px;
  --display: 'Chakra Petch', 'IBM Plex Sans Thai', sans-serif;
  --body: 'IBM Plex Sans Thai', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); line-height: 1.55; }
body { min-height: 100vh; -webkit-text-size-adjust: 100%; }
a { color: var(--accent-fg); }
a:hover { color: var(--accent-hover); }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
img, svg { max-width: 100%; }
.btn > svg { max-width: none; flex-shrink: 0; }
h1, h2, h3 { margin: 0; font-family: var(--display); line-height: 1.3; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 600; }
p { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono { font-family: var(--mono); }
.num { font-family: var(--display); font-weight: 700; }
.accent { color: var(--accent-fg); }
.amber { color: var(--amber); }
.red { color: var(--red); }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 6px; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.grow { flex-grow: 1; min-width: 0; }
.center { text-align: center; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-fg); text-decoration: underline; cursor: pointer; }

.test-banner { background: #b3261e; color: #fff; text-align: center; font-size: 13px; font-weight: 600; padding: 6px 12px; }

.wrap { max-width: 440px; margin: 0 auto; padding: 16px 20px 40px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; margin-bottom: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: .02em; line-height: 1; color: var(--text); text-decoration: none; }
.brand b { color: var(--accent-fg); font-weight: 700; }
.brand .mark { flex-shrink: 0; display: block; }
.brand .wm { display: inline-flex; align-items: center; white-space: nowrap; }
.brand .ko { width: .74em; height: .74em; margin: 0 .04em; flex-shrink: 0; }

/* แถบเมนูด้านล่าง (หน้าลูกค้า) */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--tabbar-bg); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); backdrop-filter: blur(8px); }
.tabbar .tabs-in { max-width: 480px; margin: 0 auto; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.tabbar .tabs-in a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; color: var(--muted); font-size: 11px; font-weight: 500; text-decoration: none; }
.tabbar .tabs-in a svg { width: 22px; height: 22px; }
.tabbar .tabs-in a.on { color: var(--accent-fg); }
.tabbar .tabs-in a:hover { color: var(--text); }
.tabbar .tabs-in a.on:hover { color: var(--accent-fg); }
.tabbar .railbrand, .tabbar .railfoot { display: none; }
body.has-tabbar { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
body.has-tabbar .buybar { bottom: calc(70px + env(safe-area-inset-bottom)); }
body.has-tabbar .chat { height: calc(100vh - 210px); height: calc(100dvh - 210px); min-height: 380px; }
.menulist .menurow { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.menulist .menurow:last-child { border-bottom: 0; }
.menulist .menurow:hover { background: var(--surface2); }
.avatar { width: 44px; height: 44px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; background: var(--accent-soft); color: var(--accent-fg); }
.iconbtn { width: 44px; height: 44px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--text); cursor: pointer; text-decoration: none; }
.iconbtn:hover { color: var(--text); border-color: var(--line2); }
.backrow { display: flex; align-items: center; gap: 12px; min-height: 48px; margin-bottom: 20px; font-size: 16px; font-weight: 500; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.sunk { background: var(--sunk); }
.card.flush { padding: 0; overflow: hidden; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 14px; border: 1px solid; }
.note > svg { flex-shrink: 0; margin-top: 2px; }
.note.amber { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber-text); }
.note.amber > svg { color: var(--amber); }
.note.red { background: var(--red-bg); border-color: var(--red-line); color: var(--red-text); }
.note.red > svg { color: var(--red); }
.note.green { background: var(--accent-soft); border-color: var(--accent-line); color: var(--green-text); }
.note.green > svg { color: var(--accent-fg); }
.note.blue { background: var(--blue-bg); border-color: var(--blue-line); color: var(--blue-text); }
.note.blue > svg { color: var(--blue-icon); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--text); font-size: 15px; font-weight: 500; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--line2); color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent-fg); color: var(--accent-ink); font-weight: 600; font-size: 16px; }
.btn.primary:hover { background: #d4f75a; color: var(--accent-ink); }
.btn.block { display: flex; width: 100%; min-height: 54px; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.danger { border-color: var(--red-line); color: var(--red); }
.btn:disabled, .btn.primary:disabled { background: var(--surface2); border-color: var(--surface2); color: var(--dim); cursor: not-allowed; }
/* ปุ่มจ่าย (หน้าสรุปการจอง): ติ๊กเข้าใจเงื่อนไขแล้วเป็นสีเข้มของธีมนั้น (ตามโทนสีที่เลือก) พร้อมกด */
.btn.gobtn:not(:disabled), .btn.gobtn:not(:disabled):hover { background: var(--accent-fg); border-color: var(--accent-fg); color: var(--bg); }
.btn.gobtn:not(:disabled):hover { filter: brightness(.92); }
/* ปุ่มคัดลอก (ซ้าย) / โหลดไฟล์ (ขวา) ในหน้าออเดอร์ */
.copygrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.copygrid .btn { padding: 0 8px; gap: 6px; font-size: 14px; }
.morecopy > summary { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 40px; padding: 0 12px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font: 600 13px var(--body); cursor: pointer; list-style: none; -webkit-tap-highlight-color: transparent; }
.morecopy > summary::-webkit-details-marker { display: none; }
.morecopy > summary:focus-visible { outline: 2px solid var(--accent-fg); outline-offset: 2px; }
.morecopy > summary svg { width: 16px; height: 16px; flex-shrink: 0; transform: rotate(90deg); transition: transform .15s; }
.morecopy[open] > summary svg { transform: rotate(-90deg); }
.morecopy > .copygrid { margin-top: 8px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .label { font-size: 13px; font-weight: 500; }
.input, .select, .textarea { width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--text); outline: none; font-size: 15px; }
.textarea { padding: 12px 14px; min-height: 90px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent-fg); }
.input::placeholder, .textarea::placeholder { color: var(--dim); }
.input.big { min-height: 64px; font-family: var(--mono); font-size: 30px; letter-spacing: .45em; text-align: center; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent-fg); flex-shrink: 0; }
.error { color: var(--red); font-size: 13px; }

.trust { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.trust div { display: flex; flex-direction: column; gap: 6px; padding: 12px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; font-size: 12px; line-height: 1.45; }
.trust svg { color: var(--accent-fg); }

.opts { display: flex; flex-direction: column; gap: 10px; border: 0; padding: 0; margin: 0; }
.opt .prodnote { color: var(--accent-fg); font-weight: 500; }
.opt { display: flex; align-items: center; gap: 14px; min-height: 76px; padding: 12px 16px; border-radius: var(--radius); background: var(--surface); border: 1.5px solid var(--line); cursor: pointer; }
.opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opt .dot { width: 22px; height: 22px; flex-shrink: 0; border-radius: 999px; border: 2px solid var(--line2); display: flex; align-items: center; justify-content: center; }
.opt .dot::after { content: ''; width: 10px; height: 10px; border-radius: 999px; background: transparent; }
.opt:has(input:checked) { background: var(--accent-soft); border-color: var(--accent-fg); }
.opt:has(input:checked) .dot { border-color: var(--accent-fg); }
.opt:has(input:checked) .dot::after { background: var(--accent); }
.opt:has(input:focus-visible) { outline: 2px solid var(--accent-fg); outline-offset: 2px; }
.opt.soldout { opacity: .5; cursor: not-allowed; }
.modes { display: flex; flex-direction: column; gap: 8px; border: 0; padding: 0; margin: 0 0 12px; }
.mode { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius); background: var(--surface); border: 1.5px solid var(--line); cursor: pointer; }
.mode input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mode .dot { width: 20px; height: 20px; flex-shrink: 0; border-radius: 999px; border: 2px solid var(--line2); display: flex; align-items: center; justify-content: center; }
.mode .dot::after { content: ''; width: 9px; height: 9px; border-radius: 999px; background: transparent; }
.mode:has(input:checked) { background: var(--accent-soft); border-color: var(--accent-fg); }
.mode:has(input:checked) .dot { border-color: var(--accent-fg); }
.mode:has(input:checked) .dot::after { background: var(--accent); }
.mode:has(input:focus-visible) { outline: 2px solid var(--accent-fg); outline-offset: 2px; }
.nc-hint { margin: 2px 2px 0; color: var(--accent-fg); font-weight: 600; }
.opt .name { font-family: var(--display); font-size: 18px; font-weight: 600; }
/* ไอคอนตัว T ขาวดำ: ปกติพื้นดำตัวขาว เลือกอยู่พื้นขาวตัวดำ */
.opticon { width: 42px; height: 42px; flex-shrink: 0; margin-left: -4px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--tile-bg); border: 1px solid var(--tile-line); color: var(--tile-fg); }
.opticon svg { width: 24px; height: 24px; }
.opt:has(input:checked) .opticon { background: var(--tile-on-bg); border-color: var(--tile-on-bg); color: var(--tile-on-fg); }
.tmini { width: 22px; height: 22px; flex-shrink: 0; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; background: var(--tile-bg); border: 1px solid var(--tile-line); color: var(--tile-fg); }
.tmini svg { width: 14px; height: 14px; }
.cattab.on .tmini { background: var(--tile-on-bg); border-color: var(--tile-on-bg); color: var(--tile-on-fg); }
@media (max-width: 380px) { .opt { gap: 10px; padding: 12px; } .opticon { width: 36px; height: 36px; border-radius: 10px; } .opticon svg { width: 20px; height: 20px; } }
@media (max-width: 340px) { .opticon { display: none; } }
.opt .price { font-family: var(--display); font-size: 20px; font-weight: 700; color: var(--accent-fg); text-align: right; }

.stepper { display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.stepper button { width: 44px; height: 44px; border: 0; border-radius: 10px; background: var(--surface2); color: var(--text); font-size: 22px; cursor: pointer; }
.stepper input { width: 64px; height: 44px; border: 0; background: transparent; color: var(--text); text-align: center; font-family: var(--display); font-size: 20px; font-weight: 700; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.buybar { position: sticky; bottom: 12px; display: flex; align-items: center; gap: 16px; padding: 12px 12px 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 30px var(--shadow); }
.buybar .btn { flex-grow: 1; }
.buybar .buybtns { display: flex; flex-direction: column; gap: 6px; flex-grow: 1; }
.buybar .buybtns .btn { min-height: 40px; }
.walletchip { display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 6px 0 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 14px; }
.walletchip svg { color: var(--accent-fg); width: 18px; height: 18px; }
.walletchip .plus { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.amountchips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.amountchips button { min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.amountchips button.on { background: var(--accent-soft); border-color: var(--accent-fg); color: var(--accent-fg); }
.amountchips button small { display: block; margin-top: 1px; font-size: 11px; font-weight: 500; color: var(--accent-fg); line-height: 1.2; }
.amountchips button:has(small) { min-height: 52px; }
.bonuspreview { margin: 0; color: var(--muted); }
.bonuspreview.has { color: var(--accent-fg); font-weight: 600; }
.bonuspreview:empty { display: none; }
.txrow { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.txrow:last-child { border-bottom: 0; }
.txrow .plus { color: var(--accent-fg); }
.txrow .minus { color: var(--text); }

.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist svg { color: var(--accent-fg); flex-shrink: 0; margin-top: 3px; }
.numlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; counter-reset: n; }
.numlist li { display: flex; gap: 12px; font-size: 14px; counter-increment: n; }
.numlist li::before { content: counter(n); width: 26px; height: 26px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 999px; background: var(--surface2); font-family: var(--display); font-size: 13px; font-weight: 600; color: var(--accent-fg); }

.progress { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.progress li { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--dim); }
.progress li::before { content: ''; height: 4px; border-radius: 2px; background: var(--line); }
.progress li.done { color: var(--text); }
.progress li.done::before { background: var(--accent); }
.progress li.now { color: var(--amber); }
.progress li.now::before { background: var(--amber); }

.qrbox { width: 232px; max-width: 100%; margin: 0 auto; padding: 8px; background: #fff; border-radius: 14px; }
.qrbox svg, .qrbox img { display: block; width: 100%; height: auto; }
.amount { font-family: var(--display); font-size: 36px; font-weight: 700; line-height: 1.2; }
.divider { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.divider::before, .divider::after { content: ''; flex-grow: 1; height: 1px; background: var(--line); }

.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 148px; padding: 16px; border-radius: var(--radius); background: var(--sunk); border: 1.5px dashed var(--line2); color: var(--text); cursor: pointer; text-align: center; }
.drop .ico { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }
.drop.has { border-style: solid; border-color: var(--accent-line); background: var(--accent-soft); }

.verify-steps { list-style: none; margin: 0; padding: 4px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.verify-steps li { display: flex; align-items: center; gap: 12px; min-height: 58px; border-top: 1px solid var(--line); font-size: 15px; color: var(--dim); }
.verify-steps li:first-child { border-top: 0; }
.verify-steps .st { width: 26px; height: 26px; flex-shrink: 0; border-radius: 999px; border: 2px solid var(--line2); display: flex; align-items: center; justify-content: center; }
.verify-steps li.active { color: var(--text); }
.verify-steps li.active .st { border-color: var(--accent-fg); border-top-color: transparent; animation: spin .9s linear infinite; }
.verify-steps li.done { color: var(--text); }
.verify-steps li.done .st { background: var(--accent); border-color: var(--accent-fg); color: var(--accent-ink); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ไอดีที่ซื้อ: แถวเล็กกะทัดรัด (เลข · ยูส/รหัส · ปุ่มคัดลอก) */
.acctlist { display: flex; flex-direction: column; gap: 6px; }
.acct { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.acct.found { border-color: var(--accent-fg); box-shadow: 0 0 0 2px var(--accent-soft); scroll-margin-top: 80px; }
.acct dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 1px 8px; font-size: 13px; line-height: 1.35; flex-grow: 1; min-width: 0; }
.acct dt { color: var(--muted); font-size: 11.5px; }
.acct dd { margin: 0; font-family: var(--mono); overflow-wrap: anywhere; min-width: 0; }
.acct dd.userdd { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.userdd > span { min-width: 0; overflow-wrap: anywhere; }
.acct .pill { height: 18px; padding: 0 7px; font-size: 10.5px; font-family: var(--body); }
.acct .iconbtn { width: 36px; height: 36px; min-height: 36px; flex-shrink: 0; }
.copychip { display: inline-flex; align-items: center; padding: 2px 10px; min-height: 26px; border-radius: 999px; border: 1px solid var(--line); background: var(--sunk); color: var(--muted); font: 600 12px var(--body); cursor: pointer; vertical-align: middle; }
.acct .copychip { min-height: 20px; padding: 0 8px; font-size: 10.5px; }
.copychip:active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent-fg); }
.masked .secret { display: none; }
.masked .mask { display: inline; white-space: nowrap; }
.mask { display: none; }
.acct.replaced { opacity: .55; }
/* รายการไอดีในหน้าออเดอร์ (กล่องสีม่วง): ซ่อนไว้ กดหัวข้อแล้วค่อยกาง */
details.bstep.acctfold { display: block; }
.acctfold > summary { cursor: pointer; list-style: none; -webkit-tap-highlight-color: transparent; flex-wrap: nowrap; }
.acctfold > summary::-webkit-details-marker { display: none; }
.acctfold > summary:focus-visible { outline: 2px solid var(--sc); outline-offset: 4px; border-radius: 8px; }
.acctfold .foldbtn { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; min-height: 36px; padding: 0 10px 0 12px; border-radius: 10px; border: 1px solid var(--sc); background: var(--sc-bg); color: var(--sc); font: 600 13px var(--body); white-space: nowrap; }
.acctfold .foldbtn svg { width: 16px; height: 16px; transform: rotate(90deg); transition: transform .15s; }
.acctfold[open] .foldbtn svg { transform: rotate(-90deg); }
.acctfold .fold-hide, .acctfold[open] .fold-show { display: none; }
.acctfold[open] .fold-hide { display: inline; }
.copyready { margin: 0; }
.acctfold-body { padding-top: 12px; }
.bnum svg { width: 15px; height: 15px; }
.claimnote { margin: 0; color: var(--muted); }
.claimnote b { color: var(--amber); }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface2); color: var(--pill-text); }
.pill.ok { background: var(--ok-bg); color: var(--accent-fg); }
.pill.bad { background: var(--bad-bg); color: var(--red); }
.pill.warn { background: var(--warn-bg); color: var(--amber); }
.pill.info { background: var(--blue-bg); color: var(--blue-icon); }

.chat { display: flex; flex-direction: column; height: calc(100vh - 140px); min-height: 480px; }
.chat .msgs { flex-grow: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 14px 0; }
.bubble { max-width: 82%; display: flex; flex-direction: column; gap: 2px; }
.bubble .b { padding: 10px 14px; border-radius: 16px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.them { align-self: flex-start; }
.bubble.them .b { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble.me { align-self: flex-end; align-items: flex-end; }
.bubble.me .b { background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.bubble .t { font-size: 11px; color: var(--dim); }
.sysmsg { align-self: center; max-width: 92%; padding: 6px 12px; border-radius: 999px; background: var(--sunk); border: 1px solid var(--line); font-size: 12px; color: var(--muted); text-align: center; }
.composer { display: flex; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
/* แชท: รูป · แนบออเดอร์ */
.composer > .iconbtn { cursor: pointer; }
.composer label.iconbtn:focus-within { outline: 2px solid var(--accent-fg); outline-offset: 2px; }
.chatattach { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 6px 6px 6px 12px; border: 1px solid var(--accent-fg); border-radius: 12px; background: var(--accent-soft); font-size: 13px; min-width: 0; }
.chatattach .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatattach .iconbtn { width: 32px; height: 32px; }
.pickorder { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 10px 12px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--text); cursor: pointer; font: inherit; }
.pickorder:hover, .pickorder:focus-visible { border-color: var(--accent-fg); }
.bubble .b.pic { padding: 4px; }
.bubble .b.pic:not(:has(.chatorder)) { background: none; border: 0; }
.chatimg { display: block; line-height: 0; }
.chatimg img { display: block; max-width: min(240px, 100%); max-height: 320px; border-radius: 12px; border: 1px solid var(--line); object-fit: cover; background: var(--sunk); }
.chatimg.gone { line-height: 1.4; padding: 8px 10px; font-size: 12px; color: var(--muted); }
.chatorder { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; margin: 0 0 6px; border-radius: 10px; background: var(--surface); color: var(--text); border: 1px solid var(--line); text-decoration: none; white-space: normal; font-size: 13px; }
.chatorder span { font-size: 12px; color: var(--muted); }
.b > .chatorder:last-child { margin-bottom: 0; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(8, 9, 12, .82); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { width: 100%; max-width: 420px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.modal .mhead { padding: 22px 20px 12px; display: flex; flex-direction: column; gap: 6px; }
.modal .mbody { padding: 4px 20px 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal .mfoot { padding: 14px 20px 20px; border-top: 1px solid var(--line); background: var(--sunk); display: flex; flex-direction: column; gap: 12px; }
.yesno { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.yesno > div { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 12px; font-size: 13px; border: 1px solid; }
.yesno .yes { background: var(--accent-soft); border-color: var(--accent-line); color: var(--green-text); }
.yesno .no { background: var(--red-bg); border-color: var(--red-line); color: var(--red-text); }
.yesno b { display: flex; align-items: center; gap: 6px; }
.yesno .yes b { color: var(--accent-fg); }
.yesno .no b { color: var(--red); }

.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; }
.chip span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; cursor: pointer; text-align: center; }
.chip input:checked + span { background: var(--accent); border-color: var(--accent-fg); color: var(--accent-ink); font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--accent-fg); outline-offset: 2px; }
.pick { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; }
.pick input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent-fg); }
.pick:has(input:checked) { background: var(--accent-soft); border-color: var(--accent-fg); }

/* ---------- หลังบ้าน ---------- */
.admin { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--sunk); border-right: 1px solid var(--line); padding: 24px 16px; display: flex; flex-direction: column; gap: 28px; }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.side a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--pill-text); font-size: 14px; text-decoration: none; }
.side a:hover { background: var(--surface); color: var(--text); }
.side a.on { background: var(--surface2); color: var(--accent-fg); font-weight: 600; }
.side .sm { display: none; }
.sidelogout { margin-top: auto; }
.side .badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; display: flex; align-items: center; justify-content: center; border-radius: 999px; background: #ff7a59; color: var(--accent-ink); font-size: 11px; font-weight: 700; }
.amain { padding: 32px; display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.kpi .v { font-family: var(--display); font-size: 28px; font-weight: 700; line-height: 1.25; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--sunk); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--text); font-size: 13px; text-decoration: none; }
.tabs a.on { background: var(--accent); border-color: var(--accent-fg); color: var(--accent-ink); font-weight: 600; }
.cols2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.cols3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.rule { display: flex; align-items: center; gap: 12px; min-height: 60px; border-top: 1px solid var(--line); }
.rule:first-of-type { border-top: 0; }
/* สวิตช์เปิด/ปิด: ช่องติ๊กจริงวางทับด้านบน (โปร่งใส) และขยายพื้นที่กดรอบๆ ให้กดติดง่ายบน iPhone */
.switch { position: relative; display: inline-block; width: 48px; height: 28px; flex-shrink: 0; -webkit-tap-highlight-color: transparent; }
.switch input { -webkit-appearance: none; appearance: none; position: absolute; top: -5px; right: -12px; bottom: -5px; left: -12px; width: auto; height: auto; margin: 0; padding: 0; border: 0; border-radius: 999px; background: transparent; opacity: 1; cursor: pointer; z-index: 1; }
.switch span { position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: 999px; background: var(--line2); pointer-events: none; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 999px; background: var(--text); transition: left .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { left: 23px; background: var(--accent-ink); }
.switch input:focus-visible + span { outline: 2px solid var(--accent-fg); outline-offset: 2px; }
.lockpill { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--surface2); font-size: 12px; color: var(--pill-text); }
.inbox { display: grid; grid-template-columns: 290px minmax(0, 1fr) 300px; min-height: calc(100vh - 64px); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.inbox > * { min-width: 0; }
.inbox .list { border-right: 1px solid var(--line); overflow-y: auto; max-height: calc(100vh - 64px); }
.inbox .list a { display: flex; flex-direction: column; gap: 3px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.inbox .list a.on { background: var(--surface2); }
.inbox .conv { display: flex; flex-direction: column; min-height: 0; }
.inbox .conv .msgs { flex-grow: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 16px 20px; max-height: calc(100vh - 260px); }
.inbox .detail { border-left: 1px solid var(--line); background: var(--sunk); padding: 20px 18px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; max-height: calc(100vh - 64px); }
.kv { margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.bar { height: 6px; border-radius: 3px; background: var(--surface2); overflow: hidden; }
.bar i { display: block; height: 6px; background: var(--accent); }
.bar.low i { background: var(--amber); }
.login-card { max-width: 420px; margin: 10vh auto; }

@media (max-width: 900px) {
  .admin { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  /* มือถือ: แถบบนติดหัวจอ ชื่อร้าน + ออกจากระบบ แล้วเมนูเป็นแถวเดียวปัดซ้าย-ขวาได้ */
  .side { position: sticky; top: 0; z-index: 30; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 8px; padding: 10px 12px 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebrand { grid-column: 1; grid-row: 1; padding: 0 4px !important; }
  .sidelogout { grid-column: 2; grid-row: 1; margin: 0; }
  .sidelogout .btn { min-height: 36px; padding: 0 12px; font-size: 13px; }
  .side nav { grid-column: 1 / -1; grid-row: 2; flex-direction: row; flex-wrap: nowrap; gap: 6px; overflow-x: auto; margin: 0 -12px; padding: 0 12px 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .side nav::-webkit-scrollbar { display: none; }
  .side a { flex-shrink: 0; min-height: 38px; padding: 0 12px; gap: 6px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; white-space: nowrap; }
  .side a svg { width: 16px; height: 16px; }
  .side a.on { background: var(--accent); border-color: var(--accent-fg); color: var(--accent-ink); }
  .side a .badge { margin-left: 2px; }
  .side .lg { display: none; }
  .side .sm { display: inline; }
  .amain { padding: 16px; gap: 16px; }
  /* หัวหน้า: ชื่อหน้ากับปุ่มไม่เบียดกัน */
  .amain > .row.between { flex-wrap: wrap; gap: 12px; }
  .amain > .row.between > .col { flex: 1 1 220px; }
  .kpis, .cols2, .cols3 { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 1fr; }
  .inbox .list, .inbox .detail { max-height: none; border: 0; border-bottom: 1px solid var(--line); }
  .table { display: block; overflow-x: auto; }
}

/* กล่องพับได้ (เช่น ลูกค้าลืมรหัสผ่าน ในหน้าลูกค้า) */
details.card > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: '+'; color: var(--muted); font-size: 22px; line-height: 1; }
details.card[open] > summary::after { content: '−'; }
/* หัวข้อการตั้งค่าหลังบ้าน: ย่อไว้ กดเปิด */
details.topic > summary { min-height: 40px; }
details.topic .topic-title { font-size: 16px; }
details.topic .topic-body { padding-top: 14px; }
details.topic.flush > summary { padding: 14px 18px; }
details.topic.flush .topic-body { padding-top: 0; }
details.topic[open] > summary { border-bottom: 1px solid var(--line, transparent); padding-bottom: 12px; }
details.topic.flush[open] > summary { margin-bottom: 8px; }
.savebar { position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; align-self: flex-start; padding: 8px 12px 8px 8px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line, transparent); box-shadow: 0 6px 20px rgba(0, 0, 0, .12); }

/* ช่องรหัสผ่านที่มีปุ่มแสดงรหัส */
.pwwrap { position: relative; display: block; }
.pwwrap .input { padding-right: 52px; }
.pweye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.pweye:hover { color: var(--text); }
.pweye.on { color: var(--accent-fg); }
.pweye:focus-visible { outline: 2px solid var(--accent-fg); outline-offset: 1px; }
/* เตือนใต้ช่องกรอก */
.field-warn { color: var(--red); font-weight: 500; }
.input.bad { border-color: var(--red); }

/* ประวัติลูกค้า: แสดงเป็นรายการ อ่านง่ายทั้งมือถือและคอม */
.actlist .actrow { display: flex; flex-direction: column; gap: 4px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.actlist .actrow:last-child { border-bottom: 0; }
a.linkrow { color: inherit; text-decoration: none; }
a.linkrow:hover, a.linkrow:focus-visible { background: var(--sunk); }
.kvlist { margin: 0; display: grid; grid-template-columns: minmax(96px, max-content) minmax(0, 1fr); gap: 6px 14px; font-size: 14px; }
.kvlist dt { color: var(--muted); }
.kvlist dd { margin: 0; overflow-wrap: anywhere; }
/* ตารางหลังบ้านบนมือถือ: แสดงเป็นการ์ดทีละรายการ (app.js ใส่ชื่อคอลัมน์ให้แต่ละช่อง) */
@media (max-width: 700px) {
  .table.cards, .table.cards tbody, .table.cards tr, .table.cards td { display: block; width: 100%; }
  .table.cards { overflow: visible; }
  .table.cards thead { display: none; }
  .table.cards tr { padding: 10px 16px; border-bottom: 1px solid var(--line); }
  .table.cards tr:last-child { border-bottom: 0; }
  .table.cards td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 0; border: 0; text-align: right; overflow-wrap: anywhere; }
  .table.cards td::before { content: attr(data-label); flex-shrink: 0; max-width: 45%; color: var(--muted); font-size: 12px; text-align: left; }
  .table.cards td[data-label=""]::before { content: none; }
  .table.cards td[data-label=""] { justify-content: flex-end; }
  .table.cards td:empty { display: none; }
  .table.cards td > .input, .table.cards td > select { flex: 1 1 auto; max-width: 62%; min-width: 0; }
  .table.cards td form, .table.cards td .btn { margin-left: auto; }
  .table.cards td > .col { align-items: flex-end; }
}
@media (max-width: 600px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi .v { font-size: 22px; }
}

/* ช่องค่าลับในหน้าการเชื่อมต่อ: ซ่อนตัวอักษรโดยไม่ใช้ type=password (กันเบราว์เซอร์เติมรหัสผ่านให้เอง) */
.masked-input:not(.reveal) { -webkit-text-security: disc; text-security: disc; }

/* สถานะการตอบของแอดมิน */
.replybadge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 400; }
.replybadge i { width: 8px; height: 8px; border-radius: 999px; background: var(--dim); flex-shrink: 0; }
.replybadge.on { color: var(--online); }
.replybadge.on i { background: var(--accent); box-shadow: 0 0 0 3px rgba(200, 240, 60, .18); }
.replyline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--text); text-decoration: none; font-size: 14px; }
.replyline svg { width: 18px; height: 18px; color: var(--accent-fg); }
.replyline .replybadge { margin-left: auto; }

.soldcount { color: var(--accent-fg); }

/* หมวดหมู่สินค้าบนหน้าร้าน */
.cattabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
.cattabs::-webkit-scrollbar { display: none; }
.cattab { flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 8px 16px; border-radius: 12px; background: var(--surface); border: 1.5px solid var(--line); color: var(--text); text-decoration: none; font-weight: 600; white-space: nowrap; }
.cattab svg { width: 18px; height: 18px; flex-shrink: 0; }
.cattab:hover { color: var(--text); border-color: var(--line2); }
.cattab.on { background: var(--accent-soft); border-color: var(--accent-fg); color: var(--accent-fg); }
.cattab:focus-visible { outline: 2px solid var(--accent-fg); outline-offset: 2px; }
.soontag { font-size: 11px; font-weight: 600; line-height: 1; padding: 4px 7px; border-radius: 999px; background: var(--warn-bg); color: var(--amber); }
.soonbox { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 28px 20px; }
.soonicon { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 16px; background: var(--surface2); color: var(--accent-fg); }
.soonicon svg { width: 28px; height: 28px; }
.soonbtns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }

/* ปุ่มติดต่อแอดมินทาง LINE พร้อมรูปโปรไฟล์ร้าน */
.contactcard { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--text); text-decoration: none; }
a.contactcard:hover { color: var(--text); border-color: var(--line2); }
.contactcard .lineavatar { flex-shrink: 0; display: block; border-radius: 50%; }
.contactcard b { font-size: 15px; }
.contactcard .tiny { line-height: 1.4; }
.linepill { flex-shrink: 0; display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 999px; background: #06c755; color: #0b1a10; font-size: 13px; font-weight: 700; white-space: nowrap; }

/* หน้าต่างเตือนก่อนโอนเงิน + ข้อที่ต้องระวังเป็นพิเศษ */
.paywarn-amount { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 12px; border-radius: 14px; background: var(--red-bg); border: 1px solid var(--red-line); text-align: center; }
.paywarn-amount .amount { font-size: 34px; }
.paywarn-amount .small { color: var(--red-text); }
.numlist li.warnitem > span { color: var(--red-text); }
.numlist li.warnitem > span b { color: var(--red); }
.numlist li.warnitem::before { background: var(--red-bg); color: var(--red); }

/* ไอดีเข้าใหม่: ช่วงเวลาที่ไอดีครบอายุพร้อมขาย */
.incoming { display: flex; flex-direction: column; gap: 12px; }
.inc-tier { display: flex; flex-direction: column; gap: 6px; }
.inc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.inc-list li { display: grid; grid-template-columns: minmax(64px, auto) 1fr auto; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 10px; background: var(--sunk); font-size: 14px; }
.inc-list li b { color: var(--accent-fg); white-space: nowrap; }
.inc-list li.inc-day { grid-template-columns: minmax(0, 1fr) auto; }
.inc-list li.inc-prod { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
details.card.incoming { display: block; }
details.card.incoming > summary::after { content: none; }
.incoming > summary { cursor: pointer; list-style: none; }
.incoming > summary::-webkit-details-marker { display: none; }
.incoming .inc-peek { color: var(--accent-fg); font-weight: 600; display: inline-flex; align-items: center; }
.incoming .inc-peek::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-left: 10px; border-right: 1.6px solid var(--muted, currentColor); border-bottom: 1.6px solid var(--muted, currentColor); transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
.incoming[open] .inc-peek::after { transform: translateY(1px) rotate(-135deg); }
.inc-days { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.inc-days li.inc-day { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; background: var(--surface); }
.inc-days li.inc-day b { color: var(--accent-fg); white-space: nowrap; }
.inc-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); font-size: 14px; }
.inc-total b { color: var(--accent-fg); }
.nw { white-space: nowrap; }

/* หน้าต่างขอบคุณเมื่อได้รับเงินแล้ว */
.thanks .mhead { padding-top: 28px; gap: 8px; }
.thanks .ticon { width: 64px; height: 64px; border-radius: 999px; display: flex; align-items: center; justify-content: center; background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 10px var(--accent-soft); margin-bottom: 8px; }
.thanks .ticon svg { width: 34px; height: 34px; stroke-width: 2.4; }
.thanks .tamount { font-size: 40px; color: var(--accent-fg); line-height: 1.1; }
.trows { margin: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.trows > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.trows > div:last-child { border-bottom: 0; }
.trows dt { color: var(--muted); flex-shrink: 0; }
.trows dd { margin: 0; text-align: right; }
@media (prefers-reduced-motion: no-preference) {
  .thanks { animation: thanks-pop .28s ease-out; }
  .thanks .ticon { animation: thanks-pop .4s .08s ease-out both; }
}
@keyframes thanks-pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* การแจ้งเตือนลูกค้า */
.bellbtn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.bellbtn:hover { color: var(--text); border-color: var(--line2); }
.bellbadge { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: #ff5f45; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid var(--bg); }
.tabbar .tabic { position: relative; display: inline-flex; }
.tabdot { position: absolute; top: -2px; right: -4px; width: 9px; height: 9px; border-radius: 999px; background: #ff5f45; border: 2px solid var(--bg); }
.ntflist .ntf { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.ntflist .ntf:last-child { border-bottom: 0; }
.ntflist .ntf:hover { background: var(--surface2); color: var(--text); }
.ntflist .ntf.new { background: var(--new-bg); }
.ntfic { flex-shrink: 0; width: 36px; height: 36px; border-radius: 999px; display: flex; align-items: center; justify-content: center; background: var(--surface2); }
.ntfic svg { width: 18px; height: 18px; }
.tone-green .ntfic { background: var(--ok-bg); color: var(--accent-fg); }
.tone-red .ntfic { background: var(--bad-bg); color: var(--red); }
.tone-amber .ntfic { background: var(--warn-bg); color: var(--amber); }
.tone-blue .ntfic { background: var(--blue-bg); color: var(--blue-icon); }
.tone-muted .ntfic { color: var(--muted); }
.ntfdot { flex-shrink: 0; width: 9px; height: 9px; margin-top: 6px; border-radius: 999px; background: #ff5f45; }
.ntoast { position: fixed; left: 12px; right: 12px; top: 12px; z-index: 70; max-width: 420px; margin: 0 auto; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--surface2); border: 1px solid var(--accent-line); box-shadow: 0 12px 30px var(--shadow); color: var(--text); text-decoration: none; transform: translateY(-140%); transition: transform .25s ease-out; }
.ntoast.show { transform: translateY(0); }
.ntoast:hover { color: var(--text); }
.ntoast .nti { flex-shrink: 0; color: var(--accent-fg); display: inline-flex; margin-top: 1px; }
.ntoast .ntc { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; color: var(--muted); }
.ntoast .ntc b { color: var(--text); font-size: 14px; }

/* เลขลำดับไอดีในหน้าคำสั่งซื้อ */
.acctno { flex-shrink: 0; min-width: 26px; height: 26px; padding: 0 4px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: var(--accent); color: var(--accent-ink); font-family: var(--display); font-size: 13px; font-weight: 700; }
.acct.replaced .acctno { background: var(--surface2); color: var(--muted); }

/* ซื้อสะสมแถมฟรี + คำเตือนไม่รับเคลมกรณีไม่มีคูปอง */
.loyalty { display: flex; flex-direction: column; gap: 10px; border-color: var(--accent-line); }
.lrow { display: flex; flex-direction: column; gap: 6px; }
.loybar { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--accent-line); border-radius: 14px; background: var(--surface); }
.loybar .ldots { gap: 4px; }
.loybar .ldots i { height: 6px; }
.loybar.off { border-color: var(--line); opacity: .65; }
.loybar.off .ldots { display: none; }
.ldots { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; }
.ldots i { height: 10px; border-radius: 999px; background: var(--surface2); }
.ldots i.on { background: var(--accent); }
.nocoupon { color: var(--red); }
.opt.soldout .nocoupon { color: inherit; }

/* หน้าสถิติ: กราฟแท่ง (สีเดียว แท่งไม่เกิน 24px ปลายมน 4px เส้นตารางบาง) */
.bchart { margin: 0; }
.bplot { position: relative; margin: 18px 0 0 52px; }
.bgrid span { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.bgrid i { position: absolute; right: calc(100% + 6px); top: -8px; font-style: normal; font-size: 11px; line-height: 16px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bbars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.bbars.dense { gap: 1px; }
.bcol { position: relative; flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; outline: none; }
.bbar { width: 100%; max-width: 24px; background: var(--accent); border-radius: 4px 4px 0 0; transition: background .1s; }
.bbars.dense .bbar { border-radius: 2px 2px 0 0; }
.bcol:hover .bbar, .bcol.hover .bbar { background: var(--accent-hover); }
.bcol:focus-visible { outline: 2px solid var(--accent-fg); outline-offset: 1px; border-radius: 4px; }
.bpeak { position: absolute; left: 50%; transform: translate(-50%, -4px); margin-bottom: 0; font-size: 11px; font-weight: 600; color: var(--text); white-space: nowrap; pointer-events: none; }
.bx { display: flex; justify-content: space-between; margin: 6px 0 0 52px; font-size: 11px; color: var(--muted); }
.ctip { position: fixed; z-index: 80; display: flex; flex-direction: column; gap: 1px; padding: 6px 10px; border-radius: 8px; background: var(--surface2); border: 1px solid var(--line2); font-size: 12px; color: var(--muted); pointer-events: none; box-shadow: 0 6px 18px var(--shadow); }
.ctip b { color: var(--text); font-size: 14px; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hrow { display: grid; grid-template-columns: minmax(96px, 40%) 1fr auto; gap: 10px; align-items: center; }
.htrack { height: 14px; border-left: 1px solid var(--line2); }
.htrack i { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.tabview summary { cursor: pointer; }
.tabview .table { margin-top: 8px; }
.tscroll { overflow-x: auto; }
.daytable { min-width: 560px; }
.daytable tr.muted td { color: var(--muted); }
.kpi .v.red { color: var(--red); }
.daytable td, .daytable th { white-space: nowrap; }
@media (max-width: 700px) { .daytable td, .daytable th { padding: 10px 10px; } }

/* สมัครสมาชิก: เช็กชื่อผู้ใช้ระหว่างพิมพ์ + ชื่อที่แนะนำ */
.uname-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 0; }
.uname-status:empty { display: none; }
.uname-status .ok { color: var(--accent-fg); }
.uname-status .bad { color: var(--red); }
.namechip { padding: 4px 12px; min-height: 30px; border-radius: 999px; border: 1px solid var(--accent-fg); background: var(--accent-soft); color: var(--accent-fg); font: 600 13px var(--mono); cursor: pointer; }
.namechip:active { background: var(--accent); color: var(--accent-ink); }

/* ธีมสว่าง: เลือกได้จากปุ่มสลับธีม (จำไว้ในคุกกี้) */
:root[data-theme="light"] {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface2: #eceef2;
  --sunk: #f0f1f4;
  --line: #dde0e6;
  --line2: #c6cbd4;
  --text: #15171c;
  --muted: #5a616d;
  --dim: #646b78;
  --accent: #c8f03c;
  --accent-ink: #101217;
  --accent-fg: #4a7300;
  --accent-hover: #365600;
  --accent-soft: #f0f8da;
  --accent-line: #b9d977;
  --amber: #9a5d00;
  --amber-bg: #fff5de;
  --amber-line: #efcf8c;
  --amber-text: #5a3900;
  --red: #c0331f;
  --red-bg: #fdeeeb;
  --red-line: #f2bbb0;
  --red-text: #5c1c12;
  --blue-bg: #e9effd;
  --blue-line: #b9c9f1;
  --blue-text: #1d3772;
  --blue-icon: #3555c8;
  --violet: #6a3dc2;
  --violet-bg: #f3eefd;
  --violet-line: #cfbcf2;
  --green-text: #2f4a00;
  --pill-text: #3f4652;
  --ok-bg: #e5f3c2;
  --bad-bg: #fde1db;
  --warn-bg: #fcefd0;
  --new-bg: #f3f9e4;
  --online: #3d6800;
  --tabbar-bg: rgba(255, 255, 255, .96);
  --shadow: rgba(20, 22, 27, .12);
  --tile-bg: #fff;
  --tile-line: #c6cbd4;
  --tile-fg: #000;
  --tile-on-bg: #000;
  --tile-on-fg: #fff;
  color-scheme: light;
}
:root[data-theme="light"] .btn.primary:hover { background: #bde32d; }
:root[data-theme="light"] .modal-backdrop { background: rgba(20, 22, 27, .55); }

/* ธีมสีพาสเทลที่ลูกค้าเลือกได้ (เขียวขาว = ธีมสว่างเดิม · เขียวดำ = ธีมมืดเดิม) */
:root[data-palette="sky"] {
  --bg: #f2f8fc;
  --sunk: #edf5fa;
  --accent: #a8daf5;
  --accent-ink: #0b2a3d;
  --accent-fg: #1d6a93;
  --accent-hover: #124e6e;
  --accent-soft: #e6f4fc;
  --accent-line: #9fcfea;
  --new-bg: #eef7fc;
}
:root[data-palette="pink"] {
  --bg: #fcf5f8;
  --sunk: #faeff4;
  --accent: #f7bfd5;
  --accent-ink: #45132a;
  --accent-fg: #b2346a;
  --accent-hover: #8a2050;
  --accent-soft: #fdecf3;
  --accent-line: #f0b3cb;
  --new-bg: #fdf1f6;
}
:root[data-palette="navy"] {
  --bg: #f3f5fb;
  --sunk: #eef1f9;
  --accent: #a9bbf7;
  --accent-ink: #0d1a4a;
  --accent-fg: #2d48b5;
  --accent-hover: #1f3488;
  --accent-soft: #e9eefd;
  --accent-line: #b3c2f2;
  --new-bg: #eef2fd;
}
:root[data-palette="blue"] {
  --bg: #0f1320;
  --surface: #161b2b;
  --surface2: #1e2538;
  --sunk: #121726;
  --line: #283149;
  --line2: #37425f;
  --accent: #8fb0ff;
  --accent-ink: #0b1430;
  --accent-fg: #9fbcff;
  --accent-hover: #c4d5ff;
  --accent-soft: #141d36;
  --accent-line: #2e4378;
  --new-bg: #151c33;
  --tabbar-bg: rgba(18, 23, 38, .96);
}
:root[data-palette="sky"] .btn.primary:hover { background: #93cfef; }
:root[data-palette="pink"] .btn.primary:hover { background: #f3a9c6; }
:root[data-palette="navy"] .btn.primary:hover { background: #95aaf2; }
:root[data-palette="blue"] .btn.primary:hover { background: #a9c2ff; }

/* แผงเลือกธีมสี */
.themegrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.themeopt { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); text-decoration: none; font-weight: 500; }
.themeopt:hover { color: var(--text); border-color: var(--line2); }
.themeopt.on { border-color: var(--accent-fg); box-shadow: 0 0 0 2px var(--accent-line); }
.themeopt .sw { width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .14); background: linear-gradient(135deg, var(--sw-a) 0 50%, var(--sw-b) 50% 100%); }

/* จอแคบ (มือถือเล็ก): ย่อหัวหน้าร้านให้โลโก้ ปุ่มธีม กระดิ่ง และยอดเงินอยู่บรรทัดเดียว */
@media (max-width: 400px) {
  .top { gap: 8px; }
  .top > .row { gap: 6px !important; }
  .top .brand { font-size: 19px; gap: 7px; }
  .top .brand .mark { width: 26px; height: 26px; }
  .top .iconbtn, .top .bellbtn { width: 40px; height: 40px; }
  .top .walletchip { height: 40px; padding: 0 5px 0 9px; font-size: 13px; }
  .top .walletchip > svg { display: none; }
}

/* ปุ่ม ! เงื่อนไขของร้าน (สีแดง) */
.condbtn { color: var(--red); border-color: var(--red-line); background: var(--red-bg); }
.condbtn:hover { color: var(--red); border-color: var(--red); }
/* หน้าเงื่อนไข */
.conds { display: flex; flex-direction: column; gap: 14px; }
.cond { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.cond h2 { font-size: 16px; }
.cond ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.modal .mbody.conds .cond { padding: 12px 14px; }
@media (max-width: 400px) {
  .top .brand { font-size: 17px; gap: 6px; }
  .top .brand .mark { width: 24px; height: 24px; }
  .top .iconbtn, .top .bellbtn { width: 36px; height: 36px; border-radius: 10px; }
  .top .walletchip { height: 36px; }
  .top > .row { gap: 5px !important; }
}
/* แจ้งเคลมแบบรวม */
.errlist { margin: 4px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 2px; }
.claimgroup textarea { min-height: 112px; font-size: 15px; }
/* การ์ดไอดีทดลองฟรี */
.trialcard { text-decoration: none; color: inherit; border-color: var(--accent-line); background: var(--accent-soft); gap: 12px; }
.trialcard .btn { flex-shrink: 0; white-space: nowrap; }
/* รหัสเชิญเพื่อน */
.agentbox { padding-top: 12px; border-top: 1px solid var(--line); }
.refcode { display: flex; align-items: center; min-height: 40px; padding: 0 12px; border: 1px dashed var(--accent-line); border-radius: 10px; background: var(--accent-soft); font-size: 18px; font-weight: 700; letter-spacing: .08em; }
/* แถบเลเวล */
.levelbar { display: flex; flex-direction: column; gap: 6px; padding: 10px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; }
.levelbar:hover { color: var(--text); border-color: var(--accent-line); }
.levelbar > summary { cursor: pointer; list-style: none; }
.levelbar > summary::-webkit-details-marker { display: none; }
.levelbar > summary .lvmore::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-left: 8px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
.levelbar[open] > summary .lvmore::after { transform: translateY(1px) rotate(-135deg); }
.lvdeals > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.lvdeals > summary::-webkit-details-marker { display: none; }
.lvdeals > summary::after { content: ''; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
.lvdeals[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
.lvdeal-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.lvdeal-list li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; border-radius: 8px; background: var(--surface2); }
.lvdeal-list b { color: var(--accent-fg); }
.lvbadge { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-family: var(--display); font-size: 13px; font-weight: 700; }
.lvtrack { display: block; height: 6px; border-radius: 999px; background: var(--surface2); overflow: hidden; }
.lvtrack i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }


/* ปุ่มเข้าสู่ระบบด้วย LINE / Google (ใช้สีของแต่ละเจ้า ไม่ใช้โลโก้) */
.btn.linebtn { background: #06c755; border-color: #06c755; color: #fff; font-weight: 600; }
.btn.linebtn:hover { background: #05b34c; border-color: #05b34c; color: #fff; }
.btn.googlebtn { background: #fff; border-color: #dadce0; color: #1f1f1f; font-weight: 600; }
.btn.googlebtn:hover { background: #f8f9fa; border-color: #c6c9cc; color: #1f1f1f; }
.orline { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin-top: 4px; }
.orline::before, .orline::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------- คอม / จอกว้าง ----------
   เมนูล่างกลายเป็นเมนูด้านซ้าย · เนื้อหากว้างขึ้น · หน้าร้านแบ่ง 2 ฝั่ง (เลือกแบบ | สรุปและปุ่มซื้อ)
   หน้าโอนเงินแบ่ง 2 ฝั่ง (QR | แนบสลิป) · ไอดีที่ซื้อเรียง 2 คอลัมน์ */
.buypick, .buyside, .paygrid { display: contents; }
@media (min-width: 1024px) {
  body.has-tabbar { padding: 0 0 0 248px; }
  body.has-tabbar .tabbar { top: 0; right: auto; bottom: 0; width: 248px; display: flex; flex-direction: column; gap: 28px; padding: 26px 16px 20px; border-top: 0; border-right: 1px solid var(--line); background: var(--surface); backdrop-filter: none; overflow-y: auto; }
  .tabbar .railbrand { display: inline-flex; padding: 0 10px; }
  .tabbar .tabs-in { max-width: none; margin: 0; display: flex; flex-direction: column; gap: 4px; }
  .tabbar .tabs-in a, .tabbar .railitem { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 46px; padding: 0 14px; border-radius: 12px; font-size: 15px; color: var(--muted); }
  .tabbar .tabs-in a.on { background: var(--accent-soft); color: var(--accent-fg); font-weight: 600; }
  .tabbar .tabs-in a:not(.on):hover, .tabbar .railitem:hover { background: var(--surface2); color: var(--text); }
  .tabbar .railfoot { display: flex; flex-direction: column; gap: 2px; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
  .tabbar .railitem { display: flex; align-items: center; min-height: 40px; font-size: 14px; text-decoration: none; }
  .tabbar .railitem svg { width: 18px; height: 18px; flex-shrink: 0; }

  body.has-tabbar .wrap { max-width: 760px; padding: 32px 40px 72px; }
  body.has-tabbar .backrow { margin-bottom: 24px; }
  /* หัวหน้าร้าน: ชื่อร้านอยู่ในเมนูซ้ายแล้ว เหลือแค่ปุ่มด้านขวา */
  body.has-tabbar .top { justify-content: flex-end; }
  body.has-tabbar .top > .brand { display: none; }
  body.has-tabbar .top .themebtn { display: none; }

  /* หน้าร้าน */
  body.has-tabbar .wrap.shopwrap { max-width: 1120px; }
  #buy { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
  #buy .buypick { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
  #buy .buyside { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 16px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
  #buy .buyside .buybar { position: static; flex-direction: column; align-items: stretch; gap: 14px; padding: 16px 0 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; box-shadow: none; }
  /* หน้าตะกร้าแบบแยกขั้น (มีสีประจำขั้น): ไม่ซ้อนกล่อง · แถบสรุปยอดเป็นกล่องของตัวเอง */
  #buy .buyside:has(> .bstep) { padding: 0; background: none; border: 0; }
  #buy .buyside:has(> .bstep) .buybar { padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
  #buy .buyside .buybar .buybtns .btn, #buy .buyside .buybar > .btn { min-height: 48px; }
  #buy .buyside #min-hint { text-align: left; }

  /* หน้าโอนเงิน / เติมเงิน */
  body.has-tabbar .wrap.paywrap { max-width: 1040px; }
  .paygrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }

  /* ไอดีที่ซื้อ: 2 คอลัมน์ */
  body.has-tabbar .wrap.acctwrap { max-width: 1000px; }
  #accounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 8px; }

  /* แชท: สูงเต็มจอ */
  body.has-tabbar .wrap:has(.chat) { max-width: 880px; }
  body.has-tabbar .chat { height: calc(100vh - 150px); height: calc(100dvh - 150px); }
}

/* จองไอดีล่วงหน้า */
.bookcta { display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-decoration: none; color: inherit; }
.bookcta:hover { border-color: var(--accent-fg); }
.booklink { color: var(--accent-fg); font-weight: 600; }
.bookrules { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.booksum .row { gap: 10px; }
.booksum #bk-ready { text-align: right; }
.waitlist { display: flex; flex-direction: column; gap: 6px; }
.waitrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--sunk); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.waitrow:hover { border-color: var(--accent-fg); }
.waitrow.on { border-color: var(--accent-fg); background: var(--accent-soft); }
details.card.waits { display: block; }
.acct dd.readyat { font-family: var(--body); font-size: 12px; color: var(--accent-fg); }
.acct dd.readyat.wait { color: var(--amber); font-weight: 600; }
.acct dd.readyat .muted { font-weight: 400; }

/* ฟอร์มจอง: แต่ละขั้นมีสีของตัวเอง */
.bstep { --sc: var(--accent-fg); --sc-solid: var(--accent); --sc-ink: var(--accent-ink); --sc-bg: var(--accent-soft); display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 18px; border: 1px solid var(--line); border-left: 5px solid var(--sc); background: var(--surface); }
.bstep.gray { --sc: var(--muted); --sc-solid: var(--muted); --sc-ink: var(--surface); --sc-bg: var(--sunk); }
.bstep.blue { --sc: var(--blue-icon); --sc-solid: var(--blue-icon); --sc-ink: #fff; --sc-bg: var(--blue-bg); }
.bstep.amber { --sc: var(--amber); --sc-solid: var(--amber); --sc-ink: var(--surface); --sc-bg: var(--amber-bg); }
.bstep.violet { --sc: var(--violet); --sc-solid: var(--violet); --sc-ink: var(--surface); --sc-bg: var(--violet-bg); }
.bstep-h { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.bstep-h h2 { font-size: 17px; margin: 0; color: var(--sc); }
.bstep.gray .bstep-h h2 { color: var(--text); }
.bnum { width: 26px; height: 26px; flex-shrink: 0; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; background: var(--sc-solid); color: var(--sc-ink); font: 700 14px var(--display); }
.bstep .modes { margin: 0; }
.bstep .modes > h2 { display: none; }
.bstep .opt, .bstep .mode { background: var(--bg); }
.bstep.blue .mode:has(input:checked), .bstep.amber .mode:has(input:checked), .bstep.violet .mode:has(input:checked) { background: var(--sc-bg); border-color: var(--sc); }
.bstep.blue .mode:has(input:checked) .dot, .bstep.amber .mode:has(input:checked) .dot, .bstep.violet .mode:has(input:checked) .dot { border-color: var(--sc); }
.bstep.blue .mode:has(input:checked) .dot::after, .bstep.amber .mode:has(input:checked) .dot::after, .bstep.violet .mode:has(input:checked) .dot::after { background: var(--sc); }
.bstep details.waits { background: var(--bg); }
.booksum { border: 2px solid var(--accent-fg); }
.booksum .paynow { padding-top: 10px; margin-top: 2px; border-top: 1px dashed var(--line2); }
.booksum .paynow #bk-deposit { font: 700 24px var(--display); color: var(--accent-fg); }
.booksum #bk-bal.low { color: var(--red); font-weight: 700; }

/* ช่องจำนวน: ให้เห็นชัดว่าพิมพ์ตัวเลขเองได้ */
.stepper input { width: 76px; height: 40px; background: var(--bg); border: 1.5px solid var(--line2); border-radius: 10px; cursor: text; }
.stepper input:hover { border-color: var(--accent-fg); }
.stepper input:focus { outline: none; border-color: var(--accent-fg); box-shadow: 0 0 0 3px var(--accent-soft); }
.bonushint { margin: 0; padding: 8px 12px; border-radius: 12px; background: var(--sunk); color: var(--muted); }
.bonushint.on { background: var(--ok-bg); color: var(--green-text); font-weight: 600; }
/* เวลาที่ไอดีจะครบชั่วโมง (หน้าจอง) */
.readybox { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 14px; background: var(--blue-bg); border: 1px solid var(--blue-line); color: var(--blue-text); }
.readybox > b.row { color: var(--blue-icon); }
.readybox .muted { color: var(--blue-text); opacity: .8; }
.readybox .row.between b { color: var(--blue-text); text-align: right; white-space: nowrap; }
.readybox .row.between { gap: 10px; }
.readyline { display: flex; gap: 4px; align-items: flex-start; color: var(--blue-icon); }
.readyline svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 2px; }
.bstep .waits { padding-top: 2px; }
/* ติ๊กเลือกช่วงชั่วโมงที่จะจอง */
.slotlist { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; padding-right: 2px; }
.slotday { display: flex; flex-direction: column; gap: 6px; }
.slotday > b { color: var(--muted); position: sticky; top: 0; background: var(--surface); padding: 2px 0; z-index: 1; }
.slotrow { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); cursor: pointer; }
.slotrow input { width: 18px; height: 18px; flex-shrink: 0; margin: 0; accent-color: var(--sc); }
.slotrow:has(input:checked) { border-color: var(--sc); background: var(--sc-bg); }
.slotrow .num { white-space: nowrap; }
.booksum .bonusline.on { margin: 0 -8px; padding: 6px 8px; border-radius: 10px; background: var(--ok-bg); color: var(--green-text); }
.booksum .bonusline.on b { color: var(--green-text); }

/* หน้าร้านขั้นที่ 1: กดเลือกตะกร้า แล้วไปหน้าจำนวน/ชำระเงิน */
a.opt.optpick { text-decoration: none; color: inherit; }
a.opt.optpick:hover { border-color: var(--accent-fg); }
.opt .optgo { flex-shrink: 0; color: var(--muted); display: inline-flex; }
/* การ์ดจองล่วงหน้าในหน้าแรก: เส้นประ แยกจากตะกร้าซื้อปกติ */
a.opt.bookpick { border-style: dashed; border-color: var(--accent-line); background: var(--accent-soft); margin-top: 4px; }
a.opt.bookpick .opticon, .opt.bookpick.full .opticon { background: var(--surface); border-color: var(--accent-line); color: var(--accent-fg); }
.opt.bookpick.full { border-style: dashed; border-color: var(--line2); background: var(--sunk); margin-top: 4px; cursor: default; }
.opt.bookpick.full .name .pill { vertical-align: middle; height: 20px; font-size: 11px; }
.bookpromo { color: var(--accent-fg); font-weight: 600; }
.sumbonus { color: var(--accent-fg); font-weight: 700; }
/* จ่ายจากยอดไหนก่อน: ยอดจากเพื่อน / ยอดเงิน */
.paysrc { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.paysrc legend { padding: 0; margin-bottom: 6px; }
.psrcs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.psrc { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; min-width: 0; }
.psrc input { accent-color: var(--accent-fg); width: 18px; height: 18px; flex-shrink: 0; margin: 0; }
.psrc:has(input:checked) { border-color: var(--accent-fg); background: var(--accent-soft); }
.psplit { margin: 0; font-weight: 600; }
.opt.chosen { cursor: default; background: var(--accent-soft); border-color: var(--accent-fg); }

/* โน้ตของฉันในคำสั่งซื้อ/การจอง (เห็นแค่เจ้าของ) */
.ocard { padding: 0; }
.ocard > .olink { padding: 16px 16px 10px; text-decoration: none; color: inherit; border-radius: var(--radius) var(--radius) 0 0; }
.ocard > .onote { padding: 0 16px 14px; }
.onotebtn { display: inline-flex; align-items: flex-start; gap: 6px; max-width: 100%; min-height: 30px; padding: 5px 10px; border-radius: 8px; border: 1px dashed var(--line2, var(--line)); background: transparent; color: var(--muted); font: inherit; font-size: 13px; line-height: 1.45; text-align: left; cursor: pointer; }
.onotebtn > svg { flex-shrink: 0; width: 14px; height: 14px; margin-top: 2px; }
.onotebtn > span { overflow-wrap: anywhere; }
.onotebtn.has { border: 1px solid var(--violet-line); background: var(--violet-bg); color: var(--text); }
.onotebtn.has > svg { color: var(--violet); }
.onotebtn:hover { border-color: var(--violet-line); }
.onoteform { display: flex; gap: 6px; align-items: center; }
.onoteform .input { min-height: 36px; height: 36px; font-size: 14px; padding: 0 10px; border-radius: 10px; flex: 1; min-width: 0; }
.onoteform .btn { flex-shrink: 0; }
.notebox { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--violet-line); background: var(--violet-bg); }
.notehead { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.notehead .noteic { display: inline-flex; color: var(--violet); }
.notesaved { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-fg); font-weight: 600; }
.notesaved > svg { width: 14px; height: 14px; }
.notebox .input { background: var(--surface); }

/* คำสั่งซื้อของฉัน: แท็บ "คำสั่งซื้อ" / "การจองล่วงหน้า" กดเลือกดูทีละอย่าง · แต่ละแท็บคนละสี */
.otabs { position: sticky; top: 0; z-index: 7; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; padding: 6px; margin: 0 -2px; border-radius: 16px; background: var(--sunk); border: 1px solid var(--line); }
.otab { --sc: var(--accent-fg); --sc-solid: var(--accent); --sc-ink: var(--accent-ink); --sc-bg: var(--accent-soft); --sc-line: var(--line); position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 6px 8px; border-radius: 12px; color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none; border: 1px solid transparent; }
.otab.violet { --sc: var(--violet); --sc-solid: var(--violet); --sc-ink: var(--surface); --sc-bg: var(--violet-bg); --sc-line: var(--violet-line); }
.otab.amber { --sc: var(--amber-text, var(--amber)); --sc-solid: var(--amber); --sc-ink: #1d1404; --sc-bg: var(--amber-bg); --sc-line: var(--amber-line); }
.otab > svg { width: 18px; height: 18px; flex-shrink: 0; }
.otab-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.otab-n { flex-shrink: 0; min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text); font: 700 12px/20px var(--body); text-align: center; }
.otab.on { background: var(--sc-bg); color: var(--sc); border-color: var(--sc-line); box-shadow: 0 1px 4px var(--shadow); }
.otab.on .otab-n { background: var(--sc-solid); color: var(--sc-ink); border-color: transparent; }
.otab-dot { position: absolute; top: 6px; right: 8px; width: 8px; height: 8px; border-radius: 999px; background: var(--amber); box-shadow: 0 0 0 2px var(--sunk); }
.otab.on .otab-dot { box-shadow: 0 0 0 2px var(--sc-bg); }
.osec { --sc-line: var(--line); display: flex; flex-direction: column; gap: 10px; padding: 10px; border-radius: 18px; border: 1px solid var(--sc-line); background: var(--accent-soft); }
.osec.violet { --sc-line: var(--violet-line); background: var(--violet-bg); }
.osec.amber { --sc-line: var(--amber-line); background: var(--amber-bg); color: var(--text); }
.pill.amber { background: var(--amber-bg); color: var(--amber-text, var(--amber)); border: 1px solid var(--amber-line); }
.pill.amber > svg { width: 13px; height: 13px; vertical-align: -2px; }
@media (max-width: 440px) { .otabs.t3 .otab > svg { display: none; } .otabs.t3 .otab { gap: 5px; padding: 6px 4px; font-size: 13px; } }
.osec[hidden], #browse[hidden] { display: none; }
.osec.res { background: var(--sunk); }
.ocard.bk { border-color: var(--violet-line); }
.pill.violet { background: var(--violet-bg); color: var(--violet); }
.pill.violet > svg { width: 13px; height: 13px; vertical-align: -2px; }
.input.mono::placeholder { font-family: var(--body); }
.osec .ocard { border-color: var(--sc-line); }
@media (max-width: 360px) { .otab > svg { display: none; } }

/* ปุ่ม 2 บรรทัด: คำสั่ง (คัดลอก/โหลด) + รูปแบบข้อความเล็กข้างใต้ */
.btn2l .b2 { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.2; text-align: left; }
.btn2l .b2 small { font-size: 12px; font-weight: 500; opacity: .85; }

/* ยอดจองแต่ละวัน (3 วันล่าสุด) ใต้ "จองไปแล้ว" */
.bookdays { display: block; margin-top: 2px; }
.bookday { display: block; }

/* แท็บเคลม: ลำดับ · ผลเคลมใหม่ที่ยังไม่ได้อ่าน = จุดมุมการ์ด */
.ocard.cl { position: relative; }
.ocard.cl > .olink { align-items: stretch; }
.cnum { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 6px; margin-top: 1px; border-radius: 999px; background: var(--amber-bg); border: 1px solid var(--amber-line); color: var(--amber-text, var(--amber)); font: 700 12px var(--body); }
.ocard.cl.unread::after { content: ''; position: absolute; top: 8px; left: 8px; width: 10px; height: 10px; border-radius: 999px; background: var(--amber); box-shadow: 0 0 0 2px var(--surface); }
/* หน้าต่างยืนยันเคลม: ไอดีที่อยู่คนละออเดอร์ */
.ccids{overflow-wrap:anywhere;max-height:96px;overflow:auto;color:var(--text)}
