/* Auth chrome: workspace + studio top bar */
.auth-chrome,
.auth-chrome__user,
.auth-user-menu {
  overflow: visible;
}
.auth-chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.auth-chrome--hydrating {
  opacity: 0.72;
  pointer-events: none;
}
.auth-chrome__guest {
  display: flex;
  align-items: center;
  gap: 8px;
}
.auth-chrome__user {
  position: relative;
  flex: 0 0 auto;
  align-self: center;
  min-width: 0;
  max-width: min(52vw, 300px);
  padding: 0;
  border: none;
  background: transparent;
  /* shrink-to-fit so the user chip is not stretched across the whole header */
  display: inline-flex;
  align-items: stretch;
}
.auth-user-menu {
  position: relative;
  z-index: 50;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  width: max-content;
  max-width: 100%;
}
.auth-user-menu__trigger {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 6px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  outline: none;
  transition: background 0.15s ease, border-color 0.15s ease;
  max-width: 100%;
}
/* When real avatar is shown, hide letter fallback (avoid two circles stacked) */
.auth-user-menu__trigger .auth-user-avatar:not([hidden]) ~ .auth-avatar-fallback {
  display: none !important;
}
.auth-user-menu:hover .auth-user-menu__trigger,
.auth-user-menu:focus-within .auth-user-menu__trigger {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(0, 219, 191, 0.28);
}
.auth-user-menu__dropdown {
  position: absolute;
  left: 50%;
  right: auto;
  top: calc(100% + 6px);
  width: 160px;
  min-width: 160px;
  max-width: min(160px, calc(100vw - 24px));
  padding: 6px 0;
  margin: 0;
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.08);
  z-index: 5000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  box-sizing: border-box;
  /* centered under the trigger (avatar + name) */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%) translateY(-4px);
  transition: opacity 0.14s ease, visibility 0.14s ease, transform 0.14s ease;
}
/* Invisible hit area so moving pointer from trigger to menu does not close the gap */
.auth-user-menu__dropdown::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 12px;
}
.auth-user-menu:hover .auth-user-menu__dropdown,
.auth-user-menu:focus-within .auth-user-menu__dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.auth-user-menu__item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  margin: 0;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  color: #3c4043;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  box-sizing: border-box;
  transition: background 0.12s ease;
  -webkit-appearance: none;
  appearance: none;
}
.auth-user-menu__item--link,
.auth-user-menu__item--link:visited {
  color: #3c4043;
}
.auth-user-menu__item--link:hover {
  background: #f1f3f4;
  color: #202124;
}
.auth-user-menu__item--signout {
  color: #d93025;
}
.auth-user-menu__item--signout:hover {
  background: #fce8e6;
  color: #c5221f;
}
.auth-user-menu__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
  color: #5f6368;
}
.auth-user-menu__icon .auth-menu-ico,
.auth-user-menu__icon > svg {
  width: 1rem;
  height: 1rem;
  display: block;
  flex-shrink: 0;
}
.auth-user-menu__item--signout .auth-user-menu__icon {
  color: #d93025;
}
.auth-chrome--studio .auth-user-menu__dropdown {
  width: 160px;
  min-width: 160px;
  max-width: min(160px, calc(100vw - 24px));
  margin-top: 6px;
  border-radius: 10px;
}
.auth-chrome--studio .auth-user-menu__item {
  padding: 8px 10px;
  font-size: 12px;
}
.auth-chrome--studio .auth-user-menu__trigger {
  padding: 3px 8px 3px 4px;
  border-radius: 8px;
  gap: 8px;
}
.auth-chrome__user[hidden],
.auth-chrome__guest[hidden] {
  display: none !important;
}
.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: filter 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  white-space: nowrap;
}
.auth-btn--ghost {
  border: 1px solid #333842;
  background: #171a20;
  color: #dce3ea;
}
.auth-btn--ghost:hover {
  border-color: rgba(0, 219, 191, 0.55);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(0, 219, 191, 0.12);
}
.auth-btn--primary {
  border: 1px solid #00b79f;
  background: linear-gradient(135deg, #00dbbf 0%, #00bfa6 100%);
  color: #03231d;
  box-shadow: 0 0 0 1px rgba(0, 219, 191, 0.2), 0 0 12px rgba(0, 219, 191, 0.12);
}
.auth-btn--primary:hover {
  filter: brightness(1.06);
  box-shadow: 0 0 0 1px rgba(0, 219, 191, 0.35), 0 0 14px rgba(0, 219, 191, 0.22);
}
/* Studio top bar: slightly shorter / tighter */
.auth-chrome--studio .auth-btn {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: 8px;
}
.auth-chrome--studio .auth-chrome__user {
  max-width: min(48vw, 260px);
  flex: 0 0 auto;
}
.auth-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.auth-avatar-fallback {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #03231d;
  background: linear-gradient(135deg, #00dbbf 0%, #1aafff 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.auth-chrome--studio .auth-user-avatar,
.auth-chrome--studio .auth-avatar-fallback {
  width: 28px;
  height: 28px;
}
.auth-username {
  font-size: 13px;
  font-weight: 600;
  color: #e8eaed;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-chrome--studio .auth-username {
  font-size: 12px;
  max-width: 100px;
}