:root {
  --bg: #f6f5f1;
  --card: #ffffff;
  --ink: #1e2420;
  --muted: #66706a;
  --line: #e2e1da;
  --brand: #2f6b4a;
  --brand-ink: #ffffff;
  --brand-soft: #e5efe8;
  --warn: #9a5a00;
  --warn-soft: #fdf1dc;
  --bad: #b3261e;
  --bad-soft: #fbe7e5;
  --radius: 12px;
  font-family: 'Noto Sans Thai', 'Sarabun', system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.55; font-size: 16px; }
.wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px 48px; }
.wrap.wide { max-width: 1100px; }
header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
header.top h1 { font-size: 20px; margin: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 17px; margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 14px; }
.hero img { width: 100%; border-radius: 8px; display: block; margin-bottom: 12px; aspect-ratio: 1; object-fit: cover; background: var(--brand-soft); }
.hero h2 { font-size: 22px; margin: 0 0 4px; }

label { display: block; font-size: 14px; font-weight: 600; margin: 10px 0 4px; }
input, select, textarea {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
textarea { min-height: 70px; resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row > div { min-width: 0; }

button, .btn {
  font: inherit; font-weight: 600; border: 0; border-radius: 8px; padding: 11px 16px;
  background: var(--brand); color: var(--brand-ink); cursor: pointer; display: inline-block; text-decoration: none;
}
button:disabled { opacity: .5; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
button.danger { background: var(--bad); }
button.small { padding: 6px 10px; font-size: 14px; }
button.block { width: 100%; padding: 14px; font-size: 17px; }

.sizes { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.size {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; background: #fff;
}
.size b { display: block; font-size: 18px; }
.size .stepper { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 6px; }
.size .stepper button { width: 32px; height: 32px; padding: 0; border-radius: 50%; }
.size .stepper span { min-width: 22px; font-weight: 700; }
.size.out { opacity: .45; }
.size.picked { border-color: var(--brand); background: var(--brand-soft); }

.quote table, table.list { width: 100%; border-collapse: collapse; }
.quote td { padding: 4px 0; }
.quote td:last-child { text-align: right; }
.quote .total td { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 700; font-size: 18px; }
.remote { color: var(--warn); }

.note { border-radius: 8px; padding: 10px 12px; font-size: 14px; margin: 10px 0; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.bad { background: var(--bad-soft); color: var(--bad); }
.note.ok { background: var(--brand-soft); color: var(--brand); }
.hidden { display: none !important; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.check input { width: auto; margin-top: 4px; }

.badge { display: inline-block; font-size: 13px; padding: 2px 8px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.badge.PENDING_PAYMENT, .badge.EXPIRED { background: #eee; color: #555; }
.badge.SLIP_UPLOADED { background: var(--warn-soft); color: var(--warn); }
.badge.REJECTED { background: var(--bad-soft); color: var(--bad); }
.badge.TEST { background: #e3e8ff; color: #3446a8; margin-right: 4px; }

.qr { text-align: center; }
.qr svg, .qr img { width: 240px; height: 240px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* admin */
nav.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
nav.tabs button { background: #fff; color: var(--ink); border: 1px solid var(--line); }
nav.tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
table.list th, table.list td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
table.list th { color: var(--muted); font-weight: 600; }
.scroll { overflow-x: auto; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.toolbar select, .toolbar input { width: auto; }
.detail { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail img.slip { max-width: 100%; border: 1px solid var(--line); border-radius: 8px; }
.inline { display: flex; gap: 6px; align-items: center; }
.inline input { width: 90px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--brand-soft); }
#msg { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 10;
  max-width: calc(100vw - 32px); box-shadow: 0 4px 16px rgba(0,0,0,.15); margin: 0; }
@media (max-width: 720px) { .detail { grid-template-columns: 1fr; } }
