.site-account {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.site-account[hidden] { display: none; }

.site-account__trigger {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.48rem;
  max-width: 15rem;
  padding: 0.45rem 0.7rem 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--page-text);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 780;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.site-account__trigger:hover,
.site-account[data-open="true"] .site-account__trigger {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.site-account__trigger:focus-visible,
.site-account__menu a:focus-visible,
.site-account__menu button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 42%, transparent);
  outline-offset: 2px;
}

.site-account__avatar {
  width: 1.7rem;
  height: 1.7rem;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--accent-dark);
}

.site-account__avatar svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.site-account__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-account__chevron {
  display: inline-flex;
  color: var(--muted-text);
}

.site-account__chevron svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.site-account__menu {
  position: absolute;
  z-index: 120;
  top: calc(100% + 0.55rem);
  right: 0;
  width: min(15rem, calc(100vw - 2rem));
  display: grid;
  gap: 0.2rem;
  padding: 0.45rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.site-account__menu[hidden] { display: none; }
.site-account__menu [hidden] { display: none; }

.site-account__menu a,
.site-account__menu button {
  min-height: 40px;
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 0;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--page-text);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.site-account__menu a:hover,
.site-account__menu button:hover {
  background: var(--surface-soft);
  color: var(--heading);
}

.site-account__menu-heading {
  margin: 0;
  padding: 0.55rem 0.7rem 0.65rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted-text);
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-account__status {
  margin: 0.2rem 0 0;
  padding: 0.55rem 0.7rem 0.2rem;
  border-top: 1px solid var(--line);
  color: var(--muted-text);
  font-size: 0.75rem;
  line-height: 1.4;
}

.site-account__menu button:disabled {
  opacity: 0.65;
  cursor: wait;
}

@media (max-width: 900px) {
  .header-actions .site-account {
    flex: 1 1 auto;
    min-width: 0;
  }

  .header-actions .site-account__trigger {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .header-actions .site-account__trigger {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-account__trigger { transition: none; }
}

/* Google profile photos use the same fallback icon on account surfaces. */
.site-account__avatar img, .account-profile-photo img { width:100%; height:100%; object-fit:cover; border-radius:50%; display:block; }
.site-account__avatar img[hidden], .account-profile-photo img[hidden] { display:none; }
.layout-header .site-account__avatar[data-has-picture] { width:32px; height:32px; box-shadow:0 0 0 2px var(--accent); }
.account-profile-photo { width:64px; height:64px; flex:0 0 64px; display:grid; place-items:center; border-radius:50%; background:var(--surface-soft); color:var(--accent-dark); }
.account-profile-photo svg { width:36px; height:36px; fill:none; stroke:currentColor; stroke-width:1.5; }
.account-profile-photo[data-has-picture] { box-shadow:0 0 0 2px var(--accent); }
.account-profile-summary { display:flex; align-items:center; gap:18px; }
@media(max-width:600px) { .account-profile-summary { align-items:flex-start; gap:12px; } }
