/* Identidade / Documento — wizard mobile limpo, botões uniformes */

.page-id {
  --id-pad: 16px;
  --id-radius: 16px;
  --id-btn-h: 52px;
  --id-purple: #342f8b;
  --id-green: #1db24e;
  background: #eef0f7;
  min-height: 100dvh;
  overflow-x: hidden;
  color: #1a1c2e;
}

.page-id .id-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(238, 240, 247, .94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(52, 47, 139, .07);
}

.page-id .id-header .container {
  max-width: 440px;
  margin: 0 auto;
  padding: 10px var(--id-pad);
  display: flex;
  align-items: center;
}

.page-id .id-header .brand img {
  height: 26px;
  width: auto;
  display: block;
}

.page-id .id-main {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 14px var(--id-pad) calc(18px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
}

.page-id .id-top {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.page-id .id-title {
  margin: 0;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--id-purple);
}

.page-id .id-progress {
  padding: 12px 14px;
  border-radius: var(--id-radius);
  background: #fff;
  border: 1px solid rgba(52, 47, 139, .08);
}

.page-id .id-progress .progress {
  height: 4px;
  margin-bottom: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e6e9f4;
}

.page-id .id-progress .progress > div {
  background: var(--id-green);
}

.page-id .steps-pills {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0;
}

.page-id .pill {
  text-align: center;
  padding: 8px 2px;
  border-radius: 10px;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: #8b93a7;
  background: #f4f6fb;
  border: 1px solid transparent;
  line-height: 1.2;
}

.page-id .pill.on {
  background: rgba(52, 47, 139, .1);
  color: var(--id-purple);
  border-color: rgba(52, 47, 139, .14);
}

.page-id .pill.ok {
  background: #e8f9ee;
  color: #0f8f3d;
}

.page-id .id-shell {
  margin: 0;
  border: none;
  box-shadow: none;
  background: transparent;
  overflow: visible;
  border-radius: 0;
}

.page-id .id-body {
  padding: 0;
  min-height: 0;
}

/* Uma etapa por vez */
.page-id #p1,
.page-id #p2,
.page-id #p3,
.page-id #p4,
.page-id .step-panel,
.page-id .id-body > section {
  display: none !important;
  flex-direction: column;
  gap: 12px;
  padding: 18px 16px 16px;
  border-radius: var(--id-radius);
  background: #fff;
  border: 1px solid rgba(52, 47, 139, .08);
  box-shadow: 0 8px 24px rgba(20, 16, 84, .06);
  box-sizing: border-box;
}

.page-id #p1.on,
.page-id #p2.on,
.page-id #p3.on,
.page-id #p4.on,
.page-id .step-panel.on,
.page-id .id-body > section.on {
  display: flex !important;
}

.page-id .checklist,
.checklist[hidden] {
  display: none !important;
}

.page-id .id-step-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: #1a1c2e;
  line-height: 1.25;
}

.page-id .id-tip {
  margin: -4px 0 0;
  font-size: .84rem;
  line-height: 1.4;
  color: #6b7388;
}

.page-id .field {
  margin: 0;
}

.page-id .field label {
  font-size: .78rem;
  font-weight: 800;
  color: var(--id-purple);
  margin-bottom: 6px;
}

.page-id .input {
  height: 52px;
  border-radius: 14px;
  font-size: 1.05rem;
  letter-spacing: .02em;
}

/* Preview da foto */
.page-id .capture {
  flex: 0 0 auto;
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 4 / 3;
  max-height: none;
  border-radius: 14px;
  border: 1.5px solid rgba(52, 47, 139, .14);
  background: #f3f5fb;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.page-id .capture.capture-selfie {
  aspect-ratio: 3 / 4;
  max-width: 200px;
  width: 100%;
  margin: 0 auto;
}

.page-id .capture.done {
  border-color: rgba(29, 178, 78, .45);
}

.page-id .capture .capture-ph {
  position: absolute;
  inset: 0;
  height: auto;
  padding: 12px;
  gap: 8px;
  box-sizing: border-box;
}

.page-id .capture .capture-exemplo {
  width: auto !important;
  height: auto !important;
  max-width: 92%;
  max-height: calc(100% - 34px);
  flex: 0 1 auto;
  object-fit: contain !important;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(20, 16, 84, .08);
}

.page-id .capture > img:not(.capture-exemplo) {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.page-id .capture > img[hidden],
.page-id .capture > img:not([src]),
.page-id .capture > img[src=""] {
  display: none !important;
}

.page-id .capture-ph-lbl {
  font-size: .8rem;
  flex-shrink: 0;
}

.page-id .capture-ph strong {
  font-size: .86rem;
  color: var(--id-purple);
}

/* Ações — sempre mesma altura / largura total */
.page-id .id-actions,
.page-id .capture-actions {
  margin: 4px 0 0;
  padding: 0;
  position: static;
  background: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.page-id .capture-pick,
.page-id .capture-review {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.page-id .capture-pick[hidden],
.page-id .capture-review[hidden] {
  display: none !important;
}

.page-id .btn,
.page-id label.btn {
  width: 100%;
  min-height: var(--id-btn-h);
  height: var(--id-btn-h);
  padding: 0 18px;
  border-radius: 14px;
  font-size: .95rem;
  font-weight: 800;
  line-height: 1;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  margin: 0;
  cursor: pointer;
}

.page-id .btn-green {
  background: var(--id-green);
  color: #fff;
  border: 2px solid var(--id-green);
  box-shadow: none;
}

.page-id .btn-green:hover {
  background: #189a43;
  border-color: #189a43;
  box-shadow: none;
}

.page-id .btn-outline {
  background: #fff;
  color: var(--id-purple);
  border: 2px solid rgba(52, 47, 139, .22);
  box-shadow: none;
}

.page-id .btn-outline:hover {
  background: #f5f6fc;
}

.page-id .capture-review .btn-green {
  grid-column: auto;
}

.page-id .capture-review .btn-green::before {
  display: none;
}

.page-id .hint:empty {
  display: none;
  min-height: 0;
  margin: 0;
}

.page-id .hint:not(:empty) {
  margin: 0;
  min-height: 0;
  font-size: .8rem;
}

.page-id .success-view {
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 40px 16px;
  border-radius: var(--id-radius);
  background: #fff;
  border: 1px solid rgba(52, 47, 139, .08);
}

.page-id .success-view.on {
  display: flex;
}

.page-id .autosave { display: none !important; }

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

/* Capture shared (camera overlay + busy states) */
.capture {
  border-radius: 18px;
  border: 2px dashed rgba(52, 47, 139, .2);
  aspect-ratio: 4/3;
  background: #f0f3fa;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.capture.busy { pointer-events: none }
.capture.busy::before {
  content: "";
  position: absolute; inset: 0; z-index: 5;
  background: rgba(16, 18, 32, .58);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.capture.busy::after {
  content: attr(data-loading);
  position: absolute; left: 50%; top: 50%; z-index: 6;
  transform: translate(-50%, -50%);
  min-width: 160px; max-width: calc(100% - 32px);
  padding: 42px 16px 14px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 18px, transparent 0 10px, rgba(255,255,255,.18) 11px 13px, transparent 14px),
    rgba(255,255,255,.94);
  color: var(--purple);
  font-size: .86rem; font-weight: 900; text-align: center;
  box-shadow: 0 12px 36px rgba(0,0,0,.18);
}
.capture.busy .capture-ph,
.capture.busy > img { filter: blur(1px); transform: scale(1.01) }
.capture.done { border-style: solid; border-color: rgba(29,178,78,.4) }
.capture img { width: 100%; height: 100%; object-fit: cover }
.capture.capture-selfie { aspect-ratio: 1 / 1; max-height: 340px; margin: 0 auto }
.capture-ph {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 10px 12px 12px; text-align: center; color: var(--muted); font-size: .88rem; gap: 6px;
}
.capture-exemplo {
  width: 100%; max-height: calc(100% - 36px); flex: 1 1 auto;
  object-fit: contain; border-radius: 10px;
  box-shadow: 0 4px 16px rgba(20,16,84,.08);
}
.capture-ph-lbl { font-size: .78rem; line-height: 1.35 }
.capture-ph strong { display: block; color: var(--purple); margin-bottom: 2px; font-size: .84rem }
.capture-ok {
  position: absolute; top: 10px; right: 10px;
  padding: 5px 10px 5px 28px; border-radius: 999px;
  color: #fff; font-size: .72rem; font-weight: 800; display: none;
  background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") 8px center / 14px no-repeat;
}
.capture.done .capture-ok { display: block }

.tip {
  display: flex; gap: 10px; padding: 12px 14px; margin: 14px 0;
  border-radius: 14px; background: rgba(52,47,139,.05);
  border: 1px solid rgba(52,47,139,.08);
  font-size: .86rem; color: var(--muted); line-height: 1.5;
}
.tip b { display: block; color: var(--purple); margin-bottom: 2px }

.capture-actions { margin-top: 12px }
.capture-pick,
.capture-review {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.capture-review .btn-green { grid-column: 1 / -1 }
.capture-pick[hidden],
.capture-review[hidden] { display: none !important }
.capture-pick label.btn {
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; margin: 0;
}
.btn.is-disabled,
.capture-pick label.btn.is-disabled {
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}
.capture-pick .btn[disabled],
.capture-review .btn[disabled] { opacity: .55 }
.capture-review .btn-green::before {
  content: "";
  display: inline-block;
  width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center/contain no-repeat;
}

.checklist { display: none }
.check-item { display: flex; gap: 10px; align-items: center; font-size: .86rem; color: var(--muted) }
.check-item.done { color: var(--green); font-weight: 700 }
.check-dot {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--line); display: grid; place-items: center;
  font-size: .7rem; font-weight: 900; flex-shrink: 0;
}
.check-item.done .check-dot {
  background: var(--green); border-color: var(--green); color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 12px;
  font-size: 0;
}

.steps-pills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 0 }
.pill {
  text-align: center; padding: 7px 4px; border-radius: 10px;
  font-size: .7rem; font-weight: 800; color: var(--muted);
  background: rgba(52,47,139,.05); border: 1px solid var(--line);
}
.pill.on { background: rgba(248,195,44,.2); color: #6a5000 }
.pill.ok { background: #dafbe5; color: var(--green) }

.autosave { display: none !important }

/* Camera overlay */
.cam {
  position: fixed; inset: 0; z-index: 200;
  background: #000; display: none; flex-direction: column;
}
.cam.open { display: flex }
.cam-top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; color: #fff; z-index: 2;
  background: linear-gradient(180deg, rgba(0,0,0,.7), transparent);
  position: absolute; top: 0; left: 0; right: 0;
}
.cam-top h3 { margin: 0; font-size: .95rem }
.cam-close {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(255,255,255,.15); color: #fff; font-size: 1.1rem;
}
.cam-view { flex: 1; position: relative; overflow: hidden }
.cam-view video { width: 100%; height: 100%; object-fit: cover }
.cam-view.selfie video { transform: scaleX(-1) }
.cam-guide {
  position: absolute; inset: 0; pointer-events: none;
  display: grid; place-items: center;
}
.guide-doc,
.guide-selfie { display: none }
.cam-view.doc .guide-doc { display: block }
.cam-view.selfie .guide-selfie { display: flex }
.guide-doc {
  width: min(94%, 640px);
  max-height: min(58vh, 420px);
  aspect-ratio: 1.586;
  border: 3px solid var(--gold); border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.5);
}
@media (orientation: landscape) {
  .guide-doc {
    width: min(72vw, 560px);
    max-height: min(68vh, 360px);
  }
  .cam-view.doc .g-label { bottom: 14% }
}
.cam-rotate-hint {
  display: none;
  position: absolute;
  z-index: 3;
  top: 56px; left: 50%; transform: translateX(-50%);
  width: min(88vw, 280px);
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(0,0,0,.72);
  color: #fff;
  text-align: center;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}
.cam-rotate-hint strong { font-size: .95rem }
.cam-rotate-hint span { font-size: .78rem; opacity: .88; line-height: 1.3 }
.cam-rotate-ico {
  font-size: 1.35rem;
  line-height: 1;
  margin-bottom: 2px;
  animation: cam-rotate-pulse 1.4s ease-in-out infinite;
}
@keyframes cam-rotate-pulse {
  0%, 100% { transform: rotate(-18deg) }
  50% { transform: rotate(18deg) }
}
@media (orientation: portrait) {
  .cam-view.doc .cam-rotate-hint { display: flex }
}
.guide-selfie {
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 3.5vw, 18px);
  width: min(92vw, 400px);
  padding: 6px 4px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.48);
  border-radius: 14px;
}
.g-face {
  order: 2;
  width: 58%;
  max-width: 220px;
  aspect-ratio: 3 / 4;
  border: 3px solid var(--gold);
  border-radius: 50%;
  flex-shrink: 0;
}
.g-doc {
  order: 1;
  width: 34%;
  max-width: 118px;
  aspect-ratio: 3 / 4.15;
  border: 3px solid rgba(255,255,255,.9);
  border-radius: 10px;
  flex-shrink: 0;
}
.g-label { display: none }
.cam-view.selfie .g-label,
.cam-view.doc .g-label { display: block }
.cam-view.selfie .g-label { bottom: 22% }
.cam-view.doc .g-label { bottom: max(12%, calc(50% - 38vw)) }
.g-label {
  position: absolute; left: 50%; transform: translateX(-50%);
  padding: 7px 12px; border-radius: 999px;
  background: rgba(0,0,0,.55); color: #fff;
  font-size: .78rem; font-weight: 700; white-space: nowrap;
}
.cam-foot {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 2;
  padding: 16px 20px calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: linear-gradient(0deg, rgba(0,0,0,.85), transparent);
}
.cam-foot p { margin: 0; color: rgba(255,255,255,.8); font-size: .82rem }
.shutter {
  width: 68px; height: 68px; border-radius: 50%;
  border: 4px solid #fff; position: relative; padding: 0;
}
.shutter.is-disabled,
.shutter:disabled { opacity: .65; pointer-events: none }
.shutter::after {
  content: ""; position: absolute; inset: 6px;
  border-radius: 50%; background: #fff; transition: transform .12s;
}
.shutter:active::after { transform: scale(.88); background: var(--gold) }
.flash {
  position: fixed; inset: 0; background: #fff; opacity: 0;
  pointer-events: none; z-index: 300; transition: opacity .07s;
}
.flash.on { opacity: .8 }

@media (max-height: 700px) {
  .page-id .id-main { padding-top: 10px; gap: 10px }
  .page-id .id-title { font-size: 1.08rem }
  .page-id .id-progress { padding: 10px 12px }
  .page-id #p1.on,
  .page-id #p2.on,
  .page-id #p3.on,
  .page-id #p4.on { padding: 14px 14px 12px; gap: 10px }
  .page-id .capture { aspect-ratio: 4 / 3 }
  .page-id .capture.capture-selfie { max-width: 170px }
  .page-id .btn,
  .page-id label.btn { --id-btn-h: 48px; min-height: 48px; height: 48px; font-size: .9rem }
}
