.navbar {
  grid-area: navbar;
  background: #1a1a1a;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 1.75rem 1.25rem;
  gap: 2rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

/* ---- Brand: logo + name side by side ---- */
.navbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  text-decoration: none;
  min-width: 0;
}

/* Reserved square space for the logo */
.navbar-logo {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  background: #2a2a2a;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.navbar-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.navbar-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Links (vertical on desktop) ---- */
.navbar-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.navbar-links a {
  display: block;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  color: #ccc;
  text-decoration: none;
  font-size: 1rem;
  transition: background 0.2s, color 0.2s;
}

.navbar-links a:hover,
.navbar-links a.active {
  background: #2a2a2a;
  color: #fff;
}

/* ---- Sidebar footer note ---- */
.navbar-footer {
  margin-top: auto;
  color: #666;
  font-size: 0.85rem;
}

.navbar-footer p { margin: 0; }

/* ---- Hamburger button ---- */
.navbar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 5px;
  justify-content: center;
  align-items: center;
  flex: 0 0 auto;
}

.navbar-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.2s;
}

.navbar-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.navbar-toggle.open span:nth-child(2) { opacity: 0; }
.navbar-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ===== MOBILE / TABLET ===== */
@media (max-width: 1024px) {
  .navbar {
    /* Reset the desktop sidebar behavior */
    flex-direction: column;
    height: auto;
    padding: 0.9rem 1rem;
    gap: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    overflow: visible;
  }

  .navbar-top {
    width: 100%;
  }

  .navbar-toggle { display: flex; }

  /* Full-width dropdown */
  .navbar-links {
    flex-direction: column;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, margin-top 0.2s;
    margin-top: 0;
    gap: 0;
  }

  .navbar-links.open {
    max-height: 500px;
    margin-top: 0.75rem;
  }

  .navbar-links a {
    padding: 0.85rem 0.5rem;
    border-radius: 6px;
    border-bottom: 1px solid #2a2a2a;
  }

  .navbar-links li:last-child a { border-bottom: none; }

  .navbar-footer { display: none; }
}

/* Very small phones */
@media (max-width: 420px) {
  .navbar-name { font-size: 1.1rem; }
  .navbar-logo { width: 38px; height: 38px; flex-basis: 38px; }
}