:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --primary: #1e3a5f;
  --primary-dark: #142942;
  --text: #1e2430;
  --muted: #6b7280;
  --border: #e2e5ea;
  --success: #1f8a4c;
  --pending: #b8860b;
  --danger: #c0392b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 20px;
}

.topbar {
  background: var(--primary);
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar a { color: white; text-decoration: none; font-weight: 600; }
.topbar .logo { font-size: 18px; }
.topbar nav a { margin-left: 16px; opacity: 0.9; font-weight: 400; font-size: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 20px;
}

h1 { font-size: 24px; margin: 0 0 8px; }
h2 { font-size: 18px; margin: 0 0 16px; }
p.muted, .muted { color: var(--muted); font-size: 14px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 16px 0 6px;
  color: var(--text);
}

input[type="text"], input[type="email"], input[type="password"], input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: white;
}

.btn {
  display: inline-block;
  background: var(--primary);
  color: white;
  border: none;
  padding: 11px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: white; color: var(--primary); border: 1px solid var(--primary); }
.btn.small { padding: 6px 12px; font-size: 13px; }

.signer-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}
.signer-row input { flex: 1; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge.pendente { background: #fdf1d6; color: var(--pending); }
.badge.assinado { background: #e2f4e8; color: var(--success); }
.badge.concluido { background: #e2f4e8; color: var(--success); }

.doc-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.doc-list-item:last-child { border-bottom: none; }

.doc-list-item .info { display: flex; flex-direction: column; gap: 4px; }
.doc-list-item .info a { color: var(--text); font-weight: 600; text-decoration: none; font-size: 15px; }

.error-box {
  background: #fdecea;
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 16px;
}

.success-box {
  background: #e2f4e8;
  color: var(--success);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 16px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.topbar .logo-img { height: 30px; display: block; }
.login-logo { height: 40px; display: block; }

.auth-page {
  display: flex;
  flex-direction: row-reverse;
  min-height: 100vh;
}
.auth-form-col {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: white;
}
.auth-form-wrap {
  width: 100%;
  max-width: 380px;
}
.auth-brand-col {
  flex: 1;
  background: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}
.auth-brand-content {
  max-width: 380px;
  text-align: center;
}
.auth-brand-logo { height: 30px; margin-bottom: 56px; }
.auth-brand-badge {
  width: 140px;
  height: 140px;
  margin: 0 auto 40px;
  border-radius: 50%;
  border: 1.5px solid rgba(224, 184, 74, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 34px;
}
.auth-tagline {
  color: rgba(255, 255, 255, 0.88);
  font-size: 18px;
  line-height: 1.55;
  margin: 0;
}

@media (max-width: 780px) {
  .auth-brand-col { display: none; }
  .auth-form-col { padding-top: 64px; align-items: flex-start; }
}

.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}
.step-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.step-dot span {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--border);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}
.step-dot small { font-size: 11px; color: var(--muted); }
.step-dot.active span { border-color: var(--primary); color: var(--primary); background: white; }
.step-dot.active small { color: var(--primary); font-weight: 600; }
.step-dot.done span { border-color: var(--primary); background: var(--primary); color: white; }
.step-line {
  width: 40px;
  height: 2px;
  background: var(--border);
  margin: 0 6px;
  margin-bottom: 18px;
}

#camera-wrap {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 4 / 3;
  background: #111;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}
#camera-video, #photo-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

#signature-pad {
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  touch-action: none;
  background: white;
  width: 100%;
  height: 180px;
}

.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #25D366;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.btn-whatsapp:hover { background: #1fb959; }

.btn-copy-link {
  background: white;
  color: var(--primary);
  border: 1px solid var(--primary);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.btn-copy-link:hover { background: #eef2f7; }

.btn-icon-delete {
  background: none;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
.btn-icon-delete:hover {
  background: #fdecea;
  color: var(--danger);
  border-color: #f5c6c0;
}

.help-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.help-icon {
  color: var(--muted);
  cursor: help;
  flex-shrink: 0;
}
.help-icon:hover { color: var(--primary); }
.help-tip {
  display: none;
  position: absolute;
  top: 26px;
  left: 0;
  z-index: 20;
  background: var(--text);
  color: white;
  font-size: 12.5px;
  line-height: 1.6;
  padding: 12px 14px;
  border-radius: 8px;
  width: 260px;
}
.help-wrap:hover .help-tip,
.help-wrap:focus-within .help-tip {
  display: block;
}

.nao-sabe-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}
.nao-sabe-summary::-webkit-details-marker { display: none; }
.nao-sabe-summary .toggle-arrow {
  display: inline-block;
  transition: transform 0.15s;
}
.nao-sabe-details[open] .toggle-arrow { transform: rotate(90deg); }
.nao-sabe-box {
  margin-top: 12px;
  padding: 14px;
  background: #f7f5ef;
  border-radius: 8px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-box {
  background: white;
  border-radius: 10px;
  padding: 20px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.pdf-viewer-container {
  width: 100%;
  max-height: 520px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #eceae4;
}
.pdf-viewer-container canvas {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 10px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.pdf-viewer-container canvas:last-child { margin-bottom: 0; }

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 16px 0;
}
.checkbox-row input {
  width: 26px;
  height: 26px;
  min-width: 26px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.checkbox-row label { margin: 0; font-weight: 400; font-size: 14px; padding-top: 3px; }

footer.notice {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-top: 30px;
}

/* ---------- Página pública de verificação (/verificar/:id) ---------- */
.verify-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}
.verify-back:hover { color: var(--primary); }

.verify-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 14px;
  padding: 26px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.verify-banner .brand { display: flex; align-items: center; gap: 10px; }
.verify-banner .brand img { height: 28px; display: block; }
.verify-banner .shield img { height: 52px; display: block; opacity: 0.95; }

.verify-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 20px;
  overflow: hidden;
}
.verify-card .head {
  background: #eef2f7;
  padding: 14px 20px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.verify-card .body { padding: 20px; }
.verify-card .body + .body { border-top: 1px solid var(--border); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill-success { background: #e2f4e8; color: var(--success); border-color: #bfe6cd; }
.pill-pending { background: #fdf1d6; color: var(--pending); border-color: #f0dca3; }
.pill-info { background: var(--bg); color: var(--primary); border-color: var(--border); }

.verify-field + .verify-field { margin-top: 14px; }
.verify-field .label { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 3px; }
.verify-field .value { font-size: 14px; color: var(--text); }
.verify-hash {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  word-break: break-all;
  color: var(--muted);
}

.signer-entry { padding: 14px 0; border-bottom: 1px solid var(--border); }
.signer-entry:last-child { border-bottom: none; }
.signer-entry .pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 7px; }
.signer-entry .name { font-weight: 700; font-size: 14px; letter-spacing: 0.2px; }
.signer-entry .meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.verify-note {
  background: var(--bg);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
}

.verify-details summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.verify-details summary::-webkit-details-marker { display: none; }
.verify-details summary .toggle-arrow { display: inline-block; transition: transform 0.15s; }
.verify-details[open] summary .toggle-arrow { transform: rotate(90deg); }
.verify-details .verify-note { margin-top: 8px; }
