:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #18202b;
  --muted: #687385;
  --line: #e3e6eb;
  --primary: #0f766e;
  --primary-hover: #0b5f59;
  --primary-soft: #e3f4f1;
  --on-primary: #ffffff;
  --price: #c2410c;
  --danger: #c62828;
  --danger-soft: #fdecec;
  --online: #16a34a;
  --bubble-mine: #0f766e;
  --bubble-theirs: #ffffff;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 16px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, 0.18);
  --radius: 14px;
  --radius-sm: 10px;
  --font: 'Noto Sans Thai', 'Noto Sans Lao', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-head: 'Prompt', var(--font);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-head); line-height: 1.25; margin: 0 0 .4em; font-weight: 600; }
a { color: var(--primary); }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* ---------- ปุ่ม / ฟอร์ม ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 500; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger.confirming { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 14px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; font-size: 20px;
}
.icon-btn:hover { background: rgba(0, 0, 0, .06); }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 14px; font-weight: 500; }
.field .hint { font-size: 13px; color: var(--muted); }
input, textarea, select {
  width: 100%; font: inherit; color: var(--text);
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
input:focus, textarea:focus, select:focus, .btn:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary);
}
textarea { resize: vertical; min-height: 80px; }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix span {
  display: flex; align-items: center; padding: 0 10px; font-size: 14px; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  white-space: nowrap;
}
.input-prefix input { min-width: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.slug-preview { overflow-wrap: anywhere; }
.slug-preview strong { color: var(--primary); }
.check { display: flex; align-items: center; gap: 8px; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 12px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 600; line-height: 1;
}
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }

/* ---------- แถบบน ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .container { display: flex; align-items: center; gap: 8px; min-height: 60px; }
.topbar .btn { white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-head); font-weight: 600; font-size: 20px; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 17px; }
.topbar .spacer { flex: 1; }

/* ---------- หน้าแรก ---------- */
.hero { padding: 56px 0 40px; }
.hero h1 { font-size: clamp(28px, 5vw, 44px); max-width: 720px; }
.hero p { font-size: 18px; color: var(--muted); max-width: 620px; margin: 0 0 24px; }
.hero .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 16px 0 48px; }
.feature { padding: 20px; }
.feature .emoji { font-size: 28px; }
.feature h3 { font-size: 18px; margin-top: 8px; }
.feature p { margin: 0; color: var(--muted); font-size: 15px; }
.section-title { font-size: 22px; margin: 0 0 14px; }
.shop-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 64px; }
.shop-tile { padding: 16px; text-decoration: none; color: inherit; display: block; transition: border-color .15s; }
.shop-tile:hover { border-color: var(--primary); }
.shop-tile h3 { font-size: 17px; margin: 0 0 4px; }
.shop-tile p { margin: 0 0 8px; font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- หน้าร้าน ---------- */
.shop-header { background: linear-gradient(135deg, var(--primary), #14857b); color: #fff; padding: 32px 0 28px; }
.shop-header h1 { font-size: clamp(24px, 4vw, 34px); margin-bottom: 6px; }
.shop-header p { margin: 0 0 12px; opacity: .92; max-width: 640px; }
.shop-contacts { display: flex; flex-wrap: wrap; gap: 8px; }
.shop-contacts a, .shop-contacts span {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .16); color: #fff; text-decoration: none; font-size: 14px;
}
.shop-contacts a.wa-chip { background: #25d366; color: #fff; font-weight: 600; }
.wa-link { margin-left: 10px; color: #128c4a; font-weight: 600; text-decoration: none; }
.products-section { padding-top: 8px; padding-bottom: 120px; }
.category-bar {
  position: sticky; top: 60px; z-index: 10; background: var(--bg);
  display: flex; gap: 8px; overflow-x: auto; padding: 12px 0; margin-bottom: 4px; scrollbar-width: none;
}
.category-bar::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text);
  font: inherit; font-size: 15px; cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--primary); }
.chip .count { font-size: 12px; color: var(--muted); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.active .count { color: rgba(255, 255, 255, .8); }
.category-section { margin-top: 12px; }
.category-section + .category-section { margin-top: 28px; }
.category-section h2 { font-size: 20px; margin-bottom: 12px; }
.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .product-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; } }
.product-card { overflow: hidden; display: flex; flex-direction: column; }
.product-img { aspect-ratio: 1; background: var(--surface-2); position: relative; }
.product-img img { width: 100%; height: 100%; object-fit: cover; }
.product-img .placeholder { position: absolute; inset: 0; display: grid; place-items: center; font-size: 44px; color: var(--muted); }
.product-img .soldout {
  position: absolute; top: 8px; left: 8px; background: rgba(24, 32, 43, .82); color: #fff;
  font-size: 12px; padding: 2px 10px; border-radius: 999px;
}
.product-body { padding: 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.product-name { font-weight: 500; font-size: 15px; line-height: 1.4; }
.product-desc { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price { color: var(--price); font-weight: 700; font-size: 17px; }
.product-body .btn { margin-top: auto; }
.product-body .price { margin-bottom: 8px; }
.empty-state { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-state .emoji { font-size: 40px; }

/* ---------- ปุ่มแชทลอย + หน้าต่างแชทของลูกค้า ---------- */
.chat-fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 40;
  display: inline-flex; align-items: center; gap: 8px; padding: 0 20px; height: 54px;
  border: 0; border-radius: 999px; background: var(--primary); color: #fff;
  font: inherit; font-weight: 600; font-size: 16px; cursor: pointer; box-shadow: var(--shadow-lg);
}
.chat-fab:hover { background: var(--primary-hover); }
.chat-fab .badge { background: #fff; color: var(--danger); }

.chat-panel {
  position: fixed; z-index: 50; inset: 0;
  display: flex; flex-direction: column; background: var(--bg);
}
@media (min-width: 640px) {
  .chat-panel {
    inset: auto 20px 20px auto; width: 380px; height: min(620px, calc(100vh - 40px));
    border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  }
}
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 16px; background: var(--primary); color: #fff; }
.chat-head .title { flex: 1; min-width: 0; }
.chat-head strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.presence { font-size: 13px; opacity: .9; display: flex; align-items: center; gap: 6px; }
.presence::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; }
.presence.online::before { background: #4ade80; }
.chat-start { padding: 20px 16px; overflow-y: auto; flex: 1; }
.chat-start h3 { font-size: 18px; }

.messages { flex: 1; overflow-y: auto; padding: 16px 12px; display: flex; flex-direction: column; gap: 6px; }
.day-sep { align-self: center; font-size: 12px; color: var(--muted); background: var(--surface-2); padding: 2px 10px; border-radius: 999px; margin: 8px 0; }
.msg { display: flex; flex-direction: column; max-width: 82%; align-self: flex-start; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.bubble {
  padding: 8px 12px; border-radius: 16px 16px 16px 4px; background: var(--bubble-theirs); border: 1px solid var(--line);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.mine .bubble { background: var(--bubble-mine); color: #fff; border-color: var(--bubble-mine); border-radius: 16px 16px 4px 16px; }
.msg-time { font-size: 11px; color: var(--muted); margin: 2px 4px 0; }
.msg-product {
  display: flex; gap: 10px; align-items: center; padding: 8px; margin-bottom: 4px; width: 240px; max-width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--text);
}
.msg-product img, .msg-product .ph { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--surface-2); flex-shrink: 0; display: grid; place-items: center; }
.msg-product .info { min-width: 0; font-size: 13px; line-height: 1.35; }
.msg-product .info div:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.msg-product .price { font-size: 13px; }

.msg-image { display: block; width: fit-content; padding: 0; margin-bottom: 4px; border: 0; background: none; cursor: zoom-in; }
.msg-image img { max-width: 240px; max-height: 320px; min-width: 80px; min-height: 60px; border-radius: 14px; object-fit: cover; background: var(--surface-2); }
.attach-btn { color: var(--muted); flex-shrink: 0; }

@media (max-width: 420px) { .hide-narrow { display: none; } }
.login-hint { margin: 14px 0 0; text-align: center; }

/* ---------- บัญชีลูกค้า ---------- */
.account-title { font-size: 22px; }
.account-list { display: grid; gap: 8px; }
.account-row {
  display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: inherit; text-decoration: none;
}
a.account-row:hover { border-color: var(--primary); }
.account-row .meta { flex: 1; min-width: 0; }
.account-row .name { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.account-row .preview { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-row .side { display: grid; justify-items: end; gap: 4px; }
.account-row .time { font-size: 12px; color: var(--muted); }
.address-row { flex-wrap: wrap; }
.address-row .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.default-tag, .member-tag { background: var(--primary-soft); color: var(--primary); }
.address-choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; }
.address-choice input { width: 18px; height: 18px; margin-top: 2px; flex-shrink: 0; }
.address-choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.address-choices { display: grid; gap: 8px; margin-bottom: 12px; }

/* ---------- การ์ดที่อยู่รับของในแชท ---------- */
.addr-card { width: 270px; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; color: var(--text); text-align: left; }
.addr-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; background: #eef4ff; font-weight: 600; font-size: 14px; }
.addr-body { padding: 10px 12px 12px; display: grid; gap: 4px; font-size: 14px; overflow-wrap: anywhere; }
.addr-body .btn { margin-top: 6px; justify-self: start; }

/* ---------- การ์ดชำระเงินในแชท ---------- */
.pay-card { width: 280px; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; color: var(--text); text-align: left; }
.pay-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; background: var(--primary-soft); font-weight: 600; font-size: 14px; }
.pay-status { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.tone-amber { background: #fff1cc; color: #8a5a00; }
.tone-blue { background: #e1ecfb; color: #1d4f91; }
.tone-green { background: #dcf5e3; color: #166534; }
.tone-red { background: var(--danger-soft); color: var(--danger); }
.tone-gray { background: var(--surface-2); color: var(--muted); }
.pay-body { padding: 12px; display: grid; gap: 10px; }
.pay-amount { font-family: var(--font-head); font-size: 28px; font-weight: 600; line-height: 1.1; }
.pay-cancelled .pay-amount { text-decoration: line-through; color: var(--muted); }
.pay-amount-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.pay-steps { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.5; text-align: left; color: var(--text); }
.pay-steps li + li { margin-top: 2px; }
.pay-note { font-size: 14px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.pay-qr { display: grid; gap: 8px; justify-items: center; text-align: center; }
.pay-qr-img { padding: 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: zoom-in; overflow: hidden; }
.pay-qr-img img { width: 200px; height: 200px; object-fit: contain; background: #fff; }
#payQrThumb img { object-fit: contain; background: #fff; }
.pay-account { font-size: 14px; overflow-wrap: anywhere; }
.pay-warn { font-size: 13px; line-height: 1.45; background: #fff7e6; color: #8a5a00; border-radius: 10px; padding: 8px 10px; }
.pay-warn.danger { background: var(--danger-soft); color: var(--danger); }
.pay-actions { display: grid; gap: 6px; }
.pay-actions .btn { width: 100%; }
.btn-primary.confirming { background: var(--primary-hover); }
.attach-btn.busy { pointer-events: none; opacity: .6; }
.lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, .88);
  display: grid; place-items: center; padding: 16px; cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: calc(100dvh - 32px); border-radius: 8px; }
.lightbox-bar { position: absolute; top: 12px; right: 12px; display: flex; align-items: center; gap: 8px; }
.lightbox-bar .btn { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .35); color: #fff; }
.lightbox-bar .btn:hover { background: rgba(255, 255, 255, .28); }
.lightbox-bar .icon-btn { color: #fff; }

.attach-preview {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--primary-soft); font-size: 14px; border-top: 1px solid var(--line);
}
.attach-preview .info { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; background: var(--surface); border-top: 1px solid var(--line); }
.composer textarea { min-height: 42px; max-height: 140px; resize: none; border-radius: 21px; padding: 9px 14px; line-height: 1.45; }
.composer .btn { flex-shrink: 0; }

/* ---------- หลังร้าน (ผู้ขาย) ---------- */
.auth-wrap { max-width: 420px; margin: 40px auto; padding: 0 16px; }
.auth-card { padding: 24px; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 999px; margin-bottom: 20px; }
.tabs button {
  flex: 1; border: 0; background: transparent; font: inherit; font-weight: 500; padding: 8px 12px; border-radius: 999px; cursor: pointer; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.app-nav { background: var(--surface); border-bottom: 1px solid var(--line); }
.app-nav .tabs { margin: 8px 0; max-width: 460px; }
.app-main { flex: 1; min-height: 0; overflow: auto; }
.page { padding-top: 20px; padding-bottom: 40px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 22px; }

.inbox { display: grid; grid-template-columns: 1fr; height: 100%; }
@media (min-width: 860px) { .inbox { grid-template-columns: 340px 1fr; } }
.conv-list { background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
.conv-item {
  display: flex; gap: 12px; align-items: center; width: 100%; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.conv-item:hover { background: var(--surface-2); }
.conv-item.active { background: var(--primary-soft); }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 600; flex-shrink: 0; }
.conv-item .meta { flex: 1; min-width: 0; }
.conv-item .row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.conv-item .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item .time { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.conv-item .preview { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item.unread .preview { color: var(--text); font-weight: 500; }
.thread { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.thread-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.thread-head .meta { flex: 1; min-width: 0; }
.thread-empty { flex: 1; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 24px; }
.back-btn { display: inline-grid; }
@media (max-width: 859px) {
  .inbox.show-thread .conv-list { display: none; }
  .inbox:not(.show-thread) .thread { display: none; }
}
@media (min-width: 860px) { .back-btn { display: none; } }

.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.category-head { display: flex; align-items: center; gap: 6px; margin: 22px 0 10px; flex-wrap: wrap; }
.category-head:first-child { margin-top: 0; }
.category-head h3 { margin: 0; font-size: 17px; flex: 1; min-width: 120px; }
.category-head h3 .muted { font-weight: 400; font-size: 14px; }
.category-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 14px; }
.product-rows { display: grid; gap: 10px; }
.product-row { display: flex; gap: 12px; align-items: center; padding: 10px; }
.product-row .thumb { width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: var(--surface-2); flex-shrink: 0; display: grid; place-items: center; font-size: 26px; }
.product-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-row .meta { flex: 1; min-width: 0; }
.product-row .name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-row .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 560px) {
  .product-row { flex-wrap: wrap; }
  .product-row .actions { width: 100%; justify-content: flex-start; }
}

dialog.sheet {
  width: min(520px, 100% - 24px); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 18px; box-shadow: var(--shadow-lg);
  background: var(--surface); color: var(--text);
}
dialog.sheet::backdrop { background: rgba(16, 24, 40, .45); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 4px 20px; }
.sheet-head h3 { margin: 0; font-size: 18px; }
.sheet-body { padding: 8px 20px 20px; }
.image-picker { display: flex; gap: 12px; align-items: center; }
.image-picker .thumb { width: 88px; height: 88px; border-radius: 12px; background: var(--surface-2); overflow: hidden; display: grid; place-items: center; font-size: 28px; flex-shrink: 0; }
.image-picker .thumb img { width: 100%; height: 100%; object-fit: cover; }
.sheet-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

.settings-grid { display: grid; gap: 16px; }
@media (min-width: 860px) { .settings-grid { grid-template-columns: 1.4fr 1fr; align-items: start; } }
.settings-card { padding: 20px; }
.settings-col { display: grid; gap: 16px; align-content: start; }
.notify-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.notify-banner { background: #fff7e6; border-bottom: 1px solid #f5d9a8; color: #6b4600; font-size: 14px; }
.notify-banner .container { display: flex; align-items: center; gap: 10px; min-height: 48px; padding-top: 6px; padding-bottom: 6px; }
.notify-banner span { flex: 1; }
.share-link { display: flex; gap: 8px; }
.share-link input { background: var(--surface-2); min-width: 0; }
.share-link .btn { flex-shrink: 0; white-space: nowrap; }
.qr-title { margin-top: 22px; }
.qr-box { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.qr-box img { width: 180px; height: 180px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.qr-actions { display: flex; flex-direction: column; gap: 8px; }
.notice { background: #fff7e6; color: #8a5a00; border: 1px solid #f5d9a8; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; margin: 14px 0 0; }

/* ---------- โปสเตอร์ QR (หน้าสำหรับพิมพ์) ---------- */
.poster-page { background: var(--surface-2); }
.poster-toolbar { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 16px; }
.poster {
  width: min(100% - 32px, 148mm); aspect-ratio: 148 / 210; margin: 0 auto 32px; background: #fff;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-lg);
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.poster-head { width: 100%; background: var(--primary); color: #fff; padding: 7% 8% 6%; }
.poster-head .brand { color: #fff; justify-content: center; font-size: 16px; opacity: .9; margin-bottom: 10px; }
.poster-head .brand-mark { background: #fff; color: var(--primary); }
.poster-head h1 { font-size: clamp(22px, 6vw, 34px); margin: 0; overflow-wrap: anywhere; }
.poster-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4%; padding: 5% 10% 7%; width: 100%; }
.poster-sub { font-family: var(--font-head); font-size: clamp(16px, 4.2vw, 22px); font-weight: 600; margin: 0; }
.poster-qr { width: 66%; aspect-ratio: 1; }
.poster-url { font-size: 13px; color: var(--muted); margin: 0; overflow-wrap: anywhere; }
.poster-steps { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; font-size: 13px; color: var(--text); margin: 0; padding: 0; list-style: none; }
.poster-steps li { background: var(--primary-soft); color: var(--primary); padding: 3px 10px; border-radius: 999px; }
@media print {
  @page { size: A5 portrait; margin: 0; }
  .poster-page { background: #fff; }
  .poster-toolbar { display: none; }
  .poster { width: 148mm; height: 210mm; aspect-ratio: auto; margin: 0; border-radius: 0; box-shadow: none; }
}

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100;
  background: #18202b; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow-lg);
  max-width: calc(100% - 32px);
}

.site-footer { border-top: 1px solid var(--line); padding: 20px 0; color: var(--muted); font-size: 14px; }

/* ---------- ภาษา ---------- */
/* ระหว่างแปลข้อความ (เสี้ยววินาที) ซ่อนหน้าไว้ก่อน จะได้ไม่เห็นภาษาไทยแวบขึ้นมา */
html.i18n-pending body { visibility: hidden; }
/* ภาษาลาว: ใช้ฟอนต์ลาวก่อน (หัวข้อ Prompt ไม่มีตัวอักษรลาว) */
html[lang="lo"] { --font: 'Noto Sans Lao', 'Noto Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif; --font-head: var(--font); }
.lang-select {
  width: auto; flex: none; min-height: 34px; padding: 4px 20px 4px 8px; font-size: 14px; border-radius: 999px;
  background-color: var(--surface);
}
.poster-toolbar .lang-select { min-height: 40px; }
@media print { .lang-select { display: none; } }
/* มือถือจอแคบ: แถบบนของหลังร้านมีปุ่มเยอะ แสดงแค่ไอคอนแทนชื่อเว็บ */
@media (max-width: 480px) { .seller-page .brand [data-app-name] { display: none; } }
/* ชื่อลูกค้ายาว ๆ ไม่ดันแถบบนจนล้นจอ */
#accountLink { display: inline-block; line-height: 32px; max-width: 42vw; overflow: hidden; text-overflow: ellipsis; }
