/* ==========================================================================
   Orcheum · Workspace top-right actions + account menu
   Source of truth: Figma nodes 576:1800 (Share + Avatar), 580:2100 (menu).

   There is no navbar in this design: the wordmark moved into the sidebar
   (workspace-sidebar.css) and these two controls float over main's top-right
   corner, positioned by .ws-topbar in workspace-shell.css. The bar, the
   breadcrumb and the .ws-brand* lockup that used to live here are gone with it.
   ========================================================================== */

.ws-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-8);
  background: var(--color-button-secondary-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  font-family: var(--font-sans);
  font-weight: var(--font-weight-medium);
  font-size: 12px;
  line-height: 1.3;
  color: var(--color-foreground);
  white-space: nowrap;
  cursor: pointer;
  transition: filter var(--duration-base, 0.2s) var(--ease-standard, ease),
    background var(--duration-base, 0.2s) var(--ease-standard, ease);
}
.ws-share:hover { filter: brightness(0.98); background: rgba(213, 218, 220, 0.8); }
.ws-share:active { filter: brightness(0.95); }

.ws-avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  background: var(--color-avatar);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  font-family: var(--font-sans);
  font-weight: var(--font-weight-medium);
  font-size: 12px;
  line-height: 1.3;
  color: var(--color-foreground);
  cursor: pointer;
  overflow: hidden;
  transition: filter var(--duration-base, 0.2s) var(--ease-standard, ease);
}
.ws-avatar:hover { filter: brightness(1.04); }
.ws-avatar:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--color-background),
    0 0 0 4px var(--color-puddle-700, #f97d24);
}
.ws-avatar__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 7px;
}
.ws-avatar.has-image {
  padding: 0;
  min-width: 30px;
  width: 30px;
}
.ws-avatar.has-image .ws-avatar__initials { display: none; }

/* ---- Profile dropdown (Figma 580:2100) ---- */
.ws-account {
  position: relative;
  flex-shrink: 0;
}

.ws-account-menu[hidden] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.ws-account-menu {
  /* Anchored under the avatar via JS (fixed + getBoundingClientRect).
     Avoids absolute/overflow containing-block bugs that pinned the menu
     to the bottom of .ws. Gap to avatar: 8–10px. */
  position: fixed;
  top: 0;
  right: 0;
  left: auto;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Figma spaces the rows with explicit gaps, but our rows carry 8px of
     vertical padding so they have a hover surface. Each child pays that
     8px back through its own margin-top, so the *text* lands exactly
     where Figma puts it. Hence gap: 0 here. */
  gap: 0;
  width: 249px;
  max-width: min(249px, calc(100vw - 16px));
  padding: 13px 0 6px; /* Figma pb 14px minus the sign-out row's 8px overhang */
  border: 0;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 3px 20px -8px rgba(0, 0, 0, 0.1);
  overflow: visible;
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity 130ms cubic-bezier(0.32, 0.72, 0, 1),
    transform 130ms cubic-bezier(0.32, 0.72, 0, 1);
}
.ws-account-menu.is-open {
  visibility: visible;
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0);
}

/* The panel's rows are all inset 5px from the panel edge (Figma: 239 in 249). */
.ws-account-menu__identity {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: calc(100% - 10px);
  padding-left: 2px;
  box-sizing: border-box;
}

.ws-account-menu__face {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 24px;
  padding: 0 5px;
  border-radius: 5px;
  background: var(--color-avatar);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  overflow: hidden;
  font-family: var(--font-sans);
  font-weight: var(--font-weight-medium);
  font-size: 10px;
  line-height: 1.3;
  color: #24252d;
}
.ws-account-menu__face.has-image {
  padding: 0;
}
.ws-account-menu__face.has-image .ws-avatar__initials { display: none; }
.ws-account-menu__face .ws-avatar__img {
  border-radius: 5px;
}

.ws-account-menu__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  width: 108px;
  flex: 1 1 auto;
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: -0.03em;
  color: #24252d;
}

.ws-account-menu__name {
  font-weight: 600;
  color: #24252d;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.ws-account-menu__email {
  font-weight: var(--font-weight-medium);
  color: #24252d;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.ws-account-menu__plan {
  font-weight: var(--font-weight-medium);
  color: #838b8e;
  min-height: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.ws-account-menu__upgrade {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 10px);
  margin: 11px 0 0; /* Figma: 11px under the identity block */
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: #f7e0c7;
  box-sizing: border-box;
  text-align: left;
  font-family: var(--font-sans);
  font-weight: var(--font-weight-normal);
  font-size: 14px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: #24252d;
  cursor: pointer;
  transition: background-color 140ms cubic-bezier(0.32, 0.72, 0, 1);
}
.ws-account-menu__upgrade:hover {
  background: #f2d3af;
}
.ws-account-menu__upgrade:active {
  background: #eecaa2;
}

.ws-account-menu__body {
  display: flex;
  flex-direction: column;
  /* Figma 13px, less the 8px hover-surface overhang on the adjacent row. */
  gap: 5px;
  width: calc(100% - 10px);
  margin-top: 3px; /* Figma 11px, less the first row's 8px overhang */
  padding: 0 12px;
  box-sizing: border-box;
}

.ws-account-menu__group {
  display: flex;
  flex-direction: column;
  gap: 7px; /* Figma 23px, less 2 x 8px overhang */
  width: 100%;
}

.ws-account-menu__group--plain {
  gap: 5px; /* Figma 21px, less 2 x 8px overhang */
}

.ws-account-menu__rule {
  width: 100%;
  height: 0;
  border: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.ws-account-menu__item,
.ws-account-menu__logout {
  display: flex;
  align-items: center;
  gap: 10px;
  /* The row's text sits at Figma's x/y; the 8px/12px padding only widens the
     hit area and hover surface, which then bleeds out to the 239px column. */
  width: calc(100% + 24px);
  margin: 0 -12px;
  padding: 8px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  box-sizing: border-box;
  text-align: left;
  font-family: var(--font-sans);
  font-weight: var(--font-weight-normal);
  font-size: 14px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: #24252d;
  cursor: pointer;
  transition: background-color 140ms cubic-bezier(0.32, 0.72, 0, 1);
}

.ws-account-menu__group--plain .ws-account-menu__item {
  letter-spacing: -0.015em;
}

.ws-account-menu__item:hover,
.ws-account-menu__logout:hover {
  background: rgba(36, 37, 45, 0.05);
}
.ws-account-menu__item:active,
.ws-account-menu__logout:active {
  background: rgba(36, 37, 45, 0.08);
}

.ws-account-menu__item:focus-visible,
.ws-account-menu__upgrade:focus-visible,
.ws-account-menu__logout:focus-visible {
  outline: none;
  background: rgba(36, 37, 45, 0.05);
  box-shadow:
    0 0 0 2px #ffffff,
    0 0 0 4px var(--color-puddle-700, #f97d24);
}
.ws-account-menu__upgrade:focus-visible {
  background: #f2d3af;
}

.ws-account-menu__icon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  display: block;
  object-fit: contain;
}

.ws-account-menu__icon--upgrade {
  width: 18px;
  height: 18px;
}

.ws-account-menu__logout {
  /* Sits outside .ws-account-menu__body, so it carries the body's own 12px
     inset itself in order to line its icon up with the rows above. */
  width: calc(100% - 10px);
  margin: 2px 0 0; /* Figma 10px, less this row's 8px overhang */
  padding: 8px 12px;
  letter-spacing: -0.015em;
  box-sizing: border-box;
}

@media (prefers-reduced-motion: reduce) {
  .ws-account-menu,
  .ws-account-menu__item,
  .ws-account-menu__logout,
  .ws-account-menu__upgrade {
    transition: none;
  }
  .ws-account-menu { transform: none; }
}

@media (max-width: 560px) {
  .ws-account-menu {
    right: 0;
    left: auto;
  }
}
