/* =========================================================
   Комментарии: вариант 1 — цифра внутри облачка
   + менеджерские разделы в стилистике 2-го раздела
   ========================================================= */

/* Иконка комментариев для всех пользователей */
.assigned-comments-btn.assigned-comments-bubble-btn,
.calculation-comments-icon-cell .assigned-comments-btn.assigned-comments-bubble-btn {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 38px !important;
    width: auto !important;
    height: 28px !important;
    min-height: 28px !important;
    padding: 0 8px 0 10px !important;
    border-radius: 14px !important;
    border: 1px solid #bfd7ff !important;
    background: #eef5ff !important;
    color: #2454d3 !important;
    font-weight: 900 !important;
    font-size: 12px !important;
    line-height: 1 !important;
    gap: 0 !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.9) !important;
    overflow: visible !important;
}

.assigned-comments-btn.assigned-comments-bubble-btn::after {
    content: "";
    position: absolute;
    left: 8px;
    bottom: -4px;
    width: 8px;
    height: 8px;
    background: #eef5ff;
    border-left: 1px solid #bfd7ff;
    border-bottom: 1px solid #bfd7ff;
    border-bottom-left-radius: 3px;
    transform: rotate(-34deg) skewX(-16deg);
}

.assigned-comments-btn.assigned-comments-bubble-btn .assigned-comments-count {
    position: relative !important;
    z-index: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 1ch !important;
    font-size: 12px !important;
    line-height: 1 !important;
    font-weight: 900 !important;
    color: #2454d3 !important;
}

.assigned-comments-btn.assigned-comments-bubble-btn span {
    font-size: 12px !important;
}

/* Компактное выравнивание в узких колонках */
.calculation-money-section td[data-label="Комментарии"],
.assigned-sales-section td[data-label="Комментарии"],
.admin-clients-section td[data-label="Комментарии"],
.admin-measurements-section td[data-label="Комментарии"] {
    text-align: center !important;
}

.calculation-money-section td[data-label="Комментарии"] .assigned-comments-btn.assigned-comments-bubble-btn,
.assigned-sales-section td[data-label="Комментарии"] .assigned-comments-btn.assigned-comments-bubble-btn,
.admin-clients-section td[data-label="Комментарии"] .assigned-comments-btn.assigned-comments-bubble-btn,
.admin-measurements-section td[data-label="Комментарии"] .assigned-comments-btn.assigned-comments-bubble-btn {
    margin: 0 auto !important;
}

/* Все менеджерские разделы — в стилистике 2-го раздела */
.manager-section:not(.calculation-money-section) {
    background: #ffffff !important;
    border: 1px solid #b7ebc5 !important;
    border-left: 4px solid #9fe3b4 !important;
    box-shadow: none !important;
}

.manager-section:not(.calculation-money-section) .card-title h2,
.manager-section:not(.calculation-money-section) h2 {
    color: #006b2d !important;
}

.manager-section:not(.calculation-money-section) .hint {
    color: #64748b !important;
}

.manager-section:not(.calculation-money-section) .table-wrap {
    background: #ffffff !important;
    border: 1px solid #cfeedd !important;
    border-radius: 14px !important;
}

.manager-section:not(.calculation-money-section) table thead th,
.manager-section:not(.calculation-money-section) thead th {
    background: #edf8f0 !important;
    color: #006b2d !important;
    border-bottom: 1px solid #b7ebc5 !important;
    font-family: inherit !important;
    font-size: 12px !important;
    line-height: 1.08 !important;
    font-weight: 900 !important;
    white-space: nowrap !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    hyphens: none !important;
}

.manager-section:not(.calculation-money-section) .small-btn,
.manager-section:not(.calculation-money-section) .btn-light {
    border-color: #cbd5e1 !important;
}

/* Первый раздел — дополнительно убираем красные акценты старых стилей */
.today-money-section {
    border-left: 4px solid #9fe3b4 !important;
}

.today-money-section .card-title h2,
.today-money-section h2,
.today-money-section .hint,
.today-money-section table thead th,
.today-money-section th {
    color: #006b2d !important;
}

.today-money-section table thead th,
.today-money-section th {
    background: #edf8f0 !important;
    border-bottom: 1px solid #b7ebc5 !important;
}

.today-money-section .table-wrap {
    border-color: #cfeedd !important;
}

/* На мобильных оставляем читабельность */
@media (max-width: 950px) {
    .assigned-comments-btn.assigned-comments-bubble-btn,
    .calculation-comments-icon-cell .assigned-comments-btn.assigned-comments-bubble-btn {
        min-width: 36px !important;
        height: 28px !important;
        padding: 0 8px 0 9px !important;
    }

    .assigned-comments-btn.assigned-comments-bubble-btn::after {
        left: 7px;
    }
}


/* =========================================================
   Деньги на сегодня — точечная корректировка по ТЗ
   ========================================================= */
.today-money-section .table-wrap table {
    table-layout: fixed !important;
    width: 100% !important;
}

.today-money-section thead th,
.today-money-section tbody td {
    vertical-align: middle !important;
}

.today-money-section th:nth-child(1), .today-money-section td:nth-child(1) { width: 90px !important; }
.today-money-section th:nth-child(2), .today-money-section td:nth-child(2) { width: 220px !important; }
.today-money-section th:nth-child(3), .today-money-section td:nth-child(3) { width: 120px !important; }
.today-money-section th:nth-child(4), .today-money-section td:nth-child(4) { width: 120px !important; }
.today-money-section th:nth-child(5), .today-money-section td:nth-child(5) { width: 150px !important; }
.today-money-section th:nth-child(6), .today-money-section td:nth-child(6) { width: 210px !important; }
.today-money-section th:nth-child(7), .today-money-section td:nth-child(7) { width: 90px !important; text-align: center !important; }
.today-money-section th:nth-child(8), .today-money-section td:nth-child(8) { width: 90px !important; text-align: center !important; }
.today-money-section th:nth-child(9), .today-money-section td:nth-child(9) { width: 70px !important; text-align: center !important; }
.today-money-section th:nth-child(10), .today-money-section td:nth-child(10) { width: 180px !important; }
.today-money-section th:nth-child(11), .today-money-section td:nth-child(11),
.today-money-section th:nth-child(12), .today-money-section td:nth-child(12) {
    width: 76px !important;
    text-align: center !important;
}

.today-money-section .deal-amount-cell {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    min-height: 32px !important;
}

.today-money-section .deal-amount-cell .deal-amount-edit-btn {
    display: none !important;
}

.today-money-section .edit-client-btn.edit-deal-main-btn,
.today-money-section .btn-postpone-deal {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 38px !important;
    min-width: 38px !important;
    height: 34px !important;
    padding: 0 !important;
    border-radius: 10px !important;
    font-size: 18px !important;
    line-height: 1 !important;
}

.today-money-section .edit-client-btn.edit-deal-main-btn {
    color: #0f172a !important;
}

.today-money-section .btn-postpone-deal {
    color: #dc2626 !important;
}

.today-money-section .action-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-style: normal !important;
    font-weight: 700 !important;
    line-height: 1 !important;
}

.today-money-section .client-name-cell {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.today-money-section input[type="checkbox"] {
    margin: 0 auto !important;
    display: block !important;
}

.today-money-section td[data-label="Причина"] input,
.today-money-section td[data-label="Причина незакрытия"] input {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}


/* =========================================================
   Шаблон расположения кнопок и столбцов
   Основа: 2-й раздел. Применение: 1-й раздел.
   ========================================================= */

.section2-template-table {
    width: 100% !important;
    table-layout: fixed !important;
}

.section2-template-table thead th,
.section2-template-table tbody td {
    vertical-align: middle !important;
}

.section2-template-table .client-name-cell {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.section2-template-table .money strong,
.section2-template-table .money {
    font-weight: 800 !important;
}

/* ---------- Базовый шаблон второго раздела ---------- */
.calc-template-table th:nth-child(1), .calc-template-table td:nth-child(1) { width: 28% !important; }
.calc-template-table th:nth-child(2), .calc-template-table td:nth-child(2) { width: 8% !important; }
.calc-template-table th:nth-child(3), .calc-template-table td:nth-child(3) { width: 7% !important; }
.calc-template-table th:nth-child(4), .calc-template-table td:nth-child(4) { width: 9% !important; }
.calc-template-table th:nth-child(5), .calc-template-table td:nth-child(5) { width: 10% !important; }
.calc-template-table th:nth-child(6), .calc-template-table td:nth-child(6) { width: 11% !important; }
.calc-template-table th:nth-child(7), .calc-template-table td:nth-child(7) { width: 9% !important; }
.calc-template-table th:nth-child(8), .calc-template-table td:nth-child(8) { width: 4.5% !important; text-align: center !important; }
.calc-template-table th:nth-child(9), .calc-template-table td:nth-child(9) { width: 4.5% !important; text-align: center !important; }
.calc-template-table th:nth-child(10), .calc-template-table td:nth-child(10) { width: 3.5% !important; text-align: center !important; }
.calc-template-table th:nth-child(11), .calc-template-table td:nth-child(11) { width: 6.5% !important; text-align: center !important; }
.calc-template-table th:nth-child(12), .calc-template-table td:nth-child(12) { width: 4% !important; text-align: center !important; }

/* Последние колонки второго раздела — компактный блок действий */
.calc-template-table td:nth-child(8),
.calc-template-table td:nth-child(9),
.calc-template-table td:nth-child(10),
.calc-template-table td:nth-child(11),
.calc-template-table td:nth-child(12),
.calc-template-table th:nth-child(8),
.calc-template-table th:nth-child(9),
.calc-template-table th:nth-child(10),
.calc-template-table th:nth-child(11),
.calc-template-table th:nth-child(12) {
    padding-left: 6px !important;
    padding-right: 6px !important;
}

/* ---------- Первый раздел по шаблону второго ---------- */
.today-template-table th:nth-child(1), .today-template-table td:nth-child(1)  { width: 7% !important; }
.today-template-table th:nth-child(2), .today-template-table td:nth-child(2)  { width: 21% !important; }
.today-template-table th:nth-child(3), .today-template-table td:nth-child(3)  { width: 10% !important; }
.today-template-table th:nth-child(4), .today-template-table td:nth-child(4)  { width: 9% !important; }
.today-template-table th:nth-child(5), .today-template-table td:nth-child(5)  { width: 11% !important; }
.today-template-table th:nth-child(6), .today-template-table td:nth-child(6)  { width: 17% !important; }
.today-template-table th:nth-child(7), .today-template-table td:nth-child(7)  { width: 7% !important; text-align: center !important; }
.today-template-table th:nth-child(8), .today-template-table td:nth-child(8)  { width: 6% !important; text-align: center !important; }
.today-template-table th:nth-child(9), .today-template-table td:nth-child(9)  { width: 5% !important; text-align: center !important; }
.today-template-table th:nth-child(10), .today-template-table td:nth-child(10){ width: 14% !important; }
.today-template-table th:nth-child(11), .today-template-table td:nth-child(11){ width: 4% !important; text-align: center !important; }
.today-template-table th:nth-child(12), .today-template-table td:nth-child(12){ width: 5% !important; text-align: center !important; }

.today-template-table td:nth-child(7),
.today-template-table td:nth-child(8),
.today-template-table td:nth-child(9),
.today-template-table td:nth-child(11),
.today-template-table td:nth-child(12),
.today-template-table th:nth-child(7),
.today-template-table th:nth-child(8),
.today-template-table th:nth-child(9),
.today-template-table th:nth-child(11),
.today-template-table th:nth-child(12) {
    padding-left: 6px !important;
    padding-right: 6px !important;
}

.today-template-table .deal-amount-cell {
    min-height: 34px !important;
}

.today-template-table td:nth-child(6) {
    line-height: 1.22 !important;
}

.today-template-table td[data-label="Причина"] input,
.today-template-table td[data-label="Причина незакрытия"] input {
    height: 34px !important;
    border-radius: 10px !important;
}

.today-template-table td:nth-child(11) .edit-client-btn,
.today-template-table td:nth-child(12) .btn-postpone-deal {
    margin: 0 auto !important;
}

.today-template-table td:nth-child(11) .edit-client-btn.edit-deal-main-btn,
.today-template-table td:nth-child(12) .btn-postpone-deal {
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    border-radius: 10px !important;
}

.today-template-table .priority {
    min-width: 58px !important;
    justify-content: center !important;
}

.today-template-table td:nth-child(2) .client-name-cell span {
    display: inline-block !important;
    max-width: 100% !important;
}
