/* Signed-in account menu: username button + dropdown (shared across site) */
.header-auth-signed-in {
  display: flex;
  align-items: center;
}

.header-account-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.header-account-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 0.4rem;
  max-width: 14rem;
  padding: 0.35rem 0.65rem !important;
  font-size: 0.875rem !important;
  font-weight: 500;
}

.header-account-btn .header-account-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.header-account-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.header-account-chevron {
  flex-shrink: 0;
  opacity: 0.75;
  transition: transform 0.2s ease;
}

.header-account-wrap.is-open .header-account-chevron {
  transform: rotate(180deg);
}

.header-account-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 15.5rem;
  max-width: min(18rem, calc(100vw - 1.5rem));
  padding: 0.5rem 0;
  background: var(--surface, #1a1a1f);
  border: 1px solid var(--border, #2a2a32);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  z-index: 300;
}

.header-account-menu.hidden {
  display: none !important;
}

.header-account-panel {
  padding: 0.35rem 0.75rem 0.55rem;
  border-bottom: 1px solid var(--border, #2a2a32);
  margin-bottom: 0.35rem;
}

.header-account-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.8125rem;
  padding: 0.35rem 0;
}

.header-account-stat-label {
  color: var(--muted, #71717a);
  flex-shrink: 0;
}

.header-account-stat-value {
  font-weight: 600;
  color: var(--text, #e4e4e7);
  text-align: right;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

.header-account-action {
  display: block;
  width: 100%;
  padding: 0.5rem 0.85rem;
  border: none;
  background: none;
  color: var(--text, #e4e4e7);
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  box-sizing: border-box;
}

.header-account-action:hover {
  background: rgba(255, 255, 255, 0.06);
}

a.header-account-action:hover {
  text-decoration: none;
}

.header-account-action-danger {
  color: #f87171;
}

.header-account-action-danger:hover {
  background: rgba(248, 113, 113, 0.12);
}

.header-account-theme {
  padding: 0.35rem 0.75rem 0.5rem;
  border-top: 1px solid var(--border, #2a2a32);
  margin-top: 0.25rem;
}

.header-account-theme-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #71717a);
  margin-bottom: 0.35rem;
}

.header-account-theme-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.header-account-pill {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.32rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border, #2a2a32);
  background: var(--bg, #0f0f12);
  color: var(--muted, #a1a1aa);
  cursor: pointer;
  font-family: inherit;
}

.header-account-pill:hover {
  border-color: #52525b;
  color: var(--text, #e4e4e7);
}

.header-account-pill.is-active {
  border-color: rgba(59, 130, 246, 0.65);
  background: rgba(59, 130, 246, 0.15);
  color: var(--text, #e4e4e7);
}

/* Light / system-light: menu contrast (variables already overridden on html) */
html[data-seedex-theme="light"] .header-account-menu,
html[data-seedex-theme="system-light"] .header-account-menu {
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(15, 23, 42, 0.06);
}

html[data-seedex-theme="light"] .header-account-action:hover,
html[data-seedex-theme="system-light"] .header-account-action:hover {
  background: rgba(0, 0, 0, 0.04);
}

html[data-seedex-theme="light"] .header-account-pill,
html[data-seedex-theme="system-light"] .header-account-pill {
  background: var(--bg, #f4f4f5);
}

html[data-seedex-theme="light"] .header-account-pill:hover,
html[data-seedex-theme="system-light"] .header-account-pill:hover {
  border-color: var(--border, #e4e4e7);
}

/* Legal footer: uses theme tokens so light/dark stay consistent (avoid inline link colors). */
/* Full-bleed under column flex `body`: avoid shrink-to-fit + align-items:start hugging the left edge. */
body:has(> footer.site-legal-footer) {
  align-items: stretch;
}

.site-legal-footer {
  flex-shrink: 0;
  align-self: stretch;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  padding: 1.25rem 1rem 1.75rem;
  font-size: 0.8125rem;
  color: var(--muted, #71717a);
  border-top: 1px solid var(--border, rgba(148, 163, 184, 0.2));
  background: var(--bg, transparent);
  /* Fallback when flex rules below don’t run (blocked sheet, older UA): inline <a> stay centered. */
  text-align: center;
}

.site-legal-footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}

.site-legal-footer-sep {
  color: var(--muted, #71717a);
  user-select: none;
}

.site-legal-footer a {
  color: var(--accent, #3b82f6);
  text-decoration: none;
}

.site-legal-footer a:hover {
  color: var(--accent-hover, #2563eb);
  text-decoration: underline;
}

.site-legal-footer a:visited {
  color: var(--accent, #3b82f6);
}
