/* Autoatendimento — página do consumidor. Cores da marca entram por CSSOM (app.js → setProperty) nos tokens abaixo;
   nada de style inline (a CSP é style-src 'self'). Celular primeiro: coluna de até 480 px, como as telas do SDK. */
:root {
  --brand: #1A1C1E;
  --on-brand: #FFFFFF;
  --radius: 12px;
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --ink: #1A1C1E;
  --muted: #5B6470;
  --line: #DADFE5;
  --danger: #B42318;
  --danger-bg: #FEF3F2;
  --ok: #1E7A4C;
  --focus: color-mix(in srgb, var(--brand) 35%, transparent);
  --brand-soft: color-mix(in srgb, var(--brand) 9%, #FFFFFF);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-text-size-adjust: 100%;
}

/* ─── topo ─── */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-inner { max-width: 480px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 10px; min-height: 56px; }
.brand-logo { height: 32px; width: auto; max-width: 160px; object-fit: contain; }
.brand-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quit { margin-left: auto; }
.progress { height: 3px; background: var(--line); }
.progress-bar { height: 100%; width: 0; background: var(--brand); transition: width .3s ease; }

/* ─── conteúdo ─── */
.wrap { flex: 1; width: 100%; max-width: 480px; margin: 0 auto; padding: 20px 16px 32px; outline: none; }
.screen { display: flex; flex-direction: column; gap: 16px; }
.screen.center { align-items: center; text-align: center; padding-top: 48px; }
h1 { font-size: 24px; line-height: 1.25; margin: 4px 0 0; letter-spacing: -0.01em; }
h2 { font-size: 18px; line-height: 1.3; margin: 0; }
p { margin: 0; }
.lead { font-size: 16px; color: var(--ink); }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.intro-text p + p { margin-top: 12px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist .dot { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; margin-top: 1px; }

/* ─── formulário ─── */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-size: 14px; font-weight: 600; }
.field .opt { font-weight: 400; color: var(--muted); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.row.r-2-1 { grid-template-columns: 2fr 1fr; }
.row.r-1-2 { grid-template-columns: 1fr 2fr; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; width: 100%; min-height: 48px;
}
input:focus, select:focus, textarea:focus { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--brand); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); }
.err { color: var(--danger); font-size: 13px; }
.err:empty { display: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { width: 20px; height: 20px; min-height: 0; margin: 2px 0 0; flex: none; accent-color: var(--brand); }
.code-input { font-size: 24px; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; }

.alert { border-radius: 10px; padding: 12px 14px; font-size: 14px; background: var(--danger-bg); color: var(--danger); }
.alert:empty { display: none; }
.note { border-radius: 10px; padding: 12px 14px; font-size: 14px; background: var(--brand-soft); }

/* ─── botões ─── */
.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.btn {
  font: inherit; font-weight: 600; font-size: 16px; min-height: 52px; padding: 12px 20px; width: 100%;
  border-radius: var(--radius); border: 1px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.link-btn { font: inherit; font-size: 14px; background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 6px 0; }
.link-btn:disabled { opacity: .5; cursor: default; }
a { color: var(--brand); }
a.btn { text-decoration: none; }

/* ─── produto / seguros / documentos ─── */
.choice { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface); cursor: pointer; }
.choice input { width: 20px; height: 20px; min-height: 0; margin: 0; flex: none; accent-color: var(--brand); }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice img { width: 48px; height: 32px; object-fit: contain; }
.choice .grow { flex: 1; }
.price { font-weight: 600; white-space: nowrap; }
.doc-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.badge { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 10px; background: var(--line); color: var(--muted); }
.badge.ok { background: color-mix(in srgb, var(--ok) 14%, #FFFFFF); color: var(--ok); }

/* ─── assinatura ─── */
.sign-pad { position: relative; border: 1px dashed var(--muted); border-radius: 10px; background: #FFFFFF; touch-action: none; }
.sign-pad canvas { display: block; width: 100%; height: 180px; border-radius: 10px; }
.sign-pad .hint { position: absolute; left: 12px; bottom: 10px; font-size: 12px; color: var(--muted); pointer-events: none; }
.sign-pad.has-ink .hint { display: none; }
.sign-tools { display: flex; justify-content: flex-end; }

/* ─── comprovante ─── */
.preview { width: 100%; max-height: 260px; object-fit: contain; border-radius: 10px; border: 1px solid var(--line); background: #FFFFFF; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }

/* ─── captcha ─── */
.captcha { min-height: 70px; display: flex; justify-content: center; }

/* ─── resultado ─── */
.result-icon { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 700; background: var(--brand-soft); color: var(--brand); }
.result-text { white-space: pre-line; }

.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── captura (SDK) ─── */
.capture-host { position: fixed; inset: 0; z-index: 50; background: #FFFFFF; }

.foot { max-width: 480px; margin: 0 auto; width: 100%; padding: 8px 16px 24px; text-align: center; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.foot:empty { display: none; }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.5s; }
  .progress-bar { transition: none; }
}
