.profileOpenButton {
  width: 100%;
  min-height: 40px;
}

.profileAvatarTrigger {
  overflow: hidden;
  cursor: pointer;
}

.profileAvatarTrigger img,
.profileModalAvatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profileDialogBackdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  place-items: center;
  padding: 16px;
  background: rgba(5, 15, 21, 0.72);
  backdrop-filter: blur(4px);
}

.profileDialogBackdrop.open {
  display: grid;
}

.profileDialog {
  width: min(520px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 20px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.profileDialogHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.profileDialogHeader h2,
.profilePasswordForm h3 {
  margin: 0;
}

.profileDialogHeader p {
  margin: 4px 0 0;
}

.profileCloseButton {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 26px;
  line-height: 1;
}

.profileMessage {
  display: none;
  margin: 10px 0;
  padding: 11px 12px;
  border: 1px solid var(--green-border);
  border-radius: 7px;
  color: var(--green);
  background: var(--green-soft);
  font-weight: 800;
}

.profileMessage.error {
  border-color: var(--red-border);
  color: var(--red);
  background: var(--red-soft);
}

.profileMessage.visible {
  display: block;
}

.profileAvatarSection {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  margin: 12px 0 18px;
  padding: 14px 0 18px;
  border-bottom: 1px solid var(--border);
}

.profileModalAvatar {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(145deg, #ee9a43, #8e470f);
  border: 1px solid #f1ad68;
  border-radius: 50%;
  font-size: 25px;
  font-weight: 950;
}

.profileIdentity {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.profileIdentityText {
  color: var(--muted);
  font-size: 13px;
}

.profileAvatarActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.profileFileButton {
  display: inline-grid;
  place-items: center;
  min-height: 42px;
  padding: 9px 13px;
  cursor: pointer;
  font-weight: 850;
}

.profileFileButton input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.profilePasswordForm {
  display: grid;
  gap: 9px;
}

.profilePasswordForm button {
  margin-top: 5px;
}

@media (max-width: 520px) {
  .profileDialogBackdrop { padding: 8px; }
  .profileDialog { max-height: calc(100dvh - 16px); padding: 16px; }
  .profileAvatarSection { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .profileAvatarActions { justify-content: center; }
  .profilePasswordForm button { width: 100%; }
}
