/*
  HelpInsect BI — identidade visual própria (não é o tema padrão do Bootstrap).

  Paleta: tinta verde-escura (não preto puro) pro sidebar, um verde-pinho como
  cor de ação/destaque — remete a "controle de pragas / proteção de área verde"
  sem cair no clichê neon. Tipografia combina Space Grotesk (títulos, tem
  personalidade) com Inter (corpo/dados — números tabulares, ótima legibilidade
  em tabela densa, que é 90% do que este sistema mostra).
*/

:root {
  --ink: #14231C;
  --ink-soft: #1E362A;
  --ink-softer: #2A4838;

  --accent: #3F7B5C;
  --accent-strong: #2E5D45;
  --accent-soft: #E7F0EA;

  --bg: #F6F8F6;
  --surface: #FFFFFF;
  --border: #E1E7E2;

  --text: #1F2A24;
  --text-muted: #5C6B62;

  --warn: #B8862B;
  --warn-soft: #FBF1DD;
  --danger: #B23B3B;
  --danger-soft: #FBEAE8;
  --success: #2F8F5B;
  --success-soft: #E7F5EC;

  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;

  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(20, 35, 28, 0.06);
  --shadow-md: 0 6px 20px rgba(20, 35, 28, 0.08);

  /* remapeando as variáveis do Bootstrap 5.3 pro nosso token system */
  --bs-primary: var(--accent);
  --bs-primary-rgb: 63, 123, 92;
  --bs-body-font-family: var(--font-body);
  --bs-body-color: var(--text);
  --bs-body-bg: var(--bg);
  --bs-border-color: var(--border);
  --bs-link-color: var(--accent-strong);
  --bs-link-hover-color: var(--accent);
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-feature-settings: "tnum" 1, "lnum" 1; /* números tabulares alinhados nas colunas de valor */
}

h1, h2, h3, h4, .display-title {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

a { color: var(--accent-strong); }
a:hover { color: var(--accent); }

/* ---------- Shell / sidebar ---------- */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
  width: 264px;
  flex-shrink: 0;
  background: var(--ink);
  color: #EDF3EF;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.85rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.app-brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.6rem 1.2rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 0.9rem;
  text-decoration: none;
}
.app-brand:hover { color: #fff; }
.app-brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 0.95rem;
}

.nav-section-label {
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: #93A69B;
  padding: 0.9rem 0.6rem 0.3rem;
}

.app-nav .nav-link {
  color: #C9D6CE;
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.app-nav .nav-link:hover { background: var(--ink-soft); color: #fff; }
.app-nav .nav-link.active { background: var(--accent); color: #fff; font-weight: 500; }
.app-nav .nav-link i { font-size: 1rem; width: 1.1rem; text-align: center; }

.app-main { flex: 1; min-width: 0; }

.app-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-content { padding: 1.5rem; max-width: 1400px; }

/* ---------- Cards / surfaces ---------- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-kpi .kpi-value {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 600;
}
.card-kpi .kpi-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------- Buttons ---------- */
.btn-primary {
  background: var(--accent); border-color: var(--accent);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--accent-strong); border-color: var(--accent-strong);
}
.btn-outline-primary {
  color: var(--accent-strong); border-color: var(--accent);
}
.btn-outline-primary:hover {
  background: var(--accent); border-color: var(--accent);
}

/* Foco visível pra acessibilidade de teclado — não remover */
.btn:focus-visible, .nav-link:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Tabelas de dados ---------- */
.table-app {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table-app thead th {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  border-bottom: none;
  white-space: nowrap;
}
.table-app td, .table-app th { padding: 0.65rem 0.9rem; vertical-align: middle; }
.table-app tbody tr:hover { background: var(--accent-soft); }
.valor-num { font-variant-numeric: tabular-nums; text-align: right; display: block; }

/* ---------- Badges de status ---------- */
.badge-status { font-weight: 500; font-size: 0.72rem; padding: 0.35em 0.65em; border-radius: 999px; }
.badge-status.status-pago, .badge-status.status-recebido, .badge-status.status-sucesso { background: var(--success-soft); color: var(--success); }
.badge-status.status-aberto, .badge-status.status-pendente, .badge-status.status-processando { background: var(--warn-soft); color: var(--warn); }
.badge-status.status-atrasado, .badge-status.status-erro, .badge-status.status-cancelado { background: var(--danger-soft); color: var(--danger); }

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--text-muted);
}
.empty-state i { font-size: 2.2rem; color: var(--border); margin-bottom: 0.75rem; display: block; }

/* ---------- Login ---------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  background-image: radial-gradient(circle at 20% 20%, var(--ink-softer), var(--ink) 60%);
}
.login-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
}

@media (max-width: 900px) {
  .app-sidebar { position: fixed; left: -280px; z-index: 1000; transition: left 0.2s ease; box-shadow: var(--shadow-md); }
  .app-sidebar.aberto { left: 0; }
  .app-content { padding: 1rem; }
}
