:root {
  --bg: #f5f2ea; --card: #ffffff; --ink: #1c1b18; --muted: #6b665c; --line: #ddd6c6;
  --primary: #1f6f4a; --primary-ink: #fff; --accent: #c8590f; --danger: #b3261e; --warn: #8a5a00; --ok-bg: #e3f2e8;
  --radius: 16px; --tap: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 18px; }
body { min-height: 100vh; padding-bottom: 96px; }
button { font: inherit; color: inherit; cursor: pointer; }
h1 { font-size: 1.5rem; margin: 0 0 12px; } h2 { font-size: 1.25rem; margin: 18px 0 8px; } h3 { font-size: 1.05rem; margin: 14px 0 6px; }
.muted { color: var(--muted); } .small { font-size: 0.85rem; } .right { text-align: right; } .center { text-align: center; }
.container { max-width: 760px; margin: 0 auto; padding: 12px 16px; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--primary); color: var(--primary-ink); display: flex; align-items: center; gap: 10px; padding: 10px 14px; min-height: 56px; }
.topbar .title { flex: 1; font-weight: 700; font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .back { background: rgba(255,255,255,.18); border: 0; color: #fff; border-radius: 12px; min-width: 48px; height: 44px; font-size: 1.3rem; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: rgba(255,255,255,.2); font-size: .85rem; font-weight: 600; white-space: nowrap; }
.chip.open { background: #d7f5e0; color: #0b4a2a; } .chip.closed { background: #ffe0dc; color: #7c1c15; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 12px 0; }
.btn { min-height: 52px; padding: 10px 18px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font-weight: 700; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn.big { min-height: var(--tap); font-size: 1.15rem; width: 100%; }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: .9rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(.98); }
.row { display: flex; gap: 10px; align-items: center; } .row > * { flex: 1; } .row.wrap { flex-wrap: wrap; } .row .auto { flex: 0 0 auto; }
.stack > * + * { margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { min-height: 110px; border-radius: var(--radius); border: 2px solid var(--line); background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px; text-align: center; font-weight: 700; font-size: 1.15rem; }
.tile .sub { font-size: .85rem; font-weight: 500; color: var(--muted); }
.tile .price { font-size: 1.05rem; color: var(--primary); }
.tile.cat-peso { background: #e3f2e8; border-color: var(--primary); } .tile.cat-bebidas { background: #e4eefb; border-color: #2c5fa8; }
.tile.cat-sobremesas { background: #fbe8f0; border-color: #a8325f; } .tile.cat-balcao { background: #fdf0d9; border-color: #a86a00; }
.tile.gc0 { background: #e4eefb; border-color: #2c5fa8; } .tile.gc1 { background: #fbe8f0; border-color: #a8325f; } .tile.gc2 { background: #fdf0d9; border-color: #a86a00; }
.tile.gc3 { background: #ece6fa; border-color: #5b3fa8; } .tile.gc4 { background: #e0f4f2; border-color: #1f7a73; } .tile.gc5 { background: #f3ecdf; border-color: #7a5a2a; }
.tile.item { min-height: 96px; position: relative; } .tile.item .qty { position: absolute; top: 6px; right: 8px; background: var(--primary); color: #fff; border-radius: 999px; min-width: 28px; padding: 0 8px; font-size: .95rem; }
.big-total { font-size: 2.2rem; font-weight: 800; letter-spacing: -.5px; white-space: nowrap; }
.display { background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; margin-bottom: 12px; }
.display .value { font-size: 3rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.display .calc { font-size: 1.6rem; color: var(--primary); font-weight: 700; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.key { min-height: 76px; font-size: 2rem; font-weight: 700; border-radius: 16px; border: 2px solid var(--line); background: #fff; }
.key:active { background: #efe9d8; } .key-ok { background: var(--primary); border-color: var(--primary); color: #fff; font-size: 1.5rem; } .key-back { font-size: 1.7rem; }
input[type=text], input[type=password], input[type=number], input[type=month], select, textarea { width: 100%; min-height: 52px; font: inherit; padding: 10px 14px; border: 2px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); }
label { display: block; font-weight: 600; margin: 10px 0 4px; } label.check { display: flex; align-items: center; gap: 10px; font-weight: 500; min-height: 44px; } label.check input { width: 24px; height: 24px; }
.line { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; } .line .name { flex: 1; } .line .amt { font-weight: 700; font-variant-numeric: tabular-nums; } .line.void { text-decoration: line-through; opacity: .45; }
.line .x { min-width: 44px; min-height: 44px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-size: 1.1rem; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: #fff1cc; color: var(--warn); }
.badge.green { background: var(--ok-bg); color: #0b4a2a; } .badge.red { background: #ffe0dc; color: #7c1c15; }
.comanda-chip { min-height: 88px; border-radius: 16px; border: 2px solid var(--line); background: #fff; padding: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.comanda-chip .num { font-size: 1.6rem; font-weight: 800; } .comanda-chip.pending { border-color: var(--accent); background: #fff4e8; }
.nav { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); display: flex; z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
.nav a { flex: 1; text-align: center; padding: 10px 4px; min-height: 64px; text-decoration: none; color: var(--muted); font-size: .8rem; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.nav a .ico { font-size: 1.4rem; line-height: 1; } .nav a.active { color: var(--primary); }
.sticky-actions { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); display: flex; gap: 10px; z-index: 25; }
.sticky-actions > * { flex: 1; }
.modal-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; justify-content: center; z-index: 100; }
.modal { background: #fff; width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; padding: 18px; max-height: 90vh; overflow: auto; }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; } .modal-actions .btn { flex: 1; }
@media (min-width: 700px) { .modal-wrap { align-items: center; } .modal { border-radius: 22px; } }
#toasts { position: fixed; left: 12px; right: 12px; bottom: 100px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: #123c28; color: #fff; padding: 12px 16px; border-radius: 14px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast.err { background: var(--danger); }
.scan-wrap { position: fixed; inset: 0; background: #000; z-index: 150; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px; }
.scan-wrap video { width: 100%; max-height: 62vh; object-fit: cover; border-radius: 16px; }
.scan-frame { position: absolute; width: 56vmin; height: 56vmin; border: 4px solid #fff; border-radius: 22px; top: 22%; box-shadow: 0 0 0 9999px rgba(0,0,0,.25); pointer-events: none; }
.scan-hint { color: #fff; font-weight: 700; margin: 0; } .scan-wrap .btn { max-width: 420px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.tabs button { flex: 0 0 auto; min-height: 46px; padding: 8px 16px; border-radius: 999px; border: 2px solid var(--line); background: #fff; font-weight: 700; }
.tabs button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.method-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; } .method-grid .btn { min-height: 60px; }
.method-grid .btn.sel { background: var(--primary); border-color: var(--primary); color: #fff; }
.pay-part { border: 2px solid var(--line); border-radius: 14px; padding: 10px; margin: 10px 0; background: #fcfbf7; }
table { width: 100%; border-collapse: collapse; } th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); font-size: .95rem; } td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.login { max-width: 420px; margin: 8vh auto 0; padding: 20px; }
.login h1 { text-align: center; font-size: 1.8rem; }
.feed-item { padding: 10px 0; border-bottom: 1px solid var(--line); } .feed-item .t { color: var(--muted); font-size: .8rem; }
.empty { text-align: center; color: var(--muted); padding: 24px 0; }
.statement { background: #fff; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
@media print { .topbar, .nav, .sticky-actions, .no-print, #toasts { display: none !important; } body { background: #fff; padding: 0; } .statement { border: 0; } }

.home-grid { display: block; }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.comanda-chip .cname { font-size: .95rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-list { margin-top: 12px; }
@media (min-width: 900px) {
  .container { max-width: 1180px; }
  .home-grid { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
  .home-list { margin-top: 0; }
  .home-open .display { padding: 8px; margin-bottom: 8px; } .home-open .display .value { font-size: 1.8rem; }
  .home-open .keypad { gap: 6px; } .home-open .key { min-height: 46px; font-size: 1.3rem; border-radius: 12px; }
  .home-open .btn.big { min-height: 46px; font-size: 1rem; }
  .chips { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .comanda-chip { min-height: 96px; } .comanda-chip .num { font-size: 1.5rem; }
}

/* Qtd-Leiste, Rabatt, Druck */
.qty-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 8px 10px; background: var(--card, #fff); border: 1px solid var(--line, #ddd); border-radius: 12px; }
.qty-bar .btn { min-width: 48px; font-size: 1.4rem; }
.qty-big { flex: 0 0 auto; min-width: 72px; font-size: 1.8rem; font-weight: 800; border: 2px solid var(--line, #ddd); background: transparent; border-radius: 10px; padding: 4px 12px; cursor: pointer; }
.qty-bar .small { margin-left: auto; }
table th { text-align: left; font-size: .8rem; color: var(--muted, #666); }
table th.num { text-align: right; }
@media print {
  .nav, .topbar, .no-print, .tabs, .sticky-actions { display: none !important; }
  body { background: #fff; }
  .card { break-inside: avoid; border: 0; box-shadow: none; }
}
