:root {
  --fundo: #f6f4f1;
  --cartao: #ffffff;
  --borda: #ebe5de;
  --texto: #1f1a16;
  --texto-2: #8a7f74;
  --brasa: #ea6a12;
  --brasa-claro: #fff1e6;
  --azul: #2563eb;
  --erro: #dc2626;
  --erro-claro: #fdecec;
  --verde: #16a34a;
  --raio: 16px;
  --sombra: 0 1px 2px rgba(31, 26, 22, .06), 0 2px 8px rgba(31, 26, 22, .04);
  --abas: 64px;
  --seguro: env(safe-area-inset-bottom, 0px);
  --largura: 720px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--fundo);
  color: var(--texto);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button, a, .chip, summary { touch-action: manipulation; user-select: none; -webkit-user-select: none; }
button { cursor: pointer; }
h2 { margin: 0 0 12px; font-size: 1.05rem; font-weight: 700; }
small { color: var(--texto-2); }
.txt-erro { color: var(--erro) !important; }

/* ---------- estrutura ---------- */
.topo {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  background: rgba(246, 244, 241, .92); backdrop-filter: blur(8px);
}
.marca { font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; }
.dia {
  font-size: .85rem; font-weight: 700; color: var(--brasa);
  background: var(--brasa-claro); padding: 4px 10px; border-radius: 999px;
}

main {
  max-width: var(--largura); margin: 0 auto;
  padding: 4px 16px calc(var(--abas) + var(--seguro) + 24px);
  display: flex; flex-direction: column; gap: 16px;
}
body[data-tela="pdv"] main { padding-bottom: calc(var(--abas) + var(--seguro) + 170px); }

.abas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--abas) + var(--seguro)); padding-bottom: var(--seguro);
  background: var(--cartao); border-top: 1px solid var(--borda);
}
.abas a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--texto-2); font-size: .75rem; font-weight: 600;
}
.abas .ic { font-size: 1.4rem; line-height: 1; filter: grayscale(1); opacity: .6; transition: .15s; }
.abas a.ativo { color: var(--brasa); }
.abas a.ativo .ic { filter: none; opacity: 1; transform: translateY(-1px); }

.bloco {
  background: var(--cartao); border-radius: var(--raio); padding: 16px;
  box-shadow: var(--sombra);
}

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 52px; padding: 0 20px; border: 0; border-radius: 14px;
  font-weight: 700; font-size: 1rem; text-decoration: none;
  transition: transform .08s, opacity .15s;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .35; cursor: default; }
.btn.principal { background: var(--brasa); color: #fff; }
.btn.secundario { background: var(--fundo); color: var(--texto); }
.btn.largo { width: 100%; min-height: 56px; font-size: 1.05rem; }

.btn-ic {
  width: 48px; height: 48px; flex-shrink: 0; border: 0; border-radius: 12px;
  background: var(--fundo); font-size: 1.15rem; display: grid; place-items: center;
}
.btn-ic:active { transform: scale(.94); }
.btn-ic.perigo { background: var(--erro-claro); color: var(--erro); font-weight: 800; }

.link { background: none; border: 0; color: var(--texto-2); font-weight: 600; padding: 12px; margin: -12px; text-decoration: underline; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  flex: 1; min-width: 64px; min-height: 48px; border: 1.5px solid var(--borda); border-radius: 999px;
  background: var(--cartao); font-weight: 700;
}
.chip.sel { border-color: var(--brasa); background: var(--brasa-claro); color: var(--brasa); }
.chip:active { transform: scale(.96); }

/* ---------- formulários ---------- */
input, select {
  width: 100%; min-height: 52px; padding: 0 14px;
  background: var(--fundo); border: 1.5px solid transparent; border-radius: 12px;
  font-size: 1rem; /* 16px evita zoom no iPhone */
}
input:focus, select:focus { outline: none; border-color: var(--brasa); background: var(--cartao); }
.campos { display: flex; flex-direction: column; gap: 14px; }
.campos label, .campos-2 label { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; font-weight: 600; color: var(--texto-2); }
.campos-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.campos-2 label { min-width: 0; }
input[type="date"] { min-width: 0; padding: 0 10px; -webkit-appearance: none; appearance: none; }
.add { display: flex; gap: 8px; margin-bottom: 12px; }

/* ---------- listas ---------- */
.lista { display: flex; flex-direction: column; }
.linha {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--borda); min-height: 64px;
}
.linha:last-child { border-bottom: 0; }
.linha > div:first-child { min-width: 0; }
.linha b { display: block; }
.linha small { display: block; }
.linha.inativo b { color: var(--texto-2); }
.linha-acoes { display: flex; gap: 8px; align-items: center; }
.num { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.num-legenda { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.vazio-p { color: var(--texto-2); margin: 8px 0; }
.dica { color: var(--texto-2); margin: 12px 0 0; font-size: .9rem; }

.switch {
  width: 52px; height: 32px; border: 0; border-radius: 999px; background: #d6cfc7; padding: 3px; flex-shrink: 0;
  display: flex; transition: background .15s;
}
.switch span { width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.switch.on { background: var(--verde); }
.switch.on span { transform: translateX(20px); }

.endereco {
  margin-top: 10px; padding: 14px; border-radius: 12px; text-align: center;
  background: var(--brasa-claro); color: var(--brasa); font-size: 1.2rem; font-weight: 800;
  user-select: all; -webkit-user-select: all; word-break: break-all;
}
.vazio { text-align: center; padding: 48px 16px; color: var(--texto-2); }
.vazio-ic { font-size: 3rem; }

/* ---------- grade de espetinhos ---------- */
.grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.bloco .grade { gap: 10px; }
.prod { position: relative; }
.prod-add, .opcao {
  width: 100%; min-height: 112px; padding: 14px;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 6px;
  text-align: left; border: 2px solid transparent; border-radius: var(--raio);
  background: var(--cartao); box-shadow: var(--sombra);
  transition: transform .08s, border-color .15s;
}
.prod-add:active, .opcao:active { transform: scale(.96); }
.opcao { min-height: 76px; padding: 12px; background: var(--fundo); box-shadow: none; }
.prod.tem .prod-add, .opcao.sel { border-color: var(--brasa); background: var(--brasa-claro); }
.prod-nome { font-size: 1.1rem; font-weight: 800; line-height: 1.15; padding-right: 36px; word-break: break-word; }
.opcao .prod-nome { padding-right: 0; }
.prod-disp { font-size: .8rem; font-weight: 600; color: var(--texto-2); }
.prod-disp.zerado { color: var(--erro); }
.prod-mais, .prod-qtd {
  position: absolute; top: 10px; right: 10px;
  min-width: 36px; height: 36px; padding: 0 8px; border-radius: 999px;
  display: grid; place-items: center; font-weight: 800; font-size: 1.15rem;
}
.prod-mais { background: var(--fundo); color: var(--texto-2); }
.prod-qtd { background: var(--brasa); color: #fff; }
.prod-menos {
  position: absolute; right: 8px; bottom: 8px;
  width: 44px; height: 44px; border: 0; border-radius: 12px;
  background: var(--cartao); color: var(--brasa); font-size: 1.6rem; font-weight: 800; line-height: 1;
  box-shadow: var(--sombra);
}
.prod-menos:active { transform: scale(.92); }

/* ---------- últimas vendas ---------- */
.ultimas { background: var(--cartao); border-radius: var(--raio); box-shadow: var(--sombra); padding: 0 16px; }
.ultimas summary {
  list-style: none; min-height: 56px; display: flex; align-items: center; gap: 8px;
  font-weight: 700; cursor: pointer;
}
.ultimas summary::-webkit-details-marker { display: none; }
.ultimas summary::after { content: "›"; margin-left: auto; font-size: 1.5rem; color: var(--texto-2); transition: transform .15s; }
.ultimas[open] summary::after { transform: rotate(90deg); }
.contador { background: var(--fundo); color: var(--texto-2); font-size: .8rem; padding: 2px 8px; border-radius: 999px; }
.venda { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--borda); }
.venda:last-child { padding-bottom: 16px; }
.venda-info { flex: 1; min-width: 0; }
.venda-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.venda-acoes { display: flex; gap: 8px; }
.venda.cancelada { opacity: .5; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: .7rem; font-weight: 800; vertical-align: 1px; }
.tag-kit { background: var(--brasa-claro); color: var(--brasa); }
.tag-voucher { background: #e8efff; color: var(--azul); }
.tag-cancel { background: var(--erro-claro); color: var(--erro); }

/* ---------- checkout fixo ---------- */
.checkout {
  position: fixed; left: 0; right: 0; z-index: 9;
  bottom: calc(var(--abas) + var(--seguro));
  max-width: var(--largura); margin: 0 auto;
  padding: 12px 16px; background: var(--cartao);
  border-top: 1px solid var(--borda); border-radius: 20px 20px 0 0;
  box-shadow: 0 -6px 24px rgba(31, 26, 22, .08);
}
.checkout-resumo { display: flex; align-items: center; justify-content: space-between; min-height: 32px; margin-bottom: 10px; }
.checkout-resumo b { font-size: 1.05rem; margin-right: 10px; }
.checkout-resumo .valor { font-size: 1.25rem; font-weight: 800; color: var(--brasa); }
.checkout-resumo .dica { margin: 0; }
.checkout-botoes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn.grande { flex-direction: column; gap: 0; min-height: 72px; font-size: 1.3rem; font-weight: 800; letter-spacing: .03em; color: #fff; }
.btn.grande small { color: rgba(255, 255, 255, .85); font-size: .78rem; font-weight: 600; letter-spacing: 0; }
.btn.kit { background: var(--brasa); }
.btn.voucher { background: var(--azul); }

/* ---------- assados ---------- */
.stepper { display: grid; grid-template-columns: 72px 1fr 72px; gap: 10px; margin-bottom: 12px; }
.btn-step {
  height: 72px; border: 0; border-radius: 16px; background: var(--fundo);
  font-size: 2rem; font-weight: 700; color: var(--brasa);
}
.btn-step:active { transform: scale(.94); }
.stepper input { height: 72px; text-align: center; font-size: 2rem; font-weight: 800; padding: 0; }
.bloco .chips + .btn { margin-top: 14px; }

/* ---------- relatório ---------- */
.indicadores { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.indicadores div {
  background: var(--cartao); border-radius: var(--raio); padding: 14px; box-shadow: var(--sombra);
  display: flex; flex-direction: column; gap: 2px;
}
.indicadores span { font-size: .8rem; font-weight: 600; color: var(--texto-2); }
.indicadores b { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.indicadores .destaque { grid-column: 1 / -1; background: var(--brasa); }
.indicadores .destaque span { color: rgba(255, 255, 255, .85); }
.indicadores .destaque b { color: #fff; font-size: 2rem; }

/* ---------- aviso ---------- */
.aviso {
  position: fixed; left: 50%; top: max(16px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 20;
  padding: 12px 20px; border-radius: 20px; font-weight: 700; width: max-content; max-width: calc(100% - 32px);
  text-align: center;
  background: var(--texto); color: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}
.aviso.erro { background: var(--erro); }

/* ---------- telas maiores ---------- */
@media (min-width: 600px) {
  .grade { grid-template-columns: repeat(3, 1fr); }
  .indicadores { grid-template-columns: repeat(4, 1fr); }
  .indicadores .destaque { grid-column: auto; }
}

/* ---------- login / acesso ---------- */
body[data-tela="login"] .abas, body[data-tela="carregando"] .abas,
body[data-tela="login"] .dia, body[data-tela="carregando"] .dia { display: none; }
.login { margin-top: 24px; text-align: center; }
.login .campos { text-align: left; margin-top: 8px; }
.login-ic { font-size: 3rem; line-height: 1; margin-bottom: 8px; }
.login-msg { margin: 0; font-weight: 600; }
.conta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.conta b { display: block; word-break: break-all; }

/* ---------- impressão ---------- */
.dica-topo { margin: 0 0 8px; }
.botoes-col { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.ponto { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #c9c1b8; margin-right: 8px; vertical-align: 1px; }
.ponto.on { background: var(--verde); box-shadow: 0 0 0 3px rgba(22, 163, 74, .18); }
.codigo-box {
  display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px;
  padding: 14px; border-radius: 14px; background: var(--brasa-claro); border: 1.5px dashed var(--brasa);
}
.codigo {
  font-family: ui-monospace, Consolas, monospace; font-size: .95rem; font-weight: 700;
  background: var(--cartao); padding: 12px; border-radius: 10px; word-break: break-all;
  user-select: all; -webkit-user-select: all;
}
.aviso.info { background: var(--azul); }
