/* MudBlazor sets min-width:fit-content on .mud-chart and on .mud-chart-legend,
   so a chart with a side legend refuses to shrink and overflows narrow
   containers. .chart-fit lets the plot area absorb the shrinking while the
   legend keeps its natural width. */
.chart-fit.mud-chart {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* The SVG is the flex item that gives up space. */
.chart-fit.mud-chart > svg {
    flex: 1 1 0;
    min-width: 0;
}

/* The legend keeps its content width, but never more than half the card. */
.chart-fit.mud-chart > .mud-chart-legend {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 50%;
}

/* Long labels wrap instead of pushing the legend wider. */
.chart-fit.mud-chart > .mud-chart-legend .mud-chart-legend-item {
    white-space: normal;
    overflow-wrap: anywhere;
}
