/* Good PDV: app de celular (consulta de preços e venda rápida). */
:root {
  --brand: #0e9f6e;
  --brand-dark: #057a55;
  --brand-soft: #def7ec;
  --navy: #0f1b2d;
  --bg: #f3f5f8;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --danger: #dc2626;
  --danger-soft: #fde8e8;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --radius: 14px;
  --topo: 56px;
  --menu: 64px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 16px;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); min-height: 100%; }
body { overscroll-behavior-y: contain; }
h1, h2, h3 { margin: 0; }
button, input, select { font: inherit; color: inherit; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Estrutura ---------- */
.topo {
  position: fixed; inset: 0 0 auto; height: calc(var(--topo) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 16px 0;
  background: var(--navy); color: #fff; display: flex; align-items: center; gap: 10px; z-index: 20;
}
.topo img { width: 28px; height: 28px; }
.topo .titulo { font-weight: 700; line-height: 1.1; }
.topo .titulo small { display: block; font-weight: 400; font-size: 12px; color: #b6c2d3; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topo .espaco { flex: 1; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 5px 10px; border-radius: 99px; background: rgba(255, 255, 255, .1); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #34d399; }
.status.off::before { background: #fbbf24; }
.status b { background: #fbbf24; color: var(--navy); border-radius: 99px; padding: 0 6px; font-size: 12px; }

.tela { padding: calc(var(--topo) + env(safe-area-inset-top) + 14px) 14px calc(var(--menu) + env(safe-area-inset-bottom) + 18px); max-width: 720px; margin: 0 auto; }
.tela.com-rodape { padding-bottom: calc(var(--menu) + env(safe-area-inset-bottom) + 96px); }

.menu {
  position: fixed; inset: auto 0 0; height: calc(var(--menu) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, 1fr); z-index: 20;
}
.menu a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; color: var(--muted); text-decoration: none; position: relative; }
.menu a svg { width: 24px; height: 24px; }
.menu a.ativo { color: var(--brand-dark); font-weight: 600; }
.menu .bolha[hidden] { display: none; }
.menu .bolha { position: absolute; top: 8px; left: 56%; min-width: 18px; height: 18px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 11px; display: grid; place-items: center; padding: 0 5px; }

/* ---------- Componentes ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card h3 { font-size: 16px; margin-bottom: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--text);
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { color: var(--danger); border-color: #f5c2c2; }
.btn.bloco { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn svg { width: 22px; height: 22px; }
.linha { display: flex; gap: 10px; align-items: center; }
.linha > * { flex: 1; }
label.f { display: block; font-size: 14px; color: var(--muted); margin-bottom: 12px; }
label.f input, label.f select { display: block; width: 100%; margin-top: 6px; color: var(--text); }
input[type=text], input[type=search], input[type=number], input[type=email], input[type=password], select {
  height: 48px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; background: var(--card); width: 100%; outline: none;
}
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.senha { position: relative; display: block; margin-top: 6px; }
label.f .senha input { margin-top: 0; padding-right: 50px; }
.olho { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 42px; height: 40px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; border-radius: 10px; }
.olho svg { width: 22px; height: 22px; }

.busca { display: flex; gap: 8px; margin-bottom: 12px; position: sticky; top: calc(var(--topo) + env(safe-area-inset-top) + 8px); z-index: 5; }
.busca input { font-size: 17px; box-shadow: 0 2px 8px rgba(16, 24, 40, .06); }
.busca .btn { flex: none; width: 48px; padding: 0; }

/* Resultado da consulta */
.produto { display: flex; gap: 12px; align-items: center; }
.produto .info { flex: 1; min-width: 0; }
.produto .nome { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.produto .cod { font-size: 13px; color: var(--muted); }
.produto .preco { font-size: 20px; font-weight: 700; color: var(--brand-dark); white-space: nowrap; }
.produto .estoque { font-size: 13px; color: var(--muted); }
.produto .estoque.baixo { color: var(--danger); }
.lista .card { padding: 12px 14px; margin-bottom: 8px; }
.destaque { text-align: center; padding: 22px 16px; }
.destaque .preco { font-size: 44px; font-weight: 800; color: var(--brand-dark); margin: 6px 0; }
.destaque .nome { font-size: 19px; font-weight: 600; }

/* Venda */
.item { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .nome { font-weight: 600; }
.item .sub { font-size: 13px; color: var(--muted); }
.item .total { font-weight: 700; text-align: right; }
.qtd { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.qtd button { width: 42px; height: 40px; border: 0; background: var(--bg); font-size: 20px; font-weight: 700; cursor: pointer; }
.qtd span { min-width: 44px; text-align: center; font-weight: 600; }
.remover { border: 0; background: none; color: var(--danger); font-size: 14px; padding: 6px; cursor: pointer; }
.rodape-venda {
  position: fixed; left: 0; right: 0; bottom: calc(var(--menu) + env(safe-area-inset-bottom)); background: var(--card);
  border-top: 1px solid var(--line); padding: 12px 14px; display: flex; align-items: center; gap: 14px; z-index: 15;
}
.rodape-venda .total { flex: 1; }
.rodape-venda .total small { display: block; color: var(--muted); font-size: 13px; }
.rodape-venda .total b { font-size: 26px; }
.rodape-venda .btn { min-width: 150px; font-size: 17px; }
.vazio { text-align: center; color: var(--muted); padding: 34px 12px; }
.vazio svg { width: 48px; height: 48px; opacity: .4; display: block; margin: 0 auto 10px; }

/* Folha inferior (pagamento, etc.) */
.fundo { position: fixed; inset: 0; background: rgba(15, 27, 45, .5); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.folha {
  background: var(--card); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: sobe .18s ease-out;
}
@keyframes sobe { from { transform: translateY(30px); opacity: 0; } }
.folha h2 { font-size: 19px; margin-bottom: 4px; }
.folha .fechar { float: right; border: 0; background: var(--bg); width: 36px; height: 36px; border-radius: 50%; font-size: 20px; cursor: pointer; }
.formas { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
.formas button { height: 54px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); font-weight: 600; cursor: pointer; }
.formas button.sel { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.rapidos { display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 12px; }
.rapidos button { flex: 1; min-width: 60px; height: 40px; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; cursor: pointer; font-weight: 600; }
.troco { background: var(--brand-soft); color: var(--brand-dark); border-radius: 12px; padding: 12px 14px; display: flex; justify-content: space-between; font-size: 18px; margin-bottom: 14px; }
.troco.falta { background: var(--danger-soft); color: var(--danger); }
.ok-venda { text-align: center; padding: 10px 0 4px; }
.ok-venda .icone { width: 64px; height: 64px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; margin: 0 auto 10px; }
.ok-venda .icone svg { width: 34px; height: 34px; }
.ok-venda .valor { font-size: 34px; font-weight: 800; margin: 4px 0; }
.ok-venda .grade { display: grid; gap: 8px; margin-top: 16px; }

/* Câmera (leitor de código de barras) */
.camera { position: fixed; inset: 0; background: #000; z-index: 50; display: flex; flex-direction: column; }
.camera video { flex: 1; width: 100%; object-fit: cover; }
.camera .mira { position: absolute; left: 10%; right: 10%; top: 40%; height: 20%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
.camera .barra { padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); display: flex; gap: 10px; align-items: center; color: #fff; }
.camera .barra span { flex: 1; font-size: 14px; }

/* Caixa e sincronização */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.kpi small { color: var(--muted); font-size: 13px; }
.kpi b { display: block; font-size: 20px; margin-top: 2px; }
.tabela { width: 100%; border-collapse: collapse; font-size: 15px; }
.tabela td { padding: 8px 0; border-bottom: 1px solid var(--line); }
.tabela tr:last-child td { border-bottom: 0; }
.alerta { background: var(--warn-soft); color: var(--warn); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: 14px; }
.alerta.erro { background: var(--danger-soft); color: var(--danger); }
.passos { margin: 8px 0 0; padding-left: 20px; line-height: 1.7; }

/* Login */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px 18px calc(24px + env(safe-area-inset-bottom)); max-width: 420px; margin: 0 auto; }
.login .marca { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login .marca img { width: 52px; height: 52px; }
.login .marca b { font-size: 24px; display: block; }

#toasts { position: fixed; top: calc(var(--topo) + env(safe-area-inset-top) + 10px); left: 12px; right: 12px; z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 15px; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); max-width: 520px; }
.toast.ok { background: var(--brand-dark); }
.toast.erro { background: var(--danger); }

@media (min-width: 720px) {
  .rodape-venda { max-width: 720px; margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
