.sidebar {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 30;

  width: 320px;
  min-width: 320px;
  height: 100vh;

  display: flex;
  flex-direction: column;
  gap: 22px;

  padding: 24px 18px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);

  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;

  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel-light);
}

.brand-logo {
  width: 54px;
  height: 54px;
  flex-shrink: 0;

  display: grid;
  place-items: center;

  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 14px 30px rgba(79, 70, 229, 0.35);
}

.brand h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.1;
}

.brand p {
  margin: 5px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.menu-title {
  padding: 0 10px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.6px;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.menu-item {
  position: relative;
  overflow: hidden;

  display: flex;
  align-items: center;
  gap: 16px;

  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;

  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.04);
  transition:
    transform 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    background 0.25s ease;
}

.menu-item::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: linear-gradient(90deg, rgba(79, 70, 229, 0.18), rgba(124, 58, 237, 0.18));
  transition: opacity 0.25s ease;
}

.menu-item:hover,
.menu-item.active {
  transform: translateX(6px);
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
}

.menu-item:hover::before,
.menu-item.active::before {
  opacity: 1;
}

.menu-icon,
.menu-text {
  position: relative;
  z-index: 1;
}

.menu-icon {
  width: 50px;
  min-width: 50px;
  height: 50px;

  display: grid;
  place-items: center;

  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
}

.menu-item.active .menu-icon {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.28);
}

.menu-text b {
  display: block;
  margin-bottom: 4px;
  font-size: 18px;
}

.menu-text span {
  font-size: 13px;
  color: var(--muted);
}

.sidebar-stats {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.04);
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);

  font-size: 14px;
  color: var(--muted);
}

.stat-row:first-of-type {
  padding-top: 0;
  border-top: none;
}

.stat-row strong {
  font-size: 15px;
  color: var(--text);
}

.mobile-menu-button,
.sidebar-overlay,
.sidebar-mobile-header {
  display: none;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

@media (max-width: 1180px) {
  .sidebar {
    width: 280px;
    min-width: 280px;
  }
}

@media (max-width: 960px) {
  .mobile-menu-button {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 45;

    width: 52px;
    height: 52px;

    display: grid;
    place-items: center;

    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(17, 24, 39, 0.92);
    color: var(--text);
    backdrop-filter: blur(14px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
    cursor: pointer;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 39;
    display: block;
    opacity: 0;
    pointer-events: none;
    background: rgba(3, 8, 20, 0.58);
    transition: opacity 0.25s ease;
  }

  .sidebar-overlay.show {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 40;

    width: min(320px, 88vw);
    min-width: 0;
    height: 100vh;

    transform: translateX(-100%);
    transition: transform 0.28s ease;

    border-right: 1px solid var(--line);
    border-bottom: none;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: -6px;
    padding: 0 4px;
  }

  .sidebar-mobile-header span {
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--muted);
  }

  .sidebar-close {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    cursor: pointer;
  }
}

@media (max-width: 640px) {
  .sidebar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .menu-item:hover,
  .menu-item.active {
    transform: none;
  }
}