/* Tanah Mympi guest app */
:root { --tabh: 62px; --col: 560px; }
html, body { min-height: 100%; }
body { overscroll-behavior-y: none; }
.col { max-width: var(--col); margin: 0 auto; padding: 0 16px; }
[hidden] { display: none !important; }

/* ---------- centred screens (sign in, checked out) ---------- */
.screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 32px 20px; max-width: 440px; margin: 0 auto; }
.screen .wordmark { font-size: 2rem; color: var(--teal); text-align: center; }
.screen .tag { text-align: center; font-family: var(--font-breakout); font-style: italic; font-size: 1.15rem; color: var(--muted); margin: 6px 0 28px; }
.screen h1 { font-size: var(--fs-h1); text-align: center; color: var(--teal); }
.screen p.lead { text-align: center; margin: 14px 0 24px; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 6px; }
.pin { letter-spacing: 0.6em; text-align: center; font-size: 1.5rem; }
.help { font-size: 0.9rem; color: var(--muted); margin: 14px 0 0; text-align: center; }
.err { color: var(--danger); font-size: 0.95rem; margin: 10px 0 0; }
.btn.block { width: 100%; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--navy) 50%), linear-gradient(135deg, var(--navy) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }

/* ---------- shell ---------- */
.main { padding-bottom: calc(var(--tabh) + env(safe-area-inset-bottom) + 90px); }
.panel { padding-top: 6px; }
.head { padding: calc(env(safe-area-inset-top) + 22px) 0 12px; }
.head .wm { font-size: 0.8rem; color: var(--muted); }
.head h1 { font-size: var(--fs-h1); color: var(--teal); margin-top: 4px; }
.head p { margin: 2px 0 0; color: var(--muted); }
.page-title { font-size: var(--fs-h1); color: var(--teal); padding: calc(env(safe-area-inset-top) + 22px) 0 10px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--white); border-top: 1px solid var(--sand); padding-bottom: env(safe-area-inset-bottom); }
.tabbar .in { max-width: var(--col); margin: 0 auto; display: flex; }
.tab { flex: 1; min-height: var(--tabh); background: none; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 0.8rem; position: relative; }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--sea); }
.tab .badge { position: absolute; top: 7px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--teal); color: var(--cream); font-size: 0.72rem; line-height: 18px; text-align: center; }

.cartbar { position: fixed; left: 0; right: 0; z-index: 25; bottom: calc(var(--tabh) + env(safe-area-inset-bottom) + 10px); padding: 0 16px; pointer-events: none; }
.cartbar button { pointer-events: auto; display: flex; width: 100%; max-width: calc(var(--col) - 32px); margin: 0 auto; min-height: 54px; align-items: center; justify-content: space-between; gap: 10px; background: var(--teal); color: var(--cream); border: 0; border-radius: var(--radius-pill); padding: 0 24px; box-shadow: var(--shadow-lg); font-size: 1rem; }
.cartbar button:active { background: var(--teal-dark); }

/* ---------- menu ---------- */
.chips { position: sticky; top: 0; z-index: 20; background: var(--cream); margin: 0 -16px; padding: calc(env(safe-area-inset-top) + 8px) 16px 8px; border-bottom: 1px solid var(--sand-light); }
.chips .scroll { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips .scroll::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 44px; padding: 0 18px; border-radius: var(--radius-pill); border: 1px solid var(--sand); background: var(--white); white-space: nowrap; }
.chip.on { background: var(--teal); border-color: var(--teal); color: var(--cream); }
.kind-title { font-size: var(--fs-h2); color: var(--teal); margin: 26px 0 0; padding-bottom: 6px; border-bottom: 1px solid var(--sand); }
.cat { scroll-margin-top: calc(env(safe-area-inset-top) + 72px); }
.cat h3 { font-size: var(--fs-h3); margin: 20px 0 4px; }
.item { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--sand-light); }
.item .info { min-width: 0; flex: 1; }
.item .name { font-size: 1.05rem; font-weight: 500; }
.item .desc { font-size: 0.9rem; color: var(--muted); margin-top: 1px; }
.item .price { font-size: 0.95rem; margin-top: 3px; color: var(--teal); }
.item.off { opacity: 0.5; }
.item.off .price { color: var(--muted); }
.ctl { flex: none; }
.add { min-width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--teal); background: var(--white); color: var(--teal); font-size: 1.5rem; line-height: 1; padding: 0 14px; }
.add:active { background: var(--sand-light); }
.step { display: inline-flex; align-items: center; background: var(--teal); color: var(--cream); border-radius: 22px; }
.step button { width: 44px; height: 44px; background: none; border: 0; color: inherit; font-size: 1.4rem; line-height: 1; }
.step .q { min-width: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.step.sm button { width: 40px; height: 40px; }
.na { font-size: 0.85rem; color: var(--muted); padding: 0 6px; }

/* ---------- cards & states ---------- */
.card { padding: 16px; margin-bottom: 14px; }
.state { text-align: center; padding: 56px 20px; color: var(--muted); }
.state h3 { color: var(--navy); font-size: var(--fs-h3); margin-bottom: 6px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--sand); border-top-color: var(--teal); border-radius: 50%; margin: 0 auto 12px; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.banner { background: #e6f1ea; border: 1px solid #b9d8c7; color: #1f5a40; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px; }
.banner.warn { background: #fbf1dc; border-color: #ecd49a; color: #7a5410; }

/* ---------- orders ---------- */
.order .top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.order .num-id { font-family: var(--font-display); font-size: 1.3rem; }
.order .meta { color: var(--muted); font-size: 0.92rem; margin-top: 2px; }
.order ul { list-style: none; margin: 12px 0 0; padding: 0; }
.order li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.order li .ln { color: var(--muted); font-size: 0.88rem; }
.order .tot { display: flex; justify-content: space-between; border-top: 1px solid var(--sand-light); margin-top: 8px; padding-top: 8px; font-weight: 600; }
.track { display: flex; margin: 14px 0 4px; }
.track .s { flex: 1; text-align: center; position: relative; font-size: 0.78rem; color: var(--muted); }
.track .s::before { content: ''; position: absolute; top: 9px; left: -50%; width: 100%; height: 2px; background: var(--sand); }
.track .s:first-child::before { display: none; }
.track .dot { position: relative; z-index: 1; display: block; width: 20px; height: 20px; border-radius: 50%; background: var(--white); border: 2px solid var(--sand); margin: 0 auto 4px; }
.track .s.done .dot { background: var(--teal); border-color: var(--teal); }
.track .s.done::before { background: var(--teal); }
.track .s.cur { color: var(--teal); font-weight: 600; }
.track .s.cur .dot { box-shadow: 0 0 0 4px rgba(5, 86, 111, 0.3); }
.pill { display: inline-block; padding: 3px 12px; border-radius: var(--radius-pill); font-size: 0.85rem; background: var(--sand-light); }
.pill.cancelled { background: #f6dcd5; color: var(--danger); }
.order.cancelled { opacity: 0.85; border-style: dashed; }
.order.cancelled .tot span:last-child, .order.cancelled li span:last-child { text-decoration: line-through; }

/* ---------- account / bill ---------- */
.member { font-family: var(--font-display); font-size: 1.35rem; color: var(--teal); margin: 20px 0 8px; display: flex; justify-content: space-between; align-items: baseline; }
.member small { font-family: var(--font-body); font-size: 0.95rem; color: var(--navy); }
.bo .when { color: var(--muted); font-size: 0.88rem; margin-bottom: 4px; }
.bo li { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; list-style: none; }
.bo ul { margin: 0; padding: 0; }
.bo .ot { display: flex; justify-content: space-between; border-top: 1px solid var(--sand-light); margin-top: 6px; padding-top: 6px; font-size: 0.95rem; }
.sumrow { display: flex; justify-content: space-between; padding: 5px 0; }
.sumrow.total { font-weight: 600; border-top: 1px solid var(--sand); margin-top: 6px; padding-top: 10px; }
.balance { text-align: center; padding: 22px 16px; }
.balance .lbl { color: var(--muted); }
.balance .amt { font-family: var(--font-display); font-size: 2.8rem; color: var(--teal); line-height: 1.1; }
.confirmed { text-align: center; color: var(--success); }
.confirmed h3 { color: var(--success); font-size: var(--fs-h3); }
.explain { font-size: 0.92rem; color: var(--muted); margin: 0 0 12px; }
.signout { margin: 28px 0 8px; text-align: center; }
.signout .btn { color: var(--muted); font-size: 0.95rem; }

/* ---------- sheet ---------- */
.backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(47, 56, 80, 0.45); display: flex; align-items: flex-end; justify-content: center; animation: fade 0.15s; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.sheet { background: var(--cream); width: 100%; max-width: var(--col); max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column; border-radius: 22px 22px 0 0; animation: rise 0.2s; }
.sheet .sh { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 8px; }
.sheet .sh h2 { font-size: var(--fs-h2); color: var(--teal); }
.sheet .sb { overflow-y: auto; padding: 0 20px 12px; -webkit-overflow-scrolling: touch; }
.sheet .sf { padding: 12px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--sand); background: var(--white); }
.x { width: 44px; height: 44px; border: 0; background: none; font-size: 1.8rem; line-height: 1; color: var(--muted); }
.cl { padding: 12px 0; border-bottom: 1px solid var(--sand-light); }
.cl .r1 { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cl .nm { font-weight: 500; }
.cl .pr { font-size: 0.9rem; color: var(--muted); }
.cl .input { margin-top: 8px; min-height: 40px; padding: 6px 12px; font-size: 0.95rem; }
.sheet h4 { font-family: var(--font-display); font-weight: 400; font-size: 1.2rem; margin: 18px 0 8px; }
.locs { display: flex; flex-wrap: wrap; gap: 8px; }
.loc { min-height: 44px; padding: 0 16px; border-radius: var(--radius-pill); border: 1px solid var(--sand); background: var(--white); }
.loc.on { background: var(--teal); border-color: var(--teal); color: var(--cream); }
.ctotal { display: flex; justify-content: space-between; font-size: 1.15rem; font-weight: 600; margin-bottom: 12px; }
textarea.input { min-height: 64px; resize: vertical; }

/* ---------- toasts ---------- */
#toasts { position: fixed; left: 0; right: 0; top: calc(env(safe-area-inset-top) + 10px); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--navy); color: var(--cream); padding: 12px 20px; border-radius: var(--radius-pill); box-shadow: var(--shadow-lg); max-width: 100%; animation: rise 0.2s; }
.toast.bad { background: var(--danger); }

@media (min-width: 700px) {
  .backdrop { align-items: center; }
  .sheet { border-radius: 22px; max-height: 86vh; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* demo / quick switching: always-visible Log out in the header area */
.whobar { display: flex; justify-content: flex-end; padding-top: calc(env(safe-area-inset-top) + 8px); padding-bottom: 0; }
.logoutpill { display: inline-flex; align-items: stretch; min-height: 44px; border: 1.5px solid var(--teal); border-radius: 999px; background: #fff; color: var(--teal); font: inherit; font-size: 0.95rem; cursor: pointer; overflow: hidden; max-width: 100%; padding: 0; }
.logoutpill .wn { display: inline-flex; align-items: center; padding: 0 12px 0 16px; color: var(--muted); max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logoutpill .wl { display: inline-flex; align-items: center; padding: 0 16px 0 12px; font-weight: 600; border-left: 1.5px solid var(--teal); }
.logoutpill:active { background: var(--teal); color: #fff; }
.logoutpill:active .wn { color: #fff; }
.whobar + .main .head, .whobar + .main .page-title { padding-top: 6px; }
