/* Shared by CSA, FSTalent and RobotRisk. Each Cloudflare Pages project watches sites/shared/* so edits here redeploy all three. */
.csa-analytics-grid,
.chartrow {
  container-type: inline-size;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 14px;
  margin: 12px 0 18px;
  align-items: start;
}

.csa-chart-card,
.chart {
  min-width: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--csa-chart-line, rgba(15, 23, 42, 0.12));
  border-radius: 8px;
  padding: 12px 14px;
}

.csa-chart-card-compact {
  padding-block: 10px;
}

.csa-chart-card h3,
.chart h3 {
  margin: 0 0 8px;
  font-size: var(--ui-font-card-title);
  line-height: 1.3;
  font-weight: 700;
  color: var(--csa-chart-ink, currentColor);
}

.csa-chart {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.csa-chart svg {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  overflow: visible;
}

.csa-chart text {
  font-family: inherit;
  font-size: calc(var(--ui-font-chart-label) * var(--csa-svg-k, 1));
  fill: var(--csa-chart-muted, #64748b);
}

.csa-chart .csa-chart-tick {
  font-size: calc(0.9375rem * var(--csa-svg-k, 1));
  fill: var(--csa-chart-muted, #64748b);
}

.csa-chart .csa-chart-value,
.csa-chart .csa-chart-label {
  font-size: calc(var(--ui-font-chart-label) * var(--csa-svg-k, 1));
  fill: var(--csa-chart-ink, #111827);
}

.csa-chart .csa-chart-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.csa-chart .csa-chart-label {
  font-weight: 600;
}

.csa-chart .csa-chart-colval {
  font-weight: 500;
  fill: var(--csa-chart-muted, #475569);
}

.csa-chart .csa-chart-track {
  opacity: 0.08;
}

.csa-chart .csa-chart-gridline {
  stroke: var(--csa-chart-line, #dfe1e2);
  stroke-dasharray: 2 4;
}

.csa-stat-tile {
  display: grid;
  gap: 4px;
  min-height: 88px;
  align-content: center;
}

.csa-stat-label {
  color: var(--csa-chart-muted, #64748b);
  font-size: var(--ui-font-small);
  line-height: 1.25;
}

.csa-stat-value {
  color: var(--csa-chart-ink, #111827);
  font-size: 2.25rem;
  line-height: 1;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.csa-stat-note {
  color: var(--csa-chart-muted, #64748b);
  font-size: var(--ui-font-small);
  line-height: 1.3;
}

.csa-chart-legend,
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 10px;
  padding: 0;
  color: var(--csa-chart-muted, #64748b);
  font-size: var(--ui-font-small);
  line-height: 1.3;
}

.csa-chart-legend:empty,
.legend:empty {
  display: none;
}

.csa-chart-legend span,
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.csa-chart-legend i,
.legend i {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  flex: none;
}

.csa-chart-tip {
  min-width: 0;
  overflow-wrap: break-word;
}

.csa-hbar {
  display: grid;
  gap: 10px;
}

.csa-hbar-row {
  display: grid;
  grid-template-columns: minmax(6rem, 38%) minmax(3rem, 1fr) auto;
  align-items: center;
  gap: 10px;
  font-size: var(--ui-font-small);
  line-height: 1.3;
}

.csa-chart .csa-hbar .csa-chart-label,
.csa-chart .csa-hbar .csa-chart-value {
  font-size: var(--ui-font-chart-label);
  color: var(--csa-chart-ink, #111827);
  overflow-wrap: break-word;
}

.csa-hbar .csa-chart-value {
  text-align: right;
  min-width: 2.5ch;
}

/* Rows/headers that link back to their entity page (company, category, etc.): read as a link,
   not as decorative chart text, while keeping the same size/weight as unlinked labels. */
.csa-chart a.csa-chart-link {
  color: var(--ui-color-brand, var(--csa-chart-ink, #111827));
  text-decoration: none;
}
.csa-chart a.csa-chart-link:hover,
.csa-chart a.csa-chart-link:focus-visible {
  text-decoration: underline;
}
.csa-chart a.csa-chart-link:focus-visible {
  outline: 2px solid var(--ui-color-focus, #2491ff);
  outline-offset: 2px;
  border-radius: 2px;
}

.csa-hbar-bar {
  position: relative;
  display: block;
  height: 16px;
  border-radius: 3px;
  overflow: hidden;
}

.csa-hbar-bar .csa-chart-track {
  position: absolute;
  inset: 0;
  background: #2378C3;
}

.csa-hbar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 3px;
}

.csa-donut {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.csa-donut-ring {
  position: relative;
  flex: none;
  width: 160px;
  height: 160px;
}

.csa-donut-total {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  font-size: var(--ui-font-small);
  line-height: 1.2;
  color: var(--csa-chart-muted, #64748b);
}

.csa-donut-total b {
  font-size: 1.25rem;
  color: var(--csa-chart-ink, #111827);
}

.csa-donut-legend {
  flex: 1 1 200px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}

.csa-donut-legend li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  font-size: var(--ui-font-small);
  line-height: 1.3;
}

.csa-donut-legend i {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.csa-chart .csa-donut-legend .csa-chart-label,
.csa-chart .csa-donut-legend .csa-chart-value,
.csa-chart .csa-heat .csa-chart-label,
.csa-chart .csa-heat .csa-chart-value {
  font-size: var(--ui-font-chart-label);
  color: var(--csa-chart-ink, #111827);
}

.csa-donut-legend .csa-chart-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.csa-heat-wrap {
  overflow-x: auto;
  max-width: 100%;
}

.csa-heat {
  width: 100%;
  border-collapse: separate;
  border-spacing: 2px;
  font-size: var(--ui-font-small);
  line-height: 1.25;
}

.csa-chart .csa-heat td {
  font-size: var(--ui-font-small);
}

.csa-chart .csa-heat th {
  font-size: var(--ui-font-table-header);
}

.csa-heat th {
  font-weight: 600;
  text-align: center;
  padding: 4px 3px;
  hyphens: none;
  overflow-wrap: normal;
  word-break: normal;
  color: var(--csa-chart-ink, #111827);
}

.csa-heat thead th {
  vertical-align: bottom;
}

.csa-heat tbody th {
  text-align: left;
}

.csa-chart .csa-heat td.csa-chart-value {
  text-align: center;
  padding: 5px 4px;
  border-radius: 3px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.csa-chart .csa-heat td.csa-chart-value[style*="#fff"] {
  color: #fff;
}


/* Wide heatmaps (many columns) take the full grid row instead of scrolling inside a narrow card. */
.csa-analytics-grid > :has(.csa-heat-wide),
.chartrow > :has(.csa-heat-wide) {
  grid-column: 1 / -1;
}
