/* Montserrat (SIL Open Font License) — servida pelo próprio site, sem depender do Google */
@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('fonts/montserrat-latin.woff2') format('woff2');
}

/* ===== Tokens (troque as cores aqui para seguir a identidade visual) ===== */
:root {
  --primary: #0b3a75;
  --primary-hover: #082c59;
  --primary-soft: #e8eef8;
  --accent: #f08a00;
  --text: #1b2430;
  --muted: #5b6676;
  --border: #c9d1dc;
  --bg: #f3f5f8;
  --card: #ffffff;
  --error: #b42318;
  --error-soft: #fdecea;
  --ok: #157a3c;
  --ok-soft: #e7f5ec;
  --radius: 10px;
  --focus: 0 0 0 3px rgba(240, 138, 0, .55);
  --font: 'Montserrat', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light; /* evita controles escuros quando o celular está em modo escuro */
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5;
  color: var(--text); background: var(--bg); overflow-x: hidden;
}
[hidden] { display: none !important; }
a { color: var(--primary); overflow-wrap: anywhere; }
img { max-width: 100%; }
.wrap { width: 100%; max-width: 720px; margin: 0 auto; padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
.sr-only, .hp {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* ===== Topo ===== */
.demo-banner { margin: 0; padding: 8px 14px; background: #fff3cd; color: #6b4e00; font-size: .85rem; font-weight: 600; text-align: center; }
.topbar { background: var(--primary); color: #fff; border-bottom: 4px solid #589cd0; }
.topbar-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding-top: 12px; padding-bottom: 12px; }
.brand-link { display: inline-flex; align-items: center; color: #fff; text-decoration: none; min-height: 40px; }
.brand-logo { display: block; height: 36px; width: auto; max-width: min(260px, 70vw); }
.brand-fallback { font-size: 1.15rem; letter-spacing: .04em; font-weight: 500; white-space: nowrap; }
.brand-fallback strong { font-weight: 800; }
.topnav { display: flex; gap: 8px; }
.topnav a {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  color: #fff; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.45); text-decoration: none;
}
.topnav a:hover, .topnav a:focus-visible { background: rgba(255,255,255,.16); border-color: #fff; outline: none; }
.ico { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 520px) {
  .brand-logo { height: 32px; }
  .topnav a { width: 40px; height: 40px; }
  .ico { width: 20px; height: 20px; }
}

/* ===== Intro ===== */
.intro { padding: 22px 0 14px; }
h1 { font-size: 1.3rem; line-height: 1.25; margin: 0 0 10px; overflow-wrap: break-word; }
.lead { margin: 0 0 12px; font-size: .92rem; color: var(--text); }
.lead strong { font-weight: 700; }
.note { font-size: .88rem; color: var(--error); margin: 0; }
.req { color: var(--error); font-weight: 700; }

/* ===== Seções e campos ===== */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 16px; margin-bottom: 14px; }
.section { border-top: 6px solid var(--primary); }
.section-title { font-size: 1.15rem; line-height: 1.3; margin: 0 0 18px; text-transform: uppercase; letter-spacing: .02em; color: var(--primary); }
.field { margin: 0 0 22px; border: 0; padding: 0; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.q, legend.q { display: block; font-weight: 600; line-height: 1.35; margin: 0 0 8px; padding: 0; width: 100%; }
.sub { display: block; font-weight: 500; font-size: .92rem; margin: 0 0 6px; }
.hint { font-size: .86rem; color: var(--muted); margin: -2px 0 8px; }
.hint:empty { display: none; }
.error { color: var(--error); font-size: .86rem; font-weight: 600; margin: 6px 0 0; }
.error:empty { display: none; }

input[type="text"], input[type="email"], input[type="tel"], select, textarea {
  display: block; width: 100%; max-width: 100%; font: inherit; font-size: 16px; /* 16px evita zoom no iPhone */
  color: var(--text); background-color: #fff; border: 1.5px solid var(--border); border-radius: 8px;
  padding: 11px 12px; min-height: 48px; margin: 0;
  -webkit-appearance: none; appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%;
  background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px;
  text-overflow: ellipsis;
}
textarea { resize: vertical; min-height: 110px; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: #8a94a3; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.invalid > input, .invalid > select, .invalid > textarea, .invalid .prefix-input input,
.invalid > .conditional input { border-color: var(--error); }
.prefix-input { display: flex; align-items: stretch; width: 100%; }
.prefix-input span { display: flex; align-items: center; padding: 0 12px; background: var(--bg); border: 1.5px solid var(--border); border-right: 0; border-radius: 8px 0 0 8px; color: var(--muted); font-weight: 600; flex: 0 0 auto; }
.prefix-input input { border-radius: 0 8px 8px 0; min-width: 0; flex: 1 1 auto; }
.row-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
.sub-field { min-width: 0; }
.conditional { margin-top: 10px; }
.callout { background: #fff7e6; border-left: 4px solid var(--accent); padding: 10px 12px; border-radius: 6px; font-size: .9rem; margin: -4px 0 20px; }

/* opções (rádio / caixa) em formato tocável */
.options { display: grid; grid-template-columns: 1fr; gap: 8px; }
.opt {
  display: flex; align-items: flex-start; gap: 10px; font-weight: 500; margin: 0;
  border: 1.5px solid var(--border); border-radius: 8px; padding: 12px; cursor: pointer; background: #fff; min-height: 48px;
}
.opt input {
  -webkit-appearance: none; appearance: none; width: 22px; height: 22px; margin: 0; flex: 0 0 22px;
  background: #fff; border: 2px solid #7d8796; display: grid; place-content: center; cursor: pointer;
}
.opt input[type="radio"] { border-radius: 50%; }
.opt input[type="checkbox"] { border-radius: 5px; }
.opt input::before { content: ""; transform: scale(0); transition: transform .12s ease-in-out; }
.opt input[type="radio"]::before { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.opt input[type="checkbox"]::before {
  width: 12px; height: 12px; background: #fff;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
.opt input:checked { border-color: var(--primary); }
.opt input[type="checkbox"]:checked { background: var(--primary); }
.opt input:checked::before { transform: scale(1); }
.opt input:focus-visible { box-shadow: var(--focus); outline: none; }
.invalid .opt input { border-color: var(--error); }
.opt span { flex: 1 1 auto; min-width: 0; padding-top: 1px; }
.opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.opt:has(input:focus-visible) { box-shadow: var(--focus); }
.invalid .opt { border-color: var(--error); }
.opt-check { font-weight: 400; font-size: .95rem; line-height: 1.45; }

/* ===== Upload ===== */
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 16px 12px; text-align: center; background: #fafbfd; }
.dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
.invalid .dropzone { border-color: var(--error); }
.dz-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.dz-actions .btn { flex: 1 1 140px; max-width: 220px; }
.dz-text { margin: 10px 0 0; font-size: .88rem; color: var(--muted); }
.status { margin: 8px 0 0; }
.thumbs { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.thumb { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 8px; padding: 8px; background: #fff; min-width: 0; }
.thumb img { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; background: var(--bg); flex: 0 0 52px; }
.thumb .meta { flex: 1 1 auto; min-width: 0; font-size: .9rem; }
.thumb .name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.thumb .size { color: var(--muted); font-size: .8rem; }
.thumb.loading { opacity: .7; }
.thumb .remove { flex: 0 0 auto; border: 0; background: transparent; color: var(--error); font: inherit; font-size: .9rem; font-weight: 600; padding: 10px 6px; cursor: pointer; border-radius: 6px; }
.thumb .remove:focus-visible { box-shadow: var(--focus); outline: none; }

/* ===== Botões ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
  font: inherit; font-weight: 700; border-radius: 8px; padding: 12px 18px; min-height: 48px;
  border: 1.5px solid transparent; cursor: pointer; text-decoration: none; margin: 0;
  -webkit-appearance: none; appearance: none;
}
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
#btnSubmit:hover:not(:disabled) { background: #15803d; } /* verde no mouse over */
.btn-primary:disabled { opacity: .7; cursor: progress; }
.btn-secondary { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-secondary:hover { background: var(--primary-soft); }
.btn-ghost { background: transparent; color: var(--primary); border-color: var(--border); }
.btn-block { display: flex; width: 100%; font-size: 1.05rem; min-height: 54px; margin: 4px 0 10px; }
.spinner { display: none; width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.sending { font-size: .9rem; color: var(--muted); text-align: center; margin: 0 0 12px; }

.alert { background: var(--error-soft); border: 1px solid var(--error); color: var(--error); border-radius: 8px; padding: 12px; margin-bottom: 14px; font-weight: 600; }

/* ===== Sucesso ===== */
.success { text-align: center; padding: 30px 18px; margin-top: 22px; outline: none; }
.success-icon { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; font-size: 2rem; font-weight: 800; }
.success h2 { margin: 0 0 8px; font-size: 1.5rem; }
.success p { margin: 0 0 8px; }
.protocolo-label { margin: 16px 0 0 !important; font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.protocolo {
  display: inline-block; margin: 6px 0 8px; padding: 10px 14px; border: 2px dashed var(--primary); border-radius: 8px;
  background: var(--primary-soft); color: var(--primary); font-weight: 800; letter-spacing: .02em;
  font-size: clamp(.95rem, 4.4vw, 1.5rem); font-variant-numeric: tabular-nums; max-width: 100%; overflow-wrap: anywhere;
  -webkit-user-select: all; user-select: all;
}
.muted { color: var(--muted); }
.success-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; margin: 20px auto 0; max-width: 320px; }

.footer { padding: 24px 0 36px; font-size: .82rem; text-align: center; color: var(--text); }
.footer p { margin: 2px 0; }
.footer-org { font-weight: 700; }
.footer-addr { font-style: normal; margin: 6px 0 8px; line-height: 1.5; }
.footer-links { margin: 0 0 8px !important; }

/* "Tirar foto" só em telas de toque; "arraste" só com mouse */
.only-touch { display: none !important; }
@media (pointer: coarse) { .only-touch { display: inline-flex !important; } .only-pointer { display: none; } }

/* ===== Telas maiores ===== */
@media (min-width: 640px) {
  .wrap { padding-left: 20px; padding-right: 20px; }
  .card { padding: 26px 28px; }
  h1 { font-size: 1.65rem; }
  .lead { font-size: .98rem; }
  .options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row-2 { grid-template-columns: 1fr 1fr; }
  .btn-block { width: auto; min-width: 280px; margin-left: auto; margin-right: auto; }
  .success-actions { flex-direction: row; flex-wrap: wrap; justify-content: center; max-width: none; }
}

/* ===== Impressão: só o comprovante ===== */
@media print {
  .topbar, .footer, .intro, form, .success-actions { display: none !important; }
  body { background: #fff; }
  .success { border: 0; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
