/* Shared account menu (top-right header slot) */

.am-root {
  position: relative;
  margin-left: 14px;
  flex-shrink: 0;
}

.am-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 220px;
  padding: 4px 8px 4px 4px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.am-trigger:hover,
.am-trigger[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(232, 197, 71, 0.45);
}

.am-trigger:focus-visible {
  outline: 2px solid var(--chalk, #E8C547);
  outline-offset: 2px;
}

.am-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  background: var(--pitch-bright, #1A6B43);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  overflow: hidden;
}

.am-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.am-name {
  font-family: 'Geist', system-ui, sans-serif;
  font-size: 0.86rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.am-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: transform 0.15s ease;
}

.am-trigger[aria-expanded="true"] .am-chevron {
  transform: rotate(180deg);
  opacity: 1;
}

.am-signin {
  display: inline-flex;
  align-items: center;
  margin-left: 14px;
  color: rgba(255, 255, 255, 0.72);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
}

.am-signin:hover {
  color: var(--chalk, #E8C547);
  text-decoration: none;
}

/* Light header pages (paper / cream backgrounds) */
.am-root[data-am-theme="light"] .am-trigger {
  border-color: rgba(15, 14, 12, 0.12);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink, #0F0E0C);
}

.am-root[data-am-theme="light"] .am-trigger:hover,
.am-root[data-am-theme="light"] .am-trigger[aria-expanded="true"] {
  background: #fff;
  border-color: rgba(14, 74, 45, 0.35);
}

.am-root[data-am-theme="light"] .am-name {
  color: var(--ink, #0F0E0C);
}

.am-root[data-am-theme="light"] .am-chevron {
  opacity: 0.65;
  color: var(--ink-soft, #4C4944);
  stroke: currentColor;
}

.am-root[data-am-theme="light"] .am-signin {
  color: var(--ink-soft, #4C4944);
}

.am-root[data-am-theme="light"] .am-signin:hover {
  color: var(--pitch, #0E4A2D);
}

.am-root[data-am-theme="light"] .am-skel {
  background: rgba(15, 14, 12, 0.1);
}

.am-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(300px, calc(100vw - 24px));
  background: var(--card, #fff);
  color: var(--ink, #14171C);
  border: 1px solid var(--rule, #E4DFD4);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(6, 36, 20, 0.18), 0 2px 6px rgba(6, 36, 20, 0.06);
  padding: 8px;
  z-index: 80;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
}

.am-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.am-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 12px;
}

.am-identity .am-avatar {
  width: 40px;
  height: 40px;
  font-size: 0.82rem;
}

.am-identity-text {
  min-width: 0;
  flex: 1;
}

.am-identity-name {
  font-family: 'Geist', system-ui, sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink, #14171C);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.am-identity-email {
  font-size: 0.78rem;
  color: var(--ink-soft, #5A5F68);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.am-divider {
  height: 1px;
  background: var(--rule-soft, #EFEAE0);
  margin: 4px 6px;
}

.am-section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint, #9AA0A8);
  padding: 8px 10px 4px;
}

.am-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--ink, #14171C);
  font-family: 'Geist', system-ui, sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s ease;
}

.am-item:hover {
  background: var(--rule-soft, #EFEAE0);
  text-decoration: none;
  color: var(--ink, #14171C);
}

.am-item:focus-visible {
  outline: 2px solid var(--pitch-bright, #1A6B43);
  outline-offset: -2px;
}

.am-item.is-danger {
  color: #8B2E2E;
}

.am-item.is-danger:hover {
  background: #F8EAEA;
  color: #8B2E2E;
}

.am-item-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.55;
}

.am-skel {
  width: 120px;
  height: 36px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  animation: am-pulse 1.1s ease-in-out infinite;
}

@keyframes am-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@media (max-width: 720px) {
  .am-name {
    display: none;
  }

  .am-trigger {
    padding: 4px;
    gap: 0;
  }

  .am-chevron {
    display: none;
  }

  .am-skel {
    width: 36px;
  }
}
