:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #eef2ff;
  --sidebar-w: 260px;
  --topbar-h: 60px;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', -apple-system, sans-serif; background: var(--bg); color: var(--text); }

/* Sidebar */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w); background: #0f172a;
  display: flex; flex-direction: column;
  z-index: 1000; transition: transform .3s ease;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-icon { color: #818cf8; font-size: 24px; }
.brand-name { color: #f1f5f9; font-weight: 700; font-size: 14px; }
.brand-sub { color: #64748b; font-size: 11px; }
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; color: #94a3b8;
  text-decoration: none; font-size: 14px;
  transition: all .2s; border-left: 3px solid transparent;
}
.nav-item:hover { color: #f1f5f9; background: rgba(255,255,255,.05); }
.nav-item.active { color: #818cf8; background: rgba(99,102,241,.12); border-left-color: #818cf8; }
.nav-item i { font-size: 18px; width: 20px; }
.sidebar-footer {
  padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #4f46e5; color: white; display: flex;
  align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.user-info { flex: 1; overflow: hidden; }
.user-name { color: #f1f5f9; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: #64748b; font-size: 11px; }
.btn-logout { color: #64748b; font-size: 18px; text-decoration: none; }
.btn-logout:hover { color: #ef4444; }

/* Main */
.main-content { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; height: var(--topbar-h);
  background: white; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; z-index: 100;
}
.sidebar-toggle { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); display: none; }
.topbar-title { font-weight: 600; font-size: 16px; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.notif-btn { position: relative; color: var(--text-muted); font-size: 20px; text-decoration: none; }
.notif-btn:hover { color: var(--primary); }
.notif-badge {
  position: absolute; top: -4px; right: -6px;
  background: var(--danger); color: white;
  font-size: 10px; font-weight: 700; min-width: 16px; height: 16px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 3px;
}
.content-area { flex: 1; padding: 24px; }

/* Cards */
.card { border: 1px solid var(--border); border-radius: 12px; background: var(--card-bg); box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 600; background: transparent; }
.card-body { padding: 20px; }

/* Stat cards */
.stat-card {
  background: white; border: 1px solid var(--border);
  border-radius: 12px; 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: 22px; flex-shrink: 0;
}
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.green  { background: #d1fae5; color: #059669; }
.stat-icon.blue   { background: #dbeafe; color: #2563eb; }
.stat-icon.orange { background: #ffedd5; color: #ea580c; }
.stat-icon.red    { background: #fee2e2; color: #dc2626; }
.stat-icon.teal   { background: #ccfbf1; color: #0d9488; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text); }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Tables */
.table { margin: 0; }
.table th { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.table td { vertical-align: middle; font-size: 14px; }
.table-hover tbody tr:hover { background: #f8fafc; }

/* Forms */
.form-label { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-control, .form-select { border: 1px solid var(--border); border-radius: 8px; font-size: 14px; padding: 9px 12px; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }

/* Buttons */
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn { border-radius: 8px; font-size: 14px; font-weight: 500; padding: 8px 16px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h4 { font-weight: 700; font-size: 20px; margin: 0; }

/* Status badges */
.badge { font-size: 11px; font-weight: 600; padding: 4px 8px; border-radius: 6px; }

/* Progress */
.progress { border-radius: 4px; height: 6px; background: #e2e8f0; }
.progress-bar { border-radius: 4px; background: var(--primary); }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 48px; opacity: .3; margin-bottom: 12px; display: block; }

/* Alert */
.alert { border-radius: 10px; border: none; font-size: 14px; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .content-area { padding: 16px; }
}

/* Invoice print */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .content-area { padding: 0 !important; }
  body { background: white !important; }
  .invoice-box { box-shadow: none !important; border: none !important; }
}

/* Login page */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%); }
.login-card { background: white; border-radius: 20px; padding: 40px; width: 100%; max-width: 420px; }
.login-logo { font-size: 28px; font-weight: 800; color: var(--primary); margin-bottom: 4px; }
.login-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 30px; }

/* Avatar */
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: white; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }

/* Divider */
.section-divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
