/* ============ ธีม: dark = ดำ+แดง / light = ขาว+ดำ ============ */
:root,
[data-theme='light'] {
  --bg: #F4EBDD;
  --bg-2: #EEE5D6;
  --card: #FFFDF8;
  --card-2: #F7F0E4;
  --border: #D9CCB6;
  --text: #171717;
  --muted: #746D62;
  --accent: #A88745;
  --accent-2: #806638;
  --btn-bg: linear-gradient(135deg, #E5CB88 0%, #D6B66E 48%, #A88745 100%);
  --btn-fg: #17140D;
  --ok: #17884d;
  --warn: #b97400;
  --info: #1769c2;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.10);
  --glow: radial-gradient(60% 50% at 50% 0%, rgba(168, 135, 69, 0.12), transparent 70%);
}

[data-theme='dark'] {
  --bg: #101012;
  --bg-2: #18181B;
  --card: #202024;
  --card-2: #29292E;
  --border: #393940;
  --text: #F4EBDD;
  --muted: #B7B0A3;
  --accent: #D6B66E;
  --accent-2: #A88745;
  --btn-bg: linear-gradient(135deg, #E5CB88 0%, #D6B66E 48%, #A88745 100%);
  --btn-fg: #17140D;
  --ok: #2fbf71;
  --warn: #f5a524;
  --info: #4da3ff;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.48);
  --glow: radial-gradient(60% 50% at 50% 0%, rgba(214, 182, 110, 0.20), transparent 70%);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--glow) top center / 100% 480px no-repeat, var(--bg);
  color: var(--text);
  font-family: 'Noto Sans Thai', 'Sarabun', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .75em; }
.muted { color: var(--muted); }
.container { width: min(1100px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(560px, 100% - 32px); margin-inline: auto; }
.mt { margin-top: 20px; }
.mb { margin-bottom: 20px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; }

/* ============ หัวเว็บ / ท้ายเว็บ ============ */
.site-header {
  position: relative; top: 0; z-index: 50;
  background: transparent;
  border-bottom: 0;
}
.site-header .container { display: flex; align-items: center; gap: 14px; padding: 12px 0; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 1.2rem; text-decoration: none; letter-spacing: .5px; }
.brand b { color: var(--accent); }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { text-decoration: none; padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: .95rem; }
.nav a:hover, .nav a.active { color: var(--text); background: var(--card-2); }
.user-chip { font-size: .85rem; color: var(--muted); max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-footer { border-top: 1px solid var(--border); margin-top: 48px; padding: 28px 0; color: var(--muted); font-size: .9rem; }

/* ============ ปุ่ม / ฟอร์ม ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 10px; padding: 10px 18px;
  background: var(--btn-bg); color: var(--btn-fg);
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; transition: transform .1s, filter .15s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--card-2); filter: none; }
.btn.danger { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn.sm { padding: 6px 12px; font-size: .85rem; border-radius: 8px; }
.btn.block { width: 100%; }
.icon-btn { width: 38px; height: 38px; padding: 0; font-size: 1.05rem; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: .88rem; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-2); color: var(--text); font: inherit;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea.input { min-height: 130px; resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; }

/* ============ การ์ด / ป้าย / แท็บ ============ */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; border: 1px solid currentColor; }
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }
.badge.info { color: var(--info); }
.badge.mute { color: var(--muted); }
.badge.red { color: var(--accent); }

.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--card-2); border-radius: 12px; border: 1px solid var(--border); flex-wrap: wrap; }
.tab { border: 0; background: transparent; color: var(--muted); padding: 8px 18px; border-radius: 9px; font: inherit; font-weight: 700; cursor: pointer; }
.tab.active { background: var(--btn-bg); color: var(--btn-fg); }

/* ============ หน้าร้าน ============ */
.hero { text-align: center; padding: 56px 0 28px; }
.hero p { color: var(--muted); max-width: 560px; margin-inline: auto; }
.hero .row { justify-content: center; margin-top: 18px; }
.hero h1 span { color: var(--accent); }

.features { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 18px 0 8px; }
.features .badge { color: var(--text); border-color: var(--border); background: var(--card); }

.zone-head { display: flex; align-items: center; gap: 12px; margin: 34px 0 14px; }
.zone-head .ico { font-size: 1.8rem; }
.zone-head h2 { margin: 0; }
.zone-head p { margin: 0; color: var(--muted); font-size: .9rem; }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.plan {
  position: relative; text-align: center; padding: 24px 16px 18px;
  background: var(--card); border: 1px solid var(--border); border-radius: 18px;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.plan:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.plan .days { font-size: 1.05rem; font-weight: 700; color: var(--muted); }
.plan .price { font-size: 2.5rem; font-weight: 800; margin: 6px 0 2px; }
.plan .price small { font-size: 1.1rem; color: var(--accent); margin-left: 2px; }
.plan .per { color: var(--muted); font-size: .82rem; margin-bottom: 14px; }
.plan .tag { position: absolute; top: 10px; right: 10px; font-size: .7rem; background: var(--accent); color: #fff; border-radius: 999px; padding: 2px 9px; font-weight: 700; }
.stock-dot { font-size: .78rem; margin-bottom: 12px; display: block; }
.stock-dot.in { color: var(--ok); }
.stock-dot.out { color: var(--warn); }

/* ============ ออเดอร์ / เช็คเอาท์ ============ */
.order { margin-bottom: 14px; }
.order.highlight { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.order-top { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.order-title { font-weight: 700; }
.order-meta { color: var(--muted); font-size: .85rem; }
.cred { margin-top: 14px; background: var(--bg-2); border: 1px dashed var(--accent); border-radius: 12px; padding: 14px; display: grid; gap: 10px; }
.cred-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cred-row .k { width: 88px; color: var(--muted); font-size: .85rem; }
.cred-row code { flex: 1; min-width: 140px; background: var(--card); padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); word-break: break-all; font-size: .95rem; }
.expiry { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .9rem; }

.summary { display: grid; gap: 8px; }
.summary .line { display: flex; justify-content: space-between; gap: 12px; }
.summary .total { font-size: 1.4rem; font-weight: 800; border-top: 1px solid var(--border); padding-top: 10px; }
.steps { padding-left: 20px; color: var(--muted); font-size: .92rem; margin: 0 0 14px; }
.bank-box { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: grid; gap: 8px; margin-bottom: 14px; }
.preview { max-width: 100%; max-height: 260px; border-radius: 10px; border: 1px solid var(--border); margin-bottom: 12px; display: block; }

/* ============ แอดมิน ============ */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.stat .v { font-size: 1.7rem; font-weight: 800; }
.stat .v.red { color: var(--accent); }
.stat .l { color: var(--muted); font-size: .85rem; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 10px; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; min-width: 0; }
.bar i { display: block; width: 100%; background: var(--accent); border-radius: 6px 6px 0 0; min-height: 3px; }
.bar span { font-size: .68rem; color: var(--muted); }
.bar em { font-size: .68rem; font-style: normal; font-weight: 700; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; background: var(--card-2); }
tr:last-child td { border-bottom: 0; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ============ โมดัล / toast ============ */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.65); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 22px; width: min(480px, 100%); max-height: 92vh; overflow: auto; box-shadow: var(--shadow); }
.modal h3 { margin-bottom: 14px; }
.modal .row { margin-top: 14px; justify-content: flex-end; }
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 200; width: min(420px, 100% - 24px); }
.toast { background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--info); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); font-size: .92rem; }
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--accent); }

.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 560px) {
  .site-header .container { gap: 8px; }
  .nav { order: 3; width: 100%; }
  .cred-row .k { width: 100%; }
}

/* ===== สวิตช์สลับธีม (Uiverse by JustCode14) ===== */
.switch { font-size: 14px; position: relative; display: inline-block; width: 4em; height: 2.2em; border-radius: 30px; box-shadow: 0 0 10px rgba(0,0,0,.1); flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background-color: #2a2a2a; transition: .4s; border-radius: 30px; overflow: hidden; }
.slider:before { position: absolute; content: ""; height: 1.2em; width: 1.2em; border-radius: 20px; left: .5em; bottom: .5em; transition: .4s; transition-timing-function: cubic-bezier(.81,-.04,.38,1.5); box-shadow: inset 8px -4px 0 0 #fff; }
.switch input:checked + .slider { background-color: #00a6ff; }
.switch input:checked + .slider:before { transform: translateX(1.8em); box-shadow: inset 15px -4px 0 15px #ffcf48; }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.star { background-color: #fff; border-radius: 50%; position: absolute; width: 5px; height: 5px; transition: all .4s; }
.star_1 { left: 2.5em; top: .5em; }
.star_2 { left: 2.2em; top: 1.2em; }
.star_3 { left: 3em; top: .9em; }
.switch input:checked ~ .slider .star { opacity: 0; }
.cloud { width: 3.5em; position: absolute; bottom: -1.4em; left: -1.1em; opacity: 0; transition: all .4s; }
.switch input:checked ~ .slider .cloud { opacity: 1; }

/* ===== ปุ่มติดต่อร้านแบบลอย (กดแล้วเด้งการ์ด) ===== */
.support { position: fixed; right: 18px; bottom: 20px; z-index: 100; }

.support-fab {
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #E5CB88 0%, #D6B66E 48%, #A88745 100%);
  box-shadow: 0 6px 20px rgba(214, 182, 110, .38);
  transition: transform .2s, box-shadow .2s;
}
.support-fab svg { width: 27px; height: 27px; }
.support-fab:hover, .support.open .support-fab { transform: scale(1.08); box-shadow: 0 8px 26px rgba(214, 182, 110, .48); }

.support-panel {
  position: absolute; right: 0; bottom: 72px;
  width: min(310px, calc(100vw - 36px));
  padding: 14px; border-radius: 18px;
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(10px) scale(.97); transform-origin: bottom right;
  transition: opacity .18s, transform .18s, visibility .18s;
}
.support-panel::after { content: ""; position: absolute; left: 0; right: 0; bottom: -16px; height: 16px; } /* กันเมาส์หลุดตอนเลื่อนลงไปที่ปุ่ม */
.support.open .support-panel { opacity: 1; visibility: visible; transform: none; }

.sp-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.sp-status { font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; border: 1px solid currentColor; }
.sp-status.on { color: var(--ok); }
.sp-status.off { color: var(--muted); }

.sp-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; margin-bottom: 8px; border-radius: 12px; text-align: left;
  background: var(--card-2); border: 1px solid var(--border);
  color: var(--text); font: inherit; text-decoration: none; cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.sp-row:hover { border-color: var(--accent); transform: translateY(-1px); }
.sp-ico { flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center; font-size: 1.4rem; }
.sp-ico svg { width: 100%; height: 100%; }
.sp-txt { display: grid; line-height: 1.3; min-width: 0; }
.sp-txt small { color: var(--muted); font-size: .78rem; }

.sp-hours {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 4px; padding: 10px 12px; border-radius: 12px;
  border: 1px dashed var(--border); font-size: .85rem;
}
.sp-hours span { color: var(--muted); }

@media (max-width: 600px) {
  .support { right: 12px; bottom: 14px; }
  .support-fab { width: 52px; height: 52px; }
  .support-panel { bottom: 66px; }
}

.row a[href="/topup"]:hover { background: rgba(214,182,110,.3); transform: translateY(-1px); }
.row a[href="/topup"]::before { content: "💰"; font-size: .9em; }

/* ===== ชิป ✓ ใหญ่ขึ้น ===== */
#zone-features { gap: 10px; }
#zone-features .badge {
  font-size: 0.8rem;
  padding: 8px 18px;
  border-radius: 999px;
}

/* ===== การ์ดแพ็กเกจ: สินค้าหมดให้ดูนุ่มลงและมีระยะห่าง ===== */
.plan .stock-left { display: inline-block; margin: 14px 0 16px; font-size: .95rem; }
.plan .stock-left.out {
  padding: 6px 16px;
  border-radius: 999px;
  color: #A88745;
  background: rgba(214, 182, 110, .10);
  border: 1px solid rgba(214, 182, 110, .35);
}
.plan .btn[disabled] {
  background: transparent;
  color: rgba(128, 128, 128, .9);
  border: 1px solid rgba(128, 128, 128, .35);
  cursor: not-allowed;
}

/* ===== popup รายละเอียดก่อนสั่งซื้อ ===== */
.warn-banner {
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 700;
  background: rgba(255, 176, 0, .12);
  border: 1px solid rgba(255, 176, 0, .35);
  margin-bottom: 14px;
}
.summary { padding: 6px 16px; border-radius: 12px; border: 1px solid rgba(128, 128, 128, .25); background: rgba(128, 128, 128, .08); }
.summary .line { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 0; }
.summary .line + .line { border-top: 1px solid rgba(128, 128, 128, .2); }
.summary .line.total { font-size: 1.35rem; font-weight: 800; }
.summary .line.total span:last-child { color: var(--accent, #D6B66E); }

.rules { list-style: none; padding: 0; margin: 10px 0 16px; display: grid; gap: 8px; }
.rules li {
  padding: 10px 14px;
  border-radius: 10px;
  line-height: 1.5;
  background: rgba(128, 128, 128, .09);
  border: 1px solid rgba(128, 128, 128, .18);
}

.check {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 10px; cursor: pointer;
  border: 1px dashed rgba(128, 128, 128, .45);
  margin-bottom: 12px;
}
.check input { width: 20px; height: 20px; accent-color: var(--accent, #D6B66E); flex-shrink: 0; }

.balance-line {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: 10px;
  background: rgba(46, 204, 113, .10); border: 1px solid rgba(46, 204, 113, .35);
  margin-bottom: 16px;
}
.balance-line b { font-size: 1.2rem; }
.balance-line.bad { background: rgba(214, 182, 110, .10); border-color: rgba(214, 182, 110, .4); }

.actions-row { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* ===== หน้าออเดอร์: แถวย่อ ===== */
.order-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 18px; margin-bottom: 10px;
}
.or-main { min-width: 0; flex: 1 1 260px; }
.or-title { font-weight: 700; }
.or-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 4px; font-size: .88rem; opacity: .7; }
.or-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ===== ป้ายยอดเงินคงเหลือ ===== */
.balance-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 12px;
  border-radius: 999px;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(135deg, rgba(214, 182, 110, .20), rgba(214, 182, 110, .04));
  border: 1px solid rgba(214, 182, 110, .38);
  box-shadow: 0 0 0 0 rgba(214, 182, 110, .0);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.balance-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(214, 182, 110, .8);
  box-shadow: 0 4px 14px rgba(214, 182, 110, .25);
}
.balance-chip .bc-ico { font-size: 1rem; line-height: 1; }
.balance-chip .bc-amt { font-weight: 800; letter-spacing: .2px; font-variant-numeric: tabular-nums; }
.balance-chip .bc-plus {
  display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  font-weight: 800; line-height: 1;
  background: var(--accent, #D6B66E); color: #fff;
}

/* อีเมลย่อไม่ให้ยาวจนดันแถบ */
.user-chip { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .75; }

@media (max-width: 900px) {
  .user-chip { display: none; }
}

/* ===== ขั้นตอนวิธีเข้าใช้งาน ===== */
.guide-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 14px;
  margin: 10px 0;
  border-radius: 12px;
  background: rgba(128, 128, 128, .08);
  border: 1px solid rgba(128, 128, 128, .18);
  line-height: 1.55;
}
.guide-step .n {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-weight: 800;
  font-size: .95rem;
  color: #fff;
  background: var(--accent, #D6B66E);
}
.guide-step > div:last-child { flex: 1; min-width: 0; padding-top: 3px; }
.guide-step img {
  display: block;
  max-width: 100%;
  margin-top: 10px;
  border-radius: 10px;
}

.howto-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.rules-mini-box { margin-top: 14px; padding: 10px 14px; border-radius: 10px; background: rgba(128,128,128,.08); border: 1px solid rgba(128,128,128,.18); }
.rules-mini-title { font-weight: 700; font-size: .88rem; margin-bottom: 6px; }
.rules-mini { margin: 0; padding-left: 18px; display: grid; gap: 3px; font-size: .8rem; color: var(--muted); line-height: 1.45; }

.renew-list { display: grid; gap: 10px; margin-top: 12px; }
.renew-opt {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-radius: 12px; cursor: pointer; font: inherit; color: var(--text);
  background: var(--card-2); border: 1px solid var(--border); transition: .15s;
}
.renew-opt:hover { border-color: var(--accent); transform: translateY(-1px); }
.renew-opt[disabled] { opacity: .5; cursor: not-allowed; }
.renew-opt b { font-size: 1.05rem; }
.renew-opt span { color: var(--accent); font-weight: 800; }

.stamps { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; margin: 12px 0; }
.stamp { aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; font-size: .8rem; font-weight: 700; color: var(--muted); border: 1px dashed var(--border); }
.stamp.on { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (max-width: 500px) { .stamps { grid-template-columns: repeat(5, 1fr); } }

/* popup บนมือถือ: เลื่อนได้ ไม่ตัดหัว ไม่ถูกแถบ Safari บัง */
.modal-back { padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
.modal {
  max-height: 85vh;
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
body:has(.modal-back) { overflow: hidden; } /* ล็อกหน้าข้างหลังไม่ให้เลื่อนแทน */

.nav-burger {
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  width: 42px; height: 42px; padding: 0; border-radius: 12px; cursor: pointer;
  background: var(--card-2); border: 1px solid var(--border);
}
.nav-burger span { display: block; width: 20px; height: 2px; border-radius: 2px; background: var(--text); transition: transform .2s, opacity .2s; }
.site-header.menu-open .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-header.menu-open .nav-burger span:nth-child(2) { opacity: 0; }
.site-header.menu-open .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.mobile-menu { display: none; }

@media (max-width: 760px) {
  .site-header .container { flex-wrap: nowrap; gap: 8px; }
  .site-header .nav { display: none; }
  .site-header .row { margin-left: auto; flex-wrap: nowrap; gap: 8px; }
  .site-header .logout-btn, .site-header .login-btn, .user-chip { display: none; }
  .nav-burger { display: flex; }

  .site-header.menu-open .mobile-menu {
    display: flex; flex-direction: column; gap: 8px;
    margin: 0 16px 12px; padding: 12px; border-radius: 16px;
    background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow);
  }
  .mobile-menu a:not(.btn) { padding: 12px 14px; border-radius: 10px; text-decoration: none; font-weight: 700; background: var(--card-2); }
  .mobile-menu a.active { outline: 2px solid var(--accent); }
  .mm-user { padding: 4px; font-size: .85rem; color: var(--muted); word-break: break-all; }
}

.tabs:not(#zone-tabs) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px;
  width: 100%;
}
.tabs:not(#zone-tabs) .tab { text-align: center; white-space: nowrap; }

/* ===== ปุ่มสามขีด + เมนูมือถือ ===== */
.nav-burger {
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  flex: 0 0 auto; width: 42px; height: 42px; padding: 0; border-radius: 12px; cursor: pointer;
  background: var(--card-2); border: 1px solid var(--border);
}
.nav-burger span { display: block; width: 20px; height: 2px; border-radius: 2px; background: var(--text); transition: transform .2s, opacity .2s; }
.site-header.menu-open .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-header.menu-open .nav-burger span:nth-child(2) { opacity: 0; }
.site-header.menu-open .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.mobile-menu { display: none; }

@media (max-width: 760px) {
  .site-header .container { flex-wrap: nowrap; gap: 8px; }
  .site-header .nav { display: none; }
  .site-header .row { margin-left: auto; flex-wrap: nowrap; gap: 8px; }
  .site-header .logout-btn, .site-header .login-btn, .site-header .user-chip { display: none; }
  .nav-burger { display: flex; }
  .balance-chip { padding: 4px 5px 4px 10px; gap: 6px; }
  .balance-chip .bc-plus { width: 22px; height: 22px; }

  .site-header.menu-open .mobile-menu {
    display: flex; flex-direction: column; gap: 8px;
    width: min(1100px, 100% - 32px); margin: 0 auto 12px; padding: 12px; border-radius: 16px;
    background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow);
  }
  .mobile-menu a:not(.btn) { padding: 12px 14px; border-radius: 10px; text-decoration: none; font-weight: 700; background: var(--card-2); }
  .mobile-menu a.active { outline: 2px solid var(--accent); }
  .mm-user { padding: 4px; font-size: .85rem; color: var(--muted); word-break: break-all; }
}

/* แจ้งเตือนเคลมที่แอดมินดำเนินการแล้ว */
.nav-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px; background: #e50914; color: #fff; font-size: .72rem; font-weight: 700; line-height: 1; }
.claim.unseen { border-color: #e50914; box-shadow: 0 0 0 1px rgba(229, 9, 20, .35); }
.claim-alert { border-color: #e50914; margin-bottom: 14px; }
.claim-alert .claim-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.claim-chip { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: .85rem; text-decoration: none; }