:root {
  --blue: #173682;
  --blue-light: #a8c0ff;
  --orange: #F6811F;
  --white: #fff;
  --gray: #f4f6fa;
  --dark: #232730;
  --text: #222;
  --radius: 10px;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--gray);
  color: var(--text);
  min-height: 100vh;
  transition: background .3s, color .3s;
}

header {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  color: var(--white);
  padding: 1rem 2rem;
  border-bottom: 4px solid var(--orange);
  flex-wrap: wrap;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-right: 2rem;
}

.logo-area img {
  height: 40px;
}

.main-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 1.2rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.main-nav ul li {
  position: relative;
}

.main-nav ul li a {
  color: var(--white);
  text-decoration: none;
  font-weight: 500;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius);
  transition: background .2s, color .2s;
  display: block;
}

.main-nav ul li a:hover, .main-nav ul li a.active {
  background: var(--orange);
  color: var(--white);
}

.main-nav .dropdown-content {
  display: none;
  position: absolute;
  background: var(--blue);
  min-width: 180px;
  z-index: 100;
  top: 100%;
  left: 0;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px #0003;
  flex-direction: column;
}

.main-nav .dropdown-content li {
  width: 100%;
}

.main-nav .dropdown:hover .dropdown-content,
.main-nav .dropdown:focus-within .dropdown-content {
  display: flex;
}

#theme-toggle {
  background: none;
  border: none;
  color: var(--orange);
  font-size: 1.7rem;
  cursor: pointer;
  margin-left: 1.5rem;
}

main {
  padding: 2rem 5vw;
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

h2, h1 {
  text-align: center;
  width: 100%;
}

.card-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 2rem;
  justify-content: center;
  width: 100%;
}

.card {
  flex: 1 1 250px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 2px 12px #0001;
  padding: 2rem;
  min-width: 220px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-left: 6px solid var(--blue);
}

.card.inadimplente {
  border-left-color: var(--orange);
  background: #fff3e5;
}

.card-title {
  font-size: 1.1rem;
  color: var(--blue);
  margin-bottom: .5rem;
  font-weight: 600;
  text-align: center;
}

.card.inadimplente .card-title {
  color: var(--orange);
}

.card-value {
  font-size: 2.2rem;
  font-weight: bold;
  text-align: center;
}

form {
  background: var(--white);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px #0001;
  max-width: 400px;
  margin: 2rem auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

form label {
  width: 100%;
  text-align: left;
  margin-bottom: 0.3rem;
}

input, select, button, textarea {
  font-family: inherit;
  font-size: 1rem;
  margin-top: 0.7rem;
  margin-bottom: 1.2rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  border: 1px solid #ddd;
  width: 100%;
  box-sizing: border-box;
}

button {
  background: var(--orange);
  color: var(--white);
  border: none;
  font-weight: bold;
  cursor: pointer;
  transition: background .2s;
  width: 100%;
  margin-top: 1rem;
}

button:hover {
  background: var(--blue);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  margin-bottom: 2rem;
  margin-top: 2rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 8px #0001;
}

th, td {
  padding: 0.8rem;
  border-bottom: 1px solid #eee;
  text-align: center;
}

th {
  background: #f0f4fa;
  color: var(--blue);
}

tr:nth-child(even) {
  background: #fafbfc;
}

/* Footer padronizado */
.footer-bar {
  background: #173682;
  color: #fff;
  text-align: center;
  padding: 1.2rem 0;
  font-size: 1.1rem;
  font-family: 'Segoe UI', Arial, sans-serif;
  letter-spacing: 1px;
  border-top: 4px solid #F6811F;
  width: 100%;
  margin-top: 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Mensagens de sucesso/erro */
.success { color: #1cae1c; font-weight: bold; margin-bottom: 1rem; }
.error { color: #e53935; font-weight: bold; margin-bottom: 1rem; }

/* Responsividade */
@media (max-width: 900px) {
  header, main {
    flex-direction: column;
    padding: 1rem;
  }
  .main-nav ul { flex-direction: column; gap: 0.5rem; }
  .logo-area { margin-bottom: 1rem; }
}

@media (max-width: 800px) {
  main { padding: 1rem 2vw; }
  .card-grid, form, table { max-width: 100%; }
  .card-grid { flex-direction: column; gap: 1rem; }
  form { padding: 1rem; }
}

@media (max-width: 500px) {
  header { flex-direction: column; align-items: center; }
  .main-nav ul { flex-direction: column; gap: 0.7rem; }
  main { padding: 1rem 1vw; }
  .card, form, table { max-width: 100%; }
}

/* === TEMA ESCURO SUAVE COM AZUL CLARO === */
body.dark {
  --gray: #262b33;
  --white: #323843;
  --text: #f7f7f7;
  --blue: #a8c0ff;
  background: var(--gray);
  color: var(--text);
}

body.dark header,
body.dark .main-nav ul li a,
body.dark .main-nav ul li a.active,
body.dark .main-nav ul li a:hover {
  background: var(--white) !important;
  color: var(--blue) !important;
}

body.dark .main-nav .dropdown-content {
  background: var(--white);
}

body.dark .footer-bar {
  background: var(--white);
  color: var(--blue);
  border-color: var(--orange);
}

body.dark .card { background: #3c414b; color: var(--text); }
body.dark .card-title,
body.dark th {
  color: var(--blue);
}
body.dark .card.inadimplente { background: #4a3f3f; }
body.dark form, body.dark table { background: #3c414b; color: var(--text); }
body.dark tr:nth-child(even) { background: #323843; }
