/* =========================================================================
   WAGONCAM Store — Design System
   Kanit (หัวข้อ) + Sarabun (เนื้อหา) · แดง WAGONCAM บนพื้นถ่านเข้ม
   ========================================================================= */

:root {
  /* --- สี --- */
  --ink-900: #080B11;
  --ink-800: #0F141D;
  --ink-700: #1A2130;
  --ink-600: #2A3446;
  --ink-400: #6B7688;
  --ink-300: #98A2B3;
  --ink-200: #C9D0DB;

  --bg:      #F2F4F7;
  --bg-soft: #FAFBFC;
  --card:    #FFFFFF;
  --line:    #E4E8EE;
  --line-2:  #EFF2F6;

  --red:     #E4002B;
  --red-600: #BE0024;
  --red-50:  #FFF0F3;
  --green:   #0EA05A;
  --gold:    #F0A202;

  /* --- รูปทรง --- */
  --r-xs: 8px;
  --r-sm: 12px;
  --r:    18px;
  --r-lg: 26px;

  --sh-1: 0 1px 2px rgba(8,11,17,.04), 0 2px 6px rgba(8,11,17,.05);
  --sh-2: 0 6px 22px rgba(8,11,17,.09);
  --sh-3: 0 24px 60px rgba(8,11,17,.20);
  --sh-red: 0 10px 26px rgba(228,0,43,.30);

  --hdr-h: 68px;
  --ease: cubic-bezier(.4,.14,.3,1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body {
  margin: 0; padding: 0;
  font-family: 'Sarabun', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink-800);
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; }

h1, h2, h3, h4, .font-display {
  font-family: 'Kanit', 'Sarabun', sans-serif;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.28;
}

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 20px; }

::selection { background: var(--red); color: #fff; }

/* =========================================================================
   HEADER
   ========================================================================= */
.hdr {
  position: sticky; top: 0; z-index: 60;
  background: rgba(8,11,17,.92);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.07);
  transition: box-shadow .25s var(--ease);
}
.hdr.stuck { box-shadow: 0 8px 30px rgba(0,0,0,.30); }
.hdr-in { height: var(--hdr-h); display: flex; align-items: center; gap: 18px; }

.brand { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.brand img { height: 30px; width: auto; }
.brand-sub {
  font-family: 'Kanit', sans-serif;
  font-size: .66rem; font-weight: 500; letter-spacing: .16em;
  color: var(--ink-300); line-height: 1.35;
  border-left: 1px solid rgba(255,255,255,.16); padding-left: 11px;
}
.hdr-spacer { flex: 1; }

.hdr-tel {
  display: inline-flex; align-items: center; gap: 9px; white-space: nowrap;
  padding: 6px 4px; border-radius: 999px; transition: opacity .2s;
}
.hdr-tel:hover { opacity: .8; }
.hdr-tel .ic {
  width: 32px; height: 32px; border-radius: 999px; flex-shrink: 0;
  background: rgba(255,255,255,.09); display: grid; place-items: center; font-size: .95rem;
}
.hdr-tel .tx { display: flex; flex-direction: column; line-height: 1.15; }
.hdr-tel small { font-size: .66rem; color: var(--ink-300); }
.hdr-tel b { font-family: 'Kanit', sans-serif; font-size: .93rem; font-weight: 500; }

.cart-btn {
  position: relative; color: #fff;
  background: var(--red);
  padding: 10px 18px; border-radius: 999px;
  font-family: 'Kanit', sans-serif; font-weight: 500; font-size: .92rem;
  display: inline-flex; align-items: center; gap: 9px;
  transition: transform .18s var(--ease), box-shadow .2s, background .2s;
}
.cart-btn:hover { background: var(--red-600); box-shadow: var(--sh-red); transform: translateY(-1px); }
.cart-btn:active { transform: translateY(0); }
.cart-count {
  background: #fff; color: var(--red);
  min-width: 21px; height: 21px; border-radius: 999px;
  display: inline-grid; place-items: center;
  font-size: .74rem; font-weight: 800; padding: 0 6px;
}

/* =========================================================================
   HERO
   ========================================================================= */
.hero {
  position: relative; overflow: hidden;
  background: var(--ink-900);
  color: #fff;
  isolation: isolate;
}
/* path นับจากไฟล์ CSS (assets/) — อย่าย้ายไปไว้ใน custom property เพราะ Chrome
   จะ resolve เทียบกับ stylesheet ทำให้กลายเป็น assets/assets/ */
.hero::before {
  content: ''; position: absolute; inset: 0; z-index: -2;
  background-image: url('hero.jpg');
  background-size: cover; background-position: 56% 34%;
  filter: saturate(1.04);
}
.hero::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  /* คลุมเข้มเฉพาะฝั่งซ้ายให้ตัวหนังสือขาวอ่านออก ส่วนฝั่งขวาปล่อยให้ภาพสว่างตามต้นฉบับ */
  background:
    linear-gradient(92deg,
      rgba(8,11,17,.95) 0%, rgba(8,11,17,.87) 24%,
      rgba(8,11,17,.54) 42%, rgba(8,11,17,.14) 60%, rgba(8,11,17,0) 78%),
    linear-gradient(180deg, rgba(8,11,17,.10) 0%, rgba(8,11,17,0) 30%, rgba(8,11,17,.26) 100%),
    radial-gradient(58% 110% at 0% 106%, rgba(228,0,43,.22) 0%, rgba(228,0,43,0) 58%);
}
.hero-in { padding: 44px 20px 46px; max-width: 1280px; margin: 0 auto; }
.hero-copy { max-width: 720px; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: 'Kanit', sans-serif; font-size: .76rem; font-weight: 500;
  letter-spacing: .09em; text-transform: uppercase;
  color: #fff;
  background: rgba(228,0,43,.18);
  border: 1px solid rgba(228,0,43,.45);
  padding: 5px 14px; border-radius: 999px;
  margin-bottom: 14px;
}
.eyebrow .dot { width: 6px; height: 6px; border-radius: 999px; background: var(--red); box-shadow: 0 0 0 4px rgba(228,0,43,.22); }

.hero h1 {
  font-size: clamp(1.85rem, 4vw, 2.7rem);
  font-weight: 700; margin: 0 0 11px; line-height: 1.18;
  text-shadow: 0 2px 30px rgba(0,0,0,.4);
}
.hero h1 .accent {
  background: linear-gradient(96deg, #FF3355 0%, var(--red) 60%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--red);
}
.hero-lead {
  font-size: 1rem; color: #D6DCE6; margin: 0 0 20px; max-width: 600px;
  text-shadow: 0 1px 12px rgba(0,0,0,.4);
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }

.hero-points {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px 18px;
}
.hero-points li {
  display: flex; align-items: center; gap: 7px;
  font-size: .85rem; color: #E4E9F0;
}
.hero-points .tick {
  width: 18px; height: 18px; border-radius: 999px; flex-shrink: 0;
  background: rgba(14,160,90,.22); border: 1px solid rgba(14,160,90,.55);
  display: grid; place-items: center; font-size: .62rem; color: #4ADE80;
}

/* --- แถบสถิติใต้ hero --- */
.stats { background: var(--ink-800); color: #fff; border-top: 1px solid rgba(255,255,255,.06); }
.stats-in {
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 4px 20px;
}
.stat { padding: 16px 14px; text-align: center; position: relative; }
.stat + .stat::before {
  content: ''; position: absolute; left: 0; top: 26%; bottom: 26%;
  width: 1px; background: rgba(255,255,255,.10);
}
.stat b {
  display: block; font-family: 'Kanit', sans-serif;
  font-size: 1.24rem; font-weight: 600; line-height: 1.25;
}
.stat span { font-size: .81rem; color: var(--ink-300); }

/* =========================================================================
   ปุ่ม
   ========================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; text-align: center;
  font-family: 'Kanit', sans-serif; font-weight: 500; font-size: 1rem;
  background: var(--red); color: #fff;
  padding: 13px 22px; border-radius: 12px;
  transition: background .2s, transform .18s var(--ease), box-shadow .2s;
}
.btn:hover { background: var(--red-600); box-shadow: var(--sh-red); transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn[disabled] { background: var(--ink-200); color: #fff; cursor: not-allowed; box-shadow: none; transform: none; }

.btn-lg { width: auto; padding: 12px 26px; font-size: .98rem; border-radius: 12px; }
.btn-ghost {
  background: var(--card); color: var(--ink-800);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--bg-soft); border-color: var(--ink-200); box-shadow: var(--sh-1); }
.btn-outline {
  background: rgba(255,255,255,.06); color: #fff;
  border: 1px solid rgba(255,255,255,.28);
  backdrop-filter: blur(6px);
}
.btn-outline:hover { background: rgba(255,255,255,.14); border-color: #fff; box-shadow: none; }
.btn-line { background: #06C755; }
.btn-line:hover { background: #05A648; box-shadow: 0 10px 26px rgba(6,199,85,.30); }

/* =========================================================================
   TOOLBAR (ค้นหา + หมวด)
   ========================================================================= */
.toolbar {
  position: sticky; top: var(--hdr-h); z-index: 50;
  background: rgba(242,244,247,.86);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line);
  padding: 14px 0 13px;
  scroll-margin-top: var(--hdr-h);
}
.toolbar-in { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.search {
  flex: 1 1 auto; min-width: 0; max-width: 420px; margin-right: auto;
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 0 18px; height: 44px;
  transition: border-color .2s, box-shadow .2s;
}
.search:focus-within { border-color: var(--red); box-shadow: 0 0 0 4px rgba(228,0,43,.10); }
.search .mag { width: 18px; height: 18px; flex-shrink: 0; color: var(--ink-300); }
.search input {
  border: 0; outline: 0; flex: 1; min-width: 0;
  font-family: inherit; font-size: .94rem; background: transparent; color: inherit;
}
.search input::placeholder { color: var(--ink-300); }

/* ---------------- ดรอปดาวน์เลือกหมวด ---------------- */
.catsel { position: relative; flex: 0 0 auto; }
.catsel-btn {
  display: flex; align-items: center; gap: 14px;
  min-width: 300px; height: 44px; padding: 0 16px;
  background: var(--ink-900); color: #fff;
  border-radius: 999px; text-align: left;
  transition: background .2s, box-shadow .2s;
}
.catsel-btn:hover { background: var(--ink-700); box-shadow: 0 6px 18px rgba(8,11,17,.22); }
.catsel-cap {
  font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-300); border-right: 1px solid rgba(255,255,255,.18);
  padding-right: 13px; white-space: nowrap;
}
.catsel-label {
  flex: 1; font-family: 'Kanit', sans-serif; font-size: .92rem; font-weight: 400;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.catsel-chev {
  width: 0; height: 0; flex-shrink: 0;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 6px solid #fff;
  transition: transform .22s var(--ease);
}
.catsel.open .catsel-chev { transform: rotate(180deg); }

.catsel-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 55;
  min-width: 340px; max-width: min(430px, calc(100vw - 40px));
  max-height: min(70vh, 520px); overflow-y: auto;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--sh-3); padding: 7px;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .2s var(--ease), transform .2s var(--ease), visibility .2s;
}
.catsel.open .catsel-menu { opacity: 1; visibility: visible; transform: none; }

.catsel-opt {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border-radius: var(--r-sm); text-align: left;
  transition: background .15s;
}
.catsel-opt:hover { background: var(--bg); }
.catsel-opt.on { background: var(--red-50); }
.o-txt { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.o-main { font-family: 'Kanit', sans-serif; font-size: .93rem; font-weight: 400; color: var(--ink-800); }
.catsel-opt.on .o-main { color: var(--red); font-weight: 500; }
.o-sub { font-size: .78rem; color: var(--ink-400); }
.o-tick { color: var(--red); font-weight: 800; opacity: 0; flex-shrink: 0; }
.catsel-opt.on .o-tick { opacity: 1; }
.pill {
  display: inline-block; background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 14px;
  font-size: .78rem; font-weight: 700; color: var(--ink-400);
}

/* =========================================================================
   SECTION + การ์ดสินค้า
   ========================================================================= */
.grid { padding: 6px 0 64px; }

.sec { scroll-margin-top: 150px; padding-top: 46px; }
.sec-hd {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; margin: 0 0 22px;
  padding-left: 16px; position: relative;
}
.sec-hd::before {
  content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--red) 0%, #FF4D6D 100%);
}
.sec-hd h2 {
  margin: 0 0 4px; font-size: 1.4rem; font-weight: 600;
  display: flex; align-items: center; gap: 10px;
}
.sec-hd p { margin: 0; font-size: .9rem; color: var(--ink-400); max-width: 760px; }

.cards {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
}

.card {
  position: relative;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--sh-1);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--sh-2); border-color: #D8DEE7; }

.card-img {
  position: relative; cursor: pointer; overflow: hidden;
  background: linear-gradient(160deg, #FAFBFC 0%, #EDF0F4 100%);
  border-bottom: 1px solid var(--line-2);
}
.card-img img {
  width: 100%; aspect-ratio: 1/1; object-fit: contain;
  transition: transform .5s var(--ease);
}
.card:hover .card-img img { transform: scale(1.05); }

/* ไม่วางป้ายทับรูป — รูปปกสินค้ามีป้ายของตัวเองอยู่แล้ว จะตีกัน */
.card-code {
  font-family: 'Kanit', sans-serif;
  font-size: .68rem; font-weight: 500; letter-spacing: .1em;
  color: var(--ink-300);
}
.card-off {
  background: var(--red-50); color: var(--red);
  font-size: .72rem; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
}

.card-body { padding: 15px 17px 17px; display: flex; flex-direction: column; flex: 1; gap: 7px; }
.card-name {
  font-family: 'Kanit', sans-serif; font-weight: 500;
  font-size: .97rem; line-height: 1.4; cursor: pointer;
  transition: color .2s;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-name:hover { color: var(--red); }
.card-short {
  font-size: .83rem; color: var(--ink-400); flex: 1; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 10px; margin-top: 6px; padding-top: 12px;
  border-top: 1px solid var(--line-2);
}
.price-wrap { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; gap: 1px; }
.price-was-row { display: flex; align-items: center; gap: 7px; }
.was { font-size: .76rem; color: var(--ink-300); text-decoration: line-through; }
.price {
  font-family: 'Kanit', sans-serif;
  font-size: 1.3rem; font-weight: 600; color: var(--ink-900); white-space: nowrap;
}
.add-btn {
  background: var(--ink-900); color: #fff;
  padding: 9px 16px; border-radius: 10px;
  font-family: 'Kanit', sans-serif; font-weight: 400; font-size: .85rem;
  white-space: nowrap;
  transition: .2s var(--ease);
}
.add-btn:hover { background: var(--red); box-shadow: var(--sh-red); }
.add-btn.done { background: var(--green); }

.empty {
  padding: 72px 20px; text-align: center; color: var(--ink-400);
  background: var(--card); border: 1px dashed var(--line);
  border-radius: var(--r); margin-top: 20px;
}

/* =========================================================================
   TRUST BAND
   ========================================================================= */
.trust { background: var(--ink-900); color: #fff; }
.trust-in {
  display: grid; gap: 4px; grid-template-columns: repeat(auto-fit, minmax(240px,1fr));
  padding: 52px 20px;
}
.trust-item { display: flex; gap: 15px; align-items: flex-start; padding: 8px 16px; }
.trust-ico {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 13px;
  background: rgba(228,0,43,.14); border: 1px solid rgba(228,0,43,.3);
  display: grid; place-items: center; font-size: 1.25rem;
}
.trust-item b {
  display: block; font-family: 'Kanit', sans-serif; font-weight: 500;
  font-size: .99rem; margin-bottom: 3px;
}
.trust-item span { font-size: .85rem; color: var(--ink-300); line-height: 1.6; }

/* =========================================================================
   FOOTER
   ========================================================================= */
.ftr { background: var(--ink-800); color: var(--ink-300); padding: 52px 0 30px; font-size: .9rem; }
.ftr-in { display: grid; gap: 34px; grid-template-columns: 1.4fr 1fr 1fr; }
.ftr h4 {
  color: #fff; margin: 0 0 14px; font-size: 1rem; font-weight: 500;
}
.ftr p { margin: 0; line-height: 1.75; }
.ftr a { transition: color .2s; }
.ftr a:hover { color: #fff; }
.ftr-logo { height: 28px; width: auto; margin-bottom: 14px; opacity: .95; }
.ftr-bottom {
  border-top: 1px solid rgba(255,255,255,.08); margin-top: 34px; padding-top: 20px;
  font-size: .82rem; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between;
}

/* =========================================================================
   DRAWER (ตะกร้า) + MODAL
   ========================================================================= */
.scrim {
  position: fixed; inset: 0; background: rgba(8,11,17,.62);
  backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .28s var(--ease); z-index: 70;
}
.scrim.on { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(430px, 100%);
  background: var(--bg-soft); z-index: 80; display: flex; flex-direction: column;
  transform: translateX(101%); transition: transform .34s var(--ease);
  box-shadow: var(--sh-3);
}
.drawer.on { transform: none; }
.drawer-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 19px 22px; border-bottom: 1px solid var(--line); background: var(--card);
}
.drawer-hd h3 { margin: 0; font-size: 1.1rem; font-weight: 600; }
.x-btn {
  width: 34px; height: 34px; border-radius: 999px;
  font-size: 1.4rem; line-height: 1; color: var(--ink-400);
  display: grid; place-items: center; transition: .2s;
}
.x-btn:hover { background: var(--line-2); color: var(--ink-800); }
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 22px; }
.drawer-foot { border-top: 1px solid var(--line); padding: 18px 22px 22px; background: var(--card); }

.line-item { display: flex; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.line-item:last-child { border-bottom: 0; }
.line-item img {
  width: 74px; height: 74px; object-fit: contain; flex-shrink: 0;
  background: linear-gradient(160deg,#FAFBFC,#EDF0F4);
  border: 1px solid var(--line); border-radius: var(--r-sm);
}
.li-main { flex: 1; min-width: 0; }
.li-name { font-family: 'Kanit', sans-serif; font-weight: 500; font-size: .89rem; line-height: 1.4; }
.li-code { font-size: .75rem; color: var(--ink-400); margin-top: 2px; }
.li-row { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; gap: 8px; }
.qty {
  display: inline-flex; align-items: center;
  border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--card);
}
.qty button {
  width: 32px; height: 32px; font-size: 1.05rem; font-weight: 600; color: var(--ink-600);
  transition: .15s;
}
.qty button:hover { background: var(--line-2); color: var(--red); }
.qty span { min-width: 32px; text-align: center; font-weight: 700; font-size: .88rem; }
.li-price { font-family: 'Kanit', sans-serif; font-weight: 600; white-space: nowrap; }
.li-del {
  color: var(--ink-300); font-size: .78rem; padding: 4px 0; margin-top: 2px;
  transition: color .2s;
}
.li-del:hover { color: var(--red); }

.sum-row { display: flex; justify-content: space-between; font-size: .93rem; padding: 4px 0; }
.sum-row.total {
  font-family: 'Kanit', sans-serif;
  font-size: 1.24rem; font-weight: 600; padding-top: 12px; margin-top: 10px;
  border-top: 1px dashed var(--line);
}

/* --- Modal สินค้า --- */
.modal {
  position: fixed; z-index: 80; inset: 0; display: grid; place-items: center;
  padding: 18px; pointer-events: none; opacity: 0; transition: opacity .25s var(--ease);
}
.modal.on { opacity: 1; pointer-events: auto; }
.modal-card {
  background: var(--card); border-radius: var(--r-lg); width: min(940px, 100%);
  max-height: 92vh; overflow-y: auto; box-shadow: var(--sh-3);
  transform: translateY(16px) scale(.985); transition: transform .3s var(--ease);
}
.modal.on .modal-card { transform: none; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; }
.m-img {
  background: linear-gradient(165deg, #FAFBFC 0%, #E9EDF2 100%);
  display: flex; flex-direction: column; gap: 12px; justify-content: center; padding: 20px;
  min-width: 0;                 /* กันแถบรูปย่อยดันกล่องให้กว้างเกินจอ */
}
.m-stage { position: relative; min-width: 0; }
.m-stage > img { display: block; width: 100%; height: auto; border-radius: var(--r-sm); }
/* ปุ่มเลื่อนซ้าย/ขวา */
.m-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; border-radius: 999px;
  background: rgba(255,255,255,.92); color: var(--ink);
  font-size: 1.7rem; line-height: 1; padding: 0 0 4px;
  display: grid; place-items: center; box-shadow: var(--sh-2);
  transition: background .18s, transform .18s var(--ease);
}
.m-nav:hover { background: #fff; transform: translateY(-50%) scale(1.08); }
.m-prev { left: 6px; }
.m-next { right: 6px; }
.m-count {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(15,20,29,.72); color: #fff;
  font-size: .72rem; padding: 4px 10px; border-radius: 999px; letter-spacing: .03em;
}
.m-count b { font-weight: 700; }
.m-thumbs {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  min-width: 0; max-width: 100%;
}
.m-th {
  width: 54px; height: 54px; padding: 0; border-radius: 9px; overflow: hidden;
  background: #fff; border: 2px solid transparent; box-shadow: var(--sh-1);
  transition: border-color .18s, transform .18s var(--ease);
}
.m-th img { width: 100%; height: 100%; object-fit: contain; }
.m-th:hover { transform: translateY(-2px); }
.m-th.on { border-color: var(--red); }
.m-info { padding: 26px 30px 30px; }
.m-top { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.code-tag {
  font-family: 'Kanit', sans-serif;
  font-size: .74rem; font-weight: 500; letter-spacing: .05em;
  color: var(--red); background: var(--red-50);
  padding: 5px 12px; border-radius: 999px;
}
.m-info h2 { margin: 12px 0 10px; font-size: 1.42rem; font-weight: 600; }
.m-desc { font-size: .93rem; color: var(--ink-600); margin: 0; }
.m-spec-hd {
  margin: 20px 0 10px; font-size: .74rem; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-400);
}
.m-info ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.m-info li {
  font-size: .9rem; line-height: 1.55; color: var(--ink-700);
  padding-left: 25px; position: relative;
}
.m-info li::before {
  content: '✓'; position: absolute; left: 0; top: 1px;
  width: 17px; height: 17px; border-radius: 999px;
  background: var(--red-50); color: var(--red);
  font-size: .62rem; font-weight: 800;
  display: grid; place-items: center;
}
.m-price {
  font-family: 'Kanit', sans-serif;
  font-size: 2rem; font-weight: 600; margin: 22px 0 4px;
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
}
.m-price .was { font-size: 1.02rem; }
.off-tag {
  background: var(--red); color: #fff; font-family: 'Sarabun', sans-serif;
  font-size: .76rem; font-weight: 700; padding: 4px 12px; border-radius: 999px;
}
.m-note { font-size: .83rem; color: var(--ink-400); margin-bottom: 18px; }

/* =========================================================================
   CHECKOUT
   ========================================================================= */
.co { display: grid; grid-template-columns: 1.12fr .88fr; gap: 26px; padding: 26px 0 60px; align-items: start; }
.crumb { margin: 22px 0 0; font-size: .9rem; color: var(--ink-400); }
.crumb a { transition: color .2s; }
.crumb a:hover { color: var(--red); }

.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 26px; box-shadow: var(--sh-1);
}
.panel h2 { margin: 0 0 4px; font-size: 1.16rem; font-weight: 600; display: flex; align-items: center; gap: 11px; }
.step-no {
  width: 28px; height: 28px; border-radius: 999px; flex-shrink: 0;
  background: var(--ink-900); color: #fff;
  font-family: 'Sarabun', sans-serif; font-size: .82rem; font-weight: 700;
  display: grid; place-items: center;
}
.panel .hint { color: var(--ink-400); font-size: .87rem; margin: 0 0 20px; padding-left: 39px; }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: .86rem; font-weight: 600; margin-bottom: 6px; }
.field label .req { color: var(--red); }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 14px; font-family: inherit; font-size: .94rem;
  border: 1px solid var(--line); border-radius: 11px;
  background: var(--bg-soft); color: inherit;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.field input:focus, .field textarea:focus {
  outline: 0; background: var(--card);
  border-color: var(--red); box-shadow: 0 0 0 4px rgba(228,0,43,.10);
}
.field textarea { min-height: 88px; resize: vertical; }
.field .err { color: var(--red); font-size: .8rem; margin-top: 5px; display: none; }
.field.bad input, .field.bad textarea { border-color: var(--red); background: var(--red-50); }
.field.bad .err { display: block; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
/* ต้องเจาะจงกว่า ".field label" ไม่งั้นโดน display:block ทับ แล้ว gap ไม่ทำงาน */
.field label.check-line {
  display: flex; align-items: center; gap: 10px;
  font-size: .9rem; font-weight: 600; cursor: pointer;
  padding: 4px 0;                    /* พื้นที่กดบนมือถือ */
}
.field label.check-line input {
  width: 19px; height: 19px; margin: 0; flex-shrink: 0;
  accent-color: var(--red);
}

/* --- PromptPay --- */
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0 0 20px; }
.steps li {
  counter-increment: s; position: relative; padding-left: 36px;
  margin-bottom: 11px; font-size: .91rem;
}
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 2px;
  width: 24px; height: 24px; border-radius: 999px;
  background: var(--line-2); color: var(--ink-600);
  font-size: .76rem; font-weight: 700;
  display: grid; place-items: center;
}
.qr-box {
  text-align: center;
  background: linear-gradient(170deg, #FFFFFF 0%, #F3F6FA 100%);
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 22px; box-shadow: var(--sh-1);
}
.qr-box canvas { display: block; margin: 0 auto; border-radius: 8px; }
.pp-logo {
  display: inline-block; background: #003D7A; color: #fff;
  font-family: 'Kanit', sans-serif; font-weight: 500;
  letter-spacing: .08em; font-size: .72rem;
  padding: 5px 15px; border-radius: 999px; margin-bottom: 14px;
}
.qr-amt { font-family: 'Kanit', sans-serif; font-size: 1.7rem; font-weight: 600; margin-top: 14px; }
.qr-name { font-size: .85rem; color: var(--ink-400); }

.order-list { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; margin-bottom: 16px; }
.order-list .oi { display: flex; gap: 12px; padding: 11px 13px; border-bottom: 1px solid var(--line-2); align-items: center; }
.order-list .oi:last-child { border-bottom: 0; }
.order-list img {
  width: 48px; height: 48px; object-fit: contain; border-radius: 8px;
  background: linear-gradient(160deg,#FAFBFC,#EDF0F4);
}
.oi-name { flex: 1; font-size: .86rem; line-height: 1.35; }
.oi-qty { font-size: .78rem; color: var(--ink-400); }
.oi-sum { font-family: 'Kanit', sans-serif; font-weight: 500; font-size: .9rem; white-space: nowrap; }

.notice {
  background: #FFFBEB; border: 1px solid #FDE68A; border-radius: var(--r-sm);
  padding: 13px 15px; font-size: .86rem; line-height: 1.6;
}
.ok-box {
  background: linear-gradient(170deg, #ECFDF3 0%, #DCFCE7 100%);
  border: 1px solid #A7E8C0; border-radius: var(--r); padding: 26px; text-align: center;
}
.ok-box .tick { font-size: 2.8rem; line-height: 1; }

/* ---------------- ปุ่มลอยเข้าหลังบ้าน (เห็นเฉพาะเครื่องที่เคยล็อกอิน) ---------------- */
.admin-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ink-900); color: #fff;
  padding: 11px 18px; border-radius: 999px;
  font-family: 'Kanit', sans-serif; font-size: .88rem; font-weight: 400;
  box-shadow: 0 10px 30px rgba(8,11,17,.35);
  opacity: .55; transition: opacity .2s, transform .2s var(--ease), background .2s;
}
.admin-fab:hover { opacity: 1; transform: translateY(-2px); background: var(--red); }
.admin-fab span { font-size: 1rem; line-height: 1; }
@media (max-width: 680px) {
  .admin-fab { right: 12px; bottom: 12px; padding: 10px 15px; font-size: .82rem; opacity: .82; }
}

/* =========================================================================
   TOAST
   ========================================================================= */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 22px);
  background: var(--ink-900); color: #fff;
  padding: 12px 22px; border-radius: 999px;
  font-size: .9rem; font-weight: 600; z-index: 95;
  box-shadow: var(--sh-3);
  opacity: 0; pointer-events: none; transition: .26s var(--ease);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1000px) {
  .ftr-in { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .co { grid-template-columns: 1fr; }
  .modal-grid { grid-template-columns: 1fr; }
  .m-img { padding: 20px; }
  .m-nav { width: 38px; height: 38px; font-size: 1.5rem; }
  .m-thumbs { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start;
    padding-bottom: 2px; scrollbar-width: none; }
  .m-thumbs::-webkit-scrollbar { display: none; }
  .m-th { flex: 0 0 auto; }
  .stats-in { grid-template-columns: repeat(2, 1fr); }
  .stat + .stat:nth-child(odd)::before { display: none; }
}
@media (max-width: 680px) {
  :root { --hdr-h: 60px; }

  /* iOS จะซูมหน้าจอเองถ้าช่องกรอกตัวอักษรเล็กกว่า 16px — บังคับ 16px กันซูม */
  input, textarea, select, .search input { font-size: 16px !important; }
  .search input { height: 100%; }

  /* จอแคบ ข้อความพาดเต็มความกว้าง เลยต้องคลุมจากบนลงล่างแทนซ้าย-ขวา */
  .hero::after {
    background:
      linear-gradient(180deg,
        rgba(8,11,17,.88) 0%, rgba(8,11,17,.74) 42%,
        rgba(8,11,17,.66) 70%, rgba(8,11,17,.84) 100%),
      radial-gradient(80% 60% at 0% 100%, rgba(228,0,43,.26) 0%, rgba(228,0,43,0) 70%);
  }
  /* ปุ่มคู่วางข้างกันแทนซ้อนกัน ประหยัดพื้นที่ ~60px */
  .hero-cta { flex-direction: row; gap: 8px; }
  .btn-lg { flex: 1 1 0; width: auto; padding: 12px 10px; font-size: .92rem; }
  .brand-sub { display: none; }
  .brand img { height: 26px; }
  .hdr-tel .tx { display: none; }
  .cart-btn { padding: 9px 14px; }
  .cart-btn .lbl { display: none; }

  /* จอแคบ ภาพถูกครอปด้านข้างเยอะ ขยับให้หัวรถขาวอยู่ในเฟรม */
  .hero::before { background-position: 62% 40%; }
  .hero-in { padding: 30px 20px 32px; }
  .hero h1 { font-size: 1.7rem; }
  .hero-lead { font-size: .93rem; margin-bottom: 16px; }
  .hero-points { gap: 6px 14px; }
  .hero-points li { font-size: .8rem; }
  .stat { padding: 12px 8px; }
  .stat b { font-size: 1.1rem; }
  .stat span { font-size: .74rem; }

  .sec { padding-top: 26px; }
  .sec-hd { align-items: center; gap: 10px; }
  .sec-hd .pill { flex-shrink: 0; font-size: .72rem; padding: 4px 10px; }
  .sec-hd h2 { font-size: 1.13rem; }
  .sec-hd p { font-size: .84rem; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(144px, 1fr)); gap: 12px; }
  .card-body { padding: 12px 13px 14px; }
  .card-name { font-size: .87rem; }
  .card-short { -webkit-line-clamp: 2; font-size: .78rem; }
  .card-foot { flex-direction: column; align-items: stretch; gap: 9px; }
  .add-btn { width: 100%; text-align: center; padding: 12px 10px; }
  .price { font-size: 1.12rem; }

  .catsel { flex: 1 1 100%; }
  .catsel-btn { width: 100%; min-width: 0; }
  .catsel-menu { min-width: 0; width: 100%; }
  .search { max-width: none; flex: 1 1 auto; }
  .toolbar-in > .pill { display: none; }

  .panel { padding: 20px; }
  .panel .hint { padding-left: 0; }
  .ftr-in { grid-template-columns: 1fr; gap: 26px; }
  .m-info { padding: 22px; }
  .m-price { font-size: 1.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  .hdr, .toolbar, .ftr, .cart-btn, .btn, .scrim, .drawer, .hero, .stats { display: none !important; }
}
