/* chat-charts.css — Spectra chat charts + KPI tiles (chat-charts.js). Every selector is .pcc-* scoped.
   Colours follow data-theme through the shared tokens (--text, --secondary, --muted, --border, --surface,
   --soft, --hover) and the prism-viz brand blues (--pv-cat-*); fallbacks keep it readable without them.
   Green/red only mark KPI delta direction. */
.pcc-chart,.pcc-kpis{
 --pcc-c0:var(--pv-cat-0,#004dc0);--pcc-c1:var(--pv-cat-1,#7fb4e6);--pcc-c2:var(--pv-cat-2,#0a2f6b);--pcc-c3:var(--pv-cat-3,#3d86d6);
 --pcc-c4:var(--pv-cat-5,#5b6f92);--pcc-c5:var(--pv-cat-7,#9aa9c2);--pcc-c6:var(--pv-cat-6,#1a66c9);--pcc-c7:var(--pv-cat-4,#b9dbf4);
 --pcc-est:var(--pv-est,#4696cb);--pcc-grid:var(--pv-grid,#eef2f6);--pcc-zero:var(--pv-zero,#b7c2d0);
 --pcc-pos:var(--pv-pos,#12834b);--pcc-neg:var(--pv-neg,#c33b49);
 --pcc-num:'JetBrains Mono',ui-monospace,SFMono-Regular,Menlo,monospace;
 white-space:normal;line-height:1.4;font-family:Inter,Arial,sans-serif;color:var(--text,#0a0a0a)
}
/* Dark: re-order the brand blues so the first series never lands on a navy that vanishes on #11172b. */
:root[data-theme="dark"] :is(.pcc-chart,.pcc-kpis){
 --pcc-c0:var(--pv-cat-0,#82b6ff);--pcc-c1:var(--pv-cat-1,#3f7fd0);--pcc-c2:var(--pv-cat-2,#c4e0fa);--pcc-c3:var(--pv-cat-4,#5f9be6);
 --pcc-c4:var(--pv-cat-5,#8d9cba);--pcc-c5:var(--pv-cat-6,#a9cdf4);--pcc-c6:var(--pv-cat-7,#4d5d7d);--pcc-c7:var(--pv-cat-3,#1f4f93);
 --pcc-est:var(--pv-est,#c4e0fa);--pcc-grid:var(--pv-grid,#1c2438);--pcc-zero:var(--pv-zero,#46536d);
 --pcc-pos:var(--pv-pos,#66ce96);--pcc-neg:var(--pv-neg,#ff8f99)
}

/* ---- chart block ---- */
/* No border of its own: the chat message is the card, and nested sections use whitespace (dev/CONVENTIONS.md). */
.pcc-chart{position:relative;box-sizing:border-box;min-width:0;max-width:100%;margin:12px 0;padding:0;font-size:13px}
.pcc-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin:0 0 6px}
.pcc-title{min-width:0;font-size:13px;font-weight:600;color:var(--text,#0a0a0a);overflow-wrap:anywhere}
.pcc-unit{flex:none;max-width:40%;font-size:11px;color:var(--muted,#68758a);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pcc-legend{display:flex;flex-wrap:wrap;gap:4px 14px;margin:0 0 6px;font-size:11px;color:var(--secondary,#4f5d73)}
.pcc-legend-item{display:inline-flex;align-items:center;gap:6px;min-width:0;max-width:100%}
.pcc-legend-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pcc-sw{flex:none;display:inline-block;width:10px;height:10px;border-radius:2px;background:var(--pcc-c)}
.pcc-sw.pcc-sw-line{width:14px;height:2px;border-radius:1px}
.pcc-est-dash .pcc-sw.pcc-sw-line{background:repeating-linear-gradient(90deg,var(--pcc-c) 0 4px,transparent 4px 7px)}
.pcc-est-dot .pcc-sw.pcc-sw-line{background:repeating-linear-gradient(90deg,var(--pcc-c) 0 2px,transparent 2px 4px)}
.pcc-plot{position:relative;min-width:0;border-radius:4px;outline:none;touch-action:pan-y}
.pcc-plot:focus-visible{outline:2px solid var(--accent-text,#004dc0);outline-offset:2px}
.pcc-svg{display:block;width:100%;height:auto;overflow:visible;user-select:none;-webkit-user-select:none}

/* series colour: one custom property per series, read by lines, bars, dots and swatches */
.pcc-s0{--pcc-c:var(--pcc-c0)}.pcc-s1{--pcc-c:var(--pcc-c1)}.pcc-s2{--pcc-c:var(--pcc-c2)}.pcc-s3{--pcc-c:var(--pcc-c3)}
.pcc-s4{--pcc-c:var(--pcc-c4)}.pcc-s5{--pcc-c:var(--pcc-c5)}.pcc-s6{--pcc-c:var(--pcc-c6)}.pcc-s7{--pcc-c:var(--pcc-c7)}
.pcc-s8{--pcc-c:var(--pcc-c0)}.pcc-s9{--pcc-c:var(--pcc-c1)}.pcc-s10{--pcc-c:var(--pcc-c2)}.pcc-s11{--pcc-c:var(--pcc-c3)}
/* estimates follow the prism-viz convention: nowcast dashed, forecast dotted, both in --pv-est */
.pcc-est{--pcc-c:var(--pcc-est)}

.pcc-svg text{font:11px/1 Inter,Arial,sans-serif;fill:var(--muted,#68758a);font-variant-numeric:tabular-nums}
.pcc-svg .pcc-a-start{text-anchor:start}.pcc-svg .pcc-a-mid{text-anchor:middle}.pcc-svg .pcc-a-end{text-anchor:end}
.pcc-grid{fill:none;stroke:var(--pcc-grid);stroke-width:1;shape-rendering:crispEdges}
.pcc-zero{fill:none;stroke:var(--pcc-zero);stroke-width:1;shape-rendering:crispEdges}
.pcc-line{fill:none;stroke:var(--pcc-c);stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
.pcc-est-dash .pcc-line{stroke-dasharray:6 4}
.pcc-est-dot .pcc-line{stroke-dasharray:2 3}
.pcc-s8 .pcc-line,.pcc-s9 .pcc-line,.pcc-s10 .pcc-line,.pcc-s11 .pcc-line{stroke-dasharray:6 3}
.pcc-area{fill:var(--pcc-c);fill-opacity:.1;stroke:none}
.pcc-stacked .pcc-area{fill-opacity:.32}
.pcc-dot{fill:var(--pcc-c);stroke:var(--surface,#fff);stroke-width:1}
.pcc-bar{fill:var(--pcc-c);stroke:none}
.pcc-bar.pcc-seg{stroke:var(--surface,#fff);stroke-width:1}
.pcc-s8 .pcc-bar,.pcc-s9 .pcc-bar,.pcc-s10 .pcc-bar,.pcc-s11 .pcc-bar{fill-opacity:.55}
.pcc-band{fill:var(--hover,#edf5fc)}
.pcc-cross{fill:none;stroke:var(--muted,#68758a);stroke-width:1;stroke-dasharray:3 3;opacity:.7}
.pcc-hdot{fill:var(--pcc-c);stroke:var(--surface,#fff);stroke-width:2}
.pcc-svg .pcc-off{display:none}

/* tooltip: lives inside the plot, positioned by chat-charts.js */
.pcc-tip{position:absolute;top:6px;left:0;z-index:3;box-sizing:border-box;min-width:110px;max-width:min(260px,92%);padding:7px 9px;border:1px solid var(--border,#dce4ed);border-radius:6px;background:var(--surface,#fff);color:var(--text,#0a0a0a);box-shadow:0 6px 20px var(--shade,#0e13340a),0 1px 3px #0e133414;font:12px/1.45 Inter,Arial,sans-serif;pointer-events:none;white-space:normal}
.pcc-tip[hidden]{display:none}
.pcc-tip-x{margin-bottom:3px;font-weight:600;overflow-wrap:anywhere}
.pcc-tip-row{display:flex;align-items:center;gap:6px;font-size:11px;color:var(--secondary,#4f5d73)}
.pcc-tip-name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pcc-tip-val{margin-left:auto;padding-left:10px;font:500 11px/1.45 var(--pcc-num);color:var(--text,#0a0a0a);white-space:nowrap}
.pcc-tip-total .pcc-tip-name,.pcc-tip-total .pcc-tip-val{font-weight:600;color:var(--text,#0a0a0a)}
.pcc-tip-total{padding-left:16px}

/* ---- KPI strip ---- */
.pcc-kpis{display:grid;grid-template-columns:repeat(auto-fill,minmax(132px,1fr));gap:8px;margin:10px 0;font-size:13px}
.pcc-kpi{display:flex;flex-direction:column;gap:4px;box-sizing:border-box;min-width:0;min-height:var(--kpi-h,72px);padding:10px 12px;border:1px solid var(--border,#dce4ed);border-radius:var(--r-card,10px);background:var(--surface,#fff)}
.pcc-kpi-label{font-size:12px;line-height:1.3;color:var(--secondary,#4f5d73);overflow-wrap:anywhere}
.pcc-kpi-value{font:600 18px/1.2 var(--pcc-num);letter-spacing:-.3px;color:var(--text,#0a0a0a);overflow-wrap:anywhere}
.pcc-kpis-long .pcc-kpi-value{font-size:15px}
.pcc-kpi-foot{display:flex;flex-wrap:wrap;align-items:center;gap:4px 6px;margin-top:auto;font-size:11px;color:var(--muted,#68758a)}
.pcc-kpi-delta{display:inline-flex;align-items:center;padding:1px 6px;border-radius:4px;font:500 11px/16px var(--pcc-num);white-space:nowrap;background:var(--soft,#f8fafc);color:var(--secondary,#4f5d73)}
.pcc-kpi-delta.pcc-up{color:var(--pcc-pos);background:color-mix(in srgb,var(--pcc-pos) 12%,transparent)}
.pcc-kpi-delta.pcc-down{color:var(--pcc-neg);background:color-mix(in srgb,var(--pcc-neg) 12%,transparent)}
.pcc-kpi-sub{min-width:0;overflow-wrap:anywhere}

/* ---- fallbacks, text, streaming placeholder ---- */
.pcc-raw{box-sizing:border-box;max-width:100%;max-height:260px;margin:10px 0;padding:8px 10px;overflow:auto;border:1px solid var(--border,#dce4ed);border-radius:6px;background:var(--soft,#f8fafc);color:var(--secondary,#4f5d73);font:11px/1.5 'JetBrains Mono',ui-monospace,monospace;white-space:pre-wrap;overflow-wrap:anywhere}
.pcc-p{margin:0 0 8px;white-space:pre-line;overflow-wrap:anywhere}
.pcc-pending{box-sizing:border-box;height:226px;margin:10px 0;border:1px solid var(--border,#dce4ed);border-radius:var(--r-card,10px);background:var(--soft,#f8fafc);animation:pcc-pulse 1.4s ease-in-out infinite}
.pcc-pending.pcc-pending-kpi{height:72px}
@keyframes pcc-pulse{50%{opacity:.55}}
@media (prefers-reduced-motion:reduce){.pcc-pending{animation:none}}
