:root {
  --bg: #0e1116;
  --panel: #161b22;
  --border: #2a2f3a;
  --text: #e5e7eb;
  --muted: #9aa3af;
  --accent: #3ba7ff;
}

* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* ================= SIDEBAR (DESKTOP) ================= */
nav {
  width: 270px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 24px;
  padding-top: 80px;
  position: fixed;
  top: 56px;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* Main navigation wrapper — grows to push LEGAL down */
.nav-main {
  flex: 1 1 auto;
}

/* ================= MAIN ================= */
main {
  flex: 1;
  padding: 40px;
  max-width: 900px;
  margin-top: 56px;
  margin-left: 270px; /* Offset for fixed sidebar */
}

h1 {
  font-size: 32px;
  margin-bottom: 32px;
}

h3 {
  font-size: 18px;
  margin-top: 28px;
  margin-bottom: 8px;
}

p,
li {
  line-height: 1.7;
  color: var(--muted);
}

ul {
  margin-left: 20px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ================= TOPBAR ================= */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #0b0f14;
  border-bottom: 1px solid #1f2630;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1000;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: contain;
  display: block;
}

.title {
  font-size: 15px;
  font-weight: 600;
  color: #e5e7eb;
}

.topbar-right {
  display: flex;
  gap: 10px;
}

.btn {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: #cbd5f5;
  border: 1px solid #2a2f3a;
  background: transparent;
  text-decoration: none;
}

.btn:hover {
  background: #1f2630;
  color: #ffffff;
}

.btn-primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.btn-primary:hover {
  background: #1d4ed8;
}

/* ================= SIDEBAR NAVIGATION ================= */
.nav-group {
  margin-bottom: 24px;
}

.nav-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #6b7280;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin: 2px 0;
  border-radius: 8px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}

.nav-link:hover {
  background: #1f2630;
  color: var(--text);
}

.nav-link.active {
  background: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
  font-weight: 500;
}

/* ================= MOBILE ================= */
.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: #e5e7eb;
  font-size: 22px;
  cursor: pointer;
}

@media (max-width: 768px) {
  body {
    flex-direction: column;
  }

  nav {
    position: fixed;
    top: 56px;
    left: -270px;
    width: 270px;
    height: calc(100vh - 56px);
    z-index: 999;
    padding: 24px;
    padding-top: 40px;
    overflow-y: auto;
    background: var(--panel);
    border-right: 1px solid var(--border);
    transition: left 0.25s ease;
    display: none;
  }

  nav.open {
    left: 0;
    display: flex;
  }

  /* Critical fix: prevent empty gap on mobile */
  .nav-main {
    flex: unset;
  }

  main {
    margin-left: 0;
    padding: 24px;
    max-width: 100%;
  }

  .topbar-right {
    display: none;
  }

  .menu-toggle {
    display: block;
  }

  .title {
    font-size: 14px;
    white-space: nowrap;
  }
}
/* ================= OVERLAY-STYLE SIDEBAR SCROLLBAR ================= */

/* Chrome, Edge, Safari */
nav::-webkit-scrollbar {
  width: 6px;
}

nav::-webkit-scrollbar-track {
  background: transparent; /* NO track */
}

nav::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.7); /* pure black feel */
  border-radius: 10px;
}

nav::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.9);
}

/* Firefox (best possible approximation) */
nav {
  scrollbar-width: thin;
  scrollbar-color: #000000 transparent;
}
