:root {
  --bg: #121214; --bg2: #1b1b1f; --card: #222228; --line: #303038; --txt: #ececf1; --mut: #9a9aa6;
  --pri: #f5a524; --pri2: #ffbf4d; --priTxt: #1a1206; --ok: #2fbf71; --err: #ef4b4b; --info: #4b9bef;
  --r: 14px; --nav: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--txt); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: calc(var(--nav) + env(safe-area-inset-bottom)); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--pri); }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.2; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; color: var(--mut); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.mut { color: var(--mut); } .ok { color: var(--ok); } .err { color: var(--err); } .pri { color: var(--pri); }
.small { font-size: 13px; } .big { font-size: 26px; font-weight: 700; } .right { text-align: right; } .center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.between { justify-content: space-between; } .col { display: flex; flex-direction: column; gap: 10px; }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; }
.hide { display: none !important; }

/* topo */
header.top { position: sticky; top: 0; z-index: 20; background: rgba(18,18,20,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); padding: 10px 14px; display: flex; align-items: center; gap: 10px; min-height: 56px; }
header.top .t { font-weight: 700; font-size: 17px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.top .t small { display: block; font-weight: 400; color: var(--mut); font-size: 12px; }
.back { background: none; border: 0; font-size: 22px; padding: 4px 8px 4px 0; cursor: pointer; color: var(--txt); }
main { padding: 14px; max-width: 1100px; margin: 0 auto; }

/* navegação inferior */
nav.bottom { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; height: calc(var(--nav) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: var(--bg2); border-top: 1px solid var(--line); display: flex; }
nav.bottom a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--mut); text-decoration: none; font-size: 11px; }
nav.bottom a .i { font-size: 21px; line-height: 1; }
nav.bottom a.on { color: var(--pri); }

/* componentes */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.list > .it { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.list > .it:last-child { border-bottom: 0; }
.list > .it.click { cursor: pointer; } .list > .it.click:active { background: #2a2a31; }
.btn { border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 650; cursor: pointer; background: #33333c; color: var(--txt);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; }
.btn:active { transform: scale(.98); } .btn:disabled { opacity: .45; pointer-events: none; }
.btn.pri { background: var(--pri); color: var(--priTxt); } .btn.ok { background: var(--ok); color: #04170c; }
.btn.err { background: transparent; color: var(--err); border: 1px solid #5a2a2a; } .btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 13px; border-radius: 10px; } .btn.block { width: 100%; }
.chip { display: inline-block; padding: 7px 13px; border-radius: 99px; background: #2b2b33; border: 1px solid var(--line); cursor: pointer; white-space: nowrap; font-size: 14px; }
.chip.on { background: var(--pri); color: var(--priTxt); border-color: var(--pri); font-weight: 650; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; } .chips::-webkit-scrollbar { display: none; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: #2f2f37; color: var(--mut); white-space: nowrap; }
.tag.ok { background: #143522; color: var(--ok); } .tag.err { background: #3d1717; color: #ff8a8a; } .tag.pri { background: #3a2a0c; color: var(--pri2); }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--mut); }
input.i, select.i, textarea.i { background: var(--bg2); border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; width: 100%; min-height: 46px; font-size: 16px; color: var(--txt); }
input.i:focus, select.i:focus, textarea.i:focus { outline: 2px solid var(--pri); border-color: transparent; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.kpi .l { color: var(--mut); font-size: 12px; } .kpi .v { font-size: 21px; font-weight: 700; margin-top: 2px; }
.empty { text-align: center; color: var(--mut); padding: 30px 10px; }

/* mesas */
.mesas { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.mesa { aspect-ratio: 1 / .9; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); padding: 10px; cursor: pointer;
  display: flex; flex-direction: column; justify-content: space-between; position: relative; user-select: none; }
.mesa .n { font-size: 26px; font-weight: 800; line-height: 1; } .mesa .nm { font-size: 11px; color: var(--mut); }
.mesa .v { font-weight: 700; font-size: 14px; } .mesa .tm { font-size: 11px; color: var(--mut); }
.mesa.oc { background: linear-gradient(160deg, #3b2a0b, #2a1f0c); border-color: #6b4a12; } .mesa.oc .n { color: var(--pri2); }
.mesa .cnt { position: absolute; top: 8px; right: 8px; background: var(--pri); color: var(--priTxt); font-size: 11px; font-weight: 800; border-radius: 99px; padding: 1px 7px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--mut); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* cardápio */
.prods { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.prod { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; cursor: pointer; position: relative; min-height: 86px;
  display: flex; flex-direction: column; justify-content: space-between; user-select: none; }
.prod:active { transform: scale(.97); } .prod .p { color: var(--pri2); font-weight: 700; }
.prod .q { position: absolute; top: -6px; right: -6px; background: var(--pri); color: var(--priTxt); min-width: 26px; height: 26px; border-radius: 99px;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; padding: 0 6px; }
.prod.sem { opacity: .5; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { width: 38px; height: 36px; border: 0; background: #2b2b33; font-size: 18px; cursor: pointer; }
.stepper span { min-width: 34px; text-align: center; font-weight: 700; }
.bar-bottom { position: fixed; left: 0; right: 0; bottom: calc(var(--nav) + env(safe-area-inset-bottom)); padding: 10px 14px; z-index: 25;
  background: linear-gradient(transparent, var(--bg) 30%); }
.bar-bottom .inner { max-width: 1100px; margin: 0 auto; display: flex; gap: 10px; }
.pad-bottom { height: 84px; }

/* totais */
.tot .l { display: flex; justify-content: space-between; padding: 3px 0; }
.tot .l.g { font-size: 20px; font-weight: 800; border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 9px; }
.item-c { text-decoration: line-through; opacity: .5; }

/* gráficos simples */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: 10px; }
.bars .b { flex: 1; background: var(--pri); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bars .b:hover::after { content: attr(data-t); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #000; padding: 3px 6px; border-radius: 6px; font-size: 11px; white-space: nowrap; }
.bars-l { display: flex; gap: 4px; font-size: 10px; color: var(--mut); } .bars-l span { flex: 1; text-align: center; overflow: hidden; }
.hbar { height: 8px; background: #2b2b33; border-radius: 99px; overflow: hidden; margin-top: 5px; } .hbar > i { display: block; height: 100%; background: var(--pri); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; } table.t th, table.t td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; }
table.t th { color: var(--mut); font-weight: 600; font-size: 12px; } table.t td.r, table.t th.r { text-align: right; }
.scroll-x { overflow-x: auto; }

/* modal */
.ov { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: f .15s; }
.modal { background: var(--bg2); width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  border: 1px solid var(--line); animation: up .2s; }
@media (min-width: 700px) { .ov { align-items: center; } .modal { border-radius: 20px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } } @keyframes f { from { opacity: 0; } }
.toast { position: fixed; bottom: calc(var(--nav) + 20px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 99; background: #2b2b33; border: 1px solid var(--line); padding: 11px 16px;
  border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.5); max-width: 92vw; animation: f .2s; }
.toast.err { background: #3d1717; border-color: #6a2a2a; } .toast.ok { background: #143522; border-color: #25603e; }
.formas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.formas .chip { text-align: center; padding: 11px 6px; border-radius: 12px; }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login .card { width: 100%; max-width: 380px; padding: 26px 22px; }
.logo { font-size: 30px; font-weight: 900; letter-spacing: -.02em; } .logo b { color: var(--pri); }

/* impressão (cupom 80mm) */
#print { display: none; }
@media print {
  body * { visibility: hidden; } body { background: #fff; padding: 0; }
  #print, #print * { visibility: visible; } #print { display: block; position: absolute; left: 0; top: 0; width: 72mm; color: #000; font: 12px/1.35 monospace; }
  #print .c { text-align: center; } #print hr { border: 0; border-top: 1px dashed #000; } #print table { width: 100%; } #print td.r { text-align: right; }
}
@media (min-width: 900px) {
  body { padding-bottom: 0; padding-left: 210px; }
  nav.bottom { top: 0; right: auto; width: 210px; height: 100vh; flex-direction: column; justify-content: flex-start; padding: 70px 10px 10px; border-top: 0; border-right: 1px solid var(--line); gap: 4px; }
  nav.bottom a { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 14px; border-radius: 12px; font-size: 15px; }
  nav.bottom a.on { background: #2b2412; }
  .bar-bottom { bottom: 0; left: 210px; }
}
