/* =============================================================
   Sistema de Solicitações - RBCIP — Formulários Institucionais
   Estilo compartilhado (landing + formulários)
   ============================================================= */

:root {
  --brand:        #17324d;  /* navy institucional */
  --brand-dark:   #0f2438;
  --brand-light:  #eef2f7;
  --gold:         #c19a3e;  /* fio de destaque */
  --accent:       #12805c;  /* verde (sucesso) */
  --danger:       #b42318;
  --bg:           #f3f4f6;
  --surface:      #ffffff;
  --text:         #16202e;
  --muted:        #667085;
  --border:       #e4e7ec;
  --radius:       10px;
  --radius-sm:    8px;
  --shadow:       0 1px 3px rgba(16, 24, 40, 0.07), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-sm:    0 1px 2px rgba(16, 24, 40, 0.05);
  --font:         -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif:        Georgia, "Times New Roman", serif;
  --maxw:         760px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand); }

/* ---------- Cabeçalho ---------- */
.site-header {
  background: var(--brand);
  color: #fff;
  padding: 26px 24px 24px;
  border-bottom: 3px solid var(--gold);
  text-align: center;
}
.site-header .brand {
  font-family: var(--serif);
  font-size: 0.82rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  margin: 0 0 5px;
  font-weight: 400;
}
.site-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.site-header p {
  margin: 7px auto 0;
  max-width: 620px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.94rem;
}
.site-header .header-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.site-header .site-logo {
  flex: none;
  height: 62px;
  width: auto;
  display: block;
}
.site-header .header-text { min-width: 0; }

/* ---------- Container ---------- */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 20px 64px;
}

/* ---------- Landing: grade de cartões ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  margin-top: 8px;
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 22px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--gold);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.18s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: #cfd6df;
}
.card:hover::before { transform: scaleY(1); }
.card .icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--brand-light);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  margin-bottom: 16px;
}
.card h2 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.89rem;
  flex: 1;
}
.card .go {
  margin-top: 18px;
  font-weight: 600;
  color: var(--brand);
  font-size: 0.85rem;
  letter-spacing: 0.01em;
}

/* ---------- Cartão de formulário ---------- */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 30px 34px;
}
.form-card h1 {
  margin: 0 0 4px;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.form-intro {
  color: var(--muted);
  margin: 0 0 4px;
  font-size: 0.95rem;
}
.required-note {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 4px 0 20px;
}

/* ---------- Barra de navegação (voltar) ---------- */
.topbar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 20px 0;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--brand);
  font-weight: 600;
  font-size: 0.9rem;
}
.back-link:hover { text-decoration: underline; }

/* ---------- Seções ---------- */
.form-section { margin-bottom: 8px; }
.section-title {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand);
  margin: 32px 0 18px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--border);
}
.form-section:first-of-type .section-title { margin-top: 6px; }
.section-title .num {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  display: grid;
  place-items: center;
}

/* ---------- Campos ---------- */
.field { margin-bottom: 22px; }
.field > label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}
.field .hint {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 8px;
}
.field .req { color: var(--danger); margin-left: 2px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: 11px 12px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(23, 50, 77, 0.12);
}
textarea { min-height: 96px; resize: vertical; }

/* Grupo de valor monetário */
.money-wrap { position: relative; }
.money-wrap::before {
  content: "R$";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 600;
  pointer-events: none;
}
.money-wrap input { padding-left: 38px; }

/* Grupos de opções (checkbox / radio) */
.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.option:hover { border-color: var(--brand); background: var(--brand-light); }
.option input { margin-top: 3px; width: auto; }
.option .other-input { margin-top: 8px; }

.confirm-box {
  background: var(--brand-light);
  border: 1px solid #dbe2ea;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.confirm-box .option { border: none; background: transparent; padding: 0; }
.confirm-box .option:hover { background: transparent; }

/* Aviso informativo */
.callout {
  display: flex;
  gap: 10px;
  background: #fff8e6;
  border: 1px solid #f2e2b3;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.9rem;
  color: #7a5c00;
  margin-bottom: 22px;
}
.callout .i { font-size: 1.1rem; line-height: 1.3; }
.callout-error {
  background: #fdecea;
  border-color: #f5c6c2;
  color: var(--danger);
}

/* ---------- Validação ---------- */
.field.invalid input,
.field.invalid textarea,
.field.invalid select { border-color: var(--danger); }
.field .error {
  display: none;
  color: var(--danger);
  font-size: 0.83rem;
  margin-top: 6px;
}
.field.invalid .error { display: block; }

/* Estado válido (feedback em tempo real) */
.field.valido input,
.field.valido textarea,
.field.valido select { border-color: #86c5a6; }

/* Aviso não bloqueante (ex.: chave PIX diferente do CPF) */
.field .aviso {
  margin-top: 6px;
  padding: 7px 10px;
  background: #fff8e6;
  border: 1px solid #f2e2b3;
  border-radius: 6px;
  color: #7a5c00;
  font-size: 0.83rem;
}

/* Prévia do comprovante */
.file-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--muted);
}
.file-preview img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* ---------- Ações ---------- */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}
.btn {
  appearance: none;
  border: 1px solid transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:active { box-shadow: inset 0 2px 4px rgba(0,0,0,0.15); }
.btn-secondary {
  background: #fff;
  color: var(--brand);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: #b9c2cd; background: #fafbfc; }

/* ---------- Mensagem de sucesso ---------- */
.success {
  display: none;
  text-align: center;
  padding: 20px 0;
}
.success.show { display: block; }
.success .check {
  width: 64px; height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 2rem;
}
.success h2 { margin: 0 0 6px; }
.success p { color: var(--muted); margin: 0 0 18px; }

/* ---------- Barra do usuário logado ---------- */
.user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--brand-light);
  border: 1px solid #dbe2ea;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--brand-dark);
}
.link-sair {
  appearance: none;
  border: none;
  background: none;
  color: var(--brand);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

/* ---------- Tela de login ---------- */
.login-panel { max-width: 420px; margin: 8px auto 0; }
.login-head { text-align: center; margin-bottom: 22px; }
.login-icon {
  width: 56px; height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--brand-light);
  color: var(--brand);
  display: grid; place-items: center;
  font-size: 1.6rem;
}
.login-head h2 { margin: 0 0 6px; }
.login-head p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.login-step label {
  display: block;
  font-weight: 600;
  margin: 14px 0 4px;
}
.login-step .btn { width: 100%; margin-top: 16px; }
.login-info { color: var(--muted); font-size: 0.9rem; margin: 0 0 4px; }
.login-msg { color: var(--danger); font-size: 0.85rem; min-height: 1em; margin: 6px 0 0; }
.link-voltar {
  appearance: none; border: none; background: none;
  color: var(--brand); font: inherit; cursor: pointer;
  text-decoration: underline; display: block;
  margin: 12px auto 0;
}

/* ---------- Rodapé ---------- */
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 24px 20px 40px;
}

@media (max-width: 560px) {
  .form-card { padding: 22px 18px 26px; }
  .site-header h1 { font-size: 1.35rem; }
}

/* Marca de campo opcional (contraponto ao asterisco de obrigatório) */
.field .opcional {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.82rem;
  margin-left: 4px;
}

/* Preenchimento para outra pessoa */
.terceiro-box {
  background: #fbfcfd;
  border: 1px dashed #cfd8e3;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 22px;
}
.terceiro-box .option { border: none; background: transparent; padding: 0; }
.terceiro-box small { color: var(--muted); font-size: 0.83rem; line-height: 1.45; display: block; margin-top: 2px; }
.quem-preenche { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.qp-logado {
  margin: 0;
  font-size: 0.88rem;
  color: var(--brand);
  background: var(--brand-light);
  border-radius: 6px;
  padding: 8px 11px;
}
/* [hidden] é só display:none do navegador — um display explícito o venceria */
.quem-preenche [hidden], .terceiro-box [hidden] { display: none !important; }
.qp-campos { display: grid; gap: 12px; }
.qp-campos label { font-weight: 600; font-size: 0.9rem; display: block; }
.qp-campos input { margin-top: 4px; }
@media (min-width: 560px) { .qp-campos { grid-template-columns: 1fr 1fr; } .qp-campos .error { grid-column: 1 / -1; } }

/* Prévia de comprovante em PDF (sem miniatura de imagem) */
.file-preview .file-icone { font-size: 1.6rem; line-height: 1; }
