/* ============================================================
   SISTEMA DE CADASTRO SOCIAL — CSS GLOBAL
   ============================================================ */

:root {
  --cor-primaria: #1351B4;
  --cor-primaria-dark: #0C326F;
  --cor-secundaria: #168821;
  --cor-acento: #FFCD07;
  --cor-acento-dark: #E8B800;
  --cor-fundo: #F8F8F8;
  --cor-texto: #1B1B1B;
  --cor-cinza: #636363;
  --cor-borda: #E8E8E8;
  --cor-sucesso: #168821;
  --cor-erro: #E52207;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(19,81,180,0.14);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--cor-texto);
  background: var(--cor-fundo);
  line-height: 1.5;
}
h1, h2, h3 { font-family: 'Plus Jakarta Sans', 'DM Sans', sans-serif; }

/* ---- INPUTS ---- */
.input-field {
  width: 100%;
  border: 2px solid var(--cor-borda);
  border-radius: var(--radius);
  padding: 11px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}
.input-field:focus { outline: none; border-color: var(--cor-primaria); box-shadow: 0 0 0 3px rgba(15,76,117,0.1); }
.input-field.error { border-color: var(--cor-erro); }
.input-field.success { border-color: var(--cor-sucesso); }
select.input-field {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2394a3b8' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.input-group { margin-bottom: 16px; }
.input-group label { display: block; font-size: 0.85rem; font-weight: 600; color: #475569; margin-bottom: 4px; }
.input-group .req { color: var(--cor-erro); }
.error-msg { color: var(--cor-erro); font-size: 0.78rem; margin-top: 2px; display: none; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 24px; border-radius: var(--radius); font-weight: 700;
  font-size: 0.95rem; font-family: inherit; cursor: pointer;
  transition: all 0.2s; border: none; text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--cor-primaria); color: #fff; }
.btn-primary:hover { background: var(--cor-primaria-dark); }
.btn-accent { background: var(--cor-acento); color: var(--cor-texto); }
.btn-accent:hover { background: var(--cor-acento-dark); }
.btn-success { background: var(--cor-sucesso); color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-ghost { background: #f1f5f9; color: #475569; }
.btn-ghost:hover { background: #e2e8f0; }
.btn-sm { padding: 8px 16px; font-size: 0.82rem; }
.btn-block { width: 100%; }

/* ---- CARDS ---- */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

/* ---- BADGE ---- */
.badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 999px; font-size: 0.72rem; font-weight: 700;
}
.badge-completo { background: #DAF0DC; color: #071D09; }
.badge-rascunho { background: #FFF5CC; color: #5B4000; }
.badge-verificado { background: #D4E5FF; color: #0C326F; }
.badge-ativo { background: #DAF0DC; color: #071D09; }
.badge-inativo { background: #FDDBD8; color: #7C1500; }

/* ---- TABLE ---- */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { background: #f8fafc; text-align: left; padding: 10px 12px; font-weight: 700; color: #475569; border-bottom: 2px solid var(--cor-borda); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; }
tr:hover td { background: #f8fafc; }

/* ---- TOAST ---- */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  padding: 12px 24px; border-radius: var(--radius); font-weight: 600; font-size: 0.9rem;
  z-index: 9999; opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.success { background: var(--cor-sucesso); color: #fff; }
.toast.error { background: var(--cor-erro); color: #fff; }

/* ---- ALERT BOX ---- */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 0.9rem; font-weight: 500; margin-bottom: 16px; }
.alert-error { background: #FDDBD8; color: #7C1500; border: 1px solid #F4A89A; }
.alert-success { background: #DAF0DC; color: #071D09; border: 1px solid #9ED4A3; }

/* ---- NAV ---- */
.navbar {
  background: var(--cor-primaria); color: #fff;
  padding: 12px 16px; display: flex; align-items: center; gap: 12px;
}
.navbar-logo {
  display: flex; align-items: center; text-decoration: none;
  background: #fff; border-radius: 8px; padding: 4px 10px;
}
.navbar-logo img { height: 30px; width: auto; display: block; }
.navbar-title { font-weight: 700; font-size: 1rem; }
.navbar-spacer { flex: 1; }
.navbar a, .navbar button {
  color: #fff; background: rgba(255,255,255,0.12); border: none;
  padding: 8px 16px; border-radius: 10px; font-size: 0.85rem; font-weight: 600;
  font-family: inherit; cursor: pointer; text-decoration: none; transition: background 0.2s;
}
.navbar a:hover, .navbar button:hover { background: rgba(255,255,255,0.22); }

/* ---- GRID HELPERS ---- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 360px) {
  .grid-4 { grid-template-columns: 1fr; }
}

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.5); display: none;
  align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal-content {
  background: #fff; border-radius: 20px; max-width: 680px; width: 100%;
  max-height: 90vh; overflow-y: auto; padding: 28px;
  animation: modalIn 0.3s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ---- STAT CARD ---- */
.stat-card { text-align: center; }
.stat-num { font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: 0.82rem; color: var(--cor-cinza); margin-top: 4px; }

/* ---- BAR CHART ---- */
.bar-item { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bar-label { font-size: 0.82rem; font-weight: 600; width: 120px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; background: #f1f5f9; border-radius: 6px; height: 20px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--cor-secundaria); transition: width 0.6s ease; }
.bar-value { font-size: 0.82rem; font-weight: 800; width: 32px; }

/* ---- UTILITIES ---- */
.text-center { text-align: center; }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.78rem; }
.text-muted { color: var(--cor-cinza); }
.font-bold { font-weight: 700; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.p-6 { padding: 24px; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none; }
