/* === BASE === */
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", sans-serif;
  transition: background 0.3s, color 0.3s;
  overflow-x: hidden;
}

/* === LIGHT THEME === */
:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #6b7280;
  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

/* === DARK THEME === */
html.dark {
  --bg: #0f172a;
  --surface: #1e293b;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --brand: #3b82f6;
  --brand-hover: #2563eb;
  --shadow: 0 2px 12px rgba(255, 255, 255, 0.05);
}

/* === LAYOUT === */
.dashboard-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.3s ease;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand {
  color: var(--brand);
  font-weight: 700;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.sidebar-nav { flex: 1; padding: 1rem 0; }
.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .8rem 1.5rem;
  color: var(--text);
  border-left: 4px solid transparent;
  text-decoration: none;
  transition: all .2s;
}
.sidebar .nav-link:hover {
  background: rgba(0,0,0,.05);
  border-left-color: var(--brand);
  color: var(--brand);
}
html.dark .sidebar .nav-link:hover {
  background: rgba(255,255,255,.08);
}
.sidebar .nav-link.active {
  background: rgba(37,99,235,.1);
  border-left-color: var(--brand);
  color: var(--brand);
}
html.dark .sidebar .nav-link.active {
  background: rgba(59,130,246,.15);
}
.sidebar-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); }
.user-info { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.user-avatar { font-size: 1.8rem; color: var(--brand); }

/* Topbar */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 900;
}
.page-title { font-size: 1.25rem; font-weight: 600; }

/* Conteúdo */
.main-content { flex: 1; background: var(--bg); transition: background .3s; }
.page-content { padding: 2rem; min-height: 100vh; }

/* === CARDS === */
.summary-card, .chart-card, .table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.summary-card:hover, .chart-card:hover, .table-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
}

/* Tabelas */
.table thead th { background: var(--bg); color: var(--muted); font-weight: 600; }
.table td, .table th { vertical-align: middle; }
html.dark .table thead th { background: #1e293b; }

/* Responsivo */
@media (max-width: 991px) {
  .sidebar { position: fixed; left: -260px; top: 0; bottom: 0; height: 100%; }
  .sidebar.show { left: 0; box-shadow: 0 0 20px rgba(0,0,0,.4); }
  .main-content { width: 100%; }
}

/* Animação */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.page-content > * { animation: fadeIn .4s ease; }
