:root {
  --primary: #3498db;
  --primary-dark: #2980b9;
  --success: #27ae60;
  --danger: #e74c3c;
  --warning: #f39c12;
  --info: #17a2b8;
  --dark: #2c3e50;
  --light: #ecf0f1;
  --gray: #95a5a6;
  --white: #ffffff;
  --bg: #f5f6fa;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --border: #dcdde1;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* Navbar */
.navbar {
  background: var(--white);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--dark);
}
.brand-badge {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 6px;
  display: inline-block;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.nav-link {
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  transition: background 0.2s;
}
.nav-link:hover { background: var(--light); color: var(--text); }
.nav-link.active { background: var(--primary); color: var(--white); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--light);
  border-radius: 20px;
  font-size: 0.85rem;
  margin-left: 8px;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  background: var(--gray);
  color: var(--white);
}
.badge-admin { background: var(--danger); }
.badge-warehouse_keeper { background: var(--warning); }
.badge-user { background: var(--info); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-success { background: var(--success); color: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-warning { background: var(--warning); color: var(--white); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--dark);
}

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.stat-icon.blue { background: rgba(52,152,219,0.1); color: var(--primary); }
.stat-icon.green { background: rgba(39,174,96,0.1); color: var(--success); }
.stat-icon.red { background: rgba(231,76,60,0.1); color: var(--danger); }
.stat-icon.orange { background: rgba(243,156,18,0.1); color: var(--warning); }
.stat-value { font-size: 1.8rem; font-weight: 700; }
.stat-label { font-size: 0.85rem; color: var(--text-light); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 0.9rem;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(52,152,219,0.1);
}
.form-textarea { resize: vertical; min-height: 80px; }

/* Tables */
.table-wrapper { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.table th, .table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table th {
  background: var(--light);
  font-weight: 600;
  white-space: nowrap;
}
.table tr:hover { background: rgba(52,152,219,0.02); }

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}
.status-in_stock { background: rgba(39,174,96,0.1); color: var(--success); }
.status-out_of_stock { background: rgba(231,76,60,0.1); color: var(--danger); }
.status-low_stock { background: rgba(243,156,18,0.1); color: var(--warning); }
.status-out { background: rgba(52,152,219,0.1); color: var(--primary); }
.status-returned { background: rgba(39,174,96,0.1); color: var(--success); }
.status-overdue { background: rgba(231,76,60,0.1); color: var(--danger); }

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 16px;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 20px;
}
.pagination button {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}
.pagination button:hover { border-color: var(--primary); color: var(--primary); }
.pagination button.active { background: var(--primary); color: var(--white); border-color: var(--primary); }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Auth */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-box {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}
.auth-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--dark);
}

/* Toast */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 6px;
  color: var(--white);
  font-size: 0.9rem;
  z-index: 9999;
  animation: slideIn 0.3s ease;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Notifications */
.notification-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.notification-item.unread { background: rgba(52,152,219,0.05); }
.notification-item:last-child { border-bottom: none; }
.notification-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 6px;
  flex-shrink: 0;
}
.notification-content { flex: 1; }
.notification-title { font-weight: 600; font-size: 0.9rem; }
.notification-message { font-size: 0.85rem; color: var(--text-light); margin-top: 4px; }
.notification-time { font-size: 0.75rem; color: var(--gray); margin-top: 4px; }

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title { font-size: 1.4rem; font-weight: 700; }

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar .form-input, .toolbar .form-select {
  width: auto;
  min-width: 150px;
}

/* Grid layout */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* Responsive */
@media (max-width: 768px) {
  .navbar-inner { flex-wrap: wrap; }
  .nav-links { width: 100%; justify-content: center; margin-top: 8px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .table { font-size: 0.8rem; }
  .table th, .table td { padding: 6px 8px; }
  .page-header { flex-direction: column; align-items: flex-start; }
}
