.profile-page {
  min-height: 100vh;
}

/* Profile dashboard reference layout */
body[data-page="profile"] {
  --profile-ref-green: #009b36;
  --profile-ref-green-dark: #078c34;
  --profile-ref-ink: #11191d;
  --profile-ref-muted: #687579;
  --profile-ref-border: rgba(17, 25, 29, 0.075);
  --profile-ref-shadow: 0 22px 56px rgba(17, 25, 29, 0.08);
  --profile-ref-soft-shadow: 0 14px 34px rgba(17, 25, 29, 0.055);
  background:
    radial-gradient(circle at 82% 6%, rgba(0, 155, 54, 0.08), transparent 28%),
    linear-gradient(180deg, #fbfdfc 0%, #f4f7f5 100%);
  color: var(--profile-ref-ink);
}

body[data-page="profile"] .site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  width: 100%;
  height: 76px;
  margin: 0;
  padding: 0 44px;
  border: 0;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1px 0 rgba(17, 25, 29, 0.04), 0 12px 32px rgba(17, 25, 29, 0.04);
  backdrop-filter: blur(18px);
  transform: none;
}

body[data-page="profile"] .site-header::before {
  content: none;
  display: none;
}

body[data-page="profile"] .brand-wordmark {
  flex: 0 0 auto;
  color: var(--profile-ref-green);
  font-family: "Sora", "Manrope", sans-serif;
  font-size: clamp(1.5rem, 2vw, 1.8rem);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
}

body[data-page="profile"] .header-actions {
  position: static;
  flex: 1 1 auto;
  min-width: 0;
  --profile-header-icon-size: var(--header-icon-size);
  gap: 24px;
  flex-wrap: nowrap;
  justify-content: flex-start;
}

body[data-page="profile"] .header-city-picker-anchor {
  margin-left: 34px;
}

body[data-page="profile"] .header-chip-location {
  height: 44px;
  min-height: 44px;
  margin-left: 0;
  gap: 8px;
  padding: 0;
  color: var(--profile-ref-ink);
  background: transparent;
  border: 0;
  box-shadow: none;
  font-size: 0.95rem;
  font-weight: 800;
}

body[data-page="profile"] .header-chip-location::before {
  width: var(--profile-header-icon-size);
  height: var(--profile-header-icon-size);
  flex: 0 0 var(--profile-header-icon-size);
  background: var(--profile-ref-green);
}

body[data-page="profile"] .header-chip-location::after {
  content: "";
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") center / contain no-repeat;
}

body[data-page="profile"] .profile-header-map-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 42px;
  margin-left: auto;
  padding: 0;
  color: var(--profile-ref-ink);
  background: transparent;
  border: 0;
  box-shadow: none;
  font-size: 0.94rem;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  transition:
    transform 160ms ease,
    color 160ms ease;
}

body[data-page="profile"] .profile-header-map-link::before {
  content: "";
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  background: var(--profile-ref-green);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 4 3.5 6.5v13L9 17l6 2.5 5.5-2.5v-13L15 6.5 9 4Z'/%3E%3Cline x1='9' y1='4' x2='9' y2='17'/%3E%3Cline x1='15' y1='6.5' x2='15' y2='19.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 4 3.5 6.5v13L9 17l6 2.5 5.5-2.5v-13L15 6.5 9 4Z'/%3E%3Cline x1='9' y1='4' x2='9' y2='17'/%3E%3Cline x1='15' y1='6.5' x2='15' y2='19.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

body[data-page="profile"] .profile-header-map-link:hover,
body[data-page="profile"] .profile-header-map-link:focus-visible {
  transform: translateY(-1px);
  color: var(--profile-ref-ink);
}

/* Icon-only map link: hide the "Карта" label and use theme ink (white on dark). */
body[data-page="profile"] .profile-header-map-link {
  font-size: 0;
  gap: 0;
  width: 42px;
}
body[data-page="profile"] .profile-header-map-link::before {
  background: var(--profile-ref-ink);
}

body[data-page="profile"] .header-notification-button,
body[data-page="profile"] #logoutButton.header-chip-auth {
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--profile-ref-ink);
  background: transparent;
  box-shadow: none;
}

body[data-page="profile"] .header-notification-button:hover,
body[data-page="profile"] .header-notification-button:focus-visible,
body[data-page="profile"] .header-notification-button.is-open,
body[data-page="profile"] .header-notification-button.has-unread,
body[data-page="profile"] .header-chip-user:hover,
body[data-page="profile"] #logoutButton.header-chip-auth:hover,
body[data-page="profile"] #logoutButton.header-chip-auth:focus-visible,
body[data-page="profile"] #logoutButton.header-chip-auth.is-logging-out {
  background: transparent;
  border: 0;
  box-shadow: none;
}

body[data-page="profile"] #logoutButton.header-chip-auth::before,
body[data-page="profile"] .header-notification-icon {
  width: var(--profile-header-icon-size);
  height: var(--profile-header-icon-size);
  flex: 0 0 var(--profile-header-icon-size);
}

body[data-page="profile"] .header-notification-button {
  color: var(--profile-ref-ink);
}

body[data-page="profile"] .header-notification-badge {
  top: 5px;
  right: 4px;
}

body[data-page="profile"] .header-chip-user {
  width: auto;
  min-width: 0;
  height: 50px;
  gap: 12px;
  padding: 0 4px 0 0;
  color: var(--profile-ref-ink);
  background: transparent;
  border: 0;
  box-shadow: none;
}

body[data-page="profile"] .header-user-chip-avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  color: var(--profile-ref-green);
  background: rgba(0, 155, 54, 0.1);
}

body[data-page="profile"] .header-user-chip-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

body[data-page="profile"] .header-user-chip-name,
body[data-page="profile"] .header-user-chip-role {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: nowrap;
  clip-path: none;
}

body[data-page="profile"] .header-user-chip-name {
  color: var(--profile-ref-ink);
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.05;
}

body[data-page="profile"] .header-user-chip-role {
  color: var(--profile-ref-muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.05;
}

body[data-page="profile"] #loginButton.header-chip-auth,
body[data-page="profile"] .site-header:not(.auth-header) .primary-button.header-signup-button {
  color: var(--profile-ref-ink);
  background: transparent;
  border: 0;
  box-shadow: none;
  font-size: 0.92rem;
  font-weight: 800;
}

body[data-page="profile"] .site-header:not(.auth-header) .primary-button.header-signup-button {
  color: #ffffff;
  padding: 14px 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--profile-ref-green), var(--profile-ref-green-dark));
  box-shadow: 0 14px 28px rgba(0, 155, 54, 0.22);
}

body[data-page="profile"] .profile-shell {
  width: min(1460px, calc(100% - 88px));
  padding: 88px 0 12px;
}

body[data-page="profile"] .profile-hero {
  display: none;
}

body[data-page="profile"] .profile-dashboard {
  grid-template-columns: minmax(256px, 292px) minmax(0, 1fr);
  gap: clamp(30px, 3.5vw, 48px);
  align-items: start;
  margin-top: 0;
}

body[data-page="profile"] .profile-sidebar,
body[data-page="profile"] .profile-stat-card,
body[data-page="profile"] .profile-level-card,
body[data-page="profile"] .profile-city-card,
body[data-page="profile"] .profile-goals,
body[data-page="profile"] .profile-achievement-card,
body[data-page="profile"] .profile-card,
body[data-page="profile"] .profile-admin-panel,
body[data-page="profile"] .profile-added-place-card {
  border: 1px solid var(--profile-ref-border);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--profile-ref-shadow);
  backdrop-filter: blur(18px);
}

body[data-page="profile"] .profile-sidebar {
  top: 88px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: calc(100vh - 104px);
  gap: 0;
  padding: 28px 16px 24px;
  border-radius: 24px;
  border-color: rgba(17, 25, 29, 0.06);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 52px rgba(17, 25, 29, 0.075);
}

body[data-page="profile"] .profile-sidebar-user {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 54px;
  padding: 0 18px;
}

body[data-page="profile"] .profile-sidebar-avatar {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: rgba(0, 155, 54, 0.1);
  color: var(--profile-ref-green);
  font-weight: 900;
}

body[data-page="profile"] .profile-sidebar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body[data-page="profile"] .profile-sidebar-user-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

body[data-page="profile"] .profile-sidebar-user-copy strong {
  overflow: hidden;
  color: var(--profile-ref-ink);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.06;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-page="profile"] .profile-sidebar-user-copy span {
  color: var(--profile-ref-muted);
  font-size: 0.88rem;
  font-weight: 800;
}

body[data-page="profile"] .profile-nav {
  display: grid;
  gap: 4px;
  margin-top: 18px;
}

body[data-page="profile"] .profile-nav-button {
  min-height: 44px;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 14px;
  padding: 0 16px;
  border-radius: 13px;
  color: #6f7c80;
  font-size: 0.92rem;
  font-weight: 800;
}

body[data-page="profile"] .profile-nav-button:hover {
  color: var(--profile-ref-ink);
  background: rgba(17, 25, 29, 0.04);
}

body[data-page="profile"] .profile-nav-button.is-active {
  color: var(--profile-ref-green);
  background: #e6f7ed;
}

body[data-page="profile"] .profile-workspace {
  gap: 18px;
}

@media (min-width: 1181px) {
  body[data-page="profile"] .profile-workspace {
    min-height: calc(100vh - 96px);
  }
}

body[data-page="profile"] .profile-section[data-profile-section="stats"] {
  gap: 18px;
}

body[data-page="profile"] .profile-stats-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 338px);
  align-items: center;
  gap: 24px;
}

body[data-page="profile"] .profile-welcome {
  display: grid;
  gap: 10px;
}

body[data-page="profile"] .profile-welcome h2 {
  margin: 0;
  color: var(--profile-ref-ink);
  font-family: "Sora", "Manrope", sans-serif;
  font-size: clamp(2rem, 3.45vw, 2.85rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: 0;
}

body[data-page="profile"] .profile-welcome h2 span {
  color: var(--profile-ref-green);
}

body[data-page="profile"] .profile-welcome p {
  max-width: 620px;
  margin: 0;
  color: var(--profile-ref-muted);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.46;
}

body[data-page="profile"] .profile-level-card {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  min-height: 96px;
  padding: 18px;
  border-radius: 24px;
}

body[data-page="profile"] .profile-level-badge {
  width: 54px;
  height: 62px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(150deg, var(--profile-ref-green), #0bc653);
  clip-path: polygon(50% 0, 92% 24%, 92% 76%, 50% 100%, 8% 76%, 8% 24%);
  font-family: "Sora", "Manrope", sans-serif;
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1;
}

body[data-page="profile"] .profile-level-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

body[data-page="profile"] .profile-level-copy strong {
  color: var(--profile-ref-ink);
  font-size: 1rem;
  font-weight: 900;
}

body[data-page="profile"] .profile-level-copy span {
  color: var(--profile-ref-muted);
  font-size: 0.86rem;
  font-weight: 700;
}

body[data-page="profile"] .profile-level-progress {
  width: 100%;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(17, 25, 29, 0.08);
}

body[data-page="profile"] .profile-level-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--profile-ref-green), #0bc653);
  box-shadow: 0 8px 18px rgba(0, 155, 54, 0.24);
  transition: width 240ms ease;
}

body[data-page="profile"] .profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

body[data-page="profile"] .profile-stat-card {
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  align-content: center;
  gap: 15px;
  min-height: 102px;
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
}

body[data-page="profile"] .profile-stat-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 155, 54, 0.12);
}

body[data-page="profile"] .profile-stat-icon::before {
  content: "";
  width: 25px;
  height: 25px;
  background: var(--profile-ref-green);
  -webkit-mask: var(--profile-stat-icon) center / contain no-repeat;
  mask: var(--profile-stat-icon) center / contain no-repeat;
}

body[data-page="profile"] .profile-stat-icon-pin {
  --profile-stat-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21s7-6.5 7-12a7 7 0 0 0-14 0c0 5.5 7 12 7 12Z'/%3E%3Ccircle cx='12' cy='9' r='2.5'/%3E%3C/svg%3E");
}

body[data-page="profile"] .profile-stat-icon-binoculars {
  --profile-stat-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5' width='17' height='14' rx='2'/%3E%3Ccircle cx='8' cy='9.5' r='1.5'/%3E%3Cpath d='M4 17l5-5 3 3 3-4 5 6'/%3E%3C/svg%3E");
}

body[data-page="profile"] .profile-stat-icon-check {
  --profile-stat-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='4 12.5 9 17.5 20 6.5'/%3E%3C/svg%3E");
}

body[data-page="profile"] .profile-stat-icon-rank {
  --profile-stat-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 21h8'/%3E%3Cpath d='M12 17.5V21'/%3E%3Cpath d='M7 4h10v4a5 5 0 0 1-10 0Z'/%3E%3Cpath d='M7 6H4.5v1.5A3 3 0 0 0 7.5 10.5'/%3E%3Cpath d='M17 6h2.5v1.5a3 3 0 0 1-3 3'/%3E%3C/svg%3E");
}

body[data-page="profile"] .profile-stat-copy {
  display: grid;
  gap: 5px;
}

body[data-page="profile"] .profile-stat-label {
  color: var(--profile-ref-muted);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

body[data-page="profile"] .profile-stat-value {
  color: var(--profile-ref-ink);
  font-family: "Sora", "Manrope", sans-serif;
  font-size: clamp(1.75rem, 2.7vw, 2.1rem);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
}

body[data-page="profile"] .profile-stat-note {
  color: var(--profile-ref-muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

body[data-page="profile"] .profile-exploration {
  gap: 12px;
}

body[data-page="profile"] .profile-exploration-head {
  align-items: center;
}

body[data-page="profile"] .profile-exploration-head h3,
body[data-page="profile"] .profile-block-head h3 {
  color: var(--profile-ref-ink);
  font-family: "Sora", "Manrope", sans-serif;
  font-size: 1.36rem;
  font-weight: 800;
  letter-spacing: 0;
}

body[data-page="profile"] .profile-exploration-head p {
  color: var(--profile-ref-muted);
  font-size: 0.95rem;
  font-weight: 800;
}

body[data-page="profile"] .profile-city-card {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  box-shadow: var(--profile-ref-shadow);
}

body[data-page="profile"] .profile-city-banner {
  min-height: 236px;
  align-content: end;
  gap: 12px;
  padding: 28px 34px 102px;
  background-color: #17201d;
  background-image:
    linear-gradient(90deg, rgba(9, 15, 13, 0.78), rgba(9, 15, 13, 0.44) 54%, rgba(9, 15, 13, 0.62)),
    var(--profile-city-banner-image, url("https://images.unsplash.com/photo-1512470876302-972faa2aa9a4?auto=format&fit=crop&w=1200&q=84"));
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

body[data-page="profile"] .profile-city-banner::before {
  background: linear-gradient(180deg, rgba(9, 15, 13, 0.12), rgba(9, 15, 13, 0.42));
}

body[data-page="profile"] .profile-city-banner::after {
  content: none;
  display: none;
}

body[data-page="profile"] .profile-city-kicker {
  min-height: 30px;
  padding: 0 13px;
  background: var(--profile-ref-green);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: none;
}

body[data-page="profile"] .profile-city-banner h3 {
  max-width: min(100%, 15ch);
  font-size: clamp(2rem, 4.2vw, 3.15rem);
  font-weight: 800;
  letter-spacing: 0;
}

body[data-page="profile"] .profile-city-banner p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.05rem;
  font-weight: 800;
}

body[data-page="profile"] .profile-city-body {
  position: absolute;
  inset: auto 32px 18px 32px;
  z-index: 2;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 28px;
  padding: 0;
  color: #ffffff;
}

body[data-page="profile"] .profile-city-progress {
  gap: 12px;
}

body[data-page="profile"] .profile-city-progress-head span,
body[data-page="profile"] .profile-city-progress-head strong,
body[data-page="profile"] .profile-city-progress-meta span {
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.9rem;
  font-weight: 800;
}

body[data-page="profile"] .profile-progress-bar {
  height: 10px;
  background: rgba(255, 255, 255, 0.34);
}

body[data-page="profile"] .profile-progress-bar span {
  background: linear-gradient(90deg, #ffffff, #cef4d9);
  box-shadow: none;
}

body[data-page="profile"] .profile-city-map-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 176px;
  min-height: 52px;
  padding: 0 24px;
  border-radius: 16px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--profile-ref-green), #08b942);
  box-shadow: 0 16px 32px rgba(0, 155, 54, 0.32);
  font-size: 0.96rem;
  font-weight: 900;
  text-decoration: none;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

body[data-page="profile"] .profile-city-map-button:hover,
body[data-page="profile"] .profile-city-map-button:focus-visible {
  transform: translateY(-1px);
  color: #ffffff;
  box-shadow: 0 20px 38px rgba(0, 155, 54, 0.36);
}

body[data-page="profile"] .profile-city-map-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 4 3.5 6.5v13L9 17l6 2.5 5.5-2.5v-13L15 6.5 9 4Z'/%3E%3Cline x1='9' y1='4' x2='9' y2='17'/%3E%3Cline x1='15' y1='6.5' x2='15' y2='19.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 4 3.5 6.5v13L9 17l6 2.5 5.5-2.5v-13L15 6.5 9 4Z'/%3E%3Cline x1='9' y1='4' x2='9' y2='17'/%3E%3Cline x1='15' y1='6.5' x2='15' y2='19.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

body[data-page="profile"] .profile-bottom-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(0, 1.35fr);
  gap: 24px;
}

body[data-page="profile"] .profile-goals,
body[data-page="profile"] .profile-achievements {
  display: grid;
  gap: 10px;
  min-width: 0;
}

body[data-page="profile"] .profile-goals {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body[data-page="profile"] .profile-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

body[data-page="profile"] .profile-block-head h3 {
  margin: 0;
}

body[data-page="profile"] .profile-inline-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--profile-ref-green);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 900;
  cursor: pointer;
}

body[data-page="profile"] .profile-goals-list {
  overflow: hidden;
  border: 1px solid var(--profile-ref-border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--profile-ref-soft-shadow);
}

body[data-page="profile"] .profile-goal-item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 60px;
  padding: 10px 18px;
  border-bottom: 1px solid rgba(17, 25, 29, 0.07);
}

body[data-page="profile"] .profile-goal-item:last-child {
  border-bottom: 0;
}

body[data-page="profile"] .profile-goal-icon,
body[data-page="profile"] .profile-achievement-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 155, 54, 0.1);
}

body[data-page="profile"] .profile-goal-icon::before,
body[data-page="profile"] .profile-achievement-icon::before {
  content: "";
  width: 23px;
  height: 23px;
  background: var(--profile-ref-green);
  -webkit-mask: var(--profile-achievement-icon, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='6' cy='18' r='2.5'/%3E%3Ccircle cx='18' cy='6' r='2.5'/%3E%3Cpath d='M8.5 17.5H14a3 3 0 0 0 0-6H10a3 3 0 0 1 0-6h5.5'/%3E%3C/svg%3E")) center / contain no-repeat;
  mask: var(--profile-achievement-icon, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='6' cy='18' r='2.5'/%3E%3Ccircle cx='18' cy='6' r='2.5'/%3E%3Cpath d='M8.5 17.5H14a3 3 0 0 0 0-6H10a3 3 0 0 1 0-6h5.5'/%3E%3C/svg%3E")) center / contain no-repeat;
}

body[data-page="profile"] .profile-goal-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

body[data-page="profile"] .profile-goal-copy strong,
body[data-page="profile"] .profile-achievement-card strong {
  color: var(--profile-ref-ink);
  font-size: 0.96rem;
  font-weight: 900;
  line-height: 1.25;
}

body[data-page="profile"] .profile-goal-copy span,
body[data-page="profile"] .profile-achievement-card span {
  color: var(--profile-ref-muted);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.35;
}

body[data-page="profile"] .profile-goal-reward {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(0, 155, 54, 0.1);
  color: var(--profile-ref-green);
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

body[data-page="profile"] .profile-goal-item.is-complete .profile-goal-reward {
  color: #ffffff;
  background: var(--profile-ref-green);
}

body[data-page="profile"] .profile-achievements-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

/* The dashboard shows only a 3-item preview of goals / achievements; the full
   lists live in the "Цели и достижения" section opened via "Смотреть все". */
body[data-page="profile"] [data-profile-section="stats"] .profile-goal-item:nth-child(n + 4),
body[data-page="profile"] [data-profile-section="stats"] .profile-achievement-card:nth-child(n + 4) {
  display: none;
}

/* "Цели и достижения" section: goals block above the achievements grid. */
body[data-page="profile"] .profile-milestones {
  display: grid;
  gap: 28px;
}

body[data-page="profile"] .profile-achievement-card {
  min-height: 154px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 18px;
  border-radius: 20px;
  box-shadow: var(--profile-ref-soft-shadow);
}

body[data-page="profile"] .profile-achievement-card.is-locked {
  box-shadow: 0 14px 30px rgba(17, 25, 29, 0.045);
}

body[data-page="profile"] .profile-achievement-card.is-locked .profile-achievement-icon {
  background: rgba(104, 117, 121, 0.12);
}

body[data-page="profile"] .profile-achievement-card.is-locked .profile-achievement-icon::before {
  background: #a8b0b3;
}

body[data-page="profile"] .profile-achievement-icon-ticket {
  --profile-achievement-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='5' width='16' height='16' rx='2'/%3E%3Cline x1='4' y1='9' x2='20' y2='9'/%3E%3Cline x1='8' y1='3' x2='8' y2='6'/%3E%3Cline x1='16' y1='3' x2='16' y2='6'/%3E%3Cpath d='M9 14.5l2 2 4-4'/%3E%3C/svg%3E");
}

body[data-page="profile"] .profile-achievement-icon-route {
  --profile-achievement-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='6' cy='18' r='2.5'/%3E%3Ccircle cx='18' cy='6' r='2.5'/%3E%3Cpath d='M8.5 17.5H14a3 3 0 0 0 0-6H10a3 3 0 0 1 0-6h5.5'/%3E%3C/svg%3E");
}

body[data-page="profile"] .profile-achievement-icon-map {
  --profile-achievement-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 4 3.5 6.5v13L9 17l6 2.5 5.5-2.5v-13L15 6.5 9 4Z'/%3E%3Cline x1='9' y1='4' x2='9' y2='17'/%3E%3Cline x1='15' y1='6.5' x2='15' y2='19.5'/%3E%3C/svg%3E");
}
/* Achievement icons added for the expanded badge set. */
body[data-page="profile"] .profile-achievement-icon-pen {
  --profile-achievement-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.4 3.6a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z'/%3E%3C/svg%3E");
}
body[data-page="profile"] .profile-achievement-icon-flag {
  --profile-achievement-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 21V4'/%3E%3Cpath d='M5 4h11l-2 3 2 3H5'/%3E%3C/svg%3E");
}
body[data-page="profile"] .profile-achievement-icon-compass {
  --profile-achievement-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M15.6 8.4l-2 5.2-5.2 2 2-5.2Z'/%3E%3C/svg%3E");
}
body[data-page="profile"] .profile-achievement-icon-star {
  --profile-achievement-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.2l2.6 5.3 5.9.9-4.2 4.1 1 5.9L12 16.7 6.7 19.4l1-5.9L3.5 9.4l5.9-.9Z'/%3E%3C/svg%3E");
}
body[data-page="profile"] .profile-achievement-icon-trophy {
  --profile-achievement-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 21h8'/%3E%3Cpath d='M12 17.5V21'/%3E%3Cpath d='M7 4h10v4a5 5 0 0 1-10 0Z'/%3E%3Cpath d='M7 6H4.5v1.5A3 3 0 0 0 7.5 10.5'/%3E%3Cpath d='M17 6h2.5v1.5a3 3 0 0 1-3 3'/%3E%3C/svg%3E");
}
body[data-page="profile"] .profile-achievement-icon-chat {
  --profile-achievement-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.5 14.5a2 2 0 0 1-2 2H8l-4 3.5V5.5a2 2 0 0 1 2-2h12.5a2 2 0 0 1 2 2Z'/%3E%3C/svg%3E");
}

body[data-page="profile"] .profile-achievement-card em {
  width: fit-content;
  margin-top: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(17, 25, 29, 0.06);
  color: var(--profile-ref-muted);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
}

body[data-page="profile"] .profile-achievement-card.is-unlocked em {
  background: rgba(0, 155, 54, 0.1);
  color: var(--profile-ref-green);
}

@media (min-width: 1181px) {
  /* The stats dashboard is meant to fill one screen on wide displays. Use
     min-height instead of a fixed height + overflow:hidden so short laptop
     viewports can scroll to the bottom of the dashboard instead of clipping
     it (the sidebar is position:sticky, so it still stays in view). */
  body[data-page="profile"].profile-stats-section-active {
    min-height: 100vh;
  }
}

@media (max-height: 860px) and (min-width: 1181px) {
  body[data-page="profile"] .profile-shell {
    width: min(1460px, calc(100% - 64px));
    padding: 82px 0 8px;
  }

  body[data-page="profile"] .profile-dashboard {
    grid-template-columns: minmax(244px, 292px) minmax(0, 1fr);
    gap: clamp(26px, 3vw, 44px);
  }

  body[data-page="profile"] .profile-sidebar {
    top: 82px;
    min-height: calc(100vh - 94px);
    gap: 0;
    padding: 28px 16px 24px;
    border-radius: 24px;
  }

  body[data-page="profile"] .profile-sidebar-user {
    gap: 13px;
    min-height: 54px;
    padding: 0 18px;
  }

  body[data-page="profile"] .profile-sidebar-avatar {
    width: 54px;
    height: 54px;
    flex-basis: 54px;
  }

  body[data-page="profile"] .profile-sidebar-user-copy {
    gap: 3px;
  }

  body[data-page="profile"] .profile-sidebar-user-copy strong {
    font-size: 1rem;
  }

  body[data-page="profile"] .profile-sidebar-user-copy span {
    font-size: 0.88rem;
  }

  body[data-page="profile"] .profile-nav {
    gap: 4px;
    margin-top: 18px;
  }

  body[data-page="profile"] .profile-nav-button {
    min-height: 44px;
    padding: 0 16px;
    border-radius: 13px;
    font-size: 0.92rem;
  }

  body[data-page="profile"] .profile-workspace,
  body[data-page="profile"] .profile-section[data-profile-section="stats"] {
    gap: 12px;
  }

  body[data-page="profile"] .profile-stats-top {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 336px);
    gap: 18px;
  }

  body[data-page="profile"] .profile-welcome {
    gap: 7px;
  }

  body[data-page="profile"] .profile-welcome h2 {
    font-size: clamp(1.9rem, 3vw, 2.35rem);
  }

  body[data-page="profile"] .profile-welcome p {
    max-width: 580px;
    font-size: 0.9rem;
    line-height: 1.35;
  }

  body[data-page="profile"] .profile-level-card {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 12px;
    min-height: 84px;
    padding: 14px 16px;
    border-radius: 20px;
  }

  body[data-page="profile"] .profile-level-badge {
    width: 46px;
    height: 52px;
    font-size: 1.35rem;
  }

  body[data-page="profile"] .profile-level-copy {
    gap: 4px;
  }

  body[data-page="profile"] .profile-level-copy strong {
    font-size: 0.92rem;
  }

  body[data-page="profile"] .profile-level-copy span {
    font-size: 0.8rem;
  }

  body[data-page="profile"] .profile-stats-grid {
    gap: 12px;
  }

  body[data-page="profile"] .profile-stat-card {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    min-height: 84px;
    padding: 12px 16px;
    border-radius: 18px;
  }

  body[data-page="profile"] .profile-stat-icon {
    width: 44px;
    height: 44px;
  }

  body[data-page="profile"] .profile-stat-icon::before {
    width: 22px;
    height: 22px;
  }

  body[data-page="profile"] .profile-stat-copy {
    gap: 3px;
  }

  body[data-page="profile"] .profile-stat-label {
    font-size: 0.82rem;
  }

  body[data-page="profile"] .profile-stat-value {
    font-size: clamp(1.48rem, 2.2vw, 1.82rem);
  }

  body[data-page="profile"] .profile-stat-note {
    font-size: 0.72rem;
  }

  body[data-page="profile"] .profile-exploration {
    gap: 8px;
  }

  body[data-page="profile"] .profile-exploration-head h3,
  body[data-page="profile"] .profile-block-head h3 {
    font-size: 1.18rem;
  }

  body[data-page="profile"] .profile-exploration-head p,
  body[data-page="profile"] .profile-inline-link {
    font-size: 0.84rem;
  }

  body[data-page="profile"] .profile-city-banner {
    min-height: 178px;
    gap: 8px;
    padding: 20px 28px 76px;
  }

  body[data-page="profile"] .profile-city-kicker {
    min-height: 26px;
    padding: 0 11px;
    font-size: 0.7rem;
  }

  body[data-page="profile"] .profile-city-banner h3 {
    font-size: clamp(1.78rem, 3.2vw, 2.5rem);
  }

  body[data-page="profile"] .profile-city-banner p {
    font-size: 0.9rem;
  }

  body[data-page="profile"] .profile-city-body {
    inset: auto 28px 14px;
    gap: 18px;
  }

  body[data-page="profile"] .profile-city-progress {
    gap: 8px;
  }

  body[data-page="profile"] .profile-city-progress-head span,
  body[data-page="profile"] .profile-city-progress-head strong,
  body[data-page="profile"] .profile-city-progress-meta span {
    font-size: 0.8rem;
  }

  body[data-page="profile"] .profile-city-map-button {
    min-width: 158px;
    min-height: 46px;
    padding: 0 20px;
    border-radius: 14px;
    font-size: 0.88rem;
  }

  body[data-page="profile"] .profile-bottom-grid {
    gap: 20px;
  }

  body[data-page="profile"] .profile-goals,
  body[data-page="profile"] .profile-achievements {
    gap: 8px;
  }

  body[data-page="profile"] .profile-goals-list {
    border-radius: 18px;
  }

  body[data-page="profile"] .profile-goal-item {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 12px;
    min-height: 46px;
    padding: 5px 14px;
  }

  body[data-page="profile"] .profile-goal-icon,
  body[data-page="profile"] .profile-achievement-icon {
    width: 40px;
    height: 40px;
  }

  body[data-page="profile"] .profile-goal-icon::before,
  body[data-page="profile"] .profile-achievement-icon::before {
    width: 20px;
    height: 20px;
  }

  body[data-page="profile"] .profile-goal-copy strong,
  body[data-page="profile"] .profile-achievement-card strong {
    font-size: 0.88rem;
  }

  body[data-page="profile"] .profile-goal-copy span,
  body[data-page="profile"] .profile-achievement-card span {
    font-size: 0.78rem;
  }

  body[data-page="profile"] .profile-goal-reward {
    min-height: 24px;
    padding: 0 10px;
    font-size: 0.74rem;
  }

  body[data-page="profile"] .profile-achievements-list {
    gap: 12px;
  }

  body[data-page="profile"] .profile-achievement-card {
    min-height: 124px;
    gap: 6px;
    padding: 12px 14px;
    border-radius: 18px;
  }

  body[data-page="profile"] .profile-achievement-card em {
    margin-top: 2px;
    padding: 5px 9px;
    font-size: 0.72rem;
  }
}

@media (max-width: 1180px) {
  body[data-page="profile"] .profile-shell {
    width: min(100% - 44px, 980px);
  }

  body[data-page="profile"] .profile-dashboard {
    /* minmax(0,1fr) + min-width:0 — иначе grid-трек не сжимается ниже min-content
       контента и рабочая область раздувается за экран (контент обрезается). */
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-page="profile"] .profile-workspace,
  body[data-page="profile"] .profile-section {
    min-width: 0;
  }

  body[data-page="profile"] .profile-sidebar {
    position: relative;
    top: auto;
    min-height: 0;
  }

  body[data-page="profile"] .profile-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body[data-page="profile"] .profile-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-page="profile"] .profile-bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  body[data-page="profile"] .site-header {
    height: auto;
    min-height: 76px;
    padding: 16px 22px;
  }

  body[data-page="profile"] .header-actions {
    gap: 14px;
  }

  body[data-page="profile"] .header-city-picker-anchor,
  body[data-page="profile"] .header-chip-location {
    margin-left: 0;
  }

  body[data-page="profile"] .profile-header-map-link,
  body[data-page="profile"] .header-user-chip-copy {
    display: none;
  }

  body[data-page="profile"] .profile-shell {
    width: min(100% - 28px, 680px);
    padding-top: 104px;
  }

  body[data-page="profile"] .profile-stats-top {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 620px) {
  body[data-page="profile"] .profile-stats-grid,
  body[data-page="profile"] .profile-achievements-list {
    grid-template-columns: 1fr;
  }

  body[data-page="profile"] .profile-stat-card,
  body[data-page="profile"] .profile-level-card,
  body[data-page="profile"] .profile-goal-item {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  body[data-page="profile"] .profile-goal-reward {
    justify-self: start;
  }
}

/* Новые мобильные элементы скрыты на десктопе. */
.profile-mobile-topbar,
.profile-mobile-menu {
  display: none;
}

/* ============================================================================
   Мобильный профиль (≤900px), собран заново под смартфоны.
   Домашний экран: шапка (аватар+имя) → уровень → плитки статов → цели → меню
   разделов (список в стиле настроек). Под-раздел открывается полноэкранно
   с топбаром «← Профиль». Десктоп (>900px) не затрагивается.
   ============================================================================ */
@media (max-width: 900px) {
  /* Десктопную боковую навигацию и подсказку убираем. */
  body[data-page="profile"] .profile-nav {
    display: none;
  }

  /* Sidebar превращается в прозрачную шапку профиля. */
  body[data-page="profile"] .profile-sidebar {
    padding: 0;
    min-height: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  body[data-page="profile"] .profile-sidebar-user {
    min-height: 0;
    padding: 4px 4px 0;
    gap: 14px;
  }
  body[data-page="profile"] .profile-sidebar-avatar {
    width: 60px;
    height: 60px;
    flex-basis: 60px;
    font-size: 1.4rem;
  }
  body[data-page="profile"] .profile-sidebar-user-copy strong {
    font-size: 1.32rem;
    line-height: 1.1;
  }
  body[data-page="profile"] .profile-sidebar-user-copy span {
    font-size: 0.95rem;
  }

  /* Меню разделов — список-«настройки». */
  body[data-page="profile"] .profile-mobile-menu {
    display: flex;
    flex-direction: column;
    margin-top: 8px;
    border-radius: 18px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--profile-ref-border);
    box-shadow: var(--profile-ref-soft-shadow);
  }
  body[data-page="profile"] .profile-mobile-menu:empty {
    display: none;
  }
  body[data-page="profile"] .profile-menu-row {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 56px;
    padding: 0 16px;
    border: 0;
    background: transparent;
    color: var(--profile-ref-ink);
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    transition: background 150ms ease;
  }
  body[data-page="profile"] .profile-menu-row + .profile-menu-row {
    border-top: 1px solid var(--profile-ref-border);
  }
  body[data-page="profile"] .profile-menu-row:active {
    background: rgba(0, 155, 54, 0.09);
  }
  body[data-page="profile"] .profile-menu-icon {
    display: inline-flex;
    width: 22px;
    height: 22px;
    color: var(--profile-ref-green);
  }
  body[data-page="profile"] .profile-menu-icon svg {
    width: 100%;
    height: 100%;
  }
  body[data-page="profile"] .profile-menu-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body[data-page="profile"] .profile-menu-chevron {
    display: inline-flex;
    width: 18px;
    height: 18px;
    color: var(--profile-ref-muted);
    opacity: 0.55;
  }
  body[data-page="profile"] .profile-menu-chevron svg {
    width: 100%;
    height: 100%;
  }

  /* Топбар «← Профиль» (виден только в под-разделе). */
  body[data-page="profile"] .profile-mobile-topbar {
    margin-bottom: 12px;
  }
  body[data-page="profile"] .profile-mobile-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 15px 0 10px;
    border-radius: 999px;
    border: 1px solid var(--profile-ref-border);
    background: rgba(255, 255, 255, 0.96);
    color: var(--profile-ref-ink);
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: var(--profile-ref-soft-shadow);
  }
  body[data-page="profile"] .profile-mobile-back svg {
    width: 20px;
    height: 20px;
  }

  /* --- Меню-экран («Профиль»): шапка (аватар+имя) + список разделов.
     На телефоне профиль работает как два экрана: список разделов (это состояние,
     .profile-mobile-home) и полноэкранный раздел с кнопкой «назад». Управляется
     классом profile-mobile-home на <body> (см. profile.js). --- */
  body[data-page="profile"].profile-mobile-home .profile-section {
    display: none;
  }
  body[data-page="profile"].profile-mobile-home .profile-mobile-topbar {
    display: none;
  }

  /* --- Экран раздела: прячем меню+шапку, показываем «назад» + раздел. --- */
  body[data-page="profile"]:not(.profile-mobile-home) .profile-sidebar,
  body[data-page="profile"]:not(.profile-mobile-home) .profile-mobile-menu {
    display: none;
  }
  body[data-page="profile"]:not(.profile-mobile-home) .profile-mobile-topbar {
    display: block;
  }


  /* --- Дашборд «Моя статистика»: приветствие + плитки + город + цели (как в макете). --- */
  body[data-page="profile"] .profile-dashboard {
    row-gap: 18px;
  }
  body[data-page="profile"] .profile-welcome {
    display: grid;
    gap: 8px;
  }
  /* Крупная типографика как в макете: размеры завязаны на ширину экрана. */
  body[data-page="profile"] .profile-welcome h2 {
    font-size: clamp(1.9rem, 7.6vw, 2.4rem);
  }
  /* Подзаголовок под приветствием на телефоне не показываем. */
  body[data-page="profile"] .profile-welcome p {
    display: none;
  }
  body[data-page="profile"] .profile-bottom-grid {
    display: grid;
    grid-template-columns: 1fr;
  }
  /* Десктопная карточка уровня не входит в мобильный дашборд макета. */
  body[data-page="profile"] .profile-stats-top .profile-level-card {
    display: none;
  }
  body[data-page="profile"] .profile-stats-top {
    grid-template-columns: 1fr;
  }
  body[data-page="profile"] .profile-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  /* Плитка статистики как в макете: иконка + подпись в одной строке, число
     крупно ниже на всю ширину, примечание под ним. Содержимое .profile-stat-copy
     раскладывается прямо по сетке карточки (display: contents). */
  body[data-page="profile"] .profile-stat-card {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    align-content: center;
    gap: 10px 12px;
    min-height: 0;
    padding: 16px 15px;
  }
  body[data-page="profile"] .profile-stat-copy {
    display: contents;
  }
  body[data-page="profile"] .profile-stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }
  body[data-page="profile"] .profile-stat-icon::before {
    width: 19px;
    height: 19px;
  }
  body[data-page="profile"] .profile-stat-label {
    font-size: clamp(0.84rem, 3.5vw, 0.98rem);
  }
  body[data-page="profile"] .profile-stat-value {
    grid-column: 1 / -1;
    font-size: clamp(1.75rem, 7vw, 2.2rem);
  }
  body[data-page="profile"] .profile-stat-note {
    grid-column: 1 / -1;
    font-size: clamp(0.7rem, 3vw, 0.8rem);
  }

  /* Заголовки блоков в одну строку: название слева, мета/ссылка справа
     (переопределяет колоночную раскладку из @media ≤720px ниже по файлу). */
  body[data-page="profile"] .profile-exploration-head {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
  }
  body[data-page="profile"] .profile-exploration-head p {
    text-align: right;
  }
  body[data-page="profile"] .profile-exploration-head h3,
  body[data-page="profile"] .profile-block-head h3 {
    font-size: clamp(1.05rem, 4.6vw, 1.3rem);
  }
  body[data-page="profile"] .profile-exploration-head p,
  body[data-page="profile"] .profile-inline-link {
    font-size: clamp(0.76rem, 3.2vw, 0.88rem);
  }

  /* «Прогресс исследования … 0%» — в одну строку (тоже стеклилось в колонку). */
  body[data-page="profile"] .profile-city-progress-head {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  /* Цель: иконка слева, текст по центру, награда справа — одна строка. */
  body[data-page="profile"] .profile-goal-item {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    justify-items: stretch;
    gap: 12px;
    min-height: 58px;
    padding: 10px 14px;
  }
  body[data-page="profile"] .profile-goal-reward {
    justify-self: end;
  }

  /* --- Карточка «Исследование городов»: на телефоне — единый вертикальный стек
     поверх затемнённого фото (как в макете). Десктопный .profile-city-body
     позиционировался абсолютно и на узком экране наезжал на название города.
     Фото рисуется на самой карточке (переменную ставит profile.js на
     .profile-city-card; она наследуется баннером на десктопе). --- */
  body[data-page="profile"] .profile-city-card {
    display: flex;
    flex-direction: column;
    background-color: #121a16;
    background-image:
      linear-gradient(180deg, rgba(9, 15, 13, 0.6) 0%, rgba(9, 15, 13, 0.52) 48%, rgba(9, 15, 13, 0.86) 100%),
      var(--profile-city-banner-image, linear-gradient(130deg, #232b2f, #07b63c 62%, #35c85c 100%));
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
  }
  body[data-page="profile"] .profile-city-banner {
    position: static;
    min-height: 0;
    align-content: start;
    gap: 8px;
    padding: 22px 22px 10px;
    background: none;
  }
  body[data-page="profile"] .profile-city-banner::before,
  body[data-page="profile"] .profile-city-banner::after {
    display: none;
  }
  body[data-page="profile"] .profile-city-banner h3 {
    max-width: 100%;
    font-size: clamp(1.9rem, 6.4vw, 2.4rem);
  }
  body[data-page="profile"] .profile-city-body {
    position: static;
    inset: auto;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 6px 22px 22px;
  }
  body[data-page="profile"] .profile-city-map-button {
    width: 100%;
  }
}

@media (min-width: 981px) {
  .profile-page.profile-places-section-active {
    --profile-places-header-offset: 76px;
    height: 100vh;
    overflow: hidden;
  }
}

@media (min-width: 981px) and (max-width: 1180px) {
  .profile-page.profile-places-section-active {
    --profile-places-header-offset: 136px;
  }
}

.profile-shell {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.profile-hero {
  max-width: 760px;
}

.profile-hero h1,
.profile-sidebar-head h2,
.profile-section-head h2,
.profile-exploration-head h3,
.profile-card h2,
.profile-admin-panel h3 {
  margin: 0;
  font-family: "Sora", sans-serif;
  letter-spacing: var(--brand-letter-spacing);
}

.profile-hero h1 {
  margin-top: 14px;
  font-size: clamp(2.6rem, 7vw, 4.8rem);
  line-height: 0.95;
}

.profile-lead,
.profile-sidebar-head p:not(.eyebrow),
.profile-section-head p:not(.eyebrow),
.profile-stat-copy,
.profile-admin-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.profile-dashboard {
  display: grid;
  grid-template-columns: minmax(252px, 296px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  margin-top: 28px;
}

.profile-sidebar,
.profile-card,
.profile-admin-panel,
.profile-stat-card,
.profile-added-place-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.profile-sidebar {
  position: sticky;
  top: 94px;
  display: grid;
  gap: 12px;
  padding: 18px 14px;
  border-radius: 26px;
  box-shadow: 0 14px 30px rgba(35, 43, 47, 0.05);
}

.profile-sidebar-head {
  display: grid;
  gap: 4px;
  padding: 0 10px 6px;
}

.profile-sidebar-head h2 {
  font-size: 1.1rem;
  line-height: 1.1;
}

.profile-nav {
  display: grid;
  gap: 4px;
  transition:
    opacity 160ms ease,
    visibility 160ms ease;
}

body.auth-state-pending .profile-nav {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.profile-nav-button {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border: none;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition:
    color 160ms ease,
    background 180ms ease;
}

.profile-nav-button[hidden],
.profile-section[hidden] {
  display: none !important;
}

.profile-nav-button:hover {
  background: rgba(35, 43, 47, 0.045);
  color: var(--text);
}

.profile-nav-button:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.28);
  outline-offset: 2px;
}

.profile-nav-button.is-active {
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent-strong);
}

.profile-nav-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  color: currentColor;
  opacity: 0.85;
}

.profile-nav-icon svg {
  width: 100%;
  height: 100%;
}

.profile-nav-button.is-active .profile-nav-icon {
  opacity: 1;
}

.profile-nav-label {
  min-width: 0;
  font-size: 0.98rem;
  line-height: 1.3;
}

.profile-workspace {
  position: relative;
  display: grid;
  gap: 18px;
}

.profile-section {
  display: grid;
  align-content: start;
  gap: 18px;
  will-change: opacity;
}

.profile-section-head {
  display: grid;
  gap: 10px;
}

.profile-section-head-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.profile-section-head-row p {
  text-align: right;
}

.profile-section-head h2 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 0.95;
}

.profile-stat-card {
  padding: 28px;
  border-radius: 32px;
  display: grid;
  gap: 12px;
  background:
    radial-gradient(circle at top left, rgba(var(--accent-rgb), 0.16), transparent 42%),
    rgba(255, 255, 255, 0.96);
}

.profile-stat-label {
  color: var(--muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: var(--brand-letter-spacing);
}

.profile-stat-value {
  font-family: "Sora", sans-serif;
  font-size: clamp(3rem, 10vw, 5.6rem);
  line-height: 0.92;
  letter-spacing: -0.04em;
}

.profile-added-places-list {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 16px;
  min-height: 0;
}

.profile-cities-list {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 16px;
  min-height: 0;
}

.profile-added-places-list:focus-visible {
  border-radius: 18px;
  outline: 2px solid rgba(var(--accent-rgb), 0.28);
  outline-offset: 4px;
}

.profile-cities-list:focus-visible {
  border-radius: 18px;
  outline: 2px solid rgba(var(--accent-rgb), 0.28);
  outline-offset: 4px;
}

.profile-added-places-empty {
  margin: 0;
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid rgba(var(--accent-rgb), 0.12);
  background: rgba(255, 255, 255, 0.96);
  color: var(--muted);
  line-height: 1.7;
  box-shadow: 0 14px 28px rgba(35, 43, 47, 0.05);
}

.profile-added-place-card {
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(148px, 220px) minmax(0, 1fr);
  min-height: 190px;
  border-radius: 28px;
  box-shadow: 0 18px 38px rgba(35, 43, 47, 0.08);
}

.profile-added-place-card.is-pending {
  border-color: rgba(245, 158, 11, 0.22);
}

.profile-added-place-card.is-rejected {
  border-color: rgba(220, 38, 38, 0.2);
}

.profile-added-place-photo {
  position: relative;
  min-height: 190px;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(145deg, rgba(12, 16, 14, 0.38), rgba(12, 16, 14, 0.1)),
    linear-gradient(135deg, var(--profile-place-accent, var(--accent)), rgba(var(--accent-rgb), 0.18));
  color: #fff;
  text-align: center;
  font-weight: 800;
}

.profile-added-place-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-added-place-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11, 15, 13, 0.02), rgba(11, 15, 13, 0.18));
  pointer-events: none;
}

.profile-added-place-photo span {
  position: relative;
  z-index: 1;
  max-width: 12rem;
}

.profile-added-place-body {
  min-width: 0;
  display: grid;
  gap: 14px;
  padding: 22px;
}

.profile-added-place-head,
.profile-added-place-footer,
.profile-added-place-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.profile-added-place-head {
  justify-content: space-between;
}

.profile-added-place-category,
.profile-added-place-status,
.profile-added-place-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.profile-added-place-category {
  background: color-mix(in srgb, var(--profile-place-accent, var(--accent)) 14%, white);
  color: color-mix(in srgb, var(--profile-place-accent, var(--accent)) 78%, #151b1f);
}

.profile-added-place-status {
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent-strong);
}

.profile-added-place-card.is-pending .profile-added-place-status {
  background: rgba(245, 158, 11, 0.12);
  color: #a16207;
}

.profile-added-place-card.is-rejected .profile-added-place-status {
  background: rgba(220, 38, 38, 0.1);
  color: #b91c1c;
}

.profile-added-place-copy {
  display: grid;
  gap: 8px;
}

.profile-added-place-copy h3 {
  margin: 0;
  font-size: clamp(1.25rem, 2.4vw, 1.75rem);
  line-height: 1.08;
}

.profile-added-place-copy p,
.profile-added-place-footer span {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.profile-added-place-tags span {
  min-height: 26px;
  background: rgba(35, 43, 47, 0.06);
  color: rgba(35, 43, 47, 0.72);
}

.profile-added-place-footer {
  justify-content: space-between;
  padding-top: 2px;
}

.profile-added-place-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 14px 26px rgba(var(--accent-rgb), 0.2);
}

.profile-added-place-link.is-disabled {
  background: rgba(35, 43, 47, 0.07);
  color: var(--muted);
  box-shadow: none;
}

.profile-added-places-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-top: 4px;
}

.profile-added-places-pagination[hidden] {
  display: none !important;
}

.profile-added-places-pages {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.profile-added-places-page,
.profile-added-places-ellipsis {
  min-width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 800;
}

.profile-added-places-page {
  padding: 0 14px;
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  box-shadow: 0 12px 22px rgba(35, 43, 47, 0.06);
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.profile-added-places-page:hover:not(:disabled):not(.is-active) {
  transform: translateY(-1px);
  border-color: rgba(var(--accent-rgb), 0.28);
  box-shadow: 0 16px 26px rgba(35, 43, 47, 0.1);
}

.profile-added-places-page:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.28);
  outline-offset: 2px;
}

.profile-added-places-page.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 14px 26px rgba(var(--accent-rgb), 0.2);
}

.profile-added-places-page:disabled {
  opacity: 0.48;
  cursor: default;
  box-shadow: none;
}

.profile-added-places-page.is-direction {
  min-width: 96px;
}

.profile-added-places-ellipsis {
  color: var(--muted);
}

.profile-leaderboard-tabs {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 26px rgba(35, 43, 47, 0.06);
}

.profile-leaderboard-tab {
  min-height: 40px;
  padding: 0 16px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  transition:
    background 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.profile-leaderboard-tab:hover:not(.is-active) {
  color: var(--text);
  background: rgba(35, 43, 47, 0.04);
}

.profile-leaderboard-tab:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.28);
  outline-offset: 2px;
}

.profile-leaderboard-tab.is-active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 24px rgba(var(--accent-rgb), 0.2);
}

.profile-leaderboard-empty {
  margin: 0;
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid rgba(var(--accent-rgb), 0.12);
  background: rgba(255, 255, 255, 0.96);
  color: var(--muted);
  line-height: 1.7;
  box-shadow: 0 14px 28px rgba(35, 43, 47, 0.05);
}

.profile-leaderboard-empty[hidden] {
  display: none !important;
}

.profile-leaderboard-list {
  display: grid;
  gap: 12px;
}

.profile-leaderboard-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 86px;
  padding: 16px 18px;
  border: 1px solid rgba(var(--accent-rgb), 0.1);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 255, 247, 0.86)),
    #fff;
  box-shadow: 0 16px 34px rgba(35, 43, 47, 0.07);
}

.profile-leaderboard-card.is-top-rank {
  border-color: rgba(var(--accent-rgb), 0.22);
  box-shadow: 0 18px 38px rgba(var(--accent-rgb), 0.11);
}

.profile-leaderboard-card.is-current-user {
  background:
    radial-gradient(circle at top left, rgba(var(--accent-rgb), 0.16), transparent 42%),
    rgba(255, 255, 255, 0.98);
}

.profile-leaderboard-card.is-loading {
  color: var(--muted);
}

.profile-leaderboard-rank {
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent-strong);
  font-family: "Sora", sans-serif;
  font-size: 1.12rem;
  font-weight: 800;
}

.profile-leaderboard-card.is-top-rank .profile-leaderboard-rank {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 24px rgba(var(--accent-rgb), 0.2);
}

.profile-leaderboard-user {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.profile-leaderboard-avatar {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(var(--accent-rgb), 0.16);
}

.profile-leaderboard-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-leaderboard-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.profile-leaderboard-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 1.08rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-leaderboard-copy span,
.profile-leaderboard-score span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.profile-leaderboard-score {
  min-width: 108px;
  display: grid;
  gap: 2px;
  justify-items: end;
  text-align: right;
}

.profile-leaderboard-score strong {
  font-family: "Sora", sans-serif;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  line-height: 1;
}

.profile-exploration {
  display: grid;
  gap: 18px;
}

.profile-exploration-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.profile-exploration-head h3 {
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  line-height: 1;
}

.profile-exploration-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: right;
}

.profile-exploration-empty {
  margin: 0;
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid rgba(var(--accent-rgb), 0.12);
  background: rgba(255, 255, 255, 0.96);
  color: var(--muted);
  line-height: 1.7;
  box-shadow: 0 14px 28px rgba(35, 43, 47, 0.05);
}

.profile-exploration-list {
  display: grid;
  gap: 18px;
}

.profile-city-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.profile-city-banner {
  position: relative;
  min-height: 208px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 10px;
  padding: 32px;
  color: #fff;
  text-align: left;
  background-color: #203026;
  background-image:
    linear-gradient(145deg, rgba(18, 24, 22, 0.82), rgba(15, 63, 39, 0.34)),
    var(--profile-city-banner-image, linear-gradient(130deg, #232b2f, #07b63c 62%, #35c85c 100%));
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.profile-city-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(8, 11, 10, 0.38);
  pointer-events: none;
}

.profile-city-banner::after {
  content: "";
  position: absolute;
  inset: auto -56px -68px auto;
  width: 220px;
  height: 220px;
  z-index: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 68%);
  pointer-events: none;
}

.profile-city-card.is-city-photo-loading .profile-city-banner::before {
  background:
    linear-gradient(180deg, rgba(10, 14, 12, 0.28) 0%, rgba(10, 14, 12, 0.54) 100%),
    linear-gradient(110deg, rgba(255, 255, 255, 0.06) 8%, rgba(255, 255, 255, 0.18) 18%, rgba(255, 255, 255, 0.06) 32%);
  background-size: auto, 220% 100%;
  animation: profileCityCardPhotoPulse 1.8s ease-in-out infinite;
}

@keyframes profileCityCardPhotoPulse {
  0% {
    background-position: 0 0, 140% 0;
  }

  100% {
    background-position: 0 0, -80% 0;
  }
}

.profile-city-banner > * {
  position: relative;
  z-index: 1;
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
}

.profile-city-kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.profile-city-banner h3 {
  margin: 0;
  max-width: min(100%, 11ch);
  font-family: "Sora", sans-serif;
  font-size: clamp(2.2rem, 7vw, 3.9rem);
  line-height: 0.92;
  letter-spacing: -0.05em;
}

.profile-city-banner p {
  margin: 0;
  max-width: 36rem;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1rem;
  line-height: 1.6;
}

.profile-city-body {
  display: grid;
  gap: 22px;
  padding: 28px;
}

.profile-city-progress {
  display: grid;
  gap: 14px;
}

.profile-city-progress-head,
.profile-city-visits-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.profile-city-progress-head strong,
.profile-city-visits-head span {
  font-size: 0.95rem;
  font-weight: 700;
}

.profile-city-progress-head span,
.profile-city-visits-head span,
.profile-city-progress-meta span,
.profile-visit-copy span {
  color: var(--muted);
}

.profile-progress-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(35, 43, 47, 0.08);
}

.profile-progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.78), rgba(var(--accent-rgb), 1));
  box-shadow: 0 10px 20px rgba(var(--accent-rgb), 0.22);
  transition: width 240ms ease;
}

.profile-city-progress-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.95rem;
}

.profile-city-visits {
  display: grid;
  gap: 14px;
  padding-top: 2px;
  border-top: 1px solid rgba(35, 43, 47, 0.08);
}

.profile-city-visits-head h4 {
  margin: 0;
  font-size: 1.08rem;
}

.profile-city-empty {
  margin: 0;
  padding: 17px 18px;
  border-radius: 20px;
  border: 1px solid rgba(var(--accent-rgb), 0.12);
  background: var(--panel-soft);
  color: var(--muted);
  line-height: 1.7;
}

.profile-visit-list {
  display: grid;
  gap: 12px;
}

.profile-visit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid rgba(var(--accent-rgb), 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), var(--panel-soft));
}

.profile-visit-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.profile-visit-copy strong {
  font-size: 1rem;
  line-height: 1.35;
}

.profile-visit-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.profile-visit-action {
  position: relative;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(35, 43, 47, 0.1);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 22px rgba(35, 43, 47, 0.06);
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.profile-visit-action:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(35, 43, 47, 0.1);
}

.profile-visit-action:disabled {
  opacity: 0.55;
  cursor: wait;
}

.profile-visit-action.is-confirm {
  border-color: rgba(var(--accent-rgb), 0.2);
  background: rgba(var(--accent-rgb), 0.08);
}

.profile-visit-action.is-reject {
  background: rgba(35, 43, 47, 0.03);
}

.profile-visit-action-icon {
  position: relative;
  width: 16px;
  height: 16px;
  display: block;
}

.profile-visit-action-icon.is-confirm::before,
.profile-visit-action-icon.is-confirm::after,
.profile-visit-action-icon.is-reject::before,
.profile-visit-action-icon.is-reject::after {
  content: none;
}

.profile-visit-action-icon.is-confirm,
.profile-visit-action-icon.is-reject {
  background-color: currentColor;
}

.profile-visit-action-icon.is-confirm {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='4 12.5 9 17.5 20 6.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='4 12.5 9 17.5 20 6.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.profile-visit-action-icon.is-reject {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3C/svg%3E") center / contain no-repeat;
}

.profile-visit-action.is-confirm .profile-visit-action-icon {
  color: var(--accent-strong);
}

.profile-visit-action.is-reject .profile-visit-action-icon {
  color: rgba(35, 43, 47, 0.62);
}

.profile-card,
.profile-admin-panel {
  padding: 28px;
  border-radius: 32px;
}

.profile-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.profile-avatar-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.profile-avatar-input {
  display: none;
}

.profile-avatar-button {
  position: relative;
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(180deg, #f4f6f7 0%, #e0e5e7 100%);
  border: 1px solid rgba(35, 43, 47, 0.08);
  box-shadow: 0 18px 36px rgba(35, 43, 47, 0.08);
  overflow: hidden;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.profile-avatar-button:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  box-shadow: 0 22px 40px rgba(35, 43, 47, 0.12);
}

.profile-avatar-button.is-uploading {
  pointer-events: none;
  opacity: 0.8;
}

.profile-avatar-button.is-readonly {
  cursor: default;
  pointer-events: none;
}

.profile-avatar-button.is-readonly:hover {
  transform: none;
  border-color: rgba(35, 43, 47, 0.08);
  box-shadow: 0 18px 36px rgba(35, 43, 47, 0.08);
}

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

.profile-avatar-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.profile-avatar-pencil {
  width: 28px;
  height: 28px;
  display: block;
  background-color: #2f7a45;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20l1-4 11-11 3 3-11 11-4 1Z'/%3E%3Cline x1='14' y1='6' x2='17' y2='9'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20l1-4 11-11 3 3-11 11-4 1Z'/%3E%3Cline x1='14' y1='6' x2='17' y2='9'/%3E%3C/svg%3E") center / contain no-repeat;
}

.profile-avatar-remove {
  padding: 0;
  color: var(--muted);
  background: transparent;
  font-size: 0.88rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(35, 43, 47, 0.14);
  transition:
    color 160ms ease,
    border-color 160ms ease;
}

.profile-avatar-remove:hover {
  color: var(--text);
  border-color: rgba(35, 43, 47, 0.24);
}

.profile-card h2 {
  margin-top: 10px;
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  line-height: 1;
}

.profile-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.profile-home-link,
.profile-edit-button {
  color: var(--text);
  background: rgba(var(--accent-rgb), 0.08);
  border-color: var(--border);
}

.profile-save-button,
.profile-cancel-button {
  min-height: 52px;
}

.profile-cancel-button {
  padding: 0 20px;
  border: 1px solid rgba(35, 43, 47, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  box-shadow: 0 14px 24px rgba(35, 43, 47, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.profile-cancel-button:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--accent-rgb), 0.2);
  box-shadow: 0 18px 30px rgba(35, 43, 47, 0.12);
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.profile-field-card {
  padding: 22px;
  background: var(--panel-soft);
  border: 1px solid rgba(var(--accent-rgb), 0.12);
  border-radius: 24px;
}

.profile-field-card span,
.profile-field-card strong {
  display: block;
}

.profile-field-card span {
  color: var(--muted);
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: var(--brand-letter-spacing);
}

.profile-field-card strong {
  margin-top: 12px;
  font-size: 1.22rem;
  line-height: 1.35;
}

.profile-field-input {
  width: 100%;
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.profile-field-input:focus {
  border-color: rgba(var(--accent-rgb), 0.34);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.08);
}

.profile-field-card-wide {
  grid-column: span 2;
}

.profile-security-card {
  display: grid;
  gap: 0;
  padding: 0;
  border-radius: 28px;
  overflow: hidden;
}

.profile-security-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  width: 100%;
  padding: 0 24px;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.08rem;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  transition:
    background 180ms ease,
    color 160ms ease;
}

.profile-security-toggle:hover {
  background: rgba(var(--accent-rgb), 0.06);
}

.profile-security-toggle:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.28);
  outline-offset: -5px;
}

.profile-security-switch {
  position: relative;
  flex: 0 0 auto;
  width: 56px;
  height: 32px;
  border-radius: 999px;
  background: rgba(35, 43, 47, 0.12);
  border: 1px solid rgba(35, 43, 47, 0.1);
  box-shadow: inset 0 1px 3px rgba(35, 43, 47, 0.12);
  transition:
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.profile-security-switch > span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 5px 12px rgba(35, 43, 47, 0.18);
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.profile-security-switch.is-enabled {
  background: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.45);
  box-shadow:
    inset 0 1px 3px rgba(0, 91, 42, 0.18),
    0 10px 24px rgba(var(--accent-rgb), 0.18);
}

.profile-security-switch.is-enabled > span {
  transform: translateX(24px);
}

.profile-security-switch.is-open:not(.is-enabled) {
  border-color: rgba(var(--accent-rgb), 0.28);
  box-shadow:
    inset 0 1px 3px rgba(35, 43, 47, 0.1),
    0 0 0 4px rgba(var(--accent-rgb), 0.06);
}

.profile-security-panel {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translateY(-8px);
  transition:
    max-height 320ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 220ms ease,
    transform 260ms ease;
}

.profile-security-card.is-open .profile-security-panel {
  max-height: 720px;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.profile-security-panel-inner {
  display: grid;
  gap: 16px;
  padding: 0 28px 28px;
}

.profile-security-panel-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.profile-security-form {
  display: grid;
  gap: 16px;
}

.profile-security-field {
  display: grid;
  gap: 8px;
}

.profile-security-field[hidden] {
  display: none !important;
}

.profile-security-field > span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: var(--brand-letter-spacing);
}

.profile-security-message {
  margin: 0;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 245, 245, 0.94);
  border: 1px solid rgba(186, 54, 54, 0.18);
  color: #a43434;
  font-weight: 800;
}

.profile-security-message[hidden] {
  display: none !important;
}

.profile-security-message[data-state="success"] {
  background: rgba(var(--accent-rgb), 0.1);
  border-color: rgba(var(--accent-rgb), 0.2);
  color: var(--accent-strong);
}

.profile-security-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.profile-security-setup-button {
  background: rgba(var(--accent-rgb), 0.12);
  border-color: rgba(var(--accent-rgb), 0.28);
  color: var(--accent-strong);
  font-weight: 800;
  box-shadow: 0 14px 26px rgba(var(--accent-rgb), 0.1);
}

.profile-security-setup-button:hover {
  background: rgba(var(--accent-rgb), 0.18);
  border-color: rgba(var(--accent-rgb), 0.38);
}

.profile-security-setup-button:disabled {
  background: rgba(var(--accent-rgb), 0.08);
  border-color: rgba(var(--accent-rgb), 0.16);
  color: rgba(var(--accent-rgb), 0.58);
  box-shadow: none;
  opacity: 1;
}

.profile-security-actions [hidden] {
  display: none !important;
}

/* Change-password card (Security section). */
.profile-password-card {
  display: grid;
  gap: 16px;
}
.profile-password-head {
  display: grid;
  gap: 6px;
}
.profile-password-head h3 {
  margin: 0;
  font-size: 1.05rem;
}
.profile-password-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}
.profile-password-card .profile-security-form {
  display: grid;
  gap: 14px;
}
/* Leave room for the show/hide-password eye (overrides .profile-field-input's
   padding shorthand). */
.profile-security-field .password-field .profile-field-input {
  padding-right: 46px;
}

.profile-message {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 245, 245, 0.94);
  border: 1px solid rgba(186, 54, 54, 0.18);
  color: #a43434;
  font-weight: 700;
}

.profile-message[data-state="success"] {
  background: rgba(var(--accent-rgb), 0.1);
  border-color: rgba(var(--accent-rgb), 0.2);
  color: var(--accent-strong);
}

.profile-admin-panel {
  display: grid;
  gap: 14px;
  background:
    radial-gradient(circle at top left, rgba(var(--accent-rgb), 0.14), transparent 42%),
    rgba(255, 255, 255, 0.96);
}

.profile-admin-panel.is-locked {
  background:
    linear-gradient(135deg, rgba(35, 43, 47, 0.06), rgba(255, 255, 255, 0.96)),
    rgba(255, 255, 255, 0.96);
}

.profile-admin-panel h3 {
  font-size: 1.6rem;
}

.profile-admin-link {
  display: inline-flex;
  width: fit-content;
}

@media (min-width: 981px) {
  .profile-page.profile-places-section-active .profile-shell {
    position: fixed;
    top: var(--profile-places-header-offset, 76px);
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: auto;
    padding: 28px 0 24px;
    overflow: hidden;
  }

  .profile-page.profile-places-section-active .profile-dashboard {
    height: 100%;
    min-height: 0;
    margin-top: 22px;
  }

  .profile-page.profile-places-section-active .profile-sidebar,
  .profile-page.profile-places-section-active .profile-workspace,
  .profile-page.profile-places-section-active .profile-section[data-profile-section="places"].is-active,
  .profile-page.profile-places-section-active .profile-section[data-profile-section="cities"].is-active {
    min-height: 0;
  }

  .profile-page.profile-places-section-active .profile-workspace {
    align-self: stretch;
    height: 100%;
    overflow: hidden;
  }

  .profile-page.profile-places-section-active .profile-section[data-profile-section="places"].is-active,
  .profile-page.profile-places-section-active .profile-section[data-profile-section="cities"].is-active {
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: 100%;
    overflow: hidden;
  }

  .profile-page.profile-places-section-active .profile-added-places-list,
  .profile-page.profile-places-section-active .profile-cities-list {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 10px;
    margin-right: -10px;
    scrollbar-gutter: stable;
    align-content: start;
  }

  /* Empty state: don't let the message stretch into the full-height 1fr track —
     keep it a natural-height card like every other section's empty state. */
  .profile-page.profile-places-section-active .profile-added-places-empty,
  .profile-page.profile-places-section-active .profile-cities-empty {
    align-self: start;
  }

  .profile-page.profile-places-section-active .profile-added-places-list::-webkit-scrollbar,
  .profile-page.profile-places-section-active .profile-cities-list::-webkit-scrollbar {
    width: 10px;
  }

  .profile-page.profile-places-section-active .profile-added-places-list::-webkit-scrollbar-track,
  .profile-page.profile-places-section-active .profile-cities-list::-webkit-scrollbar-track {
    background: rgba(var(--accent-rgb), 0.07);
    border-radius: 999px;
  }

  .profile-page.profile-places-section-active .profile-added-places-list::-webkit-scrollbar-thumb,
  .profile-page.profile-places-section-active .profile-cities-list::-webkit-scrollbar-thumb {
    border: 3px solid rgba(255, 255, 255, 0.92);
    border-radius: 999px;
    background: rgba(var(--accent-rgb), 0.42);
  }

  .profile-page.profile-places-section-active .profile-added-places-pagination {
    padding-bottom: 12px;
  }
}

@media (max-width: 980px) {
  .profile-dashboard {
    grid-template-columns: 1fr;
  }

  .profile-sidebar {
    position: static;
  }
}

@media (max-width: 720px) {
  .profile-shell {
    width: min(100% - 20px, 1240px);
    padding-top: 24px;
  }

  .profile-sidebar,
  .profile-card,
  .profile-admin-panel,
  .profile-stat-card {
    padding: 22px;
    border-radius: 24px;
  }

  .profile-card-head {
    flex-direction: column;
  }

  .profile-card-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .profile-identity {
    gap: 16px;
  }

  .profile-avatar-stack {
    align-items: flex-start;
  }

  .profile-avatar-button {
    width: 76px;
    height: 76px;
  }

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

  .profile-field-card-wide {
    grid-column: span 1;
  }

  .profile-nav-button {
    padding: 11px 12px;
  }

  .profile-exploration-head,
  .profile-section-head-row,
  .profile-city-progress-head,
  .profile-city-visits-head,
  .profile-visit-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-exploration-head p {
    text-align: left;
  }

  .profile-section-head-row {
    grid-template-columns: 1fr;
  }

  .profile-section-head-row p {
    text-align: left;
  }

  .profile-city-banner {
    min-height: 180px;
    padding: 24px 22px;
  }

  .profile-city-body {
    padding: 22px;
  }

  .profile-added-place-card {
    grid-template-columns: 1fr;
  }

  .profile-added-place-photo {
    min-height: 178px;
  }

  .profile-added-place-head,
  .profile-added-place-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-added-places-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .profile-added-places-page.is-direction {
    width: 100%;
  }

  .profile-leaderboard-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    border-radius: 22px;
  }

  .profile-leaderboard-card {
    grid-template-columns: 46px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
  }

  .profile-leaderboard-rank {
    width: 46px;
    height: 46px;
    border-radius: 15px;
  }

  .profile-leaderboard-user {
    min-width: 0;
  }

  .profile-leaderboard-score {
    grid-column: 2;
    min-width: 0;
    justify-items: start;
    text-align: left;
  }

  .profile-city-progress-meta,
  .profile-visit-actions {
    width: 100%;
  }

  .profile-visit-actions {
    justify-content: flex-start;
  }
}

/* Profile secondary tabs reference styling */
body[data-page="profile"] .profile-section:not([data-profile-section="stats"]) {
  box-sizing: border-box;
  gap: 16px;
  padding-top: 26px;
}

body[data-page="profile"] .profile-section:not([data-profile-section="stats"]) .profile-section-head {
  gap: 6px;
}

body[data-page="profile"] .profile-section:not([data-profile-section="stats"]) .profile-section-head-row {
  align-items: center;
}

body[data-page="profile"] .profile-section:not([data-profile-section="stats"]) .profile-section-head h2 {
  color: var(--profile-ref-ink);
  font-family: "Sora", "Manrope", sans-serif;
  font-size: clamp(2rem, 3.45vw, 2.85rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: 0;
}

body[data-page="profile"] .profile-section:not([data-profile-section="stats"]) .profile-section-head p {
  margin: 0;
  color: var(--profile-ref-muted);
  font-size: 0.93rem;
  font-weight: 800;
  line-height: 1.35;
}

body[data-page="profile"] .profile-added-places-empty,
body[data-page="profile"] .profile-cities-empty,
body[data-page="profile"] .profile-leaderboard-empty,
body[data-page="profile"] .profile-card {
  border: 1px solid var(--profile-ref-border);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--profile-ref-soft-shadow);
  backdrop-filter: blur(18px);
}

body[data-page="profile"] .profile-added-places-list {
  gap: 12px;
  min-height: 0;
}

body[data-page="profile"] .profile-cities-list {
  gap: 14px;
  min-height: 0;
}

body[data-page="profile"] .profile-cities-list .profile-city-card {
  width: 100%;
}

body[data-page="profile"] .profile-cities-list .profile-city-banner h3 {
  max-width: min(100%, 18ch);
}

body[data-page="profile"] .profile-added-place-card {
  grid-template-columns: minmax(150px, 210px) minmax(0, 1fr);
  min-height: 164px;
  overflow: hidden;
  border: 1px solid var(--profile-ref-border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--profile-ref-soft-shadow);
}

body[data-page="profile"] .profile-added-place-photo {
  min-height: 164px;
  padding: 16px;
  background:
    linear-gradient(145deg, rgba(17, 25, 29, 0.18), rgba(17, 25, 29, 0.04)),
    linear-gradient(135deg, color-mix(in srgb, var(--profile-place-accent, var(--profile-ref-green)) 62%, #ffffff), #edf8f1);
  font-weight: 900;
}

body[data-page="profile"] .profile-added-place-photo span {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--profile-ref-green);
  font-size: 0.82rem;
}

body[data-page="profile"] .profile-added-place-body {
  gap: 10px;
  padding: 18px 20px;
}

body[data-page="profile"] .profile-added-place-head,
body[data-page="profile"] .profile-added-place-footer,
body[data-page="profile"] .profile-added-place-tags {
  gap: 8px;
}

body[data-page="profile"] .profile-added-place-category,
body[data-page="profile"] .profile-added-place-status,
body[data-page="profile"] .profile-added-place-tags span {
  min-height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
}

body[data-page="profile"] .profile-added-place-category {
  background: color-mix(in srgb, var(--profile-place-accent, var(--profile-ref-green)) 16%, white);
  color: color-mix(in srgb, var(--profile-place-accent, var(--profile-ref-green)) 82%, #11191d);
}

body[data-page="profile"] .profile-added-place-status {
  background: rgba(0, 155, 54, 0.1);
  color: var(--profile-ref-green);
}

body[data-page="profile"] .profile-added-place-copy {
  gap: 6px;
}

body[data-page="profile"] .profile-added-place-copy h3 {
  color: var(--profile-ref-ink);
  font-family: "Sora", "Manrope", sans-serif;
  font-size: clamp(1.08rem, 1.65vw, 1.32rem);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.15;
}

body[data-page="profile"] .profile-added-place-copy p,
body[data-page="profile"] .profile-added-place-footer span {
  color: var(--profile-ref-muted);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.42;
}

body[data-page="profile"] .profile-added-place-tags span {
  min-height: 26px;
  background: rgba(17, 25, 29, 0.055);
  color: #677378;
}

body[data-page="profile"] .profile-added-place-link {
  min-height: 38px;
  padding: 0 15px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--profile-ref-green), var(--profile-ref-green-dark));
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(0, 155, 54, 0.18);
}

body[data-page="profile"] .profile-added-place-link.is-disabled {
  background: rgba(17, 25, 29, 0.06);
  color: var(--profile-ref-muted);
  box-shadow: none;
}

body[data-page="profile"] .profile-added-places-pagination {
  gap: 9px;
  padding-top: 0;
}

body[data-page="profile"] .profile-added-places-page,
body[data-page="profile"] .profile-added-places-ellipsis {
  min-width: 38px;
  height: 38px;
  font-size: 0.88rem;
}

body[data-page="profile"] .profile-added-places-page {
  border: 1px solid var(--profile-ref-border);
  background: rgba(255, 255, 255, 0.97);
  color: var(--profile-ref-ink);
  box-shadow: 0 10px 22px rgba(17, 25, 29, 0.045);
}

body[data-page="profile"] .profile-added-places-page.is-active {
  border-color: var(--profile-ref-green);
  background: var(--profile-ref-green);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(0, 155, 54, 0.18);
}

body[data-page="profile"] .profile-added-places-page.is-direction {
  min-width: 88px;
}

body[data-page="profile"] .profile-leaderboard-tabs {
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--profile-ref-border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--profile-ref-soft-shadow);
}

body[data-page="profile"] .profile-leaderboard-tab {
  min-height: 38px;
  padding: 0 15px;
  border-radius: 13px;
  color: var(--profile-ref-muted);
  font-size: 0.9rem;
  font-weight: 900;
}

body[data-page="profile"] .profile-leaderboard-tab:hover:not(.is-active) {
  color: var(--profile-ref-ink);
  background: rgba(17, 25, 29, 0.04);
}

body[data-page="profile"] .profile-leaderboard-tab.is-active {
  background: #e6f7ed;
  color: var(--profile-ref-green);
  box-shadow: none;
}

body[data-page="profile"] .profile-leaderboard-list {
  gap: 10px;
}

body[data-page="profile"] .profile-leaderboard-card {
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 14px;
  min-height: 76px;
  padding: 13px 16px;
  border: 1px solid var(--profile-ref-border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--profile-ref-soft-shadow);
}

body[data-page="profile"] .profile-leaderboard-card.is-top-rank,
body[data-page="profile"] .profile-leaderboard-card.is-current-user {
  border-color: rgba(0, 155, 54, 0.16);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(235, 250, 241, 0.86)),
    #ffffff;
  box-shadow: 0 14px 32px rgba(0, 155, 54, 0.08);
}

body[data-page="profile"] .profile-leaderboard-rank,
body[data-page="profile"] .profile-leaderboard-avatar {
  width: 48px;
  height: 48px;
}

body[data-page="profile"] .profile-leaderboard-rank {
  border-radius: 16px;
  background: rgba(0, 155, 54, 0.1);
  color: var(--profile-ref-green);
  font-family: "Sora", "Manrope", sans-serif;
  font-size: 1rem;
  font-weight: 800;
}

body[data-page="profile"] .profile-leaderboard-card.is-top-rank .profile-leaderboard-rank {
  background: linear-gradient(150deg, var(--profile-ref-green), #0bc653);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(0, 155, 54, 0.18);
}

body[data-page="profile"] .profile-leaderboard-avatar {
  background: rgba(0, 155, 54, 0.1);
  color: var(--profile-ref-green);
  box-shadow: none;
}

body[data-page="profile"] .profile-leaderboard-copy strong {
  color: var(--profile-ref-ink);
  font-size: 0.98rem;
  font-weight: 900;
}

body[data-page="profile"] .profile-leaderboard-copy span,
body[data-page="profile"] .profile-leaderboard-score span {
  color: var(--profile-ref-muted);
  font-size: 0.82rem;
  font-weight: 800;
}

body[data-page="profile"] .profile-leaderboard-score {
  min-width: 94px;
}

body[data-page="profile"] .profile-leaderboard-score strong {
  color: var(--profile-ref-ink);
  font-family: "Sora", "Manrope", sans-serif;
  font-size: clamp(1.35rem, 2.1vw, 1.68rem);
  font-weight: 800;
}

body[data-page="profile"] .profile-card {
  padding: 22px;
}

body[data-page="profile"] .profile-card-head {
  align-items: flex-start;
}

body[data-page="profile"] .profile-identity {
  align-items: flex-start;
}

body[data-page="profile"] .profile-avatar-stack + div {
  min-height: 76px;
  display: flex;
  align-items: center;
}

body[data-page="profile"] .profile-card h2 {
  margin: 0;
  color: var(--profile-ref-ink);
  font-family: "Sora", "Manrope", sans-serif;
  font-size: clamp(1.45rem, 2vw, 1.72rem);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.1;
}

body[data-page="profile"] .profile-avatar-button {
  width: 76px;
  height: 76px;
  border: 1px solid var(--profile-ref-border);
  background: rgba(0, 155, 54, 0.1);
  box-shadow: none;
}

body[data-page="profile"] .profile-avatar-pencil {
  width: 26px;
  height: 26px;
  background-color: var(--profile-ref-green);
}

body[data-page="profile"] .profile-card-actions {
  gap: 8px;
}

body[data-page="profile"] .profile-home-link,
body[data-page="profile"] .profile-edit-button,
body[data-page="profile"] .profile-cancel-button,
body[data-page="profile"] .profile-security-setup-button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--profile-ref-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--profile-ref-ink);
  font-size: 0.9rem;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(17, 25, 29, 0.045);
}

body[data-page="profile"] .profile-save-button,
body[data-page="profile"] .profile-security-enable-button {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--profile-ref-green), var(--profile-ref-green-dark));
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 900;
  box-shadow: 0 14px 28px rgba(0, 155, 54, 0.22);
}

body[data-page="profile"] .profile-grid {
  gap: 12px;
  margin-top: 18px;
}

body[data-page="profile"] .profile-field-card {
  padding: 17px 18px;
  border: 1px solid var(--profile-ref-border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 22px rgba(17, 25, 29, 0.035);
}

body[data-page="profile"] .profile-field-card span,
body[data-page="profile"] .profile-security-field > span {
  color: var(--profile-ref-muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: none;
}

body[data-page="profile"] .profile-field-card strong {
  margin-top: 8px;
  color: var(--profile-ref-ink);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.25;
}

body[data-page="profile"] .profile-field-input {
  margin-top: 8px;
  min-height: 44px;
  padding: 11px 13px;
  border: 1px solid var(--profile-ref-border);
  border-radius: 14px;
  background: #fbfdfc;
  color: var(--profile-ref-ink);
  font-size: 0.95rem;
  font-weight: 800;
}

body[data-page="profile"] .profile-field-input:focus {
  border-color: rgba(0, 155, 54, 0.34);
  box-shadow: 0 0 0 4px rgba(0, 155, 54, 0.08);
}

body[data-page="profile"] .profile-security-card {
  display: grid;
  overflow: hidden;
  padding: 0;
  border-radius: 24px;
}

body[data-page="profile"] .profile-security-toggle {
  min-height: 72px;
  padding: 0 22px;
  color: var(--profile-ref-ink);
  font-size: 1rem;
  font-weight: 900;
}

body[data-page="profile"] .profile-security-toggle:hover {
  background: rgba(0, 155, 54, 0.055);
}

body[data-page="profile"] .profile-security-switch {
  width: 54px;
  height: 30px;
  border: 1px solid var(--profile-ref-border);
  background: rgba(17, 25, 29, 0.09);
  box-shadow: inset 0 1px 3px rgba(17, 25, 29, 0.1);
}

body[data-page="profile"] .profile-security-switch > span {
  width: 22px;
  height: 22px;
  box-shadow: 0 5px 12px rgba(17, 25, 29, 0.16);
}

body[data-page="profile"] .profile-security-switch.is-enabled {
  border-color: rgba(0, 155, 54, 0.32);
  background: var(--profile-ref-green);
  box-shadow: 0 10px 22px rgba(0, 155, 54, 0.16);
}

body[data-page="profile"] .profile-security-switch.is-enabled > span {
  transform: translateX(24px);
}

body[data-page="profile"] .profile-security-panel-inner {
  gap: 14px;
  padding: 0 22px 22px;
}

body[data-page="profile"] .profile-security-panel-note {
  color: var(--profile-ref-muted);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.5;
}

body[data-page="profile"] .profile-security-form {
  gap: 13px;
}

body[data-page="profile"] .profile-security-message {
  padding: 13px 15px;
  border-radius: 16px;
  font-size: 0.9rem;
}

@media (min-width: 981px) {
  body[data-page="profile"].profile-places-section-active .profile-shell {
    top: 0;
    padding: 88px 0 12px;
  }

  body[data-page="profile"].profile-places-section-active .profile-dashboard {
    margin-top: 0;
  }

  body[data-page="profile"].profile-places-section-active .profile-sidebar {
    position: static;
    min-height: calc(100vh - 104px);
  }

  body[data-page="profile"].profile-places-section-active .profile-added-places-list,
  body[data-page="profile"].profile-places-section-active .profile-cities-list {
    padding-right: 8px;
    margin-right: -8px;
  }
}

@media (max-height: 860px) and (min-width: 981px) {
  body[data-page="profile"] .profile-section:not([data-profile-section="stats"]) {
    padding-top: 26px;
  }

  body[data-page="profile"] .profile-section:not([data-profile-section="stats"]) .profile-section-head h2 {
    font-size: clamp(1.9rem, 3vw, 2.35rem);
  }

  body[data-page="profile"].profile-places-section-active .profile-shell {
    padding: 82px 0 8px;
  }

  body[data-page="profile"].profile-places-section-active .profile-sidebar {
    min-height: calc(100vh - 94px);
  }
}

@media (max-width: 860px) {
  body[data-page="profile"] .profile-section:not([data-profile-section="stats"]) .profile-section-head-row {
    align-items: start;
    grid-template-columns: 1fr;
  }

  body[data-page="profile"] .profile-section:not([data-profile-section="stats"]) .profile-section-head-row p {
    text-align: left;
  }

  body[data-page="profile"] .profile-added-place-card {
    grid-template-columns: 1fr;
  }

  body[data-page="profile"] .profile-added-place-photo {
    min-height: 180px;
  }

  body[data-page="profile"] .profile-leaderboard-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    border-radius: 20px;
  }
}

@media (max-width: 620px) {
  body[data-page="profile"] .profile-card-head,
  body[data-page="profile"] .profile-identity,
  body[data-page="profile"] .profile-card-actions {
    align-items: flex-start;
  }

  body[data-page="profile"] .profile-card-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ===========================================================================
   Public profile (viewing another user). Hides the personal-dashboard chrome
   so a visitor sees a clean public profile, not someone else's "your account".
   ========================================================================= */
body[data-page="profile"].is-public-profile [data-profile-nav="data"],
body[data-page="profile"].is-public-profile [data-profile-nav="admin"],
body[data-page="profile"].is-public-profile .profile-goals {
  display: none !important;
}

/* With "Ближайшие цели" gone, let "Достижения" take the full width. */
body[data-page="profile"].is-public-profile .profile-bottom-grid {
  grid-template-columns: 1fr;
}

/* ===========================================================================
   Reviews section — reviews render as place cards (same style as "Я пойду!"),
   with the review's rating shown as stars in the card head.
   ========================================================================= */
body[data-page="profile"] .profile-review-stars {
  color: #f5a623;
  letter-spacing: 2px;
  font-size: 0.95rem;
  line-height: 1;
  white-space: nowrap;
}

/* Read-only like/dislike counts on your own review cards (others react to them
   on the place page). */
body[data-page="profile"] .profile-review-footer-meta {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex-wrap: wrap;
}
body[data-page="profile"] .profile-review-reactions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
body[data-page="profile"] .profile-review-react {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--profile-ref-muted);
  font-size: 0.85rem;
  font-weight: 800;
}
body[data-page="profile"] .profile-review-react-icon {
  width: 15px;
  height: 15px;
  background: currentColor;
  -webkit-mask: var(--profile-react-icon) center / contain no-repeat;
  mask: var(--profile-react-icon) center / contain no-repeat;
}
body[data-page="profile"] .profile-review-react.is-like {
  color: var(--profile-ref-green);
  --profile-react-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 11v9H4a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1h3Z'/%3E%3Cpath d='M7 11l4.2-7.4a1.6 1.6 0 0 1 3 .8V8h4.3a2 2 0 0 1 2 2.4l-1.2 6.4A2.2 2.2 0 0 1 19.1 20H7'/%3E%3C/svg%3E");
}
body[data-page="profile"] .profile-review-react.is-dislike {
  color: #d9564d;
  --profile-react-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 13V4h3a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1h-3Z'/%3E%3Cpath d='M17 13l-4.2 7.4a1.6 1.6 0 0 1-3-.8V16H5.4a2 2 0 0 1-2-2.4l1.2-6.4A2.2 2.2 0 0 1 4.9 4H15'/%3E%3C/svg%3E");
}

/* =========================================================================
   Account deletion — danger card in "Мой аккаунт" + password-confirm modal.
   ========================================================================= */
.profile-danger-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  border: 1px solid rgba(220, 38, 38, 0.18);
  background: rgba(220, 38, 38, 0.04);
}

.profile-danger-copy h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #b91c1c;
}

.profile-danger-copy p {
  margin: 0;
  max-width: 520px;
  color: #6b5b5b;
  font-size: 0.92rem;
  line-height: 1.5;
}

.profile-danger-button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 14px;
  border: 1px solid rgba(220, 38, 38, 0.3);
  background: #fff;
  color: #c0392b;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.profile-danger-button:hover {
  background: #c0392b;
  color: #fff;
}

body.profile-delete-is-open {
  overflow: hidden;
}

.profile-delete-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 25, 29, 0.45);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.profile-delete-overlay.is-visible {
  opacity: 1;
}

.profile-delete-modal {
  width: min(440px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(17, 25, 29, 0.25);
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s ease;
}

.profile-delete-overlay.is-visible .profile-delete-modal {
  transform: translateY(0) scale(1);
}

.profile-delete-mark {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(220, 38, 38, 0.12);
}

.profile-delete-mark::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #dc2626;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 6 5 6 21 6'/%3E%3Cpath d='M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6'/%3E%3Cpath d='M10 11v6M14 11v6'/%3E%3Cpath d='M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2'/%3E%3C/svg%3E") center / 26px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 6 5 6 21 6'/%3E%3Cpath d='M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6'/%3E%3Cpath d='M10 11v6M14 11v6'/%3E%3Cpath d='M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2'/%3E%3C/svg%3E") center / 26px no-repeat;
}

.profile-delete-modal h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
  color: #11191d;
}

.profile-delete-modal > p {
  margin: 0;
  color: #5b6469;
  font-size: 0.95rem;
  line-height: 1.55;
}

.profile-delete-field {
  display: grid;
  gap: 6px;
}

.profile-delete-field span {
  font-size: 0.85rem;
  font-weight: 700;
  color: #5b6469;
}

.profile-delete-field input {
  height: 50px;
  padding: 0 16px;
  border: 1px solid rgba(17, 25, 29, 0.14);
  border-radius: 14px;
  font-family: inherit;
  font-size: 0.98rem;
}

.profile-delete-field input:focus {
  outline: none;
  border-color: rgba(220, 38, 38, 0.5);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.profile-delete-error {
  margin: 0;
  color: #c0392b;
  font-size: 0.88rem;
  font-weight: 700;
}

.profile-delete-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 4px;
}

.profile-delete-cancel,
.profile-delete-confirm {
  min-height: 46px;
  padding: 0 22px;
  border-radius: 14px;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
}

.profile-delete-cancel {
  border: 1px solid rgba(17, 25, 29, 0.12);
  background: #fff;
  color: #51606a;
}

.profile-delete-cancel:hover {
  background: rgba(17, 25, 29, 0.04);
}

.profile-delete-confirm {
  border: 1px solid #dc2626;
  background: #dc2626;
  color: #fff;
}

.profile-delete-confirm:hover {
  background: #b91c1c;
}

.profile-delete-confirm:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ===========================================================================
   Мои маршруты — список, карточки и редактор
   ========================================================================= */
.profile-routes-create {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--profile-ref-green), var(--profile-ref-green-dark));
  box-shadow: 0 12px 26px rgba(0, 155, 54, 0.22);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease;
}
.profile-routes-create:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}
.profile-routes-create-icon {
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='5' x2='12' y2='19'/%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='5' x2='12' y2='19'/%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Route cards reuse the "Я пойду!"/"Добавленные места" shell (.profile-added-
   place-card): photo on the left, body on the right, stacked vertically. */
.profile-routes-list {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 16px;
  min-height: 0;
}
.profile-route-badge {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(0, 155, 54, 0.12);
  color: var(--profile-ref-green-dark);
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
}
.profile-route-footer {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.profile-route-footer-count {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--profile-ref-muted);
}
.profile-route-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.profile-route-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--profile-ref-border);
  border-radius: 11px;
  background: #fff;
  color: var(--profile-ref-ink);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}
.profile-route-action:hover {
  background: rgba(0, 155, 54, 0.06);
  border-color: rgba(0, 155, 54, 0.4);
}
.profile-route-action.is-primary {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--profile-ref-green), var(--profile-ref-green-dark));
}
.profile-route-action.is-primary:hover {
  filter: brightness(1.04);
}
.profile-route-action.is-danger {
  margin-left: auto;
  width: 38px;
  padding: 0;
  color: #b91c1c;
}
.profile-route-action.is-danger:hover {
  background: rgba(185, 28, 28, 0.08);
  border-color: rgba(185, 28, 28, 0.4);
}
.profile-route-action-icon {
  width: 17px;
  height: 17px;
  background: currentColor;
}
.profile-route-action-icon-map {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='9 4 3.5 6.5 3.5 19.5 9 17 15 19.5 20.5 17 20.5 4 15 6.5 9 4'/%3E%3Cline x1='9' y1='4' x2='9' y2='17'/%3E%3Cline x1='15' y1='6.5' x2='15' y2='19.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='9 4 3.5 6.5 3.5 19.5 9 17 15 19.5 20.5 17 20.5 4 15 6.5 9 4'/%3E%3Cline x1='9' y1='4' x2='9' y2='17'/%3E%3Cline x1='15' y1='6.5' x2='15' y2='19.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.profile-route-action-icon-trash {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16'/%3E%3Cpath d='M10 11v6M14 11v6'/%3E%3Cpath d='M6 7l1 13h10l1-13'/%3E%3Cpath d='M9 7V4h6v3'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16'/%3E%3Cpath d='M10 11v6M14 11v6'/%3E%3Cpath d='M6 7l1 13h10l1-13'/%3E%3Cpath d='M9 7V4h6v3'/%3E%3C/svg%3E") center / contain no-repeat;
}

.profile-route-editor {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  opacity: 0;
  transition: opacity 200ms ease;
}
.profile-route-editor[hidden] {
  display: none;
}
.profile-route-editor.is-visible {
  opacity: 1;
}
.profile-route-editor-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 16, 12, 0.42);
  backdrop-filter: blur(3px);
}
.profile-route-editor-dialog {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(86vh, 760px);
  display: flex;
  flex-direction: column;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 40px 90px rgba(8, 16, 12, 0.3);
  transform: translateY(12px) scale(0.98);
  transition: transform 220ms ease;
}
.profile-route-editor.is-visible .profile-route-editor-dialog {
  transform: translateY(0) scale(1);
}
.profile-route-editor-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--profile-ref-border);
}
.profile-route-editor-head strong {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--profile-ref-ink);
}
.profile-route-editor-close {
  margin-left: auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(17, 25, 29, 0.05);
  color: var(--profile-ref-muted);
  cursor: pointer;
}
.profile-route-editor-close:hover {
  background: rgba(17, 25, 29, 0.1);
  color: var(--profile-ref-ink);
}
.profile-route-editor-close svg {
  width: 16px;
  height: 16px;
}
.profile-route-editor-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.profile-route-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.profile-route-field span {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--profile-ref-muted);
}
.profile-route-field input {
  height: 46px;
  padding: 0 14px;
  border: 1px solid rgba(17, 25, 29, 0.14);
  border-radius: 13px;
  background: #fff;
  color: var(--profile-ref-ink);
  font: inherit;
  font-weight: 600;
}
.profile-route-field input:focus {
  outline: 2px solid rgba(0, 155, 54, 0.35);
  outline-offset: 1px;
}
.profile-route-stops-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--profile-ref-muted);
}
.profile-route-stops-head small {
  font-weight: 700;
  color: var(--profile-ref-green-dark);
}
.profile-route-stops-hint {
  font-size: 0.74rem;
  font-weight: 600;
  color: rgba(104, 117, 121, 0.85);
}
.profile-route-stops {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.profile-route-stops-empty {
  margin: 0;
  font-size: 0.84rem;
  color: var(--profile-ref-muted);
}
.profile-route-stops-empty[hidden] {
  display: none;
}
.profile-route-stop {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--profile-ref-border);
  border-radius: 13px;
  background: #fff;
  touch-action: pan-y;
}
.profile-route-stop.is-dragging {
  border-color: rgba(0, 155, 54, 0.5);
  box-shadow: 0 14px 28px rgba(17, 25, 29, 0.14);
  opacity: 0.96;
}
.profile-route-stop-handle {
  flex: 0 0 auto;
  width: 20px;
  height: 24px;
  cursor: grab;
  touch-action: none;
  background: var(--profile-ref-muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23000'%3E%3Ccircle cx='9' cy='6' r='1.5'/%3E%3Ccircle cx='15' cy='6' r='1.5'/%3E%3Ccircle cx='9' cy='12' r='1.5'/%3E%3Ccircle cx='15' cy='12' r='1.5'/%3E%3Ccircle cx='9' cy='18' r='1.5'/%3E%3Ccircle cx='15' cy='18' r='1.5'/%3E%3C/svg%3E") center / 18px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23000'%3E%3Ccircle cx='9' cy='6' r='1.5'/%3E%3Ccircle cx='15' cy='6' r='1.5'/%3E%3Ccircle cx='9' cy='12' r='1.5'/%3E%3Ccircle cx='15' cy='12' r='1.5'/%3E%3Ccircle cx='9' cy='18' r='1.5'/%3E%3Ccircle cx='15' cy='18' r='1.5'/%3E%3C/svg%3E") center / 18px no-repeat;
}
.profile-route-stop-num {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 155, 54, 0.12);
  color: var(--profile-ref-green-dark);
  font-size: 0.74rem;
  font-weight: 800;
}
.profile-route-stop-thumb {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: linear-gradient(135deg, #cbe6d3, #a7d9b2) center / cover no-repeat;
}
.profile-route-stop-title {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  color: var(--profile-ref-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-route-stop-remove {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--profile-ref-muted);
  cursor: pointer;
}
.profile-route-stop-remove:hover {
  background: rgba(185, 28, 28, 0.08);
  color: #b91c1c;
}
.profile-route-stop-remove svg {
  width: 15px;
  height: 15px;
}
.profile-route-picker {
  position: relative;
}
.profile-route-search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 14px;
  border: 1px solid rgba(17, 25, 29, 0.14);
  border-radius: 13px;
  background: #fff;
}
.profile-route-search-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  background: var(--profile-ref-muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='6'/%3E%3Cline x1='15.5' y1='15.5' x2='20' y2='20'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='6'/%3E%3Cline x1='15.5' y1='15.5' x2='20' y2='20'/%3E%3C/svg%3E") center / contain no-repeat;
}
.profile-route-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-weight: 600;
  color: var(--profile-ref-ink);
}
.profile-route-search-results {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
}
.profile-route-search-results[hidden] {
  display: none;
}
.profile-route-search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 0;
  border-radius: 11px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: background 150ms ease;
}
.profile-route-search-result:hover {
  background: rgba(0, 155, 54, 0.08);
}
.profile-route-search-thumb {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #cbe6d3, #a7d9b2) center / cover no-repeat;
}
.profile-route-search-title {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  color: var(--profile-ref-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-route-search-add {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 155, 54, 0.12);
  color: var(--profile-ref-green-dark);
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1;
}
.profile-route-editor-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--profile-ref-border);
}
.profile-route-cancel,
.profile-route-save {
  min-height: 44px;
  padding: 0 22px;
  border-radius: 13px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.profile-route-cancel {
  border: 1px solid var(--profile-ref-border);
  background: #fff;
  color: var(--profile-ref-ink);
}
.profile-route-cancel:hover {
  background: rgba(17, 25, 29, 0.04);
}
.profile-route-save {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--profile-ref-green), var(--profile-ref-green-dark));
  box-shadow: 0 12px 26px rgba(0, 155, 54, 0.22);
}
.profile-route-save:hover {
  filter: brightness(1.04);
}
.profile-route-save:disabled {
  opacity: 0.6;
  cursor: default;
}
body.profile-route-editor-open {
  overflow: hidden;
}

/* ===========================================================================
   Тёмная тема — профиль
   ========================================================================= */
:root[data-theme="dark"] body[data-page="profile"] {
  --profile-ref-ink: #e9efe9;
  --profile-ref-muted: #9aa8a1;
  --profile-ref-border: rgba(255, 255, 255, 0.09);
  --profile-ref-shadow: 0 22px 56px rgba(0, 0, 0, 0.55);
  --profile-ref-soft-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
  background:
    radial-gradient(circle at 82% 6%, rgba(40, 200, 90, 0.1), transparent 30%),
    linear-gradient(180deg, #0d1210 0%, #0e1311 100%);
}
:root[data-theme="dark"] body[data-page="profile"] .site-header {
  background: rgba(18, 24, 21, 0.92);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-sidebar,
:root[data-theme="dark"] body[data-page="profile"] .profile-stat-card,
:root[data-theme="dark"] body[data-page="profile"] .profile-level-card,
:root[data-theme="dark"] body[data-page="profile"] .profile-card,
:root[data-theme="dark"] body[data-page="profile"] .profile-added-place-card,
:root[data-theme="dark"] body[data-page="profile"] .profile-admin-panel,
:root[data-theme="dark"] body[data-page="profile"] .profile-goals-list,
:root[data-theme="dark"] body[data-page="profile"] .profile-achievement-card,
:root[data-theme="dark"] body[data-page="profile"] .profile-review-card,
:root[data-theme="dark"] body[data-page="profile"] .profile-route-card,
:root[data-theme="dark"] body[data-page="profile"] .profile-mobile-menu,
:root[data-theme="dark"] body[data-page="profile"] .profile-mobile-back {
  background: #171e1a;
  border-color: var(--profile-ref-border);
  color: var(--profile-ref-ink);
}
/* На телефоне сайдбар — это прозрачная шапка (аватар + имя), без серой
   подложки: правило выше (тёмная карточка) перебивало мобильную прозрачность
   из-за большей специфичности, поэтому возвращаем прозрачность точечно. */
@media (max-width: 900px) {
  :root[data-theme="dark"] body[data-page="profile"] .profile-sidebar {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
  }
}
/* .profile-section is a TRANSPARENT layout wrapper (no background in light
   theme); it must NOT get the card surface colour, or the whole content
   column reads as a grey block that's lighter than the page background. */
:root[data-theme="dark"] body[data-page="profile"] .profile-section {
  background: transparent;
  border-color: transparent;
  color: var(--profile-ref-ink);
}
/* Place-card / route-card thumbnail placeholder: its mint→lavender gradient
   (color-mix with #ffffff, ending #edf8f1) stayed light in dark mode — only
   the label pill was darkened. Re-tint the whole gradient dark, keeping the
   category accent. */
:root[data-theme="dark"] body[data-page="profile"] .profile-added-place-photo {
  background:
    linear-gradient(145deg, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.12)),
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--profile-place-accent, var(--profile-ref-green)) 50%, #0e1412),
      #0e1412
    );
}
/* Tag pills read as near-invisible dark text on a dark card — make them a
   subtle light-translucent pill with readable muted text. */
:root[data-theme="dark"] body[data-page="profile"] .profile-added-place-tags span {
  background: rgba(255, 255, 255, 0.06);
  color: var(--profile-ref-muted);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-nav-button {
  color: #9aa8a1;
}
:root[data-theme="dark"] body[data-page="profile"] .profile-nav-button:hover {
  background: rgba(255, 255, 255, 0.05);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-nav-button.is-active {
  background: rgba(40, 200, 90, 0.14);
  color: #36da6a;
}
:root[data-theme="dark"] body[data-page="profile"] .profile-level-progress,
:root[data-theme="dark"] body[data-page="profile"] .profile-goal-item {
  border-color: rgba(255, 255, 255, 0.08);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-level-progress {
  background: rgba(255, 255, 255, 0.08);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-achievement-card.is-locked {
  background: rgba(255, 255, 255, 0.04);
}

/* Route editor (modal) in dark */
:root[data-theme="dark"] body[data-page="profile"] .profile-route-editor-dialog {
  background: #161d19;
}
:root[data-theme="dark"] body[data-page="profile"] .profile-route-field input,
:root[data-theme="dark"] body[data-page="profile"] .profile-route-search,
:root[data-theme="dark"] body[data-page="profile"] .profile-route-stop,
:root[data-theme="dark"] body[data-page="profile"] .profile-route-search-result,
:root[data-theme="dark"] body[data-page="profile"] .profile-route-cancel {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--profile-ref-border);
  color: var(--profile-ref-ink);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-route-action {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--profile-ref-border);
  color: var(--profile-ref-ink);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-route-editor-head,
:root[data-theme="dark"] body[data-page="profile"] .profile-route-editor-foot {
  border-color: var(--profile-ref-border);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-route-editor-close {
  background: rgba(255, 255, 255, 0.06);
  color: var(--profile-ref-muted);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-route-card-cover,
:root[data-theme="dark"] body[data-page="profile"] .profile-route-stop-thumb,
:root[data-theme="dark"] body[data-page="profile"] .profile-route-search-thumb {
  background: linear-gradient(135deg, #1c2a22, #16241c) center / cover no-repeat;
}
:root[data-theme="dark"] body[data-page="profile"] .profile-city-card {
  background: #17201d;
}
:root[data-theme="dark"] body[data-page="profile"] .profile-added-places-empty,
:root[data-theme="dark"] body[data-page="profile"] .profile-cities-empty,
:root[data-theme="dark"] body[data-page="profile"] .profile-section-empty {
  background: #171e1a;
  border-color: var(--profile-ref-border);
  color: var(--profile-ref-muted);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-sidebar-avatar,
:root[data-theme="dark"] body[data-page="profile"] .header-user-chip-avatar {
  background: rgba(40, 200, 90, 0.16);
}
/* Light-gray progress-bar tracks -> dark; fill (span) stays bright. */
:root[data-theme="dark"] body[data-page="profile"] .profile-progress-bar {
  background: rgba(255, 255, 255, 0.13);
}
/* Dim the city banner photo so its bright sky doesn't read light-gray. */
:root[data-theme="dark"] body[data-page="profile"] .profile-city-banner {
  background-image:
    linear-gradient(90deg, rgba(9, 15, 13, 0.86), rgba(9, 15, 13, 0.6) 54%, rgba(9, 15, 13, 0.74)),
    var(--profile-city-banner-image, url("https://images.unsplash.com/photo-1512470876302-972faa2aa9a4?auto=format&fit=crop&w=1200&q=84"));
}
:root[data-theme="dark"] body[data-page="profile"] .profile-city-banner::before {
  background: linear-gradient(180deg, rgba(9, 15, 13, 0.4), rgba(9, 15, 13, 0.68));
}
/* Телефон, тёмная тема: фото рисуется на всей карточке, баннер прозрачный —
   единый стек поверх фото (переопределяет тёмные фоны карточки/баннера выше;
   светлая раскладка живёт в блоке ≤900px). */
@media (max-width: 900px) {
  :root[data-theme="dark"] body[data-page="profile"] .profile-city-card {
    background-color: #0f1512;
    background-image:
      linear-gradient(180deg, rgba(9, 15, 13, 0.6) 0%, rgba(9, 15, 13, 0.52) 48%, rgba(9, 15, 13, 0.86) 100%),
      var(--profile-city-banner-image, url("https://images.unsplash.com/photo-1512470876302-972faa2aa9a4?auto=format&fit=crop&w=1200&q=84"));
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
  }
  :root[data-theme="dark"] body[data-page="profile"] .profile-city-banner {
    background-image: none;
  }
}

/* =========================================================================
   Dark theme — remaining light surfaces found in the site-wide sweep
   (delete modal, leaderboard, account fields/buttons, visit list, banners).
   ========================================================================= */
:root[data-theme="dark"] body[data-page="profile"] .profile-delete-modal {
  background: #171e1a;
  border-color: var(--profile-ref-border);
  color: var(--profile-ref-ink);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-leaderboard-card {
  background: #171e1a;
  border-color: var(--profile-ref-border);
  color: var(--profile-ref-ink);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-leaderboard-empty,
:root[data-theme="dark"] body[data-page="profile"] .profile-exploration-empty {
  background: #171e1a;
  border-color: var(--profile-ref-border);
  color: var(--profile-ref-muted);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-leaderboard-card.is-top-rank,
:root[data-theme="dark"] body[data-page="profile"] .profile-leaderboard-card.is-current-user {
  background: linear-gradient(135deg, rgba(40, 200, 90, 0.16), rgba(40, 200, 90, 0.06)), #171e1a;
  border-color: rgba(40, 200, 90, 0.22);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-leaderboard-tabs {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--profile-ref-border);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-leaderboard-tab.is-active {
  background: rgba(40, 200, 90, 0.14);
  color: #36da6a;
}
:root[data-theme="dark"] body[data-page="profile"] .profile-field-card {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--profile-ref-border);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-field-input {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--profile-ref-border);
  color: var(--profile-ref-ink);
}
/* Secondary action buttons + pagination chips that were near-white pills. */
:root[data-theme="dark"] body[data-page="profile"] .profile-home-link,
:root[data-theme="dark"] body[data-page="profile"] .profile-edit-button,
:root[data-theme="dark"] body[data-page="profile"] .profile-cancel-button,
:root[data-theme="dark"] body[data-page="profile"] .profile-security-setup-button,
:root[data-theme="dark"] body[data-page="profile"] .profile-delete-cancel,
:root[data-theme="dark"] body[data-page="profile"] .profile-added-places-page {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--profile-ref-border);
  color: var(--profile-ref-ink);
}
/* Danger button keeps its red affordance — just lose the white fill. */
:root[data-theme="dark"] body[data-page="profile"] .profile-danger-button {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--profile-ref-border);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-visit-item {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--profile-ref-border);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-visit-action {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--profile-ref-border);
}
/* Status banners (security / form messages) read light-pink — dark red tint.
   This is the ERROR/default state; the SUCCESS state is re-greened below. */
:root[data-theme="dark"] body[data-page="profile"] .profile-security-message,
:root[data-theme="dark"] body[data-page="profile"] .profile-message {
  background: rgba(186, 54, 54, 0.16);
  border-color: rgba(186, 54, 54, 0.3);
}
/* Success banners ("Данные профиля обновлены") must stay green — the red rule
   above (0,4,1) out-specifies the base success variant, so re-assert it here
   with the [data-state] selector (0,5,1) to win. */
:root[data-theme="dark"] body[data-page="profile"] .profile-message[data-state="success"],
:root[data-theme="dark"] body[data-page="profile"] .profile-security-message[data-state="success"] {
  background: rgba(var(--accent-rgb), 0.16);
  border-color: rgba(var(--accent-rgb), 0.32);
  color: var(--accent-soft, #36da6a);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-added-place-category {
  background: color-mix(in srgb, var(--profile-place-accent, var(--profile-ref-green)) 24%, #171e1a);
  color: var(--profile-ref-ink);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-added-place-photo span {
  background: rgba(23, 30, 26, 0.85);
  color: var(--profile-ref-ink);
}

/* =====================================================================
   Dark-theme contrast fixes (audit 2026-07) — profile dashboard.
   --profile-ref-green is still used for solid green button fills, so it
   is NOT remapped; instead brighten the specific green TEXT/ICON/pill
   elements that were too dark on the near-black cards.
   ===================================================================== */
:root[data-theme="dark"] body[data-page="profile"] .profile-inline-link {
:root[data-theme="dark"] body[data-page="profile"] .profile-stat-icon::before { background: var(--accent-soft, #36da6a); }
:root[data-theme="dark"] body[data-page="profile"] .profile-goal-icon::before,
:root[data-theme="dark"] body[data-page="profile"] .profile-achievement-icon::before { background: var(--accent-soft, #36da6a); }
:root[data-theme="dark"] body[data-page="profile"] .profile-achievement-card.is-unlocked em {
  background: rgba(40, 200, 90, 0.18);
  color: var(--accent-soft, #36da6a);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-goal-reward {
  background: rgba(40, 200, 90, 0.18);
  color: var(--accent-soft, #36da6a);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-added-place-status {
  background: rgba(40, 200, 90, 0.18);
  color: var(--accent-soft, #36da6a);
}

/* Delete-account modal password input declares no background -> UA white on
   the dark modal. Darken it to the standard dark form-control style. */
:root[data-theme="dark"] body[data-page="profile"] .profile-delete-field input {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.22);
  color: var(--profile-ref-ink, #e9efe9);
}
:root[data-theme="dark"] body[data-page="profile"] .profile-delete-field input::placeholder {
  color: rgba(233, 239, 233, 0.55);
}

/* ============================================================================
   Mobile header polish (profile): push the city picker + theme/bell icons to
   the right edge, let the city name ellipsize so the icons never overflow, and
   anchor the notifications panel to the right so it fits the screen.
   ============================================================================ */
@media (max-width: 900px) {
  body[data-page="profile"] .header-actions {
    justify-content: flex-end;
    flex-wrap: nowrap;
    margin-left: auto;
    min-width: 0;
  }
  body[data-page="profile"] .header-city-picker-anchor {
    min-width: 0;
    flex: 0 1 auto;
  }
  body[data-page="profile"] .header-chip-location {
    min-width: 0;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body[data-page="profile"] .header-notification-dropdown {
    left: auto;
    right: 0;
    transform: translateY(-10px) scale(0.97);
    transform-origin: top right;
  }
  body[data-page="profile"] .header-notification-dropdown.is-visible {
    transform: translateY(0) scale(1);
  }
}

/* ============================================================================
   Карточка «Смена пароля»
   ----------------------------------------------------------------------------
   .profile-security-card задаёт padding:0 — это правильно для карточки 2FA, у
   которой отступы живут внутри раскрывающейся панели (.profile-security-panel-
   inner: 0 22px 22px). У карточки пароля такой панели нет, поэтому заголовок,
   поля и кнопка упирались прямо в скруглённый край. Возвращаем те же 22px.
   Идёт после body[data-page="profile"] .profile-security-card (та же
   специфичность), поэтому выигрывает по порядку.
   ============================================================================ */
body[data-page="profile"] .profile-password-card {
  gap: 14px;
  padding: 22px;
}

/* Поля и кнопка не должны вылезать за карточку: у input width:100%, а padding
   считается внутрь только при border-box. */
body[data-page="profile"] .profile-password-card .profile-field-input {
  box-sizing: border-box;
  max-width: 100%;
}

body[data-page="profile"] .profile-password-card .profile-security-actions {
  align-items: center;
}

/* Код из письма: моноширинный ритм, как в поле кода на странице входа. */
body[data-page="profile"] #profilePasswordCode {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.4em;
  text-indent: 0.4em; /* компенсирует трекинг после последней цифры */
}

@media (max-width: 640px) {
  body[data-page="profile"] .profile-password-card {
    padding: 18px;
  }
}

}