:root {
  /* LINE green identity (คงโทนเดิมของ LIFF) */
  --color-primary: #06c755;
  --color-primary-dark: #04a648;
  --color-primary-soft: #e6f8ee;
  --color-bg: #f2f3f5;
  --color-card: #ffffff;
  --color-line: #e7e9ec;
  --color-text: #1b1f23;
  --color-text-secondary: #687076;
  --color-text-hint: #bdbdbd;
  --color-danger: #e5484d;
  --color-warn: #f5a524;
  --color-amber-soft: #fff6e5;
  --text-xs: 11px;
  --text-sm: 12.5px;
  --text-md: 14px;
  --text-lg: 16px;
  --text-xl: 20px;
  --font-base: "Sarabun", -apple-system, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 14px;
  --shadow-card:
    0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
body {
  font-family: var(--font-base);
  background: #c9ccd1;
  color: var(--color-text);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 24px;
  line-height: 1.5;
}
@media (max-width: 520px) {
  body {
    padding: 0;
  }
}

/* ── iOS phone frame ───────────────────────────── */
.phone {
  width: 390px;
  height: 844px;
  background: var(--color-bg);
  border-radius: 46px;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 0 0 12px #1c1c1e,
    0 0 0 14px #2c2c2e,
    0 30px 60px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
}
@media (max-width: 520px) {
  .phone {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    box-shadow: none;
  }
}
.statusbar {
  height: 50px;
  flex: 0 0 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px 0 32px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  z-index: 30;
}
.statusbar .icons {
  display: flex;
  gap: 6px;
  align-items: center;
}
.notch {
  position: absolute;
  top: 11px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 30px;
  background: #000;
  border-radius: 18px;
  z-index: 40;
}

/* ── LINE LIFF header ──────────────────────────── */
.liff-header {
  flex: 0 0 52px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  background: var(--color-card);
  border-bottom: 1px solid var(--color-line);
  z-index: 20;
}
.liff-header .back {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: 0.15s;
  color: var(--color-text);
}
.liff-header[data-back="1"] .back {
  opacity: 1;
  pointer-events: auto;
}
.liff-header .back:active {
  background: #0000000d;
}
.liff-header .htitle {
  flex: 1;
  font-size: var(--text-lg);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.liff-header .ham {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
}

/* ── body / screens ────────────────────────────── */
.app-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
.screen {
  display: none;
  padding: 18px 18px 96px;
  animation: none;
}
.screen.active {
  display: block;
}
.fade-up {
  animation: fadeUp 0.32s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ── components ────────────────────────────────── */
.hero {
  margin-top: 6px;
}
.hero h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.25;
}
.hero p {
  color: var(--color-text-secondary);
  font-size: var(--text-md);
  margin-top: 8px;
}
.fee-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
  font-weight: 600;
  font-size: var(--text-sm);
  padding: 8px 13px;
  border-radius: 999px;
  margin-top: 16px;
}
.fee-pill b {
  font-variant-numeric: tabular-nums;
}

.card {
  background: var(--color-card);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 16px;
}
.card + .card {
  margin-top: 12px;
}

.steps {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 11px 4px;
}
.step .n {
  flex: 0 0 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
  font-weight: 700;
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.step .t {
  font-size: var(--text-md);
}
.step .t span {
  display: block;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  margin-top: 1px;
}

.field {
  margin-bottom: 15px;
}
.field-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 7px;
}
.field-label .req {
  color: var(--color-danger);
}
.input-field {
  width: 100%;
  border: 1.5px solid var(--color-line);
  border-radius: 11px;
  padding: 13px 14px;
  font-size: var(--text-md);
  font-family: var(--font-base);
  background: #fff;
  transition: 0.15s;
  color: var(--color-text);
}
.input-field:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.input-field:disabled,
.input-field[readonly] {
  background: #f7f8f9;
  color: var(--color-text-secondary);
}
.input-field.mono {
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}
textarea.input-field {
  resize: none;
  line-height: 1.5;
}
.field-hint {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: 6px;
}

.btn-primary {
  width: 100%;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 15px;
  font-size: var(--text-md);
  font-weight: 700;
  font-family: var(--font-base);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: 0.12s;
}
.btn-primary:active {
  background: var(--color-primary-dark);
  transform: scale(0.99);
}
.btn-primary:disabled {
  background: #c9decf;
  cursor: not-allowed;
}
.btn-ghost {
  width: 100%;
  background: transparent;
  color: var(--color-text-secondary);
  border: none;
  padding: 13px;
  font-size: var(--text-md);
  font-weight: 600;
  font-family: var(--font-base);
  cursor: pointer;
}
.btn-outline {
  width: 100%;
  background: #fff;
  color: var(--color-primary-dark);
  border: 1.5px solid var(--color-primary);
  border-radius: 12px;
  padding: 14px;
  font-size: var(--text-md);
  font-weight: 700;
  font-family: var(--font-base);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-outline:active {
  background: var(--color-primary-soft);
}
.btn-fetch {
  flex: 0 0 auto;
  background: var(--color-primary-dark);
  color: #fff;
  border: none;
  border-radius: 11px;
  padding: 0 16px;
  font-weight: 600;
  font-size: var(--text-sm);
  font-family: var(--font-base);
  cursor: pointer;
}
.stack-12 {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  font-size: var(--text-md);
}
.kv:not(:last-child) {
  border-bottom: 1px dashed var(--color-line);
}
.kv .k {
  color: var(--color-text-secondary);
  flex: 0 0 auto;
}
.kv .v {
  text-align: right;
  font-weight: 600;
}
.eyebrow {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--color-text-hint);
  margin-bottom: 10px;
}
.inv {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--color-primary-dark);
  font-size: var(--text-md);
}
.container-no {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 1px;
  margin-top: 2px;
}

/* receipt preview block */
.receipt {
  position: relative;
  background: #fff;
  border: 1px solid var(--color-line);
  border-radius: 12px;
  padding: 18px;
  overflow: hidden;
}
.receipt .wm {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.receipt .wm span {
  font-size: 34px;
  font-weight: 800;
  color: rgba(229, 72, 77, 0.13);
  transform: rotate(-22deg);
  letter-spacing: 3px;
  white-space: nowrap;
  border: 3px solid rgba(229, 72, 77, 0.13);
  padding: 6px 18px;
  border-radius: 8px;
}
.receipt h4 {
  font-size: var(--text-md);
  font-weight: 700;
  margin-bottom: 4px;
}
.receipt .small {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}
.r-row {
  display: flex;
  gap: 10px;
  font-size: var(--text-sm);
  padding: 5px 0;
}
.r-row .lbl {
  flex: 0 0 76px;
  color: var(--color-text-secondary);
}
.r-row .val {
  flex: 1;
  font-weight: 600;
}
.r-row .val.changed {
  color: var(--color-primary-dark);
  background: var(--color-primary-soft);
  border-radius: 5px;
  padding: 1px 5px;
  margin: -1px -5px;
}

.diff {
  margin-top: 4px;
}
.diff-row {
  padding: 9px 0;
  border-bottom: 1px dashed var(--color-line);
}
.diff-row:last-child {
  border-bottom: none;
}
.diff-row .dk {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-weight: 600;
}
.diff-row .old {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-decoration: line-through;
  text-decoration-color: var(--color-danger);
}
.diff-row .new {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-primary-dark);
}
.diff-row.same .new {
  color: var(--color-text);
}

.fee-box {
  background: var(--color-card);
  border: 1px solid var(--color-line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 14px;
}
.fee-box.free {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
}
.fee-line {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-md);
  padding: 4px 0;
}
.fee-line.total {
  border-top: 1px solid var(--color-line);
  margin-top: 6px;
  padding-top: 10px;
  font-weight: 700;
  font-size: var(--text-lg);
}
.fee-line .num {
  font-variant-numeric: tabular-nums;
}

.banner {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 11px;
  font-size: var(--text-sm);
  margin-top: 14px;
  align-items: flex-start;
}
.banner.info {
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
}
.banner.warn {
  background: var(--color-amber-soft);
  color: #9a6700;
}
.banner svg {
  flex: 0 0 18px;
  margin-top: 1px;
}

/* QR */
.qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 0 4px;
}
.qr-head {
  background: #1a3a6b;
  color: #fff;
  width: 100%;
  border-radius: 10px 10px 0 0;
  padding: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: var(--text-md);
}
.qr-box {
  border: 1px solid var(--color-line);
  border-top: none;
  border-radius: 0 0 10px 10px;
  padding: 18px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.qr-amt {
  font-size: 26px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.poll {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  margin-top: 6px;
}
.spinner {
  width: 15px;
  height: 15px;
  border: 2.4px solid var(--color-line);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* success */
.success-ico {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: var(--color-primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 14px auto 6px;
  animation: pop 0.4s cubic-bezier(0.2, 0.8, 0.3, 1.4) both;
}
@keyframes pop {
  from {
    transform: scale(0.5);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
.center {
  text-align: center;
}

.lookup-loading {
  display: none;
  align-items: center;
  gap: 8px;
  color: var(--color-primary-dark);
  font-size: var(--text-sm);
  margin-top: 10px;
}
.lookup-loading.on {
  display: flex;
}
.verified {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  margin-left: 8px;
}

.empty-ico {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #fde8e8;
  color: var(--color-danger);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 24px auto 10px;
}

/* rich menu */
.rich-menu {
  flex: 0 0 82px;
  display: flex;
  background: var(--color-card);
  border-top: 1px solid var(--color-line);
  z-index: 20;
}
.rich-menu-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-hint);
  cursor: pointer;
  transition: 0.12s;
}
.rich-menu-btn.active {
  color: var(--color-primary);
}
.home-indicator {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 134px;
  height: 5px;
  background: #1c1c1e;
  border-radius: 3px;
  z-index: 40;
}

/* bottom sheet */
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  z-index: 50;
}
.sheet-backdrop.on {
  opacity: 1;
  pointer-events: auto;
}
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-radius: 22px 22px 0 0;
  padding: 8px 22px 34px;
  transform: translateY(110%);
  transition: 0.28s cubic-bezier(0.2, 0.8, 0.3, 1);
  z-index: 51;
  text-align: center;
}
.sheet.on {
  transform: none;
}
.sheet-handle {
  width: 38px;
  height: 4px;
  background: var(--color-line);
  border-radius: 3px;
  margin: 8px auto 16px;
}
.sheet-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}
.sheet-icon.warn {
  background: var(--color-amber-soft);
  color: var(--color-warn);
}
.sheet-title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: 6px;
}
.sheet-text {
  font-size: var(--text-md);
  color: var(--color-text-secondary);
  margin-bottom: 18px;
}

/* toast */
.toast {
  position: absolute;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1b1f23;
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s;
  z-index: 60;
  white-space: nowrap;
}
.toast.on {
  opacity: 1;
  transform: translateX(-50%);
}
.toast svg {
  color: var(--color-primary);
}

.demo-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: var(--text-xs);
  color: var(--color-text-hint);
  margin-top: 16px;
  cursor: pointer;
}
.demo-toggle b {
  color: var(--color-text-secondary);
}

/* home: greeting + menu grid */
.liff-ctrls {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--color-text-secondary);
  padding-right: 4px;
}
.greet-date {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: 4px;
}
.greet {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.4px;
  margin-top: 3px;
}
.greet-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.greet-text {
  min-width: 0;
}
.greet-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--color-card);
  box-shadow: var(--shadow-card);
  background: var(--color-primary-soft);
  display: none;
}
.greet-avatar.on {
  display: block;
}
.section-label {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text-secondary);
  margin: 22px 0 12px;
}
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.menu-card {
  background: var(--color-card);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 16px;
  cursor: pointer;
  position: relative;
  transition: 0.12s;
  min-height: 130px;
  display: flex;
  flex-direction: column;
}
.menu-card:active {
  transform: scale(0.98);
}
.menu-card .mc-ico {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.menu-card .mc-title {
  font-weight: 700;
  font-size: var(--text-md);
  margin-top: auto;
  padding-top: 14px;
}
.menu-card .mc-sub {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: 3px;
  line-height: 1.45;
}
.menu-card.soon {
  cursor: default;
}
.menu-card.soon .mc-ico,
.menu-card.soon .mc-title,
.menu-card.soon .mc-sub {
  opacity: 0.45;
}
.soon-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 10px;
  font-weight: 700;
  color: var(--color-text-hint);
  background: #f2f3f5;
  padding: 3px 8px;
  border-radius: 999px;
}
.mc-ico.green {
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
}
.mc-ico.blue {
  background: #e7f0fb;
  color: #2563eb;
}
.mc-ico.muted {
  background: #f2f3f5;
  color: var(--color-text-hint);
}
.mc-ico.amber {
  background: #fef3c7;
  color: #b45309;
}

/* ════════════════════════════════════════════════════════════════════
   โหมดใช้งานจริงใน LINE (LIFF) — เอา chrome จำลองมือถือออก ให้เต็มจอ
   (chrome จริง เช่น status bar / header / close button มาจาก LINE เอง)
   ════════════════════════════════════════════════════════════════════ */
body {
  background: var(--color-bg);
  padding: 0;
  display: block;
}
.phone {
  width: 100%;
  height: 100dvh;
  border-radius: 0;
  box-shadow: none;
}

/* ซ่อนของปลอมที่จำลองกรอบมือถือ */
.statusbar,
.notch,
.home-indicator {
  display: none !important;
}
.liff-ctrls {
  display: none !important;
} /* ปุ่ม − ✕ ซ้ำกับ LINE */
.liff-header[data-back="0"] {
  display: none;
} /* ซ่อน header แอปบนหน้าหลัก (LINE โชว์ชื่อแล้ว) */

/* ── ฟอนต์ Kanit ── */
:root {
  --font-base: "Kanit", -apple-system, system-ui, sans-serif;
}

/* ── ล็อกโครงหน้าจอ: เลื่อนได้เฉพาะ content ตรงกลาง, หัว+เมนูล่างอยู่นิ่งสนิท ── */
html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
.phone {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.app-body {
  overscroll-behavior: contain;
}
.rich-menu {
  /* flex-basis ต้องมีหน่วย (เดิม "72" ไม่มี px → ค่าโดน drop ทั้งบรรทัด)
     + box-sizing:border-box ทำให้ padding safe-area กินเข้าในปุ่ม → เมนูลอยสูงไม่นิ่งตามรุ่นเครื่อง
     แก้: รวม safe-area ไว้ใน basis แล้วให้ padding ดันลงล่าง = แถวปุ่มคงที่ 72px เสมอ */
  flex: 0 0 calc(72px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
}
/* ── top safe-area: กัน header/หน้าหลักโดน notch/status bar บัง (โหมด LIFF บางโหมด LINE ไม่วาดหัวให้) ── */
.liff-header {
  flex-basis: calc(52px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
}
/* หน้าหลัก/success ซ่อน header → ดันเนื้อหาลงพ้น notch แทน (เฉพาะตอนไม่มี header) */
.liff-header[data-back="0"] + .app-body {
  padding-top: env(safe-area-inset-top);
}
.screen {
  padding-bottom: 24px;
}

/* ════════════════════════════════════════════════════════
   เพิ่มใหม่: Boot splash · Onboarding · Ad carousel
   ════════════════════════════════════════════════════════ */

/* ── Boot splash ───────────────────────────────── */
.boot-splash {
  position: absolute;
  inset: 0;
  z-index: 60;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 24px;
  transition: opacity 0.35s ease;
}
.boot-splash.hide {
  opacity: 0;
  pointer-events: none;
}
.bs-logo {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(6, 199, 85, 0.32);
}
.bs-name {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-top: 2px;
}
.bs-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--color-line);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: bsspin 0.85s linear infinite;
  margin-top: 6px;
}
@keyframes bsspin {
  to {
    transform: rotate(360deg);
  }
}
.bs-text {
  font-size: var(--text-md);
  color: var(--color-text-secondary);
}

/* ── Onboarding overlay ────────────────────────── */
.onboard {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: var(--color-bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: none;
}
.onboard.on {
  display: block;
}
.ob-inner {
  padding: 40px 22px 32px;
  min-height: 100%;
}
.ob-head {
  text-align: center;
  margin-bottom: 26px;
}
.ob-icon {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.ob-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.ob-sub {
  font-size: var(--text-md);
  color: var(--color-text-secondary);
  margin-top: 8px;
  line-height: 1.5;
}

/* ── Ad carousel ───────────────────────────────── */
.ad-section {
  margin-top: 8px;
}
.ad-carousel {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.ad-track {
  display: flex;
  transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.ad-slide {
  flex: 0 0 100%;
  aspect-ratio: 16 / 7;
  position: relative;
  background: var(--color-line);
}
.ad-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ad-slide a {
  position: absolute;
  inset: 0;
}
.ad-dots {
  position: absolute;
  bottom: 9px;
  left: 0;
  right: 0;
  display: flex;
  gap: 6px;
  justify-content: center;
  z-index: 2;
}
.ad-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.25);
  transition: 0.2s;
}
.ad-dot.on {
  background: #fff;
  width: 18px;
  border-radius: 99px;
}

/* ── ที่อยู่ใบเสร็จค่าบริการ (107) — radio card ──────────────── */
.fee-opt {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1.6px solid var(--color-line);
  border-radius: 13px;
  padding: 13px;
  margin-bottom: 10px;
  background: var(--color-card);
  cursor: pointer;
}
.fee-opt.sel {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}
.fee-radio {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  border: 2px solid var(--color-text-hint);
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fee-opt.sel .fee-radio {
  border-color: var(--color-primary);
}
.fee-opt.sel .fee-radio::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary);
}
.fee-opt-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.fee-opt-title {
  font-weight: 600;
  font-size: var(--text-md);
  color: var(--color-text);
}
.fee-opt-sum {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.55;
  white-space: pre-line;
}

/* ปุ่มกำลังทำรายการ — กันกดเบิ้ล */
.is-busy {
  pointer-events: none;
  opacity: 0.55;
  cursor: progress;
}

/* ── แก้: หน้าสั้นก็เลื่อนได้ + เมนูล่างลอยหนีจากขอบล่าง ──
   สาเหตุ: บนมือถือ/LINE LIFF ค่า 100vh สูงกว่าพื้นที่จอจริง (โดนแถบ browser กิน)
   → ทั้งหน้าเลื่อนได้ และแถบเมนูล่างหลุดจากขอบล่างที่มองเห็น
   วิธีแก้: ล็อก body ไม่ให้เลื่อน (ให้ .app-body เป็นตัวเลื่อนตัวเดียว) + ใช้ 100dvh */
.app-body {
  min-height: 0;
}
@media (max-width: 520px) {
  html,
  body {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    overscroll-behavior: none;
  }
  .phone {
    height: 100vh; /* fallback เครื่อง/เว็บวิวเก่า */
    height: 100dvh; /* ความสูงจอที่มองเห็นจริง */
  }
}

/* ปุ่มยกเลิกในหน้าชำระเงิน — ให้เห็นชัด (เดิมจางเกินไป) */
.btn-cancel {
  width: 100%;
  background: transparent;
  color: var(--color-danger);
  border: 1.5px solid var(--color-danger);
  border-radius: 12px;
  padding: 14px;
  font-size: var(--text-md);
  font-weight: 700;
  font-family: var(--font-base);
  cursor: pointer;
}
.btn-cancel:active {
  background: rgba(229, 72, 77, 0.08);
}
