/* ============================================================
   Storefront — บูติกเสื้อผ้า · หรูหรา มินิมอล แดง–ขาว
   Mobile-first (ลูกค้า 70-80% เปิดจากมือถือ)
   ============================================================ */

:root {
  --font: 'Prompt', 'Segoe UI', Tahoma, sans-serif;
  --serif: 'Playfair Display', 'Prompt', serif;

  --ruby-900: #4c0519;
  --ruby-800: #7c0f2c;
  --ruby-700: #9f1239;
  --ruby-600: #be123c;
  --ruby-500: #e11d48;
  --ruby-100: #ffe4ea;
  --ruby-50:  #fff1f4;
  --blush:    #fdeef1;
  --gold:     #c9a227;

  --bg: #fdf9f8;
  --card: #ffffff;
  --line: #f4e6e6;
  --line-strong: #eBd5d5;
  --ink: #33262a;
  --ink-2: #6b565e;
  --ink-3: #ab9299;

  --green: #15803d;
  --green-bg: #ecfdf3;
  --amber: #b45309;
  --amber-bg: #fef6e7;
  --red: #be123c;
  --red-bg: #fff1f4;

  --shadow-sm: 0 1px 2px rgba(76, 5, 25, .05);
  --shadow: 0 2px 4px rgba(76, 5, 25, .04), 0 12px 32px -12px rgba(76, 5, 25, .12);
  --shadow-lg: 0 24px 64px -20px rgba(76, 5, 25, .28);
  --grad-ruby: linear-gradient(135deg, #e11d48 0%, #9f1239 60%, #7c0f2c 100%);

  --header-h: 62px;
  --bottomnav-h: 62px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(900px 380px at 100% -5%, rgba(225, 29, 72, .05), transparent 60%),
    radial-gradient(700px 380px at -10% 10%, rgba(201, 162, 39, .05), transparent 55%),
    var(--bg);
  min-height: 100vh;
  padding-bottom: calc(var(--bottomnav-h) + 16px);
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; }
p { margin: 0 0 .6em; }
a { color: var(--ruby-600); text-decoration: none; }
img { max-width: 100%; display: block; }
.icon { flex: none; vertical-align: -4px; }
::selection { background: var(--ruby-100); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #e6d2d2; border-radius: 8px; }
.muted { color: var(--ink-3); }
.pos { color: var(--green); }
.neg { color: var(--red); }
.num { font-variant-numeric: tabular-nums; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ============ Header ============ */
.sf-header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.sf-header-in {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 14px;
}
.sf-logo { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sf-logo .mark {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  color: #fff;
  background: var(--grad-ruby);
  box-shadow: 0 8px 18px -6px rgba(225, 29, 72, .5), inset 0 1px 0 rgba(255,255,255,.3);
}
.sf-logo .name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 19px;
  color: var(--ruby-800);
  letter-spacing: .4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sf-logo .name small { display: block; font-family: var(--font); font-weight: 400; font-size: 10px; color: var(--ink-3); letter-spacing: 2.4px; text-transform: uppercase; line-height: 1.1; }

.sf-nav { display: none; gap: 4px; margin-left: 10px; }
.sf-nav a {
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--ink-2);
  font-weight: 500;
  font-size: 14px;
  transition: all .15s;
}
.sf-nav a:hover { color: var(--ruby-600); background: var(--ruby-50); }
.sf-nav a.active { color: #fff; background: var(--grad-ruby); box-shadow: 0 8px 18px -8px rgba(225, 29, 72, .55); }

.sf-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.sf-icon-btn {
  position: relative;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
  transition: all .15s;
}
.sf-icon-btn:hover { border-color: var(--ruby-500); color: var(--ruby-600); }
.sf-badge {
  position: absolute;
  top: -5px; right: -5px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  display: grid; place-items: center;
  background: var(--grad-ruby);
  border-radius: 999px;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  box-shadow: 0 4px 8px -2px rgba(225, 29, 72, .6);
}

.wallet-chip {
  display: none;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, #fff8ec, #fdf1d8);
  border: 1px solid #eddfbb;
  color: #8a6d15;
  font-weight: 600;
  font-size: 13.5px;
  padding: 8px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

.login-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #1877f2;
  color: #fff;
  border: 0;
  padding: 9px 16px;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  box-shadow: 0 8px 18px -8px rgba(24, 119, 242, .6);
  white-space: nowrap;
}
.login-btn:hover { filter: brightness(1.07); color: #fff; }

/* ---------- VIP avatar ring ---------- */
.vip-avatar {
  position: relative;
  width: 40px; height: 40px;
  flex: none;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.vip-avatar img, .vip-avatar .ph {
  width: calc(100% - 6px); height: calc(100% - 6px);
  border-radius: 50%;
  object-fit: cover;
  background: var(--grad-ruby);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  border: 2px solid #fff;
  position: relative;
  z-index: 2;
}
.vip-avatar::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 0;
  background: conic-gradient(var(--vipc1, #d6c4c9), var(--vipc2, #b3989f), var(--vipc1, #d6c4c9));
  z-index: 1;
}
.vip-avatar.big { width: 96px; height: 96px; }
.vip-avatar.big img, .vip-avatar.big .ph { border-width: 3px; font-size: 34px; }
.vip-avatar.huge { width: 116px; height: 116px; }
.vip-avatar.huge img, .vip-avatar.huge .ph { border-width: 4px; font-size: 40px; }

/* สีวง VIP แต่ละระดับ */
.vipring-1  { --vipc1: #cfc4c7; --vipc2: #a89a9e; }
.vipring-2  { --vipc1: #d29a63; --vipc2: #8c5e2a; }
.vipring-3  { --vipc1: #c9ced8; --vipc2: #848d9c; }
.vipring-4  { --vipc1: #edcb57; --vipc2: #a8821a; }
.vipring-5  { --vipc1: #b8d8e8; --vipc2: #5f8fa8; }
.vipring-6  { --vipc1: #7fdcfa; --vipc2: #1e88b8; }
.vipring-7  { --vipc1: #fb7185; --vipc2: #9f1239; }
.vipring-8  { --vipc1: #7c96ff; --vipc2: #2f4bc4; }
.vipring-9  { --vipc1: #c4a9ff; --vipc2: #6d28d9; }
.vipring-10 { --vipc1: #ffd166; --vipc2: #e11d48; }
/* ระดับสูงมีอนิเมชั่นวงแหวนหมุน + ประกาย (เฉพาะกรอบรูปโปรไฟล์เท่านั้น) */
.vip-avatar.vipring-5::before, .vip-avatar.vipring-6::before, .vip-avatar.vipring-7::before,
.vip-avatar.vipring-8::before, .vip-avatar.vipring-9::before, .vip-avatar.vipring-10::before {
  background: conic-gradient(var(--vipc1), var(--vipc2), var(--vipc1), var(--vipc2), var(--vipc1));
  animation: vipSpin 3.2s linear infinite;
}
.vip-avatar.vipring-8::after, .vip-avatar.vipring-9::after, .vip-avatar.vipring-10::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: radial-gradient(circle, transparent 58%, var(--vipc1) 72%, transparent 78%);
  opacity: .55;
  animation: vipPulse 2.2s ease-in-out infinite;
  z-index: 0;
}
@keyframes vipSpin { to { transform: rotate(360deg); } }
@keyframes vipPulse { 0%, 100% { transform: scale(.96); opacity: .35; } 50% { transform: scale(1.06); opacity: .7; } }

/* มงกุฎลอยเหนือกรอบโปรไฟล์ (ระดับ 5 ขึ้นไป) */
.vip-avatar .avatar-crown {
  position: absolute;
  top: -46%;
  left: 50%;
  transform: translateX(-50%) rotate(-6deg);
  z-index: 4;
  filter: drop-shadow(0 3px 5px rgba(138, 101, 8, .45));
  pointer-events: none;
}
.vip-avatar .avatar-crown svg { display: block; }

.vip-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .4px;
  padding: 4px 12px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--vipc1, #a8a29e), var(--vipc2, #78716c));
  box-shadow: 0 6px 14px -6px rgba(76, 5, 25, .4);
}
.vipring-10.vip-chip, .vip-chip.vipring-10 { background-size: 200% 200%; animation: vipShineStore 3s ease infinite; }
@keyframes vipShineStore { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

/* ============ Bottom nav (mobile) ============ */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 80;
  height: var(--bottomnav-h);
  display: flex;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  color: var(--ink-3);
  font-weight: 500;
}
.bottom-nav a.active { color: var(--ruby-600); }
.bottom-nav a.active .icon { filter: drop-shadow(0 4px 8px rgba(225, 29, 72, .4)); }

/* ============ Hero / ticker ============ */
.hot-ticker {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--grad-ruby);
  color: #fff;
  font-size: 13px;
  padding: 8px 16px;
  overflow: hidden;
  white-space: nowrap;
}
.hot-ticker .tk {
  display: inline-block;
  animation: tickerMove 18s linear infinite;
  padding-left: 100%;
}
@keyframes tickerMove { to { transform: translateX(-100%); } }

.sf-hero {
  padding: 26px 0 6px;
}
.sf-hero h1 {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 700;
  color: var(--ruby-900);
  letter-spacing: .3px;
}
.sf-hero h1 .accent { color: transparent; background: linear-gradient(100deg, #e11d48, #c9a227); -webkit-background-clip: text; background-clip: text; }
.sf-hero .sub { color: var(--ink-2); font-size: 14px; margin-top: 4px; font-weight: 300; }

/* ============ Section tabs ============ */
.sf-tabs {
  display: flex;
  gap: 8px;
  margin: 18px 0 4px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.sf-tabs::-webkit-scrollbar { display: none; }
.sf-tab {
  padding: 9px 20px;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: #fff;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  transition: all .15s;
}
.sf-tab:hover { border-color: var(--ruby-500); color: var(--ruby-600); }
.sf-tab.active { background: var(--grad-ruby); border-color: transparent; color: #fff; box-shadow: 0 10px 22px -8px rgba(225, 29, 72, .55); }
.sf-tab .cnt { opacity: .75; font-weight: 400; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 24px 0 14px;
}
.section-head h2 { font-family: var(--serif); font-size: 22px; color: var(--ruby-900); display: flex; align-items: center; gap: 9px; }
.section-head h2 .icon { color: var(--ruby-500); }
.section-head .sub { color: var(--ink-3); font-size: 12.5px; }

/* ============ Search ============ */
.sf-search {
  position: relative;
  margin: 14px 0 4px;
}
.sf-search .icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.sf-search input {
  width: 100%;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  padding: 12px 18px 12px 46px;
  font: inherit;
  color: var(--ink);
  outline: 0;
  transition: all .15s;
  box-shadow: var(--shadow-sm);
}
.sf-search input:focus { border-color: var(--ruby-500); box-shadow: 0 0 0 4px rgba(225, 29, 72, .09); }

/* ============ Product grid & cards ============ */
.pgrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 14px;
}
.pcard {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .18s, box-shadow .18s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.pcard:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.pcard .pimg {
  aspect-ratio: 1;
  background: var(--blush);
  overflow: hidden;
  position: relative;
  display: grid;
  place-items: center;
  color: #e3bcc5;
}
.pcard .pimg img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.pcard:hover .pimg img { transform: scale(1.05); }
.pcard .ptag {
  position: absolute;
  top: 10px; left: 10px;
  z-index: 2;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
  color: #fff;
  background: var(--grad-ruby);
  box-shadow: 0 6px 14px -6px rgba(225, 29, 72, .6);
}
.pcard .ptag.coming { background: linear-gradient(135deg, #a8a29e, #57534e); }
.pcard .ptag.soldout { background: linear-gradient(135deg, #57534e, #292524); }
.pcard .ptag.cf { background: linear-gradient(135deg, #c9a227, #8a6d15); }
.pcard .pbody { padding: 11px 13px 13px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.pcard .pname {
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pcard .pdesc {
  font-size: 11.5px;
  font-weight: 300;
  color: var(--ink-3);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.3em;
}
.pcard .psizes { display: flex; gap: 4px; flex-wrap: wrap; }
.pcard .psizes span {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 1px 6px;
}
.pcard .psizes span.out { opacity: .35; text-decoration: line-through; }
.pcard .pfoot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pcard .price { font-weight: 700; font-size: 16px; color: var(--ruby-700); font-variant-numeric: tabular-nums; }
.pcard .price small { font-weight: 400; font-size: 11px; color: var(--ink-3); display: block; line-height: 1; margin-bottom: 2px; }
.pcard .add-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 11px;
  background: var(--grad-ruby);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 16px -6px rgba(225, 29, 72, .55);
  transition: transform .12s;
}
.pcard .add-btn:active { transform: scale(.92); }
.pcard.disabled { opacity: .75; }
.pcard.disabled .add-btn { background: #d6c4c9; box-shadow: none; cursor: not-allowed; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 11px 20px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { color: #fff; background: var(--grad-ruby); box-shadow: 0 12px 26px -10px rgba(225, 29, 72, .6), inset 0 1px 0 rgba(255,255,255,.22); }
.btn-primary:hover { filter: brightness(1.05); color: #fff; }
.btn-outline { color: var(--ruby-700); border-color: #f2c9d2; background: #fff; }
.btn-outline:hover { background: var(--ruby-50); border-color: var(--ruby-500); }
.btn-ghost { color: var(--ink-2); background: #fff; border-color: var(--line-strong); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-3); }
.btn-gold { color: #6b520e; background: linear-gradient(135deg, #f7e6b5, #eBCf7e); box-shadow: 0 10px 22px -10px rgba(201, 162, 39, .55); }
.btn-lg { padding: 14px 26px; font-size: 15px; border-radius: 16px; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 11px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ============ Cards / panels ============ */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.panel-pad { padding: 20px; }
.panel-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel-head h3 { font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.panel-head h3 .icon { color: var(--ruby-500); }
.panel-head .spacer { margin-left: auto; }

/* ============ Forms ============ */
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.field label .req { color: var(--ruby-500); }
.input {
  width: 100%;
  border: 1.5px solid var(--line-strong);
  background: #fff;
  border-radius: 13px;
  padding: 11px 15px;
  font: inherit;
  color: var(--ink);
  outline: 0;
  transition: all .15s;
}
.input:focus { border-color: var(--ruby-500); box-shadow: 0 0 0 4px rgba(225, 29, 72, .09); }
.input::placeholder { color: #cdb6bc; }
textarea.input { resize: vertical; min-height: 76px; }
.input-hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; }

/* ============ Size chips & qty stepper ============ */
.size-set { display: flex; gap: 8px; flex-wrap: wrap; }
.size-chip {
  min-width: 48px;
  padding: 9px 13px;
  text-align: center;
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all .14s;
}
.size-chip small { display: block; font-size: 10px; font-weight: 400; color: var(--ink-3); }
.size-chip:hover { border-color: var(--ruby-500); color: var(--ruby-600); }
.size-chip.selected { background: var(--grad-ruby); border-color: transparent; color: #fff; box-shadow: 0 8px 18px -6px rgba(225, 29, 72, .55); }
.size-chip.selected small { color: rgba(255, 241, 244, .9); }
.size-chip.disabled { opacity: .35; cursor: not-allowed; text-decoration: line-through; }

.qty-step { display: inline-flex; align-items: center; gap: 0; border: 1.5px solid var(--line-strong); border-radius: 13px; overflow: hidden; background: #fff; }
.qty-step button {
  width: 40px; height: 42px;
  border: 0;
  background: transparent;
  color: var(--ruby-600);
  font-size: 19px;
  font-weight: 600;
  cursor: pointer;
}
.qty-step button:hover { background: var(--ruby-50); }
.qty-step input {
  width: 52px;
  border: 0;
  text-align: center;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  outline: 0;
  -moz-appearance: textfield;
}
.qty-step input::-webkit-outer-spin-button, .qty-step input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ============ Product modal ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  place-items: center;
  padding: 14px;
  background: rgba(44, 6, 15, .5);
  backdrop-filter: blur(6px);
}
.modal.open { display: grid; }
.modal-box {
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 28px);
  overflow-y: auto;
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  animation: mIn .24s cubic-bezier(.2, .9, .3, 1.15);
}
.modal-box.wide { max-width: 660px; }
@keyframes mIn { from { opacity: 0; transform: translateY(22px) scale(.97); } }
.modal-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 15px 20px; background: rgba(255,255,255,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); border-radius: 24px 24px 0 0; }
.modal-head h3 { font-size: 16px; flex: 1; }
.modal-close { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); background: #fff; border-radius: 11px; cursor: pointer; color: var(--ink-2); }
.modal-body { padding: 18px 20px; }
.modal-foot { position: sticky; bottom: 0; display: flex; gap: 10px; padding: 14px 20px; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-top: 1px solid var(--line); border-radius: 0 0 24px 24px; }
.modal-foot .btn { flex: 1; }

.pm-img { border-radius: 18px; overflow: hidden; aspect-ratio: 1; background: var(--blush); display: grid; place-items: center; color: #e3bcc5; margin-bottom: 14px; }
.pm-img img { width: 100%; height: 100%; object-fit: cover; }
.pm-price-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0; }
.pm-price { font-size: 24px; font-weight: 700; color: var(--ruby-700); }
.pm-price small { display: block; font-size: 11.5px; font-weight: 400; color: var(--ink-3); }
.pm-detail { color: var(--ink-2); font-size: 13.5px; white-space: pre-line; background: var(--bg); border: 1px dashed var(--line-strong); padding: 12px 14px; border-radius: 14px; margin: 12px 0; }
.pm-label { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 14px 0 8px; }

/* ============ Cart drawer ============ */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 110;
  pointer-events: none;
}
.drawer .drawer-bg {
  position: absolute; inset: 0;
  background: rgba(44, 6, 15, .5);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .25s;
}
.drawer .drawer-box {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 100%);
  background: #fff;
  box-shadow: var(--shadow-lg);
  transform: translateX(105%);
  transition: transform .28s cubic-bezier(.2, .8, .3, 1);
  display: flex;
  flex-direction: column;
}
.drawer.open { pointer-events: auto; }
.drawer.open .drawer-bg { opacity: 1; }
.drawer.open .drawer-box { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { font-size: 16px; flex: 1; display: flex; gap: 8px; align-items: center; }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 20px; }
.drawer-group-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ruby-800); margin: 10px 0 8px; }
.cart-item { display: flex; gap: 11px; padding: 10px 0; border-bottom: 1px dashed var(--line); align-items: center; }
.cart-item .ci-img { width: 54px; height: 54px; border-radius: 12px; overflow: hidden; background: var(--blush); flex: none; }
.cart-item .ci-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item .ci-main { flex: 1; min-width: 0; }
.cart-item .ci-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item .ci-meta { font-size: 11.5px; color: var(--ink-3); }
.cart-item .ci-qty { display: flex; align-items: center; gap: 7px; margin-top: 4px; }
.cart-item .ci-qty button { width: 24px; height: 24px; border: 1px solid var(--line-strong); background: #fff; border-radius: 8px; cursor: pointer; color: var(--ruby-600); font-weight: 700; line-height: 1; }
.cart-item .ci-price { text-align: right; font-weight: 700; font-size: 13.5px; color: var(--ruby-700); white-space: nowrap; }
.cart-item .ci-del { border: 0; background: none; color: var(--ink-3); cursor: pointer; padding: 4px; }
.cart-item .ci-del:hover { color: var(--red); }
.drawer-foot { border-top: 1px solid var(--line); padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); display: grid; gap: 9px; background: #fffdfc; }
.drawer-sum { display: flex; justify-content: space-between; font-size: 14px; }
.drawer-sum b { color: var(--ruby-700); font-size: 17px; }
.drawer-empty { text-align: center; color: var(--ink-3); padding: 46px 10px; }
.drawer-empty .icon { color: #e3bcc5; }

/* ============ Toast & popup ============ */
.toast-stack { position: fixed; left: 50%; transform: translateX(-50%); top: calc(var(--header-h) + 10px); z-index: 300; display: flex; flex-direction: column; gap: 8px; width: min(430px, calc(100vw - 28px)); }
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink-3);
  border-radius: 15px;
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s cubic-bezier(.2, .9, .3, 1.15);
  font-size: 13.5px;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px); } }
.toast.hide { opacity: 0; transform: translateY(-16px); transition: all .3s; }
.toast-success { border-left-color: #16a34a; }
.toast-error { border-left-color: var(--ruby-500); }
.toast-info { border-left-color: var(--gold); }
.toast .toast-close { margin-left: auto; border: 0; background: none; color: var(--ink-3); cursor: pointer; }

.pop-icon {
  width: 76px; height: 76px;
  margin: 4px auto 14px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--ruby-500);
  background: var(--ruby-50);
  border: 2px dashed #f2c9d2;
}
.pop-icon.gold { color: var(--gold); background: #fdf6e3; border-color: #eddfbb; }
.pop-icon.green { color: var(--green); background: var(--green-bg); border-color: #bbe7cd; }
.pop-title { text-align: center; font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.pop-desc { text-align: center; color: var(--ink-2); font-size: 13.8px; }
.pop-amount { text-align: center; font-size: 30px; font-weight: 700; color: var(--ruby-600); margin: 10px 0; font-variant-numeric: tabular-nums; }

/* ============ Notification dropdown ============ */
.notif-wrap { position: relative; }
.notif-menu {
  position: absolute;
  right: -6px;
  top: calc(100% + 10px);
  width: min(360px, calc(100vw - 30px));
  max-height: 62vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 200;
}
.notif-wrap.open .notif-menu { display: block; }
.notif-head { position: sticky; top: 0; background: #fff; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; z-index: 2; }
.notif-item { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.notif-item.unread { background: var(--ruby-50); }
.notif-item .nt { flex: 1; min-width: 0; }
.notif-item .nt b { display: block; color: var(--ink); font-weight: 600; }
.notif-item small { color: var(--ink-3); }
.notif-empty { padding: 34px 16px; text-align: center; color: var(--ink-3); font-size: 13px; }

/* ============ Profile page ============ */
.me-hero {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  padding: 26px 22px;
  color: #fff;
  background:
    radial-gradient(400px 200px at 100% 0%, rgba(255, 255, 255, .16), transparent 60%),
    radial-gradient(300px 200px at 0% 100%, rgba(201, 162, 39, .3), transparent 55%),
    var(--grad-ruby);
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  box-shadow: var(--shadow-lg);
}
.me-hero .me-info { flex: 1; min-width: 200px; }
.me-hero h2 { font-size: 21px; }
.me-hero .vip-line { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.me-hero .vip-progress { margin-top: 12px; }
.me-hero .vip-progress .bar { height: 8px; border-radius: 6px; background: rgba(255, 255, 255, .25); overflow: hidden; }
.me-hero .vip-progress .bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffd166, #fff); border-radius: 6px; }
.me-hero .vip-progress small { color: rgba(255, 241, 244, .85); font-size: 11.5px; }
.me-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; width: 100%; }
.me-stat { background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .2); border-radius: 16px; padding: 12px 14px; backdrop-filter: blur(4px); }
.me-stat b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.me-stat span { font-size: 11.5px; color: rgba(255, 241, 244, .85); }

.me-tabs { display: flex; gap: 8px; overflow-x: auto; margin: 18px 0 14px; scrollbar-width: none; padding-bottom: 4px; }
.me-tabs::-webkit-scrollbar { display: none; }

/* ============ Lists / tables ============ */
.flat-list { list-style: none; margin: 0; padding: 0; }
.flat-list li { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.flat-list li:last-child { border-bottom: 0; }
.flat-list .fl-main { flex: 1; min-width: 0; }
.flat-list .fl-title { font-weight: 500; font-size: 13.8px; display: block; }
.flat-list .fl-sub { font-size: 12px; color: var(--ink-3); display: block; }
.flat-list .fl-end { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.flat-list .fl-end small { display: block; color: var(--ink-3); }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 11px; border-radius: 999px; white-space: nowrap; }
.badge-ok { color: var(--green); background: var(--green-bg); }
.badge-warn { color: var(--amber); background: var(--amber-bg); }
.badge-danger { color: var(--red); background: var(--red-bg); }
.badge-info { color: var(--ruby-700); background: var(--ruby-50); }
.badge-muted { color: var(--ink-2); background: #f6efee; }
.size-pill { display: inline-block; background: var(--ruby-50); color: var(--ruby-700); border: 1px solid #f2c9d2; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; }

.empty-state { text-align: center; padding: 44px 18px; color: var(--ink-3); }
.empty-state .ei { width: 70px; height: 70px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 22px; color: var(--ruby-400, #fb7185); background: var(--ruby-50); border: 1px dashed #f2c9d2; }
.empty-state h3 { color: var(--ink-2); font-size: 15px; margin-bottom: 4px; }
.empty-state p { font-size: 13px; }

/* ============ Topup ============ */
.amount-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.amount-btn {
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  background: #fff;
  padding: 13px 8px;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all .14s;
  font-variant-numeric: tabular-nums;
}
.amount-btn:hover { border-color: var(--ruby-500); color: var(--ruby-600); }
.amount-btn.selected { background: var(--grad-ruby); border-color: transparent; color: #fff; box-shadow: 0 10px 20px -8px rgba(225, 29, 72, .55); }
.qr-box { text-align: center; padding: 18px; background: #fff; border: 2px dashed #f2c9d2; border-radius: 20px; }
.qr-box img { max-width: 240px; margin: 0 auto; border-radius: 12px; }

.step-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 16px; }
.step-dots i { width: 26px; height: 5px; border-radius: 4px; background: var(--line-strong); }
.step-dots i.on { background: var(--grad-ruby); }

/* ============ Address picker ============ */
.addr-item {
  display: flex; gap: 11px;
  border: 1.5px solid var(--line-strong);
  border-radius: 15px;
  padding: 13px 15px;
  cursor: pointer;
  transition: all .14s;
  align-items: flex-start;
  background: #fff;
}
.addr-item:hover { border-color: var(--ruby-500); }
.addr-item.selected { border-color: var(--ruby-500); background: var(--ruby-50); box-shadow: 0 0 0 3px rgba(225, 29, 72, .08); }
.addr-item input { margin-top: 4px; accent-color: var(--ruby-600); }
.addr-item .ad-main { flex: 1; font-size: 13px; color: var(--ink-2); }
.addr-item .ad-main b { color: var(--ink); font-size: 13.8px; }

/* ============ Rewards ============ */
.reward-card { display: flex; flex-direction: column; }
.reward-card .rw-pts {
  display: inline-flex; align-items: center; gap: 5px;
  color: #8a6d15; background: linear-gradient(135deg, #fdf3d9, #f8e8bb);
  border: 1px solid #eddfbb;
  font-weight: 700; font-size: 12.5px;
  padding: 4px 12px; border-radius: 999px;
}

/* ============ เลขพัสดุ + ปุ่มคัดลอก ============ */
.track-box {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: #fff;
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  padding: 6px 8px 6px 13px;
  font-family: ui-monospace, 'SF Mono', Consolas, monospace;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: .6px;
  color: var(--ink);
}
.copy-btn {
  border: 0;
  background: var(--ruby-50);
  color: var(--ruby-700);
  border-radius: 9px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all .13s;
}
.copy-btn:hover { background: var(--ruby-100); }
.copy-btn:active { transform: scale(.9); }
.copy-btn.copied { background: var(--green-bg); color: var(--green); }

/* ============ การ์ดระดับ VIP (โชว์มงกุฎ) ============ */
.vip-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 14px; }
.vip-card {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 18px 14px 16px;
  border: 1.5px solid var(--line);
  transition: transform .18s, box-shadow .18s;
}
.vip-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.vip-card .crown-stage {
  height: 74px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
  border-radius: 16px;
  background: radial-gradient(70px 46px at 50% 62%, color-mix(in srgb, var(--vipc1, #d6c4c9) 38%, transparent), transparent 75%);
}
.vip-card .crown-stage svg { filter: drop-shadow(0 5px 8px rgba(138, 101, 8, .3)); }
.vip-card h4 { font-size: 15px; margin: 8px 0 2px; }
.vip-card .vc-min { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.vip-card .vc-perk { font-size: 12px; color: var(--ink-2); margin-top: 7px; min-height: 2.6em; }
.vip-card.current {
  border-color: var(--ruby-500);
  box-shadow: 0 0 0 3px rgba(225, 29, 72, .12), var(--shadow);
}
.vip-card.current::after {
  content: 'ระดับของคุณ';
  position: absolute;
  top: 10px; right: -30px;
  transform: rotate(38deg);
  background: var(--grad-ruby);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 34px;
}
.vip-card.locked { opacity: .82; }
@media (min-width: 640px) { .vip-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .vip-grid { grid-template-columns: repeat(5, 1fr); gap: 14px; } }

/* ============ Login page ============ */
.auth-shell { min-height: calc(100vh - var(--bottomnav-h)); display: grid; place-items: center; padding: 30px 16px; }
.auth-card { width: 100%; max-width: 420px; text-align: center; }
.auth-card .brand-big {
  width: 76px; height: 76px;
  margin: 0 auto 16px;
  display: grid; place-items: center;
  border-radius: 24px;
  color: #fff;
  background: var(--grad-ruby);
  box-shadow: 0 18px 40px -12px rgba(225, 29, 72, .55);
}
.auth-card h1 { font-family: var(--serif); font-size: 26px; color: var(--ruby-900); }
.auth-card .sub { color: var(--ink-2); font-size: 13.8px; margin: 8px 0 24px; }
.fb-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #1877f2; color: #fff;
  border: 0; border-radius: 16px;
  padding: 14px 20px;
  font: inherit; font-weight: 600; font-size: 15px;
  cursor: pointer;
  box-shadow: 0 14px 30px -10px rgba(24, 119, 242, .6);
  transition: all .15s;
}
.fb-btn:hover { filter: brightness(1.06); color: #fff; }

/* ============ Responsive ============ */
@media (min-width: 640px) {
  .pgrid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .amount-grid { grid-template-columns: repeat(6, 1fr); }
}
@media (min-width: 900px) {
  body { padding-bottom: 24px; }
  .bottom-nav { display: none; }
  .sf-nav { display: flex; }
  .wallet-chip { display: inline-flex; }
  .pgrid { grid-template-columns: repeat(4, 1fr); gap: 18px; }
  .sf-hero h1 { font-size: 38px; }
  .me-stats { grid-template-columns: repeat(3, 1fr); max-width: 520px; }
}
@media (max-width: 380px) {
  .sf-logo .name { font-size: 16px; }
}
