.error-message {
    color: #a00;
}

.mff-chart {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    /* min-height: 90vh; */
    padding-inline: 12px;
}

.mff-chart[data-chart-type="sankey"] {
    aspect-ratio: 16 / 7;
}

.mff-chart[data-chart-type="sunburst"],
.mff-chart[data-chart-type="donut"],
.mff-chart[data-chart-type="revenue-pie"],
.mff-chart[data-chart-type="bar"],
.mff-chart[data-chart-type="line"] {
    height: auto;
}

/* Tabulator table overrides */
.mff-table-row--parent {
    font-weight: 600;
    background-color: #f4f7fc;
}

.mff-table-row--child td {
    font-size: 0.9em;
    color: #444;
}

.mff-bar-inner {
    min-width: 250px;
    height: clamp(400px, 30vh, 600px);
}

.mff-chart-title {
    text-align: center;
    font-weight: 700;
    text-wrap: balance;
}
.mff-chart-subtitle {
    text-align: center;
    color: #555;
    margin-bottom: 12px;
    text-wrap: balance;
}
.mff-chart-source {
    text-align: center;
    text-wrap: balance;
    font-size: 0.78em;
    color: #888;
    margin-top: 8px;
}

/* Loading spinner */
.mff-chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.mff-chart-loading::after {
    content: "";
    width: 36px;
    height: 36px;
    border: 4px solid #ddd;
    border-top-color: #1a73e8;
    border-radius: 50%;
    animation: mff-spin 0.75s linear infinite;
}

@keyframes mff-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error box */
.mff-chart-error {
    border: 2px solid #c62828;
    color: #c62828;
    background: #fff5f5;
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Table toggle button */
.mff-table-toggle {
    display: inline-block;
    cursor: pointer;
    padding: 4px 12px;
    margin-bottom: 8px;
    font-size: 0.85em;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f5f5f5;
    color: #333;
    user-select: none;
}

.mff-table-toggle.active {
    background: #1a73e8;
    color: #fff;
    border-color: #1a73e8;
}

/* Table wrapper (no overflow hidden) */
.mff-table-wrapper {
    width: 100%;
}

/* Inline bar formatter cell */
.mff-bar-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mff-bar-cell__bar {
    height: 8px;
    background: #1a73e8;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Change badges */
.mff-badge-green,
.mff-badge-red,
.mff-badge-yellow {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.78em;
    font-weight: 600;
    line-height: 1.4;
}

.mff-badge-green {
    background: #2e7d32;
    color: #fff;
}
.mff-badge-red {
    background: #c62828;
    color: #fff;
}
.mff-badge-yellow {
    background: #f9a825;
    color: #333;
}

/* Responsive (ECharts only; Tabulator collapses itself) */
@media (max-width: 768px) {
    .mff-chart {
        min-height: 50vh;
    }
    .mff-chart[data-chart-type="sankey"] {
        aspect-ratio: 1 / 1;
    }
}

@media (max-width: 480px) {
    .mff-bar-inner {
        height: 350px;
    }
}
