*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f3f4f6; color: #1f2937; min-height: 100vh; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: #1e293b; color: #e2e8f0; padding: 1.5rem 0; position: fixed; top: 0; bottom: 0; overflow-y: auto; z-index: 50; }
.sidebar-brand { padding: 0 1.5rem 1.5rem; border-bottom: 1px solid #334155; font-size: 1.25rem; font-weight: 700; }
.sidebar-nav { padding: 1rem 0; }
.sidebar-nav a { display: flex; align-items: center; gap: 0.625rem; padding: 0.625rem 1.5rem; color: #94a3b8; text-decoration: none; font-size: 0.875rem; transition: all 0.15s; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: #334155; color: #f1f5f9; }
.sidebar-nav .nav-section { padding: 0.5rem 1.5rem 0.25rem; font-size: 0.6875rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; margin-top: 0.75rem; }
.sidebar-user { padding: 1rem 1.5rem; border-top: 1px solid #334155; position: absolute; bottom: 0; width: 100%; font-size: 0.8125rem; }
.sidebar-user .name { color: #e2e8f0; font-weight: 500; }
.sidebar-user .email { color: #64748b; }
.main { margin-left: 240px; flex: 1; padding: 2rem; }

/* Mobile */
.mobile-header { display: none; background: #1e293b; color: white; padding: 0.75rem 1rem; position: fixed; top: 0; left: 0; right: 0; z-index: 40; }
.mobile-header button { background: none; border: none; color: white; font-size: 1.5rem; cursor: pointer; }
.mobile-header .brand { font-weight: 700; font-size: 1.125rem; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 45; }
.sidebar-overlay.active { display: block; }
.sidebar.mobile-open { display: block; }

/* Page elements */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 600; }
.card { background: white; border-radius: 0.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); padding: 1.5rem; margin-bottom: 1rem; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: white; border-radius: 0.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); padding: 1.25rem; }
.stat-label { font-size: 0.75rem; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500; }
.stat-value { font-size: 1.5rem; font-weight: 700; margin-top: 0.25rem; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th { text-align: left; padding: 0.75rem 1rem; border-bottom: 2px solid #e5e7eb; color: #6b7280; font-weight: 500; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
tbody td { padding: 0.75rem 1rem; border-bottom: 1px solid #f3f4f6; }
tbody tr:hover { background: #f9fafb; }

/* Badges */
.badge { display: inline-block; padding: 0.125rem 0.5rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 500; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-blue { background: #dbeafe; color: #1e40af; }

/* Buttons */
.btn { display: inline-flex; align-items: center; padding: 0.5rem 1rem; border-radius: 0.375rem; font-size: 0.875rem; font-weight: 500; cursor: pointer; border: none; transition: all 0.15s; text-decoration: none; }
.btn-primary { background: #2563eb; color: white; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success { background: #16a34a; color: white; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 0.25rem 0.625rem; font-size: 0.75rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.375rem; color: #374151; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #d1d5db; border-radius: 0.375rem; font-size: 0.875rem; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: 0.375rem; margin-bottom: 1rem; font-size: 0.875rem; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }

/* Misc */
.money { font-variant-numeric: tabular-nums; }
.empty-state { text-align: center; padding: 2rem 1rem; color: #6b7280; }
.empty-state p { font-size: 0.875rem; margin-bottom: 1rem; }
.progress-bar { background: #e5e7eb; border-radius: 9999px; height: 0.5rem; overflow: hidden; }
.progress-bar-fill { background: #16a34a; height: 100%; border-radius: 9999px; transition: width 0.3s; }
.progress-bar-fill.warning { background: #eab308; }

/* Login */
body.login { background: #1e293b; display: flex; align-items: center; justify-content: center; }
.login-card { background: white; border-radius: 0.75rem; box-shadow: 0 4px 6px rgba(0,0,0,0.3); padding: 2rem; width: 100%; max-width: 400px; margin: 1rem; }
.login-brand { text-align: center; margin-bottom: 1.5rem; font-size: 1.5rem; font-weight: 700; color: #1e293b; }

/* Charts */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.chart-card { padding: 1rem 1.25rem 1.25rem; }
.chart-header { margin-bottom: 0.75rem; }
.chart-header h3 { font-size: 0.9375rem; font-weight: 600; color: #111827; margin: 0 0 0.125rem; }
.chart-sub { font-size: 0.75rem; color: #9ca3af; margin: 0; }
.donut-wrap { position: relative; width: 160px; margin: 0 auto 0.5rem; }
.donut-label { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 1.375rem; font-weight: 700; color: #111827; pointer-events: none; }
.donut-legend { text-align: center; font-size: 0.75rem; color: #6b7280; }
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 3px; vertical-align: middle; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 1rem; padding-top: 4rem; }
  .mobile-header { display: flex; align-items: center; justify-content: space-between; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  table { font-size: 0.8125rem; }
  thead th, tbody td { padding: 0.5rem; }
  .hide-mobile { display: none !important; }
}
