:root {
  --bg: #f6f5f3;
  --card: #fff;
  --ink: #1d1b19;
  --muted: #8a847d;
  --line: #e8e4de;
  --gold: #9a7b3f;
  --gold-soft: #f3ecdf;
  --ok: #2f7d55;
  --ok-bg: #e7f3ec;
  --err: #b4453c;
  --err-bg: #fbecea;
  --wait-bg: #fdf3e0;
  --wait: #9a6b1f;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans Thai", "IBM Plex Sans Thai", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 480px; margin: 0 auto; padding: 16px 16px 40px; }

.head { text-align: center; padding: 12px 0 18px; }
.shop { font-size: 20px; font-weight: 700; letter-spacing: .04em; }
.ono { color: var(--muted); font-size: 13px; letter-spacing: .08em; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.card h1, .card h2 { font-size: 16px; margin: 0 0 12px; }
.card h2 + h2 { margin-top: 22px; }
.center { text-align: center; }
.big-icon { font-size: 46px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ขั้นตอนของออเดอร์ */
.timeline { list-style: none; margin: 0; padding: 0; }
.step { display: flex; gap: 12px; align-items: flex-start; position: relative; padding-bottom: 14px; }
.step:last-child { padding-bottom: 0; }
.step::before {
  content: ""; position: absolute; left: 17px; top: 34px; bottom: 0; width: 2px; background: var(--line);
}
.step:last-child::before { display: none; }
.step .dot {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%;
  display: grid; place-items: center; font-size: 17px;
  background: var(--bg); border: 1px solid var(--line); position: relative; z-index: 1;
}
.step .txt { padding-top: 6px; display: flex; flex-direction: column; }
.step .txt b { font-weight: 600; }
.step .txt i { font-style: normal; font-size: 13px; color: var(--muted); }
.step.todo { opacity: .45; }
.step.done .dot { background: var(--ok-bg); border-color: var(--ok-bg); color: var(--ok); }
.step.now .dot { background: var(--gold-soft); border-color: var(--gold); box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--gold-soft); }
.step.now .txt b { color: var(--gold); }

/* เลขพัสดุ */
.track { text-align: center; background: linear-gradient(180deg, #fff, var(--gold-soft)); }
.track-label { font-size: 13px; color: var(--muted); }
.track-no { font-size: 22px; font-weight: 700; letter-spacing: .06em; margin: 4px 0 12px; word-break: break-all; }

/* รายการสินค้า */
.item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.item-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.item-main b { font-weight: 600; }
.item-main .muted { font-size: 12px; }
.qty { width: 58px; padding: 8px; text-align: center; border: 1px solid var(--line); border-radius: 10px; font-size: 16px; }
.qty-static { color: var(--muted); }
.item-sum { width: 76px; text-align: right; font-variant-numeric: tabular-nums; }

.sum { padding-top: 12px; }
.sum + h2, .addr + h2 { margin-top: 24px; }
.sum-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.sum-row.total { font-size: 18px; font-weight: 700; color: var(--ink); margin-top: 6px; }
.free { color: var(--ok); }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
input[type=text], input[type=tel], input[type=password], input[type=email], textarea {
  width: 100%; margin-top: 4px; padding: 12px; font-size: 16px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 12px; background: #fdfcfb; color: var(--ink);
}
input:focus, textarea:focus { outline: 2px solid var(--gold-soft); border-color: var(--gold); }
textarea { resize: vertical; }

.addr { background: var(--bg); border-radius: 12px; padding: 12px; font-size: 14px; }

.btn {
  display: block; width: 100%; padding: 14px; font-size: 16px; font-family: inherit; font-weight: 600;
  border-radius: 999px; border: 1px solid transparent; cursor: pointer;
}
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:active { transform: translateY(1px); }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn.small { width: auto; padding: 6px 14px; font-size: 13px; }

.qr-box { text-align: center; margin-bottom: 14px; }
#qr { display: inline-block; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
#qr svg { display: block; width: 190px; height: 190px; }
.qr-hint { font-size: 12px; color: var(--muted); margin-top: 8px; }

.bank { background: var(--bg); border-radius: 12px; padding: 12px; font-size: 14px; }
.bank > div { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.acct { margin-top: 6px; font-size: 19px; font-weight: 700; letter-spacing: .06em; }

.file { display: block; border: 2px dashed var(--line); border-radius: 12px; padding: 18px; text-align: center; cursor: pointer; color: var(--ink); }
.file input { width: 100%; }
.file span { display: block; margin-top: 8px; font-size: 14px; color: var(--muted); }

.slip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; }
.slip a { color: var(--gold); }
.badge { font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.wait { background: var(--wait-bg); color: var(--wait); }

.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 14px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--err-bg); color: var(--err); }

.foot { text-align: center; font-size: 12px; color: var(--muted); padding: 10px 20px; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614; --card: #201e1c; --ink: #f0ece6; --muted: #9b948b; --line: #332f2b;
    --gold: #d9b877; --gold-soft: #3a3226; --ok: #7bc79c; --ok-bg: #22352b;
    --err: #e79b93; --err-bg: #3a2523; --wait-bg: #3a3124; --wait: #e0b972;
  }
  .btn.primary { background: var(--gold); color: #171614; }
  .track { background: linear-gradient(180deg, var(--card), var(--gold-soft)); }
  input[type=text], input[type=tel], input[type=password], input[type=email], textarea { background: #1a1917; }
  .step.now .dot { box-shadow: 0 0 0 4px var(--card), 0 0 0 6px var(--gold-soft); }
}

.deadline {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--wait-bg); color: var(--wait);
  border-radius: 12px; padding: 12px; margin-bottom: 14px; font-size: 14px;
}
.deadline span { font-size: 12px; opacity: .85; }
.deadline.soon { background: var(--err-bg); color: var(--err); }
