:root {
  --sidebar-width: 220px;
  --sidebar-collapsed: 60px;
  --primary: #2563eb;
  --sidebar-bg: #1e293b;
  --sidebar-hover: #334155;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; background: #f1f5f9; color: #1e293b; }

/* Sidebar */
.sidebar {
  position: fixed; top: 0; left: 0; height: 100vh;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  z-index: 100;
  transition: width 0.2s ease;
}
.sidebar-header {
  padding: 18px 16px;
  font-size: 1.1rem; font-weight: 700;
  color: #fff;
  display: flex; align-items: center;
  border-bottom: 1px solid #334155;
  white-space: nowrap; overflow: hidden;
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  color: #94a3b8; cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap; overflow: hidden;
  font-size: 0.9rem;
}
.nav-item:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item i { font-size: 1.1rem; flex-shrink: 0; width: 20px; text-align: center; }
.sidebar-footer { padding: 12px; border-top: 1px solid #334155; }

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 0;
  transition: margin-left 0.2s ease;
}

/* Pages */
.page { display: none; padding: 20px 24px; }
.page.active { display: block; }

.page-header {
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
}
.page-header h4 { margin: 0; font-weight: 600; color: #1e293b; }

/* Cards */
.card { border: none; box-shadow: 0 1px 3px rgba(0,0,0,.08); border-radius: 8px; }
.card-header { background: #f8fafc; border-bottom: 1px solid #e2e8f0; font-weight: 600; font-size: 0.875rem; color: #475569; padding: 10px 16px; }

/* Stats Cards */
.stat-card {
  background: #fff;
  border-radius: 8px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  display: flex; align-items: center; gap: 16px;
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.stat-icon.blue { background: #eff6ff; color: #2563eb; }
.stat-icon.green { background: #f0fdf4; color: #16a34a; }
.stat-icon.orange { background: #fff7ed; color: #ea580c; }
.stat-icon.red { background: #fef2f2; color: #dc2626; }
.stat-icon.purple { background: #f5f3ff; color: #7c3aed; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: 0.8rem; color: #64748b; margin-top: 4px; }

/* Tables */
.table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: .03em; color: #64748b; background: #f8fafc; border-bottom: 1px solid #e2e8f0; padding: 8px 12px; white-space: nowrap; }
.table td { font-size: 0.85rem; padding: 7px 12px; vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8fafc; }

/* Badges */
.badge-cat { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.72rem; font-weight: 600; }
.badge-cat-0 { background: #ede9fe; color: #6d28d9; }
.badge-cat-1 { background: #dbeafe; color: #1d4ed8; }
.badge-cat-2 { background: #dcfce7; color: #15803d; }
.badge-cat-3 { background: #fef3c7; color: #b45309; }
.badge-cat-4 { background: #fce7f3; color: #9d174d; }
.badge-cat-5 { background: #e0f2fe; color: #0369a1; }
.badge-cat-6 { background: #f0fdf4; color: #166534; }
.badge-cat-7 { background: #fff7ed; color: #c2410c; }
.badge-cat-8 { background: #f5f3ff; color: #5b21b6; }

.status-listed { color: #16a34a; font-size: 0.8rem; }
.status-unlisted { color: #dc2626; font-size: 0.8rem; }

.stock-low { color: #dc2626; font-weight: 700; }
.stock-ok { color: #16a34a; }
.stock-mid { color: #ea580c; }

.change-positive { color: #16a34a; font-weight: 600; }
.change-negative { color: #dc2626; font-weight: 600; }

/* Pagination */
.pagination .page-link { font-size: 0.82rem; padding: 4px 10px; color: var(--primary); }
.pagination .page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

/* Forms */
.form-control-sm, .form-select-sm { font-size: 0.85rem; }

/* Loading */
.loading-overlay { text-align: center; padding: 40px; color: #94a3b8; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar-text { display: none; }
  .main-content { margin-left: var(--sidebar-collapsed); }
  .sidebar-header { justify-content: center; }
  .nav-item { justify-content: center; }
}

.turnover-bar {
  display: inline-block;
  height: 6px; border-radius: 3px;
  background: #2563eb;
  vertical-align: middle;
  min-width: 4px;
}

.clickable { cursor: pointer; }
.clickable:hover td { background: #eff6ff !important; }

.restock-needed { background: #fff7ed !important; }

.btn-purple { background: #7c3aed; color: #fff; border: none; }
.btn-purple:hover { background: #6d28d9; color: #fff; }
