/* KRISTAL × Kravio design system
   Source: mockup Kravio dashboard — Inter, canvas #FFFFFF (exact swatch),
   charcoal primary #1A1D1F, cards 16px, controls 12px, pills 999px.
   Pixel tokens sampled from PNG + letterform check (Inter). */

:root {
    color-scheme: light;

    --color-bg: #ffffff;
    --color-bg-2: #f8f8f8;
    --color-surface: #ffffff;
    --color-surface-raised: #ffffff;
    --color-border: #e5e7eb;
    --color-border-strong: #d0d5dd;
    --color-text: #101828;
    --color-text-muted: #667085;
    --color-text-faint: #98a2b3;

    --color-accent: #1a1d1f;
    --color-accent-hover: #101828;
    --color-accent-rgb: 26, 29, 31;
    --color-link: #101828;
    --color-link-hover: #344054;

    --color-chart-blue: #1a1d1f;
    --color-chart-orange: #d97706;
    --color-chart-idle: #eeeeee;

    --color-success: #059669;
    --color-danger: #e11d48;
    --color-danger-bg: rgba(225, 29, 72, 0.08);
    --color-star: #d97706;

    --color-topbar-bg: #ffffff;
    --color-topbar-text: #101828;
    --color-topbar-muted: #667085;
    --color-topbar-border: #e5e7eb;

    --color-zebra: rgba(16, 24, 40, 0.02);
    --color-row-hover: rgba(16, 24, 40, 0.035);

    --elevation-shadow: 0 12px 32px rgba(16, 24, 40, 0.12);
    --elevation-shadow-soft: 0 1px 2px rgba(16, 24, 40, 0.05);

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: 160ms var(--ease-out);
    --transition-base: 200ms var(--ease-out);

    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    --text-heading: 20px;
    --text-subheading: 15px;
    --text-body: 14px;
    --text-caption: 12px;

    /* Закругления с мокапа Kravio (Latest Updates):
       card 16px · controls/inputs 12px · pills 999px · fine 8px */
    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --radius-pill: 999px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
}

[data-theme=dark] {
    color-scheme: dark;

    --color-bg: #121314;
    --color-bg-2: #1a1c1e;
    --color-surface: #1e2023;
    --color-surface-raised: #26292d;
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-strong: rgba(255, 255, 255, 0.16);
    --color-text: #f5f5f5;
    --color-text-muted: #98a2b3;
    --color-text-faint: #667085;

    --color-accent: #f5f5f5;
    --color-accent-hover: #ffffff;
    --color-accent-rgb: 245, 245, 245;
    --color-link: #f5f5f5;
    --color-link-hover: #d0d5dd;

    --color-chart-blue: #e5e7eb;
    --color-chart-orange: #f59e0b;
    --color-chart-idle: rgba(255, 255, 255, 0.12);

    --color-success: #34d399;
    --color-danger: #fb7185;
    --color-danger-bg: rgba(251, 113, 133, 0.14);
    --color-star: #fbbf24;

    --color-topbar-bg: #1e2023;
    --color-topbar-text: #f5f5f5;
    --color-topbar-muted: #98a2b3;
    --color-topbar-border: rgba(255, 255, 255, 0.08);

    --color-zebra: rgba(255, 255, 255, 0.03);
    --color-row-hover: rgba(255, 255, 255, 0.05);

    --elevation-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    --elevation-shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.35);
}

[data-theme=light] {
    color-scheme: light;

    --color-bg: #ffffff;
    --color-bg-2: #f8f8f8;
    --color-surface: #ffffff;
    --color-surface-raised: #ffffff;
    --color-border: #e5e7eb;
    --color-border-strong: #d0d5dd;
    --color-text: #101828;
    --color-text-muted: #667085;
    --color-text-faint: #98a2b3;

    --color-accent: #1a1d1f;
    --color-accent-hover: #101828;
    --color-accent-rgb: 26, 29, 31;
    --color-link: #101828;
    --color-link-hover: #344054;

    --color-chart-blue: #1a1d1f;
    --color-chart-orange: #d97706;
    --color-chart-idle: #eeeeee;

    --color-success: #059669;
    --color-danger: #e11d48;
    --color-danger-bg: rgba(225, 29, 72, 0.08);
    --color-star: #d97706;

    --color-topbar-bg: #ffffff;
    --color-topbar-text: #101828;
    --color-topbar-muted: #667085;
    --color-topbar-border: #e5e7eb;

    --color-zebra: rgba(16, 24, 40, 0.02);
    --color-row-hover: rgba(16, 24, 40, 0.035);

    --elevation-shadow: 0 12px 32px rgba(16, 24, 40, 0.12);
    --elevation-shadow-soft: 0 1px 2px rgba(16, 24, 40, 0.05);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    font-size: var(--text-body);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    position: relative;
    /* Резерв под скроллбар: иначе при /search → /lot шапка дёргается. */
    scrollbar-gutter: stable;
}

.page {
    max-width: 1160px;
    margin: 0 auto;
    /* Сверху как у .page--shell: .top-bar тянет себя на -space-2,
       иначе на /lot|/customer остаётся «пустой» зазор над шапкой. */
    padding: var(--space-2) var(--space-5) var(--space-7);
}

.page--wide { max-width: 1680px; }

/* --- Экран /search целиком в один вьюпорт, без скролла страницы (п.2 ТЗ):
   body.app-shell фиксирует высоту в 100vh и запрещает собственный скролл,
   .page--shell растягивается на всю высоту флекс-колонкой — шапка/поиск/
   фильтры-профили не двигаются, скроллится только сама таблица результатов
   (.results-table-wrap, см. ниже) внутри #results-container. --- */
body.app-shell {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.page--shell {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
}

/* /search: шапка на всю ширину, фильтры — rail слева под ней. */
.page--dock {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.search-dock {
    display: flex;
    flex: 1;
    min-height: 0;
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

.search-dock__main {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #e7e6e4;
    padding: var(--space-2) var(--space-5) var(--space-2);
}

[data-theme=dark] .search-dock__main {
    background: var(--color-bg);
}

.page--dock .top-bar {
    flex-shrink: 0;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
}

a { color: var(--color-link); text-decoration: none; transition: color var(--transition-fast); }
a:hover { text-decoration: underline; color: var(--color-link-hover); }

/* --- Панели-контейнеры: белые карточки + мягкая тень, без градиентов ----- */

.filter-section,
.facet,
.filters-form__chips,
.modal-dialog,
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--elevation-shadow-soft);
    transition: background var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
}

.card:hover {
    background: var(--color-bg-2);
}

/* --- Header --- */

.top-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--space-4);
    padding: 12px var(--space-5);
    margin: calc(-1 * var(--space-2)) calc(-1 * var(--space-5)) var(--space-3);
    border-bottom: 1px solid var(--color-topbar-border);
    background: var(--color-topbar-bg);
    color: var(--color-topbar-text);
    min-height: 0;
    flex-shrink: 0;
    box-shadow: var(--elevation-shadow-soft);
}

.brand {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--color-topbar-text);
    margin: 0;
}
.brand:hover { text-decoration: none; color: var(--color-topbar-text); }

.top-bar__back {
    flex-shrink: 0;
    text-decoration: none;
}

.top-bar__search {
    flex: 1;
    min-width: 0;
    margin: 0;
}

.top-bar__nav {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-body);
    color: var(--color-topbar-muted);
    margin-left: auto;
    flex-shrink: 0;
}

/* --- Аватар: сразу в личный кабинет --- */

a.avatar-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: var(--color-accent);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    text-decoration: none;
    transition: filter var(--transition-fast);
}
a.avatar-btn:hover {
    filter: brightness(1.1);
    color: #fff;
    text-decoration: none;
}

.account-logout {
    /* Компактный блок в правом нижнем углу страницы аккаунта */
    width: fit-content;
    max-width: min(260px, 100%);
    margin-left: auto;
    margin-top: var(--space-5);
    padding: 14px 16px;
    box-sizing: border-box;
}
.account-logout__row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}
.account-logout__title {
    margin: 0 0 2px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
}
.account-logout__email {
    margin: 0;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.account-logout__btn {
    width: 100%;
    color: var(--color-danger);
    border-color: color-mix(in srgb, var(--color-danger) 35%, var(--color-border));
}
.account-logout__btn:hover {
    background: color-mix(in srgb, var(--color-danger) 10%, transparent);
    border-color: var(--color-danger);
    color: var(--color-danger);
}

/* --- Формы: секции-аккордеон --- */

/* Компактнее и в 2 колонки на десктопе — 5 секций в один столбец занимали
   слишком много вертикали (фидбек). .form-actions явно выведена на всю
   ширину (grid-column: 1/-1), иначе кнопка "Найти" встала бы в свободную
   клетку рядом с последней (нечётной) секцией. */
.filters-form {
    display: block;
}

#filters-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3) var(--space-4);
}

@media (min-width: 960px) {
    #filters-body { grid-template-columns: 1fr 1fr; }
}

.filter-section {
    overflow: hidden;
}

.filter-section > summary {
    list-style: none;
    cursor: pointer;
    padding: var(--space-3) var(--space-4);
    font-weight: 600;
    font-size: var(--text-subheading);
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.filter-section > summary::-webkit-details-marker { display: none; }

.filter-section > summary::after {
    content: "+";
    color: var(--color-text-faint);
    font-weight: 400;
    font-size: 16px;
    transition: transform var(--transition-fast);
}

.filter-section[open] > summary::after { content: "\2212"; /* − */ }

.filter-section[open] > summary { border-bottom: 1px solid var(--color-border); }

.filter-section__body {
    padding: var(--space-4);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3) var(--space-4);
}

/* min-width: 0 обязателен — иначе grid-item берёт intrinsic min-width по
   содержимому, а у select[multiple] с регионами среди options попадаются
   полные адреса на 100+ символов: без этого одна колонка распирает сетку
   до ~15000px, а соседние схлопываются в 0 (см. историю проверки в браузере). */
.field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.field--span2 { grid-column: span 2; }
.field--span3 { grid-column: span 3; }

.field > label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.field__hint { font-size: 12px; color: var(--color-text-faint); }

/* --- Дерево ОКПД2 (фильтр include/exclude) --- */
.okpd2-tree {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.okpd2-tree__toggle {
    font: inherit;
    font-size: 13px;
    text-align: left;
    padding: 7px 10px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
}

.okpd2-tree__toggle:hover {
    border-color: var(--color-border-strong);
}

.okpd2-tree__toggle[aria-expanded="true"] {
    border-color: var(--color-accent);
}

.okpd2-tree__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.okpd2-tree__chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    max-width: 100%;
    font-size: 12px;
    padding: 2px 4px 2px 8px;
    border-radius: var(--radius-pill);
    background: var(--color-border-strong);
    color: var(--color-text);
}

.okpd2-tree__chip button {
    all: unset;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    color: var(--color-text-muted);
}

.okpd2-tree__chip button:hover { color: inherit; }

/* Чипы ключевых слов (обязательные / любое / исключить) */
.word-chips {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.word-chips__input {
    width: 100%;
}

.word-chips__list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.word-chips__list[hidden] {
    display: none;
}

.word-chips__chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    max-width: 100%;
    padding: 1px 2px 1px 7px;
    border-radius: var(--radius-pill);
    background: var(--color-bg-2);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 12px;
    line-height: 1.4;
    word-break: break-word;
}

.word-chips__remove {
    all: unset;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
    color: var(--color-text-faint);
    font-size: 14px;
}

.word-chips__remove:hover {
    color: var(--color-text);
}

.okpd2-tree__panel {
    position: fixed;
    z-index: 420;
    display: flex;
    flex-direction: column;
    width: min(340px, calc(100vw - 24px));
    max-height: min(360px, 55vh);
    padding: 8px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface-raised);
    box-shadow: var(--elevation-shadow);
    box-sizing: border-box;
}

.okpd2-tree__panel[hidden] { display: none; }

.okpd2-tree__search {
    width: 100%;
    box-sizing: border-box;
    font: inherit;
    font-size: 13px;
    padding: 6px 10px;
    margin-bottom: 6px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: inherit;
    flex-shrink: 0;
}

.okpd2-tree__list {
    overflow-y: auto;
    min-height: 0;
    flex: 1;
    scrollbar-width: thin;
}

.okpd2-tree__row,
.okpd2-tree__search-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 4px 4px;
    font-size: 12px;
    line-height: 1.35;
    border-radius: 4px;
}

.okpd2-tree__search-row {
    padding: 5px 6px;
    cursor: pointer;
}

.okpd2-tree__row:hover,
.okpd2-tree__search-row:hover {
    background: var(--color-border-strong);
}

.okpd2-tree__twist {
    all: unset;
    box-sizing: border-box;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: 16px;
    line-height: 1;
    margin-top: -1px;
}

.okpd2-tree__twist--empty {
    cursor: default;
    visibility: hidden;
}

.okpd2-tree__cb {
    margin-top: 2px;
    flex-shrink: 0;
}

.okpd2-tree__label {
    min-width: 0;
    color: var(--color-text);
}

.okpd2-tree__label code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    color: var(--color-text-muted);
}

.okpd2-tree__empty {
    padding: 10px 6px;
    font-size: 12px;
    color: var(--color-text-muted);
}

/* Подсказки «?» у полей фильтров — всплывашка через JS (position:fixed),
   т.к. .facet { overflow:hidden } обрезает абсолютные тултипы внутри. */
.field__tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-border-strong);
    color: var(--color-text-muted);
    font-size: 10px;
    line-height: 1;
    cursor: help;
    margin-left: 5px;
    vertical-align: middle;
    flex-shrink: 0;
    border: none;
    padding: 0;
    font-family: inherit;
    position: relative;
    top: -2px;
}

.field__tip:hover,
.field__tip:focus-visible {
    color: var(--color-text);
    background: var(--color-border);
    outline: none;
}

.field-tip-popup {
    position: fixed;
    z-index: 500;
    max-width: min(320px, calc(100vw - 24px));
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--color-text);
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    box-shadow: var(--elevation-shadow);
    pointer-events: none;
    box-sizing: border-box;
}

.field-tip-popup[hidden] { display: none; }

/* "Барьерный слой" под текстом полей ввода: инпуты лежат поверх стеклянной
   панели, но сами остаются СПЛОШНЫМИ — иначе текст ввода терялся бы на
   полупрозрачном фоне (см. правило "не под текстом" в ТЗ). */
input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="password"],
select {
    font-family: inherit;
    font-size: 14px;
    color: var(--color-text);
    padding: 7px 10px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    accent-color: var(--color-accent);
}

input::placeholder { color: var(--color-text-faint); }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(var(--color-accent-rgb), 0.12);
}

[data-theme=dark] input:focus,
[data-theme=dark] select:focus,
[data-theme=dark] textarea:focus,
:root:not([data-theme=light]) input:focus,
:root:not([data-theme=light]) select:focus,
:root:not([data-theme=light]) textarea:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.10);
}

select[multiple] { min-height: 104px; }

select option { background: var(--color-surface); color: var(--color-text); }

.range-pair { display: flex; align-items: center; gap: var(--space-2); }
.range-pair input { flex: 1; min-width: 0; }
.range-pair span { color: var(--color-text-faint); font-size: 12px; }

.checkbox-row { display: flex; align-items: center; gap: var(--space-2); font-size: 13px; }
.checkbox-group { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
.checkbox-group label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 400; text-transform: none; color: var(--color-text); }
.checkbox-group input, .checkbox-row input { accent-color: var(--color-accent); }

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    padding-top: var(--space-2);
}

/* (sticky full-width «Найти» — см. .filters-sidebar .form-actions ниже) */

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

.btn {
    font-family: inherit;
    font-size: var(--text-body);
    font-weight: 600;
    padding: 10px 16px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface-raised);
    color: var(--color-text);
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.btn:hover { border-color: var(--color-text-faint); background: var(--color-bg-2); }

.btn-primary {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #ffffff;
}

.btn-primary:hover { background: var(--color-accent-hover); border-color: var(--color-accent-hover); color: #ffffff; }

[data-theme=light] .btn-primary {
    color: #ffffff;
}

/* В тёмной теме акцент светлый — текст на кнопке тёмный. */
[data-theme=dark] .btn-primary {
    color: #101828;
}
[data-theme=dark] .btn-primary:hover { color: #101828; }

.btn-ghost {
    border-color: transparent;
    background: transparent;
    color: var(--color-text-muted);
}

.btn-ghost:hover { color: var(--color-text); border-color: transparent; text-decoration: underline; }

/* --- Результаты --- */

.results-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    flex-shrink: 0;
    min-height: 32px;
    width: auto;
    box-sizing: border-box;
}

.results-footer__left {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 0;
    padding-right: 0;
}

.results-footer__left:empty { display: none; }

.results-footer .pagination {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.results-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: 0;
    flex-shrink: 0;
}

.results-count { font-size: 13px; color: var(--color-text-muted); white-space: nowrap; }
.results-count strong { color: var(--color-text); font-weight: 600; }

/* Пилюля «Найдено N категорий» справа от архива */
.facet-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface-raised);
    color: var(--color-text);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    box-sizing: border-box;
    flex-shrink: 1;
    min-width: 0;
    max-width: min(260px, 42vw);
}
.facet-pill > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
}
.facet-pill:hover { border-color: var(--color-accent); }
.facet-pill[aria-expanded="true"],
.facet-pill--active {
    border-color: var(--color-accent);
    background: color-mix(in srgb, var(--color-accent) 12%, transparent);
}
.facet-pill__badge {
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: var(--radius-pill);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    background: var(--color-accent);
    color: #fff;
    flex-shrink: 0;
}
.facet-pill__chevron {
    width: 14px;
    height: 14px;
    opacity: .55;
    display: block;
    flex-shrink: 0;
}
.facet-cats-backdrop {
    position: fixed;
    inset: 0;
    z-index: 520;
    background: rgba(15, 18, 28, .28);
}
.facet-cats-backdrop[hidden],
.facet-cats-popup[hidden] { display: none !important; }
.facet-cats-popup {
    position: fixed;
    z-index: 530;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(440px, calc(100vw - 24px));
    max-height: min(72vh, 560px);
    display: flex;
    flex-direction: column;
    padding: 0;
    border-radius: var(--radius);
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface-raised);
    box-shadow: var(--elevation-shadow);
    box-sizing: border-box;
    overflow: hidden;
}
.facet-cats-popup__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 14px 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
}
.facet-cats-popup__close {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.facet-cats-popup__close:hover {
    background: var(--color-border);
    color: var(--color-text);
}
.facet-cats-popup__search {
    margin: 10px 14px 0;
    width: calc(100% - 28px);
    box-sizing: border-box;
    font: inherit;
    font-size: 13px;
    padding: 8px 10px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: inherit;
}
.facet-cats-popup__search:focus {
    outline: none;
    border-color: var(--color-accent);
}
.facet-cats-popup__list {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 8px 8px 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.facet-cats-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 13px;
    color: var(--color-text);
}
.facet-cats-row:hover { background: var(--color-border); }
.facet-cats-row[hidden] { display: none; }
.facet-cats-row input {
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--color-accent);
}
.facet-cats-row__body { min-width: 0; flex: 1; }
.facet-cats-row__name { display: block; line-height: 1.35; }
.facet-cats-row__meta {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}
.facet-cats-popup__empty {
    padding: 24px 14px;
    text-align: center;
    font-size: 13px;
    color: var(--color-text-muted);
}
.facet-cats-popup__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px 14px;
    border-top: 1px solid var(--color-border);
}
.facet-cats-popup__foot-left {
    font-size: 12px;
    color: var(--color-text-muted);
}
.facet-cats-popup__actions { display: flex; gap: 8px; }
.facet-cats-btn {
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: var(--radius-xs);
    border: 0;
    cursor: pointer;
    background: transparent;
}
.facet-cats-btn--ghost { color: var(--color-text-muted); }
.facet-cats-btn--ghost:hover { color: var(--color-text); }
.facet-cats-btn--primary {
    background: var(--color-accent);
    color: #fff;
}
.facet-cats-btn--primary:hover { filter: brightness(1.05); }

/* Круглая кнопка-иконка (экспорт, пагинация и т.п.) */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), opacity var(--transition-fast);
}
.icon-btn svg { width: 16px; height: 16px; display: block; }
.icon-btn:hover {
    border-color: var(--color-border-strong);
    color: var(--color-text);
    text-decoration: none;
}
.icon-btn[aria-pressed="true"] {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}

.icon-btn:disabled,
.icon-btn[aria-busy="true"] {
    opacity: 0.55;
    cursor: wait;
    pointer-events: none;
}

/* Архив отклонённых (вердикт «не наш») — кнопка справа от экспорта/выбора */
.archive-btn-wrap {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    overflow: visible;
}

.archive-btn {
    position: relative;
    overflow: visible;
}

.archive-btn__badge {
    position: absolute;
    top: -6px;
    right: -6px;
    z-index: 1;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: var(--radius-pill);
    background: var(--color-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    box-sizing: border-box;
    pointer-events: none;
}

/* fixed + JS-якорь к кнопке: absolute внутри .profile-tabs /
   .search-dock { overflow } срезает попап «внутрь» выдачи. */
.archive-popup {
    position: fixed;
    z-index: 530;
    width: min(360px, calc(100vw - 24px));
    max-height: min(320px, 50vh);
    display: flex;
    flex-direction: column;
    padding: 10px;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    box-shadow: var(--elevation-shadow);
    box-sizing: border-box;
}

.archive-popup[hidden] { display: none; }

.archive-popup__head {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
    margin-bottom: 8px;
    flex-shrink: 0;
}

.archive-popup__list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
}

.archive-popup__item {
    display: block;
    padding: 7px 8px;
    font-size: 13px;
    line-height: 1.35;
    color: var(--color-text);
    text-decoration: none;
    border-radius: var(--radius-xs);
    transition: background var(--transition-fast);
}

.archive-popup__item:hover {
    background: var(--color-border-strong);
    text-decoration: none;
    color: var(--color-text);
}

.archive-popup__empty {
    padding: 8px;
    font-size: 13px;
    color: var(--color-text-muted);
}

/* Пилюля «сортировать по» справа от архива */
.sort-pill-wrap {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    overflow: visible;
}

.sort-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-border);
    background: var(--color-surface-raised);
    color: var(--color-text-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    box-sizing: border-box;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}
.sort-pill:hover {
    border-color: var(--color-border-strong);
    color: var(--color-text);
}
.sort-pill[aria-expanded="true"] {
    border-color: var(--color-border-strong);
    color: var(--color-text);
    background: var(--color-bg-2);
}
.sort-pill__chevron {
    width: 14px;
    height: 14px;
    opacity: 0.55;
    flex-shrink: 0;
}
.sort-pill[aria-expanded="true"] .sort-pill__chevron {
    transform: rotate(180deg);
}

.sort-pill-popup {
    position: fixed;
    z-index: 530;
    min-width: 180px;
    max-width: min(280px, calc(100vw - 24px));
    display: flex;
    flex-direction: column;
    padding: 6px;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    box-shadow: var(--elevation-shadow);
    box-sizing: border-box;
}
.sort-pill-popup[hidden] { display: none; }

.sort-pill-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--color-text);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}
.sort-pill-option:hover {
    background: var(--color-bg-2);
}
.sort-pill-option--active {
    font-weight: 600;
}
.sort-pill-option__dir {
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 600;
}

/* Таблица данных — намеренно СПЛОШНАЯ подложка, без стекла и без blur:
   dense dataset с цифрами, читаемость важнее эффекта (см. ТЗ и header). */
.results-table-wrap {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    align-self: stretch;
    box-shadow: var(--elevation-shadow-soft);
}

table.results {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-body);
    line-height: 1.5;
}

table.results th, table.results td {
    padding: 12px 14px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--color-border);
}

table.results th {
    background: var(--color-bg-2);
    color: var(--color-text-muted);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

table.results th a { color: inherit; }
table.results th a:hover { color: var(--color-text); text-decoration: none; }

table.results tbody tr { transition: background var(--transition-fast); }
table.results tbody tr:nth-child(even) { background: var(--color-zebra); }
table.results tbody tr:hover { background: var(--color-row-hover); }
table.results tbody tr[data-href] { cursor: pointer; }
table.results tbody tr:last-child td { border-bottom: none; }

.col-price { white-space: nowrap; }
/* НЕ nowrap: "просрочено: N дней назад" (см. web/app.py) на минимальной
   ширине колонки шире 130-150px — c nowrap текст вылезал за пределы
   ячейки и наезжал на соседнюю колонку (ОКПД2), особенно заметно на
   /customer, где своя colgroup чуть уже. Перенос в 2 строки безопаснее
   раздувания колонки под самую длинную строку. */
.col-days { white-space: normal; }
.col-star { text-align: center; width: 40px; }
.col-priority { text-align: center; width: 48px; }

.row--urgent .col-deadline,
.row--urgent .col-days { color: var(--color-danger); font-weight: 600; }

.priority-badge {
    display: inline-block;
    min-width: 20px;
    padding: 1px 6px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    background: var(--color-bg-2);
    border: 1px solid var(--color-border-strong);
    color: var(--color-text-muted);
}

/* Приоритет/вердикт — не декоративный акцент, а сигнал (см. ответ в чате):
   держим их приглушённо-пастельными, а не в цвете кнопок/ссылок, чтобы
   акцент оставался единственным "ярким" цветом интерфейса. */
.priority-badge--3 { background: rgba(72, 187, 120, 0.16); border-color: rgba(72, 187, 120, 0.4); color: var(--color-success); }
.priority-badge--2 { background: var(--color-surface-raised); border-color: var(--color-border-strong); color: var(--color-text); }
.priority-badge--1 { background: var(--color-bg-2); border-color: var(--color-border); color: var(--color-text-muted); }
/* --color-text-faint не проходил WCAG AA на этом фоне в обеих темах
   (~3.8:1 тёмная / ~2.7:1 светлая при пороге 4.5:1 для некрупного текста,
   см. .impeccable/critique) — --color-text-muted даёт ~6.9:1 / ~5.7:1,
   визуально всё ещё самый приглушённый бейдж (делит цвет с приоритетом 1,
   различаются самой цифрой внутри). */
.priority-badge--0 { background: var(--color-bg-2); border-color: var(--color-border); color: var(--color-text-muted); }

.star-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 2px;
    color: var(--color-border-strong);
    transition: color var(--transition-fast), opacity var(--transition-fast);
}

/* ★ видна при наведении на строку/карточку (или если уже в избранном). */
table.results tbody .star-btn,
.lot-card .star-btn {
    opacity: 0;
    font-size: 22px;
}
table.results tbody tr:hover .star-btn,
table.results tbody tr:focus-within .star-btn,
table.results tbody .star-btn--active,
.lot-card:hover .star-btn,
.lot-card:focus-within .star-btn,
.lot-card .star-btn--active {
    opacity: 1;
}

.star-btn:hover { color: var(--color-star); }
.star-btn--active { color: var(--color-star); }
.star-btn:disabled {
    cursor: not-allowed;
    opacity: 0.85;
}

/* Без ограничения по строкам "Описание"/ОКПД2/"Заказчик" иногда растягивали
   строку таблицы на 8-10 строк текста — из-за этого и выглядело неровно
   ("выровнять по вертикали" в фидбеке). Клэмп на 2 строки + vertical-align:
   middle выше делают высоту строк предсказуемой; полный текст — в title.
   display:-webkit-box не приживается прямо на <td> (браузер "чинит" его
   обратно в table-cell в контексте таблицы) — поэтому клэмп на вложенном
   div (.cell-clamp), а не на самой ячейке. */
.customer-cell, .title-cell, .okpd2-cell, .description-cell { max-width: 220px; }
.title-cell { max-width: 260px; }
.cell-clamp {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}
.title-cell__hint { font-size: 14px; font-weight: 600; color: var(--color-text); margin-top: 2px; }
.okpd2-cell { color: var(--color-text-muted); font-size: 12px; }
.description-cell { max-width: 320px; color: var(--color-text-muted); font-size: 12px; }
.col-date { white-space: nowrap; color: var(--color-text-muted); }
.col-verdict { white-space: nowrap; }

.verdict-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-border-strong);
    background: var(--color-bg-2);
    color: var(--color-text-muted);
}
.verdict-tag[data-verdict="наш"] { background: rgba(140, 200, 120, 0.16); border-color: rgba(140, 200, 120, 0.4); color: #9fd68a; }
.verdict-tag[data-verdict="не наш"] { background: rgba(255, 107, 107, 0.14); border-color: rgba(255, 107, 107, 0.4); color: #ff9a9a; }
.verdict-tag[data-verdict="не актуально"] { background: rgba(224, 171, 46, 0.16); border-color: rgba(224, 171, 46, 0.4); color: #e7c069; }

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin: 0;
    font-size: var(--text-body);
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.pagination__status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 1px;
    box-sizing: border-box;
    height: 28px;
    min-width: max-content;
    padding: 0 8px;
    text-align: center;
    font-size: var(--text-subheading);
    font-weight: 500;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: visible;
    cursor: pointer;
    border-radius: 8px;
    transition: background var(--transition-fast);
    flex-shrink: 0;
    vertical-align: middle;
}

.pagination__status:hover {
    background: var(--color-bg-2);
}

.pagination__status:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 1px;
}

.pagination__status.is-editing {
    cursor: default;
    background: transparent;
    padding: 0 2px;
}

/* Маленькое окошко: text, без spinner'ов type=number — иначе раздувает тулбар.
   Ширину задаёт JS по длине текущего значения (не под max pages вроде 3268). */
.pagination__input {
    -moz-appearance: textfield;
    appearance: textfield;
    width: 1.85em;
    max-width: 4.5em;
    height: 24px;
    padding: 0 4px;
    margin: 0;
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
    background: var(--color-surface-raised);
    color: var(--color-text);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 22px;
    text-align: center;
    box-sizing: border-box;
    flex: 0 0 auto;
}

.pagination__input::-webkit-outer-spin-button,
.pagination__input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pagination__input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-accent) 18%, transparent);
}

.pagination__status-total {
    font-weight: 500;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}

.pagination__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    background: var(--color-surface);
    color: var(--color-text);
    text-decoration: none;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.pagination__btn svg { width: 16px; height: 16px; display: block; }

.pagination__btn:hover {
    border-color: var(--color-border-strong);
    color: var(--color-text);
    text-decoration: none;
}

.pagination__btn.disabled,
.pagination .disabled {
    color: var(--color-text-faint);
    border-color: var(--color-border);
    background: transparent;
    pointer-events: none;
}

.empty-state {
    padding: var(--space-7) var(--space-5);
    text-align: center;
    color: var(--color-text-muted);
    width: 100%;
    box-sizing: border-box;
}

/* --- Карточка лота (/lot/{id}) и заказчика (/customer/{inn}) --- */

.lot-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.lot-header h2 { font-size: var(--text-heading); margin: 0 0 6px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; }
.lot-header__no-title { color: var(--color-text-muted); font-style: italic; font-weight: 500; }
.lot-header__meta { font-size: 13px; color: var(--color-text-muted); }
.lot-header .btn { white-space: nowrap; }

.lot-columns {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-5);
    align-items: start;
    min-width: 0;
}

.card {
    padding: var(--space-5);
    margin-bottom: var(--space-4);
    min-width: 0;
}

.card h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
    margin: 0 0 var(--space-4);
}

.kv__row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: var(--text-body);
}
.kv__row:last-child { border-bottom: none; }
.kv__label { color: var(--color-text-muted); flex-shrink: 0; }
.kv__value { text-align: right; font-weight: 500; color: var(--color-text); }

/* Второстепенные поля (регион, признак organizer_fallback) — мельче и
   приглушённее: они не должны спорить за внимание с заказчиком/ценой/
   дедлайном (см. фидбек про визуальную иерархию). */
.kv__row--secondary { font-size: var(--text-caption); padding: 6px 0; }
.kv__row--secondary .kv__value { font-weight: 400; color: var(--color-text-muted); }

.text-danger { color: var(--color-danger); font-weight: 600; }

.badge-warning {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: rgba(224, 171, 46, 0.16);
    border: 1px solid rgba(224, 171, 46, 0.4);
    color: #e7c069;
}

.lot-description { white-space: pre-wrap; font-size: 14px; line-height: 1.6; margin: 0; }

.plain-list, .doc-list, .similar-list, .comment-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}

.comment-form { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); }
.comment-form textarea {
    font-family: inherit;
    font-size: 13px;
    color: var(--color-text);
    padding: 8px 10px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    resize: vertical;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.comment-form .btn { align-self: flex-end; }

.comment-item { padding-top: var(--space-3); border-top: 1px solid var(--color-border); }
.comment-item:first-child { padding-top: 0; border-top: none; }
.comment-item__meta { display: flex; align-items: center; gap: var(--space-3); font-size: 12px; color: var(--color-text-muted); margin-bottom: 4px; }
.comment-item__text { font-size: 13px; white-space: pre-wrap; }

.btn-link-danger {
    background: none;
    border: none;
    padding: 0;
    font-size: 12px;
    color: var(--color-danger);
    cursor: pointer;
    text-decoration: underline;
}

.actions { display: flex; flex-direction: column; gap: var(--space-3); }
.actions form { margin: 0; }
.actions-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-2);
    width: 100%;
}
.actions-row form {
    display: flex;
    min-width: 0;
}
.actions-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 36px;
    padding: 8px 0;
    margin: 0;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface-raised);
    color: var(--color-text);
    cursor: pointer;
    line-height: 1;
    text-align: center;
    transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}
.actions .star-btn {
    font-size: 18px;
    gap: 0;
}
.actions .star-btn:hover { color: var(--color-star); }
.actions-hide .btn { width: 100%; }

/* Документы справа под «Действия» — тот же карточный блок, длинные имена обрезаем */
.doc-list--side {
    gap: 8px;
}
.doc-list--side li { min-width: 0; }
.doc-list--side a {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 500;
}

/* ОКПД2 справа под документами — компактный блок, код + название */
.okpd2-list--side {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.okpd2-list--side li {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.okpd2-list__code {
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--color-text);
}
.okpd2-list__name {
    font-size: 12px;
    line-height: 1.35;
    color: var(--color-text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.verdict-btn {
    font-size: 16px;
    font-weight: 600;
}
.verdict-btn[data-verdict="не актуально"] {
    font-size: 20px;
    font-weight: 500;
}
.verdict-btn--active[data-verdict="наш"] { background: rgba(140, 200, 120, 0.16); border-color: rgba(140, 200, 120, 0.4); color: #9fd68a; }
.verdict-btn--active[data-verdict="не наш"] { background: rgba(255, 107, 107, 0.14); border-color: rgba(255, 107, 107, 0.4); color: #ff9a9a; }
.verdict-btn--active[data-verdict="не актуально"] { background: rgba(224, 171, 46, 0.16); border-color: rgba(224, 171, 46, 0.4); color: #e7c069; }

.similar-list li { padding-bottom: var(--space-3); border-bottom: 1px solid var(--color-border); }
.similar-list li:last-child { border-bottom: none; padding-bottom: 0; }
.muted { color: var(--color-text-faint); font-size: 12px; }

.summary-card {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-6);
    margin-bottom: var(--space-2);
}
.summary-card__stat { min-width: 120px; }
.summary-card__stat-value { font-size: 20px; font-weight: 600; }
.summary-card__stat-label { font-size: 12px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.02em; }

@media (max-width: 900px) {
    .lot-columns { grid-template-columns: 1fr; }
    .filter-section__body { grid-template-columns: repeat(2, 1fr); }
    .field--span3 { grid-column: span 2; }
}

@media (max-width: 620px) {
    .filter-section__body { grid-template-columns: 1fr; }
    .field--span2, .field--span3 { grid-column: span 1; }
}

/* --- Объединённая страница /search: чипы свёрнутых фильтров, статус
   живого поиска --- */

.filters-form__chips[hidden] { display: none; }

.filters-form__chips {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
    font-size: 13px;
    color: var(--color-text-muted);
}

.filters-form__chips:hover {
    background: var(--color-surface);
}

.search-status {
    font-size: 12px;
    color: var(--color-text-faint);
    margin-right: auto;
}

/* --- Блок 3: resizable-колонки, sticky header, тонкий scroll-индикатор --- */

/* table-layout: fixed обязателен — иначе ширина <col> игнорируется,
   колонки считаются по содержимому td/th (см. column-resize.js).
   width: max-content + min-width: 100% — колонки держат свои px-ширины
   и уезжают в горизонтальный скролл, а не схлопываются в узкий viewport. */
table.results {
    table-layout: fixed;
    width: max-content;
    min-width: 100%;
}

/* Минимальные ширины по колонкам (совпадают с data-min в colgroup). */
th[data-col="date"],
td.col-date { min-width: 120px; }
th[data-col="title"],
td.title-cell { min-width: 180px; }
th[data-col="verdict"],
td.col-verdict { min-width: 104px; }
th[data-col="description"],
td.description-cell { min-width: 180px; }
th[data-col="okpd2"],
td.okpd2-cell { min-width: 140px; }
th[data-col="customer"],
td.customer-cell { min-width: 140px; }
th[data-col="price"],
td.col-price { min-width: 100px; }
th[data-col="deadline"],
td.col-deadline { min-width: 140px; }
th[data-col="days"],
td.col-days { min-width: 110px; }
th[data-col="priority"],
td.col-priority { min-width: 64px; }
th[data-col="source"] { min-width: 110px; }

.results-table-wrap {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    /* Иначе при смене фильтров scrollbar то появляется, то исчезает —
       ширина выдачи прыгает на ~8px («окно сжимается»). */
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-strong) transparent;
    padding: 2px 2px var(--space-3);
}

/* Живой поиск: старые карточки остаются на месте (высота/скролл),
   пока не пришёл новый HTML — только приглушаем. */
#results-container.results-loading .lot-cards,
#results-container.results-loading table.results tbody {
    opacity: 0.45;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.results-table-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
.results-table-wrap::-webkit-scrollbar-track { background: transparent; }
.results-table-wrap::-webkit-scrollbar-thumb {
    background: var(--color-border-strong);
    border-radius: var(--radius-pill);
}
.results-table-wrap::-webkit-scrollbar-thumb:hover { background: var(--color-text-faint); }

table.results thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

th[data-col] { position: relative; }

.col-resize-handle {
    position: absolute;
    top: 0;
    right: -4px;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    z-index: 2;
    touch-action: none;
}

/* Видимая «палочка» по центру хит-зоны — всегда, не только на hover. */
.col-resize-handle::before {
    content: "";
    position: absolute;
    top: 18%;
    bottom: 18%;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    border-radius: 1px;
    background: var(--color-text-muted);
    opacity: 0.85;
    pointer-events: none;
}

.col-resize-handle:hover::before,
body.col-resizing .col-resize-handle::before {
    background: var(--color-accent);
    opacity: 1;
    width: 3px;
}

body.col-resizing { cursor: col-resize; user-select: none; }

/* max-width колонок описания/окпд2/заказчика/названия раньше были
   фиксированы в px — теперь их реальную ширину задаёт table-layout:fixed
   через <col> (resizable), поэтому внутренние ограничения убраны, чтобы
   не перебивать пользовательский resize. */
.customer-cell, .title-cell, .okpd2-cell, .description-cell { max-width: none; }

/* --- Профили фильтров (saved_searches): вкладки над формой + модалка
   сохранения --- */

.profile-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    margin-bottom: 0;
    flex: 1 1 auto;
    flex-shrink: 1;
    min-width: 0;
    width: auto;
    /* Запас под бейдж архива (top:-4px, h:16) — overflow-x:auto
       форсирует clip по Y, поэтому бейдж должен влезать в padding. */
    padding-top: 8px;
    padding-bottom: 2px;
    padding-left: 4px;
    padding-right: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-y: none;
    scrollbar-width: none;
}

.profile-tabs::-webkit-scrollbar { display: none; }

.profile-tabs > .icon-btn,
.profile-tabs > .archive-btn-wrap,
.profile-tabs > .sort-pill-wrap {
    flex-shrink: 0;
}

/* Кнопка попапа активных фильтров — слева от вкладки «Все» */
.filters-more-slot {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    position: relative;
    overflow: visible;
}

.filters-more-slot[hidden] { display: none; }

.filters-more-slot .chips-more {
    margin: 0;
}

.profile-tab {
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-border);
    background: var(--color-surface-raised);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    flex-shrink: 0;
    white-space: nowrap;
}

.profile-tab:hover { border-color: var(--color-border-strong); color: var(--color-text); }

.profile-tab--active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #ffffff;
}

[data-theme=light] .profile-tab--active {
    color: #ffffff;
}

[data-theme=dark] .profile-tab--active {
    color: #101828;
}

.profile-tab--add {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 16px;
    line-height: 1;
}

/* --- Модалка: overlay сплошной (не стеклянный — это фон-затемнение, не
   панель интерфейса), диалог внутри — стеклянный (см. селектор выше). --- */

.modal-overlay[hidden] { display: none; }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: var(--space-4);
}

.modal-dialog {
    width: min(420px, 100%);
    padding: var(--space-5);
    box-shadow: var(--elevation-shadow);
}

.modal-dialog h3 {
    margin: 0 0 var(--space-4);
    font-size: var(--text-subheading);
    font-weight: 600;
}

/* --- Инлайн-кнопки вердикта в таблице результатов --- */

.verdict-mini {
    display: flex;
    gap: 4px;
}

.verdict-mini__btn {
    width: 24px;
    height: 24px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface-raised);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.verdict-mini__btn:hover { border-color: var(--color-border-strong); color: var(--color-text); }

.verdict-mini__btn--active[data-verdict="наш"] { background: rgba(140, 200, 120, 0.18); border-color: rgba(140, 200, 120, 0.5); color: #9fd68a; }
.verdict-mini__btn--active[data-verdict="не наш"] { background: rgba(255, 107, 107, 0.16); border-color: rgba(255, 107, 107, 0.5); color: #ff9a9a; }
.verdict-mini__btn--active[data-verdict="не актуально"] { background: rgba(224, 171, 46, 0.18); border-color: rgba(224, 171, 46, 0.5); color: #e7c069; }

/* --- Светлая тема: семантические цвета (приоритет/вердикт/предупреждение) --
   Те же rgba-полупрозрачные фоны читаются иначе на белом, чем на тёмном —
   текст поверх них надо тонировать темнее, иначе бледно-зелёный/красный
   текст (рассчитанный на тёмный фон) становится нечитаемым на белом. */

[data-theme="light"] .priority-badge--3 { background: #e8f5e9; border-color: #a5d6a7; color: #2e7d32; }

[data-theme="light"] .verdict-tag[data-verdict="наш"],
[data-theme="light"] .verdict-mini__btn--active[data-verdict="наш"] { background: #e8f5e9; border-color: #a5d6a7; color: #2e7d32; }
[data-theme="light"] .verdict-tag[data-verdict="не наш"],
[data-theme="light"] .verdict-mini__btn--active[data-verdict="не наш"] { background: #fbeaea; border-color: #e0a3a3; color: #a32b2b; }
[data-theme="light"] .verdict-tag[data-verdict="не актуально"],
[data-theme="light"] .verdict-mini__btn--active[data-verdict="не актуально"] { background: #fbf3e2; border-color: #e7cf9c; color: #7a5c11; }

[data-theme="light"] .verdict-btn--active[data-verdict="наш"] { background: #eaf5ea; border-color: #8fc793; color: #1f7a26; }
[data-theme="light"] .verdict-btn--active[data-verdict="не наш"] { background: #fbeaea; border-color: #e0a3a3; color: #a32b2b; }
[data-theme="light"] .verdict-btn--active[data-verdict="не актуально"] { background: #fbf3e2; border-color: #e7cf9c; color: #7a5c11; }

[data-theme="light"] .badge-warning { background: #fbf3e2; border-color: #e7cf9c; color: #7a5c11; }

/* --- Переключатель темы (шапка) --- */

.theme-toggle {
    background: rgba(248, 250, 252, 0.06);
    border: 1px solid var(--color-topbar-border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-topbar-muted);
    padding: 0;
    transition: border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast), background var(--transition-fast);
}

.theme-toggle:hover {
    border-color: var(--color-border-strong);
    color: var(--color-topbar-text);
    background: var(--color-bg-2);
    transform: translateY(-1px);
    text-decoration: none;
}

.theme-toggle svg,
.theme-toggle__icon { width: 16px; height: 16px; }

/* Специфичность выше, чем у `.theme-toggle svg` — иначе в dark оба
   значка (солнце+луна) всегда видны рядом. */
.theme-toggle .theme-toggle__icon--sun { display: block; }
.theme-toggle .theme-toggle__icon--moon { display: none; }
[data-theme="light"] .theme-toggle .theme-toggle__icon--sun { display: none; }
[data-theme="light"] .theme-toggle .theme-toggle__icon--moon { display: block; }

/* --- /search: пришвартованный левый rail фильтров (Kravio) --- */

.search-main__profiles {
    flex-shrink: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    overflow: visible;
    margin-bottom: var(--space-2);
}

/* Одна строка: профили/кнопки слева, пагинация + «найдено» справа. */
.search-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    width: 100%;
    min-height: 36px;
}

.results-meta {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    margin-left: auto;
    min-width: max-content;
    overflow: visible;
}

.results-meta:empty { display: none; }

.results-meta .results-footer {
    margin: 0;
}

.search-layout {
    display: contents;
}

/* Полная высота, flush left, только правая граница — как меню Kravio. */
.filters-sidebar {
    flex: 0 0 268px;
    width: 268px;
    height: 100%;
    min-height: 0;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 0;
    padding: 14px 14px 0;
    /* Как у .lot-card: var(--color-surface), не канвас #e7e6e4 */
    background: var(--color-surface);
    border: none;
    border-right: 1px solid var(--color-border);
    border-radius: 0;
    box-sizing: border-box;
}

[data-theme=dark] .filters-sidebar {
    background: var(--color-bg);
    border-right-color: var(--color-border);
}

.filters-sidebar__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: 4px 8px 14px;
    margin: 0 0 4px;
    border-bottom: none;
}

.filters-sidebar__head .filters-sidebar__section-label {
    margin: 0;
    padding: 0;
}

.sidebar-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    text-decoration: none;
    color: #101828;
}

.sidebar-brand:hover {
    text-decoration: none;
    color: #101828;
}

[data-theme=dark] .sidebar-brand,
[data-theme=dark] .sidebar-brand:hover {
    color: var(--color-text);
}

/* Марк: чёрная K в круге (как favicon). */
.sidebar-brand__mark {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid #1a1d1f;
    color: #1a1d1f;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

[data-theme=dark] .sidebar-brand__mark {
    border-color: var(--color-text);
    color: var(--color-text);
}

.sidebar-brand__name {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.sidebar-panel-toggle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #98a2b3;
    cursor: pointer;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.sidebar-panel-toggle:hover {
    color: #667085;
    background: rgba(255, 255, 255, 0.7);
}

.sidebar-panel-toggle svg {
    width: 18px;
    height: 18px;
}

/* Секция как MAIN NAVIGATION */
.filters-sidebar__section-label {
    margin: 12px 0 8px;
    padding: 0 12px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #98a2b3;
}

/* Пункты меню = summary фасетов (Kravio nav). */
.filters-sidebar .facet,
.filters-sidebar .filters-form__chips {
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
    flex-shrink: 0;
}

/* Закрытый: 13px, charcoal-серый, иконка слева — как Clients/Integrations. */
.filters-sidebar .facet > summary {
    padding: 8px 10px;
    min-height: 38px;
    font-weight: 500;
    font-size: 13px;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: #344054;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    box-shadow: none;
    gap: 10px;
    transition: background var(--transition-fast), color var(--transition-fast),
        box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.filters-sidebar .facet:not([open]) > summary:hover {
    color: #1a1d1f;
    background: rgba(255, 255, 255, 0.65);
}

/* Иконки слева (mask → currentColor, как outline-иконки Kravio). */
.filters-sidebar .facet > summary::before {
    content: "";
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    background-color: currentColor;
    opacity: 1;
    -webkit-mask: center / 18px 18px no-repeat;
    mask: center / 18px 18px no-repeat;
}

.filters-sidebar .facet[data-facet="text-extra"] > summary::before {
    -webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E");
}
.filters-sidebar .facet[data-facet="category"] > summary::before {
    -webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7' rx='1.5'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1.5'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1.5'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1.5'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7' rx='1.5'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1.5'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1.5'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1.5'/%3E%3C/svg%3E");
}
.filters-sidebar .facet[data-facet="price"] > summary::before {
    -webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2v20'/%3E%3Cpath d='M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2v20'/%3E%3Cpath d='M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6'/%3E%3C/svg%3E");
}
.filters-sidebar .facet[data-facet="dates"] > summary::before {
    -webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M16 3v4M8 3v4M3 11h18'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M16 3v4M8 3v4M3 11h18'/%3E%3C/svg%3E");
}
.filters-sidebar .facet[data-facet="parties"] > summary::before {
    -webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
}
.filters-sidebar .facet[data-facet="status"] > summary::before {
    -webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 11l3 3L22 4'/%3E%3Cpath d='M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 11l3 3L22 4'/%3E%3Cpath d='M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11'/%3E%3C/svg%3E");
}
.filters-sidebar .facet[data-facet="personal"] > summary::before {
    -webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78L12 21.23l8.84-8.84a5.5 5.5 0 0 0 0-7.78z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78L12 21.23l8.84-8.84a5.5 5.5 0 0 0 0-7.78z'/%3E%3C/svg%3E");
}

/* Открытый / с активными фильтрами — как Overview: белая плитка, тень, обводка. */
.filters-sidebar .facet[open] > summary,
.filters-sidebar .facet:not([open]):has(.facet-badge:not([hidden])) > summary {
    background: #ffffff;
    color: #1a1d1f;
    font-weight: 600;
    border-color: #ebebeb;
    box-shadow:
        0 1px 2px rgba(16, 24, 40, 0.04),
        0 2px 8px rgba(16, 24, 40, 0.06);
}

.filters-sidebar .facet[open] > summary:hover {
    background: #ffffff;
    color: #1a1d1f;
}

[data-theme=dark] .filters-sidebar .facet > summary {
    color: var(--color-text-muted);
}
[data-theme=dark] .filters-sidebar .facet:not([open]) > summary:hover {
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.06);
}
[data-theme=dark] .filters-sidebar .facet[open] > summary,
[data-theme=dark] .filters-sidebar .facet:not([open]):has(.facet-badge:not([hidden])) > summary {
    color: var(--color-text);
    background: var(--color-surface);
    border-color: var(--color-border);
    box-shadow: var(--elevation-shadow-soft);
}

/* Вложенное содержимое — дерево с L-линиями как у Tickets. */
.filters-sidebar .facet__body {
    position: relative;
    margin: 4px 0 8px;
    padding: 2px 0 6px 38px;
    border-left: none;
    gap: 12px;
}

.filters-sidebar .facet__body::before {
    content: "";
    position: absolute;
    left: 18px;
    top: 0;
    bottom: 10px;
    width: 1px;
    background: #e4e7ec;
}

.filters-sidebar .facet__body > .field {
    position: relative;
}

.filters-sidebar .facet__body > .field::before {
    content: "";
    position: absolute;
    left: -20px;
    top: 11px;
    width: 14px;
    height: 1px;
    background: #e4e7ec;
}

[data-theme=dark] .filters-sidebar .facet__body::before,
[data-theme=dark] .filters-sidebar .facet__body > .field::before {
    background: var(--color-border);
}

.filters-sidebar .field > label {
    font-size: 12px;
    font-weight: 500;
    color: #344054;
    line-height: 1.35;
    text-transform: none;
    letter-spacing: normal;
}

/* Поля как Search anything: компактная высота ~32px. */
.filters-sidebar input[type="text"],
.filters-sidebar input[type="number"],
.filters-sidebar input[type="date"],
.filters-sidebar select:not([multiple]),
.filters-sidebar .word-chips__input,
.filters-sidebar .okpd2-tree__toggle {
    border-radius: 10px;
    min-height: 32px;
    height: 32px;
    padding: 5px 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.3;
    color: #1a1d1f;
    box-sizing: border-box;
}

.filters-sidebar input[type="text"]::placeholder,
.filters-sidebar input[type="number"]::placeholder,
.filters-sidebar input[type="date"]::placeholder,
.filters-sidebar .word-chips__input::placeholder {
    color: #98a2b3;
}

.filters-sidebar input[type="text"]:focus,
.filters-sidebar input[type="number"]:focus,
.filters-sidebar input[type="date"]:focus,
.filters-sidebar select:not([multiple]):focus,
.filters-sidebar .word-chips__input:focus {
    border-color: #d0d5dd;
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 29, 31, 0.06);
}

.filters-sidebar select:not([multiple]) {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px 14px;
    background-color: #ffffff;
    cursor: pointer;
}

[data-theme="dark"] .filters-sidebar select:not([multiple]),
:root:not([data-theme="light"]) .filters-sidebar select:not([multiple]) {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

.filters-sidebar select[multiple] {
    border-radius: 10px;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
}

.filters-sidebar .okpd2-tree__toggle {
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    color: #344054;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.filters-sidebar .okpd2-tree__toggle:hover {
    color: #1a1d1f;
    border-color: #d0d5dd;
}

.filters-form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    gap: 4px;
    /* Скролл остаётся, «серая палка» (thumb) не показывается */
    scrollbar-width: none;
}
.filters-form::-webkit-scrollbar { display: none; }

.filters-form > * {
    flex-shrink: 0;
}

.filters-sidebar .form-actions {
    position: sticky;
    bottom: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
    margin-top: auto;
    padding: 12px 0 14px;
    background: transparent;
    border-top: none;
    box-shadow: none;
}

[data-theme=dark] .filters-sidebar .form-actions {
    background: transparent;
    box-shadow: none;
    border-top: none;
}

.filters-sidebar .form-actions .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
}

.filters-sidebar .form-actions .btn-primary {
    position: relative;
    z-index: 1;
    box-shadow:
        0 -6px 14px -2px rgba(16, 24, 40, 0.14),
        0 2px 6px rgba(16, 24, 40, 0.1);
    transition: background var(--transition-fast), border-color var(--transition-fast),
        box-shadow var(--transition-fast), transform var(--transition-fast);
}

.filters-sidebar .form-actions .btn-primary:hover {
    box-shadow:
        0 -8px 18px -2px rgba(16, 24, 40, 0.18),
        0 3px 8px rgba(16, 24, 40, 0.12);
    transform: translateY(-1px);
}

[data-theme=dark] .filters-sidebar .form-actions .btn-primary {
    box-shadow:
        0 -6px 14px -2px rgba(0, 0, 0, 0.32),
        0 2px 6px rgba(0, 0, 0, 0.22);
}

[data-theme=dark] .filters-sidebar .form-actions .btn-primary:hover {
    box-shadow:
        0 -8px 18px -2px rgba(0, 0, 0, 0.38),
        0 3px 8px rgba(0, 0, 0, 0.26);
}

.filters-sidebar .form-actions .search-status {
    margin-right: 0;
    align-self: flex-start;
}

.results-pane {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
}

/* Содержимое целиком заменяется AJAX-ответом (results-toolbar + table +
   pagination, либо empty-state) — flex-контекст задаём на самом контейнере,
   чтобы .results-table-wrap внутри фрагмента мог растянуться на всю
   оставшуюся высоту и скроллиться сам по себе.
   Без width/stretch пустая выдача сжимается до ширины текста empty-state. */
#results-container {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
    align-self: stretch;
    box-sizing: border-box;
}

.sidebar-close { display: none; }

/* --- Поиск в шапке: крупная пилюля на всю ширину до темы/аватара --- */

.search-topbar {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin: 0;
}

.search-topbar__icon {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    color: var(--color-text-faint);
    pointer-events: none;
}

input[type="text"].search-topbar__input {
    width: 100%;
    font-size: 14px;
    font-weight: 400;
    padding: 10px 40px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-2);
    color: var(--color-topbar-text);
}
input[type="text"].search-topbar__input::placeholder {
    color: var(--color-topbar-muted);
}
input[type="text"].search-topbar__input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(var(--color-accent-rgb), 0.12);
    background: var(--color-surface);
}

.search-topbar__clear {
    position: absolute;
    right: 10px;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: none;
    color: var(--color-topbar-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.search-topbar__clear:hover { background: var(--color-bg-2); color: var(--color-text); }

.field__hint--search {
    flex-shrink: 0;
    margin: calc(-1 * var(--space-2)) 0 var(--space-3);
}

/* --- Фасет: аккордеон-блок в сайдбаре (аналог .filter-section, но в один
   столбец — сайдбар узкий, места на грид из 3 колонок нет) --- */

.facet { overflow: hidden; border-radius: var(--radius); }

.facet > summary {
    list-style: none;
    cursor: pointer;
    padding: var(--space-4);
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    user-select: none;
    min-height: 48px;
    box-sizing: border-box;
}

.facet > summary::-webkit-details-marker { display: none; }

.facet > summary::after {
    content: "+";
    margin-left: auto;
    color: var(--color-text-faint);
    font-weight: 400;
    font-size: 16px;
}

.facet[open] > summary::after { content: "\2212"; }
.facet[open] > summary { border-bottom: 1px solid var(--color-border); }

/* Сайдbar: chevron вместо +/- (перебивает правила .facet выше). */
.filters-sidebar .facet > summary::after {
    content: "";
    width: 16px;
    height: 16px;
    margin-left: auto;
    flex-shrink: 0;
    opacity: 1;
    font-size: 0;
    font-weight: 400;
    color: transparent;
    background: center / 14px 14px no-repeat
        url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.filters-sidebar .facet[open] > summary::after {
    content: "";
    transform: rotate(180deg);
    opacity: 1;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231a1d1f' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

.filters-sidebar .facet > summary:hover::after {
    opacity: 1;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231a1d1f' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

.filters-sidebar .facet[open] > summary {
    border-bottom: none;
}

.facet-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--radius-pill);
    background: var(--color-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.facet-badge[hidden] { display: none; }

.facet__body {
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.checkbox-group--vertical { flex-direction: column; gap: 6px; }

/* Длинный список площадок — не раздувает фасет на весь экран. */
.checkbox-group--scroll {
    max-height: 260px;
    overflow-y: auto;
    padding: 6px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-strong) transparent;
}

.filters-sidebar .checkbox-group--scroll {
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    border-color: transparent;
    box-shadow: var(--elevation-shadow-soft);
}

/* Группа tektorg: общая галочка + раскрываемые подплощадки. */
.source-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.source-group__head {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.source-group__toggle {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

.source-group__toggle svg {
    width: 14px;
    height: 14px;
    display: block;
}

.source-group__toggle:hover {
    color: var(--color-text);
    background: var(--color-bg-2);
}

.source-group--open .source-group__toggle {
    transform: rotate(90deg);
    color: var(--color-text);
}

.source-group__all-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    text-transform: none;
    color: var(--color-text);
    min-width: 0;
    cursor: pointer;
}

.source-group__children {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 2px 0 4px 26px;
}

.source-group__children[hidden] {
    display: none;
}

.source-group__children label {
    font-weight: 400;
    color: var(--color-text-muted);
}

/* --- Активные фильтры: чипы с крестиком удаления --- */

.active-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 0;
    flex-shrink: 0;
    position: relative;
    z-index: 5;
}

.active-chips[hidden] { display: none; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 10px;
    border-radius: var(--radius-pill);
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border-strong);
    color: var(--color-text);
    font-size: 12px;
    max-width: min(100%, 220px);
    min-width: 0;
}

.chip__text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.chip__remove {
    background: none;
    border: none;
    padding: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    flex-shrink: 0;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.chip__remove:hover { background: var(--color-danger-bg); color: var(--color-danger); }

/* Кнопка «ещё фильтры» + попап со полным списком чипов. */
.chips-more {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    overflow: visible;
}

.chips-more__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    position: relative;
    overflow: visible;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.chips-more__btn svg {
    width: 14px;
    height: 14px;
    display: block;
}

.chips-more__btn:hover,
.chips-more__btn[aria-expanded="true"] {
    border-color: var(--color-border-strong);
    color: var(--color-text);
    background: var(--color-bg-2);
}

.chips-more__count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: var(--radius-pill);
    background: var(--color-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    box-sizing: border-box;
    z-index: 1;
    pointer-events: none;
}

.chips-more__empty {
    font-size: 12px;
    color: var(--color-text-muted);
    padding: 4px 2px 2px;
}

.chips-more__popup {
    /* fixed + JS-якорь: absolute внутри .profile-tabs / .search-dock
       (overflow) срезает попап под sticky .lot-sort-bar. */
    position: fixed;
    left: 0;
    top: 0;
    z-index: 530;
    width: min(320px, calc(100vw - 24px));
    max-height: min(360px, 60vh);
    display: flex;
    flex-direction: column;
    padding: 10px;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    box-shadow: var(--elevation-shadow);
    box-sizing: border-box;
}

.chips-more__popup[hidden] { display: none; }

.chips-more__popup-head {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    padding: 2px 4px 8px;
}

.chips-more__popup-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
}

.chips-more__popup-list .chip {
    max-width: 100%;
}

@media (max-width: 900px) {
    .chips-more__popup {
        width: min(280px, calc(100vw - 24px));
    }
}

/* --- Слайдер диапазона цены (два input[type=range] внахлёст) --- */

.price-slider {
    position: relative;
    height: 32px;
    margin-bottom: 4px;
}

.price-slider__track {
    position: absolute;
    top: 15px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--color-border-strong);
    border-radius: var(--radius-pill);
}

.price-slider__range {
    position: absolute;
    top: 15px;
    height: 2px;
    background: var(--color-accent);
    border-radius: var(--radius-pill);
}

.price-slider__input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 32px;
    margin: 0;
    background: none;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
}

.price-slider__input::-webkit-slider-thumb {
    -webkit-appearance: none;
    pointer-events: auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-accent);
    border: 2px solid var(--color-surface);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    margin-top: 0;
}

.price-slider__input::-moz-range-thumb {
    pointer-events: auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-accent);
    border: 2px solid var(--color-surface);
    cursor: pointer;
}

.price-slider__input::-webkit-slider-runnable-track { background: transparent; }
.price-slider__input::-moz-range-track { background: transparent; }

/* На /search: сворачивание фильтров на desktop. */
@media (min-width: 901px) {
    body:not(.filters-sidebar-collapsed) .page--dock .sidebar-toggle {
        display: none;
    }

    body.filters-sidebar-collapsed .page--dock .sidebar-toggle {
        display: flex;
    }

    body.filters-sidebar-collapsed .filters-sidebar {
        display: none;
    }
}



/* --- Кнопка «Показать фильтры» (topbar / мобильная панель) --- */

.sidebar-toggle {
    display: none;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.sidebar-toggle:hover {
    color: var(--color-text);
    background: var(--color-bg-2);
}

.sidebar-toggle svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-toggle__label { display: none; }

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
}

.sidebar-backdrop[hidden] { display: none; }

@media (max-width: 900px) {
    .brand { font-size: 16px; }
    .sidebar-toggle { display: flex; }
    .sidebar-toggle__label { display: inline; }

    body.filters-sidebar-collapsed .filters-sidebar {
        display: block;
    }

    .search-dock {
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .search-dock__main {
        flex: 1;
        min-height: 0;
        order: 1;
        background: var(--color-bg);
    }

    .search-main__profiles {
        order: 0;
    }

    .results-pane {
        order: 0;
        flex: 1;
        min-height: 0;
    }

    .filters-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(85vw, 340px);
        flex: none;
        max-height: none;
        z-index: 200;
        background: var(--color-surface);
        border: none;
        border-right: 1px solid var(--color-border);
        border-radius: 0;
        padding: var(--space-4) var(--space-3) 0;
        transform: translateX(-100%);
        transition: transform var(--transition-base);
        overflow: hidden;
        margin: 0;
        height: auto;
        display: flex;
        flex-direction: column;
    }

    .filters-sidebar.open { transform: translateX(0); }

    .sidebar-panel-toggle {
        display: flex;
    }
}

/* --- Skeleton-плейсхолдер строк на время AJAX-поиска --- */

.skeleton-row td { padding: 14px; border-bottom: 1px solid var(--color-border); }
.skeleton-bar {
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--color-border) 25%, var(--color-border-strong) 37%, var(--color-border) 63%);
    background-size: 400% 100%;
    animation: skeleton-shimmer 1.4s ease infinite;
}
@keyframes skeleton-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* --- Фикс дрожания при resize колонок: на время drag гасим ЛЮБЫЕ
   transition в поддереве таблицы (на случай, если какой-то общий transition
   всё же матчился бы на <col>/<td> и пытался анимировать промежуточные
   ширины) — сам column-resize.js ставит transition:none на <col>, это
   дублирующая подстраховка на уровне CSS. --- */
body.col-resizing .results-table-wrap,
body.col-resizing .results-table-wrap * {
    transition: none !important;
}

/* --- Toast-уведомления --- */

.toast-container {
    position: fixed;
    bottom: var(--space-5);
    right: var(--space-5);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border-strong);
    color: var(--color-text);
    padding: 10px 16px;
    border-radius: var(--radius);
    box-shadow: var(--elevation-shadow);
    font-size: 13px;
    max-width: 380px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity var(--transition-base), transform var(--transition-base);
}

.toast__text { cursor: pointer; }

.toast__action {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--color-text);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    white-space: nowrap;
}
.toast__action:hover { color: var(--color-text-muted); text-decoration: underline; }

.toast--visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Фокус-состояния: чётче браузерного дефолта --------------------------
   Инпуты уже подсвечиваются через box-shadow на :focus (см. выше) — здесь
   общее правило для всего остального интерактивного (кнопки/ссылки/чипы/
   вкладки/чекбоксы), что своего focus-стиля не имело и падало на едва
   заметный браузерный outline. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* --- Подсветка совпадений запроса в Название/Описание (см. utils.py) --- */

mark {
    background: rgba(224, 171, 46, 0.35);
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}

/* --- Блок 1: массовая разметка — чекбоксы + плавающая панель действий --- */
/* По умолчанию колонка выбора скрыта; появляется в .selection-mode. */

.col-select { width: 40px; text-align: center; vertical-align: middle; }
.col-select input[type="checkbox"] {
    accent-color: var(--color-accent);
    cursor: pointer;
    width: 18px;
    height: 18px;
    margin: 0;
    vertical-align: middle;
}

/* Скрытие чекбоксов вне .selection-mode: нулевая ширина слота
   (не display:none — иначе ломается сетка карточек/таблицы).
   В .selection-mode эти правила не действуют — квадратики видны. */
#results-container:not(.selection-mode) col.col-select-slot {
    width: 0 !important;
    max-width: 0;
}
#results-container:not(.selection-mode) .col-select,
#results-container:not(.selection-mode) .lot-card__select,
#results-container:not(.selection-mode) .lot-select-bar__check {
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin: 0 !important;
    border: none !important;
    overflow: hidden;
}
#results-container:not(.selection-mode) .col-select input,
#results-container:not(.selection-mode) .lot-card__select input,
#results-container:not(.selection-mode) .lot-select-bar__check input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* В режиме выбора слот чекбокса занимает место */
#results-container.selection-mode .lot-card__select,
#results-container.selection-mode .lot-select-bar__check {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    overflow: visible;
}

/* Панель «выбрать все» — только в режиме выбора */
#results-container:not(.selection-mode) .lot-select-bar {
    display: none;
}

.bulk-bar {
    position: fixed;
    left: 50%;
    bottom: var(--space-5);
    transform: translateX(-50%);
    z-index: 250;
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: 10px var(--space-4);
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    /* Сильнее обычного elevation: панель на светлом #e7e6e4 иначе «теряется». */
    box-shadow:
        0 4px 6px rgba(16, 24, 40, 0.08),
        0 12px 28px rgba(16, 24, 40, 0.18),
        0 24px 48px rgba(16, 24, 40, 0.12);
}

[data-theme=dark] .bulk-bar {
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.25),
        0 12px 28px rgba(0, 0, 0, 0.45),
        0 24px 48px rgba(0, 0, 0, 0.35);
}

.bulk-bar[hidden] { display: none; }

.bulk-bar__count { font-size: var(--text-body); font-weight: 600; white-space: nowrap; }

/* "Выбрать все N по фильтру" — появляется вместо тихого потолка в 50
   строк (per_page), когда отмечен весь текущий "select all page" и по
   фильтру есть ещё непоказанные совпадения. После активации переключается
   в подтверждающее состояние (--active), означающее что bulk-действие
   пойдёт по ВСЕМ найденным id, а не только по видимой странице. */
.bulk-bar__select-all-matching {
    background: none;
    border: none;
    color: var(--color-link);
    font-size: var(--text-caption);
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    white-space: nowrap;
}
.bulk-bar__select-all-matching:hover { color: var(--color-text-muted); }
.bulk-bar__select-all-matching[hidden] { display: none; }
.bulk-bar__select-all-matching--active {
    color: var(--color-text-muted);
    text-decoration: none;
    cursor: default;
}
.bulk-bar__select-all-matching--active:hover { color: var(--color-text-muted); }

.bulk-bar__actions { display: flex; gap: var(--space-2); }
.bulk-bar__actions .btn { padding: 7px 14px; font-size: var(--text-caption); }

.bulk-bar__close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}
.bulk-bar__close:hover { color: var(--color-text); }

/* --- Блок 2: "Новое с прошлого раза" --- */

.profile-tab { position: relative; display: inline-flex; align-items: center; gap: 6px; }

.profile-tab__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: var(--radius-pill);
    background: var(--color-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

/* Плашка «Новых сегодня» — toast-попап справа снизу, вне потока layout. */
.today-summary {
    position: fixed;
    bottom: var(--space-5);
    right: var(--space-5);
    z-index: 290;
    width: min(360px, calc(100vw - 32px));
    padding: 14px 40px 14px 16px;
    margin: 0;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    box-shadow: var(--elevation-shadow);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity var(--transition-base), transform var(--transition-base);
}

.today-summary[hidden] {
    display: none;
}

.today-summary.today-summary--visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.today-summary__close {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

.today-summary__close:hover {
    color: var(--color-text);
    border-color: var(--color-border-strong);
}

.today-summary__headline { font-size: 14px; font-weight: 600; }
.today-summary__headline strong { color: var(--color-text); }

.today-summary__list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: var(--text-caption);
    color: var(--color-text-muted);
}

/* --- Средняя цена по ОКПД2 (карточка лота) --- */

.okpd2-stats {
    font-size: var(--text-caption);
    color: var(--color-text-muted);
    padding: 2px 0 8px;
    margin-top: -4px;
}

/* --- /login: единственный неаутентифицированный экран, но на тех же
   токенах и с той же поддержкой тём, что весь остальной путь (раньше жил
   отдельным инлайн-стилем без тёмной темы — несостыковка с первым же
   экраном, который видит пользователь). --- */

body.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-5);
}

.auth-shell { width: 100%; max-width: 360px; }

.auth-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--elevation-shadow);
    padding: var(--space-6) var(--space-5);
}

.auth-card__brand { display: block; margin-bottom: var(--space-1); }

.auth-card__hint {
    font-size: var(--text-caption);
    color: var(--color-text-muted);
    margin: 0 0 var(--space-5);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.auth-form__error {
    margin: 0;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    background: var(--color-danger-bg);
    color: var(--color-danger);
    font-size: var(--text-caption);
}

.auth-form__submit { width: 100%; margin-top: var(--space-1); }

/* --- Карточки лотов в /search (компактный Finexy-layout) --------------- */
.results-list-wrap {
    display: flex;
    flex-direction: column;
    gap: 0;
    /* Скролл — у .lots-panel, иначе панель с overflow:hidden
       сжимается по высоте родителя и обрезает нижние строки. */
    overflow: hidden;
    /* Явно цвет канваса (.search-dock__main), не transparent:
       иначе у sticky .lot-sort-bar на скруглении проступают белые «ушки»
       (композитный слой / antialias на белом body). */
    background: #e7e6e4;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
}
[data-theme=dark] .results-list-wrap {
    background: var(--color-bg);
}

/* --- Выдача лотов: панель + карточки по макету (title / цена+ЭТП / дедлайн) --- */

.lots-panel {
    background: #e7e6e4;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-strong) transparent;
    /* 0 между sort-bar и .lot-cards — стык без щели; gap карточек внутри .lot-cards */
    gap: 0;
    padding: 0 2px 8px;
}
[data-theme=dark] .lots-panel {
    background: var(--color-bg);
}

.lots-panel--empty {
    padding: var(--space-6);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.lot-select-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    position: sticky;
    top: 0;
    z-index: 3;
    flex-shrink: 0;
}
.lot-select-bar__check {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.lot-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0;
    margin: 0;
    position: relative;
}

/* Слот под уходящую карточку («не наш»): height анимирует WAAPI */
.lot-card-slot {
    flex: 0 0 auto;
    overflow: hidden;
    pointer-events: none;
    visibility: hidden;
}

.lot-card--leaving {
    pointer-events: none;
    will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
    .lot-card--leaving {
        opacity: 0 !important;
    }
}

.lot-card {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    padding: 18px 20px 16px 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: none;
    cursor: pointer;
    overflow: hidden;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}
.lot-card:hover {
    background: var(--color-surface);
    border-color: var(--color-border-strong);
}

.lot-card__select {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 4px;
}

/* Чекбокс Kravio: скруглённый квадрат */
.lot-card__select input[type="checkbox"],
.lot-select-bar__check input[type="checkbox"],
.lots-panel .col-select input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    margin: 0;
    border: 1.5px solid var(--color-border-strong);
    border-radius: 4px;
    background: var(--color-surface);
    cursor: pointer;
    flex-shrink: 0;
    display: grid;
    place-content: center;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}
.lot-card__select input[type="checkbox"]::before,
.lot-select-bar__check input[type="checkbox"]::before,
.lots-panel .col-select input[type="checkbox"]::before {
    content: "";
    width: 9px;
    height: 9px;
    transform: scale(0);
    background: center / contain no-repeat
        url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-6'/%3E%3C/svg%3E");
    transition: transform 80ms ease-out;
}
.lot-card__select input[type="checkbox"]:checked,
.lot-select-bar__check input[type="checkbox"]:checked,
.lots-panel .col-select input[type="checkbox"]:checked {
    background: var(--color-accent);
    border-color: var(--color-accent);
}
.lot-card__select input[type="checkbox"]:checked::before,
.lot-select-bar__check input[type="checkbox"]:checked::before,
.lots-panel .col-select input[type="checkbox"]:checked::before {
    transform: scale(1);
}

.lot-card__main {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.lot-card__top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 16px 28px;
    align-items: start;
}

.lot-card__title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--color-text);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: -0.01em;
}
.lot-card__title mark {
    background: rgba(var(--color-accent-rgb), 0.12);
    color: var(--color-text);
    padding: 0 2px;
    border-radius: 2px;
}

.lot-card__price-col {
    text-align: right;
    min-width: 7.5em;
    flex-shrink: 0;
    padding-top: 1px;
}

.lot-card__price {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    color: var(--color-text);
    white-space: nowrap;
}

.lot-card__etp {
    display: inline-block;
    margin-top: 4px;
    font-size: 13px;
    font-weight: 500;
    color: #2F6FED;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.lot-card__etp:hover { color: #1D4ED8; text-decoration: underline; }

.lot-card__deadline {
    min-width: 11.5em;
    max-width: 13em;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    color: var(--color-text);
    text-align: right;
    padding-top: 2px;
}

.lot-card--urgent .lot-card__deadline {
    color: #9f1239;
}

.lot-card__mid-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 20px;
    min-width: 0;
}

.lot-card__mid {
    min-width: 0;
    flex: 1 1 auto;
    max-width: 42rem;
}

.lot-card__customer-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted);
    margin-bottom: 2px;
}

.lot-card__customer-name {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--color-text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-decoration: none;
}
a.lot-card__customer-name:hover {
    color: var(--color-text);
    text-decoration: underline;
}

.lot-card__proc {
    margin-top: 4px;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
    color: var(--color-text-muted);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.lot-card__tools {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    align-self: flex-end;
    margin-left: auto;
    padding-bottom: 1px;
}

.lot-card__tools .verdict-mini {
    display: none;
}
.lot-card__tools:hover .verdict-mini,
.lot-card__tools:focus-within .verdict-mini {
    display: inline-flex;
}
.lot-card__tools:hover .status-pill,
.lot-card__tools:focus-within .status-pill {
    display: none;
}
.lot-card__tools.is-verdict-just-set .verdict-mini,
.lot-card__tools.is-verdict-just-set:hover .verdict-mini,
.lot-card__tools.is-verdict-just-set:focus-within .verdict-mini {
    display: none;
}
.lot-card__tools.is-verdict-just-set .status-pill,
.lot-card__tools.is-verdict-just-set:hover .status-pill,
.lot-card__tools.is-verdict-just-set:focus-within .status-pill {
    display: inline-flex;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
}
.status-pill__icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.status-pill__icon svg { width: 11px; height: 11px; }

.status-pill--ok .status-pill__icon { background: #ecfdf5; color: #059669; }
.status-pill--no .status-pill__icon { background: #fff1f2; color: #e11d48; }
.status-pill--maybe .status-pill__icon { background: #fffbeb; color: #d97706; }
.status-pill--new .status-pill__icon { background: #eff6ff; color: #2563eb; }

[data-theme=dark] .status-pill--ok .status-pill__icon { background: rgba(52, 211, 153, 0.15); color: #34d399; }
[data-theme=dark] .status-pill--no .status-pill__icon { background: rgba(251, 113, 133, 0.15); color: #fb7185; }
[data-theme=dark] .status-pill--maybe .status-pill__icon { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
[data-theme=dark] .status-pill--new .status-pill__icon { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }

.lot-card__fav { margin: 0; display: inline-flex; }
.lot-card .star-btn { opacity: 0.35; }
.lot-card:hover .star-btn,
.lot-card .star-btn--active { opacity: 1; }

.lot-card--skeleton {
    pointer-events: none;
    cursor: default;
}
.lot-card--skeleton .skeleton-bar {
    height: 12px;
    border-radius: 4px;
    margin: 4px 0;
}

@media (max-width: 1100px) {
    .lot-card__top {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "title title"
            "price deadline";
        gap: 10px 20px;
    }
    .lot-card__title { grid-area: title; }
    .lot-card__price-col { grid-area: price; text-align: left; }
    .lot-card__deadline { grid-area: deadline; text-align: right; }
}

@media (max-width: 720px) {
    .lot-card {
        grid-template-columns: 22px minmax(0, 1fr);
        padding: 14px 12px 14px 8px;
    }
    .lot-card__top {
        grid-template-columns: 1fr;
        grid-template-areas:
            "title"
            "price"
            "deadline";
    }
    .lot-card__price-col,
    .lot-card__deadline { text-align: left; min-width: 0; max-width: none; }
    .lot-card__mid-row { flex-wrap: wrap; }
}

/* --- /account: избранное — вкладки как в браузере + карточки DnD -------- */

.fav-board {
    margin-bottom: var(--space-5);
}

.fav-board__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.fav-board__title {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
}

.fav-board__actions { display: flex; gap: 8px; }

.fav-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    padding: 8px 14px;
}
.fav-export-btn svg { width: 16px; height: 16px; }
.fav-export-btn:hover { text-decoration: none; }

.fav-chrome {
    /* Полоска вкладок серее; панель «выплывает» белым блоком снизу */
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
}

.fav-tabs {
    display: flex;
    align-items: flex-end;
    flex-wrap: nowrap;
    gap: 3px;
    padding: 0 10px 1px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-y: none;
    scrollbar-width: none;
    min-height: 32px;
    background: var(--color-bg-2);
    border: 1px solid var(--color-border);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
}
.fav-tabs::-webkit-scrollbar { display: none; }

.fav-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 120px;
    max-width: 240px;
    height: 28px;
    padding: 0 12px;
    margin-bottom: -1px; /* стык с верхней границей панели */
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    background: color-mix(in srgb, var(--color-surface) 35%, transparent);
    color: var(--color-text-muted);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
    z-index: 1;
    transition: background var(--transition-fast), color var(--transition-fast),
                border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.fav-tab:hover {
    color: var(--color-text);
    background: color-mix(in srgb, var(--color-surface) 70%, transparent);
}
.fav-tab--active {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
    z-index: 3;
    /* нижняя «заплатка» перекрывает border панели — вкладка выплывает из блока */
    box-shadow: 0 1px 0 var(--color-surface);
}
.fav-tab--drop {
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
    color: var(--color-text);
    background: var(--color-surface);
}
.fav-tab--system {
    cursor: pointer;
}
.fav-tab--system .fav-tab__label {
    font-style: normal;
}
.fav-tab--add {
    min-width: 40px;
    width: 40px;
    max-width: none;
    padding: 0;
    justify-content: center;
    font-size: 20px;
    font-weight: 500;
    color: var(--color-text-muted);
    background: transparent;
}
.fav-tab--add:hover {
    background: color-mix(in srgb, var(--color-surface) 55%, transparent);
}
.fav-tab__label {
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1 1 auto;
    text-align: left;
}
.fav-tab__count {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-faint);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.fav-tab--active .fav-tab__count { color: var(--color-text-muted); }
.fav-tab__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 2px;
    margin-right: -4px;
    border-radius: 50%;
    font-size: 15px;
    line-height: 1;
    color: var(--color-text-faint);
    opacity: 0;
    flex-shrink: 0;
    transition: opacity var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}
.fav-tab:hover .fav-tab__close,
.fav-tab--active .fav-tab__close { opacity: 1; }
.fav-tab__close:hover {
    background: var(--color-border-strong);
    color: var(--color-text);
}

.fav-panel {
    position: relative;
    z-index: 2;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 16px;
    min-height: 160px;
    box-shadow: var(--elevation-shadow-soft);
}

.fav-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.fav-card {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) 32px;
    gap: 8px;
    align-items: start;
    padding: 14px 12px 14px 10px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: grab;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
    user-select: none;
}
/* display:grid выше перекрывает UA-стиль [hidden] — без этого фильтр папок «не работает» */
.fav-card[hidden],
.fav-card--filtered-out {
    display: none !important;
}
.fav-card:hover {
    border-color: var(--color-border-strong);
    box-shadow: var(--elevation-shadow-soft);
}
.fav-card--dragging {
    opacity: 0.28;
    cursor: grabbing;
}

/* Кастомный drag-ghost: большая иконка вместо снимка всей карточки */
.lot-drag-ghost {
    position: absolute;
    left: -9999px;
    top: 0;
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: var(--color-accent);
    color: var(--color-bg);
    box-shadow: 0 12px 32px rgba(16, 24, 40, 0.18);
    pointer-events: none;
    z-index: 0;
}
.lot-drag-ghost svg {
    width: 48px;
    height: 48px;
    display: block;
}
.fav-card:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 1px;
}

.fav-card__grip {
    color: var(--color-text-faint);
    padding-top: 3px;
    opacity: 0.55;
}
.fav-card__grip svg { width: 14px; height: 14px; display: block; }
.fav-card:hover .fav-card__grip { opacity: 1; }

.fav-card__body { min-width: 0; }
.fav-card__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--color-text);
    text-decoration: none;
}
.fav-card__title:hover { text-decoration: underline; color: var(--color-text); }
.fav-card__meta {
    margin-top: 4px;
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.35;
    display: flex;
    flex-wrap: wrap;
    gap: 0 4px;
}
.fav-card__etp,
.verdict-card__etp {
    color: inherit;
    text-decoration: none;
}
.fav-card__etp:hover,
.verdict-card__etp:hover {
    color: var(--color-text);
    text-decoration: underline;
}
.fav-card__customer {
    margin-top: 6px;
    font-size: 12px;
    color: var(--color-text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fav-card__menu-wrap { position: relative; justify-self: end; }

.fav-card__aside {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    justify-self: end;
}

.lot-note {
    position: relative;
    z-index: 6;
    flex-shrink: 0;
}
.lot-note.is-open {
    z-index: 20;
}
.fav-card:has(.lot-note.is-open),
.verdict-card:has(.lot-note.is-open) {
    z-index: 8;
}
.lot-note__btn {
    position: relative;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    background: var(--color-surface);
    color: var(--color-text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}
.lot-note__btn svg { width: 14px; height: 14px; display: block; }
.lot-note__btn:hover,
.lot-note.is-open .lot-note__btn {
    background: var(--color-bg-2);
    border-color: var(--color-border-strong);
    color: var(--color-text);
}
.lot-note__btn:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 1px;
}
.lot-note__dot {
    position: absolute;
    top: -1px;
    right: -1px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success);
    box-shadow: 0 0 0 2px var(--color-surface);
    pointer-events: none;
}
.lot-note__pop {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 50;
    width: 260px;
    max-width: min(260px, calc(100vw - 24px));
    padding: 10px 12px;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--elevation-shadow);
    text-align: left;
}
.lot-note__pop[hidden] { display: none !important; }
.lot-note__preview {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    color: var(--color-text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 160px;
    overflow-y: auto;
}
.lot-note[data-has-comment="0"] .lot-note__preview {
    color: var(--color-text-muted);
}
.lot-note__form { display: flex; flex-direction: column; gap: 8px; }
.lot-note__form[hidden] { display: none; }
.lot-note__input {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--color-border-strong);
    border-radius: 8px;
    font: inherit;
    font-size: 13px;
    line-height: 1.4;
    color: var(--color-text);
    background: var(--color-surface);
    resize: vertical;
    min-height: 72px;
    user-select: text;
}
.lot-note__input:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 1px;
}
.lot-note__actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}
.lot-note__cancel {
    border: none;
    background: none;
    padding: 6px 4px;
    font: inherit;
    font-size: 13px;
    color: var(--color-text-muted);
    cursor: pointer;
}
.lot-note__cancel:hover { color: var(--color-text); }
.lot-note__save {
    padding: 6px 12px;
    font-size: 13px;
}
.fav-card__more {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.fav-card__more svg { width: 16px; height: 16px; }
.fav-card__more:hover,
.fav-card__more[aria-expanded="true"] {
    background: var(--color-bg-2);
    color: var(--color-text);
}

.fav-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 40;
    min-width: 200px;
    max-width: min(260px, 80vw);
    max-height: min(320px, 50vh);
    overflow-y: auto;
    padding: 6px;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--elevation-shadow);
}
.fav-menu__section-label {
    padding: 6px 8px 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-faint);
}
.fav-menu__item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    border: none;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--color-text);
    font: inherit;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
}
.fav-menu__item:hover {
    background: var(--color-bg-2);
    text-decoration: none;
    color: var(--color-text);
}
.fav-menu__item--danger { color: var(--color-danger); }
.fav-menu__item--danger:hover { background: var(--color-danger-bg); color: var(--color-danger); }
.fav-menu__item:disabled,
.fav-menu__item[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}
.fav-menu__sep {
    height: 1px;
    margin: 4px 6px;
    background: var(--color-border);
}

.fav-empty {
    margin: 24px 8px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 14px;
}
.fav-empty[hidden] {
    display: none !important;
}

.fav-modal[hidden] { display: none !important; }
.fav-modal {
    position: fixed;
    inset: 0;
    z-index: 600;
    display: grid;
    place-items: center;
}
.fav-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 18, 28, 0.32);
}
.fav-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(360px, calc(100vw - 32px));
    padding: 20px;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    box-shadow: var(--elevation-shadow);
}
.fav-modal__dialog h4 {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 600;
}
.fav-modal__dialog input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid var(--color-border-strong);
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    background: var(--color-surface);
    color: var(--color-text);
}
.fav-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

@media (max-width: 720px) {
    .fav-cards { grid-template-columns: 1fr; }
    .fav-export-btn span,
    .fav-export-btn { font-size: 12px; }
}

/* --- /account: история вердиктов — сетка компактных кубиков ------------ */

.verdict-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.verdict-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 156px;
    height: 100%;
    padding: 14px 42px 12px 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-sizing: border-box;
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
}

.verdict-card__note {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 6;
}

.verdict-card:hover {
    border-color: var(--color-border-strong);
    box-shadow: var(--elevation-shadow-soft);
}

.verdict-card:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 1px;
}

.verdict-card--pending {
    opacity: 0.55;
    pointer-events: none;
}

.verdict-card--collapsing {
    min-height: 0 !important;
    pointer-events: none;
}

.verdict-card__body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
}

.verdict-card__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--color-text);
    text-decoration: none;
    word-break: break-word;
    min-height: calc(1.35em * 2);
}

.verdict-card__title:hover {
    text-decoration: underline;
    color: var(--color-text);
}

.verdict-card__title mark {
    background: rgba(224, 171, 46, 0.28);
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}

.verdict-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    font-size: 12px;
    line-height: 1.35;
    color: var(--color-text-muted);
}

.verdict-card__customer {
    color: var(--color-text-muted);
    text-decoration: none;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

a.verdict-card__customer:hover {
    color: var(--color-text);
    text-decoration: underline;
}

.verdict-card__price {
    font-weight: 600;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}

.verdict-card__sub,
.verdict-card__date {
    font-size: 12px;
    line-height: 1.35;
    color: var(--color-text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.verdict-card__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--color-border);
}

.verdict-card__actions .verdict-mini {
    display: inline-flex;
    gap: 4px;
}

.verdict-card__actions .lot-card__fav {
    display: inline-flex;
    margin: 0;
}

.verdict-card__reset {
    margin-left: auto;
    font-size: 12px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

.verdict-folder-tabs {
    margin: 0 0 12px;
}
.verdict-card[draggable="true"] {
    cursor: grab;
}
.verdict-card--dragging {
    opacity: 0.28;
    cursor: grabbing;
}
.verdict-card__actions .fav-card__menu-wrap {
    position: relative;
}

.verdict-empty .muted {
    margin: 0;
}

#verdict-pagination {
    margin-top: 16px;
}

@media (max-width: 1100px) {
    .verdict-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .verdict-cards { grid-template-columns: 1fr; }
    .verdict-card { min-height: 0; }
}

/* --- /account: сохранённые поиски — карточки с чипами фильтров ---------- */

.saved-board {
    margin-bottom: var(--space-5);
}

.saved-board__head {
    margin-bottom: 12px;
}

.saved-board__title {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
}

.saved-board__empty {
    margin: 0;
    padding: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.saved-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.saved-card {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) 32px;
    gap: 8px;
    align-items: start;
    padding: 14px 12px 14px 10px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    min-width: 0;
    cursor: grab;
    user-select: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
}
.saved-card[hidden],
.saved-card--filtered-out {
    display: none !important;
}
.saved-card:hover {
    border-color: var(--color-border-strong);
    box-shadow: var(--elevation-shadow-soft);
}
.saved-card--dragging {
    opacity: 0.28;
    cursor: grabbing;
}
.saved-card__body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.saved-card__top {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.saved-card__name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-text);
    text-decoration: none;
}
.saved-card__name:hover {
    text-decoration: underline;
    color: var(--color-text);
}

.saved-card__delete { margin: 0; flex-shrink: 0; }
.saved-card__delete-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--color-text-faint);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.saved-card__delete-btn:hover {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.saved-card__date {
    font-size: 12px;
    color: var(--color-text-faint);
    margin-top: -4px;
}

.saved-card__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.saved-chip {
    display: inline-block;
    max-width: 100%;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background: var(--color-bg-2);
    border: 1px solid var(--color-border);
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saved-card__empty-filters {
    font-size: 13px;
    color: var(--color-text-faint);
    font-style: italic;
}

.saved-card__foot {
    margin-top: auto;
    padding-top: 4px;
}

.saved-card__open {
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    padding: 7px 12px;
}
.saved-card__open:hover { text-decoration: none; }

@media (max-width: 720px) {
    .saved-cards { grid-template-columns: 1fr; }
}

/* Смена пароля + иконка оргструктуры в одном ряду */
.account-settings {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}
.account-password {
    max-width: min(50%, 420px);
    width: 100%;
    box-sizing: border-box;
    margin: 0;
}
.account-password .comment-form .btn {
    align-self: stretch;
    width: 100%;
}

.org-icon-btn {
    flex: 0 0 auto;
    width: 88px;
    height: 88px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    text-decoration: none;
    box-sizing: border-box;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}
.org-icon-btn svg {
    width: 52px;
    height: 52px;
    display: block;
}
.org-icon-btn:hover {
    border-color: var(--color-border-strong);
    box-shadow: var(--elevation-shadow-soft);
    color: var(--color-text);
    text-decoration: none;
    background: var(--color-bg-2);
}
.org-icon-btn:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

@media (max-width: 720px) {
    .account-password { max-width: 100%; }
    .account-settings { align-items: stretch; }
    .org-icon-btn { width: 72px; height: 72px; }
    .org-icon-btn svg { width: 42px; height: 42px; }
}

/* --- Оргструктура (/org) ------------------------------------------------ */

.org-head { margin: var(--space-4) 0 var(--space-5); }
.org-head__title {
    margin: 0 0 var(--space-2);
    font-size: var(--text-heading);
    font-weight: 700;
}
.org-head__hint {
    margin: 0;
    max-width: 64ch;
    color: var(--color-text-muted);
    font-size: var(--text-body);
}

.org-flash {
    margin: 0 0 var(--space-4);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--color-danger-bg);
    color: var(--color-danger);
}
.org-flash--ok {
    background: rgba(5, 150, 105, 0.1);
    color: var(--color-success);
}

.org-card {
    margin-bottom: var(--space-4);
    padding: var(--space-4);
}
.org-card__title {
    margin: 0 0 var(--space-3);
    font-size: var(--text-subheading);
    font-weight: 650;
}
.org-card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}
.org-card__head .org-card__title { margin: 0; margin-right: auto; }

.org-sub {
    margin: var(--space-4) 0 var(--space-2);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.org-form--grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-3);
    align-items: end;
}
.org-form--add {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}
.org-form--inline {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: end;
    margin-top: var(--space-4);
}
.org-form__actions { display: flex; align-items: end; }

.org-rename {
    display: flex;
    gap: 8px;
    align-items: center;
}
.org-rename input {
    min-width: 160px;
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
}

.org-list { list-style: none; margin: 0; padding: 0; }
.org-list__item {
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}
.org-list__item:last-child { border-bottom: none; }

.org-person {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
}
.org-person--leader {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--color-bg-2);
    border: 1px solid var(--color-border);
}
.org-person__role {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
}
.org-person__login { font-weight: 650; }
.org-person__name { color: var(--color-text-muted); }
.org-person__pass {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 2px 8px;
}
.org-person__link { font-size: 13px; font-weight: 600; }
.org-inline-form { margin-left: auto; }
.org-empty { margin: 0; color: var(--color-text-muted); font-size: 14px; }

.org-kv {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-3);
    margin: 0 0 var(--space-4);
}
.org-kv dt {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
    margin: 0 0 4px;
}
.org-kv dd { margin: 0; font-weight: 600; }

.org-data-list { list-style: none; margin: 0; padding: 0; }
.org-data-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}
.org-data-list li:last-child { border-bottom: none; }
.org-data-list__meta {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--color-text-muted);
}
.org-comment {
    margin-top: 6px;
    white-space: pre-wrap;
    color: var(--color-text);
}

/* --- Скрам-доска (/scrum) ------------------------------------------------ */

.scrum-body .page--scrum {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-bottom: var(--space-4);
}

.scrum-empty-page {
    margin: var(--space-6) auto;
    max-width: 40rem;
    text-align: center;
    color: var(--color-text-muted);
}
.scrum-empty-page h1 {
    color: var(--color-text);
    margin-bottom: var(--space-3);
}

.scrum-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin: var(--space-3) 0 var(--space-4);
}
.scrum-toolbar__left {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
}
.scrum-toolbar__title {
    margin: 0;
    font-size: var(--text-heading);
    font-weight: 700;
}
.scrum-toolbar__right {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.scrum-team-pick {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text-muted);
}
.scrum-team-pick select {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
}

.scrum-board {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: var(--space-4);
    align-items: flex-start;
    min-height: 60vh;
    scrollbar-width: thin;
}

.scrum-col {
    flex: 0 0 280px;
    width: 280px;
    max-height: calc(100vh - 160px);
    display: flex;
    flex-direction: column;
    background: var(--color-bg-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}
.scrum-col__head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 10px 8px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
    flex-shrink: 0;
}
.scrum-col__title {
    flex: 1;
    min-width: 0;
    border: 1px solid transparent;
    background: transparent;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    color: var(--color-text);
    padding: 4px 6px;
    border-radius: 6px;
}
.scrum-col__title:hover,
.scrum-col__title:focus {
    border-color: var(--color-border-strong);
    background: var(--color-surface-raised);
    outline: none;
}
.scrum-col__title-static {
    flex: 1;
    margin: 0;
    font-size: 13px;
    font-weight: 650;
    padding: 4px 6px;
}
.scrum-col__count {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    background: var(--color-bg-2);
    border-radius: var(--radius-pill);
    padding: 2px 8px;
}
.scrum-col__delete {
    all: unset;
    cursor: pointer;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--color-text-faint);
    font-size: 16px;
    line-height: 1;
}
.scrum-col__delete:hover {
    color: var(--color-danger);
    background: var(--color-danger-bg);
}

.scrum-col__list {
    flex: 1;
    min-height: 80px;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.scrum-col__list.is-over {
    background: color-mix(in srgb, var(--color-accent) 6%, transparent);
}

.scrum-card {
    position: relative;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    box-shadow: var(--elevation-shadow-soft);
    cursor: grab;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.scrum-card:hover {
    border-color: var(--color-border-strong);
}
.scrum-card.is-dragging {
    opacity: 0.28;
    cursor: grabbing;
}
.scrum-board[data-readonly="1"] .scrum-card { cursor: default; }

.scrum-card__title {
    display: block;
    font-size: 13px;
    font-weight: 650;
    color: var(--color-text);
    text-decoration: none;
    line-height: 1.35;
    margin-right: 16px;
}
.scrum-card__title:hover { text-decoration: underline; }
.scrum-card__customer {
    margin-top: 4px;
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.3;
}
.scrum-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--color-text-faint);
    font-variant-numeric: tabular-nums;
}
.scrum-card__note {
    margin-top: 8px;
    font-size: 12px;
    color: var(--color-text-muted);
    white-space: pre-wrap;
}
.scrum-card__assignee {
    margin-top: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text);
}
.scrum-card__remove {
    all: unset;
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    color: var(--color-text-faint);
    opacity: 0;
    transition: opacity var(--transition-fast);
}
.scrum-card:hover .scrum-card__remove { opacity: 1; }
.scrum-card__remove:hover {
    color: var(--color-danger);
    background: var(--color-danger-bg);
}

.scrum-modal[hidden] { display: none; }
.scrum-modal {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}
.scrum-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 18, 28, 0.4);
}
.scrum-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(520px, 100%);
    max-height: min(80vh, 640px);
    overflow: auto;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    box-shadow: var(--elevation-shadow);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}
.scrum-modal__dialog h3 { margin: 0; font-size: var(--text-subheading); }
.scrum-modal__hint { margin: 0; font-size: 13px; color: var(--color-text-muted); }
.scrum-modal__search {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
}
.scrum-modal__results {
    min-height: 120px;
    max-height: 360px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.scrum-lot-hit {
    all: unset;
    display: block;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
}
.scrum-lot-hit:hover {
    background: var(--color-bg-2);
    border-color: var(--color-border);
}
.scrum-lot-hit__title {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}
.scrum-lot-hit__meta {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--color-text-muted);
}
.scrum-members-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.scrum-members-list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}
.scrum-members-list__item:last-child { border-bottom: none; }
.scrum-muted { color: var(--color-text-muted); font-size: 13px; }

@media (max-width: 720px) {
    .scrum-col { flex-basis: 86vw; width: 86vw; }
    .scrum-toolbar__title { font-size: 18px; }
}

