/* สไตล์แบบ iPhone (iOS): ใช้ฟอนต์ระบบ San Francisco บน iPhone/Mac, เครื่องอื่นใช้ Inter + Noto Sans Thai ที่หน้าตาใกล้เคียง */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "SF Thonburi", "Helvetica Neue", "Inter", "Noto Sans Thai", "Segoe UI", system-ui, sans-serif;
  --bg: #f2f2f7;
  --bg2: #ffffff;
  --bg3: #e5e5ea;
  --label: #000000;
  --label2: rgba(60, 60, 67, .6);
  --label3: rgba(60, 60, 67, .3);
  --sep: rgba(60, 60, 67, .18);
  --tint: #e8711a;      /* ส้มวินเทจ — สีหลักของ PNPR */
  --tint-ink: #b9520f;
  --navy: #1e3a5f;
  --blue: #007aff;
  --green: #34c759;
  --red: #e5322d;
  --yellow: #ffcc00;
  --bar: rgba(255, 255, 255, .9);
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 18px rgba(0,0,0,.05);
  --r: 14px;
  --r-lg: 22px;
  color-scheme: light;
}
/* ธีมดำสำหรับหลังร้าน (ใส่ class="theme-dark" ที่ body) */
body.theme-dark {
  --bg: #0b0b0d; --bg2: #1c1c1e; --bg3: #2c2c2e; --label: #ffffff;
  --label2: rgba(235, 235, 245, .62); --label3: rgba(235, 235, 245, .3); --sep: rgba(84, 84, 88, .55);
  --tint: #ff8a2b; --tint-ink: #ffa75c; --blue: #0a84ff; --green: #30d158; --red: #ff453a;
  --bar: rgba(22, 22, 24, .82); --shadow: none;
  color-scheme: dark;
}
body.theme-dark .pill.green { color: var(--green); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--label); font-size: 17px; line-height: 1.4; letter-spacing: -.01em; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--label2); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ปุ่ม */
.btn { appearance: none; border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 600; font-size: 17px; cursor: pointer; background: var(--tint); color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .1s, opacity .15s; min-height: 44px; }
.btn:active { transform: scale(.97); opacity: .85; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.block { width: 100%; }
.btn.gray { background: var(--bg3); color: var(--label); }
.btn.plain { background: transparent; color: var(--blue); padding: 8px 10px; font-weight: 500; }
.btn.danger { background: transparent; color: var(--red); }
.btn.blue { background: var(--blue); }
.btn.green { background: var(--green); }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 15px; border-radius: 10px; }

/* แถบบน (blur แบบ iOS) */
.navbar { position: sticky; top: 0; z-index: 40; background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: .5px solid var(--sep); }
.navbar .wrap { display: flex; align-items: center; gap: 10px; height: 54px; }
.brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; color: var(--label); min-width: 0; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--tint); display: grid; place-items: center; font-size: 17px; flex: none; }
.spacer { flex: 1; }
.seg { display: inline-flex; background: var(--bg3); border-radius: 9px; padding: 2px; flex: none; }
.seg button { border: 0; background: transparent; padding: 4px 10px; border-radius: 7px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--label); }
.seg button.on { background: var(--bg2); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.icon-btn { position: relative; border: 0; background: transparent; width: 40px; height: 40px; border-radius: 20px; display: grid; place-items: center; cursor: pointer; color: var(--blue); flex: none; }
.icon-btn svg { width: 24px; height: 24px; }
.badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }

.announce { background: var(--tint); color: #fff; text-align: center; font-size: 14px; font-weight: 600; padding: 7px 16px; }

/* การ์ด / รายการแบบ inset grouped */
.card { background: var(--bg2); border-radius: var(--r); box-shadow: var(--shadow); }
.group { background: var(--bg2); border-radius: var(--r); overflow: hidden; }
.group > .row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 44px; position: relative; }
.group > .row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep); }
.section-title { font-size: 13px; text-transform: uppercase; color: var(--label2); padding: 22px 16px 7px; letter-spacing: .02em; }
.large-title { font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin: 0; }
.title2 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin: 0; }

/* ฟอร์ม */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--label2); margin: 0 4px 6px; }
.input, select.input, textarea.input { width: 100%; border: 0; background: var(--bg2); border-radius: 12px; padding: 12px 14px; outline: none; font-size: 17px; box-shadow: inset 0 0 0 .5px var(--sep); }
.input:focus { box-shadow: inset 0 0 0 2px var(--blue); }
textarea.input { min-height: 84px; resize: vertical; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch { appearance: none; width: 51px; height: 31px; border-radius: 16px; background: var(--bg3); position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15); transition: transform .2s; }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }

/* แผ่นเลื่อนขึ้น (sheet) */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 80; opacity: 0; pointer-events: none; transition: opacity .25s; }
.sheet-bg.open { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; max-height: 92vh; background: var(--bg); border-radius: 14px 14px 0 0; transform: translateY(105%); transition: transform .32s cubic-bezier(.2,.9,.3,1); display: flex; flex-direction: column; max-width: 680px; margin: 0 auto; }
.sheet.open { transform: none; }
.sheet .grab { width: 36px; height: 5px; border-radius: 3px; background: var(--label3); margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; padding: 8px 8px 8px 16px; flex: none; }
.sheet-head h3 { margin: 0; font-size: 17px; font-weight: 600; flex: 1; text-align: center; padding-left: 40px; }
.sheet-body { overflow-y: auto; padding: 0 16px calc(20px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
@media (min-width: 760px) { .sheet { bottom: auto; top: 50%; border-radius: 16px; transform: translateY(-40%) scale(.96); opacity: 0; pointer-events: none; transition: transform .25s, opacity .2s; max-height: 86vh; } .sheet.open { transform: translateY(-50%); opacity: 1; pointer-events: auto; } .sheet .grab { display: none; } }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 30px); background: rgba(30,30,30,.92); color: #fff; padding: 11px 18px; border-radius: 22px; font-size: 15px; font-weight: 500; opacity: 0; transition: .25s; z-index: 200; pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.pill { display: inline-block; padding: 3px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; background: var(--bg3); color: var(--label2); }
.pill.orange { background: rgba(255,149,0,.15); color: var(--tint-ink); }
.pill.green { background: rgba(52,199,89,.15); color: #1f8a3d; }
.pill.blue { background: rgba(0,122,255,.12); color: var(--blue); }
.pill.red { background: rgba(255,59,48,.12); color: var(--red); }

.empty { text-align: center; color: var(--label2); padding: 40px 16px; }
.empty .big { font-size: 48px; margin-bottom: 8px; }
