

.sales-summary-card {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 25px 35px;
}

.sales-summary-total-container {
    text-align: center;
    border-right: 1px solid var(--border-color);
    padding-right: 2rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.sales-summary-total-container h4 {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}
.sales-summary-total {
    font-size: 4.5em;
    font-weight: 700;
    line-height: 1;
    color: var(--accent-color);
}
.sales-summary-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem 1.5rem;
    align-self: start;
}
.sales-summary-breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-color);
    border-radius: 12px;
    corner-shape: continuous;
    font-size: 0.95em;
}

.sales-summary-breakdown-item__name-container {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    flex: 1;
}

.sales-summary-breakdown-item .name {
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sales-summary-breakdown-item .value {
    font-weight: 700;
    color: var(--heading-color);
    background-color: #fff;
    padding: 2px 8px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* --- SALES TRENDS ROW (70/30 Split, No Wrap) --- */
.sales-trends-row {
    display: grid;
    grid-template-columns: 7fr 3fr; 
    gap: 20px;
    margin-bottom: 2rem;
    width: 100%;
    align-items: stretch;
}

.chart-header-group {
    margin-bottom: 20px;
}

.chart-subtitle-note {
    font-size: 0.85em;
    color: #7f8c8d;
    margin-top: 4px;
    font-weight: 400;
}

.chart-card-half {
    margin-bottom: 0 !important;
    min-width: 0; 
}

/* --- BENTO GRID STYLES (NEW DESIGN) --- */
.sales-bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(130px, auto); /* ИЗМЕНЕНО: Адаптивная высота строк */
    gap: 12px;
    width: 100%;
}

.bento-item {
    border-radius: 24px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
    color: #1a1a1a;
}

.bento-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

/* Сетка распределения по важности */
.bento-item--large {
    grid-column: span 2;
    grid-row: span 2;
}

.bento-item--medium {
    grid-column: span 2;
    grid-row: span 1;
}

.bento-item--small {
    grid-column: span 1;
    grid-row: span 1;
}

.bento-item__name {
    font-size: 0.85em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.8;
    line-height: 1.2;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Уменьшение шрифта для длинных названий */
.bento-item__name--long {
    font-size: 0.72em;
    letter-spacing: 0.02em;
}

.bento-item--large .bento-item__name {
    font-size: 1em;
}

.bento-item--large .bento-item__name--long {
    font-size: 0.9em;
}

.bento-item__value-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.bento-item__percent {
    font-size: 2.2em;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
}

.bento-item--large .bento-item__percent {
    font-size: 5em;
    letter-spacing: -0.04em;
}

.bento-item__count {
    font-size: 0.9em;
    font-weight: 600;
    opacity: 0.6;
}

.bento-item--large .bento-item__count {
    font-size: 1.2em;
}

.bento-item--large .bento-item__name {
    font-size: 1em;
}

.bento-placeholder {
    grid-column: 1 / -1;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7f8c8d;
    font-style: italic;
    background: #f8f9fa;
    border-radius: 24px;
}

/* --- ANALYTICS CHARTS --- */
.sales-charts-container {
    margin-top: 2.5rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--border-color);
    margin-bottom: 2.5rem;
}

.sales-charts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.sales-charts-title {
    font-size: 2em;
    font-weight: 700;
    color: var(--heading-color);
}

.sales-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 20px;
    margin-bottom: 20px;
}

.chart-card {
    padding: 25px;
}

.chart-card .chart-title {
    font-size: 1.25em;
    font-weight: 600;
    color: var(--heading-color);
    margin-bottom: 20px;
}

.doughnut-chart-wrapper {
    position: relative;
    height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.doughnut-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}

.doughnut-center-text .total-value {
    font-size: 3em;
    font-weight: 700;
    color: var(--heading-color);
    line-height: 1;
}

.doughnut-center-text .total-label {
    font-size: 1em;
    color: #7f8c8d;
    font-weight: 500;
}

.bar-chart-wrapper {
    height: 414px; 
}

.sources-legend-card {
    padding: 25px;
}
.sources-legend-card .chart-title {
     font-size: 1.25em;
    font-weight: 600;
    color: var(--heading-color);
    margin-bottom: 20px;
}

.sales-legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.legend-plaque {
    background-color: #f8f9fa;
    padding: 12px 15px;
    border-radius: 16px;
    corner-shape: continuous;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.legend-plaque.is-zero {
    opacity: 0.6;
    background-color: #fafbfc;
}

.legend-plaque-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
    corner-shape: continuous;
}

.legend-plaque-info {
    flex-grow: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.legend-plaque-name {
    font-weight: 600;
    color: var(--heading-color);
    font-size: 0.95em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.legend-plaque-values {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.legend-plaque-count {
    font-weight: 700;
    font-size: 1em;
    color: var(--heading-color);
    background-color: #ffffff;
    padding: 2px 10px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    min-width: 36px;
    text-align: center;
}

.legend-plaque-percent {
    font-weight: 500;
    font-size: 0.85em;
    color: #7f8c8d;
    min-width: 45px;
    text-align: right;
}

/* Исправляем отступ заголовка, если у него есть подпись */
.chart-header-group .chart-title {
    margin-bottom: 4px;
}

/* НОВЫЕ СТИЛИ: Сетка для двух графиков (по формам и по менеджерам) */
.sales-subgrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 2rem;
}


@media (max-width: 1200px) {
    .sales-subgrid {
        grid-template-columns: 1fr;
    }
}


@media (max-width: 1100px) {
    .sales-charts-grid {
        grid-template-columns: 1fr;
    }
    .sales-bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 900px) {
    .sales-charts-header {
        flex-direction: column;
        align-items: flex-start;
    }
    /* Адаптация для мобильных */
    .sales-trends-row,
    .sales-charts-grid,
    .sales-subgrid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 850px) {
     .sales-summary-card {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .sales-summary-total-container {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-right: 0;
        padding-bottom: 1.5rem;
    }
    .sales-trends-row {
        grid-template-columns: 1fr; 
        overflow-x: hidden;
    }
}
@media (max-width: 550px) {
    .sales-bento-grid {
        grid-template-columns: 1fr;
    }
    .bento-item--large, .bento-item--medium {
        grid-column: span 1;
        grid-row: span 1;
    }
}
