/**
 * User Profile — Direction A v2 (identity-first, site tokens)
 * Tokens: 00-tokens.css (shadcn Zinc) + button/card/nav patterns.
 */

.user-profile-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-6);
}

.profile-dir-a {
  background: transparent;
}

/* Mobile: Telegram density — kill outer gutters, full-width sections */
@media (max-width: 899px) {
  .container:has(.profile-dir-a) {
    padding-left: 0;
    padding-right: 0;
  }
  #content:has(.profile-dir-a) {
    /* Keep avatar + identity clear of Telegram Mini App top chrome */
    padding-top: max(var(--space-4), env(safe-area-inset-top, 0px));
    padding-bottom: var(--space-2);
    background: var(--color-card);
  }
}

/* —— Shell: sticky rail + main —— */
.profile-shell {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.profile-rail {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.profile-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

@media (min-width: 900px) {
  .profile-shell {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: var(--space-6);
    align-items: start;
  }

  .profile-shell--user {
    grid-template-columns: 360px 1fr;
  }

  .profile-rail {
    position: sticky;
    top: calc(var(--navbar-height, 64px) + var(--space-4));
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: var(--space-6) var(--space-5);
  }
}

/* —— Hero / identity (mobile card; desktop merges into rail) —— */
.profile-hero__banner {
  /* Decorative gray strip removed — showed behind square avatar on mobile. */
  display: none;
  height: 0;
  border: none;
  background: transparent;
}

.profile-hero__card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 0 var(--space-5) var(--space-5);
}

@media (max-width: 899px) {
  .profile-shell {
    gap: 0;
  }
  .profile-main {
    gap: 0;
  }
  .profile-hero {
    padding: 0;
    background: var(--color-card);
  }
  .profile-hero__banner {
    display: none;
  }
  .profile-hero__card {
    margin-top: 0;
    padding: 0.75rem 1rem 0.85rem;
    border-radius: 0;
    border: none;
    box-shadow: none;
    background: var(--color-card);
  }
  .profile-shell--self .profile-identity,
  .profile-shell--user .profile-identity {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  /* Telegram Settings: white content, gray band separators only */
  .user-profile-container.profile-dir-a {
    padding: 0 0 0.75rem;
    background: var(--color-card);
  }
  .profile-shell--user .profile-identity.user-profile-header {
    padding-top: 0.35rem;
    gap: 0.85rem;
  }
  .profile-shell--user .profile-identity__info {
    gap: 0.55rem;
  }
  .profile-shell--user .profile-identity__actions {
    margin-top: 0.15rem;
  }
  .profile-contact-group,
  .profile-panel,
  .profile-media-list,
  .me-status-card {
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: none;
  }
  .profile-section__label {
    padding: 0.4rem 1rem 0.15rem;
  }
  .profile-contact-row {
    padding: 0.7rem 1rem;
    gap: 0.75rem;
  }
  .me-status-card {
    margin: 0;
  }
  .me-logout {
    padding: 0.5rem 1rem;
  }
}

@media (min-width: 900px) {
  .profile-hero__card {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }
  .profile-shell--self .profile-rail {
    /* rail already carded */
  }
}

/* Identity header fragment */
.profile-identity.user-profile-header {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
}

/* Hero stays a positioning context for banner overlap */
.profile-hero {
  position: relative;
}

/* Inside /me hero: identity is static so avatar overlaps banner cleanly */
.profile-hero .profile-identity {
  position: static;
}

/* Edit is a Telegram action-row cell (icon above label), not a floating pill */
.profile-identity__edit.profile-actions__btn {
  color: var(--color-text-base);
  text-decoration: none;
}

.profile-identity__edit.profile-actions__btn > i {
  font-size: 1.15rem;
  color: var(--color-text-base);
}

/* Mobile /me: Change photo + Edit under name; desktop uses rail CTAs */
@media (min-width: 900px) {
  .profile-identity__actions--self {
    display: none;
  }
}

.profile-actions__primary.profile-actions__primary--self {
  display: flex;
  justify-content: center;
  max-width: none;
  width: 100%;
  margin-inline: 0;
  padding-inline: 1rem;
  box-sizing: border-box;
  gap: var(--space-2);
}

/* Self row: Photo + Edit (+ optional More) as equal cells. */
.profile-actions__primary--self > .profile-actions__photo,
.profile-actions__primary--self > .profile-identity__edit,
.profile-actions__primary--self > .profile-actions-more {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  max-width: none;
}

.profile-actions__primary--self > .profile-actions-more {
  position: relative;
}

.profile-actions__primary--self > .profile-actions-more > summary.profile-actions-more__trigger {
  width: 100%;
}

.profile-actions__primary--self .profile-actions__btn {
  white-space: normal;
  text-overflow: clip;
  overflow: visible;
  font-size: 12px;
  line-height: 1.25;
  min-height: 72px;
  padding: var(--space-3) 0.35rem;
}

.profile-actions__photo {
  min-width: 0;
  width: 100%;
}

.profile-actions__photo .profile-rail-photo-form {
  display: block;
  width: 100%;
  margin: 0;
}

.profile-actions__photo .profile-actions__btn {
  width: 100%;
  cursor: pointer;
}

.profile-identity__info {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Desktop rail CTAs (edit name / change photo). Hidden while the name form is up. */
.profile-rail-actions {
  display: none;
  width: 100%;
}

.profile-rail-photo-form {
  display: block;
  width: 100%;
  margin: 0;
}

.profile-rail-actions__btn {
  width: 100%;
  height: 36px;
  box-sizing: border-box;
  justify-content: center;
  gap: 0.35rem;
}

.profile-rail-actions__btn .profile-rail-actions__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 900px) {
  .profile-identity .profile-rail-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: var(--space-2);
    margin-top: var(--space-3);
  }

  .profile-identity .profile-rail-actions > .profile-rail-photo,
  .profile-identity .profile-rail-actions > .profile-rail-actions__btn,
  .profile-identity .profile-rail-actions > .profile-actions-more {
    flex: 1 1 0;
    min-width: 0;
  }

  .profile-identity .profile-rail-actions > .profile-rail-photo .profile-rail-actions__btn,
  .profile-identity .profile-rail-actions > .profile-rail-actions__btn {
    width: 100%;
    height: 2.75rem;
    min-height: 2.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-inline: 0.4rem;
    font-size: 0.8rem;
  }

  /* More in rail: same compact row chrome as Photo/Edit (not tall mobile tile). */
  .profile-identity .profile-rail-actions > .profile-actions-more {
    position: relative;
    display: flex;
  }

  .profile-identity .profile-rail-actions > .profile-actions-more > summary.profile-actions-more__trigger {
    width: 100%;
    height: 2.75rem;
    min-height: 2.75rem;
    max-height: 2.75rem;
    flex-direction: row;
    gap: 0.35rem;
    padding: 0 0.4rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .profile-identity .profile-rail-actions > .profile-actions-more > summary.profile-actions-more__trigger > i {
    font-size: 0.95rem;
    margin: 0;
  }

  .profile-identity .profile-rail-actions > .profile-actions-more > summary .profile-actions__short {
    display: inline;
  }

  .profile-identity .profile-rail-actions > .profile-actions-more > summary .profile-actions__full {
    display: none;
  }
}

.profile-identity--editing .profile-rail-actions,
.profile-hero__card:has(.profile-name-edit) > .profile-rail-actions {
  display: none !important;
}

.profile-identity--editing .profile-identity__info {
  align-items: stretch;
  text-align: left;
}

.user-profile-photo-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  width: 100%;
}

.user-profile-avatar {
  position: relative;
  margin-top: 0;
}

/* No banner overlap — square photo sits on white identity (Telegram) */
.profile-hero .user-profile-avatar {
  margin-top: 0;
}

.user-profile-avatar img {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-xl); /* square with soft corners — never circular */
  object-fit: cover;
  box-shadow: var(--shadow-md);
  border: 3px solid var(--color-card);
  background: var(--ctp-blue);
  display: block;
}

.user-profile-avatar__open {
  display: block;
  cursor: zoom-in;
  border-radius: var(--radius-xl);
  line-height: 0;
}

.user-profile-avatar__open:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.user-profile-avatar__camera {
  margin: 0;
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.user-profile-avatar__camera .user-profile-avatar__edit {
  pointer-events: auto;
}

@media (min-width: 900px) {
  .user-profile-avatar img {
    width: 140px;
    height: 140px;
  }
}

.user-profile-avatar--edit {
  margin: 0;
  position: relative;
}

.user-profile-avatar__label {
  display: block;
  cursor: pointer;
  position: relative;
}

.user-profile-avatar__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.user-profile-avatar__edit {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  background: var(--color-primary);
  border: 2px solid var(--color-card);
  color: var(--color-primary-foreground);
  box-shadow: var(--shadow-sm);
  font-size: 0.75rem;
}

.user-profile-name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.user-profile-latin-name {
  flex: 1 0 100%;
  margin: 0;
  text-align: center;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-normal);
  color: var(--color-text-muted);
  line-height: 1.35;
}

.profile-name-edit__hint {
  margin: 0.15rem 0 0;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  line-height: 1.4;
}

.profile-passport-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.55rem;
}
.profile-passport-actions form { margin: 0; }
.profile-passport .profile-contact-row__hint { margin-top: 0.35rem; }

.user-profile-name {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-base);
  margin: 0;
  line-height: var(--line-height-tight);
  letter-spacing: -0.02em;
  display: inline;
}

@media (min-width: 900px) {
  .user-profile-name {
    font-size: 1.5rem;
  }
}

.user-profile-name .user-profile-gender {
  display: inline;
  margin-left: 0.35rem;
  font-size: 0.78em;
  font-weight: var(--font-weight-normal);
  vertical-align: baseline;
  line-height: 1;
}

.user-profile-gender.is-male {
  color: color-mix(in srgb, #3b82f6 70%, var(--color-muted-foreground));
  background: none;
  width: auto;
  height: auto;
  border-radius: 0;
}

.user-profile-gender.is-female {
  color: color-mix(in srgb, var(--ctp-pink) 70%, var(--color-muted-foreground));
  background: none;
  width: auto;
  height: auto;
  border-radius: 0;
}

/* Fallback inline edit (rare): text control, never a circular twin to gender */
.profile-name-edit-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: var(--space-2);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-card);
  color: var(--color-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  flex-shrink: 0;
  width: auto;
  height: auto;
}

.profile-name-edit-link > i {
  font-size: 0.7rem;
}

.profile-name-edit-link:hover {
  color: var(--color-link-hover);
  background: var(--color-muted);
}

.profile-name-was {
  margin: 0.15rem 0 0;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-normal);
  line-height: 1.35;
  color: var(--color-text-subtle);
  text-align: center;
}

.user-profile-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-3) 0 var(--space-2);
}

.user-profile-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  padding: 0.3125rem 0.75rem 0.3125rem 0.375rem;
  border-radius: var(--radius-full);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border-base);
  color: var(--color-text-base);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  line-height: 1.3;
}

.user-profile-chip > i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  flex-shrink: 0;
}

.user-profile-chip__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-profile-chip--id {
  font-family: var(--font-family-mono, ui-monospace, monospace);
  font-weight: var(--font-weight-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
}

.user-profile-chip--id > i {
  background: color-mix(in srgb, var(--color-primary) 15%, transparent);
  color: var(--color-primary);
}

.user-profile-chip--instructor > i {
  background: color-mix(in srgb, var(--ctp-blue) 15%, transparent);
  color: var(--ctp-blue);
}

.user-profile-badges {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: var(--space-2);
}

.user-profile-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: var(--color-bg-subtle);
  color: var(--color-text-base);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  border: 1px solid var(--color-border-base);
}

.user-profile-badge.is-instructor {
  background: var(--ctp-blue);
  color: white;
  border-color: var(--ctp-blue);
}

.user-profile-badge.is-suspended {
  background: var(--ctp-yellow);
  color: white;
  border-color: var(--ctp-yellow);
}

.user-profile-badge.is-chat-removed {
  background: var(--ctp-red);
  color: white;
  border-color: var(--ctp-red);
}

/* —— Photo gallery —— */
.profile-photo-gallery {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  align-items: center;
}

.profile-photo-gallery__label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.profile-photo-gallery__track {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  justify-content: center;
  max-width: 100%;
  scrollbar-width: thin;
  padding-bottom: 0.15rem;
}

.profile-photo-gallery__item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  text-decoration: none;
  color: inherit;
}

.profile-photo-gallery__img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 2px solid var(--color-card);
  background: var(--color-bg-subtle);
  display: block;
  box-shadow: var(--shadow-xs);
}

.profile-photo-gallery__img.is-empty {
  display: grid;
  place-items: center;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.profile-photo-gallery__date {
  font-size: 10px;
  color: var(--color-text-subtle);
  white-space: nowrap;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* —— Sections / panels —— */
.profile-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* .profile-section { display:flex } is later than 03-layout utilities and
   would otherwise keep both mobile+desktop media lists visible. */
@media (max-width: 767px) {
  .profile-section.hidden-mobile {
    display: none;
  }
}
@media (min-width: 768px) {
  .profile-section.hidden-desktop {
    display: none;
  }
}

.profile-section__label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 var(--space-1);
}

.profile-rail-section .profile-section__label {
  padding-left: 0;
}

.profile-panel {
  background: var(--color-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.profile-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.profile-panel__title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-base);
}

.profile-panel__body {
  padding: var(--space-4);
}

/* Legacy section class — keep for study/seminar */
.user-profile-section {
  margin-bottom: 0;
  padding: 0;
  background: var(--color-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.user-profile-section-header {
  margin-bottom: 0;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.user-profile-section-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-base);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.user-profile-section-title i {
  color: var(--color-primary);
}

.user-profile-section .profile-panel__body,
.user-profile-section > .profile-history-cards,
.user-profile-section > .hidden-mobile {
  padding: var(--space-4);
}

/* —— Contact rows —— */
.profile-contact-group {
  background: var(--color-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.profile-contact-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-subtle);
}

.profile-contact-row:last-child {
  border-bottom: none;
}

.profile-contact-row__ico {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ctp-overlay2);
  background: var(--ctp-mantle);
  flex: 0 0 32px;
  align-self: flex-start;
  margin-top: 2px;
  font-size: 0.85rem;
}

.profile-contact-row__ico.is-phone,
.profile-contact-row__ico.is-mail,
.profile-contact-row__ico.is-cake,
.profile-contact-row__ico.is-user,
.profile-contact-row__ico.is-group,
.profile-contact-row__ico.is-instructor,
.profile-contact-row__ico.is-location,
.profile-contact-row__ico.is-tg {
  background: var(--ctp-mantle);
  color: var(--ctp-overlay2);
}

.profile-contact-row__body {
  flex: 1 1 auto;
  min-width: 0;
}

.profile-contact-row__value {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-base);
  line-height: 1.35;
  word-break: break-word;
}

.profile-contact-row__label {
  font-size: var(--font-size-xs);
  color: var(--color-text-subtle);
  font-weight: var(--font-weight-normal);
  line-height: 1.25;
  margin-top: 0.1rem;
}

.profile-contact-row__value.is-link,
.profile-contact-row__value.is-link a {
  color: var(--color-link);
  text-decoration: none;
}

.profile-contact-row__hint {
  font-size: 11.5px;
  color: var(--color-text-subtle);
  margin-top: 2px;
  line-height: 1.3;
}

.profile-contact-row__trailing {
  flex: 0 0 auto;
  margin-top: 2px;
  color: var(--color-text-subtle);
}

/* Desktop contact tiles for self-view main column */
@media (min-width: 900px) {
  .profile-shell--self .profile-contact-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--color-card);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
  }

  .profile-shell--self .profile-contact-row {
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    background: var(--color-bg-subtle);
    padding: var(--space-3);
  }
}

/* —— Actions (Telegram Message/Mute/Call/More row under identity) —— */
.profile-identity__actions {
  width: 100%;
  margin-top: var(--space-1);
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
}

.profile-actions__primary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
}

.profile-actions__btn {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: auto;
  min-height: 64px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  padding: var(--space-3) var(--space-2);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  box-sizing: border-box;
  border-radius: var(--radius-xl);
  background: var(--color-card);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-xs);
  font-size: 11px;
  font-weight: var(--font-weight-medium);
  color: var(--color-text-base);
  text-decoration: none;
}

.profile-actions__btn > i {
  flex-shrink: 0;
  font-size: 1.15rem;
  color: var(--color-text-base);
}

.profile-actions__btn.btn-tg {
  background: var(--color-card);
  color: var(--color-text-base);
  border-color: var(--color-border);
}

.profile-actions__btn.btn-tg > i {
  color: #229ED9;
}

.profile-actions__btn.btn-outline {
  background: var(--color-card);
}

.profile-actions__btn:hover,
.profile-actions__btn:focus-visible {
  background: var(--color-muted);
  outline: none;
}

.profile-actions__short {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.2;
}

.profile-actions__full {
  display: none;
}

@media (min-width: 900px) {
  .profile-actions__primary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .profile-actions__short {
    display: block;
  }

  .profile-actions__full {
    display: none;
  }
}

.btn-tg {
  background: #229ED9;
  color: #fff;
  border-color: #229ED9;
}

.btn-tg:hover {
  background: #1b8fc4;
  color: #fff;
  border-color: #1b8fc4;
}

/* «Ще» overflow — details/summary, site dropdown tokens */
.profile-actions-more {
  position: relative;
  min-width: 0;
  width: 100%;
}

.profile-actions-more__trigger {
  list-style: none;
  cursor: pointer;
  user-select: none;
  color: var(--color-muted-foreground);
}

.profile-actions-more__trigger::-webkit-details-marker {
  display: none;
}

.profile-actions-more__trigger::marker {
  content: "";
}

.profile-actions-more[open] > .profile-actions-more__trigger {
  background: var(--color-muted);
  color: var(--color-foreground);
}

.profile-actions-more__menu {
  position: absolute;
  top: calc(100% + var(--space-1));
  right: 0;
  left: auto;
  z-index: var(--z-dropdown, 50);
  /* Anchor to the More cell; wide enough for manage labels */
  width: max(12rem, calc(200% + var(--space-2)));
  min-width: 12rem;
  max-width: min(20rem, calc(100vw - 2rem));
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-1) 0;
  box-sizing: border-box;
}

@media (min-width: 900px) {
  .profile-actions-more__menu {
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
  }
}

.profile-actions-more__menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  color: var(--color-foreground) !important;
  text-decoration: none;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  box-sizing: border-box;
}

.profile-actions-more__menu .dropdown-item > i {
  width: 1.1rem;
  text-align: center;
  color: var(--color-muted-foreground);
  flex-shrink: 0;
}

.profile-actions-more__menu .dropdown-item:hover,
.profile-actions-more__menu .dropdown-item:focus-visible {
  background: var(--color-muted);
  outline: none;
}

.profile-actions-more__menu .dropdown-item--destructive {
  color: var(--color-destructive);
}

.profile-actions-more__menu .dropdown-item--destructive:hover,
.profile-actions-more__menu .dropdown-item--destructive:focus-visible {
  background: color-mix(in srgb, var(--color-destructive) 12%, transparent);
}

/* Legacy class kept for billing / other pages that still use the toolbar */
.user-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.btn-ghost,
.me-logout-btn {
  background: transparent;
  color: var(--color-muted-foreground);
  border: none;
  height: auto;
  padding: var(--space-2) var(--space-3);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
}

/* —— Name edit form (replaces the name + edit CTAs) —— */
.profile-name-edit {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: 100%;
  max-width: 100%;
  margin: 0;
  text-align: left;
}

.profile-name-edit__fields,
.profile-name-edit__fields--with-middle {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: 100%;
  min-width: 0;
}

.profile-name-edit .form-group {
  margin: 0;
  min-width: 0;
  width: 100%;
}

.profile-name-edit .form-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-subtle);
  line-height: 1.2;
}

.profile-name-edit .input {
  width: 100%;
  box-sizing: border-box;
  height: 40px;
  background: var(--color-background);
  font-size: var(--font-size-base);
}

.profile-name-edit__location {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: 100%;
  min-width: 0;
}

.profile-name-edit__select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2371717a' d='M1.41 0 6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.2rem;
  cursor: pointer;
}

.profile-contact-row--cta {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border-style: dashed;
  background: color-mix(in srgb, var(--color-bg-subtle) 70%, transparent);
}

.profile-contact-row--cta:hover {
  background: var(--color-bg-subtle);
}

.profile-contact-row__value.is-cta {
  color: var(--color-text-muted);
  font-weight: var(--font-weight-medium);
}

.profile-contact-row__ico.is-location {
  color: var(--color-text-muted);
}

.profile-contact-row__ico.is-muted {
  opacity: 0.7;
}

@media (max-width: 899px) {
  .profile-name-edit__location {
    gap: var(--space-2);
  }
}


@media (min-width: 900px) {
  .profile-shell--self .profile-name-edit,
  .profile-shell--user .profile-name-edit {
    gap: var(--space-4);
  }
}

@media (max-width: 899px) {
  .profile-name-edit {
    gap: var(--space-2);
  }
  .profile-name-edit__fields,
  .profile-name-edit__fields--with-middle {
    gap: var(--space-2);
  }
  .profile-name-edit .input {
    height: 36px;
  }
  .profile-hero__card:has(.profile-name-edit) {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

.profile-phone-update { margin-top: 0.35rem; }

.btn-sm {
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
}

/* —— Change history timeline —— */
.profile-change-history {
  margin: 0;
}

.profile-change-history__note {
  font-size: var(--font-size-xs);
  color: var(--color-text-subtle);
  padding: var(--space-3) var(--space-4) var(--space-1);
  margin: 0;
}

.profile-timeline {
  padding: var(--space-1) 0 var(--space-4);
}

.profile-timeline__item {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  position: relative;
}

.profile-timeline__item::before {
  content: '';
  position: absolute;
  left: 22px;
  top: 28px;
  bottom: -4px;
  width: 2px;
  background: var(--color-border);
}

.profile-timeline__item:last-child::before {
  display: none;
}

.profile-timeline__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--ctp-blue);
  margin-top: 6px;
  margin-left: 4px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ctp-blue) 14%, transparent);
}

.profile-timeline__when {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  font-weight: var(--font-weight-medium);
}

.profile-timeline__who {
  font-size: var(--font-size-xs);
  color: var(--color-text-subtle);
}

.profile-timeline__bits {
  font-size: var(--font-size-sm);
  margin-top: 2px;
  line-height: 1.4;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.7rem;
}

.profile-change-bit__field { color: var(--color-text-muted); }
.profile-change-bit__old {
  text-decoration: line-through;
  color: var(--color-text-subtle);
}
.profile-change-bit__new {
  color: var(--color-text-base);
  font-weight: var(--font-weight-medium);
}
.profile-change-bit__photo-note {
  color: var(--color-text-muted);
  font-style: italic;
}
.profile-change-empty {
  margin: 0;
  padding: var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* —— History cards (mobile) —— */
.profile-history-cards {
  flex-direction: column;
  gap: var(--space-3);
}

@media (max-width: 767px) {
  .profile-history-cards {
    display: flex;
  }
}

.profile-history-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.profile-history-card__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.profile-history-card__title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-foreground);
}

.profile-history-card__title a {
  color: var(--color-foreground);
  text-decoration: none;
}

.profile-history-card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  font-size: var(--font-size-xs);
  color: var(--color-muted-foreground);
}

.profile-history-card__meta i {
  flex-shrink: 0;
  font-size: 0.75em;
  opacity: 0.8;
}

.profile-history-card__meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-history-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.profile-history-card__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
  flex-shrink: 0;
  text-align: right;
}

.profile-history-card__date,
.profile-history-card__year {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-foreground);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.profile-history-card__id {
  font-size: var(--font-size-xs);
  color: var(--color-muted-foreground);
  font-variant-numeric: tabular-nums;
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  border: 1px solid transparent;
}

.profile-chip i { font-size: 0.85em; }

.profile-chip--paid {
  background: color-mix(in srgb, var(--ctp-green) 15%, transparent);
  color: var(--ctp-green);
  border-color: color-mix(in srgb, var(--ctp-green) 30%, transparent);
}

.profile-chip--checkin {
  background: color-mix(in srgb, var(--ctp-blue) 15%, transparent);
  color: var(--ctp-blue);
  border-color: color-mix(in srgb, var(--ctp-blue) 30%, transparent);
}

.user-profile-empty {
  text-align: center;
  padding: var(--space-8);
  color: var(--color-text-muted);
}

/* Legacy contact item (kept for any remaining uses) */
.user-profile-contacts {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.user-profile-contact-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg-subtle);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--color-text-base);
  border: 1px solid transparent;
}


/* —— Media list (Telegram photos/videos/files rows) —— */
.profile-media-list {
  background: var(--color-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.profile-media-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.7rem var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-card);
  color: inherit;
  text-decoration: none;
  min-height: 48px;
  box-sizing: border-box;
}

.profile-media-row:last-child {
  border-bottom: none;
}

.profile-media-row:not(.is-static):hover,
.profile-media-row:not(.is-static):focus-visible {
  background: var(--color-muted);
  outline: none;
}

.profile-media-row.is-static {
  cursor: default;
}

.profile-media-row.is-static .profile-media-row__chev {
  visibility: hidden;
}

.profile-media-row__ico {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  color: var(--ctp-overlay2);
  background: var(--ctp-mantle);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.profile-media-row__ico.is-study,
.profile-media-row__ico.is-seminars,
.profile-media-row__ico.is-videos,
.profile-media-row__ico.is-available {
  background: var(--ctp-mantle);
  color: var(--ctp-overlay2);
}

.profile-media-row__body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.profile-media-row__label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-base);
  line-height: 1.3;
}

.profile-media-row__count {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.profile-media-row__chev {
  flex: 0 0 auto;
  color: var(--color-text-subtle);
  font-size: 0.7rem;
}

/* —— Focused profile edit page (name + location only) —— */
.profile-edit-page {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-4) var(--space-8);
  box-sizing: border-box;
}

/* One row: back (cancel) on the left, save on the right. No title. */
.profile-edit-page__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.profile-edit-page__back {
  margin-bottom: 0;
  min-width: 0;
}

.profile-edit-page__save {
  flex: 0 0 auto;
  min-height: 40px;
  white-space: nowrap;
}

.profile-edit-page__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.profile-edit-page .profile-name-edit {
  gap: var(--space-4);
}

.profile-edit-page .alert {
  margin: 0;
}

@media (max-width: 899px) {
  .profile-edit-page {
    max-width: none;
    padding: var(--space-3) var(--space-4) var(--space-8);
  }
}

/* —— Photo gallery page (full-page nav, mobile + desktop) —— */
.profile-gallery-page {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-4) var(--space-8);
  box-sizing: border-box;
}

.profile-gallery-back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: var(--space-4);
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.profile-gallery-back:hover,
.profile-gallery-back:focus-visible {
  color: var(--color-text-base);
  outline: none;
}

.profile-gallery-page__head {
  margin-bottom: var(--space-5);
}

.profile-gallery-page__head h1 {
  margin: 0;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-base);
  line-height: 1.25;
}

.profile-gallery-page__sub {
  margin: 0.25rem 0 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.profile-gallery-page__body {
  padding: 0;
}

.profile-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

@media (min-width: 640px) {
  .profile-gallery-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.profile-gallery-grid__item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.profile-gallery-grid__item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-bg-subtle);
  display: block;
}

.profile-gallery-grid__date {
  font-size: 10px;
  color: var(--color-text-subtle);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-gallery-empty {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  text-align: center;
  padding: var(--space-6) var(--space-4);
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
}

/* legacy modal class hooks (keep harmless if old markup cached) */
.profile-gallery-modal__sub { margin: 0.15rem 0 0; font-size: var(--font-size-sm); color: var(--color-text-muted); }
.profile-gallery-modal__body { padding: var(--space-4); }

/* —— Instructor comments (main.comment_to_user) —— */
.profile-comments__note {
  font-size: var(--font-size-xs);
  color: var(--color-text-subtle);
  padding: var(--space-3) var(--space-4) var(--space-1);
  margin: 0;
}

.profile-comments__composer {
  padding: var(--space-3) var(--space-4) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.profile-comments__add {
  align-self: flex-start;
}

.profile-comments__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.profile-comments__form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.profile-comments__input {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
  font: inherit;
}

.profile-comments__submit {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.profile-comments__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: 0 var(--space-4) var(--space-4);
}

.profile-comments__item {
  padding: var(--space-3);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.profile-comments__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-bottom: 0.35rem;
}

.profile-comments__who {
  color: var(--color-text-subtle);
  font-weight: var(--font-weight-medium);
}

.profile-comments__body {
  font-size: var(--font-size-sm);
  color: var(--color-text-base);
  white-space: pre-wrap;
  line-height: 1.45;
  margin: 0;
}

.profile-comments__empty {
  margin: 0;
  padding: 0 var(--space-4) var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}


/* —— Full-screen history lists (Telegram Files pattern) —— */
.profile-history-page {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.profile-history-page__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.profile-history-page__cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}


/* —— Profile photo cropper (fixed overlay; crop+compress before POST) —— */
.profile-photo-cropper {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: color-mix(in srgb, #0f172a 55%, transparent);
}
.profile-photo-cropper[style*="display: block"],
.profile-photo-cropper[style*="display:block"] {
  display: flex !important;
}
.profile-photo-cropper__dialog {
  position: relative;
  width: min(100%, 420px);
  max-height: min(90vh, 640px);
  overflow: auto;
  background: var(--color-card, #fff);
  border-radius: var(--radius-xl, 16px);
  box-shadow: var(--shadow-lg);
  padding: 1rem;
}
.profile-photo-cropper__stage {
  max-height: 360px;
  margin-bottom: 0.75rem;
}
.profile-photo-cropper__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* —— Available seminars (profile media page) —— */
.profile-media-page__list,
.profile-media-page__cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.profile-media-page__list {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.profile-media-page__list .profile-media-row {
  border-radius: 0;
}
.profile-media-page__hint {
  margin: 0 0 0.75rem;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}
.profile-available-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.profile-available-card__title {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-base);
}
.profile-available-card__meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}
.profile-available-card__meta i {
  width: 1rem;
  text-align: center;
  margin-right: 0.25rem;
  color: var(--color-text-subtle);
}
.profile-available-card__price {
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  color: var(--color-text-base);
}


/* —— Mobile: Telegram Settings layout ——
   White content canvas; ONLY light-gray band separators between sections.
   Not a gray page with inset rounded white cards. */
@media (max-width: 899px) {
  .profile-dir-a .profile-contact-group,
  .profile-dir-a .profile-panel,
  .profile-dir-a .profile-media-list,
  .profile-dir-a .me-status-card,
  .profile-dir-a .user-profile-section,
  .profile-dir-a .profile-available-card {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: none;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    border-bottom: none;
    box-shadow: none;
    overflow: hidden;
  }

  .profile-dir-a .profile-contact-group,
  .profile-dir-a .profile-panel,
  .profile-dir-a .profile-media-list,
  .profile-dir-a .user-profile-section {
    background: var(--color-card);
    border: none;
  }

  /* Contact rows: white (not subtle gray fill) */
  .profile-dir-a .profile-contact-row {
    background: var(--color-card);
  }

  /* Section label sits in the gray separator band */
  .profile-dir-a .profile-section {
    gap: 0;
  }
  .profile-dir-a .profile-section__label {
    margin: 0;
    padding: 0.55rem 1rem 0.4rem;
    background: var(--color-bg-muted);
  }

  /* Logout / trailing blocks get a thin gray band above */
  .profile-dir-a .me-logout {
    margin: 0;
    padding: 0.75rem 1rem 0.5rem;
    background: var(--color-bg-muted);
  }

  /* Status / payment card: full-bleed; keep tint, drop floating radius */
  .profile-dir-a .me-status-card {
    border-radius: 0;
  }
}

/* —— In-app profile photo lightbox (Mini App safe) —— */
.profile-gallery-grid__trigger,
.profile-photo-gallery__trigger {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
  font: inherit;
  text-align: center;
  min-width: 0;
}

.profile-gallery-grid__trigger img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-bg-subtle);
  display: block;
}

.profile-photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(2, 6, 23, 0.88);
  backdrop-filter: blur(2px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: manipulation;
}

.profile-photo-lightbox__img {
  display: block;
  max-width: min(96vw, 1200px);
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  cursor: zoom-out;
  background: #fff;
}

.profile-photo-lightbox__close {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 20001;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  font-size: 1.15rem;
}

.profile-photo-lightbox__close:hover,
.profile-photo-lightbox__close:focus-visible {
  background: rgba(255, 255, 255, 0.28);
  outline: none;
}

@media (max-width: 767px) {
  .profile-photo-lightbox {
    padding: var(--space-2);
  }
  .profile-photo-lightbox__img {
    max-width: 100%;
    max-height: none;
    width: 100%;
  }
}


/* Chat removal: confirm busy + live per-chat progress (up-poll) */
.chat-removal-busy {
  display: none;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-3) 0 0;
  color: var(--ctp-blue);
  font-weight: 600;
}
.chat-removal-form[up-active] .chat-removal-busy,
.chat-removal-restore-form[up-active] .chat-removal-busy {
  display: inline-flex;
}
.chat-removal-restore-form .chat-removal-busy {
  margin: 0;
}
.chat-removal-form[up-active] .chat-removal-submit {
  display: none;
}
.chat-removal-restore-form .chat-removal-busy { display: none; }
.chat-removal-restore-form[up-active] .chat-removal-submit__idle { display: none; }
.chat-removal-restore-form[up-active] .chat-removal-busy { display: inline-flex; }
.chat-removal-form[up-active] {
  opacity: 1;
}
.chat-removal-form[up-active]::after {
  display: none;
}

/* Dense progress modal: tight padding, forced list scroll, mobile layout */
.chat-removal-progress,
.chat-removal-form {
  display: flex;
  flex-direction: column;
}
.chat-removal-progress .modal-body,
.chat-removal-form .modal-body {
  flex: 0 1 auto;
}
.chat-removal-progress .modal-header,
.chat-removal-progress .modal-body,
.chat-removal-progress .modal-footer,
.chat-removal-form .modal-header,
.chat-removal-form .modal-body,
.chat-removal-form .modal-footer {
  padding: 0.55rem 0.75rem;
}
.chat-removal-progress .modal-title,
.chat-removal-form .modal-title {
  font-size: var(--font-size-base);
  line-height: 1.3;
}
.chat-removal-progress .modal-body,
.chat-removal-form .modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow: hidden;
}
.chat-removal-progress__status {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.chat-removal-progress__header {
  margin: 0;
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--color-text);
}
.chat-removal-progress__header--done {
  color: var(--ctp-green, #40a02b);
}
.chat-removal-progress__hint {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--color-text-muted);
  font-weight: 400;
}
.chat-removal-progress__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
/* Force overflow so scrollbar is real + visible at ~20 items */
.chat-removal-progress__list:not(.chat-removal-progress__list--preview) {
  max-height: 12.75rem; /* ~8–9 dense rows — forces scroll at 20 */
  overflow-y: scroll !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
  scrollbar-width: auto; /* Firefox: always show classic bar */
  scrollbar-color: #64748b #e2e8f0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-subtle, #f8fafc);
  padding: 0.1rem 0 0.1rem 0.25rem;
}
/* Chromium: classic non-overlay scrollbar (visible in screenshots) */
.chat-removal-progress__list:not(.chat-removal-progress__list--preview)::-webkit-scrollbar {
  -webkit-appearance: none;
  width: 12px;
  background: #e2e8f0;
}
.chat-removal-progress__list:not(.chat-removal-progress__list--preview)::-webkit-scrollbar-track {
  background: #e2e8f0;
  border-radius: 0;
}
.chat-removal-progress__list:not(.chat-removal-progress__list--preview)::-webkit-scrollbar-thumb {
  background: #64748b;
  border-radius: 6px;
  border: 2px solid #e2e8f0;
  min-height: 2.5rem;
}
.chat-removal-progress__list:not(.chat-removal-progress__list--preview)::-webkit-scrollbar-thumb:hover {
  background: #475569;
}
.chat-removal-progress__list--preview {
  max-height: 10rem;
  overflow-y: scroll !important;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: #64748b #e2e8f0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.1rem 0 0.1rem 0.25rem;
  margin: 0 0 0.4rem;
  background: var(--color-bg-subtle, #f8fafc);
}
.chat-removal-progress__list--preview::-webkit-scrollbar {
  -webkit-appearance: none;
  width: 12px;
  background: #e2e8f0;
}
.chat-removal-progress__list--preview::-webkit-scrollbar-thumb {
  background: #64748b;
  border-radius: 6px;
  border: 2px solid #e2e8f0;
}
.chat-removal-progress__item {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.2rem 0.3rem;
  min-height: 1.2rem;
  border-radius: var(--radius-sm);
}
.chat-removal-progress__item + .chat-removal-progress__item {
  border-top: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);
}
.chat-removal-progress__item.is-fail {
  padding-bottom: 0.35rem;
}
.chat-removal-progress__icon {
  width: 1rem;
  flex: 0 0 1rem;
  text-align: center;
  line-height: 1.35;
  margin-top: 0.05rem;
  font-size: 0.85rem;
}
.chat-removal-progress__item.is-pending .chat-removal-progress__icon {
  color: var(--color-text-muted);
  font-size: 0.4rem;
  line-height: 1.5;
}
.chat-removal-progress__item.is-processing .chat-removal-progress__icon {
  color: var(--ctp-blue);
}
.chat-removal-progress__item.is-ok .chat-removal-progress__icon {
  color: var(--ctp-green, #40a02b);
}
.chat-removal-progress__item.is-fail .chat-removal-progress__icon {
  color: var(--ctp-red, #d20f39);
}
.chat-removal-progress__body {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}
.chat-removal-progress__name {
  font-weight: 500;
  font-size: var(--font-size-sm);
  line-height: 1.3;
}
.chat-removal-progress__item.is-pending .chat-removal-progress__name {
  color: var(--color-text-muted);
  font-weight: 400;
}
.chat-removal-progress__error {
  display: block;
  font-size: 0.7rem;
  line-height: 1.3;
  margin-top: 0.05rem;
  color: var(--ctp-red, #d20f39);
}
.chat-removal-progress__links {
  white-space: pre-wrap;
  margin: var(--space-2) 0 0;
  font-size: var(--font-size-sm);
}
.chat-removal-progress .modal-footer .btn,
.chat-removal-form .modal-footer .btn {
  min-height: 2.25rem;
  padding: 0.4rem 0.9rem;
}
.chat-removal-form .form-group {
  margin: 0.35rem 0 0;
}

/* Phone: dense full-bleed rows, sticky count, usable footer */
@media (max-width: 480px) {
  .chat-removal-progress .modal-header,
  .chat-removal-progress .modal-body,
  .chat-removal-progress .modal-footer,
  .chat-removal-form .modal-header,
  .chat-removal-form .modal-body,
  .chat-removal-form .modal-footer {
    padding: 0.65rem 0.75rem;
  }
  .chat-removal-progress .modal-title,
  .chat-removal-form .modal-title {
    font-size: 0.95rem;
  }
  .chat-removal-progress__header {
    font-size: 0.9rem;
  }
  .chat-removal-progress__list:not(.chat-removal-progress__list--preview) {
    max-height: min(55vh, 22rem);
  }
  .chat-removal-progress__list--preview {
    max-height: min(40vh, 14rem);
  }
  .chat-removal-progress__item {
    padding: 0.4rem 0.25rem;
    gap: 0.55rem;
  }
  .chat-removal-progress__name {
    font-size: 0.9rem;
  }
  .chat-removal-progress .modal-footer,
  .chat-removal-form .modal-footer {
    flex-direction: column;
    gap: 0.4rem;
  }
  .chat-removal-progress .modal-footer .btn,
  .chat-removal-form .modal-footer .btn {
    width: 100%;
    min-height: 2.75rem;
    font-size: 1rem;
  }
}


/* —— Profile videos page: a collection row with what the person watched
   there underneath (only for those allowed to see it) —— */
.profile-video-collection {
  border-bottom: 1px solid var(--color-border);
}
.profile-video-collection:last-child {
  border-bottom: none;
}
.profile-video-collection > .profile-media-row {
  border-bottom: none;
}
.profile-video-collection > .wv-list--inline {
  margin: 0 var(--space-4) 0.8rem calc(var(--space-4) + 28px + var(--space-3));
}
.profile-media-row__note {
  font-weight: var(--font-weight-normal);
}
@media (max-width: 640px) {
  .profile-video-collection > .wv-list--inline {
    margin: 0 0.75rem 0.75rem;
  }
}
