/* AI marking: the sparkle and the word AI on blocks, dotted words in mixed text, the sparkle alone
   in dense spots, and one note that says what wrote it, from what, and who checked it. */
.bc-ai-glyph { flex: 0 0 auto; color: var(--label-2); vertical-align: -2px; }
/* Layer 1: the label. The word AI plus the sparkle, on blocks. */
/* Always one 24px line. A long name never pushes the page sideways: the words (bc-ai-badge__text)
   end in "…" inside their container, and the note, which opens on focus, hover and tap, holds the
   full name. The words get the clip, not the label, so the note it positions isn't clipped too.
   A grid, not a flex row: the words' column (minmax(0, max-content)) asks for no width at its
   narrowest, so a row or card that sizes itself to its content takes its container's width, not
   the full name's, and the label then ends in "…" (BLU-563). The sparkle keeps its own column. */
.bc-ai-badge { position: relative; display: inline-grid; grid-auto-flow: column; grid-template-columns: auto; grid-auto-columns: minmax(0, max-content); align-items: center; gap: 5px; box-sizing: border-box; min-height: 24px; max-width: 100%; padding: 4px 9px 4px 7px;
  border-radius: var(--radius-pill); background: var(--fill); color: var(--label-2);
  font-size: 0.75rem; line-height: 1.3334; font-weight: 600; white-space: normal; cursor: help; }
.bc-ai-badge > .bc-ai-badge__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-ai-badge .bc-ai-glyph { color: currentColor; }
.bc-ai-badge:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
/* Layer 2: inside text. Dotted underline on the exact words, sparkle after them. */
.bc-ai { position: relative; text-decoration: underline dotted var(--label-2); text-decoration-thickness: 2px;
  text-underline-offset: 4px; text-decoration-skip-ink: none; cursor: help; border-radius: 2px; }
.bc-ai > .bc-ai-glyph { margin-left: 3px; vertical-align: 1px; }
.bc-ai:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
@media (hover: hover) { .bc-ai:hover { text-decoration-color: var(--label); } }
/* Layer 3: dense spots. The sparkle alone, opening the same note. */
.bc-ai-dot { position: relative; display: inline-flex; align-items: center; justify-content: center; cursor: help; border-radius: 4px; }
.bc-ai-dot:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.bc-status-pill .bc-ai-glyph { color: currentColor; margin-left: 2px; }
.bc-ai-corner { position: relative; display: inline-flex; }
.bc-ai-corner > .bc-ai-glyph { position: absolute; right: -6px; top: -6px; padding: 1px; border-radius: 50%; background: var(--surface); color: var(--label); }
/* The note: what wrote it, from what, who checked it. Hover, focus and tap. */
.bc-ai-note { position: absolute; z-index: 30; left: 0; top: calc(100% + 10px); width: min(340px, calc(100vw - 48px)); box-sizing: border-box;
  display: none; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: var(--radius-field);
  background: var(--surface-raised); box-shadow: var(--shadow-3); color: var(--label);
  font-size: 0.8125rem; line-height: 1.3847; font-weight: 400; text-align: left; text-decoration: none; white-space: normal; cursor: auto;
  animation: bc-pop var(--duration-pop) var(--ease) both; transform-origin: top left; }
.bc-ai:hover > .bc-ai-note, .bc-ai:focus-within > .bc-ai-note, .bc-ai-badge:hover > .bc-ai-note, .bc-ai-badge:focus-within > .bc-ai-note,
.bc-ai-dot:hover > .bc-ai-note, .bc-ai-dot:focus-within > .bc-ai-note { display: flex; }
/* Escape closes the note until the mark is focused again (WCAG 1.4.13): the mark sets data-note-dismissed. */
:is(.bc-ai, .bc-ai-badge, .bc-ai-dot)[data-note-dismissed="true"]:is(:hover, :focus-within) > .bc-ai-note { display: none; }
.bc-ai-note > span, .bc-ai-note__rows > span { display: block; }
.bc-ai-note > .bc-ai-note__head { display: flex; align-items: center; gap: 6px; font-size: 0.875rem; line-height: 1.4286; font-weight: 600; }
.bc-ai-note__head .bc-ai-glyph { color: var(--label); }
.bc-ai-note > .bc-ai-note__rows { display: grid; grid-template-columns: 76px 1fr; gap: 4px 10px; }
.bc-ai-note__k { color: var(--label-2); }
.bc-ai-note a { font-weight: 600; }
.bc-ai-note > .bc-ai-note__foot { display: flex; gap: 14px; padding-top: 8px; box-shadow: inset 0 0.5px 0 var(--separator); }
.bc-ai-note--end { left: auto; right: 0; transform-origin: top right; }
/* Set by ai-mark.js: the note opens upward when there's no room below, and Escape closes it. */
.bc-ai-note--up { top: auto; bottom: calc(100% + 10px); transform-origin: bottom left; }
.bc-ai-note--up.bc-ai-note--end { transform-origin: bottom right; }
:is(.bc-ai, .bc-ai-badge, .bc-ai-dot).bc-ai--closed > .bc-ai-note:not(.bc-ai-note--static) { display: none; }
.bc-ai-note--static { position: static; display: flex; animation: none; }
@media (max-width: 600px) { .bc-ai-note:not(.bc-ai-note--static) { position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px; width: auto; transform-origin: bottom center; } }
/* Above 600px the note never runs past the window or widens the page, with CSS alone, so it holds
   where ai-mark.js isn't loaded, as in the product app (BLU-775; WCAG 1.4.10 Reflow). With anchor
   positioning, the note is fixed to the window, so it never adds to the page's scroll width, and
   tied to its mark. When it doesn't fit below the mark and aligned to its edge, it tries the other
   edge, then above, then 8px from the window's left edge. Without anchor positioning, the note is
   a bottom sheet up to 1023px, where a mark near either edge would otherwise push it off screen. */
@supports (anchor-scope: all) {
  @media (min-width: 601px) {
    .bc-ai, .bc-ai-badge, .bc-ai-dot { anchor-name: --bc-ai-mark; anchor-scope: --bc-ai-mark; }
    .bc-ai-note:not(.bc-ai-note--static) { position: fixed; position-anchor: --bc-ai-mark;
      top: calc(anchor(bottom) + 10px); bottom: auto; left: anchor(left); right: auto;
      position-try-fallbacks: flip-inline, flip-block, flip-block flip-inline, --bc-ai-note-start, --bc-ai-note-start-up; }
    .bc-ai-note--end:not(.bc-ai-note--static) { left: auto; right: anchor(right); }
  }
}
@position-try --bc-ai-note-start { top: calc(anchor(bottom) + 10px); bottom: auto; left: 8px; right: auto; }
@position-try --bc-ai-note-start-up { top: auto; bottom: calc(anchor(top) + 10px); left: 8px; right: auto; }
@supports not (anchor-scope: all) {
  @media (min-width: 601px) and (max-width: 1023px) { .bc-ai-note:not(.bc-ai-note--static) { position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px; width: auto; transform-origin: bottom center; } }
}
.bc-ai__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Forced colours (Windows contrast themes) drop fills and shadows, so the label would lose its
   capsule and read as loose words, the note would float over the page with no edge, and the line
   above its links would vanish. The label and the note keep a CanvasText border, and the line takes
   CanvasText. The sparkle, the dotted underline and the focus rings already take system colours.
   The label's border takes 1px from its padding, so a short label stays one 24px line. */
@media (forced-colors: active) {
  .bc-ai-badge { border: 1px solid CanvasText; padding: 3px 8px 3px 6px; }
  .bc-ai-note { border: 1px solid CanvasText; }
  .bc-ai-note > .bc-ai-note__foot { border-top: 1px solid CanvasText; }
  .bc-ai-corner > .bc-ai-glyph { background: Canvas; }
}
