[part=base] {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  block-size: 20px;
  padding-block: 0;
  padding-inline: 6px;
  max-inline-size: 100%;
  border-radius: var(--radius-sm);
  background: var(--bythium-surface-raised);
  color: var(--bythium-text-secondary);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}
:host(:not([tone])) [part=base],:host([tone=info]) [part=base] {
  --badge-tone: var(--bythium-status-info);
}
:host([tone=success]) [part=base] {
  --badge-tone: var(--bythium-status-success);
}
:host([tone=danger]) [part=base] {
  --badge-tone: var(--bythium-status-danger);
}
:host([tone=warning]) [part=base] {
  --badge-tone: var(--bythium-status-warning);
}
:host([tone=brand]) [part=base] {
  --badge-tone: var(--bythium-brand-primary-text);
}
:host(:not([tone])) [part=base],:host([tone=info]) [part=base],:host([tone=success]) [part=base],:host([tone=danger]) [part=base],:host([tone=warning]) [part=base],:host([tone=brand]) [part=base] {
  color: var(--badge-tone);
  background: color-mix(in oklch,var(--badge-tone) 12%,var(--bythium-surface-base));
}
:host([tone=outline]) [part=base],:host([shape=circle]) [part=base] {
  box-sizing: border-box;
}
:host([tone=outline]) [part=base] {
  border: 1px solid var(--bythium-border-strong);
  background: transparent;
  color: var(--bythium-text-primary);
}
/* Brand gradient with dark text: at least 6.5:1 on both ends, in both themes (the gradient does not change with the theme). */
:host([tone=gradient]) [part=base] {
  background: linear-gradient(100deg,var(--bythium-brand-cyan),var(--bythium-brand-violet));
  color: oklch(0.14 0.02 275);
  font-weight: 650;
}
:host([shape=pill]) [part=base] {
  border-radius: var(--radius-full);
  padding-inline: 9px;
}
:host([shape=circle]) [part=base] {
  inline-size: 20px;
  justify-content: center;
  padding-inline: 0;
  border-radius: var(--radius-full);
  font-variant-numeric: tabular-nums;
}
:host([size=md]) [part=base] {
  block-size: 28px;
  padding-inline: 12px;
  font-size: 13px;
}
:host([size=md][shape=circle]) [part=base] {
  inline-size: 28px;
  padding-inline: 0;
}
:host([dot]) [part=base]::before {
  content: "";
  flex: none;
  inline-size: 6px;
  block-size: 6px;
  margin-inline-end: 1px;
  border-radius: 50%;
  background: currentcolor;
}
/* Large size: the thanks page's check badge (merci.html .badge-ok: 52 px, a 1 px frame at 50 % of the tone, a fill at 14 %,
   a 26 px glyph). A tone without --badge-tone (neutral, outline, gradient) frames with its own text colour. */
:host([size=lg]) [part=base] {
  box-sizing: border-box;
  block-size: 52px;
  padding-inline: 20px;
  border: 1px solid color-mix(in oklch,var(--badge-tone,currentcolor) 50%,transparent);
  font-size: 22px;
}
:host([size=lg]:is(:not([tone]),[tone=info],[tone=success],[tone=danger],[tone=warning],[tone=brand])) [part=base] {
  background: color-mix(in oklch,var(--badge-tone) 14%,transparent);
}
:host([size=lg][shape=circle]) [part=base] {
  inline-size: 52px;
  padding-inline: 0;
}
:host([size=lg]) ::slotted(*) {
  inline-size: 26px;
  block-size: 26px;
}
@media (forced-colors: active) {
  [part=base] {
    border: 1px solid CanvasText;
  }
  :host([tone=gradient]) [part=base] {
    background: Canvas;
    color: CanvasText;
  }
  :host([dot]) [part=base]::before {
    background: CanvasText;
  }
}
