/* Same look as the booking pages (booking/site): shop green, IBM Plex Sans Thai + Mitr. */
:root {
  --bg: #eef2ea; --surface: #fff; --ink: #16251b; --muted: #5a6a5f; --line: #d5ddd0;
  --brand: #14532d; --accent: #15803d; --accent-soft: #dcf2e1; --warn: #9a4d05; --warn-soft: #fcefd9;
  --danger: #b42318; --danger-soft: #fdeceb; --info: #1d4ed8; --info-soft: #e8efff; --off: #eceeea;
  --font: 'IBM Plex Sans Thai', 'Noto Sans Thai', 'Leelawadee UI', Tahoma, sans-serif;
  --display: 'Mitr', 'IBM Plex Sans Thai', 'Noto Sans Thai', sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }

.hero { background: linear-gradient(160deg, #0f3d22, var(--brand) 55%, var(--accent)); color: #fff; padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 18px; }
.hero .inner { max-width: 720px; margin: 0 auto; display: flex; gap: 12px; align-items: center; }
.hero h1 { margin: 0; font-family: var(--display); font-weight: 500; font-size: 1.3rem; line-height: 1.25; }
.hero p { margin: 2px 0 0; color: #d1f5dc; font-size: .9rem; }
.hero .grow { flex: 1; min-width: 0; }
.tag-demo { display: inline-block; background: #fde68a; color: #713f12; border-radius: 999px; padding: 1px 9px; font-size: .75rem; font-weight: 700; vertical-align: middle; }

main { max-width: 720px; margin: 0 auto; padding: 14px 16px 120px; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.panel { background: var(--surface); border-radius: 16px; padding: 14px; box-shadow: 0 1px 2px rgba(22,37,27,.06), 0 4px 14px rgba(22,37,27,.06); }
.panel h2 { margin: 0 0 10px; font-family: var(--display); font-weight: 500; font-size: 1.05rem; }
.step { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .85rem; margin-right: 6px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row .grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

label { display: block; font-weight: 600; font-size: .92rem; margin: 12px 0 5px; }
input[type=text], input[type=tel], input[type=number], input[type=password], textarea, select {
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
textarea { min-height: 60px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
:focus-visible { outline: 3px solid #86efac; outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 12px; font-size: .9rem; cursor: pointer; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--brand); font-weight: 600; }
.cat { font-size: .78rem; color: var(--muted); margin: 10px 0 4px; font-weight: 600; letter-spacing: .02em; }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 0; border-radius: 14px; padding: 13px 16px; font-weight: 700; font-size: 1rem; background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; }
.btn.sm { width: auto; padding: 8px 12px; font-size: .9rem; border-radius: 10px; }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.blue { background: var(--info); }
.btn.red { background: var(--danger); }
.btn.soft-red { background: var(--danger-soft); color: var(--danger); }
.btn[disabled] { opacity: .5; pointer-events: none; }

.alert { border-radius: 12px; padding: 11px 13px; font-size: .92rem; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.info { background: var(--info-soft); color: #1e40af; }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.ok { background: var(--accent-soft); color: var(--brand); }

.map { height: 260px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); z-index: 0; }
.map.tall { height: 340px; }
.pin { background: none; border: 0; }
.pin span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--accent); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); color: #fff; font-size: 11px; font-weight: 700; }
.pin.me span { background: var(--info); border-radius: 50%; transform: none; }
.pin.home span { background: var(--danger); }
.pin.taken span { background: #6b7280; }

.status { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.s-open { background: var(--warn-soft); color: var(--warn); }
.s-taken { background: var(--info-soft); color: var(--info); }
.s-done { background: var(--accent-soft); color: var(--brand); }
.s-cancel { background: var(--off); color: var(--muted); }

.job { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 6px; background: var(--surface); }
.job.new { animation: flash 1.6s ease-out 1; }
@keyframes flash { from { background: #fef9c3; } to { background: var(--surface); } }
@media (prefers-reduced-motion: reduce) { .job.new { animation: none; } }
.job .dist { font-family: var(--display); font-weight: 600; font-size: 1.35rem; color: var(--brand); line-height: 1.1; font-variant-numeric: tabular-nums; }
.job .what { font-weight: 600; }
.list { display: grid; gap: 10px; }

dl.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; margin: 0; font-size: .95rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-weight: 600; word-break: break-word; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); display: flex; justify-content: center; }
.tabs .inner { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; max-width: 560px; gap: 4px; }
.tabs button { border: 0; background: none; padding: 6px 4px; border-radius: 10px; font-size: .82rem; color: var(--muted); cursor: pointer; display: grid; justify-items: center; gap: 1px; position: relative; }
.tabs button b { font-size: 1.25rem; line-height: 1.1; }
.tabs button.on { background: var(--accent-soft); color: var(--brand); font-weight: 700; }
.badge { position: absolute; top: 2px; right: 18%; background: var(--danger); color: #fff; border-radius: 999px; font-size: .7rem; min-width: 18px; padding: 0 5px; font-weight: 700; }

.credit { display: inline-flex; align-items: baseline; gap: 4px; background: rgba(255,255,255,.16); border-radius: 12px; padding: 6px 10px; color: #fff; text-align: right; flex-direction: column; line-height: 1.1; }
.credit b { font-family: var(--display); font-weight: 500; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.credit small { font-size: .72rem; color: #d1f5dc; }
.credit.low { background: #fecaca; color: #7f1d1d; }
.credit.low small { color: #7f1d1d; }

.big { font-family: var(--display); font-weight: 600; font-size: 2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.qr { width: 220px; max-width: 100%; margin: 6px auto; background: #fff; padding: 6px; border-radius: 12px; border: 1px solid var(--line); }
.qr svg { display: block; width: 100%; height: auto; }
.weigh { display: grid; grid-template-columns: minmax(0, 1fr) 96px 86px; gap: 6px 8px; align-items: center; font-size: .92rem; }
.weigh input { padding: 9px; text-align: right; font-variant-numeric: tabular-nums; }
.weigh .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.weigh .h { font-size: .75rem; color: var(--muted); font-weight: 600; }
.total { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.total .fee { color: var(--danger); font-weight: 700; }
.stars { display: flex; gap: 6px; }
.stars button { border: 0; background: none; font-size: 2rem; cursor: pointer; color: #d1d5db; padding: 0; line-height: 1; }
.stars button.on { color: #f59e0b; }

.ledger { display: grid; gap: 0; }
.ledger div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.ledger div:last-child { border-bottom: 0; }
.plus { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.minus { color: var(--danger); font-weight: 700; font-variant-numeric: tabular-nums; }

#toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: .92rem; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.error { background: var(--danger); }
#toast.ok { background: var(--accent); }

.sheet-bg { position: fixed; inset: 0; background: rgba(10,20,14,.45); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 10px; }
.sheet h3 { margin: 0; font-family: var(--display); font-weight: 500; font-size: 1.1rem; }

table.t { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.t th, table.t td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { font-size: .78rem; color: var(--muted); font-weight: 600; }
table.t td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scroll { overflow-x: auto; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.tile { background: var(--surface); border-radius: 14px; padding: 12px; box-shadow: 0 1px 2px rgba(22,37,27,.06); }
.tile b { display: block; font-family: var(--display); font-weight: 500; font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.tile span { font-size: .8rem; color: var(--muted); }
.tile.hot { background: var(--warn-soft); }

/* online training */
.train-card { display: grid; gap: 8px; border: 2px solid var(--accent); }
.bar { height: 8px; background: var(--off); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }
.steps { display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; }
.steps span { width: 26px; height: 8px; border-radius: 999px; background: var(--line); }
.steps span.done { background: var(--accent); }
.steps span.on { background: var(--info); }
.steps span.quiz { width: auto; height: auto; padding: 1px 8px; font-size: .72rem; font-weight: 700; color: var(--muted); background: var(--off); }
.steps span.quiz.on { background: var(--info); color: #fff; }
.lesson { font-size: 1.02rem; line-height: 1.75; }
.lesson p { margin: 0 0 10px; }
.lesson ul { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 4px; }
.timer { border-radius: 12px; padding: 11px 13px; background: var(--warn-soft); color: var(--warn); font-variant-numeric: tabular-nums; margin-top: 6px; }
.timer.ready { background: var(--accent-soft); color: var(--brand); }
.check { display: flex; align-items: flex-start; gap: 10px; border: 2px solid var(--accent); border-radius: 12px; padding: 12px; margin: 10px 0; cursor: pointer; font-weight: 600; }
.check input { width: 24px; height: 24px; flex: none; accent-color: var(--accent); margin: 0; }
.check.off { border-color: var(--line); color: var(--muted); cursor: not-allowed; }
.quiz { display: grid; gap: 12px; }
.quiz fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 0; display: grid; gap: 4px; min-width: 0; }
.quiz legend { padding: 0 4px; font-weight: 600; }
.opt { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 0; padding: 8px; border-radius: 10px; cursor: pointer; }
.opt:has(input:checked) { background: var(--accent-soft); }
.opt input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); margin: 2px 0 0; }
.result { text-align: center; border-radius: 14px; padding: 18px; }
.result.pass { background: var(--accent-soft); color: var(--brand); }
.result.fail { background: var(--danger-soft); color: var(--danger); }

/* app online switch, top-up cards, referral */
.online-panel.on { border: 2px solid var(--accent); background: var(--accent-soft); }
.online-panel.off { border: 2px dashed var(--line); }
.topup { display: grid; gap: 8px; border: 2px solid var(--warn); }
.topup.sent { border-color: var(--info); }
.code { font-family: var(--display); letter-spacing: .06em; background: var(--accent-soft); color: var(--brand); padding: 1px 8px; border-radius: 8px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--line); margin-right: 4px; vertical-align: middle; }
.dot.on { background: #22c55e; box-shadow: 0 0 0 3px #bbf7d0; }

/* Netlify's free plan puts a "Powered by Netlify" badge at the bottom right of every page:
   bottom bars leave room under their buttons so the badge never covers them. */
/* Cloudflare Pages (since 2026-10-11) shows no badge: no extra room needed. */
:root { --badge-room: 0px; }
.tabs { padding-bottom: calc(var(--badge-room) + env(safe-area-inset-bottom, 0px)); }
main { padding-bottom: calc(150px + var(--badge-room)); }
#toast { bottom: calc(96px + var(--badge-room) + env(safe-area-inset-bottom, 0px)); }

/* buying at the customer's place (buy.js), same look as the ขายดีรับซื้อ app */
body.buying .hero, body.buying #home, body.buying #tabs, body.buying #train { display: none !important; }
.buy { max-width: 720px; margin: 0 auto; padding: 0 16px calc(170px + var(--badge-room)); display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.buy-top { position: sticky; top: 0; z-index: 5; display: flex; gap: 10px; align-items: center; background: var(--brand); color: #fff; margin: 0 -16px; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; }
.buy-top .small { color: #d1f5dc; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.buy-top .grow { min-width: 0; }
.icon-btn { border: 0; background: rgba(255,255,255,.16); color: #fff; border-radius: 10px; width: 40px; height: 40px; font-size: 1.3rem; cursor: pointer; flex: none; }
.buy-body { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.buy-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--line); padding: 10px 16px calc(10px + var(--badge-room) + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; }
.buy-bar > * { max-width: 688px; width: 100%; margin: 0 auto; }
.sum { display: flex; justify-content: space-between; align-items: baseline; font-variant-numeric: tabular-nums; }
.sum b { font-family: var(--display); font-weight: 600; font-size: 1.4rem; color: var(--accent); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cat-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cat-tile { background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 14px 8px; min-height: 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; cursor: pointer; }
.cat-tile .em { font-size: 2rem; line-height: 1; }
.cat-tile small { color: var(--muted); font-size: .78rem; }
.cat-tile:active { border-color: var(--accent); }
.prod { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; }
.prod b { color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.item { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.item:last-child { border-bottom: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item .del { background: none; border: 0; color: var(--muted); font-size: 1rem; padding: 6px; cursor: pointer; }
.thumb { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; background: var(--off); flex: none; display: grid; place-items: center; }
.deduct { color: var(--warn); font-size: .8rem; }
.photo { aspect-ratio: 4 / 3; max-width: 100%; background: #111; border-radius: 16px; overflow: hidden; display: grid; place-items: center; color: #a7b3aa; text-align: center; }
.photo img { width: 100%; height: 100%; object-fit: contain; }
.scale { background: #0c1c12; border-radius: 18px; padding: 10px; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 6px; box-shadow: inset 0 0 0 3px #1f3a28; }
.lcd-field { border: 0; background: transparent; text-align: right; color: #2f5a3d; padding: 6px 8px; border-radius: 10px; display: block; width: 100%; min-width: 0; white-space: nowrap; overflow: hidden; cursor: pointer; }
.lcd-field .lbl { display: block; font-size: .74rem; }
.lcd-field .lcd { font-family: 'Share Tech Mono', 'Roboto Mono', ui-monospace, monospace; font-size: 2.3rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.lcd-field .unit { font-size: .9rem; margin-left: 4px; }
.lcd-field.on { color: #86f5a4; background: rgba(134, 245, 164, .07); text-shadow: 0 0 10px rgba(134, 245, 164, .45); }
.lcd-field.small-lcd .lcd { font-size: 1.6rem; }
.lcd-field.small-lcd.on { color: #ffc56b; text-shadow: 0 0 10px rgba(255, 197, 107, .4); background: rgba(255, 197, 107, .07); }
.chip.warn-on { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); font-weight: 600; }
.chip.add { border-style: dashed; color: var(--accent); }
.calc { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--accent-soft); border-radius: 14px; padding: 10px 12px; font-variant-numeric: tabular-nums; }
.calc b { font-family: var(--display); font-weight: 600; font-size: 1.5rem; color: var(--accent); white-space: nowrap; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keypad button { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; font-size: 1.4rem; font-weight: 600; padding: 9px 0; font-variant-numeric: tabular-nums; cursor: pointer; }
.keypad button:active { background: var(--off); }
.keypad .fn { background: var(--off); font-size: 1.05rem; }
.grand { display: flex; justify-content: space-between; align-items: baseline; padding-top: 10px; }
.grand b { font-family: var(--display); font-weight: 600; font-size: 1.8rem; color: var(--accent); font-variant-numeric: tabular-nums; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg button { border: 2px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px; font-weight: 600; cursor: pointer; }
.seg button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.gallery img, .gallery button { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.receipt-img { width: 100%; max-width: 100%; border-radius: 6px; box-shadow: 0 4px 14px rgba(22,37,27,.12); background: #fff; display: block; }
.status.line { background: #06c755; color: #fff; }
.sheet { padding-bottom: calc(16px + var(--badge-room) + env(safe-area-inset-bottom, 0px)); }
.thumb-btn { border: 0; background: none; padding: 0; position: relative; cursor: pointer; flex: none; }
.thumb-btn span { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.55); color: #fff; font-size: .62rem; border-radius: 0 0 10px 10px; text-align: center; }
.confirm-box { display: grid; gap: 8px; border: 2px solid #b45309; border-radius: 12px; padding: 10px; }
