:root {
  /* Cores da Marca e Paleta Refinada */
  --green: #00a651;
  --green-d: #008f45;
  --green-l: rgba(0, 166, 81, 0.15);
  
  --blue: #00457c;
  --blue-d: #002d52;
  
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  
  --field: #f8fafc;
  --surface: #ffffff;
  
  /* Fundos */
  --canvas-start: #f1f5f9;
  --canvas-end: #e2e8f0;
  
  /* Sombras Modernas / Glass */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-card: 0 10px 40px -10px rgba(0, 69, 124, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-btn: 0 4px 14px 0 rgba(0, 166, 81, 0.25);
  
  /* Transicoes */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, var(--canvas-start) 0%, var(--canvas-end) 100%);
  background-attachment: fixed;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--green-d); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--green); text-decoration: underline; }

/* Layout da Pagina */
.page { min-height: 100dvh; display: flex; flex-direction: column; }
.wrap { width: 100%; max-width: 480px; margin: 0 auto; padding: 48px 16px 16px; flex: 1; transition: max-width 0.3s ease; }
.wrap.is-success { max-width: 900px; }

.logo { display: flex; justify-content: center; margin-bottom: 32px; }
.logo img { width: 170px; height: auto; transition: transform 0.3s ease; }
.logo img:hover { transform: scale(1.02); }

/* Header/Intro */
.intro { text-align: center; margin-bottom: 32px; animation: slideDown 0.5s ease-out; }
.intro h1 { color: var(--blue-d); font-size: 26px; font-weight: 800; line-height: 1.2; letter-spacing: -0.02em; }
.intro p { color: var(--muted); font-size: 15px; max-width: 420px; margin: 12px auto 0; font-weight: 400; }
.intro .notice { color: var(--green); font-weight: 600; margin-top: 8px; font-size: 14px; background: var(--green-l); display: inline-block; padding: 4px 12px; border-radius: 20px; }

/* Card Principal */
.card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  position: relative;
  animation: slideUp 0.6s ease-out forwards;
}

.card-top {
  height: 5px;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.card.is-success-host {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}
.card.is-success-host > .card-top { display: none; }

.form { padding: 32px 24px; }
@media (min-width: 640px) { .form { padding: 40px 32px; } }

/* Formularios & Inputs */
[hidden] { display: none !important; }

.field { display: block; margin-bottom: 20px; }
.label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--blue-d); }
.label i { color: var(--green); font-style: normal; margin-left: 2px; }

input:not([type="checkbox"]), select {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
  color: var(--ink);
  appearance: none;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

input:not([type="checkbox"])::placeholder, select::placeholder { color: #94a3b8; }

input:not([type="checkbox"]):focus, select:focus {
  outline: none;
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 4px var(--green-l);
}

input[aria-invalid=true] {
  border-color: #ef4444;
  background: #fef2f2;
}

.row { display: grid; grid-template-columns: 1fr; gap: 0; }
@media (min-width: 400px) { .row { grid-template-columns: 1fr 1fr; gap: 16px; } }

.err { display: block; color: #ef4444; font-size: 12px; margin-top: 6px; font-weight: 500; min-height: 0; }

/* Checkboxes LGPD/Marketing */
.check {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
  margin-top: 12px;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.check:hover { background: #f1f5f9; border-color: #cbd5e1; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--green); cursor: pointer; }
.check span { color: var(--muted); font-weight: 500; line-height: 1.4; }
.check span i { color: var(--green); font-style: normal; }

.form-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
}

/* Call to Action */
.btn {
  width: 100%;
  height: 56px;
  margin-top: 24px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(to right, var(--green), var(--green-d));
  color: #fff;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(0, 166, 81, 0.35);
  background: linear-gradient(to right, #00b85a, var(--green));
}

.btn:active { transform: translateY(0); box-shadow: var(--shadow-btn); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }

.secure { text-align: center; font-size: 12px; color: var(--muted); margin-top: 20px; font-weight: 500; }

/* Badges / Selos de Confiança */
.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 24px;
  list-style: none;
  padding: 0;
  margin: 32px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.badges li { display: flex; align-items: center; gap: 6px; }
.badges li::before { content: "✓"; color: var(--green); font-size: 16px; font-weight: 800; }

/* Estado de Sucesso */
.success {
  padding: 24px 12px;
  text-align: center;
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ---------- Confirmacao de cadastro (comprovante) ---------- */
.success { padding: 8px 0 24px; text-align: left; }

.success-hero { text-align: center; margin-bottom: 22px; }
.success-check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px; background: var(--green);
  box-shadow: 0 6px 18px -6px rgba(0, 166, 81, 0.6);
}
.success-title {
  margin-top: 14px; font-size: 22px; font-weight: 800; letter-spacing: -0.02em;
  color: var(--blue-d); line-height: 1.25;
}
.success-sub { margin-top: 6px; font-size: 14px; color: var(--muted); }

.receipt-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 40px -12px rgba(0, 69, 124, 0.18);
  max-width: 100%;
  margin: 0 auto;
}
.receipt-topbar { height: 4px; background: linear-gradient(90deg, var(--green), var(--blue)); }
.receipt-body { padding: 18px; }

/* Bloco do protocolo */
.proto-row {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
  gap: 12px; background: #eef2fb; border-radius: 12px; padding: 16px;
}
.proto-main { min-width: 0; }
.proto-label {
  display: block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--muted);
}
.proto-code-line { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.proto-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 21px; font-weight: 700; color: var(--blue); word-break: break-all;
}
.proto-copy {
  flex-shrink: 0; border: 0; background: transparent; color: var(--muted);
  padding: 6px; border-radius: 8px; cursor: pointer; line-height: 0; transition: var(--transition);
}
.proto-copy:hover { background: #fff; color: var(--blue); }
.proto-copy.is-copied { color: var(--green); }
.proto-holder { display: block; margin-top: 8px; font-size: 14px; font-weight: 700; color: var(--ink); }
.proto-holder-sub { display: block; font-size: 12px; color: var(--muted); }
.proto-valid {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
  background: var(--green); color: #fff; font-size: 13px; font-weight: 700;
  padding: 7px 13px; border-radius: 999px;
}

/* Tres blocos de informacao */
.info-grid { display: grid; gap: 12px; margin-top: 12px; }
.info-card { background: var(--field); border-radius: 12px; padding: 16px; }
.info-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.info-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--muted);
}
.info-icon {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 9px; background: #fff;
}
.info-icon-green { background: var(--green); }
.info-value { margin-top: 8px; font-size: 18px; font-weight: 800; color: var(--blue-d); line-height: 1.2; }
.info-value-green { color: var(--green); }
.info-hint { margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.4; }

.receipt-notice {
  display: flex; align-items: flex-start; gap: 10px; margin-top: 12px;
  background: #eef2fb; border-radius: 12px; padding: 14px 16px;
  font-size: 13px; color: var(--ink); line-height: 1.5;
}
.receipt-notice svg { flex-shrink: 0; margin-top: 1px; }

/* Acoes */
.receipt-actions { display: grid; gap: 12px; margin-top: 18px; }
.btn-receipt {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 18px; border: 0; border-radius: 10px; cursor: pointer;
  font-size: 15px; font-weight: 700; color: #fff; text-decoration: none;
  transition: var(--transition);
}
.btn-receipt:disabled { opacity: 0.6; cursor: default; }
.btn-receipt-blue { background: var(--blue-d); box-shadow: 0 4px 14px rgba(0, 45, 82, 0.25); }
.btn-receipt-blue:hover:not(:disabled) { background: #001f3a; }
.btn-receipt-green { background: var(--green); box-shadow: var(--shadow-btn); }
.btn-receipt-green:hover { background: var(--green-d); }

/* Faixa de verificacao */
.receipt-verify {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 6px; background: #eef2fb; padding: 11px 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px; color: var(--muted);
}
.verify-left { display: inline-flex; align-items: center; gap: 7px; }
.verify-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); display: inline-block; }
.verify-hash { word-break: break-all; }

/* Selos */
.receipt-badges {
  list-style: none; display: flex; flex-wrap: wrap; justify-content: center;
  gap: 8px 20px; margin: 22px auto 0; padding: 0 8px;
  font-size: 11px; font-weight: 600; color: var(--muted);
}
.receipt-badges li { display: inline-flex; align-items: center; gap: 6px; }

/* Botoes lado a lado so quando o rotulo cabe em uma linha */
.btn-receipt { white-space: nowrap; }

@media (min-width: 620px) {
  .success-title { font-size: 28px; }
  .receipt-body { padding: 26px; }
  .receipt-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Tres colunas so com largura real para elas: abaixo disso os rotulos
   quebravam em duas linhas e o cartao ficava apertado. */
@media (min-width: 760px) {
  .receipt-body { padding: 30px; }
  .info-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .info-card { padding: 18px; }
  .proto-row { padding: 20px 22px; }
  .proto-code { font-size: 24px; }
  .receipt-actions { gap: 16px; max-width: 560px; margin-left: auto; margin-right: auto; }
}

/* Footer */
.foot { border-top: 1px solid rgba(0, 0, 0, 0.06); text-align: center; padding: 32px 24px; margin-top: auto; }
.foot-logo { opacity: 0.6; filter: grayscale(100%); transition: var(--transition); }
.foot-logo:hover { opacity: 1; filter: grayscale(0%); }
.foot p { font-size: 13px; color: var(--muted); margin-top: 16px; font-weight: 500; }

/* Páginas de Documento (Privacidade, etc) */
.doc { max-width: 680px; margin: 0 auto; padding: 48px 20px; background: var(--surface); box-shadow: var(--shadow-sm); min-height: 100dvh; }
.doc h1 { color: var(--blue-d); font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin-top: 24px; }
.doc h2 { color: var(--blue); font-size: 20px; font-weight: 700; margin-top: 32px; margin-bottom: 12px; }
.doc p { font-size: 16px; color: var(--ink); line-height: 1.7; margin-bottom: 16px; }

/* Animações Keyframes */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
  0% { opacity: 0; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}
