/* public_html/assets/css/shop.css
   Customer-facing shop for JUDY JEWELRY.

   Palette is the SAME gold identity as the admin (backoffice/assets/css/style.css):
   charcoal ink, ivory ground, gold accent. The mockups this layout follows were
   drawn in a purple/plum palette; the structure is taken from them and the colour
   is deliberately not, so the shop and the backoffice look like one brand.

   MOBILE FIRST. Every rule below is the phone layout; the @media (min-width: 900px)
   block at the bottom is the only place the desktop shape is described. The mockup
   is a phone design, and phones are how customers will actually arrive from LINE. */

:root {
  --charcoal: #2b2b2b;

  /*
   * ── พื้นหลัง 3 ระดับ ใช้ทั้งเว็บฝั่งลูกค้า (ปรับ 2026-07-28 เจ้าของร้านว่าขาวไป)
   *
   * ★★ ต้องต่างกันพอให้เห็นชั้น แต่ยังอยู่ในโทนอุ่นเดียวกัน
   *    ค่าเดิม --ivory #faf8f4 ห่างจากขาวแค่ 5/7/11 หน่วย และ --card เป็น #fff สนิท
   *    การ์ดจึงกลืนกับพื้นจนทั้งหน้าอ่านเป็นขาวแบน · ตอนนี้ห่างกัน ~10 หน่วยต่อชั้น
   *    ซึ่งเห็นเป็นชั้นได้บนจอมือถือกลางแดด (ที่ลูกค้าร้านนี้ใช้จริง)
   * ★ ทั้งสามค่าอมเหลือง/แดงเล็กน้อย (R>G>B) ให้เข้ากับทองของแบรนด์
   *   เทาเย็น (#f5f5f7) ทำให้ทองดูหมองลงทันที เพราะเป็นสีตรงข้ามกันบนวงล้อสี
   */
  --ivory: #f5f1e8;        /* พื้นหน้าเว็บ */
  --ivory-deep: #ece5d7;   /* แถบสลับ / พื้นที่ยุบลงไป */
  --gold: #c9a24b;
  --gold-light: #e8c97a;
  /*
   * ── ทองเข้ม = สี "ตัวอักษร" ไม่ใช่สีพื้น (ปรับ 2026-08-05 หลัง UI audit)
   *
   * ★★ ค่าเดิม #b8860b อ่านไม่ผ่านเกณฑ์สักพื้นเดียว: บน --ivory 2.89 · --card 3.20 ·
   *    --ivory-deep 2.60 (ต้องการ 4.5) และตัวที่โดนคือของสำคัญที่สุดในหน้า —
   *    ราคาสินค้า ยอดรวมในตะกร้า ลิงก์หมวดหมู่ แท็บที่กำลังใช้งาน
   * ★ #7f5d05 ผ่านทั้งสามพื้น: ivory 5.37 · card 5.95 · ivory-deep 4.83
   *   ยังเป็นทองเข้มโทนเดียวกัน ไม่เพี้ยนไปทางน้ำตาลแดง
   * ★ ห้ามเอาไปใช้เป็นสีพื้น — พื้นปุ่มใช้ --gold (คู่กับตัวอักษร charcoal = 5.90)
   */
  --gold-dark: #7f5d05;
  /*
   * ★ เส้นขอบ/รางก็ต้องอุ่นตาม — #e5e7e9 เดิมเป็นเทา "เย็น" (B>R) ซึ่งบนพื้นครีม
   *   จะเห็นเป็นเส้นอมฟ้าจางๆ ตัดกับโทนทั้งหน้า · เป็นจุดสุดท้ายที่เหลือเทาเย็น
   *   หลังเปลี่ยนพื้น (วัดด้วยการไล่ทุก element: เหลือ .fill-meter อันเดียว)
   */
  --silver: #b3ada1;
  --silver-light: #e4ddd0;
  --ink: #2b2b2b;
  /*
   * ── หมึกจาง = ข้อความรอง (ปรับความทึบ 2026-08-05 หลัง UI audit)
   * ★★ ค่าเดิม .62 ได้คอนทราสต์ 4.17 / 4.01 / 3.84 บนพื้นทั้งสามระดับ — ต่ำกว่า 4.5 ทุกพื้น
   *    ตัวที่โดนคือ breadcrumb, ป้ายกำกับตัวกรอง, ข้อความใต้แท็บ, meta ของสินค้า (ราศี/ธาตุ)
   *    ซึ่งเป็นข้อมูลที่ลูกค้าร้านนี้ใช้ตัดสินใจจริง ไม่ใช่ของประดับ
   * ★ .70 ได้ 5.32 / 5.06 / 4.80 ผ่านทั้งสามพื้น และยังอ่อนกว่า --ink ชัดเจน
   *   จึงยังทำหน้าที่ "ลำดับรอง" ทางสายตาได้เหมือนเดิม
   * ★ ใช้ได้เฉพาะบนพื้นสว่าง — บนพื้น --charcoal ต้อง override เป็น --silver
   *   (ดู .shop-footer .muted ท้ายไฟล์)
   */
  --ink-muted: rgba(43, 43, 43, 0.70);
  --danger: #c0392b;
  --success: #1e7a4d;
  --card: #fffdf8;         /* การ์ด/พื้นผิวที่ยกขึ้นมา — ขาวอมครีม ไม่ใช่ขาวสนิท */
  --radius: 14px;
  --shadow: 0 1px 2px rgba(43, 43, 43, 0.05), 0 8px 24px -14px rgba(43, 43, 43, 0.22);
  /* Height of the fixed bottom tab bar, reused as the body's bottom padding so
     the last row of content is never hidden underneath it. Tall enough for a
     disabled tab's three stacked lines (icon / label / "เร็วๆ นี้"). */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: calc(70px + var(--safe-bottom));
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: "Anuphan", "Noto Sans SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--ivory);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabbar-h) + 16px);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--gold-dark); outline-offset: 2px; }

/*
 * คอนเทนเนอร์หลัก — กว้างขึ้นตามจอ (เจ้าของร้านสั่ง 2026-07-29)
 *
 * ★ ของเดิมล็อกไว้ 1120px ตายตัว บนจอ 1920 จึงเหลือขอบว่างข้างละ ~400px
 *   ซึ่งบนหน้าที่เป็นตะแกรงสินค้าคือพื้นที่ที่ควรได้ใช้
 * ★★ แต่ไม่ปล่อยให้กว้างไม่จำกัด — ย่อหน้าข้อความยาวที่กว้างเกิน ~90 ตัวอักษร
 *    ต่อบรรทัดจะอ่านยากขึ้นจริง (ตาต้องกวาดกลับไกล) ข้อความยาวในโปรเจกต์นี้
 *    มีเพดานของตัวเองเป็น ch อยู่แล้ว (32-36ch) จึงไม่โดนผลนี้
 * ★ เพิ่มเป็นขั้นตามช่วงจอ ไม่ใช่ใช้ % หรือ vw — เปอร์เซ็นต์ทำให้ระยะขอบ
 *   เปลี่ยนตลอดเวลาที่ลากขนาดหน้าต่าง แล้วตะแกรงจะเด้งเป็นคนละจำนวนคอลัมน์
 */
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 1400px) { .container { max-width: 1320px; padding: 0 24px; } }
@media (min-width: 1700px) { .container { max-width: 1500px; } }
.muted { color: var(--ink-muted); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------- header ---------------- */

.shop-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--charcoal);
  color: var(--ivory);
  box-shadow: 0 1px 0 rgba(201, 162, 75, 0.35);
}

/* The search field is a child of this row in the DOM, but on a phone there is no
   horizontal room for it beside the brand and the cart button -- so the row wraps
   and `flex: 1 0 100%` on .search-row forces it onto its own second line. The
   desktop block below simply lets it sit inline instead. Wrapping beats moving the
   element, which would need duplicate markup or ordering that fights the source. */
.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 10px 16px;
  max-width: 1120px;
  margin: 0 auto;
}

/* ★ min-height 44px ให้โลโก้เป็นเป้าสัมผัสที่กดได้จริง (แก้ 2026-08-05) — เดิมสูง 30px
     ไม่กระทบความสูงแถบหัวเว็บ เพราะแถวมี padding 10px อยู่แล้วรวมเกิน 44 */
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; min-height: 44px; }
.brand-mark { width: 26px; height: 26px; flex-shrink: 0; }
/*
 * โลโก้ที่ร้านอัปเอง
 *
 * ★ `contain` ไม่ใช่ `cover` เพราะโลโก้ที่ถูกครอปคือโลโก้ที่ผิด (ตัวอักษรหรือขอบตราหาย)
 *   ปล่อยให้เหลือที่ว่างรอบรูปดีกว่า
 *
 * ★★ ต้องมี "แผ่นรอง" สีขาว ไม่ใช่วางรูปเปล่าๆ — โลโก้ของร้านนี้เป็นไฟล์ **จัตุรัสพื้นทึบ
 *    สีเทาอ่อน** ส่วนหัวเว็บเป็นสีถ่าน วางเปล่าๆ แล้วเห็นเป็นสี่เหลี่ยมเทาลอยอยู่
 *    ดูเหมือนรูปโหลดพลาด ไม่ใช่ตราของร้าน (เจอจริงตอน deploy 2026-08-05)
 *    แผ่นรองโค้งมุม + เส้นทองบางๆ ทำให้ "พื้นอ่อนบนแถบเข้ม" อ่านเป็นของที่ตั้งใจ
 *    ★ วิธีนี้ใช้ได้กับโลโก้ทุกแบบที่ร้านจะอัปในอนาคต ไม่ได้ผูกกับองค์ประกอบของไฟล์นี้
 *      (เคยคิดจะซูมแล้วครอปเอาแต่ตรา ซึ่งจะพังทันทีที่เปลี่ยนไฟล์)
 *
 * ⚠️ ทางแก้ที่ดีที่สุดคือ **อัปโลโก้ที่พื้นหลังโปร่งใส (PNG) และไม่มีตัวอักษรในรูป**
 *    เพราะชื่อร้านเป็นข้อความอยู่ข้างๆ อยู่แล้ว และตัวอักษรในรูปที่ย่อเหลือ 30px
 *    อ่านไม่ออกอยู่ดี · ถ้าอัปแบบนั้นมา ให้ลบ background/padding/box-shadow ทิ้ง
 */
.brand-logo {
  height: 30px;
  width: 30px;
  padding: 2px;
  box-sizing: border-box;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(201, 162, 75, 0.55);
  flex-shrink: 0;
  display: block;
}
.brand-name {
  font-family: "Anuphan", "Noto Sans SC", system-ui, sans-serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.35;
  color: var(--gold-light);
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-name small {
  display: block;
  font-family: "Anuphan", "Noto Sans SC", system-ui, sans-serif;
  font-size: 11px;
  line-height: 1.45;
  letter-spacing: 0.06em;
  font-weight: 400;
  color: var(--silver);
}

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(231, 231, 231, 0.16);
  background: transparent;
  color: var(--ivory);
  font-size: 16px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
.icon-btn:hover { background: rgba(201, 162, 75, 0.16); }
/*
 * ★ ปุ่มตะกร้าวงกลม 38px — คงขนาดวงกลมไว้ (ใหญ่กว่านี้แถบหัวเว็บจะแน่น)
 *   แต่แผ่พื้นที่กดเป็น 44x44 ด้วย ::after โปร่งใส เหมือนที่ทำกับ .hero-dot
 *   ★★ ต้องอยู่ใต้ .cart-badge ในลำดับซ้อน — badge เป็น absolute เหมือนกันแต่ประกาศทีหลัง
 *      จึงอยู่บนอยู่แล้ว ไม่ต้องตั้ง z-index เพิ่ม
 */
.icon-btn::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 44px; height: 44px;
  border-radius: 50%;
}

.cart-badge {
  position: absolute;
  top: -3px; right: -3px;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--gold);
  color: var(--charcoal);
  font-size: 10.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-row { flex: 1 0 100%; }
.search-form { display: flex; gap: 8px; }
/*
 * ★ ช่องค้นหาและปุ่มสูงอย่างน้อย 44px (แก้ 2026-08-05) — เดิม padding 9px ได้ 38px
 *   ต่ำกว่าเกณฑ์เป้าสัมผัส และ font-size 16px กัน iOS ซูมหน้าเองตอนโฟกัสช่อง
 *   (Safari บนมือถือซูมทุกครั้งที่ช่องมีตัวอักษรเล็กกว่า 16px แล้วผู้ใช้ต้องซูมกลับเอง)
 */
.search-form input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 16px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(231, 231, 231, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ivory);
}
.search-form input::placeholder { color: rgba(231, 231, 231, 0.55); }
.search-form button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: inherit;
  font-size: 14px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  background: var(--gold);
  color: var(--charcoal);
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.topnav { display: none; }

/* ---------------- bottom tab bar ---------------- */

.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 40;
  height: var(--tabbar-h);
  padding-bottom: var(--safe-bottom);
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--silver-light);
  box-shadow: 0 -2px 12px -6px rgba(43, 43, 43, 0.2);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  padding: 4px 2px;
  font-size: 11px;
  line-height: 1.2;
  color: var(--ink-muted);
  position: relative;
}
.tab-icon {
  display: grid; place-items: center; width: 44px; height: 30px;
  border-radius: 999px; font-size: 21px; line-height: 1;
}
.tab.is-active { color: var(--gold-dark); font-weight: 600; }
.tab.is-active .tab-icon { background: var(--ivory-deep); }
.tab.is-disabled { opacity: 0.42; }
.tab .cart-badge { top: 4px; right: 22%; }

/* Marks a tab whose page belongs to a later phase, so it reads as "not yet" rather
   than as broken -- the same "เร็วๆ นี้" idea as the admin sidebar.
   It is a THIRD STACKED LINE, not an absolutely-positioned overlay: an overlay at
   the top of a 62px tab lands on top of the icon and made both unreadable. The bar
   grows a little to make room, and --tabbar-h drives the body padding, so nothing
   else has to be adjusted. */
.tab.is-disabled::after {
  content: "เร็วๆ นี้";
  font-size: 8px;
  line-height: 1.1;
  letter-spacing: 0.02em;
  background: var(--silver-light);
  color: var(--ink-muted);
  border-radius: 5px;
  padding: 1px 4px;
}

/* ---------------- hero ---------------- */

/* A CSS-only carousel: a scroll-snapping strip. No JS, no timers, and swiping is
   what a phone user reaches for anyway. */
.hero-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px 4px;
  scrollbar-width: none;
}
.hero-strip::-webkit-scrollbar { display: none; }
.hero-slide {
  scroll-snap-align: center;
  flex: 0 0 100%;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--charcoal);
  aspect-ratio: 20 / 9;
}
.hero-slide img { width: 100%; height: 100%; object-fit: cover; }
.hero-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 26px 16px 13px;
  background: linear-gradient(to top, rgba(30, 30, 30, 0.78), transparent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

/* ---------------- แบนเนอร์เป็นสไลด์ (เจ้าของร้านสั่ง 2026-08-05) ----------------
 *
 * ★★ ต่อยอดจากแถบ scroll-snap ที่มีอยู่ ไม่ได้เขียนใหม่เป็นสไลด์แบบ position:absolute
 *    ของเดิมปัดด้วยนิ้วได้อยู่แล้วโดยไม่พึ่ง JS เลย ถ้าเปลี่ยนไปซ้อนกันแบบ absolute
 *    คนที่ JS โหลดไม่ทันจะเห็นแบนเนอร์ทับกันเป็นกองเดียว — ตอนนี้ปุ่มลูกศรกับจุด
 *    ถูกสร้างโดย JS เท่านั้น ไม่มี JS = ได้แถบปัดนิ้วเหมือนเดิม ไม่มีปุ่มตาย
 *
 * ★ ตัวห่อ `.hero-wrap` จำเป็นเพราะปุ่มลูกศรต้องวางทับขอบสไลด์ ถ้าวางใน `.hero-strip`
 *   ที่เป็น scroll container ปุ่มจะเลื่อนหนีไปกับเนื้อหาตอนปัด
 */
.hero-wrap { position: relative; }

.hero-dots {
  display: flex;
  justify-content: center;
  /* ★ ระยะห่างต้องพอให้พื้นที่กดที่แผ่ออกไป (ดู .hero-dot::after) ไม่ทับกัน
       12px + จุด 7px = ระยะระหว่างจุดกึ่งกลาง 19px ยังห่างกันเกิน 8px ตามเกณฑ์ */
  gap: 12px;
  padding: 10px 0 2px;
}
/*
 * ★★ พื้นที่กดต้องใหญ่กว่าจุดที่มองเห็น (แก้ 2026-08-05)
 *    จุด 7x7px เล็กเกินกว่านิ้วจะกดโดน (เกณฑ์ 44x44) แต่ขยายจุดให้ใหญ่ขึ้น
 *    ก็ทำลายดีไซน์ จึงคงขนาดที่ "เห็น" ไว้เท่าเดิม แล้วแผ่พื้นที่ "กด" ออกด้วย
 *    ::after โปร่งใสที่วางทับตรงกลาง — เป็นวิธีมาตรฐานสำหรับเป้าเล็กที่ตั้งใจให้เล็ก
 */
.hero-dot {
  width: 7px; height: 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--silver);
  opacity: 0.45;
  cursor: pointer;
  position: relative;
  transition: opacity .18s, background-color .18s, width .18s;
}
.hero-dot::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 44px; height: 44px;
}
/* ★ จุดที่ใช้งานอยู่ยืดเป็นแคปซูล ไม่ใช่แค่เปลี่ยนสี — บนจอมือถือกลางแดด ความต่าง
     ของสีจุด 7px มองไม่ออก แต่ความต่างของ "รูปร่าง" มองออกเสมอ */
.hero-dot.is-on { width: 20px; border-radius: 4px; background: var(--gold); opacity: 1; }
.hero-dot:focus-visible { outline: 2px solid var(--gold-dark); outline-offset: 3px; }

/* ปุ่มลูกศร — เดสก์ท็อปเท่านั้น (มือถือปัดนิ้วสะดวกกว่าและปุ่มจะไปทับภาพ) */
.hero-arrow { display: none; }
@media (hover: hover) and (pointer: fine) {
  .hero-arrow {
    display: grid;
    place-items: center;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 40px; height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(30, 30, 30, 0.55);
    color: #fff;
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity .18s, background-color .18s;
  }
  /* ★ โผล่ตอนเอาเมาส์เข้าแถบ หรือตอนโฟกัสด้วยแป้นพิมพ์ — ซ่อนถาวรแล้วกดด้วย Tab
       ไม่ได้เท่ากับปุ่มที่คนใช้แป้นพิมพ์เข้าไม่ถึง */
  .hero-wrap:hover .hero-arrow,
  .hero-arrow:focus-visible { opacity: 1; }
  .hero-arrow:hover { background: rgba(30, 30, 30, 0.8); }
  .hero-arrow:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 2px; }
  .hero-arrow.is-prev { left: 22px; }
  .hero-arrow.is-next { right: 22px; }
}

/* ---------------- category row ---------------- */

.cat-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 16px 16px 6px;
  scrollbar-width: none;
}
.cat-row::-webkit-scrollbar { display: none; }
.cat-item {
  flex: 0 0 auto;
  width: 74px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-align: center;
  font-size: 11px;
  line-height: 1.25;
  color: var(--ink);
}
.cat-icon {
  width: 54px; height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 23px;
  background: linear-gradient(145deg, #fff, #f1ece1);
  border: 1px solid rgba(201, 162, 75, 0.42);
  box-shadow: var(--shadow);
}
.cat-item.is-disabled { opacity: 0.45; }

/* ---------------- sections ---------------- */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 0 12px;
}
.section-head h2,
.section-head h1 {   /* h1 ใช้ในหน้า Shop/ตะกร้า — หน้าตาเท่า h2 เดิม */
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}
.section-head .link { font-size: 12.5px; color: var(--gold-dark); font-weight: 600; }
.section-sub { margin: 6px 0 0; font-size: 14px; color: var(--ink-muted); }

/* ---------------- product grid ---------------- */

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.product-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--silver-light);
}
.product-thumb {
  position: relative;
  aspect-ratio: 1;
  background: linear-gradient(145deg, #f4efe4, #e8e2d4);
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
/* Shown when a product has no image row at all -- an empty grey box would look
   like a failed request, a monogram looks intentional. */
.thumb-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-family: "Anuphan", "Noto Sans SC", system-ui, sans-serif;
  font-size: 34px;
  color: var(--gold-dark);
}
.badge-new {
  position: absolute;
  top: 8px; left: 8px;
  background: var(--gold);
  color: var(--charcoal);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  letter-spacing: 0.04em;
}
.badge-out {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(250, 248, 244, 0.78);
  color: var(--charcoal);
  font-size: 12.5px;
  font-weight: 700;
}
.product-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.product-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  /* Two lines then ellipsis, so cards in a row stay the same height whatever the
     name length -- Thai product names vary a lot. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-meta { font-size: 12px; color: var(--ink-muted); line-height: 1.5; overflow-wrap: anywhere; }
.product-price {
  margin-top: auto;
  font-size: 17px;
  font-weight: 700;
  color: var(--gold-dark);
}
.product-stock { font-size: 12px; color: var(--ink-muted); }
.product-stock.is-low { color: var(--danger); font-weight: 600; }

/* ---------------- chips / filters ---------------- */

.chip-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 3px 0 9px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
/*
 * ★ ชิปตัวกรองสูง 29-30px — ต่ำกว่าเกณฑ์เป้าสัมผัส และเรียงติดกันเป็นแถวเลื่อนแนวนอน
 *   จึงกดพลาดง่ายเป็นพิเศษ (แก้ 2026-08-05) · ใช้ inline-flex + min-height ให้สูง 44px
 *   โดยคงขนาดตัวอักษรและระยะขอบซ้ายขวาเดิม หน้าตาจึงเปลี่ยนน้อยที่สุด
 */
.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 12px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--silver-light);
  background: var(--card);
  color: var(--ink);
  white-space: nowrap;
  cursor: pointer;
}
.chip-dot { display: inline-flex; align-items: center; gap: 6px; }
/* จุดสีจักระในชิป — สีมาจาก --dot ที่ PHP ใส่ทาง style="" ไม่มีคลาส .is-chakra-N
   ในไฟล์นี้โดยเจตนา (มีสองที่แล้วจะขัดกันเองวันที่แก้ที่เดียว) */
.chip-dot::before {
  content: "";
  flex: none;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--dot, var(--silver));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22);
}
/* ชิปที่เลือกอยู่พื้นเป็น charcoal — จุดสีต้องมีวงขาวคั่น ไม่งั้นจักระเข้มๆ (คราม/ดำ)
   จะกลืนไปกับพื้นจนดูเหมือนไม่มีจุด */
.chip-dot.is-active::before { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.9); }
.filter-note { margin: 2px 0 0; font-size: 11.5px; }
.filter-note a { color: var(--gold-dark); }
/* .pd-chakra ย้ายไปอยู่กับกฎอื่นของหน้าสินค้าแล้ว — อยู่สองที่จะทับกันเอง */

.chip.is-active {
  background: var(--charcoal);
  border-color: var(--charcoal);
  color: var(--gold-light);
  font-weight: 600;
}
.filter-group { padding-top: 8px; }
.filter-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  margin: 0 0 5px;
}

/* ---------------- buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  min-height: 48px;
  padding: 11px 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-align: center;
}
.btn-gold { background: var(--gold); color: var(--charcoal); }
.btn-gold:hover { background: var(--gold-light); }
.btn-dark { background: var(--charcoal); color: var(--gold-light); }
.btn-outline { background: transparent; border-color: var(--silver); color: var(--ink); }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}
/* ★ ปุ่มเล็กยังต้องกดได้ — 32px เตี้ยเกินเกณฑ์ (แก้ 2026-08-05) */
.btn-sm { font-size: 12.5px; padding: 7px 14px; min-height: 44px; }

/* ---------------- alerts ---------------- */

.alert {
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 13px;
  margin: 14px 0 0;
  border: 1px solid;
}
.alert-ok { background: #eef7f1; border-color: #b9dcc7; color: var(--success); }
.alert-err { background: #fdf0ef; border-color: #f0c5c0; color: var(--danger); }

/* ---------------- product detail ---------------- */

.detail-gallery {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.gallery-main { aspect-ratio: 1; background: linear-gradient(145deg, #f4efe4, #e8e2d4); }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 8px; padding: 10px; overflow-x: auto; }
.gallery-thumbs button {
  flex: 0 0 auto;
  width: 56px; height: 56px;
  padding: 0;
  border-radius: 9px;
  overflow: hidden;
  border: 2px solid transparent;
  background: none;
  cursor: pointer;
}
.gallery-thumbs button.is-active { border-color: var(--gold); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }

.detail-title { font-size: 20px; font-weight: 700; margin: 16px 0 6px; line-height: 1.3; }
.detail-desc { font-size: 15px; line-height: 1.75; color: var(--ink); }   /* 13.5px เล็กเกินสำหรับเนื้อหาหลักบนมือถือ (ตรวจ 2026-11-28) */
/* ช่องค้นหามือถือแคบ: ตัดตัวอย่างด้วย … ให้ดูตั้งใจ แทนตัดขาดกลางคำ */
#q { text-overflow: ellipsis; }

/* ป้ายหัวข้อในคอลัมน์ขวาของหน้าสินค้า — แยกจาก .filter-label ที่เป็นของแถบตัวกรอง
   ★ เคยใช้ .filter-label ปนกัน วันที่แถบตัวกรองอยากเปลี่ยนหน้าตา หน้าสินค้าจะเปลี่ยนตาม
     โดยไม่มีใครตั้งใจ (บทเรียนเดียวกับ .t-card ที่เคยมีสองความหมายในไฟล์เดียว) */
.pd-label {
  margin: 0 0 7px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-dark);
}

/* ป้ายคะแนนรีวิว — กดลงไปที่รีวิวได้ เพราะรีวิวอยู่ท้ายหน้า
   เลขคะแนนที่กดไม่ได้คือของที่ชวนให้กดแล้วไม่มีอะไรเกิดขึ้น */
.pd-rating {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 12px;
  padding: 4px 11px 4px 9px;
  border-radius: 999px;
  background: var(--ivory-deep);
  border: 1px solid var(--silver-light);
  text-decoration: none;
  color: var(--ink);
  font-size: 12.5px;
}
.pd-rating strong { font-size: 13px; }
.pd-rating-n { color: var(--ink-muted); }

/* ── ป้ายราคา
 * ★ เดิมเป็น <p> ลอยสามอันเรียงกัน (ราคา / VAT / สถานะของ) อ่านเหมือนข้อความที่หลุด
 *   มาอยู่ด้วยกันโดยบังเอิญ · เส้นทองด้านซ้ายทำให้เป็นก้อนเดียวที่ตาจับได้ทันทีว่า
 *   นี่คือราคา โดยไม่ต้องใส่กรอบทึบที่จะไปแข่งกับการ์ดข้อมูลใต้มัน
 */
.pd-price-box {
  margin: 0 0 14px;
  padding: 2px 0 2px 14px;
  border-left: 3px solid var(--gold);
}
.detail-price {
  margin: 0;
  font-size: 27px;
  font-weight: 700;
  color: var(--gold-dark);
  /* ตัวเลขความกว้างเท่ากัน — ราคาหลายรายการเรียงหลักตรงกัน และเลขไม่ขยับตอนค่าเปลี่ยน */
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.detail-vat { margin: 3px 0 0; font-size: 11.5px; color: var(--ink-muted); }

/* สถานะของเป็นป้ายกลม ไม่ใช่ตัวหนาสีแดงลอยๆ
   ★ สีแดงเปล่าๆ บนพื้นครีมอ่านเหมือนข้อความ error ของระบบ มากกว่าข้อมูลสินค้า
   ★ ของพร้อมส่งก็มีป้ายด้วย ไม่ใช่มีเฉพาะตอนของใกล้หมด — ไม่งั้นบล็อกราคาจะสูงไม่เท่ากัน
     ระหว่างสินค้า และ "ไม่มีป้าย" ไม่ได้สื่ออะไรกับลูกค้าเลย */
.pd-stock {
  display: inline-block;
  margin: 9px 0 0;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid;
}
.pd-stock.is-ok  { background: #eef7f1; border-color: #b9dcc7; color: var(--success); }
.pd-stock.is-low { background: #fdf6e3; border-color: #efdca9; color: #8a6d1f; }
.pd-stock.is-out { background: #fdf0ef; border-color: #f0c5c0; color: var(--danger); }

/* ── ใบสเปก
 * ★ เดิมเป็นกริดพื้นเทาที่เผยตัวเองเป็นเส้น 1px รอบ **ทุกช่อง** ซึ่งอ่านเหมือน dump
 *   จากฐานข้อมูล ไม่ใช่ใบสเปกของเครื่องประดับ · ตอนนี้มีเส้นคั่นระหว่างแถวเท่านั้น
 * ★ ป้ายซ้ายเป็นตัวเล็กเว้นระยะตัวอักษร กว้างคงที่ ทำให้อ่านลงมาเป็นคอลัมน์ได้
 *   ทั้งฝั่งป้ายและฝั่งค่า ไม่ต้องกวาดตาไปมา
 */
.pd-info { margin: 0 0 14px; padding: 15px 16px; }
.spec-list { display: grid; margin: 0; }
.spec-row {
  display: flex;
  gap: 14px;
  align-items: baseline;
  padding: 9px 0;
  font-size: 13.5px;
  border-top: 1px solid var(--silver-light);
}
.spec-row:first-child { border-top: none; padding-top: 0; }
.spec-row dt {
  flex: 0 0 92px;
  margin: 0;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.spec-row dd { margin: 0; font-weight: 500; line-height: 1.6; }

/* จักระอยู่ในการ์ดเดียวกับสเปก คั่นด้วยเส้นเดียวกัน ให้อ่านเป็นข้อมูลชุดเดียวกัน */
.pd-chakra { margin: 12px 0 0; padding: 12px 0 0; border-top: 1px solid var(--silver-light); }
.pd-chakra:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.pd-chakra .chip-row { flex-wrap: wrap; overflow: visible; padding: 0; }

.pd-desc-card { padding: 15px 16px; }
/* รายละเอียดย้ายมาอยู่หลังปุ่มซื้อ (2026-11-28) — เว้นระยะจากแถวปุ่ม */
.pd-actions + .pd-desc-card { margin-top: 14px; }

/* ★ ป้ายหัวข้อตัวเล็กใช้ letter-spacing + uppercase แบบอักษรละติน — กับไทย/จีนทำให้ตัวอักษร
     แยกกันเป็น "ร า ย ล ะ เ อี ย ด" และสระลอยห่างพยัญชนะ (ตรวจ 2026-11-28) · ภาษาอังกฤษคงแบบเดิม */
:lang(th) .pd-label, :lang(th) .spec-row dt, :lang(th) .chakra-stones-head,
:lang(zh) .pd-label, :lang(zh) .spec-row dt, :lang(zh) .chakra-stones-head {
  letter-spacing: 0;
  font-size: 12px;
}

/* แถบซื้อ + ปุ่มถูกใจอยู่แถวเดียวกันบนเดสก์ท็อป · บนมือถือ .buy-bar เป็น fixed
   จึงหลุดออกจาก .pd-actions เอง และหัวใจอยู่ในคอลัมน์ตามลำดับเนื้อหา */
.pd-actions { display: flex; align-items: center; gap: 10px; }
/* ★ .buy-bar ต้อง flex: 1 — เป็น flex item แล้วมันจะหดเท่าเนื้อหา
     วัดจริง: ปุ่ม "เพิ่มลงตะกร้า" หดจาก 503px เหลือ 125px ทันทีที่ห่อด้วย .pd-actions
     (เจอตอนตรวจ ไม่ใช่เดา) · min-width: 0 กันช่องจำนวนดันให้ล้นออกนอกคอลัมน์ */
.pd-actions > .buy-bar { flex: 1 1 auto; min-width: 0; }
.pd-wish { flex: none; }
.pd-wish .wish-btn { width: 44px; height: 44px; font-size: 19px; }
/* บนมือถือ .buy-bar เป็น position: fixed จึงหลุดจาก flow ของ .pd-actions
   เหลือหัวใจอยู่ตัวเดียว — ให้มันเป็นปุ่มเต็มความกว้างพร้อมกรอบ ไม่ใช่วงกลมลอยกลางหน้า
   ★ ขอบเขตต้องเป็น 899px ไม่ใช่ 767px — .buy-bar กลับเป็น static ที่ 900px
     (บรรทัดเดียวกับที่ซ่อน .tabbar) ใช้ 767 จะมีช่วง 768-899px ที่ทั้งสองกฎขัดกัน */
@media (max-width: 899px) {
  .pd-actions { display: block; }
  .pd-wish { margin-top: 12px; }
  .pd-wish .wish-btn { width: 100%; border-radius: 12px; height: 46px; }
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(231, 231, 231, 0.9);
  padding: 15px;
}

/* The add-to-cart bar is docked above the tab bar: on a phone the button must be
   reachable without scrolling back up past the description. */
.buy-bar {
  position: fixed;
  left: 0; right: 0;
  bottom: var(--tabbar-h);
  z-index: 35;
  background: var(--card);
  border-top: 1px solid var(--silver-light);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 -2px 14px -8px rgba(43, 43, 43, 0.3);
}
.buy-bar .btn { flex: 1; }
body.has-buy-bar { padding-bottom: calc(var(--tabbar-h) + 74px); }

/* ---------------- quantity stepper ---------------- */

.qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--silver-light);
  border-radius: 999px;
  overflow: hidden;
  background: var(--card);
}
/*
 * ★ ปุ่ม -/+ และช่องตัวเลขต้องสูง 44px (แก้ 2026-08-05)
 *   เดิมปุ่ม 32x32 และช่องกรอกสูงเพียง 20px ซึ่งเป็นเป้าที่เล็กที่สุดในเส้นทางซื้อทั้งหมด
 *   ★★ ช่องตัวเลขก็เป็นเป้าสัมผัสเหมือนกัน ไม่ใช่แค่ที่แสดงผล — ลูกค้าแตะเพื่อพิมพ์จำนวนเอง
 *   ★ font-size 16px กัน iOS ซูมหน้าเองตอนโฟกัส
 */
.qty button {
  width: 44px; height: 44px;
  border: none;
  background: transparent;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
  font-family: inherit;
}
.qty button:disabled { opacity: 0.35; cursor: not-allowed; }
.qty input {
  width: 44px;
  min-height: 44px;
  border: none;
  text-align: center;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  background: transparent;
  color: var(--ink);
  -moz-appearance: textfield;
}
.qty input::-webkit-outer-spin-button,
.qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------------- cart ---------------- */

.cart-line {
  display: flex;
  gap: 12px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid rgba(231, 231, 231, 0.9);
  box-shadow: var(--shadow);
  padding: 12px;
  margin-bottom: 11px;
}
.cart-line-thumb {
  flex: 0 0 76px;
  width: 76px; height: 76px;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(145deg, #f4efe4, #e8e2d4);
}
.cart-line-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-line-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cart-line-name { font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.cart-line-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.cart-line-price { font-size: 14.5px; font-weight: 700; color: var(--gold-dark); }
.link-danger {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 12px;
  color: var(--danger);
  cursor: pointer;
  text-decoration: underline;
}
.custom-detail { font-size: 11.5px; color: var(--ink-muted); line-height: 1.5; }

.summary { display: grid; gap: 8px; font-size: 13.5px; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; }
.summary-row.is-total {
  border-top: 1px solid var(--silver-light);
  padding-top: 10px;
  font-size: 16px;
  font-weight: 700;
}
.summary-row.is-total span:last-child { color: var(--gold-dark); }
.summary-note { font-size: 11.5px; color: var(--ink-muted); line-height: 1.5; }

/* ---------------- stones ---------------- */

.stone-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stone-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid rgba(231, 231, 231, 0.9);
  box-shadow: var(--shadow);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stone-bead {
  width: 62px; height: 62px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(145deg, #f4efe4, #e8e2d4);
  align-self: center;
}
.stone-bead img { width: 100%; height: 100%; object-fit: cover; }
.stone-name { font-size: 13.5px; font-weight: 700; text-align: center; }
.stone-name-en {
  display: block;
  font-family: "Anuphan", "Noto Sans SC", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  font-style: italic;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
  margin-top: 1px;
}
.stone-meaning { font-size: 11.5px; color: var(--ink-muted); line-height: 1.55; }
.stone-price { font-size: 12.5px; font-weight: 600; color: var(--gold-dark); text-align: center; margin-top: auto; }

/* Mineral facts: a two-column definition list that keeps the labels aligned down the
   card, so hardness/origin scan as data rather than as more prose. */
.stone-facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 8px;
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
}
.stone-facts dt { color: var(--ink-muted); white-space: nowrap; }
.stone-facts dd { margin: 0; }

.stone-care {
  margin: 0;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--ink-muted);
  background: rgba(201, 162, 75, 0.09);
  border-left: 2px solid var(--gold);
  border-radius: 0 6px 6px 0;
  padding: 6px 8px;
}
.stone-care strong { color: var(--gold-dark); }

/* ---------------- reviews ---------------- */

.stars { color: var(--gold); font-size: 13px; letter-spacing: 1px; }
.review { border-top: 1px solid var(--silver-light); padding: 12px 0; }
.review:first-of-type { border-top: none; }
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.review-who { font-size: 13px; font-weight: 600; }
.review-body { font-size: 13px; line-height: 1.7; margin: 5px 0 0; color: var(--ink); }
.review-date { font-size: 11px; color: var(--ink-muted); }

/* ---------------- pagination ---------------- */

.pagination { display: flex; gap: 6px; justify-content: center; align-items: center; padding: 22px 0 6px; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 34px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--silver-light);
  background: var(--card);
  font-size: 13px;
  text-align: center;
}
.pagination .is-current { background: var(--charcoal); border-color: var(--charcoal); color: var(--gold-light); font-weight: 700; }
.pagination .is-disabled { opacity: 0.4; }

/* ---------------- empty state ---------------- */

.empty { text-align: center; padding: 46px 20px; color: var(--ink-muted); }
.empty-mark { font-size: 40px; margin-bottom: 10px; }
.empty p { margin: 0 0 16px; font-size: 13.5px; }

/* ---------------- breadcrumb ---------------- */

.crumb { font-size: 12px; color: var(--ink-muted); padding: 14px 0 0; }
.crumb a { color: var(--gold-dark); }

/* ---------------- footer ---------------- */

.shop-footer {
  margin-top: 34px;
  padding: 26px 16px;
  background: var(--charcoal);
  color: var(--silver);
  font-size: 12px;
  line-height: 1.85;
}
.shop-footer strong { color: var(--gold-light); font-size: 13px; }
/*
 * ★ ลิงก์ในฟุตเตอร์สูงเพียง 15px และเรียงชิดกัน — กดพลาดง่ายบนมือถือ (แก้ 2026-08-05)
 *   ทำให้พื้นที่กดสูง 44px โดยฟุตเตอร์ไม่บวมขึ้น: padding แนวตั้งแล้วชดเชยด้วย margin ลบ
 *   ระยะที่ตาเห็นเท่าเดิม แต่พื้นที่กดโตขึ้น
 */
.shop-footer a {
  color: var(--gold-light);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 11px 0;
  margin: -11px 0;
}
/*
 * ★★ .muted บนพื้นมืดต้องกำหนดสีเอง — --ink-muted คือหมึกเข้มโปร่งแสง ทำมาสำหรับพื้นสว่าง
 *    พอวางบน --charcoal ซึ่งเป็นสีเดียวกับ --ink คอนทราสต์เหลือ 1.0 พอดี
 *    บรรทัด "เลขประจำตัวผู้เสียภาษี" กับ "ราคารวมภาษีแล้ว" จึงหายไปทั้งบรรทัด
 *    อยู่ใน DOM แต่มองไม่เห็น (ตรวจเจอตอน UI audit 2026-08-05)
 * ★ ใช้ --silver ซึ่งฟุตเตอร์ตั้งเป็นสีข้อความหลักอยู่แล้ว = 6.34:1 ผ่าน AAA
 */
.shop-footer .muted { color: var(--silver); }

/* ================= desktop ================= */

@media (min-width: 900px) {
  body { padding-bottom: 0; }
  body.has-buy-bar { padding-bottom: 0; }

  /* The tab bar is a phone pattern; on a desktop it becomes a nav row in the
     header, where there is horizontal room for it. */
  .tabbar { display: none; }
  .buy-bar { position: static; border: none; box-shadow: none; padding: 16px 0 0; }

  /* จอแท็บเล็ตแยกเมนูอีกแถว เพื่อไม่ให้ช่องค้นหาถูกบีบจนพิมพ์ไม่ได้ */
  .header-row {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 1.2fr) auto;
    grid-template-areas: "brand search actions" "nav nav nav";
    padding: 12px 24px; gap: 8px 20px;
  }
  .brand { grid-area: brand; }
  .topnav { grid-area: nav; justify-content: center; }
  .search-row { grid-area: search; width: 100%; justify-self: end; }
  .header-actions { grid-area: actions; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-logo { height: 36px; width: 36px; border-radius: 9px; }
  .brand-name { font-size: 18px; }

  /* Now that the row no longer wraps, the field shares the line instead of
     claiming one of its own. */
  .search-row { flex: 1 1 auto; min-width: 0; max-width: 400px; }

  .topnav { display: flex; gap: 20px; }
  .topnav a { display: inline-flex; align-items: center; min-height: 44px; font-size: 13.5px; color: var(--silver); white-space: nowrap; }
  .topnav a:hover { color: var(--gold-light); }
  .topnav a.is-active { color: var(--gold-light); font-weight: 600; box-shadow: inset 0 -2px var(--gold); }
  .topnav .is-disabled { opacity: 0.45; cursor: not-allowed; }

  .hero-strip { padding: 20px 0 4px; gap: 16px; }
  .hero-slide { aspect-ratio: 24 / 7; }
  .hero-caption { font-size: 19px; padding: 40px 24px 18px; }

  .cat-row { padding: 24px 0 8px; gap: 14px; justify-content: flex-start; }
  .cat-item { width: 96px; font-size: 12.5px; }
  .cat-icon { width: 68px; height: 68px; font-size: 29px; }

  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
  .product-name { font-size: 14px; }
  .product-price { font-size: 18px; }
}

/*
 * จอกว้างเพิ่มคอลัมน์ ไม่ใช่ขยายการ์ดให้ใหญ่ขึ้น
 * ★ การ์ดสินค้ามีรูปเป็นสี่เหลี่ยมจัตุรัส ขยายการ์ดคือขยายรูปตามไปด้วย
 *   รูปกำไลที่ใหญ่ 400px ไม่ได้ให้ข้อมูลมากกว่า 280px แต่ทำให้เห็นสินค้าน้อยลงต่อหน้าจอ
 * ★ หยุดที่ 5 คอลัมน์ — ที่ 6 คอลัมน์บนคอนเทนเนอร์ 1500px การ์ดเหลือ ~230px
 *   ซึ่งชื่อกำไลภาษาไทยเริ่มตกสามบรรทัดและราคาไปชนขอบ (วัดแล้ว)
 */
@media (min-width: 1400px) {
  .product-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 20px; }

  .stone-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
  .stone-bead { width: 84px; height: 84px; }

  .section-head { padding: 30px 0 14px; }
  .section-head h2, .section-head h1 { font-size: 21px; }

  /* Detail page: gallery beside the buy column instead of stacked. */
  .detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 34px; align-items: start; padding-top: 8px; }
  .detail-title { font-size: 26px; margin-top: 0; }
  /* ★ วัดจริงที่ 1440px: คอลัมน์ซ้าย (แกลเลอรี 619px) เตี้ยกว่าคอลัมน์ขวา 207px
     เลื่อนหน้าลงไปอ่านรีวิวแล้วรูปสินค้าหลุดจอไปก่อน · ทำให้เหนียวไว้ รูปกับปุ่ม
     ซื้อจึงอยู่ในสายตาตลอดช่วงที่ยังอ่านรายละเอียดอยู่ (หลักเดียวกับ .cart-summary-col) */
  .detail-gallery { position: sticky; top: 96px; }
  /* คำอธิบายสินค้าเคยยาว 87 ตัวอักษรต่อบรรทัด — เกินช่วงที่อ่านสบาย ตาจะหาบรรทัด
     ถัดไปไม่เจอเมื่อขึ้นบรรทัดใหม่ · 68ch อยู่ในช่วงที่ใช้กันทั่วไป */
  .detail-desc { max-width: 68ch; }
  /* สินค้าที่เกี่ยวข้องมีไม่เกิน 4 ชิ้น (LIMIT 4 ใน view.php) — กริด 5 คอลัมน์ของ
     หน้ารายการจึงเหลือช่องว่างค้างไว้เสมอ 1 ช่อง ทำเป็น 4 ให้เต็มแถวพอดี */
  .detail-related { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  /* Cart: lines beside a sticky summary. */
  .cart-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 26px; align-items: start; }
  .cart-summary-col { position: sticky; top: 96px; }

  .list-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 28px; align-items: start; }
  .filter-col { position: sticky; top: 96px; }
  .filter-col .chip-row { flex-wrap: wrap; overflow: visible; }
}

/* ── รีวิวบนจอกว้าง: กริดการ์ด ไม่ใช่แถวเดียวกว้างเต็มคอนเทนเนอร์
 *
 * ★★ วัดจริงที่ 1440px ก่อนแก้: ชื่อผู้รีวิวกับดาวของรีวิวเดียวกันห่างกัน **1149px**
 *    เพราะ .review-head ใช้ justify-content: space-between บนแถบกว้าง 1240px
 *    สองอย่างที่เป็นของชิ้นเดียวกันจึงอยู่คนละฟากจอ ตาต้องกวาดข้ามหน้าเพื่อจับคู่
 *    และบรรทัดข้อความรีวิวยาว 1240px ซึ่งเกินความยาวที่อ่านสบาย (~65-75 ตัวอักษร)
 * ★ แก้ด้วยการหั่นเป็นคอลัมน์ ไม่ใช่ใส่ max-width ให้การ์ดเดียว — ใส่ max-width
 *   แล้วที่ว่างขวามือจะกลายเป็นช่องโหว่เปล่าๆ ส่วนกริดใช้ความกว้างนั้นทำงาน
 */
@media (min-width: 900px) {
  .review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
  /* เส้นคั่นบนของใบแรกในแต่ละคอลัมน์ต้องหาย ไม่ใช่แค่ใบแรกของทั้งชุด
     (:first-of-type เดิมซ่อนของใบซ้ายเท่านั้น ใบขวาบนสุดจึงมีเส้นลอยอยู่) */
  .review-grid .review:nth-of-type(-n+2) { border-top: none; }
}
@media (min-width: 1400px) {
  .review-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .review-grid .review:nth-of-type(-n+3) { border-top: none; }
}
/* ดาวอยู่ติดชื่อ ไม่ผลักไปสุดขอบ · วันที่ไปอยู่ท้ายการ์ดตามเดิม */
.review-head { justify-content: flex-start; }

/* ================= custom bracelet designer ================= */

/* Laid out as the mockup the owner supplied: a title bar, then three numbered panels --
   pick, design, review -- which is also the order the work happens in. On a phone they
   stack with the ring first, because the ring is the thing being designed. */

.designer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid rgba(231, 231, 231, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-top: 14px;
}
.designer-bar-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.designer-mark {
  width: 42px; height: 42px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 11px;
  border: 1px solid rgba(201, 162, 75, 0.45);
  background: linear-gradient(145deg, #fffdf8, #f3ece0);
  color: var(--gold-dark);
}
.designer-bar h1 { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.25; }
.designer-bar p { margin: 2px 0 0; font-size: 12px; color: var(--ink-muted); }
.designer-bar-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--silver-light);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.pill-btn:hover:not(:disabled) { border-color: var(--gold); background: #fffdf7; }
.pill-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.designer { display: grid; gap: 14px; padding: 14px 0 4px; }

.panel {
  background: var(--card);
  border: 1px solid rgba(231, 231, 231, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px;
  min-width: 0;
}
/*
 * ลำดับพาเนลบนมือถือ: วงกำไล → ตัวเลือกหิน → ส่วนควบคุม → สรุป
 *
 * ★ เรียงตามเลขขั้นตอนที่เขียนไว้บนพาเนล: 1 เลือกหิน → 2 ออกแบบ → สรุป
 *   (เจ้าของร้านสั่ง 2026-07-28) ของเดิมสลับให้วงขึ้นก่อนเพราะกลัวว่าหิน 37 ชนิด
 *   จะดันวงพ้นจอ — พอตัวเลือกเป็นแถวเดียวสูง 128px ปัญหานั้นหมดไป
 *   จึงเรียงตามเลขได้ตามที่ควรเป็นตั้งแต่แรก
 * ★ ตัวเลือกหินต้องอยู่ "ติด" วงกำไล ไม่ใช่อยู่ท้ายหน้า
 *   วัดก่อนแก้บนจอ 400×860: พาเนลวงสูง 693px ตัวเลือกหินเริ่มที่ y=1002
 *   คือพ้นจอไปแล้ว ต้องเลื่อนลงไปแตะหินแล้วเลื่อนกลับขึ้นมาดูผลทุกครั้ง
 *   (เจ้าของร้านแจ้งเอง 2026-07-28)
 * ★ ส่วนควบคุม (มุมมอง/ซูม/ขนาดข้อมือ) ถูกดันลงไปหลังตัวเลือกหิน เพราะเป็นของที่
 *   ตั้งครั้งเดียวตอนเริ่ม ไม่ใช่ของที่แตะสลับกับการเลือกหินไปมา
 */
.panel-picker   { order: 1; }
.panel-ring     { order: 2; }
.panel-controls { order: 3; }
.panel-summary  { order: 4; }

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
}
.panel-num {
  width: 21px; height: 21px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--gold);
  color: var(--charcoal);
  font-size: 12px;
  font-weight: 700;
}
.panel-sub { margin: 0 0 10px; font-size: 12px; color: var(--ink-muted); }

/* ---------------- picker ---------------- */

.search-field {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--silver-light);
  border-radius: 10px;
  padding: 8px 11px;
  margin: 10px 0;
  background: var(--ivory);
}
.search-field span { font-size: 13px; opacity: 0.6; }
.search-field input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  outline: none;
}

/*
 * บนมือถือ ตัวเลือกเป็น "แถวเดียวเลื่อนแนวนอน" ไม่ใช่กริดสูง 344px
 *
 * ★ ของเดิมจำกัดความสูงไว้ 40vh แล้วเลื่อนแนวตั้งในกล่อง — ยังกินพื้นที่ 344px
 *   ซึ่งดันวงกำไลพ้นจอไปอยู่ดี · แถวเดียวสูงราว 112px ทำให้วงกับตัวเลือก
 *   อยู่ในจอเดียวกันได้จริง
 * ★ scroll-snap ทำให้ปัดแล้วหยุดตรงเม็ด ไม่ค้างครึ่งๆ กลางๆ
 * ★ overscroll-behavior: contain กันไม่ให้การปัดสุดขอบไปลากหน้าทั้งหน้าต่อ
 */
/* ค่าตั้งต้นคือกริดหลายแถว — ใช้กับทุกจอที่กว้างพอ */
.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}

/*
 * เฉพาะโทรศัพท์เท่านั้นที่เป็น "แถวเดียวเลื่อนแนวนอน"
 *
 * ★ วัดก่อนแก้บนจอ 400x860: พาเนลวงสูง 693px ตัวเลือกหินเริ่มที่ y=1002
 *   คือพ้นจอไปแล้ว ต้องเลื่อนลงไปแตะหินแล้วเลื่อนกลับขึ้นมาดูผลทุกครั้ง
 *   (เจ้าของร้านแจ้งเอง 2026-07-28) · แถวเดียวลดจาก 344px เหลือ 128px
 * ★ ไม่ใช้กับแท็บเล็ต — วัดที่ 820px แล้วกว้าง 788px แต่บังคับปัดแนวนอน
 *   คือทิ้งพื้นที่ว่างแล้วทำให้ช้าลง · แถวเดียวคุ้มเฉพาะตอนที่ "ความสูง"
 *   มีค่ามากกว่าความกว้าง
 */
/*
 * บีบแถบหัวหน้าออกแบบบนโทรศัพท์
 *
 * ★ ปุ่ม แชร์/บันทึก/กระจายตัวคั่น/รีเซ็ต เป็นงาน "หลัง" ออกแบบเสร็จ
 *   แต่เดิมกิน 77px (ตัดสองแถว) อยู่บนสุดของหน้า เบียดวงกำไลให้ตกจอ
 *   บีบเป็นแถวเดียวปัดแนวนอน — ยังกดครบทุกปุ่ม แต่คืนพื้นที่ให้ของที่สำคัญกว่า
 * ★ คำโปรยใต้ชื่อซ่อนบนมือถือ — ข้อความ "หินแท้ 37 ชนิด" ซ้ำกับที่เห็นในแถบเลือกหินอยู่แล้ว
 */
@media (max-width: 699px) {
  .designer-bar-actions {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    margin-left: 0;
    width: 100%;
    padding-bottom: 2px;
  }
  .designer-bar-actions > * { flex: 0 0 auto; }
  .designer-bar p { display: none; }
  .designer-bar h1 { font-size: 16px; }
}

@media (max-width: 699px) {
  .pick-grid {
    display: flex;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }
  .pick-grid > .pick-cell { flex: 0 0 96px; scroll-snap-align: start; }
}
/* ★ เลิกใช้ max-height + เลื่อนแนวตั้ง — แถวเดียวไม่ต้องจำกัดความสูงแล้ว */
#stonePanel .pick-grid { padding-right: 4px; }

/*
 * ช่วงแท็บเล็ต (700–999px): ยังวางซ้อนกันอยู่ แต่กริดหลายแถวไม่มีเพดาน
 * จะสูงจนดันวงกำไลพ้นจอ — วัดที่ 820px ได้หน้ายาว 2,534px
 * จำกัดความสูงแล้วให้เลื่อนในกล่องแทน วงกับตัวเลือกจึงยังอยู่ใกล้กัน
 */
@media (min-width: 700px) and (max-width: 999px) {
  #stonePanel .pick-grid { max-height: 290px; overflow-y: auto; overscroll-behavior: contain; }
}
.pick-cell { position: relative; min-width: 0; }
.pick-btn {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 6px 9px;
  background: var(--card);
  border: 1px solid var(--silver-light);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
}
.pick-btn:hover { border-color: var(--gold); background: #fffdf7; }
.pick-btn:active { transform: scale(0.97); }
.pick-bead {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(145deg, #f0ebe0, #ddd6c6);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
/* Half-width parts are drawn smaller in the picker too, so the size is visible where the
   choice is made rather than only once the bead is on the ring. */
.pick-bead.is-half { width: 26px; height: 26px; margin: 7px 0; }
.pick-name {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pick-note {
  font-size: 9.5px;
  line-height: 1.3;
  color: var(--ink-muted);
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pick-price { font-size: 10.5px; font-weight: 700; color: var(--gold-dark); margin-top: auto; }
.pick-empty { text-align: center; font-size: 12.5px; color: var(--ink-muted); padding: 18px 0; margin: 0; }

.pick-fill {
  position: absolute;
  top: 4px; right: 4px;
  font-family: inherit;
  font-size: 8.5px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 5px;
  border: none;
  background: var(--charcoal);
  color: var(--gold-light);
  cursor: pointer;
  opacity: 0.8;
}
.pick-fill:hover { opacity: 1; }

/* ---------------- selected stone info ---------------- */

.stone-info {
  margin-top: 4px;
  border-top: 1px solid var(--silver-light);
}
.stone-info-head { display: flex; gap: 11px; align-items: flex-start; }
.stone-info-bead {
  width: 52px; height: 52px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(145deg, #f0ebe0, #ddd6c6);
  background-size: cover;
  background-position: center;
}
.stone-info-name { margin: 0; font-size: 13.5px; font-weight: 700; }
.stone-info-meaning { margin: 3px 0 0; font-size: 11.5px; line-height: 1.55; color: var(--ink-muted); }
.stone-info-facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 3px 8px;
  margin: 10px 0 0;
  font-size: 11px;
}
.stone-info-facts dt { color: var(--ink-muted); white-space: nowrap; }
.stone-info-facts dd { margin: 0; font-weight: 600; }

/* ---------------- the ring ---------------- */

.ring-wrap { display: flex; justify-content: center; }
.ring-stage {
  position: relative;
  width: 100%;
  max-width: 330px;
  aspect-ratio: 1;
  /* A soft disc, so the bracelet reads as lying on a surface rather than floating.
     Warm greige rather than white: pale stones lit from above washed out against a white
     centre and the top of the ring looked like it was missing beads. */
  background:
    radial-gradient(circle at 50% 42%, #f1ece2, #e6dfd2 55%, rgba(230, 223, 210, 0) 74%);
  border-radius: 50%;
  touch-action: pan-y; /* horizontal drag spins; vertical still scrolls the page */
  user-select: none;
  cursor: grab;
}
/*
 * ★★ ความสูงสำรองสำหรับเบราว์เซอร์ที่ไม่รู้จัก `aspect-ratio`
 *
 *    `aspect-ratio` รองรับตั้งแต่ Safari 15 — iOS ที่เก่ากว่านั้นและ WebView
 *    ในแอปบางตัว (ลูกค้าร้านนี้เข้าจากในแอป LINE เป็นหลัก) จะ **ไม่รู้จักเลย**
 *    แล้วเวทีจะสูง 0px เพราะข้างในมีแต่ `.ring` ที่เป็น position:absolute
 *    ซึ่งไม่ดันความสูงให้พ่อแม่
 *
 *    ผลที่ตามมาไม่ใช่แค่ "จานหาย" — designer.js วัดกล่องนี้เพื่อหารัศมี ได้ศูนย์
 *    แล้วจุดกึ่งกลางไปอยู่ที่ขอบบนของเวที **ครึ่งบนของวงจึงลอยขึ้นไปทับแถบหัวเว็บ**
 *    (เจอจริงบน iPhone 2026-07-28 — เม็ดหินวาดทับโลโก้กับช่องค้นหา)
 *
 *    padding-top:100% บน ::before ให้กล่องสี่เหลี่ยมจัตุรัสเหมือนกันทุกเบราว์เซอร์
 *
 *    ★ ไม่ห่อด้วย `@supports not (aspect-ratio: 1)` โดยตั้งใจ — สาขาที่รันเฉพาะบน
 *      เบราว์เซอร์เก่าคือสาขาที่ **ทดสอบบนเครื่องเราไม่ได้เลย** และสาขาที่ทดสอบไม่ได้
 *      คือสาขาที่จะพัง · padding-top:100% ให้ผลเหมือน aspect-ratio:1 ทุกประการ
 *      (ความสูง = ความกว้าง) จึงใช้ทางเดียวกันทุกเบราว์เซอร์ และทางนั้นถูกทดสอบจริง
 */
.ring-stage::before { content: ''; display: block; padding-top: 100%; }

.ring-stage.is-dragging { cursor: grabbing; }

/* .ring must stay exactly inset:0 in both views. designer.js measures this box to work
   out the radius and positions every part from its centre, so CSS that moves or resizes
   it per view fights the script -- an earlier `top: 46%` here left parts positioned for
   the full box while the box had shrunk, throwing the ring out through the side. */
.ring { position: absolute; inset: 0; }

.slot {
  position: absolute;
  left: 50%; top: 50%;
  padding: 0;
  border-radius: 50%;
  border: none;
  background-color: transparent;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 1px 4px rgba(43, 43, 43, 0.32);
  transition: box-shadow 0.12s;
}
.slot:hover { box-shadow: 0 0 0 2px var(--gold), 0 2px 6px rgba(43, 43, 43, 0.35); }
.slot.is-ghost {
  cursor: default;
  border: 1.5px dashed var(--silver);
  background-color: rgba(255, 255, 255, 0.55);
  box-shadow: none;
  pointer-events: none;
}
/* Position numbers sit OUTSIDE the ring: over a photographic bead they are unreadable. */
.slot-num {
  position: absolute;
  left: 50%; top: 50%;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--ink-muted);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--silver-light);
  border-radius: 50%;
  width: 17px; height: 17px;
  display: grid;
  place-items: center;
  pointer-events: none;
}

/* Only meaningful in 3D: spinning a flat top-down circle just relabels which position
   sits where, so the hint is hidden in 2D rather than inviting a pointless gesture. */
.ring-drag-hint { text-align: center; font-size: 10.5px; color: var(--ink-muted); margin: 8px 0 0; display: none; }
.ring-wrap:has(.is-3d) + .ring-drag-hint { display: block; }

.stage-controls { display: flex; justify-content: center; margin-top: 12px; }
.seg {
  display: inline-flex;
  background: var(--ivory);
  border: 1px solid var(--silver-light);
  border-radius: 999px;
  padding: 3px;
}
.seg-btn {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 16px;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--ink-muted);
  cursor: pointer;
}
.seg-btn.is-active { background: var(--charcoal); color: var(--gold-light); }

.tool-row { display: flex; justify-content: center; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-family: inherit;
  font-size: 10.5px;
  color: var(--ink-muted);
  background: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 7px 11px;
  cursor: pointer;
}
.tool span { font-size: 16px; color: var(--ink); }
.tool:hover { border-color: var(--silver-light); background: var(--ivory); }

.size-row { margin-top: 14px; }

/* How full the bracelet is. A number alone does not convey "nearly there". */
.fill-meter {
  height: 6px;
  border-radius: 999px;
  background: var(--silver-light);
  overflow: hidden;
  margin: 14px 0 8px;
}
.fill-meter span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--gold);
  transition: width 0.18s ease-out;
}
.fill-meter span.is-complete { background: var(--success); }
.fill-meter span.is-over { background: var(--danger); }

.slot-counter { text-align: center; font-size: 14.5px; font-weight: 700; margin: 0 0 2px; }
.slot-counter.is-complete { color: var(--success); }
.designer-hint { text-align: center; font-size: 12px; color: var(--ink-muted); margin: 0; min-height: 18px; }

/* ---------------- composition ---------------- */

/* A full bracelet is 27 parts and a fixed 300px box showed ten of them behind a hairline
   scrollbar, which reads as "the list is missing beads" rather than "the list scrolls".
   It now takes what the viewport can spare, and the scrollbar is made visible. */
.composition {
  list-style: none;
  margin: 8px 0 0;
  padding: 0 6px 0 0;
  display: grid;
  gap: 5px;
  max-height: min(46vh, 520px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--silver) transparent;
}
.composition::-webkit-scrollbar { width: 8px; }
.composition::-webkit-scrollbar-thumb { background: var(--silver); border-radius: 999px; }
.composition::-webkit-scrollbar-track { background: var(--silver-light); border-radius: 999px; }

/* Total count beside the panel heading, so it is obvious how many there are even when
   the list is scrolled part-way. */
.panel-count {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-muted);
  background: var(--ivory);
  border: 1px solid var(--silver-light);
  border-radius: 999px;
  padding: 2px 9px;
}
.comp-empty { font-size: 12.5px; color: var(--ink-muted); padding: 8px 0; }
.comp-row {
  display: grid;
  grid-template-columns: 18px 26px minmax(0, 1fr) auto 22px;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  padding: 3px 0;
}
.comp-index { font-size: 11px; color: var(--ink-muted); text-align: right; }
.comp-bead {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(145deg, #f0ebe0, #ddd6c6);
  background-size: cover;
  background-position: center;
}
.comp-bead.is-half { width: 16px; height: 16px; margin: 4px; }
.comp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-price { font-weight: 600; color: var(--gold-dark); font-size: 11.5px; }
.comp-remove {
  border: none;
  background: none;
  color: var(--danger);
  font-size: 12px;
  cursor: pointer;
  padding: 2px;
  font-family: inherit;
}

.spec-table {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px 10px;
  margin: 8px 0 0;
  font-size: 12.5px;
}
.spec-table dt { color: var(--ink-muted); white-space: nowrap; }
.spec-table dd { margin: 0; text-align: right; font-weight: 600; }

.price-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--silver-light);
  margin-top: 12px;
  padding-top: 12px;
  font-size: 14px;
  font-weight: 700;
}
.price-line strong { font-size: 22px; color: var(--gold-dark); }

.howto-box { margin-top: 12px; border-top: 1px solid var(--silver-light); padding-top: 10px; }
.howto-box summary { font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--gold-dark); }
.howto { margin: 8px 0 0; padding-left: 18px; font-size: 12px; line-height: 1.8; color: var(--ink); }
.howto strong { color: var(--gold-dark); }

/* ---------------- SweetAlert, wearing the shop's clothes ---------------- */

.jj-swal {
  border-radius: var(--radius) !important;
  font-family: "Anuphan", "Noto Sans SC", system-ui, sans-serif !important;
  box-shadow: 0 18px 60px -20px rgba(43, 43, 43, 0.5) !important;
}
.jj-swal .swal2-title { font-size: 18px !important; font-weight: 700 !important; }
.jj-swal .swal2-html-container { font-size: 13.5px !important; }
.jj-swal .swal2-styled { border-radius: 999px !important; font-weight: 600 !important; font-size: 14px !important; }
.jj-swal .swal2-styled.swal2-confirm { color: var(--charcoal) !important; }
.jj-swal-input {
  width: 100%;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  padding: 9px 11px;
  border: 1px solid var(--silver-light);
  border-radius: 8px;
  background: var(--ivory);
  color: var(--ink);
}

@media (min-width: 1000px) {
  /*
   * สามคอลัมน์ตาม mockup: เลือกหิน | ออกแบบ | สรุป
   * ★ ตัวเลือกหินอยู่ "ข้าง" วงกำไลจริงตรงนี้ ซึ่งคือสิ่งที่เจ้าของร้านขอ
   *   บนจอแคบทำแบบนี้ไม่ได้ จึงใช้แถวเดียวเลื่อนแนวนอนแทน
   * ★ อ้างด้วยชื่อคลาส ไม่ใช่ :nth-of-type — ตอนแยกส่วนควบคุมออกมาเป็นพาเนลที่ 4
   *   เลข nth เลื่อนไปชี้ผิดตัวทันทีโดยไม่มีอะไรเตือน
   */
  .designer {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr) minmax(0, 0.9fr);
    gap: 16px;
    align-items: start;
  }
  /* order กลับเป็นศูนย์ทั้งหมด — การเรียงบนมือถือต้องไม่ตามมาที่จอกว้าง */
  .panel-picker   { grid-column: 1; grid-row: 1 / span 2; order: 0; }
  .panel-ring     { grid-column: 2; grid-row: 1;          order: 0; }
  .panel-controls { grid-column: 2; grid-row: 2;          order: 0; }
  .panel-summary  { grid-column: 3; grid-row: 1;          order: 0; position: sticky; top: 96px; }

  .ring-stage { max-width: 100%; }
  /* จำกัดความสูงไว้ ไม่งั้นหิน 37 ชนิดจะดันคอลัมน์กลางให้สั้นกว่าคอลัมน์ซ้ายมาก */
  #stonePanel .pick-grid { max-height: 340px; overflow-y: auto; }
  .designer-bar h1 { font-size: 21px; }
}

/* ปุ่มรีเซ็ตมุมขวาบนของพาเนลวงกำไล
   ★ ต้องเป็น position:absolute ในพาเนล ไม่ใช่ float — พาเนลมี padding อยู่แล้ว
     และหัวข้อ "2 ออกแบบกำไลของคุณ" ต้องไม่ถูกดันหรือถูกตัดคำเพราะปุ่ม
   ★ .panel มี position:relative อยู่แล้วไหม? ถ้าไม่มีต้องใส่ ไม่งั้นปุ่มจะไปเกาะ
     บรรพบุรุษที่ไกลกว่าแล้วลอยผิดที่ */
.panel-ring { position: relative; }
.ring-reset {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  display: inline-flex; align-items: center; justify-content: center;
  /* 38px — เล็กพอที่จะไม่เบียดหัวข้อ แต่ยังใหญ่กว่าเกณฑ์นิ้ว 36px
     (ไอคอนล้วนต้องไม่เล็กกว่านี้ ไม่งั้นกดพลาดบ่อย) */
  width: 38px; height: 38px; padding: 0;
  border: 1px solid var(--silver-light); border-radius: 50%;
  background: var(--card); color: var(--ink-muted);
  font-family: inherit; font-size: 17px; line-height: 1; cursor: pointer;
}
.ring-reset:hover { border-color: var(--danger); color: var(--danger); }
/* เว้นที่ให้ปุ่มไม่ให้ทับหัวข้อบนจอแคบ */
.panel-ring .panel-title,
.panel-ring .panel-sub { padding-right: 48px; }

/* ═════════════════════ ขนาดเม็ดหิน 6 / 8 / 10 มม. ═════════════════════
   เจ้าของร้านสั่ง 2026-07-28: ขาย 3 ขนาด และผสมในวงเดียวกันได้

   ★ สีประจำขนาดกำหนดที่เดียวตรงนี้ แล้วใช้ซ้ำทั้งปุ่มเลือกและวงแหวนรอบเม็ด
     ในวง — ลูกค้าต้องเชื่อมโยง "ปุ่มเขียว" กับ "เม็ดที่มีขอบเขียว" ได้โดยไม่ต้องอ่าน
   ★ ใช้เป็น "ขอบ" ไม่ใช่พื้น เพราะพื้นของเม็ดคือรูปหินจริง ซึ่งเป็นข้อมูลที่สำคัญกว่า */
:root {
  --mm6:  #4f9d5d;
  --mm8:  #7b5ea7;
  --mm10: #3f7cc4;
}

.bead-size-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  margin: 0 0 12px; padding: 10px 12px;
  border: 1px solid var(--silver-light); border-radius: 12px;
  background: var(--bg-soft, #faf8f4);
}
.bead-size-lead {
  font-size: 12.5px; font-weight: 700; color: var(--ink);
  display: flex; flex-direction: column; line-height: 1.35;
}
.bead-size-lead em {
  font-style: normal; font-weight: 400; font-size: 11px; color: var(--ink-muted);
}
.bead-size-chips { display: flex; gap: 6px; flex-wrap: wrap; }

.bead-chip {
  display: inline-flex; align-items: center; gap: 6px;
  /* 38px สูงพอสำหรับนิ้ว (เกณฑ์ 36px) — แถบนี้ถูกกดบ่อยที่สุดในหน้า */
  min-height: 38px; padding: 7px 14px;
  border: 1.5px solid var(--silver-light); border-radius: 10px;
  background: var(--card); color: var(--ink);
  font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
/* จุดสีนำหน้า ขนาดของจุด "สื่อขนาดจริงของเม็ด" ไม่ใช่จุดเท่ากันหมด
   — เป็นการบอกความต่างของขนาดโดยไม่ต้องใช้ตัวหนังสือ */
.bead-chip-dot { border-radius: 50%; background: currentColor; opacity: .55; }
.bead-chip.is-mm6  { color: var(--mm6); }
.bead-chip.is-mm8  { color: var(--mm8); }
.bead-chip.is-mm10 { color: var(--mm10); }
.bead-chip.is-mm6  .bead-chip-dot { width: 8px;  height: 8px; }
.bead-chip.is-mm8  .bead-chip-dot { width: 11px; height: 11px; }
.bead-chip.is-mm10 .bead-chip-dot { width: 14px; height: 14px; }
.bead-chip.is-on {
  border-color: currentColor;
  /* ★ ใช้ box-shadow เป็นวงในแทนการเพิ่มความหนาของ border — เปลี่ยนความหนา border
       จะทำให้ปุ่มขยับตำแหน่งตอนกด ทั้งแถวจะกระตุก */
  box-shadow: inset 0 0 0 1px currentColor;
  background: color-mix(in srgb, currentColor 12%, var(--card));
}
.bead-chip:disabled { opacity: .4; cursor: not-allowed; }
.bead-size-note { margin: 0; font-size: 11.5px; color: var(--ink-muted); width: 100%; }

/* ── ใบหินที่ไม่มีของในขนาดที่เลือกอยู่
   ★ จางลงแต่ยังอยู่ ไม่ซ่อนทิ้ง — ซ่อนแล้วรายการจะกระโดดเรียงใหม่ทุกครั้งที่เปลี่ยน
     ขนาด และลูกค้าจะไม่รู้ว่าหินที่หาอยู่ "มีแต่คนละขนาด" หรือ "ร้านไม่มีเลย" */
.pick-cell.is-unavailable { opacity: .42; }
.pick-cell.is-unavailable .pick-btn { cursor: not-allowed; }
.pick-price.is-out { color: var(--ink-muted); font-weight: 400; }

/* ── เม็ดในวง: วงแหวนสีบอกขนาด
   ขนาดที่วาดจริงมาจาก layoutRing() (คอร์ดของส่วนโค้ง) อยู่แล้ว วงแหวนนี้จึงเป็น
   ตัวยืนยันด้วยสี ไม่ใช่ตัวบอกขนาดเพียงอย่างเดียว — คนตาบอดสีจะยังเห็นความต่าง
   ของขนาดจริงอยู่ */
.slot.is-mm6  { box-shadow: 0 0 0 2px var(--mm6),  0 2px 6px rgba(43, 43, 43, .3); }
.slot.is-mm8  { box-shadow: 0 0 0 2px var(--mm8),  0 2px 6px rgba(43, 43, 43, .3); }
.slot.is-mm10 { box-shadow: 0 0 0 2px var(--mm10), 0 2px 6px rgba(43, 43, 43, .3); }

/* ── ในรายการสรุป จุดนำหน้าก็ต่างขนาดตามจริง */
.comp-bead.is-mm6  { width: 17px; height: 17px; margin: 3.5px; outline: 1.5px solid var(--mm6);  outline-offset: 1px; }
.comp-bead.is-mm8  { outline: 1.5px solid var(--mm8);  outline-offset: 1px; }
.comp-bead.is-mm10 { width: 26px; height: 26px; margin: -1px; outline: 1.5px solid var(--mm10); outline-offset: 1px; }
.comp-mm {
  font-style: normal; font-size: 10.5px; font-weight: 700;
  color: var(--ink-muted); margin-left: 6px;
}
/* ============ กดค้างเม็ดในวงแล้วลากไปวางตำแหน่งใหม่ ============
 * ★ ต้องมีสัญญาณว่า "จับติดแล้ว" ให้ชัด เพราะบนมือถือไม่มีเคอร์เซอร์บอก
 *   ถ้าเม็ดไม่เปลี่ยนหน้าตาเลย ผู้ใช้จะไม่รู้ว่ากดค้างนานพอหรือยัง แล้วปล่อยเร็ว
 *   ซึ่งกลายเป็นการ "แตะ" = ลบเม็ดนั้นทิ้งแทน
 */
.slot.is-lifted {
  z-index: 800;                 /* เหนือเม็ดอื่นทุกเม็ด (ช่วง 300-700) แต่ยังต่ำกว่า SweetAlert 1060 */
  box-shadow: 0 6px 16px rgba(43, 43, 43, 0.45);
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  opacity: 0.92;
  cursor: grabbing;
}
/* ปลายทางที่จะวาง — วงแหวนประให้เห็นว่าปล่อยแล้วเม็ดจะไปอยู่ตรงไหน */
.slot.is-drop-target {
  outline: 2px dashed var(--gold-dark);
  outline-offset: 3px;
}
/* ขณะย้ายเม็ด ห้ามให้เบราว์เซอร์เลื่อนหน้าตามนิ้ว ไม่งั้นหน้าไหลขณะกำลังเล็งตำแหน่ง */
.ring-stage.is-reordering { touch-action: none; cursor: grabbing; }
.ring-stage.is-reordering .slot { touch-action: none; }

/* ============ กันมือถือซูมเองตอนแตะรัวๆ (double-tap zoom) ============
 *
 * ★ อาการ: กดเม็ดหินรัวๆ แล้วหน้าจอซูมเข้าเอง (เจ้าของร้านเจอจริง 2026-07-28)
 *   เบราว์เซอร์มือถือรอดูว่าจะมีแตะครั้งที่สองไหมเพื่อ "แตะสองครั้งเพื่อซูม"
 *   การกดปุ่มเร็วๆ ติดกันจึงถูกตีความเป็นการซูม ไม่ใช่การกดสองครั้ง
 *   (ผลพลอยได้อีกอย่างคือทุกการแตะหน่วงราว 300ms เพราะต้องรอดูก่อน)
 *
 * ★ `manipulation` = ยังเลื่อนหน้าและ **บีบนิ้วซูมได้ตามปกติ** ตัดเฉพาะ
 *   "แตะสองครั้งเพื่อซูม" ออก · จึงไม่ทำลายการเข้าถึงของคนสายตาไม่ดี
 *   ★★ ห้ามแก้ด้วย `user-scalable=no` ใน viewport meta เด็ดขาด — นั่นคือ
 *      การห้ามคนซูมทั้งเว็บ ซึ่งกันคนที่มองไม่ชัดออกจากร้าน และ iOS
 *      ก็ไม่สนใจค่านั้นตั้งแต่ iOS 10 แล้ว จึงได้ผลเสียโดยไม่ได้ผลดี
 */
button,
[role="button"],
.btn,
.pill-btn,
.chip,
.tool,
.seg-btn,
.pick-btn,
.pick-fill {
  touch-action: manipulation;
}

/*
 * เม็ดหินในวงใช้ `pan-y` ไม่ใช่ `manipulation`
 * ★ ต้องตรงกับ `.ring-stage` — การลากซ้าย-ขวาบนวงคือการหมุน ซึ่ง JS เป็นคนทำ
 *   ถ้าเม็ดเป็น `manipulation` เบราว์เซอร์จะรับการลากแนวนอนไปเอง แล้วการลาก
 *   ที่เริ่มจากบนเม็ดหินจะหมุนวงไม่ได้ · `pan-y` ตัด double-tap zoom เหมือนกัน
 */
.slot { touch-action: pan-y; }

/* ================= checkout ================= */

/* The four-step bar. Steps already passed are links, so correcting an address does not
   mean starting over; the current and later steps are not, because jumping ahead would
   skip the data the next page needs. */
.steps {
  display: flex;
  list-style: none;
  margin: 16px 0 14px;
  padding: 0;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.steps::-webkit-scrollbar { display: none; }
.step {
  flex: 1 0 auto;
  min-width: 0;
}
.step > a,
.step > span {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--silver-light);
  font-size: 12.5px;
  color: var(--ink-muted);
  white-space: nowrap;
}
.step-num {
  width: 20px; height: 20px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--silver-light);
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 700;
}
.step.is-current > span {
  border-color: var(--gold);
  background: #fffdf7;
  color: var(--ink);
  font-weight: 600;
}
.step.is-current .step-num { background: var(--gold); color: var(--charcoal); }
.step.is-done > a { color: var(--ink); }
.step.is-done .step-num { background: var(--success); color: #fff; }
.step.is-done > a:hover { border-color: var(--gold); }

/* ---------------- saved addresses ---------------- */

.addr-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 11px 0;
  border-top: 1px solid var(--silver-light);
}
.addr-row:first-of-type { border-top: none; }
.addr-body { flex: 1; min-width: 0; }
.addr-label { margin: 0 0 3px; font-size: 13px; font-weight: 700; }
.addr-default {
  margin-left: 6px;
  font-size: 10px;
  font-weight: 600;
  background: var(--gold);
  color: var(--charcoal);
  border-radius: 5px;
  padding: 1px 6px;
  vertical-align: middle;
}
.addr-text { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--ink-muted); }
.addr-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }

/* ---------------- payment method ---------------- */

.pay-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--silver-light);
  border-radius: 11px;
  margin-bottom: 8px;
  cursor: pointer;
}
.pay-option:hover { border-color: var(--gold); background: #fffdf7; }
.pay-option input { margin-top: 3px; accent-color: var(--gold-dark); }
.pay-option strong { display: block; font-size: 13.5px; }
.pay-option small { display: block; font-size: 11.5px; color: var(--ink-muted); line-height: 1.5; margin-top: 2px; }
.pay-option.is-disabled { opacity: 0.5; cursor: not-allowed; }
.pay-option.is-disabled:hover { border-color: var(--silver-light); background: var(--card); }

/* รับที่หน้างาน (2026-11-28) — ตัวเลือกงานใช้ .pay-option เดิม · fieldset ล้างกรอบของเบราว์เซอร์ */
.pickup-events { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; min-width: 0; }
.pickup-where { margin: 0 0 12px; font-size: 13.5px; line-height: 1.7; }
.pickup-pay { margin: 10px 0 0; font-size: 13px; }
.pickup-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pickup-steps li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-muted); }
.pickup-steps li.is-done { color: var(--ink); }
.pickup-steps li[aria-current="step"] { font-weight: 600; }
.pickup-dot {
  flex: none; display: inline-grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--silver-light); background: var(--card);
  color: var(--card); font-size: 13px;
}
.pickup-steps li.is-done .pickup-dot { border-color: var(--success); background: var(--success); }

/* ป้ายวันที่แบบต้นขั้วตั๋ว — จุดเดียวที่ "เป็นงานอีเวนต์" ในหน้า checkout ที่เหลือเรียบ */
.pickup-option { align-items: center; }
.pickup-date {
  flex: none; display: grid; place-items: center; align-content: center;
  min-width: 64px; padding: 6px 8px; border-radius: 9px;
  border: 1px dashed var(--gold); background: var(--ivory);
  text-align: center; line-height: 1.15;
}
.pickup-date b { font-size: 17px; color: var(--ink); letter-spacing: .01em; }
.pickup-date small { font-size: 11px; color: var(--ink-muted); margin-top: 2px; }
.pay-option input:checked ~ .pickup-date { border-style: solid; background: var(--card); }

/* เงื่อนไขรับของ/ไม่คืนเงิน — "ต้องรู้" ไม่ใช่ "ผิดพลาด" จึงไม่ใช้กรอบแดงของ .alert-err
   ★ ข้อความใช้ --ink (ไม่ใช่ --gold-dark ที่ contrast ไม่ผ่าน) · สีทองอยู่แค่เส้นขอบ */
.pickup-policy {
  display: flex; gap: 8px; align-items: flex-start;
  margin: 0; padding: 10px 12px; border-radius: 9px;
  background: var(--ivory-deep); border-left: 3px solid var(--gold);
  font-size: 12.5px; line-height: 1.6; color: var(--ink);
}
.pickup-policy .ui-ico { flex: none; margin-top: 3px; color: var(--danger); }
.pickup-event-line { margin: 0; font-size: 13.5px; line-height: 1.7; }

/* เลือกวิธีรับสินค้า (address.php) — สลับแผงด้วย CSS ล้วน: input ต้องเป็นพี่น้องที่อยู่ก่อน .recv-panel
   ★ ไม่รองรับ selector = เห็นทั้งสองแผง (พฤติกรรมเดิม) ไม่ใช่หน้าเสีย */
.recv-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.recv-tab {
  display: flex; align-items: flex-start; gap: 10px; min-height: 64px;
  padding: 12px; border: 1px solid var(--silver-light); border-radius: 11px;
  background: var(--card); cursor: pointer;
}
.recv-tab:hover { border-color: var(--gold); }
.recv-text { display: grid; gap: 2px; min-width: 0; font-size: 13.5px; }
.recv-text small { font-size: 11.5px; color: var(--ink-muted); overflow-wrap: anywhere; }
.recv-dot {
  flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%;
  border: 2px solid var(--silver); background: var(--card);
}
#recvShip:checked ~ .recv-tabs .recv-tab-ship,
#recvPickup:checked ~ .recv-tabs .recv-tab-pickup { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
#recvShip:checked ~ .recv-tabs .recv-tab-ship .recv-dot,
#recvPickup:checked ~ .recv-tabs .recv-tab-pickup .recv-dot { border-color: var(--gold); box-shadow: inset 0 0 0 4px var(--card); background: var(--gold); }
#recvShip:focus-visible ~ .recv-tabs .recv-tab-ship,
#recvPickup:focus-visible ~ .recv-tabs .recv-tab-pickup { outline: 2px solid var(--ink); outline-offset: 2px; }
#recvShip:checked ~ .recv-panel-pickup,
#recvPickup:checked ~ .recv-panel-ship { display: none; }

/* ---------------- order placed ---------------- */

.order-done { text-align: center; padding: 18px 12px 8px; }
.order-done-mark {
  width: 56px; height: 56px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 28px;
  font-weight: 700;
}
.order-done h1 { margin: 0 0 4px; font-size: 21px; }
.order-number { margin: 0 0 6px; font-size: 15px; }
.order-number strong {
  font-family: ui-monospace, monospace;
  font-size: 17px;
  letter-spacing: 0.04em;
  color: var(--gold-dark);
}

/* ================= account (phase 4) ================= */

.account-head {
  display: flex;
  align-items: center;
  gap: 13px;
  flex-wrap: wrap;
  padding: 18px 0 6px;
}
.account-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold);
  flex-shrink: 0;
}
.account-avatar-blank {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #fffdf8, #f0e9dc);
  color: var(--gold-dark);
  font-family: "Anuphan", "Noto Sans SC", system-ui, sans-serif;
  font-size: 26px;
}
.account-head h1 { margin: 0; font-size: 19px; }

.account-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.account-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px;
  background: var(--card);
  border: 1px solid rgba(231, 231, 231, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.account-tile:hover { border-color: var(--gold); }
.account-tile-icon { font-size: 22px; line-height: 1; margin-bottom: 4px; }
.account-tile strong { font-size: 13.5px; }
.account-tile small { font-size: 11.5px; color: var(--ink-muted); }

/* ---------------- order rows ---------------- */

.order-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  background: var(--card);
  border: 1px solid rgba(231, 231, 231, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 9px;
}
.order-row:hover { border-color: var(--gold); }
.order-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.order-row-number { font-family: ui-monospace, monospace; font-size: 13px; font-weight: 700; }
.order-row-date { font-size: 11.5px; color: var(--ink-muted); }
.order-row-total { font-size: 14px; font-weight: 700; color: var(--gold-dark); white-space: nowrap; }

/* Same status vocabulary as the admin (ORDER_STATUS_PILL), so a customer and staff never
   see one order described two different ways. */
.order-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.order-pill-pending { background: #fdf3e0; color: #96660d; }
.order-pill-shipped { background: #e8f4ec; color: #1e7a4d; }
.order-pill-cancelled { background: #fbeceb; color: #a33227; }
.order-pill-muted { background: var(--silver-light); color: var(--ink-muted); }

.order-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px 0;
  border-top: 1px solid var(--silver-light);
}
.order-item:first-of-type { border-top: none; }
.order-item-thumb {
  width: 62px; height: 62px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 9px;
  border: 1px solid var(--silver-light);
  background: var(--card);
}
.order-item-name { margin: 0; font-size: 13px; font-weight: 600; }
.order-item-detail { margin: 3px 0 0; font-size: 11.5px; line-height: 1.55; color: var(--ink-muted); }
.order-item-price { font-size: 13px; font-weight: 600; color: var(--gold-dark); white-space: nowrap; }

/* ---------------- wishlist heart ---------------- */

/* The card is a div with the link inside it, because a <form> cannot live inside an <a>.
   The heart sits above the link so it is clickable without following it. */
.product-card { position: relative; }
.product-card-link { display: flex; flex-direction: column; height: 100%; }
/* วงโฟกัสอยู่ด้านใน เพราะการ์ดตัดส่วนที่ล้นเพื่อรักษามุมโค้ง */
.product-card-link:focus-visible { outline-offset: -3px; }
.wish-form { position: absolute; top: 6px; right: 6px; z-index: 2; }
.wish-btn {
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--silver-light);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink-muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 1px 3px rgba(43, 43, 43, 0.18);
}
.wish-btn:hover { border-color: var(--danger); color: var(--danger); }
.wish-btn.is-on { color: var(--danger); border-color: var(--danger); }

/* ---------------- saved designs ---------------- */

.design-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.design-card {
  background: var(--card);
  border: 1px solid rgba(231, 231, 231, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.design-card > a { display: flex; flex-direction: column; gap: 5px; }
.design-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 10px;
  background: var(--ivory);
}
.design-blank {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--ivory);
  font-size: 30px;
}
.design-card strong { font-size: 12.5px; line-height: 1.3; }
.design-card small { font-size: 11px; color: var(--ink-muted); }
.design-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }

@media (min-width: 900px) {
  .account-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .design-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}


/* ================= ข้อความที่จัดรูปแบบจากแอดมิน (.rich) =================
   ฟิลด์รายละเอียด/ความหมาย/วิธีดูแล เก็บเป็น HTML จากตัวแก้ไข Trix แล้วผ่าน
   rich_html() ก่อนแสดง กฎที่นี่คุมเฉพาะระยะห่างกับหัวข้อ ไม่ให้แอดมินกำหนดสีเองได้
   (ตัวกรองตัด style= ทิ้งอยู่แล้ว) หน้าร้านจึงยังเป็นธีมเดียวกันทั้งเว็บ */

.rich > div:empty { min-height: 0.9em; }   /* บรรทัดว่างที่ตั้งใจเว้น */

.rich h3 {
  font-size: 1.05em;
  font-weight: 700;
  margin: 0.9em 0 0.35em;
  color: var(--ink);
}
.rich h3:first-child { margin-top: 0; }

.rich ul,
.rich ol {
  margin: 0.4em 0;
  padding-left: 1.35em;
}

.rich li { margin: 0.15em 0; }

.rich blockquote {
  margin: 0.6em 0;
  padding-left: 0.75em;
  border-left: 2px solid var(--gold);
  color: var(--ink-muted);
}

.rich pre {
  margin: 0.5em 0;
  padding: 0.6em 0.8em;
  background: var(--silver-light);
  border-radius: 8px;
  font-size: 0.92em;
  overflow-x: auto;      /* โค้ด/ข้อความยาวเลื่อนในกล่องตัวเอง ไม่ดันหน้าให้เลื่อนแนวนอน */
  white-space: pre-wrap;
}

.rich a {
  color: var(--gold-dark);
  text-decoration: underline;
}

.rich strong { font-weight: 700; }
.rich del { opacity: 0.7; }

/* บนการ์ดหิน ข้อความถูกบีบให้เล็กอยู่แล้ว หัวข้อจึงไม่ควรใหญ่กว่าเนื้อรอบๆ มาก */
.stone-meaning.rich h3,
.stone-care.rich h3 { font-size: 1em; margin: 0.5em 0 0.2em; }
.stone-meaning.rich ul,
.stone-care.rich ul { padding-left: 1.1em; }

/* ---------------------------------------------------------------- บริการเสริม
   แถวติ๊กเลือกในตะกร้า — พื้นที่กดต้องเป็นทั้งแถว ไม่ใช่แค่ช่องสี่เหลี่ยมเล็กๆ
   เพราะหน้านี้ถูกใช้บนมือถือเป็นหลัก */
.cart-addons { margin-top: 14px; }
.addon-row {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 2px; cursor: pointer;
  border-top: 1px solid var(--line, #eee7d8);
}
.addon-row:first-of-type { border-top: none; }
.addon-row input { width: 18px; height: 18px; accent-color: #c9a24b; flex: none; }
.addon-text { flex: 1 1 auto; min-width: 0; }
.addon-name { display: block; font-size: 14px; }
.addon-note { display: block; font-size: 12px; color: #8a8378; margin-top: 2px; }
.addon-price { flex: none; font-size: 13.5px; color: #6f6a60; }

/* ---------------------------------------------------------------- บทความ
   การ์ดในหน้ารายการต้องสูงเท่ากันทั้งแถว ไม่งั้นบทความที่ไม่มีรูปปกจะทำให้
   แถวนั้นเตี้ยลงและกริดดูพัง — ปกจึงมีความสูงคงที่เสมอแม้ไม่มีรูป */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  padding: 4px 0 20px;
}
.article-card {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line, #eee7d8);
  border-radius: 12px; overflow: hidden; color: inherit; text-decoration: none;
}
.article-cover {
  display: block; height: 132px;
  background-size: cover; background-position: center;
  background-color: var(--ivory-deep);
}
.article-cover.is-blank {
  display: flex; align-items: center; justify-content: center;
  color: #d6c79c; font-size: 30px;
}
.article-body { display: block; padding: 12px 14px 15px; }
.article-date { display: block; font-size: 11.5px; color: #8a8378; }
.article-title { display: block; font-size: 14.5px; font-weight: 600; margin: 3px 0 5px; }
.article-excerpt { display: block; font-size: 12.5px; color: #6f6a60; line-height: 1.55; }

.article-full { padding: 6px 0 8px; }
.article-hero { width: 100%; border-radius: 12px; display: block; margin-bottom: 14px; }
.article-h1 { font-size: 21px; margin: 0 0 4px; line-height: 1.4; }
.article-meta { font-size: 12px; color: #8a8378; margin: 0 0 14px; }
.article-lead { font-size: 14.5px; line-height: 1.75; margin: 0 0 14px; color: #4a453d; }
.article-content { font-size: 14.5px; line-height: 1.85; }
.article-foot { display: flex; gap: 10px; flex-wrap: wrap; padding: 18px 0 8px; }

/* แบ่งหน้า — ใช้ที่หน้าบทความเป็นที่แรก */
.pager { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px 0 20px; }
.pager-item {
  min-width: 34px; padding: 6px 10px; text-align: center;
  border: 1px solid var(--line, #eee7d8); border-radius: 8px;
  font-size: 13px; color: inherit; text-decoration: none;
}
.pager-item.is-active { background: #c9a24b; border-color: #c9a24b; color: #fff; font-weight: 600; }

/* ---------------------------------------------------------------- ตัวสลับภาษา
   dropdown ทำด้วย <details> ไม่ใช่ <select> หรือ CSS hack
   — เปิด/ปิดเองได้โดยไม่ต้องมีสคริปต์ ใช้คีย์บอร์ดได้ตามมาตรฐาน
   และเครื่องมืออ่านหน้าจอรู้จักสถานะเปิด/ปิดของมันอยู่แล้ว

   ธงเป็น SVG ฝังในโค้ด ไม่ใช่อิโมจิ เพราะ Windows ไม่มีฟอนต์ธง
   (จะกลายเป็นตัวอักษร "TH" "GB" "CN") — ดู lang_flag_svg() ใน function/i18n.php */
.lang-menu { position: relative; flex: none; }

.lang-menu > summary {
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border-radius: 980px;
  font-size: 12.5px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  list-style: none;                 /* ซ่อนสามเหลี่ยมเริ่มต้นของ <details> */
  white-space: nowrap;
  transition: background .16s ease;
}
.lang-menu > summary::-webkit-details-marker { display: none; }
.lang-menu > summary:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.lang-menu[open] > summary { background: rgba(255, 255, 255, 0.14); color: #fff; }
.lang-menu > summary:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 2px; }

/* ธงมีขอบบางๆ เพราะธงที่มีพื้นขาว (ไทย) จะกลืนไปกับพื้นสว่างถ้าไม่มีขอบ */
.lang-flag {
  display: block;
  width: 21px;
  height: 14px;
  flex: none;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
}
.lang-flag svg { display: block; width: 100%; height: 100%; }

.lang-caret {
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4.5px solid currentColor;
  opacity: .75;
  transition: transform .18s ease;
}
.lang-menu[open] .lang-caret { transform: rotate(180deg); }

.lang-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;                      /* เหนือ header ที่เป็น sticky */
  min-width: 168px;
  padding: 6px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,.08), 0 14px 34px -10px rgba(0,0,0,.35);
}
.lang-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  /* ★ 9px ได้ความสูง 36px — ต่ำกว่าเกณฑ์เป้าสัมผัส 44px (แก้ 2026-08-05) */
  min-height: 44px;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
}
.lang-list a:hover { background: var(--ivory); }
.lang-list a.is-on { font-weight: 600; color: var(--gold-dark); }
/* เครื่องหมายถูกบอกภาษาที่ใช้อยู่ — สีอย่างเดียวไม่พอสำหรับคนตาบอดสี */
.lang-list a.is-on::after { content: "✓"; margin-left: auto; font-size: 12px; }

@media (min-width: 900px) {
  .lang-menu > summary { font-size: 13px; padding: 6px 11px; }
}

/* ---------------------------------------------------------------- แนบสลิป
   พื้นที่เลือกไฟล์ทั้งกรอบกดได้ ไม่ใช่แค่ปุ่มเล็กๆ ที่เบราว์เซอร์วาดให้

   ★ ของเดิมเป็น <input type="file"> เปล่า ซึ่งปุ่มจริงกว้าง ~80px สูง 21px
     อยู่ซ้ายสุดของกล่องกว้าง 637px (วัดจริง) ส่วนที่เหลือกดไม่ติด
     บนมือถือยิ่งต่ำกว่า 44px ที่นิ้วกดโดน — ลูกค้ากดพลาดแล้วคิดว่าปุ่มเสีย */
.slip-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 116px;              /* สูงกว่าเกณฑ์ 44px มาก กดพลาดยาก */
  padding: 18px 16px;
  border: 1.5px dashed var(--silver-light);
  border-radius: var(--radius);
  background: var(--card);
  text-align: center;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease;
}
.slip-drop:hover { border-color: var(--gold); background: #fdfaf2; }
/* เห็นชัดว่าโฟกัสอยู่ตรงนี้เมื่อใช้คีย์บอร์ด — input ถูกซ่อนจึงต้องโชว์ที่กรอบแทน
   ★ ใช้ outline ไม่ใช่ border — .slip-drop.has-file ข้างล่างมี specificity เท่ากัน
     และอยู่ทีหลัง จึงชนะกฎ border ของ :focus-within เสมอ ผลคือพอเลือกไฟล์แล้ว
     คนใช้คีย์บอร์ดจะมองไม่เห็นว่าโฟกัสอยู่ตรงไหน · outline เป็นคนละคุณสมบัติ
     จึงอยู่รอดทั้งสองสถานะ (ตรวจแล้วว่าเห็นวงโฟกัสทั้งก่อนและหลังเลือกไฟล์) */
.slip-drop:focus-within {
  border-color: var(--gold-dark);
  background: #fdfaf2;
  outline: 2px solid var(--gold-dark);
  outline-offset: 2px;
}

/* ซ่อนแบบ sr-only ไม่ใช่ display:none — display:none จะหลุดจากลำดับ Tab
   ทำให้คนที่ใช้คีย์บอร์ดเข้าไม่ถึงช่องนี้เลย */
.slip-input {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.slip-icon { font-size: 26px; line-height: 1; }
.slip-main { font-size: 15px; font-weight: 600; margin-top: 6px; }
.slip-hint { font-size: 12.5px; color: var(--ink-muted); }
.slip-file {
  display: block;
  margin-top: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--success);
  word-break: break-all;
}
.slip-drop.has-file { border-style: solid; border-color: var(--success); background: #f5fbf7; }

/* ---------------------------------------------------- จังหวัด/อำเภอ/ตำบล
   ★ ติ๊ก "ที่อยู่ต่างประเทศ" ทำเป็นกรอบมีพื้น ไม่ใช่ checkbox ลอยๆ ปนกับ
     "บันทึกที่อยู่นี้ไว้" ข้างล่าง — สองอันนั้นเป็นตัวเลือกเล็กๆ ส่วนอันนี้
     **เปลี่ยนหน้าตาของฟอร์ม** คนต้องเห็นว่ามันไม่ใช่ของประเภทเดียวกัน */
.geo-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid var(--silver-light);
  border-radius: 9px;
  background: var(--card);
  font-size: 13px;
  cursor: pointer;
}
.geo-toggle input { flex: none; }

.geo-fields { display: grid; gap: 12px; }
/* จอกว้างพอ วางสามช่องเรียงกัน — บนมือถือเรียงลงมาเพราะชื่อตำบลไทยยาว
   จนตัดคำกลางคำถ้าบีบเป็นสามคอลัมน์ */
@media (min-width: 620px) {
  .geo-fields { grid-template-columns: repeat(3, 1fr); }
}
.geo-fields select:disabled { background: var(--ivory-deep); color: var(--ink-muted); cursor: not-allowed; }

.slip-card { margin-top: 12px; }
.slip-form { margin-top: 10px; }
.slip-submit { margin-top: 10px; }
.slip-preview {
  width: 100%;
  max-height: 300px;
  object-fit: contain;      /* สลิปเป็นภาพแนวตั้ง crop ไม่ได้ เลขที่ต้องอ่านอยู่กลางภาพ */
  background: var(--ivory);
  border: 1px solid var(--silver-light);
  border-radius: 10px;
  display: block;
}
/* รูปตัวอย่างของไฟล์ที่เพิ่งเลือก (ยังไม่ได้อัปโหลด) — JS สร้างให้ตอน change
   ต่างจาก .slip-preview ที่เป็นสลิปซึ่งอัปโหลดขึ้นเซิร์ฟเวอร์ไปแล้ว */
.slip-chosen {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  background: var(--ivory);
  border: 1.5px solid var(--success);
  border-radius: 10px;
  display: block;
  margin-top: 10px;
}
.slip-note { margin: 8px 0 0; font-size: 12px; color: var(--ink-muted); line-height: 1.6; }
.slip-note.is-warn { color: var(--danger); font-weight: 600; }
.slip-error {
  margin: 10px 0 0;
  padding: 9px 12px;
  border-radius: 8px;
  background: #fdf0ee;
  color: var(--danger);
  font-size: 13px;
}

/* ------------------------------------------------ นโยบายความเป็นส่วนตัว
   ★ ความกว้างจำกัดที่ 68ch ไม่ใช่เต็มจอ — บรรทัดยาวเกิน ~75 ตัวอักษร
     ตาจะหาต้นบรรทัดถัดไปไม่เจอ และเอกสารแบบนี้คือของที่คนตั้งใจอ่านจริงๆ
     เมื่อเขาเปิดมา ไม่ใช่ของที่กวาดตาผ่าน
   ★ line-height 1.85 สูงกว่าปกติ เพราะภาษาไทยมีสระบนล่างที่ชนกันเองได้
     เมื่อบรรทัดชิด (เหตุผลเดียวกับที่วัดไว้ตอนทำหน้าแรก) */
.policy { max-width: 68ch; padding-bottom: 40px; }
.policy-title { font-size: clamp(26px, 5vw, 34px); margin: 8px 0 6px; letter-spacing: -0.01em; }
.policy-intro { color: var(--ink-muted); font-size: 15px; line-height: 1.8; margin: 0 0 26px; }
.policy-sec { margin-bottom: 26px; }
.policy-sec h2 {
  font-size: 17px;
  margin: 0 0 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--silver-light);
}
.policy-sec p { font-size: 14.5px; line-height: 1.85; margin: 0 0 10px; }
.policy-sec ul { margin: 0 0 10px; padding-left: 20px; }
.policy-sec li { font-size: 14.5px; line-height: 1.8; margin-bottom: 7px; }
.policy-sec strong { color: var(--ink); font-weight: 700; }

.policy-dl { margin: 0; font-size: 14.5px; }
.policy-dl dt { font-weight: 700; margin-top: 10px; }
.policy-dl dd { margin: 2px 0 0; line-height: 1.75; }

/* ยังไม่ได้กรอกข้อมูลติดต่อ = นโยบายยังไม่สมบูรณ์ตามกฎหมาย ต้องเห็นชัด */
.policy-warn {
  padding: 11px 14px;
  border-radius: 9px;
  background: #fdf0ee;
  color: var(--danger);
  font-weight: 600;
}
.policy-updated { margin-top: 28px; font-size: 12.5px; color: var(--ink-muted); }


/* ---------------- หินบำบัด 7 จักระ (2026-07-31) ----------------
 *
 * ★ สีของแต่ละบล็อกมาจากตัวแปร --dot ที่ PHP ใส่ให้ทาง style="" ซึ่งมาจาก
 *   chakra_colour_hex(number) — ไม่มีคลาส .is-chakra-1..7 ในไฟล์นี้โดยเจตนา
 *   เพราะสีจะอยู่สองที่แล้วขัดกันเองวันที่แก้ที่เดียว (ดู function/chakras.php)
 * ★ ตัวเลือกทั้งหมดขึ้นต้นด้วย .chakra- ไม่มี selector แบบ element เปล่า —
 *   เคยเจอ `nav { flex-direction: column }` ของแถบข้างไปโดนคอมโพเนนต์ใหม่มาแล้ว
 * ★ mobile-first ตามไฟล์นี้ทั้งไฟล์: ค่าฐานคือโทรศัพท์ แล้วขยายด้วย min-width
 */

.chakra-intro {
  margin: 12px 0 0;
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--ink-muted);
  max-width: 72ch;
}

/* แถบสีย่อ 7 จุด — ปัดแนวนอนบนโทรศัพท์
 * ★ overflow-x: auto ตัวเดียวได้ (ไม่ใช่ hidden) เพราะที่นี่ "ต้องการ" ให้เลื่อนจริง
 *   กับดักที่เคยเจอคือ overflow-x: hidden เดี่ยวๆ ซึ่งบังคับแกน y เป็น auto
 *   แล้วได้แถบเลื่อนลอยขึ้นมาโดยไม่มีใครสั่ง */
.chakra-rail {
  display: flex;
  gap: 8px;
  margin: 16px 0 4px;
  padding-bottom: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chakra-rail::-webkit-scrollbar { display: none; }
.chakra-rail-dot {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 74px;
  padding: 8px 4px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--silver-light);
  text-decoration: none;
  color: var(--ink);
}
.chakra-rail-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--dot, var(--silver));
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}
.chakra-rail-name {
  font-size: 10.5px;
  line-height: 1.3;
  text-align: center;
  color: var(--ink-muted);
}

.chakra-list { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }

/* เส้นสีทางซ้ายคือสิ่งที่ทำให้ไล่หน้ายาวๆ ได้ด้วยตา ไม่ต้องอ่านหัวข้อทุกอัน */
.chakra-block {
  background: var(--card);
  border: 1px solid rgba(231, 231, 231, 0.9);
  border-left: 4px solid var(--dot, var(--silver));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 14px 16px;
  /* กระโดดจากแถบย่อแล้วหัวข้อต้องไม่ไปติดใต้แถบบนสุดของเว็บ */
  scroll-margin-top: 16px;
}
.chakra-head { display: flex; gap: 11px; align-items: flex-start; }
.chakra-num {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--dot, var(--silver));
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}
.chakra-title { flex: 1; min-width: 0; }
.chakra-title h3 { margin: 0; font-size: 16px; line-height: 1.35; }
.chakra-title h3 small {
  display: block;
  font-family: "Anuphan", "Noto Sans SC", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  font-style: italic;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
}
.chakra-meta { margin: 4px 0 0; font-size: 12.5px; line-height: 1.7; color: var(--ink-muted); }
.chakra-meaning { margin: 10px 0 0; font-size: 13.5px; line-height: 1.85; max-width: 72ch; }

.chakra-stones-head {
  margin: 14px 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}
.chakra-count {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--dot, var(--ink-muted));
}
.chakra-empty { margin: 0; font-size: 13px; color: var(--ink-muted); }

.chakra-stones {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px;
}
.chakra-stones a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  color: var(--ink);
}
.chakra-bead {
  width: 54px; height: 54px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(145deg, #f4efe4, #e8e2d4);
  /* วงแหวนสีจักระรอบเม็ด ทำให้เห็นว่าเม็ดนี้กำลังพูดถึงจุดไหนเวลาเม็ดซ้ำกันหลายจุด */
  box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px var(--dot, var(--silver-light));
}
.chakra-bead img { width: 100%; height: 100%; object-fit: cover; }
.chakra-bead-name { font-size: 12px; font-weight: 600; text-align: center; line-height: 1.35; }
.chakra-bead-name small {
  display: block;
  font-family: "Anuphan", "Noto Sans SC", system-ui, sans-serif;
  font-size: 10.5px;
  font-weight: 500;
  font-style: italic;
  color: var(--ink-muted);
}

.chakra-cta { display: inline-block; margin-top: 12px; text-decoration: none; }

/* ★ ข้อความกำกับว่าเป็นความเชื่อ ไม่ใช่การรักษา — ต้องอ่านออกจริง ไม่ใช่ตัวจิ๋วสีจาง
     ที่ออกแบบมาให้ข้าม (นั่นคือความหมายตรงข้ามกับการมีข้อความนี้) */
.chakra-note {
  margin: 20px 0 0;
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--ink);
  background: var(--ivory-deep);
  border: 1px solid var(--silver-light);
  border-radius: 10px;
}

/* กำไลสำเร็จรูปที่ผูกกับจุดนั้น — การ์ดแนวตั้งเล็ก ไม่ใช่ .product-card ของหน้าสินค้า
 * ★ ไม่ใช้ product_card.php ที่นี่ เพราะการ์ดนั้นมีปุ่มใส่ตะกร้าและป้ายสต็อกอยู่ในตัว
 *   ซึ่งจะทำให้บล็อกจักระกลายเป็นหน้าสินค้าย่อยๆ 7 หน้าซ้อนกัน · ที่นี่ต้องการแค่
 *   "ของที่เข้ากับจุดนี้" แล้วให้กดเข้าไปดูรายละเอียดที่หน้าสินค้าจริง
 */
.chakra-products {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 12px;
}
.chakra-products a {
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-decoration: none;
  color: var(--ink);
}
.chakra-prod-img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(145deg, #f4efe4, #e8e2d4);
  /* ★ ต้องมีความสูงสำรองที่ไม่พึ่ง aspect-ratio อย่างเดียว — Safari รองรับตั้งแต่ 15
       เท่านั้น เบราว์เซอร์ที่เก่ากว่าจะได้กรอบสูง 0 แล้วชื่อสินค้าเลื่อนขึ้นมาชนกัน
       (อาการเดียวกับ .ring-stage ที่เจอบน iPhone) */
  min-height: 96px;
}
.chakra-prod-img img { width: 100%; height: 100%; object-fit: cover; }
.chakra-prod-name { font-size: 12.5px; font-weight: 600; line-height: 1.4; }
.chakra-prod-price { font-size: 12.5px; font-weight: 700; color: var(--gold-dark); }

@media (min-width: 700px) {
  .chakra-block { padding: 18px 20px 20px; }
  .chakra-num { width: 40px; height: 40px; font-size: 16px; }
  .chakra-title h3 { font-size: 18px; }
  .chakra-rail-dot { width: 88px; }
  .chakra-rail-name { font-size: 11.5px; }
  .chakra-bead { width: 62px; height: 62px; }
  .chakra-stones { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}
@media (min-width: 1000px) {
  /* จอกว้างพอให้ทั้ง 7 จุดอยู่ในแถวเดียว — ไม่ต้องปัด และไม่ทิ้งที่ว่างข้างขวา */
  .chakra-rail { justify-content: space-between; overflow-x: visible; }
  .chakra-rail-dot { flex: 1 1 0; }
}

/* ---------------- คำเตือนภาพจำลอง + วิธีวัดข้อมือ (2026-08-04) ----------------
 *
 * เทียบกับร้านคู่แข่งที่เจ้าของร้านส่งมาให้ดู เขามีสองอย่างนี้ เราไม่มีเลย:
 *   1) หมายเหตุติดวงว่าภาพเป็นการจำลอง สีจริงอาจต่าง
 *   2) วิธีวัดข้อมือ (เขาทำเป็นขั้นที่ 1 ของ 4 เลย)
 * ★ ข้อ 1 เราเสี่ยงกว่าเขา เพราะเม็ดหินของเราเป็นภาพ AI/ภาพที่ GD วาด
 *   ไม่ใช่รูปถ่ายสต็อกจริง — ภาพเป็นของเราเอง เถียงไม่ได้ถ้าลูกค้าทักว่าสีไม่ตรง
 */

.ring-sim-note {
  margin: 6px auto 0;
  max-width: 42ch;
  text-align: center;
  font-size: 11px;
  line-height: 1.65;
  color: var(--ink-muted);
}

.measure-box {
  margin: 10px 0 0;
  border: 1px dashed var(--silver-light);
  border-radius: 10px;
  background: var(--ivory-deep);
}
/* ★ แตะได้ทั้งแถบ ไม่ใช่แค่ตัวหนังสือ (สูง 11+11+ตัวอักษร ≈ 42px อยู่ในเกณฑ์นิ้ว) */
.measure-box > summary {
  cursor: pointer;
  padding: 11px 13px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gold-dark);
  list-style: none;
}
.measure-box > summary::-webkit-details-marker { display: none; }
.measure-box > summary::after { content: ' ▾'; }
.measure-box[open] > summary::after { content: ' ▴'; }
.measure-box > *:not(summary) { padding: 0 13px; }
.measure-box > *:last-child { padding-bottom: 12px; }

/* ภาพเป็น SVG เขียนในหน้า ไม่ใช่รูปอัปโหลด — โปรเจกต์ไม่มี build step และไฟล์สำรอง
   ไม่เก็บ uploads/ รูปที่อัปโหลดจึงหายตอนกู้เครื่อง ส่วน SVG อยู่ใน git
   ★ เส้นมือสืบสีจาก color ของกล่อง · สายวัดเป็นสีทองเพื่อให้ตาแยกออกทันทีว่า
     อะไรคือสิ่งที่ต้องทำ ไม่ใช่ต้องอ่านคำอธิบายก่อนจึงเข้าใจภาพ */
/* ★ รูปที่เจ้าของร้านส่งมาแทน SVG ที่วาดไว้ (2026-08-04)
     กว้างเต็มกล่อง ไม่จำกัด 240px เหมือน SVG เดิม เพราะเป็นรูปถ่ายที่มีรายละเอียด
     (เลขบนสายวัด) ที่ต้องอ่านออก — บีบเหลือ 240px แล้วเลขจะเล็กจนไม่มีประโยชน์
   ★ aspect-ratio กันหน้ากระตุกตอนรูปโหลดเสร็จ · ใส่ทั้ง width/height ใน HTML
     และ aspect-ratio ที่นี่ เพราะเบราว์เซอร์เก่าคำนวณจาก attribute ไม่ได้ */
.measure-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 960 / 441;
  margin: 2px 0 10px;
  border-radius: 10px;
}
.measure-cap { margin: 0 0 8px; font-size: 12px; line-height: 1.7; }
.measure-steps { margin: 0; padding-left: 20px; font-size: 12px; line-height: 1.8; }
.measure-steps li { margin: 0 0 2px; }
.measure-alt { margin: 8px 0 0; font-size: 11.5px; line-height: 1.7; color: var(--ink-muted); }

/* ---------------- หินประจำตัวจากวันเกิด (2026-08-04) ----------------
 * ใช้การ์ดเม็ดหิน (.chakra-stones / .chakra-bead) และกล่องกำกับ (.chakra-note)
 * ร่วมกับหน้าจักระโดยตั้งใจ — เป็นของหน้าตาเดียวกัน ถ้าทำคลาสใหม่จะมีสองชุดที่
 * ต้องแก้พร้อมกันทุกครั้ง (บทเรียนเดิมของโปรเจกต์นี้)
 */

.bs-form {
  margin: 14px 0 0;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid rgba(231, 231, 231, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.bs-fields { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
/* ★ ช่องกว้างตามเนื้อหาที่ต้องใส่ ไม่ยืดเต็มแถว — วัดก่อนแก้: ช่อง "วันเกิด" ที่ใส่เลข
     สองหลักถูกยืดเป็น 547px บนจอ 1440px ซึ่งอ่านเหมือนช่องกรอกที่อยู่ ไม่ใช่ช่องเลือกวัน
   ★ flex-basis ต่างกันสองช่อง เพราะชื่อเดือน ("กุมภาพันธ์" / "September") ยาวกว่าเลขวันมาก
     บนจอแคบ flex-wrap พาลงบรรทัดใหม่ให้เอง */
.bs-fields > div { min-width: 0; }
.bs-fields > div:nth-of-type(1) { flex: 1 1 96px;  max-width: 130px; }
.bs-fields > div:nth-of-type(2) { flex: 1 1 150px; max-width: 220px; }
.bs-fields select {
  width: 100%;
  padding: 10px 11px;
  font-size: 14px;
  border: 1px solid var(--silver-light);
  border-radius: 9px;
  background: var(--card);
  color: var(--ink);
}
/* ปุ่มไม่ยืดเท่าช่องเลือก — มันคือการกระทำ ไม่ใช่ช่องกรอกอีกช่อง
   แต่บนจอแคบให้เต็มแถวเพื่อให้นิ้วกดง่าย */
.bs-fields .btn { flex: 0 0 auto; width: auto; padding: 11px 22px; }
@media (max-width: 479px) { .bs-fields .btn { flex: 1 0 100%; width: 100%; } }

/* ★ คำสัญญาว่าไม่เก็บวันเกิดอยู่ติดฟอร์ม ไม่ใช่ในหน้านโยบาย — คนกรอกวันเกิดให้
     ร้านออนไลน์มีสิทธิ์ลังเล และคำตอบต้องอยู่ตรงจุดที่เขาลังเล */
.bs-privacy {
  margin: 10px 0 0;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--ink-muted);
}

.bs-result { margin: 18px 0 0; }
.bs-sign { margin: 0 0 4px; font-size: 20px; font-weight: 700; line-height: 1.35; }
.bs-sign small {
  display: block;
  font-family: 'Anuphan', 'Noto Sans SC', system-ui, sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  font-style: italic;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
}
/* วันคาบเกี่ยวเป็นข้อมูลที่ต้องอ่าน ไม่ใช่หมายเหตุตัวจิ๋ว — คนที่รู้ว่าตัวเองเกิดวันคาบเกี่ยว
   จะจับได้ทันทีถ้าเราตอบราศีเดียวแบบมั่นใจ */
.bs-cusp {
  margin: 8px 0 0;
  padding: 9px 12px;
  font-size: 12.5px;
  line-height: 1.7;
  background: var(--ivory-deep);
  border: 1px solid var(--silver-light);
  border-radius: 9px;
}
.bs-cusp a { color: var(--gold-dark); white-space: nowrap; }
.bs-element-note { margin: 0 0 10px; font-size: 12px; line-height: 1.7; color: var(--ink-muted); }
.bs-cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 0; }
.bs-cta .btn { text-decoration: none; }

/* แถวชิปกรองสีในหน้าออกแบบ — ต่อจากแถบแท็บ หินมงคล / อะไหล่
   ★ ใช้ .chip-dot ร่วมกับตัวกรองจักระในหน้าสินค้า สีมาจาก --dot ที่ PHP ใส่
     (ที่นี่มาจาก STONE_COLOUR_GROUPS ใน function/stone_colour.php) */
.colour-row { margin-top: -2px; }
.colour-row .chip { font-size: 11.5px; padding: 5px 11px; }

/* ช่องชื่อเจ้าของกำไลในพาเนลสรุป — ไม่บังคับ จึงไม่เด่นเท่าปุ่มสั่งทำที่อยู่ใต้มัน */
.owner-field { display: block; margin: 0 0 12px; }
.owner-field .pd-label { display: flex; align-items: baseline; gap: 6px; }
.owner-opt {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: none;
  color: var(--ink-muted);
}
.owner-field input {
  width: 100%;
  padding: 9px 11px;
  font-size: 13.5px;
  border: 1px solid var(--silver-light);
  border-radius: 9px;
  background: var(--card);
  color: var(--ink);
}
.owner-hint { display: block; margin-top: 5px; font-size: 11px; line-height: 1.65; color: var(--ink-muted); }

/* ═══════════ หน้าออกแบบแบบ 4 ขั้น (2026-08-04) ═══════════
 *
 * เจ้าของร้านส่งหน้าจอร้านคู่แข่งมาให้ทำตามโครง: วัดข้อมือ → เลือกขนาดหิน →
 * ออกแบบ → ยืนยัน พร้อมแถบความคืบหน้า 4 ท่อน
 *
 * ★ ลอกโครงและลำดับ ไม่ใช่ของของเขา — ธีมยังเป็นทอง/ครีมของร้าน (ตัดสินใจแล้ว
 *   ห้ามเปลี่ยนเป็นน้ำเงินตามเขา) ไม่มีโลโก้/รูปถ่ายของเขาในนี้เลย
 * ★★ การซ่อนขั้นผูกกับ .wiz-on ที่ JS ใส่ให้ ไม่ใช่เขียนไว้ตรงๆ — ไม่มี JS
 *    ต้องเห็นทุกขั้นเรียงลงมา ไม่ใช่เห็นขั้นแรกแล้วไปต่อไม่ได้
 */

.designer.wiz-on > .panel[data-step]:not(.is-current) { display: none; }

/* ขั้นเดียวบนจอกว้างต้องไม่ยืดเต็ม 1320px — ฟอร์มที่กว้างเกินอ่านยากกว่าฟอร์มที่แคบ
   ขั้น 3 เป็นข้อยกเว้น เพราะมีสามพาเนล (เลือกหิน | วง | ควบคุม) ที่ต้องอยู่ข้างกัน */
@media (min-width: 1000px) {
  .designer.wiz-on:not([data-current="3"]) { grid-template-columns: minmax(0, 1fr); max-width: 760px; margin-inline: auto; }
  .designer.wiz-on[data-current="3"] { grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr); }
  /* พาเนลควบคุมไปอยู่คอลัมน์ที่ 2 แถวที่ 2 ตามเดิม · สรุปไม่อยู่ในขั้นนี้แล้ว */
  .designer.wiz-on[data-current="3"] .panel-summary { position: static; }
}

/* ---------- แถบขั้นตอน ---------- */
.wiz-bar { margin: 14px 0 0; }
.wiz-head {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--ink-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
}
.wiz-kicker { letter-spacing: 0.12em; text-transform: uppercase; font-weight: 700; font-size: 10.5px; }
.wiz-head strong { color: var(--gold-dark); font-size: 12.5px; }
.wiz-sep { opacity: 0.5; }

.wiz-track {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
}
/* ★ ปุ่มจริง กดข้ามไปขั้นที่ผ่านมาแล้วได้ · เส้นหนา 3px ด้านบนคือ "ความคืบหน้า"
     ส่วนตัวหนังสือใต้มันคือชื่อขั้น — ที่แคบมากตัวหนังสือหายแต่เส้นยังอยู่ */
.wiz-seg {
  width: 100%;
  padding: 7px 4px 0;
  border: none;
  background: none;
  cursor: pointer;
  text-align: center;
  border-top: 3px solid var(--silver-light);
  color: var(--ink-muted);
  font: inherit;
}
.wiz-seg.is-done    { border-top-color: var(--gold-light); color: var(--ink); }
.wiz-seg.is-current { border-top-color: var(--gold-dark); color: var(--ink); font-weight: 700; }
.wiz-seg-n {
  display: inline-block;
  min-width: 16px;
  font-size: 11px;
  font-weight: 700;
}
.wiz-seg-label { display: block; font-size: 11px; line-height: 1.4; }
@media (max-width: 379px) { .wiz-seg-label { display: none; } }

/* ---------- ปุ่มเดินขั้น ---------- */
.wiz-nav { display: flex; gap: 10px; margin: 16px 0 0; }
/* ★★ [hidden] แพ้กฎคลาสที่ตั้ง display — กับดักที่โปรเจกต์นี้เจอมาแล้วสองครั้ง
     ([hidden] แพ้ .t-btn ในหน้าไพ่ · แพ้คลาสช่องผู้รับใน POS)
     ต้องเขียนเจาะจงกว่าเดิม ไม่งั้นปุ่มเดินขั้นจะโผล่ตอนปิด JS ทั้งที่มี hidden อยู่
     (วัดจริงตอนทดสอบด้วย javaScriptEnabled: false — โผล่จริง) */
.wiz-nav[hidden] { display: none; }
.wiz-nav .btn { flex: 1 1 0; width: auto; }
/* ปุ่มถัดไปเด่นกว่าปุ่มย้อนกลับ — สองปุ่มที่เด่นเท่ากันคือสองปุ่มที่ต้องหยุดอ่าน */
@media (min-width: 700px) {
  .wiz-nav { justify-content: flex-end; }
  .wiz-nav .btn { flex: 0 0 auto; min-width: 150px; }
}

/* ---------- ขั้น 1: วัดข้อมือ ---------- */
.measure-figure {
  margin: 12px 0 0;
  padding: 10px;
  border: 1px solid var(--silver-light);
  border-radius: 12px;
  background: var(--ivory-deep);
}
.measure-figure .measure-cap { margin: 8px 0 0; text-align: center; font-style: italic; }

/* ค่าที่เลือกอยู่ตัวใหญ่ — ขั้นนี้มีคำตอบเดียว ต้องอ่านออกจากระยะไกล
 *
 * ★★ ก่อน 2026-08-05 บล็อกนี้จัดสไตล์ให้ `.wrist-readout strong` แต่ markup ถูกเปลี่ยน
 *    เป็น `<input id="wristValue">` ไปตั้งแต่ 2026-08-04 (ให้พิมพ์ทับได้) **จึงไม่มีกฎไหน
 *    จับมันเลย** ผลคือเลขตัวใหญ่กลายเป็น "ช่องกรอกเริ่มต้นของเบราว์เซอร์" กล่องเล็กๆ
 *    ชิดซ้ายกลางแผ่นที่ว่างเปล่า — เจ้าของร้านวงแดงตรงนี้มาให้ดู
 *    ★ บทเรียน: เปลี่ยนชนิดของ element ต้องตามไปแก้ selector ด้วย เพราะ CSS ที่
 *      เล็งชนิดเดิมไม่ error ไม่เตือน มันแค่ "ไม่ทำงาน" ซึ่งมองไม่เห็นจนกว่าจะเปิดหน้าจริง
 */
.wrist-readout {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0 8px;
  margin: 14px 0 0;
  padding: 16px 14px 18px;
  border: 1px solid var(--gold-light);
  border-radius: 14px;
  text-align: center;
  /* ไล่สีอ่อนๆ จากครีมขึ้นขาวอมครีม ให้แผ่นนี้ "ยกขึ้นมา" กว่าการ์ดรอบข้าง
     เพราะมันคือคำตอบของขั้นนี้ ไม่ใช่ข้อมูลประกอบ */
  background: linear-gradient(180deg, #fffdf6, #fdf7e8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* ★ เส้นใต้สีทองคือสิ่งเดียวที่บอกว่า "พิมพ์ทับได้" — เลขทองตัวใหญ่ที่ไม่มีอะไรบอก
     จะถูกอ่านเป็นป้ายแสดงผล แล้วไม่มีใครลองแตะ (ซึ่งคือเหตุผลที่ย้ายมาตรงนี้ตั้งแต่ต้น) */
#wristValue {
  /* ★ 3.8ch พอดีกับค่าที่ยาวสุดที่พิมพ์ได้ ("19.5" — step 0.1 ทศนิยมตำแหน่งเดียว)
       กว้างกว่านี้แล้วเส้นใต้จะยาวเกินเลข และกลุ่ม "17 ซม." ที่จัดกลางจะดันให้ตัวเลข
       ดูเยื้องซ้าย เพราะหน่วยไปถ่วงน้ำหนักการจัดกลางอยู่ทางขวา
     ★ ตั้งเป็นค่าคงที่ ไม่ยืดตามจำนวนหลัก — ไม่งั้นเส้นใต้จะกระตุกทุกครั้งที่พิมพ์ */
  width: 3.8ch;
  max-width: 100%;
  padding: 0 2px 4px;
  border: 0;
  border-bottom: 2px solid var(--gold);
  border-radius: 0;
  background: transparent;
  color: var(--gold-dark);
  font-family: inherit;
  font-size: clamp(36px, 11vw, 44px);
  font-weight: 700;
  line-height: 1.05;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
/* ★ ซ่อนลูกศรของ input[type=number] — ที่ขนาด 40px+ ปุ่มลูกศรเบียดตัวเลขจนจัดกลาง
     ไม่ได้จริง และลูกค้าร้านนี้ใช้เบราว์เซอร์ในแอป LINE เป็นหลักซึ่ง**ไม่แสดงลูกศรอยู่แล้ว**
     ตัวปรับหยาบๆ คือปุ่มขนาดที่อยู่ใต้ช่องนี้ ส่วนช่องนี้มีไว้พิมพ์ค่าที่ตรงเป๊ะ
     (แก้คอมเมนต์ใน custom/index.php ที่เคยเขียนว่า "ได้ปุ่มลูกศรบนเดสก์ท็อปฟรี" แล้ว) */
#wristValue::-webkit-outer-spin-button,
#wristValue::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#wristValue { -moz-appearance: textfield; appearance: textfield; }
/* ★ ใช้ outline ไม่ใช่ border ตอนโฟกัส — border ล่างเป็นของกฎข้างบนอยู่แล้ว
     เขียนทับตอนโฟกัสจะทำให้เลขกระโดดขึ้นลง 2px (บทเรียนเดียวกับกรอบโฟกัสของช่องแนบสลิป) */
#wristValue:focus-visible {
  outline: 2px solid var(--gold-dark);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrist-readout .wrist-unit {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

/* ★ กริด ไม่ใช่แถวปัดแนวนอน — ทุกขนาดสำคัญเท่ากัน ขนาดที่อยู่ท้ายแถวปัด
     จะถูกมองข้าม (ของเดิมต้องปัดเพราะอยู่ในพาเนลควบคุมที่แคบ ที่นี่เต็มความกว้าง) */

/* ★ กริด ไม่ใช่แถวปัดแนวนอน — ทุกขนาดสำคัญเท่ากัน ขนาดที่อยู่ท้ายแถวปัด
     จะถูกมองข้าม (ของเดิมต้องปัดเพราะอยู่ในพาเนลควบคุมที่แคบ ที่นี่เต็มความกว้าง) */
.wrist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  gap: 8px;
  margin: 12px 0 0;
}
.wrist-chip {
  padding: 11px 6px 12px;
  border: 1px solid var(--silver-light);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  line-height: 1.2;
  transition: border-color .12s, background-color .12s, transform .08s;
}
.wrist-chip-cm {
  display: block;
  font-size: 21px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.wrist-chip-n { display: block; font-size: 10.5px; color: var(--ink-muted); margin-top: 3px; }

/*
 * ★★ สถานะ "เลือกอยู่" ใช้กรอบทอง + พื้นครีม เหมือน `.bead-card.is-on` ของขั้นที่ 2
 *    ไม่ใช่กล่องดำทึบเหมือนเดิม — สองขั้นนี้อยู่ในวิซาร์ดเดียวกันและทำเรื่องเดียวกัน
 *    (เลือก 1 อย่างจากหลายอย่าง) การใช้ภาพคนละแบบทำให้ลูกค้าต้องเรียนรู้สองครั้ง
 *    และกล่องดำทึบยังดึงสายตาแรงกว่าปุ่ม "ถัดไป" ที่เป็นปุ่มที่ควรถูกกดต่อ
 * ★ ใช้ box-shadow ทำเส้นหนาชั้นที่สอง ไม่เพิ่ม border-width — เพิ่ม border จะทำให้
 *   กล่องโตขึ้น 1px แล้วปุ่มที่เลือกจะขยับเบียดเพื่อนในกริด
 */
.wrist-chip.is-active {
  border-color: var(--gold-dark);
  box-shadow: inset 0 0 0 1px var(--gold-dark);
  background: #fffaf0;
}
.wrist-chip.is-active .wrist-chip-cm { color: var(--gold-dark); }

/* ★ hover เฉพาะเมาส์จริง — บนมือถือ :hover ค้างหลังแตะ ทำให้ปุ่มที่เพิ่งกดดูเหมือน
     ยังถูกเลือกอยู่ทั้งที่เลือกไปอันอื่นแล้ว */
@media (hover: hover) and (pointer: fine) {
  .wrist-chip:hover { border-color: var(--gold); background: #fffdf6; }
}
/* ยุบเล็กน้อยตอนกด — เป็นการตอบสนองอย่างเดียวที่นิ้วรู้สึกได้บนจอสัมผัส */
.wrist-chip:active { transform: scale(0.97); }

/*
 * ★★ ไม่ต้องเขียนกฎ :focus-visible ที่นี่ — มีกฎทั่วเว็บอยู่แล้วที่หัวไฟล์
 *    (`:focus-visible { outline: 2px solid var(--gold-dark) }`) เขียนซ้ำคือสร้างจุดที่
 *    วันหนึ่งจะแก้ที่เดียวแล้วอีกที่ไม่เปลี่ยน
 *
 * ★★ ผลข้างเคียงที่ต้องรู้: วงโฟกัสทั่วเว็บก็เป็นสีทอง เมื่อสถานะ "เลือกอยู่" เปลี่ยนจาก
 *    กล่องดำมาเป็นทอง สองสถานะนี้จึงใช้สีเดียวกัน (ตอนทดสอบกด Tab จากช่องกรอกแล้ว
 *    เห็นปุ่ม 14 กับ 16 มีวงทองพร้อมกัน) — แยกกันได้ด้วย 3 อย่าง และต้องรักษาไว้ทั้งสาม:
 *      1. วงโฟกัสเป็น outline ที่ **ลอยห่างออกไป 2px** ไม่ใช่เส้นขอบติดกล่อง
 *      2. ปุ่มที่เลือกมีพื้นครีม `#fffaf0` ปุ่มที่แค่โฟกัสยังเป็นพื้นการ์ดปกติ
 *      3. ตัวเลขของปุ่มที่เลือกเป็นสีทองเข้ม ของปุ่มอื่นเป็นสีหมึก
 *    ขั้นที่ 2 (`.bead-card.is-on`) อยู่ในสถานะเดียวกันนี้มาก่อนแล้ว จึงไม่ใช่ของใหม่
 */

/* ---------- ขั้น 2: ขนาดเม็ดหิน ---------- */
.bead-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 8px;
  margin: 12px 0 0;
}
.bead-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  /* ★ ความสูงเท่ากันทุกใบ ไม่ยุบตามขนาดวงกลม — ไม่งั้นการ์ด 4 มม. จะเตี้ยกว่า
       การ์ด 10 มม. แล้วแถวดูเหมือนพัง · วงกลมชิดล่างด้วย justify-content */
  min-height: 130px;
  padding: 10px 6px 12px;
  border: 1px solid var(--silver-light);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}
/* เม็ดหินวาดตามสัดส่วนจริงของเส้นผ่านศูนย์กลาง (PHP คำนวณ px ให้ทาง style="")
   ★ ไล่สีทองเป็น **ตัวสำรอง** ไม่ใช่ของหลักแล้ว — ใช้เมื่อหาหินที่มีรูปเม็ด (`bead-*`)
     ไม่ได้เลย (DB เปล่า / รูปถูกลบ) การ์ดจะยังเห็นเป็นวงกลมตามสัดส่วน ไม่ใช่กล่องว่าง */
.bead-card-dot {
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #f6e9c8, var(--gold) 62%, #9d7c33);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  margin-bottom: auto;
}
/*
 * ★★ ใส่รูปเม็ดหินจริง (2026-08-05 เจ้าของร้านสั่ง) — หินชนิดเดียวกันทั้ง 4 ใบ
 *    เพราะการ์ดพวกนี้เทียบ **ขนาด** ไม่ใช่เสนอหิน (เหตุผลเต็มใน custom/index.php)
 * ★ `background-size: cover` ขาดไม่ได้ — รูปต้นฉบับ 480×480 ถ้าไม่ตั้ง จะเห็นแค่
 *   มุมซ้ายบนของรูปในกรอบ 47px ซึ่งไม่ใช่เม็ดหิน (ค่าเริ่มต้นของ background-size คือ auto)
 * ★ ต้องล้าง box-shadow ของกฎข้างบน — รูปมีขอบเข้มและเงาในตัวอยู่แล้ว วงในซ้อนอีกชั้น
 *   จะเห็นเป็นเส้นวงแหวนบนผิวเม็ด
 * ★ พื้นหลังโปร่งใส ไม่ใช่ทอง — ระหว่างรูปยังโหลดไม่เสร็จ วงทองจะแวบขึ้นมาแล้วหายไป
 *   (เห็นเป็นการกระพริบ) ซึ่งแย่กว่ารอเงียบๆ บนเน็ตมือถือช้า
 */
.bead-card-dot.is-photo {
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  box-shadow: none;
}
.bead-card-mm { font-size: 20px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.bead-card-unit { font-size: 10.5px; color: var(--ink-muted); }
/* จำนวนหินที่มีในขนาดนั้น — เลขเปล่าๆ อ่านไม่ออกว่าเป็นอะไร จึงมีคำนำหน้าใน ::before */
.bead-card-n { font-size: 10.5px; color: var(--ink-muted); }
.bead-card.is-on {
  border-color: var(--gold-dark);
  box-shadow: inset 0 0 0 1px var(--gold-dark);
  background: #fffaf0;
}
.bead-scale-note { margin: 8px 0 0; font-size: 11px; color: var(--ink-muted); text-align: center; }

.bead-mix-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 0;
  padding: 10px 13px;
  border: 1px solid var(--silver-light);
  border-radius: 12px;
  background: var(--ivory-deep);
  font-size: 12.5px;
  font-weight: 600;
}
.bead-mix-dots { display: flex; align-items: center; gap: 3px; flex: none; }
/* ★ ไล่สีทองเป็นตัวสำรองเหมือน `.bead-card-dot` — ถ้ามีรูปเม็ดจริง PHP จะใส่
     `--mix-bead` ให้ทาง style="" แล้วกฎข้างล่างทับ · ไม่ให้เหลือวงกลมทองปนอยู่
     ในหน้าเดียวกับเม็ดจริง เพราะจะอ่านเหมือนเป็นของสองชนิดที่ไม่เกี่ยวกัน */
.bead-mix-dots i {
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #f6e9c8, var(--gold) 62%, #9d7c33);
}
.bead-mix-dots.is-photo i {
  background: var(--mix-bead) center / cover no-repeat;
}
.bead-mix-dots i:nth-child(1) { width: 9px;  height: 9px; }
.bead-mix-dots i:nth-child(2) { width: 13px; height: 13px; }
.bead-mix-dots i:nth-child(3) { width: 17px; height: 17px; }

/* ---------- ขั้น 3: เลขในช่องว่างของวง ---------- */
/* ★ เลขอยู่ในช่องว่าง ไม่ใช่ข้างนอกเหมือนเม็ดที่วางแล้ว — ช่องว่างไม่มีรูปเม็ดทับ
     จึงมีที่ให้เลขอ่านออก และลูกค้าเห็นว่าเหลืออีกกี่ช่องตั้งแต่ก่อนวางเม็ดแรก */
.slot.is-ghost {
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--silver);
  font-variant-numeric: tabular-nums;
  user-select: none;
}

/* ★ แถบหัวเว็บเป็น sticky — scrollIntoView() พาแถบขั้นไปอยู่ใต้มันพอดีแล้วมองไม่เห็น
     (เจอตอนทดสอบบนเดสก์ท็อป: กดไปขั้น 3 แล้วแถบขั้นหายไปเลย)
     scroll-margin-top เผื่อความสูงแถบหัว + ระยะหายใจ */
.wiz-bar { scroll-margin-top: 88px; }

/* ★ เวทีวงกำไลต้องมีเพดานบนเดสก์ท็อป — ขั้นที่ 3 เหลือสองคอลัมน์ คอลัมน์วงจึงกว้าง
     713px แล้วเวทีขยายเป็นจัตุรัส 682px ทำให้วงกำไลลอยอยู่กลางพื้นครีมโล่งๆ
     (วัดจริง: วงกินแค่ ~45% ของเวที) · 520px ให้วงเต็มพื้นที่พอดีและยังใหญ่กว่า
     ตอนสามคอลัมน์เดิม */
@media (min-width: 1000px) {
  .designer.wiz-on[data-current="3"] .ring-stage { max-width: 520px; margin-inline: auto; }
}

/* ---------- ขั้น 1 เพิ่มเติม: กรอกขนาดเอง ---------- */
.wrist-type { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--silver-light); }
.wrist-type-row { display: flex; align-items: center; gap: 8px; }
.wrist-type-row input {
  flex: 0 1 130px;
  min-width: 0;
  padding: 10px 11px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--silver-light);
  border-radius: 9px;
  background: var(--card);
  color: var(--ink);
}
.wrist-type-unit { font-size: 13px; color: var(--ink-muted); }
/*
 * ★ บอกตรงๆ ว่าสแนปไปขนาดไหน — รับค่าไปเงียบๆ แล้วคิดเงินจากอีกค่าคือสิ่งที่ห้ามทำ
 *
 * ★★ ต้องเป็น `flex-basis: 100%` เพราะ `.wrist-readout` เป็น flex แล้ว — ของเดิมเป็น
 *    span ธรรมดาใน `<p>` ที่ `margin: 7px 0 0` **ไม่มีผลกับ element แบบ inline**
 *    ข้อความจึงต่อท้าย "ซม." อยู่บรรทัดเดียวกัน แทนที่จะเป็นบรรทัดใหม่ใต้เลข
 * ★★ และของเดิมถูกกฎ `.wrist-readout span` (specificity 0,2,0) ทับ `.wrist-snap`
 *    (0,1,0) อยู่ **สีเขียวกับขนาด 12px จึงไม่เคยมีผลเลย** ข้อความเตือนออกมาเป็น
 *    เทาจาง 14px กลืนกับหน่วย · แก้ด้วยการตั้งคลาส `.wrist-unit` ให้หน่วยแทนการ
 *    เล็ง `span` กว้างๆ (โปรเจกต์นี้เจ็บกับอุบัติเหตุ specificity มาหลายรอบแล้ว)
 */
.wrist-snap {
  flex-basis: 100%;
  margin: 9px 0 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--success);
}
.wrist-snap.is-snapped { color: #8a6d1f; }

/* ---------- ขั้น 2 เพิ่มเติม ---------- */
/* ขนาดที่ยังไม่มีสต็อก: เห็นว่ามีอยู่ แต่กดไม่ได้ */
/* ★ ขนาดที่ยังไม่มีสต็อก **เลือกได้** แค่ติดป้ายบอกว่าต้องสั่งเม็ดเพิ่ม (2026-08-04)
     ไม่หรี่ทั้งการ์ดเหมือนของที่กดไม่ได้ — หรี่แล้วคนจะไม่กด ทั้งที่กดได้และร้านรับทำ */
.bead-card.is-restock .bead-card-n { color: #8a6d1f; font-weight: 600; }
/* โหมดผสมเปิดอยู่ = ไม่มีขนาดเดียวที่ถูกเลือกในความหมายของทั้งเส้น */
.bead-card.is-dimmed { opacity: 0.6; }
.bead-card.is-dimmed.is-on { box-shadow: none; border-color: var(--silver-light); background: var(--card); }

.bead-mode { margin: 12px 0 0; }
.bead-mix-card {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--silver-light);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.bead-mix-card.is-on { border-color: var(--gold-dark); box-shadow: inset 0 0 0 1px var(--gold-dark); background: #fffaf0; }
.bead-mix-text strong { display: block; font-size: 13.5px; }
.bead-mix-text small { display: block; font-size: 11.5px; color: var(--ink-muted); margin-top: 1px; }

/* รูปเทียบขนาดบนข้อมือที่เจ้าของร้านส่งมา — รูปถ่ายจริงชุดแรกของหน้านี้ */
.bead-compare { margin: 14px 0 0; }
.bead-compare img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1100 / 643;
  border-radius: 12px;
  border: 1px solid var(--silver-light);
}

/* ---------- ขั้น 3 เพิ่มเติม: แถบสรุป + แถบปากกา ---------- */
.ring-top {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: baseline;
  justify-content: space-between;
  margin: 10px 0 0;
  padding: 9px 12px;
  border: 1px solid var(--silver-light);
  border-radius: 10px;
  background: var(--ivory-deep);
  font-size: 12.5px;
  color: var(--ink-muted);
}
.ring-top strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.ring-top-money { display: flex; align-items: baseline; gap: 10px; }
/* ★ ยอดรวมในขั้นออกแบบ — เจ้าของร้านสั่งให้เห็นตรงนี้ ไม่ใช่ไปเจอตอนขั้นสุดท้าย
     ซึ่งเป็นจุดที่คนกดถอย */
.ring-top-total { font-size: 17px; color: var(--gold-dark) !important; font-weight: 700; }

.pen-bar { display: flex; align-items: center; gap: 10px; margin: 10px 0 0; flex-wrap: wrap; }
.pen-bar[hidden] { display: none; }
.pen-label { font-size: 11.5px; color: var(--ink-muted); }
.pen-chips { display: flex; gap: 6px; }
.pen-chip {
  min-width: 40px;
  padding: 6px 10px;
  border: 1px solid var(--silver-light);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.pen-chip.is-on { background: var(--charcoal); border-color: var(--charcoal); color: #fff; }

/* ---------- ขั้น 4: ยืนยัน (ออกแบบใหม่ 2026-08-04) ---------- */
/* ★★ ยอดรวมเป็นบล็อกใหญ่บนสุด ไม่ใช่แทรกกลาง — ขั้นนี้มีหน้าที่เดียวคือ
     "ตกลงจ่ายเท่านี้ไหม" เลขที่ต้องตัดสินใจต้องเป็นสิ่งแรกที่เห็น */
.sum-total {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin: 12px 0 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--ivory-deep);
  border: 1px solid var(--silver-light);
  border-left: 3px solid var(--gold);
}
.sum-total-label { font-size: 12.5px; color: var(--ink-muted); }
.sum-total strong {
  font-size: 30px;
  font-weight: 700;
  color: var(--gold-dark);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.sum-total-vat { flex: 1 0 100%; font-size: 11px; color: var(--ink-muted); }

.sum-grid { display: grid; gap: 14px; margin: 14px 0 0; }
/* สองคอลัมน์บนจอกว้าง — รายการหินกับข้อมูลกำไลเป็น "สิ่งที่จะได้" ทั้งคู่
   เรียงต่อกันลงมาทำให้ขั้นนี้ยาวเกินจำเป็น */
@media (min-width: 700px) { .sum-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }
.sum-block { padding: 12px 14px; border: 1px solid var(--silver-light); border-radius: 12px; }
.sum-block .pd-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }

/* ปุ่มกลับไปแก้แบบในขั้นนี้ด้วย — คนที่เลื่อนมาถึงปุ่มสั่งทำแล้วเปลี่ยนใจ
   ต้องมีทางกลับตรงที่เขายืนอยู่ ไม่ใช่ต้องเลื่อนขึ้นไปหาแถบขั้น */
.sum-edit { display: inline-block; margin: 12px 0 0; font-size: 12.5px; color: var(--gold-dark); background: none; border: none; cursor: pointer; padding: 0; font-family: inherit; }

/* รูปกำไลในขั้นยืนยัน — วาดฝั่งเบราว์เซอร์จาก layout ชุดเดียวกับที่กำลังจะส่ง
   ★ แบน ไม่เอียง เหตุผลเดียวกับรูปแนบใบสั่งงาน: ขั้นนี้คือการตรวจของก่อนจ่าย
     ต้องไม่มีเม็ดหน้าบังเม็ดหลัง */
.sum-ring { margin: 12px 0 0; }
.sum-ring[hidden] { display: none; }
.sum-ring-stage {
  position: relative;
  width: 100%;
  max-width: 260px;
  margin-inline: auto;
  /* ★ ความสูงไม่พึ่ง aspect-ratio อย่างเดียว — Safari รองรับตั้งแต่ 15 และข้างในเป็น
       absolute ทั้งหมด เบราว์เซอร์เก่ากว่านั้นจะได้เวทีสูง 0 แล้วเม็ดลอยไปทับของอื่น
       (บทเรียนเดียวกับ .ring-stage ที่เจอบน iPhone) */
}
.sum-ring-stage::before { content: ''; display: block; padding-top: 100%; }
.sum-bead {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: linear-gradient(145deg, #f4efe4, #e8e2d4);
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
/* อะไหล่/ตัวคั่นเป็นเงิน ไม่ใช่หิน — ต่างที่การไล่แสง ไม่ใช่ต่างที่ขนาด
   (ขนาดมาจากหน่วยความกว้างอยู่แล้ว) */
.sum-bead.is-part { background-image: linear-gradient(145deg, #f2f2f2, #c9c9c9); }

/* ---------- ปุ่มที่ย้ายมาจากแถบหัวที่ถูกเอาออก (2026-08-04) ---------- */

/* กระจายตัวคั่น — อยู่ใต้วงในขั้นออกแบบ เพราะมันแก้เนื้อในของวงนี้
   (อยู่ในแถบหัวทำให้ดูเป็นปุ่มระดับหน้าเหมือน แชร์/บันทึก) */
.ring-tools { display: flex; justify-content: center; margin: 8px 0 0; }

/* แชร์แบบ / บันทึกแบบ / กลับไปแก้ ในขั้นยืนยัน
   ★★ เป็นไอคอนที่ยัง **มีข้อความกำกับ** ไม่ใช่ไอคอนเปล่า — 🔗 กับ 🔖 เดาความหมาย
      ไม่ได้ถ้าไม่เคยกด และคนละความหมายกันในแต่ละแอป · title/aria-label แทนข้อความ
      ที่มองเห็นไม่ได้ เพราะคนใช้มือถือไม่มีทางชี้ค้าง */
.sum-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--silver-light);
}
.sum-actions form { display: contents; }
.icon-action {
  flex: 1 1 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  border: 1px solid var(--silver-light);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
  text-align: center;
  text-decoration: none;
}
.icon-action:hover { border-color: var(--gold); }
.icon-action-mark { font-size: 17px; line-height: 1; }

/* วิดีโอสินค้าในแกลเลอรี — กรอบเดียวกับรูปหลัก จะได้ไม่กระตุกตอนสลับ */
.gallery-video {
  width: 100%; display: block; border-radius: var(--radius);
  background: var(--charcoal); aspect-ratio: 1 / 1; object-fit: cover;
}

/* ================= ปรับให้ใช้บนมือถือ (2026-10-05) ================= */

/*
 * ★ หัวเว็บหลบขึ้นตอนเลื่อนลง แล้วกลับมาเมื่อเลื่อนขึ้น (มือถือเท่านั้น)
 *   หัวเว็บ sticky สูง ~120px + แถบเมนูล่าง ~70px + แถบเพิ่มลงตะกร้า ~65px
 *   เหลือที่ให้อ่านเนื้อหาไม่ถึง 70% ของจอ iPhone · คลาส .hdr-hidden มาจาก shop.js
 *   ใช้ transform ไม่ใช่เปลี่ยนความสูง — ความสูงเปลี่ยนจะดันเนื้อหาทั้งหน้ากระตุก
 *   ไม่มี JS = หัวเว็บอยู่กับที่เหมือนเดิม
 */
@media (max-width: 899px) {
  .shop-header { transition: transform 0.22s ease; will-change: transform; }
  body.hdr-hidden .shop-header { transform: translateY(-100%); box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  .shop-header { transition: none; }
}

/*
 * ★ ตัวกรองหน้ารวมสินค้า: มือถือพับไว้หลังปุ่ม "ตัวกรอง" · เดสก์ท็อปกางเสมอ
 *   checkbox ซ่อนแบบที่ยังโฟกัสด้วยคีย์บอร์ดได้ (ไม่ใช้ display:none)
 */
.filter-toggle { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.filter-toggle-btn { gap: 6px; margin: 4px 0 2px; }
.filter-toggle:focus-visible + .filter-toggle-btn { outline: 2px solid var(--gold-dark); outline-offset: 2px; }
.filter-toggle:checked + .filter-toggle-btn { background: var(--charcoal); border-color: var(--charcoal); color: var(--gold-light); font-weight: 600; }
.filter-more { display: none; }
.filter-toggle:checked ~ .filter-more { display: block; }
@media (min-width: 900px) {
  .filter-toggle, .filter-toggle-btn { display: none; }
  .filter-more { display: block; }
}

/* ── ไอคอน SVG กลาง (function/icons.php · 2026-10-05) ─────────────────────────
   ★ ขนาดมาจาก font-size ของกล่องเดิมที่เคยใส่อีโมจิ (svg กว้าง/สูง 1em)
   ★ สีเป็น currentColor — กล่องที่อยากให้ไอคอนเป็นสีทองตั้ง color เอง */
.ui-ico { display: inline-block; width: 1em; height: 1em; vertical-align: -0.14em; flex: none; }
.ui-ico.is-filled { fill: currentColor; }
.tab-icon .ui-ico { display: block; width: 21px; height: 21px; }
.empty-mark { color: var(--gold-dark); line-height: 1; }
.account-tile-icon { color: var(--gold-dark); }
.slip-icon { color: var(--gold-dark); }
.design-blank { color: var(--gold-dark); }
.icon-btn .ui-ico { width: 19px; height: 19px; }
.wish-btn .ui-ico { width: 19px; height: 19px; }
.pd-wish .wish-btn .ui-ico { width: 19px; height: 19px; }
.icon-action-mark .ui-ico { width: 19px; height: 19px; }

/* พื้นเข้มต้องใช้วงโฟกัสสีอ่อน จึงเห็นช่องค้นหา/เมนูเมื่อใช้คีย์บอร์ด */
.shop-header :focus-visible { outline-color: var(--gold-light); }

/* viewport-fit=cover: เผื่อรอยบากแนวนอนและขอบจอของแถบ fixed ด้วย */
@supports (padding: env(safe-area-inset-left)) {
  body {
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }
  .shop-header { padding-top: env(safe-area-inset-top, 0px); }
  .tabbar {
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }
  @media (max-width: 899px) {
    .buy-bar {
      padding-left: max(16px, env(safe-area-inset-left, 0px));
      padding-right: max(16px, env(safe-area-inset-right, 0px));
    }
  }
}

/* จอใหญ่มีพื้นที่ให้แบรนด์ เมนู และค้นหาอยู่แถวเดียวกัน */
@media (min-width: 1200px) {
  .header-row {
    max-width: 1500px;
    grid-template-columns: minmax(160px, .85fr) auto minmax(180px, 1fr) auto;
    grid-template-areas: "brand nav search actions";
    gap: 20px;
  }
  .topnav { gap: 16px; }
}
@media (hover: hover) and (pointer: fine) {
  .product-card:hover { border-color: var(--gold); }
}
.product-card:focus-within { border-color: var(--gold-dark); }

/* Gem Objects: retain existing labels and button hit areas. */
.ui-ico.gem-ico { min-width: 22px; min-height: 22px; overflow: hidden; }
.tab-icon .ui-ico.gem-ico { width: 24px; height: 24px; }
.comp-remove { display: inline-grid; place-items: center; flex: none; width: 44px; min-height: 44px; }
.comp-remove .gem-ico { width: 22px; height: 22px; }

.comp-row { grid-template-columns: 18px 26px minmax(0, 1fr) auto 44px; }
