/* ==========================================================================
   Auth pages — вход, регистрация, повторное согласие.
   Один визуальный язык с личными кабинетами (.page-overview):
   тёмная витрина слева, светлая панель формы справа.
   ========================================================================== */

.page-auth {
  --ov-bg: #f4f6f1;
  --ov-surface: #ffffff;
  --ov-ink: #243e35;
  --ov-muted: #7b8982;
  --ov-line: #e4eae2;
  --ov-green: #297455;
  --ov-soft: #edf4eb;
  --ov-amber: #b17b42;
  --ov-shadow: 0 24px 60px -40px rgba(24, 59, 42, 0.35);
  background:
    radial-gradient(58% 42% at 10% 4%, #e7f0dd 0, transparent 62%),
    radial-gradient(48% 40% at 94% 96%, #e4eee4 0, transparent 64%),
    var(--ov-bg);
}

html[data-theme="dark-green"] .page-auth {
  --ov-bg: #0e1512;
  --ov-surface: #18211c;
  --ov-ink: #e9eee7;
  --ov-muted: #96a59a;
  --ov-line: #28362c;
  --ov-green: #a7cf9b;
  --ov-soft: #1f2b23;
  --ov-amber: #d5a66e;
  --ov-shadow: 0 24px 60px -36px rgba(0, 0, 0, 0.6);
  background:
    radial-gradient(58% 42% at 10% 4%, #1b2a21 0, transparent 62%),
    radial-gradient(48% 40% at 94% 96%, #182620 0, transparent 64%),
    var(--ov-bg);
}

/* Публичный каркас: страница самодостаточна, верхнего меню и футера нет. */
.page-auth .topbar,
.page-auth .footer {
  display: none !important;
}

.page-auth main {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
}

.page-auth .content {
  display: flex;
  flex: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

/* Системные флеш-сообщения отрисованы внутри панели. */
.page-auth main > .container {
  display: none;
}

.page-auth .auth-page {
  display: flex;
  flex: 1;
  padding: clamp(12px, 2.4vw, 32px);
}

/* ---------- Двухпанельный каркас ---------- */
.auth-split {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  align-items: stretch;
  gap: clamp(14px, 1.7vw, 24px);
  width: 100%;
  max-width: 1280px;
  min-height: 620px;
  min-height: min(820px, calc(100dvh - 64px));
  margin: auto;
  animation: auth-rise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes auth-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Витрина ---------- */
.auth-aside {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 2.4vh, 30px);
  padding: clamp(24px, 2.6vw, 42px);
  overflow: hidden;
  border: 1px solid #3a6146;
  border-radius: 26px;
  background:
    radial-gradient(118% 88% at 88% 4%, #4d6f4c 0%, transparent 58%),
    radial-gradient(82% 70% at 4% 100%, #3f6a4d 0%, transparent 62%),
    linear-gradient(148deg, #14291f 0%, #1b3a2b 46%, #2a4d36 100%);
  color: #f2f5e8;
  box-shadow: 0 30px 70px -44px rgba(16, 40, 28, 0.75);
}

.auth-aside::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: -30% -20%;
  background: repeating-linear-gradient(128deg, transparent 0 68px, #dbe8c50a 69px 70px);
  pointer-events: none;
}

.auth-aside::after {
  content: '';
  position: absolute;
  z-index: -1;
  right: -170px;
  bottom: -230px;
  width: 430px;
  height: 430px;
  border-radius: 50%;
  background: #cfe2a61f;
  filter: blur(12px);
  pointer-events: none;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  color: #f4f7ea;
  text-decoration: none;
}

.auth-brand__logo {
  width: 42px;
  height: 42px;
  padding: 3px;
  border-radius: 13px;
  object-fit: contain;
  background: #f7f8ef;
  box-shadow: 0 10px 24px -14px #000000aa;
}

.auth-brand__name {
  display: flex;
  flex-direction: column;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.auth-brand__name small {
  margin-top: 3px;
  color: #a9c0a5;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.auth-aside__body {
  margin-top: auto;
  margin-bottom: auto;
}

.auth-eyebrow {
  margin: 0;
  color: var(--ov-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.auth-aside .auth-eyebrow {
  color: #a9c0a5;
}

.auth-aside__title {
  margin: 14px 0 0;
  color: #f6f7ec;
  font-size: clamp(25px, 2.4vw, 35px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.12;
  text-wrap: balance;
}

.auth-aside__lead {
  max-width: 42ch;
  margin: 14px 0 0;
  color: #b9cdb6;
  font-size: 13.5px;
  line-height: 1.65;
}

.auth-perks {
  display: grid;
  gap: 11px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.auth-perks li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #d6e2cd;
  font-size: 13px;
  line-height: 1.5;
}

.auth-perks__icon {
  display: grid;
  place-items: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border: 1px solid #9dbba042;
  border-radius: 50%;
  background: #cfe4a514;
  color: #cfe4a5;
}

/* Мини-превью кабинета: декоративное, но задаёт «дорогой» контекст. */
.auth-preview {
  margin-top: clamp(18px, 3vh, 34px);
  padding: 14px 16px;
  border: 1px solid #ffffff1f;
  border-radius: 18px;
  background: #0f231a70;
  box-shadow: inset 0 1px 0 #ffffff12;
  backdrop-filter: blur(6px);
}

.auth-preview__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 11px;
  border-bottom: 1px solid #ffffff14;
}

.auth-preview__bar i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffffff2b;
}

.auth-preview__bar em {
  margin-left: auto;
  color: #9db79c;
  font-size: 9.5px;
  font-style: normal;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.auth-preview__rows {
  display: grid;
  gap: 7px;
  padding: 11px 0;
}

.auth-preview__row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  color: #dfe8d5;
  font-size: 12px;
}

.auth-preview__row span {
  font-weight: 550;
}

.auth-preview__row em {
  color: #93ab92;
  font-size: 10.5px;
  font-style: normal;
}

.auth-preview__row b {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: #cfe4a51f;
  color: #d9edb4;
  font-size: 11px;
  font-weight: 600;
}

.auth-preview__row b.is-four {
  background: #dbe3a314;
  color: #cfd9a2;
}

.auth-preview__foot {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid #ffffff14;
  color: #9db79c;
  font-size: 10px;
}

.auth-preview__foot strong {
  color: #eaf3cf;
  font-size: 13px;
  font-weight: 600;
}

.auth-preview__foot i {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #ffffff17;
}

.auth-preview__foot i b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8fbf86, #d3e2a3);
}

.auth-aside__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: clamp(14px, 2vh, 20px);
  color: #9db59b;
  font-size: 11px;
}

.auth-aside__foot a {
  color: #b4c9af;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.auth-aside__foot a:hover {
  color: #e6efce;
  border-bottom-color: #e6efce66;
}

/* ---------- Панель формы ---------- */
.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: clamp(26px, 3vw, 48px);
  border: 1px solid var(--ov-line);
  border-radius: 26px;
  background: var(--ov-surface);
  box-shadow: var(--ov-shadow);
}

.auth-card {
  width: 100%;
  max-width: 424px;
  margin: 0 auto;
}

.auth-title {
  margin: 12px 0 0;
  color: var(--ov-ink);
  font-size: clamp(25px, 2.2vw, 31px);
  font-weight: 550;
  letter-spacing: -0.045em;
  line-height: 1.16;
}

.auth-lede {
  margin: 10px 0 0;
  color: var(--ov-muted);
  font-size: 13.5px;
  line-height: 1.6;
}

/* ---------- Сообщения ---------- */
.auth-alerts {
  display: grid;
  gap: 8px;
  margin: 20px 0 0;
}

.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid #2f7f5b2e;
  border-radius: 12px;
  background: #2f7f5b12;
  color: #26684a;
  font-size: 12.5px;
  line-height: 1.5;
}

.auth-alert--error {
  border-color: #b16e5230;
  background: #b16e5210;
  color: #9a5b45;
}

.auth-alert__icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

html[data-theme="dark-green"] .auth-alert {
  color: #a9d8a0;
  border-color: #7fb18a3d;
  background: #7fb18a14;
}

html[data-theme="dark-green"] .auth-alert--error {
  color: #e2a58c;
  border-color: #d5957a3d;
  background: #d5957a14;
}

/* ---------- Форма ---------- */
.auth-form {
  display: grid;
  gap: 15px;
  margin: 24px 0 0;
}

.auth-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.auth-field__label {
  color: var(--ov-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.auth-input {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid var(--ov-line);
  border-radius: 12px;
  background: var(--ov-surface);
  color: var(--ov-ink);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.4;
  box-shadow: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  -webkit-appearance: none;
  appearance: none;
}

.auth-input::placeholder {
  color: var(--ov-muted);
  opacity: 0.72;
}

.auth-input:hover {
  border-color: color-mix(in srgb, var(--ov-green) 28%, var(--ov-line));
}

.auth-input:focus {
  outline: none;
  border-color: var(--ov-green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ov-green) 16%, transparent);
}

/* Поле пароля с кнопкой «показать» */
.auth-field__password {
  position: relative;
  display: flex;
}

.auth-field__password .auth-input {
  padding-right: 46px;
}

.auth-eye {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ov-muted);
  cursor: pointer;
  transform: translateY(-50%);
  transition: background 0.15s ease, color 0.15s ease;
}

.auth-eye:hover {
  background: var(--ov-soft);
  color: var(--ov-green);
}

.auth-eye:focus-visible {
  outline: 2px solid var(--ov-green);
  outline-offset: 1px;
}

.auth-eye .auth-eye__hide,
.auth-eye.is-visible .auth-eye__show {
  display: none;
}

.auth-eye.is-visible .auth-eye__hide {
  display: block;
}

.auth-hint {
  color: var(--ov-muted);
  font-size: 11.5px;
  line-height: 1.45;
  opacity: 0.9;
}

.auth-section {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 3px 0 -3px;
  color: var(--ov-muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.auth-section::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--ov-line);
}

.auth-note {
  margin: 0;
  color: var(--ov-muted);
  font-size: 12px;
  line-height: 1.5;
}

.auth-note--warn {
  color: var(--ov-amber);
}

/* Индикатор надёжности пароля */
.auth-strength {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 1px;
}

.auth-strength[hidden] {
  display: none;
}

.auth-strength__track {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
}

.auth-strength__track i {
  width: 24px;
  height: 4px;
  border-radius: 999px;
  background: var(--ov-line);
  transition: background 0.2s ease;
}

.auth-strength__text {
  color: var(--ov-muted);
  font-size: 11px;
}

.auth-strength[data-score="1"] .auth-strength__track i:nth-child(-n+1) { background: #c1886a; }
.auth-strength[data-score="2"] .auth-strength__track i:nth-child(-n+2) { background: #c9a15e; }
.auth-strength[data-score="3"] .auth-strength__track i:nth-child(-n+3) { background: #7fae74; }
.auth-strength[data-score="4"] .auth-strength__track i { background: var(--ov-green); }

/* ---------- Капча ---------- */
.auth-captcha {
  margin-top: 2px;
  overflow: hidden;
  border: 1px solid var(--ov-line);
  border-radius: 14px;
  background: var(--ov-soft);
}

.auth-captcha__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--ov-line);
  background: color-mix(in srgb, var(--ov-surface) 55%, transparent);
  color: var(--ov-ink);
  font-size: 12px;
  font-weight: 600;
}

.auth-captcha__icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--ov-green) 14%, transparent);
  color: var(--ov-green);
}

.auth-captcha__title {
  flex: 1;
}

.auth-captcha__refresh {
  color: var(--ov-muted);
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
}

.auth-captcha__refresh:hover {
  color: var(--ov-green);
}

.auth-captcha__body {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px;
}

.auth-captcha__question {
  color: var(--ov-ink);
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.auth-captcha__input {
  width: 74px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--ov-green) 35%, var(--ov-line));
  border-radius: 10px;
  background: var(--ov-surface);
  color: var(--ov-ink);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.auth-captcha__input:focus {
  outline: none;
  border-color: var(--ov-green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ov-green) 16%, transparent);
}

.auth-captcha__widget {
  display: flex;
  justify-content: center;
  padding: 8px;
}

/* ---------- Согласие ---------- */
.auth-consent {
  position: relative;
  display: flex;
  gap: 11px;
  padding: 13px 14px;
  border: 1px solid var(--ov-line);
  border-radius: 13px;
  background: var(--ov-soft);
  cursor: pointer;
  transition: border-color 0.18s ease;
}

.auth-consent:hover {
  border-color: color-mix(in srgb, var(--ov-green) 34%, var(--ov-line));
}

.auth-consent__input {
  position: absolute;
  left: 14px;
  top: 14px;
  width: 20px;
  height: 20px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.auth-consent__box {
  display: grid;
  place-items: center;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 1.5px solid color-mix(in srgb, var(--ov-ink) 26%, transparent);
  border-radius: 6px;
  background: var(--ov-surface);
  color: #ffffff;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.auth-consent__box svg {
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.auth-consent__input:checked + .auth-consent__box {
  border-color: var(--ov-green);
  background: var(--ov-green);
}

.auth-consent__input:checked + .auth-consent__box svg {
  opacity: 1;
  transform: none;
}

.auth-consent__input:focus-visible + .auth-consent__box {
  outline: 2px solid var(--ov-green);
  outline-offset: 2px;
}

html[data-theme="dark-green"] .auth-consent__box {
  color: #14261b;
}

.auth-consent__text {
  color: var(--ov-muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.auth-consent__text a {
  color: var(--ov-green);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* ---------- Кнопки ---------- */
.auth-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  margin-top: 4px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #2d6148;
  color: #ffffff;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 12px 26px -18px #14351f;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.auth-submit:hover {
  background: #26543e;
  transform: translateY(-1px);
  box-shadow: 0 16px 32px -18px #14351f;
}

.auth-submit:active {
  transform: translateY(0);
}

.auth-submit:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--ov-green) 42%, transparent);
  outline-offset: 2px;
}

.auth-submit[aria-busy="true"] {
  opacity: 0.72;
  pointer-events: none;
}

html[data-theme="dark-green"] .auth-submit {
  background: #a7cf9b;
  color: #14261b;
  box-shadow: none;
}

html[data-theme="dark-green"] .auth-submit:hover {
  background: #b8dbaa;
}

.auth-signout-form {
  margin: 18px 0 0;
}

.auth-link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ov-muted);
  font: inherit;
  font-size: 12.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.auth-link-button:hover {
  color: var(--ov-green);
}

/* ---------- Подвал панели ---------- */
.auth-switch {
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--ov-line);
  color: var(--ov-muted);
  font-size: 13px;
  text-align: center;
}

.auth-switch a {
  color: var(--ov-green);
  font-weight: 600;
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.auth-footnote {
  margin: 14px 0 0;
  color: var(--ov-muted);
  font-size: 11.5px;
  line-height: 1.5;
  text-align: center;
}

.auth-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Адаптив ---------- */
@media (max-width: 960px) {
  .auth-split {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    min-height: 0;
  }

  .auth-aside {
    gap: 16px;
    padding: 22px;
    border-radius: 22px;
  }

  .auth-aside__body {
    margin-top: 0;
  }

  .auth-aside__title {
    max-width: 30ch;
    font-size: 24px;
  }

  .auth-aside__lead {
    margin-top: 10px;
    font-size: 13px;
  }

  .auth-perks {
    margin-top: 16px;
  }

  .auth-preview {
    display: none;
  }

  .auth-panel {
    padding: 26px 22px;
    border-radius: 22px;
  }

  .auth-card {
    max-width: 480px;
  }
}

@media (max-width: 600px) {
  .page-auth .auth-page {
    padding: 10px;
  }

  .auth-split {
    gap: 10px;
  }

  .auth-aside {
    gap: 8px;
    padding: 16px 18px;
    border-radius: 18px;
  }

  .auth-aside__title {
    margin-top: 9px;
    font-size: 20px;
    letter-spacing: -0.03em;
  }

  .auth-aside__lead,
  .auth-perks,
  .auth-aside__foot {
    display: none;
  }

  .auth-panel {
    padding: 22px 18px;
    border-radius: 18px;
  }

  .auth-title {
    font-size: 23px;
  }

  .auth-form {
    margin-top: 20px;
  }
}

@media (max-height: 760px) and (min-width: 961px) {
  .auth-preview {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-auth *,
  .page-auth *::before {
    animation: none !important;
    transition: none !important;
  }
}
