:root {
  --terracota:  #C86B4F;
  --salvia:     #7D8B72;
  --areia:      #FAF6F0;
  --creme:      #F0EFEA;
  --grafite:    #2A2D34;
  --branco:     #FFFFFF;
  --linha:      #D9D8D3;
  --sans: 'Outfit', sans-serif;
  --serif: 'Playfair Display', Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background-color: var(--areia);
  color: var(--grafite);
  font-family: var(--sans);
  line-height: 1.6;
}

/* ---------- Topbar ---------- */
.topbar {
  background: var(--grafite);
  color: #fff;
  padding: 0 20px;
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-family: var(--serif);
  font-size: 1.2em;
}
.brand-logo {
  background: var(--terracota);
  color: var(--branco);
  font-family: var(--serif);
  font-style: italic;
  padding: 4px 12px;
  border-radius: 18px 0 18px 0;
}
.brand-logo.big {
  display: inline-block;
  font-size: 2em;
  padding: 10px 22px;
  margin-bottom: 12px;
}
.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.nav-links a {
  color: #fff;
  text-decoration: none;
  font-size: 0.9em;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
}
.nav-links a:hover { background: rgba(255,255,255,0.12); }
.nav-links .btn-ghost {
  border: 1px solid rgba(255,255,255,0.4);
}
.btn-ghost:hover { background: rgba(255,255,255,0.12); }

/* ---------- Layout ---------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px 80px;
}
.page-title {
  font-family: var(--serif);
  font-size: 2em;
  color: var(--terracota);
  margin-bottom: 6px;
}
.lead {
  color: #555;
  margin-bottom: 24px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--branco);
  border: 1px solid var(--linha);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.02);
}
.card h2 {
  font-family: var(--serif);
  font-size: 1.4em;
  color: var(--terracota);
  margin-bottom: 16px;
}
.card-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}
@media (max-width: 900px) {
  .card-grid-2 { grid-template-columns: 1fr; }
}

/* ---------- Stats ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.stat-card {
  background: var(--branco);
  border: 1px solid var(--linha);
  border-left: 4px solid var(--salvia);
  border-radius: 10px;
  padding: 18px;
}
.stat-card.warn { border-left-color: var(--terracota); }
.stat-label {
  display: block;
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #777;
  margin-bottom: 6px;
}
.stat-value {
  font-size: 1.6em;
  font-weight: 700;
}
.stat-value small {
  font-size: 0.55em;
  font-weight: 500;
  color: #777;
}

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.95em;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--linha);
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 1em;
  background: var(--branco);
}
.form-group input:focus,
.form-group select:focus {
  outline: 2px solid var(--terracota);
  border-color: var(--terracota);
}
.form-group small {
  display: block;
  color: #888;
  margin-top: 4px;
  font-size: 0.85em;
}
.grid-2-forms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ---------- Buttons ---------- */
.btn-primary {
  display: inline-block;
  padding: 11px 20px;
  background: var(--terracota);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.95em;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn-primary:hover { background: #B2583D; }
.btn-secondary {
  display: inline-block;
  padding: 10px 16px;
  background: var(--creme);
  border: 1px solid var(--linha);
  border-radius: 6px;
  color: var(--grafite);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.9em;
  cursor: pointer;
  text-decoration: none;
  margin-top: 12px;
}
.btn-secondary:hover { background: var(--terracota); color: #fff; }
.btn-secondary-sm {
  display: inline-block;
  padding: 4px 8px;
  background: var(--creme);
  border: 1px solid var(--linha);
  border-radius: 4px;
  font-size: 0.75em;
  text-decoration: none;
  color: var(--grafite);
}
.btn-danger-sm {
  padding: 3px 8px;
  background: transparent;
  border: 1px solid var(--terracota);
  color: var(--terracota);
  border-radius: 4px;
  font-size: 0.8em;
  cursor: pointer;
}
.btn-danger-sm:hover { background: var(--terracota); color: #fff; }

/* ---------- Tables ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
  margin-bottom: 12px;
}
.table th {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 2px solid var(--linha);
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #777;
  white-space: nowrap;
}
.table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--creme);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table.wide { min-width: 900px; }
td.r, th.r { text-align: right; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75em;
  font-weight: 600;
}
.badge.ok { background: #E2EFE7; color: #17553B; }
.badge.refugo { background: #FCECE8; color: var(--terracota); }

/* ---------- Results ---------- */
.result-rows { margin-bottom: 14px; }
.r-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px dashed var(--linha);
  font-size: 0.95em;
}
.r-row.total {
  font-weight: 700;
  font-size: 1.1em;
  border-top: 2px solid var(--grafite);
  border-bottom: none;
  margin-top: 8px;
  padding-top: 10px;
}
.sub-title {
  margin: 14px 0 8px;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--salvia);
}
.ok-note { color: #17553B; font-weight: 600; margin-top: 10px; }

/* ---------- Fotos ---------- */
.foto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.foto-item {
  border: 1px solid var(--linha);
  border-radius: 8px;
  overflow: hidden;
  background: var(--branco);
}
.foto-item img {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  display: block;
}
.foto-item form { padding: 6px; }

/* ---------- Flash ---------- */
.flash {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-weight: 600;
}
.flash.ok { background: #E2EFE7; color: #17553B; }
.flash.erro { background: #FCECE8; color: var(--terracota); }

/* ---------- Steps ---------- */
.steps {
  margin-left: 20px;
}
.steps li { margin-bottom: 8px; }

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--branco);
  border: 1px solid var(--linha);
  border-radius: 14px;
  padding: 34px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(42,45,52,0.06);
}
.login-card h1 {
  font-family: var(--serif);
  font-size: 1.8em;
  margin-bottom: 4px;
}
.login-sub { color: var(--salvia); margin-bottom: 22px; }
.login-card form { text-align: left; }
.login-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--linha);
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 1em;
  margin-bottom: 16px;
}
.login-card button { width: 100%; }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}

.muted { color: #999; }
