:root {
  --ink: #0c0c0d; --panel: #161618; --panel2: #1d1d20; --line: #2b2b30;
  --paper: #f4f2ec; --muted: #a9a69c; --volt: #ffe01a; --volt-ink: #141200;
  --volt-soft: rgba(255, 224, 26, .12); --ok: #3ddc5a; --ok-soft: rgba(61, 220, 90, .12);
  --bad: #ff5a4f; --bad-soft: rgba(255, 90, 79, .12); --info: #6da7ec;
  --raio: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--ink); color: var(--paper); font: 15px/1.4 Figtree, system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: 'Bricolage Grotesque', Figtree, sans-serif; margin: 0 0 .5em; letter-spacing: -.01em; }
.mono, .num { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* botões e campos */
.btn { border: 1px solid var(--line); background: var(--panel2); border-radius: 10px; padding: 10px 14px; cursor: pointer; font-weight: 600; }
.btn:hover { border-color: #44444b; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.volt { background: var(--volt); color: var(--volt-ink); border-color: var(--volt); }
.btn.ok { background: var(--ok); color: #06210d; border-color: var(--ok); }
.btn.bad { background: var(--bad-soft); color: var(--bad); border-color: rgba(255, 90, 79, .35); }
.btn.fino { padding: 6px 10px; font-size: 13px; }
.btn.grande { padding: 14px 18px; font-size: 17px; width: 100%; }
input, select { background: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; outline: none; }
input:focus, select:focus { border-color: var(--volt); }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }

/* topo */
.topo { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.marca { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: 20px; }
.marca b { color: var(--volt); }
.topo select { width: auto; padding: 7px 10px; }
.topo nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.topo nav button { background: none; border: 0; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600; }
.topo nav button.ativo { color: var(--paper); background: var(--panel2); }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line); white-space: nowrap; }
.chip.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.chip.bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.faixa-treino { background: var(--volt); color: var(--volt-ink); text-align: center; font-weight: 700; font-size: 13px; padding: 4px 8px; }

/* tela de venda */
.venda { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; padding: 16px; max-width: 1400px; margin: 0 auto; }
.painel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--raio); padding: 16px; }
.busca { position: relative; }
.busca input { font-size: 18px; padding: 14px 16px; }
.dica { font-size: 12px; color: var(--muted); margin-top: 6px; }
.resultados { margin-top: 12px; display: grid; gap: 6px; max-height: calc(100vh - 250px); overflow: auto; }
.res { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 12px; background: var(--panel2); border: 1px solid transparent; border-radius: 10px; cursor: pointer; text-align: left; width: 100%; }
.res:hover, .res:focus { border-color: var(--volt); outline: none; }
.res .nome { font-weight: 600; }
.res .sub { font-size: 12px; color: var(--muted); }
.res .preco { font-family: 'IBM Plex Mono', monospace; white-space: nowrap; }

.carrinho { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 76px; max-height: calc(100vh - 100px); }
.linhas { overflow: auto; display: grid; gap: 6px; min-height: 80px; }
.linha { background: var(--panel2); border-radius: 10px; padding: 10px; display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; }
.linha .nome { font-weight: 600; font-size: 14px; }
.linha .var { color: var(--volt); font-size: 13px; }
.linha .acoes { display: flex; gap: 6px; align-items: center; grid-column: 1 / -1; }
.qtd { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qtd button { background: none; border: 0; width: 34px; height: 32px; cursor: pointer; font-size: 18px; }
.qtd span { min-width: 28px; text-align: center; font-family: 'IBM Plex Mono', monospace; }
.linha .valor { text-align: right; font-family: 'IBM Plex Mono', monospace; }
.linha .desc { color: var(--ok); font-size: 12px; }
.vazio { color: var(--muted); text-align: center; padding: 24px 8px; border: 1px dashed var(--line); border-radius: 10px; }
.totais { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 4px; }
.totais .l { display: flex; justify-content: space-between; }
.totais .total { font-size: 26px; font-weight: 800; font-family: 'Bricolage Grotesque', sans-serif; }
.totais .total .num { color: var(--volt); }
.dupla { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* seletor de variações */
.variacoes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; max-height: 55vh; overflow: auto; padding: 2px; }
.vcard { position: relative; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; cursor: pointer; text-align: left; }
.vcard:hover, .vcard:focus { border-color: var(--volt); outline: none; }
.vcard .vn { font-weight: 700; }
.vcard .vc { font-size: 11px; color: var(--muted); font-family: 'IBM Plex Mono', monospace; }
.vcard .vp { margin-top: 4px; font-family: 'IBM Plex Mono', monospace; }
.vcard .ve { font-size: 12px; color: var(--muted); }
.vcard .ve.zero { color: var(--bad); }
.vcard .badge { position: absolute; top: -8px; right: -8px; background: var(--volt); color: var(--volt-ink); border-radius: 99px; min-width: 26px; height: 26px; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.filtro-var { margin-bottom: 10px; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .7); display: grid; place-items: center; z-index: 20; padding: 16px; }
.modal[hidden] { display: none; }
.modal-caixa { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; width: min(760px, 100%); max-height: 92vh; overflow: auto; }
.modal-topo { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 12px; }
.fechar { background: none; border: 0; font-size: 26px; cursor: pointer; color: var(--muted); line-height: 1; }
.rodape { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

/* pagamento */
.formas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 14px; }
.formas .btn { padding: 14px 6px; }
.pag { display: grid; grid-template-columns: 110px 1fr 100px 40px; gap: 8px; align-items: center; margin-bottom: 8px; }
.pag .forma { font-weight: 700; }
.saldo { display: flex; justify-content: space-between; font-size: 20px; font-weight: 800; padding: 12px; border-radius: 10px; margin-top: 8px; }
.saldo.falta { background: var(--bad-soft); color: var(--bad); }
.saldo.troco { background: var(--ok-soft); color: var(--ok); }

/* telas de caixa / listas */
.pagina { padding: 16px; max-width: 1000px; margin: 0 auto; display: grid; gap: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.card { background: var(--panel2); border-radius: 10px; padding: 12px; }
.card .t { font-size: 12px; color: var(--muted); }
.card .v { font-size: 22px; font-weight: 800; font-family: 'IBM Plex Mono', monospace; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
td.n, th.n { text-align: right; font-family: 'IBM Plex Mono', monospace; }
tr.clicavel { cursor: pointer; }
tr.clicavel:hover td { background: var(--panel2); }
.dif.pos { color: var(--ok); } .dif.neg { color: var(--bad); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(360px, 100%); }
.login .marca { font-size: 32px; margin-bottom: 4px; }

/* aviso */
.aviso { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); padding: 12px 18px; border-radius: 12px; z-index: 30; max-width: 90vw; box-shadow: 0 8px 30px rgba(0, 0, 0, .5); }
.aviso.erro { border-color: var(--bad); color: var(--bad); }
.aviso.ok { border-color: var(--ok); color: var(--ok); }

/* cupom 80 mm */
.cupom { background: #fff; color: #000; font: 12px/1.35 'IBM Plex Mono', monospace; width: 302px; padding: 10px; margin: 0 auto; }
.cupom .c { text-align: center; }
.cupom hr { border: 0; border-top: 1px dashed #000; }
.cupom .l { display: flex; justify-content: space-between; gap: 8px; }
.cupom .treino { border: 2px solid #000; text-align: center; font-weight: 700; padding: 4px; margin: 6px 0; }

@media (max-width: 900px) {
  .venda { grid-template-columns: 1fr; }
  .carrinho { position: static; max-height: none; }
  .resultados { max-height: 45vh; }
  .formas { grid-template-columns: repeat(2, 1fr); }
  .pag { grid-template-columns: 1fr 1fr; }
}
@media print {
  body * { visibility: hidden; }
  .cupom, .cupom * { visibility: visible; }
  .cupom { position: absolute; left: 0; top: 0; width: 72mm; padding: 0; }
  @page { size: 80mm auto; margin: 3mm; }
}
