/* สีและสัดส่วนยกมาจาก design ของทีม (Arteereview Shop.dc.html) */
:root {
  --navy: #0e2a6e;
  --red: #e4002b;
  --blue: #1e50e5;
  --ink: #16213a;
  --muted: #6b7690;
  --faint: #9aa5bc;
  --line: #edf1f7;
  --border: #e2e8f2;
  --bg: #f3f5fa;
  --green: #10b981;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: 'IBM Plex Sans Thai', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
}

input, textarea, button, select { font-family: inherit; }
.hidden { display: none !important; }

/* ---------- หัวเรื่อง ---------- */
.topbar {
  background: var(--navy);
  color: #fff;
  padding: calc(env(safe-area-inset-top) + 14px) 18px 14px;
  border-top: 4px solid var(--red);
  flex-shrink: 0;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; }
/* โลโก้วางบนแถบสีกรมท่า ตัวไฟล์เป็นพื้นขาวอยู่แล้ว จึงคงพื้นขาวไว้เป็นชิป
   ไม่ทำพื้นใส เพราะในโลโก้มีชิ้นส่วนสีขาวจริง (หน้ายิ้มในลูกโป่งคำพูด)
   ถ้าเจาะขาวออกจะกลายเป็นรูทะลุเห็นสีกรมท่าข้างหลัง */
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px; background: #fff;
  object-fit: contain;
  padding: 2px;
  flex-shrink: 0;
}
.brand-name { font-family: 'Prompt', sans-serif; font-weight: 600; font-size: 15px; }
.brand-line {
  display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600;
  background: rgba(255,255,255,.14); padding: 5px 9px; border-radius: 20px;
}
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: #06c755; }

/* ---------- ตัวบอกขั้นตอน ---------- */
.steps {
  display: flex;
  padding: 12px 16px 6px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.step { flex: 1; text-align: center; }
.step-num {
  width: 24px; height: 24px; margin: 0 auto; border-radius: 50%;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  background: #fff; color: var(--faint); border: 2px solid var(--border);
  transition: background .2s, color .2s, border-color .2s;
}
.step-label { font-size: 9.5px; margin-top: 4px; color: var(--faint); font-weight: 500; line-height: 1.2; }
.step.active .step-num { background: var(--navy); color: #fff; border-color: var(--navy); }
.step.active .step-label { color: var(--navy); font-weight: 600; }
.step.done .step-num { background: var(--green); color: #fff; border-color: var(--green); }
.step.done .step-label { color: var(--muted); }

/* ---------- พื้นที่เลื่อน ---------- */
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pane { padding: 18px 16px 28px; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.pane-title { font-family: 'Prompt', sans-serif; font-weight: 600; font-size: 18px; margin: 0; }
.pane-sub { font-size: 12.5px; color: var(--muted); margin: 4px 0 16px; }

/* ---------- ฟอร์ม ---------- */
.field-label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.field {
  width: 100%; padding: 12px 13px; border: 1.5px solid var(--border); border-radius: 11px;
  font-size: 14px; background: #fff; color: inherit; margin-bottom: 4px;
}
.field:focus { outline: none; border-color: var(--blue); }
textarea.field { resize: none; line-height: 1.5; }
.field.invalid { border-color: var(--red); }
.field-error { color: var(--red); font-size: 11.5px; min-height: 16px; margin-bottom: 6px; }

/* ---------- การ์ด ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 15px; margin-bottom: 14px; }
.card-head { font-size: 12px; font-weight: 700; color: var(--navy); margin-bottom: 10px; letter-spacing: .02em; }
.row-card { display: flex; gap: 13px; }
.grow { flex: 1; min-width: 0; }

.product-strip {
  background: #f0f4fc; border: 1px solid #dce6f8; border-radius: 13px; padding: 13px;
  display: flex; gap: 12px; align-items: center; margin-top: 18px;
}
.product-strip-text { flex: 1; min-width: 0; }
.product-thumb {
  width: 52px; height: 52px; border-radius: 10px; background: var(--navy);
  object-fit: cover; flex-shrink: 0;
}
.product-thumb.lg { width: 64px; height: 64px; border-radius: 11px; }
.product-name { font-weight: 600; font-size: 13.5px; }
.product-variant { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.price { font-family: 'Prompt', sans-serif; font-weight: 700; color: var(--red); font-size: 15px; }

.item-list { list-style: none; margin: 8px 0 0; padding: 0; }
.item-list li { font-size: 11.5px; color: var(--muted); line-height: 1.7; }
.item-list li::before { content: '·'; margin-right: 6px; color: var(--faint); }

.qty-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.qty-row .price { margin-left: auto; }
.muted-sm { font-size: 12.5px; color: var(--muted); }
.tiny { font-size: 11px; color: var(--faint); }
.tiny-light { font-size: 11.5px; opacity: .8; }
.strong { font-weight: 600; font-size: 13.5px; }
.addr { line-height: 1.5; margin-top: 4px; }

.stepper { display: flex; align-items: center; gap: 2px; border: 1.5px solid var(--border); border-radius: 9px; overflow: hidden; }
.stepper button {
  width: 30px; height: 28px; border: none; background: #fff; color: var(--navy);
  font-size: 16px; font-weight: 600; cursor: pointer;
}
.stepper button:disabled { color: #cbd4e4; }
.stepper span { min-width: 26px; text-align: center; font-weight: 600; font-size: 13.5px; }

.linkbtn { margin-top: 10px; background: none; border: none; color: var(--blue); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 0; }

.total-line { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; }
.total-grand { border-top: 1px dashed var(--border); padding-top: 10px; display: flex; justify-content: space-between; align-items: center; }
.grand { font-family: 'Prompt', sans-serif; font-weight: 700; font-size: 19px; color: var(--red); }

/* ---------- บัญชีธนาคาร ---------- */
.bank-card {
  background: var(--navy); border-radius: 15px; padding: 17px; color: #fff;
  margin-bottom: 14px; position: relative; overflow: hidden;
}
.bank-blob { position: absolute; right: -22px; top: -22px; width: 90px; height: 90px; border-radius: 50%; background: rgba(228,0,43,.25); }
.bank-cap { font-size: 11.5px; opacity: .8; }
.bank-name { font-family: 'Prompt', sans-serif; font-weight: 600; font-size: 16px; margin: 4px 0 12px; }
.bank-no { font-family: 'Prompt', sans-serif; font-weight: 700; font-size: 22px; letter-spacing: .04em; }
.bank-holder { font-size: 12.5px; opacity: .85; margin-top: 4px; }
.copy-inline {
  margin-top: 10px; background: rgba(255,255,255,.16); border: none; color: #fff;
  font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 20px; cursor: pointer;
}
.bank-foot {
  border-top: 1px solid rgba(255,255,255,.18); margin-top: 13px; padding-top: 11px;
  display: flex; justify-content: space-between; align-items: center; font-size: 12.5px;
}
.bank-foot > span:first-child { opacity: .85; }
.bank-amount { font-family: 'Prompt', sans-serif; font-weight: 700; font-size: 20px; }

.reserve-note {
  background: #fff6e5; border: 1px solid #ffe0a3; color: #8a5a00;
  border-radius: 11px; padding: 10px 12px; font-size: 12px; line-height: 1.5; margin-bottom: 16px;
}
.reserve-note.expired { background: #fdecef; border-color: #f8c6cf; color: #a3122b; }

/* ---------- แนบสลิป ---------- */
.slip-drop { display: block; cursor: pointer; }
#slip-empty { border: 2px dashed #c4d0e6; border-radius: 13px; padding: 30px 16px; text-align: center; background: #fff; }
.slip-icon {
  width: 46px; height: 46px; border-radius: 12px; background: #eef3fc; margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.slip-title { font-weight: 600; font-size: 13.5px; color: var(--navy); }
.slip-hint { font-size: 11.5px; color: var(--faint); margin-top: 3px; }
#slip-filled { border-radius: 13px; overflow: hidden; border: 2px solid var(--green); position: relative; }
#slip-preview { width: 100%; display: block; max-height: 320px; object-fit: contain; background: #fff; }
.slip-ok {
  position: absolute; bottom: 0; left: 0; right: 0; background: rgba(16,185,129,.94);
  color: #fff; font-size: 12px; font-weight: 600; padding: 8px 12px;
}

/* ---------- หน้าสถานะ ---------- */
.hero { text-align: center; margin-bottom: 6px; }
.hero-icon {
  width: 66px; height: 66px; border-radius: 50%; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center; font-size: 30px;
  background: #eef3fc; animation: pop .4s ease;
}
.hero-icon.warn { background: #fdecef; color: var(--red); font-weight: 700; }
.hero-title { font-family: 'Prompt', sans-serif; font-weight: 600; font-size: 19px; }
.hero-desc { font-size: 12.5px; color: var(--muted); margin-top: 5px; line-height: 1.5; padding: 0 8px; }

.order-no-card { display: flex; justify-content: space-between; align-items: center; padding: 12px 15px; margin-top: 16px; }
.order-no { font-family: 'Prompt', sans-serif; font-weight: 700; font-size: 15px; color: var(--navy); }

.timeline { list-style: none; margin: 0; padding: 3px 1px; }
.timeline li { display: flex; gap: 13px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; }
.tl-dot {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; background: #fff; color: var(--faint); border: 2px solid var(--border);
}
.timeline li.done .tl-dot { background: var(--green); color: #fff; border-color: var(--green); }
.timeline li.current .tl-dot { background: var(--navy); color: #fff; border-color: var(--navy); }
.tl-line { width: 2px; flex: 1; background: var(--border); min-height: 18px; }
.timeline li.done .tl-line { background: var(--green); }
.timeline li:last-child .tl-line { display: none; }
.tl-body { padding-bottom: 16px; }
.timeline li:last-child .tl-body { padding-bottom: 0; }
.tl-label { font-weight: 600; font-size: 13.5px; color: var(--faint); }
.timeline li.done .tl-label, .timeline li.current .tl-label { color: var(--ink); }
.tl-time { font-size: 11.5px; color: var(--faint); margin-top: 2px; }

.track-card { background: var(--navy); border-radius: 14px; padding: 16px; color: #fff; margin-top: 14px; }
.track-row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.track-no { font-family: 'Prompt', sans-serif; font-weight: 700; font-size: 19px; letter-spacing: .04em; }
.chip { background: rgba(255,255,255,.16); border: none; color: #fff; padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; cursor: pointer; }

/* ---------- ปุ่มล่าง ---------- */
.cta-bar {
  padding: 12px 16px calc(env(safe-area-inset-bottom) + 16px);
  background: #fff; border-top: 1px solid var(--line); flex-shrink: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.cta {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  font-family: 'Prompt', sans-serif; font-weight: 600; font-size: 15px;
  background: var(--navy); color: #fff; cursor: pointer;
}
.cta:disabled { background: #c4d0e6; cursor: not-allowed; }
.cta.ghost { background: #fff; color: var(--muted); border: 1.5px solid var(--border); font-size: 14px; padding: 11px; }
.cta.busy { opacity: .75; }

/* ---------- เบ็ดเตล็ด ---------- */
.center-block { text-align: center; padding: 60px 20px; }
.muted { color: var(--muted); font-size: 13px; }
.spinner {
  width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--navy);
  border-radius: 50%; margin: 0 auto 14px; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 92px);
  transform: translateX(-50%);
  background: rgba(22,33,58,.94); color: #fff; font-size: 13px;
  padding: 10px 18px; border-radius: 22px; z-index: 50; animation: fade .2s ease;
  max-width: 86%; text-align: center;
}


/* ---------------------------------------------- ออเดอร์ค้าง และสลิปถูกปฏิเสธ */

/* การ์ดออเดอร์ค้างในหน้าเลือก กดได้ทั้งใบ ไม่ใช่แค่ตรงปุ่ม
   เพราะบนมือถือคนมักแตะกลางการ์ดมากกว่าเล็งปุ่มเล็ก ๆ */
.open-order {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  font: inherit;
}
.open-order:active { background: #fafafa; }
.open-order .oo-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.open-order .oo-no { font-size: 12px; color: #9a9a9a; }
.open-order .oo-total { font-size: 15px; font-weight: 700; color: #111; }
.open-order .oo-name { font-size: 14px; color: #111; margin-top: 4px; }
.open-order .oo-state {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f0f0f0;
  color: #555;
}
.open-order .oo-state.warn { background: #fdecef; color: #b00020; }
.open-order .oo-state.good { background: #e7f8f1; color: #1b7f4b; }

/*
 * ปุ่มในเนื้อหน้า — ต้องมีน้ำหนักเท่าปุ่ม .cta ด้านล่างจอ
 *
 * ก่อนหน้านี้มีแต่ .btn.ghost / .btn.danger ที่กำหนด "สี" ไว้ แต่ไม่เคยมีนิยาม
 * ของ .btn เองเลย ปุ่มสองอันที่ใช้คลาสนี้ ("แนบสลิปใหม่" กับ "สั่งซื้อเพิ่ม")
 * จึงตกไปเป็นปุ่มเปล่าของเบราว์เซอร์ — 80x24px ฟอนต์ 13px ไม่มีมุมโค้ง
 * ทั้งที่เป็นปุ่มที่ลูกค้าต้องกดต่อ กดยากและมองไม่เห็นว่าเป็นปุ่มหลัก
 *
 * padding 13 + เส้นขอบ 1 = 14 เท่ากับ padding ของ .cta ที่ไม่มีเส้นขอบ
 * ทำให้ทั้ง ghost (มีเส้นขอบ) และ danger (ไม่มี) สูงเท่ากันที่ 50px เท่า .cta
 */
.btn {
  padding: 13px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-family: 'Prompt', sans-serif;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}
.btn:active { opacity: .88; }
.btn.block { display: block; width: 100%; }

.btn.ghost {
  background: #fff;
  border: 1px solid #e0e0e0;
  color: #111;
}

/* แถบเตือนสลิปถูกปฏิเสธ ใช้สีแดงจุดเดียวในหน้า ให้มองปุ๊บรู้ว่าต้องลงมือทำอะไร */
.alert {
  background: #fdecef;
  border: 1px solid #f5c2cb;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.alert-title { font-weight: 700; color: #b00020; font-size: 15px; }
.alert-body { color: #6b2b34; font-size: 13px; margin: 6px 0 12px; line-height: 1.5; }
.btn.danger { background: #b00020; color: #fff; }

/*
 * แถบ "ยังไม่ได้แนบสลิป" — งานที่ค้างอยู่ ไม่ใช่ความผิดพลาด
 *
 * ใช้สีน้ำเงินของแบรนด์ ไม่ใช้แดงเหมือน .alert ตัวหลัก เพราะแดงในหน้านี้ถูกจอง
 * ไว้ให้เคส "สลิปไม่ผ่าน" ซึ่งเป็นข่าวร้ายจริง ๆ ถ้าใช้แดงทั้งสองเคส ลูกค้าที่
 * แค่ปิดหน้าไปกลางคันจะตกใจว่าออเดอร์ตัวเองมีปัญหา
 */
.alert.todo {
  background: #eef3fc;
  border-color: #c7d7f5;
}
.alert.todo .alert-title { color: var(--navy); }
.alert.todo .alert-body { color: #3c4a6b; }
.btn.primary { background: var(--navy); color: #fff; }
