/*
 * Личный кабинет (лк.<домен>).
 *
 * Тот же визуальный язык, что у сайта: Inter, зелёная кнопка с объёмом
 * (#307943), оранжевый акцент (#EA8F13), поля как в модалках —
 * серая заливка #F5F5F5 и рамка #CDCDCD, белые карточки со скруглением 20.
 */

:root {
    --lk-green: #307943;
    --lk-green-hover: #285E36;
    --lk-green-soft: #48924E;
    --lk-green-tint: #E7F1E8;
    --lk-orange: #EA8F13;
    --lk-text: #282828;
    --lk-muted: #767676;
    --lk-line: #CDCDCD;
    --lk-field: #F5F5F5;
    --lk-bg: #F5F5F5;
    --lk-card: #FFFFFF;
    --lk-danger: #C62828;
    --lk-danger-hover: #A61F1F;

    --lk-radius-card: 20px;
    --lk-radius-field: 6px;

    /* Пружина без перескока: так ведут себя смена шагов и возврат фото к краю. */
    --lk-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
}

body.lk {
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    background: var(--lk-bg);
    color: var(--lk-text);
    font: 400 16px/1.5 'Inter', system-ui, -apple-system, sans-serif;
}

[hidden] {
    display: none !important;
}

a {
    color: inherit;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

/* ===== Шапка ===== */

.lk-header {
    background: var(--lk-card);
    border-bottom: 1px solid #EBEBEB;
}

.lk-header__inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.lk-header__logo img {
    display: block;
    height: 44px;
    width: auto;
}

.lk-header__label {
    padding-left: 16px;
    border-left: 1px solid var(--lk-line);
    color: var(--lk-muted);
    font-size: 15px;
    font-weight: 500;
}

.lk-header__site {
    margin-left: auto;
    color: var(--lk-green);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}

.lk-header__site:hover {
    color: var(--lk-green-hover);
    text-decoration: underline;
}

/* ===== Содержимое ===== */

.lk-main {
    flex: 1;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 20px 56px;
}

.lk-card {
    background: var(--lk-card);
    border-radius: var(--lk-radius-card);
}

.lk-title {
    color: var(--lk-text);
    font-size: 30px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
    text-transform: uppercase;
}

.lk-text {
    margin-top: 10px;
    color: var(--lk-muted);
    font-size: 16px;
}

.lk-nowrap {
    color: var(--lk-text);
    font-weight: 500;
    white-space: nowrap;
}

/* ===== Поля и кнопки — как в модалке обратного звонка ===== */

.lk-form {
    margin-top: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.lk-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lk-label {
    color: #6B6B6B;
    font-size: 14px;
    line-height: 18px;
}

.lk-input {
    width: 100%;
    height: 50px;
    padding: 0 20px;
    border: 1px solid var(--lk-line);
    border-radius: var(--lk-radius-field);
    background: var(--lk-field);
    color: var(--lk-text);
    font: 400 18px/26px 'Inter', system-ui, sans-serif;
    transition: border-color 0.2s, background-color 0.2s;
}

.lk-input::placeholder {
    color: rgba(39, 39, 39, 0.45);
}

.lk-input:focus {
    outline: none;
    border-color: var(--lk-green-soft);
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(72, 146, 78, 0.18);
}

.lk-input--code {
    height: 64px;
    text-align: center;
    font-size: 30px;
    font-weight: 600;
    letter-spacing: 0.5em;
    /* Межбуквенный отступ добавляется и после последней цифры — сдвигаем обратно. */
    text-indent: 0.5em;
    font-variant-numeric: tabular-nums;
}

.lk-input--invalid,
.lk-input--invalid:focus {
    border-color: var(--lk-danger);
    box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.15);
}

.lk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 56px;
    padding: 0 32px;
    border-radius: var(--lk-radius-field);
    color: #FFFFFF;
    font-size: 18px;
    font-weight: 600;
    line-height: 20px;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.1s ease-out, opacity 0.2s;
}

/* Отклик сразу на нажатие, а не на отпускание. */
.lk-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.lk-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.lk-btn--green {
    background: var(--lk-green);
    box-shadow: 0 -4px 11px 0 rgba(0, 0, 0, 0.2) inset, 0 6px 8px 0 rgba(255, 255, 255, 0.45) inset;
}

.lk-btn--green:hover:not(:disabled) {
    background: var(--lk-green-hover);
}

.lk-btn--danger {
    background: var(--lk-danger);
    box-shadow: 0 -4px 11px 0 rgba(0, 0, 0, 0.2) inset, 0 6px 8px 0 rgba(255, 255, 255, 0.3) inset;
}

.lk-btn--danger:hover:not(:disabled) {
    background: var(--lk-danger-hover);
}

.lk-btn--ghost {
    background: var(--lk-field);
    color: var(--lk-text);
    border: 1px solid var(--lk-line);
}

.lk-btn--ghost:hover:not(:disabled) {
    background: #EBEBEB;
}

.lk-btn--small {
    height: 44px;
    padding: 0 22px;
    font-size: 16px;
}

.lk-btn.is-busy {
    color: transparent;
    position: relative;
    pointer-events: none;
}

.lk-btn.is-busy::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border: 2.5px solid rgba(255, 255, 255, 0.45);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: lk-spin 0.8s linear infinite;
}

.lk-link {
    align-self: center;
    color: var(--lk-green);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
}

.lk-link:hover {
    color: var(--lk-green-hover);
    text-decoration: underline;
}

.lk-link:disabled {
    color: var(--lk-muted);
    text-decoration: none;
    cursor: default;
}

.lk-error {
    color: var(--lk-danger);
    font-size: 14px;
    line-height: 1.4;
}

.lk-status {
    color: var(--lk-muted);
    font-size: 14px;
}

.lk-consent {
    color: #2F2F2F;
    font-size: 12px;
    line-height: 16px;
    text-align: center;
    opacity: 0.55;
}

.lk-consent a {
    text-decoration: underline;
}

/* ===== Вход ===== */

.lk-auth {
    display: flex;
    justify-content: center;
}

.lk-auth__card {
    width: 100%;
    max-width: 480px;
    padding: 44px 44px 40px;
}

.lk-step {
    display: flex;
    flex-direction: column;
}

/* Новый шаг наплывает справа и чуть снизу, возврат — обратно влево. */
.lk-step.is-entering {
    animation: lk-step-in 0.35s var(--lk-ease-out) both;
}

.lk-step.is-entering-back {
    animation: lk-step-in-back 0.35s var(--lk-ease-out) both;
}

.lk-back {
    align-self: flex-start;
    margin: -8px 0 16px -6px;
    padding: 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--lk-green);
    font-size: 15px;
    font-weight: 600;
}

.lk-back::before {
    content: '';
    width: 8px;
    height: 8px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
}

.lk-back:hover {
    color: var(--lk-green-hover);
}

.lk-resend {
    color: var(--lk-muted);
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

/* ===== Кабинет ===== */

.lk-cabinet {
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.lk-profile {
    padding: 36px 28px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.lk-avatar {
    position: relative;
    width: 112px;
    height: 112px;
    border-radius: 50%;
    transition: transform 0.1s ease-out;
}

.lk-avatar:active {
    transform: scale(0.97);
}

.lk-avatar:focus-visible {
    outline: 3px solid rgba(72, 146, 78, 0.45);
    outline-offset: 4px;
}

.lk-avatar__face {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    overflow: hidden;
    background: var(--lk-green-tint);
    color: var(--lk-green-soft);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lk-avatar__face.is-popping {
    animation: lk-pop 0.5s var(--lk-ease-out);
}

.lk-avatar__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lk-avatar__initials {
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
}

.lk-avatar__busy {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lk-avatar__busy::after {
    content: '';
    width: 26px;
    height: 26px;
    border: 3px solid rgba(255, 255, 255, 0.45);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: lk-spin 0.8s linear infinite;
}

.lk-avatar__badge {
    position: absolute;
    right: 0;
    bottom: 2px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid var(--lk-card);
    background: var(--lk-green);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lk-profile__who {
    margin-top: 18px;
}

.lk-profile__name {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}

.lk-profile__phone {
    margin-top: 4px;
    color: var(--lk-muted);
    font-size: 16px;
}

.lk-profile__error {
    margin-top: 12px;
}

.lk-profile__photo-actions {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.lk-chip {
    height: 38px;
    padding: 0 18px;
    border-radius: 19px;
    background: var(--lk-field);
    border: 1px solid #E2E2E2;
    color: var(--lk-text);
    font-size: 15px;
    font-weight: 500;
    transition: background-color 0.2s, transform 0.1s ease-out;
}

.lk-chip:hover {
    background: #EBEBEB;
}

.lk-chip:active {
    transform: scale(0.97);
}

.lk-chip--danger {
    color: var(--lk-danger);
}

.lk-section {
    padding: 24px 28px 18px;
}

.lk-section__title {
    margin-bottom: 6px;
    color: var(--lk-text);
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
}

.lk-section__note {
    margin-top: 10px;
    color: var(--lk-muted);
    font-size: 14px;
}

.lk-row {
    min-height: 60px;
    padding: 12px 0;
    display: flex;
    align-items: center;
    gap: 16px;
    border-top: 1px solid #EFEFEF;
}

.lk-section__title + .lk-row,
.lk-section__title + .lk-row--edit {
    border-top: none;
}

.lk-row__main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.lk-row__label {
    color: var(--lk-muted);
    font-size: 14px;
}

.lk-row__value {
    font-size: 17px;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.lk-row--edit {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.lk-row__buttons {
    display: flex;
    gap: 10px;
}

.lk-row__action {
    padding: 4px 0;
    color: var(--lk-text);
    font-size: 17px;
    font-weight: 500;
}

.lk-row__action:hover {
    color: var(--lk-green);
}

.lk-row__action--danger,
.lk-row__action--danger:hover {
    color: var(--lk-danger);
}

/* ===== Модалки ===== */

.lk-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.lk-modal__scrim {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    animation: lk-fade-in 0.25s ease-out both;
}

.lk-modal__sheet {
    position: relative;
    width: 100%;
    background: var(--lk-card);
    border-radius: var(--lk-radius-card);
    animation: lk-sheet-in 0.35s var(--lk-ease-out) both;
}

.lk-modal.is-closing .lk-modal__scrim {
    animation: lk-fade-out 0.2s ease-in both;
}

.lk-modal.is-closing .lk-modal__sheet {
    animation: lk-sheet-out 0.2s ease-in both;
}

body.lk-modal-open {
    overflow: hidden;
}

.lk-confirm {
    max-width: 440px;
    padding: 32px 28px 28px;
}

.lk-confirm__title {
    font-size: 22px;
    font-weight: 700;
}

.lk-confirm__text {
    margin-top: 10px;
    color: var(--lk-muted);
}

.lk-confirm .lk-error {
    margin-top: 12px;
}

.lk-confirm__buttons {
    margin-top: 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.lk-confirm__buttons .lk-btn {
    height: 48px;
    padding: 0 24px;
    font-size: 16px;
}

/* ===== Кадрирование фото ===== */

.lk-crop {
    max-width: 440px;
    overflow: hidden;
    background: #111111;
    color: #FFFFFF;
}

.lk-crop__bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 14px 16px;
}

.lk-crop__title {
    font-size: 17px;
    font-weight: 600;
}

.lk-crop__bar-btn {
    justify-self: start;
    padding: 8px 6px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 16px;
}

.lk-crop__bar-btn--primary {
    justify-self: end;
    color: #FFFFFF;
    font-weight: 600;
}

.lk-crop__bar-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.lk-crop__stage {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    touch-action: none;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.lk-crop__stage.is-dragging {
    cursor: grabbing;
}

.lk-crop__img {
    position: absolute;
    left: 50%;
    top: 50%;
    max-width: none;
    transform-origin: center;
    will-change: transform;
    pointer-events: none;
}

/* Затемнение с круглым окном: круг на 16px меньше сцены с каждой стороны. */
.lk-crop__mask {
    position: absolute;
    inset: 0;
    pointer-events: none;
    /* closest-side: 100% — ровно до края сцены, а не до угла. */
    background: radial-gradient(circle closest-side at center,
        transparent calc(100% - 16px),
        rgba(255, 255, 255, 0.75) calc(100% - 16px),
        rgba(255, 255, 255, 0.75) calc(100% - 15px),
        rgba(0, 0, 0, 0.6) calc(100% - 15px));
}

.lk-crop__zoom {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 24px 4px;
    color: rgba(255, 255, 255, 0.7);
}

.lk-crop__zoom input {
    flex: 1;
    accent-color: var(--lk-green-soft);
}

.lk-crop__hint {
    padding: 4px 24px 20px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
    text-align: center;
}

/* ===== Подвал — зелёный, как у сайта ===== */

.lk-footer {
    background: var(--lk-green-soft);
    color: #FFFFFF;
}

.lk-footer__inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 28px 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 32px;
}

.lk-footer__offices {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 40px;
}

.lk-footer__office {
    display: flex;
    flex-direction: column;
    text-decoration: none;
}

.lk-footer__city {
    font-size: 13px;
    opacity: 0.8;
}

.lk-footer__phone {
    font-size: 18px;
    font-weight: 600;
}

.lk-footer__office:hover .lk-footer__phone {
    text-decoration: underline;
}

.lk-footer__copy {
    font-size: 13px;
    opacity: 0.8;
}

/* ===== Движение ===== */

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

@keyframes lk-step-in {
    from { opacity: 0; transform: translateX(24px); }
    to { opacity: 1; transform: none; }
}

@keyframes lk-step-in-back {
    from { opacity: 0; transform: translateX(-24px); }
    to { opacity: 1; transform: none; }
}

@keyframes lk-pop {
    0% { transform: scale(0.7); opacity: 0.4; }
    60% { transform: scale(1.04); opacity: 1; }
    100% { transform: scale(1); }
}

@keyframes lk-fade-in {
    from { opacity: 0; }
}

@keyframes lk-fade-out {
    to { opacity: 0; }
}

/* Лист растёт из середины экрана и уходит туда же — один путь туда и обратно. */
@keyframes lk-sheet-in {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
}

@keyframes lk-sheet-out {
    to { opacity: 0; transform: translateY(16px) scale(0.97); }
}

/* Без вестибулярных движений: только смена прозрачности. */
@media (prefers-reduced-motion: reduce) {
    .lk-step.is-entering,
    .lk-step.is-entering-back,
    .lk-modal__sheet,
    .lk-modal.is-closing .lk-modal__sheet {
        animation-name: lk-fade-in;
        animation-duration: 0.2s;
    }

    .lk-modal.is-closing .lk-modal__sheet {
        animation-name: lk-fade-out;
    }

    .lk-avatar__face.is-popping {
        animation: lk-fade-in 0.2s ease-out;
    }

    .lk-btn:active:not(:disabled),
    .lk-chip:active,
    .lk-avatar:active {
        transform: none;
    }
}

/* ===== Телефон ===== */

@media (max-width: 600px) {
    .lk-header__inner {
        padding: 10px 16px;
        gap: 12px;
    }

    .lk-header__logo img {
        height: 36px;
    }

    .lk-header__label {
        display: none;
    }

    .lk-main {
        padding: 20px 16px 40px;
    }

    .lk-auth__card {
        padding: 30px 20px 28px;
    }

    .lk-title {
        font-size: 24px;
    }

    .lk-profile {
        padding: 28px 20px 24px;
    }

    .lk-section {
        padding: 20px 20px 14px;
    }

    .lk-modal {
        padding: 12px;
        align-items: flex-end;
    }

    .lk-confirm__buttons {
        flex-direction: column-reverse;
    }

    .lk-confirm__buttons .lk-btn {
        width: 100%;
    }

    .lk-footer__inner {
        padding: 22px 16px 26px;
    }
}
