/* ============ Base ============ */
:root {
  /* Color tokens — base */
  --bg: #0f0f14;
  --bg-2: #16161f;
  --bg-3: #1e1e2a;
  --border: #2a2a3a;
  --border-strong: #3a3a4f;
  --text: #e7e7ef;
  --muted: #8b8ba0;
  --primary: #a855f7;
  --primary-dark: #7e22ce;
  --accent: #a78bfa;
  /* accordion หน้าสินค้า: สีประจำหัวข้อ */
  --acc-receive: #5b9dff;
  --acc-usage: #a855f7;
  --acc-safety: #2dd4bf;
  --brand-name-gradient: linear-gradient(135deg, #d8b4fe 0%, #c084fc 44%, #9f57e0 100%);
  --search-hover-bg: rgba(19, 14, 31, .96);
  --search-hover-border: rgba(164, 79, 255, .78);
  --search-focus-border: rgba(205, 139, 255, .92);
  --search-hover-shadow: 0 0 0 1px rgba(164, 79, 255, .34), 0 0 18px rgba(164, 79, 255, .32), inset 0 0 16px rgba(164, 79, 255, .08);
  --search-focus-shadow: 0 0 0 1px rgba(205, 139, 255, .48), 0 0 24px rgba(164, 79, 255, .46), 0 8px 28px rgba(0, 0, 0, .28), inset 0 0 18px rgba(164, 79, 255, .1);
  --search-icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238b8ba0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
  --select-chevron-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238b8ba0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --select-chevron-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23c4b5fd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m18 15-6-6-6 6'/%3E%3C/svg%3E");
  --discord: #5865F2;
  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --scrollbar-track: rgba(12, 12, 18, .72);
  --scrollbar-thumb: #3f3f49;
  --scrollbar-thumb-hover: #52525d;

  /* Color tokens — soft tints (สำหรับ pill/hover/selected backgrounds) */
  --primary-soft: rgba(168, 85, 247, .12);
  --primary-soft-hover: rgba(168, 85, 247, .18);
  --accent-soft: rgba(167, 139, 250, .12);
  --discord-soft: rgba(88, 101, 242, .15);
  --success-soft: rgba(34, 197, 94, .14);
  --warn-soft: rgba(245, 158, 11, .14);
  --danger-soft: rgba(239, 68, 68, .14);

  /* Typography scale */
  --fs-xs: .75rem;     /* 12px — captions, tiny labels */
  --fs-sm: .85rem;     /* 13.6px — secondary text */
  --fs-base: 1rem;     /* 16px — body */
  --fs-md: 1.05rem;    /* 16.8px — emphasized body */
  --fs-lg: 1.15rem;    /* 18.4px — small headings, hero sub */
  --fs-xl: 1.4rem;     /* 22.4px — h3 */
  --fs-2xl: 1.75rem;   /* 28px — h2 */
  --fs-3xl: 2.25rem;   /* 36px — h1 */
  --fs-4xl: 3rem;      /* 48px — hero */
  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 600;
  --font-body: 'Anuphan', 'Prompt', 'Noto Sans Thai', 'Segoe UI', Tahoma, sans-serif;
  --font-display: 'Kanit', 'Prompt', 'Noto Sans Thai', 'Segoe UI', Tahoma, sans-serif;
  --lh-tight: 1.25;
  --lh-normal: 1.55;
  --lh-loose: 1.7;

  /* Spacing scale (4px base unit) */
  --space-1: .25rem;   /* 4px */
  --space-2: .5rem;    /* 8px */
  --space-3: .75rem;   /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.5rem;   /* 24px */
  --space-6: 2rem;     /* 32px */
  --space-7: 3rem;     /* 48px */
  --space-8: 4rem;     /* 64px */

  /* Radius scale */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 999px;

  /* Shadow scale */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.2);
  --shadow-sm: 0 2px 6px rgba(0,0,0,.25);
  --shadow-md: 0 4px 14px rgba(0,0,0,.3);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.35);
  --shadow-xl: 0 20px 50px rgba(0,0,0,.45);
  --shadow-glow-primary: 0 6px 18px rgba(168,85,247,.35);
  --shadow-glow-accent: 0 6px 18px rgba(167,139,250,.35);
  --shadow: var(--shadow-lg);  /* legacy alias */
  /* Ink สำหรับเงา/พื้น-ขอบ tint ที่ hardcode rgba(0,0,0) — light จะ override ให้อมม่วงแทนดำ */
  --shadow-ink: 0, 0, 0;
  --tint-ink: 0, 0, 0;

  /* Motion */
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.5, .64, 1);
  --dur-fast: .12s;
  --dur-base: .2s;
  --dur-slow: .35s;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f8f6fc;
  --bg-2: #ffffff;
  --bg-3: #f9f6ff;
  --border: #ded6ec;
  --border-strong: #cbbfe0;
  --text: #20182d;
  --muted: #6f657d;
  --primary: #8b45d6;
  --primary-dark: #6f2dbd;
  --accent: #7c5fd6;
  --acc-receive: #2f6bd6;
  --acc-usage: #8b45d6;
  --acc-safety: #0f9e8c;
  --brand-name-gradient: linear-gradient(135deg, #7c3aed 0%, #a855f7 48%, #d946ef 100%);
  --search-hover-bg: rgba(255, 255, 255, .96);
  --search-hover-border: rgba(139, 69, 214, .62);
  --search-focus-border: rgba(139, 69, 214, .82);
  --search-hover-shadow: 0 0 0 1px rgba(139, 69, 214, .22), 0 8px 22px rgba(78, 48, 112, .12), inset 0 0 14px rgba(139, 69, 214, .05);
  --search-focus-shadow: 0 0 0 1px rgba(139, 69, 214, .32), 0 10px 28px rgba(78, 48, 112, .16), inset 0 0 16px rgba(139, 69, 214, .06);
  --search-icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236f657d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
  --select-chevron-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236f657d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --select-chevron-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%237c5fd6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m18 15-6-6-6 6'/%3E%3C/svg%3E");
  --scrollbar-track: rgba(230, 224, 240, .72);
  --scrollbar-thumb: #c4b5d8;
  --scrollbar-thumb-hover: #a995c2;
  --primary-soft: rgba(139, 69, 214, .1);
  --primary-soft-hover: rgba(139, 69, 214, .16);
  --accent-soft: rgba(124, 95, 214, .12);
  --discord-soft: rgba(88, 101, 242, .12);
  --success-soft: rgba(34, 197, 94, .12);
  --warn-soft: rgba(245, 158, 11, .13);
  --danger-soft: rgba(239, 68, 68, .12);
  --shadow-xs: 0 1px 2px rgba(142, 122, 180, .08);
  --shadow-sm: 0 2px 6px rgba(142, 122, 180, .09);
  --shadow-md: 0 5px 16px rgba(142, 122, 180, .1);
  --shadow-lg: 0 12px 30px rgba(142, 122, 180, .12);
  --shadow-xl: 0 20px 46px rgba(142, 122, 180, .14);
  /* light: เงาบางมาก โทนลาเวนเดอร์อ่อน — 83 จุดที่แปลงใน T0 (alpha เดิม dark) จะนุ่มลงพร้อมกัน */
  --shadow-ink: 142, 122, 180;
  --tint-ink: 60, 48, 82;
}

* { box-sizing: border-box; }
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: var(--radius-full);
}
*::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--radius-full);
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}
html, body { margin: 0; padding: 0; }
html {
  cursor: default;
  /* -webkit-user-select: none;
  user-select: none; */
}
body {
  font-family: var(--font-body);
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  cursor: default;
}

/* หัวข้อใหญ่หน้าบ้าน (ไม่เกิน 500) */
.hero-v2-title,
.hero-v2-subtitle,
.hero-title,
.page-title,
.auth-title {
  font-family: var(--font-display);
  font-weight: 600;
}

body img {
  -webkit-user-drag: none;
  user-drag: none;
}

/* Page fade-in (subtle) */
main {
  animation: page-fade-in .35s var(--ease-out);
}
@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  main { animation: none; }
}

/* คลุมดำได้: ช่องกรอก | เนื้อหาที่มีคลาส .u-select-text (ชื่อสินค้า, บัญชี/อีเมล, รหัสออเดอร์) */
input,
textarea,
select {
  -webkit-user-select: text;
  user-select: text;
}
[contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
}
.u-select-text {
  -webkit-user-select: text;
  user-select: text;
}

/* Cursor ทั้งไซต์: ข้อความทั่วไป = ลูกศร | I-beam เฉพาะช่องพิมพ์ | มือที่ปุ่ม/ลิงก์คลิกได้ */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="number"],
input:not([type]),
textarea {
  cursor: text;
}
[contenteditable="true"] {
  cursor: text;
}
select,
input[type="file"],
input[type="checkbox"],
input[type="radio"],
input[type="range"],
input[type="color"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"],
input[type="week"] {
  cursor: pointer;
}
a[href],
button:not(:disabled),
.btn,
[role="button"],
input[type="submit"]:not(:disabled),
input[type="button"]:not(:disabled),
input[type="reset"]:not(:disabled),
summary,
label,
.chip,
.nt-opt {
  cursor: pointer;
}
button:disabled,
input:disabled,
textarea:disabled,
select:disabled,
.btn-disabled,
[aria-disabled="true"] {
  cursor: pointer !important;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--primary); }
img { max-width: 100%; display: block; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

/* Global focus ring — keyboard navigation friendly, แสดงเฉพาะ keyboard ไม่โผล่ตอน mouse click */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
button:focus-visible,
.btn:focus-visible,
.chip:focus-visible {
  outline-offset: 3px;
}
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;  /* ใช้ border-color + box-shadow แทน (ดูใน .form-row และ .nav-search-inner) */
}

/* Password field wrapper (auto-wired by /js/password-toggle.js) */
.pw-field {
  position: relative;
  display: block;
}
.pw-field input {
  padding-right: 44px !important;  /* leave room for toggle btn */
  width: 100%;
}
.pw-toggle-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px; height: 34px;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color var(--dur-fast) ease, background var(--dur-fast) ease;
}
.pw-toggle-btn:hover {
  color: var(--primary);
  background: var(--primary-soft);
}
.pw-toggle-icon { display: block; }
.pw-toggle-btn .secret-icon {
  display: inline-flex;
  line-height: 0;
}
.pw-toggle-btn .secret-icon--hide,
.pw-toggle-btn.is-revealed .secret-icon--show {
  display: none;
}
.pw-toggle-btn.is-revealed .secret-icon--hide {
  display: inline-flex;
}

/* Password strength meter */
.pw-strength {
  margin-top: var(--space-2);
  display: flex; flex-direction: column; gap: var(--space-1);
}
.pw-strength__bars {
  display: flex; gap: 4px;
}
.pw-strength__bar {
  flex: 1;
  height: 4px;
  background: var(--bg-3);
  border-radius: var(--radius-full);
  transition: background var(--dur-base) ease;
}
.pw-strength[data-level="1"] .pw-strength__bar.is-on { background: var(--danger); }
.pw-strength[data-level="2"] .pw-strength__bar.is-on { background: var(--warn); }
.pw-strength[data-level="3"] .pw-strength__bar.is-on { background: #eab308; }
.pw-strength[data-level="4"] .pw-strength__bar.is-on { background: var(--success); }
.pw-strength__info {
  display: flex; gap: var(--space-2); flex-wrap: wrap;
  font-size: var(--fs-xs);
  min-height: 1.2em;
}
.pw-strength__label { font-weight: var(--fw-semibold); }
.pw-strength[data-level="0"] .pw-strength__label,
.pw-strength[data-level="1"] .pw-strength__label { color: var(--danger); }
.pw-strength[data-level="2"] .pw-strength__label { color: var(--warn); }
.pw-strength[data-level="3"] .pw-strength__label { color: #eab308; }
.pw-strength[data-level="4"] .pw-strength__label { color: var(--success); }
.pw-strength__tips { color: var(--muted); }

/* Consistent input baseline (สำหรับ form ที่ไม่ได้ override styling) */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="number"],
textarea,
select {
  font-family: inherit;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-base) ease, background var(--dur-fast) ease;
}
/* ปุ่ม/submit ไม่ inherit ฟอนต์เอง — บังคับให้ใช้ฟอนต์เว็บ (ไม่งั้นตกไปเป็นฟอนต์ระบบ) */
button,
input[type="submit"],
input[type="button"],
input[type="reset"] {
  font-family: inherit;
}
/* Preserve the native option picker and keep the chevron visible in both states. */
select:not([multiple]):not([size]) {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 2.25rem !important;
  background-image: var(--select-chevron-down) !important;
  background-position: right .7rem center !important;
  background-repeat: no-repeat !important;
  background-size: 16px 16px !important;
}
select:not([multiple]):not([size]):open {
  background-image: var(--select-chevron-up) !important;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="search"] {
  -webkit-appearance: none;
  appearance: none;
  background-image: var(--search-icon-image);
  background-position: .72rem 50%;
  background-repeat: no-repeat;
  background-size: 16px 16px;
  padding-left: 2.2rem;
}
input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
input[type="search"]:hover {
  background-color: var(--search-hover-bg);
  border-color: var(--search-hover-border);
  box-shadow: var(--search-hover-shadow);
}
input[type="search"]:focus {
  background-color: var(--search-hover-bg);
  border-color: var(--search-focus-border);
  box-shadow: var(--search-focus-shadow);
}
input[type="search"]::placeholder {
  transition: color var(--dur-fast) ease;
}
input[type="search"]:hover::placeholder,
input[type="search"]:focus::placeholder {
  color: var(--muted);
}
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-danger { color: var(--danger); }
.text-warn { color: var(--warn); }
.text-ok { color: var(--success); }
.u-m-0 { margin: 0; }
.u-mb-4 { margin-bottom: 1rem; }
.u-mt-1 { margin-top: .4rem; }
.u-mt-2 { margin-top: .6rem; }
.u-mt-3 { margin-top: 1rem; }
.u-mt-4 { margin-top: 1.2rem; }
.u-mt-5 { margin-top: 1.3rem; }
.u-mt-6 { margin-top: 1.5rem; }
.u-mt-7 { margin-top: 2rem; }
.u-mt-space-7 { margin-top: var(--space-7); }
.u-mt-neg-1 { margin-top: -.4rem; }
.u-mt-neg-2 { margin-top: -.5rem; }
.u-my-compact { margin: .4rem 0 .8rem; }
.u-inline { display: inline; }
.u-inline-offset { display: inline-block; margin-left: 8px; }
.u-flex-shrink-0 { flex-shrink: 0; }
.u-flex-wrap-gap { display: flex; gap: .6rem; flex-wrap: wrap; }
.u-flex-1-min-200 { flex: 1; min-width: 200px; }
.u-align-end { align-items: flex-end; }
.u-break-all { word-break: break-all; }
.u-w-36 { width: 36px; }
.u-w-48 { width: 48px; }
.u-w-60 { width: 60px; }
.u-w-100 { width: 100px; }
.u-w-160 { width: 160px; }
.u-w-180 { width: 180px; }
.u-w-full { width: 100%; }
.u-min-w-160 { min-width: 160px; }
.u-min-w-220 { min-width: 220px; }
.u-disabled-link { opacity: .4; cursor: not-allowed; }
.u-chrome-none { border: 0; background: transparent; }
.u-date-filter-label { display: flex; align-items: center; gap: .4rem; min-width: auto; }
.u-field-transparent { background: transparent; border: 0; color: var(--text); }
.u-text-normal-sm { font-weight: 400; font-size: .9rem; }
.hero-stat-icon--purple { color: #ad40eb; }
.hero-stat-icon--gold { color: #fbbf24; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
code { background: var(--bg-3); padding: 2px 6px; border-radius: 4px; font-size: .9em; }

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

/* ============ Header ============ */
.site-header {
  background: rgba(15,15,20,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  padding: .7rem 1.25rem;
}
.header-left { display: flex; align-items: center; gap: 1.25rem; min-width: 0; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 600; font-size: 1.2rem; flex-shrink: 0; }
.brand-logo {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  filter: drop-shadow(0 0 12px rgba(168,85,247,.5));
}
.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.brand-text {
  font-family: 'Chakra Petch', var(--font-display);
  font-weight: 700;
  background: var(--brand-name-gradient);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

/* Center main nav (Home / Products) */
.main-nav {
  display: flex; gap: 1.5rem; align-items: center;
  justify-content: center;
  justify-self: center;
}
.main-nav > a,
.nav-category-dropdown__summary {
  color: var(--muted); font-weight: 500; transition: color var(--dur-fast) ease, text-shadow var(--dur-fast) ease;
  font-size: .95rem; padding: .35rem .55rem;
  position: relative;
}
.main-nav > a:hover,
.main-nav > a:focus-visible,
.nav-category-dropdown[open] > .nav-category-dropdown__summary,
.nav-category-dropdown__summary:hover,
.nav-category-dropdown__summary:focus-visible {
  color: #c084fc;
  text-shadow: 0 0 14px rgba(192, 132, 252, .34);
}
.main-nav > a::after,
.nav-category-dropdown__summary::after {
  content: ""; position: absolute; left: 50%; bottom: -4px;
  width: 0; height: 2px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 2px;
  transform: translateX(-50%);
  transition: width .2s ease;
}
.main-nav > a:hover::after,
.main-nav > a:focus-visible::after,
.nav-category-dropdown[open] > .nav-category-dropdown__summary::after,
.nav-category-dropdown__summary:hover::after,
.nav-category-dropdown__summary:focus-visible::after {
  width: 70%;
}
/* แถบประกาศ Quest AUTO เหนือ header — เฉพาะมือถือ (desktop เห็นเมนู + badge NEW บน nav อยู่แล้ว) */
.quest-announce { display: none; }
html[data-quest-announce="off"] .quest-announce { display: none !important; }

/* ป้าย NEW ท้ายเมนู — span จริง ไม่ใช่ ::after เพราะ ::after ถูกใช้ทำเส้นขีดใต้ตอน hover แล้ว */
.nav-badge-new {
  margin-left: .35rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: .625rem; font-weight: var(--fw-bold);
  letter-spacing: .04em;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  vertical-align: middle;
}

.nav-category-dropdown {
  position: relative;
}
.nav-category-dropdown__summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  cursor: pointer;
  /* user-select: none; */
}
.nav-category-dropdown__summary::-webkit-details-marker {
  display: none;
}
.nav-category-dropdown__summary .lucide {
  transition: transform var(--dur-fast) ease;
}
.nav-category-dropdown[open] .nav-category-dropdown__summary .lucide {
  transform: rotate(180deg);
}
.nav-category-dropdown__panel {
  position: absolute;
  top: calc(100% + .7rem);
  left: 50%;
  transform: translateX(-50%);
  width: min(280px, calc(100vw - 2rem));
  max-height: min(420px, calc(100vh - 6rem));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .18rem;
  padding: .45rem;
  background: rgba(22, 22, 31, .98);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 160;
}
.nav-category-dropdown:not([open]) .nav-category-dropdown__panel {
  display: none;
}
.nav-category-dropdown__panel::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 10px;
  height: 10px;
  transform: translateX(-50%) rotate(45deg);
  background: rgba(22, 22, 31, .98);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
}
.nav-category-dropdown__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 40px;
  padding: .55rem .65rem;
  border-radius: 10px;
  color: var(--text);
  font-size: .9rem;
  font-weight: 500;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease, transform var(--dur-fast) ease;
}
.nav-category-dropdown__item:hover,
.nav-category-dropdown__item:focus-visible {
  background: var(--primary-soft);
  color: var(--primary);
  transform: translateX(2px);
}
.nav-category-dropdown__item-icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  overflow: hidden;
  color: var(--muted);
}
.nav-category-dropdown__item:hover .nav-category-dropdown__item-icon {
  color: var(--primary);
  background: var(--primary-soft);
}
.nav-category-dropdown__item-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.nav-category-dropdown__emoji {
  font-size: .95rem;
  line-height: 1;
}

/* Right cluster: search + actions */
.header-right-cluster {
  display: flex; align-items: center; gap: clamp(2rem, 3vw, 3.75rem);
  justify-self: end;
  width: 100%;
  min-width: 0;
  padding-left: clamp(.75rem, 1.5vw, 1.5rem);
}
.nav-search-wrap {
  display: flex; justify-content: flex-end;
  flex: 0 1 480px; min-width: 0;
  position: relative;
}
.nav-search { width: 100%; max-width: 720px; }
.nav-search-inner {
  display: flex; align-items: center; gap: .65rem;
  width: 100%;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 1.05rem 0 .95rem;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-base) ease, background var(--dur-fast) ease;
}
.nav-search-inner:hover {
  background: var(--search-hover-bg);
  border-color: var(--search-hover-border);
  box-shadow: var(--search-hover-shadow);
}
.nav-search-inner:focus-within {
  background: var(--search-hover-bg);
  border-color: var(--search-focus-border);
  box-shadow: var(--search-focus-shadow);
}
.nav-search-icon {
  display: flex; align-items: center; flex-shrink: 0;
  color: var(--muted);
  transition: color var(--dur-fast) ease, filter var(--dur-fast) ease;
}
.nav-search-inner:hover .nav-search-icon,
.nav-search-inner:focus-within .nav-search-icon {
  color: #e1c4ff;
  filter: drop-shadow(0 0 7px rgba(205, 139, 255, .6));
}
.nav-search input[type="search"] {
  flex: 1; min-width: 0;
  width: 100%;
  background: transparent; border: 0;
  background-image: none;
  color: var(--text); padding: .5rem 0;
  font-size: .92rem; font-family: inherit;
}
.nav-search input[type="search"]:hover,
.nav-search input[type="search"]:focus {
  background: transparent;
  outline: 0;
  border-color: transparent;
  box-shadow: none;
}
.nav-search input[type="search"]::-webkit-search-cancel-button,
.nav-search input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}
.nav-search.is-live-searching .nav-search-inner {
  border-color: var(--search-hover-border);
  box-shadow: var(--search-hover-shadow);
}
.site-header .btn {
  font-weight: 500;
}
.icon-svg { display: block; flex-shrink: 0; }

/* Lucide icon system — global rules */
.lucide {
  display: inline-block;
  vertical-align: -0.18em;  /* baseline align with surrounding text */
  flex-shrink: 0;
}
/* When inside flex containers (buttons/chips) — block + auto vertical-align */
.btn .lucide,
.chip .lucide,
.filter-btn .lucide,
.admin-sidebar nav a .lucide,
.admin-sidebar-logout button .lucide,
.mobile-drawer__nav a .lucide,
h1 .lucide, h2 .lucide, h3 .lucide, h4 .lucide {
  vertical-align: middle;
}
/* color helpers */
.lucide.text-success { color: var(--success); }
.lucide.text-warn    { color: var(--warn); }
.lucide.text-danger  { color: var(--danger); }
.lucide.text-info    { color: var(--accent); }
.lucide.text-muted   { color: var(--muted); }
/* fill variant — for "filled" status icons */
.lucide.fill-current { fill: currentColor; stroke: none; }
.nav-cart-icon .icon-svg,
.wallet-mini .icon-svg { color: var(--text); opacity: .92; }

.header-right { display: flex; align-items: center; gap: .55rem; flex-shrink: 0; }

/* Cart — icon only with badge */
.nav-cart-icon {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--bg-3); border: 1px solid var(--border);
  font-size: 1.1rem; transition: all .15s;
}
.nav-cart-icon:hover { border-color: var(--primary); transform: translateY(-1px); }

/* Theme toggle — icon-only circle, ก่อนกระดิ่งแจ้งเตือน */
.nav-theme-toggle {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--bg-3); border: 1px solid var(--border);
  color: var(--text); cursor: pointer; flex-shrink: 0;
  transition: border-color .15s ease, transform .15s ease, box-shadow .2s ease;
}
.nav-theme-toggle:hover { border-color: var(--primary); transform: translateY(-1px); }
.nav-theme-toggle .theme-icon { opacity: .92; }
.cart-icon { line-height: 0; display: flex; align-items: center; justify-content: center; }
.cart-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--primary); color: #fff;
  border-radius: 999px; font-size: .68rem; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--bg-1);
}
.cart-badge--zero {
  display: none;
}
.cart-badge.is-updated {
  animation: cart-badge-pop 0.55s cubic-bezier(0.34, 1.2, 0.64, 1);
}
@keyframes cart-badge-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.22); }
  70% { transform: scale(0.96); }
  100% { transform: scale(1); }
}
.nav-cart-icon.cart-icon-pulse {
  animation: cart-icon-pulse 0.55s ease;
}
@keyframes cart-icon-pulse {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-2px) scale(1.06); }
  55% { transform: translateY(0) scale(1.02); }
}

/* Toast — เพิ่มตะกร้าแบบไม่รีเฟรช */
.cart-toast-stack {
  position: fixed;
  bottom: 1.15rem;
  right: 1.15rem;
  z-index: 10050;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  max-width: min(380px, calc(100vw - 1.5rem));
}
.cart-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.4;
  animation: cart-toast-in 0.38s ease;
}
.cart-toast--error {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.08);
}
.cart-toast--warn {
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.1);
}
.cart-toast--warn .cart-toast__icon {
  color: var(--warn);
}
.cart-toast__icon {
  flex-shrink: 0;
  font-size: 1.15rem;
  line-height: 1;
}
.cart-toast__msg {
  min-width: 0;
  word-break: break-word;
}
@keyframes cart-toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Global toast (window.showToast) — ใช้ทั่วไซต์ ===== */
.toast-stack {
  position: fixed;
  bottom: 1.15rem;
  right: 1.15rem;
  z-index: 10050;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
  max-width: min(420px, calc(100vw - 1.5rem));
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: 1.45;
  animation: toast-in .35s var(--ease-spring);
}
.toast--success { border-left-color: var(--success); background: linear-gradient(to right, var(--success-soft), var(--bg-2) 30%); }
.toast--error   { border-left-color: var(--danger);  background: linear-gradient(to right, var(--danger-soft),  var(--bg-2) 30%); }
.toast--info    { border-left-color: var(--accent);  background: linear-gradient(to right, var(--accent-soft),  var(--bg-2) 30%); }
.toast--warn    { border-left-color: var(--warn);    background: linear-gradient(to right, var(--warn-soft),    var(--bg-2) 30%); }
.toast__icon { flex-shrink: 0; line-height: 1; display: inline-flex; align-items: center; }
.toast--success .toast__icon { color: var(--success); }
.toast--error   .toast__icon { color: var(--danger); }
.toast--info    .toast__icon { color: var(--accent); }
.toast--warn    .toast__icon { color: var(--warn); }
.toast__msg  { min-width: 0; word-break: break-word; flex: 1; }
.toast__close {
  background: none; border: 0; color: var(--muted);
  font-size: 1.4rem; line-height: 1; cursor: pointer;
  padding: 0 .25rem; flex-shrink: 0;
  transition: color var(--dur-fast) ease;
}
.toast__close:hover { color: var(--text); }
/* Light mode: การ์ดสีขาวล้วน (คงแถบสี + ไอคอนสีตามชนิดไว้) */
html[data-theme="light"] .toast,
html[data-theme="light"] .toast--success,
html[data-theme="light"] .toast--error,
html[data-theme="light"] .toast--info,
html[data-theme="light"] .toast--warn {
  background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
@media (max-width: 1023px) {
  .cart-toast-stack,
  .toast-stack {
    right: .6rem;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    gap: .4rem;
    max-width: min(320px, calc(100vw - 1.2rem));
  }
  .cart-toast,
  .toast {
    gap: .45rem;
    padding: .55rem .68rem;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    font-size: .76rem;
    line-height: 1.34;
  }
  .toast {
    border-left-width: 3px;
  }
  .cart-toast__icon {
    font-size: .95rem;
  }
  .toast__icon .lucide {
    width: 16px;
    height: 16px;
  }
  .toast__close {
    font-size: 1.05rem;
    padding: 0 .1rem;
  }
}

/* ===== Recent-purchase social-proof card (มุมล่างซ้าย) ===== */
.rp-toast {
  position: fixed;
  left: 1.15rem;
  bottom: 1.15rem;
  z-index: 10040;
  display: flex;
  flex-direction: column;
  max-width: min(320px, calc(100vw - 2rem));
  /* Glass — ดำแต่โปร่ง ให้พื้นหลังเบลอทะลุผ่าน */
  background: linear-gradient(180deg, rgba(14, 14, 20, .6), rgba(3, 3, 6, .64));
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .06);
  border-radius: 8px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .3s var(--ease-out), transform .3s var(--ease-out);
}
.rp-toast.is-in { opacity: 1; transform: translateY(0); }
.rp-toast__main { display: flex; align-items: stretch; }
.rp-toast__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: .6rem .7rem;
  color: inherit;
  text-decoration: none;
  min-width: 0;
  flex: 1;
}
a.rp-toast__link:hover .rp-toast__name { color: var(--accent); }
.rp-toast__thumb {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-3);
  border: 1px solid var(--border);
}
.rp-toast__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rp-toast__body { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.rp-toast__label {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--accent);
  line-height: 1.3;
}
.rp-toast__label .lucide { width: 14px; height: 14px; }
/* badge ป้ายเล็ก: ซื้อ = เขียว · Quest AUTO = ม่วง (รูปแบบเดียวกัน ต่างแค่สี) */
.rp-toast__label.is-buy,
.rp-toast__label.is-quest {
  color: #fff;
  background: var(--success);
  gap: .22rem;
  font-size: 10px;
  padding: .07rem .4rem;
  border-radius: 999px;
  align-self: flex-start;
}
.rp-toast__label.is-quest { background: var(--primary); }
.rp-toast__label.is-buy .lucide,
.rp-toast__label.is-quest .lucide { width: 11px; height: 11px; }
.rp-toast__name {
  font-size: var(--fs-sm);
  font-weight: var(--fw-normal);
  color: #f1f1f4;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--dur-fast) ease;
}
.rp-toast__time { font-size: var(--fs-xs); color: rgba(255, 255, 255, .5); line-height: 1.3; }
.rp-toast__dismiss {
  display: block;
  width: 100%;
  background: transparent;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .4);
  /* บางและเล็กกว่าทุกอย่างในการ์ด (fs-xs = .75rem) */
  font-size: .66rem;
  font-weight: var(--fw-normal);
  letter-spacing: .2px;
  text-align: center;
  padding: .36rem;
  cursor: pointer;
  transition: color var(--dur-fast) ease, background var(--dur-fast) ease;
}
.rp-toast__dismiss:hover { color: rgba(255, 255, 255, .8); background: rgba(255, 255, 255, .05); }
@media (max-width: 1023px) {
  .rp-toast {
    left: .6rem;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    max-width: min(280px, calc(100vw - 1.2rem));
    /* ปิด backdrop-filter บนมือถือ (หนักเครื่อง) แต่ใช้พื้นทึบตาม token
       ไม่ fix เป็น #fff เพราะ storefront เป็น dark เป็นหลัก — token จะพลิกเองในโหมดสว่าง */
    background: var(--bg-2);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-color: var(--border);
    box-shadow: 0 6px 18px rgba(var(--shadow-ink), .26);
  }
  .rp-toast__name { color: var(--text); }
  .rp-toast__time { color: var(--muted); }
  .rp-toast__dismiss { color: var(--muted); border-top-color: var(--border); }
  .rp-toast__dismiss:hover { color: var(--text); background: rgba(var(--shadow-ink), .06); }
  .rp-toast__thumb { width: 38px; height: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  .rp-toast { transition: opacity .2s ease; transform: none; }
  .rp-toast.is-in { transform: none; }
}

/* Light mode: rp-toast เป็นกระจกขาวโปร่ง + blur เท่ากันทุกจอ — จางเท่า .toast
   (base เป็น glass ดำ hardcode ไม่พลิกตาม token, มือถือ ≤1023 ก็ปิด blur ไว้ → specificity นี้ชนะทั้งคู่) */
html[data-theme="light"] .rp-toast {
  background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  border-color: rgba(203, 191, 224, .82);
  box-shadow: 0 12px 30px rgba(var(--shadow-ink), .18), inset 0 1px 0 rgba(255, 255, 255, .6);
}
html[data-theme="light"] .rp-toast__name { color: var(--text); }
html[data-theme="light"] .rp-toast__time { color: var(--muted); }
html[data-theme="light"] .rp-toast__dismiss { color: var(--muted); border-top-color: var(--border); }
html[data-theme="light"] .rp-toast__dismiss:hover { color: var(--text); background: rgba(var(--shadow-ink), .06); }

/* ===== Activity ticker — แถบวิ่งรายการซื้อ/Quest ล่าสุด (หน้าแรก) ===== */
.activity-ticker {
  display: flex;
  align-items: stretch;
  margin: 0 0 var(--space-5);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(var(--shadow-ink), .10), rgba(var(--shadow-ink), .04));
}
.activity-ticker__lead {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  flex-shrink: 0;
  padding: .55rem .8rem .55rem .3rem;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  letter-spacing: .3px;
  color: var(--muted);
  white-space: nowrap;
}
.activity-ticker__pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: activity-pulse 1.8s ease-out infinite;
}
@keyframes activity-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, .5); }
  70%  { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.activity-ticker__viewport {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12%, #000 88%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 12%, #000 88%, transparent 100%);
}
.activity-ticker__track {
  display: flex;
  align-items: center;
  width: max-content;
  animation: activity-scroll 20s linear infinite;
}
.activity-ticker:hover .activity-ticker__track { animation-play-state: paused; }
@keyframes activity-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.activity-chip {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .5rem 2.1rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  white-space: nowrap;
}
.activity-chip__ico { font-size: 1.2em; }
.activity-chip__thumb {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  display: inline-flex;
}
.activity-chip__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.activity-chip__text { display: flex; flex-direction: column; gap: 3px; line-height: 1.2; min-width: 0; }
.activity-chip__name { color: var(--text); font-weight: var(--fw-medium); font-size: 11px; }
.activity-chip:hover .activity-chip__name { color: var(--accent); }
.activity-chip__meta { color: var(--muted); font-size: 10px; }
.activity-chip__badges { display: inline-flex; align-items: center; gap: .3rem; margin-top: 1px; }
.activity-badge {
  display: inline-flex;
  align-items: center;
  gap: .18rem;
  font-size: 10px;
  font-weight: var(--fw-semibold);
  line-height: 1.3;
  padding: .1rem .45rem;
  border-radius: 999px;
  white-space: nowrap;
}
.activity-badge svg { width: 11px; height: 11px; }
.activity-badge--sold { color: #fff; background: #ec4899; }
.activity-badge--price { color: #fff; background: rgba(168, 85, 247, .42); }
/* ===== แถบคำสั่งซื้อล่าสุด (variant A) — โหมด activity: ริบบิ้นม่วง + แถบเน้นซ้าย ===== */
.activity-ticker--orders {
  position: relative;
  border: 1px solid rgba(168, 85, 247, .16);
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(126, 34, 206, .20) 0%, rgba(22, 18, 38, .82) 30%, rgba(16, 16, 20, .9) 100%);
  box-shadow: 0 8px 24px rgba(var(--shadow-ink), .28), inset 0 1px 0 rgba(255, 255, 255, .04);
}
.activity-ticker--orders::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #b78bf0, #9f57e0, #7e22ce);
  box-shadow: 0 0 5px rgba(168, 85, 247, .25);
}
.activity-ticker--orders .activity-ticker__lead {
  color: #fff;
  padding-left: 1rem;
  font-family: var(--font-display);
}
html[data-theme="light"] .activity-ticker--orders {
  border-color: rgba(124, 95, 214, .22);
  background: linear-gradient(90deg, rgba(168, 85, 247, .14) 0%, rgba(255, 255, 255, .72) 34%, var(--bg-2) 100%);
}
html[data-theme="light"] .activity-ticker--orders .activity-ticker__lead { color: var(--text); }
/* UPDATES mode — หัวแถบ megaphone (icon) + ป้ายวันที่ + วิ่งเร็วกว่า */
.activity-ticker__mega { display: inline-flex; align-items: center; }
.activity-ticker__mega svg { width: 16px; height: 16px; }
.activity-ticker--updates .activity-ticker__track { animation-duration: 12s; }
.activity-chip__msg { color: var(--text); font-weight: var(--fw-medium); }
.activity-chip__date {
  flex-shrink: 0;
  font-size: var(--fs-xs);
  color: var(--muted);
  background: color-mix(in srgb, var(--border) 45%, transparent);
  padding: .08rem .45rem;
  border-radius: 999px;
}
@media (max-width: 640px) {
  .activity-ticker__lead { padding: .45rem .55rem; font-size: 11px; }
  .activity-chip { padding: .4rem 1.1rem; gap: .45rem; }
  .activity-chip__thumb { width: 40px; height: 40px; border-radius: 8px; }
  .activity-chip__name { font-size: 10px; }
  .activity-chip__meta { font-size: 9px; }
  .activity-badge { font-size: 9px; padding: .06rem .38rem; }
  .activity-badge svg { width: 10px; height: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .activity-ticker__track { animation: none; }
  .activity-ticker__pulse { animation: none; }
}

/* ===== Floating quick actions — desktop only ===== */
.quick-actions {
  position: fixed;
  right: clamp(.8rem, 1.6vw, 1.05rem);
  bottom: calc(.9rem + env(safe-area-inset-bottom));
  z-index: 9000;
  width: 48px;
  height: 48px;
}
.quick-actions__menu {
  position: absolute;
  right: calc(100% + .52rem);
  bottom: calc(100% - .18rem);
  display: grid;
  gap: .42rem;
  justify-items: end;
  align-items: end;
  transform-origin: right bottom;
}
.quick-actions__menu[hidden] {
  display: none;
}
.quick-actions__item {
  min-width: 158px;
  min-height: 40px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: .48rem;
  padding: .32rem .72rem .32rem .32rem;
  border: 1px solid rgba(148, 122, 212, .24);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(28, 24, 49, .96), rgba(18, 17, 37, .96));
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.055), 0 8px 18px rgba(var(--shadow-ink),.16), 0 0 0 1px rgba(109, 75, 192, .08);
  font: inherit;
  font-size: .86rem;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease, color var(--dur-fast) ease, transform var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.quick-actions__item:hover,
.quick-actions__item:focus-visible {
  outline: none;
  border-color: rgba(185, 155, 245, .42);
  background: linear-gradient(180deg, rgba(35, 29, 61, .98), rgba(22, 20, 43, .98));
  color: #fff;
  transform: translateX(-1px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 0 0 3px rgba(168,85,247,.12), 0 10px 20px rgba(var(--shadow-ink),.2);
}
.quick-actions__item-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 4px 10px rgba(var(--shadow-ink),.2);
}
.quick-actions__item-icon--chat {
  background: linear-gradient(135deg, #ec4899, #d946ef);
}
.quick-actions__item-icon--theme {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
}
.quick-actions__item-icon .lucide {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
}
.quick-actions__fab {
  position: relative;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 50%;
  background: linear-gradient(135deg, #6E47CE 0%, #9D6BE1 60%, #D39BE8 100%);
  color: #fff;
  box-shadow: 0 8px 18px rgba(78, 42, 138, .3), inset 0 1px 0 rgba(255,255,255,.18);
  cursor: pointer;
  overflow: hidden;
  transition: transform var(--dur-fast) ease, box-shadow var(--dur-fast) ease, filter var(--dur-fast) ease;
}
.quick-actions__fab:hover,
.quick-actions__fab:focus-visible {
  outline: none;
  transform: translateY(-1px);
  filter: saturate(1.06);
  box-shadow: 0 11px 22px rgba(78, 42, 138, .36), 0 0 0 3px rgba(168,85,247,.12), inset 0 1px 0 rgba(255,255,255,.2);
}
.quick-actions__fab-icon {
  position: absolute;
  width: 19px;
  height: 19px;
  opacity: 1;
  transform: rotate(0deg) scale(1);
  transition: opacity .22s ease, transform .24s cubic-bezier(.2,.8,.2,1);
}
.quick-actions__fab-icon--close {
  width: 22px;
  height: 22px;
  opacity: 0;
  transform: rotate(-120deg) scale(.55);
}
.quick-actions.is-open .quick-actions__fab {
  transform: translateY(-1px) rotate(0);
}
.quick-actions.is-open .quick-actions__fab-icon--open {
  opacity: 0;
  transform: rotate(120deg) scale(.55);
}
.quick-actions.is-open .quick-actions__fab-icon--close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}
.quick-actions.is-open .quick-actions__menu {
  animation: quick-actions-menu-in .18s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes quick-actions-menu-in {
  from { opacity: 0; transform: translate(6px, 8px) scale(.96); }
  to { opacity: 1; transform: translate(0, 0) scale(1); }
}

/* ===== AI Support Chat panel ===== */
.support-chat {
  position: fixed;
  right: clamp(.8rem, 1.6vw, 1.05rem);
  bottom: calc(4.4rem + env(safe-area-inset-bottom));
  z-index: 9001;
  width: min(380px, calc(100vw - 1.6rem));
}
.support-chat[hidden] { display: none; }
.support-chat__panel {
  display: flex;
  flex-direction: column;
  height: min(560px, calc(100vh - 8rem));
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--bg-2);
  box-shadow: 0 18px 48px rgba(var(--shadow-ink),.42), inset 0 1px 0 rgba(255,255,255,.04);
  overflow: hidden;
}
.support-chat--open .support-chat__panel {
  animation: support-chat-in .2s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes support-chat-in {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.support-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .7rem .9rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(110,71,206,.22), rgba(168,85,247,.12));
}
.support-chat__title {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-weight: 600;
  font-size: .95rem;
  color: var(--text);
}
.support-chat__title-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-3);
}
.support-chat__actions {
  display: inline-flex;
  align-items: center;
  gap: .15rem;
}
.support-chat__action {
  display: inline-flex;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: .2rem;
  border-radius: 8px;
  transition: color var(--dur-fast) ease, background var(--dur-fast) ease;
}
.support-chat__action:hover { color: var(--text); background: rgba(255,255,255,.06); }
.support-chat__action[data-support-chat-delete]:hover { color: var(--danger); }
/* แถบยืนยันก่อนลบประวัติ */
.support-chat__confirm {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .5rem .9rem;
  border-bottom: 1px solid var(--border);
  background: rgba(239,68,68,.08);
  font-size: .82rem;
  color: var(--text);
}
.support-chat__confirm[hidden] { display: none; }
.support-chat__confirm-actions { display: inline-flex; gap: .4rem; flex: 0 0 auto; }
.support-chat__confirm-btn {
  font: inherit;
  font-size: .78rem;
  font-weight: 600;
  padding: .28rem .7rem;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: filter var(--dur-fast) ease, background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.support-chat__confirm-btn--cancel { background: transparent; color: var(--muted); }
.support-chat__confirm-btn--cancel:hover { color: var(--text); background: rgba(255,255,255,.06); }
.support-chat__confirm-btn--yes { background: var(--danger); color: #fff; border-color: transparent; }
.support-chat__confirm-btn--yes:hover { filter: brightness(1.08); }
.support-chat__messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: .9rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.support-chat__row {
  display: flex;
  align-items: flex-end;
  gap: .45rem;
}
.support-chat__row--user { justify-content: flex-end; }
.support-chat__row--bot { justify-content: flex-start; align-items: flex-start; }
.support-chat__avatar {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-3);
  border: 1px solid var(--border);
}
.support-chat__msg {
  max-width: 80%;
  padding: .55rem .75rem;
  border-radius: 14px;
  font-size: .87rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.support-chat__msg--bot {
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.support-chat__msg--bot a { color: var(--accent); text-decoration: underline; }
.support-chat__msg--user {
  background: linear-gradient(135deg, #6E47CE, #9D6BE1);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.support-chat__typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.support-chat__typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: support-chat-typing 1s infinite ease-in-out;
}
.support-chat__typing span:nth-child(2) { animation-delay: .15s; }
.support-chat__typing span:nth-child(3) { animation-delay: .3s; }
@keyframes support-chat-typing {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
.support-chat__suggest {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding: .55rem .9rem;
  border-top: 1px solid var(--border);
}
.support-chat__suggest[hidden] { display: none; }
.support-chat__chip {
  font: inherit;
  font-size: .78rem;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  padding: .3rem .65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color var(--dur-fast) ease, color var(--dur-fast) ease, background var(--dur-fast) ease;
}
.support-chat__chip:hover {
  border-color: var(--accent);
  color: #fff;
  background: rgba(168,85,247,.16);
}
.support-chat__form {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  padding: .65rem .8rem calc(.65rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
}
.support-chat__input {
  flex: 1 1 auto;
  resize: none;
  max-height: 120px;
  padding: .5rem .7rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-3);
  color: var(--text);
  font: inherit;
  font-size: .87rem;
  line-height: 1.4;
  overflow-y: hidden; /* JS เปิด scrollbar เฉพาะตอนข้อความเกิน max-height */
}
.support-chat__input:focus {
  outline: none;
  border-color: var(--primary);
}
.support-chat__input:disabled { opacity: .6; }
.support-chat__send {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #6E47CE, #9D6BE1);
  color: #fff;
  cursor: pointer;
  transition: filter var(--dur-fast) ease, opacity var(--dur-fast) ease;
}
.support-chat__send:hover { filter: saturate(1.1) brightness(1.05); }
.support-chat__send:disabled { opacity: .5; cursor: default; }
@media (max-width: 520px) {
  .support-chat { left: .8rem; right: .8rem; width: auto; }
  .support-chat__panel { height: min(70vh, calc(100vh - 7rem)); }
}

/* ===== Proactive nudge (โผล่ด้านซ้ายของปุ่มลอย) ===== */
.support-chat-nudge {
  position: fixed;
  right: calc(clamp(.8rem, 1.6vw, 1.05rem) + 48px + 1rem);
  bottom: calc(.9rem + env(safe-area-inset-bottom));
  z-index: 9000;
  width: max-content;
  max-width: min(260px, calc(100vw - 2.1rem - 48px - 1rem));
  opacity: 0;
  transform: translateY(8px) scale(.96);
  transform-origin: right bottom;
  transition: opacity .22s ease, transform .22s cubic-bezier(.2,.8,.2,1);
  pointer-events: none;
}
.support-chat-nudge--show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.support-chat-nudge[hidden] { display: none; }
.support-chat-nudge__body {
  display: flex;
  align-items: center;
  gap: .55rem;
  text-align: left;
  font: inherit;
  cursor: pointer;
  padding: .6rem .8rem;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  border-bottom-right-radius: 4px;
  background: var(--bg-2);
  color: var(--text);
  box-shadow: 0 12px 30px rgba(var(--shadow-ink),.32);
}
.support-chat-nudge__body:hover { border-color: var(--accent); }
.support-chat-nudge__avatar {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-3);
}
.support-chat-nudge__text { font-size: .82rem; line-height: 1.4; }
.support-chat-nudge__close {
  position: absolute;
  top: -7px; right: -7px;
  width: 22px; height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}
.support-chat-nudge__close:hover { color: var(--text); }
@media (max-width: 1023px) {
  /* มือถือ: ไม่มีปุ่มลอย (FAB) → วาง nudge ที่มุมขวาล่าง เหนือ bottom nav (66px)
     ขนาด/หน้าตาเท่า desktop (สืบทอด padding/avatar/font จาก base) */
  .support-chat-nudge {
    right: clamp(.8rem, 3vw, 1.05rem);
    bottom: calc(66px + .8rem + env(safe-area-inset-bottom, 0px));
    max-width: min(260px, calc(100vw - 2.1rem));
  }
}
[data-theme-toggle] .theme-icon {
  display: none;
}
[data-theme-toggle][data-theme-current="dark"] .theme-icon--sun,
[data-theme-toggle][data-theme-current="light"] .theme-icon--moon {
  display: inline-block;
}
html[data-theme="light"] .quick-actions__item {
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(244,239,252,.98));
  border-color: rgba(124,95,214,.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 8px 18px rgba(var(--shadow-ink),.09);
}
html[data-theme="light"] .quick-actions__item:hover,
html[data-theme="light"] .quick-actions__item:focus-visible {
  background: linear-gradient(180deg, #ffffff, #f1ecfa);
  border-color: rgba(124,95,214,.36);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 0 0 3px rgba(124,95,214,.1), 0 10px 20px rgba(var(--shadow-ink),.11);
}
@media (max-width: 1023px) {
  .quick-actions {
    display: none;
  }

  /* ===== Support chat = bottom sheet บนมือถือ (เปิดจากปุ่มแชทใน bottom nav) ===== */
  /* ชีต + backdrop จบเหนือ bottom nav (สูง 72px) → nav ยังสว่างและกดสลับแท็บได้ */
  .support-chat {
    right: 0;
    left: 0;
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));  /* = ความสูงจริงของ nav (52 + .45rem×2) */
    top: 0;
    width: auto;
    z-index: 9100;
    display: flex;
    align-items: flex-end;
  }
  /* backdrop มืดบางๆ — แตะเพื่อปิด (จัดการใน support-chat.js) */
  .support-chat::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    opacity: 0;
    transition: opacity .28s ease;
  }
  .support-chat--open::before {
    animation: support-sheet-backdrop-in .2s ease both;
  }
  /* ปัดปิด: ฉากหลังค่อยๆจางออกพร้อม panel (override animation ตอนเปิด) */
  .support-chat--closing::before {
    animation: none !important;
    opacity: 0;
  }
  @keyframes support-sheet-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  .support-chat__panel {
    position: relative;
    width: 100%;
    /* เว้นแถบมืดด้านบนเสมอ และไม่ล้นพื้นที่เหนือ nav */
    height: min(80vh, calc(100vh - 66px - env(safe-area-inset-bottom, 0px) - 2rem));
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
  }
  /* drag-handle (═══) ด้านบน — เป็นภาพบอกใบ้ว่าปัดได้ (ยังไม่ผูก gesture) */
  .support-chat__panel::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 50%;
    transform: translateX(-50%);
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: var(--border-strong);
    z-index: 1;
  }
  .support-chat__header {
    padding-top: 1.05rem;     /* เว้นที่ให้ drag-handle */
  }
  /* เลื่อนขึ้นจากล่างแทน fade เดิม — backwards (ไม่ใช่ both) ไม่งั้น keyframe จะค้าง
     transform:translateY(0) override inline transform ตอนลาก/slide-down */
  .support-chat--open .support-chat__panel {
    animation: support-sheet-in .24s cubic-bezier(.2,.8,.2,1) backwards;
  }
  @keyframes support-sheet-in {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  html[data-theme="light"] .support-chat::before {
    background: rgba(32, 24, 45, .4);
  }
}

/* สกอร์บาร์บาง โทนเดียวกับเว็บ (ใช้ร่วมกับ checkout / wallet) */
.ui-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
.ui-scrollbar::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.ui-scrollbar::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: var(--radius-full);
}
.ui-scrollbar::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--radius-full);
}
.ui-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* Wallet - compact angular chip */
.wallet-cluster {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  background: rgba(168, 85, 247, .08);
  border: 1px solid rgba(168, 85, 247, .24);
  border-radius: 8px;
  overflow: hidden;
  padding-right: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease, transform var(--dur-fast) ease;
}
.wallet-cluster:hover {
  background: rgba(168, 85, 247, .12);
  border-color: rgba(216, 180, 254, .46);
  transform: translateY(-1px);
}
.wallet-mini {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: .38rem .68rem .38rem .82rem;
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
}
.wallet-amount-mini { color: #ffffff; white-space: nowrap; }
.wallet-topup-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-height: 34px;
  margin: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 0;
  color: #fff !important;
  font-size: 1.1rem;
  text-decoration: none;
  transition: background var(--dur-fast) ease, filter var(--dur-fast) ease;
}
.wallet-topup-btn:hover {
  filter: brightness(1.1);
  color: #fff;
}
/* User — avatar + ไอคอนเมนู (chevron) */
.user-chip-block {
  display: inline-flex; align-items: center;
}
.user-chip {
  display: inline-flex; align-items: center; justify-content: center;
  position: relative; cursor: pointer;
}
.user-chip.avatar-only {
  width: 36px; height: 36px; padding: 0;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 50%; transition: border-color .15s, transform .15s;
}
.user-chip.avatar-only:hover { border-color: var(--primary); transform: translateY(-1px); }
.user-chip img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar-fallback {
  width: 100%; height: 100%; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: inline-flex;
  align-items: center; justify-content: center; color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.16);
}
.avatar-fallback__letter {
  font-family: var(--font-display);
  font-size: .92rem;
  font-weight: 600;
  line-height: 1;
}
.user-chip-menu-indicator {
  position: absolute; right: -1px; bottom: -1px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); line-height: 0;
  pointer-events: none;
}
.user-chip-menu-indicator .icon-svg {
  transition: transform var(--dur-fast) ease;
}
.user-chip.avatar-only:hover .user-chip-menu-indicator { border-color: var(--primary); color: var(--text); }
.user-chip.avatar-only:hover .user-chip-menu-indicator .icon-svg,
.user-chip.avatar-only:focus-within .user-chip-menu-indicator .icon-svg {
  transform: rotate(180deg);
}

.user-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: .4rem;
  min-width: 200px; display: none; flex-direction: column;
  box-shadow: var(--shadow); z-index: 10;
}
.user-chip:hover .user-menu, .user-chip:focus-within .user-menu { display: flex; }
.user-menu-name {
  padding: .55rem .8rem .35rem; font-weight: 600;
  color: var(--text); font-size: .92rem;
  border-bottom: 1px solid var(--border); margin-bottom: .25rem;
}
.user-menu a,
.user-menu-theme,
.user-menu-logout button {
  display: flex; align-items: center; gap: .55rem;
  padding: .5rem .8rem; border-radius: 9px;
  color: var(--text); font-size: .92rem;
}
.user-menu-logout { margin: 0; }
.user-menu-theme,
.user-menu-logout button {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}
.user-menu a:hover,
.user-menu-theme:hover,
.user-menu-logout button:hover { background: var(--bg-3); color: var(--primary); }
.user-menu-icon { flex-shrink: 0; color: var(--muted); }
.user-menu a:hover .user-menu-icon,
.user-menu-theme:hover .user-menu-icon,
.user-menu-logout button:hover .user-menu-icon { color: var(--primary); }
.theme-toggle--drawer {
  gap: .45rem;
  justify-content: center;
}
.theme-icon[hidden] {
  display: none !important;
}

.mobile-toggle {
  display: none; align-items: center; justify-content: center;
  background: transparent; color: var(--text); border: 0;
  padding: .25rem; cursor: pointer; line-height: 0;
}
.mobile-toggle:hover { color: var(--primary); }

/* Storefront mobile mode ทั้งชุดสลับที่ ≤1023 (1024 ขึ้นไป = desktop): hamburger + search เต็มกว้าง + drawer + bottom-nav + chat/toast
   821–1023 ช่องเสิร์ช desktop ถูกบีบจนใช้ไม่ได้ จึงเป็น mobile ทั้งหมด (bottom-nav มาด้วย ตามที่ผู้ใช้เลือก) */
@media (max-width: 1023px) {
  .header-inner {
    grid-template-columns: auto 1fr auto;
    gap: .5rem;
    padding: .55rem .85rem;
  }
  .main-nav { display: none; }
  /* เมนูหลักถูกซ่อนบนมือถือ → เมนูเควสไปอยู่ในลิ้นชักแฮมเบอร์เกอร์ ผู้ใช้เลยไม่เห็น
     แถบนี้จึงเป็นทางเดียวที่ประกาศของใหม่ให้เห็นทันทีโดยไม่ต้องกดอะไรก่อน */
  .quest-announce {
    display: block;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
  }
  .quest-announce__row {
    display: flex; align-items: center; gap: .5rem;
    padding: .5rem .85rem;
    font-size: var(--fs-sm); font-weight: 500;
  }
  .quest-announce__link {
    display: flex; align-items: center; gap: .4rem;
    color: #fff; flex: 1; min-width: 0;
  }
  .quest-announce__link:hover { color: #fff; }
  .quest-announce__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .quest-announce__tag {
    background: rgba(255, 255, 255, .22);
    font-size: 9px; font-weight: var(--fw-bold); letter-spacing: .04em;
    padding: 1px 5px; border-radius: var(--radius-full);
    flex-shrink: 0;
  }
  .quest-announce__close {
    background: transparent; border: 0; color: #fff;
    font-size: 18px; line-height: 1; padding: 0 .25rem;
    flex-shrink: 0; opacity: .85;
  }
  .header-left {
    min-width: 0;
  }
  .header-right-cluster {
    justify-self: stretch;
    justify-content: flex-end;
    gap: .45rem;
    padding-left: 0;
  }
  .nav-search-wrap { flex: 1 1 auto; }
  .header-right {
    min-width: 0;
    gap: .45rem;
  }
  .mobile-toggle {
    display: inline-flex;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--bg-3);
  }
  .site-header--guest .header-inner {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }
  .site-header--guest .brand {
    max-width: 116px;
    min-width: 0;
  }
  .site-header--guest .brand-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .site-header--guest .nav-search-wrap,
  .site-header--guest .nav-cart-icon {
    display: none;
  }
  .site-header--guest .header-right .btn-sm {
    padding: .42rem .62rem;
    font-size: .8rem;
    white-space: nowrap;
  }
  .site-header--user .brand {
    width: 36px;
    height: 38px;
    justify-content: center;
    gap: 0;
  }
  .site-header--user .brand-text,
  .site-header--user .nav-cart-icon,
  .site-header--user .wallet-cluster,
  .site-header--user .user-chip-block {
    display: none;
  }
  .site-header--user .nav-search-wrap {
    display: flex;
  }
  .site-header--user .nav-search-inner {
    padding: 0 .7rem 0 .62rem;
  }
  .site-header--user .nav-search input[type="search"] {
    padding: .48rem 0;
    font-size: .86rem;
  }
  .site-header--user .customer-notif__btn {
    width: 38px;
    height: 38px;
  }
}

/* ============ Mobile drawer ============ */
.mobile-drawer {
  position: fixed; inset: 0;
  z-index: 1500;
  pointer-events: none;
}
.mobile-drawer[hidden] { display: none; }
.mobile-drawer.is-open { pointer-events: auto; }

.mobile-drawer__backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity var(--dur-base) ease;
}
.mobile-drawer.is-open .mobile-drawer__backdrop {
  opacity: 1;
}

.mobile-drawer__panel {
  position: absolute; top: 0; left: 0; bottom: 0;
  width: min(320px, 86vw);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  box-shadow: 8px 0 30px rgba(var(--shadow-ink),.5);
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform .3s var(--ease-out);
  overflow-y: auto;
}
.mobile-drawer.is-open .mobile-drawer__panel {
  transform: translateX(0);
}

.mobile-drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}
.mobile-drawer__head .brand { font-size: var(--fs-lg); }
.mobile-drawer__close {
  width: 36px; height: 36px;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text);
  font-size: 1.4rem; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast) ease, transform var(--dur-fast) ease;
}
.mobile-drawer__close:hover {
  background: var(--danger-soft); color: var(--danger);
  transform: rotate(90deg);
}

.mobile-drawer__user {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft));
  border-bottom: 1px solid var(--border);
}
.mobile-drawer__avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--bg-3);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  font-size: 1.4rem;
  flex-shrink: 0;
  border: 2px solid var(--primary);
}
.mobile-drawer__avatar img { width: 100%; height: 100%; object-fit: cover; }
.mobile-drawer__user-name {
  font-weight: var(--fw-semibold);
  color: var(--text);
}
.mobile-drawer__user-balance {
  color: var(--muted); font-size: var(--fs-sm);
}
.mobile-drawer__user-balance strong { color: var(--success); }

.mobile-drawer__nav {
  display: flex; flex-direction: column;
  padding: var(--space-3) var(--space-3);
}
.mobile-drawer__nav a {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  color: var(--text);
  border-radius: var(--radius);
  transition: background var(--dur-fast) ease;
}
.mobile-drawer__nav a:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
.mobile-drawer__nav a > .lucide {
  flex-shrink: 0;
  color: var(--muted);
  transition: color var(--dur-fast) ease;
}
.mobile-drawer__nav a:hover > .lucide { color: var(--primary); }
.mobile-category-menu {
  margin: 0;
}
.mobile-category-menu summary {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  color: var(--text);
  border-radius: var(--radius);
  list-style: none;
  cursor: pointer;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.mobile-category-menu summary::-webkit-details-marker {
  display: none;
}
.mobile-category-menu summary:hover,
.mobile-category-menu[open] summary {
  background: var(--primary-soft);
  color: var(--primary);
}
.mobile-category-menu summary > .lucide:first-child {
  color: var(--muted);
}
.mobile-category-menu[open] summary > .lucide:first-child,
.mobile-category-menu summary:hover > .lucide:first-child {
  color: var(--primary);
}
.mobile-category-menu__chevron {
  margin-left: auto;
  transition: transform var(--dur-fast) ease;
}
.mobile-category-menu[open] .mobile-category-menu__chevron {
  transform: rotate(180deg);
}
.mobile-category-menu__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 4px 1.75rem;
  padding-left: .45rem;
  border-left: 1px solid var(--border);
}
.mobile-category-menu__list a {
  padding: .55rem .75rem;
  border-radius: 9px;
  font-size: var(--fs-sm);
}
.mobile-category-menu__image,
.mobile-category-menu__emoji {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 22px;
}
.mobile-category-menu__image {
  overflow: hidden;
  border-radius: 7px;
  background: rgba(255,255,255,.06);
}
.mobile-category-menu__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mobile-drawer__badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs); font-weight: var(--fw-bold);
  padding: 2px 8px;
  min-width: 20px;
  text-align: center;
}
.mobile-drawer__nav--secondary a {
  color: var(--muted);
  font-size: var(--fs-sm);
}
.mobile-drawer__sep {
  height: 1px;
  background: var(--border);
  margin: 0 var(--space-5);
}

.mobile-drawer__foot {
  margin-top: auto;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: var(--space-2);
}
.mobile-logout-form { margin: 0; }
.mobile-logout-form button { width: 100%; font: inherit; }

/* lock body scroll when drawer open */
body.drawer-open {
  overflow: hidden;
}

/* hide drawer ที่ desktop (>720px) แม้จะมี is-open */
@media (min-width: 1024px) {
  .mobile-drawer { display: none !important; }
}

.mobile-bottom-nav {
  display: none;
}

/* sticky footer: ดันให้ footer อยู่ล่างสุดเสมอเมื่อเนื้อหาสั้น (ทุกขนาดจอ) */
body:has(.mobile-bottom-nav) {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
body:has(.mobile-bottom-nav) > main {
  flex: 1 0 auto;
  /* flex item ที่มี margin:auto จะหดเป็น shrink-to-fit — บังคับเต็มความกว้างไว้
     แล้วปล่อยให้ max-width เดิมของ main (.container = 1200px) เป็นตัว cap เอง */
  width: 100%;
}

@media (max-width: 1023px) {
  /* มือถือ: เผื่อที่ให้ fixed bottom-nav + cap main กัน overflow แนวนอน
     (main เป็น flex item: min-width:auto จะขยายตาม page-title/filter-bar ที่ไม่ wrap) */
  body:has(.mobile-bottom-nav) {
    padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px));
  }
  body:has(.mobile-bottom-nav) > main {
    min-width: 0;
    max-width: 100%;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1200;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    padding: .45rem .35rem calc(.45rem + env(safe-area-inset-bottom, 0px));
    background: rgba(15, 15, 20, .94);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(14px);
    box-shadow: 0 -10px 28px rgba(var(--shadow-ink), .28);
  }

  .mobile-bottom-nav a,
  .mobile-bottom-nav__chat {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .2rem;
    min-width: 0;
    min-height: 52px;
    border-radius: var(--radius);
    color: var(--muted);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
  }

  .mobile-bottom-nav__chat {
    border: 0;
    background: transparent;
    font-family: inherit;
    cursor: pointer;
  }

  .mobile-bottom-nav a.is-active,
  .mobile-bottom-nav a:hover,
  .mobile-bottom-nav__chat:hover {
    color: var(--text);
    background: var(--primary-soft);
  }

  .mobile-bottom-nav a.is-active .lucide {
    color: var(--primary);
  }

  .mobile-bottom-nav__icon {
    position: relative;
    display: inline-flex;
    line-height: 0;
  }

  .mobile-bottom-nav__badge {
    position: absolute;
    top: -8px;
    right: -10px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: #fff;
    font-size: .68rem;
    font-weight: var(--fw-bold);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 2px var(--bg);
  }
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem 1.3rem; border-radius: var(--radius);
  font-weight: 600; font-family: inherit; font-size: 1rem;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .15s, box-shadow .2s, background .2s;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.97); transition-duration: 60ms; }
.btn-primary {
  background: linear-gradient( 90deg, #6E47CE 0%, #9D6BE1 60%, #D39BE8 100% );
  background-clip: padding-box;
  color: #fff;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: none;
}
.btn-primary:hover {
  background-image: linear-gradient(
    90deg, #6E47CE 0%, #9D6BE1 50%, #D39BE8 100%
  );
  color: #fff;
  box-shadow: 0 8px 18px rgba(139, 92, 246, .24), 0 0 12px rgba(216, 180, 254, .16);
}
.btn-ghost { background: var(--bg-3); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--border); color: var(--text); }
.btn-discord {
  background: rgba(255,255,255,.95);
  color: #111827;
  box-shadow: none;
}
.btn-discord svg {
  color: #5865F2;
}
.btn-discord:hover { background: rgba(255,255,255,.95); color: #111827; box-shadow: 0 6px 16px rgba(88,101,242,.24); }
.btn-google {
  background: rgba(255,255,255,.96);
  color: #111827;
  border-color: rgba(255,255,255,.16);
  box-shadow: none;
}
.btn-google:hover {
  background: #fff;
  color: #111827;
  box-shadow: 0 6px 16px rgba(255,255,255,.08), 0 6px 16px rgba(var(--shadow-ink),.18);
}
.google-mark {
  display: inline-block;
  flex: 0 0 auto;
}
.icon-discord { display: inline-block; vertical-align: -3px; margin-right: 6px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-disabled { background: var(--bg-3); color: var(--muted); cursor: not-allowed; }
.btn-sm { padding: .4rem .8rem; font-size: .88rem; }
.btn-lg { padding: .95rem 1.8rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-rounded-full { border-radius: var(--radius-full); }
.btn-icon {
  width: 2.25rem;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0;
}
.btn-icon.btn-sm {
  width: 2rem;
  min-width: 2rem;
  height: 2rem;
  padding: 0;
}

/* ============ Hero ============ */
.hero {
  padding: 4rem 0 3rem;
  background:
    radial-gradient(800px 400px at 80% -20%, rgba(167,139,250,.3), transparent),
    radial-gradient(600px 300px at 10% 0%, rgba(168,85,247,.25), transparent);
  text-align: center;
  overflow: hidden;
}
.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.5rem); margin: 0 0 1rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { font-size: 1.15rem; color: var(--muted); margin: .5rem 0; }
.hero-cta { display: flex; gap: 1rem; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }

/* Homepage banner — placed in normal hero flow, constrained to content width */
.hero-banner-full {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  line-height: 0;
}
.hero-banner-full::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(15,15,20,.48), rgba(15,15,20,.66)),
    radial-gradient(circle at 50% 24%, rgba(15,15,20,.2), rgba(15,15,20,.72) 70%);
  pointer-events: none;
}
.hero-banner-full img {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
  border-radius: inherit;
  transition: filter .3s ease;
}
.hero-banner-link {
  display: block;
  text-decoration: none;
  line-height: 0;
  border-radius: inherit;
  height: 100%;
}
.hero-banner-link:hover img {
  filter: brightness(1.05);
}

/* Split hero — text left, banner right */
.hero-split { padding: 3.5rem 0 3rem; text-align: left; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: center;
  gap: 2.5rem;
}
.hero-split .hero-title {
  font-size: clamp(2rem, 4.4vw, 3.2rem);
  line-height: 1.15;
  margin: 0 0 1rem;
}
.hero-split .hero-sub { margin: .35rem 0; }
.hero-split .hero-cta {
  justify-content: flex-start;
  margin-top: 1.5rem;
  align-items: center;
}
.hero-stat {
  display: inline-flex; align-items: center; gap: .45rem;
  color: var(--muted); font-size: .92rem;
}
.hero-stat-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34,197,94,.15);
}
.hero-banner {
  display: flex; justify-content: center; align-items: center;
  position: relative;
}
.hero-banner img {
  width: 100%; max-width: 520px; height: auto;
  filter: drop-shadow(0 20px 40px rgba(88,101,242,.25)) drop-shadow(0 8px 24px rgba(168,85,247,.15));
  animation: hero-float 6s ease-in-out infinite;
}
@keyframes hero-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-banner img { animation: none; }
}
@media (max-width: 820px) {
  .hero-split { padding: 2.5rem 0 2rem; text-align: center; }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .hero-split .hero-cta { justify-content: center; }
  .hero-banner { order: -1; }
  .hero-banner img { max-width: 360px; }
}
@media (max-width: 480px) {
  .hero-banner img { max-width: 280px; }
}

/* ============ Products ============ */
.page-title { margin: 2rem 0 1.5rem; }
.section-title { margin: 2rem 0 1rem; }
@media (max-width: 720px) {
  .section-title {
    font-size: 1.28rem;
    line-height: 1.28;
    margin: 1.5rem 0 .8rem;
  }
  .section-title .lucide {
    width: 18px;
    height: 18px;
  }
}

/* ===== Filter button + popover (Sprint E — replaces shop-toolbar) ===== */
.category-bar-wrap {
  display: flex; align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
  min-width: 0;
}
.category-bar-wrap > .category-bar {
  flex: 1 1 auto;
  margin-top: 0;
  min-width: 0;
}

.filter-popover-wrap {
  position: relative;
  flex-shrink: 0;
}
.filter-btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text);
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
  cursor: pointer;
  transition: all var(--dur-fast) ease;
  white-space: nowrap;
}
.filter-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}
.filter-btn.has-active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}
.filter-btn[aria-expanded="true"] {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}
.filter-btn__icon { display: block; flex-shrink: 0; }
.filter-btn__badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs); font-weight: var(--fw-bold);
  margin-left: var(--space-1);
}

.filter-popover {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  min-width: 260px;
  max-width: calc(100vw - 2rem);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 50px rgba(var(--shadow-ink),.55);
  z-index: 200;
  overflow: hidden;
  animation: filter-pop-in .18s var(--ease-out);
}
.filter-popover[hidden] { display: none; }
@keyframes filter-pop-in {
  from { opacity: 0; transform: translateY(-6px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.filter-popover__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--bg-3);
}
.filter-popover__close {
  background: none; border: 0;
  color: var(--muted);
  font-size: 1.4rem; line-height: 1; cursor: pointer;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.filter-popover__close:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.filter-popover__section {
  padding: var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--border);
}
.filter-popover__section:last-of-type { border-bottom: 0; }
.filter-popover__section-title {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 0 var(--space-3);
  margin-bottom: var(--space-2);
}
.filter-popover__options {
  display: flex; flex-direction: column;
}
.filter-popover__opt {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: var(--fs-sm);
  transition: background var(--dur-fast) ease;
}
.filter-popover__opt:hover {
  background: var(--bg-3);
  color: var(--text);
}
.filter-popover__opt.is-active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: var(--fw-semibold);
}
.filter-popover__opt-check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border-radius: 4px;
  border: 1.5px solid var(--border);
  background: var(--bg-3);
  font-size: 11px; font-weight: var(--fw-bold);
  color: transparent;
  flex-shrink: 0;
  transition: all var(--dur-fast) ease;
}
.filter-popover__opt.is-active .filter-popover__opt-check {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.filter-popover__foot {
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--border);
  background: var(--bg-3);
  text-align: center;
}
.filter-popover__clear {
  color: var(--muted);
  font-size: var(--fs-sm);
  padding: var(--space-2);
  display: inline-block;
  transition: color var(--dur-fast) ease;
}
.filter-popover__clear:hover { color: var(--primary); }

@media (max-width: 600px) {
  .filter-btn__label { display: none; }  /* แสดงแค่ icon บน mobile */
  .filter-btn { padding: var(--space-2); width: 38px; height: 38px; justify-content: center; }
  .filter-popover {
    min-width: 240px;
    right: 0;
  }
}

@media (max-width: 620px) {
  .product-grid:not(.product-grid--weekly-featured) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
  }
  .product-grid:not(.product-grid--weekly-featured) .product-body {
    padding: .7rem .72rem .8rem;
    gap: .28rem;
  }
  .product-grid:not(.product-grid--weekly-featured) .product-name {
    font-size: .88rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .product-grid:not(.product-grid--weekly-featured) .product-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: .18rem;
    padding-top: .35rem;
  }
  .product-grid:not(.product-grid--weekly-featured) .product-price {
    font-size: 1rem;
  }
  .product-grid:not(.product-grid--weekly-featured) .product-stock {
    font-size: .72rem;
    line-height: 1.25;
  }
  .product-grid:not(.product-grid--weekly-featured) .product-tag {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Featured section title — โดดเด่นกว่าปกติด้วย gradient + icon glow */
.section-title--featured {
  display: flex; align-items: center; gap: var(--space-3);
  margin-top: var(--space-6);
  font-size: var(--fs-xl);
  position: relative;
  padding-bottom: var(--space-3);
}
.section-title--featured::after {
  content: ""; position: absolute; bottom: 0; left: 0;
  width: 64px; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: var(--radius-full);
}
.section-title-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft));
  border: 1px solid rgba(168,85,247,.24);
  border-radius: 50%;
  font-size: 1.15rem;
  box-shadow: 0 0 14px rgba(168,85,247,.16);
  animation: none;
}
@keyframes featured-glow {
  0%, 100% { box-shadow: 0 0 14px rgba(168,85,247,.16); }
  50% { box-shadow: 0 0 18px rgba(168,85,247,.22); }
}
@media (prefers-reduced-motion: reduce) {
  .section-title-icon { animation: none; }
}

/* Featured grid — เน้น visual: ขอบชมพูเรืองแสง slight scale on hover */
.product-grid--featured .product-card {
  position: relative;
  border: 1px solid rgba(168,85,247,.3);
  background: linear-gradient(180deg, var(--primary-soft) 0%, var(--bg-2) 30%);
  box-shadow: 0 4px 20px rgba(168,85,247,.12);
}
.product-grid--featured .product-card::before {
  content: ""; position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, transparent 60%, rgba(168,85,247,.08) 100%);
  pointer-events: none;
  z-index: 1;
}

.category-bar {
  display: flex; gap: .45rem; overflow-x: auto; padding: .25rem .25rem .5rem;
  margin-top: 1rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
}
.category-bar:active { cursor: grabbing; }
.category-bar::-webkit-scrollbar { display: none; height: 0; width: 0; }
.chip {
  background: var(--bg-3); padding: .38rem .85rem; border-radius: 999px;
  border: 1px solid var(--border); white-space: nowrap;
  transition: all var(--dur-fast) var(--ease-out); font-size: .85rem; line-height: 1.2;
  flex-shrink: 0;
}
.chip:hover, .chip.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border-color: transparent;
  transform: translateY(-1px);
}
.chip:active:not(.active) { transform: translateY(0) scale(.96); transition-duration: 60ms; }

.product-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem; margin-top: 1rem;
}

/* ===== แถบ "สินค้าแนะนำ" หน้าแรก: เลื่อนอัตโนมัติ (JS) + ปัด/ลากเองได้ ===== */
.product-marquee {
  margin-top: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;            /* Firefox */
  -ms-overflow-style: none;         /* IE/Edge เก่า */
  overscroll-behavior-x: contain;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 2.5%, #000 97.5%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 2.5%, #000 97.5%, transparent 100%);
}
.product-marquee::-webkit-scrollbar { display: none; }
.product-marquee__track {
  display: flex;
  align-items: stretch;
  gap: 1.25rem;
  width: max-content;
  /* เผื่อพื้นที่ให้เงา/การยกตอน hover ไม่โดน overflow ตัด */
  padding: .45rem .15rem 1.25rem;
}
.product-marquee .product-card-wrap {
  width: 240px;
  flex: 0 0 240px;
}
@media (max-width: 620px) {
  .product-marquee__track { gap: .85rem; }
  .product-marquee .product-card-wrap { width: 165px; flex: 0 0 165px; }
}
/* หัวข้อของแต่ละแถวแนะนำหน้าแรก — แถวที่ 2 ขึ้นไปเว้นระยะจากแถวก่อนหน้า */
.home-row-heading + .product-marquee { margin-top: .5rem; }
.product-marquee + .home-row-heading { margin-top: 1.5rem; }
.product-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: transform var(--dur-base) var(--ease-out), border-color var(--dur-base) ease, box-shadow var(--dur-base) ease;
  display: flex; flex-direction: column;
}
.product-card:hover {
  transform: translateY(-4px); border-color: var(--primary);
  box-shadow: 0 12px 30px rgba(168,85,247,.2);
}
.product-card:active {
  transform: translateY(-2px) scale(.99);
  transition-duration: var(--dur-fast);
}
.product-image {
  aspect-ratio: 1.2 / 1; background: var(--bg-3);
  position: relative; overflow: hidden;
}
.product-image img {
  width: 100%; height: 100%; object-fit: cover;
}
/* hover zoom + GPU compositing rules อยู่ใน skeleton block ด้านล่าง (รวมกับ opacity transition) */
@media (prefers-reduced-motion: reduce) {
  .product-card, .product-card:hover { transform: none !important; }
}
.image-default {
  width: 100%; height: 100%; object-fit: cover;
}
.image-default-big {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius);
}
.image-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, var(--bg-3), var(--bg-2));
}
.image-placeholder.big { font-size: 6rem; aspect-ratio: 1; }
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .25rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600;
  line-height: 1.1; white-space: nowrap; vertical-align: middle;
}
.product-image .badge {
  position: absolute; top: .6rem; right: .6rem;
}
.badge-out { background: var(--danger); color: #fff; }
.badge-low { background: var(--warn); color: #111; }
.badge-success { background: rgba(34,197,94,.16); color: #bbf7d0; border: 1px solid rgba(34,197,94,.34); }
.badge-muted { background: rgba(148,163,184,.12); color: var(--muted); border: 1px solid rgba(148,163,184,.24); }

.product-body { padding: .78rem .95rem .85rem; display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.product-name { font-size: 1rem; margin: 0; font-weight: 600; line-height: 1.3; color: var(--text); }
.product-tags {
  display: flex; flex-wrap: wrap; gap: .3rem;
  margin: .15rem 0 .1rem;
}
.product-tag {
  display: inline-flex; align-items: center; gap: .2rem;
  font-size: .68rem; font-weight: 500; line-height: 1;
  padding: .22rem .5rem; border-radius: 999px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  color: var(--muted);
  letter-spacing: .01em;
}
.product-tag.cat { background: rgba(168,85,247,.07); border-color: rgba(168,85,247,.18); }
.product-tag.sub { background: rgba(56,189,248,.08); border-color: rgba(56,189,248,.22); }
/* คอลเลคชั่น: สีเทาเริ่มต้น — ถ้ามี tag_color ในแอดมินจะใช้ inline style ทับ */
.product-tag.col { background: rgba(148,163,184,.12); border-color: rgba(148,163,184,.28); }
.product-footer {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: auto; padding-top: .42rem;
}
.product-price { font-size: 1.2rem; font-weight: 600; color: var(--primary); }
.product-price-line {
  display: flex;
  align-items: baseline;
  gap: .34rem;
  flex-wrap: wrap;
  min-width: 0;
}
.product-price-original {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 500;
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  white-space: nowrap;
}
.product-discount-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.22rem;
  padding: .14rem .4rem;
  border-radius: 6px;
  border: 1px solid rgba(192, 132, 252, .38);
  background: rgba(168, 85, 247, .16);
  color: #d8b4fe;
  font-size: .72rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.product-discount-badge--corner {
  display: none;
  position: absolute;
  top: .5rem;
  left: .5rem;
  z-index: 4;
  min-height: 1.35rem;
  padding: .2rem .48rem;
  border-radius: 999px;
  background: rgba(168, 85, 247, .82);
  color: #fff;
  box-shadow: 0 6px 14px rgba(var(--shadow-ink), .24);
}
/* การ์ดปกติ (ไม่ใช่สุดฮิตรายสัปดาห์): badge ส่วนลดไปมุมขวาบนของรูป แทน badge ในแถวราคา — ทุกจอ */
.product-grid:not(.product-grid--weekly-featured) .product-image .product-discount-badge--corner {
  display: inline-flex;
  left: auto;
  right: .5rem;
}
.product-grid:not(.product-grid--weekly-featured) .product-price-line > .product-discount-badge:not(.product-discount-badge--corner) {
  display: none;
}
/* การ์ดสุดฮิตรายสัปดาห์: คงเดิม — corner badge (ซ้ายบน) เฉพาะมือถือ, จอปกติใช้ badge ในแถวราคา */
@media (max-width: 620px) {
  .product-grid--weekly-featured .product-image .product-discount-badge--corner {
    display: inline-flex;
  }
  .product-grid--weekly-featured .product-price-line > .product-discount-badge:not(.product-discount-badge--corner) {
    display: none;
  }
}
.product-stock { font-size: .8rem; color: var(--muted); }

/* ============ Product card — info style (ดาว·ขายแล้ว/วิธีส่ง + คงเหลือ + ปุ่มเพิ่มตะกร้า) ============ */
/* wrap: การ์ด (<a>) + ปุ่มตะกร้า (นอก <a>) อยู่ในกล่องเดียว เพื่อกดปุ่ม = add / กดการ์ด = ดูสินค้า */
.product-card-wrap { position: relative; display: flex; }
.product-card-wrap > .product-card { flex: 1 1 auto; min-width: 0; }
/* ยกทั้ง wrap ตอน hover เพื่อให้ปุ่มตะกร้าขยับตามการ์ด (ปุ่มอยู่นอก <a>) */
.product-card--info:hover, .product-card--info:active { transform: none; }
.product-card-wrap:hover { transform: translateY(-4px); transition: transform var(--dur-base) var(--ease-out); }
@media (prefers-reduced-motion: reduce) { .product-card-wrap:hover { transform: none; } }
.product-card--info .product-image,
.product-card--info .product-image:has(img.is-loaded) {
  aspect-ratio: 1 / 1;
  padding: 1rem;
  background: var(--bg-2);
}
.product-card--info .product-image img {
  border: 1px solid var(--bg-2);
  border-radius: var(--radius);
  object-fit: contain;
}
.product-card--info .product-body { gap: .4rem; }
/* แถวดาว/ขายแล้ว + คงเหลือ: ดันลงชิดล่างเสมอ (การ์ดสูงไม่เท่ากันก็ยังชิดเส้น ไม่ลอยขึ้น) */
.product-meta-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: .6rem; font-size: .72rem; color: var(--muted); margin-top: auto;
}
.product-meta-left { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-star { color: var(--warn); }
.product-stock-chip {
  display: inline-flex; align-items: center; gap: .34rem;
  white-space: nowrap; flex: 0 0 auto; color: var(--muted);
}
.product-stock-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto;
  background: var(--success);
  box-shadow: 0 0 6px color-mix(in srgb, var(--success) 70%, transparent);
}
/* ป้ายคงเหลือ: จอเล็กใช้ข้อความสั้น ("พร้อมส่ง") เพราะการ์ด 2 คอลัมน์ที่แคบ */
.stock-text-short { display: none; }
.product-stock-chip--low { color: var(--warn); }
.product-stock-chip--pre { color: var(--warn); }
.product-stock-chip--pre .product-stock-dot { background: var(--warn); box-shadow: none; }
.product-stock-chip--out { color: var(--muted); }
.product-stock-chip--out .product-stock-dot { background: var(--muted); box-shadow: none; }
/* แถวราคา: เส้นขีดคั่นด้านบน · ราคาเต็มอยู่ใต้ราคาขาย · เว้นที่ขวาให้ปุ่มตะกร้า */
/* min-height: จองที่ให้ปุ่มตะกร้า (สูง 38px + เว้นขอบ) ปุ่มจะได้ไม่เกยเส้นคั่น */
/* align-items: center → ไม่มีราคาเต็ม ราคาขายก็ยังอยู่กึ่งกลางแถว ไม่ลอยติดเส้น */
.product-card--info .product-footer {
  margin-top: 0; padding-top: .55rem; padding-bottom: .1rem; padding-right: 3rem;
  min-height: 2.9rem;
  border-top: 1px solid var(--border); align-items: center;
}
.product-pricewrap {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: .05rem; min-width: 0;
}
.product-card--info .product-price { font-size: 1.35rem; line-height: 1.15; }
.product-pricewrap .product-price-original { font-size: .78rem; line-height: 1.2; }
/* ปุ่มเพิ่มลงตะกร้า: มุมขวาล่างการ์ด, z สูงกว่า <a> — bottom เท่ากับ padding ล่างของ body เพื่อให้กึ่งกลางตรงกับแถวราคา */
.product-cart-btn {
  position: absolute; right: .8rem; bottom: .85rem; z-index: 2;
  width: 38px; height: 38px; border-radius: 11px; border: 0; cursor: pointer;
  display: grid; place-items: center; padding: 0;
  background: var(--primary); color: #fff;
  box-shadow: 0 6px 14px rgba(168, 85, 247, .3);
  transition: filter var(--dur-fast) ease, transform var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) ease;
}
.product-cart-btn:hover {
  /* กัน a:hover (บรรทัด ~275) ย้อมไอคอนเป็นสีม่วงจนกลืนพื้นหลัง — ปุ่มนี้เป็น <a> ตอนปิด quick-add */
  color: #fff;
  filter: brightness(1.08);
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 10px 20px rgba(168, 85, 247, .42);
}
.product-cart-btn:active {
  transform: translateY(0) scale(.92);
  box-shadow: 0 3px 8px rgba(168, 85, 247, .28);
  transition-duration: var(--dur-fast);
}
/* ไอคอนเอียงเล็กน้อยตอน hover — ให้รู้สึกว่ารถเข็นขยับ */
.product-cart-btn svg { transition: transform var(--dur-base) var(--ease-out); }
.product-cart-btn:hover svg { transform: translateX(1.5px) rotate(-8deg); }
.product-cart-btn:active svg { transform: translateX(0) rotate(0); }
/* ระหว่างยิง AJAX: เต้นเบา ๆ บอกว่ากำลังทำงาน */
.product-cart-btn.is-busy {
  pointer-events: none;
  animation: cart-btn-busy .8s ease-in-out infinite;
}
@keyframes cart-btn-busy {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .55; transform: scale(.9); }
}
@media (prefers-reduced-motion: reduce) {
  .product-cart-btn, .product-cart-btn svg { transition: none; }
  .product-cart-btn:hover, .product-cart-btn:active { transform: none; }
  .product-cart-btn:hover svg { transform: none; }
  .product-cart-btn.is-busy { animation: none; opacity: .7; }
}
.product-cart-btn.is-out { background: var(--bg-3); color: var(--muted); box-shadow: none; }
/* สินค้าหมด: ปุ่มนิ่ง ไม่ยก ไม่ขยาย ไอคอนไม่เอียง — สื่อว่าไม่ใช่ปุ่มซื้อ */
.product-cart-btn.is-out:hover,
.product-cart-btn.is-out:active { transform: none; filter: none; }
.product-cart-btn.is-out:hover svg,
.product-cart-btn.is-out:active svg { transform: none; }
.product-card--info.is-out { opacity: .9; }
@media (max-width: 620px) {
  .product-meta-row { font-size: .68rem; }
  .stock-text-full { display: none; }
  .stock-text-short { display: inline; }
  .product-card--info .product-footer { padding-right: 2.6rem; min-height: 2.6rem; }
  /* กฎ .product-grid:not(--weekly-featured) .product-footer ด้านบน (specificity สูงกว่า)
     บังคับ column + flex-start — ทับการจัดกึ่งกลางของการ์ด info ต้อง override กลับ */
  .product-grid .product-card--info .product-footer {
    flex-direction: row;
    align-items: center;
  }
  .product-cart-btn { width: 34px; height: 34px; border-radius: 10px; right: .6rem; bottom: .85rem; }
}

/* ============ Product Detail ============ */
.breadcrumb { margin: 1.5rem 0 1rem; color: var(--muted); font-size: .95rem; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { display: inline-block; vertical-align: middle; margin: 0 .15rem; color: var(--muted); opacity: .65; }
.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem; margin-bottom: 2rem;
}
.detail-image img { border-radius: var(--radius); width: 100%; }
.detail-info h1 { margin: .4rem 0; font-size: 1rem; }
.detail-price { font-size: 1.8rem; font-weight: 600; color: var(--primary); margin: .5rem 0 1rem; }
.detail-price-line {
  display: flex;
  align-items: baseline;
  gap: .55rem;
  flex-wrap: wrap;
  margin: .35rem 0 .6rem;
}
.detail-price-line .detail-price { margin: 0; }
.product-price-original--detail { font-size: 1rem; }
.product-discount-badge--detail { font-size: .82rem; min-height: 1.45rem; padding: .2rem .52rem; }
.purchase-summary-price {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: .4rem;
  flex-wrap: wrap;
  min-width: 0;
}
.product-price-original--summary { font-size: .82rem; }
.product-discount-badge--summary { font-size: .72rem; }
.stock-info { margin: .5rem 0 1rem; }
.stock-ok { color: var(--success); }
.stock-out { color: var(--danger); }
.stock-msg { color: var(--muted); font-weight: 500; }
.detail-desc { margin: 1rem 0; color: var(--muted); }
.add-to-cart-form {
  display: flex; gap: 1rem; align-items: center;
  margin: 1.5rem 0;
}
.qty-input {
  display: flex; align-items: center;
  background: var(--bg-3); border-radius: var(--radius); border: 1px solid var(--border);
}
.qty-input button {
  background: transparent; border: 0; color: var(--text);
  padding: .7rem 1rem; cursor: pointer; font-size: 1.2rem;
}
.qty-input input {
  width: 60px; background: transparent; border: 0;
  color: var(--text); text-align: center; font-size: 1rem;
  -moz-appearance: textfield;
}
.qty-input input::-webkit-outer-spin-button,
.qty-input input::-webkit-inner-spin-button { -webkit-appearance: none; }

.trust-box {
  margin-top: 1.5rem; padding: 1rem;
  background: var(--bg-3); border-radius: var(--radius);
  display: flex; flex-direction: column; gap: .4rem;
}

@media (max-width: 1023px) {
  /* product detail เป็น mobile (1-col) ที่ ≤1023 ตรงกับ storefront chrome — รูปเต็มกว้าง + ย่อ container spacing
     (trust badges 3-col จึงกระจายเต็มแถว ไม่เบียดคอลัมน์แคบเหมือนตอน 2-col) */
  .detail-grid { grid-template-columns: 1fr; padding: 1rem; gap: 1.5rem; }
  .product-detail--v2 { padding-bottom: 1.2rem; }
  .product-detail--v2 .detail-grid--v2 {
    padding: 1rem 1rem 1.15rem;
    gap: 1rem;
    border-radius: 14px;
  }
  .detail-image-panel { border-radius: 12px; }
}

/* —— Product detail (mockup-style v2) —— */
.product-detail--v2 { padding-bottom: 2rem; }
.product-detail--v2 .detail-grid--v2 {
  background:
    radial-gradient(circle at 24% 4%, rgba(88, 59, 181, .14), transparent 34%),
    linear-gradient(150deg, rgba(10, 11, 21, .98) 0%, rgba(7, 9, 17, .98) 54%, rgba(9, 11, 20, .96) 100%);
  border: 1px solid rgba(77, 79, 110, .42);
  border-radius: 18px;
  padding: 1.75rem 1.5rem 2rem;
  gap: 2rem 2.5rem;
  box-shadow: 0 18px 45px rgba(var(--shadow-ink),.28), inset 0 1px 0 rgba(255,255,255,.035);
  align-items: start;
}
.detail-image--v2 { position: relative; }
.detail-image-panel {
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(12, 12, 25, .96) 0%, rgba(6, 8, 18, .98) 100%);
  border: 1px solid rgba(94, 83, 132, .36);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.035), 0 18px 38px rgba(var(--shadow-ink),.22);
}
.detail-image-panel img {
  width: 100%;
  display: block;
  border-radius: 0;
}
.detail-info--v2 { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.detail-meta-tags {
  display: flex; flex-wrap: wrap; gap: 0.45rem;
  margin-bottom: 0.25rem;
}
.product-tag--pill {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.3rem 0.7rem; border-radius: 999px;
  font-size: 0.78rem; font-weight: 600;
  color: var(--text);
}
.product-tag--pill.cat {
  background: rgba(168,85,247,.1); border-color: rgba(168,85,247,.25);
}
.product-tag--pill.sub {
  background: rgba(56,189,248,.1); border-color: rgba(56,189,248,.28);
}
.product-tag--pill.col {
  background: rgba(148,163,184,.12); border-color: rgba(148,163,184,.3);
  font-weight: 500;
  color: var(--muted);
}
.detail-info .detail-title { font-size: 1.75rem; font-weight: 600; line-height: 1.25; margin: 0.2rem 0 0.5rem; letter-spacing: -0.02em; }
.detail-desc--lead { color: #c2bed8; font-size: 0.98rem; line-height: 1.48; margin: 0.1rem 0 0.78rem; max-width: 42rem; }
.detail-desc--lead.rich-content p { margin-bottom: 0.24rem; }
.detail-desc--lead.rich-content p:last-child { margin-bottom: 0; }
/* ห้ามซ่อน <br> ที่ติดกัน — เคยมี `br + br { display: none }` ตรงนี้ ทำให้บรรทัดว่างที่แอดมิน
   เว้นไว้ไม่แสดงผล แม้ HTML จะถูกต้องแล้ว (เป็นตัวที่ทำให้ปัญหา "Enter หลายครั้งไม่ขึ้น" ไม่จบ) */
.chat-delivery-note {
  width: min(100%, 42rem);
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.05rem 0 0.95rem;
  padding: 1.02rem 1.15rem;
  border: 1px solid rgba(168, 85, 247, .32);
  border-radius: 12px;
  background:
    radial-gradient(100% 160% at 0% 0%, rgba(168, 85, 247, .18), transparent 46%),
    linear-gradient(180deg, rgba(31, 23, 56, .76), rgba(20, 16, 42, .82));
  color: #a855f7;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.045), 0 12px 24px rgba(var(--shadow-ink),.16);
}
.chat-delivery-note__icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #a855f7;
  filter: drop-shadow(0 0 8px rgba(168, 85, 247, .16));
}
.chat-delivery-note__copy {
  min-width: 0;
  display: grid;
  gap: 0.08rem;
  line-height: 1.28;
}
.chat-delivery-note__copy strong {
  color: #a855f7;
  font-size: 0.9rem;
  font-weight: 500;
}
.chat-delivery-note__copy span {
  color: rgba(168, 85, 247, .86);
  font-size: 0.8rem;
  font-weight: 500;
}
.detail-price--hero { font-size: 2.15rem; font-weight: 600; color: var(--primary); margin: 0.35rem 0 0.6rem; line-height: 1.1; }
.detail-price-hint { font-weight: 500; margin: 0.4rem 0 0.2rem; }
.stock-info--v2 { margin: 0.25rem 0 0.4rem; }
.btn-preview { align-self: flex-start; margin-top: 0.2rem; }

.nitro-section-label { font-size: .88rem; font-weight: 600; color: var(--muted); margin: 1rem 0 0.42rem; }
.nitro-pick--v2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
  margin: 0;
  padding: 0;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.nitro-pick-item--v2 {
  position: relative; display: block; margin: 0; cursor: pointer; /* user-select: none; */
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(14,19,29,.96), rgba(8,12,20,.96));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035), 0 10px 24px rgba(var(--shadow-ink),.18);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s, transform 0.12s;
  overflow: hidden;
}
.nitro-pick-item--v2:hover {
  border-color: rgba(148,163,184,.28);
  background: linear-gradient(180deg, rgba(17,23,35,.98), rgba(10,15,24,.98));
}
.nitro-pick-item--v2 input {
  position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;
}
.nitro-pick-item--v2 .nitro-pick-item__body {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .72rem .82rem;
  min-height: 3.1rem;
}
.nitro-pick-item--v2 .nitro-pick-item__text { min-width: 0; }
.nitro-pick-item--v2 .nitro-pick-item__title {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
  font-weight: 600; font-size: .88rem; color: var(--text);
  line-height: 1.3;
}
.badge-nitro-rec {
  font-size: 0.7rem; font-weight: 600; text-transform: none;
  padding: 0.15rem 0.5rem; border-radius: 6px;
  background: linear-gradient(135deg, var(--primary), #7e22ce);
  color: #fff;
  letter-spacing: 0.01em;
}
.nitro-pick-item--v2 .nitro-pick-item__sub {
  display: block;
  font-size: .72rem;
  color: var(--muted);
  margin-top: .18rem;
  font-weight: 500;
  line-height: 1.3;
}
.nitro-pick-item--v2 .nitro-pick-item__price {
  display: none;
}
.nitro-pick-item--v2.is-selected,
.nitro-pick-item--v2:has(input:checked) {
  border-color: rgba(192, 132, 252, .78);
  background:
    radial-gradient(120% 100% at 92% 0%, rgba(168,85,247,.28), transparent 58%),
    linear-gradient(180deg, rgba(43, 25, 68, .98), rgba(23, 15, 39, .98));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.07),
    0 0 0 1px rgba(168,85,247,.32),
    0 10px 24px rgba(var(--shadow-ink),.22),
    0 0 22px rgba(168,85,247,.22);
}
.nitro-pick-item--v2.is-selected .nitro-pick-item__sub,
.nitro-pick-item--v2:has(input:checked) .nitro-pick-item__sub {
  color: #d8c7ff;
}
.nitro-pick-item--v2:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.add-to-cart-form--v2 {
  display: flex; flex-direction: column; align-items: stretch;
  margin: 1.15rem 0 0.75rem; gap: 0;
}
.detail-purchase-controls {
  display: grid;
  gap: .58rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, .16);
}
.purchase-summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: .02rem 0 .22rem;
  border-bottom: 0;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 500;
}
.purchase-summary-total,
.purchase-summary-stock {
  display: inline-flex;
  align-items: baseline;
  min-width: 0;
  gap: .35rem;
  white-space: nowrap;
}
.purchase-summary-total {
  flex: 1 1 auto;
}
.purchase-summary-stock {
  flex: 0 0 auto;
  text-align: right;
}
.purchase-summary-row strong {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1;
  white-space: nowrap;
  text-shadow: none;
}
.purchase-summary-stock strong {
  color: var(--success);
  font-size: inherit;
  font-weight: inherit;
  text-shadow: none;
}
.purchase-summary-stock.is-ok strong {
  color: var(--success);
}
.purchase-summary-stock.is-low strong {
  color: var(--warn);
}
.purchase-summary-stock.is-critical strong {
  color: var(--danger);
}
.purchase-summary-stock.is-preorder strong {
  color: var(--accent, #7c5cff);
}
.purchase-summary-eta {
  display: flex;
  align-items: center;
  min-width: 0;
}
/* พรีออเดอร์: ให้ badge ETA ยืด/ยุบได้ และห่อลงบรรทัดใหม่บนจอแคบ ไม่ล้นขอบ */
.purchase-summary-row--preorder {
  flex-wrap: wrap;
  align-items: center;
  row-gap: .4rem;
}
.purchase-summary-row--preorder .purchase-summary-eta {
  flex: 1 1 auto;
}
.purchase-summary-row--preorder .purchase-summary-stock {
  margin-left: auto;
}
.preorder-eta-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  max-width: 100%;
  padding: .3rem .7rem;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
  color: #ddd6fe;
  background: rgba(124,92,255,.14);
  border: 1px solid rgba(124,92,255,.4);
}
.preorder-autodeliver-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin-top: .3rem;
  padding: .22rem .6rem;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 600;
  line-height: 1.2;
  color: #c4b5fd;
  background: rgba(124,92,255,.12);
  border: 1px solid rgba(124,92,255,.32);
}
.product-stock--preorder {
  color: var(--accent, #7c5cff);
  font-weight: 600;
}
@media (max-width: 480px) {
  .purchase-summary-row {
    gap: .7rem;
    font-size: .78rem;
  }
}
.detail-purchase-controls > .qty-input--v2 {
  width: 100%;
  height: 40px;
}
.detail-purchase-controls > .qty-input--v2 input {
  flex: 1;
  padding: 0;
  line-height: 1.1;
  font-weight: 600;
}
.detail-purchase-controls > .qty-input--v2 button {
  flex: 0 0 2.9rem;
  height: 100%;
  padding: 0;
  line-height: 1;
}
.detail-buy-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 0.75rem;
}
/* compound selector: ชนะ media query mobile ที่ประกาศ .detail-buy-row 2 คอลัมน์ (specificity สูงกว่า) */
.detail-buy-row.detail-buy-row--single {
  grid-template-columns: 1fr;
}
/* สินค้า 2-rate: เว้นระหว่างตัวเลือก Nitro กับแถวจำนวน/เพิ่มตะกร้า */
.add-to-cart-form--v2 .nitro-pick--v2 ~ .detail-purchase-controls {
  margin-top: 1.1rem;
}
.qty-input--v2 {
  border-radius: 10px;
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(14,19,29,.96), rgba(8,12,20,.96));
  border-color: rgba(148,163,184,.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035), 0 10px 24px rgba(var(--shadow-ink),.18);
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.qty-input--v2:hover {
  border-color: rgba(148,163,184,.28);
  background: linear-gradient(180deg, rgba(17,23,35,.98), rgba(10,15,24,.98));
}
.qty-input--v2:focus-within {
  border-color: rgba(148,163,184,.34);
  background: linear-gradient(180deg, rgba(18,24,36,.98), rgba(9,14,23,.98));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.045), 0 0 0 3px rgba(148,163,184,.1), 0 10px 24px rgba(var(--shadow-ink),.2);
}
.qty-input--v2 button {
  color: #e9ddff;
}
.qty-input--v2 input { min-width: 2.5rem; }
.detail-buy-row .btn-add-cart,
.detail-buy-row .btn-buy-now,
.qa-foot .btn-buy-now { min-width: 0; border-radius: 12px; font-weight: 600; }
.detail-buy-row .btn-add-cart,
.detail-buy-row .btn-buy-now,
.qa-foot .btn-buy-now {
  min-height: 3rem;
  padding-top: .8rem;
  padding-bottom: .8rem;
  box-shadow: 0 10px 22px rgba(var(--shadow-ink),.22);
}
.detail-buy-row .btn-buy-now,
.qa-foot .btn-buy-now {
  border-color: rgba(157, 107, 225, .62);
  background: rgba(5, 7, 14, .68);
  color: #f4eeff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.035), 0 10px 22px rgba(var(--shadow-ink),.2);
}
.detail-buy-row .btn-buy-now:hover,
.qa-foot .btn-buy-now:hover {
  border-color: rgba(211, 155, 232, .74);
  background: rgba(22, 15, 36, .86);
  color: #fff;
}

.payment-trust {
  margin-top: 1.25rem; padding-top: 1.15rem; border-top: 1px solid var(--border);
}
/* แถบ 3 คอลัมน์: ไอคอนชมพู + หัวข้อ + คำอธิบาย (หน้าสินค้า) */
.payment-trust.product-trust-badges {
  margin-top: 1.25rem;
  padding: 0.95rem 0.5rem;
  border-top: none;
  display: grid;
  /* คอลัมน์กลาง (ชำระเงินปลอดภัย) กว้างสุด — ลดซ้าย/ขวา เพื่อไม่ให้บรรทัดย่อยของ PromptPay */
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  background:
    linear-gradient(180deg, rgba(27, 28, 42, .98) 0%, rgba(22, 23, 35, .98) 100%);
  border: 1px solid rgba(53, 56, 82, .72);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .045), 0 14px 34px rgba(var(--shadow-ink), .26);
}
.product-trust-badges__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.85rem;
  min-height: 3.25rem;
  border-right: 1px solid rgba(58, 60, 86, .72);
}
.product-trust-badges__item:last-child {
  border-right: 0;
}
.product-trust-badges__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a855ff;
  filter: drop-shadow(0 0 8px rgba(168, 85, 255, .32));
  line-height: 0;
}
.product-trust-badges__icon svg {
  display: block;
}
.product-trust-badges__text {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}
.product-trust-badges__title {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #fbf8ff;
  line-height: 1.25;
  letter-spacing: 0.01em;
}
.product-trust-badges__sub {
  display: block;
  font-size: 0.76rem;
  font-weight: 500;
  color: #a9a6c3;
  line-height: 1.35;
}
.product-trust-badges__item:nth-child(2) .product-trust-badges__sub {
  white-space: nowrap;
}

@media (max-width: 820px) {
  .payment-trust.product-trust-badges {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: .38rem .28rem;
    border-radius: 12px;
  }
  .product-trust-badges__item:nth-child(2) .product-trust-badges__sub {
    white-space: normal;
  }
  .product-trust-badges__item {
    border-right: 1px solid rgba(58, 60, 86, .72);
    border-bottom: 0;
    padding: .45rem .35rem;
    gap: .32rem;
    min-height: 0;
  }
  .product-trust-badges__item:last-child {
    border-right: 0;
  }
}

@media (max-width: 480px) {
  .payment-trust.product-trust-badges {
    grid-template-columns: 1fr;
  }
  .product-trust-badges__item {
    border-right: 0;
    border-bottom: 1px solid rgba(58, 60, 86, .72);
    padding: .6rem .55rem;
  }
  .product-trust-badges__item:last-child {
    border-bottom: 0;
  }
}

.product-accordion {
  margin: 0 0 2.5rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-2);
  box-shadow: 0 4px 20px rgba(var(--shadow-ink),.12);
}
.accordion-panel { border-bottom: 1px solid var(--border); }
.accordion-panel:last-child { border-bottom: 0; }
.accordion-panel summary {
  list-style: none; cursor: pointer; padding: 1rem 1.15rem 1rem 1.25rem;
  font-weight: 600; font-size: 0.95rem;
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  /* user-select: none; */ transition: background 0.15s;
  color: var(--text);
}
.accordion-panel summary::-webkit-details-marker { display: none; }
.accordion-panel summary::after {
  content: ''; width: 0.45rem; height: 0.45rem; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); margin-right: 0.2rem; flex-shrink: 0; transition: transform 0.2s; opacity: 0.8;
}
.accordion-panel[open] summary::after { transform: rotate(225deg); }
.accordion-panel summary:hover { background: rgba(255,255,255,.04); }
/* badge ไอคอน + สีประจำหัวข้อ (รับ=ฟ้า, ใช้=ม่วง, ปลอดภัย=เขียว) */
.accordion-panel { --sec: var(--acc-receive); }
.accordion-panel.p-usage { --sec: var(--acc-usage); }
.accordion-panel.p-safety { --sec: var(--acc-safety); }
.accordion-panel__title { flex: 1; }
.accordion-panel__badge {
  display: grid; place-items: center; width: 2rem; height: 2rem; flex-shrink: 0;
  border-radius: 9px; color: var(--sec);
  background: color-mix(in srgb, var(--sec) 16%, transparent);
}
.accordion-panel__badge svg { width: 1.05rem; height: 1.05rem; }
.accordion-panel[open] summary .accordion-panel__title { color: var(--sec); }

/* ===== admin: หน้าตั้งค่าข้อความ accordion (แท็บ + พรีวิวสด + คืนค่า) ===== */
.acc-tabs {
  display: flex; flex-wrap: wrap; gap: .5rem;
  margin: 0 0 1.25rem; padding-bottom: .75rem; border-bottom: 1px solid var(--border);
}
.acc-tab {
  display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
  padding: .5rem .9rem; border-radius: 8px; font-weight: 600; font-size: .9rem;
  border: 1px solid var(--border); background: var(--bg-2); color: var(--muted);
}
.acc-tab svg { width: 16px; height: 16px; }
.acc-tab.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.acc-panel { display: none; }
.acc-panel.is-active { display: block; }
.acc-panel__desc {
  display: flex; align-items: flex-start; gap: .5rem; margin: 0 0 1.25rem;
  padding: .7rem .9rem; border-radius: 10px; font-size: .9rem; color: var(--text);
  background: rgba(168,85,247,.08); border: 1px solid var(--border);
}
.acc-panel__desc svg { flex-shrink: 0; margin-top: .1rem; color: var(--accent); }
.acc-field { --sec: var(--acc-receive); margin-bottom: 1.75rem; }
.acc-field.p-usage { --sec: var(--acc-usage); }
.acc-field.p-safety { --sec: var(--acc-safety); }
.acc-field__head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .5rem; }
.acc-field__id { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; color: var(--text); }
.acc-field__id svg { color: var(--sec); }
.acc-sub-label { display: block; margin: .55rem 0 .3rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.acc-sub-label:first-child { margin-top: 0; }
.acc-title-input { width: 100%; margin-bottom: .35rem; }
.acc-reset { flex-shrink: 0; }
.acc-field__body { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 1080px) {
  .acc-field__body { grid-template-columns: minmax(0,1fr) minmax(0,1fr); align-items: start; }
}
.acc-preview__label {
  margin-bottom: .4rem; font-size: .78rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .03em;
}
.acc-preview__frame { margin: 0; }
.accordion-panel__summary-mock {
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem 1.15rem 1rem 1.25rem; color: var(--sec);
  font-family: "Kanit", system-ui, sans-serif; font-weight: 600; font-size: .95rem;
}
.accordion-panel__body {
  padding: 0 1.25rem 1.1rem; font-size: 0.9rem; color: var(--muted);
  line-height: 1.6; max-width: 58rem;
}
.accordion-panel__body p { margin: 0; }
.accordion-panel__body p + .howto-list,
.accordion-panel__body .howto-list + p { margin-top: .65rem; }
/* ป้ายกำกับเนื้อหา placeholder ใน FAQ — ลบออกเมื่อแก้เป็นเนื้อหาจริงแล้ว */
.accordion-panel__draft {
  display: inline-flex; align-items: center; gap: .35rem;
  margin-bottom: .55rem !important; padding: .15rem .5rem;
  border-radius: .4rem; font-size: .72rem; font-weight: 600;
  color: #92400e; background: #fef3c7; border: 1px dashed #f59e0b;
}
.accordion-panel__draft + p { margin-top: 0; }
.howto-list {
  margin: 0;
  padding-left: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.howto-list li { line-height: 1.55; }
.howto-list li strong { color: var(--text); font-weight: 600; }
.howto-list li em { color: var(--primary); font-style: normal; font-weight: 500; }
.howto-list li code {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .05em .35em;
  font-size: .85em;
}
.howto-list a { color: var(--accent); }
.howto-tip {
  margin-top: .6rem !important;
  padding: .55rem .75rem;
  background: rgba(167,139,250,.08);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-size: .85rem;
  color: var(--text);
}

/* Product detail — mobile compaction + qty-input fix (container spacing ย้ายไปยุบที่ 820 พร้อม layout collapse) */
@media (max-width: 720px) {
  .breadcrumb { margin: .9rem 0 .55rem; font-size: .8rem; }
  .product-tag--pill { font-size: .7rem; padding: .22rem .55rem; }
  .detail-meta-tags { gap: .35rem; margin-bottom: .15rem; }
  .detail-info .detail-title { font-size: 1.2rem; line-height: 1.3; margin: .1rem 0 .3rem; letter-spacing: 0; }
  .detail-desc--lead { font-size: .8rem; line-height: 1.42; margin-bottom: .3rem; }
  .chat-delivery-note {
    gap: .72rem;
    margin: .05rem 0 .65rem;
    padding: .78rem .86rem;
    border-radius: 10px;
  }
  .chat-delivery-note__icon .lucide {
    width: 30px;
    height: 30px;
  }
  .chat-delivery-note__copy { line-height: 1.24; }
  .chat-delivery-note__copy strong { font-size: .82rem; }
  .chat-delivery-note__copy span { font-size: .76rem; }
  .detail-price--hero { font-size: 1.55rem; margin: .2rem 0 .4rem; }
  .detail-price-hint { font-size: .8rem; margin: .25rem 0 .15rem; }
  .stock-info--v2 { margin: .15rem 0 .3rem; }
  .stock-msg, .stock-out, .stock-ok { font-size: .8rem; }
  .btn-preview { font-size: .8rem; padding: .42rem .75rem; }

  .nitro-section-label { font-size: .82rem; margin: .75rem 0 .35rem; }
  .nitro-pick--v2 { gap: .45rem; padding: 0; }
  .nitro-pick-item--v2 { border-width: 1px; border-radius: 10px; }
  .nitro-pick-item--v2 .nitro-pick-item__body {
    padding: .62rem .66rem;
    min-height: 3rem;
    gap: .45rem;
  }
  .nitro-pick-item--v2 .nitro-pick-item__title { font-size: .78rem; gap: .25rem; }
  .badge-nitro-rec { font-size: .62rem; padding: .08rem .38rem; }
  .nitro-pick-item--v2 .nitro-pick-item__sub { display: block; font-size: .66rem; margin-top: .12rem; line-height: 1.25; }
  .nitro-pick-item--v2 .nitro-pick-item__price { font-size: 1rem; }
  .nitro-error { font-size: .78rem; }

  /* Buy row: keep horizontal (เลิก stack column) — กัน qty-input stretch ผิดปกติ */
  .add-to-cart-form--v2 { margin: .85rem 0 .5rem; }
  .add-to-cart-form--v2 .nitro-pick--v2 ~ .detail-purchase-controls { margin-top: .7rem; }
  .detail-purchase-controls {
    gap: .48rem;
    margin-top: .7rem;
    padding-top: .75rem;
    border-top: 1px solid rgba(148, 163, 184, .14);
  }
  .purchase-summary-row {
    padding-bottom: .18rem;
    border-bottom: 0;
    font-size: .78rem;
  }
  .purchase-summary-row strong { font-size: inherit; }
  .detail-buy-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem;
  }
  .qty-input--v2 {
    width: 100%;
    height: 36px;
    border-radius: 10px;
  }
  .qty-input--v2 button {
    flex-basis: 2.55rem;
    padding: 0;
    font-size: 1.05rem;
    line-height: 1;
  }
  .qty-input--v2 input {
    flex: 1;
    width: auto;
    min-width: 2.4rem;
    font-size: .9rem;
    padding: 0;
  }
  .detail-buy-row .btn-add-cart,
  .detail-buy-row .btn-buy-now {
    min-width: 0;
    font-size: .82rem;
    padding: .68rem .55rem;
    gap: .35rem;
  }
  .detail-buy-row .btn-add-cart,
  .detail-buy-row .btn-buy-now { min-height: 2.75rem; }

  /* Trust badges (3-col) */
  .payment-trust.product-trust-badges {
    margin-top: 1rem;
    padding: .35rem .25rem;
  }
  .product-trust-badges__item {
    padding: .42rem .32rem;
    gap: .3rem;
    min-height: 0;
  }
  .product-trust-badges__icon svg { width: 17px; height: 17px; }
  .product-trust-badges__title { font-size: .62rem; line-height: 1.16; }
  .product-trust-badges__sub { font-size: .53rem; line-height: 1.18; }

  /* Accordion */
  .product-accordion { margin: 0 0 1.5rem; border-radius: 12px; }
  .accordion-panel summary { padding: .8rem 1rem; font-size: .87rem; }
  .accordion-panel__body { padding: 0 1rem .85rem; font-size: .82rem; line-height: 1.55; }
  .accordion-panel__body p + .howto-list,
  .accordion-panel__body .howto-list + p { margin-top: .5rem; }
  .howto-list { padding-left: 1.1rem; gap: .3rem; }
  .howto-list li { font-size: .82rem; line-height: 1.5; }
  .howto-tip { font-size: .78rem; padding: .5rem .65rem; margin-top: .5rem !important; }
}

/* ============ Cart ============ */
.empty-state {
  text-align: center; padding: 4rem 1rem;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.big-emoji { font-size: 4rem; margin-bottom: 1rem; }
/* เวอร์ชันไม่มีการ์ดพื้นหลัง — เหลือแค่ไอคอน ข้อความ ปุ่ม (หน้าประวัติการสั่งซื้อ) */
.empty-state--bare { background: none; border: none; padding: 3rem 1rem; }
.empty-state__icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 88px; height: 88px;
  margin-bottom: var(--space-4);
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--muted);
}

.cart-layout { display: grid; grid-template-columns: 1fr 360px; gap: 2rem; }
.cart-items { display: flex; flex-direction: column; gap: .8rem; }
.cart-item {
  display: grid; grid-template-columns: 80px 1fr auto auto auto;
  gap: 1rem; align-items: center;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .8rem;
}
.cart-image { width: 80px; height: 80px; border-radius: 8px; overflow: hidden; background: var(--bg-3); }
.cart-image img { width: 100%; height: 100%; object-fit: cover; }
.cart-name { font-weight: 600; display: block; margin-bottom: .2rem; }
.cart-price { color: var(--muted); font-size: .9rem; }
.qty-form input {
  width: 70px; padding: .4rem; text-align: center;
  background: var(--bg-3); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px;
}

/* Qty stepper (cart page AJAX) — −  N  + */
.qty-stepper {
  display: inline-flex; align-items: center;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.qty-btn {
  width: 32px; height: 36px;
  background: none; border: 0;
  color: var(--muted); font-size: 1.1rem; font-weight: var(--fw-bold);
  cursor: pointer;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.qty-btn:hover:not(:disabled) { background: var(--primary-soft); color: var(--primary); }
.qty-btn:disabled,
.qty-btn.is-disabled {
  opacity: .35;
  cursor: not-allowed;
  background: none !important;
  color: var(--muted) !important;
}
/* scope ให้ชนกับ .qty-input wrapper บน product page ไม่ได้ — ใช้เฉพาะ input ใน cart stepper */
.qty-stepper .qty-input {
  width: 44px; height: 36px;
  background: none; border: 0;
  color: var(--text); text-align: center;
  font-weight: var(--fw-semibold); font-size: var(--fs-base);
  padding: 0;
  -moz-appearance: textfield;
}
.qty-stepper .qty-input::-webkit-outer-spin-button,
.qty-stepper .qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
.qty-stepper .qty-input:focus { outline: none; box-shadow: none; }

.cart-subtotal {
  font-weight: var(--fw-bold); color: var(--primary);
  min-width: 90px; text-align: right;
  transition: opacity var(--dur-fast) ease;
}
.cart-item.is-updating .cart-subtotal { opacity: .55; }
.cart-item.is-updating { pointer-events: none; }

/* Admin dropdown loading state */
select.is-loading {
  opacity: .65;
  background-image: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.05) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: img-shimmer 1.6s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  select.is-loading { animation: none; }
}

.cart-remove-btn {
  background: transparent; border: 0; color: var(--muted);
  font-size: 1.2rem; cursor: pointer;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.cart-remove-btn:hover { background: var(--danger-soft); color: var(--danger); }

.js-cart-clear {
  align-self: flex-end;
}

.cart-summary, .checkout-summary {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  height: fit-content; position: sticky; top: 80px;
}
.cart-summary h3, .checkout-summary h3 { margin-top: 0; }
.cart-cta-spacer { height: .85rem; }
.summary-row, .summary-line {
  display: flex; justify-content: space-between;
  padding: .5rem 0;
}
.summary-row.total, .summary-line.total {
  font-size: 1.3rem; font-weight: 600; color: var(--primary);
  border-top: 1px solid var(--border); margin-top: .5rem; padding-top: .8rem;
}
.checkout-summary > button[type="submit"].btn-block + a.btn-block {
  margin-top: 0.85rem;
}

/* Cart mobile checkout components — desktop hides them */
.cart-mobile-banner,
.cart-mobile-bar { display: none; }

@media (max-width: 1023px) {
  .cart-layout { grid-template-columns: 1fr; gap: 1rem; }
  .cart-item {
    grid-template-columns: 60px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    grid-template-areas:
      "img name    name"
      "img price   stepper";
    column-gap: .7rem;
    row-gap: .55rem;
    padding: .65rem;
    position: relative;
  }
  .cart-image { width: 60px; height: 60px; grid-area: img; }
  /* ชื่อกินเต็มแถวบน · เว้นที่ขวาให้ปุ่มลบ */
  .cart-main { grid-area: name; min-width: 0; padding-right: 1.7rem; }
  /* ปุ่มลบลอยมุมขวาบน ไม่กินคอลัมน์ — ชื่อจึงกว้างเต็ม */
  .cart-remove-btn { position: absolute; top: .3rem; right: .3rem; }
  /* ราคา (purple) ซ้ายล่าง · stepper ขวาล่าง — ตามภาพ mockup */
  .cart-price { display: none; }
  .cart-subtotal { grid-area: price; justify-self: start; align-self: center; text-align: left; min-width: 0; }
  .qty-stepper { grid-area: stepper; justify-self: end; }
  .cart-summary { position: static; padding: 1.1rem; }
  .js-cart-clear { display: none; }

  /* สรุปคำสั่งซื้อให้ใกล้ mockup: ตัดหัวข้อ · ตัดแถวจำนวนรายการ · ส่วนลดเป็นสีเขียว */
  .cart-summary h3 { display: none; }
  .summary-row--count { display: none; }
  #cartDiscountDisplay { color: var(--success); }
  /* ปุ่มเลือกสินค้าเดิมในการ์ดสรุปย้ายไปอยู่ในแถบลอยล่าง */
  .cart-summary > a.btn-ghost { display: none; }

  /* แถบ checkout ซ้อนเหนือ bottom nav (สองชั้น) — nav ยังนำทางได้
     ≤820: มี bottom nav → แถบเลื่อนขึ้นเหนือ nav (ดู media 820 ด้านล่าง) */
  body:has(.cart-mobile-bar) { padding-bottom: calc(52px + env(safe-area-inset-bottom, 0px)); }

  .cart-mobile-banner {
    display: flex; align-items: center; gap: .5rem;
    padding: .6rem .8rem; margin-bottom: .8rem;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg-2); color: var(--muted);
    font-size: .85rem; line-height: 1.4;
  }
  .cart-mobile-banner .lucide { flex: 0 0 auto; }
  .cart-mobile-banner--info { color: var(--accent); border-color: var(--accent-soft); background: var(--accent-soft); }

  /* ปุ่ม checkout ย้ายไปอยู่ในแถบลอยล่าง */
  #cartCheckoutBtn, .cart-cta-spacer { display: none; }

  .cart-mobile-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1190;
    display: flex; align-items: center; gap: .7rem;
    padding: .5rem .9rem calc(.5rem + env(safe-area-inset-bottom, 0px));
    background: rgba(15, 15, 20, .96);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(14px);
    box-shadow: 0 -10px 28px rgba(var(--shadow-ink), .28);
  }
  .cart-mobile-bar__info { display: flex; flex-direction: column; line-height: 1.15; flex: 0 0 auto; }
  .cart-mobile-bar__label { font-size: .72rem; color: var(--muted); }
  .cart-mobile-bar__total { font-size: 1.1rem; font-weight: var(--fw-bold); color: var(--primary); }
  /* nav มี "หน้าแรก"/"สินค้า" อยู่แล้ว — ปุ่มเลือกสินค้าในแถบจึงซ้ำซ้อน ตัดออก */
  .cart-mobile-bar__shop { display: none; }
  .cart-mobile-bar__btn { flex: 1 1 auto; padding: .6rem .8rem; font-size: .95rem; white-space: nowrap; }
}

/* ≤1023: มี bottom nav → แถบ checkout เลื่อนขึ้นไปนั่งเหนือ nav (สองชั้น) */
@media (max-width: 1023px) {
  .cart-mobile-bar {
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));  /* เหนือ nav สูง 66px */
    padding-bottom: .5rem;  /* nav รับ safe-area ที่ขอบล่างแล้ว */
  }
  body:has(.cart-mobile-bar) {
    padding-bottom: calc(116px + env(safe-area-inset-bottom, 0px));  /* nav 66 + แถบ ~50 */
  }
}

/* ============ Checkout ============ */
.checkout-form {
  display: block;
}
/* แถวสูงตามคอลัมน์ซ้ายเท่านั้น (สรุป absolute จึงไม่ดันความสูง) → max-height 100% ของสรุป = สูงสุดเท่าฝั่งซ้าย */
.checkout-columns {
  display: grid;
  grid-template-columns: minmax(260px, 34rem) minmax(400px, 1fr);
  gap: 1.5rem;
  align-items: start;
  position: relative;
}
.checkout-grid {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.checkout-section {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
}
.checkout-section h3 { margin-top: 0; }

.checkout-summary--side {
  grid-column: 2;
  grid-row: 1;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  width: auto;
  height: auto;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  bottom: auto;
}
.checkout-summary--side > *:not(.checkout-summary-list) {
  flex-shrink: 0;
}
.checkout-summary-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin: 0.35rem 0 0.85rem;
  padding-right: 6px;
  -webkit-overflow-scrolling: touch;
}

.checkout-summary-item {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 0.65rem;
  align-items: center;
}
.checkout-summary-thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-3);
  border: 1px solid var(--border);
}
.checkout-summary-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.checkout-summary-item-mid { min-width: 0; }
.checkout-summary-item-title {
  font-size: 0.95rem;
  line-height: 1.35;
  word-break: normal;
  overflow-wrap: break-word;
}
.checkout-summary-item-meta { margin-top: 0.15rem; font-size: 0.82rem; }
.checkout-summary-item-price {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  align-self: start;
  padding-top: 0.1rem;
}

.form-row { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row label { font-weight: 500; font-size: .95rem; }
.form-row label .optional { color: var(--muted); font-weight: normal; font-size: .85em; }
.form-row input, .form-row textarea, .form-row select {
  background: var(--bg-3); border: 1px solid var(--border);
  color: var(--text); padding: .7rem .9rem; border-radius: 8px;
  font-family: inherit; font-size: 1rem;
}
.form-row input:focus, .form-row textarea:focus, .form-row select:focus {
  outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(168,85,247,.2);
}

.angpao-box {
  background: linear-gradient(135deg, rgba(168,85,247,.1), rgba(167,139,250,.1));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; margin-bottom: 1rem;
}
.angpao-amount {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: .8rem; border-bottom: 1px dashed var(--border);
}
.angpao-amount strong { font-size: 1.8rem; color: var(--primary); }
.angpao-steps {
  padding-left: 1.2rem; margin: 1rem 0;
  display: flex; flex-direction: column; gap: .5rem;
}

.alert { padding: 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.alert-error { background: rgba(239,68,68,.1); border-color: var(--danger); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.1); border-color: var(--success); color: #86efac; }
.alert-info { background: rgba(167,139,250,.1); border-color: #a78bfa; color: #c4b5fd; }
.form-row .required { color: var(--danger); }
.form-row.has-error input, .form-row.has-error textarea, .form-row.has-error select { border-color: var(--danger); }
.form-row.has-error input:focus, .form-row.has-error textarea:focus, .form-row.has-error select:focus { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239,68,68,.2); }
.field-error { display: flex; align-items: center; gap: .35rem; margin: 0; color: #fca5a5; font-size: .85rem; }
.field-error svg { flex-shrink: 0; }
.checkbox-label { display: flex; align-items: center; gap: .5rem; font-weight: 500; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }
.radio-group { display: flex; flex-direction: column; gap: .5rem; }
.radio-inline { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; font-weight: 500; }
.radio-inline input[type="radio"] { width: 16px; height: 16px; cursor: pointer; }
/* File-based product download card (order page) */
.file-card {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-top: .5rem;
  padding: .5rem .6rem;
  background: rgba(15, 15, 20, .28);
  border: 1px solid rgba(255, 255, 255, .08);
  
  border-radius: 10px;
}
.file-card__icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.file-card__icon img {
  display: block;
  width: 64%;
  height: 64%;
  object-fit: contain;
}
.file-card__meta {
  flex: 1;
  min-width: 0;
}
.file-card__name {
  font-weight: 600;
  font-size: .87rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.file-card__size {
  margin-top: .1rem;
  font-size: .74rem;
  color: var(--muted);
}
.file-card__btn {
  flex-shrink: 0;
  min-height: 34px;
  padding: .4rem .7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  font-size: .82rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}
.file-card__btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.file-card__btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.file-card__btn:active { transform: scale(.94); }
@media (max-width: 480px) {
  .file-card { padding: .45rem .55rem; gap: .5rem; flex-wrap: wrap; }
  .file-card__icon { width: 34px; height: 34px; border-radius: 8px; }
  .file-card__meta { flex-basis: calc(100% - 44px); }
  .file-card__name { font-size: .84rem; }
  .file-card__btn { width: 100%; min-height: 36px; }
}

@media (max-width: 820px) {
  .checkout-columns {
    grid-template-columns: 1fr;
  }
  .checkout-grid {
    grid-column: 1;
  }
  .checkout-summary--side {
    position: static;
    grid-column: 1;
    grid-row: auto;
    left: auto;
    right: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
  }
  .checkout-summary-list {
    flex: none;
    min-height: 0;
    max-height: none;
    overflow-y: visible;
  }
  .form-row-2 { grid-template-columns: 1fr; }
}

/* ============ Order Tracking ============ */
.order-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
  margin-top: 1.45rem;
  margin-bottom: 1.55rem;
  flex-wrap: nowrap;
}
.order-head__main {
  min-width: 0;
  flex: 1 1 auto;
}
.order-head__back {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin: 0 0 1.25rem;
  color: #a6a7b8;
  font-size: .95rem;
  font-weight: var(--fw-semibold);
  line-height: 1.2;
  transition: color var(--dur-fast) ease;
}
.order-head__back:hover {
  color: var(--text);
}
.order-head__back .lucide {
  color: currentColor;
}
.order-head__back--static {
  cursor: default;
}
.order-head__back--static:hover {
  color: #a6a7b8;
}
.order-head__summary {
  display: flex;
  align-items: center;
  gap: 1.05rem;
  min-width: 0;
}
.order-head__icon {
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .015)),
    var(--bg-2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .06),
    0 12px 30px rgba(var(--shadow-ink), .26);
  color: #f4f5ff;
}
.order-head__title-block {
  min-width: 0;
}
.order-head__title-block h1 {
  display: flex;
  align-items: baseline;
  gap: .55rem;
  flex-wrap: wrap;
  margin: 0;
  font-size: 1.85rem;
  line-height: 1.15;
  letter-spacing: 0;
  color: #f1f2fb;
}
.order-head__meta {
  margin: .45rem 0 0;
  color: #8f91a4;
  font-size: .95rem;
  font-weight: var(--fw-medium);
  line-height: 1.35;
}
.order-code { color: var(--primary); font-family: inherit; font-weight: var(--fw-bold); }
.status-badge, .status-chip {
  display: inline-block; white-space: nowrap;
  padding: .3rem .8rem; border-radius: 999px; font-size: .85rem; font-weight: 600;
  background: var(--bg-3); border: 1px solid var(--border); text-transform: uppercase;
}
.status-badge { padding: .5rem 1.2rem; font-size: 1rem; }
.order-head > .status-badge {
  min-width: 120px;
  min-height: 38px;
  justify-content: center;
  align-items: center;
  display: inline-flex;
  margin-bottom: .7rem;
  border-radius: 8px;
  font-size: .95rem;
  font-weight: var(--fw-bold);
  text-transform: none;
  /* สี/พื้น/ขอบ ปล่อยให้คลาส .status-<สถานะ> คุม เพื่อให้ป้ายเปลี่ยนตามสถานะ (ทั้ง dark/light) */
}
.status-pending { background: rgba(202,138,4,.18); color: #fde047; border-color: #ca8a04; }
.status-preorder { background: rgba(124,92,255,.15); color: #ddd6fe; border-color: #7c5cff; }
.status-processing { background: rgba(56,189,248,.15); color: #bae6fd; border-color: #38bdf8; } /* สินค้า API — รอ worker ส่งมอบ */

/* popup รอเตรียมสินค้า API หลังชำระเงิน (หน้า checkout) — โลโก้ร้านกลาง + ดาวหมุน + แสงเรือง */
.checkout-preparing-slow { color: var(--muted); }
.checkout-preparing-spin {
  position: relative;
  width: 96px;
  height: 96px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.checkout-preparing-spin__logo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  position: relative;
  z-index: 2;
  animation: preparingLogoPulse 1.6s ease-in-out infinite;
}
.checkout-preparing-spin__glow {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 85, 247, .45), transparent 70%);
  animation: preparingGlow 1.6s ease-in-out infinite;
}
.checkout-preparing-spin__stars {
  position: absolute;
  inset: 0;
  animation: preparingSpin 3.2s linear infinite;
}
.checkout-preparing-spin__star {
  position: absolute;
  font-style: normal;
  color: var(--primary);
  animation: preparingTwinkle 1.2s ease-in-out infinite;
}
.checkout-preparing-spin__star--1 { top: -2px; left: 50%; margin-left: -7px; font-size: 15px; }
.checkout-preparing-spin__star--2 { top: 50%; right: -4px; margin-top: -8px; font-size: 12px; color: #f0abfc; animation-delay: .3s; }
.checkout-preparing-spin__star--3 { bottom: -2px; left: 50%; margin-left: -6px; font-size: 13px; color: var(--accent, #a78bfa); animation-delay: .6s; }
.checkout-preparing-spin__star--4 { top: 50%; left: -4px; margin-top: -7px; font-size: 11px; animation-delay: .9s; }
@keyframes preparingSpin { to { transform: rotate(360deg); } }
@keyframes preparingLogoPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}
@keyframes preparingTwinkle {
  0%, 100% { opacity: 1; }
  50% { opacity: .25; }
}
@keyframes preparingGlow {
  0%, 100% { opacity: .5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.12); }
}
@media (prefers-reduced-motion: reduce) {
  .checkout-preparing-spin__logo,
  .checkout-preparing-spin__glow,
  .checkout-preparing-spin__stars,
  .checkout-preparing-spin__star { animation: none !important; }
}

/* ===== Admin: สินค้า API (dropship หลายผู้ให้บริการ) — CSP ห้าม inline style attr ===== */
.supplier-balances { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.supplier-balance-card { flex: 1 1 200px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.supplier-balance-card b { font-size: 1.15rem; }

/* --- /admin/api-products (prefix .apx-) --- */
/* คุมความกว้างคอลัมน์ไว้ที่เดียว: หัวตารางกับแถวสินค้าใช้ grid template เดียวกัน จึงตรงกันเสมอ */
.apx-list { --apx-cols: 22px minmax(200px, 2.2fr) minmax(170px, 1.6fr) 150px 74px 128px; }

.apx-input {
  width: 100%;
  min-height: var(--admin-control-height, 36px);
  padding: .45rem .62rem;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--admin-radius-control, 6px);
  color: var(--text);
  font-family: inherit;
  font-size: .85rem;
}
.apx-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
select.apx-input {
  appearance: none;
  padding-right: 2rem;
  background-image: var(--select-chevron-down);
  background-repeat: no-repeat;
  background-position: right .55rem center;
  background-size: 16px 16px;
}
.apx-code {
  padding: .1rem .35rem;
  border-radius: 4px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: .72rem;
}
.apx-col-num { text-align: right; font-variant-numeric: tabular-nums; }
.apx-chips { display: flex; gap: .4rem; flex-wrap: wrap; }
/* .chip ไม่ได้ตั้ง color ไว้ — บน <button> จะตกไปใช้ค่า default ของ UA (ดำ) ต้องบังคับเอง */
.apx-chips button.chip { color: var(--text); }
.apx-chips button.chip:hover, .apx-chips button.chip.active { color: #fff; }
.apx-chips .chip b { font-weight: 600; }
.apx-empty { padding: 1.1rem .2rem; text-align: center; }
.apx-detached-form { display: none; }
.apx-action-form { display: inline-flex; margin: 0; }
.apx-thumb {
  flex-shrink: 0;
  width: 34px; height: 34px;
  object-fit: contain;
  border-radius: 6px;
  background: var(--bg-3);
  border: 1px solid var(--border);
}
.apx-thumb--empty {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted);
}

/* ตั้งค่า + ยอดเงินผู้ให้บริการ */
.apx-settings { margin: 0; }
.apx-providers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: .75rem;
}
.apx-provider {
  display: grid;
  gap: .45rem;
  align-content: start;
  padding: .8rem .9rem;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--admin-radius-panel, 8px);
}
.apx-provider.is-ok { border-left-color: var(--success); }
.apx-provider.is-low { border-left-color: var(--warn); }
.apx-provider.is-off { border-left-color: var(--muted); }
.apx-provider__top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.apx-provider__name { display: inline-flex; align-items: center; gap: .45rem; font-weight: 600; }
.apx-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.apx-provider.is-ok .apx-dot { background: var(--success); }
.apx-provider.is-low .apx-dot { background: var(--warn); }
.apx-provider__balance { display: flex; align-items: center; gap: .5rem; }
.apx-provider__balance b { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.apx-provider__meta { margin: 0; font-size: var(--admin-font-secondary, 12px); }
.apx-provider__warn {
  margin: 0;
  color: #fde68a;
  font-size: var(--admin-font-secondary, 12px);
  line-height: 1.5;
}
.apx-settings__globals {
  display: flex;
  gap: .9rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-top: .9rem;
  padding-top: .9rem;
  border-top: 1px solid var(--border);
}
.apx-settings__globals .apx-field { flex: 0 1 260px; }
.apx-provider .apx-input { max-width: 150px; }

.apx-field { display: grid; gap: .3rem; }
.apx-field[hidden] { display: none; }
.apx-field__label { font-size: var(--admin-font-secondary, 12px); color: var(--muted); font-weight: 500; }
.apx-field__hint { font-size: var(--admin-font-secondary, 12px); line-height: 1.45; }

/* รายการสินค้าที่ import แล้ว — แต่ละแถวเป็น <details> ที่กางดูตั้งค่าได้ */
.apx-row {
  display: grid;
  grid-template-columns: var(--apx-cols);
  gap: .75rem;
  align-items: center;
  padding: .55rem .7rem;
}
.apx-row--head {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.apx-item { border-bottom: 1px solid var(--border); }
.apx-item[hidden] { display: none; }
.apx-item__summary {
  list-style: none;
  cursor: pointer;
  transition: background var(--dur-fast, .12s) var(--ease-out, ease);
}
.apx-item__summary::-webkit-details-marker { display: none; }
.apx-item__summary:hover { background: rgba(var(--tint-ink), .18); }
.apx-item[open] > .apx-item__summary { background: rgba(var(--tint-ink), .22); }
.apx-chevron { display: inline-flex; color: var(--muted); transition: transform var(--dur-fast, .12s) var(--ease-out, ease); }
.apx-item[open] > .apx-item__summary .apx-chevron { transform: rotate(90deg); }

.apx-cell-name { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.apx-name { display: grid; gap: .2rem; min-width: 0; }
.apx-name b { overflow-wrap: anywhere; }
.apx-tags { display: flex; gap: .3rem; flex-wrap: wrap; }
.apx-tags:empty { display: none; }

.apx-cell-provider { display: grid; gap: .22rem; min-width: 0; }
.apx-provider-line { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.apx-cheaper { display: inline-flex; align-items: center; gap: .3rem; color: var(--success); font-size: var(--admin-font-secondary, 12px); font-weight: 600; }

.apx-cell-price { display: grid; gap: .1rem; justify-items: end; }
.apx-price-line { display: inline-flex; align-items: center; gap: .3rem; }
.apx-arrow { display: inline-flex; color: var(--muted); }
.apx-cell-stock b { font-size: 1rem; }
.apx-cell-sync { font-size: var(--admin-font-secondary, 12px); }

/* ตัวสินค้าที่กางออก */
.apx-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 1rem;
  padding: .9rem .7rem 1.1rem 1.65rem;
  background: rgba(var(--tint-ink), .22);
  border-top: 1px dashed var(--border);
}
@media (max-width: 1180px) {
  .apx-detail { grid-template-columns: minmax(0, 1fr); }
}
.apx-block { display: grid; gap: .55rem; align-content: start; }
.apx-block__title {
  margin: 0;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
}
.apx-offers { display: grid; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.apx-offer {
  display: grid;
  gap: .35rem;
  padding: .55rem .7rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--admin-radius-control, 6px);
}
.apx-offer.is-selected { border-color: var(--success); }
.apx-offer__head { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.apx-offer__stats { display: flex; gap: .9rem; flex-wrap: wrap; font-size: var(--admin-font-secondary, 12px); color: var(--muted); }
.apx-offer__stats b { color: var(--text); font-variant-numeric: tabular-nums; }
.apx-offer__actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.apx-offer__actions:empty { display: none; }
.apx-diff-down { color: var(--success); font-weight: 600; }
.apx-diff-up { color: var(--warn); font-weight: 600; }

.apx-link-forms { display: grid; gap: .45rem; }
.apx-link-form { display: flex; gap: .4rem; align-items: center; margin: 0; }
.apx-link-form .apx-input { flex: 1; min-width: 0; }

.apx-product-form { display: grid; gap: .75rem; margin: 0; }
.apx-field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .7rem; }
.apx-check { display: flex; gap: .55rem; align-items: flex-start; cursor: pointer; }
.apx-check input { margin-top: .2rem; width: 16px; height: 16px; flex-shrink: 0; }
.apx-check__text { display: grid; gap: .15rem; }
.apx-check__text small { line-height: 1.45; }
.apx-form-actions { display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }

/* แคตตาล็อกแบบแท็บต่อผู้ให้บริการ */
.apx-tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .9rem; border-bottom: 1px solid var(--border); }
.apx-tab {
  padding: .5rem .9rem;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
}
.apx-tab:hover { color: var(--text); }
.apx-tab.is-active { color: var(--text); border-bottom-color: var(--primary); }
.apx-tabpanel[hidden] { display: none; }
.apx-catalog-table td { vertical-align: middle; }
.apx-catalog-table tr[hidden] { display: none; }
.apx-catalog-table th:first-child, .apx-catalog-table td:first-child { width: 44px; }

/* ≤1023px: หน้านี้ออกแบบมาเพื่อ PC — บนจอแคบยุบทุกคอลัมน์ลงมาเรียงกันแทน ไม่ตัดข้อมูลทิ้ง */
@media (max-width: 1023px) {
  .apx-list { --apx-cols: 20px minmax(0, 1fr); }
  .apx-row--head { display: none; }
  .apx-row { gap: .35rem .6rem; align-items: start; }
  .apx-item__summary > :nth-child(n + 3) { grid-column: 2; }
  .apx-cell-price, .apx-cell-stock { justify-items: start; text-align: left; }
  .apx-detail { padding-left: .7rem; }
}
.status-paid { background: rgba(168,85,247,.12); color: #e9d5ff; border-color: var(--primary); }
.status-shipping { background: rgba(167,139,250,.18); color: #ddd6fe; border-color: var(--accent); }
.status-delivered, .status-completed { background: rgba(34,197,94,.2); color: #bbf7d0; border-color: var(--success); }
.status-cancelled { background: rgba(239,68,68,.15); color: #fca5a5; border-color: var(--danger); }
.status-refund_pending { background: rgba(251,146,60,.15); color: #fed7aa; border-color: #f97316; }
.status-refunded { background: rgba(148,163,184,.15); color: #cbd5e1; border-color: #64748b; }
.status-available { background: rgba(34,197,94,.1); color: #86efac; }
.status-sold { background: var(--bg-3); color: var(--muted); }

@media (max-width: 720px) {
  .order-head {
    align-items: stretch;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.1rem;
  }
  .order-head__back {
    margin-bottom: 1rem;
    font-size: .86rem;
  }
  .order-head__summary {
    gap: .8rem;
  }
  .order-head__icon {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }
  .order-head__title-block h1 {
    font-size: 1.5rem;
  }
  .order-head__meta {
    font-size: .84rem;
  }
  .order-head > .status-badge {
    /* บนมือถือซ่อนป้ายสถานะ — timeline/alert ด้านล่างบอกสถานะอยู่แล้ว (desktop ยังแสดงปกติ) */
    display: none;
  }
}

/* Order timeline (stepper) */
.order-timeline {
  display: flex; align-items: center;
  gap: var(--space-2);
  margin: var(--space-4) 0;
  padding: var(--space-5) var(--space-5);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}
.timeline-step {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
  flex: 0 0 auto;
  min-width: 90px;
  text-align: center;
}
.timeline-dot {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-3);
  border: 2px solid var(--border);
  font-size: 1.3rem; line-height: 1;
  transition: all var(--dur-base) var(--ease-out);
}
.timeline-icon {
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1;
}
.timeline-icon--default { display: inline-flex; }
.timeline-icon--done    { display: none; }
.timeline-step.is-done .timeline-icon--default { display: none; }
.timeline-step.is-done .timeline-icon--done    { display: inline-flex; }
.timeline-label {
  font-size: var(--fs-sm);
  color: var(--muted);
  font-weight: var(--fw-medium);
  transition: color var(--dur-base) ease;
}
.timeline-connector {
  flex: 1 1 auto;
  height: 3px;
  min-width: 30px;
  margin-top: -28px;  /* align with center of dots */
  background: var(--border);
  border-radius: var(--radius-full);
  transition: background var(--dur-base) ease;
}

/* States */
.timeline-step.is-done .timeline-dot {
  background: linear-gradient(135deg, var(--success), #16a34a);
  border-color: var(--success);
  color: #fff;
  box-shadow: 0 0 0 4px var(--success-soft);
}
.timeline-step.is-done .timeline-label {
  color: var(--text);
}
.timeline-step.is-active .timeline-dot {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 4px var(--primary-soft), 0 4px 16px rgba(168,85,247,.4);
  animation: timeline-pulse 2s ease-in-out infinite;
}
.timeline-step.is-active .timeline-label {
  color: var(--text);
  font-weight: var(--fw-semibold);
}
.timeline-step.is-pending .timeline-dot {
  opacity: .5;
}
.timeline-connector.is-done {
  background: linear-gradient(90deg, var(--success), var(--primary));
}
@keyframes timeline-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
@media (prefers-reduced-motion: reduce) {
  .timeline-step.is-active .timeline-dot { animation: none; }
}
@media (max-width: 600px) {
  .order-timeline { padding: var(--space-4) var(--space-3); }
  .timeline-step { min-width: 70px; }
  .timeline-dot { width: 36px; height: 36px; font-size: 1rem; }
  .timeline-label { font-size: var(--fs-xs); }
  .timeline-connector { min-width: 16px; }
}

.order-cancel-notice { margin: var(--space-4) 0; }

/* Thank-you message — เปิดหน้าออเดอร์ครั้งแรกหลัง paid (paid_at < 5 นาที) */
.order-thanks {
  display: flex; align-items: center; gap: var(--space-4);
  margin: var(--space-4) 0;
  padding: var(--space-5) var(--space-5);
  background: linear-gradient(135deg, var(--success-soft) 0%, var(--primary-soft) 70%);
  border: 1px solid rgba(34,197,94,.35);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  animation: thanks-slide-in .5s var(--ease-out);
}
.order-thanks::after {
  content: ""; position: absolute; top: 0; right: 0;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(168,85,247,.18), transparent 70%);
  pointer-events: none;
}
.order-thanks__emoji {
  font-size: 3rem; line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 12px rgba(168,85,247,.4));
  animation: thanks-bounce 1.4s var(--ease-spring) infinite;
}
@keyframes thanks-slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes thanks-bounce {
  0%, 100% { transform: translateY(0) rotate(0); }
  25% { transform: translateY(-6px) rotate(-8deg); }
  75% { transform: translateY(-3px) rotate(8deg); }
}
@media (prefers-reduced-motion: reduce) {
  .order-thanks { animation: none; }
  .order-thanks__emoji { animation: none; }
}
.order-thanks__title {
  margin: 0 0 var(--space-1);
  font-size: var(--fs-xl);
  background: linear-gradient(135deg, var(--success), var(--primary));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.order-thanks__text {
  margin: 0;
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: var(--lh-loose);
}
@media (max-width: 600px) {
  .order-thanks { flex-direction: column; text-align: center; padding: var(--space-4); }
  .order-thanks__emoji { font-size: 2.5rem; }
  .order-thanks__title { font-size: var(--fs-lg); }
}

/* Reorder button (ใต้ order totals) */
.order-reorder {
  display: flex; align-items: center; gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
}
.order-reorder-btn {
  border: 1px solid var(--accent) !important;
  color: var(--accent) !important;
  background: var(--accent-soft) !important;
  font-weight: var(--fw-semibold) !important;
}
.order-reorder-btn:hover {
  background: rgba(167,139,250,.22) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(167,139,250,.3);
}
.order-reorder small { flex: 1; min-width: 200px; font-size: var(--fs-xs); }

.order-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1.2rem; margin-top: 1rem; }
.order-grid.single { grid-template-columns: 1fr; max-width: 900px; }
.order-grid section { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.order-main-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}
.order-recipient-card {
  border-radius: 10px !important;
  border-color: rgba(255, 255, 255, .08) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(255, 255, 255, .008)),
    var(--bg-2) !important;
  box-shadow: 0 14px 36px rgba(var(--shadow-ink), .22);
}
.order-recipient-card > h3 {
  margin: 0 0 1rem;
  color: #eef0fa;
  font-size: 1.08rem;
  line-height: 1.25;
}
.order-recipient-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .95rem 1.25rem;
}
.order-recipient-field {
  min-width: 0;
}
.order-recipient-field--note {
  grid-column: 1 / -1;
}
.order-recipient-label {
  display: block;
  margin-bottom: .35rem;
  color: #8f92a6;
  font-size: .88rem;
  font-weight: var(--fw-semibold);
}
.order-recipient-label--with-action {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.order-recipient-value,
.order-recipient-note {
  color: #e8e9f4;
  font-size: .98rem;
  font-weight: var(--fw-bold);
  word-break: break-word;
  line-height: 1.45;
}
.order-recipient-note {
  min-height: 1.25rem;
  white-space: pre-wrap;
}
.order-secret-line {
  display: flex;
  align-items: center;
  min-width: 0;
}
.order-recipient-safe-note {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .75rem .9rem;
  border: 1px solid rgba(88, 101, 242, .28);
  border-radius: 8px;
  background: rgba(88, 101, 242, .12);
  color: #c7d2fe;
  font-size: .92rem;
  font-weight: var(--fw-semibold);
  line-height: 1.45;
}
.order-recipient-safe-note .lucide {
  color: #a5b4fc;
}
.order-secret-line .order-recipient-value {
  min-width: 120px;
}
.order-secret-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  flex: 0 0 auto;
  color: #b9bdcf;
  background: transparent;
  cursor: pointer;
}
.order-secret-toggle:hover {
  color: #eef0fa;
  background: rgba(255, 255, 255, .055);
}
.order-secret-toggle .secret-icon {
  display: inline-flex;
  line-height: 0;
}
.order-secret-toggle .secret-icon--hide,
.order-secret-toggle.is-revealed .secret-icon--show {
  display: none;
}
.order-secret-toggle.is-revealed .secret-icon--hide {
  display: inline-flex;
}
.order-recipient-deleted {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: #aeb2c5;
  font-weight: var(--fw-semibold);
}
.order-products-panel {
  border-radius: 10px !important;
  border-color: rgba(255, 255, 255, .08) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(255, 255, 255, .008)),
    var(--bg-2) !important;
  box-shadow: 0 14px 36px rgba(var(--shadow-ink), .22);
}
.order-products-panel > h3 {
  margin: 0 0 1.55rem;
  color: #eef0fa;
  font-size: 1.08rem;
  line-height: 1.25;
}
.order-products-panel .order-item {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  align-items: start;
  column-gap: 1rem;
  row-gap: 0;
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin-bottom: 1.15rem;
}
.order-products-panel .order-item-body {
  min-width: 0;
}
.order-products-panel .order-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
  font-weight: 600;
}
.order-products-panel .order-item-head .name {
  display: flex;
  align-items: center;
  gap: .45rem;
  min-width: 0;
  flex-wrap: wrap;
  color: #e7e8f3;
}
.order-products-panel .order-item-head .name .u-select-text {
  font-size: 1rem;
  font-weight: var(--fw-bold);
}
.order-products-panel .order-item .price {
  color: var(--primary);
  flex-shrink: 0;
  font-size: 1rem;
  font-weight: var(--fw-bold);
  line-height: 1.25;
}
.delivered { margin-top: .8rem; }
.delivered summary { cursor: pointer; font-weight: 500; padding: .4rem 0; }
.order-products-panel .delivered {
  margin-top: 0rem;
}
.order-products-panel .delivered summary {
  padding: .05rem 0 .35rem;
}

.delivered-card { margin-top: .55rem; }
.delivered-card > summary.delivered-card__toggle {
  list-style: none;
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  background: transparent;
  color: #aeb2c5;
  font-size: .85rem;
  cursor: pointer;
  /* user-select: none; */
  transition: color .18s ease, border-color .18s ease;
}
.delivered-card > summary.delivered-card__toggle::-webkit-details-marker { display: none; }
.delivered-card > summary.delivered-card__toggle::marker { content: ''; }
.delivered-card > summary.delivered-card__toggle:hover {
  color: #dfe2ef;
  border-color: rgba(255, 255, 255, .2);
}
.delivered-card__icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(167, 139, 250, .12);
  border: 1px solid rgba(167, 139, 250, .08);
  color: #cfd2e4;
  flex-shrink: 0;
}
.delivered-card__label {
  min-width: 0;
  line-height: 1.35;
}
.delivered-card__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #7f8398;
  transform: rotate(-90deg);
  transition: transform .2s ease;
  flex-shrink: 0;
}
.delivered-card[open] > summary .delivered-card__chevron {
  transform: rotate(0deg);
}
.code-block {
  background: #0a0a12; border: 1px solid var(--border);
  padding: .8rem 1rem; border-radius: 8px;
  white-space: pre-wrap; word-break: break-all;
  font-family: 'Consolas', monospace; font-size: .9rem;
  margin: .5rem 0;
}
.order-totals {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  justify-content: space-between;
  gap: .75rem 2rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.order-total-cell {
  display: flex;
  align-items: baseline;
  gap: .15rem;
  min-width: 0;
}
.order-total-cell span {
  color: var(--muted);
  margin-right: 1rem;
  font-size: .92rem;
  white-space: nowrap;
}
.order-total-cell strong {
  color: #e9eaf5;
  font-size: 1.08rem;
  line-height: 1.25;
  white-space: nowrap;
}

#messages.order-chat-panel {
  padding: 1.3rem 1.25rem 1.25rem;
  border-color: rgba(255, 255, 255, .08);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(255, 255, 255, .008)),
    var(--bg-2);
  box-shadow: 0 14px 36px rgba(var(--shadow-ink), .22);
}
#messages.order-chat-panel > h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  margin: 0 0 1.05rem;
  color: #eef0fa;
  font-size: 1.12rem;
  line-height: 1.25;
}
#messages.order-chat-panel > h3 .lucide {
  color: #d7d9e8;
}
.chat-box {
  min-height: 162px;
  height: 400px;
  max-height: 80vh;
  resize: vertical;
  overflow-y: auto; padding: .9rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, .04), transparent 62%),
    var(--bg-3);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 8px; margin-bottom: 1rem;
  display: flex; flex-direction: column; gap: .7rem;
  outline: none;
}
.chat-box:focus,
.chat-box:focus-visible { outline: none; }
.chat-box::-webkit-resizer {
  background-color: transparent;
  background-image: linear-gradient(
    135deg,
    transparent 0%, transparent 55%,
    rgba(255, 255, 255, .35) 55%, rgba(255, 255, 255, .35) 65%,
    transparent 65%, transparent 75%,
    rgba(255, 255, 255, .35) 75%, rgba(255, 255, 255, .35) 85%,
    transparent 85%
  );
  border: none;
  border-bottom-right-radius: 8px;
}
.chat-empty {
  flex: 1;
  min-height: 132px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  color: var(--muted);
  text-align: center;
  padding: 1.2rem 0;
}
.chat-empty__icon {
  display: inline-flex;
  color: #d7d9e8;
  margin-bottom: .15rem;
}
.chat-empty strong {
  color: #d8dae7;
  font-size: .95rem;
  font-weight: var(--fw-semibold);
}
.chat-empty span {
  color: #9295a8;
  font-size: .9rem;
  line-height: 1.55;
}
.chat-msg {
  padding: .7rem .9rem; border-radius: var(--radius);
  max-width: 85%;
}
/* ค่าเริ่มต้น (ใช้ในแอดมิน) — admin = ขวาชมพู (ฝั่งตัวเอง), customer = ซ้าย */
.chat-msg.customer { background: var(--bg-2); align-self: flex-start; }
.chat-msg.admin { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; align-self: flex-end; }

/* มุมมองลูกค้า — สลับ: admin = ซ้ายชมพู (ร้านค้า), customer = ขวา (ตัวเอง) */
.chat-box[data-view="customer"] .chat-msg.customer { align-self: flex-end; }
.chat-box[data-view="customer"] .chat-msg.admin { align-self: flex-start; }
.chat-sender { font-size: .8rem; font-weight: 600; margin-bottom: .2rem; opacity: .9; display: flex; align-items: center; gap: .4rem; }
.chat-text { white-space: pre-wrap; word-break: break-word; font-size: .8rem; }
.chat-text--deleted { font-style: italic; opacity: .65; font-size: .8rem; }
.chat-msg.is-deleted { opacity: .8; }
.chat-msg.is-deleted .chat-text { background: transparent; }
.chat-msg-delete {
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18);
  color: inherit; width: 20px; height: 20px; line-height: 1; border-radius: 50%;
  font-size: 14px; cursor: pointer; padding: 0; display: inline-flex;
  align-items: center; justify-content: center; opacity: .55; transition: opacity .12s, background .12s;
}
.chat-msg-delete:hover { opacity: 1; background: rgba(255, 99, 99, .35); border-color: rgba(255, 99, 99, .55); }
.chat-msg-delete:disabled { cursor: wait; opacity: .3; }
.chat-msg.customer .chat-msg-delete { background: rgba(0, 0, 0, .12); border-color: rgba(0, 0, 0, .18); }
.chat-msg.customer .chat-msg-delete:hover { background: rgba(255, 99, 99, .25); border-color: rgba(255, 99, 99, .45); }
.chat-time { font-size: .7rem; opacity: .7; margin-top: .3rem; }
.chat-form { display: flex; flex-direction: column; gap: .85rem; }
.chat-composer {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 10px;
  background: rgba(30, 30, 42, .72);
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-base) ease;
}
.chat-composer:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.chat-form .chat-composer textarea {
  display: block;
  width: 100%;
  min-height: 82px;
  padding: .85rem .95rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  line-height: 1.55;
  resize: vertical;
  box-shadow: none;
}
.chat-form .chat-composer textarea:focus {
  border-color: transparent;
  box-shadow: none;
}
.chat-form textarea::placeholder {
  color: var(--muted);
}
.chat-composer-preview {
  position: relative;
  width: fit-content;
  max-width: calc(100% - 1.5rem);
  margin: .75rem .75rem 0;
  padding: .35rem;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 11px;
  background: rgba(9, 9, 16, .42);
}
.chat-composer-preview[hidden] {
  display: none;
}
.chat-composer-preview img {
  display: block;
  width: auto;
  max-width: 260px;
  max-height: 220px;
  border-radius: 8px;
  object-fit: contain;
}
.chat-composer-preview__remove {
  position: absolute;
  top: .55rem;
  right: .55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 9px;
  background: rgba(24, 21, 35, .92);
  color: #fca5a5;
  box-shadow: 0 8px 20px rgba(var(--shadow-ink), .32);
  cursor: pointer;
  transition: color var(--dur-fast) ease, background var(--dur-fast) ease, transform var(--dur-fast) ease;
}
.chat-composer-preview__remove:hover,
.chat-composer-preview__remove:focus-visible {
  outline: none;
  background: rgba(239, 68, 68, .9);
  color: #fff;
  transform: translateY(-1px);
}
.chat-actions { display: flex; gap: .75rem; align-items: center; justify-content: flex-end; }
.chat-file-btn,
.admin-body .chat-form .chat-file-btn {
  cursor: pointer;
  margin-right: auto;
  min-height: 48px;
  padding: .65rem 1rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, .035);
  border-color: rgba(255, 255, 255, .08);
  color: #eef0fa;
  font-weight: var(--fw-bold);
  font-size: .9rem;
}
.chat-file-btn:hover {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .14);
}
.chat-send-btn,
.admin-body .chat-form .chat-send-btn {
  min-height: 48px;
  min-width: 126px;
  border-radius: 10px;
  background: linear-gradient(135deg, #a855f7, #9333ea);
  box-shadow: 0 10px 24px rgba(147, 51, 234, .24);
  font-size: .9rem;
}
.chat-send-btn .lucide,
.chat-file-btn .lucide {
  color: currentColor;
}
.chat-image-wrap { margin-top: .4rem; }
.chat-image {
  max-width: 280px; max-height: 280px; border-radius: 8px;
  display: block; cursor: pointer; border: 1px solid var(--border);
}
@media (max-width: 560px) {
  .chat-actions {
    align-items: stretch;
  }
  .chat-file-btn,
  .admin-body .chat-form .chat-file-btn,
  .chat-send-btn,
  .admin-body .chat-form .chat-send-btn {
    min-height: 46px;
  }
  .chat-composer-preview img {
    max-width: min(240px, calc(100vw - 5rem));
    max-height: 200px;
  }
}
.save-link-hint {
  margin: 1.5rem 0; padding: 1rem;
  background: var(--bg-2); border: 1px dashed var(--primary);
  border-radius: var(--radius);
}
.save-link-hint code { word-break: break-all; }
.order-credential-summary {
  align-items: center;
  flex-wrap: wrap;
  gap: .45rem;
}
.order-credential-summary code { word-break: break-all; }

/* ============ My Orders ============ */
.my-orders-list { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.5rem; }
.my-order-card {
  position: relative;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.2rem;
  transition: all .15s;
}
.my-order-card:hover { border-color: var(--primary); transform: translateY(-2px); }
/* มีข้อความแชทใหม่ที่ยังไม่อ่าน — ขอบการ์ดสีม่วงให้สะดุดตา */
.my-order-card--unread { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary-soft); }
/* ลิงก์คลุมทั้งการ์ด — กดที่ไหนก็ได้ ไม่มีโซนตาย */
.my-order-stretched-link {
  position: absolute; inset: 0;
  z-index: 1;
  border-radius: inherit;
}
/* เลขออเดอร์ต้องคัดลอกได้ จึงอยู่เหนือ overlay link (ชื่อสินค้าให้ตกใต้ overlay เพื่อให้กดแล้วพาไปหน้า order) */
.my-order-card .order-code { position: relative; z-index: 2; }
.my-order-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; }
.my-order-head-left { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; min-width: 0; }
/* order code เป็นข้อมูลรอง — เล็ก จาง ไม่แย่งสายตาจากสถานะ */
.my-order-head .order-code { font-family: monospace; color: var(--muted); font-weight: 500; font-size: .82rem; }
.my-order-amount { font-weight: 600; font-size: 1.1rem; }
.my-order-body { margin-top: .5rem; padding-top: .5rem; border-top: 1px dashed var(--border); }
.my-order-item-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.my-order-item { font-weight: 600; font-size: 1.02rem; min-width: 0; }
.my-order-item-link { flex: 1; min-width: 0; }
.my-order-item .muted { font-weight: normal; font-size: .9em; margin-left: .3rem; }
.my-order-meta-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: .3rem; }
.my-order-meta { display: flex; align-items: center; font-size: .85rem; flex-wrap: wrap; gap: .5rem; min-width: 0; }
.my-order-reorder-form { flex-shrink: 0; position: relative; z-index: 2; }
.my-order-reorder-btn {
  padding: .45rem .8rem;
  border-radius: 12px;
  white-space: nowrap;
}
.my-order-reorder-btn .lucide { color: currentColor; }
@media (max-width: 560px) {
  .my-order-item-row { align-items: flex-start; }
  .my-order-meta-row { align-items: flex-start; flex-direction: column; }
  .my-order-reorder-form { align-self: stretch; }
  .my-order-reorder-btn { width: 100%; min-height: 44px; justify-content: center; }
}
.unread-badge {
  display: inline-flex; align-items: center; gap: .25rem;
  background: var(--primary); color: #fff; padding: .15rem .6rem;
  border-radius: 999px; font-weight: 600; font-size: .78rem;
  box-shadow: 0 0 0 3px var(--primary-soft);
}
/* ป้ายในการ์ดประวัติการสั่งซื้อ — เล็กลงเล็กน้อย ไม่แย่งสายตา (เฉพาะการ์ด ไม่กระทบหน้าอื่น) */
.my-order-head .status-chip { padding: .22rem .65rem; font-size: .76rem; }
.my-order-head .unread-badge { padding: .12rem .5rem; font-size: .72rem; box-shadow: 0 0 0 2px var(--primary-soft); }

/* ============ Search status (live filter) ============ */
.search-status {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .55rem .85rem;
  margin: 0 0 1rem; color: var(--muted); font-size: .9rem;
}
.search-status a { color: var(--primary); margin-left: .25rem; }
.search-status a:hover { text-decoration: underline; }

/* ============ Pagination ============ */
.pagination {
  display: flex; gap: .4rem; flex-wrap: wrap;
  justify-content: center; align-items: center;
  margin: 2rem 0;
}
.page-link {
  padding: .5rem .9rem; border-radius: 8px;
  background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text); text-decoration: none; font-weight: 500;
  transition: all .15s;
}
.page-link:hover { border-color: var(--primary); color: var(--primary); }
.page-link.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.page-info { margin-left: auto; font-size: .9rem; }
@media (max-width: 600px) {
  .page-info { margin: .5rem auto 0; width: 100%; text-align: center; }
}

/* ============ Delivery note & badges ============ */
.badge-discord {
  background: #5865F2; color: #fff; border: 0;
}
.delivery-note {
  background: rgba(88,101,242,.12);
  border: 1px solid #5865F2;
  color: #c7d2fe;
  padding: .6rem .9rem;
  border-radius: 8px;
  font-size: .9rem;
  margin-top: .5rem;
}
.ai-screenshot-thumb {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  margin-top: 0.55rem;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-3);
  text-decoration: none;
  color: var(--muted);
  font: inherit;
  text-align: left;
  cursor: pointer;
  max-width: 180px;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.ai-screenshot-thumb:hover,
.ai-screenshot-thumb:focus-visible {
  border-color: rgba(167,139,250,.55);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(var(--shadow-ink),.25);
  outline: none;
}
.ai-screenshot-thumb img {
  display: block;
  width: 100%;
  height: 130px;
  object-fit: contain;
  object-position: center;
  border-radius: 6px;
  background: #1a1626;
}
.ai-screenshot-thumb__label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--muted);
}
.image-viewer-open {
  overflow: hidden;
}
.image-viewer[hidden] {
  display: none;
}
.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 3vw, 2rem);
}
.image-viewer__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(3, 5, 12, .82);
  backdrop-filter: blur(6px);
  cursor: zoom-out;
}
.image-viewer__panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.75rem;
  max-width: min(94vw, 980px);
  max-height: 92vh;
}
.image-viewer__img {
  display: block;
  max-width: min(94vw, 980px);
  max-height: 82vh;
  object-fit: contain;
  border-radius: 10px;
  background: #050812;
  box-shadow: 0 24px 70px rgba(var(--shadow-ink),.55);
}
.image-viewer__caption {
  color: #f8fafc;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  text-shadow: 0 1px 8px rgba(0,0,0,.45);
}
.image-viewer__close {
  position: absolute;
  top: -0.75rem;
  right: -0.75rem;
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
  background: rgba(15, 23, 42, .92);
  color: #ffffff;
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(var(--shadow-ink),.35);
}
.image-viewer__close:hover,
.image-viewer__close:focus-visible {
  border-color: rgba(196,181,253,.68);
  background: rgba(88, 46, 148, .95);
  outline: none;
}
.badge-mini {
  display: inline-block; background: #5865F2; color: #fff;
  padding: .1rem .5rem; border-radius: 999px; font-size: .7rem;
  margin-left: .4rem; font-weight: 500;
}

/* Real-time status indicator */
.rt-status {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin-left: auto;
  font-size: .78rem;
  font-weight: var(--fw-semibold);
  padding: .28rem .65rem;
  border-radius: 999px;
  letter-spacing: 0;
  vertical-align: middle;
  white-space: nowrap;
}
.rt-status.online {
  background: rgba(34,197,94,.14); color: #22c55e;
  animation: pulse 2s ease-in-out infinite;
}
.rt-status.offline {
  background: rgba(239,68,68,.15); color: #ef4444;
}
.rt-status.closed-tag {
  background: rgba(148,163,184,.15); color: #cbd5e1;
  animation: none;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}

/* Read-only chat (order closed) */
.chat-box.chat-readonly {
  opacity: .92;
  position: relative;
}
.chat-closed-notice {
  margin-bottom: .8rem; line-height: 1.6;
}
.chat-closed-notice .link-discord {
  display: inline-flex; align-items: center; gap: .35rem;
  color: var(--discord); font-weight: 600;
  background: rgba(88,101,242,.12);
  padding: .2rem .6rem; border-radius: 6px;
  margin-left: .25rem;
}
.chat-closed-notice .link-discord:hover {
  background: rgba(88,101,242,.22); color: var(--discord);
}

/* Order closed notice card */
.order-closed-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.order-closed-card__main {
  display: flex;
  align-items: center;
  gap: .9rem;
  min-width: 0;
}
.order-closed-card__icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}
.order-closed-card__text {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  min-width: 0;
}
.order-closed-card__title {
  font-weight: 600;
  font-size: .9rem;
  color: var(--text);
  line-height: 1.3;
}
.order-closed-card__sub {
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.4;
}
.order-closed-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  flex-shrink: 0;
}
.order-closed-card__btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem 1rem;
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: .9rem;
  text-decoration: none;
  transition: background .15s, transform .15s, color .15s, border-color .15s, box-shadow .2s;
}
.order-closed-card__btn:hover {
  transform: translateY(-1px);
}
.order-closed-card__btn--discord:hover {
  background: var(--discord);
  color: #fff;
  border-color: var(--discord);
  box-shadow: 0 6px 14px rgba(88,101,242,.2);
}
.order-closed-card__btn--contact:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 6px 14px rgba(168,85,247,.18);
}
@media (max-width: 640px) {
  .order-closed-card {
    flex-direction: column;
    align-items: stretch;
  }
  .order-closed-card__actions {
    justify-content: flex-end;
  }
  .order-closed-card__btn {
    flex: 1;
    justify-content: center;
  }
}

/* Filter bar (status filter chips) */
.order-filter { margin: 1rem 0 1.5rem; }
.chip-count {
  display: inline-block; margin-left: .35rem;
  background: rgba(255,255,255,.12);
  padding: .05rem .45rem; border-radius: 999px;
  font-size: .72rem; font-weight: 600;
  min-width: 18px; text-align: center;
}
.chip.active .chip-count {
  background: rgba(255,255,255,.25);
  color: #fff;
}

/* ============ Admin login redesign ============ */
.admin-login-body {
  background: radial-gradient(1200px 800px at 80% -10%, #2a1855 0%, #0a0a1f 45%, #050510 100%) !important;
  min-height: 100vh;
  overflow: hidden;
  /* override .admin-body grid layout so login page is centered, not squeezed */
  display: block !important;
  grid-template-columns: none !important;
}
.admin-login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  position: relative;
}
.login-bg-orb {
  position: absolute; border-radius: 50%;
  filter: blur(70px); opacity: .5;
  pointer-events: none; z-index: 0;
}
.orb-1 { width: 380px; height: 380px; background: #ff7eb9; top: -80px; left: -100px; }
.orb-2 { width: 320px; height: 320px; background: #7b5cff; bottom: -60px; right: -80px; animation: float 8s ease-in-out infinite; }
.orb-3 { width: 260px; height: 260px; background: #4fc3f7; top: 40%; right: 15%; opacity: .3; animation: float 12s ease-in-out infinite reverse; }
@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.08); }
}

.login-card-new {
  position: relative; z-index: 1;
  width: 100%; max-width: 420px;
  background: rgba(18, 18, 35, 0.72);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 24px;
  padding: 2.5rem 2rem;
  box-shadow:
    0 30px 80px rgba(var(--shadow-ink),.55),
    0 1px 0 rgba(255,255,255,.05) inset;
  animation: cardIn .6s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(.96); }
  to { opacity: 1; transform: none; }
}

.login-brand { text-align: center; margin-bottom: 1.8rem; }
.login-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 72px; height: 72px; border-radius: 22px;
  background: linear-gradient(135deg, #ff7eb9 0%, #7b5cff 100%);
  font-size: 2.2rem;
  margin-bottom: .8rem;
  box-shadow: 0 12px 30px rgba(123,92,255,.4);
}
.login-brand h1 {
  font-size: 1.7rem; margin: 0;
  background: var(--brand-name-gradient);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  letter-spacing: -.5px;
}
.login-subtitle {
  color: rgba(255,255,255,.55); margin: .3rem 0 0; font-size: .9rem;
}

.login-form-new { display: flex; flex-direction: column; gap: .8rem; }
.input-group {
  position: relative; display: flex; align-items: center;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  transition: all .2s;
}
.input-group:focus-within {
  border-color: #ff7eb9;
  background: rgba(255,255,255,.07);
  box-shadow: 0 0 0 4px rgba(255,126,185,.12);
}
.input-icon {
  padding: 0 .85rem; font-size: 1.1rem; opacity: .7;
}
.input-group .pw-field {
  flex: 1;
}
.input-group input {
  flex: 1; background: transparent; border: 0; outline: 0;
  padding: .95rem .6rem .95rem 0;
  color: #fff; font-size: .95rem;
}
.input-group input::placeholder { color: var(--muted); }

.btn-login-primary {
  margin-top: .5rem;
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  padding: 1rem;
  background: linear-gradient(135deg, #ff7eb9 0%, #7b5cff 100%);
  color: #fff; border: 0; border-radius: 14px;
  font-size: 1rem; font-weight: 600; letter-spacing: .3px;
  cursor: pointer;
  transition: all .2s;
  box-shadow: none;
}
.btn-login-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(123,92,255,.26);
}
.btn-login-primary:active { transform: translateY(0); }
.btn-arrow { transition: transform .2s; }
.btn-login-primary:hover .btn-arrow { transform: translateX(4px); }

.login-divider {
  display: flex; align-items: center; gap: .8rem;
  margin: 1.4rem 0;
  color: rgba(255,255,255,.35);
  font-size: .85rem;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.08);
}

.btn-login-discord {
  display: flex; align-items: center; justify-content: center; gap: .7rem;
  padding: .95rem;
  background: #5865F2; color: #fff; text-decoration: none;
  border-radius: 14px; font-weight: 600; font-size: .95rem;
  transition: all .2s;
}
.btn-login-discord:hover {
  background: #4752c4;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(88,101,242,.22);
}

.login-footer-new {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 1.8rem;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(255,255,255,.06);
  font-size: .85rem;
}
.login-footer-new a { color: rgba(255,255,255,.55); text-decoration: none; }
.login-footer-new a:hover { color: #ff7eb9; }

@media (max-width: 480px) {
  .login-card-new { padding: 2rem 1.3rem; border-radius: 18px; }
  .login-logo { width: 64px; height: 64px; font-size: 1.9rem; }
  .login-brand h1 { font-size: 1.4rem; }
}

@media (max-width: 820px) {
  .order-grid { grid-template-columns: 1fr; }
  .order-recipient-grid { grid-template-columns: 1fr; }
}

/* Order detail (มือถือ) — คลายความแน่น: หด padding panel ให้เนื้อหาไม่ติดขอบ
   + ลดความสูงกล่องแชทไม่ให้กินทั้งจอ. คงสไตล์การ์ด/เงาเดิมไว้ทุกอย่าง */
@media (max-width: 600px) {
  .order-grid section { padding: 1.15rem 1rem; }
  .order-products-panel > h3 { margin-bottom: 1.1rem; }
  #messages.order-chat-panel { padding: 1.15rem 1rem; }
  #messages.order-chat-panel .chat-box { height: 320px; }
  /* ชื่อไฟล์ดาวน์โหลดยาว: <a> เดิมเป็น inline ทำให้ ellipsis ไม่ทำงานและล้นขอบ — block แล้วตัดได้ */
  .order-products-panel .file-card__name { display: block; }
}

/* ============ Footer ============ */
.site-footer {
  margin-top: var(--space-8);
  padding: var(--space-7) 0 var(--space-5);
  background:
    linear-gradient(to bottom, transparent, rgba(167,139,250,.04)),
    var(--bg-2);
  border-top: 0;
  position: relative;
}
.site-footer::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent 0%, #6E47CE 20%, #9D6BE1 50%, #D39BE8 80%, transparent 100%);
  opacity: .72;
}
.footer-top {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1.2fr;
  gap: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid rgba(157, 107, 225, .32);
}
.footer-brand .brand { font-size: var(--fs-xl); margin-bottom: var(--space-3); }
.footer-tagline {
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-loose);
  margin: 0 0 var(--space-4);
}
.footer-payments {
  display: flex; flex-wrap: wrap; gap: var(--space-2);
}
.footer-pay-pill {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  color: var(--muted);
}
.footer-pay-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 18px;
  border-radius: 4px;
  font-size: 9px; font-weight: var(--fw-bold);
  letter-spacing: .5px;
  color: #fff;
}
.footer-pay-icon--tmw { background: linear-gradient(135deg, #ff5722, #ff8a00); }
.footer-pay-icon--pp  { background: linear-gradient(135deg, #003d99, #0066cc); }

.footer-col h4 {
  margin: 0 0 var(--space-3);
  font-size: var(--fs-base);
  color: var(--text);
}
.footer-col a {
  display: block;
  color: var(--muted);
  padding: var(--space-1) 0;
  font-size: var(--fs-sm);
  transition: color var(--dur-fast) ease, transform var(--dur-fast) ease;
}
.footer-col a:hover {
  color: var(--primary);
  transform: translateX(2px);
}

.footer-socials {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.footer-socials .footer-social-circle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  padding: 0;
  border-radius: 50%;
  background: var(--bg-3, #1d1d2b);
  color: #fff !important;
  border: 1px solid var(--border);
  line-height: 1;
  transition: transform var(--dur-fast) ease, background var(--dur-fast) ease, box-shadow var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.footer-socials .footer-social-circle svg { display: block; }
.footer-socials .footer-social-circle:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(var(--shadow-ink),.35);
  color: #fff;
}
.footer-socials .footer-social-circle--discord:hover { background: #5865F2; border-color: #5865F2; }
.footer-socials .footer-social-circle--facebook:hover { background: #1877F2; border-color: #1877F2; }
.footer-socials .footer-social-circle--twitter:hover { background: #000; border-color: #000; }
.footer-socials .footer-social-circle--instagram:hover {
  background: radial-gradient(circle at 30% 110%, #fdf497 0%, #fdf497 8%, #fd5949 38%, #d6249f 55%, #285AEB 80%, #285AEB 100%);
  background-size: 140% 140%;
  background-position: center;
  background-repeat: no-repeat;
  border-color: transparent;
}
.footer-help {
  font-size: var(--fs-xs);
  line-height: var(--lh-loose);
  margin: var(--space-3) 0 0;
}

.footer-bottom {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: var(--space-4);
  flex-wrap: wrap; gap: var(--space-3);
}
.footer-copyright {
  color: var(--muted);
  font-size: var(--fs-sm);
  margin: 0;
}
.footer-copyright b {
  background: var(--brand-name-gradient);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.footer-trust {
  font-size: var(--fs-xs);
  margin: 0;
  display: inline-flex; gap: var(--space-2); flex-wrap: wrap; align-items: center;
}
.footer-trust-item { display: inline-flex; align-items: center; gap: var(--space-1); }
.footer-trust-sep { color: var(--border); }

/* แท็บเล็ต/จอกลาง (≤900): footer 2 คอลัมน์ — ชื่อร้าน+ติดต่อ&โซเชียลอยู่แถวบน, ช่วยเหลือ+ความปลอดภัยไหลลงแถวสอง, หด padding/gap
   (รวม ≤900 + ≤820 เดิมเข้าด้วยกัน เพื่อให้ช่วง 821–900 ใช้ footer แบบเดียวกับ ≤820) */
@media (max-width: 900px) {
  .site-footer {
    margin-top: var(--space-6);
    padding: var(--space-5) 0 var(--space-4);
  }
  .footer-top { grid-template-columns: 1fr 1fr; gap: var(--space-3) var(--space-5); }
  .footer-brand { grid-column: 1; grid-row: 1; }
  .footer-col:last-child { grid-column: 2; grid-row: 1; }
}
@media (max-width: 600px) {
  .site-footer {
    padding: var(--space-3) 0 var(--space-2);
    margin-top: var(--space-4);
  }
  .footer-top {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2) var(--space-3);
    padding-bottom: var(--space-3);
  }
  .footer-brand {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding-right: 9rem;
    min-height: 34px;
  }
  .footer-brand .brand {
    margin-bottom: 0;
    font-size: var(--fs-lg);
  }
  .footer-tagline,
  .footer-help {
    display: none;
  }
  .footer-payments { display: none; }
  .footer-col h4 {
    display: none;
  }
  .footer-col a {
    padding: .12rem 0;
    font-size: var(--fs-xs);
    line-height: 1.45;
  }
  .footer-col:last-child {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: end;
    align-self: center;
  }
  .footer-socials {
    gap: var(--space-1);
    margin-bottom: 0;
  }
  .footer-socials .footer-social-circle {
    width: 30px; height: 30px;
  }
  .footer-socials .footer-social-circle svg { width: 15px; height: 15px; }
  .footer-bottom {
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: var(--space-2);
    padding-top: var(--space-2);
  }
  .footer-copyright {
    font-size: .68rem;
  }
  .footer-trust {
    width: 100%;
    font-size: .62rem;
    line-height: 1.4;
  }
}

/* ============ Admin ============ */
.admin-body {
  --admin-font-body: 14px;
  --admin-font-secondary: 12px;
  --admin-font-page-title: 21px;
  --admin-font-panel-title: 15px;
  --admin-control-height: 36px;
  --admin-control-height-compact: 32px;
  --admin-radius-control: 6px;
  --admin-radius-panel: 8px;
  --admin-panel-padding: 1rem;
  --admin-layout-gap: .55rem;
  background: #0a0a0f;
}
.admin-body .site-header { display: none; }

.admin-login { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 2rem; }
.login-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2.5rem; max-width: 420px; width: 100%;
  box-shadow: var(--shadow);
}
.login-card h1 { text-align: center; margin-top: 0; }
.login-card .back-home { display: block; text-align: center; margin-top: 1rem; }

.admin-body {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
  font-size: var(--admin-font-body);
}
.admin-sidebar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
}
.admin-sidebar__head {
  padding: 1.15rem .9rem .75rem;
}
.admin-sidebar__nav {
  min-height: 0;
  padding: .1rem .65rem .75rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.admin-sidebar__foot {
  display: grid;
  gap: .2rem;
  padding: .7rem .65rem;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.admin-nav-group + .admin-nav-group {
  margin-top: .72rem;
}
.admin-nav-group__label {
  padding: .18rem .68rem .3rem;
  color: #77778a;
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.2;
}
.admin-nav-group {
  display: grid;
  gap: .2rem;
}
.admin-sidebar__nav a,
.admin-sidebar__foot > a,
.admin-sidebar-theme,
.admin-sidebar-logout button {
  min-height: var(--admin-control-height);
  padding: .55rem .72rem;
  border-radius: var(--admin-radius-control);
  color: var(--muted); font-weight: 500; transition: all .2s;
  display: flex; align-items: center; gap: .65rem;
}
.admin-sidebar-logout { margin: 0; }
.admin-sidebar-logout button {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}
.admin-sidebar-theme {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.admin-sidebar__nav a > .nav-link-main {
  display: inline-flex; align-items: center; gap: .65rem;
  flex: 1; min-width: 0;
}
.admin-sidebar__nav a:hover,
.admin-sidebar__foot > a:hover,
.admin-sidebar-theme:hover,
.admin-sidebar-logout button:hover { background: var(--bg-3); color: var(--text); }
.admin-sidebar__nav a.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
}

/* Sidebar badge — เลขแดงข้างเมนูเมื่อมี unread */
.sidebar-badge {
  min-width: 20px; height: 20px; padding: 0 6px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff;
  border-radius: 999px;
  font-size: var(--fs-xs); font-weight: var(--fw-bold);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px rgba(15,15,20,.6);
  flex-shrink: 0;
  animation: badge-pop .35s var(--ease-spring);
}
.sidebar-badge.is-zero { display: none; }
.admin-sidebar__nav a.active .sidebar-badge {
  box-shadow: 0 0 0 2px rgba(255,255,255,.25);
}
.admin-main { min-width: 0; padding: 2rem; max-width: 100%; overflow-x: auto; }
.admin-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem;
}
.admin-header h1 {
  margin: 0;
  font-size: var(--admin-font-page-title);
  line-height: 1.25;
}
.admin-page-header {
  align-items: flex-start;
  margin-bottom: 1rem;
}
.admin-page-header > div:first-child {
  min-width: 0;
}
.admin-page-header h1 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .55rem;
}
.admin-page-header p {
  max-width: 760px;
  margin: .3rem 0 0;
  line-height: 1.55;
}
.admin-page-count {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 400;
}
.admin-page-header > .admin-header-actions {
  align-self: flex-start;
  margin-top: 0;
}
.admin-page-header .admin-header-actions--filters {
  margin-bottom: 0;
}
.admin-body .panel h3,
.admin-body .panel-title-row h3 {
  font-size: var(--admin-font-panel-title);
}
.admin-body .panel h3 > .lucide,
.admin-body .panel-title-row h3 > .lucide {
  margin-right: .45rem;
  vertical-align: -.2em;
}
.admin-body .muted.small,
.admin-body small.muted {
  font-size: var(--admin-font-secondary);
}

@media (min-width: 1024px) {
  .admin-body {
    grid-template-columns: 216px 1fr;
  }
  .admin-sidebar__head {
    padding: 1rem .8rem .65rem;
  }
  .admin-sidebar__nav {
    padding-right: .5rem;
    padding-left: .5rem;
  }
  .admin-sidebar__foot {
    padding: .62rem .5rem;
  }
  .admin-sidebar__nav a,
  .admin-sidebar__foot > a,
  .admin-sidebar-theme,
  .admin-sidebar-logout button {
    padding: .52rem .7rem;
  }
  .admin-main {
    padding: 1.6rem;
  }
  .admin-header {
    margin-bottom: 1.5rem;
  }
  .admin-page-header {
    margin-bottom: 1rem;
  }
  .admin-page-header > .admin-header-actions {
    padding-right: 3.35rem;
  }
  .admin-body .panel {
    padding: var(--admin-panel-padding);
    border-radius: var(--admin-radius-panel);
  }
  .admin-body .data-table th,
  .admin-body .data-table td {
    padding: .58rem .5rem;
  }
  .admin-body .btn {
    min-height: var(--admin-control-height);
    padding: .48rem .78rem;
    border-radius: var(--admin-radius-control);
    font-size: .82rem;
  }
  .admin-body .btn-sm {
    min-height: var(--admin-control-height-compact);
    padding: .34rem .58rem;
    font-size: .76rem;
  }
  .admin-body .btn-icon,
  .admin-body .btn-icon.btn-sm {
    width: 2rem;
    min-width: 2rem;
    height: 2rem;
    padding: 0;
  }
  .admin-body .thumb {
    width: 43px;
    height: 43px;
  }
  .admin-body .admin-filter-input,
  .admin-body .admin-filter-select,
  .admin-body .form-row input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  .admin-body .form-row select,
  .admin-body .inline-form input:not([type="file"]),
  .admin-body .inline-form select {
    min-height: var(--admin-control-height);
    padding: .45rem .62rem;
    border-radius: var(--admin-radius-control);
    font-size: .82rem;
  }
}

html[data-theme="light"] .admin-body {
  background: var(--bg);
}
/* ============ Admin Notification Bell ============ */
.admin-notif {
  position: fixed; top: 1rem; right: 1.25rem; z-index: 200;
}
.admin-notif__btn {
  position: relative;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, box-shadow .2s ease;
  box-shadow: 0 4px 12px rgba(var(--shadow-ink),.3);
}
.admin-notif__btn:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(168,85,247,.25);
}
.admin-notif__btn.has-new .admin-notif__icon {
  animation: bell-shake .8s ease;
}
@keyframes bell-shake {
  0%, 100% { transform: rotate(0); }
  10%, 30%, 50% { transform: rotate(-15deg); }
  20%, 40%, 60% { transform: rotate(15deg); }
  70% { transform: rotate(0); }
}
.admin-notif__icon { display: block; }
.admin-notif__badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 20px; height: 20px; padding: 0 5px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff;
  border-radius: 999px;
  font-size: .7rem; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--bg-2);
  animation: badge-pop .35s cubic-bezier(.34, 1.5, .64, 1);
}
.admin-notif__badge.is-zero { display: none; }
@keyframes badge-pop {
  0% { transform: scale(0); }
  60% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.admin-notif__panel {
  position: absolute; top: 52px; right: 0;
  width: 380px; max-width: calc(100vw - 2rem);
  max-height: 75vh;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(var(--shadow-ink),.55);
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: panel-slide .18s ease-out;
}
@keyframes panel-slide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.admin-notif__panel[hidden] { display: none; }
.admin-notif__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-3);
}
.admin-notif__read-all {
  background: none; border: 0; color: var(--primary);
  font-size: .82rem; font-weight: 600; cursor: pointer;
  padding: .25rem .5rem; border-radius: 6px;
}
.admin-notif__read-all:hover { background: rgba(168,85,247,.12); }
.admin-notif__list {
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
}
.admin-notif__empty {
  padding: 2rem 1rem; text-align: center; color: var(--muted);
  font-size: .9rem;
}
.admin-notif__item {
  display: flex; gap: .75rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none; color: var(--text);
  transition: background .12s ease;
  position: relative;
}
.admin-notif__item:hover { background: var(--bg-3); }
.admin-notif__item:last-child { border-bottom: 0; }
.admin-notif__item.is-unread {
  background: rgba(168,85,247,.06);
}
.admin-notif__item.is-unread::before {
  content: ""; position: absolute; left: 6px; top: 50%;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary);
  transform: translateY(-50%);
  box-shadow: 0 0 8px rgba(168,85,247,.6);
}
.admin-notif__item-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg-3); color: var(--muted);
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}
/* สีตามชนิด — พื้น tint อ่อน + เส้นไอคอนสีเต็ม ให้สแกนเร็ว
   (ใช้ :has() จับชื่อไอคอน; เบราว์เซอร์เก่าที่ไม่รองรับ fallback เป็น chip กลาง) */
.admin-notif__item-icon:has(.lucide-shopping-cart)  { background: rgba(34,197,94,.14);  color: #22c55e; }
.admin-notif__item-icon:has(.lucide-message-square) { background: rgba(59,130,246,.14); color: #3b82f6; }
.admin-notif__item-icon:has(.lucide-x-circle)       { background: rgba(239,68,68,.14);  color: #ef4444; }
.admin-notif__item-icon:has(.lucide-alert-triangle) { background: rgba(249,115,22,.14); color: #f97316; }
.admin-notif__item-icon:has(.lucide-package)        { background: rgba(245,158,11,.14); color: #f59e0b; }
.admin-notif__item-icon:has(.lucide-shield)         { background: rgba(168,85,247,.16); color: #a855f7; }
.admin-notif__item-body {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0; flex: 1;
}
.admin-notif__item-title {
  font-weight: 600; font-size: .92rem;
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.admin-notif__item-text {
  color: var(--muted); font-size: .82rem;
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.admin-notif__item-time {
  color: var(--muted); font-size: .72rem;
  margin-top: 2px;
}
.admin-notif__foot {
  padding: .65rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-3);
  display: flex; align-items: center; justify-content: space-between;
}
.admin-notif__sound {
  display: inline-flex; align-items: center; gap: .4rem;
  color: var(--muted); font-size: .8rem; cursor: pointer;
}
.admin-notif__sound input { cursor: pointer; }

@media (max-width: 720px) {
  .admin-notif { top: .5rem; right: .5rem; }
  .admin-notif__panel {
    width: min(320px, calc(100vw - 1rem));
    right: -.25rem;
    max-height: 55vh;
    border-radius: 10px;
  }
  .admin-notif__head {
    padding: .45rem .7rem;
  }
  .admin-notif__head strong { font-size: .82rem; }
  .admin-notif__read-all { font-size: .7rem; padding: .15rem .35rem; }
  .admin-notif__item {
    gap: .45rem;
    padding: .4rem .7rem;
  }
  .admin-notif__item-icon {
    width: 28px; height: 28px;
    margin-top: 1px;
  }
  .admin-notif__item-title {
    font-size: .76rem;
    line-height: 1.25;
  }
  .admin-notif__item-text {
    display: none; /* ซ่อนรายละเอียดบนมือถือ — กดเข้าไปอ่านเต็มได้ */
  }
  .admin-notif__item-time {
    font-size: .62rem;
    margin-top: 1px;
  }
  .admin-notif__item.is-unread::before {
    left: 2px;
    width: 4px;
    height: 4px;
  }
  .admin-notif__foot {
    padding: .35rem .7rem;
  }
  .admin-notif__sound { font-size: .68rem; }
  .admin-notif__empty { padding: 1rem; font-size: .8rem; }
}

/* ============ Customer Notification Bell ============ */
.customer-notif {
  position: relative;
  flex-shrink: 0;
}
.customer-notif__btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, box-shadow .2s ease;
}
.customer-notif__btn:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(168,85,247,.22);
}
.customer-notif__btn.has-new .customer-notif__icon {
  animation: bell-shake .8s ease;
}
.customer-notif__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff;
  font-size: .68rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--bg-2);
  animation: badge-pop .35s var(--ease-spring);
}
.customer-notif__badge.is-zero { display: none; }
.customer-notif__panel {
  position: absolute;
  top: 48px;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 2rem);
  max-height: 70vh;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(var(--shadow-ink),.55);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 250;
  animation: panel-slide .18s ease-out;
}
.customer-notif__panel[hidden] { display: none; }
.customer-notif__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-3);
}
.customer-notif__read-all {
  background: none;
  border: 0;
  color: var(--primary);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  padding: .25rem .5rem;
  border-radius: 6px;
}
.customer-notif__read-all:hover { background: rgba(168,85,247,.12); }
.customer-notif__list {
  overflow-y: auto;
  flex: 1;
}
.customer-notif__empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
}
.customer-notif__item {
  display: flex;
  gap: .75rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: background .12s ease;
  position: relative;
}
.customer-notif__item:hover { background: var(--bg-3); }
.customer-notif__item.is-unread {
  background: rgba(167,139,250,.08);
}
.customer-notif__item.is-unread::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-50%);
  box-shadow: 0 0 8px rgba(167,139,250,.65);
}
.customer-notif__item-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-3); color: var(--muted);
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}
/* สีตามชนิด (ดู .admin-notif__item-icon ด้านบนสำหรับเหตุผล :has()) */
.customer-notif__item-icon:has(.lucide-package)        { background: rgba(59,130,246,.14); color: #3b82f6; }
.customer-notif__item-icon:has(.lucide-message-square) { background: rgba(167,139,250,.16); color: #a78bfa; }
.customer-notif__item-icon:has(.lucide-gift)           { background: rgba(236,72,153,.14); color: #ec4899; }
.customer-notif__item-icon:has(.lucide-mail)           { background: rgba(249,115,22,.14); color: #f97316; }
.customer-notif__item-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.customer-notif__item-title {
  font-weight: 600;
  font-size: .92rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-notif__item-text {
  color: var(--muted);
  font-size: .82rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.customer-notif__item-time {
  color: var(--muted);
  font-size: .72rem;
  margin-top: 2px;
}

@media (max-width: 720px) {
  .customer-notif__panel {
    position: fixed;
    top: 4.75rem;
    left: .75rem;
    right: .75rem;
    width: auto;
    max-width: none;
    max-height: min(62svh, 420px);
    border-radius: 14px;
    z-index: 1300;
  }
  .customer-notif__head {
    padding: .45rem .7rem;
  }
  .customer-notif__head strong { font-size: .82rem; }
  .customer-notif__read-all { font-size: .7rem; padding: .15rem .35rem; }
  .customer-notif__item {
    gap: .45rem;
    padding: .4rem .7rem;
  }
  .customer-notif__item-icon {
    width: 28px; height: 28px;
    margin-top: 1px;
  }
  .customer-notif__item-title {
    font-size: .76rem;
    line-height: 1.25;
  }
  .customer-notif__item-text {
    display: none; /* ซ่อนรายละเอียดบนมือถือ — กดเข้าไปอ่านเต็มได้ */
  }
  .customer-notif__item-time {
    font-size: .62rem;
    margin-top: 1px;
  }
  .customer-notif__item.is-unread::before {
    left: 2px;
    width: 4px;
    height: 4px;
  }
  .customer-notif__empty { padding: 1rem; font-size: .8rem; }
}

.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem; margin-bottom: 2rem;
}
.stat-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem;
}
.stat-card.alert { border-color: var(--warn); }
.stat-label { color: var(--muted); font-size: .9rem; }
.stat-value { font-size: 2rem; font-weight: 600; margin: .3rem 0; }
.stat-sub { color: var(--muted); font-size: .85rem; }

/* Stat card ที่คลิกได้ (link to filtered page) */
a.stat-card--link {
  display: block; color: inherit; text-decoration: none;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
a.stat-card--link:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(var(--shadow-ink),.25);
}
a.stat-card--link.alert:hover { border-color: var(--warn); }

/* Dashboard compact stats row (Row 4 secondary metrics) */
.dashboard-compact-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  padding: 1rem 1.2rem;
}
.dashboard-compact-stat {
  display: flex; flex-direction: column; gap: .15rem;
}
.dashboard-compact-stat strong {
  font-size: 1.2rem; color: var(--text); font-weight: 600;
}

.admin-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 1024px) { .admin-grid-2 { grid-template-columns: 1fr; } }

.panel-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.panel-title-row h3 { margin: 0; }
.dashboard-chart-panel { overflow: hidden; }
.mini-bar-chart {
  display: grid;
  grid-template-columns: repeat(14, minmax(18px, 1fr));
  gap: .55rem;
  align-items: end;
  min-height: 190px;
}
.mini-bar-chart__item {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .45rem;
}
.mini-bar-chart__track {
  width: 100%;
  height: 132px;
  display: flex;
  align-items: end;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  border: 1px solid var(--border);
  overflow: hidden;
}
.mini-bar-chart__bar {
  width: 100%;
  min-height: 4px;
  display: block;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: linear-gradient(180deg, var(--primary), var(--accent));
}
.mini-bar-chart__label {
  color: var(--muted);
  font-size: .72rem;
  text-align: center;
  white-space: nowrap;
}
.line-list,
.rank-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.line-list__row {
  display: grid;
  grid-template-columns: minmax(74px, .8fr) minmax(120px, 2fr) minmax(110px, auto) minmax(68px, auto);
  gap: .75rem;
  align-items: center;
}
.line-list__label,
.line-list__value {
  font-size: var(--fs-sm);
}
.line-list__value {
  text-align: right;
  font-weight: var(--fw-semibold);
}
.line-list__track {
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--bg-3);
  overflow: hidden;
}
.line-list__fill {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.trend {
  display: inline-flex;
  justify-content: flex-end;
  min-width: 64px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
}
.trend--up { color: var(--success); }
.trend--down { color: var(--danger); }
.rank-list__row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: .75rem;
  align-items: center;
}
.rank-list__index {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: var(--fw-bold);
}
.rank-list__body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  min-width: 0;
  padding-bottom: .45rem;
}
.rank-list__body strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-list__bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  min-width: 4px;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.rank-list__value {
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.refund-meter {
  display: grid;
  gap: .8rem;
  align-content: center;
  min-height: 150px;
}
.refund-meter__value {
  font-size: 2.4rem;
  font-weight: var(--fw-bold);
}
.refund-meter__track {
  height: 14px;
  background: var(--bg-3);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.refund-meter__track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--warn), var(--danger));
}
.repeat-meter__track span {
  background: linear-gradient(90deg, var(--primary), var(--success));
}
.table-scroll {
  overflow-x: auto;
  scrollbar-width: thin;
}
.dashboard-monthly-table {
  min-width: 760px;
}
.dashboard-monthly-table td,
.dashboard-monthly-table th {
  white-space: nowrap;
}

@media (max-width: 720px) {
  .panel-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: .25rem;
  }
  .mini-bar-chart {
    grid-template-columns: repeat(7, minmax(24px, 1fr));
    row-gap: 1rem;
  }
  .line-list__row {
    grid-template-columns: 1fr auto;
  }
  .line-list__track {
    grid-column: 1 / -1;
    order: 3;
  }
  .trend {
    justify-content: flex-start;
  }
}

.panel {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem;
}
.panel h3 { margin-top: 0; }
.panel.collapsible summary { cursor: pointer; padding: .3rem 0; font-size: 1.05rem; }
.panel.collapsible[open] summary { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }

.admin-disclosure > summary.admin-disclosure__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  list-style: none;
  cursor: pointer;
}
.stat-label,
.admin-link-action {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.admin-link-action {
  white-space: nowrap;
}
.admin-disclosure > summary.admin-disclosure__summary::-webkit-details-marker {
  display: none;
}
.admin-disclosure > summary.admin-disclosure__summary::marker {
  content: "";
}
.admin-disclosure__title {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
}
.admin-disclosure__title > span:last-child,
.admin-disclosure__title > b:last-child {
  min-width: 0;
}
.admin-disclosure__chevron {
  flex: 0 0 auto;
  color: var(--muted);
  transition: transform .18s ease, color .18s ease;
}
.admin-disclosure[open] > summary.admin-disclosure__summary .admin-disclosure__chevron {
  color: #c4b5fd;
  transform: rotate(180deg);
}
.admin-disclosure > summary.admin-disclosure__summary:hover {
  background: rgba(255,255,255,.025);
}
.admin-tool-panel > summary.admin-disclosure__summary:hover {
  background: transparent;
}
.admin-disclosure > summary.admin-disclosure__summary:focus-visible {
  outline: 2px solid rgba(139, 92, 246, .58);
  outline-offset: -2px;
}
.admin-disclosure--panel {
  padding: 0;
  overflow: hidden;
}
.admin-disclosure--panel > summary.admin-disclosure__summary {
  min-height: 48px;
  padding: .76rem 1rem;
  font-size: 1.02rem;
  font-weight: 600;
}
.admin-disclosure--panel[open] > summary.admin-disclosure__summary {
  margin-bottom: 0;
  padding-bottom: .76rem;
  border-bottom: 1px solid rgba(148, 163, 184, .16);
}
.admin-disclosure__body {
  padding: .85rem 1rem 1rem;
}
.admin-disclosure__body > :first-child {
  margin-top: 0;
}
.admin-disclosure--compact > summary.admin-disclosure__summary {
  min-height: 36px;
  padding: .45rem .55rem;
  border-radius: 6px;
  font-size: .84rem;
  font-weight: 600;
}
.admin-disclosure--compact[open] > summary.admin-disclosure__summary {
  margin-bottom: .45rem;
}

.admin-file-picker {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  max-width: 100%;
  min-width: 0;
}
.admin-body .admin-file-picker > input.admin-file-picker__input,
.admin-file-picker > input.admin-file-picker__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}
.admin-file-picker__button {
  min-height: 36px;
  flex: 0 0 auto;
}
.admin-file-picker__input:focus-visible + .admin-file-picker__button {
  outline: 2px solid rgba(139, 92, 246, .58);
  outline-offset: 2px;
}
.admin-file-picker__name {
  min-width: 0;
  max-width: min(260px, 34vw);
  overflow: hidden;
  color: var(--muted);
  font-size: .86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-file-picker.has-file .admin-file-picker__name {
  color: var(--text);
}
.admin-file-picker__clear {
  min-height: 32px;
  flex: 0 0 auto;
}
.admin-file-picker--compact {
  gap: 0;
  width: min(100%, 420px);
  min-width: min(100%, 280px);
  min-height: 38px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-3);
}
.admin-file-picker--compact .admin-file-picker__button {
  min-height: 38px;
  margin: 0;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  white-space: nowrap;
}
.admin-file-picker--compact .admin-file-picker__button:hover {
  background: rgba(255,255,255,.035);
}
.admin-file-picker--compact .admin-file-picker__input:focus-visible + .admin-file-picker__button {
  outline-offset: -2px;
}
.admin-file-picker--compact .admin-file-picker__name {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  max-width: none;
  min-height: 38px;
  padding: 0 .72rem;
}
@media (max-width: 720px) {
  .admin-file-picker {
    width: 100%;
    flex-wrap: wrap;
  }
  .admin-file-picker--compact {
    flex-wrap: nowrap;
  }
  .admin-file-picker--compact .admin-file-picker__button {
    width: auto;
  }
  .admin-file-picker__name {
    flex: 1 1 140px;
    max-width: none;
  }
}

.color-swatch {
  display: inline-block; width: 1.1rem; height: 1.1rem; border-radius: 4px;
  vertical-align: middle; margin-right: .35rem; border: 1px solid var(--border);
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: .7rem .6rem; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--muted); font-weight: 600; font-size: .85rem; text-transform: uppercase; }
.data-table tr:hover td { background: rgba(255,255,255,.02); }
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.row-actions { display: flex; gap: .3rem; flex-wrap: wrap; }
.admin-coupons-table td.row-actions {
  display: table-cell;
  white-space: nowrap;
}
.admin-coupons-table td.row-actions > button,
.admin-coupons-table td.row-actions > form {
  display: inline-flex;
  vertical-align: middle;
  margin: .12rem .18rem .12rem 0;
}

.admin-coupons-table .coupon-status-badge {
  margin-left: 0;
}

.admin-coupons-table .coupon-status-badge--active {
  background: rgba(34, 197, 94, .18);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, .38);
}

.admin-coupons-table .coupon-status-badge--inactive {
  background: rgba(239, 68, 68, .18);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, .38);
}

.admin-body #create-coupon-modal,
.admin-body dialog.modal.modal--wide[id^="edit-coupon-"] {
  max-width: min(100vw - 1.25rem, 760px);
  width: min(100vw - 1.25rem, 760px);
}

.admin-form.coupon-admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8rem 1rem;
  align-items: start;
}

.admin-form.coupon-admin-form > .form-row {
  min-width: 0;
  margin-bottom: 0;
}

.admin-form.coupon-admin-form > .coupon-category-row,
.admin-form.coupon-admin-form > .coupon-modal-actions {
  grid-column: 1 / -1;
}

.coupon-admin-form .checkline {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin-top: .25rem;
  color: var(--muted);
  font-size: .86rem;
}

.coupon-modal-actions {
  align-items: flex-end;
  padding-top: .25rem;
}

.coupon-modal-actions .btn {
  min-width: 138px;
}

.coupon-category-targets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .45rem;
  width: 100%;
  max-height: 220px;
  overflow-y: auto;
  padding: .55rem;
  border: 1px solid var(--border);
  border-radius: var(--admin-radius-control, 8px);
  background: var(--bg-3);
}

.coupon-category-target {
  display: flex;
  align-items: center;
  gap: .48rem;
  min-height: 34px;
  padding: .42rem .5rem;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--admin-radius-control, 8px);
  background: rgba(255, 255, 255, .025);
  color: var(--text);
  font-size: .86rem;
  line-height: 1.25;
  cursor: pointer;
}

.coupon-category-target:hover {
  border-color: rgba(168, 85, 247, .38);
  background: rgba(168, 85, 247, .08);
}

.coupon-category-target input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
}

@media (max-width: 720px) {
  .admin-form.coupon-admin-form {
    grid-template-columns: 1fr;
  }

  .coupon-modal-actions,
  .coupon-modal-actions .btn {
    width: 100%;
  }

  .coupon-modal-actions .btn {
    justify-content: center;
  }

  .coupon-category-targets {
    grid-template-columns: 1fr;
    max-height: 240px;
  }
}

/* Responsive admin tables — ที่ ≤720px เปลี่ยนเป็น card stack
   Pattern: vertical block (label บน, content ล่าง) — บราว์เซอร์รับมือ rich content ได้ 100% */
@media (max-width: 720px) {
  .panel { padding: var(--space-3); }
  .data-table {
    display: block;
    border: none;
  }
  .data-table thead {
    display: none;  /* ซ่อน header — แต่ละ row จะใช้ data-label แทน */
  }
  .data-table tbody { display: block; }
  .data-table tr {
    display: block;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: var(--space-3);
    padding: var(--space-3);
  }
  .data-table tr.has-unread {
    border-left: 3px solid var(--primary);
  }
  .data-table td {
    display: block;
    padding: 0.35rem 0;
    border-bottom: 1px dashed var(--border);
    text-align: left;
    min-width: 0;
    word-break: break-word;
  }
  .data-table td:last-child { border-bottom: 0; }
  .data-table td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 600;
    text-transform: uppercase;
    line-height: 1.3;
    letter-spacing: 0.02em;
    margin-bottom: 0.18rem;
  }
  /* Cells ที่ไม่มี label (checkbox) → ซ่อน label, ดัน content ไป start */
  .data-table td:not([data-label]),
  .data-table td[data-label=""] {
    display: flex;
    justify-content: flex-start;
  }
  .data-table td:not([data-label])::before,
  .data-table td[data-label=""]::before {
    display: none;
  }
  /* ภาพ thumbnail ในเซลล์ — บีบให้พอดี ไม่ล้น */
  .data-table td .thumb {
    width: 56px; height: 56px;
  }
  /* ภายในเซลล์ที่มี content หลายอัน — block stack แทน inline */
  .data-table td > br + small,
  .data-table td > br + code {
    display: inline-block;
    margin-top: 0.15rem;
  }
  .data-table tr.has-unread td:first-child {
    border-left: 0;  /* ใช้ tr border-left แทนแล้ว */
  }
  .row-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.4rem;
  }
  .row-actions > * {
    flex: 0 0 auto;
    width: auto;
  }
  .admin-main { padding: var(--space-4); }
}

/* Row unread indicator — orders table มีของใหม่ */
.data-table tr.has-unread td:first-child {
  position: relative;
  border-left: 3px solid var(--primary);
}
.data-table tr.has-unread {
  background: var(--primary-soft);
}
.data-table tr.has-unread:hover td {
  background: var(--primary-soft-hover);
}
.row-unread-dot {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  margin-left: var(--space-2);
  background: linear-gradient(135deg, var(--danger), #f97316);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs); font-weight: var(--fw-bold);
  box-shadow: 0 0 0 2px var(--bg-2), 0 2px 6px rgba(239,68,68,.4);
  vertical-align: middle;
  animation: badge-pop .35s var(--ease-spring);
}

.kv-table { width: 100%; }
.kv-table th { text-align: left; color: var(--muted); font-weight: 500; padding: .4rem 1rem .4rem 0; width: 140px; vertical-align: top; }
.kv-table td { padding: .4rem 0; word-break: break-word; }

.admin-form { display: flex; flex-direction: column; gap: .5rem; }
.inline-form { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.inline-form input, .inline-form select { background: var(--bg-3); border: 1px solid var(--border); color: var(--text); padding: .5rem .8rem; border-radius: 8px; }

.filter-bar { display: flex; gap: .5rem; flex-wrap: wrap; }
.tag-list { display: flex; gap: .5rem; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; gap: .3rem; background: var(--bg-3); padding: .3rem .6rem; border-radius: 999px; }
.tag button { background: transparent; border: 0; color: var(--muted); cursor: pointer; padding: 0 .3rem; }
.tag button.tag-edit:hover { color: var(--primary); }
.tag button.tag-del:hover { color: var(--danger); }

.stock-content {
  background: #0a0a12; padding: .5rem; border-radius: 6px;
  font-family: 'Consolas', monospace; font-size: .85rem;
  max-width: 400px; max-height: 100px; overflow: auto;
  white-space: pre-wrap; word-break: break-all; margin: 0;
}

.modal {
  position: relative;
  border: 1px solid var(--border); background: var(--bg-2); color: var(--text);
  border-radius: var(--radius); padding: 2rem; max-width: 600px; width: 90%;
}
/* แก้ไขสินค้าแอดมิน: ขนาดพอดีจอ + สกอร์ลแนวตั้ง */
dialog.modal.modal--wide {
  box-sizing: border-box;
  max-width: min(100vw - 1.25rem, 680px);
  width: min(100vw - 1.25rem, 680px);
  max-height: min(88vh, calc(100vh - 1.5rem));
  margin: auto;
  padding: 2.5rem 1.15rem 1.25rem;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
dialog.modal.modal--wide::-webkit-scrollbar {
  width: 8px;
}
dialog.modal.modal--wide::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--radius-full);
}
dialog.modal.modal--wide::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: var(--radius-full);
}
dialog.modal.modal--wide h3 {
  font-size: clamp(1rem, 2.8vw, 1.15rem);
  margin-top: 0;
  margin-bottom: 0.85rem;
  padding-right: 2rem;
  line-height: 1.35;
}
dialog.modal.modal--wide .admin-form {
  min-width: 0;
}
.admin-body dialog.modal.modal--wide.admin-product-edit-modal {
  max-width: min(100vw - 1.25rem, 1120px);
  width: min(100vw - 1.25rem, 1120px);
  padding: 0;
  overflow-y: auto;
}
.admin-product-edit-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: .9rem;
  align-items: center;
  padding: 1rem 3.25rem 1rem 1rem;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 10px 26px rgba(var(--shadow-ink), .18);
}
.admin-product-edit-thumb,
.admin-product-preview-image {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--muted);
}
.admin-product-edit-thumb {
  width: 64px;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
}
.admin-product-edit-thumb img,
.admin-product-preview-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.admin-product-edit-title {
  min-width: 0;
}
.admin-product-edit-title h3 {
  margin: .18rem 0 .15rem;
  padding: 0;
  font-size: 1.15rem;
}
.admin-product-edit-title p {
  margin: 0;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.admin-product-edit-title code {
  display: inline-block;
  margin-top: .25rem;
  max-width: 100%;
  color: var(--muted);
  background: transparent;
  padding: 0;
  font-size: .78rem;
  overflow-wrap: anywhere;
}
.admin-product-edit-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
}
.admin-product-edit-modal .modal-close {
  z-index: 8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  line-height: 1;
}
.admin-product-edit-form {
  padding: 1rem;
}
.admin-product-edit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 1rem;
  align-items: start;
}
.admin-product-edit-main,
.admin-product-edit-side {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .85rem;
}
.admin-product-edit-side {
  position: sticky;
  top: 96px;
}
.admin-form-section {
  min-width: 0;
  padding: .95rem;
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.admin-form-section--compact {
  padding: .85rem;
}
.admin-form-section__head {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  margin-bottom: .85rem;
}
.admin-form-section__head > span {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: var(--primary);
  background: rgba(168, 85, 247, .12);
  border: 1px solid rgba(168, 85, 247, .22);
  border-radius: 8px;
}
.admin-form-section__head h4 {
  margin: 0;
  font-size: .98rem;
  line-height: 1.25;
}
.admin-form-section__head p {
  margin: .15rem 0 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.35;
}

/* ---- หัวข้อฟอร์มแบบพับได้ (<details>) ---- */
.admin-form-section--fold > summary.admin-form-section__head {
  cursor: pointer;
  margin-bottom: 0;
  padding: .1rem 0;
  list-style: none;
  border-radius: 8px;
}
.admin-form-section--fold > summary.admin-form-section__head::-webkit-details-marker { display: none; }
.admin-form-section--fold > summary.admin-form-section__head::marker { content: ''; }
.admin-form-section--fold > summary.admin-form-section__head > div { flex: 1 1 auto; min-width: 0; }
.admin-form-section--fold > summary.admin-form-section__head:hover h4 { color: var(--primary); }
.admin-form-section--fold > summary.admin-form-section__head:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.admin-form-section__chevron {
  flex: 0 0 auto;
  align-self: center;
  color: var(--muted);
  transition: transform .18s var(--ease-out, ease);
}
.admin-form-section--fold[open] > summary .admin-form-section__chevron { transform: rotate(180deg); }
.admin-form-section--fold[open] > .admin-form-section__body { margin-top: .85rem; }
.admin-form-section__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  margin-left: .35rem;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(168, 85, 247, .16);
  color: var(--primary);
  font-size: .72rem;
  font-weight: var(--fw-bold);
  vertical-align: middle;
}
/* กลุ่มช่องรองในหัวข้อ — ปิดไว้ก่อน กางเมื่อต้องแก้ */
.admin-form-subsection {
  margin-top: .2rem;
  border: 1px dashed rgba(148, 163, 184, .22);
  border-radius: 8px;
}
.admin-form-subsection > summary {
  cursor: pointer;
  padding: .5rem .65rem;
  font-size: .82rem;
  color: var(--muted);
}
.admin-form-subsection > summary:hover { color: var(--text); }
.admin-form-subsection[open] > summary {
  border-bottom: 1px dashed rgba(148, 163, 184, .22);
  margin-bottom: .65rem;
}
.admin-form-subsection > .form-row { padding: 0 .65rem; }
.admin-form-subsection > .form-row:last-child { padding-bottom: .5rem; }

/* เรทบันเดิล Discord บนฟอร์มสินค้า — รายการยาว จึงพับไว้ใน <details> */
.bundle-rate-picker__summary {
  cursor: pointer;
  font-size: .88rem;
}
.bundle-rate-picker__summary small {
  font-weight: 400;
}
.bundle-rate-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: .4rem;
  max-height: 320px;
  overflow-y: auto;
  margin: .75rem 0;
  padding-right: .25rem;
}
.bundle-rate-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .55rem;
  background: rgba(255, 255, 255, .02);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.bundle-rate-row.is-on {
  border-color: rgba(168, 85, 247, .45);
  background: rgba(168, 85, 247, .08);
}
.bundle-rate-row__label {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-size: .84rem;
  line-height: 1.25;
}
.bundle-rate-row__label small {
  font-size: .74rem;
}
.bundle-rate-row__price {
  flex: 0 0 92px;
  width: 92px;
  padding: .3rem .4rem;
  font-size: .82rem;
}
.bundle-rate-add {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
}
.bundle-rate-add select,
.bundle-rate-add input {
  flex: 0 1 auto;
  width: auto;
  min-width: 110px;
  padding: .3rem .4rem;
  font-size: .82rem;
}
.bundle-rate-note {
  margin: .6rem 0 0;
}
.named-option-editor {
  margin-bottom: .9rem;
}
.named-option-list {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-bottom: .5rem;
}
.named-option-row {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
}
.named-option-row input[type="text"] {
  flex: 1 1 150px;
  min-width: 0;
}
.named-option-row select {
  flex: 0 0 120px;
  width: 120px;
}
.named-option-row input[type="number"] {
  flex: 0 0 110px;
  width: 110px;
}
.named-option-row input,
.named-option-row select {
  padding: .3rem .4rem;
  font-size: .82rem;
}
.named-option-row [data-named-remove] {
  flex: 0 0 auto;
  padding: .2rem .5rem;
  font-size: 1rem;
  line-height: 1;
}
/* ช่องรูปของตัวเลือกในฟอร์มแอดมิน — 1:1 เท่ากับที่ลูกค้าเห็น */
.named-option-thumb {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, .03);
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  overflow: hidden;
}
.named-option-thumb.has-image {
  border-style: solid;
}
.named-option-thumb.is-busy {
  opacity: .5;
  pointer-events: none;
}
.named-option-thumb img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}
/* ช่องกรอกในการ์ดตัวเลือกราคาไม่ได้อยู่ใน .form-row จึงไม่ได้สไตล์พื้นฐานจากที่นั่น
   (เดิมจึงขึ้นเป็นช่องขาวของเบราว์เซอร์ในธีมมืด) */
.named-option-row input:not([type="hidden"]),
.named-option-row select,
.bundle-rate-row__price,
.bundle-rate-add input,
.bundle-rate-add select {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
}
.named-option-row input:not([type="hidden"])::placeholder,
.bundle-rate-row__price::placeholder,
.bundle-rate-add input::placeholder {
  color: var(--muted);
}
.named-option-row input:not([type="hidden"]):focus,
.named-option-row select:focus,
.bundle-rate-row__price:focus,
.bundle-rate-add input:focus,
.bundle-rate-add select:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, .2);
}

.admin-product-edit-modal .form-row {
  margin-bottom: .85rem;
}
.admin-product-edit-modal .form-row:last-child {
  margin-bottom: 0;
}
.admin-segmented-radio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .35rem;
  padding: .3rem;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.admin-segmented-radio .radio-inline {
  justify-content: center;
  min-height: 42px;
  padding: .55rem .5rem;
  border: 1px solid transparent;
  border-radius: 6px;
  text-align: center;
  line-height: 1.2;
}
.admin-segmented-radio .radio-inline:has(input:checked) {
  color: var(--text);
  background: rgba(168, 85, 247, .16);
  border-color: rgba(168, 85, 247, .36);
}
.admin-product-preview-card {
  overflow: hidden;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.admin-product-preview-image {
  aspect-ratio: 16 / 10;
  border-width: 0 0 1px;
  border-radius: 0;
}
.admin-product-preview-body {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: .75rem;
}
.admin-product-preview-body b,
.admin-product-preview-body span,
.admin-product-preview-body small {
  min-width: 0;
  overflow-wrap: anywhere;
}
.admin-product-preview-body span,
.admin-product-preview-body small {
  color: var(--muted);
  line-height: 1.35;
}
.admin-toggle-row {
  justify-content: space-between;
  gap: .75rem;
  padding: .65rem .7rem;
  margin-bottom: .6rem;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.admin-toggle-row input {
  order: 2;
  flex: 0 0 auto;
}
.admin-product-edit-actions {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
  margin: 1rem -1rem -1rem;
  padding: .85rem 1rem;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  box-shadow: 0 -10px 24px rgba(var(--shadow-ink), .18);
}
.admin-product-edit-modal .admin-form-sep {
  margin: 0 1rem 1rem;
}
.admin-product-edit-modal .product-gallery-mgmt.admin-form-section {
  margin: 0 1rem 1rem;
}
.admin-product-page-head {
  align-items: flex-start;
}
.admin-product-page-head h1 {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.admin-product-page-head p {
  margin: .2rem 0 0;
}
.admin-product-form-alert {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-bottom: .85rem;
}
.admin-product-form-page {
  max-width: 1180px;
  margin: 0 auto;
}
.admin-product-form-page .admin-product-unified-form {
  font-size: .9rem;
  line-height: 1.4;
}
.admin-product-form-page .admin-product-edit-form {
  padding: 0;
}
.admin-product-form-page .admin-product-edit-layout {
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: .8rem;
}
.admin-product-form-page .admin-product-edit-main,
.admin-product-form-page .admin-product-edit-side {
  gap: .7rem;
}
.admin-product-form-page .admin-product-edit-side {
  top: 68px; /* ใต้แถบนำทางหัวข้อ */
}
/* .admin-main มี overflow-x:auto → กลายเป็น scroll container ทำให้ sticky ข้างในไม่ทำงาน
   หน้าฟอร์มสินค้ากว้างคงที่อยู่แล้ว จึงปิด scroll container เฉพาะหน้านี้ */
.admin-main:has(.admin-product-form-page) {
  overflow-x: clip;
}
.admin-product-form-page .admin-form-section {
  padding: .75rem;
}
.admin-product-form-page .admin-form-section__head {
  gap: .55rem;
  margin-bottom: .65rem;
}
.admin-product-form-page .admin-form-section__head > span {
  width: 26px;
  height: 26px;
  border-radius: 7px;
}
.admin-product-form-page .admin-form-section__head h4 {
  font-size: .9rem;
}
.admin-product-form-page .admin-form-section__head p {
  font-size: .76rem;
}
.admin-product-form-page .form-row {
  margin-bottom: .65rem;
}
.admin-product-form-page .form-row label {
  margin-bottom: .28rem;
  font-size: .78rem;
}
.admin-product-form-page input,
.admin-product-form-page select,
.admin-product-form-page textarea {
  font-size: .86rem;
}
.admin-product-form-page small,
.admin-product-form-page .small {
  font-size: .74rem;
}
.admin-product-form-page .admin-segmented-radio {
  gap: .25rem;
  padding: .25rem;
}
.admin-product-form-page .admin-segmented-radio .radio-inline {
  min-height: 36px;
  padding: .45rem .4rem;
}
.admin-product-form-page .admin-toggle-row {
  padding: .55rem .6rem;
  margin-bottom: .5rem;
}
.admin-product-form-page .admin-product-preview-body {
  padding: .65rem;
}
.admin-product-form-page .rte {
  border-radius: 10px;
}
.admin-product-form-page .rte-toolbar {
  gap: .25rem;
  padding: .4rem;
}
.admin-product-form-page .rte-btn,
.admin-product-form-page .rte-select,
.admin-product-form-page .rte-color {
  min-height: 30px;
  border-radius: 7px;
  font-size: .78rem;
}
.admin-product-form-page .rte-btn {
  padding: .25rem .48rem;
}
.admin-product-form-page .rte-select {
  padding: .25rem .4rem;
}
.admin-product-form-page .rte-color {
  width: 36px;
}
.admin-product-form-page .rte-editor {
  min-height: 190px;
  padding: .7rem .8rem;
}
.admin-product-form-page .admin-product-edit-actions {
  margin: .85rem 0 0;
  padding: .7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}
/* แถบนำทางหัวข้อ + ปุ่มยกเลิก/บันทึก — sticky ใต้ header, ลิงก์เลื่อนแนวนอนได้บนจอแคบ */
.admin-form-nav {
  position: sticky;
  top: .5rem; /* desktop admin ไม่มี header ลอย — mobile ปรับใน media query */
  z-index: 5;
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0 0 .8rem;
  padding: .35rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(var(--shadow-ink), .2);
}
/* เลื่อนเฉพาะกลุ่มลิงก์ ปุ่มบันทึกจึงอยู่ในสายตาเสมอ */
.admin-form-nav__links {
  display: flex;
  flex: 1 1 auto;
  gap: .3rem;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
.admin-form-nav__actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: .4rem;
}
.admin-form-nav__link {
  flex: 0 0 auto;
  padding: .4rem .7rem;
  border-radius: 7px;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.admin-form-nav__link:hover {
  background: var(--bg-3);
  color: var(--text);
}
.admin-form-nav__link.is-active {
  background: rgba(168, 85, 247, .16);
  color: var(--primary);
  font-weight: var(--fw-bold);
}
/* หัวข้อไม่ให้แถบนำทางบัง เวลาคลิกลิงก์แล้วเลื่อนมา */
[data-form-section] {
  scroll-margin-top: 64px;
}

/* กล่องรูปหลัก — โชว์รูปที่ใช้อยู่จริงข้างช่องอัปโหลด */
.admin-main-image {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: .7rem;
  align-items: start;
}
.admin-main-image__current {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.admin-main-image__current img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.admin-main-image__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  padding: .5rem;
  color: var(--muted);
  font-size: .72rem;
  text-align: center;
}
.admin-main-image__actions {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  min-width: 0;
}
.admin-main-image__remove {
  gap: .45rem;
  font-size: .78rem;
  color: var(--muted);
}
.admin-featured-fields[hidden] { display: none; }

.admin-product-form-page .admin-product-form-gallery {
  margin-top: .8rem;
}
.admin-product-form-page .admin-product-edit-layout--gallery {
  margin-top: .8rem;
}
.admin-product-form-page .admin-product-edit-layout--gallery .admin-product-form-gallery {
  margin-top: 0;
}
.admin-product-form-page .admin-product-gallery-spacer {
  min-height: 0;
}
.admin-gallery-empty {
  margin: .2rem 0 .7rem;
  padding: .7rem .75rem;
  border: 1px dashed rgba(148, 163, 184, .24);
  border-radius: 8px;
  background: rgba(255,255,255,.018);
}
@media (max-width: 1023px) {
  .admin-product-edit-layout,
  .admin-product-form-page .admin-product-edit-layout {
    grid-template-columns: 1fr;
  }
  .admin-product-edit-side {
    position: static;
  }
  .admin-product-form-page .admin-product-gallery-spacer {
    display: none;
  }
  .admin-main-image {
    grid-template-columns: 92px minmax(0, 1fr);
  }
  /* mobile ใช้ .admin-topbar แบบ fixed สูง 56px */
  .admin-form-nav { top: 60px; }
  [data-form-section] { scroll-margin-top: 116px; }
}
@media (max-width: 700px) {
  /* จอแคบ: ลิงก์กับปุ่มเบียดกันจนกดยาก → ให้ปุ่มลงบรรทัดของตัวเอง */
  .admin-form-nav { flex-wrap: wrap; }
  .admin-form-nav__links { flex-basis: 100%; }
  .admin-form-nav__actions { flex: 1 1 auto; justify-content: flex-end; }
  [data-form-section] { scroll-margin-top: 160px; }
}
@media (max-width: 620px) {
  .admin-product-edit-modal .modal-close {
    width: 40px;
    height: 40px;
  }
  .admin-product-edit-head {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: .7rem;
    padding: .8rem 2.75rem .8rem .75rem;
  }
  .admin-product-edit-thumb {
    width: 52px;
  }
  .admin-product-edit-form {
    padding: .75rem;
  }
  .admin-form-section {
    padding: .75rem;
  }
  .admin-segmented-radio {
    grid-template-columns: 1fr;
  }
  .admin-product-edit-actions {
    margin: .85rem -.75rem -.75rem;
    padding: .75rem;
  }
  .admin-product-edit-modal .admin-form-sep {
    margin: 0 .75rem .75rem;
  }
  .admin-product-edit-modal .product-gallery-mgmt.admin-form-section {
    margin: 0 .75rem .75rem;
  }
  .admin-product-form-page .admin-product-edit-form {
    padding: 0;
  }
  .admin-product-form-page .admin-product-edit-actions {
    margin: .75rem 0 0;
  }
}
@media (max-width: 480px) {
  dialog.modal.modal--wide {
    max-width: calc(100vw - 0.75rem);
    width: calc(100vw - 0.75rem);
    max-height: min(90vh, calc(100vh - 1.25rem));
    padding-left: 1rem;
    padding-right: 1rem;
  }
}
.modal::backdrop { background: rgba(0,0,0,.7); backdrop-filter: blur(4px); }
.modal-close {
  position: absolute; top: .5rem; right: .5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent; border: 0; color: var(--text);
  border-radius: var(--admin-radius-control, 6px);
  cursor: pointer;
}
.modal-close:hover,
.modal-close:focus-visible {
  outline: none;
  background: var(--bg-3);
}

/* ============ Admin Mobile Topbar + Drawer + Bottom nav (≤1023px) ============ */
.admin-topbar { display: none; }
.admin-drawer { display: none; }
.admin-bottomnav { display: none; }
.admin-card-list { display: none; }  /* การ์ด mobile — โชว์เฉพาะ <1024 (desktop ใช้ตาราง) */

@media (max-width: 1023px) {
  .admin-body { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
  .admin-main { padding: 1rem; padding-top: 4.5rem; }

  /* Sticky topbar — replaces sidebar on mobile */
  .admin-topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    padding: 0 0.75rem;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    box-shadow: 0 2px 8px rgba(var(--shadow-ink),.2);
  }
  .admin-topbar__menu,
  .admin-topbar__home {
    width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 0;
    color: var(--text);
    border-radius: 8px;
    cursor: pointer;
    transition: background var(--dur-fast) ease;
  }
  .admin-topbar__menu:hover,
  .admin-topbar__home:hover { background: var(--bg-3); }
  .admin-topbar__title {
    flex: 1;
    font-weight: var(--fw-semibold);
    font-size: var(--fs-lg);
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Notification bell offset — กันชนกับ topbar */
  .admin-notif { top: 0.5rem; right: 0.5rem; }
  .admin-notif__btn { width: 40px; height: 40px; }

  /* Admin drawer — overlay nav บน mobile */
  .admin-drawer {
    display: block;
    position: fixed; inset: 0;
    z-index: 1500;
    pointer-events: none;
  }
  .admin-drawer[hidden] { display: none; }
  .admin-drawer.is-open { pointer-events: auto; }
  .admin-drawer__backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.65);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity var(--dur-base) ease;
  }
  .admin-drawer.is-open .admin-drawer__backdrop { opacity: 1; }
  .admin-drawer__panel {
    position: absolute; top: 0; left: 0; bottom: 0;
    width: min(300px, 84vw);
    height: 100dvh;
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    box-shadow: 8px 0 30px rgba(var(--shadow-ink),.5);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    transform: translateX(-100%);
    transition: transform .3s var(--ease-out);
    overflow: hidden;
  }
  .admin-drawer.is-open .admin-drawer__panel { transform: translateX(0); }
  .admin-drawer__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
  }
  .admin-drawer__head .brand { font-size: var(--fs-lg); display: inline-flex; align-items: center; gap: 0.5rem; }
  .admin-drawer__close {
    width: 36px; height: 36px;
    background: var(--bg-3); border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text);
    font-size: 1.4rem; line-height: 1; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .admin-drawer__nav {
    min-height: 0;
    padding: 0.75rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }
  .admin-drawer__nav a,
  .admin-drawer__nav .admin-drawer__theme {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.85rem 1rem;
    color: var(--text);
    border-radius: 8px;
    transition: background var(--dur-fast) ease;
    min-height: 44px; /* touch target */
  }
  .admin-drawer__nav .admin-drawer__theme {
    width: 100%; border: 0; background: transparent;
    font: inherit; text-align: left; cursor: pointer;
  }
  .admin-drawer__nav a:hover,
  .admin-drawer__nav .admin-drawer__theme:hover {
    background: var(--bg-3);
  }
  .admin-drawer__nav a.is-active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
  }
  .admin-drawer__nav a.is-active .lucide { color: #fff; }
  .admin-drawer__badge {
    margin-left: auto;
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: #fff;
    border-radius: 999px;
    font-size: var(--fs-xs); font-weight: var(--fw-bold);
    padding: 2px 8px; min-width: 22px;
    text-align: center;
  }
  .admin-drawer__foot {
    display: grid;
    gap: .35rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--bg-2);
  }
  .admin-drawer__foot > a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    min-height: 44px;
    padding: .65rem .8rem;
    border-radius: var(--admin-radius-control);
    color: var(--muted);
    font-weight: 500;
  }
  .admin-drawer__foot > a:hover {
    background: var(--bg-3);
    color: var(--text);
  }
  .admin-drawer__foot .btn { width: 100%; justify-content: center; }
  .admin-drawer__logout { margin: 0; }

  body.admin-drawer-open { overflow: hidden; }

  /* === Bottom nav — แถบเมนูด่วน 4 ช่อง (สินค้า/สต็อก/ออเดอร์/เมนู) === */
  .admin-bottomnav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 120;
    background: var(--bg-2);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 12px rgba(var(--shadow-ink),.28);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .admin-bottomnav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 56px;
    padding: .4rem .25rem .35rem;
    background: transparent;
    border: 0;
    color: var(--muted);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: color var(--dur-fast) ease;
  }
  .admin-bottomnav__item:hover { color: var(--text); }
  .admin-bottomnav__item:active { background: var(--bg-3); }
  .admin-bottomnav__item.is-active { color: var(--primary); }
  .admin-bottomnav__item .lucide { width: 22px; height: 22px; }
  .admin-bottomnav__label {
    font-size: .66rem;
    line-height: 1;
    font-weight: 500;
  }
  .admin-bottomnav__icon-wrap {
    position: relative;
    display: inline-flex;
  }
  .admin-bottomnav__badge {
    position: absolute;
    top: -5px; left: 100%;
    transform: translateX(-55%);
    min-width: 16px; height: 16px;
    padding: 0 4px;
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: #fff;
    border-radius: 999px;
    font-size: .6rem; font-weight: var(--fw-bold);
    line-height: 16px; text-align: center;
    box-shadow: 0 0 0 2px var(--bg-2);
  }
  .admin-bottomnav__badge.is-zero { display: none; }

  /* === Admin header on mobile === */
  .admin-body .admin-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }
  .admin-body .admin-header h1 {
    font-size: 1.25rem;
  }
  .admin-body .admin-header h1 + * {
    font-size: 0.9rem;
  }

  /* === Filter bar full-width inputs === */
  .admin-filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .admin-filter-input,
  .admin-filter-select {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    font-size: 16px; /* กัน iOS zoom-in ตอน focus */
  }
  .admin-filter-bar > .btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  /* === Status chip filter — รวมเป็นแถว scroll ได้ === */
  .filter-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    margin: 0 -1rem;
    /* padding-top กัน chip ที่ active (translateY -1px) โดน clip ขอบบน; padding-bottom เว้นช่อง chip กับ scrollbar */
    padding: 0.25rem 1rem 0.6rem;
    scrollbar-width: thin;
  }
  .filter-bar .chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-height: 36px;
  }
  /* ออเดอร์: แถบกรองสถานะ (chips) — สกอร์แนวนอน
     ต้อง specificity (0,4,0) เพื่อชนะ .admin-body .admin-header .admin-header-actions (0,3,0)
     ที่ตั้ง row/nowrap และ base .admin-header-actions{flex-wrap:wrap}. self-contained กัน cascade ชนกัน */
  .admin-body .admin-page-header .filter-bar.admin-header-actions--filters {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    min-width: 0;       /* flex item ต้องหดได้ ไม่งั้น overflow ดันขยายเกินกรอบแทนที่จะสกอร์ */
    max-width: 100%;
    margin: 0;          /* ตัด negative margin ของ .filter-bar ที่ทำความกว้างเพี้ยน */
    padding: .25rem 0 .6rem;
    -webkit-overflow-scrolling: touch;
  }
  /* === Order history filter — fade ขอบขวา + snap บอกว่าเลื่อนดู chip เพิ่มได้ === */
  .order-filter {
    scroll-snap-type: x proximity;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
  }
  .order-filter .chip { scroll-snap-align: start; }

  /* === Touch targets — ขยายปุ่ม sm ในตาราง === */
  .data-table .btn-sm,
  .row-actions .btn-sm,
  .row-actions form > button {
    min-height: 40px;
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }
  .row-actions {
    flex-direction: column;
    gap: 0.4rem;
    align-items: stretch;
  }
  .row-actions > * {
    width: 100%;
    text-align: center;
  }

  /* === KPI cards: full width with smaller value === */
  .admin-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }
  .admin-kpi-card {
    padding: 0.75rem 0.85rem;
  }
  .admin-kpi-card strong {
    font-size: 1.15rem;
  }

  /* === Pagination — compact === */
  .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.3rem;
  }
  .pagination .page-link {
    min-height: 40px;
    min-width: 40px;
  }

  /* === Bulk action bar — bottom safe area === */
  .admin-bulk-bar {
    left: 0.5rem;
    right: 0.5rem;
    transform: none;
    max-width: none;
    border-radius: 12px;
  }
  .admin-bulk-bar__form {
    width: 100%;
  }
  .admin-bulk-bar__form .admin-filter-select,
  .admin-bulk-bar__form .btn {
    flex: 1;
    min-width: 0; /* ทับ base .admin-filter-select{min-width:180px} ให้ select หดได้ ไม่ล้นแถบ */
  }
}

/* === ≤480px: KPI single column on very small screens === */
@media (max-width: 480px) {
  .admin-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }

/* ====== Shop empty state (Sprint E+) ====== */
.shop-empty-state {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  max-width: 540px;
  margin: 0 auto;
}
.shop-empty-state__emoji {
  font-size: 4.5rem; line-height: 1;
  margin-bottom: var(--space-4);
  filter: drop-shadow(0 6px 18px rgba(168,85,247,.2));
  animation: empty-float 3s ease-in-out infinite;
}
@keyframes empty-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@media (prefers-reduced-motion: reduce) {
  .shop-empty-state__emoji { animation: none; }
}
.shop-empty-state__title {
  margin: 0 0 var(--space-2);
  font-size: var(--fs-xl);
  color: var(--text);
}
.shop-empty-state__hint {
  margin: 0 0 var(--space-5);
  font-size: var(--fs-sm);
  line-height: var(--lh-loose);
}
.shop-empty-state__actions {
  display: flex; gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}

/* ====== Product image skeleton (shimmer ขณะ lazy load) ====== */
.product-image {
  position: relative;
  background:
    linear-gradient(110deg, var(--bg-3) 30%, rgba(255,255,255,.04) 50%, var(--bg-3) 70%);
  background-size: 200% 100%;
  animation: img-shimmer 1.6s linear infinite;
}
/* รวม transition: เพื่อให้ zoom (transform) + fade-in (opacity) smooth ทั้งคู่
   — override declaration ที่ 1045 (transition: transform .5s var(--ease-out))
   ด้วยการรวมไว้ในตัวเดียว ป้องกันการชนกัน */
.product-image img {
  position: relative; z-index: 1;
  opacity: 0;
  transition: opacity .35s ease, transform .5s var(--ease-out);
  will-change: transform;  /* hint ให้ browser ใช้ GPU compositing → smooth */
  backface-visibility: hidden;  /* ป้องกัน sub-pixel jitter */
  transform: translateZ(0);  /* force compositor layer */
}
.product-image img.is-loaded,
.product-image img:not([loading="lazy"]) {
  opacity: 1;
}
.product-card:hover .product-image img.is-loaded,
.product-card:hover .product-image img:not([loading="lazy"]) {
  transform: scale(1.06) translateZ(0);
}
/* รูปที่โหลดเสร็จแล้ว — หยุด shimmer */
.product-image:has(img.is-loaded) {
  animation: none;
  background: var(--bg-3);
}
@keyframes img-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .product-image { animation: none; }
  .product-card:hover .product-image img { transform: none !important; }
}

/* ============ Error / 404 page ============ */
.error-page {
  text-align: center;
  padding: var(--space-7) var(--space-4);
  max-width: 720px;
  margin: 0 auto;
}
.error-glyph {
  display: inline-flex; align-items: center; justify-content: center;
  position: relative;
  margin-bottom: var(--space-5);
}
.error-emoji {
  font-size: 6rem; line-height: 1;
  filter: drop-shadow(0 8px 24px rgba(168,85,247,.25));
  animation: error-bounce 2.4s ease-in-out infinite;
}
@keyframes error-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@media (prefers-reduced-motion: reduce) {
  .error-emoji { animation: none; }
}
.error-code {
  position: absolute;
  bottom: -8px; right: -32px;
  font-size: var(--fs-2xl); font-weight: var(--fw-bold);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: -.02em;
}
.error-title {
  font-size: var(--fs-2xl);
  margin: 0 0 var(--space-3);
}
.error-message {
  white-space: pre-wrap; word-break: break-word;
  color: var(--muted);
  font-size: var(--fs-base);
  margin: 0 auto var(--space-5);
  max-width: 520px;
  background: none; border: none; padding: 0;
}
.error-actions {
  display: flex; gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-7);
}
.error-suggestions {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
}
.error-suggestions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-4);
  max-width: 600px;
  margin-left: auto; margin-right: auto;
}
.error-suggestion-card {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
  padding: var(--space-4) var(--space-3);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: transform var(--dur-fast) ease, border-color var(--dur-fast) ease, background var(--dur-fast) ease;
}
.error-suggestion-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  background: var(--bg-3);
  color: var(--text);
}
.error-suggestion-icon { font-size: 1.6rem; }
.error-suggestion-text { font-size: var(--fs-sm); font-weight: var(--fw-medium); }

/* ============ Collections bar ============ */
.collection-bar-stack {
  margin-top: .5rem; margin-bottom: .5rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.collection-bar-stack .collection-bar {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
  margin-bottom: 0;
}
.collection-bar {
  display: flex; gap: .5rem; overflow-x: auto; padding: .5rem 0;
  margin-top: .5rem; margin-bottom: .5rem; align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}
.collection-bar-stack > .collection-bar:first-child { padding-top: 0; }
.col-label { color: var(--muted); font-size: .9rem; margin-right: .3rem; white-space: nowrap; }
.chip-sm { padding: .35rem .75rem; font-size: .85rem; }

.badge-collection {
  position: absolute; bottom: .6rem; left: .6rem;
  background: rgba(0,0,0,.7); color: #fff;
  padding: .2rem .5rem; border-radius: 6px;
  font-size: .75rem; font-weight: 600; backdrop-filter: blur(4px);
}

/* ============ Auth pages ============ */
.auth-card {
  max-width: 440px; margin: 3rem auto;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2.5rem 2rem; box-shadow: var(--shadow);
}
.auth-title { margin: 0; text-align: center; }
.auth-subtitle {
  margin: .35rem 0 1.45rem;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  line-height: 1.45;
}
.auth-card--forgot,
.auth-card--notice {
  max-width: 500px;
  padding: 2.25rem;
}
.auth-card--forgot .auth-header,
.auth-card--notice .auth-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .7rem;
  margin-bottom: 1.45rem;
  text-align: center;
}
.auth-card--forgot .auth-header-icon,
.auth-card--notice .auth-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--bg-3));
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
  border-radius: var(--radius);
}
.auth-card--notice .auth-header-icon--success {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 10%, var(--bg-3));
  border-color: color-mix(in srgb, var(--success) 34%, var(--border));
}
.auth-card--notice .auth-header-icon--error {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--bg-3));
  border-color: color-mix(in srgb, var(--danger) 34%, var(--border));
}
.auth-card--notice .auth-header-icon--warning {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 10%, var(--bg-3));
  border-color: color-mix(in srgb, var(--warn) 34%, var(--border));
}
.auth-card--forgot .auth-title,
.auth-card--notice .auth-title {
  font-size: var(--fs-2xl);
  line-height: var(--lh-tight);
}
.auth-card--forgot .auth-subtitle,
.auth-card--notice .auth-subtitle {
  max-width: 34rem;
  margin: 0;
}
.auth-card--forgot .auth-form,
.auth-card--notice .auth-form {
  gap: .9rem;
}
.auth-card--forgot .form-row label,
.auth-card--notice .form-row label {
  font-weight: var(--fw-semibold);
}
.auth-card--forgot .auth-alert,
.auth-card--notice .auth-alert {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  line-height: 1.65;
  text-align: left;
}
.auth-card--forgot .auth-alert .lucide,
.auth-card--notice .auth-alert .lucide {
  flex: 0 0 auto;
  margin-top: .25rem;
}
.auth-card--notice .auth-alert strong {
  color: var(--text);
}
.auth-card--notice .auth-alert span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.auth-card--notice .auth-alert small {
  display: block;
  margin-top: .25rem;
  line-height: 1.5;
}
.auth-card--forgot .auth-alert--success,
.auth-card--notice .auth-alert--success {
  color: var(--text);
  background: color-mix(in srgb, var(--success) 10%, var(--bg-2));
  border-color: color-mix(in srgb, var(--success) 55%, var(--border));
}
.auth-card--notice .auth-account-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  margin: -0.35rem 0 1.1rem;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.45;
  word-break: break-word;
}
.auth-card--notice .auth-account-note .lucide {
  flex: 0 0 auto;
}
.auth-card--notice .auth-account-note span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.auth-card--notice .auth-actions {
  display: grid;
  gap: .75rem;
  margin-top: 1rem;
}
.auth-card--notice .auth-actions .btn {
  white-space: normal;
  line-height: 1.35;
}
.auth-card--forgot .auth-switch--forgot,
.auth-card--notice .auth-switch--notice {
  margin-top: 1.35rem;
}
.auth-card--forgot .auth-switch--forgot a,
.auth-card--notice .auth-switch--notice a {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--muted);
  font-size: .95rem;
  font-weight: var(--fw-semibold);
}
.auth-card--forgot .auth-switch--forgot a:hover,
.auth-card--notice .auth-switch--notice a:hover {
  color: var(--primary);
}
.auth-form { display: flex; flex-direction: column; gap: .5rem; }
.auth-input-field {
  position: relative;
  display: block;
}
.auth-input-icon {
  position: absolute;
  left: .95rem;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  color: #a8a6ba;
  pointer-events: none;
  transition: color var(--dur-fast) ease, filter var(--dur-fast) ease;
}
.form-row .auth-input-field input {
  width: 100%;
  min-height: 54px;
  padding-left: 3rem;
  color: var(--text);
}
.form-row .auth-input-field.pw-field input {
  padding-right: 3.15rem !important;
}
.auth-input-field:focus-within .auth-input-icon {
  color: var(--accent);
  filter: drop-shadow(0 0 7px rgba(167,139,250,.45));
}
.auth-input-field input::placeholder {
  color: var(--muted);
}
.auth-divider {
  display: flex; align-items: center; gap: 1rem;
  color: var(--muted); margin: 1.2rem 0;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.auth-oauth-stack {
  display: grid;
  gap: .72rem;
}
.auth-switch { text-align: center; margin-top: 1.2rem; }
.auth-switch a { color: var(--primary); font-weight: 600; }

/* ===== login/register redesign (scoped to --signin) ===== */
.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;
}
.auth-card--signin .auth-form .btn-primary {
  border-radius: var(--radius);
}
.auth-card--signin .auth-switch {
  margin-top: 1.5rem;
  font-size: var(--fs-sm);
}
.auth-forgot-row {
  display: flex;
  justify-content: flex-end;
  margin-top: .4rem;
}
.auth-social-label {
  margin: .35rem 0 1.2rem;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.45;
}
.auth-social-row {
  display: flex;
  gap: .75rem;
}
.auth-social-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  min-height: 3.1rem;
  padding: 0 1rem;
  border-radius: var(--radius);
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-md);
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
}
.auth-social-btn svg { flex: 0 0 auto; }
/* hover: เบอร์ 03 navbar-match — สีบางเท่าปุ่มเข้าสู่ระบบบน navbar (.btn-ghost) */
.auth-social-btn:hover {
  transform: translateY(-2px);
  background: var(--border);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: 0 6px 16px rgba(var(--shadow-ink),.18);
}
.auth-social-btn:active {
  transform: translateY(1px) scale(.97);
  transition-duration: .07s;
}
/* revert (ของเดิม):
.auth-social-btn:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  box-shadow: 0 6px 16px rgba(var(--shadow-ink),.18);
}
*/
/* เบอร์ 01 Lighten surface:
.auth-social-btn:hover {
  transform: translateY(-2px);
  background: color-mix(in srgb, var(--bg-3) 78%, #fff);
  border-color: var(--border-strong);
  color: #fff;
  box-shadow: 0 8px 20px rgba(var(--shadow-ink),.28);
}
*/
/* เบอร์ 02 Purple glow:
.auth-social-btn:hover {
  transform: translateY(-2px);
  background: color-mix(in srgb, var(--bg-3) 86%, var(--primary));
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  box-shadow: 0 8px 18px rgba(139,92,246,.24), 0 0 12px rgba(216,180,254,.16);
  color: #fff;
}
*/
.auth-social-btn--discord svg { color: #5865F2; }
.auth-terms {
  max-width: 20rem;
  margin: 1.6rem auto 0;
  text-align: center;
  color: color-mix(in srgb, var(--muted) 75%, transparent);
  font-size: 0.8rem;
  line-height: 1.7;
}
/* revert: color: color-mix(in srgb, var(--primary) 80%, var(--muted)); (no text-decoration) */
.auth-terms a {
  font-weight: var(--fw-bold);
  text-decoration-color: color-mix(in srgb, var(--muted) 40%, transparent);
}
.auth-terms a:hover { color: var(--primary); }

.test-hint {
  margin-top: 1.2rem; padding: .8rem;
  background: var(--bg-3); border-radius: 8px;
  font-size: .85rem; text-align: center; color: var(--muted);
  border: 1px dashed var(--border);
}
.test-hint code { background: var(--bg); padding: 2px 6px; color: var(--primary); }

@media (max-width: 560px) {
  .auth-card--forgot,
  .auth-card--notice {
    margin: 2rem auto;
    padding: 2rem 1.35rem;
  }
  .auth-card--forgot .auth-title,
  .auth-card--notice .auth-title {
    font-size: var(--fs-xl);
  }
  .auth-card--forgot .auth-subtitle,
  .auth-card--forgot .auth-alert,
  .auth-card--notice .auth-subtitle,
  .auth-card--notice .auth-alert,
  .auth-card--notice .auth-account-note {
    font-size: var(--fs-sm);
  }
}

/* ============ Wallet page ============ */
.wallet-hero { margin-bottom: 1.5rem; }
.wallet-card {
  background: linear-gradient(135deg, #1a1a28, #2a1830 80%);
  border: 1px solid var(--border);
  border-radius: 18px; padding: 2rem;
  position: relative; overflow: hidden;
}
.wallet-card::before {
  content: ''; position: absolute; top: -50%; right: -10%;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(168,85,247,.4), transparent 70%);
  pointer-events: none;
}
.wallet-label { color: var(--muted); font-size: .95rem; }
.wallet-balance {
  font-size: 3rem; font-weight: 600;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin: .3rem 0;
}
.wallet-user { color: var(--muted); }

.wallet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 820px) { .wallet-grid { grid-template-columns: 1fr; } }

.tx-list { display: flex; flex-direction: column; gap: .4rem; max-height: 500px; overflow-y: auto; padding-right: .6rem; }
.tx-item {
  display: grid; grid-template-columns: 28px 1fr auto;
  gap: .7rem; align-items: center;
  background: var(--bg-3); padding: .5rem .8rem;
  border-radius: 8px; border-left: 3px solid var(--border);
}
.tx-item.tx-topup { border-left-color: var(--success); }
.tx-item.tx-spend { border-left-color: var(--primary); }
.tx-item.tx-adjust { border-left-color: var(--warn); }
.tx-icon { font-size: 1rem; line-height: 1; }
.tx-desc { font-weight: 500; font-size: .92rem; line-height: 1.3; }
.tx-meta { font-size: .78rem; color: var(--muted); margin-top: .1rem; }
.tx-amount { text-align: right; font-weight: 600; line-height: 1.25; }
.tx-amount.pos { color: var(--success); }
.tx-amount.neg { color: var(--primary); }
.tx-after { font-size: .72rem; color: var(--muted); font-weight: 400; }
.tx-order { font-size: .76rem; color: var(--muted); }
.tx-order::before { content: "·"; margin: 0 .35rem; }

@media (max-width: 600px) {
  .page-title     { font-size: 1.5rem; margin: 1.2rem 0 1rem; }
  .wallet-card    { padding: 1.25rem; border-radius: 14px; }
  .wallet-balance { font-size: 2.1rem; }
  .wallet-label, .wallet-user { font-size: .85rem; }

  /* ยอดเงินตกลงมาใต้รายละเอียด แทนการเบียดคอลัมน์ขวาจนล้น */
  .tx-item   { grid-template-columns: 26px 1fr; gap: .5rem; padding: .45rem .65rem; }
  .tx-amount { grid-column: 2; text-align: left; margin-top: .1rem; }
  /* เลขออเดอร์แตกลงบรรทัดใหม่บนจอเล็ก (กันเบียดวันที่) */
  .tx-order  { display: block; margin-top: .05rem; }
  .tx-order::before { content: none; }
}

/* ============ Checkout wallet box ============ */
.wallet-box {
  background: linear-gradient(135deg, rgba(34,197,94,.08), rgba(167,139,250,.08));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem;
}
.wallet-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: .4rem 0;
}
.wallet-row strong { font-size: 1.3rem; }
.wallet-row.total strong { font-size: 1.6rem; color: var(--primary); }

.link-primary { color: var(--primary); font-weight: 600; text-decoration: underline; }
.alert-warn { background: rgba(245,158,11,.12); border-color: var(--warn); color: #fde68a; }

/* Form row 3 columns for admin */
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
/* กัน select/input ที่มี option ยาวดันให้ grid track ขยายจนล้นการ์ด (เห็นชัดที่จอแคบ ~1024) */
.form-row-2 > .form-row, .form-row-3 > .form-row { min-width: 0; }
@media (max-width: 820px) { .form-row-3 { grid-template-columns: 1fr; } }

/* ============ Checkout visual refresh ============ */
.checkout-page {
  max-width: 1250px;
  padding-top: 2.35rem;
  padding-bottom: 2.8rem;
}
.checkout-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1.25rem;
}
.checkout-hero__icon {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 66px;
  color: var(--primary);
  background:
    radial-gradient(circle at 38% 28%, rgba(168, 85, 247, .22), transparent 55%),
    rgba(168, 85, 247, .09);
  border: 1px solid rgba(255, 255, 255, .045);
  box-shadow: 0 18px 45px rgba(var(--shadow-ink), .22);
}
.checkout-title.page-title {
  margin: 0;
  font-size: 1.95rem;
  line-height: 1.15;
  font-weight: 600;
}
.checkout-subtitle {
  margin: .28rem 0 0;
  color: #a5a5b8;
  font-size: .95rem;
}
.checkout-page .checkout-columns {
  grid-template-columns: minmax(0, 1fr) 480px;
  gap: 1.5rem;
  align-items: start;
}
.checkout-page .checkout-grid {
  gap: 1rem;
}
.checkout-page .checkout-section,
.checkout-page .checkout-summary {
  border: 1px solid rgba(255, 255, 255, .075);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .028), rgba(255, 255, 255, .01)),
    rgba(22, 22, 31, .78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025);
}
.checkout-page .checkout-section {
  padding: 1.55rem 1.45rem 1.35rem;
}
.checkout-section-title {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 0 0 1.25rem;
  font-size: 1.1rem;
  line-height: 1.25;
  font-weight: 600;
}
.checkout-step {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 26px;
  color: #14121a;
  background: #c4b5fd;
  font-size: .86rem;
  font-weight: 600;
  box-shadow: none;
}
.checkout-contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}
.checkout-page .form-row {
  position: relative;
  margin-bottom: 1rem;
  gap: .5rem;
}
.checkout-page .form-row label {
  font-size: .9rem;
  font-weight: 600;
  color: #f1f1f7;
}
.checkout-page .form-row input,
.checkout-page .form-row textarea {
  min-height: 48px;
  border-radius: 8px;
  border-color: rgba(255, 255, 255, .09);
  background: rgba(13, 13, 20, .46);
  color: var(--text);
  font-size: .94rem;
}
.checkout-choice-select {
  position: relative;
  width: 100%;
}
.checkout-choice-native {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  opacity: 0;
}
.checkout-choice-select .checkout-choice-trigger {
  min-height: 48px;
  border-radius: 10px;
}
.checkout-page .checkout-choice-select .checkout-choice-trigger {
  border-color: rgba(255, 255, 255, .09);
  background: rgba(13, 13, 20, .46);
  color: var(--text);
  box-shadow: none;
  font-size: .94rem;
}
.checkout-page .checkout-choice-select .checkout-choice-trigger:hover {
  border-color: rgba(255, 255, 255, .14);
  background: rgba(13, 13, 20, .54);
}
.checkout-page .checkout-choice-select .checkout-choice-trigger:focus,
.checkout-page .checkout-choice-select.bundle-price-select.is-open .checkout-choice-trigger {
  border-color: rgba(255, 255, 255, .16);
  background: rgba(13, 13, 20, .58);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, .12);
}
.checkout-choice-select .checkout-choice-trigger[aria-invalid="true"] {
  border-color: rgba(239, 68, 68, .55);
}
.checkout-choice-select .checkout-choice-menu {
  max-height: min(260px, 42vh);
}
.checkout-choice-select .checkout-choice-option {
  grid-template-columns: minmax(0, 1fr);
  gap: .18rem;
  align-items: start;
}
.checkout-choice-option__hint {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
}
.checkout-choice-error {
  margin-top: .55rem;
}
.checkout-page .form-row textarea {
  min-height: 88px;
  resize: vertical;
  padding-right: 4.2rem;
}
.checkout-credential-note {
  display: flex;
  align-items: flex-start;
  gap: .45rem;
  margin-top: .65rem;
  color: #a6a6b7;
  font-size: .82rem;
  line-height: 1.45;
}
.checkout-credential-note .lucide {
  flex: 0 0 auto;
  margin-top: .1rem;
  color: #b8b8c6;
}
.checkout-page .form-row input::placeholder,
.checkout-page .form-row textarea::placeholder {
  color: var(--muted);
}
.checkout-inline-alert {
  display: inline-flex;
  align-items: flex-start;
  gap: .5rem;
  width: 100%;
  margin-bottom: 1.1rem;
  padding: .8rem .95rem;
  border-color: rgba(167, 139, 250, .28);
  background: rgba(167, 139, 250, .085);
  font-size: .82rem;
  line-height: 1.5;
}
/* ไอคอนไม่หด + ดันลงเล็กน้อยให้ตรงกลางบรรทัดแรกของข้อความ */
.checkout-inline-alert .lucide {
  flex: 0 0 auto;
  margin-top: 2px;
}
.checkout-note-count {
  position: absolute;
  right: .9rem;
  bottom: .8rem;
  color: #a2a2b5;
  font-size: .78rem;
  pointer-events: none;
}
.checkout-balance-alert {
  margin: 1rem 0 0;
}
.checkout-actions {
  padding-top: 1.05rem;
  margin-top: .35rem;
  border-top: 1px solid rgba(255, 255, 255, .07);
}
.checkout-actions .btn-primary {
  min-height: 40px;
  padding: .66rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  line-height: 1.1;
}
.checkout-actions .btn-ghost {
  min-height: 40px;
  padding: .62rem 1rem;
  margin-top: .45rem;
  border-color: rgba(255, 255, 255, .075);
  background: rgba(15, 15, 22, .35);
  font-weight: 600;
  line-height: 1.1;
}
.checkout-page .checkout-summary--side {
  position: sticky;
  top: 86px;
  left: auto;
  right: auto;
  bottom: auto;
  grid-column: 2;
  grid-row: auto;
  width: auto;
  height: auto;
  min-height: 0;
  max-height: none;
  padding: 1.7rem 1.85rem 1.65rem;
  overflow: visible;
}
.checkout-page .checkout-summary h3 {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin: 0 0 1.35rem;
  font-size: 1.13rem;
  font-weight: 600;
}
.checkout-page .checkout-summary h3 .lucide {
  color: var(--primary);
}
.checkout-page .checkout-summary-list {
  flex: 0 1 auto;
  gap: 1.05rem;
  margin: 0 0 1.25rem;
  padding-right: .75rem;
  max-height: calc((58px * 5) + (1.05rem * 4));
  overflow-y: auto;
}
.checkout-page .checkout-summary-item {
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: .85rem;
}
.checkout-page .checkout-summary-thumb {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  border-color: rgba(255, 255, 255, .12);
  background: rgba(12, 12, 18, .72);
}
.checkout-page .checkout-summary-item-title {
  color: #f2f2f8;
  font-size: .9rem;
  font-weight: 600;
}
.checkout-page .checkout-summary-item-meta {
  color: #a0a0b4;
  font-size: .84rem;
}
.checkout-page .checkout-summary-item-price {
  color: #f3f3f8;
  font-size: .94rem;
  font-weight: 600;
}
.checkout-page .checkout-summary hr {
  margin: 1.35rem 0 1rem;
  border-top-color: rgba(255, 255, 255, .09);
}
.checkout-page .summary-line {
  padding: .42rem 0;
  color: #a8a8ba;
  font-size: .92rem;
}
.checkout-page .summary-line span:last-child {
  color: #f0f0f7;
  font-weight: 600;
}
.checkout-page .summary-line .checkout-summary-count {
  color: #9d9daf !important;
  font-weight: 600;
}
.checkout-page .summary-line.total {
  margin-top: .65rem;
  padding-top: 1rem;
  color: #f0f0f7;
  font-size: 1.04rem;
  border-top-color: rgba(255, 255, 255, .09);
}
.checkout-page .summary-line.total span:last-child {
  color: var(--primary);
  font-size: 1.45rem;
  line-height: 1;
  font-weight: 600;
}
.checkout-summary-safe {
  display: flex;
  align-items: center;
  gap: .85rem;
  margin: 1.45rem -1.85rem -1.65rem;
  padding: 1.45rem 1.85rem;
  border-top: 1px solid rgba(255, 255, 255, .055);
  background: rgba(255, 255, 255, .018);
}
.checkout-summary-safe > span {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  color: var(--primary);
  background: rgba(168, 85, 247, .12);
}
.checkout-summary-safe strong {
  display: block;
  color: #f4f4f9;
  font-size: .92rem;
}
.checkout-summary-safe small {
  display: block;
  margin-top: .12rem;
  color: #9999ad;
  font-size: .78rem;
}
@media (max-width: 980px) {
  .checkout-page .checkout-columns {
    grid-template-columns: 1fr;
  }
  .checkout-page .checkout-summary--side {
    position: static;
    grid-column: 1;
    max-height: none;
    overflow: visible;
  }
  .checkout-page .checkout-summary-list {
    max-height: calc((58px * 5) + (1.05rem * 4));
    overflow-y: auto;
  }
}
@media (max-width: 720px) {
  .checkout-page {
    padding-top: 1.6rem;
  }
  .checkout-hero {
    align-items: flex-start;
  }
  .checkout-hero__icon {
    width: 54px;
    height: 54px;
    flex-basis: 54px;
  }
  .checkout-title.page-title {
    font-size: 1.55rem;
  }
  .checkout-contact-grid {
    grid-template-columns: 1fr;
  }
  .checkout-page .checkout-section,
  .checkout-page .checkout-summary--side {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .checkout-summary-safe {
    margin-left: -1rem;
    margin-right: -1rem;
    margin-bottom: -1.65rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Admin login fallback page */
.admin-body .admin-login { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 2rem; }

/* ============================================================
   NEW (v3): Account, PromptPay, Featured, Admin filter, Bestsellers
   ============================================================ */

/* --- Hero centered button --- */
.hero-cta-center { justify-content: center; }
.hero-cta-center .btn-discord { min-width: 280px; }

/* --- Login: forgot password link --- */
.label-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: .8rem; margin-bottom: .25rem;
}
.label-row label { margin: 0; }
.link-forgot { font-size: .82rem; color: var(--accent); text-decoration: none; }
.link-forgot:hover { text-decoration: underline; }

/* --- My Account page --- */
.account-alert {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  line-height: 1.55;
}
.account-alert .lucide {
  flex: 0 0 auto;
  margin-top: .18rem;
}
.account-alert__body {
  min-width: 0;
}
.account-alert__body strong {
  color: var(--text);
}
.account-alert form {
  margin-top: .75rem;
}
.account-alert .btn {
  white-space: normal;
  line-height: 1.35;
}
/* ข้อความ + ปุ่มอยู่บรรทัดเดียวกัน (ปุ่มชิดขวา) ตัดบรรทัดเองเมื่อจอแคบ */
.account-alert__body--inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
}
.account-alert__body--inline > span { flex: 1 1 auto; min-width: 0; }
.account-alert__body--inline form { margin-top: 0; flex: 0 0 auto; }
.account-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1.5rem; margin-top: 1rem;
}
@media (max-width: 820px) { .account-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .account-alert {
    font-size: var(--fs-sm);
  }
  .account-alert form {
    margin-left: 0;
  }
  .account-alert .btn {
    width: 100%;
  }
}

.account-rows { display: flex; flex-direction: column; gap: .55rem; margin: .8rem 0 1.2rem; }
.account-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: .75rem;
  min-width: 0;
  padding: .55rem .75rem; background: var(--bg-3);
  border-radius: 8px; border: 1px solid var(--border);
}
.account-row .lbl { color: var(--muted); font-size: .9rem; flex: 0 0 auto; }
.account-row .val {
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
  font-weight: 600;
}
.account-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.account-actions .btn { flex: 1; min-width: 140px; }

/* --- PromptPay tabs --- */
.topup-tabs {
  display: flex; gap: .4rem; margin: .2rem 0 1rem;
  border-bottom: 1px solid var(--border);
}
.topup-tab {
  display: inline-flex; align-items: center; gap: .45rem;
  background: transparent; border: none; cursor: pointer;
  padding: .7rem 1.1rem; color: var(--muted);
  font-weight: 600; font-size: .95rem;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  font-family: inherit;
}
.topup-tab__logo { height: 20px; width: auto; object-fit: contain; }
.topup-tab:hover { color: var(--text); }
.topup-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.topup-pane { display: none; }
.topup-pane.show { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* --- Numbered step list (TrueMoney + PromptPay topup instructions) --- */
.topup-steps {
  list-style: none;
  margin: 1.2rem 0 1.4rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .7rem;
}
.topup-steps li {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  color: var(--text);
  font-size: .95rem;
  line-height: 1.5;
}
.topup-step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: .88rem;
  color: var(--primary);
  background: rgba(168, 85, 247, .14);
  border: 1px solid rgba(168, 85, 247, .35);
  line-height: 1;
}
.topup-step-text {
  flex: 1;
  padding-top: 3px;
}

/* --- Input with leading icon (e.g. paste TrueMoney link) --- */
.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}
.input-with-icon__icon {
  position: absolute;
  left: .9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  pointer-events: none;
}
.input-with-icon input,
.input-with-icon textarea {
  padding-left: 2.4rem;
  width: 100%;
}
.input-with-icon:focus-within .input-with-icon__icon { color: var(--primary); }

.topup-footnote {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin-top: .8rem;
}

/* --- PromptPay QR --- */
.promptpay-qr-wrap {
  background: #fff;
  border-radius: 14px;
  padding: 1.4rem;
  text-align: center;
  color: #172033;
  border: 1px solid #d8d2e4;
  box-shadow: 0 12px 28px rgba(32, 24, 45, .1);
  max-width: 100%;
}
.promptpay-slip-form input[type="file"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.promptpay-qr-amount {
  font-size: 1.05rem; font-weight: 600;
  color: #2f263b; margin-bottom: .8rem;
}
.promptpay-qr-amount .amt {
  font-size: 1.4rem; font-weight: 600;
  color: #b91c5c; margin-left: .4rem;
}
.promptpay-qr-countdown {
  margin: -.25rem 0 .95rem;
  color: #475569;
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.35;
}
.promptpay-qr-countdown b {
  color: #b91c5c;
  font-variant-numeric: tabular-nums;
}
.promptpay-qr-countdown.is-expired {
  color: #991b1b;
}
.promptpay-qr-countdown.is-expired b {
  color: #991b1b;
}
.promptpay-qr-img {
  max-width: 420px; width: 100%; height: auto; display: block; margin: 0 auto;
  border: 1px solid #eee; border-radius: 6px;
}
.promptpay-receiver {
  margin-top: 1rem; color: #2f263b; font-size: .92rem;
}
.promptpay-receiver small { color: #516070; }
.promptpay-warning {
  margin-top: 1rem;
}
.promptpay-qr-wrap .alert-warning {
  background: #fffbeb;
  color: #78350f;
  border-color: #d97706;
  text-align: left;
}
.promptpay-qr-wrap .alert-warning .text-warn {
  color: #b45309;
}
.promptpay-slip-form {
  margin-top: 1.2rem;
}

@media (max-width: 600px) {
  .promptpay-qr-wrap {
    padding: .85rem;
    border-radius: 12px;
    max-width: 100%;
    overflow: hidden;
  }
  .promptpay-qr-amount {
    margin-bottom: .45rem;
    font-size: .88rem;
  }
  .promptpay-qr-amount .amt {
    display: inline-block;
    margin-left: .2rem;
    font-size: 1.06rem;
  }
  .promptpay-qr-countdown {
    margin: -.05rem 0 .65rem;
    font-size: .78rem;
  }
  .promptpay-qr-img {
    max-width: min(72vw, 280px);
  }
  .promptpay-receiver {
    margin-top: .65rem;
    font-size: .78rem;
  }
  .promptpay-warning {
    margin-top: .75rem;
  }
  .promptpay-qr-wrap .alert-warning {
    padding: .55rem .65rem;
    font-size: .76rem;
    line-height: 1.38;
  }
  .promptpay-slip-form {
    margin-top: .85rem;
  }
}

.alert-warning {
  background: rgba(245,158,11,.12); color: #fde68a;
  border: 1px solid var(--warn); border-radius: 10px;
  padding: .7rem .9rem; font-size: .9rem;
}

/* --- Featured product card: ออร่าสีชมพู (ไม่มีขอบ) --- */
.product-card.is-featured {
  position: relative;
  isolation: isolate;
  box-shadow:
    0 0 0 1px rgba(168,85,247,.24),
    0 6px 22px rgba(var(--shadow-ink),.3),
    0 0 22px rgba(168,85,247,.18),
    var(--shadow);
  animation: featuredAura 3.4s ease-in-out infinite;
}
.product-card.is-featured > * {
  position: relative;
  z-index: 1;
}
.product-card.is-featured::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  background:
    radial-gradient(circle at 82% 18%, rgba(168,85,247,.16), transparent 34%),
    linear-gradient(135deg, transparent 54%, rgba(168,85,247,.08) 100%);
  opacity: .35;
  pointer-events: none;
  animation: featuredAuraWash 3.4s ease-in-out infinite;
}
.product-card.is-featured:hover {
  box-shadow:
    0 0 0 1px rgba(168,85,247,.38),
    0 10px 26px rgba(var(--shadow-ink),.36),
    0 0 30px rgba(168,85,247,.22);
}
@keyframes featuredAura {
  0%, 100% { box-shadow: 0 0 0 1px rgba(168,85,247,.18), 0 6px 20px rgba(var(--shadow-ink),.28), 0 0 14px rgba(168,85,247,.12), var(--shadow); }
  50%      { box-shadow: 0 0 0 1px rgba(168,85,247,.34), 0 8px 26px rgba(var(--shadow-ink),.34), 0 0 34px rgba(168,85,247,.24), var(--shadow); }
}
@keyframes featuredAuraWash {
  0%, 100% { opacity: .16; }
  50% { opacity: .34; }
}
.product-image { position: relative; }
.featured-badge {
  position: absolute; top: .55rem; right: .55rem; z-index: 2;
  display: inline-flex; align-items: center; gap: .25rem;
  background: linear-gradient(135deg, #f59e0b 0%, #f97316 58%, #ea580c 100%);
  color: #fff; font-size: .72rem; font-weight: 600;
  padding: .25rem .55rem; border-radius: 6px;
  box-shadow: 0 2px 7px rgba(249, 115, 22, .34), 0 2px 6px rgba(var(--shadow-ink),.26);
  letter-spacing: .3px;
  text-shadow: 0 1px 1px rgba(0,0,0,.18);
}

/* --- Admin filter bar --- */
.admin-filter-bar {
  display: flex; gap: .6rem; flex-wrap: wrap; align-items: center;
  margin-bottom: 1rem;
}
.admin-filter-input {
  flex: 1; min-width: 220px;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 8px; padding: .55rem .8rem; color: var(--text);
  font-size: .92rem;
}
.admin-filter-input[type="search"] {
  background-image: var(--search-icon-image);
  background-position: .72rem 50%;
  background-repeat: no-repeat;
  background-size: 16px 16px;
  padding-left: 2.2rem;
}
.admin-filter-select {
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 8px; padding: .55rem .7rem; color: var(--text);
  font-size: .92rem; min-width: 180px;
}

/* ============ Admin bulk action bar (sticky bottom) ============ */
.admin-bulk-bar {
  position: fixed; bottom: 1rem; left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex; gap: 1rem; align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--primary);
  border-radius: 12px;
  padding: .7rem 1.1rem;
  box-shadow: 0 8px 24px rgba(var(--shadow-ink),.35);
  max-width: calc(100vw - 2rem);
  flex-wrap: wrap;
}
.admin-bulk-bar[hidden] { display: none; }
.admin-bulk-bar__count {
  color: var(--text); font-size: .95rem;
}
.admin-bulk-bar__count b { color: var(--primary); font-weight: 600; margin-right: .25rem; }
.admin-bulk-bar__form {
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: 0;
}
@media (max-width: 600px) {
  .admin-bulk-bar { bottom: 5rem; }  /* เลี่ยง mobile-bottom-nav */
}

/* --- Order item: product image thumb --- */
.order-item-head {
  display: flex; align-items: center; gap: .9rem;
  flex-wrap: wrap;
}
.order-item-thumb {
  display: block; flex-shrink: 0;
  width: 64px; height: 64px;
  border-radius: 8px; overflow: hidden;
  background: var(--bg-3); border: 1px solid var(--border);
  cursor: zoom-in;
  transition: transform .15s, border-color .15s;
}
.order-item-thumb:hover {
  transform: scale(1.05);
  border-color: var(--primary);
}
.order-item-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.order-products-panel .order-item-thumb {
  width: 68px;
  height: 68px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px;
  cursor: default;
  box-shadow: 0 8px 20px rgba(var(--shadow-ink), .18);
}
.order-products-panel .order-item-thumb:hover {
  transform: none;
  border-color: rgba(168, 85, 247, .42);
}
.order-products-panel .order-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: nowrap;
  min-width: 0;
}
.order-item-info {
  flex: 1; min-width: 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: .8rem; flex-wrap: wrap;
}
.order-item-info .name { font-weight: 600; }
.order-item-info .price { font-weight: 600; color: var(--primary); }
.order-products-panel .delivery-note {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  width: fit-content;
  max-width: 100%;
  margin-top: .3rem;
  padding: .45rem .75rem;
  border-radius: 8px;
  background: rgba(15, 15, 20, .28);
  border-color: rgba(255, 255, 255, .08);
  color: #aeb2c5;
  font-size: .82rem;
  line-height: 1.35;
}
.order-products-panel .delivery-note .lucide {
  color: #c7cadb;
}
/* file-card ใน order panel ใช้ขอบ/พื้น/มุมตรงกับ delivery-note เพื่อความกลมกลืน */
.order-products-panel .file-card {
  background: rgba(15, 15, 20, .28);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  color: #aeb2c5;
  padding: .55rem .75rem;
}
.order-products-panel .file-card__size {
  color: #8a8fa3;
}
.order-products-panel .file-card__btn {
  background: transparent;
  border-color: rgba(255, 255, 255, .12);
  color: #c7cadb;
}
.order-products-panel .file-card__btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.order-products-panel .badge-mini {
  margin-left: .1rem;
  padding: .16rem .48rem;
  border-radius: 999px;
  background: #4f46e5;
  color: #fff;
  font-size: .66rem;
  font-weight: var(--fw-bold);
  line-height: 1.15;
}
.order-item-qty {
  color: #e2e4ef;
  font-size: .92rem;
  font-weight: var(--fw-semibold);
}
@media (max-width: 560px) {
  .order-products-panel .order-item {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: .75rem;
  }
  .order-products-panel .order-item-thumb {
    width: 58px;
    height: 58px;
  }
  .order-products-panel .order-item-head {
    flex-direction: column;
    gap: .45rem;
  }
  .order-products-panel .order-item-head .name .u-select-text {
    font-size: 1rem;
  }
  .delivered-card > summary.delivered-card__toggle {
    gap: .65rem;
    padding-bottom: .9rem;
    font-size: .9rem;
  }
  .delivered-card__icon-wrap {
    width: 36px;
    height: 36px;
  }
  .order-products-panel .order-item .price {
    align-self: flex-start;
  }
  .order-totals {
    grid-template-columns: 1fr;
    gap: .75rem;
  }
  .order-total-cell {
    justify-content: space-between;
  }
}

/* หน้าออเดอร์ (มือถือ) — ลดขนาดตัวหนังสือการ์ดข้อมูลผู้รับ + ข้อมูลสินค้า ให้กระชับ
   (วางท้ายบล็อก 560px เพื่อให้ชนะ source-order; desktop เท่าเดิม) */
@media (max-width: 600px) {
  /* การ์ดข้อมูลผู้รับ */
  .order-recipient-card > h3 { font-size: .98rem; }
  .order-recipient-label { font-size: .8rem; }
  .order-recipient-value,
  .order-recipient-note { font-size: .9rem; }
  .order-recipient-safe-note { font-size: .84rem; }
  /* การ์ดข้อมูลสินค้า */
  .order-products-panel > h3 { font-size: .98rem; }
  .order-products-panel .order-item-head .name .u-select-text { font-size: .92rem; }
  .order-products-panel .order-item .price { font-size: .92rem; }
  .order-products-panel .delivery-note { font-size: .78rem; }
  .order-products-panel .file-card__name { font-size: .8rem; }
  .order-total-cell span { font-size: .85rem; }
  .order-total-cell strong { font-size: 1rem; }
}

/* --- Bestsellers: rank badges + stat cards --- */
.admin-bestsellers-page__header .admin-header-actions {
  padding-right: 3.35rem;
}
.admin-bestsellers-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .8rem;
  margin: 1rem 0;
}
.admin-bestsellers-panel {
  margin-bottom: 1rem;
}
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 1.6rem;
  padding: .18rem .4rem;
  border-radius: 999px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  font-size: .82rem;
  font-weight: 600;
  line-height: 1;
}
.rank-badge.rank-1 {
  color: #fef3c7;
  border-color: rgba(251,191,36,.48);
  box-shadow: 0 0 0 1px rgba(251,191,36,.1), 0 0 12px rgba(251,191,36,.14);
}
.rank-badge.rank-2 {
  color: #e2e8f0;
  border-color: rgba(203,213,225,.42);
}
.rank-badge.rank-3 {
  color: #fed7aa;
  border-color: rgba(251,146,60,.44);
}

.stat-card {
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 10px; padding: .9rem 1rem;
}
.stat-card .stat-label { color: var(--muted); font-size: .85rem; }
.stat-card .stat-value { font-size: 1.4rem; font-weight: 600; margin-top: .2rem; }

/* --- Admin: 'สุดฮิต' badge mini --- */
.badge-hit {
  background: linear-gradient(135deg, #f59e0b, #f97316 62%, #ea580c);
  color: #fff; font-weight: 600;
  border: none; padding: .15rem .45rem;
  border-radius: 5px; font-size: .7rem;
  margin-left: .35rem;
  box-shadow: 0 2px 7px rgba(249, 115, 22, .25);
}
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .22rem .5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
}
.role-badge--role-owner {
  color: #fef3c7;
  background: transparent;
  border-color: rgba(251, 191, 36, .45);
}
.role-badge--role-admin {
  color: #dbeafe;
  background: transparent;
  border-color: rgba(96, 165, 250, .42);
}
.role-badge--role-customer {
  color: #dcfce7;
  background: transparent;
  border-color: rgba(74, 222, 128, .38);
}
.btn .role-badge {
  margin: -.18rem -.35rem;
}
.admin-users-table .role-badge {
  background: transparent !important;
  box-shadow: none;
}
.admin-role-trigger {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.admin-role-trigger:hover,
.admin-role-trigger:focus-visible {
  outline: none;
  background: transparent;
}
.admin-role-trigger:hover .role-badge,
.admin-role-trigger:focus-visible .role-badge {
  border-color: currentColor;
}
.admin-role-trigger:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
.featured-label-form {
  display: flex;
  align-items: flex-end;
  gap: .4rem;
  min-width: 190px;
}
.featured-label-form input[type="text"] {
  width: 132px;
  min-width: 0;
  min-height: var(--admin-control-height, 36px);
  padding: .42rem .55rem;
  border: 1px solid var(--border);
  border-radius: var(--admin-radius-control, 6px);
  background: var(--bg-3);
  color: var(--text);
  font: inherit;
}
.featured-settings-form {
  display: grid;
  grid-template-columns: 76px 150px auto;
  align-items: end;
  gap: .4rem;
  min-width: 280px;
}
.featured-control {
  display: grid;
  gap: .2rem;
  margin: 0;
}
.featured-control span {
  color: var(--muted);
  font-size: .72rem;
  line-height: 1;
}
.featured-settings-form input {
  width: 100%;
  min-width: 0;
  min-height: var(--admin-control-height, 36px);
  padding: .42rem .5rem;
  border: 1px solid var(--border);
  border-radius: var(--admin-radius-control, 6px);
  background: var(--bg-3);
  color: var(--text);
  font: inherit;
}
.featured-pinned-panel {
  scroll-margin-top: 5rem;
  margin-bottom: 1.25rem;
}
/* สินค้าขายดี: ตาราง 10 คอลัมน์ (มีฟอร์มป้ายปักหมุด/การแสดงผลในแถว) ถ้าปล่อย width:100% จะบีบคอลัมน์ชื่อ/หมวด/รูปจนอ่านไม่ออก
   → ตั้ง min-width ให้ .table-scroll เลื่อนแนวนอนแทน; ใช้เฉพาะโหมดตาราง (≥1024) เพราะ ≤1023 แปลงเป็นการ์ดแล้ว */
@media (min-width: 1024px) {
  .admin-bestsellers-panel .data-table,
  .featured-pinned-panel .data-table {
    min-width: 1320px;
  }
  .admin-bestsellers-panel .data-table td,
  .featured-pinned-panel .data-table td,
  .admin-bestsellers-panel .data-table th,
  .featured-pinned-panel .data-table th {
    white-space: nowrap;
  }
  .admin-bestsellers-panel .data-table td .u-select-text,
  .featured-pinned-panel .data-table td .u-select-text {
    white-space: normal;
  }
}
@media (max-width: 560px) {
  .admin-bestsellers-page__header .admin-header-actions {
    padding-right: 0;
  }
  .featured-settings-form {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }
  .featured-label-form {
    align-items: stretch;
    flex-direction: column;
  }
  .featured-label-form input[type="text"] {
    width: 100%;
  }
}
.btn-warn {
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #fff; border: 1px solid transparent;
}
.btn-warn:hover { filter: brightness(1.1); }

/* --- Stock overview --- */
.stock-num.text-danger { color: #fca5a5; font-weight: 600; }
.stock-num.text-warn { color: #fde047; font-weight: 600; }

/* --- Alert info --- */
.alert-info {
  background: rgba(167,139,250,.12); color: #ddd6fe;
  border: 1px solid var(--accent);
  border-radius: 10px; padding: .8rem 1rem;
}

/* --- Single price + Nitro variants --- */
/* ราคามี Nitro: ใช้สีชมพูเดิม (สีหลัก) */
.product-price.price-nitro { color: var(--primary); }
/* ราคาไม่มี Nitro: สีขาว/อ่อน */
.product-price.price-no-nitro { color: var(--text); }

/* Filter Nitro + ปุ่มคอลเลคชั่น แถวเดียวกับหมวดย่อย ชิดขวา */
.collection-bar--with-nitro { flex-wrap: nowrap; gap: .75rem; overflow-x: visible; }
.collection-bar-chips {
  display: flex; align-items: center; gap: .5rem; flex: 1; min-width: 0;
  overflow-x: auto; padding: .24rem 0 .28rem; margin-top: -.16rem; scrollbar-width: none;
  -ms-overflow-style: none;
}
.collection-bar-chips::-webkit-scrollbar { display: none; height: 0; width: 0; }
.subcategory-pill {
  --subcat-accent: #a78bfa;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  flex: 0 0 auto;
  padding: .35rem .75rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .07);
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--subcat-accent) 10%, transparent) 0%, transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .015));
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025);
  backdrop-filter: blur(12px) saturate(1.18);
  -webkit-backdrop-filter: blur(12px) saturate(1.18);
  font-size: .85rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  overflow: hidden;
  transition:
    transform var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}
.subcategory-pill::before {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--subcat-accent) 64%, transparent), transparent);
  opacity: .30;
  pointer-events: none;
}
.subcategory-pill:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--subcat-accent) 32%, transparent);
  box-shadow:
    0 7px 18px -14px color-mix(in srgb, var(--subcat-accent) 35%, transparent),
    0 0 0 1px color-mix(in srgb, var(--subcat-accent) 16%, transparent) inset;
}
.subcategory-pill:active:not(.active) {
  transform: scale(.98);
  transition-duration: 60ms;
}
.subcategory-pill.active {
  color: var(--text);
  border-color: color-mix(in srgb, var(--subcat-accent) 60%, transparent);
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--subcat-accent) 16%, transparent) 0%, transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .015));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--subcat-accent) 24%, transparent) inset,
    0 6px 18px -16px color-mix(in srgb, var(--subcat-accent) 42%, transparent);
}
.subcategory-pill__emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-size: .95rem;
  line-height: 1;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--subcat-accent) 28%, transparent));
}
.subcategory-pill__name {
  min-width: 0;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
}
.collection-bar-trailing {
  display: flex; align-items: center; gap: .5rem; flex-shrink: 0;
  margin-left: auto;
}
.collection-browse-btn {
  padding: .35rem .95rem;
  font-size: .85rem;
  font-weight: 600;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: var(--bg-3);
  transition: background .15s, color .15s, border-color .15s;
}
.collection-browse-btn:hover {
  color: var(--text);
  border-color: var(--primary);
}

/* คอลเลคชั่น: แสดงแท็ก + กากบาทยกเลิกกรอง (กรอบเดียวกับปุ่มเดิม) */
.collection-browse-btn--compound {
  display: inline-flex;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
  max-width: min(100%, 22rem);
}
.collection-browse-compound-main {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
  padding: 0.35rem 0.65rem 0.35rem 0.95rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.collection-browse-compound-main:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.collection-browse-compound-prefix {
  white-space: nowrap;
  flex-shrink: 0;
}
.collection-browse-compound-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  /* ค่าเริ่มต้นเทา — ถ้ามี tag_color จะถูกทับด้วย inline จาก collectionTagInlineStyle */
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.28);
  color: var(--text);
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.collection-browse-compound-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.collection-browse-compound-clear:hover {
  color: var(--text);
  background: rgba(248, 113, 113, 0.12);
}
.collection-bar--with-nitro .nitro-toggle {
  margin-left: 0; display: flex; gap: .35rem;
  padding: .25rem; border: 1px solid var(--border);
  border-radius: 999px; background: var(--bg-3);
  flex-shrink: 0;
}

/* หน้าเลือกคอลเลคชั่น (แบนเนอร์) */
.collection-browser-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.25rem;
}
@media (max-width: 520px) {
  .collection-browser-grid { grid-template-columns: 1fr; }
}
.collection-browser-card {
  display: block;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, transform .15s;
}
.collection-browser-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}
.collection-browser-banner {
  height: 180px;
  overflow: hidden;
  background: var(--bg-3);
}
.collection-browser-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.collection-browser-fallback {
  height: 100%;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  opacity: .55;
}
.collection-browser-name {
  padding: .75rem 1rem;
  font-weight: 600;
  font-size: .98rem;
}
.nitro-toggle .nt-opt {
  padding: .35rem .85rem; font-size: .85rem; font-weight: 600;
  border-radius: 999px; color: var(--muted); white-space: nowrap;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.nitro-toggle .nt-opt:hover { color: var(--text); }
.nitro-toggle .nt-opt.active.is-nitro { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; }
.nitro-toggle .nt-opt.active.is-no-nitro { background: var(--text); color: #1a0d2e; }

/* mobile: stack vertically (chips above, collection+nitro below) + compact sizing */
@media (max-width: 720px) {
  .collection-bar-stack {
    margin-top: .35rem;
    margin-bottom: .35rem;
    padding-top: .6rem;
    gap: .45rem;
  }
  .collection-bar {
    padding: 0;
    margin: 0;
    border-top: 0;
    gap: .35rem;
  }
  .collection-bar--with-nitro {
    flex-direction: column;
    align-items: stretch;
    gap: .5rem;
  }
  .collection-bar-chips {
    width: 100%;
    gap: .3rem;
    padding-bottom: .1rem;
  }
  .col-label {
    font-size: .72rem;
    margin-right: .1rem;
  }
  .subcategory-pill {
    padding: .28rem .62rem;
    font-size: .74rem;
    line-height: 1.2;
    gap: .28rem;
  }
  .subcategory-pill.active {
    box-shadow:
      0 0 0 2px rgba(168, 85, 247, .13),
      inset 0 0 0 1px rgba(168, 85, 247, .14);
  }
  .subcategory-pill__emoji {
    font-size: .85rem;
  }
  .chip-sm {
    padding: .28rem .62rem;
    font-size: .74rem;
    line-height: 1.2;
  }
  .collection-bar-trailing {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
    gap: .35rem;
    flex-wrap: wrap;
  }
  .collection-browse-btn {
    padding: .28rem .7rem;
    font-size: .74rem;
  }
  .collection-browse-btn--compound {
    max-width: 100%;
  }
  .collection-browse-compound-main {
    padding: .25rem .45rem .25rem .65rem;
    font-size: .74rem;
    gap: .3rem;
  }
  .collection-browse-compound-tag {
    padding: .14rem .42rem;
    font-size: .7rem;
  }
  .collection-browse-compound-clear {
    width: 1.7rem;
    font-size: 1.05rem;
  }
  .collection-bar--with-nitro .nitro-toggle {
    padding: .15rem;
    gap: .15rem;
    margin-left: auto;
  }
  .nitro-toggle .nt-opt {
    padding: .26rem .65rem;
    font-size: .72rem;
  }
}

/* หน้าสินค้า: ตัวเลือก Nitro บังคับเลือกก่อนหยิบ */
.detail-price-dual { margin: .6rem 0 .9rem; display: flex; flex-direction: column; gap: .35rem; }
.detail-price-dual .p-no, .detail-price-dual .p-yes { font-size: 1.2rem; font-weight: 600; }
.detail-price-dual .p-yes { color: var(--primary); }
.detail-rate-name { font-size: .9rem; }

.nitro-error {
  background: rgba(245,158,11,.12); color: #fde68a;
  border: 1px solid var(--warn); border-radius: 10px;
  padding: .65rem .85rem; font-size: .9rem;
  margin: .25rem 0 .75rem;
  animation: shake .35s ease-in-out;
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.cart-nitro { font-size: .8rem; margin: .1rem 0; }
.cart-ai-thumb {
  display: inline-block;
  margin: 0.35rem 0 0.2rem;
  width: 70px;
  height: 70px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg-3);
  cursor: pointer;
  transition: border-color 0.18s, transform 0.18s;
}
.cart-ai-thumb:hover,
.cart-ai-thumb:focus-visible {
  border-color: rgba(167,139,250,.55);
  transform: translateY(-1px);
  outline: none;
}
.cart-ai-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

/* ============ Submit Lock (กัน double-submit) ============ */
.btn.is-locked,
button.is-locked,
input.is-locked {
  cursor: wait !important;
  opacity: .82;
  filter: saturate(.85);
}
.btn.is-locked { pointer-events: none; }
.lock-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: lock-spin .7s linear infinite;
  opacity: .7;
}
@keyframes lock-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .lock-spinner { animation: none; border-right-color: currentColor; opacity: .4; }
}

/* ============ Hero v2 (homepage redesign) ============ */
.hero-v2 {
  padding: 4.5rem 0 3rem;
  position: relative;
  overflow: hidden;
  /* override .hero parent ที่ตั้ง text-align: center ไว้ที่ line ~852 */
  text-align: left;
  background:
    radial-gradient(900px 500px at 75% -10%, rgba(167,139,250,.16), transparent 70%),
    radial-gradient(700px 380px at 0% 10%, rgba(168,85,247,.14), transparent 70%);
}
.hero-v2-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3rem;
  position: relative;
  justify-content: center;
}
.hero-v2--with-banner .hero-v2-grid {
  min-height: 520px;
  overflow: hidden;
  border-radius: 14px;
}
.hero-v2--showcase {
  padding: 1.7rem 0 2.2rem;
  background:
    radial-gradient(720px 380px at 78% 0%, rgba(164,79,255,.18), transparent 70%),
    radial-gradient(520px 320px at 12% 12%, rgba(168,85,247,.1), transparent 72%);
}
.hero-v2--showcase .hero-v2-grid {
  display: block;
  min-height: 0;
  overflow: visible;
  border-radius: 0;
}
.hero-v2--showcase .hero-banner-full,
.hero-v2--showcase .hero-v2-text {
  display: none;
}
.hero-showcase {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 360px);
  gap: 1.25rem;
  align-items: stretch;
}
.hero-showcase-banner,
.hero-coupon-panel {
  min-height: 320px;
}
.hero-showcase-banner {
  min-width: 0;
}
.hero-showcase-banner__viewport {
  position: relative;
  /* ทดลอง: ล็อก 16:9 ทุกขนาดจอ (เดิม desktop ยืดตามความสูงแถว, mobile ล็อก 2:1) */
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(164, 79, 255, .28);
  border-radius: 18px;
  background:
    radial-gradient(circle at 72% 24%, rgba(164, 79, 255, .24), transparent 38%),
    linear-gradient(135deg, #130b25 0%, #0b0716 100%);
  /* box-shadow:
    0 0 0 1px rgba(255,255,255,.04) inset,
    0 18px 42px rgba(var(--shadow-ink),.34),
    0 0 22px rgba(164,79,255,.16); */
}
.hero-showcase-banner__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transform: scale(1.015);
  transition: opacity var(--dur-slow) ease, transform var(--dur-slow) ease;
}
.hero-showcase-banner__slide.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}
.hero-showcase-banner__slide img,
.hero-showcase-banner__link {
  display: block;
  width: 100%;
  height: 100%;
}
.hero-showcase-banner__slide img {
  object-fit: cover;
}
.hero-showcase-banner__viewport::after {
  content: "";
  position: absolute;
  inset: 0;
  /* background:
    linear-gradient(90deg, rgba(8,7,18,.18), transparent 42%, rgba(8,7,18,.08)),
    linear-gradient(180deg, rgba(255,255,255,.04), rgba(0,0,0,.12)); */
  pointer-events: none;
}
.hero-showcase-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
  background: rgba(18, 14, 32, .74);
  color: #f2eaff;
  box-shadow: 0 10px 26px rgba(var(--shadow-ink),.32), 0 0 12px rgba(164,79,255,.18);
  transform: translateY(-50%);
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease, transform var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.hero-showcase-nav:hover,
.hero-showcase-nav:focus-visible {
  background: rgba(72, 35, 128, .82);
  border-color: rgba(205,139,255,.56);
  color: #fff;
  box-shadow: 0 12px 28px rgba(var(--shadow-ink),.36), 0 0 18px rgba(164,79,255,.36);
}
.hero-showcase-nav:active {
  transform: translateY(-50%) scale(.96);
}
.hero-showcase-nav--prev {
  left: 1rem;
}
.hero-showcase-nav--next {
  right: 1rem;
}
.hero-showcase-dots {
  position: absolute;
  left: 50%;
  bottom: 1.1rem;
  z-index: 2;
  display: flex;
  gap: .65rem;
  transform: translateX(-50%);
}
.hero-showcase-dot {
  width: 36px;
  height: 9px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,.2);
  box-shadow: 0 0 0 1px rgba(255,255,255,.06) inset;
  transition: width var(--dur-fast) ease, background var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.hero-showcase-dot.is-active {
  width: 44px;
  background: linear-gradient(135deg, #c15cff, #8f45ff);
  box-shadow: 0 0 14px rgba(164,79,255,.5);
}
.hero-coupon-panel {
  display: flex;
  flex-direction: column;
  /* แบนเนอร์ล็อก 16:9 → การ์ดถูกยืดสูงกว่าเนื้อหาจริง กระจายส่วนเกินลงทุกช่องว่าง
     (ถ้าเลิกใช้ 16:9 ให้กลับเป็น gap:1rem + margin-top:auto ที่ .hero-coupon-link) */
  justify-content: space-between;
  --credit-notch: #17142b;   /* สีรอยเจาะตั๋วเครดิตฟรี = พื้นการ์ดนี้ */
  gap: 1rem;
  padding: 1.35rem;
  border: 1px solid rgba(164,79,255,.24);
  border-radius: 18px;
  background:
    radial-gradient(circle at 78% 0%, rgba(164,79,255,.16), transparent 42%),
    linear-gradient(180deg, rgba(24, 21, 39, .98), rgba(15, 13, 27, .98));
  /* box-shadow:
    0 0 0 1px rgba(255,255,255,.04) inset,
    0 18px 42px rgba(var(--shadow-ink),.34),
    0 0 20px rgba(164,79,255,.12); */
}
.hero-coupon-panel__head {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.hero-coupon-panel__head h2 {
  margin: 0;
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 600;
  line-height: 1.25;
}
.hero-coupon-panel__icon,
.hero-coupon-card__icon,
.hero-coupon-today__icon,
.hero-coupon-card__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #b65cff;
  filter: drop-shadow(0 0 8px rgba(182,92,255,.45));
}
.hero-coupon-form {
  padding: 1rem;
  border: 1px solid rgba(164,79,255,.44);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(164,79,255,.11), rgba(164,79,255,.035)),
    rgba(15, 13, 27, .68);
  box-shadow: 0 0 18px rgba(164,79,255,.14), inset 0 0 16px rgba(164,79,255,.08);
}
.hero-coupon-form label,
.hero-coupon-today__label {
  display: block;
  margin: 0 0 .6rem;
  color: #d9c7f4;
  font-weight: 600;
  font-size: .92rem;
}
.hero-coupon-form__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .6rem;
}
.hero-coupon-form input {
  min-width: 0;
  height: 44px;
  padding: 0 .85rem;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 8px;
  background: rgba(8, 7, 18, .72);
  color: var(--text);
  font-size: .92rem;
}
.hero-coupon-form button {
  height: 44px;
  padding: 0 1rem;
  border: 0;
  border-radius: 9px;
  background: linear-gradient(135deg, #8f45ff, #c15cff);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(143,69,255,.32), 0 0 13px rgba(193,92,255,.2);
}
.hero-coupon-status {
  min-height: 1.1rem;
  margin-top: .65rem;
  color: #d9c7f4;
  font-size: .82rem;
  line-height: 1.35;
}
.hero-coupon-status.is-success {
  color: #86efac;
}
.hero-coupon-status.is-error {
  color: #fca5a5;
}

/* ---- ตั๋วเครดิตฟรี: อยู่ช่องเดียวกับการ์ดกรอกโค้ดเชิญเพื่อน (ทับไว้จนกดรับ)
   ตั๋วอยู่ใน flow ปกติ (ไม่ absolute) เพราะการ์ดโค้ดเชิญถูก hidden ไว้ — ถ้าตั๋ว absolute ช่องจะยุบสูง 0
   ตอนกดรับค่อยสลับตั๋วเป็น absolute เพื่อให้การ์ดเข้ามารับความสูงต่อโดยไม่กระตุก */
.hero-coupon-slot {
  position: relative;
}
.credit-ticket {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .9rem;
  overflow: hidden;
  padding: 1rem;
  border: 1px solid rgba(164,79,255,.5);
  border-radius: 12px;
  background:
    radial-gradient(circle at 88% 0%, rgba(215,150,255,.22), transparent 46%),
    linear-gradient(135deg, rgba(143,69,255,.34), rgba(193,92,255,.14)),
    rgba(15, 13, 27, .82);
  box-shadow: 0 0 20px rgba(164,79,255,.2), inset 0 0 18px rgba(164,79,255,.1);
  /* easing คุมที่ keyframe แต่ละช่วงเอง (ดู @keyframes) — ตรงนี้ต้องเป็น linear
     ถ้าใส่ easing overshoot ที่นี่มันจะไปทับทุกช่วงแล้วเด้งเกินซ้อนกันหลายรอบ = กระตุก */
  animation: credit-ticket-pulse 1.2s linear infinite;
}
/* รอยปะตั๋ว: วงกลมเจาะบน-ล่างตรงเส้นประ */
.credit-ticket__stub {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  width: 62px;
  padding-right: .9rem;
  border-right: 2px dashed rgba(205,139,255,.45);
  color: #e6d2ff;
}
.credit-ticket__stub::before,
.credit-ticket__stub::after {
  content: "";
  position: absolute;
  right: -9px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  /* ต้องเท่าพื้นการ์ดคูปองที่ตั๋ววางอยู่ ไม่ใช่พื้นหน้าเว็บ — ตั้งไว้ที่ .hero-coupon-panel ทั้ง 2 ธีม */
  background: var(--credit-notch);
  box-shadow: inset 0 0 0 1px rgba(164,79,255,.4);
}
.credit-ticket__stub::before { top: -1.55rem; }
.credit-ticket__stub::after { bottom: -1.55rem; }
.credit-ticket__stub-icon {
  display: inline-flex;
  color: #d982ff;
  filter: drop-shadow(0 0 8px rgba(182,92,255,.5));
  animation: credit-ticket-wiggle 4.5s ease-in-out infinite;
}
.credit-ticket__stub-text {
  font-family: var(--font-display);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .12em;
}
.credit-ticket__body {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
}
.credit-ticket__eyebrow {
  color: #d9c7f4;
  font-size: .82rem;
  font-weight: 600;
}
.credit-ticket__amount {
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1.15;
}
.credit-ticket__amount small {
  margin-left: .25rem;
  color: #d982ff;
  font-size: .82rem;
  font-weight: 600;
}
.credit-ticket__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  margin-top: .5rem;
  min-height: 40px;
  padding: 0 .9rem;
  border: 0;
  border-radius: 9px;
  background: linear-gradient(135deg, #8f45ff, #c15cff);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(143,69,255,.34), 0 0 13px rgba(193,92,255,.22);
  transition: transform var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.credit-ticket__btn:hover,
.credit-ticket__btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(143,69,255,.42), 0 0 18px rgba(193,92,255,.3);
}
.credit-ticket__btn:disabled {
  opacity: .65;
  transform: none;
}
.credit-ticket__status {
  grid-column: 1 / -1;
  color: #fca5a5;
  font-size: .82rem;
  line-height: 1.35;
}
/* กดรับสำเร็จ ขั้นที่ 1: ปั๊ม "รับแล้ว!" ทับหน้าตั๋วค้างไว้ ~1.4 วิ (หยุดพัลส์ไว้ก่อนให้อ่านทัน)
   ต้องประกาศก่อน .is-claimed เพราะ specificity เท่ากัน — ตัวที่อยู่หลังในไฟล์ชนะ */
.credit-ticket__done {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .15rem;
  text-align: center;
  background:
    radial-gradient(circle at 50% 30%, rgba(215,150,255,.28), transparent 60%),
    linear-gradient(135deg, rgba(143,69,255,.5), rgba(193,92,255,.26)),
    rgba(15, 13, 27, .95);
}
.credit-ticket__done[hidden] { display: none; }
.credit-ticket__done-icon {
  display: inline-flex;
  color: #86efac;
  filter: drop-shadow(0 0 10px rgba(134,239,172,.5));
}
.credit-ticket__done strong {
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.18rem;
}
.credit-ticket__done-text {
  color: #e6d2ff;
  font-size: .88rem;
  font-weight: 600;
}
.credit-ticket.is-success {
  animation: none;   /* หยุดเด้งตอนโชว์ผล */
}
.credit-ticket.is-success .credit-ticket__done {
  animation: credit-done-stamp .3s cubic-bezier(.34, 1.56, .64, 1) both;
}
@keyframes credit-done-stamp {
  0% { transform: scale(1.18); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ขั้นที่ 2: ตั๋วฉีกออกไปทางขวา แล้วการ์ดโค้ดเชิญเฟดขึ้นมาแทน */
.credit-ticket.is-claimed {
  position: absolute;
  inset: 0;
  pointer-events: none;
  animation: credit-ticket-out var(--dur-slow, .32s) ease forwards;
}
.hero-coupon-form.is-revealing {
  animation: credit-form-in .38s ease both;
}
/* ย่อ-ขยายเป็นจังหวะหายใจ — คุมแต่ transform ไม่แตะ box-shadow
   เพราะ keyframe ชนะ declaration ปกติ ถ้าใส่เงาไว้ในนี้จะทับเงาของ light theme ด้วย */
/* เด้งแบบหน่วงลง (damped): ผุดขึ้นเร็วแบบ ease-out → ไหลลงแบบ sine → เด้งกลับเบา ๆ แล้วนิ่ง
   ให้แต่ละช่วงมี easing ของตัวเองจะสมูทกว่าใส่ easing เดียวคุมทั้งเส้น */
@keyframes credit-ticket-pulse {
  0% {
    transform: scale(1);
    animation-timing-function: cubic-bezier(.22, .61, .36, 1);   /* ผุดขึ้น เร็วตอนต้น ผ่อนตอนถึงยอด */
  }
  32% {
    transform: scale(1.042);
    animation-timing-function: cubic-bezier(.37, 0, .63, 1);     /* ลงแบบ sine ไม่มีสะดุด */
  }
  64% {
    transform: scale(.9975);                                      /* ยุบต่ำกว่าปกติแค่จิ๊ดเดียว */
    animation-timing-function: cubic-bezier(.37, 0, .63, 1);
  }
  84% {
    transform: scale(1.008);                                      /* เด้งกลับเบา ๆ = ลูกที่สองของสปริง */
    animation-timing-function: cubic-bezier(.37, 0, .63, 1);
  }
  100% { transform: scale(1); }
}
@keyframes credit-ticket-wiggle {
  0%, 84%, 100% { transform: rotate(0) scale(1); }
  88% { transform: rotate(-9deg) scale(1.08); }
  94% { transform: rotate(9deg) scale(1.08); }
}
@keyframes credit-ticket-out {
  0% { transform: translate(0, 0) rotate(0) scale(1); opacity: 1; }
  100% { transform: translate(38%, -14%) rotate(7deg) scale(.86); opacity: 0; }
}
@keyframes credit-form-in {
  0% { transform: translateY(8px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .credit-ticket,
  .credit-ticket__stub-icon,
  .credit-ticket.is-success .credit-ticket__done { animation: none; }
  .credit-ticket.is-claimed { animation-duration: .01s; }
  .hero-coupon-form.is-revealing { animation: none; }
}

.hero-coupon-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .75rem;
  align-items: center;
  min-height: 74px;
  padding: 1rem;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
  background: rgba(255,255,255,.035);
}
.hero-coupon-today__label--mobile,
.hero-coupon-card--mobile-link {
  display: none;
}
.hero-coupon-card--mobile-link {
  color: inherit;
  text-decoration: none;
}
.hero-coupon-card strong {
  min-width: 0;
  color: #fff;
  font-size: 1.28rem;
  line-height: 1;
}
.hero-coupon-card__value {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  color: #d982ff;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
}
.hero-coupon-card__value small {
  margin-top: .25rem;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
}
.hero-coupon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  min-height: 48px;
  padding: .8rem 1rem;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(91,46,168,.96), rgba(117,52,205,.96));
  color: #fff;
  font-weight: 600;
  transition: transform var(--dur-fast) ease, box-shadow var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.hero-coupon-link:hover,
.hero-coupon-link:focus-visible {
  color: #fff;
  border-color: rgba(205,139,255,.45);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(91,46,168,.26), 0 0 16px rgba(164,79,255,.22);
}
.hero-v2-text {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  position: relative;
  z-index: 1;
}
.hero-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem auto;
  gap: .45rem;
  align-self: flex-start;
  padding: .42rem .9rem;
  border-radius: 999px;
  background: rgba(255,255,255,.025);
  border: 1px solid rgba(255,255,255,.08);
  font-size: .82rem;
  color: var(--text);
  font-weight: 500;
  letter-spacing: .02em;
}
.hero-badge-star {
  color: #fbbf24;
  fill: #fbbf24;
}
.hero-v2-title {
  text-align: center;
  margin: .35rem 0 0;
  font-size: clamp(2.8rem, 6vw, 4.8rem);
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0;
  background: var(--brand-name-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-v2-subtitle {
  display: flex;
  flex-direction: column; /* จัดเรียงเนื้อหาจากบนลงล่าง */
  align-items: center;    /* จัดเนื้อหาให้อยู่กึ่งกลางแนวนอน */
  justify-content: center; /* จัดเนื้อหาให้อยู่กึ่งกลางแนวตั้ง (ถ้ามีพื้นที่ว่าง) */
  text-align: center;
  margin: 0;
  font-size: clamp(1.5rem, 3.2vw, 2.3rem);
  font-weight: 600;
  line-height: 1.25;
  color: #fff;
  letter-spacing: -.3px;
}
.hero-v2-desc {
  display: flex;
  flex-direction: column; /* จัดเรียงเนื้อหาจากบนลงล่าง */
  align-items: center;    /* จัดเนื้อหาให้อยู่กึ่งกลางแนวนอน */
  justify-content: center; /* จัดเนื้อหาให้อยู่กึ่งกลางแนวตั้ง (ถ้ามีพื้นที่ว่าง) */
  text-align: center;      /* ทำให้ตัวหนังสือทุกบรรทัดเริ่มพิมพ์จากกึ่งกลาง */
  margin: .25rem 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
  max-width: 540px;
}
/* Wrapper ทำให้ stats + CTA card ความกว้างเท่ากัน */
.hero-stats-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
}
.hero-cta-buttons {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  margin-top: 1rem
}
.hero-cta-buttons .btn svg {
  flex-shrink: 0;
  overflow: visible;
}
.hero-stats {
  display: flex;
  justify-content: center; /* จัดกลุ่มไอคอนให้อยู่กึ่งกลาง */
  flex-wrap: wrap;         /* รองรับมือถือ ถ้าจอกับไอคอนจะลงมาแถวใหม่เอง */
  gap: 2.2rem;
  width: 100%;
}
.hero-stat-item {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
}
/* ไม่มีกล่องครอบ — แค่ icon สีชมพู */
.hero-stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}
.hero-stat-text {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.1;
}
.hero-stat-text strong {
  font-size: 1.35rem;
  color: #fff;
  font-weight: 600;
  letter-spacing: -.01em;
}
.hero-stat-text > span {
  font-size: .82rem;
  color: var(--muted);
  margin-top: 2px;
}
.hero-cta-card {
  display: flex;
  align-items: center;
  gap: .9rem;
  margin: 1rem auto 0 auto;
  padding: 1rem 1.2rem;
  max-width: 450px;
  border-radius: 14px;
  background: rgba(168,85,247,.04);
  border: 1px solid rgba(168,85,247,.18);
  color: var(--text);
  text-decoration: none;
  width: 100%;
  transition: all var(--dur-fast) var(--ease-out);
}
.hero-cta-card:hover {
  background: rgba(168,85,247,.08);
  border-color: rgba(168,85,247,.4);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(168,85,247,.15);
}
/* ไม่มีกล่องครอบ — แค่ icon สีชมพู */
.hero-cta-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}
.hero-cta-card__text {
  display: inline-flex;
  flex-direction: column;
  flex: 1;
  line-height: 1.3;
  min-width: 0;
}
.hero-cta-card__text strong {
  font-size: 1rem;
  color: #fff;
  font-weight: 600;
}
.hero-cta-card__text > span {
  font-size: .82rem;
  color: var(--muted);
  margin-top: 2px;
}
.hero-cta-card__arrow {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  transition: transform var(--dur-fast) var(--ease-out);
}
.hero-cta-card:hover .hero-cta-card__arrow {
  transform: translateX(3px);
  color: var(--primary);
}

.hero-v2-art {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}
.hero-v2-art img {
  width: 100%;
  max-width: 540px;
  height: auto;
  filter:
    drop-shadow(0 24px 70px rgba(88,101,242,.32))
    drop-shadow(0 12px 36px rgba(168,85,247,.22));
  animation: hero-float 6s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .hero-v2-art img { animation: none; }
}

/* Hero showcase (banner + coupon panel) ยุบที่ 1023 ให้ตรงกับ header ที่สลับ mobile (≤1023) — page-top transform พร้อมกัน */
@media (max-width: 1023px) {
  .hero-v2--showcase { padding: 1rem 0 2rem; }
  .hero-showcase {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .hero-showcase-banner,
  .hero-coupon-panel {
    min-height: auto;
  }
  .hero-coupon-panel {
    display: flex;
    padding: 1rem;
  }
  .hero-coupon-panel__head,
  .hero-coupon-form,
  .hero-coupon-link {
    display: none;
  }
  /* มือถือซ่อนการ์ดโค้ดเชิญเพื่อนอยู่แล้ว → ช่องที่ไม่มีตั๋วต้องหายไปด้วย ไม่งั้นเหลือ gap ลอย ๆ
     แต่ตั๋วยังโชว์: เป็นตัวดึงให้สมัคร ปิดบนมือถือคือเสียคนดูส่วนใหญ่ */
  .hero-coupon-slot:not(.has-ticket) {
    display: none;
  }
  /* จอเล็ก: ตั๋วเตี้ยลง — ฝั่งขวาเหลือแค่ปุ่ม (จำนวนเครดิตอยู่บนปุ่มอยู่แล้ว ไม่ต้องบอกซ้ำ) */
  .credit-ticket {
    padding: .7rem;
    gap: .7rem;
    align-items: center;
  }
  .credit-ticket__stub {
    width: 46px;
    padding-right: .7rem;
  }
  /* รอยเจาะต้องอยู่กลางขอบตั๋วพอดี = ครึ่งวงกลมโดน overflow:hidden ตัด → ผูกกับ padding ที่เล็กลง */
  .credit-ticket__stub::before { top: -1.2rem; }
  .credit-ticket__stub::after { bottom: -1.2rem; }
  .credit-ticket__eyebrow,
  .credit-ticket__amount {
    display: none;
  }
  .credit-ticket__btn {
    margin-top: 0;
    min-height: 38px;
  }
  /* ตั๋วเตี้ยลงแล้ว ปั๊ม "รับแล้ว!" ต้องย่อตามไม่ให้ล้นกรอบ */
  .credit-ticket__done {
    flex-direction: row;
    gap: .4rem;
    padding: 0 .6rem;
  }
  .credit-ticket__done-icon .lucide {
    width: 18px;
    height: 18px;
  }
  .credit-ticket__done strong {
    font-size: .95rem;
  }
  .credit-ticket__done-text {
    font-size: .74rem;
  }
  .hero-coupon-today {
    min-width: 0;
  }
  .hero-coupon-today__label--desktop,
  .hero-coupon-card--static {
    display: none;
  }
  .hero-coupon-today__label--mobile {
    display: flex;
    align-items: center;
    gap: .45rem;
  }
  .hero-coupon-card {
    min-height: 58px;
    padding: .8rem .9rem;
  }
  .hero-coupon-card--mobile-link {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
  }
  .hero-coupon-card--mobile-link:hover,
  .hero-coupon-card--mobile-link:focus-visible {
    color: inherit;
    border-color: rgba(205,139,255,.42);
  }
  .hero-coupon-card--mobile-link:focus-visible {
    outline: 2px solid rgba(193,92,255,.5);
    outline-offset: 2px;
  }
}
@media (max-width: 480px) {
  .hero-showcase-banner__viewport {
    border-radius: 14px;
  }
  .hero-showcase-nav {
    width: 40px;
    height: 40px;
  }
  .hero-showcase-nav--prev { left: .65rem; }
  .hero-showcase-nav--next { right: .65rem; }
  .hero-showcase-dots {
    bottom: .8rem;
    gap: .45rem;
  }
  .hero-showcase-dot {
    width: 26px;
    height: 7px;
  }
  .hero-showcase-dot.is-active { width: 34px; }
  .hero-coupon-form__row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .45rem;
  }
  .hero-coupon-form button {
    width: auto;
    min-width: 4.5rem;
  }
  .hero-coupon-panel {
    gap: .65rem;
    padding: .72rem;
    border-radius: 14px;
  }
  .hero-coupon-panel__head {
    gap: .45rem;
  }
  .hero-coupon-panel__head h2 {
    font-size: .9rem;
  }
  .hero-coupon-panel__icon .lucide {
    width: 18px;
    height: 18px;
  }
  .hero-coupon-form {
    position: relative;
    padding: .62rem;
    border-radius: 10px;
  }
  .hero-coupon-form label,
  .hero-coupon-today__label {
    margin-bottom: .38rem;
    font-size: .72rem;
  }
  .hero-coupon-form label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .hero-coupon-today__label {
    display: block;
  }
  .hero-coupon-today__label--desktop {
    display: none;
  }
  .hero-coupon-today__label--mobile {
    display: flex;
  }
  .hero-coupon-form input,
  .hero-coupon-form button {
    height: 36px;
    font-size: .78rem;
    border-radius: 8px;
  }
  .hero-coupon-form input {
    padding: 0 .6rem;
  }
  .hero-coupon-card {
    min-height: 44px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: .55rem .65rem;
    gap: .45rem;
    border-radius: 10px;
  }
  .hero-coupon-card--mobile-link {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
  }
  .hero-coupon-card strong {
    font-size: .96rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .hero-coupon-card__icon .lucide {
    width: 18px;
    height: 18px;
  }
  .hero-coupon-today__icon .lucide,
  .hero-coupon-card__chevron .lucide {
    width: 16px;
    height: 16px;
  }
  .hero-coupon-card__value {
    font-size: .72rem;
    align-items: flex-end;
    text-align: right;
    white-space: nowrap;
  }
  .hero-coupon-card__value small {
    font-size: .64rem;
  }
  .hero-coupon-link {
    display: none;
  }
  .hero-v2-art img { max-width: 280px; }
  .hero-stats { gap: 1.2rem; }
  .hero-stat-text strong { font-size: 1.1rem; }
}

/* ============ Category picker panel (homepage) ============ */
.cat-picker-panel {
  margin-top: 2rem;
  padding: 1.4rem 1.4rem 1.5rem;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,.005));
  border: 1px solid rgba(255,255,255,.06);
  position: relative;
}
.cat-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .9rem;
  margin-bottom: 1rem;
}
.cat-picker-title {
  margin: 0 0 .9rem;
  font-size: .96rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
  text-shadow: 0 0 16px rgba(167, 139, 250, .16);
}
.cat-picker-head .cat-picker-title { margin: 0; }
.cat-picker-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
  margin-left: auto;
}
.filter-popover-wrap--inline { flex-shrink: 0; position: relative; }

/* Admin: category icon preview (in table + edit form) */
.cat-icon-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: .35rem;
  vertical-align: middle;
  font-size: 1.15rem;
  line-height: 1;
}
.cat-icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.cat-icon-current {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .35rem .55rem;
  margin-bottom: .4rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-3);
}
.cat-icon-current img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: rgba(255,255,255,.04);
  border-radius: 6px;
  flex-shrink: 0;
}
.cell-numeric { text-align: center; }

.admin-auto-messages-table { min-width: 900px; }
.admin-subcategories-table { min-width: 720px; }
.admin-collections-table { min-width: 820px; }
.admin-auto-messages-table .auto-msg-preview {
  white-space: normal;
  overflow-wrap: anywhere;
}
.admin-auto-messages-table .auto-msg-thumb {
  display: block;
  flex-shrink: 0;
}
.admin-auto-messages-table td.row-actions {
  display: table-cell;
  white-space: nowrap;
}
.admin-auto-messages-table td.row-actions > a,
.admin-auto-messages-table td.row-actions > form {
  display: inline-flex;
  vertical-align: middle;
  margin: .12rem .18rem .12rem 0;
}

@media (max-width: 720px) {
  .admin-auto-messages-table,
  .admin-subcategories-table,
  .admin-collections-table {
    min-width: 0;
  }
  .admin-auto-messages-table tr {
    padding: 0;
    overflow: hidden;
  }
  .admin-auto-messages-table td {
    padding: .55rem .7rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  .admin-auto-messages-table td:last-child {
    border-bottom: 0;
  }
  .admin-auto-messages-table .auto-msg-preview {
    max-width: none;
  }
  .admin-auto-messages-table .auto-msg-thumb {
    width: 52px;
    height: 52px;
  }
  .admin-main-categories-table {
    min-width: 0;
  }
  .admin-main-categories-table .row-actions {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
  }
  .admin-main-categories-table .row-actions > * {
    width: auto;
  }
}

/* "ทั้งหมด" pill (next to filter button) */
.cat-pill--all {
  background: var(--bg-2);
  border-color: rgba(255,255,255,.08);
}
.cat-pill--all .cat-pill__icon { color: var(--muted); }
.cat-pill--all:hover .cat-pill__icon { color: var(--text); }
.cat-pill--all.is-active {
  background: linear-gradient(135deg, rgba(168,85,247,.18), rgba(167,139,250,.10));
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(168,85,247,.14);
}
.cat-pill--all.is-active .cat-pill__icon { color: var(--primary); }

/* ============ Category cards — horizontal neon-glow style ============ */
.cat-cards-scroller {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: .5rem;
  padding-top: 4px;
  overflow: visible;
}
.cat-cards-row {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-wrap: nowrap;
  gap: .8rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
  padding-top: 6px;
  padding-bottom: 4px;
  margin-top: -6px;
}
.cat-cards-row::-webkit-scrollbar { display: none; }

/* Nav arrow buttons (left/right) — vertical pill that blends with cards */
.cat-cards-nav {
  flex: 0 0 auto;
  width: 20px;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 5px;

  /* ปกติไม่มีพื้นหลัง */
  background: transparent;
  border: 1px solid transparent;

  color: rgba(255,255,255,.38);
  cursor: pointer;
  padding: 0;
  font-family: inherit;

  transition:
    background .22s ease,
    border-color .22s ease,
    color .22s ease,
    backdrop-filter .22s ease,
    transform .22s ease;
}
.cat-cards-nav:hover {
  border-color: rgba(150,130,255,.045);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: rgba(255,255,255,.88);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.02),
    0 0 18px rgba(90,70,220,.05);
}
.cat-cards-nav:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--primary) 70%, rgba(255,255,255,.18));
  box-shadow: 0 0 0 3px rgba(168,85,247,.14);
}
.cat-cards-nav:active { transform: scale(.96); transition-duration: 60ms; }
.cat-cards-nav[hidden] { display: none; }
.cat-cards-nav[disabled] {
  opacity: .38;
  cursor: not-allowed;
  pointer-events: none;
}
.cat-card {
  --cat-accent: #a78bfa;
  position: relative;
  flex: 0 0 auto;
  width: 254px;
  scroll-snap-align: start;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .85rem;
  padding: .85rem 1rem;
  border-radius: 14px;
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--cat-accent) 10%, transparent) 0%, transparent 55%),
    linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.015));
  border: 1px solid rgba(255,255,255,.07);
  color: var(--text);
  text-decoration: none;
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: transform var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.cat-card::before {
  /* subtle inner glow line at the bottom */
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--cat-accent) 65%, transparent), transparent);
  opacity: .32;
  pointer-events: none;
}
.cat-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--cat-accent) 32%, transparent);
  box-shadow:
    0 7px 18px -14px color-mix(in srgb, var(--cat-accent) 35%, transparent),
    0 0 0 1px color-mix(in srgb, var(--cat-accent) 16%, transparent) inset;
}
.cat-card:active { transform: translateY(0) scale(.99); transition-duration: 60ms; }
.cat-card.is-active {
  border-color: color-mix(in srgb, var(--cat-accent) 60%, transparent);
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--cat-accent) 16%, transparent) 0%, transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.015));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--cat-accent) 24%, transparent) inset,
    0 6px 18px -16px color-mix(in srgb, var(--cat-accent) 42%, transparent);
}

.cat-card__icon {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  line-height: 1;
  color: var(--cat-accent);
  flex-shrink: 0;
}
.cat-card__icon svg { color: var(--cat-accent); }
.cat-card__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cat-card__body {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  min-width: 0;
}
.cat-card__name {
  font-size: .98rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-card__desc {
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-card__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: color-mix(in srgb, var(--cat-accent) 75%, var(--muted));
  flex-shrink: 0;
  transition: transform var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.cat-card:hover .cat-card__arrow {
  transform: translateX(3px);
  color: var(--cat-accent);
}

.cat-picker-row {
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  scrollbar-width: none;
}
.cat-picker-row::-webkit-scrollbar { display: none; }
/* Categories list: wrap ภายใน, filter button stays outside */
.cat-pills-list {
  display: flex;
  gap: .65rem;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.filter-popover-wrap {
  flex-shrink: 0;
  position: relative;
}

.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .65rem 1.1rem;
  border-radius: 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--dur-fast) var(--ease-out);
  position: relative;
  cursor: pointer;
  font-family: inherit;
}
.cat-pill:hover {
  background: var(--bg-3);
  border-color: rgba(168,85,247,.3);
  transform: translateY(-1px);
}
.cat-pill:active { transform: translateY(0) scale(.98); transition-duration: 60ms; }
/* ไม่มีกล่องครอบ — emoji/svg แสดงตรงๆ */
.cat-pill__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text);
  flex-shrink: 0;
  line-height: 1;
}
.cat-pill.is-active {
  background: linear-gradient(135deg, rgba(168,85,247,.18), rgba(167,139,250,.10));
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(168,85,247,.14);
}
.cat-pill.is-active .cat-pill__icon {
  color: var(--primary);
}
.cat-pill__name { line-height: 1.2; }

.cat-pill--filter .cat-pill__icon {
  color: var(--muted);
}
.cat-pill--filter:hover .cat-pill__icon { color: var(--text); }
.cat-pill--filter.has-active {
  border-color: var(--primary);
  background: rgba(168,85,247,.08);
}
.cat-pill--filter.has-active .cat-pill__icon { color: var(--primary); }
.cat-pill__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: .15rem;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: .7rem;
  font-weight: 600;
  line-height: 1;
}

/* mobile: pills เป็น horizontal scroll (1 แถว swipe) + filter button มุมขวาบนข้าง title */
@media (max-width: 720px) {
  .cat-picker-panel {
    margin-top: 1.2rem;
    padding: .8rem .8rem .9rem;
    border-radius: 14px;
  }
  .cat-picker-head {
    gap: .5rem;
    margin-bottom: .7rem;
  }
  .cat-picker-title {
    margin: 0 0 .45rem;
    font-size: .82rem;
    min-height: 30px;
    display: flex;
    align-items: center;
  }
  .cat-picker-head .cat-picker-title { margin: 0; }
  .cat-picker-row { display: block; }
  .cat-pills-list {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: .35rem;
    padding: .1rem 0 .25rem;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
  }
  .cat-pills-list::-webkit-scrollbar { display: none; }
  .cat-pill {
    flex: 0 0 auto;
    scroll-snap-align: start;
    min-height: 34px;
    padding: .38rem .7rem;
    font-size: .76rem;
    gap: .35rem;
    border-radius: 999px;
  }
  .cat-pill__icon { font-size: .95rem; }
  .cat-pill.is-active {
    box-shadow: 0 0 0 2px rgba(168, 85, 247, .15);
  }

  /* Cards: horizontal scroll on mobile (swipe through categories) */
  .cat-cards-scroller { gap: 0; }
  .cat-cards-nav { display: none; }
  .cat-cards-row {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: .55rem;
    padding: .1rem .1rem .35rem;
    margin: 0 -.2rem;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  .cat-card {
    flex: 0 0 auto;
    width: min(74vw, 240px);
    padding: .65rem .75rem;
    gap: .6rem;
    border-radius: 12px;
    scroll-snap-align: start;
  }
  .cat-card__icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 1.55rem;
  }
  .cat-card__name { font-size: .88rem; }
  .cat-card__desc { font-size: .72rem; }

  /* Filter button: inline ใน head แล้ว (ไม่ต้อง absolute เหมือนเก่า) */
  .filter-popover-wrap--inline { position: relative; }
  .filter-popover-wrap .cat-pill--filter {
    min-height: 32px;
    padding: .35rem .65rem;
    font-size: .76rem;
    border-radius: 10px;
    gap: .3rem;
    white-space: nowrap;
  }
  .filter-popover-wrap .cat-pill--filter .cat-pill__icon { font-size: .9rem; }
  .cat-pill__badge {
    min-width: 15px;
    height: 15px;
    padding: 0 4px;
    font-size: .62rem;
    border-radius: 8px;
  }
}

@media (max-width: 480px) {
  .cat-card {
    width: min(82vw, 230px);
  }
}

/* ============ AJAX filter — loading state สำหรับ #shopResults ============ */
#shopResults {
  position: relative;
  transition: opacity var(--dur-fast) var(--ease-out);
}
#shopResults.is-loading {
  opacity: .55;
  pointer-events: none;
}
#shopResults.is-loading::after {
  content: '';
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: lock-spin .7s linear infinite;
  z-index: 2;
}
@media (prefers-reduced-motion: reduce) {
  #shopResults.is-loading::after { animation: none; opacity: .5; }
}

[data-live-search-panel] {
  position: relative;
  transition: opacity var(--dur-fast) var(--ease-out);
}
[data-live-search-panel].is-live-loading {
  opacity: .62;
  pointer-events: none;
}
[data-live-search-panel].is-live-loading::after {
  content: '';
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: lock-spin .7s linear infinite;
  z-index: 3;
}
.admin-filter-bar.is-live-searching .admin-filter-input,
.admin-filter-bar.is-live-searching .admin-filter-select {
  border-color: var(--search-hover-border);
  box-shadow: var(--search-hover-shadow);
}
@media (prefers-reduced-motion: reduce) {
  [data-live-search-panel].is-live-loading::after { animation: none; opacity: .5; }
}

/* ===== Repair: homepage curated sections + admin renovation ===== */
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 2rem 0 1rem;
}
.section-title-row .section-title {
  margin: 0;
}
.section-title-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  flex-shrink: 0;
  padding: .72rem 1.25rem;
  border-radius: 14px;
  /* สไตล์เดียวกับ alert card: soft purple bg + purple border + light purple text */
  border: 1px solid rgba(168, 85, 247, .45);
  color: #e9d5ff;
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--dur-fast) var(--ease-out);
}
.section-title-action .lucide { color: currentColor; }
.section-title-action:hover,
.section-title-action:focus-visible {
  color: #fff;
  border-color: rgba(168, 85, 247, .75);
  transform: translateY(-1px);
}
.section-title-action:active {
  transform: translateY(0) scale(.96);
  transition-duration: 60ms;
}
.section-title-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.3rem;
  line-height: 1;
  background: linear-gradient(135deg, rgba(249, 115, 22, .16), rgba(239, 68, 68, .1));
  border: 1px solid rgba(249, 115, 22, .28);
  box-shadow: 0 0 14px rgba(249, 115, 22, .14);
}
.product-grid--weekly-featured {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  grid-template-rows: repeat(2, minmax(170px, 1fr));
  gap: 1rem;
  align-items: stretch;
  margin-bottom: var(--space-7);
}
.product-grid--weekly-featured + .section-title-row {
  margin-top: var(--space-7);
}
.product-grid--weekly-featured .product-card.is-featured {
  /* ลด glow + ปิด pulse animation — ให้ดูสุขุมขึ้น สังเกตเป็น featured ได้แต่ไม่กระพริบ */
  border-color: rgba(168, 85, 247, .22);
  background:
    linear-gradient(180deg, rgba(168, 85, 247, .06) 0%, rgba(22, 22, 31, .96) 34%),
    var(--bg-2);
  box-shadow:
    0 0 0 1px rgba(168, 85, 247, .18),
    0 6px 20px rgba(var(--shadow-ink), .28),
    0 0 18px rgba(168, 85, 247, .13);
  animation: featuredAuraWeekly 3.6s ease-in-out infinite;
}
.product-grid--weekly-featured .product-card.is-featured::after {
  background:
    radial-gradient(circle at 82% 18%, rgba(168, 85, 247, .14), transparent 36%),
    linear-gradient(135deg, transparent 58%, rgba(168, 85, 247, .07) 100%);
  animation: featuredAuraWashWeekly 3.6s ease-in-out infinite;
}
.product-grid--weekly-featured .product-card.is-featured:hover {
  border-color: rgba(168, 85, 247, .36);
  box-shadow:
    0 0 0 1px rgba(168, 85, 247, .3),
    0 10px 26px rgba(var(--shadow-ink), .32),
    0 0 22px rgba(168, 85, 247, .18);
}
.product-grid--weekly-featured .product-card::before {
  background: linear-gradient(135deg, transparent 68%, rgba(168, 85, 247, .04) 100%);
}
.product-grid--weekly-featured .featured-badge {
  top: .5rem;
  right: .5rem;
  background: linear-gradient(135deg, #f59e0b 0%, #f97316 58%, #ea580c 100%);
  box-shadow: 0 2px 8px rgba(249, 115, 22, .34), 0 2px 7px rgba(var(--shadow-ink), .28);
}
.product-grid--weekly-featured .weekly-featured-card {
  position: relative;
  min-height: 180px;
  overflow: hidden;
  animation: none;
}
.product-grid--weekly-featured .weekly-featured-card--hero {
  grid-row: span 2;
  min-height: 360px;
}
.product-grid--weekly-featured .weekly-featured-card .product-image {
  position: absolute;
  inset: 0;
  z-index: 0;
  height: 100%;
  aspect-ratio: auto;
  border-radius: inherit;
  background: var(--bg-3);
}
.product-grid--weekly-featured .weekly-featured-card .product-image::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0) 34%, rgba(0, 0, 0, .62) 72%, rgba(0, 0, 0, .9) 100%),
    linear-gradient(90deg, rgba(0, 0, 0, .28) 0%, rgba(0, 0, 0, 0) 52%);
  pointer-events: none;
}
.product-grid--weekly-featured .weekly-featured-card .product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--featured-image-position, center top);
  transform-origin: center top;
}
.product-grid--weekly-featured .weekly-featured-card:hover .product-image img {
  transform: scale(1.04);
}
.product-grid--weekly-featured .weekly-featured-card .product-body {
  position: absolute;
  inset: auto 0 0;
  z-index: 3;
  padding: 4.2rem 1rem 1rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .52) 42%, rgba(0, 0, 0, .86) 100%);
}
.product-grid--weekly-featured .weekly-featured-card--hero .product-body {
  padding: 6rem 1.35rem 1.25rem;
}
.product-grid--weekly-featured .weekly-featured-card .product-name {
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .72);
}
.product-grid--weekly-featured .weekly-featured-card--hero .product-name {
  font-size: 1.2rem;
}
.product-grid--weekly-featured .weekly-featured-card .product-tags,
.product-grid--weekly-featured .weekly-featured-card .product-stock {
  display: none;
}
.product-grid--weekly-featured .weekly-featured-card .product-footer {
  justify-content: flex-start;
  gap: .45rem;
  margin-top: .4rem;
  padding-top: 0;
}
.product-grid--weekly-featured .weekly-featured-card .product-price {
  font-size: 1.05rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .55);
}
.product-grid--weekly-featured .weekly-featured-card--hero .product-price {
  font-size: 1.35rem;
}
.product-grid--weekly-featured .weekly-featured-card::before {
  display: none;
}
.product-grid--weekly-featured .weekly-featured-card.is-featured::after {
  z-index: 1;
  opacity: .48;
  animation: none;
}
.product-grid--weekly-featured .weekly-featured-card .featured-badge {
  z-index: 4;
}
@keyframes featuredAuraWeekly {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(168, 85, 247, .16),
      0 6px 18px rgba(var(--shadow-ink), .28),
      0 0 12px rgba(168, 85, 247, .1);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(168, 85, 247, .34),
      0 8px 24px rgba(var(--shadow-ink), .32),
      0 0 30px rgba(168, 85, 247, .22);
  }
}
@keyframes featuredAuraWashWeekly {
  0%, 100% { opacity: .14; }
  50% { opacity: .3; }
}
.hero-cta-buttons .hero-product-cta {
  position: relative;
  isolation: isolate;
  overflow: visible;
  min-height: 48px;
  min-width: 200px;
  padding: .78rem 1.42rem;
  gap: .62rem;
  border: 0;
  border-radius: 21px;
  background: linear-gradient(135deg, #8749ff 0%, #a044f5 48%, #ce37ee 100%);
  color: #fff;
  font-size: 1.04rem;
  font-weight: 600;
  letter-spacing: 0;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .14) inset,
    0 8px 18px rgba(128, 73, 255, .2),
    0 0 12px rgba(206, 55, 238, .18);
  animation: hero-product-cta-glow 2.4s ease-in-out infinite;
}
.hero-cta-buttons .hero-product-cta .lucide {
  width: 20px;
  height: 20px;
  stroke-width: 2.5;
  color: currentColor;
}
.hero-cta-buttons .hero-product-cta::before {
  content: "";
  position: absolute;
  inset: -6px;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(135, 73, 255, .28), rgba(206, 55, 238, .3));
  filter: blur(7px);
  opacity: .24;
  pointer-events: none;
}
.hero-cta-buttons .hero-product-cta:hover {
  background: linear-gradient(135deg, #9357ff 0%, #ad51f7 48%, #d947f2 100%);
  color: #fff;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .18) inset,
    0 10px 22px rgba(128, 73, 255, .25),
    0 0 16px rgba(206, 55, 238, .24);
}
@keyframes hero-product-cta-glow {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, .14) inset,
      0 8px 18px rgba(128, 73, 255, .18),
      0 0 12px rgba(206, 55, 238, .16);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, .18) inset,
      0 10px 22px rgba(128, 73, 255, .24),
      0 0 16px rgba(206, 55, 238, .22);
  }
}
.admin-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .55rem;
  flex-wrap: wrap;
}
.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .75rem;
  margin: 0 0 1rem;
}
.admin-kpi-grid--products {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.admin-header-actions button[onclick*="admin-product-create"] {
  display: none;
}
.admin-kpi-card {
  min-width: 0;
  padding: .9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.04), rgba(255,255,255,0)),
    var(--bg-2);
}
.admin-kpi-label {
  display: block;
  margin-bottom: .35rem;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
}
.admin-kpi-card strong {
  display: block;
  font-size: 1.45rem;
  line-height: 1.1;
}
.admin-tool-panel {
  display: block;
  width: 100%;
  margin: 0 0 1rem;
  clear: both;
}
.admin-product-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}
.admin-product-action-grid .panel {
  margin-bottom: 0;
}
.admin-tool-actions {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: .6rem;
  margin: .6rem 0;
}
.admin-tool-actions .inline-form {
  flex: 1 1 auto;
  flex-wrap: nowrap;
  align-items: center;
  min-width: 0;
  margin: 0;
}
.admin-tool-actions .admin-file-picker--compact {
  flex: 0 1 420px;
}
.admin-tool-actions .inline-form > .btn {
  flex: 0 0 auto;
}
.admin-create-product-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.admin-create-product-card h3 {
  margin-bottom: .25rem;
}
.admin-list-panel {
  overflow-x: auto;
}
.admin-list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .85rem;
}
.admin-list-head h3 { margin-bottom: .25rem; }
.admin-products-table td,
.admin-stock-table td {
  vertical-align: middle;
}
.admin-products-table,
.admin-stock-table {
  min-width: 860px;
}
.admin-products-table th:nth-child(1),
.admin-products-table td:nth-child(1) {
  width: 64px;
}
.admin-products-table th:nth-child(2),
.admin-products-table td:nth-child(2) {
  width: 72px;
  min-width: 72px;
  max-width: 72px;
}
.admin-products-table th:nth-child(3),
.admin-products-table td:nth-child(3) {
  min-width: 220px;
}
.admin-products-table th:nth-child(4),
.admin-products-table td:nth-child(4) {
  min-width: 150px;
}
.admin-products-table th:nth-child(5),
.admin-products-table td:nth-child(5),
.admin-products-table th:nth-child(6),
.admin-products-table td:nth-child(6) {
  width: 140px;
  min-width: 140px;
}
.admin-products-table td.row-actions,
.admin-stock-table td.row-actions {
  display: table-cell;
  width: 260px;
  min-width: 260px;
  white-space: nowrap;
}
.admin-products-table td.row-actions > form,
.admin-products-table td.row-actions > a,
.admin-products-table td.row-actions > button,
.admin-stock-table td.row-actions > form,
.admin-stock-table td.row-actions > a,
.admin-stock-table td.row-actions > button {
  display: inline-flex;
  vertical-align: middle;
  margin: .12rem .18rem .12rem 0;
}
.admin-products-table td.row-actions > dialog:not([open]),
.admin-stock-table td.row-actions > dialog:not([open]) {
  display: none;
}
.admin-products-table td.row-actions .btn,
.admin-stock-table td.row-actions .btn {
  white-space: nowrap;
}
/* KB + referral rewards: ปุ่มจัดการเป็นเมนูสามจุด — คืน td เป็น table-cell ให้เส้นแบ่งแถวไม่เหลื่อม */
.admin-kb-table td.row-actions,
.admin-referral-rewards-table td.row-actions {
  display: table-cell;
  vertical-align: middle;
  white-space: nowrap;
}
.admin-product-slug { margin-top: .25rem; }
.admin-product-slug code {
  color: var(--muted);
  font-size: .75rem;
  background: transparent;
  padding: 0;
}
.admin-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .25rem .55rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}
.admin-status-pill--on {
  color: #bbf7d0;
  background: rgba(34, 197, 94, .14);
  border: 1px solid rgba(34, 197, 94, .28);
}
.admin-status-pill--off {
  color: #fecaca;
  background: rgba(239, 68, 68, .12);
  border: 1px solid rgba(239, 68, 68, .26);
}

/* Toggle เปิด/ปิดขายสินค้า (หน้า /admin/products) */
.admin-switch-form { display: inline-flex; }
.admin-switch {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .2rem .5rem .2rem .25rem;
  border-radius: 999px;
  border: 1px solid rgba(239, 68, 68, .26);
  background: rgba(239, 68, 68, .12);
  color: #fecaca;
  font-size: .78rem;
  font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.admin-switch__track {
  position: relative;
  width: 30px;
  height: 17px;
  border-radius: 999px;
  background: rgba(239, 68, 68, .3);
  flex: 0 0 auto;
  transition: background var(--dur-fast) var(--ease-out);
}
.admin-switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fee2e2;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.admin-switch.is-on {
  border-color: rgba(34, 197, 94, .28);
  background: rgba(34, 197, 94, .14);
  color: #bbf7d0;
}
.admin-switch.is-on .admin-switch__track { background: rgba(34, 197, 94, .38); }
.admin-switch.is-on .admin-switch__thumb {
  transform: translateX(13px);
  background: #dcfce7;
}
.admin-switch:hover { filter: brightness(1.15); }
.admin-switch:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.admin-switch:disabled { opacity: .6; cursor: progress; }
.admin-category-panel { margin: 1rem 0; }
.admin-main-categories-table {
  min-width: 840px;
  table-layout: fixed;
}
.admin-main-categories-table th:first-child,
.admin-main-categories-table td:first-child {
  width: 64px;
}
.admin-main-categories-table th:nth-child(2),
.admin-main-categories-table td:nth-child(2) {
  width: 30%;
}
.admin-main-categories-table th:nth-child(5),
.admin-main-categories-table td:nth-child(5) {
  width: 76px;
}
.admin-main-categories-table th:last-child,
.admin-main-categories-table td:last-child {
  width: 128px;
}
.admin-main-categories-table td {
  vertical-align: top;
}
.admin-main-categories-table td.row-actions {
  display: table-cell;
  white-space: nowrap;
}
.admin-main-categories-table td.row-actions > form,
.admin-main-categories-table td.row-actions > button {
  flex: 0 0 auto;
  display: inline-flex;
  vertical-align: middle;
  margin: .12rem .18rem .12rem 0;
}
.admin-category-panel .tag-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .75rem;
}
.admin-category-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: .75rem;
  padding: .8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-3);
}
.admin-category-card__main {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  min-width: 0;
}
.admin-category-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 8px;
  background: rgba(255,255,255,.05);
  flex: 0 0 auto;
}
.admin-category-card__meta {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
  min-width: 0;
}
.admin-category-card__actions {
  display: flex;
  align-items: center;
  gap: .2rem;
}
.admin-category-card__actions button {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: .15rem .3rem;
}
.admin-category-card__actions button:hover { color: var(--primary); }
.admin-category-card__actions .tag-del:hover { color: var(--danger); }

/* จัดลำดับสินค้า (drag reorder) */
.reorder-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-width: 720px;
}
.reorder-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-3);
}
.reorder-item--dragging {
  border-color: var(--primary);
  box-shadow: 0 10px 24px -12px rgba(0,0,0,.55);
  opacity: .97;
}
.reorder-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .3rem;
  background: none;
  border: 0;
  color: var(--muted);
  cursor: grab;
  touch-action: none;
  flex: 0 0 auto;
}
.reorder-handle:active { cursor: grabbing; }
.reorder-handle:hover { color: var(--text); }
.reorder-rank {
  width: 1.7rem;
  text-align: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
.reorder-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  flex: 0 0 auto;
  background: rgba(255,255,255,.04);
}
.reorder-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.reorder-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.reorder-active,
body.reorder-active .reorder-item { user-select: none; }

/* ===== /admin/home-rows — จัดแถวสินค้าแนะนำหน้าแรก (2 แถว ตั้งค่าแยกกัน) ===== */
.home-rows-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1rem;
  align-items: start;
}
.home-row-card {
  display: flex;
  flex-direction: column;
  gap: .1rem;
}
.home-row-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .85rem;
}
.home-row-card__no {
  margin: 0;
  font-size: 1.05rem;
}
.home-row-list {
  max-width: none;
  max-height: 420px;
  overflow-y: auto;
  padding-right: .25rem;
}
.home-row-list:empty { display: none; }
.home-row-item .reorder-body { flex: 1 1 auto; }
.home-row-item .reorder-cat { display: block; }
.home-row-empty {
  margin: 0;
  padding: .7rem .75rem;
  border: 1px dashed rgba(148, 163, 184, .24);
  border-radius: 8px;
  background: rgba(255, 255, 255, .018);
}
.home-row-add__controls {
  display: flex;
  gap: .5rem;
  align-items: center;
}
.home-row-add__controls select {
  flex: 1 1 auto;
  min-width: 0;
}
.home-row-add__controls .btn { flex: 0 0 auto; }
.home-row-card__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: .4rem;
}
.admin-stock-quickfilters {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .85rem;
}
.admin-stock-page .admin-header {
  align-items: flex-start;
  margin-bottom: 1rem;
}
.admin-stock-page .admin-header h1,
.admin-stock-page .admin-stock-add-panel h3,
.admin-stock-page .admin-list-panel > h3 {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.admin-stock-page .admin-header p {
  margin: .3rem 0 0;
}
.admin-stock-page .admin-stock-tools-primary .admin-disclosure__title .lucide,
.admin-rates-tools-primary .admin-disclosure__title .lucide {
  color: #c4b5fd;
}
.admin-rates-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem;
  margin: 0 0 .85rem;
}
.admin-rates-tab {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .15rem .55rem;
  align-items: center;
  min-height: 58px;
  padding: .65rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--admin-radius-panel);
  background: var(--bg-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease, box-shadow var(--dur-base) ease;
}
.admin-rates-tab .lucide {
  grid-row: 1 / span 2;
  color: #c4b5fd;
}
.admin-rates-tab span {
  min-width: 0;
  font-weight: 600;
  line-height: 1.2;
}
.admin-rates-tab small {
  min-width: 0;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.25;
}
.admin-rates-tab:hover,
.admin-rates-tab:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  background: color-mix(in srgb, var(--bg-3) 72%, transparent);
}
.admin-rates-tab.is-active {
  border-color: color-mix(in srgb, var(--primary) 68%, var(--border));
  background: linear-gradient(135deg, rgba(168, 85, 247, .18), rgba(34, 211, 238, .06)), var(--bg-2);
  box-shadow: inset 0 0 0 1px rgba(196, 181, 253, .12);
}
.admin-rates-tab-panel[hidden] {
  display: none;
}
.admin-rates-panel-head {
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.admin-rates-panel-head > div {
  min-width: 0;
}
.admin-rates-panel-head p {
  margin: .25rem 0 0;
}
.admin-rates-table,
.admin-bundle-rates-table {
  min-width: 560px;
}
.admin-bundle-product {
  margin-bottom: .6rem;
}
.admin-bundle-product > summary {
  cursor: pointer;
  padding: .35rem 0;
  font-size: .9rem;
}
.admin-bundle-product__links {
  margin: .1rem 0 .5rem;
}
.admin-rates-table td.row-actions,
.admin-bundle-rates-table td.row-actions {
  display: table-cell;
  white-space: nowrap;
}
.admin-rates-table td.row-actions > button,
.admin-rates-table td.row-actions > form,
.admin-bundle-rates-table td.row-actions > button,
.admin-bundle-rates-table td.row-actions > form {
  display: inline-flex;
  vertical-align: middle;
  margin: .12rem .18rem .12rem 0;
}
.admin-rate-modal {
  max-width: min(92vw, 680px);
}
.admin-rate-modal h3 {
  margin-top: 0;
  padding-right: 2.25rem;
}
.admin-rate-modal .form-row-3 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.admin-rate-modal-action {
  align-self: end;
}
.admin-rate-modal-action .btn {
  width: 100%;
}
@media (max-width: 1023px) {
  .admin-rates-tabs {
    grid-template-columns: 1fr;
  }
  .admin-rates-tab {
    min-height: 52px;
  }
  .admin-rates-panel-head {
    align-items: stretch;
  }
  .admin-rates-panel-head .btn {
    width: 100%;
  }
  .admin-rate-modal .form-row-3 {
    grid-template-columns: 1fr;
  }
}
.admin-stock-page .admin-filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, .62fr);
  align-items: stretch;
  gap: .55rem;
}
.admin-stock-page .admin-filter-bar.has-reset {
  grid-template-columns: minmax(220px, 1fr) minmax(180px, .62fr) minmax(76px, .26fr);
}
.admin-stock-page .admin-filter-bar > * {
  min-width: 0;
}
.admin-stock-page .admin-filter-input,
.admin-stock-page .admin-filter-select {
  width: 100%;
  min-width: 0;
}
.admin-stock-page .admin-filter-bar .btn {
  width: 100%;
  justify-content: center;
}
.admin-inline-note {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-top: .6rem;
}
.admin-delivery-type {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.auto-msg-targets__head b {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.auto-msg-current {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.auto-msg-current__thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.auto-msg-targets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.5rem;
}
.auto-msg-targets__col {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  min-height: 300px;
}
.auto-msg-targets__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.auto-msg-targets__filter {
  margin-left: auto;
  padding: 4px 8px;
  font-size: 0.9rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  min-width: 140px;
}
.auto-msg-targets__list {
  flex: 1;
  overflow-y: auto;
  max-height: 320px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.auto-msg-targets__list .checkbox-row {
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}
.auto-msg-targets__list .checkbox-row:hover {
  background: var(--bg-2);
}
.auto-msg-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-3);
}
.auto-msg-preview {
  max-width: 420px;
  color: var(--muted);
  font-size: 0.92rem;
}
.auto-msg-binding {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.danger-row { color: #f59e0b; }
.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.req { color: #ef4444; }
@media (max-width: 1023px) {
  .auto-msg-targets { grid-template-columns: 1fr; }
}
.banner-autoplay-form {
  max-width: 420px;
}
.banner-admin-modal .form-actions {
  justify-content: flex-end;
}
.banner-admin-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.banner-admin-section-head h3 {
  margin-bottom: .25rem;
}
.banner-admin-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .45rem;
}
.banner-admin-status span {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 30px;
  padding: .28rem .58rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.2;
  white-space: nowrap;
}
.banner-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1rem;
}
.banner-admin-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-2);
  overflow: hidden;
}
.banner-admin-card.is-disabled {
  opacity: .72;
}
.banner-admin-thumb {
  position: relative;
  aspect-ratio: 16 / 7;
  background: var(--bg-3);
  overflow: hidden;
}
.banner-admin-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.banner-admin-badge {
  position: absolute;
  top: .65rem;
  right: .65rem;
  padding: .25rem .55rem;
  border-radius: 999px;
  background: rgba(0,0,0,.68);
  color: #fff;
  font-size: .78rem;
}
.banner-admin-card__form {
  padding: 1rem;
}
.banner-admin-two-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .85rem;
  align-items: end;
}
.banner-admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem;
}
.banner-admin-enabled {
  min-height: 42px;
}
.banner-admin-actions {
  margin-top: .7rem;
}
.banner-admin-delete {
  display: flex;
  justify-content: flex-end;
  padding: 0 1rem 1rem;
}
@media (max-width: 640px) {
  .banner-admin-section-head,
  .banner-admin-two-cols,
  .banner-admin-form-grid {
    grid-template-columns: 1fr;
    flex-direction: column;
  }
  .banner-admin-status {
    justify-content: flex-start;
  }
}
.admin-stock-add-panel textarea[name="bulk"] { min-height: 180px; }
.admin-stock-section {
  margin-top: .85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-3);
}
.admin-stock-section > summary.admin-disclosure__summary {
  padding: .8rem 1rem;
  font-weight: 600;
}
.admin-stock-section .data-table {
  margin: 0;
  border-top: 1px solid var(--border);
}
.admin-stock-items-table {
  min-width: 680px;
}
.admin-stock-items-table .stock-content { max-width: min(560px, 58vw); }
.admin-audit-table {
  min-width: 980px;
}
.admin-audit-detail-toggle {
  max-width: 380px;
}
.admin-audit-detail-toggle > summary.admin-disclosure__summary {
  color: var(--text);
  font-size: .82rem;
  font-weight: var(--fw-semibold);
}
.admin-audit-detail-toggle .admin-disclosure__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-audit-detail-toggle[open] > summary.admin-disclosure__summary {
  margin-bottom: .45rem;
  color: var(--primary);
}
.admin-audit-detail {
  max-width: 360px;
  max-height: 96px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  padding: .45rem .55rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, .16);
  color: var(--muted);
  font-size: .78rem;
}
.admin-confirm-modal {
  max-width: 420px;
}
.admin-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
  margin-top: 1.25rem;
}
.admin-customer-info-panel {
  border-color: var(--border);
  background: var(--bg-2);
}
.admin-customer-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem;
}
.admin-customer-info-item {
  min-width: 0;
  padding: .85rem .95rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-3);
}
.admin-customer-info-item--note { grid-column: auto; }
.admin-customer-info-label {
  display: block;
  margin-bottom: .35rem;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 600;
}
.admin-customer-info-value,
.admin-customer-info-note {
  display: block;
  min-height: 1.35rem;
  color: var(--text);
  word-break: break-word;
  white-space: pre-wrap;
}
.admin-customer-info-value {
  background: rgba(0, 0, 0, .16);
  border-radius: 6px;
}
.admin-customer-info-value.is-muted { color: var(--muted); }
.admin-secret-line {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.admin-secret-line .admin-customer-info-value {
  flex: 1 1 180px;
  min-width: 0;
}
.admin-customer-info-panel .admin-customer-info-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: .7rem;
  background: transparent;
  border-color: rgba(148, 163, 184, .16);
}
.admin-customer-info-panel .admin-customer-info-value {
  background: transparent;
  border-radius: 0;
  font-weight: 600;
}
.admin-customer-info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  color: var(--muted);
}
.admin-customer-info-body { min-width: 0; }
.admin-cred-label {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.admin-cred-actions {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
}
.admin-cred-iconbtn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  line-height: 0;
  transition: color .15s ease;
}
.admin-cred-iconbtn:hover { color: var(--text); }
.admin-cred-iconbtn:disabled { opacity: .4; cursor: not-allowed; }
.admin-cred-iconbtn:disabled:hover { color: var(--muted); }
.admin-cred-iconbtn .secret-icon { display: inline-flex; }
.admin-cred-iconbtn .secret-icon--hide,
.admin-cred-iconbtn.is-revealed .secret-icon--show { display: none; }
.admin-cred-iconbtn.is-revealed .secret-icon--hide { display: inline-flex; }
.admin-cred-iconbtn .cred-icon {
  display: inline-flex;
  transition: opacity .22s ease, transform .22s ease;
}
.admin-cred-iconbtn .cred-icon--check {
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(.5);
  color: #4ade80;
}
.admin-cred-iconbtn.is-copied .cred-icon--copy {
  opacity: 0;
  transform: scale(.5);
}
.admin-cred-iconbtn.is-copied .cred-icon--check {
  opacity: 1;
  transform: scale(1);
}
.admin-order-detail-header {
  align-items: flex-start;
  gap: 1rem 1.25rem;
  margin-bottom: 1.2rem;
}
.admin-order-detail-heading {
  display: flex;
  align-items: flex-start;
  min-width: 0;
}
.admin-order-detail-heading-copy {
  display: grid;
  gap: .38rem;
  min-width: 0;
}
.admin-page-header .admin-order-detail-heading-copy p {
  margin-top: 0;
}
.admin-order-detail-heading h1 {
  row-gap: .42rem;
}
.admin-order-detail-heading h1 .status-chip {
  font-size: .78rem;
}
.admin-order-detail-actions {
  gap: .7rem;
}
.admin-order-detail-actions .admin-action-trigger .lucide-chevron-down {
  margin-left: -.2rem;
}
.admin-order-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 60fr) minmax(0, 40fr);
  grid-template-areas:
    "delivery chat"
    "order chat"
    "products chat";
  align-items: start;
  gap: .7rem;
}
.admin-order-detail-grid > .admin-customer-info-panel { grid-area: delivery; }
.admin-order-detail-grid > .admin-order-products-panel { grid-area: products; }
.admin-order-detail-grid > .admin-order-collapsible { grid-area: order; }
.admin-order-detail-grid > .admin-order-chat-panel { grid-area: chat; }
.admin-order-detail-grid .admin-disclosure__body {
  padding: .65rem .85rem .8rem;
}
.admin-customer-info-panel .admin-customer-info-grid { gap: .55rem; }
.admin-customer-info-panel .admin-customer-info-item { padding: .55rem .7rem; }
.admin-order-detail-grid > .admin-disclosure > summary.admin-disclosure__summary:hover {
  background: transparent;
}
.admin-order-products-panel .order-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: start;
  column-gap: 1rem;
}
.admin-order-products-panel .order-item-body { min-width: 0; }
.admin-order-products-panel .order-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 1rem;
  min-width: 0;
}
.admin-order-products-panel .order-item-head .name {
  display: flex;
  align-items: center;
  gap: .45rem;
  min-width: 0;
  flex-wrap: wrap;
}
.admin-order-products-panel .order-item .price {
  flex-shrink: 0;
  margin-left: auto;
  color: var(--primary);
  font-weight: var(--fw-bold);
  white-space: nowrap;
}
.admin-products-total {
  margin: .9rem 0 0;
  padding-top: .8rem;
  border-top: 1px solid rgba(148, 163, 184, .16);
  color: var(--muted);
  font-size: .9rem;
  text-align: right;
}
.admin-products-total b {
  margin-left: .25rem;
  color: var(--text);
  font-size: 1rem;
}
.admin-order-status-edit {
  margin-top: 1rem;
  padding-top: .95rem;
  border-top: 1px solid rgba(148, 163, 184, .16);
}
.admin-order-status-edit__title {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin: 0 0 .75rem;
  color: var(--text);
  font-size: .92rem;
  font-weight: 650;
}
.admin-order-status-edit .admin-inline-note {
  margin: 0 0 .75rem;
}
.admin-order-status-edit .inline-form {
  margin: 0;
}
.admin-order-products-panel .delivered-card { margin-top: .4rem; }
.admin-order-products-panel .delivered-card > summary.delivered-card__toggle {
  font-size: .78rem;
  border: 0;
  padding-bottom: .1rem;
}
.admin-order-products-panel .delivered-card .code-block {
  margin: .15rem 0 0;
  border: 0;
  font-size: .76rem;
}
.admin-order-detail-card {
  margin-bottom: 0;
}
.admin-order-detail-card > summary.admin-disclosure__summary {
  min-height: 50px;
}
.admin-order-detail-card .admin-disclosure__title {
  flex-wrap: wrap;
  row-gap: .2rem;
}
.admin-order-detail-card .admin-disclosure__title > b {
  font-weight: 500;
}
.admin-action-menu.admin-order-quick-status-menu {
  width: min(330px, calc(100vw - 16px));
  padding: .95rem;
}
.admin-action-menu.admin-order-more-menu {
  width: min(230px, calc(100vw - 16px));
}
.admin-order-quick-status-form.admin-action-menu__form {
  display: grid;
  gap: 1.1rem;
  padding: .15rem .15rem .2rem;
}
.admin-order-quick-status-field {
  display: grid;
  gap: .55rem;
  margin: 0;
}
.admin-order-quick-status-field > span {
  color: var(--muted);
  font-size: .8rem;
  font-weight: 650;
  line-height: 1.2;
}
.admin-order-quick-status-menu .admin-filter-select,
.admin-order-quick-status-menu .admin-filter-input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  line-height: 1.35;
}
.admin-order-quick-status-submit {
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin-top: .12rem;
  line-height: 1.25;
}
.admin-order-quick-status-menu .admin-action-menu__separator {
  margin: .7rem .15rem;
}
.admin-order-quick-status-menu > .admin-action-menu__item {
  min-height: 42px;
  padding: .58rem .62rem;
}
.admin-order-collapsible {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-2);
  overflow: hidden;
}
.admin-order-collapsible > summary.admin-disclosure__summary {
  padding: .85rem 1rem;
  font-weight: 600;
}
.admin-order-collapsible__hint {
  margin-left: auto;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 500;
}
.admin-order-collapsible__body { padding: .85rem 1rem 1rem; }
.admin-order-products-panel .order-item + .order-item {
  margin-top: .9rem;
}
.admin-order-chat-panel .chat-form {
  margin-bottom: 0;
}
/* รายละเอียดออเดอร์: ยุบเป็นคอลัมน์เดียวตั้งแต่จอแคบ (≤1180) เพื่อไม่ให้ซ้าย/ขวาเบียดที่ ~1024; desktop กว้างยังคง 2 คอลัมน์ */
@media (max-width: 1180px) {
  .admin-order-detail-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "delivery"
      "order"
      "products"
      "chat";
  }
}
@media (max-width: 1023px) {
  .product-grid--weekly-featured {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }
  .product-grid--weekly-featured .weekly-featured-card,
  .product-grid--weekly-featured .weekly-featured-card--hero {
    grid-row: auto;
    min-height: 260px;
  }
  .admin-kpi-grid--products {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .admin-product-action-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 720px) {
  .admin-kpi-grid--products,
  .admin-product-action-grid {
    grid-template-columns: 1fr;
  }
  .admin-create-product-card {
    align-items: stretch;
    flex-direction: column;
  }
  .admin-create-product-card .btn {
    justify-content: center;
    width: 100%;
  }
  .admin-order-detail-heading {
    width: 100%;
  }
  .admin-order-detail-actions {
    width: 100%;
  }
  .admin-order-detail-actions > .btn {
    flex: 1 1 180px;
    justify-content: center;
  }
  .admin-order-detail-grid {
    gap: .85rem;
  }
  .admin-tool-actions,
  .admin-tool-actions .inline-form {
    align-items: stretch;
    flex-direction: column;
  }
  .admin-tool-actions .btn,
  .admin-tool-actions input[type="file"] {
    width: 100%;
  }
  .admin-stock-page .admin-filter-bar,
  .admin-stock-page .admin-filter-bar.has-reset {
    display: flex;
  }
  .admin-stock-page .admin-products-search,
  .admin-stock-page .admin-filter-bar .admin-filter-select,
  .admin-stock-page .admin-filter-bar .btn {
    width: 100%;
  }
  .admin-products-table,
  .admin-stock-table,
  .admin-stock-items-table {
    min-width: 0;
  }
  .admin-products-table td.row-actions,
  .admin-stock-table td.row-actions {
    display: flex;
    min-width: 0;
    white-space: normal;
  }
  .admin-products-table td.row-actions > form,
  .admin-products-table td.row-actions > a,
  .admin-products-table td.row-actions > button,
  .admin-stock-table td.row-actions > form,
  .admin-stock-table td.row-actions > a,
  .admin-stock-table td.row-actions > button {
    margin: 0;
  }
  .admin-header-actions,
  .admin-list-head {
    align-items: stretch;
    flex-direction: column;
  }
  .admin-header-actions .btn,
  .admin-list-head .btn {
    width: 100%;
    justify-content: center;
  }
  .admin-stock-items-table .stock-content { max-width: 100%; }
  .admin-customer-info-grid { grid-template-columns: 1fr; }
  .admin-customer-info-item--note { grid-column: auto; }
}
@media (max-width: 620px) {
  .product-grid--weekly-featured {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 78%);
    grid-template-columns: none;
    overflow-x: auto;
    overflow-y: visible;
    padding: .15rem 1rem .75rem 0;
    margin-right: -1.25rem;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .product-grid--weekly-featured::-webkit-scrollbar { display: none; }
  .product-grid--weekly-featured .product-card { scroll-snap-align: start; }
  .product-grid--weekly-featured .weekly-featured-card,
  .product-grid--weekly-featured .weekly-featured-card--hero {
    grid-row: auto;
    min-height: 240px;
  }
  .product-grid--weekly-featured .weekly-featured-card--hero .product-body {
    padding: 4.2rem 1rem 1rem;
  }
  .product-grid--weekly-featured .weekly-featured-card .product-name {
    font-size: .92rem;
    line-height: 1.3;
  }
  .product-grid--weekly-featured .weekly-featured-card--hero .product-name {
    font-size: 1rem;
  }
  .product-grid--weekly-featured .weekly-featured-card--hero .product-price {
    font-size: 1.05rem;
  }
  .product-card.is-featured,
  .product-grid--weekly-featured .product-card.is-featured {
    border-color: rgba(168, 85, 247, .18);
    box-shadow:
      0 0 0 1px rgba(168, 85, 247, .12),
      0 5px 16px rgba(var(--shadow-ink), .28),
      0 0 12px rgba(168, 85, 247, .09);
    animation: featuredAuraMobile 4s ease-in-out infinite;
  }
  .product-card.is-featured::after,
  .product-grid--weekly-featured .product-card.is-featured::after {
    background:
      radial-gradient(circle at 82% 18%, rgba(168, 85, 247, .11), transparent 38%),
      linear-gradient(135deg, transparent 60%, rgba(168, 85, 247, .055) 100%);
    animation: featuredAuraWashMobile 4s ease-in-out infinite;
  }
  .product-card.is-featured:hover,
  .product-grid--weekly-featured .product-card.is-featured:hover {
    box-shadow:
      0 0 0 1px rgba(168, 85, 247, .18),
      0 7px 18px rgba(var(--shadow-ink), .3);
  }
  .product-grid--weekly-featured .product-card::before {
    background: linear-gradient(135deg, transparent 76%, rgba(168, 85, 247, .025) 100%);
  }
  .product-grid--weekly-featured .featured-badge {
    box-shadow: 0 2px 7px rgba(249, 115, 22, .28), 0 2px 5px rgba(var(--shadow-ink), .24);
  }
  .product-grid--weekly-featured .weekly-featured-card,
  .product-grid--weekly-featured .weekly-featured-card.is-featured::after {
    animation: none;
  }
  .section-title-emoji,
  .section-title-icon {
    box-shadow: 0 0 10px rgba(249, 115, 22, .1);
  }
  .section-title-row {
    align-items: center;
    flex-direction: row;
    gap: .55rem;
    margin: 1.4rem 0 .85rem;
  }
  .section-title-row .section-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 1.05rem;
  }
  .section-title-row .section-title-action {
    flex-shrink: 0;
    padding: .42rem .65rem;
    font-size: .78rem;
    border-radius: 10px;
    gap: .25rem;
  }
}
@keyframes featuredAuraMobile {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(168, 85, 247, .12),
      0 5px 15px rgba(var(--shadow-ink), .27),
      0 0 9px rgba(168, 85, 247, .07);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(168, 85, 247, .24),
      0 6px 19px rgba(var(--shadow-ink), .3),
      0 0 20px rgba(168, 85, 247, .15);
  }
}
@keyframes featuredAuraWashMobile {
  0%, 100% { opacity: .1; }
  50% { opacity: .22; }
}
@media (prefers-reduced-motion: reduce) {
  .product-card.is-featured,
  .product-grid--weekly-featured .product-card.is-featured,
  .product-card.is-featured::after,
  .product-grid--weekly-featured .product-card.is-featured::after,
  .hero-cta-buttons .hero-product-cta {
    animation: none;
  }
}

/* ============ Checkout payment popup ============ */
.checkout-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(8, 8, 16, .72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.checkout-popup-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.checkout-popup {
  position: relative;
  width: min(420px, 100%);
  padding: 2.25rem 1.75rem 1.75rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  text-align: center;
  box-shadow: 0 24px 60px rgba(var(--shadow-ink), .45);
  transform: translateY(16px) scale(.96);
  opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
}
.checkout-popup-overlay.is-open .checkout-popup {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.checkout-popup__title {
  margin: .9rem 0 .5rem;
  font-size: 1.25rem;
  font-weight: 600;
}
.checkout-popup__desc {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.55;
}
.checkout-popup__actions {
  display: flex;
  justify-content: center;
  gap: .6rem;
  flex-wrap: wrap;
}
.checkout-popup__actions .btn { min-width: 140px; }

/* Top-right corner controls */
.checkout-popup__close {
  position: absolute;
  top: .65rem;
  right: .65rem;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.checkout-popup__close:hover {
  background: rgba(168, 85, 247, .18);
  color: var(--primary);
}
.checkout-popup__countdown {
  position: absolute;
  top: .8rem;
  right: .8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: rgba(34, 197, 94, .14);
  color: #4ade80;
  font-weight: 600;
  font-size: .95rem;
  border: 1px solid rgba(34, 197, 94, .35);
  font-variant-numeric: tabular-nums;
}

/* Success — GIF */
.checkout-popup__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  border-radius: 999px;
  margin: 0 auto;
}
.checkout-popup__success-gif {
  display: block;
  width: 140px;
  height: 140px;
  margin: 0 auto .25rem;
  object-fit: contain;
}

/* Insufficient — warning icon */
.checkout-popup__icon--warn {
  background: rgba(168, 85, 247, .12);
  border: 1px solid rgba(168, 85, 247, .35);
  color: var(--primary);
}
.checkout-popup__icon--warn svg { width: 44px; height: 44px; }

@media (prefers-reduced-motion: reduce) {
  .checkout-popup,
  .checkout-popup-overlay { transition: none; }
}

/* ============ Static / Trust Pages (FAQ · Terms · Privacy · Refund · Contact) ============ */
.static-page {
  max-width: 880px;
  margin: 0 auto;
  padding-top: 1.5rem;
  padding-bottom: 4rem;
}
.static-page__head {
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.static-page__crumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: .65rem;
}
.static-page__crumb a {
  color: var(--muted);
  text-decoration: none;
  transition: color .15s;
}
.static-page__crumb a:hover { color: var(--primary); }
.static-page__title {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: 0 0 .65rem;
  font-size: 1.85rem;
  line-height: 1.2;
}
.static-page__title .lucide {
  color: var(--primary);
  flex-shrink: 0;
}
.static-page__subtitle {
  margin: 0 0 .5rem;
  color: var(--muted);
  font-size: .98rem;
  line-height: 1.65;
  max-width: 70ch;
}
.static-page__meta {
  margin: 0;
  font-size: .82rem;
  color: var(--muted);
  opacity: .8;
}

/* Table of contents */
.static-page__toc {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem 1.1rem;
  margin-bottom: 1.75rem;
}
.static-page__toc strong {
  display: block;
  margin-bottom: .55rem;
  font-size: .92rem;
  color: var(--text);
}
.static-page__toc ol {
  margin: 0;
  padding-left: 1.4rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .25rem .75rem;
}
.static-page__toc li { font-size: .88rem; }
.static-page__toc a {
  color: var(--muted);
  text-decoration: none;
  transition: color .15s;
}
.static-page__toc a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Section blocks (FAQ-style or article-style) */
.static-page__section {
  margin-bottom: 2rem;
}
.static-page__h2 {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: 0 0 1rem;
  font-size: 1.15rem;
  color: var(--text);
}
.static-page__h2 .lucide { color: var(--primary); flex-shrink: 0; }

/* Long-form article (terms / privacy / refund) */
.static-page__article {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
}
.static-page__sec {
  padding: 1rem 0 1.1rem;
  border-bottom: 1px solid var(--border);
}
.static-page__sec:first-child { padding-top: 0; }
.static-page__sec:last-child { border-bottom: 0; padding-bottom: 0; }
.static-page__sec h2 {
  margin: 0 0 .65rem;
  font-size: 1.05rem;
  color: var(--text);
  scroll-margin-top: 5.5rem;
}
.static-page__sec h2:target { color: var(--primary); }
.static-page__sec p,
.static-page__sec li {
  margin: 0 0 .45rem;
  font-size: .92rem;
  line-height: 1.7;
  color: var(--muted);
}
.static-page__sec ul,
.static-page__sec ol {
  margin: .3rem 0 .65rem;
  padding-left: 1.4rem;
}
.static-page__sec strong { color: var(--text); }
.static-page__sec a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.static-page__sec a:hover { color: var(--accent); }
.static-page__sec code {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  padding: .1rem .35rem;
  border-radius: 4px;
  font-size: .85em;
}

/* Highlight call-out (used in refund) */
.static-page__highlight {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  background: linear-gradient(135deg, rgba(168,85,247,.08), rgba(167,139,250,.08));
  border: 1px solid rgba(168,85,247,.28);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-bottom: 1.5rem;
  font-size: .92rem;
  line-height: 1.65;
}
.static-page__highlight-icon {
  color: var(--primary);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(168,85,247,.15);
}

/* Bottom CTA block */
.static-page__cta {
  margin-top: 2.25rem;
  padding: 1.5rem 1.5rem 1.75rem;
  text-align: center;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.static-page__cta p {
  margin: 0 0 .85rem;
  font-size: .98rem;
  color: var(--text);
}
.static-page__cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  justify-content: center;
}

/* Contact page — channel cards */
.static-page__contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: .9rem;
  margin-bottom: 2.25rem;
}
.contact-card {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: 1rem 1.1rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
a.contact-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(var(--shadow-ink),.18);
}
.contact-card__icon {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(168,85,247,.12);
  color: var(--primary);
}
.contact-card--discord .contact-card__icon {
  background: rgba(88,101,242,.15);
  color: var(--discord);
}
.contact-card--facebook .contact-card__icon {
  background: rgba(24,119,242,.15);
  color: #1877f2;
}
.contact-card__body { flex: 1; min-width: 0; }
.contact-card__label {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: .2rem;
}
.contact-card__value {
  font-size: .98rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}
.contact-card__hint {
  margin-top: .2rem;
  font-size: .82rem;
  color: var(--muted);
}
.contact-card__arrow {
  color: var(--muted);
  flex-shrink: 0;
  opacity: .6;
  transition: opacity .15s, transform .15s;
}
a.contact-card:hover .contact-card__arrow {
  opacity: 1;
  transform: translateX(2px);
  color: var(--primary);
}

@media (max-width: 720px) {
  .static-page__title { font-size: 1.5rem; }
  .static-page__article { padding: 1.15rem 1.1rem; }
  .static-page__toc ol { grid-template-columns: 1fr; }
}

/* ===== Admin mobile compact pass ===== */
@media (max-width: 1023px) {
  body.admin-body {
    --admin-font-body: 14px;
    --admin-font-secondary: 12px;
    --admin-font-page-title: 18px;
    --admin-font-panel-title: 15px;
    --admin-control-height: 42px;
    --admin-control-height-compact: 40px;
    --admin-panel-padding: .85rem;
    font-size: .9rem;
    line-height: 1.45;
    overflow-x: hidden;
  }

  .admin-main {
    padding: .75rem;
    padding-top: 3.65rem;
    /* เว้นช่องล่างให้พ้น bottom nav (56px + safe area) */
    padding-bottom: calc(56px + env(safe-area-inset-bottom) + .6rem);
    overflow-x: hidden;
  }

  .admin-topbar {
    height: 52px;
    gap: .5rem;
    padding: 0 3.4rem 0 .55rem;
  }

  .admin-topbar__menu,
  .admin-topbar__home {
    width: 42px;
    height: 42px;
    border-radius: 8px;
  }

  .admin-topbar__title {
    font-size: .96rem;
    line-height: 1.25;
  }

  .admin-notif {
    top: .38rem;
    right: .45rem;
  }

  .admin-notif__btn {
    width: 42px;
    height: 42px;
  }

  .admin-notif__panel {
    top: 46px;
    max-height: calc(100vh - 4rem);
  }

  .admin-notif__head,
  .admin-notif__item,
  .admin-notif__foot {
    padding-left: .75rem;
    padding-right: .75rem;
  }

  .admin-notif__item-title { font-size: .86rem; }
  .admin-notif__item-text { font-size: .76rem; }
  .admin-notif__item-time { font-size: .68rem; }

  .admin-drawer__panel {
    width: min(276px, 84vw);
  }

  .admin-drawer__head {
    min-height: 52px;
    padding: .75rem .9rem;
  }

  .admin-drawer__head .brand {
    font-size: .98rem;
  }

  .admin-drawer__close {
    width: 40px;
    height: 40px;
    border-radius: var(--admin-radius-control);
  }

  .admin-drawer__nav {
    padding: .55rem;
  }

  .admin-drawer__nav .admin-nav-group + .admin-nav-group {
    margin-top: .6rem;
  }

  .admin-drawer__nav .admin-nav-group__label {
    padding: .15rem .7rem .28rem;
    font-size: .64rem;
  }

  .admin-drawer__nav a,
  .admin-drawer__nav .admin-drawer__theme {
    min-height: 40px;
    gap: .6rem;
    padding: .62rem .75rem;
    border-radius: 7px;
    font-size: .88rem;
    line-height: 1.25;
  }

  .admin-drawer__foot {
    padding: .75rem .9rem;
  }

  .admin-drawer__foot > a,
  .admin-drawer__foot .btn {
    min-height: 40px;
  }

  .admin-body .admin-header {
    gap: .45rem;
    margin-bottom: .7rem;
  }

  .admin-body .admin-header h1 {
    font-size: 1.05rem;
    line-height: 1.25;
  }

  .admin-body .admin-header h1 + *,
  .admin-body .admin-header p,
  .admin-body .muted.small,
  .admin-body .admin-list-head .small {
    font-size: .76rem;
    line-height: 1.4;
  }

  .admin-body .admin-header-actions,
  .admin-body .admin-list-head {
    gap: .45rem;
  }

  /* ปุ่มใน header — เรียงแถวเดียว (แยกบรรทัดจากหัวข้อ); ปุ่มรองเหลือไอคอน */
  .admin-body .admin-header .admin-header-actions {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: .4rem;
    padding-right: 0;
  }
  .admin-body .admin-header .admin-header-actions .btn {
    width: auto;
    flex: 0 0 auto;
  }
  .admin-body .admin-header .admin-header-actions .btn-primary {
    flex: 1 1 auto;
    justify-content: center;
  }
  /* ปุ่มรอง (ghost) ที่มีไอคอน → เหลือไอคอนอย่างเดียว ประหยัดพื้นที่บนแถวเดียว */
  .admin-body .admin-header .admin-header-actions .btn-ghost:has(.lucide) {
    gap: 0;
    width: var(--admin-control-height);
    min-width: var(--admin-control-height);
    padding-left: 0;
    padding-right: 0;
    font-size: 0;
    justify-content: center;
  }

  .admin-body .panel {
    margin-bottom: .85rem;
    padding: var(--admin-panel-padding);
    border-radius: var(--admin-radius-panel);
  }

  .admin-body .panel h3,
  .admin-body .panel-title-row h3 {
    font-size: .96rem;
    line-height: 1.3;
  }

  .admin-body .panel.collapsible summary {
    padding: .15rem 0;
    font-size: .92rem;
  }

  .admin-body .panel.collapsible[open] summary {
    margin-bottom: .65rem;
    padding-bottom: .65rem;
  }
  .admin-main > .admin-header .admin-header-actions {
    padding-right: 0;
  }

  .admin-body .panel.collapsible.admin-disclosure--panel {
    padding: 0;
  }

  .admin-body .panel.collapsible.admin-disclosure--panel > summary.admin-disclosure__summary {
    margin-bottom: 0;
    padding: .65rem .8rem;
  }

  .admin-body .panel.collapsible.admin-disclosure--panel[open] > summary.admin-disclosure__summary {
    margin-bottom: 0;
    padding-bottom: .65rem;
  }

  .admin-body .admin-disclosure__body {
    padding: .75rem .8rem .85rem;
  }

  .admin-body .panel-title-row {
    gap: .15rem;
    margin-bottom: .55rem;
  }

  .admin-body .admin-kpi-grid,
  .admin-body .admin-kpi-grid--products,
  .admin-body .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .45rem;
    margin-bottom: .7rem;
  }

  .admin-body .admin-kpi-card,
  .admin-body .stat-card {
    padding: .62rem .7rem;
    border-radius: 8px;
  }

  .admin-body .admin-kpi-label,
  .admin-body .stat-label {
    margin-bottom: .18rem;
    font-size: .68rem;
    line-height: 1.25;
  }

  .admin-body .admin-kpi-card strong,
  .admin-body .stat-value {
    margin: .05rem 0;
    font-size: 1rem;
    line-height: 1.15;
  }

  .admin-body .stat-sub {
    font-size: .72rem;
  }

  .admin-body .admin-filter-bar {
    gap: .42rem;
    margin-bottom: .7rem;
  }

  .admin-body .admin-filter-input,
  .admin-body .admin-filter-select {
    min-height: var(--admin-control-height);
    padding: .48rem .62rem;
    border-radius: var(--admin-radius-control);
    font-size: .88rem;
  }
  /* search input มีไอคอนพื้นหลัง — คืน padding-left ที่ถูก override ด้านบนทับ ไม่งั้นตัวหนังสือซ้อนไอคอน */
  .admin-body .admin-filter-input[type="search"] {
    padding-left: 2.2rem;
  }

  .admin-body .admin-filter-bar > .btn,
  .admin-body .btn {
    min-height: var(--admin-control-height);
    padding: .5rem .72rem;
    border-radius: var(--admin-radius-control);
    font-size: .82rem;
  }

  .admin-body .btn-sm {
    min-height: var(--admin-control-height-compact);
    gap: .3rem;
    padding: .38rem .56rem;
    border-radius: var(--admin-radius-control);
    font-size: .76rem;
  }

  /* แปลงตาราง admin เป็นการ์ดเต็มรูปแบบที่ <1024 (base เดิมอยู่แค่ ≤720 → 721-1023 เคยเป็น hybrid พัง) */
  /* min-width:0 ล้างค่า min-width ที่ตารางบางตัวตั้งไว้ (เช่น rates 780px) ซึ่งบังคับสกอร์แนวนอน */
  .admin-body .data-table { display: block; width: 100%; min-width: 0; }
  .admin-body .data-table thead { display: none; }
  .admin-body .data-table tbody { display: block; }
  .admin-body .data-table tr {
    display: block;
    margin-bottom: .65rem;
    padding: .65rem;
    border-radius: 10px;
  }

  .admin-body .data-table td {
    display: block;
    padding: .35rem 0;
    font-size: .82rem;
    line-height: 1.4;
    word-break: break-word;
    text-align: left;
    min-width: 0;
  }

  .admin-body .data-table td::before {
    display: block;
    font-size: .64rem;
    line-height: 1.25;
    margin-bottom: .15rem;
    letter-spacing: .02em;
    white-space: normal;
  }

  .admin-body .data-table td:not([data-label]),
  .admin-body .data-table td[data-label=""] {
    display: flex;
    justify-content: flex-start;
  }
  .admin-body .data-table td:not([data-label])::before,
  .admin-body .data-table td[data-label=""]::before {
    display: none;
  }

  /* รูป thumbnail ในเซลล์ — บีบให้พอดี ไม่ overflow */
  .admin-body .data-table td > .thumb,
  .admin-body .data-table td > img.thumb {
    width: 48px;
    height: 48px;
  }

  /* คอลัมน์ content ด้านขวาของ grid — รองรับ rich children */
  .admin-body .data-table td > * {
    min-width: 0;
    max-width: 100%;
  }

  /* คุม code/slug ไม่ให้ล้นเซลล์ */
  .admin-body .data-table td code,
  .admin-body .data-table td .admin-product-slug code {
    word-break: break-all;
    white-space: normal;
  }

  .admin-body .data-table td.row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: .35rem;
    width: 100%;
  }

  .admin-body .data-table td.row-actions::before {
    grid-column: 1 / -1;
    width: auto;
    margin-bottom: -.1rem;
  }

  .admin-body .data-table td.row-actions > form,
  .admin-body .data-table td.row-actions > a,
  .admin-body .data-table td.row-actions > button {
    display: flex;
    width: 100%;
    margin: 0;
  }

  .admin-body .data-table td.row-actions .btn,
  .admin-body .data-table td.row-actions form > button {
    width: 100%;
    min-height: var(--admin-control-height-compact);
    padding: .35rem .45rem;
    font-size: .74rem;
  }

  .admin-body .thumb {
    width: 40px;
    height: 40px;
  }

  .admin-body .badge-mini,
  .admin-body .admin-status-pill,
  .admin-body .tag,
  .admin-body .chip {
    font-size: .66rem;
  }

  .admin-body .admin-status-pill {
    padding: .2rem .45rem;
  }

  .admin-body .admin-product-slug code,
  .admin-body .stock-content,
  .admin-body .admin-audit-detail {
    font-size: .72rem;
  }

  /* ซ่อน slug/dev info ที่ไม่จำเป็นในมุมมองมือถือ เพื่อให้ card ไม่ยาวเกิน */
  .admin-body .admin-products-table .admin-product-slug,
  .admin-body .admin-main-categories-table td[data-label="หมวดหลัก"] code {
    display: none;
  }
  /* br ที่อยู่ก่อน code (เช่นในหมวด) — กำจัด empty line */
  .admin-body .admin-main-categories-table td br:has(+ code) {
    display: none;
  }

  /* ===== Phase 2.1: การ์ด list สินค้า/สต็อก (ref ภาพ 1) — ใช้ markup การ์ดแยก, ซ่อนตาราง ===== */
  .admin-body .admin-products-table,
  .admin-body .admin-stock-table { display: none; }
  .admin-body .admin-card-list {
    display: flex;
    flex-direction: column;
    gap: .55rem;
  }
  .admin-card {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "media body aside"
      "foot  foot foot";
    column-gap: .7rem;
    padding: .7rem .75rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 12px;
  }
  .admin-card__media {
    grid-area: media;
    width: 62px; height: 62px;
    border-radius: 9px;
    object-fit: cover;
    background: var(--bg-3);
    align-self: start;
  }
  .admin-card__body { grid-area: body; min-width: 0; }
  .admin-card__title {
    display: flex; align-items: center; gap: .35rem; flex-wrap: wrap;
    font-weight: 600; font-size: .9rem; line-height: 1.25;
  }
  .admin-card__title a { color: var(--text); }
  .admin-card__slug { margin-top: .12rem; font-size: .72rem; }
  .admin-card__slug code { color: var(--muted); word-break: break-all; }
  .admin-card__meta { display: flex; flex-direction: column; gap: .18rem; margin-top: .35rem; }
  .admin-card__meta-row {
    display: flex; align-items: center; gap: .4rem;
    font-size: .8rem; color: var(--muted); min-width: 0;
  }
  .admin-card__meta-row .lucide { flex-shrink: 0; }
  .admin-card__meta-row > span {
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .admin-card__aside {
    grid-area: aside;
    display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between;
    gap: .5rem;
  }
  .admin-card__action { width: 34px; min-width: 34px; height: 34px; }
  .admin-card__stockbtn { white-space: nowrap; }
  .admin-card__foot {
    grid-area: foot;
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    margin-top: .55rem; padding-top: .5rem;
    border-top: 1px solid var(--border);
    font-size: .8rem;
  }
  .admin-card__foot-label { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); }
  .admin-card__foot-label .lucide { flex-shrink: 0; }

  /* ===== Phase 2.2: ออเดอร์ — การ์ด (checkbox │ เนื้อหา │ สถานะ+ลิงก์) ===== */
  .admin-body .admin-orders-table { display: none; }
  .admin-order-card {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "check body aside";
    column-gap: .6rem;
  }
  .admin-order-card__check {
    grid-area: check;
    align-self: start;
    display: flex;
    padding-top: .15rem;
  }
  .admin-order-card__check input { width: 18px; height: 18px; }
  .admin-order-card__body {
    grid-area: body; min-width: 0;
    display: flex; flex-direction: column; gap: .2rem;
  }
  .admin-order-card__code {
    display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
    font-weight: 600; font-size: .9rem;
  }
  .admin-order-card__code code { color: var(--text); word-break: break-all; }
  .admin-order-card__sub { font-size: .78rem; color: var(--muted); }
  .admin-order-card__amounts {
    display: flex; align-items: center; flex-wrap: wrap; gap: .35rem;
    font-size: .82rem; margin-top: .1rem;
  }
  .admin-order-card__sep { color: var(--muted); }
  .admin-order-card__aside {
    grid-area: aside;
    display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between;
    gap: .55rem;
  }
  .admin-order-card__link {
    display: inline-flex; align-items: center; gap: .15rem;
    font-size: .8rem; color: var(--primary); white-space: nowrap;
  }
  .admin-order-card__link .lucide { flex-shrink: 0; }

  /* ===== Phase 2.1: เรทราคา (Nitro) — การ์ดอ่านง่าย (label–ค่า) ===== */
  .admin-body .admin-rates-table tr,
  .admin-body .admin-bundle-rates-table tr {
    position: relative;
    padding-left: 2.7rem;    /* ที่ว่างให้ badge ลำดับมุมซ้าย */
  }
  /* ลำดับ → badge มุมซ้าย */
  .admin-body .admin-rates-table td[data-label="ลำดับ"],
  .admin-body .admin-bundle-rates-table td[data-label="ลำดับ"] {
    position: absolute; top: .7rem; left: .55rem;
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.6rem; height: 1.6rem; padding: 0;
    border-radius: 7px; background: var(--bg-3);
    font-size: .75rem; font-weight: 600;
  }
  .admin-body .admin-rates-table td[data-label="ลำดับ"]::before,
  .admin-body .admin-bundle-rates-table td[data-label="ลำดับ"]::before { display: none; }
  /* ชื่อ / จำนวนชิ้น = หัวการ์ด + เส้นคั่น */
  .admin-body .admin-rates-table td[data-label="ชื่อเรทสินค้า"],
  .admin-body .admin-bundle-rates-table td[data-label="จำนวนชิ้น"] {
    font-weight: 600; font-size: .95rem;
    padding: 0 0 .35rem;
    margin-bottom: .35rem;
    border-bottom: 1px solid var(--border);
  }
  .admin-body .admin-rates-table td[data-label="ชื่อเรทสินค้า"]::before,
  .admin-body .admin-bundle-rates-table td[data-label="จำนวนชิ้น"]::before { display: none; }
  /* แต่ละค่า = แถว "ป้ายซ้าย · ค่าขวา" อ่านง่าย */
  .admin-body .admin-rates-table td[data-label="มี Nitro"],
  .admin-body .admin-rates-table td[data-label="ไม่มี Nitro"],
  .admin-body .admin-rates-table td[data-label="ราคาที่ sync"],
  .admin-body .admin-rates-table td[data-label="ใช้กับสินค้า"],
  .admin-body .admin-bundle-rates-table td[data-label="Nitro"],
  .admin-body .admin-bundle-rates-table td[data-label="ราคา Discord"],
  .admin-body .admin-bundle-rates-table td[data-label="ราคาขายร้าน"],
  .admin-body .admin-bundle-rates-table td[data-label="สถานะ"] {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 1rem;
    padding: .22rem 0;
    font-size: .85rem; font-weight: 600;
  }
  .admin-body .admin-rates-table td[data-label="มี Nitro"]::before,
  .admin-body .admin-rates-table td[data-label="ไม่มี Nitro"]::before,
  .admin-body .admin-rates-table td[data-label="ราคาที่ sync"]::before,
  .admin-body .admin-rates-table td[data-label="ใช้กับสินค้า"]::before,
  .admin-body .admin-bundle-rates-table td[data-label="Nitro"]::before,
  .admin-body .admin-bundle-rates-table td[data-label="ราคา Discord"]::before,
  .admin-body .admin-bundle-rates-table td[data-label="ราคาขายร้าน"]::before,
  .admin-body .admin-bundle-rates-table td[data-label="สถานะ"]::before {
    display: block; margin: 0;
    font-size: .8rem; font-weight: 400; color: var(--muted);
    white-space: nowrap;
  }
  /* actions = แถวล่าง ชิดขวา มีเส้นคั่น */
  .admin-body .admin-rates-table td.row-actions,
  .admin-body .admin-bundle-rates-table td.row-actions {
    display: flex; flex-direction: row; align-items: center;
    justify-content: flex-end; gap: .4rem;
    width: 100%;
    margin-top: .5rem; padding-top: .5rem;
    border-top: 1px solid var(--border);
  }
  .admin-body .admin-rates-table td.row-actions > *,
  .admin-body .admin-bundle-rates-table td.row-actions > * { width: auto; }
  .admin-body .admin-rates-table td.row-actions::before,
  .admin-body .admin-bundle-rates-table td.row-actions::before { display: none; }
  .admin-body .admin-rates-table td.row-actions > form,
  .admin-body .admin-bundle-rates-table td.row-actions > form { width: auto; margin: 0; }
  .admin-body .admin-rates-table td.row-actions .btn,
  .admin-body .admin-bundle-rates-table td.row-actions .btn {
    width: 38px; min-width: 38px; min-height: 38px; padding: 0;
  }

  /* ===== Phase 2.1: หมวดหมู่ (หลัก/ย่อย/คอลเลกชัน) — การ์ดอ่านง่าย ===== */
  /* ชื่อรายการ = เด่น (ซ่อน label) */
  .admin-body .admin-main-categories-table td[data-label="หมวดหลัก"],
  .admin-body .admin-subcategories-table td[data-label="หมวดหมู่ย่อย"],
  .admin-body .admin-collections-table td[data-label="คอลเลคชั่น"] {
    font-weight: 600; font-size: .92rem;
  }
  .admin-body .admin-main-categories-table td[data-label="หมวดหลัก"]::before,
  .admin-body .admin-subcategories-table td[data-label="หมวดหมู่ย่อย"]::before,
  .admin-body .admin-collections-table td[data-label="คอลเลคชั่น"]::before { display: none; }
  /* desktop ตั้ง table-layout:fixed + width ต่อคอลัมน์ (64px/30%/76px/128px) ซึ่งหลุดมาตอน card mode
     ทำให้แต่ละ td แคบ → label/ค่า ซ้อน/เรียงมั่ว (เฉพาะหมวดหลักที่มี width ต่อคอลัมน์). รีเซ็ตเต็มแถว */
  .admin-body .admin-main-categories-table td:first-child,
  .admin-body .admin-main-categories-table td:nth-child(2),
  .admin-body .admin-main-categories-table td:nth-child(5),
  .admin-body .admin-main-categories-table td:last-child {
    width: auto;
  }
  /* actions = แถวล่าง แนวนอน ชิดขวา + เส้นคั่น (override .row-actions column) */
  .admin-body .admin-subcategories-table td.row-actions,
  .admin-body .admin-collections-table td.row-actions {
    display: flex; flex-direction: row; align-items: center;
    justify-content: flex-end; gap: .4rem; width: 100%;
    margin-top: .5rem; padding-top: .5rem;
    border-top: 1px solid var(--border);
  }
  .admin-body .admin-subcategories-table td.row-actions > *,
  .admin-body .admin-collections-table td.row-actions > * { width: auto; }
  /* main-categories: row-actions เป็น div ใน td จัดการ */
  .admin-body .admin-main-categories-table td[data-label="จัดการ"] {
    margin-top: .5rem; padding-top: .5rem;
    border-top: 1px solid var(--border);
  }
  .admin-body .admin-main-categories-table td[data-label="จัดการ"] > .row-actions {
    display: flex; flex-direction: row; align-items: center;
    justify-content: flex-end; gap: .4rem; width: 100%;
  }
  .admin-body .admin-main-categories-table td[data-label="จัดการ"] > .row-actions > * { width: auto; }
  /* ซ่อน label จัดการ + ปุ่มไอคอน 38px */
  .admin-body .admin-subcategories-table td.row-actions::before,
  .admin-body .admin-collections-table td.row-actions::before,
  .admin-body .admin-main-categories-table td[data-label="จัดการ"]::before { display: none; }
  .admin-body .admin-subcategories-table td.row-actions .btn,
  .admin-body .admin-collections-table td.row-actions .btn,
  .admin-body .admin-main-categories-table td[data-label="จัดการ"] .btn {
    width: 38px; min-width: 38px; min-height: 38px; padding: 0;
  }
  .admin-body .admin-subcategories-table td.row-actions > form,
  .admin-body .admin-collections-table td.row-actions > form,
  .admin-body .admin-main-categories-table td[data-label="จัดการ"] .row-actions > form { width: auto; margin: 0; }

  /* ===== Phase 2.1: สินค้าขายดี — การ์ด ===== */
  .admin-body .admin-bestsellers-panel .data-table td[data-label="สินค้า"],
  .admin-body .featured-pinned-panel .data-table td[data-label="สินค้า"] {
    font-weight: 600; font-size: .92rem;
  }
  .admin-body .admin-bestsellers-panel .data-table td[data-label="สินค้า"]::before,
  .admin-body .featured-pinned-panel .data-table td[data-label="สินค้า"]::before,
  .admin-body .admin-bestsellers-panel .data-table td[data-label="รูป"]::before,
  .admin-body .featured-pinned-panel .data-table td[data-label="รูป"]::before,
  .admin-body .admin-bestsellers-panel .data-table td[data-label="#"]::before,
  .admin-body .featured-pinned-panel .data-table td[data-label="#"]::before { display: none; }
  .admin-body .admin-bestsellers-panel .data-table td[data-label="รูป"],
  .admin-body .featured-pinned-panel .data-table td[data-label="รูป"] { padding: .1rem 0; }
  /* ปุ่มปัก/ยกเลิกสุดฮิต = เต็มกว้าง */
  .admin-body .admin-bestsellers-panel .data-table td[data-label="จัดการ"] .btn,
  .admin-body .featured-pinned-panel .data-table td[data-label="จัดการ"] .btn {
    width: 100%; justify-content: center;
  }

  .admin-body .form-row {
    gap: .25rem;
    margin-bottom: .7rem;
  }

  .admin-body .form-row label,
  .admin-body .radio-inline,
  .admin-body .checkbox-label {
    font-size: .82rem;
    line-height: 1.35;
  }

  .admin-body .form-row input,
  .admin-body .form-row textarea,
  .admin-body .form-row select,
  .admin-body .inline-form input,
  .admin-body .inline-form select {
    min-height: var(--admin-control-height);
    padding: .52rem .65rem;
    border-radius: var(--admin-radius-control);
    font-size: .88rem;
  }

  .admin-body .modal {
    width: calc(100vw - .8rem);
    max-height: calc(100vh - 1rem);
    padding: 1.5rem .9rem 1rem;
    overflow-y: auto;
  }

  .admin-body dialog.modal.modal--wide {
    width: calc(100vw - .7rem);
    max-width: calc(100vw - .7rem);
    padding: 2.1rem .85rem 1rem;
  }

  .admin-body dialog.modal.modal--wide h3 {
    font-size: .96rem;
  }

  .admin-body .modal-close {
    top: .25rem;
    right: .25rem;
    width: 40px;
    height: 40px;
  }

  .admin-bulk-bar {
    /* ลอยเหนือ .admin-bottomnav (item min-height 56px + border) ไม่ให้ทับ/ถูกบัง */
    bottom: calc(56px + env(safe-area-inset-bottom, 0px) + .6rem);
    z-index: 130; /* > .admin-bottomnav (120) */
    gap: .45rem;
    padding: .55rem .65rem;
    font-size: .8rem;
  }
}

@media (max-width: 480px) {
  .admin-body .admin-main {
    padding-right: .55rem;
    padding-left: .55rem;
  }

  .admin-body .admin-kpi-grid,
  .admin-body .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-body .data-table td {
    gap: .5rem;
    font-size: .78rem;
  }

  .admin-body .data-table td::before {
    flex-basis: 34%;
    width: 34%;
  }

  .admin-body .admin-filter-input,
  .admin-body .admin-filter-select {
    font-size: .86rem;
  }

  .admin-body .btn-sm {
    font-size: .72rem;
  }

  .admin-notif__panel {
    width: calc(100vw - .7rem);
    right: -.1rem;
  }

  .admin-login-body {
    overflow-x: hidden;
  }

  .admin-login-page {
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
    width: 100vw;
    max-width: 100vw;
    overflow: hidden;
    padding: .8rem;
  }

  .login-card-new {
    width: calc(100vw - 3rem);
    max-width: 340px;
    min-width: 0;
    margin-right: 0;
    margin-left: 0;
    overflow: hidden;
    padding: 1.6rem 1rem;
    border-radius: 18px;
  }

  .login-brand {
    margin-bottom: 1.15rem;
  }

  .login-logo {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    font-size: 1.65rem;
  }

  .login-brand h1 {
    font-size: 1.22rem;
  }

  .input-group,
  .input-group .pw-field,
  .input-group input {
    min-width: 0;
  }

  .login-form-new,
  .input-group,
  .btn-login-primary,
  .btn-login-discord {
    width: 100%;
    max-width: 100%;
  }

  .input-icon {
    flex: 0 0 auto;
    padding: 0 .65rem;
    font-size: .95rem;
  }

  .input-group .pw-field {
    flex: 1 1 0;
    width: 0;
  }

  .input-group input {
    flex: 1 1 0;
    width: 0;
    padding-top: .78rem;
    padding-bottom: .78rem;
    font-size: .86rem;
  }

  .input-group .pw-field input {
    width: 100%;
  }

  .btn-login-primary,
  .btn-login-discord {
    min-height: 42px;
    padding: .78rem .85rem;
    border-radius: 12px;
    font-size: .86rem;
  }

  .login-divider {
    margin: 1rem 0;
    font-size: .76rem;
  }

  .login-footer-new {
    margin-top: 1.15rem;
    padding-top: .85rem;
    font-size: .74rem;
  }
}

/* ============ Product image gallery (customer detail page) ============ */
.product-gallery-thumbs {
  display: flex; gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.product-gallery-thumb {
  width: 64px; height: 64px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--bg-3);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 120ms ease, transform 120ms ease;
}
.product-gallery-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.product-gallery-thumb:hover {
  transform: translateY(-2px);
  border-color: var(--border);
}
.product-gallery-thumb.is-active {
  border-color: var(--primary);
}

/* ============ Admin Product Gallery management ============ */
.admin-delivery-file-panel[hidden],
[data-file-only][hidden] {
  display: none !important;
}

.admin-upload {
  min-width: 0;
}
.admin-upload__input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.admin-upload__dropzone {
  display: grid !important;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: .75rem;
  min-height: 82px;
  margin: 0 !important;
  padding: .75rem !important;
  border: 1px dashed rgba(168, 85, 247, .38);
  border-radius: 9px;
  background:
    radial-gradient(circle at 0 0, rgba(168, 85, 247, .09), transparent 38%),
    rgba(255,255,255,.025);
  cursor: pointer;
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.admin-upload__dropzone:hover,
.admin-upload__dropzone:focus-within,
.admin-upload:focus-within .admin-upload__dropzone,
.admin-upload__dropzone.is-dragging {
  border-color: rgba(192, 132, 252, .75);
  background:
    radial-gradient(circle at 0 0, rgba(168, 85, 247, .16), transparent 44%),
    rgba(168, 85, 247, .055);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, .09);
}
.admin-upload__dropzone.has-selection {
  min-height: 66px;
  border-style: solid;
}
.admin-upload__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  color: #c084fc;
  background: rgba(168, 85, 247, .13);
  border: 1px solid rgba(168, 85, 247, .24);
  border-radius: 9px;
}
.admin-upload__copy {
  min-width: 0;
  display: grid;
  gap: .18rem;
}
.admin-upload__copy strong {
  color: var(--text);
  font-size: .86rem;
  font-weight: 600;
  line-height: 1.3;
}
.admin-upload__copy small {
  color: var(--muted);
  line-height: 1.4;
}
.admin-upload__choose {
  pointer-events: none;
  white-space: nowrap;
}
.admin-upload__selection {
  margin-top: .55rem;
}
.admin-upload__selection[hidden],
.admin-upload__gallery-head[hidden],
.admin-upload__error[hidden] {
  display: none !important;
}
.admin-upload__file {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 30px;
  align-items: center;
  gap: .65rem;
  padding: .55rem .65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-3);
}
.admin-upload__file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: #d8b4fe;
  background: rgba(168, 85, 247, .13);
  border-radius: 8px;
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: .03em;
}
.admin-upload__thumb {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 7px;
  background: var(--bg-2);
}
.admin-upload__file-copy {
  min-width: 0;
  display: grid;
  gap: .12rem;
}
.admin-upload__file-copy strong,
.admin-upload__file-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-upload__file-copy strong {
  color: var(--text);
  font-size: .82rem;
}
.admin-upload__file-copy small {
  color: var(--muted);
  font-size: .72rem;
}
.admin-upload__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(239, 68, 68, .28);
  border-radius: 7px;
  background: rgba(239, 68, 68, .08);
  color: #fca5a5;
  line-height: 1;
  cursor: pointer;
}
.admin-upload__remove:hover,
.admin-upload__remove:focus-visible {
  outline: none;
  color: #fff;
  border-color: rgba(239, 68, 68, .65);
  background: rgba(239, 68, 68, .72);
}
.admin-upload__gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-top: .55rem;
  color: var(--muted);
  font-size: .74rem;
}
.admin-upload__clear {
  padding: 0;
  border: 0;
  background: transparent;
  color: #fca5a5;
  font: inherit;
  cursor: pointer;
}
.admin-upload__gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: .55rem;
}
.admin-upload__gallery-item {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-3);
}
.admin-upload__gallery-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}
.admin-upload__gallery-item > span {
  display: block;
  padding: .38rem .45rem;
  overflow: hidden;
  color: var(--muted);
  font-size: .68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-upload__gallery-item .admin-upload__remove {
  position: absolute;
  top: 5px;
  right: 5px;
  color: #fff;
  background: rgba(17, 17, 26, .78);
  backdrop-filter: blur(4px);
}
.admin-upload__error {
  margin: .42rem 0 0;
  color: var(--danger);
  font-size: .74rem;
}
.admin-image-url-row {
  margin-top: .65rem;
}

.admin-product-live-preview {
  min-width: 0;
}
.admin-product-live-preview__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .65rem;
  margin-bottom: .5rem;
}
.admin-product-live-preview__head h4 {
  margin: 0;
  font-size: .86rem;
}
.admin-product-live-preview__head p,
.admin-product-live-preview__note {
  margin: .12rem 0 0;
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.4;
}
.admin-product-live-preview__state {
  flex: 0 0 auto;
  padding: .2rem .45rem;
  color: var(--muted);
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .66rem;
}
.admin-product-live-preview__state.is-active {
  color: #86efac;
  background: rgba(34, 197, 94, .1);
  border-color: rgba(34, 197, 94, .28);
}
/* preview การ์ดสินค้า: ใช้ CSS ของการ์ดจริงทั้งหมด (product-card--info)
   ที่นี่มีแค่ 3 อย่าง — ล็อกความกว้างเท่าคอลัมน์จริง (grid minmax 240px),
   ปิด interaction (hover/lazy-fade) เพราะเป็นภาพนิ่ง, และกันของที่ hidden ไม่ให้โผล่ */
.admin-product-live-wrap {
  width: 240px;
  max-width: 100%;
  margin: 0 auto;
}
.admin-product-live-card {
  cursor: default;
  box-shadow: 0 12px 28px rgba(var(--shadow-ink),.2);
}
.admin-product-live-card:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: 0 12px 28px rgba(var(--shadow-ink),.2);
}
.admin-product-live-card:hover .product-image img {
  transform: none;
}
/* การ์ดจริง fade-in รูปตอน lazy load (opacity 0 → 1 ด้วย .is-loaded) — preview ไม่มี observer นั้น */
.admin-product-live-card .product-image {
  animation: none;
}
.admin-product-live-card .product-image img {
  opacity: 1;
}
.admin-product-live-card__featured[hidden],
.admin-product-live-card [data-preview-compare][hidden],
.admin-product-live-card [data-preview-discount][hidden] {
  display: none !important;
}
.admin-product-live-card__featured {
  z-index: 2;
}
/* ปุ่มตะกร้าใน preview เป็นภาพประกอบ ไม่ใช่ปุ่มจริง */
.admin-product-live-wrap .product-cart-btn {
  pointer-events: none;
}
.admin-product-live-preview__note {
  text-align: center;
}

.product-gallery-mgmt {
  margin-top: 0.5rem;
}
.product-gallery-mgmt h4 {
  margin: 0 0 0.4rem;
  font-size: 0.98rem;
}
.admin-form-sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.1rem 0 0.8rem;
}
.gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.5rem;
  margin: 0.5rem 0 0.75rem;
}
.gallery-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.gallery-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.gallery-thumb form {
  position: absolute;
  top: 4px; right: 4px;
  margin: 0;
}
.gallery-thumb__del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  padding: 0;
  background: rgba(220, 38, 38, 0.85);
  color: #fff;
  border: none;
  border-radius: 50%;
  line-height: 1;
  cursor: pointer;
}
.gallery-thumb__del:hover,
.gallery-thumb__del:focus-visible {
  outline: none;
  background: rgb(220, 38, 38);
}
.product-file-upload-status {
  display: grid;
  gap: .35rem;
  margin-top: .45rem;
}
.product-file-upload-status[hidden] {
  display: none;
}
.product-file-upload-status progress {
  width: 100%;
  height: .55rem;
  accent-color: var(--primary);
}
.product-file-upload-status[data-state="error"] small { color: var(--danger); }
.product-file-upload-status[data-state="success"] small { color: var(--success); }

.gallery-upload-form {
  background: var(--bg-3);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  margin-top: 0.5rem;
}

@media (max-width: 620px) {
  .admin-upload__dropzone {
    grid-template-columns: 38px minmax(0, 1fr);
    min-height: 76px;
  }
  .admin-upload__icon {
    width: 38px;
    height: 38px;
  }
  .admin-upload__choose {
    grid-column: 1 / -1;
    width: 100%;
  }
  .admin-upload__gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-upload__remove,
  .gallery-thumb__del {
    width: 40px;
    height: 40px;
  }
  .admin-product-live-card {
    max-width: 280px;
  }
}

/* ============ Shop Assistant Popup (admin dashboard) ============ */
.shop-assistant-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1200;
  padding: 1rem;
  overflow-y: auto;
}
.shop-assistant-overlay[hidden] { display: none; }
.shop-assistant-panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(var(--shadow-ink), 0.45);
  width: 100%; max-width: 640px; max-height: 88vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.shop-assistant-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.15), rgba(168, 85, 247, 0.1));
  border-bottom: 1px solid var(--border);
}
.shop-assistant-head h3 {
  margin: 0; font-size: 1.05rem; color: var(--text);
}
.shop-assistant-head-actions {
  display: flex; gap: 0.5rem; align-items: center;
}
.shop-assistant-close {
  background: transparent; border: none; color: var(--muted);
  font-size: 1.6rem; line-height: 1; cursor: pointer;
  padding: 0 0.4rem;
}
.shop-assistant-close:hover { color: var(--text); }
.shop-assistant-body {
  padding: 1rem 1.25rem 1.25rem;
  overflow-y: auto;
  flex: 1;
}
.shop-assistant-loading {
  text-align: center; padding: 2rem 1rem;
  color: var(--muted);
}
.shop-assistant-bullets {
  list-style: none; padding: 0; margin: 0 0 1rem;
  display: flex; flex-direction: column; gap: 0.55rem;
}
.shop-assistant-bullets li {
  padding: 0.6rem 0.8rem;
  background: var(--bg-3);
  border-radius: 8px;
  border-left: 3px solid var(--primary);
  font-size: 0.95rem;
  line-height: 1.45;
}
.shop-assistant-details {
  margin-top: 0.5rem;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
}
.shop-assistant-details > summary.admin-disclosure__summary {
  padding: 0.55rem 0.8rem;
  font-weight: 500;
  font-size: 0.92rem;
}
.shop-assistant-details > summary.admin-disclosure__summary:hover {
  background: var(--bg-2);
}
.shop-assistant-details[open] > summary.admin-disclosure__summary {
  border-bottom: 1px solid var(--border);
}
.shop-assistant-rank {
  list-style: decimal inside;
  margin: 0; padding: 0.6rem 0.8rem 0.7rem 1rem;
  display: flex; flex-direction: column; gap: 0.25rem;
  font-size: 0.9rem;
  color: var(--text);
}
.shop-assistant-rank li code {
  background: var(--bg-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
}
body.shop-assistant-open { overflow: hidden; }
@media (max-width: 640px) {
  .shop-assistant-overlay { padding: 0.5rem; align-items: flex-start; }
  .shop-assistant-panel { max-height: 95vh; }
  .shop-assistant-head { padding: 0.85rem 1rem; }
  .shop-assistant-head h3 { font-size: 0.98rem; }
  .shop-assistant-body { padding: 0.85rem 1rem 1rem; }
}

/* ============ Bundle picker (Discord Decoration) ============ */
.bundle-picker .nitro-pick--v2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 540px) {
  .bundle-picker .nitro-pick--v2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.bundle-price-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: stretch;
  margin: 0.5rem 0 0.7rem;
}
.bundle-price-dropdown {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.bundle-price-select {
  position: relative;
}
.bundle-price-trigger {
  width: 100%;
  min-height: 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .7rem;
  padding: .5rem .75rem;
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(14,19,29,.96), rgba(8,12,20,.96));
  color: var(--text);
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035), 0 10px 24px rgba(var(--shadow-ink),.18);
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.bundle-price-trigger:disabled {
  cursor: not-allowed;
  opacity: .6;
}
.bundle-price-trigger:focus,
.bundle-price-select.is-open .bundle-price-trigger {
  outline: none;
  border-color: rgba(148,163,184,.34);
  background: linear-gradient(180deg, rgba(18,24,36,.98), rgba(9,14,23,.98));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.045), 0 0 0 3px rgba(148,163,184,.1), 0 10px 24px rgba(var(--shadow-ink),.2);
}
.bundle-price-trigger__chev {
  color: #c4b5fd;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.bundle-price-trigger__chev .lucide {
  transition: transform var(--dur-fast) ease;
}
.bundle-price-select.is-open .bundle-price-trigger__chev .lucide {
  transform: rotate(180deg);
}
.bundle-price-menu {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 0.45rem);
  max-height: min(460px, 62vh);
  overflow: auto;
  padding: 0.65rem;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  background: rgba(30,30,38,.98);
  color: var(--text);
  box-shadow: 0 16px 34px rgba(var(--shadow-ink),.34);
}
.bundle-price-menu__empty {
  padding: 0.85rem 0.9rem;
  color: var(--muted);
}
.bundle-price-group {
  display: grid;
  gap: 0.45rem;
}
.bundle-price-group + .bundle-price-group {
  margin-top: 0.85rem;
}
.bundle-price-group__title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  padding: 0.1rem 0.25rem 0.05rem;
}
.bundle-price-option {
  position: relative;
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  padding: .58rem .68rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: .9rem;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, background .15s;
}
.bundle-price-option:hover,
.bundle-price-option:focus {
  border-color: rgba(168,85,247,.26);
  outline: none;
  background: rgba(255,255,255,.055);
}
.bundle-price-option.is-selected {
  border-color: var(--primary);
  background: rgba(168,85,247,.12);
}
.bundle-price-option__discord,
.bundle-price-option__shop {
  display: block;
  font-weight: 600;
  line-height: 1.25;
}
.bundle-price-option__discord {
  min-width: 0;
  overflow-wrap: anywhere;
}
.bundle-price-option__shop {
  display: inline-flex;
  align-items: baseline;
  gap: 0.32rem;
  justify-self: end;
  white-space: nowrap;
}
.bundle-price-option__shop-label {
  color: var(--primary);
  font-size: 1.08em;
  font-weight: 600;
}
/* รูปประกอบตัวเลือก — บังคับสี่เหลี่ยมจัตุรัสเสมอ รูปสัดส่วนอื่นถูก crop ด้วย cover ไม่ยืด */
.bundle-price-option.has-thumb {
  grid-template-columns: auto minmax(0, 1fr) auto;
}
.bundle-price-option__thumb {
  width: 38px;
  height: 38px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .04);
}
.bundle-price-option__shop-price {
  color: var(--primary);
  font-size: 1.08em;
  font-weight: 600;
}
.btn-ai-upload {
  min-height: 40px;
  padding: .52rem .85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  line-height: 1.15;
  font-weight: 600;
  border: 0px solid transparent;
  background: linear-gradient(135deg, #a855f7, #9f7aea);
  color: #fff;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s, filter 0.15s;
  white-space: nowrap;
  box-shadow: none;
}
.btn-ai-upload:hover,
.btn-ai-upload:focus-visible {
  transform: translateY(-1px);
  outline: none;
  background: linear-gradient(135deg, #b469ff, #b48cff);
  filter: saturate(1.08);
  box-shadow: 0 8px 18px rgba(168,85,247,.18), 0 0 0 3px rgba(255,255,255,.04);
}
.btn-ai-upload:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
@media (max-width: 540px) {
  .bundle-price-row { grid-template-columns: 1fr; }
  .btn-ai-upload { width: 100%; }
  .bundle-price-option {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
  .bundle-price-option__shop {
    justify-self: start;
    white-space: normal;
  }
}

.bundle-ai-status {
  display: block;
  margin: 0.4rem 0 0.8rem;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  font-size: 0.92rem;
  line-height: 1.4;
  border: 1px solid transparent;
}
.bundle-ai-status--busy { background: rgba(167,139,250,.16); color: #ede9fe; border-color: rgba(196,181,253,.55); }
.bundle-ai-status--ok   { background: rgba(34,197,94,.16);  color: #bbf7d0; border-color: rgba(74,222,128,.55); }
.bundle-ai-status--result {
  padding: 0;
  border: 1px dashed rgba(148, 163, 184, .34);
  border-radius: 14px;
  background:
    radial-gradient(100% 140% at 8% 12%, rgba(34,197,94,.08), transparent 42%),
    linear-gradient(180deg, rgba(12, 16, 27, .9), rgba(8, 11, 20, .9));
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 14px 26px rgba(var(--shadow-ink),.18);
}
.bundle-ai-status--manual {
  border-color: rgba(196,181,253,.42);
  background:
    radial-gradient(100% 140% at 8% 12%, rgba(167,139,250,.12), transparent 44%),
    linear-gradient(180deg, rgba(12, 16, 27, .92), rgba(8, 11, 20, .9));
}
.bundle-ai-status--manual.is-ready {
  border-color: rgba(74,222,128,.55);
  background:
    radial-gradient(100% 140% at 8% 12%, rgba(34,197,94,.08), transparent 42%),
    linear-gradient(180deg, rgba(12, 16, 27, .9), rgba(8, 11, 20, .9));
}
.bundle-ai-status--manual.is-error {
  border-color: rgba(248,113,113,.58);
  background:
    radial-gradient(100% 140% at 8% 12%, rgba(248,113,113,.1), transparent 42%),
    linear-gradient(180deg, rgba(12, 16, 27, .92), rgba(8, 11, 20, .9));
}
.bundle-ai-status--warn {
  background: linear-gradient(135deg, rgba(167,139,250,.18), rgba(168,85,247,.10));
  color: #f2edff;
  border-color: rgba(196,181,253,.62);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.bundle-ai-status--error{ background: rgba(248,113,113,.16); color: #fecaca; border-color: rgba(248,113,113,.6); }
.bundle-ai-message {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-weight: 600;
}
.bundle-ai-message__icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 0.02rem;
  color: currentColor;
}
.bundle-ai-result {
  display: grid;
  gap: 0.86rem;
  padding: 0.95rem 1rem 1rem;
}
.bundle-ai-result__head {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  color: #d9d6e8;
  font-size: 1rem;
  line-height: 1.25;
}
.bundle-ai-result__head strong {
  font-weight: 600;
}
.bundle-ai-result__check {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: #22c55e;
  filter: drop-shadow(0 0 7px rgba(34,197,94,.22));
}
.bundle-ai-result__body {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  align-items: center;
  gap: 1.1rem;
}
.bundle-ai-result__media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, .2);
  background: rgba(255,255,255,.04);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 8px 18px rgba(var(--shadow-ink),.18);
}
.bundle-ai-result__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}
.bundle-ai-result__media--upload {
  display: grid;
}
.bundle-ai-result__upload {
  width: 100%;
  height: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  padding: 0.75rem;
  border: 0;
  background: linear-gradient(180deg, rgba(167,139,250,.12), rgba(15,23,42,.22));
  color: #ede9fe;
  font: inherit;
  text-align: center;
  cursor: pointer;
}
.bundle-ai-result__upload:hover,
.bundle-ai-result__upload:focus-visible {
  background: linear-gradient(180deg, rgba(167,139,250,.18), rgba(15,23,42,.28));
}
.bundle-ai-result__upload:disabled {
  cursor: wait !important;
  opacity: .72;
}
.bundle-ai-result__upload-icon {
  width: 22px;
  height: 22px;
  color: #c4b5fd;
}
.bundle-ai-result__upload-main {
  color: #f8f7ff;
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.18;
}
.bundle-ai-result__upload-sub {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.25;
}
.bundle-ai-result__detail {
  min-width: 0;
  display: grid;
  gap: 0.7rem;
}
.bundle-ai-result__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.85rem;
}
.bundle-ai-result__label {
  min-width: 0;
  color: #c9c4db;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.bundle-ai-result__value {
  justify-self: end;
  white-space: nowrap;
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.1;
}
.bundle-ai-result__value--discord {
  color: #f2eefc;
}
.bundle-ai-result__value--type {
  color: #c4b5fd;
  font-size: 0.98rem;
}
.bundle-ai-result__value--shop {
  color: #ec4899;
  font-size: 1.24rem;
  text-shadow: 0 0 14px rgba(236,72,153,.2);
}
.bundle-ai-result__note {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
}
.bundle-ai-result__note-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  opacity: .76;
}
.bundle-ai-result__note--warn {
  color: #fde68a;
}
.bundle-picker .detail-buy-row button:disabled {
  opacity: .5;
  cursor: not-allowed !important;
  transform: none;
  box-shadow: none;
}
.bundle-ai-candidates {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.65rem;
}
.bundle-ai-candidate {
  width: 100%;
  min-height: 3.2rem;
  padding: 0.9rem 1.05rem 0.9rem 1.1rem;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--bg-3);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s, transform 0.12s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.bundle-ai-candidate__label {
  min-width: 0;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.bundle-ai-candidate__nitro {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.9em;
}
.bundle-ai-candidate__price {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
  flex-shrink: 0;
}
.bundle-ai-candidate:hover {
  border-color: rgba(167,139,250,.45);
}
.bundle-ai-candidate:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.bundle-ai-candidate:active,
.bundle-ai-candidate.is-selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(168,85,247,.12), rgba(167,139,250,.08));
  box-shadow: 0 0 0 1px rgba(168,85,247,.25), 0 8px 20px rgba(var(--shadow-ink),.2);
}
@media (max-width: 540px) {
  .bundle-ai-result {
    padding: 0.82rem;
    gap: 0.72rem;
  }
  .bundle-ai-result__head {
    font-size: 0.92rem;
  }
  .bundle-ai-result__body {
    grid-template-columns: 1fr;
    gap: 0.82rem;
  }
  .bundle-ai-result__media {
    max-width: 220px;
  }
  .bundle-ai-result__row {
    gap: 0.6rem;
  }
  .bundle-ai-result__label {
    font-size: 0.88rem;
  }
  .bundle-ai-result__value {
    font-size: 0.96rem;
  }
  .bundle-ai-result__value--shop {
    font-size: 1.1rem;
  }
  .bundle-ai-result__note {
    font-size: 0.8rem;
  }
}

.bundle-summary {
  margin: 0.6rem 0 0.9rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(168,85,247,.08), rgba(167,139,250,.08));
  border: 1.5px solid rgba(168,85,247,.25);
}
.bundle-summary__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.bundle-summary__label {
  min-width: 0;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.bundle-summary__price { font-size: 1.7rem; font-weight: 600; color: var(--primary); white-space: nowrap; }
.bundle-summary__thumb {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(168,85,247,.28);
}
.bundle-summary__label { flex: 1 1 auto; }
.bundle-summary__sub { margin: 0.3rem 0 0; font-size: 0.85rem; color: var(--muted); }
.bundle-summary__nitro {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.9em;
}

/* ============ Rich text product description ============ */
.rte-source--enhanced {
  display: none !important;
}
.rte-source--enhanced.rte-source--active {
  display: block !important;
  width: 100%;
  min-height: 260px;
  padding: .9rem 1rem;
  border: 0;
  border-radius: 0;
  background: rgba(4, 6, 12, .48);
  color: var(--text);
  box-shadow: none;
  resize: vertical;
  font: .84rem/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  tab-size: 2;
}
.rte {
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  background: rgba(255,255,255,.035);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}
.rte:focus-within {
  border-color: rgba(168,85,247,.48);
  box-shadow: 0 0 0 3px rgba(168,85,247,.10);
}
.rte-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
  padding: .55rem;
  border-bottom: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.045);
  border-radius: 11px 11px 0 0;
}
.rte-toolbar__group {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding-right: .4rem;
  border-right: 1px solid rgba(255,255,255,.10);
}
.rte-toolbar__group:last-child {
  padding-right: 0;
  border-right: 0;
}
.rte-btn,
.rte-select,
.rte-color {
  min-height: 36px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 7px;
  background: rgba(255,255,255,.07);
  color: var(--text);
  font: inherit;
}
.rte-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-width: 36px;
  padding: .35rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease, color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.rte-btn:hover,
.rte-btn:focus-visible {
  border-color: rgba(168,85,247,.45);
  background: rgba(168,85,247,.12);
  outline: none;
  box-shadow: 0 0 0 2px rgba(168,85,247,.15);
}
.rte-btn[aria-pressed="true"] {
  color: #e9d5ff;
  border-color: rgba(168,85,247,.58);
  background: rgba(168,85,247,.22);
}
.rte-btn:disabled,
.rte-select:disabled,
.rte-color:disabled {
  opacity: .42;
  cursor: not-allowed;
}
.rte-btn__icon {
  display: inline-flex;
}
.rte-btn__icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.rte-btn__text {
  line-height: 1;
}
.rte-btn--italic .rte-btn__text {
  font-style: italic;
}
.rte-btn--underline .rte-btn__text {
  text-decoration: underline;
}
.rte-select {
  max-width: 145px;
  padding: .35rem .5rem;
  cursor: pointer;
}
.rte-color-control {
  position: relative;
  display: inline-flex;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 7px;
  background: rgba(255,255,255,.07);
  cursor: pointer;
}
.rte-color-control::before {
  content: "A";
  position: absolute;
  inset: 2px 2px 8px;
  display: grid;
  place-items: center;
  color: var(--text);
  font-weight: 600;
  pointer-events: none;
}
.rte-color {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}
.rte-color-control::after {
  content: "";
  position: absolute;
  right: 6px;
  bottom: 4px;
  left: 6px;
  height: 3px;
  border-radius: 999px;
  background: var(--primary);
  pointer-events: none;
}
.rte-editor {
  min-height: 210px;
  max-height: 560px;
  padding: 1rem 1.05rem;
  overflow-y: auto;
  outline: none;
  caret-color: var(--primary);
}
.rte-editor:empty::before,
.rte-editor:has(> p:only-child > br:only-child)::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}
.rte-footer {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  min-height: 34px;
  padding: .45rem .65rem;
  border-top: 1px solid rgba(255,255,255,.08);
  color: var(--muted);
  background: rgba(0,0,0,.08);
  border-radius: 0 0 11px 11px;
  font-size: .74rem;
  line-height: 1.4;
}
.rte-status[data-tone="success"] {
  color: var(--success);
}
.rte-status[data-tone="warn"] {
  color: var(--warn);
}
.rte-status[data-tone="error"] {
  color: var(--danger);
}
.rte-count {
  flex: 0 0 auto;
  white-space: nowrap;
}
.rich-content {
  line-height: 1.72;
  overflow-wrap: anywhere;
}
.rich-content p {
  margin: 0 0 0.8rem;
}
.rich-content p:first-child,
.rich-content h2:first-child,
.rich-content h3:first-child,
.rich-content h4:first-child,
.rich-content ul:first-child,
.rich-content ol:first-child {
  margin-top: 0;
}
.rich-content p:last-child,
.rich-content h2:last-child,
.rich-content h3:last-child,
.rich-content h4:last-child,
.rich-content ul:last-child,
.rich-content ol:last-child {
  margin-bottom: 0;
}
.rich-content h2,
.rich-content h3,
.rich-content h4 {
  margin: 0.7rem 0 0.35rem;
  color: var(--text);
  line-height: 1.25;
}
.rich-content h2 { font-size: 1.45rem; }
.rich-content h3 { font-size: 1.22rem; }
.rich-content h4 { font-size: 1.08rem; }
.rich-content ul,
.rich-content ol {
  margin: 0.5rem 0 0.85rem;
  padding-left: 1.35rem;
}
.rich-content li {
  margin: 0.22rem 0;
}
.rich-content a {
  color: #a9a6c8;
  font-weight: 600;
  text-decoration: none;
}
.rich-content a:hover,
.rich-content a:focus {
  color: #c084fc;
  text-decoration: none;
}
.rich-content .rte-small,
.rich-content small {
  font-size: 0.86em;
  color: var(--muted);
}
.rich-content .rte-inline-icon,
.rich-content img.rte-inline-icon {
  width: 24px;
  height: 24px;
  max-width: 24px;
  max-height: 24px;
  object-fit: contain;
  display: inline-block;
  vertical-align: -0.32em;
  margin: 0 0.15rem;
  border-radius: 5px;
}
.rte-editor .rte-node-selected {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}
.rte-dialog {
  width: min(440px, calc(100vw - 2rem));
  padding: 0;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-xl);
}
.rte-dialog::backdrop {
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(3px);
}
.rte-dialog__form {
  display: grid;
  gap: .85rem;
  padding: 1rem;
}
.rte-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.rte-dialog__head h3 {
  margin: 0;
  font-size: 1rem;
}
.rte-dialog__close {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-3);
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.rte-dialog__field {
  display: grid;
  gap: .35rem;
  font-size: .82rem;
  font-weight: 600;
}
.rte-dialog__field input {
  width: 100%;
}
.rte-dialog__error {
  margin: 0;
  color: var(--danger);
  font-size: .78rem;
}
.rte-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  padding-top: .15rem;
}
@media (max-width: 720px) {
  .rte-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
  }
  .rte-toolbar__group {
    flex: 0 0 auto;
  }
  .rte-editor {
    min-height: 190px;
    max-height: 440px;
  }
  .rte-footer {
    align-items: flex-start;
  }
}

.nitro-icon {
  width: 18px;
  height: 18px;
  margin-right: 6px;
  vertical-align: middle;
}

/* Homepage category tiles: compact logo row */
.cat-picker-panel--cards {
  margin-top: 1.35rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.cat-picker-panel--cards .cat-picker-head {
  margin-bottom: .75rem;
}
.cat-picker-panel--cards .cat-picker-title {
  color: #f5f0ff;
  font-size: .96rem;
  font-weight: 600;
  letter-spacing: 0;
  text-shadow: 0 0 16px rgba(183, 112, 255, .2);
}
.cat-picker-panel--cards .filter-popover-wrap--inline {
  display: none;
}
.cat-picker-panel--cards .cat-pill--all {
  gap: .22rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: #C4B5FD;
  font-size: .82rem;
  font-weight: 600;
  box-shadow: none;
}
.cat-picker-panel--cards .cat-pill--all:hover,
.cat-picker-panel--cards .cat-pill--all.is-active {
  border: 0;
  background: transparent;
  color: #C4B5FD;
  box-shadow: none;
  transform: none;
}
.cat-picker-panel--cards .cat-pill--all .cat-pill__icon {
  color: currentColor;
}
.cat-picker-panel--cards .cat-cards-scroller {
  gap: 0;
  padding-top: 0;
}
.cat-picker-panel--cards .cat-cards-nav {
  display: none !important;
}
.cat-picker-panel--cards .cat-cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: .85rem;
  padding: .1rem .05rem .35rem;
  margin: 0;
  overflow: visible;
}
.cat-picker-panel--cards .cat-card {
  width: auto;
  min-height: 5.35rem;
  border-radius: 10px;
  background:
    radial-gradient(120% 95% at 86% 0%, rgba(132, 73, 255, .16), transparent 58%),
    linear-gradient(180deg, #17162b 0%, #111126 100%);
  border: 1px solid rgba(154, 102, 255, .2);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.04),
    0 9px 18px rgba(var(--shadow-ink),.18),
    0 0 16px rgba(143, 75, 255, .12);
}
.cat-picker-panel--cards .cat-card::before {
  height: 2px;
  opacity: .72;
  background: linear-gradient(90deg, transparent, rgba(168, 85, 247, .7), transparent);
}
.cat-picker-panel--cards .cat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset -1px 0 0 rgba(168, 85, 247, .24);
  opacity: .55;
  pointer-events: none;
}
.cat-picker-panel--cards .cat-card:hover,
.cat-picker-panel--cards .cat-card.is-active {
  border-color: rgba(186, 128, 255, .46);
  background:
    radial-gradient(120% 95% at 86% 0%, rgba(157, 91, 255, .22), transparent 58%),
    linear-gradient(180deg, #1b1831 0%, #131229 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.05),
    0 10px 20px rgba(var(--shadow-ink),.22),
    0 0 22px rgba(168, 85, 247, .24);
}
/* ไอคอนลอยเปล่า (ไม่มีกรอบ/glow) มาจากชั้น base 52px — ที่นี่คุมเฉพาะสีชื่อ + clamp 2 บรรทัด */
.cat-picker-panel--cards .cat-card__name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: #f7f3ff;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 720px) {
  .cat-picker-panel--cards {
    margin-top: 1rem;
    padding: 0;
  }
  .cat-picker-panel--cards .cat-picker-title {
    min-height: 0;
    font-size: .9rem;
  }
  .cat-picker-panel--cards .cat-cards-row {
    grid-template-columns: repeat(2, 1fr);
    gap: .62rem;
    padding-bottom: .45rem;
  }
  .cat-picker-panel--cards .cat-card {
    min-height: 4rem;
    padding: .62rem .7rem;
    gap: .6rem;
  }
  .cat-picker-panel--cards .cat-card__icon {
    width: 42px;
    height: 42px;
    font-size: 1.6rem;
  }
  .cat-picker-panel--cards .cat-card__name {
    font-size: .78rem;
  }
  .cat-picker-panel--cards .cat-card__desc {
    display: none;
  }
}

/* ============ Light theme surface polish ============ */
html[data-theme="light"] body {
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(139, 69, 214, .09), transparent 58%),
    radial-gradient(720px 360px at 92% 4%, rgba(56, 189, 248, .07), transparent 55%),
    var(--bg);
}

html[data-theme="light"] .site-header {
  background: rgba(255, 255, 255, .86);
  border-bottom-color: rgba(203, 191, 224, .78);
  box-shadow: 0 8px 24px rgba(var(--shadow-ink), .08);
}

html[data-theme="light"] .brand-logo {
  filter: drop-shadow(0 7px 14px rgba(139, 69, 214, .18));
}

html[data-theme="light"] .main-nav > a:hover,
html[data-theme="light"] .main-nav > a:focus-visible,
html[data-theme="light"] .nav-category-dropdown[open] > .nav-category-dropdown__summary,
html[data-theme="light"] .nav-category-dropdown__summary:hover,
html[data-theme="light"] .nav-category-dropdown__summary:focus-visible {
  color: var(--primary);
  text-shadow: none;
}

html[data-theme="light"] .nav-category-dropdown__panel {
  background: rgba(255, 255, 255, .98);
  border-color: rgba(203, 191, 224, .82);
  box-shadow: 0 18px 42px rgba(var(--shadow-ink), .16);
}

html[data-theme="light"] .nav-category-dropdown__panel::before {
  background: rgba(255, 255, 255, .98);
  border-color: rgba(203, 191, 224, .82);
}

html[data-theme="light"] .nav-category-dropdown__item-icon,
html[data-theme="light"] .mobile-category-menu__image {
  background: rgba(139, 69, 214, .08);
}

html[data-theme="light"] .nav-search-inner,
html[data-theme="light"] .nav-cart-icon,
html[data-theme="light"] .nav-theme-toggle,
html[data-theme="light"] .user-chip.avatar-only,
html[data-theme="light"] .mobile-toggle {
  background: rgba(255, 255, 255, .9);
  border-color: rgba(203, 191, 224, .82);
  box-shadow: 0 4px 12px rgba(var(--shadow-ink), .06);
}

html[data-theme="light"] .nav-search-inner:hover .nav-search-icon,
html[data-theme="light"] .nav-search-inner:focus-within .nav-search-icon {
  color: var(--primary);
  filter: none;
}

html[data-theme="light"] .nav-cart-icon .icon-svg,
html[data-theme="light"] .wallet-mini .icon-svg {
  color: var(--text);
}

html[data-theme="light"] .wallet-cluster {
  background: rgba(139, 69, 214, .09);
  border-color: rgba(139, 69, 214, .2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72);
}

html[data-theme="light"] .wallet-cluster:hover {
  background: rgba(139, 69, 214, .13);
  border-color: rgba(139, 69, 214, .34);
}

html[data-theme="light"] .wallet-amount-mini {
  color: var(--text);
}

html[data-theme="light"] .user-menu,
html[data-theme="light"] .customer-notif__panel,
html[data-theme="light"] .filter-popover {
  background: rgba(255, 255, 255, .98);
  border-color: rgba(203, 191, 224, .82);
  box-shadow: 0 18px 42px rgba(var(--shadow-ink), .16);
}

html[data-theme="light"] .filter-popover__head,
html[data-theme="light"] .filter-popover__foot,
html[data-theme="light"] .customer-notif__head {
  background: #f3effa;
}

html[data-theme="light"] .customer-notif__item.is-unread {
  background: rgba(139, 69, 214, .08);
}

html[data-theme="light"] .mobile-drawer__backdrop {
  background: rgba(32, 24, 45, .34);
}

html[data-theme="light"] .mobile-drawer__panel {
  background: #ffffff;
  box-shadow: 8px 0 30px rgba(var(--shadow-ink), .18);
}

/* แถบตะกร้ามือถือ (sticky) พื้นดำ rgba(15,15,20,.96) → ขาว (ungated: โผล่เฉพาะมือถืออยู่แล้ว) */
html[data-theme="light"] .cart-mobile-bar {
  background: rgba(255, 255, 255, .96);
  border-top-color: rgba(203, 191, 224, .82);
  box-shadow: 0 -10px 26px rgba(var(--shadow-ink), .12);
}

/* base bottom-nav โผล่ที่ ≤1023px — light override ต้องครอบช่วงเดียวกัน (เดิม 720px ทำให้ 721–1023px ยังดำ) */
@media (max-width: 1023px) {
  html[data-theme="light"] .mobile-bottom-nav {
    background: rgba(255, 255, 255, .94);
    border-top-color: rgba(203, 191, 224, .82);
    box-shadow: 0 -10px 26px rgba(var(--shadow-ink), .12);
  }
}

html[data-theme="light"] .product-card {
  background: #ffffff;
  border-color: rgba(203, 191, 224, .76);
  box-shadow: 0 6px 18px rgba(var(--shadow-ink), .08);
}

html[data-theme="light"] .product-card:hover {
  border-color: rgba(139, 69, 214, .58);
  box-shadow: 0 14px 32px rgba(var(--shadow-ink), .16);
}

html[data-theme="light"] .product-grid--featured .product-card {
  background: linear-gradient(180deg, rgba(139, 69, 214, .08) 0%, #ffffff 34%);
  border-color: rgba(139, 69, 214, .26);
  box-shadow: 0 10px 28px rgba(var(--shadow-ink), .14);
}

html[data-theme="light"] .product-grid--featured .product-card::before {
  background: linear-gradient(135deg, transparent 60%, rgba(139, 69, 214, .07) 100%);
}

html[data-theme="light"] .product-image,
html[data-theme="light"] .product-image:has(img.is-loaded) {
  background: #f1edf8;
}
/* การ์ด info: กรอบรูปสีเดียวกับตัวการ์ด (--bg-2) — ต้อง scope ธีม light ให้ชนะกฎ #f1edf8 ด้านบน */
html[data-theme="light"] .product-card--info .product-image,
html[data-theme="light"] .product-card--info .product-image:has(img.is-loaded) {
  background: var(--bg-2);
}

html[data-theme="light"] .product-tag {
  background: rgba(139, 69, 214, .06);
  border-color: rgba(139, 69, 214, .16);
  color: #665973;
}

html[data-theme="light"] .product-tag.cat,
html[data-theme="light"] .product-tag--pill.cat {
  background: rgba(139, 69, 214, .1);
  border-color: rgba(139, 69, 214, .22);
}

html[data-theme="light"] .product-tag.sub,
html[data-theme="light"] .product-tag--pill.sub {
  background: rgba(2, 132, 199, .09);
  border-color: rgba(2, 132, 199, .2);
}

html[data-theme="light"] .product-tag.col,
html[data-theme="light"] .product-tag--pill.col {
  background: rgba(100, 116, 139, .09);
  border-color: rgba(100, 116, 139, .2);
  color: #62596d;
}

html[data-theme="light"] .product-detail--v2 .detail-grid--v2 {
  background: linear-gradient(165deg, rgba(255, 255, 255, .96) 0%, #ffffff 44%, #f4f0fa 100%);
  border-color: rgba(203, 191, 224, .78);
  box-shadow: 0 14px 36px rgba(var(--shadow-ink), .12);
}

html[data-theme="light"] .detail-image-panel {
  background: linear-gradient(180deg, #ffffff 0%, #f0ecf8 100%);
  border-color: rgba(139, 69, 214, .16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .82), 0 10px 24px rgba(var(--shadow-ink), .08);
}

html[data-theme="light"] .bundle-ai-status--result {
  background:
    radial-gradient(100% 140% at 8% 12%, rgba(34,197,94,.08), transparent 42%),
    linear-gradient(180deg, #ffffff, #f4effb);
  border-color: rgba(100, 116, 139, .3);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.84), 0 10px 22px rgba(var(--shadow-ink), .09);
}
html[data-theme="light"] .bundle-ai-status--manual {
  background:
    radial-gradient(100% 140% at 8% 12%, rgba(139, 69, 214, .1), transparent 44%),
    linear-gradient(180deg, #ffffff, #f4effb);
  border-color: rgba(139, 69, 214, .28);
}
html[data-theme="light"] .bundle-ai-status--manual.is-ready {
  background:
    radial-gradient(100% 140% at 8% 12%, rgba(34,197,94,.09), transparent 42%),
    linear-gradient(180deg, #ffffff, #f4effb);
  border-color: rgba(34,197,94,.38);
}
html[data-theme="light"] .bundle-ai-status--manual.is-error {
  background:
    radial-gradient(100% 140% at 8% 12%, rgba(239,68,68,.08), transparent 42%),
    linear-gradient(180deg, #ffffff, #fdf4f4);
  border-color: rgba(239,68,68,.42);
}
html[data-theme="light"] .bundle-ai-result__head {
  color: var(--text);
}
html[data-theme="light"] .bundle-ai-result__label {
  color: #51445f;
}
html[data-theme="light"] .bundle-ai-result__value--discord {
  color: var(--text);
}
html[data-theme="light"] .bundle-ai-result__media {
  border-color: rgba(139, 69, 214, .16);
  background: #ffffff;
}
html[data-theme="light"] .bundle-ai-result__upload {
  background: linear-gradient(180deg, rgba(139,69,214,.08), rgba(244,239,251,.96));
  color: #6f2dbd;
}
html[data-theme="light"] .bundle-ai-result__upload:hover,
html[data-theme="light"] .bundle-ai-result__upload:focus-visible {
  background: linear-gradient(180deg, rgba(139,69,214,.13), rgba(237,228,249,.98));
}
html[data-theme="light"] .bundle-ai-result__upload-main {
  color: #5f279e;
}
html[data-theme="light"] .bundle-ai-result__note--warn {
  color: #946200;
}

html[data-theme="light"] .chat-delivery-note {
  background:
    radial-gradient(100% 160% at 0% 0%, rgba(139, 69, 214, .12), transparent 48%),
    linear-gradient(180deg, #fbf7ff, #efe5ff);
  border-color: rgba(139, 69, 214, .28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.84), 0 10px 22px rgba(var(--shadow-ink), .1);
}
html[data-theme="light"] .chat-delivery-note,
html[data-theme="light"] .chat-delivery-note__icon,
html[data-theme="light"] .chat-delivery-note__copy strong {
  color: #8b45d6;
}
html[data-theme="light"] .chat-delivery-note__copy span {
  color: rgba(139, 69, 214, .78);
}

html[data-theme="light"] .nitro-pick-item--v2,
html[data-theme="light"] .qty-input--v2 {
  background: linear-gradient(180deg, #ffffff, #f5f1fb);
  border-color: rgba(139, 69, 214, .18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .85), 0 8px 20px rgba(var(--shadow-ink), .08);
}

html[data-theme="light"] .nitro-pick-item--v2:hover,
html[data-theme="light"] .qty-input--v2:hover {
  background: linear-gradient(180deg, #ffffff, #efe8f8);
  border-color: rgba(139, 69, 214, .3);
}

html[data-theme="light"] .nitro-pick-item--v2.is-selected,
html[data-theme="light"] .nitro-pick-item--v2:has(input:checked) {
  background:
    radial-gradient(120% 100% at 92% 0%, rgba(168,85,247,.18), transparent 58%),
    linear-gradient(180deg, #fbf7ff, #efe2ff);
  border-color: rgba(139, 69, 214, .72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .9),
    0 0 0 2px rgba(139, 69, 214, .16),
    0 12px 24px rgba(var(--shadow-ink), .14);
}

html[data-theme="light"] .qty-input--v2:focus-within {
  background: linear-gradient(180deg, #ffffff, #eee6f8);
  border-color: rgba(139, 69, 214, .42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .88), 0 0 0 3px rgba(139, 69, 214, .1), 0 10px 24px rgba(var(--shadow-ink), .1);
}

html[data-theme="light"] .qty-input--v2 button {
  color: var(--primary);
}

html[data-theme="light"] .detail-buy-row .btn-add-cart,
html[data-theme="light"] .detail-buy-row .btn-buy-now,
html[data-theme="light"] .qa-foot .btn-buy-now {
  box-shadow: none;
}

html[data-theme="light"] .detail-buy-row .btn-buy-now,
html[data-theme="light"] .qa-foot .btn-buy-now {
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(90deg, #6E47CE 0%, #9D6BE1 50%, #D39BE8 100%) border-box;
  border: 2px solid transparent;
}

html[data-theme="light"] .detail-buy-row .btn-buy-now:hover,
html[data-theme="light"] .qa-foot .btn-buy-now:hover {
  background:
    linear-gradient(#faf7ff, #faf7ff) padding-box,
    linear-gradient(90deg, #6E47CE 0%, #9D6BE1 50%, #D39BE8 100%) border-box;
  border: 2px solid transparent;
}

html[data-theme="light"] .payment-trust.product-trust-badges {
  background: linear-gradient(180deg, #ffffff 0%, #f3eff9 100%);
  border-color: rgba(203, 191, 224, .82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .86), 0 8px 22px rgba(var(--shadow-ink), .08);
}

html[data-theme="light"] .product-trust-badges__item {
  border-right-color: rgba(203, 191, 224, .82);
}

@media (max-width: 768px) {
  html[data-theme="light"] .product-trust-badges__item {
    border-bottom-color: rgba(203, 191, 224, .82);
  }
}

html[data-theme="light"] .product-accordion {
  background: #ffffff;
  border-color: rgba(203, 191, 224, .82);
  box-shadow: 0 8px 22px rgba(var(--shadow-ink), .08);
}

html[data-theme="light"] .accordion-panel summary:hover {
  background: rgba(139, 69, 214, .07);
}

html[data-theme="light"] .howto-list li code {
  background: rgba(139, 69, 214, .07);
}

html[data-theme="light"] .rich-content a {
  color: var(--primary);
}

html[data-theme="light"] .rich-content a:hover,
html[data-theme="light"] .rich-content a:focus {
  color: var(--primary-dark);
}

html[data-theme="light"] .cat-picker-panel--cards .cat-picker-title {
  color: var(--text);
  text-shadow: none;
}

html[data-theme="light"] .cat-picker-panel--cards .cat-pill--all,
html[data-theme="light"] .cat-picker-panel--cards .cat-pill--all:hover,
html[data-theme="light"] .cat-picker-panel--cards .cat-pill--all.is-active {
  color: var(--primary);
}

html[data-theme="light"] .cat-picker-panel--cards .cat-card {
  background:
    radial-gradient(120% 95% at 86% 0%, color-mix(in srgb, var(--cat-accent) 16%, transparent), transparent 58%),
    linear-gradient(180deg, #ffffff 0%, #f5f1fb 100%);
  border-color: rgba(203, 191, 224, .76);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.84),
    0 2px 8px rgba(96, 72, 150, .05);
}

html[data-theme="light"] .cat-picker-panel--cards .cat-card::after {
  box-shadow: inset -1px 0 0 rgba(139, 69, 214, .12);
}

html[data-theme="light"] .cat-picker-panel--cards .cat-card:hover,
html[data-theme="light"] .cat-picker-panel--cards .cat-card.is-active {
  background:
    radial-gradient(120% 95% at 86% 0%, color-mix(in srgb, var(--cat-accent) 22%, transparent), transparent 58%),
    linear-gradient(180deg, #ffffff 0%, #efe8f8 100%);
  border-color: rgba(139, 69, 214, .34);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.9),
    0 6px 16px rgba(96, 72, 150, .1);
}

html[data-theme="light"] .cat-picker-panel--cards .cat-card__name {
  color: var(--text);
}

/* subcategory-pill (แถบหมวดย่อยหน้า browse): พื้น+ขอบขาวจาง (dark glass) หายบน light เหมือน cat-card */
html[data-theme="light"] .subcategory-pill {
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--subcat-accent) 14%, transparent) 0%, transparent 55%),
    linear-gradient(180deg, #ffffff, #f5f1fb);
  border-color: rgba(203, 191, 224, .78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7);
}
html[data-theme="light"] .subcategory-pill.active {
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--subcat-accent) 22%, transparent) 0%, transparent 60%),
    linear-gradient(180deg, #ffffff, #efe8f8);
  border-color: color-mix(in srgb, var(--subcat-accent) 55%, transparent);
}

/* ============ Light-mode fixes: white text/icons ที่หลุดมาบนพื้นสว่าง ============ */
/* จุดเหล่านี้ hardcode สีขาวไว้สำหรับ dark — บน light วางบนพื้น token/โปร่งใส จึงมองไม่เห็น
   แก้เฉพาะ light (ไม่แตะ dark); hover ที่มีพื้นสีคงสีขาวไว้ */

/* Hero (หน้าแรก) — subtitle/สถิติ/CTA card วางบนพื้น hero โปร่งใส = สว่าง */
html[data-theme="light"] .hero-v2-subtitle,
html[data-theme="light"] .hero-stat-text strong,
html[data-theme="light"] .hero-cta-card__text strong {
  color: var(--text);
}

/* hero-badge: พื้น+ขอบขาวจาง (dark glass) หายบน light → คืนทรงเม็ดยาโทนม่วงจาง */
html[data-theme="light"] .hero-badge {
  background: rgba(139, 69, 214, .06);
  border-color: rgba(139, 69, 214, .2);
}

/* แบนเนอร์โชว์เคส: พื้นสำรองเข้ม (#130b25) โผล่เป็นขอบดำรอบรูปสไลด์บน light → ลาเวนเดอร์อ่อน */
html[data-theme="light"] .hero-showcase-banner__viewport {
  background:
    radial-gradient(circle at 72% 24%, rgba(139, 69, 214, .1), transparent 38%),
    linear-gradient(135deg, #f2ecfb 0%, #e7ddf5 100%);
  border-color: rgba(139, 69, 214, .22);
}

/* badge พรีออเดอร์: ตัวอักษรลาเวนเดอร์อ่อนบนพื้นซีด = มองไม่เห็นบน light → ม่วงเข้มอ่านออก */
html[data-theme="light"] .preorder-eta-badge,
html[data-theme="light"] .preorder-autodeliver-badge {
  color: var(--primary-dark);
  background: rgba(139, 69, 214, .09);
  border-color: rgba(139, 69, 214, .3);
}

/* Footer social icons — พื้น var(--bg-3) สว่าง แต่ไอคอน #fff !important */
html[data-theme="light"] .footer-socials .footer-social-circle {
  color: var(--text) !important;
}
html[data-theme="light"] .footer-socials .footer-social-circle:hover {
  color: #fff !important; /* hover พื้นกลายเป็นสีแบรนด์ → คงไอคอนขาว */
}

/* ปุ่มลูกศรเลื่อนหมวดหมู่ — สีขาวจาง บนพื้นโปร่งใส */
html[data-theme="light"] .cat-cards-nav { color: var(--muted); }
html[data-theme="light"] .cat-cards-nav:hover { color: var(--text); }

/* ปุ่ม action ข้างหัวข้อ section (เช่น "ดูทั้งหมด") — พื้นโปร่งใส ขอบม่วง */
html[data-theme="light"] .section-title-action { color: var(--primary); }
html[data-theme="light"] .section-title-action:hover,
html[data-theme="light"] .section-title-action:focus-visible { color: var(--primary-dark); }

/* Support-chat chip hover — พื้นม่วงอ่อน */
html[data-theme="light"] .support-chat__chip:hover { color: var(--primary); }

/* Bundle analyzer (หน้าสินค้า) — ชื่อสินค้าในผลลัพธ์ */
html[data-theme="light"] .bundle-ai-candidate__label,
html[data-theme="light"] .bundle-summary__label {
  color: var(--text);
}

/* ============ Light-mode re-theme: หน้า Checkout ============ */
/* การ์ด checkout ออกแบบพื้นมืดทึบ (rgba(22,22,31,.78)) + ตัวอักษรเกือบขาว →
   บน light ปรับการ์ดเป็นพื้นสว่าง + ตัวอักษรเข้ม (ไม่แตะ dark) */
html[data-theme="light"] .checkout-page .checkout-section,
html[data-theme="light"] .checkout-page .checkout-summary {
  background: var(--bg-2);
  border-color: var(--border);
}
html[data-theme="light"] .checkout-page .form-row label,
html[data-theme="light"] .checkout-page .checkout-summary-item-title,
html[data-theme="light"] .checkout-page .checkout-summary-item-price,
html[data-theme="light"] .checkout-page .summary-line span:last-child,
html[data-theme="light"] .checkout-page .summary-line.total,
html[data-theme="light"] .checkout-summary-safe strong {
  color: var(--text);
}
html[data-theme="light"] .checkout-subtitle,
html[data-theme="light"] .checkout-credential-note,
html[data-theme="light"] .checkout-credential-note .lucide,
html[data-theme="light"] .checkout-note-count,
html[data-theme="light"] .checkout-page .checkout-summary-item-meta,
html[data-theme="light"] .checkout-page .summary-line,
html[data-theme="light"] .checkout-summary-safe small {
  color: var(--muted);
}
html[data-theme="light"] .checkout-page .summary-line .checkout-summary-count {
  color: var(--muted) !important;
}
html[data-theme="light"] .checkout-page .form-row input,
html[data-theme="light"] .checkout-page .form-row textarea {
  background: var(--bg);
  border-color: var(--border);
}
html[data-theme="light"] .checkout-page .checkout-choice-select .checkout-choice-trigger {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
  box-shadow: none;
}
html[data-theme="light"] .checkout-page .checkout-choice-select .checkout-choice-trigger:hover {
  background: var(--bg);
  border-color: var(--border-strong);
}
html[data-theme="light"] .checkout-page .checkout-choice-select .checkout-choice-trigger:focus,
html[data-theme="light"] .checkout-page .checkout-choice-select.bundle-price-select.is-open .checkout-choice-trigger {
  background: var(--bg);
  border-color: rgba(139, 69, 214, .4);
  box-shadow: 0 0 0 3px rgba(139, 69, 214, .12);
}
html[data-theme="light"] .checkout-page .checkout-summary-thumb {
  background: var(--bg-3);
  border-color: var(--border);
}
html[data-theme="light"] .checkout-actions { border-top-color: var(--border); }
html[data-theme="light"] .checkout-actions .btn-ghost {
  background: var(--bg-3);
  border-color: var(--border);
}
html[data-theme="light"] .checkout-page .checkout-summary hr,
html[data-theme="light"] .checkout-page .summary-line.total {
  border-top-color: var(--border);
}
html[data-theme="light"] .checkout-summary-safe {
  background: var(--bg-3);
  border-top-color: var(--border);
}

/* ============ Light-mode re-theme: หน้า Order detail (panel สินค้า/ของที่ได้รับ) ============ */
/* การ์ดพื้น var(--bg-2) (สว่างอยู่แล้ว) แต่ตัวอักษร/ไอคอน hardcode เกือบขาว →
   ตัวอักษรเข้ม + กล่องย่อยพื้นโปร่งมืด → สว่าง */
html[data-theme="light"] .order-products-panel {
  background: var(--bg-2) !important;
  border-color: var(--border) !important;
  box-shadow: var(--shadow-sm);
}
html[data-theme="light"] .order-products-panel > h3,
html[data-theme="light"] .order-products-panel .order-item-head .name,
html[data-theme="light"] .order-total-cell strong {
  color: var(--text);
}
html[data-theme="light"] .order-products-panel .order-item-thumb {
  border-color: var(--border);
}
html[data-theme="light"] .order-products-panel .delivery-note {
  background: var(--bg-3);
  border-color: var(--border);
  color: var(--muted);
}
html[data-theme="light"] .order-products-panel .delivery-note .lucide { color: var(--muted); }
html[data-theme="light"] .order-products-panel .file-card {
  background: var(--bg-3);
  border-color: var(--border);
  color: var(--text);
}
html[data-theme="light"] .order-products-panel .file-card__size { color: var(--muted); }
html[data-theme="light"] .order-products-panel .file-card__btn {
  color: var(--text);
  border-color: var(--border);
}
/* delivered-card ("ดูของที่ได้รับ") */
html[data-theme="light"] .delivered-card > summary.delivered-card__toggle { color: var(--muted); }
html[data-theme="light"] .delivered-card > summary.delivered-card__toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
html[data-theme="light"] .delivered-card__icon-wrap { color: var(--accent); }
html[data-theme="light"] .delivered-card__chevron { color: var(--muted); }
/* secret toggle + totals + code block */
html[data-theme="light"] .order-secret-toggle { color: var(--muted); }
html[data-theme="light"] .order-secret-toggle:hover {
  color: var(--text);
  background: var(--bg-3);
}
html[data-theme="light"] .order-totals { border-top-color: var(--border); }
html[data-theme="light"] .code-block {
  background: var(--bg-3);
  color: var(--text);
}

/* ============ Light-mode รอบ 2: หน้าแรก / สินค้า / order / wallet / status / alert ============ */

/* --- หน้าแรก: การ์ดโปรโมชั่นโค้ดลด (re-theme เกาะมืด → สว่าง) --- */
html[data-theme="light"] .hero-coupon-panel {
  background:
    radial-gradient(circle at 78% 0%, rgba(139, 69, 214, .1), transparent 42%),
    linear-gradient(180deg, #ffffff, #f4effb);
  border-color: rgba(139, 69, 214, .22);
  --credit-notch: #fdfaff;
}
/* ตั๋วเครดิตฟรีบน light: พื้นม่วงอ่อนบนขาว ตัวเลขยังเป็นม่วงเข้มอ่านออก */
html[data-theme="light"] .credit-ticket {
  background:
    radial-gradient(circle at 88% 0%, rgba(139, 69, 214, .12), transparent 46%),
    linear-gradient(135deg, rgba(139, 69, 214, .1), rgba(139, 69, 214, .03)),
    #ffffff;
  border-color: rgba(139, 69, 214, .34);
  box-shadow: 0 6px 18px rgba(var(--shadow-ink), .1);
}
html[data-theme="light"] .credit-ticket__stub {
  color: #6f2dbd;
  border-right-color: rgba(139, 69, 214, .35);
}
html[data-theme="light"] .credit-ticket__stub::before,
html[data-theme="light"] .credit-ticket__stub::after {
  box-shadow: inset 0 0 0 1px rgba(139, 69, 214, .3);
}
html[data-theme="light"] .credit-ticket__eyebrow { color: #6f2dbd; }
html[data-theme="light"] .credit-ticket__amount { color: var(--text); }
html[data-theme="light"] .credit-ticket__amount small,
html[data-theme="light"] .credit-ticket__stub-icon { color: var(--primary); }
html[data-theme="light"] .credit-ticket__status { color: #b91c1c; }
html[data-theme="light"] .credit-ticket__done {
  background:
    radial-gradient(circle at 50% 30%, rgba(139, 69, 214, .14), transparent 60%),
    linear-gradient(135deg, rgba(139, 69, 214, .12), rgba(139, 69, 214, .05)),
    #ffffff;
}
html[data-theme="light"] .credit-ticket__done-icon { color: #15803d; }
html[data-theme="light"] .credit-ticket__done strong { color: var(--text); }
html[data-theme="light"] .credit-ticket__done-text { color: #6f2dbd; }
html[data-theme="light"] .hero-coupon-panel__head h2,
html[data-theme="light"] .hero-coupon-card strong { color: var(--text); }
html[data-theme="light"] .hero-coupon-form {
  background:
    linear-gradient(180deg, rgba(139, 69, 214, .06), rgba(139, 69, 214, .02)),
    #ffffff;
  border-color: rgba(139, 69, 214, .28);
}
html[data-theme="light"] .hero-coupon-form label,
html[data-theme="light"] .hero-coupon-today__label { color: #6f2dbd; }
html[data-theme="light"] .hero-coupon-form input {
  background: #ffffff;
  border-color: var(--border);
}
html[data-theme="light"] .hero-coupon-status { color: var(--muted); }
html[data-theme="light"] .hero-coupon-card {
  background: #ffffff;
  border-color: var(--border);
}
html[data-theme="light"] .hero-coupon-card__value { color: var(--primary); }

/* --- หน้าสินค้า: สีตัวอักษรที่ตก (พื้นทำไว้รอบก่อน) --- */
html[data-theme="light"] .detail-desc--lead { color: var(--text); }
html[data-theme="light"] .detail-buy-row .btn-buy-now,
html[data-theme="light"] .qa-foot .btn-buy-now { color: var(--primary); }
html[data-theme="light"] .detail-buy-row .btn-buy-now:hover,
html[data-theme="light"] .qa-foot .btn-buy-now:hover { color: var(--primary-dark); }
html[data-theme="light"] .product-trust-badges__title { color: var(--text); }
html[data-theme="light"] .product-trust-badges__sub { color: var(--muted); }
html[data-theme="light"] .nitro-pick-item--v2.is-selected .nitro-pick-item__sub,
html[data-theme="light"] .nitro-pick-item--v2:has(input:checked) .nitro-pick-item__sub { color: #6f2dbd; }
html[data-theme="light"] .bundle-ai-result__value--type { color: #6f2dbd; }
html[data-theme="light"] .bundle-ai-result__value--shop { color: #c81e74; }
html[data-theme="light"] .bundle-ai-result__upload-icon { color: var(--primary); }
/* ข้อความ "คำตอบของ AI" (สถานะวิเคราะห์: ตรวจพบ.../วิเคราะห์เสร็จ/คำเตือน/ผิดพลาด) — อักษรอ่อนบนพื้น tint อ่อน */
html[data-theme="light"] .bundle-ai-status--busy,
html[data-theme="light"] .bundle-ai-status--warn { color: #6f2dbd; }
html[data-theme="light"] .bundle-ai-status--ok { color: #15803d; }
html[data-theme="light"] .bundle-ai-status--error { color: #b91c1c; }

/* --- หน้าสินค้า: dropdown เลือกราคา (custom select) --- */
html[data-theme="light"] .bundle-price-trigger {
  background: linear-gradient(180deg, #ffffff, #f5f1fb);
  border-color: rgba(139, 69, 214, .22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .85), 0 8px 20px rgba(var(--shadow-ink), .08);
}
html[data-theme="light"] .bundle-price-trigger:focus,
html[data-theme="light"] .bundle-price-select.is-open .bundle-price-trigger {
  background: linear-gradient(180deg, #ffffff, #efe8f8);
  border-color: rgba(139, 69, 214, .4);
}
html[data-theme="light"] .checkout-choice-trigger[aria-invalid="true"] {
  border-color: rgba(185, 28, 28, .42);
}
html[data-theme="light"] .bundle-price-trigger__chev { color: var(--primary); }
html[data-theme="light"] .bundle-price-menu {
  background: #ffffff;
  border-color: var(--border);
  box-shadow: 0 16px 34px rgba(var(--shadow-ink), .16);
}
html[data-theme="light"] .bundle-price-option:hover,
html[data-theme="light"] .bundle-price-option:focus { background: rgba(139, 69, 214, .07); }

/* --- Alert / คำเตือน (info/error/success/warn + nitro-error) ตัวอักษรอ่อนเกินบนพื้นสว่าง --- */
html[data-theme="light"] .alert-info { color: #6f2dbd; }
html[data-theme="light"] .alert-error { color: #b91c1c; }
/* error validation ใต้ช่องฟอร์ม (login/register/order): #fca5a5 อ่านยากบนขาว → แดงเข้ม */
html[data-theme="light"] .field-error { color: #b91c1c; }
/* สถานะคูปองหน้าแรก: base override .hero-coupon-status (เทา) ชนะ .is-error/.is-success → คืนสีสถานะ */
html[data-theme="light"] .hero-coupon-status.is-error { color: #b91c1c; }
html[data-theme="light"] .hero-coupon-status.is-success { color: #15803d; }
html[data-theme="light"] .alert-success { color: #15803d; }
html[data-theme="light"] .alert-warning { color: #92600a; }
html[data-theme="light"] .alert-warn,
html[data-theme="light"] .nitro-error { color: #92600a; }

/* --- หน้า /order: หัวออเดอร์ + การ์ดผู้รับ --- */
html[data-theme="light"] .order-head__back,
html[data-theme="light"] .order-head__back--static:hover,
html[data-theme="light"] .order-head__meta,
html[data-theme="light"] .order-recipient-label { color: var(--muted); }
html[data-theme="light"] .order-head__icon {
  color: var(--text);
  border-color: var(--border);
}
html[data-theme="light"] .order-head__title-block h1,
html[data-theme="light"] .order-recipient-card > h3,
html[data-theme="light"] .order-recipient-value,
html[data-theme="light"] .order-recipient-note { color: var(--text); }
html[data-theme="light"] .order-recipient-card {
  border-color: var(--border) !important;
  box-shadow: var(--shadow-sm);
}
/* note "ร้านค้าได้ลบข้อมูล...ตามนโยบายความเป็นส่วนตัว" — อินดิโกอ่อนจางบนพื้น light */
html[data-theme="light"] .order-recipient-safe-note { color: #3a3f9e; }
html[data-theme="light"] .order-recipient-safe-note .lucide { color: #4f46e5; }

/* --- หน้า /order: กล่องแชท (composer เทา, ปุ่มแนบรูป, empty state) --- */
html[data-theme="light"] #messages.order-chat-panel { border-color: var(--border); }
html[data-theme="light"] #messages.order-chat-panel > h3 { color: var(--text); }
html[data-theme="light"] #messages.order-chat-panel > h3 .lucide { color: var(--muted); }
html[data-theme="light"] .chat-box { border-color: var(--border); }
/* ฟองแชตฝั่งลูกค้า: คงค่า darkmode (var(--bg-2)) = ขาว แยกชัดจากพื้น chat-box (var(--bg-3)) — ไม่ override */
html[data-theme="light"] .chat-composer {
  background: var(--bg-3);
  border-color: var(--border);
}
html[data-theme="light"] .chat-composer-preview {
  background: var(--bg);
  border-color: var(--border);
}
html[data-theme="light"] .chat-file-btn {
  background: var(--bg-3);
  border-color: var(--border);
  color: var(--text);
}
html[data-theme="light"] .chat-file-btn:hover {
  background: var(--bg-2);
  border-color: var(--border-strong);
}
html[data-theme="light"] .chat-empty strong { color: var(--text); }
html[data-theme="light"] .chat-empty__icon,
html[data-theme="light"] .chat-empty span { color: var(--muted); }

/* --- Status badge ออเดอร์ (ใช้ทั้ง /order และ /my/orders) — พื้น+ขอบ pill ตามสีตัวอักษรสถานะ --- */
html[data-theme="light"] .status-pending {
  background: rgba(245, 158, 11, .14);
  border-color: rgba(217, 148, 9, .55);
  color: #92600a;
}
html[data-theme="light"] .status-paid {
  background: rgba(139, 69, 214, .12);
  border-color: rgba(139, 69, 214, .5);
  color: #6f2dbd;
}
html[data-theme="light"] .status-preorder {
  background: rgba(124, 92, 255, .12);
  border-color: rgba(124, 92, 255, .5);
  color: #5b32a8;
}
html[data-theme="light"] .status-processing {
  background: rgba(14, 165, 233, .12);
  border-color: rgba(14, 165, 233, .5);
  color: #0369a1;
}
html[data-theme="light"] .status-shipping {
  background: rgba(124, 95, 214, .14);
  border-color: rgba(124, 95, 214, .5);
  color: #5b3fb8;
}
html[data-theme="light"] .status-delivered,
html[data-theme="light"] .status-completed,
html[data-theme="light"] .status-available {
  background: rgba(34, 197, 94, .14);
  border-color: rgba(22, 163, 74, .5);
  color: #15803d;
}
html[data-theme="light"] .status-cancelled {
  background: rgba(239, 68, 68, .12);
  border-color: rgba(239, 68, 68, .5);
  color: #b91c1c;
}
html[data-theme="light"] .status-refund_pending {
  background: rgba(249, 115, 22, .14);
  border-color: rgba(249, 115, 22, .5);
  color: #b45309;
}
html[data-theme="light"] .status-refunded {
  background: rgba(100, 116, 139, .14);
  border-color: rgba(100, 116, 139, .5);
  color: #475569;
}

/* --- หน้า /wallet: การ์ดยอดคงเหลือ (gradient มืด → สว่าง) --- */
html[data-theme="light"] .wallet-card {
  background: linear-gradient(135deg, #ffffff, #f1e9fb 80%);
  border-color: var(--border);
}

/* ============ Coupon + referral rewards ============ */
.checkout-coupon-box,
.cart-coupon-box {
  display: grid;
  gap: .55rem;
  padding: .5rem;
  margin-bottom: .8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, .035);
}

.checkout-coupon-box label,
.cart-coupon-box label {
  color: var(--muted);
  font-size: .86rem;
  font-weight: 600;
}

.checkout-coupon-row,
.cart-coupon-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .5rem;
  align-items: center;
}

.checkout-coupon-row input,
.cart-coupon-row input {
  width: 100%;
  min-width: 0;
  padding: .62rem .72rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, .16);
  color: var(--text);
  text-transform: uppercase;
}

.checkout-coupon-row input:focus,
.cart-coupon-row input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}

.checkout-coupon-status,
.cart-coupon-status {
  min-height: 1.2rem;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.35;
}

.checkout-coupon-status.is-success,
.cart-coupon-status.is-success {
  color: var(--success);
}

.checkout-coupon-status.is-error,
.cart-coupon-status.is-error {
  color: var(--danger);
}

/* กล่องคูปองบนการ์ดสรุป checkout (โหมด buy_now) — จัดให้เข้าชุดดีไซน์การ์ด */
.checkout-page .checkout-summary .checkout-coupon-box {
  gap: .6rem;
  padding: .95rem 1rem 1.05rem;
  margin: 0 0 1.15rem;
  border: 1px solid rgba(168, 85, 247, .22);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(168, 85, 247, .07), rgba(168, 85, 247, .015)),
    rgba(13, 13, 20, .38);
}
.checkout-page .checkout-summary .checkout-coupon-box label {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: #cfc6e6;
  font-size: .86rem;
  font-weight: 600;
}
.checkout-page .checkout-summary .checkout-coupon-box label .lucide {
  color: var(--primary);
}
.checkout-page .checkout-summary .checkout-coupon-row {
  gap: .5rem;
}
.checkout-page .checkout-summary .checkout-coupon-row input {
  min-height: 40px;
  padding: .48rem .72rem;
  border-radius: 8px;
  border-color: rgba(255, 255, 255, .1);
  background: rgba(13, 13, 20, .5);
  color: var(--text);
  font-size: .92rem;
  letter-spacing: .04em;
}
.checkout-page .checkout-summary .checkout-coupon-row input::placeholder {
  text-transform: none;
  letter-spacing: 0;
  color: #7d7d90;
}
.checkout-page .checkout-summary .checkout-coupon-row input:focus {
  border-color: color-mix(in srgb, var(--primary) 55%, transparent);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, .16);
}
.checkout-page .checkout-summary .checkout-coupon-row .btn {
  min-height: 40px;
  padding: .46rem .95rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: .9rem;
  color: var(--text);
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .13);
  white-space: nowrap;
  transition: background .16s ease, border-color .16s ease, transform .12s ease;
}
.checkout-page .checkout-summary .checkout-coupon-row .btn:hover {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .22);
}
.checkout-page .checkout-summary .checkout-coupon-row .btn:active {
  transform: translateY(1px);
}
.checkout-page .checkout-summary .checkout-coupon-row .btn:disabled {
  opacity: .55;
  cursor: default;
}
.checkout-page .checkout-summary .checkout-coupon-status:empty {
  min-height: 0;
}
/* ส่วนลด > 0 → เน้นเป็นสีเขียว */
.checkout-page .summary-line #checkoutDiscountAmount.is-discounted {
  color: var(--success);
}
/* โหมด light (storefront) */
html[data-theme="light"] .checkout-page .checkout-summary .checkout-coupon-box {
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
  background: color-mix(in srgb, var(--primary) 5%, var(--bg));
}
html[data-theme="light"] .checkout-page .checkout-summary .checkout-coupon-box label {
  color: color-mix(in srgb, var(--primary) 55%, var(--text));
}
html[data-theme="light"] .checkout-page .checkout-summary .checkout-coupon-row input {
  background: var(--bg);
  border-color: var(--border);
}
html[data-theme="light"] .checkout-page .checkout-summary .checkout-coupon-row .btn {
  background: var(--bg-3);
  border-color: var(--border);
  color: var(--text);
}
html[data-theme="light"] .checkout-page .checkout-summary .checkout-coupon-row .btn:hover {
  background: color-mix(in srgb, var(--primary) 8%, var(--bg-3));
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
}

.cart-summary {
  padding: 1.65rem;
  border-radius: var(--radius-lg);
  border-color: color-mix(in srgb, var(--border) 82%, rgba(255,255,255,.12));
  background:
    linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.01) 42%, transparent),
    var(--bg-2);
  box-shadow: 0 18px 44px rgba(var(--shadow-ink),.18);
}

.cart-summary h3 {
  margin: 0 0 1.15rem;
  font-size: 1.28rem;
  line-height: var(--lh-tight);
  letter-spacing: 0;
}

/* กล่องคูปองหน้า cart — ใช้รูปแบบเดียวกับการ์ดสรุป checkout */
.cart-summary .cart-coupon-box {
  gap: .6rem;
  padding: .95rem 1rem 1.05rem;
  margin: 0 0 1.15rem;
  border: 1px solid rgba(168, 85, 247, .22);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(168, 85, 247, .07), rgba(168, 85, 247, .015)),
    rgba(13, 13, 20, .38);
}

.cart-summary .cart-coupon-box label {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: #cfc6e6;
  font-size: .86rem;
  font-weight: 600;
}
.cart-summary .cart-coupon-box label .lucide {
  color: var(--primary);
}

.cart-summary .cart-coupon-row {
  gap: .5rem;
}

.cart-summary .cart-coupon-row input {
  min-height: 40px;
  padding: .48rem .72rem;
  border-radius: 8px;
  border-color: rgba(255, 255, 255, .1);
  background: rgba(13, 13, 20, .5);
  font-size: .92rem;
  letter-spacing: .04em;
}
.cart-summary .cart-coupon-row input::placeholder {
  text-transform: none;
  letter-spacing: 0;
  color: #7d7d90;
}
.cart-summary .cart-coupon-row input:focus {
  border-color: color-mix(in srgb, var(--primary) 55%, transparent);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, .16);
}

.cart-summary .cart-coupon-row .btn {
  min-height: 40px;
  padding: .46rem .95rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: .9rem;
  color: var(--text);
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .13);
  white-space: nowrap;
  transition: background .16s ease, border-color .16s ease, transform .12s ease;
}
.cart-summary .cart-coupon-row .btn:hover {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .22);
}
.cart-summary .cart-coupon-row .btn:active {
  transform: translateY(1px);
}
.cart-summary .cart-coupon-row .btn:disabled {
  opacity: .55;
  cursor: default;
}

.cart-summary .cart-coupon-status:empty {
  min-height: 0;
}
/* ส่วนลด > 0 → เน้นเป็นสีเขียว */
.cart-summary #cartDiscountDisplay.is-discounted {
  color: var(--success);
}
/* โหมด light (storefront) */
html[data-theme="light"] .cart-summary .cart-coupon-box {
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
  background: color-mix(in srgb, var(--primary) 5%, var(--bg));
}
html[data-theme="light"] .cart-summary .cart-coupon-box label {
  color: color-mix(in srgb, var(--primary) 55%, var(--text));
}
html[data-theme="light"] .cart-summary .cart-coupon-row input {
  background: var(--bg);
  border-color: var(--border);
}
html[data-theme="light"] .cart-summary .cart-coupon-row .btn {
  background: var(--bg-3);
  border-color: var(--border);
  color: var(--text);
}
html[data-theme="light"] .cart-summary .cart-coupon-row .btn:hover {
  background: color-mix(in srgb, var(--primary) 8%, var(--bg-3));
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
}

.cart-summary .summary-row {
  align-items: baseline;
  gap: 1rem;
  padding: .42rem 0;
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.35;
}

.cart-summary .summary-row > span:first-child {
  min-width: 0;
}

.cart-summary .summary-row > span:last-child {
  color: var(--text);
  font-weight: var(--fw-semibold);
  text-align: right;
  white-space: nowrap;
}

.cart-summary #cartCouponLabel {
  display: inline-block;
  margin-left: .25rem;
  font-size: .75rem;
  font-weight: var(--fw-semibold);
  color: color-mix(in srgb, var(--muted) 82%, var(--accent) 18%);
}

.cart-summary .summary-row.total {
  margin-top: .65rem;
  padding: 1rem 0 .15rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 82%, rgba(255,255,255,.16));
  color: var(--text);
  font-size: 1rem;
}

.cart-summary .summary-row.total > span:first-child {
  color: color-mix(in srgb, var(--primary) 70%, var(--text) 30%);
  font-size: 1.12rem;
  font-weight: var(--fw-bold);
}

.cart-summary .summary-row.total > span:last-child {
  color: var(--primary);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.1;
}

.cart-summary #cartCheckoutBtn {
  min-height: 43px;
  padding: .5rem 1.8rem;
  margin-top: 1rem;
  border-radius: 10px;
  box-shadow: none;
}

.cart-summary #cartCheckoutBtn:hover {
  box-shadow: none;
}

.cart-summary .cart-cta-spacer {
  height: .55rem;
}

.cart-summary > a.btn-ghost {
  min-height: 37px;
  padding: .45rem 1.3rem;
  border-radius: 10px;
  background: transparent;
  border-color: color-mix(in srgb, var(--border) 88%, rgba(255,255,255,.1));
  color: color-mix(in srgb, var(--text) 92%, var(--muted) 8%);
}

.cart-summary > a.btn-ghost:hover {
  background: color-mix(in srgb, var(--bg-3) 76%, transparent);
  border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
}

.my-order-amount small {
  display: block;
  margin-top: .15rem;
  font-size: .76rem;
  font-weight: 600;
}

.referral-page {
  display: grid;
  gap: 1rem;
  padding-bottom: 2rem;
}

.referral-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.referral-head .page-title {
  margin-bottom: .2rem;
}

.referral-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  gap: 1rem;
  align-items: start;
}

.referral-invite-panel {
  display: grid;
  gap: .9rem;
}

.referral-code-line,
.referral-copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .55rem;
  align-items: center;
}

.referral-code {
  display: block;
  min-width: 0;
  padding: .72rem .85rem;
  border: 1px solid color-mix(in srgb, var(--primary) 36%, var(--border));
  border-radius: 8px;
  background: rgba(255, 255, 255, .045);
  color: var(--text);
  font-size: 1.12rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.referral-copy-row input,
.referral-invite-panel textarea,
.referral-apply-form input {
  width: 100%;
  min-width: 0;
  border-radius: 8px;
}

.referral-invite-panel textarea {
  resize: vertical;
}

.referral-bound {
  display: flex;
  gap: .8rem;
  align-items: flex-start;
  padding: .85rem;
  border: 1px solid color-mix(in srgb, var(--success) 30%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--success) 9%, transparent);
}

.referral-bound.is-muted {
  border-color: var(--border);
  background: rgba(255, 255, 255, .035);
}

.referral-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
}

.referral-stat {
  min-width: 0;
  padding: .85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, .035);
}

.referral-stat span,
.referral-stat small {
  display: block;
  color: var(--muted);
}

.referral-stat b {
  display: block;
  margin: .18rem 0;
  font-size: 1.35rem;
}

.referral-settings-action {
  align-self: end;
}

.admin-referral-rewards-actions {
  padding-right: 3.45rem;
}

.admin-referral-settings-modal {
  max-width: min(92vw, 680px);
}

.admin-referral-settings-modal h3 {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin-top: 0;
  margin-bottom: .25rem;
  padding-right: 2.25rem;
}

.admin-referral-settings-modal > p {
  margin: 0 0 1rem;
}

.admin-referral-settings-modal .admin-form {
  margin-top: .9rem;
}

@media (max-width: 1023px) {
  .admin-referral-rewards-actions {
    padding-right: 0;
  }

  .admin-referral-settings-modal .referral-settings-action {
    align-self: stretch;
  }

  .admin-referral-settings-modal .referral-settings-action .btn {
    width: 100%;
  }
}

.status-pending_review,
.status-approved,
.status-rejected {
  color: var(--text);
}

.status-pending_review {
  border-color: color-mix(in srgb, var(--warn) 46%, var(--border));
  background: color-mix(in srgb, var(--warn) 14%, transparent);
}

.status-approved {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.status-rejected {
  border-color: color-mix(in srgb, var(--danger) 42%, var(--border));
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

@media (max-width: 760px) {
  .checkout-coupon-row,
  .cart-coupon-row,
  .referral-code-line,
  .referral-copy-row {
    grid-template-columns: 1fr;
  }

  .checkout-coupon-row .btn,
  .cart-coupon-row .btn,
  .referral-code-line .btn,
  .referral-copy-row .btn {
    width: 100%;
  }

  .referral-head {
    display: grid;
  }

  .referral-grid,
  .referral-stats {
    grid-template-columns: 1fr;
  }
}

/* Cart summary มือถือ: คูปอง & ยอดรวมเป็นการ์ดแยกกัน + ปุ่มใช้โค้ดอยู่บรรทัดเดียวกับฟิลด์
   (วางท้ายไฟล์เพื่อ override กฎ .cart-summary ~L14952 และ media 760px ~L15283 ตามลำดับ source) */
@media (max-width: 1023px) {
  .cart-summary {
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
  }
  .cart-summary .cart-coupon-box {
    margin: 0 0 1rem;
    border-color: var(--border);
    border-radius: var(--radius);
    background: var(--bg-2);
  }
  .cart-coupon-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .cart-coupon-row .btn {
    width: auto;
  }
  .cart-summary__totals {
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-2);
  }
}

/* ============ Admin products prototype: compact official list ============ */
.admin-products-page {
  --admin-product-radius: var(--admin-radius-panel);
  --admin-product-control-radius: var(--admin-radius-control);
}
.admin-products-page .panel,
.admin-products-page .admin-kpi-card {
  border-radius: var(--admin-product-radius);
}
.admin-products-page .btn,
.admin-products-page input,
.admin-products-page select,
.admin-products-page textarea {
  border-radius: var(--admin-product-control-radius);
}
.admin-products-page .admin-products-page__header {
  align-items: flex-start;
  margin-bottom: 1rem;
}
.admin-products-page__header .admin-header-actions {
  padding-right: 3.35rem;
}
.admin-products-page__header h1 {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: var(--admin-font-page-title);
  line-height: 1.25;
}
.admin-products-page__header p {
  margin: .3rem 0 0;
}
.admin-products-page__count {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: .18rem .48rem;
  border: 1px solid rgba(139, 92, 246, .22);
  border-radius: 5px;
  background: rgba(139, 92, 246, .1);
  color: #c4b5fd;
  font-size: .72rem;
  font-weight: 600;
}
.admin-products-page .admin-header-actions .btn {
  min-height: 36px;
  padding: .48rem .78rem;
  font-size: .82rem;
}
.admin-products-page .admin-kpi-card {
  padding: .72rem .82rem;
}
.admin-products-page .admin-kpi-label {
  margin-bottom: .25rem;
  font-size: .72rem;
}
.admin-products-page .admin-kpi-card strong {
  font-size: 1.22rem;
}
.admin-products-page .admin-list-panel {
  padding: 1rem;
}
.admin-products-page .admin-product-tools-primary .admin-disclosure__title .lucide {
  color: #c4b5fd;
}
.admin-products-page .admin-list-head {
  align-items: center;
  margin-bottom: .65rem;
}
.admin-products-page .admin-list-head h3 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .45rem;
  margin-bottom: 0;
  font-size: var(--admin-font-panel-title);
}
.admin-products-page .admin-list-head p {
  margin: .3rem 0 0;
}
.admin-products-page .admin-filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) minmax(160px, .78fr) minmax(128px, .56fr) minmax(220px, .95fr);
  align-items: stretch;
  gap: .55rem;
  margin-bottom: .8rem;
}
.admin-products-page .admin-filter-bar.has-reset {
  grid-template-columns: minmax(220px, 1.35fr) minmax(160px, .78fr) minmax(128px, .56fr) minmax(220px, .95fr) minmax(76px, .32fr);
}
.admin-products-page .admin-filter-bar > * {
  min-width: 0;
}
.admin-products-search {
  position: relative;
  min-width: 0;
}
.admin-products-search > span {
  position: absolute;
  top: 50%;
  left: .7rem;
  z-index: 1;
  display: inline-flex;
  color: var(--muted);
  pointer-events: none;
  transform: translateY(-50%);
}
.admin-products-search input[type="search"].admin-filter-input {
  width: 100%;
  background-image: none;
  padding-left: 2.15rem;
}
.admin-products-page .admin-filter-input,
.admin-products-page .admin-filter-select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding-top: .48rem;
  padding-bottom: .48rem;
  font-size: .8rem;
}
.admin-products-page .admin-filter-bar .btn {
  width: 100%;
  min-width: 74px;
  min-height: 38px;
  justify-content: center;
  padding: .45rem .68rem;
  font-size: .78rem;
  white-space: nowrap;
}
.admin-products-page .admin-products-table {
  min-width: 900px;
  border-collapse: collapse;
  border-spacing: 0;
  background: rgba(255,255,255,.012);
}
.admin-products-page .admin-products-table thead th {
  padding: .45rem .65rem .55rem;
  border: 0;
  border-bottom: 1px solid rgba(148, 163, 184, .16);
  color: #a8a8ba;
  font-size: .7rem;
  letter-spacing: .02em;
  text-transform: none;
}
.admin-products-page .admin-products-table tbody td {
  padding: .55rem .65rem;
  border-bottom: 1px solid rgba(148, 163, 184, .12);
  background: transparent;
  font-size: .8rem;
}
.admin-products-page .admin-products-table tbody td:first-child {
  border-left: 0;
  border-radius: 0;
}
.admin-products-page .admin-products-table tbody td:last-child {
  border-right: 0;
  border-radius: 0;
}
.admin-products-page .admin-products-table tbody tr:hover td {
  background: rgba(139, 92, 246, .065);
}
.admin-products-page .admin-products-table th:nth-child(1),
.admin-products-page .admin-products-table td:nth-child(1) {
  width: 42px;
}
.admin-products-page .admin-products-table th:nth-child(2),
.admin-products-page .admin-products-table td:nth-child(2) {
  width: auto;
  min-width: 270px;
  max-width: none;
}
.admin-products-page .admin-products-table th:nth-child(3),
.admin-products-page .admin-products-table td:nth-child(3) {
  min-width: 145px;
}
.admin-products-page .admin-products-table th:nth-child(4),
.admin-products-page .admin-products-table td:nth-child(4) {
  width: 150px;
  min-width: 150px;
}
.admin-products-page .admin-products-table th:nth-child(5),
.admin-products-page .admin-products-table td:nth-child(5) {
  width: 155px;
  min-width: 155px;
}
.admin-products-page .admin-products-table th:nth-child(6),
.admin-products-page .admin-products-table td:nth-child(6) {
  width: 96px;
  min-width: 96px;
}
.admin-products-page .admin-products-table th:nth-child(7),
.admin-products-page .admin-products-table td:nth-child(7) {
  width: 58px;
  min-width: 58px;
  text-align: center;
}
.admin-product-cell {
  display: flex;
  align-items: center;
  gap: .7rem;
  min-width: 0;
}
.admin-product-cell__image {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 5px;
}
.admin-product-cell__copy {
  min-width: 0;
}
.admin-product-cell__title {
  display: flex;
  align-items: center;
  gap: .38rem;
  min-width: 0;
}
.admin-product-cell__title > a {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-product-cell__title .badge-mini {
  flex: 0 0 auto;
  white-space: nowrap;
}
.admin-products-page .admin-product-slug {
  margin-top: .18rem;
}
.admin-products-page .admin-product-slug code {
  display: block;
  max-width: 280px;
  overflow: hidden;
  font-size: .68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-product-delivery {
  display: flex;
  align-items: center;
  gap: .38rem;
  color: var(--text);
  font-weight: 500;
}
.admin-product-delivery + small,
.admin-product-stock {
  display: block;
  margin-top: .2rem;
  font-size: .68rem;
}
.admin-products-page .admin-status-pill {
  gap: .35rem;
  padding: .28rem .5rem;
  border-radius: 5px;
  font-size: .7rem;
}
.admin-products-page .admin-status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 7px currentColor;
}
.admin-products-page .admin-product-row-actions {
  display: table-cell;
  width: 58px;
  min-width: 58px;
  white-space: normal;
}
.admin-products-page .admin-product-row-actions > .admin-action-trigger {
  display: inline-flex;
  width: 34px;
  min-width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  border-radius: 10px;
  background: rgba(255,255,255,.025);
}
.admin-products-page .admin-product-row-actions > .admin-action-trigger[aria-expanded="true"] {
  border-color: rgba(139, 92, 246, .5);
  background: rgba(139, 92, 246, .14);
  color: #ddd6fe;
}
.admin-action-menu {
  position: fixed;
  z-index: 2100;
  width: min(230px, calc(100vw - 16px));
  padding: .35rem;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 12px;
  background: #171722;
  box-shadow: 0 18px 44px rgba(var(--shadow-ink),.48);
}
.admin-action-menu[hidden] {
  display: none !important;
}
.admin-action-menu__form {
  display: block;
  margin: 0;
}
.admin-action-menu__item {
  display: flex;
  align-items: center;
  gap: .65rem;
  width: 100%;
  min-height: 36px;
  padding: .52rem .62rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: .8rem;
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.admin-action-menu__item:hover,
.admin-action-menu__item:focus-visible {
  outline: none;
  background: rgba(139, 92, 246, .13);
  color: #ede9fe;
}
.admin-action-menu__item:disabled,
.admin-action-menu__item[aria-disabled="true"] {
  color: #71717f;
  cursor: not-allowed;
}
.admin-action-menu__item:disabled:hover,
.admin-action-menu__item[aria-disabled="true"]:hover {
  background: transparent;
}
.admin-action-menu__item--danger {
  color: #fca5a5;
}
.admin-action-menu__item--danger:hover,
.admin-action-menu__item--danger:focus-visible {
  background: rgba(239, 68, 68, .12);
  color: #fecaca;
}
.admin-action-menu__separator {
  height: 1px;
  margin: .3rem .25rem;
  background: rgba(148, 163, 184, .16);
}
@media (max-width: 1180px) {
  .admin-products-page .admin-filter-bar,
  .admin-products-page .admin-filter-bar.has-reset {
    grid-template-columns: minmax(220px, 1fr) minmax(160px, .72fr) minmax(128px, .56fr);
  }
  .admin-products-page .admin-filter-bar select[name="delivery_stock"] {
    grid-column: 1 / -1;
  }
  .admin-products-page .admin-filter-bar.has-reset select[name="delivery_stock"] {
    grid-column: span 2;
  }
  .admin-products-page .admin-filter-bar .btn {
    width: 100%;
    min-width: 0;
  }
}
@media (max-width: 720px) {
  .admin-body .admin-file-picker--compact {
    flex-direction: row;
    flex-wrap: nowrap;
  }
  .admin-body .admin-file-picker--compact .admin-file-picker__button {
    width: auto;
  }
  .admin-products-page .admin-products-page__header h1 {
    font-size: 1.05rem;
  }
  .admin-products-page .admin-products-page__header .admin-header-actions {
    flex-direction: row;
    align-items: center;
    padding-right: 0;
  }
  .admin-products-page .admin-products-page__header .admin-header-actions .btn {
    width: auto;
  }
  .admin-products-page .admin-filter-bar {
    display: flex;
  }
  .admin-tool-actions,
  .admin-tool-actions .inline-form,
  .admin-products-page .admin-product-tools-primary .admin-tool-actions,
  .admin-products-page .admin-product-tools-primary .admin-tool-actions > .inline-form {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }
  .admin-tool-actions .admin-file-picker--compact,
  .admin-products-page .admin-product-tools-primary .admin-file-picker--compact {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
  }
  .admin-tool-actions .admin-file-picker__button,
  .admin-products-page .admin-product-tools-primary .admin-file-picker__button {
    width: auto;
  }
  .admin-tool-actions .inline-form > .btn,
  .admin-products-page .admin-product-tools-primary .inline-form > .btn {
    width: 100%;
  }
  .admin-products-page .admin-products-search,
  .admin-products-page .admin-filter-bar .admin-filter-select,
  .admin-products-page .admin-filter-bar .btn {
    width: 100%;
  }
  .admin-products-page .admin-products-table {
    min-width: 0;
    border-spacing: 0;
  }
  .admin-products-page .admin-products-table tbody tr {
    overflow: visible;
    padding: .65rem;
    border-radius: var(--admin-product-radius);
    background: linear-gradient(135deg, rgba(255,255,255,.025), rgba(255,255,255,.012));
  }
  .admin-products-page .admin-products-table tbody td,
  .admin-products-page .admin-products-table tbody td:first-child,
  .admin-products-page .admin-products-table tbody td:last-child {
    width: 100%;
    min-width: 0;
    padding: .4rem 0;
    border: 0;
    border-bottom: 1px dashed rgba(148, 163, 184, .14);
    border-radius: 0;
    background: transparent;
    text-align: left;
  }
  .admin-products-page .admin-products-table tbody td:last-child {
    border-bottom: 0;
  }
  .admin-products-page .admin-product-cell__image {
    width: 56px;
    height: 56px;
  }
  .admin-products-page .admin-products-table td.admin-product-row-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
  }
  .admin-products-page .admin-products-table td.admin-product-row-actions::before {
    margin-right: auto;
  }
  .admin-products-page .admin-products-table td.admin-product-row-actions > .admin-action-trigger {
    flex: 0 0 auto;
    width: 40px;
    min-width: 40px;
    height: 40px;
  }
}

/* ===== Product reviews ===== */
/* ดาวให้คะแนนแบบกดได้ (storefront) — เรียง 5→1 ใน DOM + row-reverse ให้ดาว 1 อยู่ซ้าย
   ว่าง = เทา, เลือก/hover = เหลืองทอง */
.star-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; }
.star-input input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.star-input label {
  font-size: 22px;
  line-height: 1;
  color: #4b5563;
  cursor: pointer;
  padding: 0 2px;
  transition: color .12s, transform .12s;
}
.star-input label:hover,
.star-input label:hover ~ label,
.star-input input:checked ~ label { color: #f5b301; }
.star-input label:hover { transform: scale(1.1); }
.star-input input:focus-visible + label { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* ดาวแบบแสดงผลอย่างเดียว (admin table) */
.review-stars { white-space: nowrap; }
.star { color: #4b5563; font-size: 1em; }
.star.is-on { color: #f5b301; }

/* บล็อกรีวิวใต้รายการสินค้า — ดาว inline + ปุ่มส่งแถวเดียว, textarea ซ่อนหลัง toggle */
.item-review {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border, rgba(255,255,255,.1));
}
.item-review__form { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; }
.item-review__rate-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.item-review__label { font-weight: 600; font-size: .85rem; }
.item-review__submit { padding: .34rem .7rem; font-size: .8rem; }

.item-review__more-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  width: fit-content;
  cursor: pointer; list-style: none; user-select: none;
  color: var(--muted, #9ca3af); font-size: .82rem; font-weight: 500;
}
.item-review__more-toggle::-webkit-details-marker { display: none; }
.item-review__more-toggle:hover { color: var(--text, #e5e7eb); }
.item-review__more-plus { display: inline-block; font-size: 1.1em; line-height: 1; transition: transform .15s; }
.item-review__more[open] .item-review__more-plus { transform: rotate(45deg); }
.item-review__comment-wrap { position: relative; margin-top: 8px; width: 100%; }
.item-review__comment {
  width: 100%;
  resize: vertical;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: .55rem 54px .55rem .8rem;
  font-size: .88rem;
}
.item-review__comment:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.item-review__counter {
  position: absolute; right: 12px; bottom: 9px;
  font-size: .74rem; color: var(--muted, #9ca3af); pointer-events: none;
}

/* สถานะรีวิวแล้ว — มือถือ (default): เรียงเป็นบรรทัด  ดาว|ป้าย / คอมเมนต์ / ปุ่มแก้ไข */
.item-review--done { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; }
.item-review__toggle { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.item-review__done { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.item-review__done-stars { font-size: 18px; line-height: 1; white-space: nowrap; }
.item-review__sep { flex: 0 0 auto; width: 1px; height: 14px; background: var(--border); }
.item-review__done-label { font-size: .85rem; color: var(--muted, #9ca3af); }
.item-review__edit-link {
  display: inline-flex; align-items: center; gap: 5px;
  cursor: pointer; user-select: none;
  font-size: .82rem; font-weight: 500; color: var(--muted, #9ca3af);
}
.item-review__edit-link:hover { color: var(--text, #e5e7eb); }
.item-review__edit-ico { display: inline-flex; }
.item-review__edit-link .lbl-close { display: none; }
.item-review__toggle:focus-visible ~ .item-review__edit-link {
  outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px;
}

/* ชิปแสดงคอมเมนต์ (อ่านอย่างเดียว) */
.item-review__chip {
  display: inline-block;
  max-width: 100%; word-break: break-word; white-space: pre-wrap;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 11px;
  font-size: .82rem; color: var(--text);
}

/* ฟอร์มแก้ — ซ่อนไว้ เปิดเมื่อ checkbox ติ๊ก (กด "แก้ไข") */
.item-review__edit-body { display: none; width: 100%; }
.item-review__toggle:checked ~ .item-review__edit-body { display: block; }
.item-review__toggle:checked ~ .item-review__edit-link .lbl-open { display: none; }
.item-review__toggle:checked ~ .item-review__edit-link .lbl-close { display: inline; }

/* มือถือ: ดาวเล็กลง + คอมเมนต์ยาวตัด 2 บรรทัดแล้วใส่ … (เห็นเต็มตอนกดแก้ไข/hover title) */
@media (max-width: 560px) {
  .star-input label { font-size: 20px; }
  .item-review__chip {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
  }
}

/* เดสก์ท็อป: ดาว+ปุ่มแถวเดียว · done+แก้ไขแถวเดียว · คอมเมนต์/ฟอร์มเต็มกว้างบรรทัดถัดไป (เหมือนเดิม) */
@media (min-width: 561px) {
  .item-review__form { flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 12px; row-gap: 9px; }
  .item-review__rate-row { order: 1; flex: 1 1 auto; }
  .item-review__submit { order: 2; }
  .item-review__form > .field-error { order: 3; flex-basis: 100%; }
  .item-review__more { order: 4; flex-basis: 100%; }

  /* done ใช้ grid: row1 = ดาว|ป้าย ... แก้ไข, row2 = ชิป (หดตามเนื้อหาด้วย justify-self:start), row3 = ฟอร์ม */
  .item-review--done { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 12px; row-gap: 9px; }
  .item-review__done { grid-row: 1; grid-column: 1; }
  .item-review__edit-link { grid-row: 1; grid-column: 2; justify-self: end; }
  .item-review__chip { grid-column: 1 / -1; justify-self: start; }
  .item-review__edit-body { grid-column: 1 / -1; }
}

/* สถิติรีวิวหัวหน้าแอดมิน + แถวที่ถูกซ่อน */
.review-stat { text-align: right; }
.review-stat__value { display: block; font-size: 1.4rem; font-weight: 600; }
.review-stat__star { color: #f5b301; }
.review-stat__label { font-size: .8rem; color: var(--muted, #9ca3af); }
.data-table tr.is-dimmed { opacity: .55; }

/* ============================================================
   Discord Quest AUTO — placeholder landing (coming soon)
   ============================================================ */
.qa-page { padding-top: 3rem; padding-bottom: 4rem; }

.qa-hero {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 3.5rem;
  padding: 3rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    radial-gradient(120% 140% at 50% 0%, rgba(168, 85, 247, .16) 0%, rgba(168, 85, 247, 0) 60%),
    var(--bg-2);
}
.qa-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .85rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: var(--fs-sm);
  color: var(--accent);
  background: var(--primary-soft);
}
.qa-hero__title {
  margin: 1.1rem 0 .75rem;
  font-size: var(--fs-4xl);
  line-height: 1.1;
  font-weight: var(--fw-bold);
  letter-spacing: -.5px;
}
.qa-hero__accent {
  background: var(--brand-name-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.qa-hero__subtitle {
  margin: 0 auto 1.75rem;
  max-width: 460px;
  color: var(--muted);
  font-size: var(--fs-lg);
  line-height: 1.7;
}
.qa-hero__actions {
  display: flex;
  gap: .75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.qa-countdown {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: .5rem;
  margin: 0 auto 2rem;
}
.qa-countdown__box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  min-width: 64px;
}
.qa-countdown__num {
  font-family: 'Chakra Petch', var(--font-body);
  font-size: 1.9rem;
  font-weight: var(--fw-bold);
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.qa-countdown__label {
  font-size: var(--fs-xs);
  color: var(--muted);
}
.qa-countdown__sep {
  align-self: center;
  padding-top: .5rem;
  font-size: 1.5rem;
  font-weight: var(--fw-bold);
  color: var(--border-strong);
}
.qa-countdown.is-done { opacity: .5; }

@media (max-width: 640px) {
  .qa-hero { padding: 2.25rem 1.25rem; }
  .qa-hero__title { font-size: var(--fs-3xl); }
  .qa-countdown__box { min-width: 0; flex: 1; }
  .qa-countdown__num { font-size: 1.4rem; }
  .qa-countdown__sep { display: none; }
}

/* ===== Discord Quest AUTO — app ===== */
.qa-app { max-width: 640px; margin: 0 auto; padding: var(--space-5) 0; display: flex; flex-direction: column; gap: var(--space-4); }
.qa-app__head { text-align: center; }
.qa-app__title { font-family: var(--font-display); font-size: var(--fs-3xl); line-height: 1.15; margin: 0 0 var(--space-2); }
.qa-app__sub { color: var(--muted); font-size: var(--fs-sm); margin: 0; }
.qa-badge { display: inline-block; padding: 2px 10px; border-radius: var(--radius-full); font-size: var(--fs-sm); font-weight: 600; }
.qa-badge--beta { background: var(--accent-soft); color: var(--accent); }
.qa-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-4); box-shadow: var(--shadow-sm); }
.qa-label { display: block; font-weight: 600; margin-bottom: var(--space-2); }
.qa-list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-2); }
.qa-list-head .qa-label { margin-bottom: 0; }
.qa-linkbtn { background: none; border: none; color: var(--accent); font-weight: 600; font-size: var(--fs-sm); cursor: pointer; padding: 4px 6px; border-radius: var(--radius-sm); }
.qa-linkbtn:hover { background: var(--accent-soft); }
.qa-textarea { width: 100%; box-sizing: border-box; resize: vertical; padding: var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg-3); color: var(--text); font-family: monospace; font-size: var(--fs-sm); }
/* เลขขั้นตอนแบบเดียวกับหน้า checkout (วงกลม + ตัวเลข) */
.qa-steplabel { display: flex; align-items: center; gap: 8px; }
.qa-note { color: var(--muted); font-size: var(--fs-sm); margin: var(--space-2) 0 var(--space-3); display: flex; align-items: center; gap: 6px; }
.qa-btn-block { width: 100%; justify-content: center; }
.qa-hidden { display: none !important; }
.qa-list { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-3); max-height: 360px; overflow-y: auto; }
.qa-item { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out); }
.qa-item:hover { border-color: var(--accent); }
.qa-item:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
/* checkbox custom */
.qa-item input[type=checkbox] { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; margin: 0; flex: 0 0 auto; border: 2px solid var(--border-strong); border-radius: 6px; background: var(--bg-3); cursor: pointer; position: relative; transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out); }
.qa-item input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
.qa-item input[type=checkbox]:checked::after { content: ''; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.qa-item input[type=checkbox]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.qa-item__body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.qa-item__name { font-weight: 600; }
.qa-item__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; color: var(--muted); font-size: var(--fs-sm); }
.qa-item__sep { color: var(--border-strong); }
/* เควสใกล้หมดเขต (≤ 3 วัน) — สีเหลืองช่วยให้เลือกทำก่อนเควสอื่น */
.qa-item__exp { display: inline-flex; align-items: center; gap: 4px; }
.qa-item__exp--soon { color: #d08700; font-weight: 600; }
.qa-item__exp--soon .lucide { flex: 0 0 auto; }
.qa-item__price { flex: 0 0 auto; align-self: center; padding: 4px 10px; border-radius: var(--radius-full); background: var(--primary-soft); color: var(--accent); font-weight: 700; font-size: var(--fs-sm); white-space: nowrap; }
/* เควสที่ยอดชนเพดานราคาเหมาแล้ว = เพิ่มไปก็ไม่คิดเงิน */
.qa-item__price s { opacity: .5; font-weight: 500; margin-right: 3px; }
.qa-item__price--free { background: var(--success-soft); color: var(--success); }

/* ราคาเหมาที่หัวหน้า — เด่นด้วยสี ไม่ใช่ด้วยกรอบ (กรอบทำให้แข่งกับชื่อหน้า) */
.qa-app__sep { color: var(--border-strong); margin: 0 2px; }
.qa-deal { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); font-weight: 600; }
.qa-deal strong { font-weight: 800; }
.qa-deal .lucide { flex: 0 0 auto; }

/* ยอดประหยัดข้างปุ่ม "เลือกทั้งหมด" — โผล่เฉพาะตอนประหยัดได้จริง */
.qa-savehint { display: inline-block; margin-left: 5px; padding: 1px 7px; border-radius: var(--radius-full); background: var(--success-soft); color: var(--success); font-size: var(--fs-xs); font-weight: 700; }
.qa-empty { color: var(--muted); text-align: center; padding: var(--space-4); }
.qa-summary { display: flex; justify-content: space-between; align-items: center; padding: var(--space-3) 0; border-top: 1px solid var(--border); margin-bottom: var(--space-3); }
.qa-summary__total { font-size: var(--fs-lg); }
/* โค้ดส่วนลด — ช่องกรอก (เข้าชุดกับช่อง token) สลับเป็นชิปสีเขียวเมื่อใช้แล้ว */
.qa-coupon { margin-bottom: var(--space-2); }
.qa-coupon__row { position: relative; display: flex; gap: var(--space-2); align-items: center; }
.qa-coupon__lead { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); display: inline-flex; color: var(--muted); pointer-events: none; }
.qa-coupon__input { flex: 1; min-width: 0; box-sizing: border-box; padding: 8px var(--space-3) 8px 36px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg-3); color: var(--text); font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .5px; }
.qa-coupon__input::placeholder { text-transform: none; letter-spacing: normal; }
.qa-coupon__input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.qa-coupon__apply { flex: 0 0 auto; padding: 0 var(--space-3); align-self: stretch; border: 0; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: var(--fs-sm); cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.qa-coupon__apply:hover { background: var(--accent); color: #fff; }
.qa-coupon__apply:disabled { opacity: .55; cursor: default; }
.qa-coupon__applied { display: flex; align-items: center; gap: var(--space-2); padding: 6px 10px 6px var(--space-3); border: 1px solid var(--success); border-radius: var(--radius); background: var(--success-soft); }
.qa-coupon__chk { display: inline-flex; flex: 0 0 auto; color: var(--success); }
.qa-coupon__info { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.qa-coupon__info b { color: var(--success); font-weight: 800; letter-spacing: .5px; }
.qa-coupon__save { color: var(--success); font-size: var(--fs-sm); font-weight: 700; }
.qa-coupon__remove { flex: 0 0 auto; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--success); font-size: 20px; line-height: 1; cursor: pointer; }
.qa-coupon__remove:hover { background: rgba(0, 0, 0, .1); }
.qa-coupon__msg { margin-top: var(--space-2); font-size: var(--fs-sm); }
.qa-coupon__msg--ok { color: var(--success); }
.qa-coupon__msg--error { color: var(--danger); }
.qa-coupon__msg--info { color: var(--muted); }
.qa-summary__was { color: var(--muted); text-decoration: line-through; font-size: var(--fs-sm); font-weight: 400; margin: 0 2px; }
.qa-result { display: flex; flex-direction: column; gap: var(--space-2); }
.qa-result__row { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius); background: var(--bg-3); }
.qa-result__row.is-ok { border-left: 3px solid var(--success); }
.qa-result__row.is-fail { border-left: 3px solid var(--danger); }
.qa-result__name { font-weight: 600; flex: 1; }
.qa-result__detail { color: var(--muted); font-size: var(--fs-sm); }
.qa-result__summary { margin-top: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--border); text-align: center; }
.qa-result__fail { color: var(--danger); text-align: center; padding: var(--space-3); }
.qa-result__refund { text-align: center; color: var(--muted); }
.qa-msg { padding: var(--space-3); border-radius: var(--radius); font-size: var(--fs-sm); }
.qa-msg--info { background: var(--accent-soft); color: var(--accent); }
.qa-msg--error { background: var(--danger-soft); color: var(--danger); }
.qa-msg--success { background: var(--success-soft); color: var(--success); }

/* step 1 head: title/note ซ้าย · ปุ่มวิธีหา token ขวา */
.qa-step-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.qa-step-head__main { min-width: 0; }
.qa-step-head .qa-label { margin-bottom: 6px; }
.qa-step-head .qa-note { margin: 0; }
.qa-help { display: inline-flex; align-items: center; gap: 5px; background: none; border: none; color: var(--accent); font-weight: 600; font-size: var(--fs-xs); cursor: pointer; padding: 2px 5px; border-radius: var(--radius-sm); white-space: nowrap; }
.qa-help:hover { background: var(--accent-soft); }
.qa-help__q { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid currentColor; font-size: 9px; font-weight: 700; }
@media (max-width: 560px) { .qa-step-head { flex-direction: column; gap: 8px; } }

/* pay bar */
@media (max-width: 640px) {
  .qa-paybar { position: sticky; bottom: 0; z-index: 5; background: var(--bg-2); margin: 0 calc(-1 * var(--space-4)) calc(-1 * var(--space-4)); padding: var(--space-2) var(--space-4) var(--space-4); box-shadow: 0 -6px 16px rgba(var(--shadow-ink), .18); }
  .qa-paybar .qa-summary { margin-bottom: var(--space-2); }
}

/* popup วิธีหา Token */
.qa-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: var(--space-4); }
.qa-modal__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); }
.qa-modal__panel { position: relative; width: 100%; max-width: 720px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 20px 60px rgba(var(--shadow-ink), .45); overflow: hidden; }
.qa-modal__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
.qa-modal__title { margin: 0; font-size: var(--fs-lg); }
.qa-modal__close { display: inline-flex; align-items: center; justify-content: center; background: none; border: none; color: var(--muted); line-height: 1; cursor: pointer; padding: 6px; border-radius: var(--radius-sm); }
.qa-modal__close:hover { background: var(--bg-3); color: var(--text); }
.qa-modal__video { padding: var(--space-4); }
.qa-modal__frame { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; }
.qa-modal__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* dim step ที่ทำผ่านแล้ว */
.qa-card.is-dim { opacity: .55; }
/* live-check รูปแบบ token (มุมขวาบนของหัวข้อ step 1) */
.qa-token-hint { font-size: var(--fs-sm); margin: 0; display: flex; align-items: center; gap: 6px; white-space: nowrap; text-align: right; }
.qa-token-hint--ok { color: var(--success); }
.qa-token-hint--warn { color: var(--muted); }
/* แถวก่อนปุ่มตรวจ: ข้อความปลอดภัย + ปุ่มวิธีหา token */
.qa-prefetch { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-3); }
.qa-prefetch .qa-note { margin: 0; }
@media (max-width: 480px) { .qa-prefetch { flex-direction: column; align-items: flex-start; gap: 8px; } }
/* progress รวม (step ผลลัพธ์) */
.qa-progress { height: 6px; border-radius: var(--radius-full); background: var(--bg-3); overflow: hidden; margin: var(--space-2) 0 var(--space-3); }
.qa-progress--slim { height: 4px; }
.qa-progress__bar { height: 100%; background: var(--brand-name-gradient); border-radius: inherit; width: 0; transition: width 240ms linear; }
/* มือถือ: ปล่อยหน้า scroll ปกติ (เลี่ยง nested scroll ซ้อน sticky bar) */
@media (max-width: 640px) { .qa-list { max-height: none; overflow: visible; } }

/* skeleton ระหว่างโหลดรายการเควส */
.qa-skel { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); }
.qa-skel + .qa-skel { margin-top: var(--space-2); }
.qa-skel__box { width: 20px; height: 20px; border-radius: 6px; flex: 0 0 auto; }
.qa-skel__img { width: 40px; height: 40px; border-radius: var(--radius); flex: 0 0 auto; }
.qa-skel__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.qa-skel__line { height: 10px; border-radius: 6px; }
.qa-skel__line--lg { width: 60%; }
.qa-skel__line--sm { width: 35%; }
.qa-skel__price { width: 62px; height: 24px; border-radius: var(--radius-full); flex: 0 0 auto; }
.qa-skel__box, .qa-skel__img, .qa-skel__line, .qa-skel__price {
  background: linear-gradient(90deg, var(--bg-3) 25%, var(--border) 37%, var(--bg-3) 63%);
  background-size: 400% 100%; animation: qa-shimmer 1.2s ease-in-out infinite;
}
@keyframes qa-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ===== การ์ด 1: สถานะยืนยัน (โปรไฟล์ + token ปิดตา) ===== */
#qa-confirmed .qa-profile { margin-bottom: var(--space-3); }
#qa-confirmed .qa-profile__body { flex: 1; min-width: 0; }
.qa-profile__user { font-size: var(--fs-sm); color: var(--muted); }
.qa-ready { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; margin-left: auto; color: var(--success); font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; }
.qa-ready__ic { flex: 0 0 auto; }

/* banner "กำลังทำเควสอยู่" — งานรันฝั่งเซิร์ฟเวอร์ ผู้ใช้กลับมาดูต่อได้ */
.qa-resume { display: flex; flex-direction: column; gap: var(--space-2); }
.qa-resume__row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3); border-radius: var(--radius);
  border: 1px solid rgba(157, 107, 225, .45); background: rgba(157, 107, 225, .08);
}
.qa-resume__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.qa-resume__names { color: var(--muted); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-resume__btn { flex: 0 0 auto; }
@media (max-width: 480px) {
  .qa-resume__row { flex-wrap: wrap; }
  .qa-resume__btn { flex: 1 0 100%; justify-content: center; }
}

/* เควสที่กำลังทำอยู่ — ติ๊กซื้อซ้ำไม่ได้ */
.qa-item--running { opacity: .6; cursor: default; }
.qa-item--running:hover { border-color: var(--border); }
.qa-item--running input[type=checkbox] { cursor: not-allowed; }
.qa-item__running {
  flex: 0 0 auto; align-self: center; display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--radius-full);
  background: var(--accent-soft); color: var(--accent);
  font-weight: 700; font-size: var(--fs-xs); white-space: nowrap;
}

/* ของรางวัลในรายการเควส */
.qa-item__reward { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); font-size: var(--fs-sm); }
.qa-item__reward .qa-ic { flex: 0 0 auto; }

/* badge ประหยัดข้างยอดรวม */
.qa-savebadge { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: var(--radius-full); background: var(--success-soft); color: var(--success); font-size: var(--fs-xs); font-weight: 700; }

/* หลอดสีรวม (1 ช่อง/เควส) */

/* ประเภทเควส + หลอดเวลาแต่ละรายการ (result card) */
.qa-prow__meta { color: var(--muted); font-size: var(--fs-sm); }
.qa-prow--failed .qa-prow__detail { color: var(--danger); }
.qa-itembar { display: block; height: 6px; border-radius: var(--radius-full); background: var(--bg-2); overflow: hidden; }
/* JS ขยับ width ทุกเฟรม — transition สั้น ๆ ไว้กลบจังหวะที่ค่าจริงจาก Discord กระโดดเข้ามา */
.qa-itembar__fill { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--brand-name-gradient); transition: width 240ms linear; }
.qa-prow--failed .qa-itembar__fill { background: var(--danger); }
/* ข้อความปลอดภัยเล็กเท่าปุ่มวิธีหา token + แสดงต่อเนื่องบรรทัดเดียว */
.qa-prefetch .qa-note { font-size: var(--fs-xs); }

/* ช่อง token เดียว: บรรทัดเดียว ปิดตา + ไอคอนตาในช่อง */
.qa-tokenfield { position: relative; margin-bottom: var(--space-3); }
.qa-tokenfield__input { width: 100%; box-sizing: border-box; padding: var(--space-3) 40px var(--space-3) var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg-3); color: var(--text); font-family: monospace; font-size: var(--fs-sm); }
.qa-tokenfield__input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.qa-tokenfield__eye { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted); cursor: pointer; }
.qa-tokenfield__eye:hover { color: var(--text); background: var(--bg-2); }

/* สรุปเงินในการ์ดผลลัพธ์ — คลาสของตัวเอง ไม่ใช้ .order-totals ร่วมกับหน้าออเดอร์ */
.qa-sum {
  /* auto-flow: เซลล์เงินคืนโผล่เฉพาะตอนมียอดคืน → กว้างเท่ากันทั้ง 2 และ 3 เซลล์ */
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: var(--space-2) 0;
}
.qa-sum__cell { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0 var(--space-2); }
.qa-sum__cell + .qa-sum__cell { border-left: 1px solid var(--border); }
.qa-sum__label { color: var(--muted); font-size: var(--fs-xs); }
.qa-sum__val { font-size: var(--fs-base); font-variant-numeric: tabular-nums; }

/* ปุ่มดูประวัติ: เตี้ยกว่าปุ่มหลัก แต่คงขอบม่วงแบบปุ่ม "สั่งซื้อทันที" · พื้นโปร่งไม่ทึบดำ */
.qa-foot .btn-buy-now {
  min-height: 2.5rem; padding-top: .5rem; padding-bottom: .5rem;
  font-size: var(--fs-sm);
  border-color: rgba(157, 107, 225, .62);
  background: rgba(157, 107, 225, .08);
  box-shadow: none;
}
.qa-foot .btn-buy-now:hover {
  border-color: rgba(211, 155, 232, .74);
  background: rgba(157, 107, 225, .16);
}

/* login gate */
.qa-login-card { text-align: center; }
.qa-login-card__icon { color: var(--muted); margin-bottom: var(--space-2); display: flex; justify-content: center; }
.qa-login-card__text { margin: 0 0 var(--space-4); color: var(--muted); }
.qa-login-card .qa-btn-block + .qa-btn-block { margin-top: var(--space-2); }

/* discord profile chip */
.qa-profile { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); margin-bottom: var(--space-3); background: var(--bg-3); border-radius: var(--radius); }
.qa-profile .qa-item__img { width: 36px; height: 36px; border-radius: var(--radius-full); }
/* min-width:0 = ให้ชื่อยาว ๆ หดและตัด ... ได้ ไม่งั้นมันดันป้าย "บัญชีพร้อมแล้ว" ทะลุขอบการ์ดบนมือถือ */
.qa-profile__body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.qa-profile__name, .qa-profile__user { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-profile__label { font-size: var(--fs-sm); color: var(--muted); }
.qa-profile__name { font-weight: 700; }

/* quest artwork */
.qa-item { align-items: center; }
.qa-item__img { width: 40px; height: 40px; border-radius: var(--radius); object-fit: cover; flex: 0 0 auto; background: var(--bg-3); }
/* ไม่มีอวาตาร์ → โลโก้ Discord (สี blurple) แทนตัวอักษรย่อ */
.qa-item__img--ph { display: inline-flex; align-items: center; justify-content: center; color: #5865f2; }
/* รูปในรายการเควส: สูงพอดี 3 บรรทัด (ชื่อ + ประเภท/เวลา + รางวัล) */
.qa-item > .qa-item__img { width: 60px; height: 60px; border-radius: 12px; }

/* live progress rows */
.qa-ohead { text-align: center; font-weight: 700; padding: var(--space-2) 0 var(--space-3); font-size: var(--fs-lg); }
.qa-ohead--ok { color: var(--success); }
.qa-ohead--warn { color: #d08700; }
.qa-ohead--fail { color: var(--danger); }
.qa-ohead--run { color: var(--muted); font-size: var(--fs-base); display: flex; gap: 8px; align-items: center; justify-content: center; }
/* หัวการ์ดตอนจบ: ไอคอนวงกลม + หัวข้อ + คำบรรยายรอง */
.qa-ohead--ok, .qa-ohead--warn, .qa-ohead--fail {
  display: flex; align-items: center; justify-content: center; gap: var(--space-3); text-align: left;
}
.qa-ohead__ic {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid currentColor;
}
.qa-ohead__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.qa-ohead__title { font-size: var(--fs-lg); }
.qa-ohead__sub { color: var(--muted); font-weight: 400; font-size: var(--fs-sm); }
/* ตัวเลข % / เวลา เปลี่ยนทุกเฟรม — tabular-nums กันบรรทัดขยับซ้ายขวา */
.qa-ohead__stat { font-variant-numeric: tabular-nums; }
.qa-ohead-box:empty { display: none; }
.qa-foot { display: flex; flex-direction: column; gap: var(--space-2); }
.qa-foot:empty { display: none; }
.qa-plist { display: flex; flex-direction: column; gap: var(--space-2); }
.qa-prow { display: flex; flex-direction: column; gap: 8px; padding: var(--space-3); border-radius: var(--radius); background: var(--bg-3); }
.qa-prow__main { display: flex; align-items: center; gap: var(--space-3); }
.qa-prow__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.qa-prow__name { font-weight: 600; }
.qa-prow__detail { color: var(--muted); font-size: var(--fs-sm); }
.qa-prow__badge { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-full); background: var(--bg-2); color: var(--muted); font-size: .72rem; font-weight: 600; white-space: nowrap; }
.qa-prow--processing .qa-prow__badge { color: var(--accent); }
.qa-prow--success .qa-prow__badge { color: var(--success); }
.qa-prow--failed .qa-prow__badge { color: var(--danger); }
.qa-prow__badge .qa-st { width: 14px; height: 14px; }
.qa-prow__badgeic { display: inline-flex; }
.qa-prow__badgetext { font-variant-numeric: tabular-nums; }
.qa-st { flex: 0 0 auto; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; border-radius: 50%; }
.qa-st .qa-ic { width: 68%; height: 68%; stroke-width: 3.5; }
/* สำเร็จ: วงกลมติ๊กทึบ (ไอคอนชุดเดียวกับ "บัญชีพร้อมแล้ว") — ตัวไอคอนเป็นวงกลมอยู่แล้ว ไม่ต้องมีพื้นหลัง */
.qa-st--ok { color: var(--success); }
.qa-st--ok .qa-ic { width: 100%; height: 100%; }
.qa-st--fail { color: #fff; background: var(--danger); }
.qa-st--wait { border: 2px solid var(--border-strong); box-sizing: border-box; }
.qa-st--spin { border: 2px solid var(--accent-soft); border-top-color: var(--accent); box-sizing: border-box; animation: qa-spin 0.7s linear infinite; }
@keyframes qa-spin { to { transform: rotate(360deg); } }
/* มือถือ: บีบหัวหน้า + รายการเควสให้กระชับ */
@media (max-width: 480px) {
  .qa-app__title { font-size: var(--fs-2xl); }
  .qa-item { gap: var(--space-2); padding: var(--space-2); }
  /* ป้ายราคายังต้องเห็น เพราะมันบอกว่าเควสไหน "ฟรี" จากราคาเหมา — ย่อลงแทนการซ่อน */
  .qa-item__price { padding: 3px 8px; font-size: var(--fs-xs); }
  .qa-item__price s { display: none; }
  .qa-item > .qa-item__img { width: 44px; height: 44px; border-radius: 10px; }
  .qa-item__name { font-size: var(--fs-sm); }
  .qa-item__meta, .qa-item__reward { font-size: var(--fs-xs); }
  .qa-ready { font-size: var(--fs-xs); gap: 4px; }
  .qa-prow__name { font-size: var(--fs-sm); }
  .qa-prow__meta, .qa-prow__detail { font-size: var(--fs-xs); }
  /* badge "สำเร็จใน ~..." ยาวเกินจะเบียดชื่อเควส → ดันลงบรรทัดของตัวเองเสมอ */
  .qa-prow__main { flex-wrap: wrap; }
  .qa-prow__badge { flex: 1 0 100%; justify-content: center; }
}

/* quest orders on /my/orders */
.qo-section { margin-bottom: var(--space-6); }
.qo-heading-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-3); }
.qo-heading-row .qo-heading { margin: 0; }
.qo-heading { display: flex; align-items: center; gap: 8px; font-size: var(--fs-lg); margin: 0 0 var(--space-3); }
.qo-list { display: flex; flex-direction: column; gap: var(--space-3); }
/* หัวข้อคั่นวันในหน้าประวัติ (วันนี้ / เมื่อวาน / 12 ก.ค. 2569) */
.day-group + .day-group { margin-top: var(--space-5); }
.day-group__label {
  font-size: var(--fs-sm); font-weight: 700; color: var(--muted);
  margin: 0 0 var(--space-2); padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}

/* การ์ดออเดอร์เควส — ใช้โครง .my-order-card แต่ไม่ได้กดได้ทั้งใบ จึงไม่ต้องมี hover ยกการ์ด */
.qcard:hover { border-color: var(--border); transform: none; }
/* รายชื่อเควสในการ์ด: chip แถวเดียววนบรรทัด — เห็นสถานะรายตัวโดยไม่กินที่ */
.qo-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.qo-chip {
  display: inline-flex; align-items: center; gap: 5px; min-width: 0;
  padding: 3px 10px; border-radius: var(--radius-full);
  background: var(--bg-3); color: var(--muted);
  font-size: var(--fs-xs); font-weight: 600;
}
.qo-chip--success { color: var(--success); }
.qo-chip--failed { color: var(--danger); }
.qo-chip--processing { color: var(--accent); }
.qo-chip .qa-st { width: 13px; height: 13px; }
.qo-badge { font-size: var(--fs-sm); font-weight: 700; padding: 2px 10px; border-radius: var(--radius-full); }
.qo-badge--processing { background: var(--accent-soft); color: var(--accent); }
.qo-badge--completed { background: var(--success-soft); color: var(--success); }
.qo-badge--partial { background: #fff4e0; color: #d08700; }
.qo-badge--failed { background: var(--danger-soft); color: var(--danger); }
/* มือถือ: ปุ่มท้ายการ์ดเต็มความกว้าง กดง่ายกว่า */
@media (max-width: 480px) {
  .qcard .my-order-meta-row { flex-wrap: wrap; }
  .qcard .my-order-meta-row .btn { width: 100%; justify-content: center; }
}
