:root {
  --sidebar-width: 260px;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #334155;
  --topbar-height: 60px;
  --accent: #3b82f6;
  --bg-main: #f0f4f8;
  --card-bg: #ffffff;
  --card-radius: 12px;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg-main); font-family: 'Segoe UI', system-ui, sans-serif; }

/* SIDEBAR */
#sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  color: #cbd5e1;
  flex-shrink: 0;
  transition: width .25s;
  overflow: hidden;
  position: sticky;
  top: 0;
  height: 100vh;
}
#sidebar.collapsed { width: 0; }

.sidebar-header {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px 16px;
  font-size: 1.05rem; font-weight: 700;
  color: #f1f5f9;
  border-bottom: 1px solid #1e293b;
}
.sidebar-header i { font-size: 1.3rem; color: var(--accent); }

.sidebar-section-label {
  padding: 16px 16px 6px;
  font-size: .65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: #475569;
}

.sidebar-list { padding: 0 8px; }
.sidebar-item {
  display: flex; align-items: center; gap-8px; gap: 8px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: .875rem;
  transition: background .15s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-item:hover { background: var(--sidebar-hover); color: #f1f5f9; }
.sidebar-item.active { background: var(--accent); color: #fff; }
.sidebar-item .badge { font-size: .6rem; margin-left: auto; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid #1e293b;
  font-size: .7rem; color: #475569;
}

.loading-small { padding: 12px; text-align: center; }
.text-muted-light { color: #64748b; }

/* TOP BAR */
.top-bar {
  height: var(--topbar-height);
  background: var(--card-bg);
  border-bottom: 1px solid #e2e8f0;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.btn-icon { background: none; border: none; color: #64748b; padding: 4px 8px; border-radius: 6px; }
.btn-icon:hover { background: #f1f5f9; }

/* WELCOME */
.welcome-screen {
  min-height: calc(100vh - var(--topbar-height));
  text-align: center; gap: 12px;
}
.welcome-icon { font-size: 4rem; color: #cbd5e1; }

/* STAT CARDS */
.stat-card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  padding: 16px 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  border-left: 4px solid #e2e8f0;
  height: 100%;
}
.stat-card.danger { border-left-color: #ef4444; }
.stat-card.success { border-left-color: #22c55e; }
.stat-card.warning { border-left-color: #f59e0b; }

.stat-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.bg-primary-soft { background: #eff6ff; }
.bg-danger-soft   { background: #fef2f2; }
.bg-success-soft  { background: #f0fdf4; }
.bg-warning-soft  { background: #fffbeb; }
.bg-info-soft     { background: #f0f9ff; }
.bg-secondary-soft{ background: #f8fafc; }

.stat-value { font-size: 1.4rem; font-weight: 700; color: #0f172a; line-height: 1.2; }
.stat-label { font-size: .75rem; color: #64748b; margin-top: 2px; }

/* CHART CARDS */
.chart-card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  overflow: hidden;
  border: 1px solid #e2e8f0;
  height: 100%;
}
.chart-card-header {
  padding: 14px 20px;
  font-size: .875rem; font-weight: 600; color: #1e293b;
  border-bottom: 1px solid #f1f5f9;
  display: flex; align-items: center; justify-content: space-between;
}
.chart-wrap { padding: 16px; height: 280px; position: relative; }
.chart-wrap-sm { height: 230px; }

/* TABLES in cards */
.chart-card .table { font-size: .8rem; }
.chart-card .table th { font-size: .72rem; }

/* CF section */
.border-warning { border-color: #f59e0b !important; }

.cf-ip-list {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0; list-style: none;
}
.cf-ip-list li {
  background: #fee2e2; color: #991b1b;
  border-radius: 6px; padding: 3px 10px;
  font-size: .78rem; font-family: monospace;
  cursor: pointer;
}
.cf-ip-list li:hover { background: #fca5a5; }

.cf-ua-list { list-style: none; padding: 0; }
.cf-ua-list li {
  background: #fff7ed; color: #92400e;
  border-radius: 6px; padding: 5px 12px;
  font-size: .78rem; margin-bottom: 4px;
}

/* Responsive */
@media (max-width: 768px) {
  #sidebar { position: fixed; z-index: 200; height: 100vh; }
  #sidebar.collapsed { width: 0; }
  .chart-wrap { height: 220px; }
}
