/* Craftfiti Pay — เฉพาะส่วนที่ brand/craftfiti.css ไม่มี · ทุกสี/ระยะเป็น token ของแบรนด์ */
html { background: var(--ink-3); }
body { margin: 0; min-height: 100vh; -webkit-text-size-adjust: 100%; }
* { box-sizing: border-box; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.pay-top { position: sticky; top: 0; z-index: 5; padding-top: env(safe-area-inset-top); height: calc(var(--size-topbar) + env(safe-area-inset-top)); }
.pay-top__home { display: flex; align-items: center; }
.pay-top__app { font-family: var(--font-marker); font-size: 20px; color: var(--red); transform: rotate(var(--tilt-note)); margin-left: -6px; flex: 1; }
.pay-top__gear { width: var(--size-tap); height: var(--size-tap); border: none; background: transparent; color: var(--ink); display: flex; align-items: center; justify-content: center; border-radius: var(--radius-round); }

.pay-main { max-width: var(--size-column); margin: 0 auto; padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); background: var(--ink); min-height: calc(100vh - var(--size-topbar)); }
.pay-loading { text-align: center; padding: 80px 0; color: var(--muted); font-size: 14px; }
.pay-loading__mark { font-family: var(--font-marker); font-size: 44px; color: var(--yellow); transform: rotate(var(--tilt-note)); display: inline-block; margin-bottom: 10px; }

/* ---------- หน้าแรก ---------- */
.pay-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 6px 0 2px; }
.pay-h .cf-h-section { font-size: 22px; }
.pay-h__count { font-family: var(--font-marker); color: var(--red); font-size: 18px; transform: rotate(var(--tilt-note)); }
.pay-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 20px; }
.pay-actions .cf-btn { height: var(--size-action); font-size: 13px; letter-spacing: 1.5px; padding: 0 10px; }
.pay-actions .cf-btn--ghost { color: var(--cream); border-color: var(--cream); }
.pay-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.pay-tabs .cf-chip { flex: 1; height: 40px; background: transparent; color: var(--cream); border-color: var(--outline-cream); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; }
.pay-tabs .cf-chip[aria-pressed="true"] { background: var(--cream); color: var(--ink); }
.pay-empty { padding: 40px 10px; text-align: center; color: var(--muted); font-family: var(--font-thai); font-size: 14px; line-height: 1.6; }
.pay-list { display: flex; flex-direction: column; gap: 14px; }

/* การ์ดรายการ = ตั๋ว (cf-ticket) บนพื้นคืน */
.pay-card { text-align: left; width: 100%; padding: 18px 14px 14px; margin-top: 8px; }
.pay-card--done { opacity: 0.72; }
.pay-card__top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.pay-card__name { font-family: var(--font-thai); font-size: 17px; font-weight: 600; line-height: 1.3; }
.pay-card__sub { font-size: 12px; color: var(--label); margin-top: 2px; }
.pay-card__amt { font-family: var(--font-display); font-weight: 900; font-size: 24px; white-space: nowrap; }
.pay-card__amt small { font-family: var(--font-sans); font-weight: 600; font-size: 11px; color: var(--label); display: block; text-align: right; }
.pay-card__r { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
/* ระยะ 4a: ป้ายสถานะคิวมุมขวาการ์ด (ทั้งการ์ดกดได้ → ป้ายเป็นแค่ตัวหนังสือ ไม่ใช่ปุ่ม) */
.pay-card__claim { font-family: var(--font-marker); font-size: 15px; line-height: 1; background: var(--ink); color: var(--yellow); padding: 5px 9px 4px; border-radius: var(--radius-note); white-space: nowrap; transform: rotate(var(--tilt-note)); }
.pay-card__claim--me { color: #8fd69b; }
.pay-card__claim--lock { font-family: var(--font-thai); font-size: 12px; font-weight: 600; background: var(--red); color: var(--cream); transform: none; }
.pay-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pay-step { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 2px; border: var(--stroke-grid) solid var(--ink); border-radius: var(--radius-note); font-size: 9px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.pay-step__mark { width: 18px; height: 18px; border-radius: var(--radius-round); border: var(--stroke-control) solid var(--ink); display: flex; align-items: center; justify-content: center; font-size: 11px; }
.pay-step--on { background: var(--ink); color: var(--yellow); opacity: 1; border-style: solid; }
.pay-step--on .pay-step__mark { background: var(--yellow); border-color: var(--yellow); color: var(--ink); }
.pay-step--later { opacity: 0.45; border-style: dashed; }
.pay-card__miss { font-family: var(--font-thai); font-size: 12px; color: var(--red); }
.pay-card .cf-stamp { position: absolute; right: 10px; top: 8px; font-size: 20px; padding: 4px 8px 2px; border-width: 3px; }

/* ---------- ฟอร์ม (กระดาษ) ---------- */
.pay-sheet { position: relative; background: var(--paper); color: var(--ink); border-radius: var(--radius-paper); padding: 26px 16px 20px; box-shadow: var(--shadow-sheet); display: flex; flex-direction: column; gap: 16px; }
.pay-sheet .cf-tape { top: -12px; }
.pay-sheet__h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pay-sheet__h .cf-h-page { font-size: 26px; }
.pay-back { width: var(--size-tap); height: var(--size-tap); border-radius: var(--radius-round); border: var(--stroke-grid) solid var(--ink); background: transparent; display: flex; align-items: center; justify-content: center; color: var(--ink); }
.pay-kind { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay-cats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pay-cats .cf-chip, .pay-kind .cf-chip { height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; letter-spacing: 1px; line-height: 1.1; padding: 0 4px; }
.pay-cats .cf-chip small, .pay-kind .cf-chip small { font-family: var(--font-thai); font-weight: 400; font-size: 10px; letter-spacing: 0; opacity: 0.8; }
.pay-input--big { font-family: var(--font-display); font-weight: 900; font-size: 26px; text-align: right; }
.pay-sw { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: var(--size-field); padding: 0 14px; border: var(--stroke-control) solid var(--ink); border-radius: var(--radius-control); background: var(--cream); }
.pay-sw__l { font-size: 13px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.pay-sw__l small { display: block; font-family: var(--font-thai); font-weight: 400; font-size: 11px; letter-spacing: 0; text-transform: none; color: var(--label); }
.pay-sw input { width: 44px; height: 24px; accent-color: var(--ink); margin: 0; }
.pay-net { background: var(--ink); color: var(--cream); border-radius: var(--radius-card); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.pay-net__k { font-size: 11px; font-weight: 700; letter-spacing: 2px; color: var(--yellow); }
.pay-net__v { font-family: var(--font-display); font-weight: 900; font-size: 36px; line-height: 1; }
.pay-net__v small { font-family: var(--font-sans); font-size: 14px; font-weight: 500; }
.pay-net__sub { font-family: var(--font-thai); font-size: 12px; color: var(--muted); }
.pay-memo { display: flex; flex-direction: column; gap: 8px; }
.pay-memo__box { display: flex; align-items: center; gap: 8px; min-height: var(--size-field); padding: 8px 8px 8px 14px; border: var(--stroke-control) dashed var(--ink); border-radius: var(--radius-control); background: var(--cream); }
.pay-memo__t { flex: 1; font-family: var(--font-thai); font-size: 16px; font-weight: 600; word-break: break-word; }
.pay-memo__box .cf-btn--pill { height: 36px; padding: 0 14px; }
.pay-hint { font-family: var(--font-thai); font-size: 12px; color: var(--line); line-height: 1.5; }
.pay-errs { margin: 0; padding: 10px 14px 10px 28px; background: var(--hilite); border: var(--stroke-control) dashed var(--red); border-radius: var(--radius-note); color: var(--red); font-family: var(--font-thai); font-size: 13px; line-height: 1.6; }
.pay-foot { display: flex; flex-direction: column; gap: 10px; }
.pay-foot .cf-btn--ghost.danger { color: var(--red); border-color: var(--red); }
.pay-names { font-size: 12px; display: flex; flex-direction: column; gap: 6px; }
.pay-names__row { display: flex; justify-content: space-between; gap: 10px; }
.pay-names__k { color: var(--label); font-weight: 600; letter-spacing: 1px; flex-shrink: 0; }
.pay-names__v { font-family: var(--font-thai); text-align: right; word-break: break-word; }

/* เคส B: ใบเสร็จแต่ละใบ */
.pay-rc { border: var(--stroke-control) solid var(--ink); border-radius: var(--radius-card); background: var(--cream); padding: 12px; display: flex; flex-direction: column; gap: 8px; position: relative; }
.pay-rc__n { position: absolute; left: 10px; top: -11px; }
.pay-rc__del { position: absolute; right: 10px; top: -16px; width: 32px; height: 32px; border-radius: var(--radius-round); border: var(--stroke-grid) solid var(--ink); background: var(--cream); color: var(--red); font-size: 16px; }
.pay-rc .pay-cats .cf-chip { height: 44px; font-size: 10px; }
.pay-rc .cf-input { height: 44px; font-size: 15px; }

.pay-rc__file { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 4px; border-top: var(--stroke-grid) dashed var(--line); }
.pay-rc__st { font-family: var(--font-thai); font-size: 12px; color: var(--label); }
.pay-rc__st--held { color: var(--ink); font-weight: 600; }
.pay-rc__st--ok { color: var(--green); font-weight: 600; text-decoration: none; }

/* ---------- ระยะ 2: ไฟล์ → Drive ---------- */
.pay-pick { position: relative; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; white-space: nowrap; }
.pay-pick[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.cf-btn--pill.pay-pick, .pay-file__act .cf-btn--pill { height: 36px; padding: 0 14px; font-size: 12px; text-decoration: none; }
.pay-pick--want { background: var(--yellow); color: var(--ink); border: var(--stroke-control) solid var(--ink); }   /* pill ปกติ = ตัวหนังสือเหลือง → พื้นเหลืองต้องเปลี่ยนตัวหนังสือเป็นดำ ไม่งั้นมองไม่เห็น */
.pay-sep { display: flex; align-items: center; gap: 10px; font-size: 11px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: var(--label); }
.pay-sep::before, .pay-sep::after { content: ''; flex: 1; border-top: var(--stroke-grid) dashed var(--line); }
.pay-files { display: flex; flex-direction: column; gap: 10px; }
.pay-files__h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pay-files__mode { background: var(--red); color: var(--cream); }
.pay-hint a { color: inherit; }
.pay-hint--warn { color: var(--red); }
.pay-file { border: var(--stroke-control) solid var(--ink); border-radius: var(--radius-card); background: var(--cream); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.pay-file--done { border-style: solid; background: var(--paper); }
.pay-file__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pay-file__k { font-size: 13px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pay-file__k small { font-family: var(--font-thai); font-weight: 400; font-size: 11px; letter-spacing: 0; text-transform: none; color: var(--label); }
.pay-file__ok { width: 20px; height: 20px; border-radius: var(--radius-round); background: var(--ink); color: var(--yellow); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.pay-file__act { display: flex; gap: 6px; flex-shrink: 0; }
.pay-file__name { font-family: var(--font-thai); font-size: 12px; color: var(--label); word-break: break-word; }
.pay-file__warn { font-family: var(--font-thai); font-size: 12px; color: var(--red); }
.pay-file__warn summary { cursor: pointer; }
.pay-file__rm { align-self: flex-start; background: none; border: none; padding: 4px 0; font-size: 11px; color: var(--label); text-decoration: underline; }
.pay-att { border-top: var(--stroke-grid) dashed var(--ink); padding-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.pay-att__thumbs { display: flex; gap: 8px; overflow-x: auto; }
.pay-att__thumbs img { height: 110px; width: auto; max-width: 100%; border: var(--stroke-grid) solid var(--ink); border-radius: var(--radius-note); background: var(--paper); }
.pay-att__pdf { height: 110px; width: 86px; flex-shrink: 0; border: var(--stroke-grid) solid var(--ink); border-radius: var(--radius-note); display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 900; gap: 4px; padding: 4px; }
.pay-att__pdf small { font-family: var(--font-thai); font-weight: 400; font-size: 9px; word-break: break-all; text-align: center; color: var(--label); }
.pay-att__busy { font-family: var(--font-thai); font-size: 14px; font-weight: 600; }
.pay-att__note { font-family: var(--font-thai); font-size: 12px; color: var(--label); line-height: 1.5; }
.pay-att__err { font-family: var(--font-thai); font-size: 13px; color: var(--red); line-height: 1.5; }
.pay-chk { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-family: var(--font-thai); font-size: 13px; line-height: 1.45; }
.pay-chk li { display: flex; gap: 8px; align-items: flex-start; }
.pay-chk li > span { flex-shrink: 0; width: 18px; text-align: center; font-weight: 900; }
.pay-chk--ok > span { color: var(--green); }
.pay-chk--warn { color: var(--red); font-weight: 600; }
.pay-chk--info { color: var(--label); }

/* ---------- ตั้งค่า ---------- */
.pay-settings .cf-field__label { color: var(--ink); }
.pay-adv { margin: 4px 0 12px; font-size: 13px; opacity: .75; }
.pay-adv summary { cursor: pointer; padding: 8px 0; }
.pay-adv[open] { opacity: 1; }
.pay-status { font-family: var(--font-thai); font-size: 13px; line-height: 1.6; }
.pay-status b { color: var(--green); }

/* ---------- toast ---------- */
.pay-toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) rotate(-1deg); z-index: 20; max-width: 90vw; background: var(--yellow); color: var(--ink); font-family: var(--font-thai); font-size: 14px; font-weight: 600; padding: 10px 16px; box-shadow: var(--shadow-sticker); pointer-events: none; }   /* ป้ายลอยทับปุ่ม Save ได้ → ให้นิ้วทะลุไปกดปุ่มข้างใต้ */
.pay-toast--bad { background: var(--red); color: var(--cream); }
.pay-offline { background: var(--red); color: var(--cream); font-family: var(--font-thai); font-size: 12px; text-align: center; padding: 6px; margin: -16px -16px 14px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* 11 ต.ค.: ปุ่มยึดยอดตามเอกสาร (กฎแบงค์) เต็มความกว้าง อยู่เหนือปุ่ม Upload anyway */
.pay-att__fix { width: 100%; font-size: 13px; }

/* 12 ต.ค.: คู่มือในแอป (#/help) */
.pay-top__sync { font-size: 11px; color: var(--ink); opacity: .7; white-space: nowrap; }
.pay-top__ref { font-size: 22px; font-weight: 900; }
.pay-top__ref.is-spin { animation: paySpin 1s linear infinite; }
/* 20 ต.ค. (แบงค์): แถบโหลดข้อมูลล่าสุด + % */
.pay-prog { position: fixed; left: 0; right: 0; pointer-events: none; top: calc(var(--size-topbar) + env(safe-area-inset-top)); z-index: 5; height: 22px; background: var(--cream); border-bottom: 1px solid rgba(0,0,0,.12); overflow: hidden; }
.pay-prog__bar { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--yellow, #f5d547); transition: width .25s ease; }
.pay-prog__t { position: relative; display: block; text-align: center; font-size: 12px; line-height: 22px; color: var(--ink); font-weight: 700; }
.pay-prog.is-bad .pay-prog__bar { background: #e9a2a6; }
.pay-net__copy { align-self: flex-start; margin-top: 4px; background: var(--yellow, #f5d547) !important; color: var(--ink) !important; border-color: var(--yellow, #f5d547) !important; }
.pay-top__help { font-family: var(--font-display); font-weight: 900; font-size: 18px; }
.pay-empty a { color: var(--yellow); }
.pay-help__s { border: var(--stroke-control) solid var(--ink); border-radius: var(--radius-card); background: var(--cream); }
.pay-help__s summary { cursor: pointer; padding: 12px 14px; font-family: var(--font-thai); font-size: 15px; font-weight: 700; min-height: var(--size-tap); display: flex; align-items: center; }
.pay-help__s[open] summary { border-bottom: var(--stroke-grid) dashed var(--line); }
.pay-help__b { padding: 4px 14px 12px; font-family: var(--font-thai); font-size: 14px; line-height: 1.65; }
.pay-help__b p { margin: 8px 0; }
.pay-help__b ol, .pay-help__b ul { margin: 8px 0; padding-left: 22px; }
.pay-help__b li { margin: 4px 0; }
.pay-help__b code { font-family: var(--font-thai); font-size: 13px; background: var(--paper); border: var(--stroke-grid) solid var(--line); border-radius: 4px; padding: 0 4px; word-break: break-word; }
.pay-help .cf-btn, .pay-help__link { text-align: center; text-decoration: none; display: flex; align-items: center; justify-content: center; }

/* 12 ต.ค.: ชื่อซ้ำวันเดียวกัน → -2 */
.pay-hint--seq { color: var(--ink); font-weight: 600; }

/* 12 ต.ค.: หลายคนโอน → การ์ดบอกว่าใครจด/ใครโอน */
.pay-card__by { font-family: var(--font-thai); font-size: 11px; color: var(--label); margin-top: 2px; }

/* ระยะ 3: กล่องยืนยันยอด (หลังแนบสลิป → กดยืนยันแล้วระบบลงยอดในชีท P&L) */
.pay-confirm { border: var(--stroke-control) solid var(--ink); border-radius: var(--radius-card); background: var(--cream); padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.pay-confirm__row { font-family: var(--font-thai); font-size: 13px; line-height: 1.5; word-break: break-word; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
/* 19 ต.ค.: ช่องในชีทตัวใหญ่ (แบงค์ดูช่องนี้) + สูตรเดิม→ใหม่ + ส่วนปรับ เดือน/หมวด/ยอด */
.pay-confirm__a1 { font-family: var(--font-sans); font-weight: 800; font-size: 15px; letter-spacing: 1px; background: var(--ink); color: var(--yellow); padding: 3px 9px; border-radius: var(--radius-note); white-space: nowrap; }
.pay-confirm__f { flex-basis: 100%; font-size: 12px; color: var(--label); word-break: break-all; }
.pay-adj { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-bottom: 10px; border-bottom: var(--stroke-grid) dashed var(--line); }
.pay-adj__f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pay-adj__f > span { font-family: var(--font-thai); font-size: 12px; font-weight: 600; color: var(--label); }
.pay-adj__f .cf-input { height: 44px; font-size: 14px; }
.pay-adj__f--wide, .pay-adj__hint { grid-column: 1 / -1; }
.pay-adj__amt { text-align: right; }
.pay-rc__f { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pay-rc__l { font-family: var(--font-thai); font-size: 12px; font-weight: 600; color: var(--label); }
.pay-rc__l small { font-weight: 400; color: var(--fine); }
.pay-confirm__done { font-family: var(--font-thai); font-size: 14px; font-weight: 700; line-height: 1.5; color: var(--green); word-break: break-word; }
.pay-confirm .cf-btn[disabled] { opacity: .4; }

/* ระยะ 3.1: แถบสรุปบนหน้าแรก + หน้าสรุปรายเดือน (#/summary) */
.pay-sum { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: var(--size-tap); padding: 10px 14px; margin: 0 0 16px; border: var(--stroke-control) dashed var(--yellow); border-radius: var(--radius-card); color: var(--cream); text-decoration: none; }
.pay-sum__t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pay-sum__l1 { font-family: var(--font-thai); font-size: 15px; font-weight: 700; }
.pay-sum__l2 { font-family: var(--font-thai); font-size: 12px; color: var(--muted); }
.pay-sum__go { font-family: var(--font-display); font-weight: 900; font-size: 26px; color: var(--yellow); line-height: 1; }
.pay-mon { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pay-mon .cf-btn { width: var(--size-tap); height: var(--size-tap); padding: 0; flex-shrink: 0; color: var(--ink); border-color: var(--ink); }
.pay-mon .cf-btn[disabled] { opacity: .3; }
.pay-mon__l { font-family: var(--font-display); font-weight: 900; font-size: 24px; }
.pay-summary .cf-field__label { color: var(--ink); }
.pay-summary__empty { color: var(--label); padding: 20px 10px; }
.pay-sumb { display: flex; flex-direction: column; gap: 6px; }
.pay-sumr { border: var(--stroke-grid) solid var(--ink); border-radius: var(--radius-note); background: var(--cream); font-family: var(--font-thai); font-size: 14px; }
.pay-sumr:not(.pay-sumr--d), .pay-sumr__s { display: grid; grid-template-columns: 1fr auto 34px; gap: 8px; align-items: center; padding: 8px 10px; }
.pay-sumr__s { cursor: pointer; min-height: 36px; }
.pay-sumr__a { min-width: 0; word-break: break-word; font-weight: 600; }
.pay-sumr__b { font-weight: 800; text-align: right; }
.pay-sumr__c { text-align: right; color: var(--label); font-size: 12px; }
.pay-sumd { padding: 4px 10px 8px; border-top: var(--stroke-grid) dashed var(--line); display: flex; flex-direction: column; gap: 4px; }
.pay-sumd__r { display: flex; justify-content: space-between; gap: 10px; font-family: var(--font-thai); font-size: 13px; }
.pay-sumd__r span:first-child { min-width: 0; word-break: break-word; }
.pay-todo { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: var(--size-tap); padding: 8px 12px; text-align: left; border: var(--stroke-control) solid var(--ink); border-radius: var(--radius-control); background: var(--cream); color: var(--ink); font-family: var(--font-thai); font-size: 14px; font-weight: 600; }
.pay-sumw { font-family: var(--font-display); font-weight: 900; font-size: 28px; }
.pay-sumw small { font-family: var(--font-sans); font-size: 13px; font-weight: 500; }

/* ---------- ระยะ 4a: หน้าโอน (#/pay/:id) ---------- */
.pay-pay { gap: 14px; }
.pay-pay__who { font-family: var(--font-thai); }
.pay-pay__name { font-size: 20px; font-weight: 600; line-height: 1.3; }
.pay-pay__sub { font-size: 13px; color: var(--label); margin-top: 2px; }
.pay-pay__by { font-size: 12px; color: var(--fine); margin-top: 2px; }
.pay-pay__claim, .pay-pay__slip { display: flex; flex-direction: column; gap: 10px; }
.pay-pay__slip .pay-sw { height: auto; min-height: var(--size-field); padding: 8px 14px; }
.pay-pay .pay-pick { height: var(--size-submit); border-radius: var(--radius-submit); font-size: 16px; letter-spacing: 1px; width: 100%; }
.pay-pay__lock { font-family: var(--font-thai); font-size: 14px; font-weight: 600; color: var(--red); line-height: 1.5; }
.pay-pay__paid { font-family: var(--font-thai); font-size: 15px; font-weight: 600; }
.pay-pay__link { font-family: var(--font-thai); font-size: 13px; text-align: center; color: var(--label); }

/* ระยะ 4b: กล่อง "เพิ่มเติม" พับของฟอร์มร้านค้า + ปุ่มลิงก์ อ่านให้ ในแถวใบเสร็จ */
.pay-more { border: var(--stroke-grid) dashed var(--line); border-radius: var(--radius-card); padding: 0 12px; }
.pay-more > summary { cursor: pointer; min-height: var(--size-tap); display: flex; align-items: center; font-family: var(--font-thai); font-size: 13px; font-weight: 600; }
.pay-more[open] { padding-bottom: 12px; }
.pay-more[open] > summary { border-bottom: var(--stroke-grid) dashed var(--line); }
.pay-more[open] > :not(summary) { margin-top: 10px; }
.pay-rc__read { background: none; border: 0; padding: 0 6px; min-height: 36px; font-family: var(--font-thai); font-size: 13px; font-weight: 700; color: var(--ink); text-decoration: underline; cursor: pointer; }

/* 13 ต.ค.: Playfair ใช้เลขแบบเก่า (เลข 0 จม ต่างความสูง) → ตัวเลขทุกที่ใช้เลขสูงเท่ากัน + กว้างเท่ากัน */
.pay-card__amt, .pay-net__v, .pay-input--big, .pay-sum__go, .pay-mon__l, .pay-sumw, .cf-h-page, .cf-badge { font-variant-numeric: lining-nums tabular-nums; font-feature-settings: "lnum" 1, "tnum" 1; }
/* 19 ต.ค. (สิงห์ลองมือถือ: เลข 3 4 5 9 ยังห้อยอยู่ — iPhone ไม่สน lnum) → ตัวเลขเงินใช้ DM Serif Display (เลขสูงเท่ากันทุกตัว · ยังมีเชิงหรูแบบเดิม · มีน้ำหนักเดียว ไม่ต้อง 900) */
:root { --font-num: 'DM Serif Display', 'Playfair Display', Georgia, serif; }
.pay-card__amt, .pay-net__v, .pay-input--big, .pay-mon__l, .pay-sumw { font-family: var(--font-num); font-weight: 400; }
/* 19 ต.ค.: ดูไฟล์ในแอป */
.pay-view { white-space: nowrap; }
.pay-rc__act { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.pay-rc__act .cf-btn--pill { height: 36px; padding: 0 12px; font-size: 12px; }
.pay-file__pdf { color: var(--fine); }
.view__pages { --z: 1; overflow: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; max-height: 70vh; }
.view__page { width: calc(100% * var(--z)); flex-shrink: 0; }
.view__page img, .view__page canvas { display: block; width: 100%; height: auto; max-height: none; }
.view__zoom { display: flex; align-items: center; gap: 8px; }
.view__zoom .cf-btn--pill { height: 36px; min-width: 44px; padding: 0 12px; font-size: 18px; }
.view__zoomv { font-family: var(--font-thai); font-size: 13px; min-width: 44px; text-align: center; }
.view__name { word-break: break-word; }
.view .scan__foot .cf-btn, .view .scan__foot .pay-linkbtn { font-family: var(--font-thai); }

/* 13 ต.ค. (แบงค์): แนบเอกสารจากหน้าโอนได้เลย */
.pay-pay__docs { display: flex; flex-direction: column; gap: 8px; }
.pay-pay__doc { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: var(--size-tap); padding: 6px 12px; border: var(--stroke-grid) solid var(--ink); border-radius: var(--radius-card); background: var(--cream); }
.pay-pay__doc-k { font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pay-pay__doc-k small { font-family: var(--font-thai); font-weight: 400; font-size: 11px; letter-spacing: 0; text-transform: none; color: var(--label); word-break: break-word; }
.pay-pay__doc-k .pay-file__ok { margin-right: 6px; vertical-align: middle; }
.pay-pay__doc .cf-btn--pill { height: 36px; padding: 0 14px; font-size: 12px; text-decoration: none; flex-shrink: 0; }
.pay-pay__doc-k { flex: 1; }
.pay-pay__doc .pay-pick { width: auto; height: 36px; padding: 0 14px; border-radius: var(--radius-pill); font-size: 12px; letter-spacing: 1px; flex-shrink: 0; }

/* ---------- ระยะ 5: วางบิลปุ่มเดียว · เอกสารตอนคีย์ · หน้าต่างสแกน ---------- */
.pay-actions--one { grid-template-columns: 1fr; }
.pay-actions--one .cf-btn { font-family: var(--font-thai); font-size: 17px; letter-spacing: 0; }
.pay-card__doc { font-family: var(--font-thai); font-size: 12px; color: var(--green); font-weight: 600; }
.pay-card__doc--miss { color: var(--red); font-weight: 400; }
.pay-card__doc--wait { color: var(--ink); font-weight: 400; }
.pay-kind .cf-chip { font-family: var(--font-thai); font-size: 14px; letter-spacing: 0; }
.pay-hd { gap: 8px; }
.pay-hd__row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: var(--size-tap); padding: 6px 12px; border: var(--stroke-grid) solid var(--ink); border-radius: var(--radius-card); background: var(--cream); }
.pay-hd__k { flex: 1; min-width: 0; font-family: var(--font-thai); font-weight: 600; font-size: 14px; display: flex; flex-direction: column; gap: 2px; }
.pay-hd__k small { font-weight: 400; font-size: 11px; color: var(--label); word-break: break-word; }
.pay-hd .pay-pick { width: auto; height: 36px; padding: 0 14px; border-radius: var(--radius-pill); font-size: 12px; letter-spacing: 1px; flex-shrink: 0; }
.pay-hd__rm { position: static; width: 32px; height: 32px; flex-shrink: 0; }
.pay-linkbtn { border: none; background: none; padding: 4px 0; color: inherit; text-decoration: underline; font-family: var(--font-thai); font-size: 13px; }

.scan { position: fixed; inset: 0; z-index: 50; background: var(--scrim); display: flex; justify-content: center; align-items: flex-start; overflow-y: auto; padding: calc(12px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); }
.scan__box { width: 100%; max-width: var(--size-column); background: var(--paper); color: var(--ink); border-radius: var(--radius-card); padding: 14px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow-sheet); }
.scan__h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.scan__t { font-family: var(--font-thai); font-weight: 600; font-size: 17px; }
.scan__busy, .scan__hint { font-family: var(--font-thai); font-size: 13px; color: var(--label); }
.scan__busy { padding: 18px 0; text-align: center; color: var(--ink); }
.scan__modes { grid-template-columns: repeat(4, 1fr); }
.scan__modes .cf-chip { height: 40px; font-family: var(--font-thai); font-size: 12px; letter-spacing: 0; }
.scan__pages { display: flex; flex-direction: column; gap: 10px; }
.scan__page { position: relative; background: #fff; border: var(--stroke-grid) solid var(--ink); border-radius: var(--radius-note); overflow: hidden; }
.scan__page img { display: block; width: 100%; height: auto; max-height: 48vh; object-fit: contain; background: #fff; }
.scan__dock { position: sticky; bottom: calc(-24px - env(safe-area-inset-bottom, 0px)); margin: 0 -14px -14px; padding: 10px 14px calc(14px + env(safe-area-inset-bottom, 0px)); background: var(--paper); border-top: var(--stroke-grid) solid var(--line); border-radius: 0 0 var(--radius-card) var(--radius-card); display: flex; flex-direction: column; gap: 10px; box-shadow: 0 -8px 16px rgba(0, 0, 0, .12); }
.scan__page--pdf { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 28px 12px; background: var(--cream); font-weight: 800; letter-spacing: 2px; }
.scan__page--pdf small { font-family: var(--font-thai); font-weight: 400; letter-spacing: 0; font-size: 12px; color: var(--label); word-break: break-all; }
.scan__tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 8px; border-top: var(--stroke-grid) dashed var(--line); background: var(--cream); }
.scan__tools .cf-btn--pill { height: 34px; padding: 0 12px; font-family: var(--font-thai); font-size: 12px; letter-spacing: 0; }
.scan__row, .scan__foot { display: flex; gap: 8px; flex-wrap: wrap; }
.scan__row > *, .scan__foot > .cf-btn { flex: 1 1 140px; }
.scan__foot .cf-btn, .scan__row .cf-btn { height: 48px; font-family: var(--font-thai); font-size: 14px; letter-spacing: 0; }
.scan__foot .pay-linkbtn { flex: 1 1 100%; text-align: center; color: var(--label); }
.scan__v { font-family: var(--font-thai); font-size: 14px; padding: 10px 12px; border-radius: var(--radius-note); background: var(--cream); border: var(--stroke-grid) solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.scan__v small { font-size: 12px; color: var(--label); }
.scan__v--ok { border-color: var(--green); color: var(--green); font-weight: 600; }
.scan__v--bad { border-color: var(--red); color: var(--red); font-weight: 600; }
.scan__v--warn { border-color: var(--gold); color: var(--ink); }
.scan__stage { position: relative; touch-action: pan-y pinch-zoom;   /* ปัดเลื่อนจอบนรูปได้ · ลากเฉพาะวงกลมมุม (สิงห์ลองมือถือ 16 ต.ค.: หยุดตรงรูปแล้วเลื่อนจอไม่ได้) */
  user-select: none; -webkit-user-select: none; border-radius: var(--radius-note); overflow: hidden; background: var(--ink-2); }
.scan__stage canvas { display: block; width: 100%; height: auto; }
.scan__h4 { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: var(--radius-round); border: 3px solid var(--yellow); background: rgba(21, 17, 13, .35); touch-action: none; }
/* ตัวหนังสือไทยบนปุ่ม/หัวข้อ: ไม่ถ่างตัวอักษร (แบรนด์ถ่างไว้สำหรับอังกฤษตัวใหญ่ → ไทยขาดเป็นช่วงๆ จนตัดบรรทัด) */
.pay-confirm .cf-btn, .pay-hd > .cf-field__label, .pay-kind-q > .cf-field__label, .pay-confirm .cf-field__label { font-family: var(--font-thai); letter-spacing: 0.3px; }
.pay-confirm .cf-btn { font-size: 15px; }
.pay-gemoff { background: var(--gold); color: var(--ink); }
/* 20 ต.ค.: หน้า My bill ของคนเบิก — ยอดรอโอน + แถวบิลแบบย่อ (ไม่มีช่อง 4 ขั้น) */
.pay-mine__sum { padding: 14px 16px; margin: 0 0 6px; border: var(--stroke-control) solid var(--yellow); border-radius: var(--radius-card); font-family: var(--font-thai); }
.pay-mine__l { font-size: 15px; color: var(--cream); }
.pay-mine__amt { font-family: var(--font-num); font-size: 34px; color: var(--yellow); line-height: 1.2; }
.pay-mine__amt small { font-family: var(--font-thai); font-size: 13px; color: var(--muted); margin-left: 6px; }
.pay-mine__h { font-family: var(--font-thai); font-size: 14px; color: var(--muted); margin: 18px 2px 8px; font-weight: 600; }
.pay-grp { font-family: var(--font-thai); font-size: 15px; color: var(--yellow); margin: 18px 2px 4px; font-weight: 600; }
.pay-grp small { color: var(--muted); font-weight: 400; font-size: 13px; }
.pay-rows .pay-grp { font-size: 13px; color: var(--cream); margin: 10px 2px 6px; }
.pay-rows { display: flex; flex-direction: column; gap: 8px; }
.pay-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; width: 100%; min-height: var(--size-tap); padding: 12px 14px; border: 0; border-radius: var(--radius-card); background: var(--cream); color: #1a1a1a; text-align: left; font-family: var(--font-thai); cursor: pointer; }
.pay-row__t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pay-row__n { font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.pay-row__s { font-size: 13px; color: #555; }
.pay-row__ok { font-size: 14px; font-weight: 600; color: #1d7a3a; margin-top: 2px; }
.pay-row__warn { font-size: 14px; font-weight: 600; color: #b3261e; margin-top: 2px; }
.pay-row__amt { font-family: var(--font-num); font-size: 22px; white-space: nowrap; }
/* 20 ต.ค.: หน้าสรุปบิลที่โอนแล้ว (คนเบิก) */
.pay-bill__name { font-family: var(--font-thai); font-size: 20px; font-weight: 700; overflow-wrap: anywhere; }
.pay-bill__amt { font-family: var(--font-num); font-size: 40px; line-height: 1.2; margin: 10px 0 4px; }
.pay-bill__amt small { font-family: var(--font-thai); font-size: 14px; margin-left: 6px; opacity: .7; }
.pay-bill__paid { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 6px 0 4px; }
.pay-bill__row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed rgba(0,0,0,.2); font-family: var(--font-thai); }
.pay-bill__k { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.pay-bill__k small { display: block; font-weight: 400; font-size: 13px; color: #555; }
.pay-bill__v { font-family: var(--font-num); font-size: 18px; white-space: nowrap; }
.pay-bill__fix, .pay-bill__back { display: flex; margin-top: 14px; }
.pay-bill .pay-mine__h { color: #555; }
/* 20 ต.ค.: หน้าต่างกำลังบันทึก คลุมทั้งจอ (กดออกไม่ได้จนเสร็จ) */
.pay-lock { position: fixed; inset: 0; z-index: 9999; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 16px; }
.pay-lock__box { background: var(--cream); color: var(--ink); border-radius: var(--radius-card); padding: 24px 20px; width: 100%; max-width: 360px; text-align: center; box-shadow: var(--shadow-sheet); }
.pay-lock__spin { width: 40px; height: 40px; margin: 0 auto 14px; border: 4px solid var(--bar-edge); border-top-color: var(--ink); border-radius: 50%; animation: paySpin .8s linear infinite; }
@keyframes paySpin { to { transform: rotate(360deg); } }
.pay-lock__t { font-family: var(--font-thai); font-size: 18px; font-weight: 600; }
.pay-lock__steps { list-style: none; padding: 0; margin: 14px 0 0; text-align: left; font-family: var(--font-thai); font-size: 15px; }
.pay-lock__s { padding: 4px 0; color: var(--fine); }
.pay-lock__s--done { color: var(--green); }
.pay-lock__s--now { color: var(--ink); font-weight: 600; }
.pay-lock__note { margin-top: 14px; font-family: var(--font-thai); font-size: 13px; color: var(--red); }
