/* ===== 📦 ติดตามคำสั่งซื้อ (sf-buy · pay.js trackFormHTML / renderTrack / renderBeamReturn) ===== */
#trackView .track-wrap{max-width:1080px;margin:24px auto 64px}
/* ฟอร์มค้นหา */
.trk-find{display:grid;grid-template-columns:minmax(0,1fr) 360px;gap:32px 48px;align-items:start}
.trk-intro{grid-column:1/-1}
.trk-h1{font-size:var(--fs-30);font-weight:700}
.trk-lead{color:var(--text-2);margin-top:6px;max-width:60ch}
.trk-form{display:flex;flex-direction:column;gap:14px;border:1px solid var(--line);border-radius:var(--r-md);padding:24px;background:#fff;margin:0}
.trk-form .field label{display:block;font-size:var(--fs-13);font-weight:600;color:var(--text-2);margin-bottom:6px}
.trk-form .pdpa-note{margin:0}
.trk-msg{padding:10px 12px;border-radius:var(--r-sm);background:var(--danger-50);margin:0}
.trk-msg a{color:inherit;text-decoration:underline}
.trk-priv{display:flex;align-items:center;justify-content:center;gap:6px;font-size:var(--fs-12);color:var(--muted)}
.trk-member{font-size:var(--fs-13);color:var(--muted);text-align:center}
.trk-member .btn-link{font-size:var(--fs-13);color:var(--ink);font-weight:600}
.track-old{text-align:center;margin:0;font-size:var(--fs-12)}
.track-old a{color:var(--text-2);text-decoration:underline}
.trk-how{border-radius:var(--r-md);background:var(--soft);padding:20px 22px}
.trk-how h2,.trk-how .track-sub{font-size:var(--fs-14);font-weight:600;color:var(--ink);margin:0 0 12px}
.trk-how .trk-recents+h2{margin-top:20px}
.trk-recents{display:flex;flex-direction:column;gap:6px}
.track-recent{display:flex;align-items:center;gap:10px;min-height:44px;padding:0 12px;border:1px solid var(--line);border-radius:var(--r-sm);background:#fff;font-weight:600;font-size:var(--fs-14);color:var(--ink);transition:border-color var(--dur-1) var(--ease-out)}
.track-recent span{flex:1}
.track-recent .ico{width:16px;height:16px;color:var(--muted)}
.track-recent:hover{border-color:var(--ink)}
.trk-how-list{list-style:none;display:flex;flex-direction:column;gap:14px;padding:0}
.trk-how-list li{display:flex;gap:12px;align-items:flex-start}
.th-i{width:32px;height:32px;border-radius:50%;background:#fff;border:1px solid var(--line);display:grid;place-items:center;flex:none;color:var(--ink)}
.th-i .ico{width:16px;height:16px}
.trk-how-list li>span:last-child{display:flex;flex-direction:column;line-height:1.45}
.trk-how-list b{font-size:var(--fs-14);font-weight:600}
.trk-how-list span span{font-size:var(--fs-13);color:var(--muted)}
/* ผลการค้นหา */
.trk-res{display:flex;flex-direction:column;gap:16px}
.trk-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.trk-bact{display:flex;flex-wrap:wrap;gap:8px}
.trk-hero{border:1px solid var(--line);border-radius:var(--r-md);padding:24px 28px;background:#fff;position:relative;overflow:hidden}
.trk-hero::before{content:"";position:absolute;left:0;right:0;top:0;height:3px;background:var(--line-strong)}
.trk-hero.tone-amber::before{background:var(--warning)}
.trk-hero.tone-blue::before{background:var(--info)}
.trk-hero.tone-green::before{background:var(--success)}
.trk-hero.tone-ink::before{background:var(--ink)}
.th-top{display:flex;gap:16px;align-items:flex-start}
.th-ico{width:48px;height:48px;border-radius:50%;display:grid;place-items:center;flex:none;background:var(--soft);color:var(--ink)}
.th-ico .ico{width:24px;height:24px}
.tone-amber .th-ico{background:var(--warning-50);color:#9A5A00}
.tone-blue .th-ico{background:var(--info-50);color:#1D4ED8}
.tone-green .th-ico{background:var(--success-50);color:#0B7A3B}
.th-tx{flex:1;min-width:0}
.th-no{display:flex;align-items:center;gap:6px;flex-wrap:wrap;font-size:var(--fs-13);color:var(--muted)}
.th-no b{font-size:var(--fs-14);color:var(--ink);letter-spacing:.3px}
.th-copy{width:32px;height:32px;border-radius:var(--r-sm);display:grid;place-items:center;color:var(--muted);transition:background var(--dur-1) var(--ease-out),color var(--dur-1) var(--ease-out)}
.th-copy:hover{background:var(--soft);color:var(--ink)}
.th-copy .ico{width:16px;height:16px}
.th-h{font-size:var(--fs-30);font-weight:700;margin-top:2px}
.th-sub{color:var(--text-2);margin-top:4px;font-size:var(--fs-14)}
.trk-hero .refund-note{margin-top:16px}
/* ขั้นตอน */
.trk-steps{list-style:none;display:grid;grid-template-columns:repeat(var(--n),minmax(0,1fr));margin:24px 0 0;padding:0}
.trk-steps li{position:relative;display:flex;flex-direction:column;align-items:center;text-align:center;gap:8px;min-width:0}
.trk-steps li:not(:last-child)::after{content:"";position:absolute;top:17px;left:calc(50% + 22px);right:calc(-50% + 22px);height:2px;background:var(--line);border-radius:1px}
.trk-steps li.lk:not(:last-child)::after{background:var(--ink)}
.ts-dot{position:relative;z-index:1;width:36px;height:36px;border-radius:50%;display:grid;place-items:center;background:#fff;border:2px solid var(--line-strong);color:var(--muted)}
.ts-dot .ico{width:16px;height:16px}
.trk-steps li.done .ts-dot{background:var(--ink);border-color:var(--ink);color:#fff}
.trk-steps li.cur .ts-dot{border-color:var(--ink);color:var(--ink);box-shadow:0 0 0 4px var(--soft)}
.tone-green .trk-steps li.done:last-child .ts-dot{background:var(--success);border-color:var(--success)}
.ts-tx{display:flex;flex-direction:column;line-height:1.4;min-width:0}
.ts-tx b{font-size:var(--fs-13);font-weight:600;color:var(--text-2)}
.trk-steps li.cur .ts-tx b,.trk-steps li.done .ts-tx b{color:var(--ink)}
.ts-tx time{font-size:var(--fs-12);color:var(--muted)}
/* คอลัมน์ */
.trk-grid{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(0,1fr);gap:16px;align-items:start}
.trk-col{display:flex;flex-direction:column;gap:16px;min-width:0}
.trk-card{border:1px solid var(--line);border-radius:var(--r-md);padding:18px 20px;background:#fff}
.trk-ch{font-size:var(--fs-16);font-weight:600;margin:0 0 12px;display:flex;align-items:baseline;gap:8px}
.trk-ch small{font-size:var(--fs-13);font-weight:500;color:var(--muted)}
.trk-pay:empty{display:none}
.trk-carrier .tc-h{display:flex;align-items:center;gap:12px}
.tc-h>.ico{width:40px;height:40px;padding:9px;border-radius:50%;background:var(--soft);color:var(--ink);flex:none}
.tc-h span{display:flex;flex-direction:column;line-height:1.4}
.tc-h small{font-size:var(--fs-12);color:var(--muted)}
.tc-h b{font-size:var(--fs-16);font-weight:600}
.tc-no{display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px;margin-top:14px;padding:12px 14px;border-radius:var(--r-sm);background:var(--soft)}
.tc-no>span{font-size:var(--fs-13);color:var(--muted)}
.tc-no b{font-size:var(--fs-20);font-weight:700;letter-spacing:1px;margin-right:auto;overflow-wrap:anywhere}
.tc-at{font-size:var(--fs-13);color:var(--muted);margin-top:10px}
/* ประวัติ */
.trk-ev{list-style:none;padding:0;display:flex;flex-direction:column}
.trk-ev li{position:relative;display:flex;gap:12px;padding-bottom:16px}
.trk-ev li:last-child{padding-bottom:0}
.trk-ev li:not(:last-child)::before{content:"";position:absolute;left:5px;top:16px;bottom:-2px;width:2px;background:var(--line)}
.te-dot{width:12px;height:12px;border-radius:50%;background:#fff;border:2px solid var(--line-strong);flex:none;margin-top:5px;position:relative;z-index:1}
.trk-ev li.now .te-dot{background:var(--ink);border-color:var(--ink);box-shadow:0 0 0 3px var(--soft)}
.te-b{display:flex;flex-direction:column;line-height:1.45;min-width:0}
.te-b b{font-size:var(--fs-14);font-weight:600}
.te-b time{font-size:var(--fs-12);color:var(--muted)}
.te-x{display:flex;align-items:center;gap:6px;font-size:var(--fs-13);color:var(--text-2);margin-top:2px}
/* สินค้า + ยอด */
.track-items{display:flex;flex-direction:column;margin:0;border:0}
.track-items .ti{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;padding:10px 0;border-bottom:1px solid var(--line);font-size:var(--fs-14)}
.track-items .ti:first-child{padding-top:0}
.ti-tx{display:flex;flex-direction:column;min-width:0;line-height:1.4}
.ti-nm{color:var(--ink);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.ti-mt{font-size:var(--fs-12);color:var(--muted)}
.track-items .ti b{font-weight:600;flex:none}
.trk-sum{padding-top:12px}
.trk-sum .sline.big{margin-top:8px;padding-top:12px}
.trk-sum .sline.big span:last-child{font-size:var(--fs-20)}
.trk-kv{display:flex;flex-direction:column;gap:10px;margin:0}
.trk-kv div{display:grid;grid-template-columns:120px minmax(0,1fr);gap:12px;font-size:var(--fs-14)}
.trk-kv dt{display:flex;align-items:center;gap:8px;color:var(--muted)}
.trk-kv dd{color:var(--ink);overflow-wrap:anywhere}
.trk-help{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;border-radius:var(--r-md);background:var(--soft);padding:16px 18px}
.trk-help>span{display:flex;flex-direction:column;line-height:1.45}
.trk-help b{font-size:var(--fs-14);font-weight:600}
.trk-help small{font-size:var(--fs-12);color:var(--muted)}
.trk-res .refund-note{margin:0}
.trk-res .oact{display:flex;justify-content:flex-end;margin:0}
.trk-keep{display:flex;align-items:center;justify-content:center;gap:6px;text-align:center;color:var(--muted);font-size:var(--fs-12)}
/* กลับจาก Beam (r อย่างเดียว) — แผงสถานะการ์ดเดียว */
#trackMain>.pay-box{max-width:560px;margin:0 auto}
@media (max-width:900px){
  .trk-find{grid-template-columns:minmax(0,1fr);gap:20px}
  .trk-grid{grid-template-columns:minmax(0,1fr)}
}
@media (max-width:760px){
  #trackView .track-wrap{margin:16px auto 48px}
  .trk-h1{font-size:var(--fs-24)}
  .trk-form{padding:18px 16px}
  .trk-form .track-old,.trk-form .trk-member{padding-right:40px}   /* ลิงก์บรรทัดท้ายฟอร์มอยู่พ้นช่องปุ่มแชทลอย (#helpFab ขวาล่าง) */
  .trk-hero{padding:20px 16px}
  .th-ico{width:40px;height:40px}
  .th-h{font-size:var(--fs-24)}
  .trk-steps li:not(:last-child)::after{left:calc(50% + 18px);right:calc(-50% + 18px);top:15px}
  .ts-dot{width:32px;height:32px}
  .ts-tx b{font-size:var(--fs-12)}
  .ts-tx time{font-size:11px}
  .trk-card{padding:16px}
  .trk-kv div{grid-template-columns:minmax(0,1fr);gap:2px}
}
.trk-mask{display:flex;align-items:center;gap:6px;margin:12px 0 0;font-size:var(--fs-12);color:var(--muted)}
