:root {
  /* THE EMPEROR'S NEW THEME - HIGH END GLASSMORPHISM */
  --bg: #0f172a;
  /* Deep elegant dark blue */
  --bg-secondary: #1e293b;
  --glass-panel: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-highlight: rgba(255, 255, 255, 0.15);

  --primary: #6366f1;
  /* Indigo */
  --primary-light: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.5);

  --accent: #f43f5e;
  /* Rose */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --text: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(244, 63, 94, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.1) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  height: 100vh;
  overflow: hidden;
  /* Main scroll handled in content */
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: 0.3s;
}

a:hover {
  color: #fff;
  text-shadow: 0 0 8px var(--primary-glow);
}

/* --- Layout --- */
.sidebar {
  width: 260px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  z-index: 50;
}

.brand {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav a {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav a:hover {
  background: var(--glass-panel);
  color: #fff;
  transform: translateX(4px);
}

.nav a.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.2) 0%, transparent 100%);
  color: #fff;
  border-left: 3px solid var(--primary);
}

.sidebar footer {
  margin-top: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.content {
  margin-left: 260px;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--glass-border);
}

.main-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

/* --- Components --- */
h1,
h2,
h3,
h4 {
  margin: 0;
}

h2 {
  font-size: 2rem;
  margin-bottom: 24px;
  background: linear-gradient(to right, #fff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.card {
  background: var(--glass-panel);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: fadeIn 0.6s ease-out;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
  border-color: var(--glass-highlight);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.grid {
  display: grid;
  gap: 24px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid.cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* --- Stats --- */
.stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat .label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat .value {
  font-size: 2.5rem;
  font-weight: 700;
  color: #fff;
  margin-top: 8px;
  text-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

/* --- Tables --- */
table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 16px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--glass-border);
  font-weight: 600;
}

td {
  padding: 16px;
  border-bottom: 1px solid var(--glass-border);
  color: var(--text);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--glass-panel);
}

/* --- Form --- */
.input,
select,
button {
  width: 100%;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  transition: 0.3s;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23FFFFFF%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 0.65em auto;
  padding-right: 2.5rem;
}

select option {
  background: var(--bg-secondary);
  color: #fff;
}

.input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* --- Pagination --- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--glass-border);
}

.btn {
  background: var(--primary);
  border: none;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover {
  background: var(--primary-light);
  box-shadow: 0 0 15px var(--primary-glow);
}

.btn.secondary {
  background: transparent;
  border: 1px solid var(--glass-border);
}

.btn.secondary:hover {
  background: var(--glass-panel);
}

/* --- Badges --- */
.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge.success {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.badge.warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.badge.danger {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* --- Responsive --- */
@media (max-width: 992px) {
  .grid.cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid.cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {

  /* Sidebar slides out on mobile */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 280px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  /* Content takes full width */
  .content {
    margin-left: 0;
  }

  /* Stack all grids on mobile */
  .grid,
  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4 {
    grid-template-columns: 1fr !important;
  }

  /* Topbar adjustments */
  .topbar {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 12px;
  }

  /* Main scroll area padding */
  .main-scroll {
    padding: 16px;
  }

  /* Cards less padding */
  .card {
    padding: 16px;
  }

  /* Headings smaller */
  h2 {
    font-size: 1.5rem;
  }

  /* Stat values smaller */
  .stat .value {
    font-size: 1.8rem;
  }

  /* Tables scroll horizontally */
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  th,
  td {
    padding: 12px 10px;
    font-size: 0.9rem;
  }

  /* Form inputs bigger touch targets */
  .input,
  select,
  button {
    padding: 14px 16px;
    font-size: 1rem;
  }

  /* Pagination wraps */
  .pagination {
    flex-wrap: wrap;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .topbar {
    padding: 10px 12px;
  }

  .main-scroll {
    padding: 12px;
  }

  .card {
    padding: 12px;
    border-radius: var(--radius-md);
  }

  h2 {
    font-size: 1.3rem;
  }

  .stat .value {
    font-size: 1.5rem;
  }

  .stat .label {
    font-size: 0.8rem;
  }

  th,
  td {
    padding: 10px 8px;
    font-size: 0.85rem;
  }
}

/* --- Hamburger menu button --- */
.mobile-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text);
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 1.4rem;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
  }
}

/* --- Sidebar overlay --- */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
}

.sidebar-overlay.active {
  display: block;
}