.auth-overlay[hidden] {
  display: none !important;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3, 3, 10, 0.72);
  backdrop-filter: blur(12px);
}

.auth-sheet {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: min(90vh, 860px);
  overflow-y: auto;
  padding: 34px 30px 30px;
  background: linear-gradient(180deg, rgba(18, 18, 38, 0.98), rgba(8, 8, 22, 0.98));
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}

.auth-close {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
}

.auth-close:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--line-2);
}

.auth-title {
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  margin-bottom: 8px;
}

.auth-subtitle {
  color: var(--muted);
  margin-bottom: 24px;
}

.auth-social {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.auth-social__btn {
  justify-content: center;
  padding: 13px 18px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--faint);
  font-size: 13px;
  margin: 8px 0 20px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.auth-field {
  display: grid;
  gap: 7px;
  font-size: 14px;
  color: var(--muted);
}

.auth-field input {
  width: 100%;
  padding: 13px 15px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.auth-field input::placeholder {
  color: var(--faint);
}

.auth-field input:focus {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(109, 92, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(109, 92, 255, 0.16);
}

.auth-code {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 13px;
}

.auth-code__row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-code__row .auth-field {
  flex: 1;
  min-width: 0;
}

.auth-code__row .btn {
  flex: 0 0 auto;
}

.auth-hint {
  color: var(--faint);
  font-size: 13px;
}

.auth-back {
  margin-top: 16px;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--faint);
  font-size: 13.5px;
  cursor: pointer;
}

.auth-back:hover {
  color: var(--text);
}

.auth-error {
  margin-top: 16px;
  padding: 12px 14px;
  color: #ffadad;
  background: rgba(255, 78, 78, 0.1);
  border: 1px solid rgba(255, 78, 78, 0.24);
  border-radius: var(--r-sm);
  font-size: 14px;
}

.auth-consent-text {
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.025em;
  font-size: clamp(2.2rem, 6vw, 4rem);
  margin: 18px 0 26px;
}

.auth-consent__row {
  display: flex;
  gap: 12px;
}

.auth-consent__row .btn {
  flex: 1;
  justify-content: center;
}

.auth-user {
  position: relative;
}

.auth-user__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 220px;
  padding: 12px;
  background: rgba(10, 10, 24, 0.98);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  display: none;
}

.auth-user.is-open .auth-user__menu {
  display: block;
}

.auth-user__name {
  color: var(--muted);
  font-size: 13px;
  padding: 4px 8px 10px;
}

.auth-user__logout {
  width: 100%;
  text-align: left;
}

@media (max-width: 560px) {
  .auth-social {
    grid-template-columns: 1fr;
  }

  .auth-sheet {
    padding: 28px 20px 24px;
  }

  .auth-code__row {
    flex-wrap: wrap;
  }

  .auth-code__row .btn--primary {
    flex: 1 1 100%;
  }
}

.auth-profile {
  display: grid;
  gap: 10px;
  margin: 4px 0 24px;
}

.auth-profile__row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--muted);
}

.auth-profile__row b {
  color: var(--text);
  text-align: right;
  word-break: break-word;
}

.auth-profile__row--plan {
  background: var(--brand-soft);
  border-color: rgba(109, 92, 255, 0.32);
}

.auth-page {
  padding-top: 40px;
}

.auth-page__inner {
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
}

.auth-page__title {
  font-size: clamp(2rem, 4.5vw, 3rem);
  margin: 10px 0 26px;
  text-align: left;
}

.auth-card {
  background: linear-gradient(180deg, rgba(18, 18, 38, 0.96), rgba(8, 8, 22, 0.96));
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
  padding: 28px 26px;
  margin-bottom: 18px;
}

.auth-card__title {
  font-size: 1.25rem;
  margin-bottom: 14px;
}

.auth-card .auth-consent-text {
  font-size: clamp(1.5rem, 4vw, 2.4rem);
}

.auth-social__btn {
  position: relative;
}

.auth-social__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.auth-social__btn.is-loading {
  color: transparent;
}

.auth-social__btn.is-loading svg {
  opacity: 0;
}

.auth-social__btn.is-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  border-top-color: var(--brand-2);
  animation: auth-spin 0.8s linear infinite;
}

@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

.profile-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 0;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 28px 90px;
  min-height: calc(100vh - var(--header-h));
  align-items: start;
}

.profile-side {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 18px;
  background: linear-gradient(180deg, rgba(18, 18, 38, 0.96), rgba(8, 8, 22, 0.96));
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  margin-right: 26px;
}

.profile-side__user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.profile-side__avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), #8b5cf6);
  border-radius: 50%;
}

.profile-side__name {
  font-weight: 600;
  font-size: 15px;
  word-break: break-word;
}

.profile-side__plan {
  color: var(--muted);
  font-size: 13px;
}

.profile-side__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-side__nav a {
  padding: 10px 14px;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 500;
  border: 1px solid transparent;
}

.profile-side__nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.profile-side__nav a.is-active {
  color: var(--text);
  background: var(--brand-soft);
  border-color: rgba(109, 92, 255, 0.32);
}

.profile-side__logout {
  margin-top: 6px;
  justify-content: center;
}

.profile-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.profile-sec {
  scroll-margin-top: calc(var(--header-h) + 24px);
  background: linear-gradient(180deg, rgba(18, 18, 38, 0.9), rgba(8, 8, 22, 0.9));
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  padding: 30px 28px;
}

.profile-sec__title {
  font-size: 1.5rem;
  margin-bottom: 16px;
}

.profile-hello {
  font-size: clamp(2rem, 4.5vw, 3rem);
  margin-bottom: 6px;
}

.profile-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.profile-overview__card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--muted);
  font-size: 13.5px;
}

.profile-overview__card b {
  color: var(--text);
  font-size: 1.25rem;
  font-family: var(--font-display);
}

.profile-plans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.profile-plan {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 18px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
}

.profile-plan.is-current {
  border-color: rgba(109, 92, 255, 0.55);
  background: var(--brand-soft);
}

.profile-plan h3 {
  font-size: 1.2rem;
}

.profile-plan__desc {
  color: var(--muted);
  font-size: 13.5px;
  flex: 1;
}

.profile-plan__price {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
}

.auth-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

  .profile-side {
    position: static;
    margin-right: 0;
  }

  .profile-side__nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

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

.auth-terms {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
}

.auth-terms input {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin-top: 2px;
  accent-color: var(--brand);
  cursor: pointer;
}

.terms-doc {
  max-height: min(52vh, 520px);
  overflow-y: auto;
  padding-right: 6px;
  margin-bottom: 18px;
  font-size: 14.5px;
  color: var(--muted);
}

.terms-doc > div {
  display: grid;
  gap: 12px;
  line-height: 1.6;
}

.terms-doc > div[hidden] {
  display: none;
}

.terms-doc h3 {
  color: var(--text);
  font-size: 15px;
  margin: 8px 0 0;
}

.terms-doc p,
.terms-doc ul {
  margin: 0;
}

.terms-doc ul {
  display: grid;
  gap: 6px;
  padding-left: 18px;
  list-style: disc;
}

.terms-doc b {
  color: var(--text);
}

.terms-actions {
  margin-top: 4px;
}

@media (max-width: 560px) {
  .terms-doc {
    max-height: 46vh;
  }
}

/* --- brand refresh: монохром под лого UIDE --- */

.auth-profile__row--plan {
  border-color: transparent;
  background:
    linear-gradient(180deg, #17171f, #0e0e14) padding-box,
    linear-gradient(135deg, #ffffff 0%, #6f6f85 100%) border-box;
}

.profile-plan.is-current {
  border-color: transparent;
  background:
    linear-gradient(180deg, #17171f, #0e0e14) padding-box,
    linear-gradient(135deg, #ffffff 0%, #6f6f85 100%) border-box;
}

.auth-field input:focus {
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}

.auth-social__btn.is-loading::after {
  border-top-color: #f2f2f7;
}

.auth-overlay {
  background: rgba(2, 2, 6, 0.8);
}
