/* ── Reset / Base ─────────────────────────────────────────── */
:root {
  --azul:       #0d5c34;
  --azul-light: #2e9e5b;
  --dourado:    #b8860b;
  --cinza-bg:   #f4f6fb;
  --cinza-borda:#dee2e6;
  --texto:      #1e293b;
  --muted:      #64748b;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  /* Trava qualquer elemento que acidentalmente fique mais largo que a tela —
     é isso que permite "arrastar" a página para os lados no celular */
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--cinza-bg);
  color: var(--texto);
  margin: 0;
  min-height: 100vh;
}

/* ── Header público ──────────────────────────────────────── */
.site-header {
  background: linear-gradient(135deg, #06331d 0%, #0d5c34 60%, #2e9e5b 100%);
  color: #fff;
  padding: 0;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.site-header .header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.site-header .header-logo img {
  height: 70px;
  width: auto;
}
.site-header .header-logo-placeholder {
  width: 70px;
  height: 70px;
  background: rgba(255,255,255,.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
}
.site-header .header-text h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -.01em;
}
.site-header .header-text p {
  margin: 2px 0 0;
  font-size: .83rem;
  opacity: .85;
}
.header-bar {
  background: var(--dourado);
  height: 4px;
}

/* ── Footer público ──────────────────────────────────────── */
.site-footer {
  background: #06331d;
  color: rgba(255,255,255,.75);
  text-align: center;
  padding: 20px 16px;
  font-size: .82rem;
  margin-top: 48px;
}
.site-footer a { color: rgba(255,255,255,.85); }

/* ── Formulário público ──────────────────────────────────── */
.filiacao-wrap {
  max-width: 900px;
  margin: 36px auto;
  padding: 0 16px;
}

.page-hero {
  text-align: center;
  margin-bottom: 32px;
}
.page-hero h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--azul);
  margin: 0 0 8px;
}
.page-hero p { color: var(--muted); margin: 0; }
.page-hero .divider {
  width: 60px;
  height: 4px;
  background: var(--dourado);
  border-radius: 2px;
  margin: 14px auto 0;
}

.form-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(13,92,52,.08);
  overflow: hidden;
}
.form-card-header {
  background: linear-gradient(135deg, var(--azul), var(--azul-light));
  color: #fff;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.form-card-header h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.form-card-body { padding: 28px 28px 32px; }

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .95rem;
  font-weight: 700;
  color: var(--azul);
  margin: 24px 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e9ecef;
}
.form-step .section-title:first-child { margin-top: 0; }

/* ── Formulário por etapas ────────────────────────────────── */
.form-step { display: none; }
.form-step.active { display: block; }

.stepper {
  display: flex;
  align-items: flex-start;
  margin-bottom: 8px;
}
.stepper-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  width: 74px;
}
.stepper-num {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #e9ecef;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .82rem;
  font-weight: 800;
  transition: background .2s, color .2s;
}
.stepper-item.active .stepper-num { background: var(--azul); color: #fff; }
.stepper-item.done   .stepper-num { background: #16a34a; color: #fff; cursor: pointer; }
.stepper-label {
  font-size: .68rem;
  font-weight: 600;
  color: #94a3b8;
  text-align: center;
  line-height: 1.2;
}
.stepper-item.active .stepper-label { color: var(--azul); }
.stepper-item.done   .stepper-label { color: #16a34a; }
.stepper-line {
  flex: 1;
  height: 2px;
  background: #e9ecef;
  margin-top: 15px;
}
.section-num {
  display: inline-flex;
  width: 26px; height: 26px;
  background: var(--azul);
  color: #fff;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 800;
  flex-shrink: 0;
}

.form-label { font-weight: 600; font-size: .85rem; color: #374151; margin-bottom: 5px; display: block; }
.form-control, .form-select {
  width: 100%;
  border-radius: 9px;
  border: 1.5px solid var(--cinza-borda);
  /* 16px trava o zoom automático do iPhone/Safari ao tocar no campo —
     é isso que fazia a "tela mexer" no celular */
  font-size: 16px;
  padding: 11px 13px;
  transition: border-color .2s, box-shadow .2s;
  box-sizing: border-box;
}
.form-control:focus, .form-select:focus {
  border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(13,92,52,.1);
  outline: none;
}

.declaracao-box {
  background: #f0faf3;
  border: 1px solid #c2e8cf;
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 24px;
}
.declaracao-text { font-size: .85rem; color: var(--muted); margin: 0 0 12px; line-height: 1.6; }
.declaracao-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: .88rem;
  font-weight: 600;
}
.declaracao-check input { margin-top: 2px; width: 16px; height: 16px; flex-shrink: 0; }

/* ── Grids do formulário público ─────────────────────────── */
/* Um campo por linha, sempre — evita qualquer problema de alinhamento */
.form-section-grid { display: grid; gap: 12px; margin-bottom: 8px; }
.form-grid-auto {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 8px;
}
.form-row-cep {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.form-row-bairro {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #f0f2f5;
}

.btn-enviar {
  background: linear-gradient(135deg, var(--azul), var(--azul-light));
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px 36px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-enviar:hover { opacity: .9; }
.btn-enviar:active { transform: scale(.98); }
.btn-enviar:disabled { opacity: .65; cursor: not-allowed; }

.sucesso-box {
  text-align: center;
  padding: 56px 24px;
}
.sucesso-box .icon { font-size: 4.5rem; margin-bottom: 16px; }
.sucesso-box h3 { color: #15803d; font-weight: 800; margin: 0 0 10px; }
.sucesso-box p { color: var(--muted); max-width: 420px; margin: 0 auto; }

.info-rodape {
  text-align: center;
  color: var(--muted);
  font-size: .82rem;
  margin-top: 20px;
}

/* ── Admin layout ────────────────────────────────────────── */
.admin-wrapper { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: 240px;
  background: linear-gradient(180deg, #06331d 0%, #0d5c34 100%);
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform .25s;
}
.sidebar-brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-brand h2 {
  margin: 0;
  font-size: .95rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.3;
}
.sidebar-brand p { margin: 2px 0 0; font-size: .72rem; opacity: .65; }
.sidebar-logo-img { height: 26px; width: auto; max-width: 40px; object-fit: contain; vertical-align: middle; margin-right: 4px; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: .87rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: rgba(255,255,255,.1);
  color: #fff;
  border-left-color: var(--dourado);
}
.sidebar-nav a i { width: 18px; text-align: center; font-size: .95rem; }
.sidebar-nav .nav-section {
  padding: 14px 18px 4px;
  font-size: .68rem;
  font-weight: 700;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.badge-nav {
  margin-left: auto;
  background: #e53e3e;
  color: #fff;
  border-radius: 10px;
  padding: 1px 8px;
  font-size: .72rem;
  font-weight: 700;
}
.badge-nav.amarelo { background: #d97706; }

.admin-topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: fixed;
  top: 0; left: 240px; right: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.admin-topbar .topbar-title { font-weight: 700; font-size: 1rem; color: var(--azul); }
.topbar-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .85rem;
  color: var(--muted);
}
.topbar-user a { color: var(--muted); text-decoration: none; }
.topbar-user a:hover { color: #dc2626; }

.admin-main {
  margin-left: 240px;
  margin-top: 56px;
  padding: 28px 28px 60px;
  flex: 1;
  min-width: 0;
}

/* ── Cards admin ─────────────────────────────────────────── */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: var(--texto);
  border: 2px solid transparent;
  transition: border-color .2s, box-shadow .2s;
}
.stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.stat-card.ativo { border-color: var(--azul); }
.stat-card .stat-num { font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-card .stat-label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat-card .stat-icon { font-size: 1.4rem; margin-bottom: 4px; }
.stat-pendente  .stat-num { color: #d97706; }
.stat-aprovado  .stat-num { color: #15803d; }
.stat-rejeitado .stat-num { color: #dc2626; }
.stat-total     .stat-num { color: var(--azul); }

/* ── Tabela admin ────────────────────────────────────────── */
.admin-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  overflow: hidden;
}
.admin-card-header {
  padding: 14px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: .9rem;
}

table { width: 100%; border-collapse: collapse; }
thead th {
  background: #f8fafc;
  padding: 10px 14px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  border-bottom: 1px solid #e9ecef;
  white-space: nowrap;
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  font-size: .87rem;
  vertical-align: middle;
}
tbody tr:hover td { background: #fafbff; }
tbody tr:last-child td { border-bottom: none; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .73rem;
  font-weight: 700;
}
.badge-pendente  { background: #fef3c7; color: #92400e; }
.badge-aprovado  { background: #dcfce7; color: #14532d; }
.badge-rejeitado { background: #fee2e2; color: #991b1b; }

/* ── Botões admin ────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px; border-radius: 8px; border: 1.5px solid transparent; font-size: .82rem; font-weight: 600; cursor: pointer; text-decoration: none; transition: opacity .15s; }
.btn:hover { opacity: .85; }
.btn-sm { padding: 4px 10px; font-size: .78rem; }
.btn-primary   { background: var(--azul); color: #fff; border-color: var(--azul); }
.btn-success   { background: #16a34a; color: #fff; border-color: #16a34a; }
.btn-danger    { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-warning   { background: #d97706; color: #fff; border-color: #d97706; }
.btn-secondary { background: #e2e8f0; color: #475569; border-color: #e2e8f0; }
.btn-outline   { background: transparent; color: var(--azul); border-color: var(--azul); }
.btn-outline-danger { background: transparent; color: #dc2626; border-color: #dc2626; }

/* ── Alertas ─────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 10px; font-size: .88rem; margin-bottom: 16px; }
.alert-success { background: #f0fdf4; color: #14532d; border: 1px solid #bbf7d0; }
.alert-danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #78350f; border: 1px solid #fde68a; }

/* ── Filtros ─────────────────────────────────────────────── */
.filtros { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.filtros input, .filtros select {
  border: 1.5px solid #dee2e6;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: .85rem;
  outline: none;
}
.filtros input:focus, .filtros select:focus { border-color: var(--azul); }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity:0; transform:scale(.95); } to { opacity:1; transform:scale(1); } }
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.modal-header h4 { margin: 0; font-size: .95rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--muted); line-height: 1; padding: 0 4px; }
.modal-close:hover { color: var(--texto); }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid #f1f5f9; display: flex; justify-content: flex-end; gap: 8px; }

/* ── Detalhe ficha ───────────────────────────────────────── */
.detalhe-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.detalhe-item label { display: block; font-size: .7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.detalhe-item span  { font-size: .88rem; font-weight: 600; color: var(--texto); }
.detalhe-sep { grid-column: 1/-1; border: none; border-top: 1px solid #f1f5f9; margin: 4px 0; }

/* ── Login admin ─────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #06331d 0%, #0d5c34 100%);
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 18px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-card .login-logo {
  text-align: center;
  margin-bottom: 24px;
}
.login-card .login-logo span { font-size: 3.5rem; }
.login-card h1 { text-align: center; font-size: 1.15rem; font-weight: 800; color: var(--azul); margin: 0 0 4px; }
.login-card p { text-align: center; color: var(--muted); font-size: .82rem; margin: 0 0 24px; }

/* ── PWA / vazio ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state span { font-size: 3.5rem; display: block; margin-bottom: 12px; opacity: .4; }

/* ── Responsivo ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-topbar { left: 0; }
  .admin-main { margin-left: 0; padding: 16px; }
  .form-card-body { padding: 18px 16px 22px; }
  .detalhe-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .site-header .header-inner { gap: 12px; padding: 16px 14px; }
  .site-header .header-logo-placeholder { width: 52px; height: 52px; font-size: 1.5rem; }
  .site-header .header-text h1 { font-size: 1.05rem; }
  .site-header .header-text p { font-size: .75rem; }
  .page-hero h2 { font-size: 1.35rem; }
  .form-card-header { padding: 14px 16px; }
  .form-card-header h3 { font-size: .9rem; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn-secondary, .form-actions .btn-enviar { width: 100%; justify-content: center; }

  .stepper-item { width: 40px; gap: 4px; }
  .stepper-num { width: 26px; height: 26px; font-size: .74rem; }
  .stepper-label { display: none; }
  .stepper-item.active .stepper-label { display: block; font-size: .62rem; }
  .stepper-line { margin-top: 13px; }
}
