/*
 * Подбор насосов в оформлении сайтов aqualider.by и tsk-nasosy.by
 * (заказчик, 26.09.2026: «переделать его в дизайне наших сайтов»).
 * Подключается после style.css и auth.css и перекрывает их: шрифт Manrope,
 * синий и оранжевый витрины, скругления и тени карточек, кнопка действия —
 * оранжевая, как «Собрать котельную» на витрине.
 *
 * html.vstroen — подбор открыт внутри сайта (js/sayt.js): свои логотипы
 * и фон не нужны, шапка и подвал — сайта.
 */
:root {
    --brand: #0b63e5;
    --brand-dark: #0848a8;
    --t-cyan: #00b3d6;
    --t-accent: #ff5b35;
    --t-accent-dark: #e8461f;
    --bg: #f3f6fb;
    --card: #ffffff;
    --border: #e6ebf2;
    --text: #16202b;
    --muted: #5a6874;
    --radius: 20px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .07);
}

html { background: linear-gradient(160deg, #f5f8fd 0%, #eef3fa 100%); }
body { font-family: Manrope, "Segoe UI", Roboto, Arial, sans-serif; }
h1 { font-weight: 800; letter-spacing: -.02em; }

/* Шапка подбора: инструкция, аналоги, вход */
.ps-help-link {
    background: var(--brand) !important;
    border-radius: 999px !important;
    padding: 9px 18px !important;
}
.ps-help-link:hover { background: var(--brand-dark) !important; }
.ps-analog-link { border-radius: 999px; }

/* Карточки */
.ps-controls, .chart-box, .ps-results {
    border-radius: var(--radius);
    border-color: var(--border);
    box-shadow: var(--shadow);
}

/* Поля */
.ps-field label { letter-spacing: .04em; }
.ps-field input, .ps-field select {
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 14px;
    font-family: inherit;
}
.ps-field input:focus, .ps-field select:focus { box-shadow: 0 0 0 4px rgba(11, 99, 229, .12); }

/* Тип насоса — главный выбор: фирменный голубой вместо жёлтого */
.ps-field-type {
    background: linear-gradient(135deg, #eef5ff 0%, #e6f8fc 100%);
    border-color: #b9d3fb;
    border-radius: 14px;
}
.ps-field-type label { color: var(--brand); }
.ps-field-type select { border-color: #b9d3fb; }

/* Кнопка «Подобрать» — оранжевая, как кнопки действия на витрине */
.ps-field-btn { margin-top: 2px; }
.ps-btn-reset { padding: 6px 12px; font-size: 13px; }
.ps-btn {
    padding: 0 20px;
    height: 40px;
    font-size: 15px;
    background: linear-gradient(135deg, #ff5b35 0%, #ff9340 100%);
    border-radius: 999px;
    font-family: inherit;
    font-weight: 700;
    box-shadow: 0 10px 24px -12px rgba(255, 91, 53, .8);
}
.ps-btn:hover { box-shadow: 0 14px 28px -12px rgba(255, 91, 53, .9); }
.ps-btn-reset { font-family: inherit; }
.ps-mode-btn { font-family: inherit; }
.ps-mode-btn.active { background: var(--brand); border-color: var(--brand); }

/* Таблица результатов */
.ps-table { border-radius: 14px; }
.ps-table th { background: var(--bg); color: var(--muted); }
.ps-table tbody tr:hover td { background: #f1f6ff; }
.ps-table tbody tr.active td { background: #e3eeff; }
.match-high { background: #12a150; }
.match-mid  { background: #d97c00; }
.match-low  { background: #d9534f; }
.ps-price { font-weight: 800; color: var(--text); min-width: 110px; }
/* Ширина ячеек не прыгает, пока «⏳» сменяется ценой и наличием. */
.ps-stock { min-width: 150px; }
.ps-shop { min-width: 100px; }
.ps-shop a { color: var(--brand) !important; font-weight: 700; }

/* Закрытый опт, наличие и панель сотрудника (js/sayt.js) */
.ps-zakryto { color: var(--muted); font-size: 12.5px; white-space: normal; }
a.ps-zakryto { color: var(--brand); font-weight: 600; }
.ps-nal { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.ps-nal::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ps-nal--da { color: #12a150; background: #e9f7ef; }
.ps-nal--zakaz { color: #b45f00; background: #fdf3e2; }
.ps-sotr-btn { display: block; margin: 6px auto 0; padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px; background: #fff; color: var(--brand); font: 600 12px/1.3 inherit; font-family: inherit; cursor: pointer; }
.ps-sotr-btn:hover { border-color: var(--brand); }
.ps-table tbody tr.ps-sotr-ryad { cursor: default; }
.ps-table tbody tr.ps-sotr-ryad td, .ps-table tbody tr.ps-sotr-ryad:hover td { background: var(--bg); white-space: normal; text-align: left; padding: 14px 18px; }
.ps-sotr { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(200px, 1fr) minmax(260px, 1.4fr); gap: 12px; }
.ps-sotr__kol { padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: #fff; }
.ps-sotr__zag { margin-bottom: 8px; font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ps-sotr__str { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 0; font-size: 14px; border-bottom: 1px dashed var(--border); }
.ps-sotr__str:last-child { border-bottom: 0; }
.ps-sotr__str b { font-weight: 800; white-space: nowrap; color: var(--text); }
.ps-sotr__str i { font-style: normal; color: var(--muted); font-size: 12.5px; }
.ps-sotr__str--nol, .ps-sotr__str--nol b { color: #9aa5b1; }
.ps-sotr__str--prihod span { color: var(--brand); }
@media (max-width: 900px) { .ps-sotr { grid-template-columns: 1fr; } }

/* ===== Форма подбора: ровные поля в порядке заполнения =====
   Заказчик, 26.09.2026: «выровняй все поля и рассортируй их в логическом порядке
   заполнения», «перемести способ ввода и панель расчёта над остальными полями».
   Сверху — тип насоса и способ ввода, под ними во всю ширину — панель расчёта;
   дальше расход, напор, допуск, характеристики типа (порядок — js/sayt.js),
   в конце питание, мощность, бренд. Подписи — в одну строку, поля — одной высоты. */
.ps-controls { gap: 8px 12px; padding: 16px 18px; align-items: end; }
.ps-field-type      { order: 1; }
#ps-input-mode      { order: 2; }
#ps-calc-block      { order: 3; grid-column: 1 / -1; }
.ps-field-flow      { order: 4; }
.ps-field-head      { order: 5; }
[data-filter="tolerance"] { order: 6; }
#ps-dynamic-filters > * { order: 50; }
[data-filter="phase"] { order: 60; }
.ps-field-power     { order: 61; }
.ps-field-brand     { order: 62; }
.ps-field-btn       { order: 90; }
@media (min-width: 761px) {
    .ps-field-type { grid-column: span 2; }
}

.ps-field label {
    display: block;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
    font-size: 10.5px;
    line-height: 14px;
}
/* Компактно (заказчик, 26.09.2026: «все строки в блоке фильтров очень большие…
   уменьши их по высоте»): поле 34 px. */
.ps-field input, .ps-field select, .range-inputs input[type="number"] {
    height: 34px;
    padding: 0 10px;
    font-size: 13px;
    border-radius: 10px;
}

/* Тип насоса: выделено само поле, без рамки-подложки — чтобы стоять вровень с остальными */
.ps-field-type { background: none; border: 0; padding: 0; }
.ps-field-type select { border: 2px solid var(--brand); background: #f4f8ff; font-weight: 700; font-size: 13.5px; }

/* Способ ввода — переключатель высотой с поле */
#ps-input-mode { flex-direction: column; border: 0; margin: 0; overflow: visible; border-radius: 0; }
#ps-input-mode .ps-mode-btns { margin: 0; height: 34px; border-radius: 10px; border: 1.5px solid var(--border); }
#ps-input-mode .ps-mode-btn { height: 100%; min-height: 0; padding: 0 8px; font-size: 12.5px; font-family: inherit; }

/* Панель расчёта */
#ps-calc-block { margin: 2px 0; padding: 10px 14px 12px; background: linear-gradient(135deg, #eef5ff 0%, #e6f8fc 100%); border: 1px solid #cfe0f5; border-radius: 16px; }
.ps-calc-title { margin-bottom: 6px; font-size: 13px; font-weight: 800; color: var(--brand-dark); }
.ps-calc-fields { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 10px; align-items: end; }
.ps-calc-field { gap: 3px; }
.ps-calc-field label { text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 10.5px; line-height: 14px; }
.ps-calc-field input, .ps-calc-field select { height: 34px; padding: 0 10px; font-size: 13px; border-radius: 10px; text-align: left; font-family: inherit; }
.ps-calc-btn { height: 36px; margin-top: 8px; padding: 0 18px; border-radius: 999px; font-size: 14px; font-family: inherit; }
.ps-calc-actions { margin-top: 0; }

/* ===== Результаты — карточки на всех экранах =====
   Заказчик, 26.09.2026: «сделать компактнее строки с насосами… колонки до фото
   объедини… выводи в 2 колонки», затем «ты же в 4 хотел сделать», «что
   в мобильной версии?», «при наведении меняется содержимое… есть ещё дёрганья».
   Сколько карточек в ряду — по ширине (на большом мониторе четыре, на телефоне
   одна). «Соответствие», «Статус», «H при Q», «Запас» — одна ячейка «Подбор»
   (js/app.js). Панель сотрудника — внутри своей карточки (js/sayt.js).
   Префикс .ps-results перекрывает мобильные правила style.css (таблица →
   карточки с подписями), чтобы вид был один. */
.ps-podbor .ps-match { min-width: 48px; padding: 3px 9px; font-size: 12.5px; }
.ps-podbor__st { margin-top: 3px; font-size: 12px; font-weight: 700; color: var(--text); }
.ps-podbor__h { font-size: 12px; color: var(--muted); white-space: nowrap; }

.ps-results .ps-table-wrap { overflow: visible; }
.ps-results .ps-table { display: block; background: none; margin-top: 12px; border-radius: 0; }
.ps-results .ps-table thead { display: none; }
.ps-results .ps-table tbody {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr));
    gap: 10px;
    align-items: start;
}
.ps-results .ps-table tbody tr,
.ps-results .ps-table tbody tr:hover,
.ps-results .ps-table tbody tr.active {
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr) auto auto;
    grid-template-areas:
        "foto model model podbor"
        "foto art   art   podbor"
        "foto cena  nal   shop"
        "sotr sotr  sotr  sotr";
    align-items: center;
    gap: 2px 12px;
    margin: 0;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    box-shadow: none;
    transition: border-color .15s, box-shadow .15s;
}
.ps-results .ps-table tbody tr:hover { border-color: #b9d3fb; box-shadow: 0 8px 20px -14px rgba(11, 45, 100, .5); }
.ps-results .ps-table tbody tr.active { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.ps-results .ps-table tbody tr > td,
.ps-results .ps-table tbody tr:hover > td,
.ps-results .ps-table tbody tr.active > td {
    display: block;
    width: auto;
    min-width: 0;
    max-width: none;
    min-height: 0;
    height: auto;
    flex: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    text-align: left;
    white-space: normal;
    font-size: 14px;
}
.ps-results .ps-table tbody tr > td::before { content: none; display: none; }
.ps-results .ps-table tbody tr > td:nth-child(1) { grid-area: podbor; align-self: start; text-align: right; }
.ps-results .ps-table tbody tr > td:nth-child(2) { grid-area: foto; align-self: center; }
.ps-results .ps-table tbody tr > td:nth-child(3) { grid-area: art; align-self: start; font-size: 12px; color: var(--muted); }
.ps-results .ps-table tbody tr > td:nth-child(4) { grid-area: model; align-self: end; font-size: 14.5px; font-weight: 700; line-height: 1.3; }
.ps-results .ps-table tbody tr > td:nth-child(5) { grid-area: cena; margin-top: 6px; font-size: 16px; font-weight: 800; white-space: nowrap; }
.ps-results .ps-table tbody tr > td:nth-child(6) { grid-area: nal; margin-top: 6px; }
.ps-results .ps-table tbody tr > td:nth-child(7) { grid-area: shop; margin-top: 6px; text-align: right; font-size: 13px; white-space: nowrap; }
.ps-results .ps-table tbody tr > td.ps-sotr-td { grid-area: sotr; margin-top: 6px; }
.ps-results .ps-table tbody tr > td.ps-sotr-td .ps-sotr { margin-top: 8px; }
.ps-results .ps-table img { display: block; width: 60px !important; height: 60px !important; }
.ps-results .ps-sotr-btn { display: inline-block; margin: 0; }

/* Панель сотрудника в карточке: колонки по ширине карточки, без реакции на наведение */
.ps-sotr { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; text-align: left; }
.ps-sotr__kol { padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.ps-sotr__zag { text-align: left; }
.ps-sotr__str { font-size: 13px; }

/* Телефон: подбор — строкой под артикулом, ниже — цена, наличие и ссылка */
@media (max-width: 600px) {
    .ps-results { padding: 14px; }
    .ps-results .ps-table tbody tr,
    .ps-results .ps-table tbody tr:hover,
    .ps-results .ps-table tbody tr.active {
        grid-template-columns: 52px minmax(0, 1fr) auto auto;
        grid-template-areas:
            "foto   model  model  model"
            "foto   art    art    art"
            "foto   podbor podbor podbor"
            "cena   cena   nal    shop"
            "sotr   sotr   sotr   sotr";
        padding: 10px 12px;
        gap: 3px 10px;
    }
    .ps-results .ps-table img { width: 52px !important; height: 52px !important; }
    .ps-results .ps-table tbody tr > td:nth-child(1) {
        display: flex; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; align-items: center; gap: 2px 8px; text-align: left; align-self: center;
    }
    .ps-results .ps-podbor__st, .ps-results .ps-podbor__h { margin: 0; }
    .ps-results .ps-table tbody tr > td:nth-child(4) { font-size: 14px; }
    .ps-results .ps-table tbody tr > td:nth-child(5) { font-size: 15px; margin-top: 8px; }
    .ps-results .ps-table tbody tr > td:nth-child(6),
    .ps-results .ps-table tbody tr > td:nth-child(7) { margin-top: 8px; }
    .ps-nal { font-size: 12px; padding: 3px 8px; }
}
/* Ссылка на товар — ссылкой, а не большой кнопкой (мобильные стили style.css) */
.ps-results .ps-table tbody tr > td.ps-shop a {
    display: inline; width: auto; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none;
    color: var(--brand) !important; font-size: 13px; font-weight: 700;
}
.ps-analog-link { white-space: nowrap; max-width: none; width: auto; overflow: visible; }

/* Телефон: форма в две колонки (тип, способ ввода, расчёт, мощность, кнопки — во всю ширину) */
@media (max-width: 768px) {
    html .ps-controls { padding: 12px; gap: 8px; }
    html .ps-controls .ps-field { flex: 1 1 calc(50% - 4px); }
    html .ps-controls .ps-field-type,
    html .ps-controls #ps-input-mode,
    html .ps-controls .ps-field-power,
    html .ps-controls .ps-field-btn { flex: 1 1 100%; }
    html .ps-controls #ps-calc-block { flex: 1 1 100%; }
    .ps-calc-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    /* Шапка подбора: заголовок, под ним — кнопки строкой */
    .ps-header { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; align-items: center; gap: 8px; text-align: left; }
    .ps-header h1 { order: -1; flex: 1 1 100%; margin: 0 0 4px; font-size: 20px !important; text-align: left; }
    .ps-help-link, .ps-analog-link { padding: 6px 12px !important; font-size: 12.5px !important; width: auto !important; }
    .ps-analog-link.ps-locked { padding-right: 30px !important; }
    .ps-userbox { font-size: 13px; }
}

/* ===== Внутри сайта ===== */
html.vstroen, html.vstroen body { background: transparent; min-height: 0; height: auto; }
html.vstroen body { max-width: none; padding: 0; overflow: hidden; }
html.vstroen .ps-logos-desktop, html.vstroen .ps-logos-mobile, html.vstroen #pwa-install { display: none !important; }
html.vstroen .ps-header { margin-bottom: 16px; }
html.vstroen .ps-header h1 { font-size: 26px; }
