/* ─────────────────────────────────────────────
   Личный кабинет и страницы входа/регистрации.
   Вёрстка по макету дизайнера (Figma, фреймы 3321:1254 и соседние).
   Палитра и шрифты — общие с сайтом, см. global.css.
   ───────────────────────────────────────────── */

/* Токены --lk-* объявлены в global.css: ими пользуются ещё страницы
   входа/регистрации (.lk-auth) и каталог подбора (catalog.css). */

/* На сайте глобального border-box нет, поэтому включаем его точечно:
   без него колонки с padding вылезают за края белой панели */
.lk *,
.lk *::before,
.lk *::after,
.lk-auth *,
.lk-auth *::before,
.lk-auth *::after {
    box-sizing: border-box;
}

.lk {
    background: #F5F5F5;
    padding-bottom: 60px;
}

/* Белое полотно кабинета шириной 1280 — та же сетка, что и .head-blocks */
.lk-panel {
    width: 1280px;
    margin: 0 auto;
    background: #FFFFFF;
    display: flex;
    align-items: stretch;
    min-height: 488px;
}

/* ── Боковое меню вкладок ── */

.lk-side {
    width: 225px;
    flex: 0 0 225px;
    border-right: 1px solid #DFDFDF;
    padding: 24px 0;
}

.lk-side a {
    display: block;
    height: 39px;
    line-height: 39px;
    padding-left: 21px;
    border-left: 3px solid transparent;
    font-family: Inter, sans-serif;
    font-size: 14px;
    color: #7A7A7A;
    white-space: nowrap;
}

.lk-side a:hover {
    color: var(--lk-dark);
}

.lk-side a.active {
    background: #FFFBEA;
    border-left-color: var(--lk-yellow);
    color: var(--lk-dark);
}

/* Выход: оформлен как пункт меню, но отбит от вкладок чертой */
.lk-side-logout {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--lk-border);
}

.lk-side-logout button {
    display: block;
    width: 100%;
    height: 39px;
    padding-left: 21px;
    border: none;
    border-left: 3px solid transparent;
    background: none;
    font-family: Inter, sans-serif;
    font-size: 14px;
    color: var(--lk-muted);
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.lk-side-logout button:hover {
    color: var(--lk-dark);
}

/* ── Центральная колонка ── */

.lk-main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 32px 35px 40px 40px;
}

.lk-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
}

.lk-head h1 {
    font-family: Tektur, sans-serif;
    font-size: 20px;
    line-height: normal;
    color: var(--lk-dark);
    text-transform: uppercase;
    margin: 0;
}

.lk-head .lk-total {
    font-family: Inter, sans-serif;
    font-size: 13px;
    color: var(--lk-muted);
}

/* кнопка, прижатая к правому краю заголовка («+ Добавить технику», «Редактировать») */
.lk-head .lk-head-action {
    margin-left: auto;
}

/* ── Фильтры ── */

.lk-filters {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 27px;
    flex-wrap: wrap;
}

.lk-chip {
    height: 35px;
    line-height: 33px;
    padding: 0 15px;
    border: 1px solid var(--lk-border-strong);
    border-radius: 20px;
    font-family: Inter, sans-serif;
    font-size: 13px;
    color: #6B6B6B;
    background: transparent;
}

.lk-chip:hover {
    border-color: #C8C8C8;
}

.lk-chip.active {
    background: var(--lk-dark);
    border-color: var(--lk-dark);
    color: #FFFFFF;
}

.lk-period {
    margin-left: auto;
    height: 35px;
    padding: 0 34px 0 12px;
    border: 1px solid var(--lk-border-strong);
    border-radius: 6px;
    font-family: Inter, sans-serif;
    font-size: 13px;
    color: #6B6B6B;
    background: #FFFFFF url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='m1 1 4 4 4-4' fill='none' stroke='%236B6B6B' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center / 10px 6px;
    appearance: none;
    -webkit-appearance: none;
}

/* ── Общие элементы списков ── */

.lk-thead {
    display: grid;
    gap: 16px;
    padding: 0 16px;
    margin-bottom: 9px;
    font-family: Inter, sans-serif;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--lk-label);
}

.lk-row {
    display: grid;
    gap: 16px;
    align-items: center;
    padding: 0 16px;
    min-height: 68px;
    border: 1px solid var(--lk-border);
    border-radius: 8px;
    background: #FFFFFF;
    margin-bottom: 10px;
}

.lk-empty {
    padding: 40px 0;
    font-family: Inter, sans-serif;
    font-size: 14px;
    color: #8A8A8A;
}

.lk-empty a {
    color: #8A7A12;
}

/* Сетка колонок вкладки «Мои заказы» */
.lk-orders .lk-thead,
.lk-orders .lk-row {
    grid-template-columns: 120px minmax(0, 1fr) 108px 116px 100px;
}

.lk-num {
    font-family: Tektur, sans-serif;
    font-size: 14px;
    color: var(--lk-dark);
}

.lk-date {
    display: block;
    margin-top: 4px;
    font-family: Inter, sans-serif;
    font-size: 12px;
    color: var(--lk-muted);
}

.lk-items {
    font-family: Inter, sans-serif;
    font-size: 13px;
    line-height: 1.25;
    color: var(--lk-text);
}

.lk-sum {
    font-family: Tektur, sans-serif;
    font-size: 15px;
    color: var(--lk-dark);
    white-space: nowrap;
}

.lk-badge {
    display: inline-block;
    height: 25px;
    line-height: 25px;
    padding: 0 11px;
    border-radius: 20px;
    font-family: Inter, sans-serif;
    font-size: 12px;
    font-weight: 500;
}

.lk-badge.warn  { background: #FFF4C2; color: #8A7A12; }
.lk-badge.ok    { background: #E4F3E6; color: #3F7A4E; }
.lk-badge.muted { background: #F0F0F0; color: #8A8A8A; }

.lk-link-action {
    font-family: Inter, sans-serif;
    font-size: 12px;
    color: #8A7A12;
    background: none;
    padding: 0;
    white-space: nowrap;
}

.lk-link-action:hover {
    text-decoration: underline;
}

/* ── Кнопки ── */

.lk-btn-yellow {
    display: inline-block;
    height: 35px;
    line-height: 35px;
    padding: 0 14px;
    border-radius: 5px;
    background: var(--lk-yellow);
    font-family: Inter, sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--lk-dark);
    text-align: center;
}

.lk-btn-yellow:hover {
    background: #F0C900;
}

.lk-btn-outline {
    display: inline-block;
    height: 33px;
    line-height: 31px;
    padding: 0 16px;
    border: 1px solid var(--lk-dark);
    border-radius: 6px;
    background: transparent;
    font-family: Inter, sans-serif;
    font-size: 12px;
    color: var(--lk-dark);
}

.lk-btn-outline:hover {
    background: var(--lk-dark);
    color: #FFFFFF;
}

.lk-btn-ghost {
    display: inline-block;
    height: 33px;
    line-height: 31px;
    padding: 0 16px;
    border: 1px solid var(--lk-border-strong);
    border-radius: 6px;
    background: #FFFFFF;
    font-family: Inter, sans-serif;
    font-size: 12px;
    color: #6B6B6B;
}

.lk-btn-ghost:hover {
    border-color: #C8C8C8;
    color: var(--lk-dark);
}

.lk-icon-btn {
    width: 24px;
    height: 24px;
    line-height: 22px;
    text-align: center;
    border-radius: 4px;
    background: none;
    font-family: Inter, sans-serif;
    font-size: 14px;
    color: #C4C4C4;
}

.lk-icon-btn:hover {
    background: #F5F5F5;
    color: #8A8A8A;
}

/* ── Избранное ── */

.lk-favorites .lk-row {
    grid-template-columns: 44px minmax(0, 1fr) 108px 120px 24px;
    min-height: 72px;
}

.lk-thumb {
    width: 44px;
    height: 44px;
    border-radius: 4px;
    background: #EDEDED;
    object-fit: cover;
}

.lk-art {
    display: block;
    font-family: Inter, sans-serif;
    font-size: 11px;
    color: var(--lk-muted);
}

.lk-name {
    display: block;
    margin: 3px 0;
    font-family: Inter, sans-serif;
    font-size: 13px;
    color: var(--lk-dark);
}

.lk-stock {
    display: block;
    font-family: Inter, sans-serif;
    font-size: 11px;
}

.lk-stock.in    { color: #3F7A4E; }
.lk-stock.order { color: #B98900; }

/* ── Моя техника ── */

.lk-machine {
    display: flex;
    align-items: stretch;
    min-height: 146px;
    border: 1px solid var(--lk-border);
    border-radius: 9px;
    overflow: hidden;
    background: #FFFFFF;
    margin-bottom: 12px;
}

.lk-machine-photo {
    width: 150px;
    flex: 0 0 150px;
    background: #EDEDED;
    object-fit: cover;
}

.lk-machine-body {
    flex: 1 1 auto;
    min-width: 0;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
}

.lk-machine-title {
    font-family: Tektur, sans-serif;
    font-size: 16px;
    color: var(--lk-dark);
    text-transform: uppercase;
}

.lk-machine-sn {
    margin-left: 10px;
    font-family: Inter, sans-serif;
    font-size: 11px;
    text-transform: none;
    color: var(--lk-muted);
}

.lk-machine-meta {
    display: flex;
    gap: 24px;
    margin-top: 12px;
}

.lk-machine-meta dt {
    font-family: Inter, sans-serif;
    font-size: 11px;
    color: var(--lk-label);
}

.lk-machine-meta dd {
    margin: 3px 0 0;
    font-family: Inter, sans-serif;
    font-size: 13px;
    color: #3A3A3A;
}

.lk-machine-actions {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Данные компании ── */

.lk-section-label {
    font-family: Inter, sans-serif;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--lk-label);
    margin-bottom: 9px;
}

.lk-section-label:not(:first-of-type) {
    margin-top: 28px;
}

.lk-props {
    border: 1px solid var(--lk-border);
    border-radius: 8px;
    overflow: hidden;
}

.lk-props div {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    min-height: 40px;
    padding: 8px 16px;
    border-bottom: 1px solid #F4F4F4;
}

.lk-props div:last-child {
    border-bottom: none;
}

.lk-props dt {
    font-family: Inter, sans-serif;
    font-size: 13px;
    color: #6B6B6B;
}

.lk-props dd {
    margin: 0;
    font-family: Inter, sans-serif;
    font-size: 13px;
    color: var(--lk-dark);
}

.lk-members .lk-row {
    grid-template-columns: 28px minmax(0, 1fr) auto;
    min-height: 48px;
}

.lk-avatar {
    width: 28px;
    height: 28px;
    line-height: 28px;
    border-radius: 14px;
    background: #F0F0F0;
    text-align: center;
    font-family: Inter, sans-serif;
    font-size: 10px;
    color: #8A8A8A;
}

.lk-member-role {
    font-family: Inter, sans-serif;
    font-size: 12px;
    color: #8A8A8A;
}

.lk-invite {
    display: block;
    padding: 14px 16px;
    border: 1px solid var(--lk-border);
    border-radius: 8px;
    font-family: Inter, sans-serif;
    font-size: 12px;
    color: #8A7A12;
}

.lk-invite:hover {
    border-color: var(--lk-yellow);
}

/* ── Документы ── */

.lk-documents .lk-thead,
.lk-documents .lk-row {
    grid-template-columns: 28px minmax(0, 1fr) 100px 100px 80px;
}

.lk-doc-icon {
    width: 28px;
    height: 34px;
    line-height: 34px;
    border: 1px solid #E8E8E8;
    border-radius: 3px;
    text-align: center;
    font-family: Inter, sans-serif;
    font-size: 8px;
    color: #B0B0B0;
}

.lk-doc-sub {
    display: block;
    margin-top: 3px;
    font-family: Inter, sans-serif;
    font-size: 11px;
    color: var(--lk-muted);
}

/* ── Пагинация ── */

.lk-pagination {
    display: flex;
    gap: 8px;
    margin-top: 30px;
}

.lk-pagination a,
.lk-pagination span {
    min-width: 32px;
    height: 32px;
    line-height: 30px;
    padding: 0 6px;
    border: 1px solid var(--lk-border-strong);
    border-radius: 6px;
    text-align: center;
    font-family: Inter, sans-serif;
    font-size: 13px;
    color: #6B6B6B;
}

.lk-pagination .current {
    background: var(--lk-dark);
    border-color: var(--lk-dark);
    color: #FFFFFF;
}

/* ── Правая колонка: персональный менеджер ── */

.lk-aside {
    width: 280px;
    flex: 0 0 280px;
    border-left: 1px solid var(--lk-border);
    padding: 24px;
}

.lk-aside h2 {
    font-family: Tektur, sans-serif;
    font-size: 13px;
    color: var(--lk-dark);
    text-transform: uppercase;
    margin: 0 0 12px;
}

.lk-manager {
    border: 1px solid #ECECEC;
    border-radius: 10px;
    background: #FFFFFF;
    padding: 18px;
    text-align: center;
}

.lk-manager-photo {
    width: 72px;
    height: 72px;
    border-radius: 36px;
    background: #E9E9E9;
    object-fit: cover;
    margin: 0 auto 14px;
    display: block;
}

.lk-manager-name {
    font-family: Tektur, sans-serif;
    font-size: 15px;
    color: var(--lk-dark);
}

.lk-manager-post {
    margin-top: 6px;
    font-family: Inter, sans-serif;
    font-size: 12px;
    color: #8A8A8A;
}

.lk-manager hr {
    border: none;
    border-top: 1px solid var(--lk-border);
    margin: 18px 0;
}

.lk-manager-phone {
    display: block;
    font-family: Inter, sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--lk-dark);
}

.lk-manager-email {
    display: block;
    margin-top: 5px;
    font-family: Inter, sans-serif;
    font-size: 12px;
    color: #8A8A8A;
}

.lk-manager .lk-btn-yellow {
    display: block;
    height: 36px;
    line-height: 36px;
    border-radius: 6px;
    font-size: 13px;
    margin-top: 18px;
}

/* ── Системные сообщения ── */

.lk-messages {
    width: 1280px;
    margin: 0 auto;
    padding: 16px 0 0;
    list-style: none;
}

.lk-messages li {
    padding: 10px 16px;
    margin-bottom: 8px;
    border-radius: 6px;
    background: #E4F3E6;
    font-family: Inter, sans-serif;
    font-size: 13px;
    color: #3F7A4E;
}

.lk-messages li.error {
    background: #FBE9E9;
    color: #A24141;
}

/* ── Формы кабинета ── */

.lk-form {
    max-width: 520px;
}

.lk-form p {
    margin: 0 0 16px;
}

.lk-form label {
    display: block;
    margin-bottom: 6px;
    font-family: Inter, sans-serif;
    font-size: 12px;
    color: #6B6B6B;
}

/* Перечислять типы по одному опасно: phonenumber_field отдаёт input[type=tel],
   и такое поле выпадало из оформления. Поэтому исключаем служебные типы,
   а не перечисляем нужные. */
.lk-form input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]),
.lk-form textarea,
.lk-form select {
    width: 100%;
    box-sizing: border-box;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--lk-border-strong);
    border-radius: 6px;
    background: #FFFFFF;
    font-family: Inter, sans-serif;
    font-size: 13px;
    color: var(--lk-dark);
}

.lk-form textarea {
    height: auto;
    padding: 10px 12px;
    resize: vertical;
}

.lk-form input:focus,
.lk-form textarea:focus,
.lk-form select:focus {
    border-color: var(--lk-yellow);
}

.lk-form .helptext {
    display: block;
    margin-top: 4px;
    font-family: Inter, sans-serif;
    font-size: 11px;
    color: var(--lk-muted);
}

/* У пустой подсказки не должно оставаться отступа */
.lk-form .helptext:empty {
    display: none;
}

/* Требования к паролю Django отдаёт отдельным <ul> без класса, рядом с полем,
   а не внутри .helptext — без этого правила список рисуется дефолтом браузера
   (16px, чёрный, отступ 40px) и кричит громче самих полей. */
.lk-form ul:not(.errorlist) {
    margin: 4px 0 0;
    padding-left: 15px;
    font-family: Inter, sans-serif;
    font-size: 11px;
    line-height: 16px;
    color: var(--lk-muted);
}

.lk-form ul:not(.errorlist) li {
    margin: 0;
}

.lk-form ul.errorlist {
    margin: 0 0 6px;
    padding-left: 16px;
    font-family: Inter, sans-serif;
    font-size: 12px;
    color: #A24141;
}

.lk-form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
}

/* ── Вход и регистрация ── */

.lk-auth {
    background: #F5F5F5;
    padding: 70px 0 90px;
}

.lk-auth-card {
    width: 420px;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 36px 40px 40px;
    background: #FFFFFF;
    border: 1px solid #ECECEC;
    border-radius: 10px;
}

.lk-auth-card h1 {
    font-family: Tektur, sans-serif;
    font-size: 22px;
    line-height: normal;
    color: var(--lk-dark);
    text-transform: uppercase;
    margin: 0;
}

.lk-auth-sub {
    margin: 10px 0 28px;
    font-family: Inter, sans-serif;
    font-size: 13px;
    color: #8A8A8A;
}

.lk-auth-card .lk-form {
    max-width: none;
}

.lk-auth-card .lk-btn-yellow {
    display: block;
    width: 100%;
    height: 44px;
    line-height: 44px;
    border-radius: 6px;
    font-size: 14px;
    margin-top: 24px;
}

.lk-auth-alt {
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid var(--lk-border);
    text-align: center;
    font-family: Inter, sans-serif;
    font-size: 13px;
    color: #8A8A8A;
}

.lk-auth-alt a {
    display: inline-block;
    margin-top: 4px;
    font-size: inherit;
    line-height: inherit;
    color: #8A7A12;
}

.lk-auth-alt > span {
    display: block;
}

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

/* ─────────────────────────────────────────────
   Адаптив. Брейкпоинты те же, что у сайта (см. global.css):
   1280 → планшет, 728 → телефон.
   ───────────────────────────────────────────── */

@media screen and (max-width: 1280px) {
    .lk-panel,
    .lk-messages {
        width: 728px;
    }

    .lk-panel {
        flex-wrap: wrap;
    }

    /* вкладки превращаются в горизонтальную ленту над контентом */
    .lk-side {
        width: 100%;
        flex: 0 0 100%;
        display: flex;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid #DFDFDF;
        padding: 0;
    }

    .lk-side a {
        padding: 0 16px;
        border-left: none;
        border-bottom: 3px solid transparent;
    }

    .lk-side a.active {
        border-left-color: transparent;
        border-bottom-color: var(--lk-yellow);
    }

    /* В ленте выход — последний пункт. margin-left:auto здесь не нужен:
       вкладки и так шире 728 и лента скроллится, «прижатие вправо»
       только выталкивало бы кнопку за край. */
    .lk-side-logout {
        flex: 0 0 auto;
        margin: 0;
        padding: 0 0 0 16px;
        border-top: none;
        border-left: 1px solid var(--lk-border);
    }

    .lk-side-logout button {
        padding: 0 16px;
        border-left: none;
        border-bottom: 3px solid transparent;
    }

    .lk-main {
        flex: 1 1 100%;
        padding: 24px 20px 32px;
    }

    /* карточка менеджера уезжает под контент */
    .lk-aside {
        width: 100%;
        flex: 0 0 100%;
        border-left: none;
        border-top: 1px solid var(--lk-border);
        padding: 20px;
    }

    .lk-manager {
        max-width: 320px;
        margin: 0 auto;
    }
}

@media screen and (max-width: 728px) {
    .lk-panel,
    .lk-messages {
        width: 300px;
    }

    .lk-main {
        padding: 20px 14px 28px;
    }

    /* строки-таблицы становятся карточками в две колонки */
    .lk-orders .lk-thead,
    .lk-documents .lk-thead {
        display: none;
    }

    .lk-orders .lk-row,
    .lk-favorites .lk-row,
    .lk-documents .lk-row,
    .lk-members .lk-row {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
        padding: 14px 16px;
    }

    .lk-favorites .lk-thumb,
    .lk-documents .lk-doc-icon {
        display: none;
    }

    .lk-machine {
        flex-direction: column;
    }

    .lk-machine-photo {
        width: 100%;
        flex: 0 0 120px;
    }

    .lk-props div {
        grid-template-columns: minmax(0, 1fr);
        gap: 4px;
    }

    .lk-period {
        margin-left: 0;
    }

    .lk-auth-card {
        width: 300px;
        padding: 28px 20px 32px;
    }
}
