.chart-wrap {
        position: relative;
        height: 420px;
        width: 100%;
        padding: 12px;
    }

.chart-block {
        margin-top: 4px;
    }

.chart-tabs {
        display: flex;
        gap: 8px;
        margin-bottom: 12px;
    }

.chart-tab {
        border-radius: 999px;
        padding: 7px 14px;
        font-size: 13px;
        background: #eef2ff;
        color: var(--text-main);
        box-shadow: none;
        min-height: 36px;
    }

.chart-tab:hover {
        background: #e0e7ff;
        transform: none;
        box-shadow: none;
    }

.chart-tab.active {
        background: var(--primary);
        color: #fff;
    }

.metrics-cards {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 10px;
        margin: 8px 0 12px;
    }

.metrics-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 8px 0 12px;
}

.metric-card {
    min-height: 128px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: var(--shadow-soft);
}

.metric-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.metric-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
}

.metric-delta-wrap {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 12px;
}

.metric-delta-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.metric-delta {
    font-weight: 600;
    min-width: 42px;
}

.metric-delta-label {
    color: var(--text-muted);
}

.metric-delta.delta-up {
    color: #16a34a;
}

.metric-delta.delta-down {
    color: #dc2626;
}

.metric-delta.delta-neutral,
.metric-delta.muted {
    color: var(--text-muted);
}

.metric-period {
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-muted);
}

.chart-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

#chart-data-table {
    width: 100%;
    table-layout: fixed;
    font-size: 12px;
    border-collapse: separate;
    border-spacing: 0;
}

#chart-data-table th,
#chart-data-table td {
    padding: 8px 10px;
    min-width: 0;
    white-space: normal;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

#chart-data-table th {
    line-height: 1.2;
    background: var(--pastel-blue);
    font-weight: 600;
    color: var(--text-muted);
    text-align: left;
}

#chart-data-table th:first-child,
#chart-data-table td:first-child {
    width: 130px;
}

#chart-data-table th:nth-child(2),
#chart-data-table td:nth-child(2) {
    width: 220px;
}

#chart-data-table th:not(:first-child):not(:nth-child(2)),
#chart-data-table td:not(:first-child):not(:nth-child(2)) {
    text-align: right;
}

#chart-data-table .table-period-cell {
    vertical-align: top;
    padding-top: 12px;
    font-weight: 700;
    background: #f8fbff;
}

#chart-data-table .table-total-row td {
    font-weight: 700;
    background: #eef4ff;
    border-top: 2px solid #dbeafe;
}

#chart-data-table .table-type-total {
    font-weight: 700;
}

#chart-data-table .table-empty-cell {
    color: var(--text-muted);
}

#chart-data-table tbody tr:has(.table-period-cell) td {
    border-top: 2px solid #dbeafe;
}

#chart-data-table tbody tr:hover td {
    background: inherit;
}

#chart-data-table tbody tr.table-total-row:hover td {
    background: #e8f1ff;
}

.table-view-tabs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0 10px;
    padding: 0 2px;
}

.table-view-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 18px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    background: #fff;
    color: var(--text-main);
    cursor: pointer;
    box-shadow: none;
}

.table-view-tab:hover {
    background: #eef2ff;
    transform: none;
}

.table-view-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.22);
}

.table-metric-name {
    font-weight: 600;
    text-align: left !important;
}

#chart-data-table .table-total-cell {
    font-weight: 700;
    background: #eef4ff;
    text-align: right;
}

#chart-data-table td:nth-child(n+3),
#chart-data-table th:nth-child(n+3) {
    text-align: right;
}

#chart-data-table td:nth-child(2),
#chart-data-table th:nth-child(2) {
    text-align: left;
}

#chart-data-table .table-number {
    text-align: right !important;
}

#chart-data-table .table-type-name,
#chart-data-table .table-type-total,
#chart-data-table .table-metric-name {
    text-align: left !important;
}

