/* UPA — Navigation: profile menu, page head, section head, settings/form tabs, shell header end */
body.upa-page .upa-profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--upa-border);
  border-radius: 999px;
  background: #fff;
  color: var(--upa-text);
  padding: 0.44rem 0.7rem 0.44rem 0.56rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
  -webkit-user-select: none;
}

body.upa-page .upa-profile-chip::-webkit-details-marker {
  display: none;
}

body.upa-page .upa-profile-chip svg {
  width: 1rem;
  height: 1rem;
  fill: #5f738b;
}

body.upa-page .upa-profile-chip__caret {
  display: inline-flex;
  width: 0.9rem;
  height: 0.9rem;
}

body.upa-page .upa-profile-chip__caret svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: #5f738b;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: rotate(0deg);
  transition: transform 150ms ease;
}

body.upa-page .upa-profile-menu {
  position: fixed;
  top: 0.9rem;
  right: 1rem;
  z-index: 35;
  display: inline-block;
}

body.upa-page .upa-profile-menu[open] .upa-profile-chip {
  border-color: #9eb9d8;
  box-shadow: 0 6px 14px rgba(24, 54, 94, 0.14);
}

body.upa-page .upa-profile-menu[open] .upa-profile-chip__caret svg {
  transform: rotate(180deg);
}

body.upa-page .upa-profile-menu__panel {
  position: absolute;
  top: calc(100% + 0.38rem);
  right: 0;
  min-width: 13.5rem;
  background: #fff;
  border: 1px solid var(--upa-border);
  border-radius: 12px;
  box-shadow: 0 18px 38px rgba(22, 45, 79, 0.2);
  overflow: hidden;
  transform-origin: top right;
  animation: upa-menu-in 140ms ease-out;
  user-select: none;
  -webkit-user-select: none;
}

body.upa-page .upa-profile-menu__item {
  display: block;
  padding: 0.65rem 0.8rem;
  color: var(--upa-text);
  text-decoration: none;
  border-bottom: 1px solid #edf2f8;
  user-select: none;
  -webkit-user-select: none;
}

body.upa-page .upa-profile-menu__item:last-child {
  border-bottom: 0;
}

body.upa-page .upa-profile-menu__item:hover {
  background: #f3f8ff;
}

body.upa-page .upa-profile-menu__item.is-danger {
  color: #9f1f36;
}

body.upa-page .upa-profile-menu__item.is-danger:hover {
  background: #fff1f4;
}

body.upa-page .upa-profile-menu__item.is-disabled {
  color: var(--upa-muted);
  cursor: not-allowed;
  pointer-events: none;
}

@keyframes upa-menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

body.upa-page .upa-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

body.upa-page .upa-page-head__title {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

body.upa-page .upa-page-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

body.upa-page .upa-round-back {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--upa-border);
  background: #fff;
  color: #315f97;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(31, 71, 121, 0.12);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

body.upa-page .upa-round-back:hover {
  transform: translateY(-1px);
  border-color: #9fbad8;
  background-color: #f4f8ff;
  box-shadow: 0 10px 22px rgba(31, 71, 121, 0.16);
}

body.upa-page .upa-round-back svg {
  width: 1rem;
  height: 1rem;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.upa-page .upa-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

body.upa-page .upa-settings-tabs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  border-bottom: 1px solid var(--upa-border);
  padding-bottom: 0.55rem;
  margin-bottom: 0.8rem;
}

body.upa-page .upa-form-tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  border-bottom: 1px solid var(--upa-border);
  padding-bottom: 0.55rem;
  margin-bottom: 0.8rem;
}

body.upa-page .upa-form-stack[data-active-tab="builder"] [data-general-save-action="true"] {
  display: none !important;
}

body.upa-page .upa-settings-tabs--main {
  border-bottom: 0;
  padding-bottom: 0;
  margin-bottom: 0;
}

body.upa-page .upa-settings-tabs__tab {
  border: 1px solid transparent;
  background: transparent;
  color: #64748b;
  border-radius: 0.55rem;
  padding: 0.38rem 0.66rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

body.upa-page .upa-settings-tabs__tab.is-active {
  color: var(--upa-primary);
  border-color: color-mix(in srgb, var(--upa-primary) 35%, white 65%);
  background: color-mix(in srgb, var(--upa-primary) 7%, white 93%);
}

body.upa-page .upa-settings-tabs__panel:not(.is-active) {
  display: none;
}

body.upa-page .upa-form-tabs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border-bottom: 1px solid var(--upa-border);
  padding-bottom: 0.55rem;
}

body.upa-page .upa-form-tabs__tab {
  border: 1px solid transparent;
  background: transparent;
  color: #64748b;
  border-radius: 0.55rem;
  padding: 0.4rem 0.68rem;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

body.upa-page .upa-form-tabs__tab.is-active {
  color: var(--upa-primary);
  border-color: color-mix(in srgb, var(--upa-primary) 35%, white 65%);
  background: color-mix(in srgb, var(--upa-primary) 8%, white 92%);
}

body.upa-page .upa-form-tab-panel {
  display: grid;
  gap: 1rem;
}

body.upa-page .upa-form-tab-panel:not(.is-active) {
  display: none;
}

body.upa-page .upa-shell__header-end {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

@media (max-width: 900px) {
  body.upa-page .upa-profile-menu {
    top: 0.6rem;
    right: 0.6rem;
  }

  body.upa-page .upa-page-head {
    flex-direction: column;
  }
}
