@layer components {
  /* AI usage in the sidebar (layouts/_ai_usage): its color blue, orange from 80 %, red from 90 % of the budget
     (AiUsageHelper#ai_usage_level), the same for the ring, the percent behind its name and the bar in its details */
  .ai-usage {
    --ai-usage-color: var(--color-blue-accent);
  }

  .ai-usage--warning {
    --ai-usage-color: var(--color-warning);
  }

  .ai-usage--critical {
    --ai-usage-color: var(--color-negative);
  }

  /* A ring drawn as far as the budget is used, from the top clockwise */
  .ai-usage__ring {
    inline-size: 1em;
    block-size: 1em;
    flex-shrink: 0;
    rotate: -90deg;
    fill: none;
    stroke-width: 3;
  }

  .ai-usage__track {
    stroke: var(--color-border);
  }

  .ai-usage__fill {
    stroke: var(--ai-usage-color);
  }

  /* In the link's color next to its name (blue under the pointer, as every link in the sidebar), until it turns orange
     or red */
  :is(.ai-usage--warning, .ai-usage--critical) .ai-usage__percent {
    color: var(--ai-usage-color);
  }

  /* Its details open upwards, wide enough to read in the collapsed sidebar too */
  .ai-usage .dropdown-menu {
    inline-size: 16rem;
    right: auto;
  }

  /* A thin bar: the number above says it */
  .ai-usage .progress {
    block-size: 6px;
    color: var(--ai-usage-color);
  }
}
