/* ============================================================================
   ФОРМЫ, ПОЛЯ ВВОДА И ФИЛЬТРЫ
   ============================================================================ */

/* ----------------------------------------------------------------------------
   Цветовые переменные для форм
   ---------------------------------------------------------------------------- */
:root {
    --form-border-color: rgba(16, 100, 209, 0.3);
    --form-border-focus: var(--brand-blue);
    --form-focus-shadow: rgba(16, 100, 209, 0.1);
    --form-bg: #ffffff;
    --form-text: var(--brand-text);
    --form-placeholder: #9ca3af;
    --form-error-bg: rgba(220, 38, 38, 0.2);
    --form-error-border: rgba(239, 68, 68, 0.5);
    --form-error-text: #fca5a5;
    --form-hint-text: #6b7280;
    --form-gray-bg: #f3f4f6;
    --form-gray-border: #e5e7eb;
    --form-gray-hover: #e5e7eb;
    --choices-hover-bg: rgba(139, 92, 246, 0.1);
    --choices-selected-bg: rgba(139, 92, 246, 0.15);
}

/* ----------------------------------------------------------------------------
   Карточка авторизации
   ---------------------------------------------------------------------------- */
.auth-card {
    margin: 4rem auto;
    max-width: 28rem;
    padding: 2.5rem;
    
    background: var(--card-bg);
    border: 2px solid var(--form-border-color);
    border-radius: 12px;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.1);
}

.auth-card h2 {
    margin: 0 0 1.5rem 0;
    text-align: center;
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 600;
    background: linear-gradient(120deg, var(--brand-red), var(--brand-purple));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.auth-card .errorlist,
.auth-card .non-field-errors {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
    color: var(--form-error-text);
    font-size: 0.875rem;
}

.auth-card .errorlist li,
.auth-card .non-field-errors li {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: var(--form-error-bg);
    border: 1px solid var(--form-error-border);
    border-radius: 6px;
}

/* ----------------------------------------------------------------------------
   Поля формы
   ---------------------------------------------------------------------------- */
.form-field {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
}

.form-field label {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--form-text);
    opacity: 0.9;
}

.form-field input,
.form-field select,
.form-field textarea {
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5rem;
    
    background: var(--form-bg);
    border: 2px solid var(--form-border-color);
    border-radius: 10px;
    color: var(--form-text);
    
    outline: 2px solid transparent;
    outline-offset: 2px;
}

/* Специфичные стили для select полей - убираем стандартные стили браузера */
.form-field select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: var(--form-bg) !important;
    color: var(--form-text) !important;
    border: 2px solid var(--form-border-color) !important;
    border-radius: 10px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231064d1' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 12px;
    padding-right: 2.5rem;
    cursor: pointer;
}

.form-field select:focus {
    outline: none;
    border-color: var(--form-border-focus);
    box-shadow: 0 0 0 3px var(--form-focus-shadow);
}

.form-field textarea {
    min-height: 48px;
    resize: none;
    overflow: hidden;
}

.form-field input:disabled,
.form-field select:disabled,
.form-field textarea:disabled {
    background: var(--form-gray-bg);
    color: var(--form-text);
    opacity: 1;
    border-color: var(--form-gray-border);
}

/* Убеждаемся, что активные select поля имеют правильные стили */
.form-field select:not(:disabled) {
    background: var(--form-bg) !important;
    border: 2px solid var(--form-border-color) !important;
    border-radius: 10px !important;
    color: var(--form-text) !important;
}

.form-field input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #1064d1;
}

.form-field input[type="checkbox"]:checked {
    accent-color: #1064d1;
}

/* ----------------------------------------------------------------------------
   Ошибки валидации полей формы
   ---------------------------------------------------------------------------- */
.form-field .errorlist,
.form-field ul.errorlist {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
    color: #dc2626;
    font-size: 0.875rem;
    font-weight: 500;
}

.form-field .errorlist li,
.form-field ul.errorlist li {
    margin-bottom: 0.25rem;
    padding: 0.5rem 0.75rem;
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.5);
    border-radius: 6px;
    color: #dc2626;
}

.form-field .errorlist li:last-child,
.form-field ul.errorlist li:last-child {
    margin-bottom: 0;
}

/* Общие ошибки формы (non_field_errors) */
.non-field-errors,
ul.non-field-errors {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
    color: #dc2626;
    font-size: 0.875rem;
    font-weight: 500;
}

.non-field-errors li,
ul.non-field-errors li {
    margin-bottom: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.5);
    border-radius: 8px;
    color: #dc2626;
}

.non-field-errors li:last-child,
ul.non-field-errors li:last-child {
    margin-bottom: 0;
}

/* Убираем стрелки у числовых полей */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.form-hint {
    margin-bottom: 1rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: var(--form-hint-text);
}

/* ----------------------------------------------------------------------------
   Сетка формы
   ---------------------------------------------------------------------------- */
.form-grid {
    margin-bottom: 1.5rem;
    display: grid;
    gap: 1.25rem;
}

@media (min-width: 640px) {
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .form-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ----------------------------------------------------------------------------
   Заголовки форм
   ---------------------------------------------------------------------------- */
.form-title {
    margin-bottom: 0.5rem;
    font-size: 1.75rem;
    font-weight: 600;
    background: linear-gradient(120deg, var(--brand-red), var(--brand-purple));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Заголовок формы создания/редактирования заявки - синий цвет */
.application-form-content .form-title,
.application-detail-content .form-title {
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
    -webkit-text-fill-color: unset;
    color: #1064d1;
    font-weight: 700;
}

/* Заголовок формы в режиме просмотра */
.application-detail-content #viewMode .form-title,
.application-form-content #viewMode .form-title {
    margin-bottom: 2rem;
    font-size: 2.25rem;
    font-weight: 800;
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
    color: #1064d1;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

/* ============================================================================
   DETAIL VIEW SECTIONS (перенесено из detail_view_sections.html)
   ============================================================================ */
.detail-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.compact-card.section-card {
    padding: 1.25rem 1.25rem 1rem;
    border-radius: 12px;
    gap: 0.75rem;
}
.pill-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.5rem;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}
.pill-item {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    text-align: center;
}
.pill-label {
    font-size: 0.75rem;
    color: #6b7280;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}
.pill-value {
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.section-heading {
    margin-bottom: 0.25rem;
}
.split-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    position: relative;
}
.split-card::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #e5e7eb;
}
@media (max-width: 768px) {
    .split-card {
        grid-template-columns: 1fr;
    }
    .split-card::before {
        display: none;
    }
}

/* Итоги: расчётные карточки (тело, комиссия, сумма) */
.financial-kpi-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.625rem;
    width: 100%;
    align-self: start;
}
.financial-kpi-card {
    background: #f8f9fa;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    box-sizing: border-box;
}
.financial-kpi-card__label {
    margin: 0 0 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4b5563;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.3;
}
.financial-kpi-card__value {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.2;
    word-break: break-word;
}

.stacked-list {
    display: grid;
    gap: 0.5rem;
}
.info-line {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #ffffff;
}
.info-line .info-label {
    margin: 0;
    color: #6b7280;
    font-size: 0.875rem;
    white-space: nowrap;
}
.info-line .info-value {
    margin: 0;
    color: #111827;
    font-weight: 600;
    text-align: right;
}
.tight-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.card-chip {
    padding: 0.75rem 0.875rem;
    border: 1px dashed #e5e7eb;
    border-radius: 10px;
    background: #f8fafc;
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 0.25rem;
    min-height: 4.5rem;
}
.card-chip .info-label {
    min-height: 2.5rem;
    line-height: 1.4;
}
.card-chip .info-value {
    align-self: end;
}
.fold-card {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.75rem 0.875rem;
    background: #f9fafb;
    height: auto;
    min-height: auto;
    max-height: none;
    width: 100%;
}
.grid-2col > .fold-card {
    padding: 1rem 1.25rem;
}
.fold-card summary {
    cursor: pointer;
    font-weight: 600;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.fold-card summary::-webkit-details-marker {
    display: none;
}
.fold-card summary:before {
    content: "▸";
    font-size: 0.9rem;
    color: #6b7280;
}
.fold-card[open] summary:before {
    content: "▾";
}
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    margin-top: 0.75rem;
    align-items: start;
    width: 100%;
}
.grid-2col > details {
    width: 100%;
    height: auto;
    min-height: auto;
    max-height: none;
}
.grid-2col > details:not(:first-child) {
    border-left: 1px solid #e5e7eb;
    padding-left: 2.5rem;
}
.grid-2col > details[open] {
    height: auto;
}
@media (max-width: 768px) {
    .grid-2col {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .grid-2col > details:not(:first-child) {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid #e5e7eb;
        padding-top: 0.75rem;
        margin-top: 0.75rem;
    }
}
.subsection-title {
    margin: 0.25rem 0 0.5rem;
    font-weight: 700;
    color: #111827;
}
.note-text {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0.25rem 0 0;
}
.line-plain {
    border: none;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 0;
    background: transparent;
    padding: 0.5rem 0;
}
/* ----------------------------------------------------------------------------
   Поиск и фильтры
   ---------------------------------------------------------------------------- */
.search-inline {
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 2.5rem;
}

.detail-card {
    margin-bottom: 2.5rem;
}

.filters-form {
    margin-top: 2.5rem;
    margin-bottom: 2rem;
    min-height: auto;
    height: auto;
    
    display: flex;
    align-items: flex-start;
    align-content: flex-start;
    gap: 0.75rem;
    flex-wrap: wrap;
    width: 100%;
    overflow-x: visible;
    
    transition: none;
    contain: layout style;
    box-sizing: border-box;
    row-gap: 0.75rem;
    position: relative;
    z-index: 1;
}

/* Две строки: поля фильтра и отдельно «на странице» + сброс — без сдвига соседних контролов */
.filters-form.filters-form--stacked {
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
}

.filters-form.filters-form--stacked .filters-form-main {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    align-content: flex-start;
    gap: 0.75rem;
    width: 100%;
    box-sizing: border-box;
}

/* Полноширинная очерченная панель фильтров под вкладками статусов (дашборд / админ. сегмента) */
.dashboard-filters-panel {
    width: 100%;
    box-sizing: border-box;
    margin-top: 0;
    /* Снизу без padding: зазор до строки per_page считается от нижней границы рамки (gap формы), а не от кнопки «Сбросить» */
    padding: 0.85rem 1.1rem 0 1.1rem;
    border: 1px solid rgba(16, 100, 209, 0.28);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 248, 255, 0.92));
    box-shadow: 0 1px 3px rgba(16, 100, 209, 0.06);
}

.dashboard-filters-panel .filters-form--stacked .filters-form-main {
    margin-top: 0;
}

/* Одна линия по вертикали с полями поиска: перебиваем align-items:flex-start у stacked-формы */
.filters-form.filters-form--stacked .dashboard-filters-panel .filters-form-main.dashboard-filters-panel__main {
    align-items: center;
}

.dashboard-filters-panel .dashboard-filters-panel__main {
    align-items: center;
    /* Небольшой отступ только внутри блока полей, чтобы контролы не касались нижней границы панели */
    padding-bottom: 0.35rem;
}

.dashboard-filters-panel .dashboard-filters-panel__reset {
    margin-left: auto;
    flex-shrink: 0;
    align-self: center;
}

/* Поля даты в панели фильтров: обе подписи отображаются внутри полей */
.dashboard-filters-panel .dashboard-filter-date-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex-shrink: 0;
    align-self: center;
}

.dashboard-filters-panel .dashboard-filter-date-field--inline-label {
    position: relative;
    flex-direction: row;
    align-items: center;
    gap: 0;
}

.dashboard-filters-panel .dashboard-filter-date-inline-label {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 1;
    font-size: 0.875rem;
    font-weight: 400;
    color: rgba(100, 116, 139, 0.95);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 2.75rem);
    transition: opacity 0.15s ease;
}

.dashboard-filters-panel .dashboard-filter-date-field--inline-label:focus-within .dashboard-filter-date-inline-label,
.dashboard-filters-panel .dashboard-filter-date-field--filled .dashboard-filter-date-inline-label {
    opacity: 0;
}

/* Скрываем шаблон «дд.мм.ггг» / «mm/dd/yyyy» целиком (Chrome/Safari и др. WebKit) */
.dashboard-filters-panel .dashboard-filter-date-field--inline-label:not(.dashboard-filter-date-field--filled):not(:focus-within) input[type="date"]::-webkit-datetime-edit,
.dashboard-filters-panel .dashboard-filter-date-field--inline-label:not(.dashboard-filter-date-field--filled):not(:focus-within) input[type="date"]::-webkit-datetime-edit-fields-wrapper,
.dashboard-filters-panel .dashboard-filter-date-field--inline-label:not(.dashboard-filter-date-field--filled):not(:focus-within) input[type="date"]::-webkit-datetime-edit-text,
.dashboard-filters-panel .dashboard-filter-date-field--inline-label:not(.dashboard-filter-date-field--filled):not(:focus-within) input[type="date"]::-webkit-datetime-edit-month-field,
.dashboard-filters-panel .dashboard-filter-date-field--inline-label:not(.dashboard-filter-date-field--filled):not(:focus-within) input[type="date"]::-webkit-datetime-edit-day-field,
.dashboard-filters-panel .dashboard-filter-date-field--inline-label:not(.dashboard-filter-date-field--filled):not(:focus-within) input[type="date"]::-webkit-datetime-edit-year-field {
    color: transparent;
}

/* Firefox: пустое поле без фокуса — скрываем нативную подпись, при фокусе и после выбора даты цвет из темы */
.dashboard-filters-panel .dashboard-filter-date-field--inline-label:not(.dashboard-filter-date-field--filled):not(:focus-within) input[type="date"] {
    color: transparent;
}

.dashboard-filters-panel .dashboard-filter-date-field--inline-label:focus-within input[type="date"],
.dashboard-filters-panel .dashboard-filter-date-field--filled input[type="date"] {
    color: var(--form-text);
}

.dashboard-filters-panel .dashboard-filter-date-field label {
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(30, 41, 59, 0.88);
    line-height: 1.15;
    letter-spacing: 0.01em;
}

.dashboard-filters-panel .dashboard-filter-date-field input[type="date"] {
    min-height: 42px;
    box-sizing: border-box;
}

/* Тот же отступ, что между статусами и панелью и между строкой per_page и таблицей */
form.dashboard-filters-panel__form.filters-form--stacked {
    gap: var(--dashboard-filters-stack-gap, 0.75rem);
    row-gap: var(--dashboard-filters-stack-gap, 0.75rem);
    /* Иначе снизу суммируется с отступом до таблицы (#dashboardTableContainer) */
    margin-bottom: 0;
}

/* Строка «N на странице» + счётчик: под очерченной панелью, над таблицей, по правому краю */
.filters-form.filters-form--stacked .filters-form-meta.dashboard-filters-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    row-gap: 0.5rem;
    width: 100%;
    box-sizing: border-box;
    margin-top: 0;
    margin-bottom: 0;
    padding: 0;
}

/* Вкладки статусов → панель фильтров (тот же зазор, что и панель → per_page → таблица) */
.dashboard-card.single .status-filter-row {
    margin-top: 1rem;
    margin-bottom: var(--dashboard-filters-stack-gap, 0.75rem);
}

.dashboard-card.single form.dashboard-filters-panel__form.filters-form {
    margin-top: 0 !important;
}

.dashboard-card.single .dashboard-filters-panel {
    margin-top: 0;
}

.filters-form.filters-form--stacked .filters-form-meta:not(.dashboard-filters-meta-row) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    row-gap: 0.75rem;
    width: 100%;
    box-sizing: border-box;
}

/* До шапки таблицы — тот же базовый зазор, что между панелью и строкой per_page (fallback, если кэш без variables.css) */
#dashboardTableContainer {
    margin-top: var(--dashboard-filters-stack-gap, 0.75rem);
    position: relative;
    z-index: 0;
    clear: both;
}

/* Таблица заявок — ширина как у панели фильтров (без «выпирания» .table-wrapper за счёт отрицательных margin из tables.css) */
.dashboard-card.single #dashboardTableContainer {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.dashboard-card.single #dashboardTableContainer .status-table-form {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.dashboard-card.single #dashboardTableContainer .table-wrapper {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Поля фильтров */
.filters-form input[type="date"],
.filters-form input[type="text"],
.filters-form select,
.search-inline input[type="text"] {
    height: 42px;
    padding: 0.75rem 1rem;
    line-height: 1.5;
    
    background: var(--form-bg);
    border: 2px solid var(--form-border-color);
    border-radius: 10px;
    color: var(--form-text);
    
    transition: none;
    box-sizing: border-box;
}

.filters-form input[type="text"],
.search-inline input[type="text"] {
    width: 220px;
    min-width: 220px;
    max-width: 220px;
    flex-shrink: 0;
    flex-grow: 0;
}

.filters-form .filter-select,
.filters-form input[type="date"],
.filters-form select {
    width: 180px;
    min-width: 180px;
    max-width: 180px;
    flex-shrink: 0;
    flex-grow: 0;
    box-sizing: border-box;
}

#subagentFilter {
    width: 180px;
    min-width: 180px;
    max-width: 180px;
    height: 42px;
    flex-shrink: 0;
    flex-grow: 0;
    box-sizing: border-box;
    line-height: 42px;
    padding: 0 1rem;
    padding-right: 2.25rem;
    vertical-align: middle;
}

.dashboard-subagent-filter-choices,
.dashboard-subagent-filter-choices .choices__inner {
    width: 180px;
    min-width: 180px;
    max-width: 180px;
}

#paymentDateFilter {
    width: 170px;
    min-width: 170px;
    max-width: 170px;
    flex-shrink: 0;
    flex-grow: 0;
    box-sizing: border-box;
}

#perPageSelect {
    width: 140px;
    min-width: 140px;
    max-width: 140px;
    flex-shrink: 0;
    flex-grow: 0;
    box-sizing: border-box;
}

.filters-form .secondary-button {
    width: 180px;
    min-width: 180px;
    max-width: 180px;
    padding: 0.75rem 1rem;
    flex-shrink: 0;
    flex-grow: 0;
    white-space: nowrap;
    box-sizing: border-box;
}

/* Выравнивание кастомных селектов Choices в панели фильтров */
.filters-form .choices {
    height: 42px;
    min-height: 42px;
    max-height: 42px;
    display: flex;
    align-items: center;
    align-self: center;
    margin: 0;
}

.filters-form .choices .choices__inner {
    height: 42px;
    min-height: 42px;
    max-height: 42px;
    padding: 0.5rem 1rem !important;
    box-sizing: border-box;
}

/* Фокус для полей фильтров */
.filters-form input[type="date"]:focus,
.filters-form input[type="text"]:focus,
.filters-form select:focus,
.search-inline input[type="text"]:focus {
    outline: none;
    border-color: var(--form-border-focus);
    box-shadow: 0 0 0 3px var(--form-focus-shadow);
}

/* Стили для опций в select фильтров */
.filters-form select {
    cursor: pointer;
    color-scheme: light;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border-radius: 12px;
    background-color: var(--form-bg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%231064d1' stroke-width='2.2' 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 0.65rem center;
    background-size: 0.875rem;
    padding-right: 2.25rem;
}

.filters-form select option {
    background: var(--form-bg);
    color: var(--form-text);
    padding: 8px 12px;
}

.filters-form select option:hover,
.filters-form select option:focus,
.filters-form select option:checked {
    background: var(--choices-hover-bg);
    color: var(--form-text);
}

.filters-form select:focus {
    color-scheme: light;
}

/* Специфичные стили для per_page селектора */
#perPageSelect,
.filter-select {
    color-scheme: light;
    background-color: var(--form-bg);
}

#perPageSelect:focus,
.filter-select:focus {
    color-scheme: light;
    background-color: var(--form-bg);
}

#perPageSelect option,
.filter-select option {
    background-color: var(--form-bg);
    color: var(--form-text);
}

#perPageSelect option:hover,
.filter-select option:hover {
    background-color: var(--choices-hover-bg);
    color: var(--form-text);
}

#perPageSelect option:checked,
.filter-select option:checked {
    background-color: var(--choices-selected-bg);
    color: var(--form-text);
}

#perPageSelect option:focus,
.filter-select option:focus {
    background-color: var(--choices-hover-bg);
    color: var(--form-text);
}

/* Стили для календаря */
.filters-form input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(0.8) sepia(0.2) saturate(2) hue-rotate(230deg);
}

/* Цвет текста даты — мягкий серый как у фильтра по клиентам (не ярко чёрный) */
.filters-form input[type="date"]::-webkit-datetime-edit,
.filters-form input[type="date"]::-webkit-datetime-edit-fields-wrapper {
    color: #4b5563;
}

.filters-form input[type="date"]::-webkit-datetime-edit-text {
    color: var(--form-placeholder);
}

.filters-form input[type="date"]::-webkit-datetime-edit-day-field,
.filters-form input[type="date"]::-webkit-datetime-edit-month-field,
.filters-form input[type="date"]::-webkit-datetime-edit-year-field {
    color: #4b5563;
}

/* Поля даты в форме заявки (дата платежа, дата ПП) и в модальных окнах */
.form-field input[type="date"]::-webkit-datetime-edit,
.form-field input[type="date"]::-webkit-datetime-edit-fields-wrapper,
input.modal-input[type="date"]::-webkit-datetime-edit,
input.modal-input[type="date"]::-webkit-datetime-edit-fields-wrapper {
    color: #4b5563;
}

.form-field input[type="date"]::-webkit-datetime-edit-text,
input.modal-input[type="date"]::-webkit-datetime-edit-text {
    color: var(--form-placeholder);
}

.form-field input[type="date"]::-webkit-datetime-edit-day-field,
.form-field input[type="date"]::-webkit-datetime-edit-month-field,
.form-field input[type="date"]::-webkit-datetime-edit-year-field,
input.modal-input[type="date"]::-webkit-datetime-edit-day-field,
input.modal-input[type="date"]::-webkit-datetime-edit-month-field,
input.modal-input[type="date"]::-webkit-datetime-edit-year-field {
    color: #4b5563;
}

/* ----------------------------------------------------------------------------
   Поисковые селекты
   ---------------------------------------------------------------------------- */
.filters-form .searchable-select-wrapper {
    min-width: 180px;
}

.form-field .searchable-select-wrapper {
    width: 100%;
}

.searchable-select-option.selected {
    background: var(--choices-hover-bg);
    font-weight: 600;
}

.searchable-select-option.hidden {
    display: none;
}

/* ----------------------------------------------------------------------------
   Choices.js - базовые стили
   ---------------------------------------------------------------------------- */
.choices {
    margin-bottom: 0;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5rem;
    color: var(--form-text);
}

.choices__inner {
    background: var(--form-bg) !important;
    color: var(--form-text) !important;
    border: 2px solid var(--form-border-color) !important;
    border-radius: 10px !important;
    padding: 0.75rem 1rem !important;
    min-height: 48px;
    display: flex;
    align-items: center;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5rem;
    box-shadow: none;
}

.choices__inner * {
    background-color: transparent;
}

.choices.is-focused .choices__inner,
.choices__inner:focus {
    border-color: var(--form-border-focus);
    box-shadow: 0 0 0 3px var(--form-focus-shadow);
}

.choices__placeholder {
    color: var(--form-placeholder);
    opacity: 1;
    font-size: 1rem;
}

.choices__input {
    background: var(--form-bg);
    color: var(--form-text);
    border: 2px solid var(--form-border-color);
    padding: 8px;
    margin-bottom: 4px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.4;
}

.choices__input:focus {
    outline: none;
    background: var(--form-bg);
    border: 1px solid var(--form-border-focus);
}

.choices__list--single {
    padding: 0;
    display: flex;
    align-items: center;
    height: 100%;
}

.choices__item--selectable {
    color: var(--form-text);
}

.choices__list--single .choices__item--selectable {
    display: flex;
    align-items: center;
    height: 100%;
    line-height: 1.5rem;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 400;
}

/* ----------------------------------------------------------------------------
   Choices.js - выпадающий список
   ---------------------------------------------------------------------------- */
.choices__list--dropdown {
    display: none;
    background-color: var(--form-bg);
    backdrop-filter: blur(10px);
    border: 2px solid var(--form-border-color);
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    margin-top: 8px;
    max-height: 350px;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 300px;
    padding: 8px 0;
}

.choices[data-type*="select-one"] .choices__list--dropdown {
    width: auto;
    min-width: 100%;
    max-width: 500px;
}

.choices.is-open .choices__list--dropdown {
    display: block;
}

.choices__list--dropdown .choices__item {
    color: var(--form-text);
    background: transparent;
    padding: 10px 16px;
    min-height: auto;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5rem;
    transition: all 0.2s ease;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border-radius: 8px;
    border: none;
    margin: 2px 4px;
    box-sizing: border-box;
}

.choices__list--dropdown .choices__item * {
    border-radius: 8px;
    border: none;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background: var(--choices-hover-bg);
    color: var(--form-text);
    border-radius: 8px;
    border: none;
}

.choices__list--dropdown .choices__item--selectable[aria-selected="true"] {
    background: var(--choices-selected-bg);
    color: var(--form-text);
    font-weight: 600;
    border-radius: 8px;
    border: none;
}

.choices__item--choice.has-no-results {
    color: var(--form-placeholder);
    background: transparent;
    font-style: italic;
}

.choices__item--disabled {
    color: #d1d5db;
    background: transparent;
}

.choices__list--multiple .choices__item {
    background: var(--choices-hover-bg);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: var(--form-text);
    border-radius: 6px;
}

.choices__button {
    background: rgba(220, 38, 38, 0.5);
    border: none;
    color: #fff;
    opacity: 1;
}

.choices__button:hover {
    background: rgba(239, 68, 68, 0.7);
}

.choices,
.choices *,
.choices__inner,
.choices__list,
.choices__list--dropdown,
.choices__list--multiple,
.choices__list--single {
    background-color: transparent;
    /* Сбрасываем inline will-change от Choices.js — иначе бюджет Chromium на длинных формах */
    will-change: auto !important;
}

.choices[data-type*="select-one"]:after {
    border-color: #6b7280 transparent transparent;
}

.choices[data-type*="select-one"].is-open:after {
    border-color: transparent transparent #6b7280;
}

/* Скроллбар для выпадающего списка */
.choices__list--dropdown::-webkit-scrollbar {
    width: 8px;
}

.choices__list--dropdown::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.choices__list--dropdown::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 4px;
}

.choices__list--dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.5);
}

/* ----------------------------------------------------------------------------
   Choices.js - стили для статусов (унифицированный дизайн)
   ---------------------------------------------------------------------------- */
.status-select + .choices .choices__inner,
td .choices .choices__inner {
    width: 100%;
    min-width: 180px;
    max-width: 200px;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    min-height: 48px;
    display: flex;
    align-items: center;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5rem;
    background: var(--form-bg) !important;
    border: 2px solid var(--form-border-color) !important;
    border-radius: 10px !important;
    color: var(--form-text) !important;
    position: relative;
    box-sizing: border-box;
    box-shadow: none;
}

.status-select + .choices .choices__list--single,
td .choices .choices__list--single {
    padding: 0;
    display: flex;
    align-items: center;
    height: 100%;
}

.status-select + .choices .choices__item--selectable,
td .choices .choices__item--selectable {
    color: var(--form-text) !important;
    display: flex;
    align-items: center;
    font-size: 1rem;
    line-height: 1.5rem;
    margin: 0;
    padding: 0;
}

/* Выпадающий список статусов */
.status-select + .choices .choices__list--dropdown .choices__item--selectable {
    padding: 0.75rem 1rem;
    margin: 0;
    line-height: 1.5rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border-radius: 0;
    border: none !important;
    border-top: none !important;
    border-bottom: none !important;
    border-left: none !important;
    border-right: none !important;
    color: var(--form-text) !important;
    background: var(--form-bg) !important;
}

.status-select + .choices,
.status-select + .choices.status-choices-outer {
    position: relative;
    display: inline-block;
    width: auto;
    min-width: 180px;
    max-width: 200px;
    box-sizing: border-box;
    z-index: 11000; /* Базовый z-index для контейнера */
}

/* Открытый список должен быть выше закрытых */
.status-select + .choices.is-open {
    z-index: 12000 !important; /* Высокий z-index для открытого контейнера */
}

.status-select + .choices .choices__inner {
    width: 100%;
    min-width: 180px;
    max-width: 200px;
}

.status-select + .choices .choices__list--dropdown {
    width: 100%;
    min-width: 180px;
    max-width: 200px;
    box-sizing: border-box;
    position: absolute;
    top: 100%;
    left: 0;
    right: auto;
    z-index: 11000 !important; /* Базовый z-index для закрытых списков */
    background: var(--form-bg) !important;
    border: 2px solid var(--form-border-color) !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin-top: 4px;
    margin-left: 0;
    margin-right: 0;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    /* Изолируем выпадающий список от стилей таблицы */
    isolation: isolate;
}

.status-select + .choices.is-open .choices__list--dropdown {
    display: block;
    visibility: visible;
    opacity: 1;
    position: absolute;
    top: 100%;
    bottom: auto;
    transform: none;
    width: 100%;
    min-width: 180px;
    max-width: 200px;
    z-index: 12000 !important; /* Еще более высокий z-index для открытого списка - перекрывает закрытые списки */
}

/* Choices.js при position:auto вешает .is-flipped — не фиксировать top:100%, иначе список обрезается overflow-родителем */
.status-select + .choices.is-open.is-flipped .choices__list--dropdown {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 4px;
}

.status-select + .choices .choices__list--dropdown .choices__item {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border: none !important;
    border-top: none !important;
    border-bottom: none !important;
    border-left: none !important;
    border-right: none !important;
    color: var(--form-text) !important;
    background: var(--form-bg) !important;
}

.status-select + .choices .choices__list--dropdown .choices__item:hover,
.status-select + .choices .choices__list--dropdown .choices__item.is-highlighted {
    background-color: var(--choices-hover-bg) !important;
    color: var(--form-text) !important;
    border-bottom: none !important;
}

/* Убираем все разделители между элементами выпадающего списка статусов */
.status-select + .choices .choices__list--dropdown .choices__item:not(:last-child) {
    border-bottom: none !important;
}

.status-select + .choices .choices__list--dropdown .choices__item:first-child {
    border-top: none !important;
    border-bottom: none !important;
}

.status-select + .choices .choices__list--dropdown .choices__item:last-child {
    border-bottom: none !important;
}

/* Стрелка выпадающего списка для статусов */
.status-select + .choices .choices__inner::after {
    content: '';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--form-border-color);
    pointer-events: none;
    transition: transform 0.2s ease;
}

.status-select + .choices.is-open .choices__inner::after {
    border-top: none;
    border-bottom: 5px solid var(--form-border-color);
    transform: translateY(-50%) rotate(180deg);
}

/* Фокус для статусов */
.status-select + .choices.is-focused .choices__inner,
.status-select + .choices .choices__inner:focus {
    border-color: var(--form-border-focus) !important;
    box-shadow: 0 0 0 3px var(--form-focus-shadow) !important;
}

/* Для статусов - переопределяем общие стили */
.status-select + .choices[data-type*="select-one"] .choices__list--dropdown {
    width: 100%;
    min-width: 180px;
    max-width: 200px;
}

/* Фильтр субагента (Choices.js): см. choices-overrides.css — подключается после choices.min.css */

/* ----------------------------------------------------------------------------
   Адаптивность для фильтров
   ---------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .filters-form {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        padding-bottom: 0.5rem;
        gap: 0.625rem;
    }
    
    .filters-form > * {
        scroll-snap-align: start;
        flex-shrink: 0;
    }
    
    .filters-form .filter-select,
    .filters-form input[type="date"],
    .filters-form select {
        min-width: 180px;
        width: 180px;
        max-width: 180px;
    }
    
    .filters-form input[type="text"],
    .search-inline input[type="text"] {
        min-width: 200px;
        width: 200px;
        max-width: 200px;
    }
    
    #subagentFilter {
        min-width: 180px;
        width: 180px;
        max-width: 180px;
    }
    
    .dashboard-subagent-filter-choices,
    .dashboard-subagent-filter-choices .choices__inner {
        min-width: 180px;
        width: 180px;
        max-width: 180px;
    }
    
    .dashboard-subagent-filter-choices .choices__list--dropdown {
        min-width: 200px;
        max-width: 100%;
    }
    
    .filters-form .secondary-button {
        min-width: 160px;
        width: 160px;
        max-width: 160px;
    }
}

@media (max-width: 768px) {
    .search-inline,
    .filters-form {
        flex-direction: column;
        flex-wrap: wrap;
        overflow-x: visible;
        gap: 0.625rem;
        height: auto;
        min-height: auto;
    }
    
    .filters-form > * {
        flex-shrink: 1;
    }
    
    .filters-form input[type="text"],
    .search-inline input[type="text"],
    .filters-form .filter-select,
    .filters-form input[type="date"],
    .filters-form select {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }
    
    #subagentFilter,
    .dashboard-subagent-filter-choices,
    .dashboard-subagent-filter-choices .choices__inner {
        min-width: 100% !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .dashboard-subagent-filter-choices .choices__list--dropdown {
        min-width: 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    
    .filters-form .secondary-button {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }
    
    .secondary-button {
        width: 100%;
    }
    
    /* Choices.js селекторы - полная ширина */
    .filters-form .choices {
        width: 100% !important;
    }
    
    .filters-form .choices .choices__inner {
        width: 100% !important;
    }
    
    #paymentDateFilter {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }
    
    #perPageSelect {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }
}

@media (max-width: 480px) {
    .filters-form {
        gap: 0.5rem;
    }
    
    .filters-form input[type="date"],
    .filters-form input[type="text"],
    .filters-form select,
    .search-inline input[type="text"] {
        height: 40px;
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .filters-form .choices .choices__inner {
        height: 40px;
        min-height: 40px;
        padding: 0.4rem 0.75rem !important;
    }
}

/* ----------------------------------------------------------------------------
   Адаптивность для форм
   ---------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .auth-card {
        margin: 2rem auto;
        padding: 1.5rem;
        max-width: 95%;
    }
    
    .form-field input,
    .form-field select,
    .form-field textarea {
        font-size: 16px; /* Предотвращает зум на iOS */
    }
}

/* ----------------------------------------------------------------------------
   Специальные стили для дашборда
   ---------------------------------------------------------------------------- */
.dashboard-card .status-filter-panel {
    margin-top: 2.5rem;
    margin-bottom: 0.75rem;
    min-height: 2.5rem;
    height: 2.5rem;
    transition: none;
    contain: layout style;
}

.dashboard-card .filters-form {
    margin-top: 0.5rem;
    min-height: 3rem;
    height: 3rem;
    transition: none;
    contain: layout style;
    box-sizing: border-box;
}

/* Дашборд / админ. сегмента: панель фильтров + строка per_page — без фиксированной высоты формы */
.dashboard-card .filters-form.dashboard-filters-panel__form {
    height: auto;
    min-height: 0;
    contain: layout;
}

.status-filter-panel {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    flex: 1;
    margin-bottom: 1rem;
    margin-top: 0.5rem;
    min-height: 3rem;
    height: 3rem;
    overflow: hidden;
    transition: none;
    contain: layout style;
}

@media (max-width: 768px) {
    .status-filter-panel {
        gap: 0.4rem;
    }
    
    .status-filter-button {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        flex: 1 1 auto;
        min-width: calc(50% - 0.2rem);
    }
}

@media (max-width: 480px) {
    .status-filter-button {
        min-width: 100%;
        font-size: 0.8rem;
        padding: 0.45rem 0.65rem;
    }
}

.status-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .status-actions {
        flex-direction: column;
    }
    
    .status-save-button {
        width: 100%;
        text-align: center;
    }
}

/* Компактные строки деталей заявки */
.info-rows {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.info-rows.two-col {
    column-gap: 1rem;
}

.info-row {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.info-row.full {
    grid-template-columns: 1fr;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label-inline {
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

.info-value-inline {
    color: #111827;
    word-break: break-word;
}

.section-card .section-heading {
    margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
    .info-row {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }
}

/* ----------------------------------------------------------------------------
   Выбор активной схемы (фиат / крипто) — сегментный переключатель
   ---------------------------------------------------------------------------- */
.scheme-truth-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.scheme-segment {
    display: inline-flex;
    align-self: flex-start;
    padding: 4px;
    gap: 0;
    border-radius: 999px;
    background: linear-gradient(180deg, #eef2f7 0%, #e5e9f0 100%);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.85);
    margin-bottom: 0.85rem;
}

.scheme-segment__btn {
    position: relative;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 0.55rem 1.35rem;
    border-radius: 999px;
    color: #64748b;
    background: transparent;
    transition: color 0.2s ease, box-shadow 0.22s ease, transform 0.12s ease;
    white-space: nowrap;
}

.scheme-segment__btn:hover:not(.scheme-segment__btn--active):not(:disabled) {
    color: #334155;
}

.scheme-segment__btn:focus {
    outline: none;
}

.scheme-segment__btn:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.scheme-segment__btn--active {
    color: #fff;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #9333ea 100%);
    box-shadow:
        0 2px 8px rgba(79, 70, 229, 0.45),
        0 1px 2px rgba(0, 0, 0, 0.08);
}

.scheme-segment--readonly .scheme-segment__btn {
    cursor: default;
    pointer-events: none;
}

.scheme-segment--readonly .scheme-segment__btn:not(.scheme-segment__btn--active) {
    opacity: 0.72;
}

.scheme-truth-hint {
    margin: 0 0 0.75rem 0;
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.4;
}

/* Субагенты */
.subagent-col-title {
    margin: 0 0 0.5rem;
    font-weight: 700;
    font-size: 0.85rem;
    color: #111827;
}
.subagents-layout {
    display: block;
}
/* Два субагента в одном ряду: фиат слева, крипто справа; уже по ширине */
#subagents-section.subagents-section--crypto-visible .subagents-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.5rem 0.85rem;
    align-items: start;
}
#subagents-section.subagents-section--crypto-visible .subagent-pane--crypto {
    margin: 0;
    padding-left: 0.85rem;
    border-left: 1px solid #e5e7eb;
}
.subagent-pair-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: flex-start;
}
#subagents-section.subagents-section--crypto-visible .subagent-pair-grid {
    gap: 0.65rem 0.55rem;
}
/* Колонка расчётов: начинается на одной линии с полями ввода (после подписи первого поля) */
#subagents-section .subagent-calc-col {
    padding-top: calc(0.875rem * 1.35 + 0.5rem);
}
#subagents-section .subagent-fields-col {
    gap: 0;
}
/* Компактные карточки расчёта, когда оба субагента на экране */
#subagents-section.subagents-section--crypto-visible .financial-kpi-grid {
    gap: 0.45rem;
}
#subagents-section.subagents-section--crypto-visible .financial-kpi-card {
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
}
#subagents-section.subagents-section--crypto-visible .financial-kpi-card__label {
    font-size: 0.6875rem;
    margin-bottom: 0.15rem;
}
#subagents-section.subagents-section--crypto-visible .financial-kpi-card__value {
    font-size: 0.95rem;
}
@media (max-width: 900px) {
    #subagents-section.subagents-section--crypto-visible .subagents-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    #subagents-section.subagents-section--crypto-visible .subagent-pane--crypto {
        border-left: none;
        padding-left: 0;
        padding-top: 1rem;
        border-top: 1px solid #e5e7eb;
    }
}
.crypto-add-btn-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.85rem;
    border: 1.5px dashed #a5b4fc;
    border-radius: 20px;
    background: transparent;
    color: #6366f1;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    white-space: nowrap;
    line-height: 1.4;
}
.crypto-add-btn-inline:hover {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.06);
}
.crypto-add-btn-inline__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.12);
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1;
    color: #6366f1;
}

.section-card.scheme-card--active {
    box-shadow:
        0 0 0 2px rgba(99, 102, 241, 0.35),
        0 8px 28px rgba(15, 23, 42, 0.06);
    border-radius: 12px;
}

.scheme-result-row {
    padding: 0.35rem 0.5rem;
    margin: 0 -0.5rem;
    border-radius: 8px;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.scheme-result-row--active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.06));
    box-shadow: inset 3px 0 0 0 #6366f1;
}

@media (prefers-reduced-motion: reduce) {
    .scheme-segment__btn,
    .scheme-result-row {
        transition: none;
    }
}
