@font-face { font-family: Anuphan; src: url(fonts/Anuphan-variable.woff2) format('woff2'), url(fonts/Anuphan-variable.ttf) format('truetype'); font-weight: 100 900; font-display: swap; }
:root {
  --ink: #31200f; --muted: #6b4a26; --green: #4f7a35; --green-soft: #e8f0dc; --paper: #fff9ef; --line: #f1e2c4;
  --amber: #8d590f; --amber-soft: #ffe9c2; --red: #ad3023; --red-soft: #fbe3dd; --white: #fff; --radius: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Anuphan, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--paper); color: var(--ink); font-size: 17px; line-height: 1.45; }
main { max-width: 560px; margin: 0 auto; padding: 16px; }
main.wide { max-width: 1100px; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 18px; margin: 0 0 8px; }
p { margin: 6px 0; }
.muted { color: var(--muted); font-size: 15px; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.bar .who { display: flex; gap: 8px; align-items: center; font-size: 15px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
label { display: block; font-weight: 600; margin: 12px 0 4px; }
input[type=tel], input[type=text], input[type=password], input[type=date], input[type=time], input[type=search], input[inputmode=decimal] {
  width: 100%; font: inherit; font-size: 22px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--white); color: var(--ink);
}
input[type=search], input[type=date], input[type=time], input[type=text] { font-size: 18px; }
input:focus { outline: none; border-color: var(--green); }
button, .button { font: inherit; font-weight: 700; font-size: 18px; border: 0; border-radius: 12px; padding: 14px 16px; cursor: pointer; background: var(--green); color: var(--white); width: 100%; margin-top: 12px; text-align: center; text-decoration: none; display: inline-block; }
button.secondary, .button.secondary { background: var(--green-soft); color: var(--green); }
button.warn { background: var(--amber-soft); color: var(--amber); }
#redeem[data-armed="1"] { background: var(--red-soft); color: var(--red); outline: 2px solid var(--red); }
button.small { width: auto; font-size: 14px; padding: 6px 10px; margin: 0; }
button:disabled { opacity: .45; cursor: not-allowed; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 15px; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
.points { font-size: 44px; font-weight: 800; color: var(--green); line-height: 1; }
.row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.preview { font-size: 16px; color: var(--green); min-height: 22px; margin-top: 6px; }
.msg { padding: 12px 14px; border-radius: 12px; margin: 12px 0; font-weight: 600; }
.msg.ok { background: var(--green-soft); color: var(--green); }
.msg.err { background: var(--red-soft); color: var(--red); }
.list { list-style: none; padding: 0; margin: 8px 0 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 15px; }
.list li.voided span:first-child { text-decoration: line-through; color: var(--muted); }
.list li:has(form.edit) { flex-wrap: wrap; }
.list .actions, .list form.edit { display: flex; gap: 6px; align-items: center; flex: none; }
.list form.edit { flex-basis: 100%; }
.list form.edit input { flex: 1; width: auto; min-width: 0; font-size: 18px; padding: 8px 10px; }
.tabs { display: flex; gap: 8px; margin: 12px 0 0; }
.tabs button { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.stat b { display: block; font-size: 26px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.chips button { width: auto; margin: 0; font-size: 15px; padding: 8px 12px; background: var(--white); color: var(--ink); border: 1px solid var(--line); }
.chips button.on { background: var(--green); color: var(--white); border-color: var(--green); }
.table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--amber-soft); position: sticky; top: 0; }
td.num, th.num { text-align: right; }
.brand { background: #111; color: #fff; text-align: center; padding: 24px 16px 20px; }
.brand img { width: 96px; height: 96px; border-radius: 20px; }
.brand h1 { font-size: 22px; margin-top: 10px; }
.right { text-align: right; }
.mt { margin-top: 16px; }
.toolbar { margin-bottom: 8px; }
.button.inline, button.inline-btn { width: auto; margin: 0; white-space: nowrap; }
#dev-url { font-size: 14px; }
input.h-date { width: auto; font-size: 16px; padding: 8px 10px; }
#h-stats { margin-top: 8px; }
#h-stats .stat { background: var(--paper); }
[hidden] { display: none !important; }
/* แดชบอร์ดเจ้าของร้าน */
.tabs button { font-size: 16px; padding: 12px 8px; }
.dh { font-size: 18px; margin: 24px 0 8px; }
.stat small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
/* แถบสถานะ = ลำดับ (ordinal) ไล่เขียวเฉดเดียว ผ่าน validate_palette.js --ordinal บนพื้นขาว 15/10/2026 · "ยังไม่ซื้อ" อยู่นอกลำดับ ใช้เทาอุ่น */
.sbar-wrap { position: relative; margin: 10px 0; }
.sbar { display: flex; gap: 2px; height: 24px; border-radius: 0 4px 4px 0; overflow: hidden; }
.seg { cursor: default; }
.seg:hover, .seg:focus-visible { filter: brightness(1.18); outline: none; }
.s-regular { background: #2b540a; } .s-cooling { background: #46712c; } .s-lapsed { background: #638f49; } .s-dormant { background: #80ae67; } .s-never { background: #b5a68a; }
.tip { position: absolute; bottom: calc(100% + 6px); transform: translateX(-50%); background: var(--ink); color: var(--white); font-size: 14px; padding: 4px 10px; border-radius: 8px; white-space: nowrap; pointer-events: none; }
.legend { list-style: none; padding: 0; margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; }
.legend li { display: flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.expiry { display: flex; gap: 18px; align-items: center; background: var(--amber-soft); border-color: var(--amber-soft); }
.expiry .count { flex: none; color: var(--amber); }
.expiry .count b { display: block; font-size: 48px; line-height: 1; }
.expiry .count span { font-size: 13px; font-weight: 600; }
.buckets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.buckets span { background: var(--white); border-radius: 999px; padding: 2px 10px; font-size: 14px; }
.list li small { display: block; color: var(--muted); font-size: 13px; }
.list li > b { flex: none; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; margin-right: 6px; vertical-align: 1px; }
.badge.red { background: var(--red-soft); color: var(--red); } .badge.yellow { background: var(--amber-soft); color: var(--amber); }
td.num { font-variant-numeric: tabular-nums; }
.hints { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.hints:empty { display: none; }
.hints li { background: var(--amber-soft); color: var(--amber); font-weight: 700; padding: 8px 12px; border-radius: 10px; }
@media (max-width: 480px) { .expiry { flex-direction: column; align-items: flex-start; } }
/* เพิ่ม 16/10/2026: แท็บโปรโมชัน / กลุ่ม / ตั้งค่า · แผงใหม่ในแดชบอร์ด */
.tabs { overflow-x: auto; padding-bottom: 2px; }
.tabs button { flex: 1 0 auto; width: auto; white-space: nowrap; }
select, textarea { width: 100%; font: inherit; font-size: 18px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--white); color: var(--ink); }
textarea { resize: vertical; }
select:focus, textarea:focus { outline: none; border-color: var(--green); }
.row.dates { align-items: flex-start; }
.row.dates > div { flex: 1; min-width: 0; }
.tier { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--paper); color: var(--muted); border: 1px solid var(--line); vertical-align: 3px; }
.tier[data-tier="silver"] { background: #eef0f2; color: #4a5560; border-color: #d5dbe0; }
.tier[data-tier="gold"] { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-soft); }
button.promo { font-size: 16px; text-align: left; }
.chips.period { margin-top: 12px; }
.chips.pick button[aria-pressed="true"] { background: var(--green); color: var(--white); border-color: var(--green); }
.flabel { font-weight: 600; margin: 12px 0 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 0 12px; }
.grid2 > .card { min-width: 0; }
.hbars { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.hbars li { display: grid; grid-template-columns: minmax(7em, 38%) 1fr auto; gap: 8px; align-items: center; font-size: 15px; }
.hbars .track { height: 14px; background: var(--paper); border-radius: 0 4px 4px 0; overflow: hidden; }
.hbars .fill { display: block; height: 100%; background: var(--green); border-radius: 0 4px 4px 0; }
.hbars .hv { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 3.5em; text-align: right; }
.quad { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.quad .stat { background: var(--paper); }
.heat h2 { font-size: 16px; }
.hgrid { display: grid; gap: 2px; font-size: 11px; color: var(--muted); align-items: center; }
.hgrid .hh { text-align: center; }
.hgrid .cell { height: 18px; border-radius: 3px; }
/* ระดับความหนาแน่นใช้ไล่เขียวเดียวกับแถบสถานะ (ผ่าน validator) · 0 = ว่าง */
.cell.l0 { background: var(--paper); } .cell.l1 { background: #80ae67; } .cell.l2 { background: #638f49; } .cell.l3 { background: #46712c; } .cell.l4 { background: #2b540a; }
.list li.off span b { color: var(--muted); }
.list li.group { display: block; }
.list li.group > .row { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.list li.group .list { margin-left: 8px; }
a.button.small { font-size: 14px; padding: 6px 10px; }
.qrs { display: flex; flex-wrap: wrap; gap: 16px; }
.qrs figure { margin: 0; text-align: center; }
.qrs img { width: 200px; height: 200px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.qrs code { font-size: 12px; overflow-wrap: anywhere; }
h3.mt { font-size: 16px; }
/* หน้าให้คะแนนร้าน */
fieldset.rate { border: 0; padding: 0; margin: 0 0 14px; }
fieldset.rate legend { font-weight: 600; margin-bottom: 6px; }
.stars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.stars button { margin: 0; padding: 12px 0; background: var(--white); color: var(--ink); border: 2px solid var(--line); }
.stars button.on { background: var(--amber-soft); border-color: var(--amber); color: var(--amber); }
/* รูปโปร (แท็บโปรโมชัน) */
input[type=file] { font: inherit; font-size: 16px; width: 100%; margin-top: 4px; }
img.thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); flex: none; }
.list li > span:has(> img.thumb) { display: grid; grid-template-columns: 48px 1fr; column-gap: 10px; align-items: start; }
.list li > span > img.thumb { width: 48px; height: 48px; grid-row: span 2; }
