:root {
  --cacau: #2A221C;
  --cacau-2: #3a2f27;
  --dourado: #8C6420;
  --dourado-claro: #b88a3c;
  --manteiga: #F4DE9E;
  --creme: #FBF6EA;
  --papel: #ffffff;
  --linha: #e7dcc4;
  --texto: #2A221C;
  --fraco: #7a6c5d;
  --perigo: #a3362a;
  --ok: #2f6b45;
  --r: 4px;
  --sombra: 0 1px 2px rgba(42, 34, 28, .06), 0 4px 14px rgba(42, 34, 28, .06);
  --sans: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Cormorant Garamond', Georgia, serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--creme); color: var(--texto);
  font: 16px/1.4 var(--sans); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.travado { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
b { font-weight: 650; }
.fraco { color: var(--fraco); font-size: .88rem; }

/* entrada */
.tela-pin {
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 24px; background: var(--cacau); color: var(--manteiga); text-align: center;
}
.tela-pin .lotus { width: 96px; color: var(--dourado-claro); margin-bottom: 10px; }
.tela-pin h1 { font: 600 2.4rem/1 var(--serif); margin: 0; letter-spacing: .01em; }
.tela-pin > p { margin: 6px 0 34px; color: #cdbb94; letter-spacing: .14em; text-transform: uppercase; font-size: .74rem; }
#form-pin { width: 100%; max-width: 280px; display: grid; gap: 10px; text-align: left; }
#form-pin label { font-size: .85rem; color: #cdbb94; }
#form-pin input {
  background: var(--cacau-2); border: 1px solid #5a4a3c; color: #fff; border-radius: var(--r);
  padding: 14px; font-size: 1.4rem; letter-spacing: .4em; text-align: center;
}
#form-pin input:focus { outline: 2px solid var(--dourado-claro); outline-offset: 1px; }
#form-pin .bt-cheio { background: var(--dourado); color: #fff; margin-top: 6px; }
.msg-erro { color: #e9a08f; min-height: 1.2em; margin: 4px 0 0; font-size: .9rem; }
#v-caixa .msg-erro, #v-comissoes .msg-erro { color: var(--perigo); }

/* topo */
.topo {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: flex-end; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 18px 14px; background: var(--cacau); color: var(--manteiga);
  border-bottom: 2px solid var(--dourado);
}
.topo h1 { margin: 0; font: 600 1.75rem/1 var(--serif); }
.topo-data { font-size: .82rem; color: #cdbb94; padding-bottom: 3px; }

main { max-width: 600px; margin: 0 auto; padding: 16px 14px calc(150px + env(safe-area-inset-bottom)); }
.secao { font: 600 1.3rem/1.2 var(--serif); margin: 26px 2px 10px; }

/* comandas abertas */
.resumo-dia { display: flex; justify-content: space-between; color: var(--fraco); font-size: .9rem; margin: 0 2px 10px; }
.resumo-dia:empty { display: none; }
.lista-comandas { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cartao-comanda {
  width: 100%; text-align: left; background: var(--papel); border: 1px solid var(--linha);
  border-radius: var(--r); padding: 14px 14px 12px; box-shadow: var(--sombra); display: grid; gap: 4px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.cartao-comanda:active { transform: scale(.985); }
.cc-linha { display: flex; justify-content: space-between; gap: 12px; }
.cc-linha > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-cliente { font-weight: 650; font-size: 1.08rem; }
.cc-total { font-weight: 700; font-variant-numeric: tabular-nums; }
.cc-info { color: var(--fraco); font-size: .86rem; }
.cc-tempo { flex-shrink: 0; }
.vazio { text-align: center; padding: 50px 20px; }
.vazio p { margin: 4px 0; }

.bt-flutuante {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 6;
  background: var(--dourado); color: #fff; border: 0; border-radius: 999px; padding: 15px 26px;
  font-weight: 650; font-size: 1.02rem; box-shadow: 0 6px 20px rgba(140, 100, 32, .38); display: flex; gap: 8px; align-items: center;
  white-space: nowrap;
}
.bt-flutuante span { font-size: 1.35rem; line-height: 1; }
.bt-flutuante:active { transform: translateX(-50%) scale(.97); }

/* abas */
.abas {
  position: fixed; inset: auto 0 0 0; z-index: 7; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--papel); border-top: 1px solid var(--linha); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.aba {
  background: none; border: 0; display: grid; justify-items: center; gap: 3px; padding: 6px 0; font-size: .74rem; color: var(--fraco);
}
.aba svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.aba.ativa { color: var(--dourado); font-weight: 650; }

/* botões */
.bt { border-radius: var(--r); padding: 14px 18px; font-weight: 650; border: 1px solid transparent; }
.bt-cheio { background: var(--cacau); color: var(--manteiga); }
.bt-cheio:disabled { opacity: .4; }
.bt-linha { background: transparent; border-color: var(--dourado); color: var(--dourado); width: 100%; margin-top: 10px; }
.bt-largo { width: 100%; margin-top: 14px; }
.bt-texto { background: none; border: 0; color: var(--dourado); font-weight: 600; padding: 12px; width: 100%; }
.bt-texto.pequeno { width: auto; padding: 6px 4px; font-size: .88rem; }
.bt-texto.perigo { color: var(--perigo); margin-top: 8px; }
.bt-x { background: none; border: 0; color: var(--fraco); font-size: 1.5rem; line-height: 1; width: 36px; height: 36px; border-radius: var(--r); }
.bt-x:active { background: #f3ead6; }

/* folha */
.fundo-folha { position: fixed; inset: 0; background: rgba(28, 22, 18, .45); z-index: 20; opacity: 0; transition: opacity .25s; }
.fundo-folha.aberto { opacity: 1; }
.folha {
  position: fixed; inset: 0; z-index: 21; background: var(--creme); display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}
.folha.aberta { transform: none; }
@media (min-width: 640px) {
  .folha { inset: 4vh auto 4vh 50%; width: 560px; margin-left: -280px; border-radius: var(--r); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
}
.folha-topo {
  display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 10px 10px;
  background: var(--cacau); color: var(--manteiga); border-bottom: 2px solid var(--dourado);
}
.folha-topo h2 { margin: 0; font: 600 1.45rem/1.1 var(--serif); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-voltar { background: none; border: 0; color: #cdbb94; padding: 8px; font-size: .95rem; white-space: nowrap; }
.folha-corpo { flex: 1; overflow-y: auto; padding: 16px 16px calc(30px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }

/* formulários */
.form { display: grid; gap: 8px; }
.form label { font-size: .88rem; color: var(--fraco); margin-top: 6px; }
.form input, .filtro input, .filtro select, .linha-valor input {
  width: 100%; background: var(--papel); border: 1px solid var(--linha); border-radius: var(--r); padding: 13px 12px; font-size: 1rem;
}
input:focus, select:focus { outline: 2px solid var(--dourado-claro); outline-offset: -1px; }
.form .bt { margin-top: 10px; }
.duas-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.duas-col label { display: block; margin-bottom: 8px; }
label.dividir { display: flex; align-items: center; gap: 10px; font-size: .95rem; color: var(--texto); margin: 14px 0 4px; }
label.dividir input { width: 20px; height: 20px; accent-color: var(--dourado); }

/* itens */
.lista-itens { list-style: none; margin: 12px 0 0; padding: 0; background: var(--papel); border: 1px solid var(--linha); border-radius: var(--r); }
.lista-itens li { display: flex; align-items: center; gap: 10px; padding: 12px 8px 12px 14px; border-bottom: 1px solid #f1e8d5; }
.lista-itens li:last-child { border-bottom: 0; }
.lista-itens li > div { flex: 1; display: grid; gap: 2px; min-width: 0; }
.lista-itens.compacta li { padding: 10px 14px; }
.it-preco { font-variant-numeric: tabular-nums; font-weight: 600; }
.vazio-item { color: var(--fraco); justify-content: center; padding: 18px !important; }
.total-comanda { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 2px 0; font-size: 1.05rem; }
.total-comanda b { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.total-comanda.grande b { font-size: 1.9rem; color: var(--dourado); }

.passo { font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--dourado); font-weight: 700; margin: 20px 0 8px; }
.passo:first-child { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--papel); border: 1px solid var(--linha); border-radius: 999px; padding: 9px 14px; font-size: .92rem;
}
.chip.ativo { background: var(--cacau); color: var(--manteiga); border-color: var(--cacau); }
.lista-escolha { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.lista-escolha button {
  width: 100%; display: flex; justify-content: space-between; gap: 10px; text-align: left;
  background: var(--papel); border: 1px solid var(--linha); border-radius: var(--r); padding: 13px 14px;
}
.lista-escolha button.ativo { border-color: var(--dourado); box-shadow: inset 0 0 0 1px var(--dourado); background: #fdf7e6; }
.linha-valor { display: flex; align-items: center; gap: 8px; }
.linha-valor span { font-weight: 600; color: var(--fraco); }
.linha-valor input { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
#previa-comissao { margin: 8px 2px 0; min-height: 1.2em; }

.grade-pag { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 4px; }
.chip-pag { background: var(--papel); border: 1px solid var(--linha); border-radius: var(--r); padding: 14px; font-weight: 600; }
.chip-pag.ativo { background: var(--cacau); color: var(--manteiga); border-color: var(--cacau); }
#bloco-segundo { display: grid; gap: 8px; }

/* caixa e comissões */
.filtro { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.filtro input[type=date] { flex: 1; text-align: center; }
.filtro-periodo { flex-direction: column; align-items: stretch; }
.datas-livres { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bt-seta { width: 48px; height: 48px; flex-shrink: 0; background: var(--papel); border: 1px solid var(--linha); border-radius: var(--r); font-size: 1.5rem; color: var(--dourado); }
.painel-total { background: var(--cacau); color: var(--manteiga); border-radius: var(--r); padding: 18px; display: grid; gap: 2px; }
.painel-total > span:first-child { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: #cdbb94; }
.painel-total b { font: 600 2.4rem/1.1 var(--serif); }
.painel-total .fraco { color: #cdbb94; }
.grade-formas { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.grade-formas div { background: var(--papel); border: 1px solid var(--linha); border-radius: var(--r); padding: 12px; display: grid; gap: 2px; }
.grade-formas span { font-size: .82rem; color: var(--fraco); }
.grade-formas b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.lista-fechadas, .lista-comissao, .lista-ajuste { list-style: none; margin: 0; padding: 0; background: var(--papel); border: 1px solid var(--linha); border-radius: var(--r); }
.lista-fechadas > li { display: flex; gap: 10px; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid #f1e8d5; }
.lista-fechadas > li > div:first-child { display: grid; gap: 2px; min-width: 0; }
.lista-fechadas li.cancelada { opacity: .55; }
.lf-dir { display: grid; justify-items: end; align-content: start; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
li:last-child { border-bottom: 0 !important; }
.lista-comissao > li { border-bottom: 1px solid #f1e8d5; }
.lc-topo { width: 100%; background: none; border: 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px; text-align: left; }
.lc-nome { font-weight: 650; }
.lc-num { display: grid; justify-items: end; }
.lc-num b { font-size: 1.12rem; color: var(--dourado); font-variant-numeric: tabular-nums; }
.lc-itens { list-style: none; margin: 0; padding: 0 14px 10px; font-size: .86rem; }
.lc-itens li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; padding: 7px 0; border-top: 1px dashed var(--linha); }
.periodo-txt { margin: 0 2px; }
.nota { margin: 12px 2px; }
.carregando { color: var(--fraco); text-align: center; padding: 30px; }

.lista-ajuste li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-bottom: 1px solid #f1e8d5; }
.lista-ajuste li.inativo { opacity: .55; }
.cat-ajuste { font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--dourado); margin: 16px 2px 6px; }
.rodape-app { text-align: center; margin-top: 30px; }

/* aviso */
.aviso {
  position: fixed; left: 50%; bottom: calc(140px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 40;
  background: var(--cacau); color: var(--manteiga); padding: 11px 18px; border-radius: var(--r); font-size: .93rem;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 90vw; text-align: center;
}
.aviso.mostrar { opacity: 1; transform: translate(-50%, 0); }
.aviso.erro { background: var(--perigo); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
