

.calls-analysis-summary-grid {
    display: grid;
    /* Увеличена минимальная ширина карточки для предотвращения переносов */
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); 
    gap: 15px;
}

/* Специальное правило для карточки с графиком, чтобы она была шире остальных */
.ca-summary-card--chart {
    grid-column: span 1;
    padding: 15px 20px;
}

@media (min-width: 1600px) {
    .calls-analysis-summary-grid {
        grid-template-columns: 1fr 1fr 1fr 1fr 1.4fr; 
    }
}

.ca-summary-card {
    background-color: var(--card-bg-color);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    corner-shape: continuous;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 160px;
    border: 1px solid rgba(0,0,0,0.02);
}

.ca-summary-card__title {
    font-size: 0.95em;
    color: #7f8c8d;
    margin-bottom: 5px;
    font-weight: 600;
}

.ca-summary-card__value {
    font-size: 2.2em;
    font-weight: 700;
    color: var(--heading-color);
    line-height: 1.1;
}

.ca-summary-card__subline {
    display: flex;
    align-items: center; /* ИСПРАВЛЕНО: с baseline на center для корректного выравнивания иконок */
    flex-wrap: nowrap; /* ДОБАВЛЕНО: Запрещает перенос элементов на новую строку */
    gap: 10px; /* Слегка увеличен отступ для воздуха */
    margin-top: 5px;
    font-size: 0.9em;
}

.ca-summary-card__percent {
    font-weight: 600;
    color: var(--text-color);
}

.weekday-chart-container {
    height: 105px;
    width: 100%;
    margin-top: 5px;
    position: relative;
}

/* --- HEATMAP STYLES --- */
.heatmap-card {
    padding: 20px;
    overflow: hidden;
    position: relative; /* Необходимо для позиционирования тултипа */
}

.heatmap-scroll-container {
    overflow-x: auto;
    padding-bottom: 10px;
}

.heatmap-grid {
    display: grid;
    /* 1-я колонка (названия) + N дней */
    grid-template-columns: 140px repeat(var(--heatmap-days, 31), 38px);
    gap: 4px;
    min-width: fit-content;
}

.heatmap-header-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 0;
    font-size: 0.75em;
    font-weight: 700;
    color: #7f8c8d;
    background: #f8f9fa;
    border-radius: 8px;
}

/* Подсветка Сб и Вс (выходных) */
.heatmap-header-cell.is-weekend {
    background-color: #fff0f3 !important; /* Светло нежно-розовый фон */
    color: #e05780 !important; /* Розовый текст */
}

.heatmap-header-cell.is-weekend .day-num {
    color: #e05780 !important;
}

.heatmap-header-cell .day-num {
    font-size: 1.2em;
    color: var(--heading-color);
}

.heatmap-source-label {
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 0.85em;
    font-weight: 600;
    color: var(--text-color);
    background: #f8f9fa;
    border-radius: 8px;
    white-space: nowrap;
}

.heatmap-cell {
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f1f3f5;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 700;
    color: #34495e;
    transition: all 0.2s;
}

.heatmap-cell.is-zero {
    color: #ced4da;
    background-color: #f8f9fa;
    font-weight: 400;
}

/* Степени интенсивности целевых звонков */
.heatmap-cell.lvl-1 { background-color: #e6fcf5; color: #0ca678; }
.heatmap-cell.lvl-2 { background-color: #c3fae8; color: #099268; }
.heatmap-cell.lvl-3 { background-color: #96f2d7; color: #087f5b; }
.heatmap-cell.lvl-4 { background-color: #63e6be; color: #087f5b; }
.heatmap-cell.lvl-5 { background-color: #38d9a9; color: #fff; }

.heatmap-header-spacer {
    background: transparent;
}

/* ФИКСИРОВАННАЯ СЕТКА ИСТОЧНИКОВ */
.sources-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); 
    gap: 20px;
    align-items: start; 
    margin-top: 20px;
}

.source-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.source-column__header {
    font-size: 0.75em;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #95a5a6;
    margin-bottom: 10px;
    padding-left: 5px;
}

.source-column__empty {
    padding: 20px;
    background: rgba(0,0,0,0.02);
    border-radius: 16px;
    border: 1px dashed var(--border-color);
    text-align: center;
    color: #bdc3c7;
    font-size: 0.9em;
}

.ca-source-item {
    padding: 25px;
    background: var(--card-bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.ca-source-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
}

.ca-source-item__group-tag {
    font-size: 0.65em;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-color);
    background: #f0f3ff;
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-block;
    align-self: flex-start;
    margin-bottom: 10px;
}

.ca-source-item__header {
    font-size: 1.25em;
    font-weight: 800;
    color: var(--heading-color);
    margin-bottom: 15px;
    line-height: 1.3;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.ca-source-item__stats-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.ca-source-item__stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fafb;
    padding: 10px 15px;
    border-radius: 12px;
}

.ca-source-item__stat-label {
    font-size: 0.8em;
    color: #7f8c8d;
    font-weight: 500;
}

.ca-source-item__stat-values {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.ca-source-item__stat-count {
    font-size: 1.1em;
    font-weight: 700;
    color: var(--heading-color);
}

.ca-source-item__stat-percent {
    font-size: 0.85em;
    font-weight: 500;
    color: #7f8c8d;
}

.ca-source-item__tags-breakdown {
    margin-top: 5px;
    padding-top: 15px;
    border-top: 1px dashed var(--border-color);
}

.ca-source-item__tags-title {
    font-size: 0.7em;
    color: #95a5a6;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.ca-source-item__tag-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.85em;
}

.ca-source-item__tag-label {
    color: #7f8c8d;
    flex: 1;
}

.ca-source-item__tag-value-container {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.ca-source-item__tag-value b {
    color: var(--heading-color);
}

.ca-source-item__footer {
    margin-top: 15px;
    padding-top: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
}

.ca-source-item__total-label {
    font-size: 0.75em;
    color: #95a5a6;
    font-weight: 600;
}

.ca-source-item__total-value {
    font-size: 1em;
    font-weight: 800;
    color: var(--accent-color);
}

/* Стили для нового блока с информацией о периоде сравнения */
.ca-source-item__comparison-note {
    font-size: 0.7em;
    color: #95a5a6;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dotted var(--border-color);
    text-align: left;
    line-height: 1.4;
}

.stat-card-line__comparison.positive {
    color: #16C79A !important;
    font-weight: 700;
}
.stat-card-line__comparison.negative {
    color: #e74c3c !important;
    font-weight: 700;
}

.calls-analysis-sources-section {
    margin-top: 3rem;
}
.calls-analysis-sources-section .section-title {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--heading-color);
    margin-bottom: 0.5rem;
}
.calls-analysis-sources-section .section-subtitle {
    color: #7f8c8d;
    margin-bottom: 2rem;
}

.ca-summary-card__comparison-period {
    font-size: 0.8em;
    color: #7f8c8d;
    font-weight: 500;
    margin-top: 6px;
}

/* ДОБАВЛЕНО: Стили для плашки периода сравнения под графиком */
.chart-comparison-note {
    display: block;
    width: -moz-fit-content;
    width: fit-content;
    margin: 20px 0 0 0;
    padding: 8px 16px;
    font-size: 0.85em;
    font-weight: 600;
    color: #475569;
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    corner-shape: continuous;
}

.chart-comparison-note:empty {
    display: none;
}

/* Улучшенные точки перелома (breakpoints) с учетом ширины сайдбара */
@media (max-width: 1500px) {
    .sources-grid { grid-template-columns: repeat(3, 1fr); }
    #col-other { grid-column: span 3; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
    #col-other .source-column__header { grid-column: span 3; }
}

@media (max-width: 1200px) {
    .sources-grid { grid-template-columns: repeat(2, 1fr); }
    #col-other { grid-column: span 2; grid-template-columns: repeat(2, 1fr); }
    #col-other .source-column__header { grid-column: span 2; }
}

@media (max-width: 900px) {
    .sources-grid { grid-template-columns: 1fr; }
    #col-other { grid-column: span 1; grid-template-columns: 1fr; }
    #col-other .source-column__header { grid-column: span 1; }
    .calls-analysis-summary-grid {
         grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

@media (max-width: 500px) {
    .calls-analysis-summary-grid {
        grid-template-columns: 1fr;
    }
}


/* Стили для подсказок и триггера были перенесены в tooltips.css */
