.lab-header,
.auth-page {
  --header-ink: #202a26;
  --header-muted: #626f68;
  --header-paper: #f3f5f4;
  --header-moss: #28614c;
  --header-line: #d9dfdc;
  --header-focus: #3e8a71;
}

.lab-header {
  background: #fff;
  border-bottom: 1px solid var(--header-line);
  color: var(--header-ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.lab-header[hidden] { display: none; }

.lab-header-inner {
  min-height: 48px;
  padding: 0 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.lab-mark,
.lab-mark:hover {
  justify-self: start;
  white-space: nowrap;
  font-weight: 700;
  text-decoration: none;
  color: var(--header-ink);
}

.lab-mark span {
  display: inline-grid;
  place-items: center;
  margin-right: 6px;
  width: 25px;
  height: 25px;
  background: var(--header-moss);
  color: #fff;
  border-radius: 6px;
}

.lab-header--public .lab-header-inner {
  grid-template-columns: minmax(0, 1fr) auto;
}

.lab-header--login .lab-header-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 12px;
}

.lab-header--login .lab-mark {
  margin-block: 6px;
}

.lab-login-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.lab-sign-in,
.lab-sign-in:hover,
.lab-login-links a,
.lab-login-links a:hover {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--header-moss);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.lab-login-links a {
  padding-inline: 6px;
}

.lab-sign-in:hover,
.lab-login-links a:hover {
  background: var(--header-paper);
}

.lab-primary-nav {
  display: flex;
  justify-self: center;
  gap: 22px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  padding: 2px 0;
  white-space: nowrap;
  font-size: 12px;
}

.lab-primary-nav a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; color: var(--header-muted); }
.lab-primary-nav a[aria-current="page"], .lab-primary-nav a.active {
  color: var(--header-moss);
  font-weight: 700;
}

.lab-header .account-actions { min-width: 0; max-width: 100%; justify-self: end; }
.lab-header .account-menu { position: relative; z-index: 30; }

.lab-header .account-profile-link {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 4px;
  list-style: none;
  cursor: pointer;
  color: var(--header-ink);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
}

.lab-header .account-profile-link::-webkit-details-marker { display: none; }

.lab-header .account-profile-icon {
  flex: none;
  width: 30px;
  height: 30px;
  padding: 5px;
  border-radius: 50%;
  background: var(--header-paper);
  color: var(--header-moss);
}

.lab-header .account-name {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lab-header .account-menu-chevron { flex: none; transition: transform .15s ease; }
.lab-header .account-menu[open] .account-menu-chevron { transform: rotate(180deg); }

.lab-header .account-menu-panel {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  display: grid;
  gap: 2px;
  width: min(250px, calc(100vw - 24px));
  max-height: calc(100dvh - 64px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--header-line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 8px 24px #202a2626;
  font-size: 13px;
}

.lab-header .account-menu-panel a,
.lab-header .account-menu-panel button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--header-ink);
  text-align: left;
  text-decoration: none;
  font: inherit;
  letter-spacing: normal;
  text-transform: none;
}

.lab-header .account-menu-panel a:hover,
.lab-header .account-menu-panel a:focus-visible,
.lab-header .account-menu-panel button:hover,
.lab-header .account-menu-panel button:focus-visible {
  background: var(--header-paper);
}

.lab-header .account-menu-panel a[aria-current="page"] {
  color: var(--header-moss);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: .2em;
}

.lab-header .account-menu-panel form {
  margin: 4px 0 0;
  padding-top: 4px;
  border-top: 1px solid var(--header-line);
}

.lab-header :focus-visible {
  outline: 3px solid var(--header-focus);
  outline-offset: 3px;
}

.lab-primary-nav a:focus-visible { outline-offset: -2px; }

@media (max-width: 820px) {
  .lab-header-inner { padding: 0 12px; grid-template-columns: minmax(0, 1fr) auto; gap: 0 12px; }
  .lab-mark { grid-column: 1; grid-row: 1; margin-block: 8px; }
  .lab-header .account-actions { grid-column: 2; grid-row: 1; }
  .lab-primary-nav { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; flex-wrap: wrap; gap: 0 18px; padding: 0; border-top: 1px solid var(--header-line); font-size: 12px; overflow: visible; }
  .lab-primary-nav a { min-height: 44px; }
  .lab-header .account-name, .lab-header .account-menu-chevron { display: none; }
}
