/* FreshMe — หน้าสมาชิก (ลูกค้าเห็น) : มือถือมาก่อน ใช้ฟอนต์ของเครื่อง ไม่โหลดอะไรจากภายนอก */
:root {
  --bg: #f4f5f3;
  --surface: #ffffff;
  --text: #1d1f1e;
  --muted: #5b605d;
  --border: #d9ddd9;
  --accent: #0b6b45;
  --accent-ink: #06432b;
  --accent-soft: #e6f5ec;
  --line: #06c755;
  --warn: #b45309;
  --warn-soft: #fff2e0;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --font: system-ui, -apple-system, "Segoe UI", "Noto Sans Thai", "Sukhumvit Set", Thonburi, Tahoma, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--text); background: var(--bg); }
body.m-has-nav { padding-bottom: 76px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }
h1, h2 { line-height: 1.3; }

.m-top { display: flex; align-items: baseline; gap: 10px; padding: 14px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.m-brand { font-weight: 800; font-size: 20px; color: var(--text); text-decoration: none; }
.m-tag { color: var(--muted); font-size: 14px; }
.m-logout { margin: 0 0 0 auto; }
.m-sim { margin: 0; padding: 6px 16px; background: var(--warn-soft); color: #6b3400; font-size: 13px; text-align: center; }
.m-main { max-width: 560px; margin: 0 auto; padding: 16px 16px 32px; }

.m-link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; min-height: 32px; }
.m-btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 50px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.m-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.m-btn-line { background: var(--line); border-color: var(--line); color: #fff; }
.m-hint { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.m-privacy { color: var(--muted); font-size: 13px; text-align: center; margin: 18px 0 0; }
.m-empty { color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: 12px; padding: 14px; margin: 0; }
.m-tip { color: var(--muted); font-size: 14px; text-align: center; margin: 20px 0 0; }
.m-mono { font-family: var(--mono); letter-spacing: .5px; }

.m-flash { padding: 10px 14px; border-radius: 12px; margin: 0 0 14px; border: 1px solid; font-weight: 600; }
.m-flash-ok { background: var(--accent-soft); border-color: #a9dcc0; color: var(--accent-ink); }
.m-flash-error { background: var(--danger-soft); border-color: #f1aba4; color: #7a1710; }
.m-flash-info { background: #eef1f5; border-color: #cfd6e0; color: #2b3645; }

.m-hero { text-align: center; padding: 18px 8px 6px; }
.m-hero h1 { font-size: 26px; margin: 0 0 4px; }
.m-hero p { margin: 0 0 14px; color: var(--muted); }
.m-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px 16px; }
.m-h1 { font-size: 22px; margin: 0 0 8px; }
.m-or { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 18px 0; font-size: 14px; }
.m-or::before, .m-or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.m-form { display: grid; gap: 10px; }
.m-form label { font-weight: 600; }
.m-form input { width: 100%; min-height: 50px; padding: 8px 12px; font: inherit; font-size: 18px; border: 1px solid var(--border); border-radius: 12px; background: #fff; color: var(--text); }
.m-form input[aria-invalid="true"] { border-color: var(--danger); }
.m-otp { font-family: var(--mono) !important; letter-spacing: 8px; text-align: center; font-size: 26px !important; }
.m-devcode { background: var(--warn-soft); border: 1px dashed #f2c48d; border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.m-devcode strong { font-size: 20px; letter-spacing: 3px; }
.m-inline { margin: 14px 0 0; font-size: 14px; color: var(--muted); }

.m-hello { font-size: 20px; margin: 0 0 12px; }
.m-points { background: linear-gradient(135deg, #0b6b45, #12895a); color: #fff; border-radius: 18px; padding: 18px; margin-bottom: 12px; }
.m-points p { margin: 0; }
.m-label { font-size: 14px; opacity: .9; }
.m-big { font-size: 40px; font-weight: 800; line-height: 1.15; }
.m-big small { font-size: 18px; font-weight: 600; }
.m-expire { margin-top: 6px !important; background: rgba(255,255,255,.16); border-radius: 10px; padding: 6px 10px; font-size: 14px; }
.m-link-light { display: inline-block; margin-top: 10px; color: #fff; font-weight: 600; }
.m-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.m-stat { display: grid; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; color: var(--text); text-decoration: none; }
.m-stat span { font-size: 13px; color: var(--muted); }
.m-stat strong { font-size: 20px; }

.m-section { margin-top: 20px; }
.m-section h2 { font-size: 18px; margin: 0 0 10px; }
.m-section h2 small { color: var(--muted); font-weight: 600; font-size: 16px; }
.m-section-head { display: flex; justify-content: space-between; align-items: baseline; }
.m-section-head a { font-size: 14px; font-weight: 600; }
.m-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.m-list > li { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }

.m-coupon { display: flex; gap: 12px; justify-content: space-between; border-left: 6px solid var(--accent) !important; }
.m-coupon-main { display: grid; }
.m-coupon-main span { font-size: 14px; color: var(--muted); }
.m-coupon-side { display: grid; text-align: right; flex: 0 0 auto; }
.m-code { background: var(--accent-soft); color: var(--accent-ink); border-radius: 8px; padding: 2px 8px; font-weight: 700; }
.m-coupon-side small { color: var(--muted); font-size: 12px; margin-top: 4px; }

.m-order-top, .m-order-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.m-order-items { margin: 6px 0; font-size: 15px; overflow-wrap: anywhere; }
.m-order-foot span { color: var(--muted); font-size: 14px; }
.m-order-track, .m-order-points { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.m-order-points { color: var(--accent); font-weight: 600; }
.m-pill { display: inline-block; font-size: 13px; font-weight: 700; border-radius: 999px; padding: 2px 10px; background: #eef1f5; color: #2b3645; margin-right: 6px; }
.m-pill-awaiting_payment { background: var(--warn-soft); color: #6b3400; }
.m-pill-confirmed, .m-pill-shipping, .m-pill-preorder { background: #e7eefc; color: #1d3f91; }
.m-pill-completed { background: var(--accent-soft); color: var(--accent-ink); }
.m-pill-cancelled, .m-pill-returned, .m-pill-refunded { background: var(--danger-soft); color: #7a1710; }

.m-ledger li { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.m-ledger li div { display: grid; }
.m-ledger li div span { font-size: 13px; color: var(--muted); }
.m-plus { color: var(--accent); font-weight: 800; white-space: nowrap; }
.m-minus { color: var(--danger); font-weight: 800; white-space: nowrap; }
.m-addr { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin: 0; }
.m-addr-item p { margin: 6px 0 0; }

.m-nav { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
.m-nav a { display: grid; justify-items: center; gap: 0; padding: 8px 2px; min-height: 58px; font-size: 12px; color: var(--muted); text-decoration: none; }
.m-nav a span { font-size: 20px; line-height: 1.2; }
.m-nav a.on { color: var(--accent); font-weight: 700; }

@media (min-width: 720px) {
  .m-main { padding-top: 28px; }
  body.m-has-nav { padding-bottom: 0; display: flex; flex-direction: column; min-height: 100vh; }
  .m-top { order: 0; } .m-sim { order: 1; } .m-main { order: 3; width: 100%; }
  .m-nav { order: 2; position: static; width: 100%; max-width: 560px; margin: 0 auto; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 14px 14px; }
  .m-nav a { grid-auto-flow: column; align-items: center; gap: 6px; min-height: 48px; font-size: 14px; }
  .m-nav a span { font-size: 16px; }
}

/* ---------- คำสั่งซื้อ + ติดตามพัสดุ ---------- */
.m-order-link { display: block; color: inherit; text-decoration: none; }
.m-order-link:active { opacity: .85; }
.m-order-more { display: block; margin-top: 8px; font-size: 14px; font-weight: 700; color: var(--accent); }
.m-back { margin: 0 0 8px; font-size: 15px; }
.m-back a { color: var(--accent); text-decoration: none; }
.m-pill-warn { background: var(--warn-soft); color: #6b3400; }
.m-link-card { margin-top: 16px; border-color: var(--accent); background: var(--accent-soft); }
.m-link-card h2 { margin: 0 0 6px; font-size: 17px; }
.m-link-card p { margin: 0 0 12px; }
.m-parcel { margin-bottom: 14px; }
.m-parcel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.m-parcel-head h2 { margin: 0; font-size: 17px; }
.m-parcel-no { margin: 6px 0 12px; font-size: 15px; overflow-wrap: anywhere; }
/* แถบความคืบหน้า 4 ขั้น — ตัวอักษรไม่ล้นจอ 320px */
.m-steps { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; counter-reset: s; }
.m-steps li { position: relative; padding-top: 30px; text-align: center; font-size: 12px; line-height: 1.3; color: var(--muted); }
.m-steps li::before { counter-increment: s; content: counter(s); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 24px; height: 24px; border-radius: 50%; background: #eef1f5; color: var(--muted); font-weight: 700; line-height: 24px; font-size: 13px; }
.m-steps li.done::before { content: "✓"; background: var(--accent); color: #fff; }
.m-steps li.now { color: var(--text); font-weight: 700; }
.m-steps li.now::before { background: var(--accent); color: #fff; box-shadow: 0 0 0 4px var(--accent-soft); }
.m-timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--border); }
.m-timeline li { position: relative; padding: 0 0 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.m-timeline li::before { content: ""; position: absolute; left: -23px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--border); border: 2px solid var(--surface); }
.m-timeline li:first-child::before { background: var(--accent); }
.m-timeline time { font-size: 13px; color: var(--muted); }
.m-timeline span { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.m-lines { list-style: none; margin: 0; padding: 0; }
.m-lines li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.m-sum { margin: 8px 0 0; }
.m-sum div { display: flex; justify-content: space-between; padding: 3px 0; }
.m-sum dt, .m-sum dd { margin: 0; }
.m-sum-total { font-weight: 700; font-size: 17px; }
.m-main > .m-card + .m-card { margin-top: 14px; }
