/* SVG charts (js/core/svgchart.js) — every colour a chart uses is a token here.
   The palette is the prototype's (Reference/daily-tb-risk-dashboard_25.html, Chart.js C()/PAL):
   s1 accent (softened blue), s2 warn, s3 accent2 (teal), s7 accent3 (violet) — the slots the ported
   views already use where the prototype drew c.a / c.warn / c.a2|good / c.a3 — and PAL's fixed
   extras (#5b8def, #c06c84, #8a6d3b, #6c757d) in s4/s5/s6/s8. good/bad stay with pos/neg. Light values on light/forest/slate; the prototype's
   dark values on midnight/ocean/aurora, with the fixed extras lifted for contrast on its dark card.
   Surface and ink come from the prototype tokens (--p-card / --p-ink, css/fis-theme.css), falling
   back to the theme's own --card/--text where that file is not loaded (the dev gallery).
   Print always uses the light set on white. */

:root{
  --sc-s1:#3e5f96;--sc-s2:#c77700;--sc-s3:#0e9f8e;--sc-s4:#5b8def;
  --sc-s5:#c06c84;--sc-s6:#8a6d3b;--sc-s7:#8a5cf6;--sc-s8:#6c757d;
  --sc-pos:#12925b;--sc-neg:#d13b3b;--sc-warn:#c77700;
  --sc-surface:var(--p-card,var(--card,#fff));
  --sc-ink:var(--p-ink,var(--text,#15181e));
  --sc-sub:color-mix(in srgb,var(--sc-ink) 66%,var(--sc-surface));
  --sc-muted:color-mix(in srgb,var(--sc-ink) 42%,var(--sc-surface));
  --sc-total:color-mix(in srgb,var(--sc-ink) 62%,var(--sc-surface));
  --sc-prev:color-mix(in srgb,var(--sc-ink) 28%,var(--sc-surface));
  --sc-grid:color-mix(in srgb,var(--sc-ink) 9%,transparent);
  --sc-axis:color-mix(in srgb,var(--sc-ink) 30%,transparent);
}
:root[data-theme="midnight"],:root[data-theme="ocean"],:root[data-theme="aurora"]{
  --sc-s1:#8ea6d4;--sc-s2:#f0a73a;--sc-s3:#2fc4b0;--sc-s4:#6f9cf2;
  --sc-s5:#e08aa3;--sc-s6:#c9a46a;--sc-s7:#a78bfa;--sc-s8:#9aa3ae;
  --sc-pos:#3ccf8a;--sc-neg:#ff6b6b;--sc-warn:#f0a73a;
  --sc-grid:color-mix(in srgb,var(--sc-ink) 11%,transparent);
}

.sc{position:relative;width:100%;min-width:0;font-size:calc(12px*var(--fz,1));color:var(--sc-ink);
  -webkit-print-color-adjust:exact;print-color-adjust:exact;}
.sc svg{display:block;width:100%;height:auto;font-family:inherit;overflow:visible;}
.sc svg text{fill:var(--sc-sub);font-family:inherit;}
.sc svg .sc-v{fill:var(--sc-ink);font-weight:600;}
.sc svg .sc-at{fill:var(--sc-sub);}
.sc svg .sc-refl{fill:var(--sc-sub);font-style:italic;}
/* a halo in the surface colour keeps labels readable where they cross marks */
.sc svg .sc-refl,.sc svg .sc-v{paint-order:stroke;stroke:var(--sc-surface);stroke-width:3px;stroke-linejoin:round;}
.sc svg .sc-ctr{fill:var(--sc-ink);font-weight:700;}
.sc svg .sc-note{fill:var(--sc-muted);}
.sc .sc-grid{stroke:var(--sc-grid);stroke-width:1;shape-rendering:crispEdges;}
.sc .sc-axis{stroke:var(--sc-axis);stroke-width:1;shape-rendering:crispEdges;}
.sc .sc-ref{stroke-width:1.5;fill:none;}
.sc .sc-conn{stroke:var(--sc-muted);stroke-width:1;stroke-dasharray:2 2;}
.sc .sc-stk{stroke:var(--sc-surface);stroke-width:1;}
.sc .sc-arc{stroke:var(--sc-surface);stroke-width:2;}
.sc .sc-pt{stroke:var(--sc-surface);stroke-width:1.5;}
.sc .sc-bub{stroke-width:1;}
.sc .sc-line{stroke-linejoin:round;stroke-linecap:round;}
.sc .sc-hit{fill:transparent;}
.sc .sc-cur{fill:var(--sc-ink);opacity:0;pointer-events:none;}
.sc .sc-cur.on{opacity:.06;}
.sc .sc-cur.on.ln{opacity:.45;}
.sc .sc-bub:hover,.sc .sc-arc:hover{filter:brightness(1.12);}

/* legend — HTML, so it wraps; each entry toggles its series */
.sc-leg{display:flex;flex-wrap:wrap;justify-content:center;gap:2px 12px;margin-top:6px;line-height:1.3;}
.sc-li{display:inline-flex;align-items:center;gap:6px;padding:2px 4px;border:0;background:none;
  font:inherit;font-size:calc(12px*var(--fz,1));color:var(--sc-sub);cursor:pointer;border-radius:4px;text-align:left;}
.sc-li:hover{color:var(--sc-ink);}
.sc-li:focus-visible{outline:2px solid var(--p-accent,var(--accent,#3e5f96));outline-offset:1px;}
.sc-li.sc-static{cursor:default;}
.sc-li[aria-pressed="false"]{opacity:.45;text-decoration:line-through;}
.sc-li i{flex:none;display:inline-block;width:10px;height:10px;border-radius:2px;}
/* a line series shows as a hollow square in its colour, like the prototype (Chart.js boxWidth/boxHeight 10) */
.sc-li i.ln{width:10px;height:10px;border:2px solid;border-radius:0;background:none;}
.sc-li i.ln.dash{border-style:dashed;}
.sc-li i.dot{border-radius:50%;}

/* doughnut: ring + value legend, side by side when there is room */
.sc-dwrap{display:flex;flex-direction:column;align-items:center;gap:10px;}
.sc-dwrap.side{flex-direction:row;align-items:center;justify-content:center;}
.sc svg.sc-dn{width:auto;max-width:100%;flex:none;}
.sc-dleg{display:flex;flex-direction:column;gap:1px;min-width:0;width:100%;max-width:420px;}
.sc-dleg .sc-li{display:grid;grid-template-columns:10px minmax(0,1fr) auto 3.6em;gap:8px;width:100%;}
.sc-dl{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.sc-dv,.sc-dp{text-align:right;font-variant-numeric:tabular-nums;color:var(--sc-ink);}
.sc-dp{color:var(--sc-sub);}

/* sparkline (KPI tiles) */
.sc-spark{display:block;width:100%;height:34px;overflow:visible;}

/* risk heat grid */
.sc-heat{display:grid;gap:4px;font-size:calc(12px*var(--fz,1));color:var(--sc-ink);
  -webkit-print-color-adjust:exact;print-color-adjust:exact;}
.sc-hc{position:relative;min-height:54px;border-radius:6px;padding:16px 4px 4px;display:flex;flex-wrap:wrap;
  align-content:flex-start;justify-content:center;gap:3px;}
.sc-hs{position:absolute;top:2px;left:5px;font-size:calc(10px*var(--fz,1));color:var(--sc-sub);}
.sc-hax{display:flex;align-items:center;justify-content:center;color:var(--sc-sub);padding:0 4px;}
.sc-hcap{font-size:calc(11px*var(--fz,1));}
.sc-chip{border:1px solid color-mix(in srgb,var(--sc-ink) 25%,transparent);background:var(--sc-surface);color:var(--sc-ink);
  font:inherit;font-size:calc(11px*var(--fz,1));font-weight:600;padding:1px 6px;border-radius:99px;cursor:pointer;}
.sc-chip.hl,.sc-chip:hover{outline:2px solid var(--sc-ink);outline-offset:0;}

/* the one shared tooltip */
.sc-tip{position:fixed;z-index:10000;pointer-events:none;max-width:320px;padding:7px 10px;border-radius:8px;
  background:var(--p-card,var(--card,#fff));color:var(--p-ink,var(--text,#15181e));border:1px solid var(--p-line,var(--border,#e3e6eb));
  box-shadow:0 6px 20px rgba(0,0,0,.18);font-size:calc(12px*var(--fz,1));line-height:1.45;}
.sc-tip[hidden]{display:none;}
.sc-tip .sc-tt{font-weight:700;margin-bottom:2px;}
.sc-tip .sc-tr{display:flex;align-items:center;gap:6px;white-space:nowrap;}
.sc-tip .sc-tr i{flex:none;width:9px;height:9px;border-radius:2px;}
.sc-tip .sc-tr span{color:var(--p-muted,color-mix(in srgb,var(--text,#1a1f2e) 70%,transparent));}
.sc-tip .sc-tr b{margin-left:auto;padding-left:10px;font-variant-numeric:tabular-nums;}

@media print{
  :root,:root[data-theme]{
    --sc-s1:#3e5f96;--sc-s2:#c77700;--sc-s3:#0e9f8e;--sc-s4:#5b8def;
    --sc-s5:#c06c84;--sc-s6:#8a6d3b;--sc-s7:#8a5cf6;--sc-s8:#6c757d;
    --sc-pos:#12925b;--sc-neg:#d13b3b;--sc-warn:#c77700;
    --sc-surface:#fff;--sc-ink:#15181e;--sc-grid:#e3e6eb;--sc-axis:#9aa1ad;
  }
  .sc-tip{display:none!important;}
  .sc .sc-cur{display:none;}
  .sc,.sc-heat{break-inside:avoid;}
}
