/* ธีมหลัก ขาว–แดง–เหลือง (ใช้ร่วมกันทั้งหน้าร้านและหลังร้าน) */
:root {
  --red: #D7192A; --red-600: #B3111F; --red-700: #8F0C18; --red-50: #FDEDEE; --red-100: #FAD4D7;
  --yellow: #FFC629; --yellow-600: #E6A800; --yellow-50: #FFF8DF; --yellow-100: #FFEDB0;
  --ink: #1E1A17; --ink-2: #48413B; --muted: #8B827B; --line: #EEE7E1; --line-2: #E2D9D1;
  --bg: #FAF7F4; --card: #FFFFFF; --ok: #15803D; --ok-50: #E8F6EC; --info: #1D4ED8; --info-50: #E8EEFC;
  --r-sm: 10px; --r: 16px; --r-lg: 22px;
  --sh-1: 0 1px 2px rgba(30, 26, 23, .06), 0 1px 1px rgba(30, 26, 23, .04);
  --sh-2: 0 6px 20px rgba(30, 26, 23, .08), 0 2px 6px rgba(30, 26, 23, .05);
  --sh-3: 0 18px 50px rgba(30, 26, 23, .18);
  --font: 'IBM Plex Sans Thai', 'Noto Sans Thai', system-ui, -apple-system, sans-serif;
  --font-h: 'Prompt', 'IBM Plex Sans Thai', system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.5; font-size: 15px; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--font-h); font-weight: 600; line-height: 1.25; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; opacity: .5; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--red); }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* ปุ่ม */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 12px; font-weight: 600; transition: background .15s, transform .05s, box-shadow .15s; white-space: nowrap; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 4px 12px rgba(215, 25, 42, .25); }
.btn-primary:hover:not(:disabled) { background: var(--red-600); }
.btn-yellow { background: var(--yellow); color: var(--ink); }
.btn-yellow:hover:not(:disabled) { background: #FFB800; }
.btn-ghost { background: var(--card); color: var(--ink); border: 1.5px solid var(--line-2); }
.btn-ghost:hover:not(:disabled) { border-color: var(--ink-2); }
.btn-soft { background: var(--red-50); color: var(--red-600); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-danger-text { color: var(--red); background: none; }
.btn-block { width: 100%; }
.btn-lg { min-height: 54px; font-size: 1.05rem; border-radius: 14px; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: .88rem; border-radius: 9px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; }

/* ฟอร์ม */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: .88rem; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.field > span em { color: var(--red); font-style: normal; }
.input, select.input, textarea.input { width: 100%; min-height: 46px; padding: 10px 14px; border: 1.5px solid var(--line-2); border-radius: 12px;
  background: #fff; transition: border-color .15s, box-shadow .15s; }
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 4px var(--red-50); }
.input.invalid { border-color: var(--red); background: var(--red-50); }
.hint { font-size: .82rem; color: var(--muted); margin-top: 4px; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.pill-red { background: var(--red-50); color: var(--red-600); }
.pill-yellow { background: var(--yellow-100); color: #7A5A00; }
.pill-ok { background: var(--ok-50); color: var(--ok); }
.pill-info { background: var(--info-50); color: var(--info); }
.pill-grey { background: #F1EEEB; color: var(--ink-2); }

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

/* สวิตช์ */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; background: #D9D1CA; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch i::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::before { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* toast */
#toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 1000; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--sh-3); font-size: .93rem; animation: tin .25s ease; transition: opacity .3s, transform .3s; }
.toast.ok { background: var(--ok); } .toast.err { background: var(--red); }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes tin { from { opacity: 0; transform: translateY(-10px); } }

.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state .big { font-size: 2.6rem; margin-bottom: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
