/* =========================================================
   Исправление вида 2-го раздела
   - возвращаем нормальный размер шрифта и общий стиль таблицы
   - знак i ставим перед именем клиента
   - кнопка "В сделку" компактная и в одну строку
   ========================================================= */

/* Возвращаем 2-му разделу нормальный общий вид */
.calculation-money-section {
    padding: 18px !important;
}

.calculation-money-section .card-title {
    margin-bottom: 14px !important;
}

.calculation-money-section .card-title h2 {
    font-size: 17px !important;
    line-height: 1.25 !important;
}

.calculation-money-section .hint {
    font-size: 14px !important;
    margin-top: 6px !important;
}

.calculation-money-section table {
    width: 100% !important;
    min-width: 1100px !important;
    table-layout: auto !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

.calculation-money-section th {
    font-size: 12px !important;
    line-height: 1.2 !important;
    padding: 6px 8px !important;
    white-space: nowrap !important;
}

.calculation-money-section td {
    font-size: 14px !important;
    line-height: 1.25 !important;
    padding: 8px 8px !important;
    vertical-align: middle !important;
}

.calculation-money-section td input,
.calculation-money-section td select {
    font-size: 13px !important;
    min-height: 34px !important;
    height: 34px !important;
    padding: 6px 8px !important;
    border-radius: 8px !important;
}

/* Убираем жесткие ширины из предыдущего компактного файла */
.calculation-money-section th,
.calculation-money-section td {
    width: auto !important;
}

/* Но важные колонки оставляем удобными */
.calculation-money-section th:nth-child(1),
.calculation-money-section td:nth-child(1) {
    min-width: 150px !important;
    font-weight: 900 !important;
}

.calculation-money-section th:nth-child(4),
.calculation-money-section td:nth-child(4) {
    min-width: 100px !important;
    font-weight: 900 !important;
}

.calculation-money-section th:nth-child(8),
.calculation-money-section td:nth-child(8) {
    min-width: 180px !important;
}

/* Знак i перед именем клиента */
.client-name-cell {
    display: inline-flex !important;
    align-items: center !important;
    gap: 7px !important;
}

.client-name-cell .client-info-btn {
    order: 1 !important;
    flex: 0 0 auto !important;
}

.client-name-cell span {
    order: 2 !important;
}

/* Комментарий оставляем коротким, но визуально ближе к обычному стилю */
.comment-compact-cell {
    max-width: 220px !important;
}

.comment-preview-btn {
    min-height: 34px !important;
    height: 34px !important;
    padding: 6px 9px !important;
    font-size: 13px !important;
    line-height: 1.25 !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    color: #374151 !important;
    border: 1px solid #d1d5db !important;
}

/* "В сделку" — компактно и в одну строку */
.btn-transfer-deal,
.calculation-money-section .btn-transfer-deal {
    width: auto !important;
    min-width: 78px !important;
    max-width: 90px !important;
    height: 32px !important;
    min-height: 32px !important;

    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    padding: 5px 9px !important;
    border-radius: 8px !important;

    font-size: 12px !important;
    line-height: 1 !important;
    font-weight: 900 !important;
    white-space: nowrap !important;
    word-break: keep-all !important;

    background: #ffffff !important;
    color: #166534 !important;
    border: 1px solid #86efac !important;
}

.btn-transfer-deal:hover,
.calculation-money-section .btn-transfer-deal:hover {
    background: #f0fdf4 !important;
    color: #166534 !important;
    border-color: #16a34a !important;
}

/* Кнопки редактирования и удаления аккуратно, но не огромные */
.calculation-money-section .edit-btn {
    width: 34px !important;
    min-width: 34px !important;
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 !important;
    border-radius: 8px !important;
}

.calculation-money-section .btn-delete,
.calculation-money-section .delete-btn,
.calculation-money-section button[onclick*="delete"],
.calculation-money-section button[onclick*="Delete"] {
    min-height: 32px !important;
    height: 32px !important;
    padding: 5px 10px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
}

/* Мобильная версия */
@media (max-width: 950px) {
    .calculation-money-section {
        padding: 12px !important;
    }

    .calculation-money-section table {
        min-width: 0 !important;
    }

    .calculation-money-section td {
        font-size: 14px !important;
        padding: 8px 0 !important;
        grid-template-columns: 104px 1fr !important;
    }

    .client-name-cell {
        display: inline-flex !important;
        gap: 7px !important;
    }

    .btn-transfer-deal,
    .calculation-money-section .btn-transfer-deal {
        min-width: 82px !important;
        max-width: none !important;
        height: 36px !important;
        min-height: 36px !important;
        font-size: 12px !important;
        white-space: nowrap !important;
    }

    .comment-preview-btn {
        height: auto !important;
        min-height: 36px !important;
        white-space: normal !important;
        max-height: 42px !important;
        overflow: hidden !important;
    }
}
