:root {
  --bg-base: #0b0f17;
  --bg-surface: #121824;
  --bg-elevated: #1a2234;
  --bg-hover: #222d44;
  --border-subtle: #232e42;
  --border-focus: #3b82f6;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --accent-500: #3b82f6;
  --accent-600: #2563eb;
  --accent-400: #60a5fa;
  --success-500: #10b981;
  --success-600: #059669;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  --error-500: #ef4444;
  --error-600: #dc2626;
  --critical-500: #b91c1c;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --sp-8: 32px;
  --fs-2xs: 11px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-size: var(--fs-base);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent-400); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-brand {
  padding: var(--sp-4);
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.sidebar-brand__mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-500), #8b5cf6);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 16px;
}
.sidebar-brand__title { font-weight: 700; font-size: var(--fs-md); }
.sidebar-brand__sub { font-size: var(--fs-2xs); color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; }

.sidebar-nav { padding: var(--sp-3); flex: 1; overflow-y: auto; }
.sidebar-section { margin-bottom: var(--sp-4); }
.sidebar-section__label {
  font-size: var(--fs-2xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  margin-bottom: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: all 0.15s ease;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.nav-item.active { background: rgba(59, 130, 246, 0.15); color: var(--accent-400); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.main-col { flex: 1; display: flex; flex-direction: column; overflow-x: hidden; }
.topbar {
  height: 60px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-6);
}
.topbar-left { display: flex; align-items: center; gap: var(--sp-3); }
.breadcrumb { font-size: var(--fs-sm); color: var(--text-tertiary); display: flex; gap: 6px; }
.breadcrumb .sep { color: var(--border-subtle); }
.topbar-right { display: flex; align-items: center; gap: var(--sp-4); }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px;
  height: 32px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  font-weight: 600;
}
.topbar-user__name { font-size: var(--fs-sm); font-weight: 600; }
.topbar-user__role { font-size: var(--fs-2xs); color: var(--text-tertiary); }

.main-content { padding: var(--sp-6); flex: 1; }

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-6);
  overflow: hidden;
}
.card-header {
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: var(--fs-md); font-weight: 600; }
.card-body { padding: var(--sp-6); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: all 0.15s ease;
}
.btn-primary { background: var(--accent-500); color: #fff; }
.btn-primary:hover { background: var(--accent-600); }
.btn-secondary { background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border-subtle); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-sm { padding: 4px 10px; font-size: var(--fs-xs); }
.btn-danger { background: var(--error-600); color: #fff; }

.table-responsive { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; text-align: left; font-size: var(--fs-sm); }
.table th { padding: 10px 14px; color: var(--text-tertiary); font-size: var(--fs-xs); text-transform: uppercase; border-bottom: 1px solid var(--border-subtle); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border-subtle); color: var(--text-primary); }
.table tr:hover td { background: var(--bg-hover); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: var(--fs-2xs);
  font-weight: 600;
  text-transform: uppercase;
}
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success-500); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning-500); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--error-500); }
.badge-info { background: rgba(59, 130, 246, 0.15); color: var(--accent-400); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-6); }
.stat-card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--r-md); padding: var(--sp-4); }
.stat-card__label { font-size: var(--fs-xs); color: var(--text-tertiary); margin-bottom: 4px; }
.stat-card__value { font-size: var(--fs-2xl); font-weight: 700; }
.stat-card__sub { font-size: var(--fs-2xs); color: var(--text-secondary); margin-top: 4px; }
