:root {
  --primary: #E8431F; --primary-dark: #C2351A; --primary-soft: #FFF1EC;
  --bg: #F6F6F7; --card: #fff; --text: #1C1C1E; --muted: #6E6E73; --line: #E6E6EA;
  --green: #1E9E5A; --red: #D93025; --yellow: #F2A900; --blue: #2E6BE6;
  --radius: 14px; --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Noto Sans Thai', 'Noto Sans KR', 'Segoe UI', Roboto, sans-serif; font-size: 16px; line-height: 1.45; }
body { padding-bottom: calc(64px + var(--safe-b)); }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; }
input, select, textarea { font: inherit; width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); border-color: transparent; }
label.f { display: block; margin: 12px 0 6px; font-size: 14px; color: var(--muted); }
.container { max-width: 560px; margin: 0 auto; padding: 0 16px; }

.splash { height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--primary); }
.splash .logo, .login .logo { font-size: 56px; font-weight: 800; color: #fff; letter-spacing: -1px; }

.topbar { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line); }
.topbar .container { display: flex; align-items: center; gap: 10px; height: 56px; }
.topbar .title { font-weight: 700; font-size: 18px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .brand { color: var(--primary); font-weight: 800; font-size: 22px; }
.iconbtn { background: none; padding: 8px; border-radius: 50%; font-size: 20px; line-height: 1; position: relative; }
.iconbtn .badge { position: absolute; top: 2px; right: 0; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; min-width: 18px; height: 18px; line-height: 18px; text-align: center; padding: 0 4px; }

.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: #fff; border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabbar .container { display: flex; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 8px 0 6px; font-size: 11px; color: var(--muted); }
.tabbar a .ic { font-size: 22px; }
.tabbar a.active { color: var(--primary); font-weight: 700; }

.card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card h3 { margin: 0 0 8px; font-size: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.bold { font-weight: 700; }
.price { font-weight: 700; color: var(--text); }
.mt { margin-top: 12px; } .mb { margin-bottom: 12px; }
.center { text-align: center; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; background: #EEE; color: var(--muted); }
.chip.ok { background: #E3F5EA; color: var(--green); }
.chip.warn { background: #FFF4D6; color: #9A6B00; }
.chip.bad { background: #FDE8E6; color: var(--red); }
.chip.info { background: #E6EEFF; color: var(--blue); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 14px 16px; border-radius: 12px; font-weight: 700; font-size: 16px; background: var(--primary); color: #fff; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn.ghost { background: var(--primary-soft); color: var(--primary); }
.btn.sm { padding: 9px 12px; font-size: 14px; width: auto; border-radius: 10px; }
.btn.danger { background: var(--red); }
.btn.line { background: #06C755; }

.login { min-height: 100vh; background: var(--primary); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; color: #fff; text-align: center; }
.login .tag { margin: 12px 0 40px; font-size: 16px; opacity: .95; }
.login .btn { max-width: 360px; }
.login .langs { margin-top: 28px; display: flex; gap: 10px; }
.login .langs button { background: rgba(255,255,255,.18); color: #fff; padding: 8px 14px; border-radius: 20px; font-size: 14px; }
.login .langs button.active { background: #fff; color: var(--primary); }

.addrbar { background: #fff; border-bottom: 1px solid var(--line); }
.addrbar .container { display: flex; align-items: center; gap: 8px; padding: 10px 16px; font-size: 14px; }
.addrbar .txt { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.search { margin: 12px 0; position: relative; }
.search input { padding-left: 40px; border-radius: 12px; }
.search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }

.cats { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cats button { flex: 0 0 auto; padding: 8px 14px; border-radius: 20px; background: #fff; border: 1px solid var(--line); font-size: 14px; white-space: nowrap; }
.cats button.active { background: var(--text); color: #fff; border-color: var(--text); }

.store { display: flex; gap: 12px; background: #fff; border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.store img, .store .ph { width: 84px; height: 84px; border-radius: 10px; object-fit: cover; background: #EEE; flex: 0 0 auto; }
.store .info { flex: 1; min-width: 0; }
.store .name { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.store .meta { font-size: 13px; margin-top: 6px; display: flex; gap: 10px; flex-wrap: wrap; }
.store.closed { opacity: .55; }

.hero { position: relative; height: 160px; background: #DDD center/cover no-repeat; }
.hero .back { position: absolute; top: 12px; left: 12px; background: rgba(0,0,0,.45); color: #fff; border-radius: 50%; width: 36px; height: 36px; font-size: 18px; }
.storehead { background: #fff; padding: 16px; margin-bottom: 8px; }
.storehead h2 { margin: 0 0 4px; font-size: 20px; }
.storehead .grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 12px; text-align: center; }
.storehead .grid div { background: var(--bg); border-radius: 10px; padding: 8px 4px; font-size: 13px; }
.storehead .grid b { display: block; font-size: 14px; }
.section-title { font-weight: 700; font-size: 15px; margin: 16px 0 8px; color: var(--muted); }
.menu { display: flex; gap: 12px; background: #fff; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.menu .info { flex: 1; min-width: 0; }
.menu .name { font-weight: 600; }
.menu .desc { font-size: 13px; color: var(--muted); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.menu img { width: 76px; height: 76px; border-radius: 10px; object-fit: cover; background: #EEE; flex: 0 0 auto; }
.menu.soldout { opacity: .5; }

.cartbar { position: fixed; left: 0; right: 0; bottom: calc(64px + var(--safe-b)); z-index: 15; padding: 8px 16px; }
.cartbar .btn { max-width: 528px; margin: 0 auto; box-shadow: 0 4px 16px rgba(232,67,31,.35); }

.cartitem { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cartitem:last-child { border-bottom: 0; }
.cartitem .info { flex: 1; }
.qtyctl { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.qtyctl button { width: 34px; height: 34px; background: #fff; font-size: 18px; }
.qtyctl span { min-width: 30px; text-align: center; font-weight: 700; }

.sumrow { display: flex; justify-content: space-between; padding: 6px 0; font-size: 15px; }
.sumrow.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; font-size: 18px; font-weight: 800; color: var(--primary); }
.radio { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.radio:last-child { border-bottom: 0; }
.radio input { width: auto; }
.check { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; }

.deposit { background: linear-gradient(135deg, #FFF4EF, #FFE8DF); border: 1px solid #FFD2C2; }
.deposit .big { font-size: 30px; font-weight: 800; color: var(--primary); letter-spacing: -0.5px; }
.deposit table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.deposit td { padding: 8px 0; border-bottom: 1px dashed #F3C9BA; vertical-align: top; }
.deposit td:first-child { color: var(--muted); width: 36%; font-size: 14px; }
.deposit td:last-child { font-weight: 700; font-size: 16px; word-break: break-all; }
.code { font-family: ui-monospace, Menlo, monospace; background: #fff; border: 2px dashed var(--primary); padding: 10px 14px; border-radius: 10px; font-size: 22px; font-weight: 800; text-align: center; letter-spacing: 1px; }

.steps { display: flex; justify-content: space-between; margin: 12px 0 4px; }
.steps div { flex: 1; text-align: center; font-size: 11px; color: var(--muted); position: relative; }
.steps div::before { content: ''; display: block; width: 12px; height: 12px; border-radius: 50%; background: var(--line); margin: 0 auto 6px; }
.steps div.done::before { background: var(--green); }
.steps div.cur::before { background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.steps div.cur { color: var(--primary); font-weight: 700; }

.order { background: #fff; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.order .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.order .no { font-family: ui-monospace, Menlo, monospace; font-weight: 700; }

.empty { text-align: center; color: var(--muted); padding: 50px 20px; }
.empty .ic { font-size: 44px; margin-bottom: 8px; }

.menuitem-list .item { padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.menuitem-list .item:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.menuitem-list .item:last-child { border-radius: 0 0 var(--radius) var(--radius); border-bottom: 0; }
.profile { display: flex; align-items: center; gap: 14px; }
.profile img, .profile .av { width: 56px; height: 56px; border-radius: 50%; background: var(--primary-soft); display: flex; align-items: center; justify-content: center; font-size: 24px; }
.wallet { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wallet div { background: var(--primary-soft); border-radius: 12px; padding: 12px; }
.wallet b { display: block; font-size: 20px; color: var(--primary); }

#toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); background: rgba(28,28,30,.92); color: #fff; padding: 10px 18px; border-radius: 24px; font-size: 14px; opacity: 0; transition: opacity .2s; z-index: 50; pointer-events: none; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; }
#modal:empty { display: none; }
#modal { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
#modal .sheet { background: #fff; width: 100%; max-width: 560px; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + var(--safe-b)); max-height: 88vh; overflow-y: auto; animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
#modal .sheet h3 { margin: 0 0 10px; font-size: 18px; }
#modal .actions { display: flex; gap: 10px; margin-top: 16px; }
.optgroup { margin: 12px 0; }
.optgroup .t { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.optgroup label { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.optgroup label span:first-child { display: flex; gap: 8px; align-items: center; }
.optgroup input { width: auto; }
.notice { background: #FFF8E1; border-left: 4px solid var(--yellow); padding: 10px 12px; border-radius: 8px; font-size: 14px; margin: 12px 0; }
.notice.red { background: #FDECEA; border-color: var(--red); }
.notice.green { background: #E8F5EE; border-color: var(--green); }
.notif { padding: 12px 0; border-bottom: 1px solid var(--line); white-space: pre-line; font-size: 14px; }
.notif .t { font-size: 12px; color: var(--muted); }
.photo-prev { width: 100%; max-height: 200px; object-fit: cover; border-radius: 10px; margin-top: 8px; }
.skeleton { background: linear-gradient(90deg, #EEE 25%, #F7F7F7 50%, #EEE 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--radius); height: 108px; margin-bottom: 10px; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.legal { margin-top: 24px; font-size: 11px; line-height: 1.6; color: var(--muted); text-align: left; max-width: 420px; }
.legal.light { color: rgba(255,255,255,.75); margin-top: 40px; }
