/* Shared visual grammar: semantic gains/losses; categorical comparisons; neutral chrome. */
:root { --chart-label: var(--fs-small); --chart-title: var(--fs-heading); --chart-gap: 12px;
  /* every horizontal bar on the site: thickness, square value end, gap between stacked parts, row rhythm */
  --bar: 8px; --bar-r: 0px; --bar-gap: 2px; --bar-row-gap: 10px; }
.chart, .netbox { min-width: 0; }
.chart text, .netbox text { font-family: var(--body); font-size: var(--chart-label); }
.chart-axis-label { fill: var(--muted); font-size: var(--chart-label); font-weight: var(--fw-medium); }
/* roles every chart shares: a reference line (median, in = out), its label, a line's end label and end dot */
.chart-ref { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart-ref-label { fill: var(--muted); font-size: var(--chart-label); }
.chart-end-label { fill: var(--ink); font-size: var(--chart-label); font-weight: var(--fw-medium); }
.chart-dot { stroke: var(--surface); stroke-width: 2; }
.chart-head, .movement-heading { margin-block-end: var(--sp-2); gap: 8px 16px; align-items: flex-start; }
.chart-head h3, .movement-heading h3 { margin: 0 0 3px; font-size: var(--chart-title); font-weight: var(--fw-medium); }
.chart-head p { margin: 0; font-size: var(--fs-small); color: var(--muted); }
.chart-help, .movement-hint { margin: 8px 0 12px; font-size: var(--fs-small); color: var(--muted); }
.chart-data, .movement-data { margin-top: 12px; font-size: var(--fs-small); }
.chart-data .tablebox, .movement-data .tablebox { margin-top: 12px; }
.chart-data tbody th { font-weight: var(--fw-regular); }
.legend-row, .legend, .movement-key { font-size: var(--fs-small); gap: 6px 16px; margin: 8px 0 10px; }
.legend-row > span, .legend > span { display: inline-flex; align-items: center; }
.movement-panel { padding-top: 20px; }
.movement-tip-row { font-size: var(--fs-small); }
.movement-tip-date, .movement-tip-total span { font-size: var(--fs-small); }
.movement-tip-total, .movement-tip-count { font-size: var(--fs-lead); }
.movement-actions { flex-wrap: wrap; gap: 8px 14px; }
.ask-read label { font-size: var(--fs-small); }
.seg button { min-height: 28px; }
.tip, .movement-tooltip {
  position: absolute; z-index: 4; box-sizing: border-box; width: max-content;
  max-width: min(360px,100%); background: var(--surface); color: var(--ink);
  border: 1px solid var(--rule); border-radius: var(--r-ui); box-shadow: var(--shadow-raised);
  padding: 12px; font-size: var(--fs-small); pointer-events: none; overflow-wrap: anywhere;
}
.tip[hidden], .movement-tooltip[hidden] { display: none; }
.tip .t { font-size: var(--fs-small); font-weight: var(--fw-strong); margin-bottom: 8px; }
.tip .row { white-space: normal; align-items: baseline; margin-top: 4px; }
.tip .v { white-space: nowrap; }
.tip .key-line { flex: none; align-self: center; }
.tip .row > :last-child { min-width: 0; }
.chart svg:focus-visible, .netbox svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.table-sort, .row-open {
  border: 0; background: none; color: inherit; font: inherit; cursor: pointer;
  padding: 0; text-align: inherit; border-radius: var(--r-ui);
}
.table-sort { display: inline-flex; align-items: center; min-height: var(--control-height); }
.row-open { color: var(--accent); white-space: inherit; }
.table-sort:hover, .row-open:hover { text-decoration: underline; }
.table-sort:focus-visible, .row-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.grid2 { grid-template-columns: repeat(auto-fit,minmax(min(320px,100%),1fr)); }
@media (pointer: coarse) {
  .row-open, .seg button, .pick button { min-height: var(--control-height); }
  .pick button { min-width: 32px; }
}
@media (max-width: 600px) {
  .chart-head, .movement-heading { flex-wrap: wrap; }
  .movement-actions { max-width: 100%; }
    .movement-tooltip { max-width: min(360px,100%); }
  .movement-tip-columns { gap: 12px; }
  .legend-row, .legend { gap: 6px 12px; }
}
.chart-data thead th { cursor: default; }
.movement-panel { position: relative; }
.movement-tip-row b { flex: none; white-space: nowrap; }
.movement-tip-row > span { min-width: 0; }

/* Treemap: HTML link cells laid out by d3.treemap; area is the count. Tints carry meaning (loss = departures, node = neutral). */
.treemap { position: relative; width: 100%; }
/* --tm-c is the area's type color: a light tint fills the area, the full color marks hover */
.tm-cell { position: absolute; box-sizing: border-box; border-radius: 0; padding: 9px 10px 8px; overflow: hidden; color: var(--ink); text-decoration: none;
  display: flex; flex-direction: column; gap: 2px; transition: box-shadow .12s; }
.tm-cell { color: var(--on-s1); }   /* text on the data color: white on navy, near-black on dark mode's light blue */
.tm-cell.on-light { color: var(--ink-on-light); }
.tm-cell .tm-value, .tm-cell .tm-value b { color: inherit; }
.tm-cell .tm-value span { opacity: .82; }
.tm-cell:hover, .tm-cell:focus-visible { filter: brightness(1.08) saturate(1.05); outline: none; text-decoration: none; }
.tm-cell:focus-visible { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.tm-cell:hover *, .tm-cell:focus-visible * { text-decoration: none; }
.tm-cell.tight, .tm-cell.tiny { padding: 4px 6px; }
.tm-label { font-size: var(--fs-ui); font-weight: var(--fw-strong); line-height: var(--lh-tight); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.tm-cell.roomy .tm-value { margin-top: auto; }
.tm-rest { margin: 8px 0 0; font-size: var(--fs-small); color: var(--muted); }
.tm-rest a { font-weight: var(--fw-strong); }
.tm-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; font-size: var(--fs-small); font-variant-numeric: tabular-nums; color: var(--muted); }
.tm-value b { color: var(--ink); font-weight: var(--fw-strong); font-size: var(--fs-ui); }
.tm-cell.big .tm-label { font-size: var(--fs-body); }
.tm-cell.big .tm-value b { font-size: var(--fs-lead); font-weight: var(--fw-strong); letter-spacing: var(--ls-display); font-variant-numeric: tabular-nums; }
.tm-cell.big .tm-value { flex-direction: column; gap: 0; margin-top: auto; }
.chart-head p.lede { font-size: var(--fs-body); line-height: var(--lh-body); max-width: var(--measure-short); }
.lateral-panel { position: relative; }
.lateral-chart { min-height: 214px; }
.lateral-chart svg { display: block; width: 100%; height: auto; }
.lateral-bar { fill: var(--s1); }
.lateral-bar.is-quiet { fill: var(--s3); }
.lateral-chart:has(.lateral-bar.is-on) .lateral-bar:not(.is-on) { fill: var(--s3); }
.lateral-bar.is-on { fill: var(--s1); }
.lateral-bar.is-latest { fill-opacity: .55; }
.lateral-callout { font-size: var(--fs-small); font-weight: var(--fw-strong); fill: var(--ink); }
.tm-legend { margin: 0; color: var(--muted); }
.tm-legend .swatch { display: inline-block; width: 10px; height: 10px; border-radius: var(--r-ui); margin-right: 6px; }
.tm-grid { align-items: start; }
