/* Aahsso — chart styles (charts.js) and the "Insights" strips on the module pages (v-insights.js).
 * Colours come from the app tokens. Several series use the categorical slots below, in this fixed order (validated:
 * colour-blind separation ΔE ≥ 11.8 between neighbours); the light ones sit under 3:1 on white, so every multi-series
 * chart shows a legend with the values (and the tap label). Green / amber / red stay for good / warning / bad. */
:root{
  --cs1:#257de0; --cs2:#f47230; --cs3:#00b894; --cs4:#f2a600; --cs5:#ee7fac; --cs6:#008a17; --cs7:#6a4ce2; --cs8:#ec4647;
  --cs-other:#a3acb6; --cs-bar:var(--brand);
}

/* ---------- the floating value label (tap a bar, a point, a slice) ---------- */
.ch-tip{position:fixed;z-index:9999;max-width:min(320px,calc(100vw - 16px));background:var(--ink);color:#fff;font-size:11px;font-weight:600;line-height:1.35;
  padding:7px 10px;border-radius:9px;box-shadow:0 6px 20px rgba(20,32,46,.22);pointer-events:none;font-variant-numeric:tabular-nums}
.ch-tip[hidden]{display:none}
[data-tip]{cursor:pointer;-webkit-tap-highlight-color:transparent}
.ch-c.ch-on b,.ch-hr.ch-on .ch-ht i{outline:2px solid var(--ink);outline-offset:1px}
.ch-hits span.ch-on{background:color-mix(in srgb,var(--brand) 10%,transparent)}
.ch-heat i.ch-on{outline:2px solid var(--ink);outline-offset:0}
.ch-donut circle.ch-on{stroke-width:7.5}
.ch-li.ch-on{background:var(--line2);border-radius:6px}

/* bars: bigger touch targets than the marks (the column is the target, not the bar) */
.ch-c{cursor:pointer}
.ch-c b{border-radius:4px 4px 0 0}

/* ---------- ranked horizontal bars ---------- */
.ch-hb{display:flex;flex-direction:column;gap:4px;margin-top:6px}
.ch-hr{display:grid;grid-template-columns:minmax(92px,40%) minmax(0,1fr) auto;gap:10px;align-items:center;padding:5px 4px;border-radius:8px;min-height:36px}
.ch-hr:hover{background:var(--line2)}
.ch-hl{min-width:0;display:flex;flex-direction:column;font-size:11.5px;line-height:1.25}
.ch-hl>span:first-child{font-weight:500}
.ch-hr.hi .ch-hl>span:first-child{font-weight:600}
.ch-hs{font-size:10px;color:var(--ink3)}
.ch-ht{height:10px;background:var(--line2);border-radius:0 4px 4px 0;overflow:hidden}
.ch-ht i{display:block;height:100%;background:var(--brand);border-radius:0 4px 4px 0;opacity:.85}
.ch-hr.hi .ch-ht i{background:var(--accent);opacity:1}
.ch-hb.t-bad .ch-ht i,.ch-hb.t-bad .ch-hr.hi .ch-ht i{background:var(--bad);opacity:.8}
.ch-hv{font-size:11.5px;font-weight:650;white-space:nowrap;font-variant-numeric:tabular-nums}

/* ---------- stacked columns: 2px surface gap between the parts ---------- */
.ch-c b.ch-sb{display:flex;flex-direction:column;gap:2px;background:none;opacity:1;width:min(100%,38px)}
.ch-c b.ch-sb span{display:block;min-height:2px}
.ch-c b.ch-sb span:first-child{border-radius:4px 4px 0 0}
.ch-key{flex-wrap:wrap;row-gap:6px}
.ch-key .ch-sw{width:10px;height:10px;border:0;border-radius:3px;display:inline-block;vertical-align:-1px;margin-right:6px}
.ch-key .ch-k3{display:inline-block;width:18px;height:0;border-top:2.5px solid var(--cs2);vertical-align:middle;margin-right:6px}

/* ---------- combo (columns + line, one scale) ---------- */
.ch-combo .ch-c b{background:var(--cs-bar);opacity:.55}
.ch-combo .ch-c:hover b,.ch-combo .ch-c.ch-on b{opacity:.8}
.ch-line2{fill:none;stroke:var(--cs2);stroke-width:2.5;stroke-linejoin:round;stroke-linecap:round}

/* ---------- KPI tiles with the change and a sparkline ---------- */
.ch-kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px}
.ch-kpi{padding:12px 14px 10px;display:flex;flex-direction:column;gap:3px;min-width:0;position:relative}
.ch-kpi.hero{border-color:var(--brand);box-shadow:inset 0 0 0 1px var(--brand)}
.ch-kl{font-size:11px;font-weight:500;color:var(--ink3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ch-kv{font-size:18px;font-weight:600;letter-spacing:-.02em;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ch-kv.t-bad{color:var(--bad)} .ch-kv.t-ok{color:var(--ok)}
.ch-ks{display:flex;align-items:center;gap:6px;font-size:10.5px;color:var(--ink3);min-width:0}
.ch-chg{font-weight:600;font-size:10px;padding:1px 6px;border-radius:999px;white-space:nowrap;flex:none}
.ch-chg.good{color:var(--ok);background:var(--okSoft)} .ch-chg.bad{color:var(--bad);background:var(--badSoft)} .ch-chg.flat{color:var(--ink2);background:var(--line2)}
.ch-spark-w{position:relative;height:28px;margin-top:4px}
.ch-spark{position:absolute;inset:0;width:100%;height:100%;overflow:visible}
.ch-spark polyline{fill:none;stroke:var(--brand);stroke-width:1.8;stroke-linejoin:round;stroke-linecap:round}
.ch-spark-w>i{position:absolute;right:-3px;width:6px;height:6px;margin-top:-3px;border-radius:50%;background:var(--brand)}
.ch-spark-w.t-cost polyline{stroke:var(--ink3)} .ch-spark-w.t-cost>i{background:var(--ink3)}

/* ---------- gauge / progress ---------- */
.ch-gauge{margin:8px 0}
.ch-gl{display:flex;justify-content:space-between;gap:8px;font-size:11.5px;margin-bottom:5px}
.ch-gl b{font-variant-numeric:tabular-nums}
.ch-gt{position:relative;height:10px;background:var(--line2);border-radius:5px}
.ch-gt i{position:absolute;left:0;top:0;bottom:0;background:var(--brand);border-radius:5px}
.ch-gauge.t-ok .ch-gt i{background:var(--ok)} .ch-gauge.t-warn .ch-gt i{background:var(--warn)} .ch-gauge.t-bad .ch-gt i{background:var(--bad)}
.ch-gt em{position:absolute;top:-3px;bottom:-3px;width:2px;background:var(--ink);border-radius:1px}
.ch-gs{font-size:10px;color:var(--ink3);margin-top:4px}

/* ---------- report layout helpers ---------- */
.rp-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;align-items:start}
.rp-grid>.card{min-width:0}
.rp-grid .wide{grid-column:1/-1}
.rp-h{display:flex;align-items:baseline;justify-content:space-between;gap:8px;flex-wrap:wrap}
.rp-h h3{margin:0}
.rp-note{font-size:10px;color:var(--ink3);margin-top:2px}
@media (max-width:700px){.rp-grid{grid-template-columns:minmax(0,1fr)}}

/* ---------- the Insights strip at the top of a module page ---------- */
.ins{margin-bottom:12px}
.ins-head{display:flex;align-items:center;gap:8px;width:100%;border:0;background:none;padding:4px 2px;font:inherit;font-size:11.5px;font-weight:600;color:var(--ink2);cursor:pointer;text-align:left}
.ins-head .i{transition:transform .15s;transform:rotate(90deg)}
.ins.closed .ins-head .i{transform:none}
.ins-head .ins-sum{margin-left:auto;font-weight:500;color:var(--ink3);font-size:10.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ins-body{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:6px;align-items:start}
.ins.closed .ins-body{display:none}
.ins-card{padding:12px 14px;min-width:0}
.ins-card h4{margin:0 0 2px;font-size:11px;font-weight:600;color:var(--ink2)}
.ins-card .ch{margin-top:6px}
.ins-card .ch-y,.ins-card .ch-plot{height:96px}
.ins-card .ch-donut svg{width:96px;height:96px}
.ins-card .ch-donut{gap:10px}
.ins-card .ch-legend{min-width:120px}
.ins-card .ch-li{font-size:10.5px;grid-template-columns:10px minmax(0,1fr) auto 32px;gap:6px}
.ins-card .ch-hr{min-height:30px;padding:3px 2px}
.ins-card .ch-hl{font-size:11px}
.ins-body .ch-kpi{padding:10px 12px 8px}
.ins-body .ch-kv{font-size:15.5px}
.ins-w2{grid-column:span 2}
@media (max-width:1100px){.ins-body{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:600px){
  /* two report cards side by side become one per row on a phone (the ranked bars too) */
  .grid2:has(> .card .ch-hb),.grid2:has(> .card .ch-donut),.grid2:has(> .card .ch),.grid2:has(> .card .ch-gauge){grid-template-columns:minmax(0,1fr)!important}
  .ins-body{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .ins-w2,.ins-body>.ins-card{grid-column:1/-1}
  .ins-body .ch-kv{font-size:14px}
  .ch-hr{grid-template-columns:minmax(80px,42%) minmax(0,1fr) auto;gap:8px}
  .ch-kpis{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .ch-kv{font-size:15.5px}
}
