/* CV Simplificada — telas de acesso (login, cadastro, redefinir senha).
   Um cartão centralizado, mobile-first, com a identidade da landing (index.html). */
:root {
  --primary: #1D4ED8;
  --primary-dark: #1E40AF;
  --primary-soft: #EFF6FF;
  --secondary: #10B981;
  --success: #047857;
  --success-soft: #ECFDF5;
  --danger: #B91C1C;
  --danger-soft: #FEF2F2;
  --text: #1E293B;
  --text-muted: #475569;
  --placeholder: #7C8798;
  --bg: #F8FAFC;
  --white: #FFFFFF;
  --border: #CBD5E1;
  --border-soft: #E2E8F0;
  --ring: 0 0 0 3px rgba(29,78,216, 0.25);
  --radius: 12px;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 50% -200px, #DBEAFE 0%, rgba(219, 234, 254, 0) 70%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- Estrutura ---------- */
.auth-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 16px 32px;
}
@media (min-width: 640px) and (min-height: 700px) {
  /* Telas grandes: cartão centralizado, levemente acima do meio. */
  .auth-shell { justify-content: center; padding: 40px 24px 10vh; }
}
.auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 20px;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--primary);
  text-decoration: none;
  border-radius: 8px;
}
.auth-logo .wheel { font-size: 1.35rem; }
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.05);
  padding: 32px;
}
.auth-card.wide { max-width: 480px; }
@media (max-width: 480px) {
  .auth-shell { padding: 16px 16px 24px; }
  .auth-logo { margin: 4px 0 16px; }
  .auth-card { padding: 24px 20px; border-radius: 14px; }
}
@media (max-width: 340px) {
  .auth-card { padding: 20px 16px; }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
}
.badge.pill-green { color: var(--success); background: var(--success-soft); }

.headline {
  margin: 0 0 6px;
  font-family: var(--font-heading);
  font-size: 1.625rem;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  outline: none;
}
.subtitle {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}
.subtitle strong { color: var(--text); font-weight: 600; }

.footer-link {
  margin: 20px 0 0;
  text-align: center;
  font-size: 0.9375rem;
  color: var(--text-muted);
}
.footer-link a { font-weight: 600; }

.auth-legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  margin-top: 24px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.auth-legal a { color: var(--text-muted); }

a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-dark); }
a:focus-visible, button:focus-visible, summary:focus-visible, input[type="checkbox"]:focus-visible {
  outline: 3px solid rgba(29,78,216, 0.45);
  outline-offset: 2px;
}

/* ---------- Banners (erro geral / informação) ---------- */
.banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 20px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.9375rem;
  line-height: 1.45;
  border: 1px solid transparent;
}
.banner::before {
  flex: 0 0 auto;
  width: 20px; height: 20px;
  margin-top: 1px;
  border-radius: 50%;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  color: #fff;
}
.banner-error { color: #7F1D1D; background: var(--danger-soft); border-color: #FECACA; }
.banner-error::before { content: "!"; background: var(--danger); }
.banner-info { color: #064E3B; background: var(--success-soft); border-color: #A7F3D0; }
.banner-info::before { content: "✓"; background: var(--success); }
.banner a, .banner .link-btn { color: inherit; font-weight: 600; text-decoration: underline; }

/* ---------- Campos ---------- */
form { margin: 0; }
.field { margin: 0 0 18px; }
.field > label, .field-label {
  display: block;
  margin: 0 0 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}
.field .optional { font-weight: 400; color: var(--text-muted); }
.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.input {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  font: inherit;
  font-size: 1rem; /* 16px: evita zoom automático no iPhone */
  color: var(--text);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: var(--placeholder); opacity: 1; }
.input:hover { border-color: #94A3B8; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.2); }
.input.upper { text-transform: uppercase; }
.input.upper::placeholder { text-transform: none; }

.hint {
  margin: 6px 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.field-error {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  margin: 6px 0 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--danger);
}
.field-error::before {
  content: "!";
  flex: 0 0 auto;
  width: 16px; height: 16px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.field-error a, .field-error .link-btn { color: inherit; text-decoration: underline; }
.suggest { margin: 6px 0 0; font-size: 0.8125rem; color: var(--text-muted); }

/* Senha com botão mostrar/ocultar */
.password-wrapper { position: relative; }
.password-wrapper .input { padding-right: 92px; }
.toggle-password {
  position: absolute;
  top: 4px; right: 4px; bottom: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}
.toggle-password:hover { color: var(--text); background: #F1F5F9; }
.toggle-password svg { width: 18px; height: 18px; flex: 0 0 auto; }
.caps-warning { margin: 6px 0 0; font-size: 0.8125rem; color: #92400E; }

/* Checklist de requisitos da senha */
.pw-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.pw-rules li { display: inline-flex; align-items: center; gap: 6px; }
.pw-rules li::before {
  content: "";
  width: 14px; height: 14px;
  flex: 0 0 auto;
  border: 1.5px solid #94A3B8;
  border-radius: 50%;
  background: var(--white);
}
.pw-rules li.ok { color: var(--success); }
.pw-rules li.ok::before {
  border-color: var(--success);
  background: var(--success) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat;
}
.pw-rules.show-missing li:not(.ok) { color: var(--danger); }
.pw-rules.show-missing li:not(.ok)::before { border-color: var(--danger); }

/* Checkbox dos termos */
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 4px 0 0;
}
.check input {
  flex: 0 0 auto;
  width: 20px; height: 20px;
  margin: 2px 0 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.check label { font-size: 0.875rem; color: var(--text-muted); cursor: pointer; }
.check label a { font-weight: 600; }
.terms-field { margin-bottom: 20px; }

/* Bloco opcional recolhível (placa QR) */
.disclosure { margin: 0 0 18px; }
.disclosure summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  border-radius: 6px;
  list-style: none;
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::before {
  content: "";
  width: 7px; height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .15s;
}
.disclosure[open] summary::before { transform: rotate(45deg); }
.disclosure .field { margin: 12px 0 0; }

/* ---------- Botões ---------- */
.submit-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s;
}
.submit-btn:hover { background: var(--primary-dark); color: #fff; }
.submit-btn:disabled { cursor: not-allowed; background: #64748B; }
.submit-btn[aria-busy="true"] { cursor: progress; background: var(--primary-dark); }
.submit-btn[aria-busy="true"]::before {
  content: "";
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
  border-radius: 4px;
}
.link-btn:hover { text-decoration: underline; }
.link-btn:disabled { color: var(--text-muted); cursor: default; text-decoration: none; }
.form-options {
  display: flex;
  justify-content: flex-end;
  margin: -6px 0 20px;
}
.step-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

/* ---------- Código de 6 dígitos ---------- */
.otp-label { text-align: center; }
.otp { position: relative; margin: 0 auto; max-width: 360px; }
.otp-boxes {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}
.otp-boxes span {
  flex: 1 1 0;
  min-width: 0;
  max-width: 54px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.otp-boxes span.filled { border-color: #94A3B8; }
.otp.focused .otp-boxes span.active { border-color: var(--primary); box-shadow: var(--ring); }
.otp.focused .otp-boxes span.active:empty::after {
  content: "";
  width: 2px; height: 24px;
  background: var(--primary);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.otp.invalid .otp-boxes span { border-color: var(--danger); }
.otp-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 16px;
  letter-spacing: 0;
  outline: none;
  opacity: 0.01;
  cursor: text;
}
.otp-input::selection { background: transparent; }
.otp-meta { margin: 12px 0 20px; text-align: center; font-size: 0.8125rem; color: var(--text-muted); }

/* ---------- Combobox do estabelecimento ---------- */
.combo { position: relative; }
.combo .input { padding-right: 44px; }
.combo-spinner {
  position: absolute;
  right: 14px; top: 50%;
  width: 18px; height: 18px;
  margin-top: -9px;
  border: 2.5px solid #CBD5E1;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.combo-icon {
  position: absolute;
  right: 14px; top: 50%;
  width: 18px; height: 18px;
  margin-top: -9px;
  color: #94A3B8;
  pointer-events: none;
}
.listbox {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0; right: 0;
  max-height: 264px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
}
.listbox li {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.9375rem;
  line-height: 1.35;
  cursor: pointer;
}
.listbox li small { display: block; font-size: 0.8125rem; color: var(--text-muted); }
.listbox li[aria-selected="true"], .listbox li:hover { background: var(--primary-soft); }
.listbox li.combo-note { cursor: default; color: var(--text-muted); font-size: 0.875rem; }
.listbox li.combo-note:hover { background: transparent; }
.listbox li.combo-attrib { cursor: default; padding: 6px 12px 4px; font-size: 0.75rem; color: var(--text-muted); text-align: right; }
.listbox li.combo-attrib:hover { background: transparent; }

.chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #A7F3D0;
  border-radius: 10px;
  background: var(--success-soft);
}
.chip-icon { flex: 0 0 auto; width: 20px; height: 20px; color: var(--success); }
.chip-text { flex: 1 1 auto; min-width: 0; font-size: 0.9375rem; line-height: 1.35; }
.chip-text strong { display: block; overflow-wrap: anywhere; }
.chip-text small { display: block; color: var(--text-muted); font-size: 0.8125rem; overflow-wrap: anywhere; }

.done-state { text-align: center; }
.done-icon {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* v43.1 (celular): áreas de toque com 44px sem mudar o visual (padding + margem negativa). */
@media (max-width: 768px) {
  .auth-logo { min-height: 44px; margin-top: -4px; margin-bottom: 8px; }
  .toggle-password { top: 2px; bottom: 2px; min-height: 44px; }
  .link-btn.forgot-password { min-height: 44px; margin: -12px 0; }
  .disclosure summary { min-height: 44px; }
  .auth-legal a { display: inline-flex; align-items: center; min-height: 44px; margin: -10px 0; }
}
