:root {
  --blue: #004e9c;
  --blue-dark: #003875;
  --red: #e30613;
  --red-dark: #c10510;
  --bg: #eef2f7;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #5b6775;
  --line: #d5dde6;
  --ok: #0f8a5f;
  --shadow: 0 8px 28px rgba(0, 55, 120, 0.08);
  --font: "Inter", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.45;
  padding-bottom: var(--safe-b);
}

a { color: var(--blue); }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font-family: inherit; }

.wrap {
  width: min(560px, calc(100% - 24px));
  margin: 0 auto;
}

.site-header {
  background: #fff;
  border-bottom: 3px solid var(--blue);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 96px;
  padding: 10px 0;
}
.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.brand-logo {
  height: 72px;
  width: auto;
  max-width: min(380px, 78vw);
  object-fit: contain;
}
.header-link {
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: var(--muted);
}

.page { padding: 20px 0 40px; }
.intro { margin-bottom: 16px; }
.intro h1 {
  margin: 0 0 8px;
  font-size: clamp(22px, 6vw, 30px);
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.intro p, .hint {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}
.is-embed { background: var(--bg); }

.form-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.steps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 14px 16px 0;
}
.steps-item {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding-bottom: 10px;
  border-bottom: 3px solid var(--line);
}
.steps-item.is-current { color: var(--blue); border-bottom-color: var(--blue); }
.steps-item.is-done { color: var(--ok); border-bottom-color: var(--ok); }

.block { padding: 18px 16px 8px; }
.block h2 { margin: 0 0 4px; font-size: 18px; }
.block p.hint { margin: 0 0 16px; font-size: 14px; }

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: 1fr 1fr; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; }
.req::after { content: " *"; color: var(--red); }
.field input:not([type="checkbox"]):not([type="file"]),
.field select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
  outline: none;
  appearance: none;
}
.field input:focus, .field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 78, 156, 0.15);
}
.field .error, .photo-error {
  color: var(--red);
  font-size: 12px;
  font-weight: 600;
  min-height: 16px;
  margin: 8px 0 0;
}
.field.is-invalid input:not([type="checkbox"]),
.field.is-invalid select { border-color: var(--red); }

.consent-field { margin-top: 8px; }
.consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  padding: 14px;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
}
.consent input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.consent-box {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border: 2px solid var(--blue);
  border-radius: 7px;
  background: #fff;
  display: grid;
  place-items: center;
}
.consent-box::after {
  content: "";
  width: 12px;
  height: 7px;
  border: 2.5px solid #fff;
  border-top: 0;
  border-right: 0;
  transform: rotate(-45deg) translate(1px, -1px);
  opacity: 0;
}
.consent input:checked + .consent-box {
  background: var(--blue);
  border-color: var(--blue);
}
.consent input:checked + .consent-box::after { opacity: 1; }
.consent:has(input:checked) {
  border-color: var(--blue);
  background: #eef4fb;
}
.consent-text { line-height: 1.4; padding-top: 2px; }
.consent-link {
  display: inline-block;
  margin: 8px 2px 0;
  font-size: 13px;
  font-weight: 700;
}
.field.is-invalid .consent { border-color: var(--red); }

#stepDocs[hidden], #stepDados[hidden], #panelSuccess[hidden] {
  display: none !important;
}

.photos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.photo-slot {
  position: relative;
  min-height: 180px;
  border: 1.5px dashed #b9c6d6;
  border-radius: 16px;
  background: #f7f9fc;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  width: 100%;
  font: inherit;
  color: inherit;
  padding: 0;
}
.photo-empty { pointer-events: none; padding: 12px; }
.photo-empty strong { display: block; font-size: 16px; }
.photo-empty small { color: var(--muted); font-size: 12px; }
.photo-preview {
  display: none;
  width: 100%;
  height: 180px;
  object-fit: cover;
}
.photo-slot.has-photo {
  border-style: solid;
  border-color: var(--ok);
}
.photo-slot.has-photo .photo-preview { display: block; }
.photo-slot.has-photo .photo-empty { display: none; }

.camera-open { overflow: hidden; }
.camera-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: #05070b;
  display: flex;
  flex-direction: column;
}
.camera-modal[hidden] { display: none !important; }
.camera-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #000;
}
.camera-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(1);
}
.camera-mask {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.doc-frame {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  width: min(90vw, 520px);
  aspect-ratio: 1.586 / 1;
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(4, 10, 18, 0.62);
  outline: 2px solid rgba(255, 255, 255, 0.88);
}
.doc-guide {
  position: absolute;
  inset: 8%;
  width: 84%;
  height: 70%;
  opacity: 0.55;
}
.camera-modal.is-verso #guideFrente { display: none; }
.camera-modal.is-verso #guideVerso { display: block; }
#guideVerso { display: none; }
.doc-corners {
  position: absolute;
  inset: -2px;
  border-radius: 14px;
  background:
    linear-gradient(#fff, #fff) left top / 28px 3px no-repeat,
    linear-gradient(#fff, #fff) left top / 3px 28px no-repeat,
    linear-gradient(#fff, #fff) right top / 28px 3px no-repeat,
    linear-gradient(#fff, #fff) right top / 3px 28px no-repeat,
    linear-gradient(#fff, #fff) left bottom / 28px 3px no-repeat,
    linear-gradient(#fff, #fff) left bottom / 3px 28px no-repeat,
    linear-gradient(#fff, #fff) right bottom / 28px 3px no-repeat,
    linear-gradient(#fff, #fff) right bottom / 3px 28px no-repeat;
}
.doc-caption {
  position: absolute;
  left: 50%;
  bottom: -38px;
  transform: translateX(-50%);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  text-shadow: 0 1px 8px #000;
}
.camera-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}
.camera-flash.is-on { animation: flash .18s ease; }
@keyframes flash {
  from { opacity: .85; }
  to { opacity: 0; }
}
.camera-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px 16px calc(18px + var(--safe-b));
  background: #05070b;
}
.camera-bar .btn-ghost {
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,.25);
  width: auto;
  min-height: 44px;
  font-size: 14px;
}
.shutter {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 6px solid #fff;
  background: var(--red);
  box-shadow: 0 0 0 6px rgba(255,255,255,.16);
  cursor: pointer;
}
.shutter:active { transform: scale(.96); }
.camera-side {
  justify-self: end;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
}
.photo-empty { pointer-events: none; padding: 12px; }
.photo-empty strong { display: block; font-size: 16px; }
.photo-empty small { color: var(--muted); font-size: 12px; }
.photo-preview {
  display: none;
  width: 100%;
  height: 180px;
  object-fit: cover;
}
.photo-slot.has-photo {
  border-style: solid;
  border-color: var(--ok);
}
.photo-slot.has-photo .photo-preview { display: block; }
.photo-slot.has-photo .photo-empty { display: none; }

.actions {
  display: flex;
  padding: 8px 16px 20px;
}
.actions-split { justify-content: space-between; gap: 10px; }
.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  min-height: 52px;
  padding: 14px 18px;
  font-weight: 700;
  font-size: 16px;
  width: 100%;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-dark); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  width: auto;
  min-width: 110px;
  flex: 0 0 auto;
}

.success {
  text-align: center;
  padding: 40px 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.success .badge {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #e8f8f0;
  color: var(--ok);
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 800;
}
.success h2 { margin: 0 0 8px; }
.success p { color: var(--muted); }

.site-footer {
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 0 calc(16px + var(--safe-b));
}
.site-footer a { color: var(--text); font-weight: 600; text-decoration: none; }

.legal { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.legal h1 { margin-top: 0; }
.admin-table { width: 100%; border-collapse: collapse; background: #fff; }
.admin-table th, .admin-table td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.admin-table th { background: var(--blue); color: #fff; }
code { font-size: 13px; background: #eef2f7; padding: 2px 6px; border-radius: 4px; }

.wrap-wide { width: min(1100px, calc(100% - 24px)); }
.header-actions { display: flex; gap: 16px; align-items: center; }
.login-error { color: var(--red); font-weight: 700; }
.gerencia-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  flex-wrap: wrap;
}
.busca { display: flex; gap: 8px; width: min(420px, 100%); }
.busca input {
  flex: 1;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
}
.busca .btn { width: auto; min-width: 110px; }
.candidato-list { display: grid; gap: 14px; }
.candidato-card {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.candidato-info h2 { margin: 0 0 4px; font-size: 20px; }
.candidato-info p { margin: 0 0 12px; color: var(--muted); }
.candidato-info ul { list-style: none; padding: 0; margin: 0 0 16px; }
.candidato-info li { margin: 0 0 6px; font-size: 14px; }
.candidato-info .btn { width: auto; }
.candidato-thumbs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.candidato-thumbs a {
  display: block;
  text-decoration: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}
.candidato-thumbs img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f3f5f8;
}
.ficha-dados {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
  margin: 0;
}
.ficha-dados dt { color: var(--muted); font-size: 12px; font-weight: 700; }
.ficha-dados dd { margin: 2px 0 0; font-weight: 600; }
.doc-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.doc-view figure { margin: 0; }
.doc-view figcaption { font-weight: 800; margin-bottom: 8px; }
.doc-view img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #111;
}

@media (max-width: 640px) {
  .grid-2, .photos, .candidato-card, .ficha-dados, .doc-view { grid-template-columns: 1fr; }
  .brand-logo { height: 58px; max-width: 82vw; }
  .photo-slot, .photo-preview { min-height: 220px; height: 220px; }
  .actions-split .btn-red { flex: 1; width: auto; }
}
