/* Страница входа: слева фирменная панель, справа форма без карточки (#28128 UI) */
.lp {
    --lp-primary: #2563eb;
    --lp-primary-dark: #1d4ed8;
    --lp-link: #1d5fc4;
    --lp-accent: #f6c343;
    --lp-accent-dark: #ecb52e;
    --lp-yellow: #f2c230;
    --lp-blue: #5b9bd5;
    --lp-text: #1e293b;
    --lp-muted: #64748b;
    --lp-placeholder: #64748b;
    --lp-danger: #b91c1c;
    --lp-danger-bg: #fef2f2;
    --lp-danger-border: #fecaca;
    --lp-ring: rgba(37, 99, 235, 0.22);
    --lp-radius: 12px;
    --lp-top: 96px; /* высота верхней полосы с логотипом и языком */
    --lp-font-display: 'Montserrat', 'Segoe UI', Roboto, sans-serif;
    --lp-font-body: 'Segoe UI', Roboto, -apple-system, 'Helvetica Neue', Arial, sans-serif;

    position: relative;
    box-sizing: border-box;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 47fr 53fr;
    background: #fff;
    font-family: var(--lp-font-body);
    color: var(--lp-text);
}
.lp *, .lp *::before, .lp *::after { box-sizing: border-box; }

/* ---------- Верхняя полоса: логотип слева, язык справа ---------- */
.lp__topbar {
    position: absolute;
    z-index: 3;
    top: 0;
    left: 0;
    right: 0;
    height: var(--lp-top);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 40px;
    pointer-events: none;
}
.lp__topbar > * { pointer-events: auto; }
.lp__lang {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    background: #f5f7fa;
    box-shadow: none;
    animation: lp-up 500ms cubic-bezier(0.22, 1, 0.36, 1) 80ms both;
}
.lp__lang-item {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--lp-muted);
    text-decoration: none;
    transition: background-color 150ms ease, color 150ms ease;
}
.lp__lang-item:hover { color: var(--lp-text); }
.lp__lang-item.is-active { background: #dbe7fb; color: var(--lp-primary); }
.lp__lang-item:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--lp-ring); }

/* ---------- Левая панель ---------- */
.lp__aside {
    position: relative;
    /* Панель шире своей колонки на половину волны, а волнистый край режет clip-path:
       один слой без наложений, поэтому на стыке нет полупиксельной щели */
    width: calc(100% + 32px);
    overflow: hidden;
    clip-path: url(#lp-wave-clip);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: calc(var(--lp-top) + 24px) 8% 30vh;
    background: linear-gradient(165deg, #fffdf6 0%, #fff6dc 55%, #fdf0c8 100%);
}
/* Фигуры на своём GPU-слое: иначе браузер перерисовывает SVG каждый кадр и движение дёргается */
.lp__shape {
    position: absolute;
    pointer-events: none;
    z-index: 0;
    /* Отрицательная задержка от часов: после перехода фигура продолжает с той же точки */
    animation-delay: calc(-1 * var(--lp-now, 0s)) !important;
    will-change: transform;
    backface-visibility: hidden;
    transform: translate3d(0, 0, 0);
}
.lp__blob {
    /* Пятно в самом углу, ниже текста и чипов — их не перекрывает */
    left: -22%;
    bottom: -40%;
    width: 80%;
    max-width: 760px;
    color: var(--lp-yellow);
    opacity: 0.85;
    animation: lp-float 24s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
.lp__circle {
    border-radius: 50%;
    background: radial-gradient(circle at 32% 30%, #a9cdee, var(--lp-blue));
}
.lp__circle--big {
    right: -8%;
    top: 14%;
    width: 30%;
    max-width: 280px;
    aspect-ratio: 1;
    opacity: 0.8;
    animation: lp-float 28s cubic-bezier(0.45, 0, 0.55, 1) infinite reverse;
}
.lp__circle--small {
    right: 26%;
    bottom: 16%;
    width: 9%;
    max-width: 84px;
    aspect-ratio: 1;
    opacity: 0.7;
    animation: lp-float 20s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
.lp__circle--top {
    left: 7%;
    top: 8%;
    width: 8%;
    max-width: 76px;
    aspect-ratio: 1;
    opacity: 0.65;
    animation: lp-float 22s cubic-bezier(0.45, 0, 0.55, 1) infinite -7s;
}
.lp__ring {
    left: 66%;
    top: 9%;
    width: 10%;
    max-width: 100px;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 10px solid rgba(242, 194, 48, 0.55);
    animation: lp-float 26s cubic-bezier(0.45, 0, 0.55, 1) infinite reverse;
}
.lp__features { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.lp__features li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px 9px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    font-size: 14px;
    font-weight: 500;
    color: var(--lp-text);
    animation: lp-up 500ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.lp__features li:nth-child(1) { animation-delay: 180ms; }
.lp__features li:nth-child(2) { animation-delay: 240ms; }
.lp__features li:nth-child(3) { animation-delay: 300ms; }
.lp__features svg { width: 18px; height: 18px; color: var(--lp-primary); flex: 0 0 18px; }
@keyframes lp-float {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(0, -6px, 0); }
}

.lp__aside-inner { position: relative; z-index: 1; max-width: 520px; }
.lp__hello {
    margin: 0 0 14px;
    font-family: var(--lp-font-display);
    font-size: clamp(30px, 3vw, 42px);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.02em;
    color: var(--lp-text);
    animation: lp-up 600ms cubic-bezier(0.22, 1, 0.36, 1) 60ms both;
}
.lp__lead {
    margin: 0 0 32px;
    max-width: 440px;
    font-size: 17px;
    line-height: 1.55;
    color: #475569;
    animation: lp-up 600ms cubic-bezier(0.22, 1, 0.36, 1) 120ms both;
}
@keyframes lp-up {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}


/* ---------- Правая часть: форма ---------- */
.lp__main {
    position: relative;
    z-index: 2;
    display: flex;
    /* Верх формы на одной высоте на всех страницах входа: при переходе меняется только содержимое */
    align-items: flex-start;
    justify-content: center;
    padding: max(calc(var(--lp-top) + 16px), 24vh) 8% 56px;
}
.lp__form { width: 100%; max-width: 400px; }
/* Логотип слева от заголовка формы — псевдоэлемент, чтобы стоять перед h1 на любой странице */
.lp__title::before {
    content: '';
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    background: var(--lp-logo) center / contain no-repeat;
}
.lp__title {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 6px;
    font-family: var(--lp-font-display);
    font-size: 27px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--lp-text);
    animation: lp-up 500ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.lp__subtitle {
    margin: 0 0 32px;
    font-size: 15px;
    color: var(--lp-muted);
    animation: lp-up 500ms cubic-bezier(0.22, 1, 0.36, 1) 60ms both;
}

.lp__field { margin-bottom: 22px; animation: lp-up 500ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.lp__field:nth-of-type(1) { animation-delay: 120ms; }
.lp__field:nth-of-type(2) { animation-delay: 180ms; }
.lp__label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 500; color: var(--lp-muted); }
.lp__control { position: relative; display: flex; align-items: center; }
.lp__icon { position: absolute; left: 16px; width: 18px; height: 18px; color: #94a3b8; pointer-events: none; }
.lp__input {
    width: 100%;
    height: 52px;
    padding: 0 16px 0 46px;
    font: inherit;
    font-size: 16px;
    color: var(--lp-text);
    background: #f8f9fb;
    border: 1.5px solid transparent;
    border-radius: 14px;
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
.lp__input::placeholder { color: var(--lp-placeholder); }
.lp__input:hover { background: #f3f5f8; }
.lp__input:focus { outline: none; background: #fff; border-color: var(--lp-primary); box-shadow: 0 0 0 4px var(--lp-ring); }
.lp__input[aria-invalid="true"] { border-color: var(--lp-danger); background: #fff; }
.lp__input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px rgba(185, 28, 28, 0.18); }
.lp__input--password { padding-right: 54px; }

.lp__eye {
    position: absolute;
    right: 5px;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: color 160ms ease, background-color 160ms ease;
}
.lp__eye:hover { color: var(--lp-text); background: #e9edf3; }
.lp__eye:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--lp-ring); }
.lp__eye svg { width: 20px; height: 20px; }
.lp__eye .lp__eye-off { display: none; }
.lp__eye[aria-pressed="true"] .lp__eye-on { display: none; }
.lp__eye[aria-pressed="true"] .lp__eye-off { display: block; }

/* Код доступа: 8 ячеек */
.lp__code { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.lp__digit {
    width: 100%;
    height: 54px;
    padding: 0;
    text-align: center;
    font-family: var(--lp-font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--lp-text);
    background: #f8f9fb;
    border: 1.5px solid transparent;
    border-radius: 12px;
    caret-color: var(--lp-primary);
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
.lp__digit:focus { outline: none; background: #fff; border-color: var(--lp-primary); box-shadow: 0 0 0 4px var(--lp-ring); }
.lp__digit.filled { background: #eef4ff; border-color: #c7d7f7; }
.lp__digit.error { border-color: var(--lp-danger); background: #fff; animation: lp-shake 300ms ease; }
@keyframes lp-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}
.lp__hint { margin: 10px 0 0; font-size: 13px; line-height: 1.45; color: var(--lp-muted); }

.lp__error { display: none; margin: 8px 0 0; font-size: 13px; line-height: 1.4; color: var(--lp-danger); }
.lp__error.is-visible { display: block; }

.lp__alert {
    display: none;
    margin: 0 0 20px;
    padding: 12px 14px;
    border-radius: var(--lp-radius);
    background: var(--lp-danger-bg);
    border: 1px solid var(--lp-danger-border);
    color: var(--lp-danger);
    font-size: 14px;
    line-height: 1.45;
}
.lp__alert.is-visible { display: flex; gap: 10px; align-items: flex-start; }
.lp__alert svg { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 1px; }
.lp__alert:focus { outline: none; box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.18); }

.lp__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: -6px 0 22px;
    min-height: 24px;
    animation: lp-up 500ms cubic-bezier(0.22, 1, 0.36, 1) 240ms both;
}
.lp__check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-size: 14px; color: var(--lp-muted); user-select: none; }
.lp__check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.lp__check-box {
    width: 20px;
    height: 20px;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.lp__check-box svg { width: 12px; height: 12px; color: #fff; opacity: 0; transition: opacity 120ms ease; }
.lp__check input:checked + .lp__check-box { background: var(--lp-primary); border-color: var(--lp-primary); }
.lp__check input:checked + .lp__check-box svg { opacity: 1; }
.lp__check input:focus-visible + .lp__check-box { box-shadow: 0 0 0 3px var(--lp-ring); }
.lp__check:hover .lp__check-box { border-color: #94a3b8; }

.lp__submit-wrap { animation: lp-up 500ms cubic-bezier(0.22, 1, 0.36, 1) 300ms both; }
.lp__submit {
    display: inline-flex;
    width: 100%;
    min-height: 54px;
    padding: 0 32px;
    border: 0;
    border-radius: 999px;
    background: var(--lp-accent);
    color: var(--lp-text);
    font-family: var(--lp-font-display);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 6px 18px rgba(242, 194, 48, 0.28);
    transition: background-color 160ms ease, transform 120ms ease, box-shadow 160ms ease;
}
.lp__submit:hover { background: var(--lp-accent-dark); box-shadow: 0 8px 22px rgba(242, 194, 48, 0.36); transform: translateY(-1px); }
.lp__submit:active { transform: translateY(0); box-shadow: 0 3px 10px rgba(242, 194, 48, 0.28); }
.lp__submit:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--lp-ring); }
.lp__submit[disabled] { cursor: progress; opacity: 0.85; transform: none; }
.lp__spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(30, 41, 59, 0.25);
    border-top-color: var(--lp-text);
    border-radius: 50%;
    animation: lp-spin 700ms linear infinite;
}
.lp__submit.is-loading .lp__spinner { display: inline-block; }
@keyframes lp-spin { to { transform: rotate(360deg); } }

.lp__foot {
    margin-top: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2px 8px;
    animation: lp-up 500ms cubic-bezier(0.22, 1, 0.36, 1) 360ms both;
}
.lp__link {
    display: inline-block;
    padding: 8px 4px;
    font-size: 14px;
    font-weight: 500;
    color: var(--lp-link);
    text-decoration: none;
    border-radius: 6px;
    transition: color 140ms ease;
}
.lp__link:hover { color: var(--lp-primary-dark); text-decoration: underline; }
.lp__link:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--lp-ring); }
.lp__mode { appearance: none; border: 0; background: transparent; font: inherit; cursor: pointer; }
.lp__dot { color: #cbd5e1; }

[hidden] { display: none !important; }

/* ---------- Адаптив ---------- */
@media (max-width: 991px) {
    .lp { grid-template-columns: 1fr; }
    .lp__aside { display: none; }
    .lp__main {
        padding: calc(var(--lp-top) + 8px) 24px 40px;
        background:
            radial-gradient(520px 320px at 110% -10%, rgba(242, 194, 48, 0.22), transparent 70%),
            radial-gradient(420px 300px at -10% 110%, rgba(91, 155, 213, 0.18), transparent 70%),
            #fff;
    }
    .lp__title { font-size: 26px; }
}
@media (max-width: 575px) {
    .lp__main { padding: calc(var(--lp-top) + 4px) 20px 32px; }
    .lp__topbar { padding: 0 16px; }
    
    .lp__code { gap: 4px; }
    .lp__digit { height: 48px; font-size: 19px; border-radius: 10px; }
    .lp__foot { flex-direction: column; }
    .lp__dot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .lp *, .lp *::before, .lp *::after { animation: none !important; transition-duration: 0.01ms !important; }
    .lp__spinner { animation: lp-spin 700ms linear infinite !important; }
}

/* ---------- Общие элементы шагов (восстановление, секретное слово) ---------- */
.lp__text { margin: 0 0 20px; font-size: 14px; line-height: 1.55; color: var(--lp-muted); }
.lp__info {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 0 0 20px;
    padding: 12px 14px;
    border-radius: var(--lp-radius);
    background: #eff6ff;
    border: 1px solid #c7d7f7;
    color: #1e3a8a;
    font-size: 14px;
    line-height: 1.45;
}
.lp__info svg { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 1px; }
.lp__input--code {
    padding-left: 16px;
    text-align: center;
    font-family: var(--lp-font-display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.35em;
    text-transform: uppercase;
}
.lp__input--code::placeholder { letter-spacing: 0.35em; font-weight: 500; color: #cbd5e1; }
.lp__sent { text-align: center; margin: 0 0 16px; }
.lp__sent-label { margin: 0; font-size: 14px; color: var(--lp-muted); }
.lp__sent-contact { margin: 4px 0 0; font-family: var(--lp-font-display); font-weight: 700; font-size: 16px; color: var(--lp-text); }
.lp__sent-channel { margin: 2px 0 0; font-size: 13px; color: var(--lp-muted); }
.lp__timer { text-align: center; margin: 0 0 18px; font-size: 14px; color: var(--lp-muted); }
.lp__timer-count { font-family: var(--lp-font-display); font-weight: 700; color: var(--lp-primary); font-variant-numeric: tabular-nums; }
.lp__btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 22px;
    border-radius: 999px;
    border: 1.5px solid #c7d7f7;
    background: #fff;
    color: var(--lp-link);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease;
}
.lp__btn-ghost:hover { background: #eff6ff; border-color: var(--lp-primary); }
.lp__btn-ghost:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--lp-ring); }
.lp__lock {
    text-align: center;
    padding: 12px 0 8px;
}
.lp__lock svg { width: 44px; height: 44px; color: var(--lp-danger); margin-bottom: 10px; }
.lp__lock p { margin: 0 0 4px; font-size: 14px; color: var(--lp-muted); }
.lp__lock-count {
    margin-top: 6px;
    font-family: var(--lp-font-display);
    font-size: 30px;
    font-weight: 700;
    color: var(--lp-primary);
    font-variant-numeric: tabular-nums;
}
.lp__success { text-align: center; padding: 8px 0 0; }
.lp__success-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ecfdf5;
    color: #059669;
    animation: lp-pop 500ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.lp__success-icon svg { width: 36px; height: 36px; }
.lp__success h2 { margin: 0 0 8px; font-family: var(--lp-font-display); font-size: 24px; font-weight: 700; color: var(--lp-text); }
.lp__success p { margin: 0 0 22px; font-size: 15px; line-height: 1.5; color: var(--lp-muted); }
@keyframes lp-pop {
    from { opacity: 0; transform: scale(0.6); }
    to { opacity: 1; transform: scale(1); }
}
.lp__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--lp-muted);
    text-decoration: none;
    animation: lp-up 400ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.lp__back svg { width: 16px; height: 16px; }
.lp__back:hover { color: var(--lp-primary-dark); }
.lp__step { animation: lp-up 420ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.lp__step[hidden] { display: none !important; }
/* Виджет подтверждения телефона рендерится в контейнер шага — аккуратные отступы */
.lp__widget { margin: 0 0 8px; }
.lp__widget button { font: inherit; }

.lp__segment {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    margin: 0 0 20px;
    background: #f1f5f9;
    border-radius: var(--lp-radius);
}
.lp__segment-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    margin: 0;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 500;
    color: var(--lp-muted);
    cursor: pointer;
    transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.lp__segment-item input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.lp__segment-item.is-active { background: #fff; color: var(--lp-primary); font-weight: 600; box-shadow: 0 1px 2px rgba(30, 41, 59, 0.08); }
.lp__segment-item:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--lp-ring); }

/* ---------- Переходы между страницами входа ---------- */
@view-transition { navigation: auto; }
.lp__aside { view-transition-name: lp-aside; }
.lp__topbar { view-transition-name: lp-topbar; }
.lp__form { view-transition-name: lp-form; }
::view-transition-old(root), ::view-transition-new(root),
::view-transition-old(lp-aside), ::view-transition-new(lp-aside),
::view-transition-old(lp-topbar), ::view-transition-new(lp-topbar) { animation: none; }
::view-transition-old(lp-form) { animation: lp-vt-out 220ms cubic-bezier(0.4, 0, 1, 1) both; }
::view-transition-new(lp-form) { animation: lp-vt-in 420ms cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes lp-vt-out {
    to { opacity: 0; transform: translateY(-8px); }
}
@keyframes lp-vt-in {
    from { opacity: 0; transform: translateY(10px); }
}
/* Fallback без View Transitions: форма гаснет перед уходом */
.lp__form { transition: opacity 180ms ease, transform 180ms ease; }
.lp__form.is-leaving { opacity: 0; transform: translateY(-8px); }
/* Пришли с соседней страницы входа: панель и верхняя полоса уже на месте, без повторного появления */
.lp-warm .lp__aside-inner > *, .lp-warm .lp__aside-inner li, .lp-warm .lp__lang { animation: none !important; }
/* Неактивная кнопка (код ещё не введён) — приглушённая, без свечения */
.lp__submit[disabled]:not(.is-loading) { background: #f6e7b3; color: #7c7f8a; box-shadow: none; opacity: 1; cursor: not-allowed; }
