/* Header layout is intentionally independent of scrollable content tables. */
.topbar { background: #141414; border-bottom: 1px solid #2b2b2b; }
.topbar-inner {
  min-height: 76px;
  padding: 14px 48px;
  gap: 24px;
  flex-wrap: nowrap;
}
#nav {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  align-self: center;
  min-width: 0;
  min-height: 0;
  width: auto;
  gap: 4px;
  overflow: visible;
}
#nav a {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 11px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #a0a0a0;
  font-size: 13px;
  line-height: 20px;
  font-weight: 450;
  transition: background-color .12s, color .12s, border-color .12s;
}
#nav a:hover { background: #202020; color: #ededed; }
#nav a.active { background: #282828; border-color: #3a3a3a; color: #f3f3f3; }
.account-controls {
  flex: 0 0 auto;
  width: auto;
  order: 0;
  gap: 20px;
  padding: 0 0 0 24px;
  border-left: 1px solid #303030;
}
.account-btn { min-width: 0; padding: 7px 0; white-space: nowrap; }
#username { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  min-height: 40px;
  padding: 8px 12px;
  background: #222;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  color: #eee;
  font-size: 13px;
  line-height: 20px;
}
.menu-toggle:hover { background: #2a2a2a; border-color: #505050; }
.menu-toggle span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.menu-toggle svg { flex: none; color: #aaa; transition: transform .12s; }
.menu-toggle[aria-expanded=true] svg { transform: rotate(180deg); }

@media (max-width: 1280px) {
  .account-btn .muted { display: none; }
}
@media (max-width: 1100px) {
  .topbar-inner { min-height: 72px; padding: 14px 28px; gap: 12px 20px; flex-wrap: wrap; }
  .menu-toggle { display: flex; }
  .account-controls { margin-left: auto; border: 0; padding: 0; gap: 20px; }
  #nav { display: none; }
  #nav.is-open {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    flex: 1 0 100%;
    order: 1;
    width: 100%;
    padding: 8px;
    margin: 2px 0;
    background: #181818;
    border: 1px solid #303030;
    border-radius: 8px;
  }
  #nav a { min-height: 40px; justify-content: flex-start; }
}
@media (max-width: 540px) {
  .topbar-inner { padding: 12px 18px; min-height: 66px; gap: 10px 12px; }
  .menu-toggle { max-width: 160px; flex: 0 1 auto; }
  .account-controls { gap: 14px; }
  #username { max-width: 90px; }
  #nav.is-open { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  #nav a, .menu-toggle svg { transition: none; }
}
