.site-header {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding: 0 12px;
  box-sizing: border-box;
  position: sticky;
  top: 0;
  z-index: 80;
  margin-bottom: 12px;
}

.site-header-inner {
  max-width: 860px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--surface-soft) 0%, var(--surface) 100%);
  box-shadow: var(--shadow-soft);
}

.site-header-toprow {
  display: flex;
  align-items: center;
}

.site-header-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.site-menu-toggle {
  display: none;
  border: 1px solid var(--line-strong);
  background: var(--surface-soft);
  border-radius: 6px;
  width: 40px;
  height: 34px;
  padding: 7px 9px;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
}

.site-header-actions {
  display: flex;
  flex-direction: column; /* Stack items vertically */
  align-items: flex-end;  /* Align everything to the right */
  gap: 8px; /* Adds breathing room between the profile and toggle */
}

/* --- REPLACED: Visual Toggle Button Styles --- */
.site-theme-toggle {
  display: inline-flex;
  align-items: center;
  padding: 0;
  width: 56px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  cursor: pointer;
  position: relative;
  transition: border-color 120ms ease, background 120ms ease;
}

.site-theme-toggle:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.site-theme-toggle-track {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px;
  position: relative;
}

.site-theme-toggle-icon {
  font-size: 13px;
  line-height: 1;
  user-select: none;
}

.site-theme-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand); /* Or var(--text-strong) */
  box-shadow: var(--shadow-soft);
  transition: transform 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
  z-index: 1;
}

/* Your JS adds .is-light to the button when light mode is active */
.site-theme-toggle.is-light .site-theme-toggle-thumb {
  transform: translateX(28px);
}

.site-menu-bar {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: var(--brand);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand-strong);
  text-decoration: none;
}

.site-brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
}

.site-brand-text {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.site-nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 33px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--text-strong);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-nav-link:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.site-nav-link.is-active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.site-header-account {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 34px;
  min-width: 190px;
}

.site-account-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}

.site-account-pill:hover {
  background: var(--surface);
  border-color: var(--line-strong);
}

.site-account-name {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-strong);
}

.site-account-name .site-account-team {
  font-weight: 500;
  color: var(--muted);
}

.site-header-auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: 0 8px 16px rgba(20, 100, 210, 0.24);
}

.site-header-auth-btn:hover {
  filter: brightness(0.97);
}

.site-account-skeleton {
  width: 190px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, var(--surface) 15%, var(--surface-soft) 45%, var(--surface) 85%);
  background-size: 220% 100%;
  animation: siteAccountPulse 1.1s linear infinite;
}

@keyframes siteAccountPulse {
  from {
    background-position: 0% 0;
  }
  to {
    background-position: 220% 0;
  }
}

@media (max-width: 760px) {
  .site-header-inner {
    margin-top: 10px;
    grid-template-columns: 1fr;
    align-items: center;
    gap: 8px;
    padding: 10px;
  }

  .site-header-toprow {
    justify-content: space-between;
  }

  .site-menu-toggle {
    display: inline-flex;
    flex-direction: column;
  }

  .site-header-panel {
    display: none;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
    border-top: 1px solid var(--line);
    padding-top: 10px;
  }

  .site-header-inner.is-open .site-header-panel {
    display: grid;
  }

  .site-nav {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .site-nav-link,
  .site-header-auth-btn,
  .site-account-pill {
    width: 100%;
    justify-content: center;
  }

  .site-header-account {
    min-width: 0;
    justify-content: stretch;
  }
}
