/* =========================================================
   DESIGN SYSTEM – MATERIAL 3 + APPLE HIG
   Light / Dark Mode (manual)
   ========================================================= */

/* ---------- RESET & BASE ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
  line-height: 1.5;
  transition: background-color .25s ease, color .25s ease;
}

/* =========================================================
   COLOR TOKENS
   ========================================================= */

/* ---------- LIGHT MODE (DEFAULT) ---------- */
:root,
:root[data-theme="light"] {
  --bg-main: #f5f7fb;
  --bg-secondary: #eef1f6;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f4fa;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --accent: #2563eb;
  --accent-soft: rgba(37,99,235,0.12);

  --success: #22c55e;
  --warning: #facc15;
  --danger: #ef4444;

  --border-subtle: rgba(15,23,42,0.08);
  --divider: rgba(15,23,42,0.1);

  --shadow-sm: 0 4px 12px rgba(15,23,42,0.08);
  --shadow-md: 0 12px 28px rgba(15,23,42,0.12);

  --radius-sm: 8px;
  --radius-md: 14px;
}

/* ---------- DARK MODE ---------- */
:root[data-theme="dark"] {
  --bg-main: #0e141b;
  --bg-secondary: #121a22;
  --bg-sidebar: #0b1117;
  --bg-card: #151e27;
  --bg-card-hover: #18222d;

  --text-primary: #e6edf3;
  --text-secondary: #a5b4c3;
  --text-muted: #7d8b99;

  --accent: #3b82f6;
  --accent-soft: rgba(59,130,246,0.15);

  --border-subtle: rgba(255,255,255,0.06);
  --divider: rgba(255,255,255,0.08);

  --shadow-sm: 0 4px 12px rgba(0,0,0,0.25);
  --shadow-md: 0 10px 30px rgba(0,0,0,0.35);
}

/* =========================================================
   GLOBAL LAYOUT
   ========================================================= */

body {
  background: linear-gradient(180deg, var(--bg-main), var(--bg-secondary));
  color: var(--text-primary);
}

.content-area {
  flex: 1;
  padding: 28px;
}

/* =========================================================
   SIDEBAR
   ========================================================= */

.bg-sidebar {
  width: 260px;
  min-width: 260px;
  background: linear-gradient(180deg, var(--bg-sidebar), var(--bg-main));
  border-right: 1px solid var(--border-subtle);
}

.app-logo {
  width: 80%;
  max-width: 180px;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.sidebar-brand .brand-text {
  color: var(--text-primary);
}

.sidebar-brand small {
  display: block;
}

.sidebar-brand.has-logo .brand-text {
  display: none;
}

/* Sidebar links (Bootstrap nav) */
.nav-pills .nav-link {
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: background .15s ease, color .15s ease;
}

.nav-pills .nav-link:hover {
  background: var(--accent-soft);
  color: var(--text-primary);
}

.nav-pills .nav-link.active {
  background: var(--accent);
  color: #fff;
}

/* =========================================================
   TYPOGRAPHY
   ========================================================= */

.page-title {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.4px;
}

.page-subtitle {
  margin-top: 6px;
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* =========================================================
   CARDS
   ========================================================= */

.card-dark {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}

.card-dark:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.status-cards .card {
  min-height: 110px;
}

/* =========================================================
   BUTTONS
   ========================================================= */

button {
  font-family: inherit;
}

.range-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 4px 10px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.range-btn:hover {
  background: var(--accent-soft);
  color: var(--text-primary);
}

.range-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* =========================================================
   CHARTS
   ========================================================= */

.chart-wrapper canvas {
  width: 100% !important;
  height: 260px !important;
}

/* =========================================================
   DIVIDERS & MUTED TEXT
   ========================================================= */

.divider {
  height: 1px;
  background: var(--divider);
  margin: 16px 0;
}

.text-muted {
  color: var(--text-muted);
}

/* =========================================================
   LOGIN
   ========================================================= */

.login-frame {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 24px;
}

.login-brand .login-logo {
  width: min(180px, 100%);
  height: auto;
  max-width: 100%;
  background: transparent;
  object-fit: contain;
  margin-bottom: 10px;
}

.brand-name {
  font-weight: 700;
  letter-spacing: -0.2px;
}

.brand-tagline {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.login-card {
  box-shadow: none;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 991px) {
  .bg-sidebar {
    display: none;
  }

  .content-area {
    padding: 16px;
  }
}

/* =========================================================
   FIX: Sidebar buttons visibility (Light mode)
   ========================================================= */

/* Botões outline-light dentro da sidebar em modo LIGHT */
:root[data-theme="light"] .bg-sidebar .btn-outline-light {
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background-color: transparent;
}

/* Hover */
:root[data-theme="light"] .bg-sidebar .btn-outline-light:hover {
  background-color: var(--accent-soft);
  color: var(--text-primary);
}

/* Ícones dentro dos botões */
:root[data-theme="light"] .bg-sidebar .btn-outline-light i {
  color: inherit;
}


/* =========================================================
   FIX: Altura estável para gráficos no dashboard
   ========================================================= */

   .chart-container {
    position: relative;
    height: 260px;       /* altura fixa do gráfico */
    max-height: 260px;
    width: 100%;
    overflow: hidden;
  }
  
  .chart-container canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
  }
  
