/* x-sc.chart (round 27, r.603–682): one SVG chart, colours only via tokens (both themes follow
   html[data-sc-theme]); series use currentColor from .sc-chart-s-*. Fixed body height per variant,
   never from the data, so loading/refreshing/empty never shift the layout. */

.sc-chart {
    --sc-chart-1: var(--sc-color-primary);
    --sc-chart-2: var(--sc-color-purple);
    --sc-chart-3: var(--sc-color-green);
    --sc-chart-4: var(--sc-color-orange);
    --sc-chart-5: var(--sc-color-danger);
    --sc-chart-6: var(--sc-color-text-subtle);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    font-family: var(--sc-font-sans);
    color: var(--sc-color-text);
}

.sc-chart-s-c1 { color: var(--sc-chart-1); }
.sc-chart-s-c2 { color: var(--sc-chart-2); }
.sc-chart-s-c3 { color: var(--sc-chart-3); }
.sc-chart-s-c4 { color: var(--sc-chart-4); }
.sc-chart-s-c5 { color: var(--sc-chart-5); }
.sc-chart-s-c6 { color: var(--sc-chart-6); }
.sc-chart-s-green { color: var(--sc-color-green); }
.sc-chart-s-red { color: var(--sc-color-danger); }
.sc-chart-s-yellow { color: var(--sc-color-yellow); }
.sc-chart-s-blue { color: var(--sc-color-blue); }
.sc-chart-s-orange { color: var(--sc-color-orange); }
.sc-chart-s-purple { color: var(--sc-color-purple); }

/* Header: title + total + local pills + refresh loader, one line high. */
.sc-chart-head {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 28px;
}

.sc-chart-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--sc-color-text-strong);
}

.sc-chart-total {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.sc-chart-delta { font-size: 12px; color: var(--sc-color-text-subtle); }
.sc-chart-delta.is-up { color: var(--sc-color-green); }
.sc-chart-delta.is-down { color: var(--sc-color-danger); }

.sc-chart-pills {
    display: flex;
    gap: 2px;
    margin-left: auto;
    padding: 2px;
    border-radius: var(--sc-radius-md);
    background: var(--sc-color-surface);
}

.sc-chart-pill {
    padding: 2px 8px;
    border: 0;
    border-radius: var(--sc-radius-sm);
    background: var(--sc-color-transparent);
    color: var(--sc-color-text-subtle);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: background-color var(--sc-dur-fast), color var(--sc-dur-fast);
}

.sc-chart-pill:hover { color: var(--sc-color-text); }
.sc-chart-pill.is-active { background: var(--sc-color-surface-alt); color: var(--sc-color-text-strong); }

.sc-chart-busy { margin-left: auto; visibility: hidden; }
.sc-chart-pills + .sc-chart-busy { margin-left: 0; }
.sc-chart.is-refreshing .sc-chart-busy { visibility: visible; }

/* Body: the fixed box (240 full, 48 compact). */
.sc-chart-body {
    position: relative;
    height: var(--sc-chart-h, 240px);
    touch-action: pan-y;
    border-radius: var(--sc-radius-md);
    outline: none;
}

.sc-chart--compact .sc-chart-body { height: var(--sc-chart-h, 48px); }
.sc-chart--compact { gap: 4px; }

.sc-chart-body:focus-visible { box-shadow: 0 0 0 2px var(--sc-input-border-focus); }

.sc-chart-svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
    transition: opacity var(--sc-dur-base);
}

.sc-chart.is-refreshing .sc-chart-svg { opacity: .6; }

/* Skeleton: same box, shimmer sweep (keyframes from ui/ui-loader.css). */
.sc-chart.is-loading .sc-chart-body {
    background: linear-gradient(90deg, var(--sc-color-surface) 0%, var(--sc-color-surface) 40%, var(--sc-color-surface-alt) 50%, var(--sc-color-surface) 60%, var(--sc-color-surface) 100%);
    background-size: 300% 100%;
    animation: sc-loader-shimmer var(--sc-dur-shimmer) linear infinite;
}

.sc-chart.is-loading .sc-chart-svg,
.sc-chart.is-empty .sc-chart-svg,
.sc-chart.is-error .sc-chart-svg { visibility: hidden; }

.sc-chart-empty,
.sc-chart-error {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 13px;
    color: var(--sc-color-text-subtle);
}

.sc-chart-empty[hidden],
.sc-chart-error[hidden],
.sc-chart-clear[hidden] { display: none; }

.sc-chart-clear { color: var(--sc-color-primary-text); }

/* Parts. */
.sc-chart-grid { stroke: var(--sc-color-hairline); stroke-width: 1; shape-rendering: crispEdges; }
.sc-chart-axis { fill: var(--sc-color-text-subtle); font-size: 11px; font-variant-numeric: tabular-nums; }
.sc-chart-line { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.sc-chart-line.is-compare { stroke-dasharray: 4 4; opacity: .55; }
.sc-chart-area { stroke: none; }
.sc-chart-bar { fill: currentColor; rx: var(--sc-radius-sm); }
.sc-chart-arc { fill: currentColor; stroke: var(--sc-color-bg); stroke-width: 2; }
.sc-chart-arc.is-active { opacity: .8; }
.sc-chart-center { fill: var(--sc-color-text-strong); font-size: 18px; font-weight: 600; text-anchor: middle; dominant-baseline: middle; }
.sc-chart-band { fill: var(--sc-color-surface); }
.sc-chart-dot { fill: currentColor; stroke: var(--sc-color-bg); stroke-width: 2; }

.sc-chart-crosshair {
    stroke: var(--sc-color-border-strong);
    stroke-width: 1;
    opacity: 0;
    transition: transform var(--sc-dur-fast) var(--sc-ease-out), opacity var(--sc-dur-fast);
}

.sc-chart.is-active .sc-chart-crosshair { opacity: 1; }

/* Tooltip: stays inside the body (sc-chart.js clamps and flips). */
.sc-chart-tip {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    min-width: 140px;
    padding: 8px 10px;
    border-radius: var(--sc-radius-md);
    background: var(--sc-color-surface-alt);
    box-shadow: var(--sc-shadow-pop);
    font-size: 12px;
    pointer-events: none;
    white-space: nowrap;
    transition: transform var(--sc-dur-fast) var(--sc-ease-out);
}

.sc-chart-tip-x { margin-bottom: 4px; color: var(--sc-color-text-subtle); }
.sc-chart-tip-row { display: flex; align-items: center; gap: 6px; }
.sc-chart-tip-row b { margin-left: auto; padding-left: 12px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--sc-color-text-strong); }
.sc-chart-tip-row.is-compare { color: var(--sc-color-text-subtle); }

/* Legend: toggle buttons, wraps on narrow screens. */
.sc-chart-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; min-height: 20px; }

.sc-chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: 0;
    background: var(--sc-color-transparent);
    color: var(--sc-color-text-muted);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.sc-chart-legend-item.is-off { color: var(--sc-color-text-subtle); opacity: .5; }
.sc-chart-legend-item:focus-visible { outline: 2px solid var(--sc-input-border-focus); outline-offset: 2px; }

.sc-chart-key {
    width: 8px;
    height: 8px;
    border-radius: var(--sc-radius-full);
    background: currentColor;
}

.sc-chart-live,
.sc-chart-table {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    margin: -1px;
    padding: 0;
    border: 0;
}
/* A fixed table honours width: 1px (an auto table stays as wide as its nowrap rows). */
.sc-chart-table { table-layout: fixed; }

