/* ══════════════════════════════════════════════════════════════
   West Village — Staff Hub
   แอปมือถือสำหรับพนักงาน (โทนมืดล้วน · คอนทราสต์สูง · ใช้ขณะยืนทำงาน)
   ธีมต่อยอดจาก westvillage.co
   ══════════════════════════════════════════════════════════════ */

:root{
  /* --- สี --- */
  --bg:#0F0C0A;
  --surface:#171210;
  --card:#1E1714;
  --card-2:#241C18;
  --coral:#FF603B;
  --brick:#8C3B2E;
  --amber:#FFC98F;
  --cream:#F6EEE3;
  --muted:#C9BCAC;
  --line:rgba(246,238,227,.12);
  --line-2:rgba(246,238,227,.07);
  --ok:#4E9A6B;
  --warn:#D9A036;
  --danger:#C4553F;

  /* ตัวอักษร: ทึบเสมอ ห้ามจาง */
  --text:rgba(246,238,227,.92);
  --text-2:rgba(246,238,227,.72);
  --text-3:rgba(246,238,227,.56);

  --font-display:"Montserrat","Anuphan",system-ui,-apple-system,sans-serif;
  --font-body:"Anuphan","Montserrat",system-ui,-apple-system,sans-serif;
  --font-script:"Great Vibes",cursive;

  --r-card:16px;
  --r-sm:12px;
  --r-sheet:20px;
  --r-pill:999px;

  --pad:16px;
  --topbar-h:52px;
  --segs-h:50px;
  --chips-h:52px;
  --tabbar-h:60px;

  --safe-t:env(safe-area-inset-top,0px);
  --safe-b:env(safe-area-inset-bottom,0px);
  --safe-l:env(safe-area-inset-left,0px);
  --safe-r:env(safe-area-inset-right,0px);

  --ease-sheet:cubic-bezier(.32,.72,0,1);
  --dur-sheet:260ms;
}

/* ระดับขนาดตัวอักษร (ปุ่ม Aa) — ทุกอย่างวัดเป็น rem จึงขยายทั้งแอป
   input ทุกช่องจึง ≥17px เสมอ = iOS ไม่ zoom เอง */
html{ font-size:17px; }
html[data-fs="2"]{ font-size:19px; }
html[data-fs="3"]{ font-size:21px; }

*,*::before,*::after{ box-sizing:border-box; }

html{
  background:var(--bg);
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
}

body{
  margin:0;
  min-height:100dvh;
  background:
    radial-gradient(1100px 620px at 50% -12%, rgba(140,59,46,.30), transparent 62%),
    radial-gradient(680px 420px at 100% 100%, rgba(255,96,59,.09), transparent 60%),
    var(--bg);
  background-attachment:fixed;
  color:var(--text);
  font-family:var(--font-body);
  font-size:1rem;
  line-height:1.65;
  overflow-wrap:break-word;
  -webkit-tap-highlight-color:transparent;
  -webkit-font-smoothing:antialiased;
}

body.locked{
  position:fixed;
  left:0; right:0;
  width:100%;
  overflow:hidden;
}

button,input,select,textarea{ font:inherit; color:inherit; }
button{ cursor:pointer; background:none; border:0; padding:0; }
a{ color:var(--amber); }
svg{ width:1.35rem; height:1.35rem; fill:none; stroke:currentColor; stroke-width:1.7;
     stroke-linecap:round; stroke-linejoin:round; }

:focus-visible{
  outline:2px solid var(--amber);
  outline-offset:2px;
  border-radius:6px;
}

/* ══════════════════════════════════════════════════════════════
   กลไกซ่อน/แสดง — จุดเดียว คุมด้วย display อย่างเดียว
   กติกา: ทุกหน้าจอ = .screen (default: none) + .is-on (แสดง)
          และ [hidden] เป็นตาข่ายกันพลาดชั้นสุดท้าย
   ══════════════════════════════════════════════════════════════ */
[hidden]{ display:none !important; }

.screen{ display:none; }
.screen.is-on{ display:flex; flex-direction:column; }

.app{ display:none; }
.app.is-on{ display:flex; flex-direction:column; min-height:100dvh; }

.sheets{ display:none; }
.sheets.is-on{ display:block; }

/* ══════════════════════════════════════════════════════════════
   primitives
   ══════════════════════════════════════════════════════════════ */

.eyebrow{
  display:block;
  font-family:var(--font-display);
  font-weight:700;
  font-size:.68rem;
  letter-spacing:.2em;
  text-transform:uppercase;
  color:var(--muted);
}

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:.5em;
  min-height:48px;
  padding:.7em 1.4em;
  border-radius:var(--r-pill);
  border:1px solid var(--line);
  background:rgba(246,238,227,.05);
  color:var(--text);
  font-family:var(--font-display);
  font-weight:600;
  letter-spacing:.03em;
  text-align:center;
  transition:transform .12s ease, background .18s ease, border-color .18s ease;
}
.btn:active{ transform:scale(.97); }
.btn-primary{ background:var(--coral); border-color:var(--coral); color:#180B06; font-weight:700; }
.btn-ghost{ background:rgba(246,238,227,.05); }
.btn-danger{ border-color:rgba(196,85,63,.6); color:#FF8A70; background:rgba(196,85,63,.10); }
.btn-lg{ width:100%; min-height:56px; font-size:1.02rem; }
.btn-sm{ min-height:44px; padding:.45em 1.1em; font-size:.88rem; }

.iconbtn{
  display:inline-flex; align-items:center; justify-content:center;
  width:44px; height:44px;
  border-radius:var(--r-pill);
  color:var(--text);
  transition:background .18s ease, transform .12s ease;
}
.iconbtn:active{ transform:scale(.92); background:rgba(246,238,227,.08); }
.iconbtn-aa{
  font-family:var(--font-display);
  font-weight:700;
  font-size:.92rem;
  letter-spacing:.02em;
  border:1px solid var(--line);
}

.tag{
  display:inline-flex; align-items:center; gap:.3em;
  padding:.22em .7em;
  border-radius:var(--r-pill);
  border:1px solid var(--line);
  background:rgba(246,238,227,.04);
  color:var(--text-2);
  font-size:.76rem;
  line-height:1.5;
  white-space:nowrap;
}
.tag.veg{ color:#9BD3AE; border-color:rgba(78,154,107,.45); background:rgba(78,154,107,.12); }
.tag.hours{ color:var(--amber); border-color:rgba(255,201,143,.34); background:rgba(255,201,143,.09); }
.tag.doc{ color:var(--amber); border-color:rgba(255,201,143,.3); }
.tag.edited{ color:var(--coral); border-color:rgba(255,96,59,.45); background:rgba(255,96,59,.10); }
.tag.fc-ok{ color:#9BD3AE; border-color:rgba(78,154,107,.5); }
.tag.fc-warn{ color:#F0C46A; border-color:rgba(217,160,54,.5); }
.tag.fc-bad{ color:#FF8A70; border-color:rgba(196,85,63,.6); }
/* ป้ายบอกว่าผลค้นหามาจากหมวดใหญ่ไหน (แท็บ · segment) */
.tag.where{ color:var(--coral); border-color:rgba(255,96,59,.38); background:rgba(255,96,59,.08); }

.num{ font-variant-numeric:tabular-nums; font-feature-settings:"tnum" 1; }

.fineprint{
  color:var(--text-3);
  font-size:.8rem;
  line-height:1.7;
  text-align:center;
}

.empty{
  padding:56px 20px;
  text-align:center;
  color:var(--text-2);
}

mark{
  background:rgba(255,96,59,.26);
  color:#FFD9CE;
  border-radius:4px;
  padding:0 .12em;
}

/* ══════════════════════════════════════════════════════════════
   1. LOGIN
   ══════════════════════════════════════════════════════════════ */

.screen-login{
  min-height:100dvh;
  align-items:center;
  justify-content:center;
  padding:calc(28px + var(--safe-t)) 20px calc(28px + var(--safe-b));
}

.login-card{
  width:100%;
  max-width:400px;
  background:linear-gradient(180deg, var(--card-2), var(--card));
  border:1px solid var(--line);
  border-radius:22px;
  padding:32px 22px 24px;
  box-shadow:0 26px 60px rgba(0,0,0,.55);
}

.brand{ text-align:center; margin-bottom:24px; }
.brand-script{
  display:block;
  font-family:var(--font-script);
  font-size:2.6rem;
  line-height:1.15;
  color:var(--coral);
}
.brand-word{
  margin:.2em 0 .35em;
  font-family:var(--font-display);
  font-weight:800;
  font-size:.9rem;
  letter-spacing:.32em;
  color:var(--text);
}
.brand-sub{ margin:0; color:var(--text-2); font-size:.85rem; }

#login-form{ display:block; }
#login-form .eyebrow{ margin-bottom:8px; }
#pw{
  width:100%;
  min-height:58px;
  padding:0 18px;
  border-radius:var(--r-card);
  border:1px solid var(--line);
  background:rgba(15,12,10,.75);
  color:var(--text);
  font-family:var(--font-display);
  font-size:1.15rem;
  font-weight:600;
  letter-spacing:.24em;
  text-align:center;
}
#pw::placeholder{ color:var(--text-3); letter-spacing:.05em; font-weight:400; }
#login-form .btn{ margin-top:14px; }

.err{
  margin:12px 0 0;
  padding:10px 14px;
  border-radius:var(--r-sm);
  border:1px solid rgba(196,85,63,.5);
  background:rgba(196,85,63,.14);
  color:#FFB6A6;
  font-size:.9rem;
  text-align:center;
}

.login-card .fineprint{ margin:22px 0 0; padding-top:18px; border-top:1px dashed var(--line); }

/* ══════════════════════════════════════════════════════════════
   2. TOP APP BAR + CHIPS
   ══════════════════════════════════════════════════════════════ */

.topbar{
  position:fixed;
  top:0; left:0; right:0;
  z-index:40;
  padding-top:var(--safe-t);
  background:rgba(15,12,10,.86);
  backdrop-filter:blur(18px) saturate(140%);
  -webkit-backdrop-filter:blur(18px) saturate(140%);
  border-bottom:1px solid var(--line-2);
  /* ซ่อน/แสดงด้วย transform เท่านั้น — layout ไม่กระตุก */
  transform:translateY(0);
  transition:transform 220ms var(--ease-sheet);
  will-change:transform;
}
.topbar.head-off{ transform:translateY(-100%); }

.topbar-row{
  display:flex; align-items:center; gap:8px;
  height:var(--topbar-h);
  padding:0 calc(10px + var(--safe-l)) 0 calc(var(--pad) + var(--safe-l));
}
.topbar-title{
  flex:1; min-width:0;
  margin:0;
  font-family:var(--font-display);
  font-weight:700;
  font-size:1.06rem;
  letter-spacing:.04em;
  color:var(--text);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.topbar-actions{ display:flex; align-items:center; gap:4px; }

/* ── ระดับ 2: segmented control ─────────────────────────────── */
.segs{
  display:flex;
  align-items:center;
  height:var(--segs-h);
  padding:0 calc(var(--pad) + var(--safe-r)) 8px calc(var(--pad) + var(--safe-l));
  overflow-x:auto;
  overflow-y:hidden;
  scroll-snap-type:x proximity;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:none;
}
.segs::-webkit-scrollbar{ display:none; }
.app.no-segs .segs{ display:none; }

.seg-group{
  display:inline-flex;
  flex:0 0 auto;
  min-width:100%;
  gap:3px;
  padding:3px;
  border-radius:var(--r-pill);
  border:1px solid var(--line);
  background:rgba(246,238,227,.045);
}
.seg{
  flex:1 0 auto;
  scroll-snap-align:center;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  min-height:36px;
  padding:0 16px;
  border-radius:var(--r-pill);
  color:var(--text-2);
  font-size:.88rem;
  font-weight:500;
  white-space:nowrap;
  transition:background .16s ease, color .16s ease, transform .12s ease;
}
.seg:active{ transform:scale(.97); }
.seg .seg-n{
  font-size:.72rem;
  font-weight:600;
  opacity:.62;
}
.seg[aria-current="true"]{
  background:var(--coral);
  color:#180B06;
  font-weight:700;
}
.seg[aria-current="true"] .seg-n{ opacity:.78; }

/* ── ระดับ 3: chips ─────────────────────────────────────────── */
.chips{
  display:flex;
  gap:8px;
  align-items:center;
  height:var(--chips-h);
  padding:0 calc(var(--pad) + var(--safe-r)) 10px calc(var(--pad) + var(--safe-l));
  overflow-x:auto;
  overflow-y:hidden;
  scroll-snap-type:x proximity;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:none;
}
.chips::-webkit-scrollbar{ display:none; }
.app.no-chips .chips{ display:none; }

.chip{
  flex:0 0 auto;
  scroll-snap-align:center;
  display:inline-flex; align-items:center;
  min-height:36px;
  padding:0 15px;
  border-radius:var(--r-pill);
  border:1px solid var(--line);
  background:rgba(246,238,227,.045);
  color:var(--text-2);
  font-size:.86rem;
  white-space:nowrap;
  transition:background .16s ease, color .16s ease, border-color .16s ease, transform .12s ease;
}
.chip:active{ transform:scale(.96); }
.chip[aria-current="true"]{
  background:var(--coral);
  border-color:var(--coral);
  color:#180B06;
  font-weight:600;
}

/* ══════════════════════════════════════════════════════════════
   3. LIST + CARDS
   ══════════════════════════════════════════════════════════════ */

.list{
  flex:1;
  padding:calc(var(--safe-t) + var(--topbar-h) + var(--segs-h) + var(--chips-h) + 6px)
          calc(var(--pad) + var(--safe-r))
          calc(var(--tabbar-h) + var(--safe-b) + 28px)
          calc(var(--pad) + var(--safe-l));
  outline:none;
}
.app.no-chips .list{
  padding-top:calc(var(--safe-t) + var(--topbar-h) + var(--segs-h) + 10px);
}
.app.no-segs .list{
  padding-top:calc(var(--safe-t) + var(--topbar-h) + var(--chips-h) + 6px);
}
.app.no-segs.no-chips .list{
  padding-top:calc(var(--safe-t) + var(--topbar-h) + 10px);
}

.group-head{
  display:flex; align-items:baseline; justify-content:space-between; gap:10px;
  margin:22px 2px 10px;
}
.group-head:first-child{ margin-top:6px; }
.group-head h2{
  margin:0;
  font-family:var(--font-display);
  font-weight:700;
  font-size:.78rem;
  letter-spacing:.18em;
  text-transform:uppercase;
  color:var(--amber);
}
.group-head .n{ color:var(--text-3); font-size:.76rem; white-space:nowrap; }

.card{
  display:flex;
  flex-direction:column;
  gap:6px;
  width:100%;
  min-height:72px;
  margin-bottom:10px;
  padding:14px 16px;
  border-radius:var(--r-card);
  border:1px solid var(--line-2);
  background:var(--card);
  color:var(--text);
  text-align:left;
  transition:transform .12s var(--ease-sheet), background .16s ease, border-color .16s ease;
}
.card:active{ transform:scale(.98); background:var(--card-2); }

.card-top{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.card-name{
  font-weight:700;
  font-size:1rem;
  line-height:1.4;
  color:var(--text);
}
.card-en{
  display:block;
  margin-top:1px;
  font-family:var(--font-display);
  font-weight:500;
  font-size:.78rem;
  letter-spacing:.05em;
  color:var(--text-2);
}
.card-price{
  flex:0 0 auto;
  font-family:var(--font-display);
  font-weight:700;
  font-size:1rem;
  color:var(--amber);
  font-variant-numeric:tabular-nums;
  font-feature-settings:"tnum" 1;
  text-align:right;
  padding-top:1px;
}
.card-desc{
  color:var(--text-2);
  font-size:.86rem;
  line-height:1.55;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.card-meta{ display:flex; flex-wrap:wrap; gap:6px; }

.card.doc{
  background:linear-gradient(180deg, var(--card-2), var(--card));
  border-color:var(--line);
  border-left:3px solid rgba(255,201,143,.5);
}

.list-foot{
  margin:26px 2px 0;
  padding-top:16px;
  border-top:1px dashed var(--line);
}

/* ══════════════════════════════════════════════════════════════
   4. BOTTOM TAB BAR
   ══════════════════════════════════════════════════════════════ */

.tabbar{
  position:fixed;
  left:0; right:0; bottom:0;
  z-index:45;
  display:flex;
  align-items:stretch;
  height:calc(var(--tabbar-h) + var(--safe-b));
  padding:0 calc(6px + var(--safe-r)) var(--safe-b) calc(6px + var(--safe-l));
  background:rgba(23,18,16,.94);
  backdrop-filter:blur(20px) saturate(140%);
  -webkit-backdrop-filter:blur(20px) saturate(140%);
  border-top:1px solid var(--line);
}

.tab{
  flex:1 1 0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:3px;
  min-width:44px;
  min-height:44px;
  padding:6px 2px 4px;
  color:var(--text-3);
  font-size:.7rem;
  line-height:1.25;
  position:relative;
  transition:color .16s ease, transform .12s ease;
}
.tab:active{ transform:scale(.94); }
.tab svg{ width:1.45rem; height:1.45rem; }
.tab .tab-label{ font-weight:500; letter-spacing:.02em; }
.tab[aria-current="true"]{ color:var(--coral); }
.tab[aria-current="true"] .tab-label{ font-weight:700; }
.tab[aria-current="true"]::before{
  content:"";
  position:absolute;
  top:0; left:50%;
  margin-left:-13px;
  width:26px; height:3px;
  border-radius:0 0 3px 3px;
  background:var(--coral);
}

/* ══════════════════════════════════════════════════════════════
   5. SHEETS (รายละเอียด / editor) — สไลด์ขึ้นจากล่าง ซ้อนกันได้
   ══════════════════════════════════════════════════════════════ */

.sheets{
  position:fixed;
  inset:0;
  z-index:60;
}

.sheet{
  position:fixed;
  inset:0;
  display:flex;
  flex-direction:column;
  background:var(--bg);
  border-radius:var(--r-sheet) var(--r-sheet) 0 0;
  overflow:hidden;
  box-shadow:0 -18px 60px rgba(0,0,0,.6);
  /* fill-mode = backwards เท่านั้น — ถ้าใช้ both ค่า transform ของ animation
     จะทับ inline transform ที่ใช้ตอนลากนิ้ว (animation ชนะ inline style ใน cascade) */
  animation:sheet-in var(--dur-sheet) var(--ease-sheet) backwards;
  transition:transform 220ms var(--ease-sheet);
  /* หมายเหตุ: ห้ามใส่ touch-action:pan-y ที่นี่ — ลูกหลานจะเลื่อนตารางแนวนอนไม่ได้
     (ancestor เป็นตัวจำกัด) การปัดขวาเพื่อย้อนกลับคุมด้วย JS ใน bindSwipeBack แทน */
}
.sheet.is-closing{ animation:sheet-out 200ms var(--ease-sheet) both; }
.sheet.is-dragging{ animation:none; transition:none; }

@keyframes sheet-in{
  from{ transform:translateY(100%); }
  to{ transform:translateY(0); }
}
@keyframes sheet-out{
  from{ transform:translateY(0); }
  to{ transform:translateY(100%); }
}

.sheet-bar{
  display:flex; align-items:center; gap:6px;
  flex:0 0 auto;
  padding-top:var(--safe-t);
  padding-right:calc(10px + var(--safe-r));
  padding-left:calc(6px + var(--safe-l));
  background:rgba(15,12,10,.92);
  backdrop-filter:blur(18px);
  -webkit-backdrop-filter:blur(18px);
  border-bottom:1px solid var(--line-2);
}
.sheet-back{
  display:flex; align-items:center; gap:4px;
  flex:1; min-width:0;
  min-height:54px;
  padding:0 6px;
  color:var(--text);
  text-align:left;
}
.sheet-back svg{ flex:0 0 auto; width:1.5rem; height:1.5rem; color:var(--coral); }
.sheet-back .t{
  flex:1; min-width:0;
  font-family:var(--font-display);
  font-weight:700;
  font-size:1rem;
  letter-spacing:.02em;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.sheet-bar-actions{ display:flex; align-items:center; gap:4px; flex:0 0 auto; }

.sheet-body{
  flex:1;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
  padding:18px calc(var(--pad) + var(--safe-r)) calc(120px + var(--safe-b)) calc(var(--pad) + var(--safe-l));
}

/* หัวเรื่องในหน้ารายละเอียด */
.d-head{ margin:0 0 18px; }
.d-head h1{
  margin:0;
  font-size:1.5rem;
  line-height:1.35;
  font-weight:700;
  color:var(--cream);
}
.d-en{
  margin:4px 0 0;
  font-family:var(--font-display);
  font-weight:500;
  font-size:.86rem;
  letter-spacing:.08em;
  color:var(--text-2);
  text-transform:uppercase;
}
.d-price{
  margin-top:10px;
  font-family:var(--font-display);
  font-weight:800;
  font-size:1.5rem;
  color:var(--amber);
  font-variant-numeric:tabular-nums;
  font-feature-settings:"tnum" 1;
}
.d-desc{ margin:10px 0 0; color:var(--text-2); font-size:.93rem; line-height:1.7; }
.d-meta{ display:flex; flex-wrap:wrap; gap:6px; margin:14px 0 4px; }

/* บล็อกเนื้อหา */
.block{
  margin:14px 0;
  padding:16px;
  border-radius:var(--r-card);
  border:1px solid var(--line-2);
  background:var(--card);
}
.block > .eyebrow{ margin-bottom:12px; }
.block.warn{
  border-color:rgba(217,160,54,.42);
  background:linear-gradient(180deg, rgba(217,160,54,.10), rgba(30,23,20,.9));
}
.block.warn > .eyebrow{ color:#F0C46A; }
.block.cost{
  border-color:rgba(255,96,59,.42);
  background:linear-gradient(180deg, rgba(140,59,46,.22), var(--card-2));
}
.block.cost > .eyebrow{ color:var(--coral); }
.secret-note{
  display:flex; align-items:center; gap:.4em;
  margin:-4px 0 12px;
  color:#FFB6A6;
  font-size:.8rem;
}

/* ส่วนผสม */
.ing{ list-style:none; margin:0; padding:0; }
.ing li{
  display:flex; align-items:flex-start; justify-content:space-between; gap:14px;
  padding:11px 0;
  border-bottom:1px dashed var(--line-2);
}
.ing li:last-child{ border-bottom:0; padding-bottom:0; }
.ing .n{ flex:1; min-width:0; line-height:1.55; }
.ing .n small{ display:block; color:var(--text-3); font-size:.8rem; }
.ing .q{
  flex:0 0 auto;
  color:var(--amber);
  font-family:var(--font-display);
  font-weight:600;
  font-size:.9rem;
  font-variant-numeric:tabular-nums;
  font-feature-settings:"tnum" 1;
  text-align:right;
  white-space:nowrap;
}
.lnk{
  display:inline-flex; align-items:center; gap:.3em;
  min-height:32px;
  color:var(--coral);
  font-weight:600;
  text-align:left;
  text-decoration:underline;
  text-underline-offset:3px;
  text-decoration-color:rgba(255,96,59,.4);
}
.lnk:active{ opacity:.7; }

/* ขั้นตอนแบบเลขวงกลม */
.steps{ list-style:none; counter-reset:s; margin:0; padding:0; }
.steps li{
  counter-increment:s;
  position:relative;
  min-height:32px;
  padding:0 0 16px 44px;
  line-height:1.65;
}
.steps li:last-child{ padding-bottom:0; }
.steps li::before{
  content:counter(s);
  position:absolute; left:0; top:0;
  display:flex; align-items:center; justify-content:center;
  width:30px; height:30px;
  border-radius:50%;
  border:1px solid rgba(255,96,59,.55);
  background:rgba(255,96,59,.13);
  color:var(--coral);
  font-family:var(--font-display);
  font-weight:700;
  font-size:.82rem;
  font-variant-numeric:tabular-nums;
}

.bul{ list-style:none; margin:0; padding:0; }
.bul li{ position:relative; padding:0 0 10px 20px; line-height:1.65; }
.bul li:last-child{ padding-bottom:0; }
.bul li::before{
  content:"";
  position:absolute; left:4px; top:.72em;
  width:6px; height:6px;
  border-radius:50%;
  background:var(--coral);
}
.block.warn .bul li::before{ background:var(--warn); }

/* ตารางคีย์-ค่า 2 คอลัมน์ (อ่านบนมือถือได้) */
.kv{
  display:grid;
  grid-template-columns:minmax(6.5em,40%) 1fr;
  gap:0;
  margin:0;
}
.kv dt{
  padding:10px 12px 10px 0;
  border-bottom:1px dashed var(--line-2);
  color:var(--text-2);
  font-size:.88rem;
}
.kv dd{
  margin:0;
  padding:10px 0;
  border-bottom:1px dashed var(--line-2);
  color:var(--text);
  font-size:.93rem;
}
.kv dt:last-of-type, .kv dd:last-of-type{ border-bottom:0; }
.kv code{
  font-family:ui-monospace,Menlo,Consolas,monospace;
  font-size:.85em;
  color:var(--amber);
  background:rgba(255,201,143,.10);
  padding:.1em .4em;
  border-radius:5px;
}

/* ตาราง */
.tbl-wrap{
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  margin:0 -4px;
  padding:0 4px;
}
.tbl{
  width:100%;
  min-width:min(100%, 460px);
  border-collapse:collapse;
  font-size:.88rem;
}
.tbl th,.tbl td{
  padding:10px 10px;
  text-align:left;
  border-bottom:1px solid var(--line-2);
  vertical-align:top;
}
.tbl th{
  font-family:var(--font-display);
  font-weight:700;
  font-size:.72rem;
  letter-spacing:.1em;
  text-transform:uppercase;
  color:var(--muted);
  white-space:nowrap;
}
.tbl td.num{
  text-align:right;
  font-variant-numeric:tabular-nums;
  font-feature-settings:"tnum" 1;
  white-space:nowrap;
}
.tbl tr.total td{
  border-top:1px solid var(--line);
  border-bottom:0;
  font-weight:700;
  color:var(--amber);
}

.fc-big{
  display:flex; align-items:center; gap:12px;
  margin-top:14px;
  padding:14px 16px;
  border-radius:var(--r-card);
  border:1px solid var(--line);
  background:rgba(15,12,10,.6);
}
.fc-big b{
  font-family:var(--font-display);
  font-size:1.6rem;
  font-weight:800;
  font-variant-numeric:tabular-nums;
}
.fc-big span{ color:var(--text-2); font-size:.84rem; line-height:1.5; }
.fc-big.ok b{ color:#9BD3AE; }
.fc-big.warn b{ color:#F0C46A; }
.fc-big.bad b{ color:#FF8A70; }

/* เอกสาร: สารบัญพับได้ */
.doc-toc{ padding:0; overflow:hidden; }
.doc-toc summary{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  min-height:52px;
  padding:0 16px;
  list-style:none;
  cursor:pointer;
}
.doc-toc summary::-webkit-details-marker{ display:none; }
.doc-toc summary .eyebrow{ margin:0; }
.doc-toc summary .caret{
  transition:transform .2s ease;
  color:var(--coral);
  font-size:1.1rem;
  line-height:1;
}
.doc-toc[open] summary .caret{ transform:rotate(180deg); }
.doc-toc ol{
  list-style:none;
  counter-reset:toc;
  margin:0;
  padding:0 16px 10px;
  border-top:1px solid var(--line-2);
}
.doc-toc li{ counter-increment:toc; }
.doc-toc li button{
  display:flex; align-items:center; gap:10px;
  width:100%;
  min-height:48px;
  padding:8px 0;
  color:var(--text);
  text-align:left;
  border-bottom:1px dashed var(--line-2);
  line-height:1.5;
}
.doc-toc li:last-child button{ border-bottom:0; }
.doc-toc li button::before{
  content:counter(toc);
  flex:0 0 auto;
  width:24px;
  color:var(--coral);
  font-family:var(--font-display);
  font-weight:700;
  font-size:.8rem;
  font-variant-numeric:tabular-nums;
}

/* เช็คลิสต์ — กล่องติ๊กใหญ่ ≥28px */
.chk{ list-style:none; margin:0; padding:0; }
.chk li{ border-bottom:1px dashed var(--line-2); }
.chk li:last-child{ border-bottom:0; }
.chk label{
  display:flex; align-items:flex-start; gap:14px;
  min-height:52px;
  padding:11px 0;
  cursor:pointer;
  line-height:1.6;
}
.chk input[type="checkbox"]{
  flex:0 0 auto;
  appearance:none;
  -webkit-appearance:none;
  width:30px; height:30px;
  margin:2px 0 0;
  border-radius:9px;
  border:2px solid rgba(246,238,227,.34);
  background:rgba(15,12,10,.5);
  position:relative;
  transition:background .14s ease, border-color .14s ease;
}
.chk input[type="checkbox"]:checked{ background:var(--ok); border-color:var(--ok); }
.chk input[type="checkbox"]:checked::after{
  content:"";
  position:absolute; left:10px; top:4px;
  width:7px; height:14px;
  border:solid #0F0C0A;
  border-width:0 3px 3px 0;
  transform:rotate(45deg);
}
.chk input[type="checkbox"]:checked + span{ color:var(--text-3); text-decoration:line-through; }

.doc-reset{
  display:block;
  width:100%;
  min-height:50px;
  margin-top:10px;
  border-radius:var(--r-pill);
  border:1px dashed var(--line);
  background:rgba(246,238,227,.04);
  color:var(--text-2);
  font-size:.9rem;
}

/* FAB แก้ไข (owner) */
.fab{
  position:absolute;
  right:calc(18px + var(--safe-r));
  bottom:calc(24px + var(--safe-b));
  z-index:5;
  display:flex; align-items:center; gap:.45em;
  min-height:54px;
  padding:0 22px;
  border-radius:var(--r-pill);
  background:var(--coral);
  color:#180B06;
  font-family:var(--font-display);
  font-weight:700;
  box-shadow:0 12px 30px rgba(255,96,59,.34);
  transition:transform .12s ease;
}
.fab:active{ transform:scale(.95); }
.fab svg{ width:1.2rem; height:1.2rem; stroke-width:2; }

/* ══════════════════════════════════════════════════════════════
   6. SEARCH (เต็มจอ)
   ══════════════════════════════════════════════════════════════ */

.screen-search{
  position:fixed;
  inset:0;
  z-index:70;
  background:var(--bg);
}
.search-head{
  display:flex; align-items:center; gap:6px;
  flex:0 0 auto;
  padding:var(--safe-t) calc(10px + var(--safe-r)) 10px calc(6px + var(--safe-l));
  border-bottom:1px solid var(--line-2);
  background:rgba(15,12,10,.94);
}
.search-input{
  flex:1; min-width:0;
  min-height:48px;
  padding:0 16px;
  border-radius:var(--r-pill);
  border:1px solid var(--line);
  background:var(--card);
  color:var(--text);
  font-size:1rem;
}
.search-input::placeholder{ color:var(--text-3); }
.search-input::-webkit-search-cancel-button{ display:none; }

.search-body{
  flex:1;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  padding:14px calc(var(--pad) + var(--safe-r)) calc(40px + var(--safe-b)) calc(var(--pad) + var(--safe-l));
}
.hit-where{
  display:flex; flex-wrap:wrap; align-items:center; gap:6px;
  margin-top:2px;
}
.hit-snip{
  color:var(--text-2);
  font-size:.84rem;
  line-height:1.55;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.recent{ list-style:none; margin:0; padding:0; }
.recent li button{
  display:flex; align-items:center; gap:12px;
  width:100%;
  min-height:52px;
  padding:8px 2px;
  color:var(--text);
  text-align:left;
  border-bottom:1px dashed var(--line-2);
}
.recent li button svg{ color:var(--text-3); flex:0 0 auto; }

/* ══════════════════════════════════════════════════════════════
   7. หน้า "ฉัน"
   ══════════════════════════════════════════════════════════════ */

.me-head{
  display:flex; align-items:center; gap:14px;
  margin:6px 0 18px;
}
.me-avatar{
  display:flex; align-items:center; justify-content:center;
  width:60px; height:60px;
  flex:0 0 auto;
  border-radius:20px;
  border:1px solid rgba(255,96,59,.4);
  background:linear-gradient(180deg, rgba(140,59,46,.5), rgba(30,23,20,.9));
  color:var(--coral);
  font-family:var(--font-display);
  font-weight:800;
  font-size:1.2rem;
}
.me-role{ margin:0; font-size:1.2rem; font-weight:700; }
.me-sub{ margin:2px 0 0; color:var(--text-2); font-size:.86rem; }

.menu-list{ list-style:none; margin:0; padding:0; }
.menu-list li{ border-bottom:1px solid var(--line-2); }
.menu-list li:last-child{ border-bottom:0; }
.menu-list button{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  width:100%;
  min-height:56px;
  padding:10px 2px;
  color:var(--text);
  text-align:left;
  font-size:.98rem;
}
.menu-list .hint{ color:var(--text-3); font-size:.82rem; flex:0 0 auto; }
.menu-list button.danger{ color:var(--coral); }

/* ══════════════════════════════════════════════════════════════
   8. FORM / EDITOR
   ══════════════════════════════════════════════════════════════ */

.field{ margin-bottom:16px; }
.field:last-child{ margin-bottom:0; }
.field label{
  display:block;
  margin-bottom:7px;
  color:var(--text-2);
  font-size:.86rem;
}
.field input, .field select, .field textarea{
  width:100%;
  min-height:52px;
  padding:13px 14px;
  border-radius:var(--r-sm);
  border:1px solid var(--line);
  background:rgba(15,12,10,.6);
  color:var(--text);
  font-size:1rem;      /* ≥17px — iOS ไม่ zoom */
  line-height:1.55;
}
.field textarea{ min-height:150px; resize:vertical; }
.field input:focus, .field select:focus, .field textarea:focus{
  border-color:rgba(255,96,59,.6);
  outline:none;
}
.field input[readonly], .field select[disabled]{ opacity:.66; }
.field .hint{ display:block; margin-top:6px; color:var(--text-3); font-size:.8rem; }
.field code{
  font-family:ui-monospace,Menlo,Consolas,monospace;
  font-size:.86em;
  color:var(--amber);
}
.row2{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }

.sticky-actions{
  position:sticky;
  bottom:0;
  z-index:4;
  display:flex; gap:10px;
  margin:22px -4px 0;
  padding:14px 4px calc(14px + var(--safe-b));
  background:linear-gradient(180deg, rgba(15,12,10,0), var(--bg) 26%);
}
.sticky-actions .btn{ flex:1; min-height:54px; }

/* ══════════════════════════════════════════════════════════════
   9. TOAST
   ══════════════════════════════════════════════════════════════ */

.toast{
  position:fixed;
  left:50%;
  bottom:calc(var(--tabbar-h) + var(--safe-b) + 18px);
  transform:translateX(-50%);
  z-index:90;
  max-width:min(92vw,420px);
  padding:13px 20px;
  border-radius:var(--r-pill);
  border:1px solid var(--line);
  background:rgba(36,28,24,.97);
  color:var(--text);
  font-size:.9rem;
  text-align:center;
  box-shadow:0 14px 40px rgba(0,0,0,.55);
  animation:toast-in 200ms var(--ease-sheet) both;
}
.toast.bad{ border-color:rgba(196,85,63,.65); color:#FFB6A6; }
@keyframes toast-in{
  from{ opacity:0; transform:translate(-50%,14px); }
  to{ opacity:1; transform:translate(-50%,0); }
}

/* ══════════════════════════════════════════════════════════════
   10. จอใหญ่ / เข้าถึงง่าย
   ══════════════════════════════════════════════════════════════ */

@media (min-width:640px){
  .list, .search-body, .sheet-body{
    max-width:720px;
    margin:0 auto;
  }
  .topbar-row, .segs, .chips{ max-width:720px; margin:0 auto; }
}

@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{
    animation-duration:1ms !important;
    animation-iteration-count:1 !important;
    transition-duration:1ms !important;
    scroll-behavior:auto !important;
  }
}

/* โลโก้จริงบนหน้าล็อกอิน */
.brand-logo{
  display:block; width:min(240px, 72%); height:auto; margin:0 auto 14px;
}
.brand-word{
  font-family:var(--font-display); font-weight:700; font-size:.78rem;
  letter-spacing:.42em; text-indent:.42em; text-transform:uppercase;
  color:rgba(246,238,227,.62); text-align:center; margin:0;
}

/* ══════════════════════════════════════════════════════════════
   แท็บต้นทุน — ฐานข้อมูลวัตถุดิบกลาง + food cost ต่อเมนู
   (โผล่เฉพาะ role owner / partner — bar/kitchen ไม่เห็นแท็บนี้เลย)
   ══════════════════════════════════════════════════════════════ */

/* ไอคอนแท็บแบบอีโมจิ ให้กินพื้นที่เท่ากับไอคอน svg ตัวอื่น */
.tab .tab-emoji{
  display:block;
  width:1.45rem; height:1.45rem;
  font-size:1.16rem; line-height:1.45rem;
  text-align:center;
  filter:saturate(.9);
}

/* ป้ายเตือน "ยังไม่ยืนยัน" — สีเตือน ไม่ใช่สีอันตราย */
.tag.unverified{
  color:#F0C46A;
  border-color:rgba(217,160,54,.55);
  background:rgba(217,160,54,.13);
  font-weight:600;
}
.tag.ok-tag{
  color:#9BD3AE;
  border-color:rgba(78,154,107,.5);
  background:rgba(78,154,107,.10);
}

/* ช่องค้นหาวัตถุดิบ */
.ing-search{ margin:0 0 12px; }
.ing-search input{
  width:100%;
  min-height:46px;
  padding:11px 14px;
  border-radius:var(--r-card);
  border:1px solid var(--line);
  background:var(--card-2);
  color:var(--text);
  font-family:var(--font-body);
  font-size:1rem;
}
.ing-search input:focus{
  outline:none;
  border-color:var(--coral);
  box-shadow:0 0 0 3px rgba(255,96,59,.16);
}

.ing-row .card-price small{
  font-family:var(--font-body);
  font-weight:500;
  font-size:.72rem;
  color:var(--text-3);
}

/* การ์ดเมนูในหน้า "ต้นทุน → เมนู" — แถบสีตามระดับ food cost */
.fc-row{
  position:relative;
  padding-left:20px;
}
.fc-row::before{
  content:"";
  position:absolute;
  left:0; top:0; bottom:0;
  width:5px;
  border-radius:var(--r-card) 0 0 var(--r-card);
  background:var(--text-3);
}
.fc-row.fc-ok::before{ background:var(--ok); }
.fc-row.fc-warn::before{ background:var(--warn); }
.fc-row.fc-bad::before{ background:var(--danger); }

.fc-badge{
  flex:0 0 auto;
  font-family:var(--font-display);
  font-weight:800;
  font-size:1.02rem;
  font-variant-numeric:tabular-nums;
  color:var(--text-2);
}
.fc-badge.ok{ color:#9BD3AE; }
.fc-badge.warn{ color:#F0C46A; }
.fc-badge.bad{ color:#FF8A70; }

/* คำเตือนในบล็อกต้นทุนของหน้ารายละเอียดเมนู */
.cost-warn{
  margin:0 0 12px;
  padding:10px 12px;
  border-radius:var(--r-sm, 10px);
  border:1px solid rgba(217,160,54,.45);
  background:rgba(217,160,54,.10);
  color:#F0C46A;
  font-size:.86rem;
  line-height:1.55;
}

/* บรรทัดต้นทุนที่ไม่ใช่วัตถุดิบ ในตารางต้นทุน */
.tbl tr.extra td{ color:var(--text-3); font-style:italic; }

/* กล่องคำนวณต้นทุนต่อหน่วยสด ๆ ใน sheet แก้ราคาวัตถุดิบ */
.calc-box{
  margin-top:14px;
  padding:12px 14px;
  border-radius:var(--r-card);
  border:1px solid rgba(255,96,59,.34);
  background:rgba(255,96,59,.07);
}
.calc-box .kv{ margin:0; }
.calc-box .kv dd b{ color:var(--coral); font-size:1.06rem; }
