:root {
  --bg: #F4F6FA;
  --card: #FFFFFF;
  --text: #1F2937;
  --muted: #6B7280;
  --border: #E5E7EB;
  --blue: #2563EB;
  --blue-light: #EFF6FF;
  --red: #DC2626;
  --red-light: #FEF2F2;
  --green: #059669;
  --green-light: #ECFDF5;
  --amber: #D97706;
  --amber-light: #FFFBEB;
  --shadow: 0 4px 12px rgba(0,0,0,0.06);
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: var(--card);
  padding: 20px 0;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.sidebar-title {
  font-size: 18px;
  font-weight: 700;
  padding: 0 20px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  color: var(--text);
}

.sidebar-title small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s;
}

.nav-item:hover { background: var(--blue-light); }
.nav-item.active {
  background: var(--blue-light);
  color: var(--blue);
  font-weight: 600;
}

.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.content {
  flex: 1;
  padding: 24px 32px;
  max-width: 1200px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
}

.page-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 24px;
}

/* KPI cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--blue);
}

.kpi-card.green { border-top-color: var(--green); }
.kpi-card.amber { border-top-color: var(--amber); }
.kpi-card.red   { border-top-color: var(--red); }
.kpi-card.blue  { border-top-color: #1D4ED8; }

.kpi-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.kpi-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Generic card */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 10px 12px;
  background: #F9FAFB;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

tr:hover td { background: var(--blue-light); }

.text-right { text-align: right; }
.text-center { text-align: center; }

.user-cell {
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green { background: var(--green-light); color: var(--green); }
.badge-amber { background: var(--amber-light); color: var(--amber); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-gray { background: #F3F4F6; color: var(--muted); }
.badge-blue { background: #DBEAFE; color: #1D4ED8; }

.progress {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  width: 80px;
  display: inline-block;
}

.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
}

/* Chart container */
.chart-wrap {
  position: relative;
  height: 260px;
  margin-top: 8px;
}

.footer-note {
  font-size: 11px;
  color: var(--muted);
  margin-top: 24px;
  text-align: center;
}

@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar { width: 180px; }
}
