/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:        #0d1525;
  --sidebar:   #111e35;
  --card:      #172035;
  --card2:     #1d2a44;
  --border:    #243250;
  --text:      #dde4f0;
  --muted:     #7a90b8;
  --blue:      #2563eb;
  --blue-l:    #3b82f6;
  --green:     #16a34a;
  --green-l:   #22c55e;
  --red:       #dc2626;
  --red-l:     #ef4444;
  --yellow:    #d97706;
  --yellow-l:  #f59e0b;
  --purple:    #7c3aed;
  --sidebar-w: 220px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-size: 13px; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
       background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }

/* ── Layout ────────────────────────────────────────────────── */
.layout { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 22px 18px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  font-size: 22px;
  background: var(--blue);
  border-radius: 8px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
}
.logo-text { font-size: 14px; font-weight: 700; letter-spacing: .3px; }
.logo-sub  { font-size: 10px; color: var(--muted); margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-section {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 14px 18px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  border-radius: 0;
  color: var(--muted);
  font-size: 13px;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.nav-item:hover  { background: #1e2f4a; color: var(--text); }
.nav-item.active {
  background: #1a2d4a;
  color: var(--blue-l);
  border-left-color: var(--blue-l);
  font-weight: 600;
}
.nav-item i { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}
.user-nome { display: block; font-weight: 600; margin-bottom: 8px; }
.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  transition: color .15s;
}
.logout-btn:hover { color: var(--red-l); }

/* ── Main ──────────────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  background: var(--sidebar);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.page-title { font-size: 16px; font-weight: 700; flex: 1; }

.content { flex: 1; overflow-y: auto; padding: 20px 24px 32px; }

/* ── Filters ───────────────────────────────────────────────── */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-select, .filter-input {
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 12px;
  outline: none;
  transition: border-color .15s;
}
.filter-select:focus, .filter-input:focus { border-color: var(--blue-l); }
.filter-input { min-width: 200px; }
.btn-filter {
  background: var(--blue);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: background .15s;
}
.btn-filter:hover { background: var(--blue-l); }

/* ── KPI Cards ─────────────────────────────────────────────── */
.kpi-row { display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.kpi {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  flex: 1;
  min-width: 160px;
  border-top: 3px solid var(--border);
}
.kpi.blue   { border-top-color: var(--blue-l); }
.kpi.green  { border-top-color: var(--green-l); }
.kpi.red    { border-top-color: var(--red-l); }
.kpi.yellow { border-top-color: var(--yellow-l); }
.kpi.purple { border-top-color: var(--purple); }

.kpi-label { font-size: 10px; color: var(--muted); text-transform: uppercase;
             letter-spacing: .6px; margin-bottom: 6px; }
.kpi-value { font-size: 20px; font-weight: 700; line-height: 1.1; }
.kpi-sub   { font-size: 10px; color: var(--muted); margin-top: 4px; }

/* ── Charts row ────────────────────────────────────────────── */
.charts-row { display: flex; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  flex: 1;
  min-width: 300px;
}
.chart-card.full { flex: 100%; }
.chart-card.w60  { flex: 1.5; }
.chart-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 14px;
}
.chart-wrap { position: relative; }

/* ── Tables ────────────────────────────────────────────────── */
.table-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}
.table-card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: #0f1e36; }
thead th {
  padding: 9px 12px;
  text-align: right;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  white-space: nowrap;
}
thead th.left { text-align: left; }
tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #1a2d4a; }
td { padding: 8px 12px; vertical-align: middle; }
td.right { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.mono  { font-family: monospace; font-size: 11px; color: var(--muted); }
td.nome  { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tfoot td { font-weight: 700; background: #0f1e36; border-top: 2px solid var(--border); padding: 9px 12px; }
tfoot td.right { text-align: right; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.badge-a { background: #052e16; color: var(--green-l); }
.badge-b { background: #1c1917; color: var(--yellow-l); }
.badge-c { background: #1c1917; color: var(--muted); }
.badge-green  { background: #052e16; color: var(--green-l); }
.badge-red    { background: #450a0a; color: var(--red-l); }
.badge-blue   { background: #0c1a3a; color: var(--blue-l); }
.badge-yellow { background: #2d1a02; color: var(--yellow-l); }

/* ── Positive / Negative numbers ───────────────────────────── */
.pos { color: var(--green-l); font-weight: 600; }
.neg { color: var(--red-l);   font-weight: 600; }

/* ── Note box ──────────────────────────────────────────────── */
.note {
  background: #1a2035;
  border: 1px solid #2a3a60;
  border-left: 3px solid var(--yellow-l);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 16px;
}

/* ── Login page ────────────────────────────────────────────── */
.login-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 30% 40%, #1a2d50 0%, var(--bg) 60%);
}
.login-card {
  background: var(--sidebar);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon { font-size: 32px; background: var(--blue); border-radius: 12px;
                          width: 56px; height: 56px; display: inline-flex;
                          align-items: center; justify-content: center; margin-bottom: 12px; }
.login-logo h1 { font-size: 20px; font-weight: 700; }
.login-logo p  { font-size: 12px; color: var(--muted); margin-top: 4px; }

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 11px; font-weight: 600;
              color: var(--muted); text-transform: uppercase;
              letter-spacing: .5px; margin-bottom: 6px; }
.form-input {
  width: 100%;
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
.form-input:focus { border-color: var(--blue-l); }

.btn-login {
  width: 100%;
  background: var(--blue);
  color: #fff;
  border: none;
  padding: 11px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: background .15s;
  letter-spacing: .3px;
}
.btn-login:hover { background: var(--blue-l); }

.login-error {
  background: #450a0a;
  border: 1px solid #7f1d1d;
  color: var(--red-l);
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 12px;
  margin-bottom: 14px;
  text-align: center;
}

/* ── Utility ───────────────────────────────────────────────── */
.mt-4  { margin-top: 16px; }
.mb-4  { margin-bottom: 16px; }
.small { font-size: 11px; color: var(--muted); }
