.react-pie-chart-container {
    margin: 0 auto;
    position: relative;
    max-width: 100%;
    transition: width 0.3s ease, height 0.3s ease;

}
.react-pie-chart-container.responsive-chart {
    box-sizing: border-box;
}
.react-pie-chart-container.rpc-modern-host {
    width: var(--rpc-modern-preview-width, 100%) !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
}
.pie-chart-wrapper {
    position: relative;
    margin: 0 auto;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

.pie-chart-wrapper canvas {
    max-width: 100%;
    height: auto;
}

.rpc-modern-chart {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    padding: 22px 24px;
    border: 1px solid #e5eaf0;
    border-radius: 16px;
    background: #fff;
    color: var(--rpc-text-color, #243047);
    box-shadow: 0 8px 28px rgba(29, 42, 67, 0.06);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.rpc-modern-title {
    margin: 0 0 20px;
    color: inherit;
    font-size: 18px;
    font-weight: 650;
    line-height: 1.3;
}

.rpc-modern-body {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    gap: 22px;
}

.rpc-modern-donut {
    position: relative;
    flex: 0 0 auto;
    width: clamp(170px, 25%, 260px);
    max-width: 100%;
    aspect-ratio: 1;
}

.react-pie-chart-container .rpc-modern-donut canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
}

.rpc-modern-legend {
    box-sizing: border-box;
    flex: 1 1 320px;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Keep the legend's spacing independent of the active WordPress theme. */
.react-pie-chart-container .rpc-modern-chart .rpc-modern-legend {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.rpc-modern-legend-row {
    display: grid;
    grid-template-columns: 11px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 43px;
    padding: 7px 0;
    border-bottom: 1px solid #eef1f5;
    font-size: 13px;
}

.react-pie-chart-container .rpc-modern-chart .rpc-modern-legend-row {
    margin: 0 !important;
    list-style: none !important;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
    font-size: 13px !important;
    line-height: 1.35 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
}

.react-pie-chart-container .rpc-modern-chart .rpc-modern-legend-row > * {
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    letter-spacing: inherit !important;
    text-transform: inherit !important;
}

.react-pie-chart-container .rpc-modern-chart .rpc-modern-label {
    font-weight: 550 !important;
}

.react-pie-chart-container .rpc-modern-chart .rpc-modern-percent {
    font-weight: 650 !important;
}

.rpc-modern-legend-row:last-child { border-bottom: 0; }
.rpc-modern-swatch { width: 11px; height: 11px; border-radius: 3px; }
.rpc-modern-label { min-width: 0; overflow-wrap: anywhere; font-weight: 550; }
.rpc-modern-percent { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rpc-modern-percent { min-width: 45px; text-align: right; font-weight: 650; }

@media (max-width: 600px) {
    .rpc-modern-chart { padding: 18px; }
    .rpc-modern-title { margin-bottom: 14px; font-size: 16px; }
    .rpc-modern-body { gap: 14px; }
    .rpc-modern-legend { flex-basis: 100%; }
}

@media (max-width: 320px) {
    .react-pie-chart-container:not(.rpc-modern-host) {
        min-width: 280px;
        min-height: 200px;
    }
}
