/* Base visual comum à página de venda e ao app. Sem fonte externa: usa a do aparelho, que abre na hora. */

:root {
  --primaria: #4338ca;
  --primaria-forte: #3730a3;
  --primaria-suave: #eef2ff;
  --compra: #15803d;
  --compra-forte: #166534;
  --texto: #0f172a;
  --texto-suave: #475569;
  --fundo: #f8fafc;
  --superficie: #ffffff;
  --borda: #cbd5e1;
  --borda-forte: #94a3b8;
  --perigo: #b91c1c;
  --foco: #f59e0b;
  --aviso-fundo: #fef3c7;
  --aviso-borda: #fcd34d;
  --aviso-texto: #78350f;
  --ok-fundo: #dcfce7;
  --ok-borda: #86efac;
  --ok-texto: #14532d;
  --erro-fundo: #fee2e2;
  --erro-borda: #fca5a5;
  --erro-texto: #7f1d1d;
  --raio: 12px;
  --raio-grande: 16px;
  --sombra: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 14px rgba(15, 23, 42, 0.07);
  --fonte: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--fonte);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--texto);
  background: var(--fundo);
  overflow-wrap: break-word;
}

h1,
h2,
h3,
p,
ul,
ol {
  margin: 0;
}

h1 {
  font-size: 1.625rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.25;
}

h3 {
  font-size: 1.0625rem;
  line-height: 1.3;
}

img,
canvas,
svg {
  max-width: 100%;
}

a {
  color: var(--primaria);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--foco);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.so-leitor {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.sub {
  color: var(--texto-suave);
}

/* ---------- botões ---------- */

.botao {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  border: 1.5px solid var(--borda-forte);
  border-radius: var(--raio);
  background: var(--superficie);
  color: var(--texto);
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.15s ease-out, border-color 0.15s ease-out, transform 0.1s ease-out;
}

.botao:hover {
  background: var(--primaria-suave);
  border-color: var(--primaria);
}

.botao:active {
  transform: scale(0.98);
}

.botao[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.botao-primario {
  background: var(--primaria);
  border-color: var(--primaria);
  color: #fff;
}

.botao-primario:hover {
  background: var(--primaria-forte);
  border-color: var(--primaria-forte);
}

.botao-compra {
  min-height: 56px;
  padding: 12px 22px;
  background: var(--compra);
  border-color: var(--compra);
  color: #fff;
  font-size: 1.125rem;
  font-weight: 700;
}

.botao-compra:hover {
  background: var(--compra-forte);
  border-color: var(--compra-forte);
}

.botao-perigo {
  border-color: var(--perigo);
  color: var(--perigo);
}

.botao-perigo:hover {
  background: var(--erro-fundo);
  border-color: var(--perigo);
}

.botao-largo {
  width: 100%;
}

/* ---------- campos ---------- */

.campo {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.campo-rotulo {
  font-size: 0.875rem;
  font-weight: 600;
}

.campo-dica {
  font-size: 0.8125rem;
  color: var(--texto-suave);
}

.campo-erro {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--perigo);
}

.entrada {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1.5px solid var(--borda-forte);
  border-radius: 10px;
  background: #fff;
  font-size: 1rem; /* menos que 16px faz o iPhone dar zoom ao tocar */
}

.entrada:focus {
  border-color: var(--primaria);
}

.entrada[aria-invalid="true"] {
  border-color: var(--perigo);
}

textarea.entrada {
  min-height: 96px;
  resize: vertical;
}

select.entrada {
  appearance: auto;
}

/* cores de marca: bolinhas que funcionam como opções */
.cores {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.cor {
  position: relative;
  display: block;
  width: 44px;
  height: 44px;
}

.cor input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.cor .bolinha {
  display: block;
  width: 44px;
  height: 44px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 1.5px var(--borda-forte);
}

.cor input:checked + .bolinha {
  box-shadow: 0 0 0 3px var(--texto);
}

.cor input:focus-visible + .bolinha {
  outline: 3px solid var(--foco);
  outline-offset: 4px;
}

/* ---------- blocos ---------- */

.cartao {
  padding: 16px;
  border: 1px solid var(--borda);
  border-radius: var(--raio-grande);
  background: var(--superficie);
  box-shadow: var(--sombra);
}

.aviso {
  padding: 12px 14px;
  border: 1px solid var(--aviso-borda);
  border-radius: var(--raio);
  background: var(--aviso-fundo);
  color: var(--aviso-texto);
}

.aviso-ok {
  border-color: var(--ok-borda);
  background: var(--ok-fundo);
  color: var(--ok-texto);
}

.aviso-erro {
  border-color: var(--erro-borda);
  background: var(--erro-fundo);
  color: var(--erro-texto);
}

/* folha do documento desenhada na tela */
.folha {
  padding: 10px;
  border-radius: var(--raio);
  background: #e2e8f0;
}

.folha canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.18);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
