:root {
  --fundo: #f4f2ee;
  --cartao: #ffffff;
  --texto: #1d1b18;
  --suave: #6b665e;
  --linha: #e3ded5;
  --acento: #b5461b;
  --acento-texto: #ffffff;
  --ok: #2f7d4f;
  --alerta: #b8860b;
  --perigo: #b42318;
  --mesa-livre: #ffffff;
  --mesa-aberta: #fbe9df;
  --raio: 14px;
  --sombra: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #151412; --cartao: #1f1d1a; --texto: #f1ede6; --suave: #a59f95; --linha: #34312c;
    --acento: #e0703f; --mesa-livre: #1f1d1a; --mesa-aberta: #3a2619; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fundo); color: var(--texto); }
body { font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.25rem; }
h2 { font-size: 1.1rem; }

.topo {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--cartao); border-bottom: 1px solid var(--linha);
}
.topo .nome { margin-left: auto; color: var(--suave); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conteudo { padding: 16px; max-width: 960px; margin: 0 auto; }

.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 18px;
  border: 1px solid var(--linha); border-radius: 12px; background: var(--cartao); cursor: pointer; font-weight: 600;
}
.botao:active { transform: scale(.98); }
a.botao { text-decoration: none; color: inherit; }
input[type=checkbox] { accent-color: var(--acento); }
.botao.primario { background: var(--acento); color: var(--acento-texto); border-color: var(--acento); }
.botao.perigo { color: var(--perigo); border-color: var(--perigo); }
.botao.pequeno { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.botao.cheio { width: 100%; }
.botao:disabled { opacity: .5; pointer-events: none; }
.link { background: none; border: 0; color: var(--acento); font-weight: 600; cursor: pointer; padding: 8px; }

.cartao { background: var(--cartao); border: 1px solid var(--linha); border-radius: var(--raio); box-shadow: var(--sombra); padding: 16px; }
.pilha > * + * { margin-top: 12px; }
.linha-flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.suave { color: var(--suave); }
.direita { margin-left: auto; }
.oculto { display: none !important; }

input[type=text], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--linha); border-radius: 12px; background: var(--cartao);
}
textarea { min-height: 70px; resize: vertical; }
label { display: block; font-size: .9rem; color: var(--suave); margin-bottom: 4px; }

.grade-mesas { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.mesa {
  aspect-ratio: 1; border-radius: var(--raio); border: 1px solid var(--linha); background: var(--mesa-livre);
  display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--sombra);
}
.mesa .num { font-size: 1.8rem; font-weight: 800; }
.mesa .info { font-size: .8rem; color: var(--suave); text-align: center; }
.mesa.aberta { background: var(--mesa-aberta); border-color: var(--acento); }
.mesa.travada { background: var(--linha); border-style: dashed; box-shadow: none; }
.mesa.travada .num { font-size: 1.4rem; color: var(--suave); }
.mesa.composta { background: var(--mesa-aberta); border: 2px solid var(--acento); }
.mesa.composta .num { font-size: 1.4rem; }
.mesa.marcada { outline: 4px solid var(--acento); outline-offset: -4px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.chip {
  flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--linha); background: var(--cartao);
  font-weight: 600; cursor: pointer;
}
.chip.ativo { background: var(--texto); color: var(--fundo); border-color: var(--texto); }

.produtos { display: grid; gap: 8px; }
.produto {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--linha); border-radius: 12px;
  background: var(--cartao); cursor: pointer; text-align: left; width: 100%;
}
.produto .preco { margin-left: auto; font-weight: 700; white-space: nowrap; }
.etiqueta { font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: var(--linha); color: var(--suave); font-weight: 700; text-transform: uppercase; }
.etiqueta.bar { background: #dbeafe; color: #1e40af; }
.etiqueta.cozinha { background: #fde7d9; color: #9a3412; }

.item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--linha); }
.item:last-child { border-bottom: 0; }
.item .qtd { font-weight: 800; min-width: 32px; }
.item .obs { font-size: .85rem; color: var(--acento); }
.item.cancelado { opacity: .5; text-decoration: line-through; }
.controle-qtd { display: flex; align-items: center; gap: 6px; }
.controle-qtd button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--linha); background: var(--cartao); font-weight: 800; cursor: pointer; }

.barra-envio {
  position: sticky; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--cartao);
  border-top: 1px solid var(--linha); display: flex; gap: 10px; align-items: center;
}

dialog { border: 0; border-radius: var(--raio); padding: 0; width: min(520px, calc(100vw - 24px)); background: var(--cartao); color: var(--texto); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog .corpo { padding: 18px; }
dialog .acoes { display: flex; gap: 10px; justify-content: flex-end; padding: 0 18px 18px; flex-wrap: wrap; }

.aviso {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--texto); color: var(--fundo);
  padding: 12px 18px; border-radius: 12px; z-index: 100; max-width: calc(100vw - 32px); box-shadow: var(--sombra); font-weight: 600;
}
.aviso.erro { background: var(--perigo); color: #fff; }

.teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.teclado button { min-height: 60px; font-size: 1.4rem; font-weight: 700; border-radius: 14px; border: 1px solid var(--linha); background: var(--cartao); cursor: pointer; }
.pontos { display: flex; gap: 12px; justify-content: center; min-height: 20px; }
.pontos span { width: 14px; height: 14px; border-radius: 50%; background: var(--linha); }
.pontos span.cheio { background: var(--texto); }

.abas { display: flex; gap: 6px; overflow-x: auto; padding: 0 16px; background: var(--cartao); border-bottom: 1px solid var(--linha); }
.abas button { border: 0; background: none; padding: 14px 10px; font-weight: 700; color: var(--suave); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.abas button.ativa { color: var(--texto); border-color: var(--acento); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--linha); vertical-align: middle; }
th { font-size: .8rem; color: var(--suave); text-transform: uppercase; }
.tabela-rolagem { overflow-x: auto; }
.status-ponto { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--perigo); margin-right: 6px; }
.status-ponto.on { background: var(--ok); }
.total-grande { font-size: 1.6rem; font-weight: 800; }
.codigo-grande { font-size: 2.4rem; font-weight: 800; letter-spacing: .2em; text-align: center; }
