:root {
  --primary: #2f6f4f;
  --primary-dark: #1c3b2c;
  --primary-darker: #12271c;
  --accent: #d98a3d;
  --accent-gold: #a5814a;
  --bg: #f5f7f4;
  --card-bg: #ffffff;
  --text: #223028;
  --muted: #6b7a70;
  --border: #e2e8e3;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(30, 50, 40, 0.06);
  --danger: #b3432e;
  --danger-bg: #fbdada;
  --danger-text: #a11d1d;
  --success: #1c6b3d;
  --success-bg: #d9f0e1;
  --warning-bg: #fdf3e3;
  --warning-text: #6b4d10;
}

/* Foco visível em todo elemento interativo — acessibilidade e segurança
   (ajuda o usuário a sempre saber onde está antes de digitar uma senha). */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--primary); }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--primary-dark);
  color: #fff;
  padding: 20px 16px;
  flex-shrink: 0;
}
.sidebar .brand { font-weight: 700; font-size: 18px; margin-bottom: 24px; display: block; color: #fff; text-decoration: none; }
.sidebar nav a {
  display: block;
  color: #d7e6dc;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 2px;
}
.sidebar nav a:hover, .sidebar nav a.active { background: rgba(255,255,255,0.12); color: #fff; }
.sidebar .tenant-name { font-size: 12px; color: #b8ccbf; margin-bottom: 12px; padding: 0 12px; }

.main-content { flex: 1; padding: 28px 32px; max-width: 1100px; }

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.topbar h1 { font-size: 22px; margin: 0; }
.topbar a.btn, button.btn, .btn { display: inline-block; }

.card { background: var(--card-bg); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; border: 1px solid var(--border); }
.card h2 { margin-top: 0; font-size: 16px; }

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.stat-value { font-size: 24px; font-weight: 700; color: var(--primary-dark); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }

.btn {
  padding: 10px 18px; border: none; border-radius: 8px;
  background: var(--primary); color: #fff; font-weight: 600; font-size: 14px;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-danger { background: #b3432e; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number],
select, textarea {
  width: 100%; padding: 10px; border-radius: 8px; border: 1px solid var(--border); font-size: 14px; font-family: inherit;
}
textarea { min-height: 80px; resize: vertical; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }

.badge { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; display: inline-block; }
.badge-met { background: #d9f0e1; color: #1c6b3d; }
.badge-pending { background: #fbe6cf; color: #9a5a12; }
.badge-status-done { background: #d9f0e1; color: #1c6b3d; }
.badge-status-in_progress { background: #fdefc7; color: #8a6d00; }
.badge-status-pending { background: #eee; color: #666; }

.legal-note {
  background: #fdf3e3; border: 1px solid #f0d9ab; border-radius: 10px;
  padding: 12px 14px; font-size: 13px; color: #6b4d10; margin-bottom: 16px;
}

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tabs a { padding: 10px 16px; text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 600; border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--primary); border-color: var(--primary); }

.empty-state { text-align: center; color: var(--muted); padding: 30px 0; font-size: 14px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* ================= Autenticação (login, registro, recuperação, bloqueio) ================= */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 15% 15%, rgba(165,129,74,0.10), transparent 40%),
    linear-gradient(160deg, var(--primary-darker), var(--primary-dark) 55%, #234533);
  padding: 24px;
}
.auth-box {
  background: #fff;
  border-radius: 18px;
  padding: 36px 34px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 50px rgba(0,0,0,.28);
}
.auth-brand {
  text-align: center;
  font-weight: 700;
  font-size: 19px;
  margin-bottom: 4px;
  color: var(--primary-dark);
  letter-spacing: .2px;
}
.auth-tagline {
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 22px;
}
.auth-box h1 { font-size: 20px; text-align: center; margin: 0 0 4px; color: var(--primary-dark); }
.auth-box .switch { text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }
.auth-box .switch a { font-weight: 600; }
.auth-links-row { display: flex; justify-content: space-between; font-size: 12.5px; margin-top: 6px; }

.alert { padding: 11px 14px; border-radius: 10px; font-size: 13.5px; margin-top: 14px; text-align: left; }
.alert-error { background: var(--danger-bg); color: var(--danger-text); }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-info { background: var(--warning-bg); color: var(--warning-text); }

.security-footer {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
}
.security-footer svg { flex-shrink: 0; }

/* Força da senha */
.pw-strength { height: 5px; border-radius: 4px; background: var(--border); margin-top: 8px; overflow: hidden; }
.pw-strength-bar { height: 100%; width: 0%; background: var(--danger); transition: width .2s ease, background .2s ease; }
.pw-strength-label { font-size: 11.5px; color: var(--muted); margin-top: 4px; display: block; }

/* Consentimento LGPD */
.consent-row {
  display: flex; align-items: flex-start; gap: 10px;
  background: #f7f9f6; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; margin-top: 16px; font-size: 12.5px; color: var(--text); line-height: 1.5;
}
.consent-row input[type=checkbox] { margin-top: 3px; width: auto; flex-shrink: 0; }
.consent-row a { font-weight: 600; }

/* Tela de bloqueio */
.lock-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary-dark); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; margin: 0 auto 14px;
}
.lock-name { text-align: center; font-weight: 600; margin-bottom: 2px; }
.lock-hint { text-align: center; font-size: 12.5px; color: var(--muted); margin-bottom: 18px; }

/* ================= Topbar / ações de sessão ================= */

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.btn-icon {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 8px; padding: 7px 12px; font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
}
.btn-icon:hover { background: #f0f3f0; color: var(--text); }

.user-chip { font-size: 13px; color: var(--muted); }
.user-chip strong { color: var(--text); }

/* Badge de conformidade legal adicional usado nas telas de compliance */
.badge-not-in-force { background: #eee2c9; color: #7a5b12; }
