/* Smart Pages: componentes (botões, campos, cards, pílulas, alertas, tabela, modal, toast, skeleton, vazio,
   passos, selo). Estados de erro corrigidos (#B91C1C sobre #FDECEA), borda de campo #757C7E, WhatsApp #0C8340
   (docs/design-system-audit.md seções 3.4 e 17). Alvos de 44 a 48 px. */

/* botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--esp-2);
  min-height: var(--alvo-g); padding: 0 var(--esp-5); border: 1px solid transparent; border-radius: var(--raio-btn);
  font-size: var(--fs-ui); font-weight: var(--peso-ui); text-decoration: none; cursor: pointer;
  transition: background var(--es-dur-1) var(--es-ease), color var(--es-dur-1) var(--es-ease);
}
.btn-primario { background: var(--es-primaria); color: var(--es-primaria-texto); }
.btn-primario:hover { background: var(--es-primaria-hover); color: var(--es-primaria-texto); }
.btn-secundario { background: var(--es-fundo); color: var(--es-texto); border-color: var(--es-linha-forte); }
.btn-secundario:hover { background: var(--es-superficie-2); }
.btn-contorno { background: transparent; color: var(--es-destaque); border-color: var(--es-destaque); }
.btn-perigo { background: var(--es-erro); color: var(--es-branco-fixo); }
.btn-wa { background: var(--es-wa); color: var(--es-branco-fixo); }
.btn-link { display: inline-flex; align-items: center; background: none; border: 0; min-height: var(--alvo); padding: 0 var(--esp-2);
  color: var(--es-destaque); text-decoration: underline; cursor: pointer; }
.link-alvo { display: inline-flex; align-items: center; min-height: var(--alvo); }
.btn-largo { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .6; cursor: not-allowed; }
.btn.enviando { color: transparent; position: relative; pointer-events: none; }
.btn.enviando::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--es-primaria-texto); border-right-color: transparent; animation: girar .8s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* campos */
.campo { display: flex; flex-direction: column; gap: var(--esp-2); margin-bottom: var(--esp-4); }
.campo label { font-size: var(--fs-peq); font-weight: 500; color: var(--es-texto); }
.campo .ajuda { font-size: var(--fs-peq); color: var(--es-texto-3); margin: 0; }
.campo input, .campo select, .campo textarea {
  min-height: var(--alvo-g); padding: var(--esp-3) var(--esp-4); width: 100%;
  background: var(--es-fundo); color: var(--es-texto); border: 1px solid var(--es-linha-forte); border-radius: var(--raio-sm);
  font-size: var(--fs-corpo);
}
.campo textarea { min-height: 120px; resize: vertical; }
.campo input:focus-visible, .campo select:focus-visible, .campo textarea:focus-visible { border-color: var(--es-destaque); }
.campo [aria-invalid="true"] { border-color: var(--es-erro); }
.campo .erro-campo { margin: 0; font-size: var(--fs-peq); color: var(--es-erro); font-weight: 500; }
.campo-codigo input { font-size: var(--fs-2xl); letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.check { display: flex; gap: var(--esp-3); align-items: flex-start; min-height: var(--alvo); }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--es-primaria); }
.mel { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* cards e superfícies */
.card { background: var(--es-superficie); border-radius: var(--es-raio); padding: var(--esp-5); }
.card-borda { border: 1px solid var(--es-linha); }
.cartao-form { background: var(--es-fundo); border-radius: var(--es-raio); padding: var(--esp-5); box-shadow: var(--es-sombra); }
@media (min-width: 560px) { .cartao-form { padding: var(--esp-6); } }

/* pílulas e selos (mínimo 14 px, L.10) */
.pilula { display: inline-flex; align-items: center; min-height: 28px; padding: 0 var(--esp-3); border-radius: var(--raio-pilula);
  background: var(--es-suave); color: var(--es-destaque); font-size: var(--fs-peq); font-weight: 500; }
.pilula.ok { background: var(--es-sucesso-fundo); color: var(--es-sucesso); }
.pilula.aviso { background: var(--es-aviso-fundo); color: var(--es-aviso); }
.pilula.erro { background: var(--es-erro-fundo); color: var(--es-erro); }
.selo { display: inline-flex; align-items: center; gap: var(--esp-2); padding: var(--esp-1) var(--esp-3); border-radius: var(--raio-pilula);
  border: 1px solid var(--es-linha-forte); background: var(--es-fundo); color: var(--es-texto-2); font-size: var(--fs-peq); }

/* alertas */
.alerta { border-radius: var(--raio-sm); padding: var(--esp-4); margin-bottom: var(--esp-4); border-left: 4px solid currentColor; }
.alerta p { margin: 0; }
.alerta.erro { background: var(--es-erro-fundo); color: var(--es-erro); }
.alerta.aviso { background: var(--es-aviso-fundo); color: var(--es-aviso); }
.alerta.ok { background: var(--es-sucesso-fundo); color: var(--es-sucesso); }
.alerta.info { background: var(--es-suave); color: var(--es-destaque); }
.alerta ul { margin: var(--esp-2) 0 0; padding-left: var(--esp-5); }
.alerta a { color: inherit; font-weight: var(--peso-ui); }

/* tabela que vira cartões no celular */
.tabela { width: 100%; border-collapse: collapse; font-size: var(--fs-corpo); }
.tabela th, .tabela td { text-align: left; padding: var(--esp-3); border-bottom: 1px solid var(--es-linha); vertical-align: top; }
.tabela th { font-size: var(--fs-peq); color: var(--es-texto-3); font-weight: var(--peso-ui); }
@media (max-width: 767px) {
  .tabela thead { display: none; }
  .tabela tr { display: block; padding: var(--esp-3) 0; border-bottom: 1px solid var(--es-linha); }
  .tabela td { display: flex; justify-content: space-between; gap: var(--esp-3); border: 0; padding: var(--esp-1) 0; }
  .tabela td::before { content: attr(data-rotulo); color: var(--es-texto-3); font-size: var(--fs-peq); }
}

/* modal com prisão de foco (ui.js) */
.veu { position: fixed; inset: 0; background: rgba(5, 17, 21, .55); z-index: 80; display: flex; align-items: center; justify-content: center; padding: var(--esp-4); }
.modal { background: var(--es-fundo); color: var(--es-texto); border-radius: var(--es-raio); width: min(560px, 100%); max-height: 90vh; overflow: auto;
  padding: var(--esp-5); box-shadow: var(--es-sombra-forte); }
.modal h2 { font-size: var(--fs-2xl); }
.modal .acoes { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--esp-3); margin-top: var(--esp-5); }
@media (max-width: 767px) { .veu { align-items: flex-end; padding: 0; } .modal { border-radius: var(--es-raio) var(--es-raio) 0 0; width: 100%; } }

/* toast */
.toasts { position: fixed; right: var(--esp-4); bottom: var(--esp-4); z-index: 90; display: flex; flex-direction: column; gap: var(--esp-2); max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--es-escuro); color: var(--es-branco-fixo); border-radius: var(--raio-sm); padding: var(--esp-3) var(--esp-4); box-shadow: var(--es-sombra-forte); }
.toast.erro { background: var(--es-erro); }

/* skeleton */
.sk { background: linear-gradient(90deg, var(--es-superficie-2), var(--es-linha), var(--es-superficie-2)); background-size: 200% 100%;
  animation: brilho 1.2s ease-in-out infinite; border-radius: var(--raio-sm); }
.sk-linha { height: 16px; margin: var(--esp-2) 0; }
.sk-card { height: 120px; }
@keyframes brilho { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* estado vazio: sempre com a próxima ação */
.vazio { border: 2px dashed var(--es-linha); border-radius: var(--es-raio); padding: var(--esp-6); text-align: center; }
.vazio h2, .vazio h3 { font-size: var(--fs-xl); }
.vazio p { margin-left: auto; margin-right: auto; color: var(--es-texto-2); }

/* passos */
.passos { list-style: none; display: flex; gap: var(--esp-2); padding: 0; margin: 0 0 var(--esp-5); flex-wrap: wrap; }
.passos li { display: flex; align-items: center; gap: var(--esp-2); font-size: var(--fs-peq); color: var(--es-texto-3); }
.passos li .num { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 50%;
  border: 1px solid var(--es-linha-forte); }
.passos li[aria-current="step"] { color: var(--es-texto); font-weight: var(--peso-ui); }
.passos li[aria-current="step"] .num { background: var(--es-primaria); border-color: var(--es-primaria); color: var(--es-primaria-texto); }

/* códigos de recuperação e QR */
.codigos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--esp-2); padding: 0; list-style: none;
  font-variant-numeric: tabular-nums; font-family: ui-monospace, monospace; }
.codigos li { background: var(--es-superficie-2); padding: var(--esp-2) var(--esp-3); border-radius: var(--raio-sm); }
.qr { width: 200px; height: 200px; background: var(--es-branco-fixo); padding: var(--esp-2); border-radius: var(--raio-sm); }
.segredo { font-family: ui-monospace, monospace; word-break: break-all; }

/* banner de cookies (L.5): botões de mesmo peso */
.banner-cookies { position: fixed; left: var(--esp-4); right: var(--esp-4); bottom: var(--esp-4); z-index: 70; max-width: 720px; margin: 0 auto;
  background: var(--es-fundo); color: var(--es-texto); border-radius: var(--es-raio); padding: var(--esp-4) var(--esp-5); box-shadow: var(--es-sombra-forte); }
.banner-cookies p { margin-bottom: var(--esp-3); }
.banner-cookies .linha .btn { flex: 1 1 160px; }

/* em construção */
.em-construcao { max-width: 640px; }
