:root {
  --verde-900: #093d29;
  --verde-700: #0d5c3d;
  --verde-500: #1d784d;
  --verde-suave: #f1f9f4;
  --linha-alt: #ebf5ef;
  --dourado: #f5c518;
  --dourado-escuro: #b8923a;
  --vermelho: #dc2f3d;
  --laranja: #e8862a;
  --sucesso: #1ea562;
  --tinta: #1a1f1c;
  --tinta-suave: #5a675e;
  --tinta-fraca: #98a39c;
  --borda: #dce5e0;
  --papel: #ffffff;
}

html { color-scheme: only light; background: #ffffff; }

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--papel);
  color: var(--tinta);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 28px 16px;
}

input, textarea { -webkit-user-select: text; user-select: text; }

[hidden] { display: none !important; }

/* ---------- Marca ---------- */
.marca { text-align: center; margin-bottom: 24px; }
.logo {
  display: block;
  margin: 0 auto;
  width: auto;
  height: auto;
  max-width: min(280px, 70vw);
  max-height: 150px;
}
.marca-nome {
  color: var(--verde-700);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
}

/* ---------- Cartão base ---------- */
.cartao {
  background: var(--papel);
  border: 1px solid var(--borda);
  border-radius: 20px;
  box-shadow: 0 12px 34px rgba(9, 61, 41, 0.08);
  width: 100%;
  max-width: 540px;
  padding: 30px 26px;
}

.titulo { font-size: 26px; font-weight: 800; color: var(--tinta); }
.subtitulo { font-size: 16px; color: var(--tinta-suave); margin-top: 8px; line-height: 1.45; }

/* ---------- Campos ---------- */
.campo { margin-top: 20px; }
.campo label {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--tinta);
  margin-bottom: 8px;
}
.campo input[type="text"],
.campo input[type="tel"],
.campo input[type="password"] {
  width: 100%;
  height: 62px;
  font-size: 21px;
  color: var(--tinta);
  background: var(--papel);
  border: 2px solid var(--borda);
  border-radius: 14px;
  padding: 0 16px;
  outline: none;
}
.campo input:focus-visible {
  border-color: var(--verde-500);
  box-shadow: 0 0 0 4px rgba(29, 120, 77, 0.14);
}

/* ---------- Aceite ---------- */
.aceite {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 22px;
  padding: 14px;
  background: var(--verde-suave);
  border: 1px solid var(--borda);
  border-radius: 14px;
}
.aceite input[type="checkbox"] {
  width: 28px;
  height: 28px;
  flex: none;
  margin-top: 2px;
  accent-color: var(--verde-500);
}
.aceite label { font-size: 15px; line-height: 1.45; color: var(--tinta); }
.aceite button {
  background: none;
  border: none;
  padding: 0;
  color: var(--verde-500);
  font-size: 15px;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- Botões ---------- */
.btn {
  display: block;
  width: 100%;
  height: 62px;
  border: none;
  border-radius: 14px;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.06s ease;
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 3px solid var(--verde-500); outline-offset: 2px; }
.btn:disabled { opacity: 0.6; cursor: default; }

.btn-ouro { background: var(--dourado); color: #3a2e00; margin-top: 24px; }
.btn-verde { background: var(--verde-500); color: #fff; }
.btn-claro {
  background: var(--verde-suave);
  color: var(--tinta);
  border: 1px solid var(--borda);
  font-weight: 700;
}

.erro {
  margin-top: 14px;
  color: var(--vermelho);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.rodape {
  margin-top: 24px;
  color: var(--tinta-fraca);
  font-size: 12px;
  text-align: center;
}

/* ---------- Voucher (bilhete) ---------- */
.bilhete {
  position: relative;
  background: var(--verde-900);
  border-radius: 18px;
  padding: 26px 20px;
  margin-top: 22px;
  text-align: center;
  overflow: hidden;
}
.bilhete::before,
.bilhete::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30px;
  height: 30px;
  background: var(--papel);
  border: 1px solid var(--borda);
  border-radius: 50%;
  transform: translateY(-50%);
}
.bilhete::before { left: -16px; }
.bilhete::after { right: -16px; }

.bilhete-rotulo {
  color: #fde9a0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.bilhete-codigo {
  color: var(--dourado);
  font-size: clamp(36px, 9vw, 56px);
  font-weight: 800;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  margin-top: 10px;
  line-height: 1.1;
}
.bilhete-divisor {
  border: none;
  border-top: 2px dashed rgba(255, 255, 255, 0.28);
  margin: 20px 6px;
}
.bilhete-passos {
  color: rgba(255, 255, 255, 0.92);
  font-size: 16px;
  line-height: 1.7;
  text-align: left;
  padding-left: 4px;
  list-style-position: inside;
}

.linha-botoes { display: flex; gap: 12px; margin-top: 20px; }
.linha-botoes .btn { margin-top: 0; }

.contador { margin-top: 20px; }
.contador-texto {
  font-size: 14px;
  color: var(--tinta-suave);
  text-align: center;
  margin-bottom: 8px;
}
.contador-trilha {
  height: 6px;
  background: var(--linha-alt);
  border-radius: 999px;
  overflow: hidden;
}
.contador-barra {
  height: 100%;
  width: 100%;
  background: var(--verde-500);
  border-radius: 999px;
  transition: width 1s linear;
}

/* ---------- Modais ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(9, 61, 41, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 60;
}
.modal .cartao { max-width: 560px; max-height: 86vh; overflow-y: auto; }

.termo-texto { margin-top: 14px; font-size: 15px; line-height: 1.65; color: var(--tinta); }
.termo-texto p { margin-top: 12px; }
.termo-texto strong { color: var(--verde-700); }

/* ---------- Painel admin ---------- */
.painel {
  position: fixed;
  inset: 0;
  background: #0a2f20;
  z-index: 70;
  overflow-y: auto;
  padding: 20px 16px 40px;
  -webkit-user-select: text;
  user-select: text;
}
.painel-conteudo { max-width: 860px; margin: 0 auto; }
.painel-topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.painel-titulo { color: #fff; font-size: 22px; font-weight: 800; }
.painel-topo .btn { width: auto; height: 48px; padding: 0 22px; font-size: 16px; margin-top: 0; }

.painel-cartao {
  background: var(--papel);
  border-radius: 16px;
  padding: 20px;
  margin-top: 16px;
}
.painel-cartao h2 { font-size: 17px; font-weight: 800; color: var(--tinta); }

.stats { display: flex; gap: 12px; flex-wrap: wrap; }
.stat {
  flex: 1;
  min-width: 150px;
  background: var(--papel);
  border-radius: 16px;
  padding: 18px;
  text-align: center;
}
.stat-numero { font-size: 34px; font-weight: 800; color: var(--verde-700); }
.stat-numero.alerta { color: var(--laranja); }
.stat-rotulo { font-size: 13px; color: var(--tinta-suave); font-weight: 600; margin-top: 4px; }

.aviso-estoque {
  background: #fdf1e3;
  border: 2px solid var(--laranja);
  color: #8a4d0f;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 700;
  margin-top: 16px;
}

.painel textarea {
  width: 100%;
  min-height: 130px;
  font-size: 15px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  border: 2px solid var(--borda);
  border-radius: 12px;
  padding: 12px;
  margin-top: 12px;
  resize: vertical;
  outline: none;
}
.painel textarea:focus-visible { border-color: var(--verde-500); }

.painel .btn-medio {
  width: auto;
  height: 50px;
  padding: 0 24px;
  font-size: 16px;
  margin-top: 14px;
}

.res-estoque { margin-top: 12px; font-size: 15px; font-weight: 700; color: var(--sucesso); }
.res-estoque.erro-cor { color: var(--vermelho); }

.busca {
  width: 100%;
  height: 50px;
  font-size: 16px;
  border: 2px solid var(--borda);
  border-radius: 12px;
  padding: 0 14px;
  margin-top: 12px;
  outline: none;
}
.busca:focus-visible { border-color: var(--verde-500); }

.tabela-caixa { overflow-x: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  padding: 10px 8px;
  color: var(--tinta-suave);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 2px solid var(--borda);
  white-space: nowrap;
}
td { padding: 10px 8px; border-bottom: 1px solid var(--linha-alt); white-space: nowrap; }
td.codigo-cel { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; color: var(--verde-700); }

.acoes-painel { display: flex; gap: 12px; flex-wrap: wrap; }
.acoes-painel .btn { width: auto; flex: 1; min-width: 160px; height: 54px; font-size: 16px; margin-top: 0; }
.btn-perigo { background: #fdecee; color: var(--vermelho); border: 2px solid #f3c2c8; font-weight: 800; }

@media (max-width: 420px) {
  .cartao { padding: 24px 18px; }
  .linha-botoes { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .btn, .contador-barra { transition: none; }
}
