:root {
  --cor: #c2410c;
  --cor-ink: #fff;
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #1f1a17;
  --mut: #6b625b;
  --line: #e8e1d8;
  --ok: #15803d;
  --warn: #b45309;
  --bad: #b91c1c;
  --r: 16px;
  --sh: 0 1px 2px rgba(31, 26, 23, .06), 0 6px 20px rgba(31, 26, 23, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15120f; --card: #201c18; --ink: #f4efe9; --mut: #a39a91; --line: #332d27;
    --ok: #4ade80; --warn: #fbbf24; --bad: #f87171;
    --sh: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100dvh; padding-bottom: env(safe-area-inset-bottom); }
h1, h2, h3 { margin: 0; line-height: 1.15; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--cor); }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.wide { max-width: 1100px; }
.hide { display: none !important; }
.mut { color: var(--mut); }
.sm { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.wrapx { flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }

/* botões */
.btn { appearance: none; border: 0; border-radius: 14px; padding: 12px 18px; font-weight: 650; background: var(--cor); color: var(--cor-ink); min-height: 46px; }
.btn:active { transform: scale(.98); }
.btn.sec { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ok { background: var(--ok); color: #fff; }
.btn.bad { background: var(--bad); color: #fff; }
.btn.sm { min-height: 38px; padding: 8px 12px; font-size: 14px; border-radius: 12px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.full { width: 100%; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; font-size: 14px; white-space: nowrap; border: 0; }
.chip.on { background: var(--cor); color: var(--cor-ink); box-shadow: none; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: 12px; font-weight: 700; background: var(--line); color: var(--mut); }
.tag.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.tag.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.tag.bad { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }

/* formulários */
.field { display: block; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--mut); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=time], input[type=tel], select, textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); min-height: 46px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--cor); outline-offset: 1px; border-color: transparent; }
textarea { min-height: 80px; resize: vertical; }
.pin { font-size: 28px; letter-spacing: .35em; text-align: center; }
.err { color: var(--bad); font-weight: 600; font-size: 14px; min-height: 20px; }

/* cartões */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--sh); padding: 16px; }
.card + .card { margin-top: 12px; }
.banner { border-radius: var(--r); padding: 14px 16px; background: color-mix(in srgb, var(--warn) 14%, var(--card)); font-weight: 600; }
.banner.bad { background: color-mix(in srgb, var(--bad) 12%, var(--card)); }
.banner.ok { background: color-mix(in srgb, var(--ok) 14%, var(--card)); }

/* cliente */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.logo { width: 42px; height: 42px; border-radius: 12px; object-fit: cover; background: var(--cor); color: var(--cor-ink); display: grid; place-items: center; font-weight: 800; flex: none; }
.mesa-tag { font-weight: 800; font-size: 13px; padding: 5px 10px; border-radius: 10px; background: var(--cor); color: var(--cor-ink); }
.cats { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.item { display: flex; gap: 12px; background: var(--card); border-radius: var(--r); box-shadow: var(--sh); overflow: hidden; margin-top: 12px; text-align: left; width: 100%; border: 0; padding: 0; }
.item .media { width: 132px; min-height: 132px; flex: none; background: var(--line); position: relative; }
.item .media video, .item .media img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; display: block; }
.item .txt { padding: 12px 12px 12px 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.item h3 { font-size: 17px; }
.item p { margin: 0; color: var(--mut); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.price { font-weight: 800; margin-top: auto; }
.item.off { opacity: .55; }
.cat-title { font-size: 20px; font-weight: 800; margin: 22px 0 0; scroll-margin-top: 130px; }
.fab { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 20; box-shadow: 0 8px 24px rgba(0,0,0,.28); border-radius: 999px; padding: 0 22px; min-height: 58px; font-size: 17px; display: flex; align-items: center; gap: 10px; }
.fab.wait { background: var(--warn); }
.fab.ok { background: var(--ok); }
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; border-radius: 24px 24px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); max-height: 92dvh; overflow: auto; animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet .vid { width: 100%; aspect-ratio: 1; border-radius: 18px; object-fit: cover; background: var(--line); }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); text-align: left; font-weight: 650; margin-top: 10px; }
.opt .ic { font-size: 24px; }
.toast { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; z-index: 99; font-weight: 600; max-width: 90vw; }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.04); } }

/* equipe */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; scrollbar-width: none; }
.tabs .chip { padding: 8px 14px; }
.call { border-left: 6px solid var(--cor); }
.call.late { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, var(--card)); }
.call.going { border-left-color: var(--ok); }
.call .num { font-size: 34px; font-weight: 900; line-height: 1; min-width: 56px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 20px; }
.timer.late { color: var(--bad); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.tile { border: 0; border-radius: 16px; padding: 12px 8px; background: var(--card); box-shadow: var(--sh); text-align: center; position: relative; }
.tile .n { font-size: 26px; font-weight: 900; }
.tile.occ { background: color-mix(in srgb, var(--ok) 16%, var(--card)); }
.tile.hascall { background: color-mix(in srgb, var(--warn) 24%, var(--card)); }
.tile.late { background: color-mix(in srgb, var(--bad) 24%, var(--card)); }
.tile .dot { position: absolute; top: 8px; right: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--mut); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi .v { font-size: 28px; font-weight: 900; }
.kpi .l { color: var(--mut); font-size: 13px; }
.qr svg { width: 100%; height: auto; display: block; }
.scroll-x { overflow-x: auto; }

/* calculadora do garçom */
.calc-screen { background: var(--bg); border-radius: 14px; padding: 10px 14px; box-shadow: inset 0 0 0 1px var(--line); }
.calc-display { font-size: 38px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.btn.key { min-height: 58px; font-size: 22px; padding: 0 8px; border-radius: 14px; }
.btn.key.wide { grid-column: span 2; }
.btn.key.opk { background: var(--ink); color: var(--bg); }

/* mensagens */
.fab2 { position: fixed; right: 16px; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 20; width: 52px; height: 52px; padding: 0; border-radius: 50%; font-size: 22px; display: grid; place-items: center; background: var(--card); color: var(--ink); box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.dotn { position: absolute; top: -4px; right: -4px; background: var(--bad); color: #fff; font-size: 12px; font-weight: 800; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 5px; }
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 48dvh; overflow: auto; padding: 4px 2px; }
.msg { max-width: 84%; padding: 8px 12px; border-radius: 16px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); align-self: flex-start; overflow-wrap: anywhere; }
.msg.out { align-self: flex-end; background: var(--cor); color: var(--cor-ink); box-shadow: none; }
.msg .who { font-size: 12px; opacity: .7; margin-bottom: 2px; }

/* stories do cardápio */
.story { position: fixed; inset: 0; z-index: 70; background: #000; color: #fff; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.story .smedia { position: absolute; inset: 0; }
.story .smedia video, .story .smedia img { width: 100%; height: 100%; object-fit: cover; display: block; }
.story .sph { width: 100%; height: 100%; display: grid; place-items: center; font-size: 96px; background: #2a2420; }
.story .sshade { position: absolute; left: 0; right: 0; bottom: 0; height: 62%; background: linear-gradient(transparent, rgba(0,0,0,.88)); pointer-events: none; }
.story .sbar { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 10px; right: 10px; display: flex; gap: 4px; z-index: 4; }
.story .sbar span { flex: 1; height: 3px; background: rgba(255,255,255,.32); border-radius: 3px; overflow: hidden; }
.story .sbar i { display: block; height: 100%; width: 0; background: #fff; }
.story .shead { position: absolute; top: calc(20px + env(safe-area-inset-top)); left: 12px; right: 12px; display: flex; align-items: center; gap: 10px; z-index: 4; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.story .sclose { border: 0; background: rgba(0,0,0,.35); color: #fff; width: 40px; height: 40px; border-radius: 50%; font-size: 18px; }
.story .tapL, .story .tapR { position: absolute; top: calc(70px + env(safe-area-inset-top)); bottom: 190px; z-index: 2; }
.story .tapL { left: 0; width: 32%; }
.story .tapR { right: 0; width: 68%; }
.story .sinfo { position: absolute; left: 16px; right: 16px; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 3; text-shadow: 0 1px 8px rgba(0,0,0,.5); }
.story .sprice { font-size: 24px; font-weight: 900; }

/* impressão das plaquinhas */
.print-only { display: none; }
@media print {
  body > *:not(.print-only) { display: none !important; }
  .print-only { display: block; background: #fff; color: #000; }
  .plaq-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; }
  .plaq { border: 1px dashed #999; padding: 8mm; text-align: center; page-break-inside: avoid; height: 135mm; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4mm; }
  .plaq .rn { font-size: 20pt; font-weight: 800; }
  .plaq .mn { font-size: 54pt; font-weight: 900; line-height: 1; }
  .plaq .ins { font-size: 12pt; }
  .plaq svg { width: 62mm; height: 62mm; }
}
