/* ── Reset e base ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:       #00539B;
  --blue-light: #E8F0F8;
  --blue-dark:  #003D73;
  --green:      #006D3B;
  --bg:         #F7F9FC;
  --white:      #FFFFFF;
  --text:       #1A1A2E;
  --text-muted: #6B7280;
  --border:     #DDE3ED;
  --yellow:     #E8A900;
  --red:        #C41E3A;
  --radius:     8px;
  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,83,155,.06);
  --font:       'Inter', system-ui, sans-serif;
}

body { font-family: var(--font); background: var(--bg); color: var(--text); }
a { color: var(--blue); }

/* ── Layout Login: card centralizado no gradiente ─── */
.login-body { min-height: 100vh; display: flex; align-items: stretch; }

.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100vh;
  padding: 24px;
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 60%, var(--green) 100%);
}

.login-card {
  background: var(--white);
  width: min(520px, 100%);
  padding: 44px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0,30,60,.35);
}

/* ── Header do card ───────────────────────────────── */
.ses-badge {
  display: inline-block;
  background: var(--blue);
  color: white;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .1em;
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 12px;
}
.login-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--blue-dark); }
.login-subtitle   { color: var(--text-muted); font-size: .9rem; margin-top: 4px; }
.login-footer { font-size: .85rem; color: var(--text-muted); text-align: center; }

/* ── Contexto explicativo ─────────────────────────── */
.login-context {
  background: var(--blue-light);
  border-left: 3px solid var(--blue);
  padding: 16px 20px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .875rem;
  line-height: 1.6;
}
.login-context p + p { margin-top: 8px; }

/* ── Formulário ───────────────────────────────────── */
.login-form, .form-coleta { display: flex; flex-direction: column; gap: 16px; }

.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group label { font-size: .875rem; font-weight: 500; }
.field-group input, .field-group textarea {
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font);
  transition: border-color .15s;
  background: var(--white);
}
.field-group input:focus, .field-group textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,83,155,.1);
}
.field-hint { font-size: .75rem; color: var(--text-muted); }

/* ── Botões ───────────────────────────────────────── */
.btn-primary {
  display: inline-block;
  background: var(--blue);
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background .15s;
}
.btn-primary:hover { background: var(--blue-dark); }
.btn-full { width: 100%; }

.btn-secundario {
  display: inline-block;
  background: var(--white);
  color: var(--blue);
  border: 1.5px solid var(--blue);
  padding: 12px 22px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background .15s;
}
.btn-secundario:hover { background: var(--blue-light); }

/* ── Alertas ──────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: .875rem; line-height: 1.5; }
.alert-erro  { background: #FEF2F2; color: #991B1B; border: 1px solid #FCA5A5; }
.alert-ok    { background: #F0FDF4; color: #166534; border: 1px solid #86EFAC; }
.alert-aviso { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }

/* ── Topo e rodapé (área logada) ──────────────────── */
.topo {
  background: var(--white);
  border-bottom: 1px solid var(--border);
}
.topo-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.topo-marca { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.topo-marca .ses-badge { margin-bottom: 0; }
.topo-titulo { font-weight: 600; }
.topo-nav { display: flex; align-items: center; gap: 18px; font-size: .9rem; flex-wrap: wrap; }
.topo-nav a { text-decoration: none; font-weight: 500; }
.topo-nav a:hover { text-decoration: underline; }
.topo-municipio { color: var(--text-muted); }
.nav-sair { color: var(--red) !important; }

.conteudo { min-height: calc(100vh - 140px); }

.rodape {
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  text-align: center;
  font-size: .8rem;
  color: var(--text-muted);
}

/* ── Páginas internas ─────────────────────────────── */
.pagina { max-width: 1100px; margin: 0 auto; padding: 32px 24px 48px; }
.pagina-estreita { max-width: 760px; }
.pagina-larga { max-width: 1240px; }

.pagina-cabecalho { margin-bottom: 28px; }
.pagina-cabecalho h1 { font-size: 1.6rem; color: var(--blue-dark); margin-bottom: 6px; }
.texto-suave { color: var(--text-muted); line-height: 1.6; }
.link-voltar { display: inline-block; font-size: .875rem; text-decoration: none; margin-bottom: 12px; }
.link-voltar:hover { text-decoration: underline; }

/* ── Dashboard município ──────────────────────────── */
.cards-formularios { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

.card-form {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-left: 4px solid var(--border);
}
.card-form[data-status="aberto"]  { border-left-color: var(--blue); }
.card-form[data-status="enviado"] { border-left-color: var(--green); }
.card-form[data-status="fechado"] { border-left-color: var(--red); }

.card-form-corpo { padding: 24px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.card-form h2 { font-size: 1.15rem; }

.status-linha { font-size: .9rem; font-weight: 500; }
.status-aberto  { color: var(--blue); }
.status-ok      { color: var(--green); }
.status-fechado { color: var(--red); }

/* ── Texto informativo dos formulários ────────────── */
.texto-informativo {
  background: var(--blue-light);
  border-left: 3px solid var(--blue);
  padding: 18px 22px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .9rem;
  line-height: 1.65;
  margin-bottom: 24px;
}
.texto-informativo p + p { margin-top: 10px; }

.bloco-branco {
  background: var(--white);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.campos-mensal { display: flex; flex-direction: column; gap: 22px; }

.field-group select {
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font);
  background: var(--white);
  transition: border-color .15s;
}
.field-group select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,83,155,.1);
}

/* ── Formulário de faixas etárias ─────────────────── */
.grade-faixas {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  background: var(--white);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.total-linha {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  background: var(--blue-light);
  border-left: 3px solid var(--blue);
  padding: 14px 20px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .95rem;
}
.total-linha strong { font-size: 1.5rem; color: var(--blue-dark); }

/* ── Telas centrais (sucesso, erros) ──────────────── */
.tela-central {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 48px 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.tela-central h1 { font-size: 1.4rem; color: var(--blue-dark); }
.tela-central p { line-height: 1.6; max-width: 46ch; }
.icone-grande { font-size: 3rem; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }

/* ── Painel admin ─────────────────────────────────── */
.resumo-grade { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 32px; }
.resumo-item {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.resumo-num { font-size: 2rem; font-weight: 700; color: var(--blue-dark); }
.resumo-rotulo { font-size: .85rem; color: var(--text-muted); }

.secao { margin-bottom: 36px; }
.secao h2 { font-size: 1.15rem; margin-bottom: 14px; color: var(--blue-dark); }

.acoes-linha { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }

.tabela-scroll { overflow-x: auto; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); }
.tabela { width: 100%; border-collapse: collapse; font-size: .875rem; }
.tabela th, .tabela td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tabela th { background: var(--blue-light); color: var(--blue-dark); font-weight: 600; }
.tabela tbody tr:hover { background: var(--bg); }
.tabela .num { text-align: right; }

.lista-pendentes {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: .85rem;
  color: var(--text-muted);
  max-height: 320px;
  overflow-y: auto;
}

/* ── Responsivo ───────────────────────────────────── */
@media (max-width: 900px) {
  .cards-formularios { grid-template-columns: 1fr; }
  .resumo-grade { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .login-wrapper { padding: 16px; }
  .login-card { padding: 32px 24px; }
  .grade-faixas { grid-template-columns: repeat(2, 1fr); padding: 16px; }
}
