/* เว็บสั่งอาหาร (มือถือใน LINE เป็นหลัก) */
:root {
  --line: #06c755;
  --line-dark: #05a847;
  --bg: #f6f7f9;
  --card: #fff;
  --ink: #1f2328;
  --muted: #6b7280;
  --divider: #e5e7eb;
}
body { background: var(--bg); color: var(--ink); font-family: 'Sarabun', 'Roboto', system-ui, sans-serif; padding-bottom: env(safe-area-inset-bottom); }
.min-w-0 { min-width: 0; }
.text-line { color: var(--line) !important; }
.btn-line { background: var(--line); border-color: var(--line); color: #fff; font-weight: 500; }
.btn-line:hover, .btn-line:active, .btn-line:focus { background: var(--line-dark) !important; border-color: var(--line-dark) !important; color: #fff !important; }
.center-screen { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* หัว + แท็บ */
.tara-head { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--card); border-bottom: 1px solid var(--divider); }
.tara-head .logo { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.tara-head .avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.tara-head .avatar.none { display: inline-flex; align-items: center; justify-content: center; background: #e5f8ed; color: var(--line-dark); font-weight: 700; }
.table-badge { display: inline-flex; gap: 4px; align-items: center; font-size: .8rem; color: var(--line-dark); background: #e5f8ed; border-radius: 999px; padding: 1px 10px; }
.tara-tabs { position: sticky; top: 61px; z-index: 9; display: flex; background: var(--card); border-bottom: 1px solid var(--divider); }
.tara-tabs button { flex: 1; border: 0; background: none; padding: 10px; color: var(--muted); border-bottom: 3px solid transparent; }
.tara-tabs button.on { color: var(--line-dark); border-bottom-color: var(--line); font-weight: 600; }

/* หมวด (ติดด้านบนตอนเลื่อน) + เมนู */
.cats { position: sticky; top: 104px; z-index: 8; display: flex; gap: 8px; overflow-x: auto; padding: 10px 14px; scrollbar-width: none;
  background: rgba(246,247,249,.94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--divider); }
.cats::-webkit-scrollbar { display: none; }
.cats button { flex-shrink: 0; border: 1px solid var(--divider); background: var(--card); border-radius: 999px; padding: 9px 16px; font-size: 1rem; font-weight: 500; color: var(--ink); min-height: 42px; }
.cats button small { color: var(--muted); font-weight: 400; margin-left: 2px; }
.cats button.on { background: var(--line); border-color: var(--line); color: #fff; box-shadow: 0 2px 8px rgba(6,199,85,.3); }
.cats button.on small { color: rgba(255,255,255,.85); }
.menu { padding-bottom: 110px; }
.menu-sec h2 { font-size: 1.1rem; font-weight: 700; margin: 0; padding: 16px 14px 8px; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 0 14px 4px; }
.menu-item { position: relative; display: flex; flex-direction: column; text-align: left; border: 0; background: var(--card); border-radius: 14px; overflow: hidden; padding: 0 0 10px; box-shadow: 0 1px 3px rgba(0,0,0,.07); }
.menu-item:active { transform: scale(.98); }
.menu-item .add { position: absolute; right: 8px; bottom: 8px; width: 30px; height: 30px; border-radius: 50%; background: var(--line); color: #fff; display: grid; place-items: center; font-size: 1rem; }
.menu-item .pic { display: block; width: 100%; aspect-ratio: 4 / 3; background: #eef0f3 center / cover no-repeat; }
.menu-item .nm { padding: 8px 10px 2px; font-weight: 500; line-height: 1.25; }
.menu-item .pr { padding: 0 44px 0 10px; color: var(--line-dark); font-weight: 700; }
.menu-item .sched { padding: 2px 44px 0 10px; font-size: .75rem; color: #8a5a00; line-height: 1.25; }
.menu-item.closed { opacity: .55; }
.menu-item.closed .sched { padding-right: 10px; }
.shape-wrap { display: flex !important; align-items: center; justify-content: center; }
/* รูปร่าง + สี แบบเดียวกับเครื่องขาย/หลังร้าน */
.pshape { display: block; width: 40%; aspect-ratio: 1; }
.pshape[data-shape=circle] { border-radius: 50%; }
.pshape[data-shape=sun] { clip-path: polygon(50% 0%, 60.6% 10.4%, 75% 6.7%, 79% 21%, 93.3% 25%, 89.6% 39.4%, 100% 50%, 89.6% 60.6%, 93.3% 75%, 79% 79%, 75% 93.3%, 60.6% 89.6%, 50% 100%, 39.4% 89.6%, 25% 93.3%, 21% 79%, 6.7% 75%, 10.4% 60.6%, 0% 50%, 10.4% 39.4%, 6.7% 25%, 21% 21%, 25% 6.7%, 39.4% 10.4%); }
.pshape[data-shape=hexagon] { clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%); }

/* แถบตะกร้า */
.cart-bar { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 20; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 14px; background: var(--line); color: #fff; padding: 14px 18px; font-size: 1.05rem; box-shadow: 0 6px 18px rgba(6,199,85,.35); }
.cart-bar .cnt { background: #fff; color: var(--line-dark); border-radius: 999px; min-width: 28px; padding: 1px 8px; font-weight: 700; text-align: center; }

/* bottom sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.4); opacity: 0; transition: opacity .25s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto; background: var(--card); border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .25s; }
.sheet-wrap.show .sheet-bg { opacity: 1; }
.sheet-wrap.show .sheet { transform: none; }
.sheet-pic .pic { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; background: #eef0f3 center / cover no-repeat; margin-bottom: 12px; }
.sheet-pic .pshape { width: 22%; }
.opts { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.opt { display: flex; align-items: center; gap: 10px; border: 1px solid var(--divider); border-radius: 10px; padding: 10px 12px; }
.opt span { flex: 1; }
.opt input { accent-color: var(--line); width: 18px; height: 18px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--divider); border-radius: 999px; }
.qty button { border: 0; background: none; width: 40px; height: 40px; font-size: 1.2rem; color: var(--line-dark); }
.qty span { min-width: 26px; text-align: center; font-weight: 600; }
.qty.sm button { width: 32px; height: 32px; font-size: 1rem; }
.cart-line { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--divider); }
.cart-line .amt { min-width: 70px; text-align: right; }

/* รายการของแคร่ */
.table-view { padding: 12px 14px 30px; }
.table-view .who { background: #e5f8ed; color: var(--line-dark); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; font-size: .9rem; }
.tline { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 10px; padding: 10px 12px; margin-bottom: 6px; }
.tline.mine { box-shadow: inset 3px 0 0 var(--line); }
.tline.total { background: none; font-size: 1.1rem; }
.st { display: inline-block; margin-top: 4px; font-size: .78rem; border-radius: 999px; padding: 1px 9px; background: #eef0f3; color: var(--muted); }
.st-cooking { background: #fff3cd; color: #8a6100; }
.st-ready { background: #e5f8ed; color: var(--line-dark); font-weight: 600; }
.st-served { background: #eef0f3; color: var(--muted); }

/* ปุ่มเรียกพนักงาน */
.call-btn { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: #fff; color: var(--line-dark); border-radius: 999px; padding: 6px 12px; font-size: .9rem; font-weight: 600; flex-shrink: 0; }
.call-btn i { font-size: 1.05rem; }
.call-btn.on { background: #fff3cd; border-color: #f0c36d; color: #8a6100; }
@media (max-width: 360px) { .call-btn span { display: none; } }

/* toast */
.toast-root { position: fixed; left: 12px; right: 12px; top: 12px; z-index: 100; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.tara-toast { border-radius: 10px; padding: 10px 14px; box-shadow: 0 4px 14px rgba(0,0,0,.15); transition: opacity .4s, transform .4s; }
.tara-toast.out { opacity: 0; transform: translateY(-8px); }

/* แตะรัว ๆ (ปุ่ม + / − ตอนนับสต็อก/จำนวนสินค้า, ‹ › เลือกวัน, การ์ดที่กดกาง) ไม่ให้ซูมจากการแตะสองครั้ง
 * และปุ่มตอบสนองทันที (ไม่ต้องรอดูการแตะครั้งที่สอง) · ซูมด้วยสองนิ้วยังได้ */
button, a, label, select, input, textarea, summary, [role=button], [tabindex] { touch-action: manipulation; }

/* ---------- บัญชีของฉัน (นโยบาย / ลบข้อมูลของฉัน) ---------- */
.avatar-btn { border: 0; background: none; padding: 0; flex-shrink: 0; line-height: 0; }
.avatar-lg { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-lg.none { display: inline-flex; align-items: center; justify-content: center; background: #e5f8ed; color: var(--line-dark); font-weight: 700; font-size: 1.2rem; }
.acct-row { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; border-top: 1px solid #eef0f3; background: none; padding: 14px 4px; text-align: left; font-size: 1rem; color: inherit; }
.acct-row span { flex: 1; }


/* ---------- หน้านโยบาย / เงื่อนไข (legal.html) ---------- */
.legal-page { max-width: 46rem; margin: 0 auto; padding: 1.5rem 1rem calc(3rem + env(safe-area-inset-bottom)); line-height: 1.65; }
.legal-page h1 { font-size: 1.35rem; margin: 0 0 .2rem; }
.legal-page .owner { color: #5b6675; margin: 0 0 1rem; }
.legal-body { background: #fff; border: 1px solid #e3e7ee; border-radius: 12px; padding: .5rem 1.1rem 1rem; overflow-wrap: anywhere; }
.legal-body h1, .legal-body h2, .legal-body h3 { font-size: 1.05rem; margin: 1rem 0 .3rem; }
.legal-body ul, .legal-body ol { padding-left: 1.2rem; margin: 0 0 .5rem; }
.legal-page .foot { font-size: .82rem; color: #5b6675; margin-top: .8rem; }
/* class จัดหน้าของ text editor (Quill) ที่ API อนุญาต */
.ql-align-center { text-align: center; } .ql-align-right { text-align: right; } .ql-align-justify { text-align: justify; }
.ql-indent-1 { padding-left: 2em; } .ql-indent-2 { padding-left: 4em; } .ql-indent-3 { padding-left: 6em; }

/* สินค้าชุดแบบเลือกได้ (itemSheet) */
.choice-group { margin-top: 10px; border: 1px solid var(--divider); border-radius: 10px; padding: 8px 12px; }
.choice-head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 4px; }
.choice-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--divider); }
.qty button:disabled { opacity: .35; }
