:root{
  --primary:#667eea;
  --primary-rgb: 102, 126, 234;
  --success:#48bb78;
  --success-rgb: 72, 187, 120;
  --danger:#f56565;
  --danger-rgb: 245, 101, 101;
  --warning:#ed8936;
  --warning-rgb: 237, 137, 54;
  --bg:#0f172a;
  --card:#111827;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --sidebar-width:260px;
  --sidebar-bg:#0b1220;
  --sidebar-border:#1f2937;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif;
}

.with-sidebar {
  display: block;
  margin-left: var(--sidebar-width);
  transition: margin-left .25s ease;
  padding: 20px;
}

/* Sidebar Styles */
.sidebar {
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  transition: width .25s ease;
}

.sidebar.collapsed { width: 64px; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 10px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar .brand { font-weight: 700; }

.icon-btn {
  background: #1f2937;
  color: var(--text);
  border: none;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.sidebar-nav {
  padding: 10px;
  overflow: auto;
}

.sidebar-section {
  margin: 20px 0 8px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  padding: 10px;
  border-radius: 8px;
  margin: 4px 4px;
  border: 1px solid transparent;
}

.nav-link:hover,
.nav-link.active {
  background: #111827;
  border-color: #1f2937;
}

.nav-link.danger { background: #3b0d0d; }
.nav-link .icon { 
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  font-size: 18px;
}

.nav-link .icon img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.sidebar.collapsed .label { display: none; }
.sidebar.collapsed .nav-link { 
  justify-content: center; 
  padding: 10px 0;
}

.sidebar.collapsed .sidebar-section {
  text-align: center;
  padding: 0 4px;
}

/* Cards and Components */
.card {
  background: var(--card);
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--sidebar-border);
  border-radius: 10px;
  padding: 16px;
}

.stat-card h3 {
  margin: 0 0 8px 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.stat-card .value {
  font-size: 1.5rem;
  font-weight: 600;
}

.stat-card .trend {
  margin-top: 8px;
  font-size: 0.9rem;
}

.trend.up { color: var(--success); }
.trend.down { color: var(--danger); }

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--muted);
}

.form-control {
  width: 100%;
  padding: 0.5rem;
  background: var(--sidebar-bg);
  border: 1px solid var(--sidebar-border);
  border-radius: 6px;
  color: var(--text);
}

.btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 500;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.table th,
.table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--sidebar-border);
}

.table th {
  font-weight: 500;
  color: var(--muted);
}

/* Utilities */
.text-muted { color: var(--muted); }
.mb-4 { margin-bottom: 1rem; }
.mt-4 { margin-top: 1rem; }

/* Responsive */
@media (max-width: 768px) {
  .with-sidebar {
    margin-left: 64px;
  }
  
  .sidebar {
    width: 64px;
  }
  
  .sidebar .label,
  .sidebar .brand {
    display: none;
  }
  
  .sidebar-header {
    justify-content: center;
  }
  
  .nav-link {
    justify-content: center;
  }
  
  .grid {
    grid-template-columns: 1fr;
  }
}