/* o atributo hidden sempre vence regras de display (ex.: .panel { display: grid }) */
[hidden] { display: none !important; }
:root {
  --bg: #f3f5f9; --card: #ffffff; --text: #141c29; --muted: #5d6b7e; --line: #e0e6ee; --soft: #f0f3f8;
  --accent: #1d4ed8; --accent-ink: #ffffff; --accent-soft: #e6edfc;
  --ok: #157347; --ok-soft: #e3f4ea; --warn: #9a5b00; --warn-soft: #fdf1dc; --bad: #b42318; --bad-soft: #fde8e6;
  --radius: 16px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 8px 24px rgba(16,24,40,.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1118; --card: #141b26; --text: #e6ebf2; --muted: #93a1b4; --line: #253141; --soft: #1a2330;
    --accent: #5b8def; --accent-ink: #0b1220; --accent-soft: #1b2a45;
    --ok: #4cc38a; --ok-soft: #12291f; --warn: #f0b354; --warn-soft: #2d2213; --bad: #f07a6e; --bad-soft: #2e1714;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100vh; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom); }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 1.25rem; margin: 0 0 4px; }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 10px; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .ok-text { color: #22c55e; }

.top { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; max-width: 640px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: .78rem; }
.pill { font-size: .75rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); }

.shell { max-width: 640px; margin: 0 auto; padding: 0 16px 24px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; display: grid; gap: 16px; animation: enter .25s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .panel { animation: none; } }

/* etapas */
.stepper { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0; margin: 4px 0 14px; }
.stepper li { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); position: relative; }
.stepper li span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem;
  background: var(--card); border: 2px solid var(--line); color: var(--muted); z-index: 1; transition: all .2s; }
.stepper li::after { content: ""; position: absolute; top: 15px; left: calc(50% + 18px); right: calc(-50% + 18px); height: 2px; background: var(--line); }
.stepper li:last-child::after { display: none; }
.stepper li.active { color: var(--text); font-weight: 600; }
.stepper li.active span { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.stepper li.done span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stepper li.done::after { background: var(--accent); }

/* intro */
.intro p { margin: 0; color: var(--muted); }
.features { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; font-size: .82rem; }
.features li { background: var(--soft); border-radius: 10px; padding: 10px; color: var(--muted); }
.features b { display: block; color: var(--text); }
@media (max-width: 480px) { .features { grid-template-columns: 1fr; } }

/* formulário */
.form { display: grid; gap: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .row { grid-template-columns: 1fr; } }
.field { display: grid; gap: 5px; font-size: .85rem; color: var(--muted); font-weight: 500; }
input, select { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; width: 100%; }
input:focus-visible, .btn:focus-visible, .segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
input.invalid { border-color: var(--bad); }
.hint-inline { min-height: 1em; font-size: .78rem; }
.hint-inline.ok { color: var(--ok); } .hint-inline.bad { color: var(--bad); }
.segmented { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.segmented legend { font-size: .85rem; color: var(--muted); font-weight: 500; margin-bottom: 5px; padding: 0; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span { display: block; text-align: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; font-weight: 600; transition: all .15s; }
.segmented input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.consent { display: grid; grid-template-columns: auto 1fr; gap: 10px; font-size: .82rem; color: var(--muted); align-items: start; }
.consent input { width: 18px; height: 18px; margin-top: 2px; }

.btn { font: inherit; font-weight: 600; padding: 11px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card);
  color: var(--text); cursor: pointer; display: inline-flex; justify-content: center; align-items: center; gap: 6px; text-decoration: none; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.big { padding: 15px; font-size: 1.05rem; width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row-actions { display: flex; gap: 10px; justify-content: space-between; }
.row-actions .btn.primary { flex: 1; }

/* documento */
.doc-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .doc-slots { grid-template-columns: 1fr; } }
.slot { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.slot.filled { border-color: var(--accent); }
.slot-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.slot-preview { aspect-ratio: 1.585; border-radius: 8px; background: var(--soft); display: grid; place-items: center; overflow: hidden; }
.slot-preview img { width: 100%; height: 100%; object-fit: cover; }
.slot-empty { color: var(--muted); font-size: .85rem; }
.slot-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.slot-actions .btn { padding: 9px 8px; font-size: .88rem; }
.doc-camera { display: grid; gap: 10px; }
.doc-frame-wrap { position: relative; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.doc-frame-wrap video { width: 100%; height: 100%; object-fit: cover; }
.doc-frame { position: absolute; left: 8%; right: 8%; top: 50%; transform: translateY(-50%); aspect-ratio: 1.585;
  box-shadow: 0 0 0 999px rgba(0,0,0,.45); border-radius: 12px; }
.doc-frame i { position: absolute; width: 28px; height: 28px; border: 4px solid #fff; }
.doc-frame i:nth-child(1) { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 12px; }
.doc-frame i:nth-child(2) { top: -2px; right: -2px; border-left: 0; border-bottom: 0; border-top-right-radius: 12px; }
.doc-frame i:nth-child(3) { bottom: -2px; left: -2px; border-right: 0; border-top: 0; border-bottom-left-radius: 12px; }
.doc-frame i:nth-child(4) { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 12px; }
.doc-tip { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px; color: #fff; text-align: center; font-weight: 600;
  background: linear-gradient(transparent, rgba(0,0,0,.7)); }

/* checklist */
.checklist, .checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checklist { padding: 12px; border-radius: 12px; background: var(--soft); }
.checks li, .checklist li { display: flex; align-items: center; gap: 10px; font-size: .92rem; }
.ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: .75rem; font-weight: 800; color: #fff; }
.ic.ok { background: #22c55e; } .ic.bad { background: #ef4444; } .ic.na { background: #94a3b8; } .ic.warn { background: #f5b301; }

/* câmera da selfie */
.camera { position: relative; aspect-ratio: 3 / 4; background: #000; border-radius: 18px; overflow: hidden; max-width: 420px; width: 100%; margin: 0 auto; }
.camera video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.camera .oval { position: absolute; inset: 12% 18%; border: 3px solid rgba(255,255,255,.85); border-radius: 50%; box-shadow: 0 0 0 999px rgba(0,0,0,.4); }
.camera .instruction { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; color: #fff; font-weight: 600;
  background: linear-gradient(transparent, rgba(0,0,0,.75)); }
.tips { margin: 0; padding-left: 20px; color: var(--muted); font-size: .88rem; display: grid; gap: 4px; }

/* resultado */
.verdict { display: flex; gap: 16px; align-items: center; padding: 16px; border-radius: 14px; }
.verdict.APPROVED { background: var(--ok-soft); } .verdict.REJECTED { background: var(--bad-soft); } .verdict.MANUAL_REVIEW { background: var(--warn-soft); }
.verdict h2 { margin: 0; }
.verdict p { margin: 2px 0 0; font-size: .85rem; }
.verdict-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; flex: none; animation: pop .3s ease-out; }
.verdict-icon svg { width: 32px; height: 32px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.verdict.APPROVED .verdict-icon { background: #22c55e; } .verdict.REJECTED .verdict-icon { background: #ef4444; }
.verdict.MANUAL_REVIEW .verdict-icon { background: #f5b301; }
@keyframes pop { from { transform: scale(.5); opacity: 0; } to { transform: none; opacity: 1; } }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.result-grid .box { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.result-grid .wide { grid-column: 1 / -1; }
@media (max-width: 520px) { .result-grid { grid-template-columns: 1fr; } }
.meter { position: relative; height: 10px; border-radius: 99px; background: var(--soft); margin: 10px 0 6px; }
.meter .fill { position: absolute; inset: 0 auto 0 0; border-radius: 99px; transition: width .6s ease-out; width: 0; }
.meter .mark { position: absolute; top: -5px; width: 2px; height: 20px; background: var(--text); }
.meter-legend { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); }
.big-num { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.reasons { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: .92rem; }

.message { min-height: 1.4em; margin: 12px 4px 0; color: var(--muted); font-size: .9rem; text-align: center; }
.message.error { color: var(--bad); }
.foot { display: flex; justify-content: center; gap: 8px; padding: 8px 16px 24px; font-size: .85rem; color: var(--muted); }
.foot a { color: var(--muted); }
/* ajustes de alinhamento */
.panel p, .panel h2 { margin: 0; }
.panel > h2 + p { margin-top: -10px; }
.slot-head { flex-direction: column; align-items: flex-start; gap: 0; min-height: 2.6em; }
