/* ── Topbar navigation ─────────────────────────────────────────────────────── */

:root {
  --nav-h: 52px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
  padding: 0 20px;
  background: #0d1017;
  border-bottom: 1px solid #1e2433;
  gap: 16px;
}

.nav-left {
  flex-shrink: 0;
}

.nav-logo {
  font-family: 'Space Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #f4b942;
  text-decoration: none;
}
.nav-logo:hover { color: #ffd06b; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
}

.nav-link {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #8896aa;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.nav-link:hover  { color: #e2e8f0; background: #1a2030; }
.nav-link.active { color: #f4b942; background: rgba(244,185,66,0.08); }

.nav-link.nav-admin { color: #f87171; }
.nav-link.nav-admin:hover  { color: #fca5a5; background: rgba(248,113,113,0.08); }
.nav-link.nav-admin.active { color: #fca5a5; background: rgba(248,113,113,0.1); }

.nav-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #8896aa;
  text-decoration: none;
  padding: 5px 12px;
  border: 1px solid #2a3347;
  border-radius: 6px;
  margin-left: 4px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.nav-btn:hover { color: #e2e8f0; border-color: #4a5568; }

.nav-burger {
  display: none;
  background: none;
  border: none;
  color: #8896aa;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

/* ── Page body padding ─────────────────────────────────────────────────────── */
.page-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* ── Mobile ────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-burger { display: block; }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: #0d1017;
    border-bottom: 1px solid #1e2433;
    padding: 8px 0;
  }
  .nav-links.open { display: flex; }

  /* Подменю «Финансы» на мобильном */
  .nav-dropdown {
    display: block;
    width: 100%;
  }
  .nav-dropdown-menu {
    position: static;
    transform: none;
    box-shadow: none;
    border: none;
    border-radius: 6px;
    background: rgba(255,255,255,0.05);
    margin: 0;
    padding: 4px 0;
    min-width: unset;
    display: none;
  }
  .nav-dropdown.open .nav-dropdown-menu {
    display: block;
  }
  .nav-dropdown-trigger {
    cursor: pointer;
  }
  .nav-dropdown-item {
    padding: 8px 32px;
    font-size: 13px;
  }

  .nav-link, .nav-btn {
    width: 100%;
    padding: 11px 20px;
    border-radius: 0;
    border: none;
    margin: 0;
    font-size: 14px;
  }
  .nav-btn {
    border-top: 1px solid #1e2433;
    margin-top: 4px;
    padding-top: 12px;
  }
}

/* ── Nav Dropdown ── */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

/* Invisible bridge: covers the gap so hover isn't lost */
.nav-dropdown::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 8px;
  background: transparent;
}

.nav-dropdown-trigger {
  cursor: default;
  display: flex;
  align-items: center;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1d24;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 140px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 200;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-item {
  display: block;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  padding: 10px 16px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.nav-dropdown-item:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}
.nav-dropdown-item.active {
  color: var(--accent);
}
