/* CondoJAR — base compartilhada: tokens de design + componentes do painel */

:root {
  --primaria: #1a56db;
  --primaria-escura: #1e429f;
  --primaria-clara: #eff6ff;
  --fundo: #f0f2f5;
  --texto: #111827;
  --texto-2: #374151;
  --texto-3: #6b7280;
  --texto-4: #9ca3af;
  --borda: #e5e7eb;
  --borda-input: #d1d5db;
  --hover: #f3f4f6;
  --fundo-claro: #f9fafb;
  --verde: #059669;
  --verde-fundo: #d1fae5;
  --verde-escuro: #065f46;
  --vermelho: #dc2626;
  --vermelho-fundo: #fee2e2;
  --vermelho-escuro: #991b1b;
  --amarelo-fundo: #fef3c7;
  --amarelo-escuro: #92400e;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--fundo);
  min-height: 100vh;
  color: var(--texto);
}

/* ─── TOPO ─── */
.topo {
  background: var(--primaria);
  color: white;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
}
.topo-left { display: flex; align-items: center; gap: 12px; }
.topo-logo { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
.topo-right { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.btn-sair {
  background: rgba(255,255,255,0.15);
  border: none; color: white;
  padding: 6px 14px; border-radius: 6px;
  cursor: pointer; font-size: 13px;
}
.btn-sair:hover { background: rgba(255,255,255,0.25); }
.menu-btn {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

/* ─── LAYOUT ─── */
.layout { display: flex; padding-top: 56px; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: white;
  border-right: 1px solid var(--borda);
  padding: 20px 0;
  position: fixed;
  top: 56px; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 90;
}
.menu-titulo {
  font-size: 11px;
  font-weight: 600;
  color: var(--texto-4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 16px;
  margin: 16px 0 6px;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 16px;
  font-size: 14px;
  font-family: inherit;
  text-align: left;
  text-decoration: none;
  color: var(--texto-2);
  cursor: pointer;
  transition: background 0.15s;
  background: none;
  border: none;
  border-left: 3px solid transparent;
}
.menu-item:hover { background: var(--hover); }
.menu-item.ativo {
  background: var(--primaria-clara);
  color: var(--primaria);
  border-left-color: var(--primaria);
  font-weight: 500;
}
.menu-icone {
  width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.menu-icone svg { width: 18px; height: 18px; }

.sidebar-overlay { display: none; }

.conteudo {
  margin-left: 220px;
  flex: 1;
  padding: 24px;
}

/* ─── CARDS ─── */
.page-titulo {
  font-size: 20px;
  font-weight: 600;
  color: var(--texto);
  margin-bottom: 20px;
}
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  border: 1px solid var(--borda);
}
.card-label { font-size: 12px; color: var(--texto-3); margin-bottom: 6px; }
.card-valor {
  font-size: 24px;
  font-weight: 700;
  color: var(--texto);
}
.card-valor.verde { color: var(--verde); }
.card-valor.vermelho { color: var(--vermelho); }
.card-sub { font-size: 12px; color: var(--texto-4); margin-top: 4px; }

/* ─── TABELA ─── */
.tabela-container {
  background: white;
  border-radius: 10px;
  border: 1px solid var(--borda);
  overflow: hidden;
}
.tabela-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--borda);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tabela-header h3 { font-size: 15px; font-weight: 600; color: var(--texto); }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--texto-3);
  padding: 10px 20px;
  background: var(--fundo-claro);
  border-bottom: 1px solid var(--borda);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
td { padding: 12px 20px; font-size: 14px; color: var(--texto-2); border-bottom: 1px solid var(--hover); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--fundo-claro); }

/* ─── BOTÕES ─── */
.btn {
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}
.btn-primary { background: var(--primaria); color: white; }
.btn-primary:hover { background: var(--primaria-escura); }
.btn-outline {
  background: white;
  color: var(--texto-2);
  border: 1px solid var(--borda-input);
}
.btn-outline:hover { background: var(--fundo-claro); }

/* ─── BADGE ─── */
.badge {
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}
.badge-ok { background: var(--verde-fundo); color: var(--verde-escuro); }
.badge-warn { background: var(--amarelo-fundo); color: var(--amarelo-escuro); }
.badge-erro { background: var(--vermelho-fundo); color: var(--vermelho-escuro); }

/* ─── ESTADOS ─── */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--texto-4);
  font-size: 14px;
}
.erro-pagina {
  text-align: center;
  padding: 48px 24px;
  color: var(--texto-3);
  font-size: 14px;
}
.erro-pagina p { margin-bottom: 16px; }

/* ─── SELETOR DE CONDOMÍNIO ─── */
.cond-seletor {
  background: white;
  border: 1px solid var(--borda-input);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--texto-2);
  cursor: pointer;
  margin-bottom: 20px;
  width: 100%;
}

/* ─── RESPONSIVO ─── */
@media (max-width: 768px) {
  .topo { padding: 0 16px; }
  .menu-btn { display: block; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s;
    box-shadow: 2px 0 12px rgba(0,0,0,0.08);
  }
  .sidebar.aberta { transform: translateX(0); }

  .sidebar-overlay.visivel {
    display: block;
    position: fixed;
    top: 56px; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 80;
  }

  .conteudo { margin-left: 0; padding: 16px; }

  .tabela-container { overflow-x: auto; }
}
