.top-actions .user-link { min-width: 0; max-width: 200px; }
.user-link > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.profile-page { max-width: 760px; }
.profile-home { max-width: 960px; }
.profile-page h1 {
  margin-bottom: 20px;
  font: var(--weight-heading) clamp(1.7rem, 3vw, 2.45rem)/1.15 var(--sans);
  letter-spacing: -.035em;
}
.profile-home-grid {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  align-items: start;
  gap: clamp(24px, 4vw, 56px);
}
.profile-identity {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding-block: 8px 16px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.profile-identity strong { font-size: 1.1rem; font-weight: var(--weight-strong); }
.profile-identity p { color: var(--muted); font-size: .85rem; }
.profile-initials {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: var(--radius-control);
  color: var(--accent-ink);
  background: var(--tint);
  font-weight: var(--weight-strong);
}
.profile-sign-in {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--subtle);
}
.profile-sign-in h2 { font-size: 1.1rem; font-weight: var(--weight-strong); }
.profile-sign-in p { margin-top: 4px; color: var(--muted); font-size: .9rem; }
.profile-sign-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.profile-sign-actions .button { min-height: 44px; }

.profile-groups, .profile-subpage { min-width: 0; }
.profile-group { min-width: 0; }
.profile-group + .profile-group { margin-top: 24px; }
.profile-group > h2, .profile-group legend {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 1.06rem;
  font-weight: var(--weight-strong);
}
.profile-group .book-feed { margin-top: 0; }
.profile-rows { border-block: 1px solid var(--line); }
.profile-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 50px;
  padding: 9px 8px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.profile-row + .profile-row { border-top: 1px solid var(--line); }
.profile-row:hover { background: var(--subtle); }
.profile-row:focus-visible { outline-offset: -2px; }
.profile-row-icon { display: grid; place-items: center; color: var(--muted); }
.profile-row > svg { color: var(--muted); }
.profile-row-text { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.profile-row-text strong { font-size: .95rem; font-weight: var(--weight-label); }
.profile-row-text small { color: var(--muted); font-size: .82rem; line-height: 1.4; }
.profile-logout {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 12px;
  color: var(--danger-ink);
}
.profile-back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin: -8px 0 8px; }
.profile-details { display: grid; gap: 3px; margin: 0 0 14px; }
.profile-details dt, .profile-form label { color: var(--muted); font-size: .875rem; font-weight: var(--weight-label); }
.profile-details dd { margin: 0; overflow-wrap: anywhere; }
.profile-form, .profile-form label { display: grid; gap: 6px; }
.profile-form { width: min(100%, 420px); gap: 12px; }
.profile-form input {
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--control-line);
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
}
.profile-form .button, .profile-publishing .button { justify-self: start; min-height: 44px; }
.profile-publishing { display: grid; gap: 12px; max-width: 54ch; }

.profile-theme { margin: 0; padding: 0; border: 0; }
.profile-theme legend { padding: 0; }
.profile-theme-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; max-width: 490px; }
.profile-theme-options label {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  min-height: 64px;
  padding: 6px 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  color: var(--muted);
  font-size: .84rem;
  font-weight: var(--weight-label);
  text-align: center;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.profile-theme-options label:hover { background: var(--subtle); }
.profile-theme-options label:has(input:checked) { border-color: var(--focus); color: var(--accent-ink); }
.profile-theme-options label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.profile-notice-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; margin-bottom: 10px; }
.profile-notice-actions .text-link { display: inline-flex; align-items: center; min-height: 44px; }

.push-profile [data-push-options] {
  display: grid;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-block: 1px solid var(--line);
}
.push-choice {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  cursor: pointer;
}
.push-choice + .push-choice { border-top: 1px solid var(--line); }
.push-choice:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }
.push-choice:has(input:disabled) { opacity: .65; cursor: default; }
.push-choice-copy { display: grid; min-width: 0; gap: 3px; overflow-wrap: anywhere; }
.push-choice-copy strong { font-size: .94rem; font-weight: var(--weight-label); }
.push-choice-copy small { color: var(--muted); font-size: .82rem; line-height: 1.4; }
.push-choice input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.push-switch { position: relative; width: 42px; height: 24px; border-radius: 12px; background: var(--field-line); }
.push-switch::before { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); }
.push-choice input:checked + .push-switch { background: var(--accent); }
.push-choice input:checked + .push-switch::before { background: var(--on-accent); transform: translateX(18px); }
.push-device {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 16px;
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius-panel);
  background: var(--subtle);
}
.push-device h3 { font-size: .94rem; }
.push-device p { margin-top: 3px; color: var(--muted); font-size: .85rem; line-height: 1.45; overflow-wrap: anywhere; }
.push-device .button { min-height: 44px; }
.push-profile .form-error { margin-top: 8px; }

@media (max-width: 800px), (max-width: 960px) and (max-height: 500px) and (pointer: coarse) {
  .top-actions .user-link { max-width: clamp(72px, 23vw, 140px); }
}
@media (max-width: 640px) {
  .profile-page h1 { margin-bottom: 16px; }
  .profile-home-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .profile-identity { padding-block: 0 12px; }
  .profile-groups .profile-group + .profile-group { margin-top: 18px; }
  .profile-row { padding-inline: 4px; }
  .push-device { grid-template-columns: minmax(0, 1fr); }
  .push-device .button { justify-self: start; }
}
