/* AIsa charts chrome: figure, legend, tooltip, table view, stat tile, meter. Requires aisa-tokens.css. */
.aisa-chart { margin: 0; font-family: var(--aisa-font-sans); color: var(--aisa-text); min-width: 0; }
.aisa-chart__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--aisa-space-3); margin-bottom: 14px; }
.aisa-chart__title { font-family: var(--aisa-font-display); font-size: 14.5px; font-weight: 700; line-height: 1.35; letter-spacing: -0.01em; color: var(--aisa-text); text-wrap: balance; }
.aisa-chart__subtitle { font-size: 12px; line-height: 1.5; color: var(--aisa-text-secondary); margin-top: 3px; }
.aisa-chart__toggle {
  flex: none; font: inherit; font-family: var(--aisa-font-mono); font-size: 10.5px; letter-spacing: .04em; color: var(--aisa-text-secondary); background: transparent;
  border: 1px solid var(--aisa-line); border-radius: var(--aisa-radius-pill); padding: 2px 9px; cursor: pointer;
}
.aisa-chart__toggle:hover { color: var(--aisa-text); border-color: var(--aisa-line-strong); }
.aisa-chart__toggle:focus-visible, .aisa-chart__key:focus-visible, .aisa-chart__svg:focus-visible { outline: none; box-shadow: var(--aisa-focus-ring); border-radius: var(--aisa-radius-sm); }
.aisa-chart__svg:focus:not(:focus-visible) { outline: none; }
/* labels never steal the pointer from the hit targets under them */
.aisa-chart__svg text { pointer-events: none; }

.aisa-chart__legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 12px; }
.aisa-chart__legend[hidden] { display: none; }
.aisa-chart__key {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-family: var(--aisa-font-mono); font-size: 10.5px; letter-spacing: .03em; color: var(--aisa-text-secondary);
  background: none; border: 0; padding: 2px 0; cursor: pointer;
}
.aisa-chart__key:disabled { cursor: default; }
.aisa-chart__key.is-off { opacity: 0.4; }
.aisa-chart__swatch { display: inline-block; flex: none; }
/* keys are the brand's hexagon, like the report series' legends */
.aisa-chart__swatch--rect { width: 9px; height: 10px; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.aisa-chart__swatch--line { width: 12px; height: 2px; border-radius: 1px; }
.aisa-chart__swatch--dot { width: 9px; height: 10px; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }

.aisa-chart__plot { position: relative; }
.aisa-chart__svg { display: block; max-width: 100%; overflow: visible; }
.aisa-chart__tick { font-size: 10.5px; font-variant-numeric: tabular-nums; }
/* numbers on an axis: mono, so the digits line up */
.aisa-chart__tick--num, .aisa-chart__ref-label { font-family: var(--aisa-font-mono); font-size: 10px; letter-spacing: .02em; }
.aisa-chart__ref-label { font-variant-numeric: tabular-nums; }
.aisa-chart__value { font-family: var(--aisa-font-display); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.aisa-chart__center { font-family: var(--aisa-font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.03em; }
.aisa-chart__center-sub { font-family: var(--aisa-font-mono); font-size: 10px; letter-spacing: .04em; }
.aisa-chart__bar, .aisa-chart__seg, .aisa-chart__cell { transition: opacity var(--aisa-duration-fast) var(--aisa-ease-out); }
.aisa-chart__marks:has(+ g .is-hot) .aisa-chart__bar { opacity: 0.9; }
.aisa-chart__seg:hover, .aisa-chart__cell:hover { opacity: 0.85; }
.aisa-chart__cross { opacity: 0; }
.aisa-chart__cross.is-on { opacity: 1; }

.aisa-chart__tooltip {
  position: absolute; z-index: 5; pointer-events: none; opacity: 0; transform: translateY(2px);
  transition: opacity var(--aisa-duration-fast) var(--aisa-ease-out), transform var(--aisa-duration-fast) var(--aisa-ease-out);
  min-width: 120px; max-width: 260px; padding: 8px 10px; border-radius: var(--aisa-radius-sm);
  background: var(--aisa-surface-raised); border: 1px solid var(--aisa-line); box-shadow: var(--aisa-shadow-3); font-size: var(--aisa-text-xs);
}
.aisa-chart__tooltip.is-on { opacity: 1; transform: none; }
.aisa-chart__tip-title { font-family: var(--aisa-font-mono); font-size: 10.5px; letter-spacing: .03em; color: var(--aisa-text-muted); margin-bottom: 4px; }
.aisa-chart__tip-row { display: grid; grid-template-columns: 14px auto 1fr; align-items: center; gap: 6px; line-height: 1.6; }
.aisa-chart__tip-row strong { font-family: var(--aisa-font-display); font-weight: 700; color: var(--aisa-text); font-variant-numeric: tabular-nums; }
.aisa-chart__tip-name { color: var(--aisa-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aisa-chart__tip-key--line { height: 2px; width: 12px; border-radius: 1px; }
.aisa-chart__tip-key--rect { height: 8px; width: 8px; border-radius: 2px; }

.aisa-chart__table { display: none; overflow-x: auto; }
.aisa-chart--table .aisa-chart__plot, .aisa-chart--table .aisa-chart__legend { display: none; }
.aisa-chart--table .aisa-chart__table { display: block; }
.aisa-chart__table table { border-collapse: collapse; width: 100%; font-size: var(--aisa-text-xs); font-variant-numeric: tabular-nums; }
.aisa-chart__table th, .aisa-chart__table td { padding: 6px 10px; border-bottom: 1px solid var(--aisa-line); text-align: right; white-space: nowrap; }
.aisa-chart__table th:first-child { text-align: left; font-weight: 500; }
.aisa-chart__foot { display: flex; flex-wrap: wrap; gap: 2px 16px; margin-top: 12px; font-family: var(--aisa-font-mono); font-size: 10.5px; letter-spacing: .04em; line-height: 1.6; color: var(--aisa-text-muted); }
.aisa-chart__note { color: var(--aisa-text-secondary); }
.aisa-chart__table thead th { color: var(--aisa-text-muted); font-weight: 500; }

/* entrance: once when the chart first scrolls into view (aisa-reveal--play on the host, set by the module),
   or on every render with animate: true (slides). Marks grow from their baseline, lines draw, dots and rows fade up. */
.aisa-reveal--waiting .aisa-chart__plot { opacity: 0; }
.aisa-reveal--play .aisa-chart__plot { animation: aisa-fade 240ms var(--aisa-ease-out) both; }
/* order: the frame (grid, axis numbers) settles first, marks follow left to right, each mark's number lands after it,
   end labels after the line arrives, the target rule last */
:is(.aisa-chart--animate, .aisa-reveal--play) :is(.aisa-chart__grid, .aisa-chart__tick) { animation: aisa-fade 320ms var(--aisa-ease-out) both; }
:is(.aisa-chart--animate, .aisa-reveal--play) .aisa-chart__bar { transform-box: fill-box; animation: aisa-grow var(--aisa-duration-slow) var(--aisa-ease-out) both; animation-delay: calc(var(--i, 0) * 40ms + 120ms); }
:is(.aisa-chart--animate, .aisa-reveal--play) .aisa-chart__value { animation: aisa-rise 360ms var(--aisa-ease-out) both; animation-delay: calc(var(--i, 0) * 40ms + 120ms + var(--aisa-duration-slow, 400ms)); }
:is(.aisa-chart--animate, .aisa-reveal--play) .aisa-chart__end { animation-delay: 980ms; }
:is(.aisa-chart--animate, .aisa-reveal--play) .aisa-chart__ref { animation: aisa-fade 420ms var(--aisa-ease-out) both; animation-delay: 760ms; }
.aisa-chart--bar .aisa-chart__bar, .aisa-chart--waterfall .aisa-chart__bar { transform-origin: center bottom; }
.aisa-chart--horizontal .aisa-chart__bar { transform-origin: left center; animation-name: aisa-grow-x; }
.aisa-chart--funnel .aisa-chart__label { font-size: 12px; }
.aisa-chart--funnel .aisa-chart__value { font-size: 13px; }
.aisa-chart--funnel .aisa-chart__bar { transform-origin: left center; animation-name: aisa-grow-x; }
/* the stage before is outlined first, then the bar grows into it */
:is(.aisa-chart--animate, .aisa-reveal--play) .aisa-chart__ghost { animation: aisa-fade 320ms var(--aisa-ease-out) both; animation-delay: calc(var(--i, 0) * 40ms + 60ms); }
.aisa-chart--diverging .aisa-chart__bar { animation-name: aisa-grow-x; }
.aisa-chart--gantt .aisa-chart__bar { transform-origin: left center; animation-name: aisa-grow-x; animation-delay: calc(var(--i, 0) * 70ms + 150ms); }
:is(.aisa-chart--animate, .aisa-reveal--play) .aisa-chart__line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: aisa-draw 900ms var(--aisa-ease-out) 150ms forwards; }
:is(.aisa-chart--animate, .aisa-reveal--play) :is(.aisa-chart__area, .aisa-chart__seg, .aisa-chart__forecast) { animation: aisa-fade 600ms var(--aisa-ease-out) both; }
/* a projection appears once the actual line has reached it */
:is(.aisa-chart--animate, .aisa-reveal--play) .aisa-chart__forecast { animation-delay: 900ms; }
/* grids (heatmap, calendar, waffle) fill in cell by cell; the donut sweeps round; a 100% bar unrolls from the left */
:is(.aisa-chart--animate, .aisa-reveal--play) .aisa-chart__cell { transform-box: fill-box; transform-origin: center; animation: aisa-pop 360ms var(--aisa-ease-out) both; animation-delay: calc(var(--i, 0) * 9ms); }
:is(.aisa-chart--animate, .aisa-reveal--play) .aisa-chart--donut .aisa-chart__seg { transform-box: view-box; animation: aisa-sweep 640ms var(--aisa-ease-out) both; animation-delay: calc(var(--i, 0) * 90ms); }
:is(.aisa-chart--animate, .aisa-reveal--play) .aisa-chart--segment .aisa-chart__seg { transform-box: view-box; transform-origin: left center; animation: aisa-grow-x 700ms var(--aisa-ease-out) both; }
:is(.aisa-chart--animate, .aisa-reveal--play) .aisa-ring__arc { animation: aisa-arc 900ms var(--aisa-ease-out) both; }
:is(.aisa-chart--animate, .aisa-reveal--play) :is(.aisa-rank__fill, .aisa-progress-list__fill) { transform-origin: left center; animation: aisa-grow-x 700ms var(--aisa-ease-out) both; animation-delay: calc(var(--i, 0) * 60ms); }
:is(.aisa-chart--animate, .aisa-reveal--play) .aisa-chart__dot { transform-box: fill-box; transform-origin: center; animation: aisa-pop 420ms var(--aisa-ease-out) both; animation-delay: calc(var(--i, 0) * 18ms + 120ms); }
:is(.aisa-chart--animate, .aisa-reveal--play) .aisa-chart__row { animation: aisa-rise 420ms var(--aisa-ease-out) both; animation-delay: calc(var(--i, 0) * 50ms); }
@keyframes aisa-grow { from { transform: scaleY(0); } }
@keyframes aisa-grow-x { from { transform: scaleX(0); } }
@keyframes aisa-draw { to { stroke-dashoffset: 0; } }
@keyframes aisa-fade { from { opacity: 0; } }
@keyframes aisa-pop { from { opacity: 0; transform: scale(0.4); } }
@keyframes aisa-rise { from { opacity: 0; transform: translateY(4px); } }
@keyframes aisa-sweep { from { opacity: 0; transform: rotate(-24deg) scale(0.94); } }
@keyframes aisa-arc { from { stroke-dasharray: 0 var(--circ, 400px); } }
@media (prefers-reduced-motion: reduce) {
  :is(.aisa-chart--animate, .aisa-reveal--play) * { animation: none !important; }
  :is(.aisa-chart--animate, .aisa-reveal--play) .aisa-chart__line { stroke-dasharray: none; stroke-dashoffset: 0; }
}
@media print { .aisa-reveal--waiting .aisa-chart__plot { opacity: 1; } }

/* spotlight: pointing at a mark (or a legend key) dims the others of its kind; a pinned tooltip stays until released */
.aisa-chart [data-k], .aisa-chart [data-s], .aisa-chart [data-r] { transition: opacity var(--aisa-duration-fast) var(--aisa-ease-out); }
.aisa-chart .is-dim { opacity: 0.22; }
.aisa-chart__tooltip.is-pinned { border-color: var(--aisa-line-strong); }
.aisa-chart__tooltip.is-pinned::after {
  content: ""; position: absolute; top: 6px; right: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--aisa-chart-emph);
}

/* stat tile: label · value · delta (· sparkline) */
.aisa-stat { font-family: var(--aisa-font-sans); }
.aisa-stat__label { font-size: var(--aisa-text-sm); color: var(--aisa-text-secondary); }
.aisa-stat__row { display: flex; align-items: flex-end; justify-content: space-between; gap: 4px var(--aisa-space-3); margin-top: 8px; }
/* the sparkline gives way to a long value instead of dropping to its own line */
.aisa-stat__row .aisa-spark { flex: 0 1 96px; min-width: 40px; height: auto; }
.aisa-stat__value { white-space: nowrap; font-variant-numeric: tabular-nums; font-family: var(--aisa-font-display); font-size: var(--aisa-text-3xl); font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; color: var(--aisa-text); }
.aisa-stat__delta { display: inline-flex; gap: 6px; align-items: baseline; margin-top: 8px; font-family: var(--aisa-font-mono); font-size: 10.5px; letter-spacing: .03em; color: var(--aisa-text-secondary); font-variant-numeric: tabular-nums; }
.aisa-stat__delta.is-good > span:nth-child(-n + 2) { color: var(--aisa-success-text); font-weight: 600; }
.aisa-stat__delta.is-bad > span:nth-child(-n + 2) { color: var(--aisa-danger-text); font-weight: 600; }
.aisa-stat__period { color: var(--aisa-text-muted); }
.aisa-spark { flex: none; }

/* meter: severity in the fill, a lighter step of the same ramp in the track */
.aisa-meter__head { display: flex; justify-content: space-between; gap: var(--aisa-space-3); font-size: var(--aisa-text-sm); margin-bottom: 6px; }
.aisa-meter__label { color: var(--aisa-text-secondary); }
.aisa-meter__value { font-family: var(--aisa-font-display); color: var(--aisa-text); font-weight: 700; font-variant-numeric: tabular-nums; }
.aisa-meter__track { height: 6px; border-radius: var(--aisa-radius-pill); background: var(--aisa-accent-soft); overflow: hidden; }
.aisa-meter__fill { height: 100%; border-radius: inherit; background: var(--aisa-accent); transition: width var(--aisa-duration-slow) var(--aisa-ease-out); }
.aisa-meter--ink .aisa-meter__track { background: var(--aisa-chart-track); }
.aisa-meter--ink .aisa-meter__fill { background: var(--aisa-chart-single); }
.aisa-meter--warning .aisa-meter__track { background: var(--aisa-warning-soft); }
.aisa-meter--warning .aisa-meter__fill { background: var(--aisa-warning); }
.aisa-meter--danger .aisa-meter__track { background: var(--aisa-danger-soft); }
.aisa-meter--danger .aisa-meter__fill { background: var(--aisa-danger); }

/* ring gauges: alone or a row (e.g. three half-year KPIs) */
.aisa-rings-row { display: flex; flex-wrap: wrap; justify-content: space-around; gap: var(--aisa-space-4); }
.aisa-ring-gauge { display: grid; justify-items: center; gap: 6px; text-align: center; min-width: 0; border-radius: var(--aisa-radius-sm); }
.aisa-ring-gauge:focus-visible { outline: none; box-shadow: var(--aisa-focus-ring); }
.aisa-ring__svg { display: block; overflow: visible; }
.aisa-ring__arc { transition: stroke-dasharray var(--aisa-duration-slow) var(--aisa-ease-out); }
.aisa-ring__value { font-family: var(--aisa-font-display); font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.aisa-ring__label { font-size: var(--aisa-text-xs); color: var(--aisa-text); font-weight: 500; }
.aisa-ring__sub { font-family: var(--aisa-font-mono); font-size: 10.5px; letter-spacing: .03em; color: var(--aisa-text-muted); font-variant-numeric: tabular-nums; }
.aisa-rings-row--inline { justify-content: flex-start; }
.aisa-rings-row--inline .aisa-ring-gauge { grid-template-columns: auto 1fr; justify-items: start; text-align: left; align-items: center; gap: 10px; }
.aisa-ring__pct { font-family: var(--aisa-font-display); font-size: var(--aisa-text-sm); font-weight: 700; color: var(--aisa-text); font-variant-numeric: tabular-nums; }

/* waffle */
.aisa-waffle { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--aisa-space-4); }
.aisa-waffle__value { font-family: var(--aisa-font-display); font-size: var(--aisa-text-3xl); font-weight: 700; letter-spacing: -0.03em; line-height: 1; color: var(--aisa-text); }
.aisa-waffle__label { margin-top: 6px; font-size: var(--aisa-text-xs); color: var(--aisa-text-secondary); }
.aisa-waffle__sub { font-family: var(--aisa-font-mono); font-size: 10.5px; letter-spacing: .03em; color: var(--aisa-text-muted); }

/* rank list (leaderboard) */
.aisa-rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; counter-reset: none; }
.aisa-rank__row { display: grid; grid-template-columns: 22px auto 1fr; align-items: center; gap: 10px; min-width: 0; }
.aisa-rank__row:not(:has(.aisa-rank__avatar)) { grid-template-columns: 22px 1fr; }
.aisa-rank__no { font-family: var(--aisa-font-mono); font-size: 11px; color: var(--aisa-text-muted); font-variant-numeric: tabular-nums; }
.aisa-rank__row.is-emph .aisa-rank__no { color: var(--aisa-chart-emph); font-weight: 600; }
.aisa-rank__avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; font-size: 10.5px; font-weight: 600; background: var(--aisa-surface-sunken); color: var(--aisa-text-secondary); border: 1px solid var(--aisa-line); }
.aisa-rank__main { display: grid; gap: 4px; min-width: 0; }
.aisa-rank__top { display: flex; justify-content: space-between; gap: 10px; font-size: var(--aisa-text-sm); min-width: 0; }
.aisa-rank__name { color: var(--aisa-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aisa-rank__value { font-family: var(--aisa-font-display); color: var(--aisa-text); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.aisa-rank__sub { font-family: var(--aisa-font-mono); font-size: 10.5px; letter-spacing: .03em; color: var(--aisa-text-muted); margin-top: -2px; }
.aisa-rank__bar { height: 3px; border-radius: 2px; background: var(--aisa-chart-track); overflow: hidden; }
.aisa-rank__fill { display: block; height: 100%; border-radius: inherit; }

/* progress list (key results) */
.aisa-progress-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.aisa-progress-list__head { display: flex; align-items: baseline; gap: 10px; font-size: var(--aisa-text-sm); margin-bottom: 5px; min-width: 0; }
.aisa-progress-list__label { flex: 1; min-width: 0; color: var(--aisa-text); }
.aisa-progress-list__label small { display: block; font-family: var(--aisa-font-mono); font-size: 10.5px; letter-spacing: .03em; color: var(--aisa-text-muted); }
.aisa-progress-list__value { font-family: var(--aisa-font-mono); color: var(--aisa-text-muted); font-size: 10.5px; letter-spacing: .02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.aisa-progress-list__pct { min-width: 38px; text-align: right; font-family: var(--aisa-font-display); font-weight: 700; color: var(--aisa-text); font-variant-numeric: tabular-nums; }
.aisa-progress-list__track { height: 4px; border-radius: 2px; background: var(--aisa-chart-track); overflow: hidden; }
.aisa-progress-list__fill { height: 100%; border-radius: inherit; background: var(--aisa-chart-single); transition: width var(--aisa-duration-slow) var(--aisa-ease-out); }
.aisa-progress-list__row--accent .aisa-progress-list__fill { background: var(--aisa-chart-emph); }
.aisa-progress-list__row--warning .aisa-progress-list__fill { background: var(--aisa-warning); }
.aisa-progress-list__row--danger .aisa-progress-list__fill { background: var(--aisa-danger); }

/* gantt */
.aisa-gantt__name { font-size: 12px; font-weight: 500; }
.aisa-gantt__today { font-size: 10px; font-weight: 600; }
.aisa-gantt__task:hover rect:first-child { stroke: var(--aisa-text-muted); }
