:root {
  --shell-ink: #252525;
  --shell-muted: #7a746d;
  --shell-line: rgba(18, 24, 22, .08);
  --shell-accent: #c6a15b;
  --shell-accent-dark: #8a6a32;
  --shell-warm: #c6a15b;
  --shell-warm-line: rgba(198, 161, 91, .42);
  --shell-radius: 8px;
  --shell-inner: inset 0 1px 0 rgba(255,255,255,.82);
}

.v5-shell-topbar,
.v5-topbar.v5-shell-topbar,
.topbar.v5-shell-topbar,
.admin-topbar.v5-shell-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid !important;
  grid-template-columns: 260px minmax(0, 1fr) 150px;
  align-items: center;
  justify-content: initial;
  gap: 24px;
  padding: 14px clamp(20px, 4vw, 56px);
  border-bottom: 1px solid var(--shell-line);
  background: rgba(248, 245, 239, .88);
  box-shadow: 0 10px 34px rgba(37,37,37,.045);
  backdrop-filter: blur(22px) saturate(1.08);
}

.v5-shell-topbar .brand {
  display: inline-flex;
  grid-column: 1;
  align-items: center;
  gap: 12px;
  width: 260px;
  min-width: 0;
  color: var(--shell-ink);
  text-decoration: none;
}

.v5-shell-topbar .brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: var(--shell-radius);
  background: linear-gradient(145deg, #252525, #4a423a);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 12px 26px rgba(37,37,37,.18);
}

.v5-shell-topbar .brand-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  max-width: 194px;
}

.v5-shell-topbar .brand strong,
.v5-shell-topbar .brand small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v5-shell-topbar .brand strong {
  font-size: 17px;
  line-height: 1.12;
}

.v5-shell-topbar .brand small {
  color: var(--shell-muted);
  font-size: 12px;
  font-weight: 750;
}

.v5-shell-topbar nav,
.v5-topbar.v5-shell-topbar nav,
.topbar.v5-shell-topbar nav,
.admin-topbar.v5-shell-topbar nav {
  display: flex;
  grid-column: 2;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  flex: none;
  min-width: 0;
  margin: 0;
  padding: 0;
  color: var(--shell-muted);
  font-size: 14px;
  font-weight: 750;
}

.v5-shell-topbar nav a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--shell-radius);
  color: inherit;
  text-decoration: none;
  font-size: 14px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
  transform: none;
  transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease;
}

.v5-shell-topbar nav a:hover,
.v5-shell-topbar nav a.active,
.v5-shell-topbar nav a[aria-current="page"] {
  border-color: var(--shell-line);
  background: rgba(255,255,255,.72);
  color: var(--shell-ink);
  transform: none;
}

.v5-shell-account,
.v5-shell-topbar .account-pill,
.account-pill.v5-shell-account,
.v5-account-pill.v5-shell-account,
.admin-account-pill.v5-shell-account {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  grid-column: 3;
  min-height: 42px;
  width: 150px;
  min-width: 0;
  padding: 0 14px;
  border: 1px solid var(--shell-line);
  border-radius: var(--shell-radius);
  background: rgba(255,255,255,.82);
  color: var(--shell-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: var(--shell-inner);
  justify-self: end;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v5-shell-account:hover,
.v5-shell-account.is-logged-in,
.v5-shell-account.is-current,
.v5-shell-account[aria-current="page"] {
  border-color: var(--shell-warm-line);
  color: var(--shell-warm);
}

.auth-dialog,
.admin-auth-dialog {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  max-height: calc(100dvh - 32px);
  margin: auto;
  overflow: auto;
  border-radius: var(--shell-radius);
}

.auth-dialog *,
.v5-auth-dialog *,
.admin-auth-dialog * {
  box-sizing: border-box;
}

.auth-dialog .login-form,
.v5-auth-dialog .login-form {
  display: grid;
  grid-template-columns: 1fr !important;
  align-items: stretch;
  gap: 12px;
  width: 100%;
}

.auth-dialog .login-form .code-row,
.v5-auth-dialog .login-form .code-row,
.login-form .code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 10px;
  width: 100%;
}

.auth-dialog .login-form .code-row input,
.v5-auth-dialog .login-form .code-row input,
.login-form .code-row input {
  min-width: 0;
}

.auth-dialog .login-form .code-row button,
.v5-auth-dialog .login-form .code-row button {
  grid-column: auto !important;
  width: 100%;
}

.auth-dialog .login-form > button[type="submit"],
.v5-auth-dialog .login-form > button[type="submit"] {
  grid-column: 1 / -1;
  width: 100%;
}

.login-form button.secondary {
  min-height: 44px;
  border: 1px solid var(--shell-line);
  background: rgba(255,255,255,.9);
  color: var(--shell-ink);
  box-shadow: var(--shell-inner);
}

.login-form button:disabled {
  cursor: not-allowed;
  opacity: .58;
}

@media (max-width: 920px) {
  .v5-shell-topbar,
  .v5-topbar.v5-shell-topbar,
  .topbar.v5-shell-topbar,
  .admin-topbar.v5-shell-topbar {
    grid-template-columns: minmax(0, 1fr) 132px;
    align-items: flex-start;
    padding: 16px 20px;
  }

  .v5-shell-topbar .brand {
    grid-column: 1;
    width: auto;
  }

  .v5-shell-topbar .brand-copy {
    max-width: min(48vw, 220px);
  }

  .v5-shell-topbar nav,
  .v5-topbar.v5-shell-topbar nav,
  .topbar.v5-shell-topbar nav,
  .admin-topbar.v5-shell-topbar nav {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .v5-shell-topbar nav::-webkit-scrollbar,
  .v5-topbar.v5-shell-topbar nav::-webkit-scrollbar,
  .topbar.v5-shell-topbar nav::-webkit-scrollbar,
  .admin-topbar.v5-shell-topbar nav::-webkit-scrollbar {
    display: none;
  }

  .v5-shell-topbar nav a,
  .v5-topbar.v5-shell-topbar nav a,
  .topbar.v5-shell-topbar nav a,
  .admin-topbar.v5-shell-topbar nav a {
    flex: 0 0 auto;
  }
}

@media (max-width: 640px) {
  .v5-shell-topbar .brand {
    min-width: 0;
  }

  .v5-shell-topbar,
  .v5-topbar.v5-shell-topbar,
  .topbar.v5-shell-topbar,
  .admin-topbar.v5-shell-topbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .v5-shell-account {
    grid-column: 1;
    justify-self: stretch;
    width: 100%;
  }

  .auth-dialog .login-form .code-row,
  .v5-auth-dialog .login-form .code-row,
  .login-form .code-row {
    grid-template-columns: 1fr;
  }
}
