/* ============================================================
   Распродажа техники (CPT sale) — фильтр + карточки. est v1.0.0
   ============================================================ */
.sale-archive { padding: 2vw 0 4vw; }
.sale-archive__title { margin-bottom: 0.8vw; }
.sale-archive__lead {
    max-width: 60ch;
    color: #5a5f66;
    line-height: 1.55;
    margin-bottom: 2vw;
}

/* ---- Фильтр ---- */
.sale-filter {
    background: #f6f7f9;
    border: 1px solid #e9ebee;
    border-radius: 16px;
    padding: 1.6vw;
    margin-bottom: 1.6vw;
}
.sale-filter__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1vw;
}
.sale-filter__field { display: flex; flex-direction: column; gap: 0.4vw; min-width: 0; }
.sale-filter__field label {
    font-size: 0.82vw;
    font-weight: 600;
    color: #3a3f45;
}
.sale-filter__field select,
.sale-filter__field input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.7vw 0.9vw;
    border: 1px solid #d7dade;
    border-radius: 10px;
    background: #fff;
    font-size: 0.9vw;
    color: #1c1c1c;
    height: auto;
    line-height: 1.3;
}
.sale-filter__field select:focus,
.sale-filter__field input:focus {
    outline: none;
    border-color: var(--main-color);
}
.sale-filter__actions {
    display: flex;
    gap: 0.8vw;
    margin-top: 1.2vw;
}
.sale-filter__submit,
.sale-filter__reset {
    cursor: pointer;
    border-radius: 10px;
    padding: 0.7vw 1.6vw;
    font-size: 0.9vw;
    font-weight: 600;
    border: 1px solid transparent;
    transition: opacity .2s ease, background .2s ease;
}
.sale-filter__submit { background: var(--main-color); color: #fff; }
.sale-filter__submit:hover { opacity: .88; }
.sale-filter__reset { background: #fff; border-color: #d7dade; color: #3a3f45; }
.sale-filter__reset:hover { background: #f0f1f3; }

.sale-filter__count {
    font-size: 0.92vw;
    color: #6a6f76;
    margin-bottom: 1.2vw;
    min-height: 1.2em;
}

/* ---- Сетка карточек (второстепенный вид) ---- */
.sale-grid { transition: opacity .15s ease; }
.sale-filter-block.is-loading .sale-grid { opacity: .5; }
.sale-view-cards .sale-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.4vw;
}
.sale-view-table .sale-grid { display: block; }

.sale-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e9ebee;
    border-radius: 16px;
    overflow: hidden;
    transition: box-shadow .2s ease, transform .2s ease;
}
.sale-card:hover {
    box-shadow: 0 12px 30px rgba(20, 24, 28, .1);
    transform: translateY(-2px);
}
.sale-card__media {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #f1f3f5;
    overflow: hidden;
}
.sale-card__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sale-card__placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef1f4 0%, #e2e6ea 100%);
    color: #aeb4ba;
    font-weight: 800;
    font-size: 1.6vw;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.sale-card__badge {
    position: absolute;
    top: 0.7vw;
    left: 0.7vw;
    background: rgba(28, 28, 28, .82);
    color: #fff;
    font-size: 0.72vw;
    padding: 0.3vw 0.7vw;
    border-radius: 999px;
    max-width: calc(100% - 1.4vw);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sale-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.7vw;
    padding: 1.1vw 1.2vw 1.2vw;
    flex: 1 1 auto;
}
.sale-card__title {
    font-size: 1.05vw;
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
    color: #1c1c1c;
}
.sale-card__chips { display: flex; flex-wrap: wrap; gap: 0.4vw; }
.sale-card__chip {
    font-size: 0.74vw;
    background: #f1f3f5;
    color: #3a3f45;
    border-radius: 8px;
    padding: 0.25vw 0.55vw;
    line-height: 1.4;
}
.sale-card__chip-label { color: #9aa0a6; }
.sale-card__config {
    font-size: 0.8vw;
    color: #5a5f66;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sale-card__meta { margin-top: auto; }
.sale-card__avail {
    display: inline-block;
    font-size: 0.78vw;
    font-weight: 600;
    padding: 0.25vw 0.6vw;
    border-radius: 8px;
}
.sale-card__avail.is-instock { color: #1d8a3b; background: rgba(49, 185, 57, .12); }
.sale-card__avail.is-order { color: #8a6d1d; background: rgba(202, 179, 146, .18); }
.sale-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8vw;
    padding-top: 0.8vw;
    border-top: 1px solid #eef0f2;
    flex-wrap: wrap;
}
.sale-card__price {
    font-size: 1.05vw;
    font-weight: 800;
    color: var(--main-color);
    white-space: nowrap;
}
.sale-card__price--request { color: #6a6f76; font-weight: 600; font-size: 0.92vw; }
.sale-card__btn {
    cursor: pointer;
    border: 0;
    border-radius: 10px;
    background: var(--main-color);
    color: #fff;
    font-weight: 600;
    font-size: 0.85vw;
    padding: 0.6vw 1.1vw;
    transition: opacity .2s ease;
}
.sale-card__btn:hover { opacity: .88; }

.sale-empty {
    text-align: center;
    padding: 3vw 1vw;
    color: #6a6f76;
}
.sale-empty a { color: var(--main-color); }

.sale-loadmore-wrap { text-align: center; margin-top: 2vw; }
.sale-loadmore {
    cursor: pointer;
    border: 1px solid var(--main-color);
    background: #fff;
    color: var(--main-color);
    font-weight: 600;
    font-size: 0.95vw;
    padding: 0.8vw 2.4vw;
    border-radius: 12px;
    transition: background .2s ease, color .2s ease;
}
.sale-loadmore:hover { background: var(--main-color); color: #fff; }
.sale-loader { color: #6a6f76; margin-top: 1vw; }

/* ---- Планшет ---- */
@media only screen and (max-width: 1024px) {
    .sale-filter__grid { grid-template-columns: repeat(3, 1fr); }
    .sale-filter__field label { font-size: 1.4vw; }
    .sale-filter__field select, .sale-filter__field input { font-size: 1.6vw; padding: 1.2vw; }
    .sale-filter__submit, .sale-filter__reset { font-size: 1.6vw; padding: 1.2vw 2.6vw; }
    .sale-filter__count { font-size: 1.7vw; }
    .sale-view-cards .sale-grid { grid-template-columns: repeat(2, 1fr); gap: 2.2vw; }
    .sale-card__title { font-size: 2vw; }
    .sale-card__chip { font-size: 1.4vw; }
    .sale-card__config { font-size: 1.5vw; }
    .sale-card__avail { font-size: 1.5vw; }
    .sale-card__price { font-size: 2vw; }
    .sale-card__price--request { font-size: 1.7vw; }
    .sale-card__btn { font-size: 1.6vw; padding: 1.2vw 2.2vw; }
    .sale-card__badge { font-size: 1.4vw; padding: 0.6vw 1.2vw; }
    .sale-card__placeholder { font-size: 3vw; }
    .sale-loadmore { font-size: 1.8vw; padding: 1.6vw 5vw; }
}

/* ---- Телефон ---- */
@media only screen and (max-width: 600px) {
    .sale-archive__lead { font-size: 3.6vw; max-width: none; margin-bottom: 5vw; }
    .sale-filter { padding: 4vw; border-radius: 14px; }
    .sale-filter__grid { grid-template-columns: 1fr 1fr; gap: 3vw; }
    .sale-filter__field--search { grid-column: 1 / -1; }
    .sale-filter__field label { font-size: 3.1vw; }
    .sale-filter__field select, .sale-filter__field input { font-size: 3.6vw; padding: 2.8vw; border-radius: 9px; }
    .sale-filter__actions { margin-top: 3vw; }
    .sale-filter__submit, .sale-filter__reset { font-size: 3.6vw; padding: 2.8vw; flex: 1; }
    .sale-filter__count { font-size: 3.4vw; margin-bottom: 3vw; }
    .sale-view-cards .sale-grid { grid-template-columns: 1fr; gap: 4vw; }
    .sale-card { border-radius: 14px; }
    .sale-card__media { aspect-ratio: 16 / 10; }
    .sale-card__body { padding: 4vw; gap: 2.4vw; }
    .sale-card__title { font-size: 4.6vw; }
    .sale-card__chip { font-size: 3vw; padding: 1vw 2vw; }
    .sale-card__config { font-size: 3.3vw; -webkit-line-clamp: 4; }
    .sale-card__avail { font-size: 3.2vw; padding: 1vw 2.2vw; }
    .sale-card__foot { padding-top: 3vw; }
    .sale-card__price { font-size: 4.6vw; }
    .sale-card__price--request { font-size: 3.6vw; }
    .sale-card__btn { font-size: 3.6vw; padding: 2.6vw 5vw; }
    .sale-card__badge { font-size: 2.9vw; padding: 1.2vw 2.6vw; top: 2vw; left: 2vw; }
    .sale-card__placeholder { font-size: 7vw; }
    .sale-loadmore { font-size: 4vw; padding: 3.4vw 10vw; border-radius: 11px; }
}

/* ============================================================
   Основной вид — ТАБЛИЦА (как «Запчасти» / как Excel). est v1.0.1
   На телефоне строки превращаются в карточки с подписями (без фото).
   ============================================================ */
.sale-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1vw;
    flex-wrap: wrap;
    margin-bottom: 1vw;
}
.sale-toolbar .sale-filter__count { margin-bottom: 0; }
.sale-view-toggle {
    display: inline-flex;
    border: 1px solid #d7dade;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    flex: 0 0 auto;
}
.sale-view-btn {
    cursor: pointer;
    border: 0;
    background: transparent;
    padding: 0.55vw 1.3vw;
    font-size: 0.85vw;
    font-weight: 600;
    color: #5a5f66;
    transition: background .2s ease, color .2s ease;
}
.sale-view-btn.is-active { background: var(--main-color); color: #fff; }

/* Таблица */
.sale-view-cards .sale-table-head { display: none; }
.sale-view-table .sale-grid {
    border: 1px solid #e9ebee;
    border-top: 0;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
}
.sale-row {
    display: grid;
    grid-template-columns: 1.1fr 0.8fr 1.1fr 2.4fr 0.7fr 1fr 1.1fr 7vw;
    align-items: center;
    gap: 0.6vw;
    padding: 0.85vw 1vw;
    border-bottom: 1px solid #eef0f2;
    font-size: 0.86vw;
}
.sale-row--head {
    font-weight: 700;
    color: #3a3f45;
    background: #f6f7f9;
    border: 1px solid #e9ebee;
    border-radius: 12px 12px 0 0;
    text-transform: uppercase;
    font-size: 0.72vw;
    letter-spacing: .02em;
    padding-top: 1vw;
    padding-bottom: 1vw;
}
.sale-row:not(.sale-row--head):last-child { border-bottom: 0; }
.sale-row:not(.sale-row--head):hover { background: #fafbfc; }
.sale-cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sale-cell--model { font-weight: 600; }
.sale-cell--config {
    color: #5a5f66;
    font-size: 0.82vw;
    line-height: 1.4;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sale-cell--price .sale-card__price { font-size: 0.92vw; }
.sale-cell--price .sale-card__price--request { font-size: 0.8vw; }
.sale-cell--avail { font-weight: 600; font-size: 0.8vw; white-space: normal; }
.sale-cell--avail.is-instock { color: #1d8a3b; }
.sale-cell--avail.is-order { color: #8a6d1d; }
.sale-cell--action { text-align: right; overflow: visible; }
.sale-row__btn { font-size: 0.8vw; padding: 0.5vw 0.9vw; white-space: nowrap; }

/* Планшет: таблица компактнее */
@media only screen and (max-width: 1024px) and (min-width: 769px) {
    .sale-row { font-size: 1.3vw; grid-template-columns: 1fr 0.8fr 1.1fr 2fr 0.7fr 1fr 1fr 11vw; }
    .sale-row--head { font-size: 1.15vw; }
    .sale-cell--config { font-size: 1.25vw; }
    .sale-cell--price .sale-card__price { font-size: 1.4vw; }
    .sale-cell--avail { font-size: 1.25vw; }
    .sale-row__btn { font-size: 1.25vw; padding: 1vw 1.4vw; }
    .sale-view-btn { font-size: 1.4vw; padding: 1vw 2.4vw; }
}

/* Телефон/мелкий планшет: строки -> карточки с подписями, без фото */
@media only screen and (max-width: 768px) {
    .sale-view-toggle { display: none; }
    .sale-view-table .sale-table-head { display: none; }
    .sale-view-table .sale-grid { border: 0; border-radius: 0; }
    .sale-row {
        display: block;
        border: 1px solid #e9ebee;
        border-radius: 12px;
        margin-bottom: 3.5vw;
        padding: 1.5vw 4vw;
        font-size: 3.5vw;
    }
    .sale-row .sale-cell {
        display: flex;
        justify-content: space-between;
        gap: 4vw;
        padding: 2.4vw 0;
        border-bottom: 1px dashed #eef0f2;
        white-space: normal;
        overflow: visible;
        text-align: right;
    }
    .sale-row .sale-cell:last-child { border-bottom: 0; }
    .sale-row .sale-cell[data-label]::before {
        content: attr(data-label);
        color: #9aa0a6;
        font-weight: 600;
        text-align: left;
        flex: 0 0 34%;
    }
    .sale-row .sale-cell--config { -webkit-line-clamp: unset; display: block; }
    .sale-cell--config::before { align-self: flex-start; }
    .sale-row .sale-cell--avail { font-size: 3.5vw; }
    .sale-cell--price .sale-card__price { font-size: 4.4vw; }
    .sale-row .sale-cell--action { border-bottom: 0; padding-top: 3.5vw; }
    .sale-row .sale-cell--action::before { display: none; }
    .sale-row__btn { width: 100%; font-size: 3.8vw; padding: 3vw; text-align: center; }
    /* Карточный вид на телефоне — без фото (фото нет) */
    .sale-view-cards .sale-card__media { display: none; }
}
