/* ===== ПЕРЕМЕННЫЕ И БАЗА ===== */
:root {
    --brand: #0066cc;
    --brand-dark: #0052a8;
    --bg: #f0f4f8;
    --card: #ffffff;
    --border: #e3e8ef;
    --text: #1a2230;
    --muted: #6b7785;
    --radius: 14px;
    --shadow: 0 2px 12px rgba(20, 40, 80, .06);
}

* { box-sizing: border-box; }

html {
    background: linear-gradient(160deg, #eef3f9 0%, #e6edf5 100%);
    min-height: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    color: var(--text);
    background: transparent;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1 {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 22px;
    letter-spacing: -.3px;
}

h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 6px;
}

/* ===== РАСКЛАДКА ===== */
.ps-layout {
    display: grid;
    grid-template-columns: minmax(0, 620px) minmax(0, 1fr);
    grid-template-areas:
        "filters chart"
        "results results";
    gap: 24px;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
}
.ps-controls  { grid-area: filters; min-width: 0; }
.ps-chart-box { grid-area: chart;   min-width: 0; }
.ps-results   { grid-area: results; min-width: 0; max-width: 100%; }

/* ===== ФИЛЬТРЫ — 3 КОЛОНКИ ===== */
.ps-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 10px;
    align-content: start;
    background: var(--card);
    padding: 18px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    max-width: 100%;
}

.ps-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.ps-field label {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .2px;
    text-align: center;   /* надписи по центру везде */
}
.ps-field input,
.ps-field select {
    padding: 5px 8px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
    width: 100%;
    max-width: 100%;
    background: #fff;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}
.ps-field input:focus,
.ps-field select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, .12);
}

/* Тип насоса — акцентный (одна колонка) */
.ps-field-type {
    background: linear-gradient(135deg, #fff8e6, #fff4d6);
    border: 1.5px solid #ffc94d;
    border-radius: 10px;
    padding: 8px 11px;
    justify-content: center;
}
.ps-field-type label { color: #8a6500; font-weight: 700; }
.ps-field-type select { border-color: #ffc94d; font-weight: 600; }

/* Чекбоксы — 3 в ряд */
.ps-field-check label {
    flex-direction: row !important;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    margin-bottom: 0;
    font-size: 12.5px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text);
    padding: 7px 8px;
    border-radius: 8px;
    background: #f6f9fc;
    transition: background .15s;
    height: 100%;
}
.ps-field-check label:hover { background: #eef3f9; }
.ps-field-check input[type="checkbox"] {
    width: 16px; height: 16px;
    cursor: pointer;
    accent-color: var(--brand);
    flex-shrink: 0;
}

/* Ползунки — 3 в ряд */
.ps-field-slider label {
    text-transform: none;
    letter-spacing: 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.2;
    min-height: 26px;
}
.ps-field-slider input[type="range"] {
    width: 100%;
    max-width: 100%;
    height: 3px;
    accent-color: var(--brand);
    cursor: pointer;
    margin: 2px 0;
}

/* Кнопка */
.ps-field-btn { grid-column: 1 / -1; margin-top: 6px; }
.ps-btn {
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff; border: none;
    padding: 12px 24px;
    border-radius: 9px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    box-shadow: 0 4px 12px rgba(0, 102, 204, .25);
    transition: transform .12s, box-shadow .15s;
}
.ps-btn:hover {
    box-shadow: 0 6px 18px rgba(0, 102, 204, .35);
    transform: translateY(-1px);
}
.ps-btn:active { transform: translateY(0); }

/* ===== ГРАФИК ===== */
.chart-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    display: block;              /* НЕ flex — flex давал петлю высоты */
    box-shadow: var(--shadow);
    max-width: 100%;
    overflow: hidden;
}
.chart-title { font-weight: 700; margin-bottom: 14px; font-size: 17px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 10px; }
.ps-loading { padding: 20px; color: var(--muted); }

.chart-canvas-wrap {
    position: relative;          /* обязательно для absolute canvas */
    width: 100%;
    max-width: 100%;
    height: 440px;               /* ЖЁСТКАЯ высота на ПК — петли нет */
    flex: 0 0 auto;              /* НЕ растягивается flex-ом */
}
.chart-canvas-wrap canvas {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
}

/* Кнопки переключения скоростей/режимов (desktop) */
.ps-mode-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 14px;
}
.ps-mode-bar button {
    padding: 6px 14px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    border-width: 2px;
    border-style: solid;
}

/* ===== РЕЗУЛЬТАТЫ + ТАБЛИЦА ===== */
.ps-results {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.ps-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ps-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
    table-layout: auto;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
}
.ps-table th, .ps-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: center;
    font-size: 15px;
    white-space: nowrap;
    vertical-align: middle;
    background: #fff;
}
.ps-table th {
    background: #f4f7fb;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: var(--muted);
    border-bottom: 2px solid var(--border);
}
.ps-table tbody tr { cursor: pointer; transition: background .15s; }
.ps-table tbody tr:hover td { background: #eef5ff; }
.ps-table tbody tr.active td { background: #dcebff; }

.ps-match {
    display: inline-block; min-width: 55px;
    padding: 5px 10px; border-radius: 20px;
    color: #fff; font-weight: 700; font-size: 13px;
}
.match-high { background: #2e9e44; }
.match-mid  { background: #e8a317; }
.match-low  { background: #d9534f; }

.ps-empty {
    padding: 22px;
    background: #fff4f4;
    color: #b03a36;
    border-radius: 10px;
    border: 1px solid #ffd9d7;
}

.ps-model {
    font-weight: 600;
    text-align: left;
    white-space: normal;
    min-width: 150px;
    max-width: 200px;
}

.ps-table img {
    max-width: 60px;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 6px;
}

/* ===== АДАПТИВ ===== */

/* Узкий десктоп / планшет: всё в одну колонку */
@media (max-width: 1100px) {
    .ps-layout {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "filters"
            "chart"
            "results";
        gap: 18px;
    }
    body { padding: 18px; }
}

/* Планшет: фильтры 2 колонки */
@media (max-width: 760px) {
    .ps-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .ps-field-btn { grid-column: 1 / -1; }
}

/* Телефон: фильтры 1 колонка (базовый) */
@media (max-width: 560px) {
    body { padding: 12px; }
    h1 { font-size: 20px; line-height: 1.2; margin-bottom: 16px; }
    h2 { font-size: 17px; }
    .ps-layout { gap: 14px; }

    .ps-controls { grid-template-columns: minmax(0, 1fr); padding: 14px; gap: 10px; }
    .ps-field label { font-size: 11px; }
    .ps-field input, .ps-field select { font-size: 14px; padding: 9px 10px; }
    .ps-field-check label { font-size: 13px; padding: 9px 10px; }
    .ps-field-slider label { min-height: 0; }
    .ps-btn { padding: 13px 24px; font-size: 15px; }

    .chart-box { padding: 14px; }
    .chart-canvas-wrap { height: 300px; }   /* фикс. высота на телефоне */
    .chart-title { font-size: 15px; }

    .ps-results { padding: 14px; }
    .ps-table th, .ps-table td { font-size: 13px; padding: 9px 10px; }
    .ps-table img { max-width: 44px; }

    #pwa-install { bottom: 12px; right: 12px; padding: 11px 16px; font-size: 14px; }
}

/* ===== ПОДСКАЗКА В РЕЗУЛЬТАТАХ ===== */
.ps-results-hint {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 6px;
    padding: 9px 14px;
    background: #eaf3ff;
    border: 1px solid #c8def8;
    border-left: 4px solid var(--brand);
    border-radius: 9px;
    font-size: 14px;
    font-weight: 500;
    color: #1f3a5a;
    line-height: 1.4;
}
.ps-results-hint::before {
    content: "👆";
    font-size: 16px;
    flex-shrink: 0;
}
.ps-results-hint b {
    color: var(--brand);
    font-weight: 700;
}

@media (max-width: 560px) {
    .ps-results-hint {
        display: flex;
        font-size: 13px;
        padding: 9px 11px;
    }
}

/* ============================================
   МОБИЛЬНАЯ ВЁРСТКА ТАБЛИЦЫ — КАРТОЧКИ
   ============================================ */
@media (max-width: 768px) {

    /* ---- ФИЛЬТРЫ В 2 КОЛОНКИ ---- */
    /* (перебиваем grid-раскладку выше: используем flex для 2 колонок) */
    .ps-controls {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }

    /* по умолчанию каждое поле = половина ширины */
    .ps-controls .ps-field {
        flex: 1 1 calc(50% - 5px);
        min-width: 0;          /* чтобы select/input не распирали колонку */
        margin: 0;
        box-sizing: border-box;
    }

    /* Тип насоса — на всю ширину (главный фильтр) */
    .ps-controls .ps-field-type {
        flex: 1 1 100%;
    }

    /* Кнопка "Подобрать" — на всю ширину снизу */
    .ps-controls .ps-field-btn {
        flex: 1 1 100%;
    }

    /* select и input не должны вылезать за колонку */
    .ps-controls .ps-field select,
    .ps-controls .ps-field input[type="number"],
    .ps-controls .ps-field input[type="text"],
    .ps-controls .ps-field input[type="range"] {
        width: 100%;
        box-sizing: border-box;
    }

    /* чекбоксы и слайдеры тоже по половине */
    .ps-controls .ps-field-check,
    .ps-controls .ps-field-slider {
        flex: 1 1 calc(50% - 5px);
    }

    /* ---- ГРАФИК: фиксированная высота на планшете/телефоне ---- */
    .chart-canvas-wrap {
        height: 300px;          /* базовые position/flex/canvas — из ЗАМЕНЫ 1 */
    }

    /* компактнее кнопки скоростей/режимов */
    .ps-mode-bar {
        gap: 6px;
        margin: 8px 0 12px;       /* отступ снизу — не липнут к графику */
        flex-wrap: wrap;
    }
    .ps-mode-bar button {
        flex: 0 1 auto;           /* НЕ растягиваем на всю ширину */
        padding: 6px 12px;
        font-size: 13px;
        white-space: nowrap;      /* "Скорость 1" не переносится */
    }

    /* ---- ТАБЛИЦА → КАРТОЧКИ ---- */

    /* убираем горизонтальный скролл-контейнер */
    .ps-table-wrap {
        overflow: visible;
    }

    /* прячем заголовок таблицы — подписи берём из data-label */
    .ps-table thead {
        display: none;
    }

    .ps-table,
    .ps-table tbody,
    .ps-table tr,
    .ps-table td {
        display: block;
        width: 100%;
    }

    /* каждая строка = карточка */
    .ps-table tr {
        background: #fff;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        margin-bottom: 14px;
        padding: 10px 14px;
        box-shadow: 0 2px 6px rgba(0,0,0,.06);
        position: relative;
    }

    .ps-table tr.active {
        border-color: #0066cc;
        box-shadow: 0 0 0 2px rgba(0,102,204,.25);
    }

    /* строка = карточка, ячейки в ряд по 2 */
    .ps-table tr {
        display: flex;
        flex-wrap: wrap;
        position: relative;   /* нужно для бейджа % в углу */
    }

    /* ячейка-поле: подпись СВЕРХУ, значение СНИЗУ, по половине ширины */
    .ps-table td {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 2px;
        flex: 1 1 50%;
        max-width: 50%;
        padding: 7px 6px;
        border: none;
        border-bottom: 1px dashed #eef0f3;
        text-align: left;
        font-size: 14px;
        min-height: 44px;
        white-space: normal;
        box-sizing: border-box;
    }

    /* подпись из data-label сверху */
    .ps-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: .3px;
        order: -1;
        text-align: left;
    }

    /* ---- ШАПКА КАРТОЧКИ (Модель + %) ---- */

    /* Модель — крупно, на всю ширину, сверху */
    .ps-table td.ps-model {
        flex: 1 1 100%;
        max-width: 100%;
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        font-size: 16px;
        font-weight: 700;
        order: -2;                 /* поднимаем наверх карточки */
        border-bottom: 1px solid #eef0f3;
        padding-top: 0;
        padding-right: 70px;       /* место под бейдж % справа */
        min-width: 0;
    }
    .ps-table td.ps-model::before {
        display: none;             /* подпись "Модель" не нужна */
    }

    /* Соответствие (%) — наверх, рядом с моделью */
    /* Соответствие (%) — в правый верхний угол карточки, без подписи */
    .ps-table td[data-label="Соответствие"] {
        position: absolute;
        top: 10px;
        right: 14px;
        width: auto;
        max-width: none;
        min-height: 0;
        padding: 0;
        margin: 0;
        border: none;
        background: transparent;
        z-index: 2;
    }
    /* убираем слово "СООТВЕТСТВИЕ" */
    .ps-table td[data-label="Соответствие"]::before {
        display: none;
    }

    /* бейдж % крупнее */
    .ps-table .ps-match {
        font-size: 15px;
        padding: 4px 12px;
    }
        /* убираем подписи у Фото / Цены / Наличия / Магазина */
    .ps-table td[data-label="Фото"]::before,
    .ps-table td[data-label="Цена"]::before,
    .ps-table td[data-label="Наличие"]::before,
    .ps-table td[data-label="Магазин"]::before {
        display: none;
    }

    /* Фото — слева, без подписи на отдельной строке */
    .ps-table td[data-label="Фото"] {
        justify-content: flex-start;
    }
    .ps-table td[data-label="Фото"] img {
        width: 60px !important;
        height: 60px !important;
        max-width: 60px;
        margin: 0;
    }

    /* Цена — выделяем цветом и размером */
    .ps-table td.ps-price {
        font-size: 17px;
        font-weight: 700;
        color: #0a7d28;
    }

    /* кнопка "На сайт" — растягиваем как кнопку */
    .ps-table td.ps-shop a {
        display: inline-block;
        background: #0066cc;
        color: #fff !important;
        padding: 7px 12px;
        border-radius: 8px;
        font-weight: 600;
        text-decoration: none;
        font-size: 13px;
        white-space: nowrap;
    }

    /* hint и заголовки — компактнее */
    .ps-results h2 {
        font-size: 18px;
    }
    .ps-results-hint {
        font-size: 13px;
    }
}

/* очень узкие экраны */
@media (max-width: 380px) {
    .ps-table tr {
        padding: 8px 10px;
    }
    .ps-table td {
        font-size: 13px;
    }
    /* на совсем узких — фильтры в 1 колонку, чтобы не было каши */
    .ps-controls .ps-field,
    .ps-controls .ps-field-check,
    .ps-controls .ps-field-slider {
        flex: 1 1 100%;
    }
}
/* ========================================================== */
/* ИСПРАВЛЕНИЕ НАЕЗДА КНОПОК СКОРОСТЕЙ НА ГРАФИК               */
/* ========================================================== */

/* Блок графика — вертикальный поток: заголовок → кнопки → график → подсказка */
#ps-chart-box.chart-box {
    display: flex;
    flex-direction: column;
}

/* Заголовок графика — с отступом снизу */
#ps-chart-title.chart-title {
    margin-bottom: 8px;
    flex: 0 0 auto;
}

/* Кнопки скоростей — отдельный блок В ПОТОКЕ над графиком */
#ps-mode-bar.ps-mode-bar {
    position: relative;       /* свой контекст, поверх absolute не ляжет */
    z-index: 2;
    flex: 0 0 auto;           /* не растягивается и не сжимается */
    margin: 0 0 14px;         /* отступ снизу = воздух перед графиком */
    clear: both;
}

/* Обёртка canvas — фиксированная высота, не сжимается флексом */
.chart-canvas-wrap {
    position: relative;       /* обязательно для absolute canvas */
    width: 100%;
    max-width: 100%;
    height: 440px;            /* десктоп */
    margin: 0;
    flex: 0 0 auto;           /* НЕ сжимается флексом */
}

.chart-canvas-wrap canvas {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
}

/* Подсказка под графиком */
#ps-chart-hint.hint {
    flex: 0 0 auto;
}

/* МОБИЛЬНЫЙ */
@media (max-width: 768px) {
    .chart-canvas-wrap {
        height: 300px;
    }
    #ps-mode-bar.ps-mode-bar {
        margin: 0 0 12px;
        gap: 6px;
    }
    #ps-mode-bar.ps-mode-bar button {
        padding: 6px 10px;
        font-size: 12px;
    }
}
/* ========================================================== */
/* ШАПКА С ЛОГОТИПАМИ                                          */
/* Десктоп = 2 логотипа, Мобильный = 1 другой логотип         */
/* ========================================================== */

.ps-header {
    display: flex;
    align-items: center;          /* всё по центру по вертикали с заголовком */
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 22px;
}

.ps-header h1 {
    margin: 0;
}

/* ---- ДЕСКТОПНЫЕ ЛОГОТИПЫ (по умолчанию видны) ---- */
.ps-logos-desktop {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 0 0 auto;               /* не сжимается, не растягивается = не съезжает */
}
.ps-logo {
    height: 40px;                 /* маленькие, десктоп */
    width: auto;
    max-width: 160px;
    object-fit: contain;
    display: block;
}

/* ---- МОБИЛЬНЫЙ ЛОГОТИП (по умолчанию скрыт) ---- */
.ps-logos-mobile {
    display: none;
    flex: 0 0 auto;
    align-items: center;
}
.ps-logo-mobile {
    height: 32px;                 /* маленький */
    width: auto;
    max-width: 120px;
    object-fit: contain;
    display: block;
}

/* ---- ПЛАНШЕТ: десктопные логотипы чуть меньше ---- */
@media (max-width: 760px) {
    .ps-logo {
        height: 34px;
        max-width: 130px;
    }
    .ps-logos-desktop { gap: 10px; }
}

/* ---- МОБИЛЬНЫЙ: шапка в столбик — заголовок → логотип → кнопка ---- */
@media (max-width: 560px) {
    .ps-header {
        flex-direction: column;      /* всё в столбик */
        align-items: center;         /* по центру */
        justify-content: center;
        text-align: center;
        margin-bottom: 16px;
        gap: 12px;
    }

    /* 1) заголовок — первым */
    .ps-header h1 {
        order: 1;
        width: 100%;
    }

    /* 2) логотип — вторым, под заголовком */
    .ps-logos-desktop {
        display: none;               /* убираем 2 десктопных логотипа */
    }
    .ps-logos-mobile {
        display: flex;               /* показываем мобильный логотип */
        order: 2;
        justify-content: center;
        width: 100%;
    }
    .ps-logo-mobile {
        height: 34px;
        max-width: 160px;
    }

    /* 3) кнопка "Как пользоваться" — третьей, на всю ширину */
    .ps-help-link {
        order: 3;
        width: 100%;
        text-align: center;
        box-sizing: border-box;
        padding: 11px 16px;
        font-size: 15px;
    }
}

/* ---- ОЧЕНЬ УЗКИЕ ЭКРАНЫ ---- */
@media (max-width: 380px) {
    .ps-logo-mobile {
        height: 26px;
        max-width: 90px;
    }
}
/* короткая подпись производительности — только мобильный */
.lbl-short { display: none; }

@media (max-width: 768px) {
    .lbl-full  { display: none; }
    .lbl-short { display: inline; }
}
/* поля диапазона "От — До" (мощность) */
.range-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}
.range-inputs input[type="number"] {
    width: 100%;
    min-width: 0;
    padding: 5px 8px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.range-inputs input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, .12);
}
.range-sep {
    color: var(--muted);
    flex-shrink: 0;
}

@media (max-width: 560px) {
    .range-inputs input[type="number"] { font-size: 14px; padding: 9px 10px; }
}

/* ===== СКРЫТИЕ ПОЛЕЙ ДО ВЫБОРА ТИПА ===== */
.ps-controls.no-type .ps-field:not(.ps-field-type) { display: none !important; }
.ps-field-power { min-width: 0; }
/* ============================================================ */
/* ПЕРЕКЛЮЧАТЕЛЬ РЕЖИМА ВВОДА (Знаю Q и H / Рассчитать)          */
/* ============================================================ */
.ps-mode-btns,
#ps-input-mode {
    display: flex;
    gap: 0;
    margin-top: 4px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
}

.ps-mode-btn {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 34px;          /* компактнее */
    height: 34px;              /* фиксируем одинаковую высоту */
    padding: 6px 8px;          /* меньше */
    border: none;
    background: #f4f7fa;
    color: var(--muted);
    font-size: 12px;           /* меньше шрифт */
    font-weight: 600;
    line-height: 1.1;
    white-space: nowrap;       /* "Знаю Q/H" в одну строку */
    cursor: pointer;
    transition: background .15s, color .15s;
}

.ps-mode-btn + .ps-mode-btn {
    border-left: 1.5px solid var(--border);
}

.ps-mode-btn:hover {
    background: #e8eef4;
}

.ps-mode-btn.active {
    background: var(--brand);
    color: #fff;
}

/* ============================================================ */
/* БЛОК КАЛЬКУЛЯТОРА                                            */
/* ============================================================ */
#ps-calc-block {
    grid-column: 1 / -1;
    margin: 4px 0;
    padding: 16px;
    background: #f3f8ff;
    border: 1.5px solid #cfe0f5;
    border-radius: var(--radius);
}

.ps-calc-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--brand-dark);
    margin: 0 0 14px;
    text-align: center;
}

.ps-calc-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    align-items: start;   /* было end → поля выравниваются по верху, ровно */
}

.ps-calc-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.ps-calc-field label {
    font-size: 11px;            /* как у обычных полей */
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;  /* как у обычных подписей */
    letter-spacing: .2px;
    text-align: center;
    line-height: 1.3;
    margin-bottom: 4px;
    display: block;             /* убрал flex + min-height (раздувал высоту) */
}

.ps-calc-field input,
.ps-calc-field select {
    width: 100%;
    box-sizing: border-box;
    padding: 5px 8px;          /* как у обычных полей (.ps-field) */
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 12px;           /* как у обычных полей */
    background: #fff;
    color: var(--text);
    text-align: center;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.ps-calc-field input:focus,
.ps-calc-field select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, .12);
}

/* Кнопка «Рассчитать и подобрать» */
.ps-calc-actions {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.ps-calc-btn {
    width: 100%;
    box-sizing: border-box;
    min-height: 44px;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff;
    border: none;
    border-radius: 9px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 102, 204, .25);
    transition: transform .12s, box-shadow .15s;
}

.ps-calc-btn:hover {
    box-shadow: 0 6px 18px rgba(0, 102, 204, .35);
    transform: translateY(-1px);
}

.ps-calc-btn:active {
    transform: translateY(0);
}

/* Результат расчёта */
.ps-calc-result {
    width: 100%;
    text-align: center;
    font-size: 14px;
    color: var(--brand-dark);
    line-height: 1.5;
}

.ps-calc-result b {
    font-size: 16px;
    color: var(--brand);
}

.ps-calc-details {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #cfe0f5;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
}

/* В режиме калькулятора прячем ручные поля Q/H */
.ps-controls.calc-mode #ps-qh-block {
    display: none !important;
}

/* ===== МОБИЛЬНЫЙ ===== */
@media (max-width: 560px) {
    .ps-mode-btn {
        font-size: 12px;
        min-height: 38px;
        height: 38px;
    }
    /* поля калькулятора — в 2 колонки, как остальные фильтры */
    .ps-calc-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .ps-calc-field input,
    .ps-calc-field select {
        font-size: 14px;   /* как обычные поля на мобиле */
        padding: 9px 10px; /* как обычные на мобиле */
    }
}

/* очень узкие экраны — калькулятор в 1 колонку, чтобы не было каши */
@media (max-width: 380px) {
    .ps-calc-fields {
        grid-template-columns: 1fr;
    }
}
/* ============================================================ */
/* ПЛАШКА-ПОДСКАЗКА В КАЛЬКУЛЯТОРЕ (тёплый пол и т.п.)            */
/* ============================================================ */
.ps-calc-note {
    grid-column: 1 / -1;
    margin: 10px 0 0;
    padding: 10px 12px;
    background: #fff8e6;
    border: 1px solid #ffd87a;
    border-left: 4px solid #f0a800;
    border-radius: 9px;
    font-size: 12.5px;
    line-height: 1.45;
    color: #6b5200;
}
.ps-calc-note b {
    color: #8a6500;
}
/* ========================================================== */
/* ФИКС НАЕЗДА МОДЕЛИ НА ЦЕНУ (десктоп / планшет ≥ 769px)      */
/* ========================================================== */
@media (min-width: 769px) {

    /* Модель: разрешаем перенос и расширяем потолок ширины */
    .ps-table td.ps-model {
        max-width: 320px;        /* было 200px — даём больше места */
        white-space: normal;     /* перенос длинных названий */
        word-break: break-word;  /* ломаем слишком длинные куски */
        overflow-wrap: anywhere;
    }

    /* Цена: фиксируем минимум, чтобы её не «съедала» модель */
    .ps-table td.ps-price,
    .ps-table th:nth-child(8) {
        min-width: 100px;
        white-space: nowrap;
    }

    /* Артикул: не даём схлопнуться (он рядом с моделью) */
    .ps-table td[data-label="Артикул"] {
        min-width: 70px;
    }
}
/* ========================================================== */
/* КНОПКА "СБРОСИТЬ ФИЛЬТРЫ"                                   */
/* ========================================================== */
.ps-btn-reset {
    width: 100%;
    margin-top: 8px;
    padding: 10px 16px;
    background: #f2f5f8;
    color: #445;
    border: 1.5px solid var(--border);
    border-radius: 9px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.ps-btn-reset:hover {
    background: #e6ebf1;
    border-color: #cdd6e0;
}
.ps-btn-reset:active {
    background: #dde4ec;
}

@media (max-width: 560px) {
    .ps-btn-reset { padding: 12px 16px; font-size: 15px; }
}
/* css/style.css — панель сортировки результатов */
.ps-sortbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 12px;
    padding: 8px 10px;
    background: #f5f7fa;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
}
.ps-sort-label {
    font-size: 13px;
    color: #667085;
    font-weight: 600;
}
.ps-sort-btn {
    font-size: 13px;
    padding: 5px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    background: #fff;
    color: #344054;
    cursor: pointer;
    transition: all .15s ease;
    white-space: nowrap;
}
.ps-sort-btn:hover { border-color: #98a2b3; }
.ps-sort-btn.active {
    background: #1565c0;
    border-color: #1565c0;
    color: #fff;
}