:root {
  --ink: #13151a;
  --muted: #6b7280;
  --brand: #0f4c81;
  --surface: #f4f6f9;
  --card: #ffffff;
  --sidebar: #091521;
  --sidebar-text: #d2d8e1;
  --accent: #f4b740;
  --glow: rgba(244, 183, 64, 0.18);
}

body {
  font-family: "Poppins", "Segoe UI", sans-serif;
  background: var(--surface);
  color: var(--ink);
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 260px;
  background: radial-gradient(circle at top, rgba(36, 66, 98, 0.75), rgba(9, 21, 33, 1));
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  transition: transform 0.35s ease, width 0.35s ease;
  position: relative;
  z-index: 1041;
}

.app-sidebar.collapsed {
  width: 86px;
}

.app-sidebar-brand {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent);
  color: #1a1a1a;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.brand-text {
  font-weight: 600;
  line-height: 1.1;
}

.app-sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 18px 24px;
}

.menu-item {
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--sidebar-text);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.menu-item:hover,
.menu-item.active {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transform: translateX(4px);
  box-shadow: 0 8px 20px rgba(2, 8, 23, 0.25);
}

.icon-badge {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 16px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.badge-blue { background: linear-gradient(135deg, #1d4ed8, #38bdf8); }
.badge-cyan { background: linear-gradient(135deg, #06b6d4, #22d3ee); }
.badge-green { background: linear-gradient(135deg, #16a34a, #4ade80); }
.badge-gold { background: linear-gradient(135deg, #f59e0b, #fde68a); color: #1b1b1b; }
.badge-teal { background: linear-gradient(135deg, #0f766e, #5eead4); }
.badge-red { background: linear-gradient(135deg, #ef4444, #fb7185); }
.form-control,
textarea.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10z'/%3E%3Cpath d='M11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  padding-left: 38px;
}

.form-select {
  background-image: var(--bs-form-select-bg-img), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10z'/%3E%3Cpath d='M11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center, 12px center;
  padding-left: 38px;
}

.app-sidebar.collapsed .brand-text,
.app-sidebar.collapsed #sidebarSearch,
.app-sidebar.collapsed .menu-text {
  display: none;
}

.app-sidebar.collapsed .app-sidebar-brand {
  justify-content: center;
}

.app-sidebar.collapsed .app-sidebar-menu {
  padding: 12px 10px 24px;
}

.app-sidebar.collapsed .menu-item {
  justify-content: center;
}

.app-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 15, 26, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 1040;
}

.app-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 12px 30px rgba(2, 8, 23, 0.2);
}

.app-topbar .navbar-brand,
.app-topbar .btn,
.app-topbar .form-control {
  color: #ffffff;
}

.app-search {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
}

.app-search::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.stat-card {
  border: none;
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(244, 183, 64, 0.2), transparent 60%);
  opacity: 0.6;
  pointer-events: none;
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 20px;
  color: #fff;
}

.chart-card {
  border-radius: 18px;
  border: none;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.chart-card canvas {
  max-height: 300px;
}

.table thead th {
  background: #f0f3f8;
}

/* Mobile Optimizations */
@media (max-width: 991px) {
  .app-shell {
    flex-direction: column;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .app-main {
    margin-left: 0;
  }
}

/* Mobile Stat Cards */
@media (max-width: 767px) {
  .stat-card {
    padding: 0.75rem !important;
  }
  
  .stat-card .fs-4 {
    font-size: 1.25rem !important;
  }
  
  .stat-card .fs-5 {
    font-size: 1.1rem !important;
  }
  
  .stat-card .fs-6 {
    font-size: 0.95rem !important;
  }
  
  .stat-card .small {
    font-size: 0.75rem !important;
  }
  
  .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  
  .chart-card {
    padding: 0.75rem !important;
  }
  
  .chart-card canvas {
    max-height: 220px !important;
  }
  
  .app-topbar .btn-sm {
    padding: 0.35rem 0.6rem;
    font-size: 0.875rem;
  }
  
  .app-topbar .badge {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
  }
  
  h3.fw-semibold {
    font-size: 1.5rem;
  }
  
  .table {
    font-size: 0.85rem;
  }
  
  .table th, .table td {
    padding: 0.5rem 0.35rem;
  }
}

/* Extra Small Mobile Devices */
@media (max-width: 575px) {
  .container-fluid {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  
  .stat-card {
    padding: 0.65rem !important;
  }
  
  .stat-card .fs-6 {
    font-size: 0.85rem !important;
  }
  
  .chart-card .fw-semibold {
    font-size: 0.9rem;
  }
  
  .badge {
    font-size: 0.7rem !important;
    padding: 0.25rem 0.45rem !important;
  }
}

/* Tablet Optimizations */
@media (min-width: 768px) and (max-width: 991px) {
  .stat-card {
    padding: 1rem !important;
  }
  
  .chart-card canvas {
    max-height: 260px;
