/* Confirma.id — design system v2 (direção do dono 2026-09-02: institucional
   claro, referência gov.br/banco — "brasileiro comum confia?"). Manrope.
   Contraste AA conferido para cada par de token usado (ver bloco de notas). */

@import url('/assets/fonts/manrope.css');

:root {
  /* paleta clara institucional */
  --bg: #eef3f2;            /* cinza-esverdeado claro */
  --surface: #ffffff;       /* cartões */
  --surface-2: #f2f7f6;     /* caixas internas (consent, url) */
  --border: #c9d6d3;
  --border-soft: #dde6e4;
  --ink: #16302b;           /* texto principal — 12.6:1 sobre --surface */
  --ink-soft: #47605b;      /* texto de apoio — 7.1:1 */
  --ink-faint: #546b66;     /* fine print — 5.1:1 até sobre --bg (AA recheck) */
  --brand: #0e7a68;         /* verde institucional — 5.1:1 sobre branco */
  --brand-strong: #0a6355;  /* hover */
  --brand-ink: #ffffff;     /* texto sobre botão brand — 5.1:1 */
  --link: #0b5e51;          /* links — 7.3:1 */
  --border-input: #7b948f;  /* borda de campo — 3.2:1 (WCAG 1.4.11) */
  --ok: #1e7a4f;
  --warn-bg: #fdf6e8; --warn-border: #d9b36a; --warn-ink: #6b4e12;
  --err-bg: #fbeeed; --err-border: #d69a94; --err-ink: #86322b;
  --focus: #0e7a68;
  --radius: 12px;
  --radius-s: 8px;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center;
  padding: 1rem 1rem 2rem;
  line-height: 1.55;
}

/* ---------- casca (header / main / footer) ---------- */
.page { width: 100%; max-width: 27rem; display: flex; flex-direction: column; gap: .9rem; flex: 1; }
.page-wide { max-width: 44rem; }

.site-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .8rem; padding: .55rem .2rem;
}
.brand { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; }
.brand svg { width: 30px; height: 30px; flex: none; }
.wordmark { font-weight: 800; font-size: 1.16rem; letter-spacing: -.02em; color: var(--ink); }
.wordmark em { font-style: normal; color: var(--brand); }

.session-chip {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .78rem; color: var(--ink-soft);
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 999px; padding: .3rem .75rem;
  max-width: 55%;
}
.session-chip .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.session-chip form { display: inline; }

main.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.7rem 1.6rem;
  box-shadow: 0 10px 30px -18px rgba(22, 48, 43, .18);
  /* telas curtas: cartão centrado entre header e footer (auto colapsa quando o
     conteúdo é longo) */
  margin-top: auto; margin-bottom: auto;
}

.site-foot {
  margin-top: auto; padding-top: 1.1rem;
  font-size: .8rem; color: var(--ink-faint);
  text-align: center; line-height: 1.8;
}
.site-foot a { color: var(--ink-soft); display: inline-block; padding: .35rem .2rem; }
.site-foot .sep { margin: 0 .35rem; opacity: .6; }
.foot-legal { border-top: 1px solid var(--border-soft); margin-top: .6rem; padding-top: .7rem; }
.foot-legal p { font-size: .78rem; margin-bottom: .2rem; }

/* faixa institucional fina sob o header (referência gov.br) */
.site-tagline {
  font-size: .74rem; color: var(--ink-faint); text-align: center;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: .55rem; margin: -.3rem 0 .2rem;
}

/* sinal de segurança no ponto de envio (afirmações verdadeiras, sem selo fake) */
.secure-line {
  display: flex; gap: .45rem; align-items: center; justify-content: center;
  font-size: .78rem; color: var(--ink-faint); margin-top: .6rem; text-align: center;
}
.secure-line svg { flex: none; }

/* ---------- tipografia ---------- */
h1 { font-size: 1.42rem; font-weight: 700; letter-spacing: -.015em; margin-bottom: .35rem; }
h2 { font-size: 1.12rem; font-weight: 700; margin: 1.25rem 0 .4rem; }
p, li { margin-bottom: .8rem; font-size: .95rem; }
li { margin-bottom: .45rem; }
ul, ol { padding-left: 1.2rem; margin-bottom: .8rem; }
.sub { color: var(--ink-soft); }
.fine { font-size: .84rem; color: var(--ink-faint); margin-top: 1.15rem; }
.fine a, p a, li a { color: var(--link); text-underline-offset: 2px; }
.fine a { display: inline-block; padding: .35rem .1rem; margin: -.25rem 0; } /* alvo de toque */
strong { font-weight: 700; }

/* ---------- estados / avisos ---------- */
.notice {
  display: flex; gap: .6rem; align-items: flex-start;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-s); padding: .8rem .9rem;
  font-size: .89rem; margin-bottom: 1rem; color: var(--ink-soft);
}
.notice .ni { flex: none; margin-top: .1rem; }
.notice-ok { border-color: var(--ok); color: var(--ink); }
.notice-ok .ni { color: var(--ok); }
.notice-warn { border-color: var(--warn-border); background: var(--warn-bg); color: var(--warn-ink); }
.notice b, .notice strong { color: var(--ink); }
.notice-warn b, .notice-warn strong { color: var(--warn-ink); }

.erro-box {
  background: var(--err-bg); border: 1px solid var(--err-border);
  border-radius: var(--radius-s); padding: .75rem .9rem;
  color: var(--err-ink); font-size: .9rem; margin-bottom: .9rem;
}

.badge-ok {
  display: inline-flex; align-items: center; gap: .5rem;
  color: var(--ok); font-weight: 700; font-size: 1.02rem; margin-bottom: .6rem;
}

/* ---------- botões ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  text-align: center; text-decoration: none;
  background: var(--brand); color: var(--brand-ink);
  font: inherit; font-weight: 700; font-size: .98rem;
  padding: .85rem 1rem; border-radius: var(--radius-s); border: 0;
  width: 100%; cursor: pointer; margin-top: .6rem;
  transition: background .15s ease, transform .05s ease;
}
.btn:hover { background: var(--brand-strong); }
.btn:active { transform: translateY(1px); }
.btn[disabled] {
  background: var(--surface-2); color: var(--ink-faint);
  border: 1px solid var(--border); cursor: not-allowed;
}
.btn-sec {
  background: transparent; color: var(--ink);
  border: 1px solid var(--border-input); font-weight: 700;
}
.btn-sec:hover { background: var(--surface-2); border-color: var(--ink-faint); }
.btn-google { background: #fff; color: #1a1a1a; border: 1px solid var(--border); }
.btn-google:hover { background: #eef2f1; }
.btn-danger { background: #b3564f; color: #fff; }
.btn-danger:hover { background: #9d453d; }
.page-wide .btn { max-width: 27rem; margin-left: auto; margin-right: auto; }

.linklike {
  background: none; border: 0; cursor: pointer;
  color: var(--ink-faint); font: inherit; font-size: .85rem; text-decoration: underline;
  text-underline-offset: 2px;
  /* área de toque ≥44px sem inflar o layout */
  display: inline-flex; align-items: center; min-height: 44px;
  padding: .5rem .4rem; margin: -.5rem -.4rem;
}
.acoes-conta { display: flex; gap: 1.4rem; margin-top: .8rem; flex-wrap: wrap; }

/* ---------- formulários ---------- */
label { display: block; margin: .85rem 0; font-size: .9rem; color: var(--ink-soft); }
input, select, textarea {
  display: block; width: 100%; margin-top: .35rem;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--border-input); border-radius: var(--radius-s);
  padding: .72rem .8rem; font: inherit; font-size: 1rem;
}
textarea { resize: vertical; min-height: 7rem; }
input::placeholder, textarea::placeholder { color: var(--ink-faint); opacity: 1; }
input[type="file"] { padding: .7rem .6rem; font-size: .9rem; }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 700; font-size: .9rem;
  color: var(--ink); background: transparent;
  border: 1px solid var(--border-input); border-radius: 8px;
  padding: .6rem 1rem; margin-right: .7rem; cursor: pointer;
}

/* campo de foto aprimorado (ui.js): rótulos pt-BR + tirar-foto-agora;
   o input nativo some mas segue no DOM (form/validação intactos) */
.file-field { margin-top: .35rem; }
.file-field .file-real {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; margin: 0; padding: 0; border: 0;
}
.file-field .file-cam { display: none; }
.file-btns { display: flex; gap: .5rem; }
.file-btns .file-btn { margin-top: 0; font-size: .9rem; padding: .65rem .5rem; }
.file-name { display: block; font-size: .8rem; color: var(--ink-faint); margin-top: .4rem; }
.file-ok .file-name { color: var(--ok); font-weight: 700; }

.consent-box {
  background: var(--surface-2); border: 1px solid #b9d6cf;
  border-radius: var(--radius-s); padding: 1rem; margin: .9rem 0;
}
.consent-box h2 { margin-top: 0; }
.consent-check { display: flex; gap: .55rem; align-items: flex-start; color: var(--ink); margin: .4rem 0 0; }
.consent-check input { width: 1.35rem; height: 1.35rem; margin-top: .1rem; accent-color: var(--brand); flex: none; }

/* ---------- câmera ---------- */
.cam-wrap { position: relative; border-radius: 12px; overflow: hidden; background: #000; margin-top: .4rem; }
.cam-wrap video { width: 100%; max-height: 48vh; object-fit: cover; display: block; transform: scaleX(-1); }
/* oval sempre em pé (proporção de rosto), centrado — independe do aspect do stream */
.oval-guide {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  height: 82%; aspect-ratio: 3 / 4; max-width: 78%;
  pointer-events: none;
  border: 3px dashed rgba(255, 255, 255, .75); border-radius: 50%; /* sobre vídeo escuro */
}
.cam-hint { font-size: 1rem; font-weight: 600; }
/* reforço simbólico de privacidade: a selfie dissolve após a captura */
.cam-wrap video.cam-dissolve { filter: blur(18px); opacity: .12; transition: filter .7s ease, opacity .7s ease; }
.step-chip {
  display: inline-block; font-size: .85rem; font-weight: 700;
  color: var(--brand); background: rgba(14, 122, 104, .08);
  border: 1px solid rgba(14, 122, 104, .35);
  border-radius: 999px; padding: .18rem .65rem; margin-bottom: .5rem;
}

/* status de processamento / resultado */
.status-wrap { text-align: center; padding: .8rem 0 .4rem; }
.status-wrap h1, .status-wrap h2 { font-size: 1.25rem; margin: .7rem 0 .3rem; }
.status-wrap p { color: var(--ink-soft); font-size: .9rem; }
.status-warn .status-icon { color: var(--warn-ink); }
.status-calm .status-icon { color: var(--ink-soft); }
.spinner {
  width: 42px; height: 42px; margin: .4rem auto; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--brand);
  animation: spin .9s linear infinite;
}
/* spinner pequeno dentro de botão (esperas de form) */
.btn-spinner {
  display: inline-block; width: 1em; height: 1em; margin-right: .5rem;
  border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: currentColor; vertical-align: -.15em;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.status-icon { font-size: 2rem; line-height: 1; }

/* overlay de "Verificando…" (fluxo do documento — percepção de trabalho) */
.verif-overlay { position: fixed; inset: 0; z-index: 50; display: flex;
  align-items: center; justify-content: center; padding: 1.5rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(3px); }
.verif-box { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.8rem 2rem; text-align: center;
  max-width: 22rem; box-shadow: 0 18px 50px -28px rgba(0,0,0,.4); }
.verif-box h2 { margin: .6rem 0 .3rem; }
.verif-passo { color: var(--ink-soft); font-size: .92rem; min-height: 1.4em; }
.status-ok .status-icon { color: var(--ok); }
.status-err .status-icon { color: var(--err-ink); }

/* ---------- QR / código ---------- */
.qr-box { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .8rem; display: flex; justify-content: center; margin-bottom: .8rem; }
.qr-box svg { width: 240px; height: 240px; }
.url-box {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-s); padding: .8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .82rem; word-break: break-all; color: var(--ink-soft);
}

/* ---------- landing ---------- */
.hero { text-align: center; padding: 1.4rem 0 .6rem; }
.hero .mark-lg { width: 64px; height: 64px; margin: 0 auto .9rem; }
.hero h1 { font-size: 1.7rem; }
.hero .tagline { color: var(--ink-soft); font-size: 1rem; max-width: 30rem; margin: .3rem auto .9rem; }
.trust-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin: 1rem 0; list-style: none; padding: 0; }
.trust-item {
  list-style: none;
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: var(--radius-s); padding: .85rem .9rem; font-size: .84rem; color: var(--ink-soft);
}
.trust-item b { display: flex; align-items: center; gap: .45rem; color: var(--ink); font-size: .88rem; margin-bottom: .25rem; }
.trust-item svg { flex: none; color: var(--brand); }

/* FAQ */
details {
  border: 1px solid var(--border-soft); border-radius: var(--radius-s);
  margin-bottom: .55rem; background: var(--surface-2);
}
details summary {
  cursor: pointer; font-weight: 700; font-size: .92rem;
  list-style: none; display: flex; align-items: center; gap: .6rem;
  padding: .8rem .9rem; min-height: 44px;
}
details summary::-webkit-details-marker { display: none; }
details summary::before {
  content: ''; flex: none; width: .55rem; height: .55rem;
  border-right: 2px solid var(--brand); border-bottom: 2px solid var(--brand);
  transform: rotate(-45deg); transition: transform .15s ease;
}
details[open] summary::before { transform: rotate(45deg); }
details[open] summary { color: var(--brand); }
details > *:not(summary) { padding: 0 .9rem; }
details p { font-size: .88rem; color: var(--ink-soft); margin-bottom: .75rem; }

/* passos numerados (como funciona) */
.steps { list-style: none; padding: 0; counter-reset: passo; }
.steps li {
  counter-increment: passo; display: flex; gap: .8rem; align-items: flex-start;
  margin-bottom: .9rem; font-size: .92rem;
}
.steps li::before {
  content: counter(passo);
  flex: none; width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: rgba(76, 201, 176, .12); color: var(--brand);
  border: 1px solid rgba(76, 201, 176, .4);
  font-weight: 800; font-size: .85rem;
  display: flex; align-items: center; justify-content: center; margin-top: .05rem;
}

/* ---------- painel do dono ---------- */
.knob-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; margin: 1rem 0; }
.knob { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-s); padding: .8rem .9rem; }
.knob label { margin: 0 0 .3rem; color: var(--ink); }
.knob-key { display: block; font-size: .74rem; color: var(--ink-faint); font-family: ui-monospace, Consolas, monospace; }
.knob-nota { font-size: .78rem; color: var(--ink-faint); margin: .4rem 0 0; }
.stats-wrap { overflow-x: auto; }
table.stats { border-collapse: collapse; font-size: .85rem; }
table.stats th, table.stats td { border: 1px solid var(--border-soft); padding: .35rem .7rem; text-align: left; }
@media (max-width: 700px) { .knob-grid { grid-template-columns: 1fr; } }

/* ---------- acessibilidade ---------- */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip-link {
  position: absolute; left: -999px; top: .5rem;
  background: var(--brand); color: var(--brand-ink);
  padding: .5rem .9rem; border-radius: 8px; font-weight: 700; z-index: 10;
}
.skip-link:focus { left: .5rem; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- responsivo ---------- */
@media (max-width: 430px) {
  body { padding: .6rem .6rem 1.4rem; }
  main.card { padding: 1.25rem 1.05rem; }
  /* passo de captura: câmera + guia + botão backup SEM rolar (papercut do teste:
     o botão ficava abaixo da dobra e o usuário esperava a foto sair sozinha) */
  #captureStep .cam-wrap video { max-height: 42vh; }
  #captureStep #camHint { font-size: .92rem; margin: .35rem 0; }
  #captureStep .btn { margin-top: .35rem; }
  #captureStep .step-chip { margin-bottom: .3rem; }
  .trust-grid { grid-template-columns: 1fr; }
  .trust-item { padding: .7rem .8rem; font-size: .82rem; }
  .hero { padding: .9rem 0 .4rem; }
  .hero h1 { font-size: 1.45rem; }
  .session-chip { max-width: 50%; }
}


/* MODO LUZ (dono 17/10): na captura, a tela inteira BRANCA ilumina o rosto (ideia do app do Mercado Pago). O vídeo
   fica num oval no meio; só título pequeno em cima, dica e botão embaixo. html.luz-on é ligado/desligado pelo camera.js. */
html.luz-on, html.luz-on body { background: #fff !important; }
html.luz-on #captureStep { position: fixed; inset: 0; z-index: 9999; background: #fff; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .55rem; padding: max(14px, env(safe-area-inset-top)) 18px
  max(14px, env(safe-area-inset-bottom)); overflow-y: auto; text-align: center; color: #1d2b28; }
html.luz-on #captureStep[hidden] { display: none; }
html.luz-on #captureStep .step-chip { margin: 0; }
html.luz-on #captureStep .cam-wrap { width: min(74vw, 44vh, 360px); aspect-ratio: 3 / 4; border-radius: 50%; margin: .2rem 0;
  background: #fff; box-shadow: 0 0 0 4px rgba(14, 122, 104, .55); }
html.luz-on #captureStep .cam-wrap video { width: 100%; height: 100%; max-height: none; object-fit: cover; }
html.luz-on #captureStep .oval-guide { display: none; }
html.luz-on #captureStep #camHint { font-size: 1rem; margin: .2rem 0 0; max-width: 34ch; }
html.luz-on #captureStep .btn { margin-top: .2rem; min-width: 12rem; }
html.luz-on #captureStep .fine { font-size: .74rem; color: #6b7f7a; max-width: 40ch; margin: 0; }
.verif-conta { margin: .5rem 0 0; font-size: .8rem; color: var(--muted, #6b7f7a); }
