.profile-shell {
  width: min(calc(100% - clamp(32px, 6vw, 64px)), 840px);
  margin-inline: auto;
}

.profile-heading {
  margin-bottom: clamp(1.5rem, 4vw, 2.75rem);
}

.profile-heading h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.1;
  letter-spacing: -.045em;
}

.profile-subtitle {
  margin-top: .55rem;
  color: var(--muted);
}

.profile-form {
  display: grid;
  gap: 1rem;
}

.profile-card {
  min-width: 0;
  padding: clamp(1.125rem, 4vw, 2rem);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  background: var(--paper, #fff);
}

.profile-card h2 {
  margin: 0 0 1.25rem;
  font-size: clamp(1.25rem, 3vw, 1.45rem);
  letter-spacing: -.02em;
}

.profile-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.profile-fields .field {
  min-width: 0;
}

.profile-fields .field input {
  width: 100%;
  min-width: 0;
}

.profile-gender {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.profile-gender legend {
  margin-bottom: 6px;
  padding: 0;
}

.profile-gender-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-gender-options label {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 50px;
  padding-inline: .84rem;
  border: 1px solid #c9d7cc;
  border-radius: 10px;
  background: #f8fbf8;
  cursor: pointer;
}

.profile-gender-options label:has(input:checked) {
  border-color: var(--deep-green);
  background: #e5f6ec;
}

.profile-gender-options input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--deep-green);
}

.profile-optional {
  margin-left: .25rem;
  font-size: .76rem;
  font-weight: 500;
  color: var(--muted);
}

.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  margin-bottom: 1.4rem;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--border);
}

.profile-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: clamp(3.75rem, 11vw, 5.75rem);
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 50%;
  background: #e5f6ec;
}

.profile-avatar [data-avatar-placeholder] {
  width: 56%;
  height: 56%;
  object-fit: contain;
}

.profile-avatar [data-avatar-image] {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-label,
.profile-payment-label {
  margin: 0 0 .2rem;
  font-size: .95rem;
  font-weight: 700;
}

.profile-avatar-details .hint,
.profile-payment .hint {
  margin: 0;
}

.profile-avatar-details [data-avatar-status] {
  margin-top: .45rem;
}

.profile-avatar-details [data-error="true"] {
  color: var(--danger, #9e2317);
}

.profile-avatar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1rem;
  margin-top: .65rem;
}

.profile-avatar-actions .button,
.profile-phone-row .button,
.profile-payment .button {
  width: auto;
  min-height: 2.75rem;
}

.profile-text-button {
  min-height: 2.75rem;
  padding: .4rem 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .86rem;
  font-weight: 600;
  cursor: pointer;
}

.profile-text-button:hover {
  color: var(--ink);
  text-decoration: underline;
}

.profile-phone-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: .75rem;
}

.profile-phone-status {
  margin: .55rem 0 0;
}

.profile-phone-status[data-confirmed="true"] {
  color: #206540;
  font-weight: 650;
}

.profile-payment {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .85rem;
}

.profile-payment-mark {
  --card-line: #08753c;
  --card-fill: #e5f6ec;
  width: 2.5rem;
  aspect-ratio: 5 / 3.5;
  border: 1.5px solid var(--card-line);
  border-radius: .35rem;
  background: linear-gradient(to bottom, var(--card-fill) 20%, var(--card-line) 20% 34%, var(--card-fill) 34%);
}

.profile-payment .button:disabled {
  cursor: not-allowed;
}

.profile-submit-row {
  display: grid;
  justify-items: start;
  gap: .5rem;
  margin-top: .75rem;
}

.profile-submit-row .button {
  width: auto;
}

@media (max-width: 540px) {
  .profile-fields,
  .profile-phone-row {
    grid-template-columns: 1fr;
  }

  .profile-phone-row .button {
    justify-self: start;
  }

  .profile-payment {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .profile-payment .button {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (max-width: 360px) {
  .profile-optional {
    display: block;
    margin-left: 0;
  }
}
