/* Table ordering (guest phone) and staff tools. */
:root:not([data-offer="2"]) [data-only="2"] { display: none !important; }

/* ---------- Guest table page ---------- */
.tbl .demo-flag { font-size: .8rem; }
.tbl-head { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: .8rem; padding: .6rem 16px; background: var(--head-bg); border-bottom: 1px solid var(--rule); }
.tbl-head__where { flex: 1; display: flex; flex-direction: column; line-height: 1.2; }
.tbl-head__where b { font: 700 1.25rem var(--head); color: var(--accent-2); }
.tbl-head__where small { color: var(--muted); }
.tbl-main { max-width: 640px; margin: 0 auto; padding: 16px 16px 120px; }
.tbl-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.tbl-optional { color: var(--muted); font-size: .85rem; margin: .6rem 0 1rem; text-align: center; }
.tbl-cats { position: sticky; top: 64px; z-index: 5; display: flex; gap: .4rem; overflow-x: auto; padding: .5rem 16px; margin: 0 -16px; background: var(--bg); scrollbar-width: none; }
.tbl-cats a { flex: none; padding: .35rem .9rem; min-height: 38px; display: inline-flex; align-items: center; border-radius: 999px; border: 1px solid var(--rule); color: var(--ink); text-decoration: none; font-family: var(--head); font-size: .9rem; }
.tbl-sec { scroll-margin-top: 120px; padding: 1.2rem 0 0; }
.tbl-sec h2 { font-size: 1.3rem; margin-bottom: .4rem; color: var(--accent-2); }
.tbl-sec ul { list-style: none; padding: 0; margin: 0; }
.titem { display: flex; gap: .8rem; align-items: center; padding: .7rem 0; border-bottom: 1px dashed var(--rule); }
.titem img { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; flex: none; }
.titem__w { width: 72px; height: 72px; flex: none; border-radius: 12px; background: var(--card); color: var(--card-accent); display: grid; place-items: center; font: 700 1.05rem var(--head); text-align: center; line-height: 1.1; }
.titem__body { flex: 1; min-width: 0; }
.titem h3 { font-size: 1.05rem; }
.titem p { margin: 0; color: var(--muted); font-size: .85rem; line-height: 1.5; }
.titem .price { font-size: 1rem; }
.add { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); font: 600 1.6rem/1 var(--head); cursor: pointer; flex: none; }
.cartbar { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 35%); z-index: 15; }
.cartbar .btn { width: 100%; max-width: 608px; margin: 0 auto; display: flex; min-height: 54px; font-size: 1.05rem; box-shadow: 0 8px 24px var(--shadow); }
.tbl-status { background: var(--bg-2); border: 2px dotted var(--accent); border-radius: 16px; padding: 1rem; margin-bottom: 1rem; scroll-margin-top: 80px; }
.tbl-status h2 { font-size: 1.05rem; margin-bottom: .4rem; }
.tbl-status ul { list-style: none; padding: 0; margin: 0; }
.st { display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; align-items: center; padding: .45rem 0; border-top: 1px dashed var(--rule); font-size: .9rem; }
.st b { font-family: var(--head); color: var(--accent-2); }
.st em { font-style: normal; font-family: var(--head); font-size: .8rem; padding: .2rem .55rem; border-radius: 999px; background: var(--bg-3); white-space: nowrap; }
.st--cooking em { background: var(--st-cook-bg); color: var(--st-cook-ink); }
.st--ready em { background: var(--st-ready-bg); color: var(--st-ready-ink); box-shadow: inset 0 0 0 1.5px currentColor; }
.st--served { opacity: .6; }

/* Bottom sheets (native <dialog>) */
.sheet { width: min(560px, 100%); max-height: 92vh; margin: auto auto 0; padding: 0; border: 0; border-radius: 22px 22px 0 0; background: var(--bg-2); color: var(--ink); overflow: auto; }
.sheet::backdrop { background: var(--backdrop); }
@media (min-width: 700px) { .sheet { margin: auto; border-radius: 22px; } }
.sheet__media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.sheet__w { margin: 0; padding: 2rem 1rem; text-align: center; background: var(--card); color: var(--card-accent); font: 700 3rem/1 var(--head); }
.sheet__body { position: relative; padding: 1.2rem 1.2rem 1.4rem; display: grid; gap: .9rem; }
.sheet__body h2 { font-size: 1.5rem; padding-right: 2.5rem; }
.sheet__body .note { margin: -.6rem 0 0; }
.sheet__group { border: 0; padding: 0; margin: 0; display: block; }
.sheet__group legend { font-family: var(--head); color: var(--muted); font-size: .9rem; margin-bottom: .45rem; }
.sheet__group .chip { min-height: 40px; padding: .3rem .8rem; }
.sheet__group .chip small { color: var(--muted); }
.sheet textarea { width: 100%; padding: .6rem .8rem; border-radius: 10px; border: 1px solid var(--field); background: var(--bg); color: var(--ink); font: inherit; resize: vertical; }
.sheet__foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.sheet__foot .btn { flex: 1; }
.sheet__close { position: absolute; top: .8rem; right: .8rem; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--rule); background: var(--bg); color: var(--ink); font-size: 1.5rem; cursor: pointer; }
#item-sheet .sheet__close { top: -3.2rem; background: var(--head-bg); }
.qty { display: inline-flex; align-items: center; gap: .3rem; }
.qty output { min-width: 1.8rem; text-align: center; font: 600 1.1rem var(--head); }
.qty .ibtn { width: 40px; height: 40px; font-size: 1.2rem; }
.cart { list-style: none; padding: 0; margin: 0; }
.cart li { display: grid; grid-template-columns: 1fr auto auto; gap: .6rem; align-items: center; padding: .6rem 0; border-bottom: 1px dashed var(--rule); }
.cart li small { display: block; color: var(--muted); font-size: .82rem; }
.cart__total { display: flex; justify-content: space-between; font: 600 1.25rem var(--head); margin: 0; }
.cart__total b { color: var(--accent-2); }
.cart__send { min-height: 54px; }
.upsell { border: 2px dotted var(--accent); border-radius: 14px; padding: .8rem; }
.upsell p { margin: 0 0 .5rem; font-family: var(--head); }
.upsell__row { display: flex; gap: .5rem; overflow-x: auto; }
.upsell__item { flex: none; display: flex; align-items: center; gap: .5rem; padding: .35rem .7rem .35rem .35rem; border-radius: 12px; border: 1px solid var(--rule); background: var(--bg); color: var(--ink); font: inherit; cursor: pointer; text-align: left; }
.upsell__item img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }
.upsell__item small { display: block; color: var(--accent-2); }

/* ---------- Staff ---------- */
.staff-head { display: flex; align-items: center; gap: .8rem; padding: .7rem var(--pad); border-bottom: 1px solid var(--rule); }
.staff-head h1 { font-size: 1.3rem; flex: 1; }
.staff-head select { min-height: 42px; padding: .3rem .7rem; border-radius: 10px; border: 1px solid var(--field); background: var(--bg-2); color: var(--ink); font: 600 .95rem var(--head); }
.staff-tabs { margin: 0; padding: .8rem var(--pad); border-bottom: 1px solid var(--rule); }
.staff-main { padding: 1.2rem var(--pad) 3rem; }
.staff-main section { padding: 0; }
.ktools { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .8rem; margin-bottom: 1rem; }
.ktools .note { margin: 0; max-width: 70ch; }
.reqs { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; }
.req { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem .6rem .6rem 1rem; border-radius: 12px; background: var(--req-bg); color: var(--req-ink); border: 2px solid transparent; font: 600 1rem var(--head); }
.req--bill { background: var(--req2-bg); color: var(--req2-ink); border-color: currentColor; }
.req .btn { min-height: 40px; border-color: currentColor; color: inherit; }
.kcols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .kcols { grid-template-columns: 1fr; } }
.kcol { background: var(--bg-2); border: 1px solid var(--rule); border-radius: 16px; padding: .8rem; min-height: 200px; }
.kcol h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); display: flex; justify-content: space-between; margin: 0 .2rem .7rem; }
.kcount { color: var(--accent-2); }
.kcol > ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.kempty { color: var(--muted); text-align: center; padding: 1rem; }
.ticket { background: var(--card); color: var(--card-ink); border-radius: 10px; padding: .8rem; border-top: 6px solid var(--accent); }
.ticket.is-late { border-top-color: #C62828; }
.ticket__top { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; font-family: var(--head); border-bottom: 1.5px dashed var(--card-rule); padding-bottom: .4rem; margin-bottom: .4rem; }
.ticket__top strong { font-size: 1.25rem; }
.ticket__top span { font-size: .8rem; color: var(--card-muted); }
.ticket.is-late .ticket__top > span { color: var(--late-ink); font-weight: 700; text-decoration: underline; }
.ticket ul { list-style: none; padding: 0; margin: 0 0 .7rem; }
.ticket li { display: flex; gap: .5rem; padding: .2rem 0; }
.ticket li b { font-family: var(--head); color: var(--card-accent); min-width: 2rem; }
.ticket li em { display: block; font-style: normal; font-weight: 700; color: var(--card-accent); font-size: .9rem; }
.ticket .btn { width: 100%; min-height: 44px; background: var(--card-btn); color: var(--card-btn-ink); }
.medit-wrap { overflow-x: auto; margin-bottom: 1.2rem; }
.medit { border-collapse: collapse; width: 100%; max-width: 820px; }
.medit th, .medit td { padding: .5rem .6rem; text-align: left; border-bottom: 1px dashed var(--rule); font-weight: 400; }
.medit thead th { font-family: var(--head); color: var(--muted); font-size: .85rem; }
.medit__cat th { font-family: var(--head); color: var(--accent-2); font-weight: 600; padding-top: 1.2rem; }
.medit tbody th small { color: var(--muted); }
.medit input[type="number"] { width: 7.5rem; min-height: 40px; padding: .3rem .6rem; border-radius: 8px; border: 1px solid var(--field); background: var(--bg); color: var(--ink); font: inherit; }
.medit tr.is-out { opacity: 1; }
.medit tr.is-out th { color: var(--muted); text-decoration: line-through; }
.switch { appearance: none; width: 46px; height: 26px; border-radius: 999px; background: var(--switch-off); position: relative; cursor: pointer; margin: 0; transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--switch-knob); transition: transform .2s; }
.switch:checked { background: #C62828; }
.switch:checked::after { transform: translateX(20px); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--bg-2); border: 1px solid var(--rule); border-radius: 16px; padding: 1rem 1.2rem; }
.kpi span { color: var(--muted); font-family: var(--head); font-size: .85rem; display: block; }
.kpi b { font: 700 2rem var(--head); color: var(--accent-2); }
.reports { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.report { background: var(--bg-2); border: 1px solid var(--rule); border-radius: 16px; padding: 1rem 1.2rem; }
.report h2 { font-size: 1rem; margin-bottom: .8rem; }
.bars { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
.bars li { display: grid; grid-template-columns: 9rem 1fr 2rem; gap: .6rem; align-items: center; font-size: .9rem; }
.bars i { height: 12px; border-radius: 6px; background: var(--accent); display: block; }
.bars b { text-align: right; font-family: var(--head); }
.hours { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; height: 180px; align-items: end; }
.hour { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.hour i { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; display: block; }
.hour span { font-size: .72rem; color: var(--muted); }
.qrsheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; justify-items: center; }
.qrsheet .tcard { width: 220px; }
.qrsheet .tcard small { color: var(--muted); }

@media print {
  body { background: #fff; }
  .demo-flag, .versions, .staff-head, .staff-tabs, .ktools { display: none !important; }
  .staff-main { padding: 0; }
  .qrsheet { grid-template-columns: repeat(3, 1fr); gap: 8mm; }
  .tcard { background: #fff; color: #000; border-color: #000; break-inside: avoid; }
  .tcard__no { color: #000; }
  .tcard img { filter: none; mix-blend-mode: normal; }
}
