/* =========================================================
   2-й раздел в стиле "Назначенные сделки"
   + перенос "Назначенные сделки" идет через index.php
   ========================================================= */

/* Общая стилистика второго раздела как у "Назначенные сделки" */
.calculation-money-section {
    border-color: #bbf7d0 !important;
    box-shadow: 0 5px 18px rgba(22, 163, 74, .06) !important;
}

.calculation-money-section .card-title h2 {
    color: #166534 !important;
}

.calculation-money-section .table-wrap {
    border-radius: 14px !important;
    border: 1px solid #bbf7d0 !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    max-height: none !important;
}

.calculation-money-section table {
    min-width: 1120px !important;
    table-layout: fixed !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

.calculation-money-section th {
    background: #f0fdf4 !important;
    color: #166534 !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
    font-weight: 900 !important;
    padding: 9px 8px !important;
    white-space: normal !important;
    vertical-align: middle !important;
}

.calculation-money-section td {
    padding: 9px 8px !important;
    font-size: 14px !important;
    line-height: 1.25 !important;
    vertical-align: middle !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: anywhere !important;
}

.calculation-money-section tbody tr {
    background: #ffffff !important;
}

.calculation-money-section tbody tr:nth-child(odd) {
    background: #f8fffa !important;
}

.calculation-money-section tbody tr:hover {
    background: #eefdf2 !important;
}

.calculation-money-section .sale-planned-calculation-row {
    background: #ffffff !important;
}

/* Ширины колонок второго раздела */
.calculation-money-section th:nth-child(1),
.calculation-money-section td:nth-child(1) {
    width: 210px !important;
}

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

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

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

.calculation-money-section th:nth-child(5),
.calculation-money-section td:nth-child(5) {
    width: 145px !important;
    font-weight: 800 !important;
}

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

.calculation-money-section th:nth-child(7),
.calculation-money-section td:nth-child(7) {
    width: 80px !important;
    text-align: center !important;
}

.calculation-money-section th:nth-child(8),
.calculation-money-section td:nth-child(8) {
    width: 115px !important;
    text-align: center !important;
}

.calculation-money-section th:nth-child(9),
.calculation-money-section td:nth-child(9) {
    width: 64px !important;
    text-align: center !important;
}

.calculation-money-section th:nth-child(10),
.calculation-money-section td:nth-child(10) {
    width: 125px !important;
    text-align: center !important;
}

.calculation-money-section th:nth-child(11),
.calculation-money-section td:nth-child(11) {
    width: 84px !important;
    text-align: center !important;
}

/* Клиент и источник */
.calculation-money-section .client-name-cell {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    min-width: 0 !important;
}

.calculation-money-section .client-name-cell > span {
    color: #111827 !important;
    font-size: 15px !important;
    line-height: 1.18 !important;
    font-weight: 900 !important;
    min-width: 0 !important;
}

.calculation-money-section .client-info-btn {
    flex: 0 0 auto !important;
}

.calculation-money-section .client-source-badge,
.calculation-money-section .source-badge,
.calculation-money-section [class*="source"] {
    max-width: 130px !important;
    padding: 4px 8px !important;
    border-radius: 999px !important;
    font-size: 11px !important;
    line-height: 1.12 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
}

/* Комментарии — только иконка как в назначенных сделках */
.calculation-comments-icon-cell {
    text-align: center !important;
}

.calculation-comments-icon-cell .assigned-comments-btn {
    margin: 0 auto 5px !important;
}

.calculation-comments-icon-cell .calculation-contact-mark {
    justify-content: center !important;
}

.calculation-comments-icon-cell .calculation-contact-mark span {
    max-width: 100% !important;
    font-size: 10px !important;
}

/* Кнопки */
.calculation-money-section .btn-transfer-deal,
.calculation-money-section .btn-sale-plan,
.calculation-money-section .transfer-narrow-btn {
    width: auto !important;
    min-width: 92px !important;
    max-width: 112px !important;
    min-height: 34px !important;
    height: auto !important;
    padding: 7px 10px !important;
    border-radius: 10px !important;
    font-size: 13px !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
}

.calculation-money-section td[data-label="Редактировать"] button,
.calculation-money-section .edit-client-btn,
.calculation-money-section .edit-btn {
    width: 36px !important;
    min-width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
    border-radius: 10px !important;
}

.calculation-money-section td[data-label="Удаление"] button,
.calculation-money-section .delete-btn,
.calculation-money-section .btn-delete {
    width: 36px !important;
    min-width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
    border-radius: 10px !important;
}

/* На мобильной версии оба раздела выглядят одинаковыми карточками */
@media (max-width: 950px) {
    .assigned-sales-section {
        order: 3 !important;
    }

    .calculation-money-section {
        order: 4 !important;
    }

    .calculation-money-section .table-wrap {
        overflow: visible !important;
        border: none !important;
        background: transparent !important;
    }

    .calculation-money-section table,
    .calculation-money-section thead,
    .calculation-money-section tbody,
    .calculation-money-section tr,
    .calculation-money-section td {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    .calculation-money-section thead {
        display: none !important;
    }

    .calculation-money-section tbody {
        display: grid !important;
        gap: 10px !important;
    }

    .calculation-money-section tr {
        padding: 12px !important;
        border-radius: 16px !important;
        border: 1px solid #bbf7d0 !important;
        background: #ffffff !important;
        box-shadow: 0 3px 12px rgba(15,23,42,.05) !important;
    }

    .calculation-money-section td {
        display: grid !important;
        grid-template-columns: 96px 1fr !important;
        gap: 8px !important;
        align-items: center !important;
        padding: 8px 0 !important;
        border: none !important;
        background: transparent !important;
        font-size: 14px !important;
    }

    .calculation-money-section td::before {
        content: attr(data-label) !important;
        color: #64748b !important;
        font-size: 12px !important;
        font-weight: 900 !important;
    }

    .calculation-money-section td[data-label="Клиент"] {
        display: block !important;
        padding-bottom: 10px !important;
        border-bottom: 1px solid #eef2f7 !important;
    }

    .calculation-money-section td[data-label="Клиент"]::before {
        display: none !important;
    }

    .calculation-money-section .client-name-cell span {
        font-size: 18px !important;
    }

    .calculation-comments-icon-cell .calculation-contact-mark {
        justify-content: flex-start !important;
    }
}
