.profile-route {
  min-width: 0;
  min-height: 100%;
  padding: clamp(28px, 4vw, 56px) clamp(22px, 5vw, 72px) 72px;
}

.profile-page {
  width: min(1080px, 100%);
  margin: 0 auto;
  animation: profile-page-in 240ms cubic-bezier(.2, .8, .2, 1) both;
}

.profile-page-head {
  display: grid;
  align-items: start;
  gap: clamp(22px, 3vw, 42px);
  margin-bottom: clamp(34px, 5vw, 64px);
  grid-template-columns: 86px minmax(0, 1fr);
}

.profile-page-head > div {
  min-width: 0;
  max-width: 760px;
}

.profile-page-head h1 {
  max-width: 760px;
  margin: 4px 0 12px;
  font-family: var(--serif);
  font-size: clamp(42px, 6vw, 76px);
  font-weight: 500;
  letter-spacing: -.055em;
  line-height: .94;
}

.profile-page-head p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.profile-back {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  transition: color 120ms ease, transform 160ms cubic-bezier(.2, .8, .2, 1);
}

.profile-back .icon {
  width: 15px;
  height: 15px;
}

.profile-back:hover {
  color: var(--ink);
  transform: translateX(-2px);
}

.profile-back:focus-visible {
  color: var(--ink);
  outline: 2px solid var(--accent);
  outline-offset: 5px;
  border-radius: var(--radius-2);
}

.profile-settings-layout {
  display: grid;
  align-items: start;
  gap: clamp(36px, 6vw, 84px);
  grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
}

.profile-account {
  position: sticky;
  top: 32px;
  min-width: 0;
}

.profile-settings-main {
  min-width: 0;
}

.profile-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  color: white;
  background-color: var(--accent);
  background-position: center;
  background-size: cover;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 750;
}

.profile-avatar.large {
  width: 88px;
  height: 88px;
  font-size: 19px;
}

.profile-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.profile-identity > div {
  min-width: 0;
}

.profile-identity strong,
.profile-identity small {
  display: block;
}

.profile-identity strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
}

.profile-identity small {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 10px;
}

.profile-section-title {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.profile-timezone-field {
  margin-top: 14px;
}

.profile-field-note {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.profile-toggle {
  display: grid;
  min-height: 66px;
  align-items: center;
  gap: 22px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
  grid-template-columns: minmax(0, 1fr) auto;
}

.profile-toggle:last-child {
  border-bottom: 1px solid var(--line);
}

.profile-toggle strong,
.profile-toggle small {
  display: block;
}

.profile-toggle strong {
  font-size: 13px;
  line-height: 1.3;
}

.profile-toggle small {
  max-width: 590px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.profile-toggle input {
  width: 38px;
  height: 20px;
  appearance: none;
  background: var(--line-strong);
  border: 0;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 150ms ease;
}

.profile-toggle input::before {
  display: block;
  width: 16px;
  height: 16px;
  margin: 2px;
  background: var(--surface);
  border-radius: 50%;
  content: "";
  transition: transform 170ms cubic-bezier(.2, .8, .2, 1);
}

.profile-toggle input:checked {
  background: var(--accent);
}

.profile-toggle input:checked::before {
  transform: translateX(18px);
}

.profile-toggle input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.profile-password {
  margin-top: 42px;
}

.profile-password-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
}

.profile-password .input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px 40px;
}

.profile-password .input-action input {
  min-width: 0;
  border-radius: var(--radius-8) 0 0 var(--radius-8);
}

.profile-password .input-action .icon-btn {
  border-left: 0;
  border-radius: 0;
}

.profile-password .input-action .icon-btn:last-child {
  border-radius: 0 var(--radius-8) var(--radius-8) 0;
}

.profile-password-strength {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.profile-password-strength > i {
  height: 4px;
  background: var(--line);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.profile-password-strength > i > b {
  display: block;
  width: 0;
  height: 100%;
  background: var(--warning);
  border-radius: inherit;
  transition: width 220ms cubic-bezier(.2, .8, .2, 1), background 180ms ease;
}

.profile-password-strength > small {
  color: var(--muted);
  font-size: 10px;
  transition: color 180ms ease;
}

.profile-password-strength[data-score="5"] > i > b {
  background: var(--success);
}

.profile-password-strength[data-score="5"] > small {
  color: var(--success);
}

.profile-password > .btn {
  margin-top: 14px;
}

.profile-settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 42px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.profile-report {
  width: min(980px, 100%);
}

.profile-report-layout {
  display: grid;
  align-items: start;
  gap: clamp(36px, 6vw, 80px);
  grid-template-columns: minmax(210px, 270px) minmax(0, 1fr);
}

.profile-report-context {
  padding-top: 2px;
}

.profile-report-context ul {
  display: grid;
  gap: 14px;
  padding: 18px 0;
  margin: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  list-style: none;
}

.profile-report-context li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
  font-size: 11px;
}

.profile-report-context li .icon {
  width: 15px;
  height: 15px;
  color: var(--accent);
}

.profile-report-context > small {
  display: block;
  margin-top: 13px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.profile-report-message textarea {
  min-height: 300px;
  padding: 18px;
  resize: vertical;
  font-size: 14px;
  line-height: 1.55;
}

@keyframes profile-page-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}

@media (max-width: 900px) {
  .profile-settings-layout,
  .profile-report-layout {
    gap: 36px;
    grid-template-columns: 1fr;
  }

  .profile-account {
    position: static;
  }

  .profile-account .field {
    max-width: 520px;
  }

  .profile-password-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .profile-route {
    padding:
      calc(70px + env(safe-area-inset-top))
      16px
      calc(104px + env(safe-area-inset-bottom));
  }

  .profile-page-head {
    gap: 18px;
    margin-bottom: 34px;
    grid-template-columns: 1fr;
  }

  .profile-page-head h1 {
    margin-top: 2px;
    font-size: clamp(40px, 13vw, 58px);
  }

  .profile-back {
    width: max-content;
    min-height: 30px;
  }

  .profile-settings-layout,
  .profile-report-layout {
    gap: 34px;
  }

  .profile-identity {
    align-items: flex-start;
  }

  .profile-toggle {
    min-height: 70px;
    gap: 16px;
  }

  .profile-toggle strong {
    font-size: 12px;
  }

  .profile-toggle small {
    font-size: 10px;
  }

  .profile-password {
    margin-top: 36px;
  }

  .profile-settings-actions {
    margin-top: 34px;
  }

  .profile-settings-actions .btn {
    min-height: 42px;
    flex: 1;
  }

  .profile-report-message textarea {
    min-height: 260px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-page {
    animation: none;
  }

  .profile-back,
  .profile-toggle input::before,
  .profile-password-strength > i > b {
    transition: none;
  }
}

/* Доступ для агента (MCP) — секция профиля */
.profile-agent .profile-agent-status { margin: 0 0 12px; font-size: 14px; opacity: 0.85; }
.profile-agent .profile-agent-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.profile-agent .profile-agent-issued { margin-top: 14px; display: grid; gap: 10px; }
.profile-agent .profile-agent-issued textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.profile-agent .profile-agent-issued input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.profile-agent .profile-agent-penpot { margin-top: 18px; display: grid; gap: 10px; }
.profile-agent .profile-agent-penpot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 720px) { .profile-agent .profile-agent-penpot-grid { grid-template-columns: 1fr; } }
