:root {
  --bg: #f5f2ed;
  --superficie: #ffffff;
  --superficie-2: #faf8f5;
  --borda: #e4ddd3;
  --texto: #2b2420;
  --muted: #74695f;
  --primaria: #9a3b26;
  --primaria-escura: #7c2d1b;
  --primaria-suave: #f6e6e0;
  --destaque: #e0a63c;
  --ok: #2f7d4f;
  --ok-suave: #e3f2e8;
  --aviso: #9a6b00;
  --aviso-suave: #fbf0d6;
  --erro: #b3261e;
  --erro-suave: #fbe4e2;
  --raio: 10px;
  --sombra: 0 1px 2px rgba(43, 36, 32, .06), 0 2px 8px rgba(43, 36, 32, .05);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--texto); font-size: 15px; line-height: 1.45; }
a { color: var(--primaria); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.dir { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inline { display: inline; }
.erro { color: var(--erro); display: block; }

/* topo */
.topo { display: flex; align-items: center; gap: 1.25rem; padding: 0 1.25rem; height: 56px;
  background: var(--superficie); border-bottom: 1px solid var(--borda); position: sticky; top: 0; z-index: 10; }
.marca { font-weight: 700; font-size: 1.05rem; color: var(--texto); white-space: nowrap; }
.marca:hover { text-decoration: none; }
.marca small { color: var(--muted); font-weight: 600; font-size: .75rem; margin-left: .2rem; }
.marca-num { display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 50%;
  background: var(--primaria); color: #fff; margin-right: .25rem; }
.marca-grande { font-size: 1.6rem; }
.menu { display: flex; gap: .15rem; overflow-x: auto; flex: 1; }
.menu a { padding: .45rem .7rem; border-radius: 8px; color: var(--muted); white-space: nowrap; font-weight: 500; }
.menu a:hover { background: var(--superficie-2); text-decoration: none; color: var(--texto); }
.menu a.ativo { background: var(--primaria-suave); color: var(--primaria-escura); }
.topo-dir { display: flex; align-items: center; gap: .75rem; white-space: nowrap; }
.usuario { font-weight: 600; }

.conteudo { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.cabecalho { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }

/* cartões */
.cartao { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra); padding: 1.25rem; }
.cartao + .cartao { margin-top: 1rem; }
.grade { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 1rem; }
.metrica .rotulo { color: var(--muted); font-size: .85rem; }
.metrica .valor { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.metrica .sub { color: var(--muted); font-size: .85rem; }
.vazio, .vazio-grande { text-align: center; color: var(--muted); }
.vazio-grande { padding: 3rem 1rem; }

/* botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1rem;
  border-radius: 8px; border: 1px solid var(--borda); background: var(--superficie); color: var(--texto);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--superficie-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primario { background: var(--primaria); border-color: var(--primaria); color: #fff; }
.btn-primario:hover { background: var(--primaria-escura); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #256640; }
.btn-perigo { color: var(--erro); border-color: #e9b9b5; }
.btn-perigo:hover { background: var(--erro-suave); }
.btn-link { border: 0; background: none; color: var(--primaria); padding: .25rem; }
.btn-pequeno { padding: .3rem .6rem; font-size: .85rem; }
.btn-grande { padding: .9rem 1.2rem; font-size: 1.05rem; }
.btn-bloco { width: 100%; }
kbd { font: 600 .72rem/1 ui-monospace, monospace; padding: .15rem .3rem; border-radius: 4px; border: 1px solid currentColor; opacity: .75; }

/* chips e mensagens */
.chip { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: var(--superficie-2); border: 1px solid var(--borda); color: var(--muted); }
.chip-ok { background: var(--ok-suave); border-color: #bfe0cb; color: var(--ok); }
.chip-aviso { background: var(--aviso-suave); border-color: #ecd59b; color: var(--aviso); }
.chip-erro { background: var(--erro-suave); border-color: #efc0bc; color: var(--erro); }
.mensagens { margin-bottom: 1rem; display: grid; gap: .5rem; }
.msg { padding: .7rem 1rem; border-radius: 8px; background: var(--superficie); border: 1px solid var(--borda); }
.msg-success { background: var(--ok-suave); border-color: #bfe0cb; }
.msg-error { background: var(--erro-suave); border-color: #efc0bc; color: var(--erro); }
.msg-warning { background: var(--aviso-suave); border-color: #ecd59b; }

/* formulários */
input, select, textarea { font: inherit; color: inherit; padding: .55rem .7rem; border: 1px solid var(--borda);
  border-radius: 8px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primaria); outline-offset: -1px; border-color: var(--primaria); }
input[type=checkbox], input[type=radio] { width: auto; }
label { font-weight: 600; font-size: .9rem; }
.formulario { max-width: 640px; }
.campo { margin-bottom: 1rem; display: grid; gap: .3rem; }
.campo-check label { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.campo ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
.campo ul label { font-weight: 500; display: flex; gap: .4rem; align-items: center; }
.campo-erro input, .campo-erro select { border-color: var(--erro); }
.acoes { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }
.filtros { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.filtros label { display: grid; gap: .25rem; font-size: .8rem; color: var(--muted); }
.filtros input, .filtros select { width: auto; min-width: 140px; }

/* tabelas */
.tabela-wrap { padding: 0; overflow-x: auto; }
.tabela { width: 100%; border-collapse: collapse; }
.tabela th, .tabela td { padding: .65rem .9rem; border-bottom: 1px solid var(--borda); text-align: left; vertical-align: middle; }
.tabela th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: var(--superficie-2); }
.tabela tbody tr:last-child td { border-bottom: 0; }
.tabela tfoot td { font-weight: 700; background: var(--superficie-2); }
.tabela td a + form, .tabela td a + a { margin-left: .5rem; }
.linha-cancelada td { color: var(--muted); text-decoration: line-through; }

/* login */
.tela-login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login { width: 100%; max-width: 360px; display: grid; gap: .9rem; }
.login label { display: grid; gap: .3rem; }

/* resumo de caixa */
.resumo { width: 100%; border-collapse: collapse; }
.resumo td { padding: .45rem 0; border-bottom: 1px dashed var(--borda); }
.resumo td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.resumo tr.total td { font-weight: 700; border-bottom: 0; font-size: 1.05rem; }
.diferenca-ok { color: var(--ok); }
.diferenca-ruim { color: var(--erro); }

@media (max-width: 760px) {
  .topo { height: auto; flex-wrap: wrap; padding: .5rem 1rem; gap: .5rem; }
  .menu { order: 3; width: 100%; }
  .conteudo { padding: 1rem; }
}

/* ---------- frente de caixa ---------- */
[x-cloak] { display: none !important; }
.pdv-main { padding: 0; }
.pdv { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; padding: 1rem 1.25rem;
  height: calc(100vh - 56px); position: relative; }
.pdv-aviso { position: absolute; top: 0; left: 0; right: 0; z-index: 5; background: var(--erro); color: #fff;
  padding: .5rem 1rem; font-weight: 600; text-align: center; }
.pdv-esquerda { display: flex; flex-direction: column; gap: .75rem; min-height: 0; }
.pdv-busca { position: relative; }
.pdv-busca-campo { position: relative; }
.pdv-busca input { font-size: 1.25rem; padding: .85rem 3rem .85rem 1rem; border-width: 2px; border-color: var(--primaria); }
.pdv-busca-dica { position: absolute; right: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.pdv-sugestoes { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: .25rem;
  list-style: none; background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio);
  box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 50vh; overflow: auto; }
.pdv-sugestoes li { display: grid; grid-template-columns: 1fr auto auto; gap: 1rem; padding: .6rem .75rem; border-radius: 8px; cursor: pointer; }
.pdv-sugestoes li.sel, .pdv-sugestoes li:hover { background: var(--primaria-suave); }
.pdv-itens { flex: 1; overflow: auto; padding: 0; min-height: 0; }
.pdv-itens .tabela thead th { position: sticky; top: 0; z-index: 1; }
.pdv-itens .tabela td { font-size: 1.05rem; }
.pdv-itens tr.sel td { background: #fff8e8; }
.pdv-vazio { padding: 3rem 1rem !important; }
.pdv-qtd { width: 5.2rem; padding: .3rem .5rem; text-align: right; }
.btn-x { border: 0; background: none; color: var(--muted); font-size: 1.4rem; line-height: 1; cursor: pointer; padding: .1rem .4rem; border-radius: 6px; }
.btn-x:hover { color: var(--erro); background: var(--erro-suave); }
.pdv-direita { display: flex; flex-direction: column; gap: .6rem; min-height: 0; overflow: auto; }
.pdv-direita .btn { justify-content: space-between; }
.pdv-total { background: var(--texto); color: #fff; border-color: var(--texto); }
.pdv-total .rotulo { opacity: .75; font-size: .9rem; }
.pdv-total .valor { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.pdv-total .sub { opacity: .7; font-size: .8rem; }
.pdv-atalhos { font-size: .8rem; margin-top: auto; display: grid; gap: .25rem; padding-top: .5rem; }
.pdv-toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); display: grid; gap: .5rem; z-index: 60; width: min(560px, 92vw); }
.pdv-toasts .msg { box-shadow: 0 6px 20px rgba(0,0,0,.15); font-weight: 600; }

.modal-fundo { position: fixed; inset: 0; background: rgba(30, 24, 20, .45); display: grid; place-items: center; z-index: 50; padding: 1rem; }
.modal { background: var(--superficie); border-radius: 14px; padding: 1.25rem 1.4rem; width: min(460px, 100%);
  max-height: 92vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); display: grid; gap: .75rem; }
.modal-largo { width: min(720px, 100%); }
.modal-topo { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.modal-topo h2 { margin: 0; font-size: 1.25rem; }
.modal .campo { display: grid; gap: .3rem; margin: 0; }
.modal .campo-check { display: flex; gap: .5rem; align-items: center; font-weight: 500; }
.pdv-total-mini { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.pag-pessoa { border: 1px solid var(--borda); border-radius: var(--raio); padding: .75rem; display: grid; gap: .6rem; }
.pag-pessoa-topo { display: flex; justify-content: space-between; }
.pag-formas { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
.pag-linha { display: grid; grid-template-columns: 6rem 1fr 1fr auto auto; gap: .6rem; align-items: end; }
.pag-linha label { display: grid; gap: .2rem; font-size: .8rem; color: var(--muted); }
.pag-linha input { font-size: 1.1rem; text-align: right; }
.pag-troco { color: var(--ok); white-space: nowrap; padding-bottom: .55rem; }
.pag-restante { display: flex; justify-content: space-between; padding: .5rem .75rem; border-radius: 8px; background: var(--aviso-suave); font-size: 1.05rem; }
.pag-restante.ok { background: var(--ok-suave); color: var(--ok); }
.pag-restante.ruim { background: var(--erro-suave); color: var(--erro); }
.pag-troco-total { font-size: 1.4rem; text-align: right; color: var(--ok); }
.abas { display: flex; gap: .25rem; background: var(--superficie-2); padding: .25rem; border-radius: 10px; }
.abas button { flex: 1; border: 0; background: none; padding: .5rem; border-radius: 8px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.abas button.ativa { background: var(--superficie); color: var(--texto); box-shadow: var(--sombra); }
.div-n { display: flex; align-items: center; gap: .75rem; }
.div-n input { width: 5rem; }
.div-linha { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .45rem 0; border-bottom: 1px dashed var(--borda); font-weight: 500; }
.div-linha input, .div-linha select { width: 10rem; }
.div-linha.desab { opacity: .55; }
.lista-vendas { max-height: 40vh; overflow: auto; }
.grade-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.modal-sucesso { text-align: center; justify-items: center; }
.sucesso-icone { width: 64px; height: 64px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 2.2rem; display: grid; place-items: center; }
.troco-grande { font-size: 2rem; color: var(--ok); }

@media (max-width: 980px) {
  .pdv { grid-template-columns: 1fr; height: auto; }
  .pag-linha { grid-template-columns: 1fr 1fr; }
  .pag-formas { grid-template-columns: repeat(2, 1fr); }
}
.div-linha input[type=radio], .div-linha input[type=checkbox] { width: auto; margin: 0 .5rem 0 0; }
.grade > .cartao + .cartao { margin-top: 0; }
.menu { scrollbar-width: none; }
.menu::-webkit-scrollbar { display: none; }
.tabela .num, .tabela .dir { text-align: right; }
