:root {
  --primary: #1a5276;
  --primary-dark: #0e2f44;
  --primary-light: #2980b9;
  --accent: #27ae60;
  --accent-dark: #1e8449;
  --danger: #e74c3c;
  --warning: #f39c12;
  --info: #3498db;
  --dark: #2c3e50;
  --gray: #95a5a6;
  --light: #ecf0f1;
  --bg: #f0f2f5;
  --sidebar-width: 240px;
  --sidebar-collapsed: 60px;
  --header-height: 56px;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
  --shadow-lg: 0 4px 20px rgba(0,0,0,.12);
  --transition: .2s ease;
}

* { box-sizing: border-box; }

/* ── Base ── */
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  color: #333;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ── App Wrapper ── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: #fff;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: width var(--transition);
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  height: var(--header-height);
  padding: 0 20px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .5px;
  white-space: nowrap;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-brand .brand-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-size: 16px;
  font-weight: 800;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 4px; }

.sidebar-label {
  padding: 16px 20px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  opacity: .5;
  white-space: nowrap;
}

.sidebar-link {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  color: rgba(255,255,255,.7);
  text-decoration: none !important;
  white-space: nowrap;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  font-size: 13px;
}

.sidebar-link:hover {
  color: #fff;
  background: rgba(255,255,255,.08);
  border-left-color: var(--accent);
}

.sidebar-link.active {
  color: #fff;
  background: rgba(255,255,255,.12);
  border-left-color: var(--accent);
}

.sidebar-link .link-icon {
  width: 20px;
  margin-right: 12px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin var(--transition);
}

/* ── Topbar ── */
.topbar {
  height: var(--header-height);
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--dark);
  margin: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #666;
}

.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

/* ── Content Area ── */
.content-area {
  padding: 20px 24px;
  flex: 1;
}

/* ── Cards ── */
.card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.card-header {
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  padding: 14px 20px;
  font-weight: 600;
  font-size: 13px;
  color: var(--dark);
}

.card-body { padding: 20px; }

/* ── Stats Cards ── */
.stat-card {
  border-radius: var(--radius);
  padding: 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.stat-card .stat-icon {
  position: absolute;
  right: 16px;
  top: 16px;
  font-size: 40px;
  opacity: .15;
}

.stat-card .stat-label {
  font-size: 12px;
  opacity: .85;
  margin-bottom: 4px;
  font-weight: 500;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

.stat-card .stat-footer {
  font-size: 11px;
  opacity: .7;
  margin-top: 8px;
}

.stat-card.teal { background: linear-gradient(135deg, #1abc9c, #16a085); }
.stat-card.blue { background: linear-gradient(135deg, #3498db, #2980b9); }
.stat-card.purple { background: linear-gradient(135deg, #9b59b6, #8e44ad); }
.stat-card.orange { background: linear-gradient(135deg, #e67e22, #d35400); }
.stat-card.red { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.stat-card.green { background: linear-gradient(135deg, #27ae60, #1e8449); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }

.table {
  margin-bottom: 0;
  font-size: 13px;
}

.table thead th {
  background: #f8f9fa;
  color: var(--dark);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .3px;
  border-bottom: 2px solid #e8e8e8;
  white-space: nowrap;
  padding: 10px 12px;
}

.table td {
  padding: 10px 12px;
  vertical-align: middle;
  border-bottom: 1px solid #f0f0f0;
}

.table tbody tr:hover { background: #f8f9fa; }
.table-striped tbody tr:nth-of-type(odd) { background: #fafbfc; }
.table-striped tbody tr:nth-of-type(odd):hover { background: #f0f2f5; }

/* ── Forms ── */
.form-control {
  border-radius: 6px;
  border: 1px solid #d9d9d9;
  font-size: 13px;
  padding: 8px 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(41,128,185,.12);
}

.form-control-sm { padding: 6px 10px; font-size: 12px; }
.form-control-lg { padding: 10px 16px; font-size: 15px; }

.form-group label {
  font-weight: 600;
  font-size: 12px;
  color: #555;
  margin-bottom: 4px;
}

/* ── Buttons ── */
.btn {
  border-radius: 6px;
  font-size: 13px;
  padding: 8px 16px;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
}

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 10px 20px; font-size: 15px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 4px; }

.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-success { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-success:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; border-color: #c0392b; }

.btn-outline-secondary {
  color: #666;
  border-color: #d9d9d9;
  background: transparent;
}
.btn-outline-secondary:hover {
  background: #f5f5f5;
  border-color: #bbb;
  color: #333;
}

/* ── Alerts ── */
.alert {
  border: none;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
}

.alert-success { background: #d4edda; color: #155724; }
.alert-danger { background: #f8d7da; color: #721c24; }
.alert-info { background: #d1ecf1; color: #0c5460; }
.alert-warning { background: #fff3cd; color: #856404; }

/* ── Badges ── */
.badge {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 4px;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info { background: #d1ecf1; color: #0c5460; }

/* ── Action Links ── */
.action-link {
  color: var(--primary-light);
  text-decoration: none !important;
  font-size: 12px;
  margin: 0 4px;
}
.action-link:hover { color: var(--primary-dark); text-decoration: underline !important; }
.action-link.danger { color: var(--danger); }
.action-link.danger:hover { color: #c0392b; }
.action-link.success { color: var(--success); }
.action-link.success:hover { color: #27ae60; }

/* ── Login Page ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  overflow: hidden;
}

.login-header {
  padding: 32px 32px 0;
  text-align: center;
}

.login-logo {
  width: 56px;
  height: 56px;
  background: var(--accent);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 24px;
  font-weight: 800;
  color: #fff;
}

.login-header h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--dark);
  margin: 0 0 4px;
}

.login-header p {
  font-size: 13px;
  color: #888;
  margin: 0 0 24px;
}

.login-body { padding: 0 32px 32px; }

.login-body .form-control {
  height: 44px;
  font-size: 14px;
  padding-left: 14px;
}

.login-body .btn {
  height: 44px;
  font-size: 14px;
  font-weight: 600;
}

.login-footer {
  background: #f8f9fa;
  padding: 16px 32px;
  text-align: center;
  font-size: 11px;
  color: #999;
  border-top: 1px solid #eee;
}

/* ── Page Header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h4 {
  font-size: 18px;
  font-weight: 700;
  color: var(--dark);
  margin: 0;
}

.page-header .subtitle {
  font-size: 12px;
  color: #888;
  margin: 2px 0 0;
}

/* ── Filter Bar ── */
.filter-bar {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-bar .form-control { min-width: 200px; }

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: .3;
}

.empty-state p { font-size: 14px; margin: 0; }

/* ── Quick Actions ── */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { width: 0; }
  .sidebar.open { width: var(--sidebar-width); }
  .main-content { margin-left: 0; }
  .content-area { padding: 16px; }
  .topbar { padding: 0 16px; }
}

@media (max-width: 576px) {
  .content-area { padding: 12px; }
  .stat-card .stat-value { font-size: 22px; }
}
