/* AI Adoption & Cost: the charts in the example boxes (spend by tool, team
   budgets, return per tool). Categorical tool colors are the validated
   four-slot palette (blue, orange, aqua, yellow); aqua and yellow sit below
   3:1 on white, so every value is also printed in a legend, a label, or the
   table view. Builds on command-page.css. */
.roi-chart {
  --roi-claude: #2a78d6;
  --roi-cursor: #eb6834;
  --roi-copilot: #1baf7a;
  --roi-codex: #eda100;
  --roi-grid: #e4e3dd;
  --roi-track: #cde2fb;
  --roi-fill: #2a78d6;
  --roi-warn: #fab219;
}
.cp-page .roi-chart .cp-card-body {
  display: grid;
  gap: 16px;
}

/* Legend: swatch, name, current value (the value is the visible label). */
.cp-page .roi-chart .roi-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}
.cp-page .roi-chart .roi-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
}
.cp-page .roi-chart .roi-legend b {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.roi-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 2px;
}
.roi-claude {
  background: var(--roi-claude);
}
.roi-cursor {
  background: var(--roi-cursor);
}
.roi-copilot {
  background: var(--roi-copilot);
}
.roi-codex {
  background: var(--roi-codex);
}

/* Stacked columns: monthly spend by tool. Scale 0 to $16K. */
.roi-plot {
  position: relative;
  height: 200px;
  margin: 8px 0 0 44px;
}
.roi-grid-line {
  position: absolute;
  right: 0;
  left: 0;
  border-top: 1px solid var(--roi-grid);
}
.roi-grid-line span {
  position: absolute;
  top: -7px;
  right: calc(100% + 8px);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}
.roi-budget {
  position: absolute;
  right: 0;
  left: 0;
  border-top: 1px solid var(--ink-soft);
}
.roi-budget span {
  position: absolute;
  top: -18px;
  right: 0;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}
.roi-cols {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  margin: 0;
  padding: 0;
  list-style: none;
}
.roi-col {
  position: relative;
  display: flex;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}
.roi-stack {
  display: flex;
  width: 24px;
  flex-direction: column-reverse;
  gap: 2px;
}
.roi-stack > span {
  position: relative;
  display: block;
  min-height: 2px;
}
.roi-stack > span:last-child {
  border-radius: 4px 4px 0 0;
}
.roi-col-total {
  margin-bottom: 4px;
  color: var(--ink-soft);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.roi-xlabels {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 6px 0 0 44px;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* Hover and focus tooltips for every mark. */
[data-tip] {
  position: relative;
}
[data-tip]:hover::after,
[data-tip]:focus-visible::after {
  position: absolute;
  z-index: 5;
  bottom: calc(100% + 6px);
  left: 50%;
  padding: 5px 8px;
  border-radius: 4px;
  background: #1f2328;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  content: attr(data-tip);
  pointer-events: none;
  transform: translateX(-50%);
}
[data-tip]:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* Meter list: spend against each team's budget. */
.cp-page .roi-chart .roi-meters {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cp-page .roi-chart .roi-meters li {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.cp-page .roi-chart .roi-meters strong {
  color: var(--ink);
  font-weight: 600;
}
.roi-meter {
  position: relative;
  height: 10px;
  border-radius: 5px;
  background: var(--roi-track);
}
.roi-meter > span {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  border-radius: 5px;
  background: var(--roi-fill);
}
.roi-meter.is-near > span {
  background: var(--roi-warn);
}
.roi-target {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  background: var(--ink);
}
.roi-figure {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.roi-figure small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.roi-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #7a5a12;
  font-size: 11px;
  font-weight: 600;
}
.cp-page .roi-flag svg {
  width: 12px;
  height: 12px;
  color: #b78300;
}
.roi-adoption {
  display: grid;
  gap: 6px;
  font-size: 13px;
}
.roi-adoption-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-soft);
}

/* Ranked bars: value returned per $1 spent, one hue. */
.cp-page .roi-chart .roi-bars {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cp-page .roi-chart .roi-bars li {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.roi-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.roi-bar > span {
  height: 16px;
  border-radius: 0 4px 4px 0;
  background: var(--roi-fill);
}
.roi-bar b {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Table view for the column chart. */
.roi-table-view summary {
  color: var(--blue-dark);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.roi-table-view[open] summary {
  margin-bottom: 8px;
}
.cp-page .roi-chart .cp-table td,
.cp-page .roi-chart .cp-table th {
  font-variant-numeric: tabular-nums;
}
.roi-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.roi-tools span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .roi-plot,
  .roi-xlabels {
    margin-left: 36px;
  }
  .roi-stack {
    width: 18px;
  }
  .roi-col-total {
    display: none;
  }
  .cp-page .roi-chart .roi-meters li {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .roi-meter {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .cp-page .roi-chart .roi-bars li {
    grid-template-columns: 92px minmax(0, 1fr);
  }
}

/* Return KPIs in a 2 x 2 grid. */
.cp-page .roi-kpis {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
