/* ---------------------------------------------------------------------------
 * bbai.css — las primitivas de la interfaz del ANALISTA (agente, ⌘K, hallazgos)
 * ---------------------------------------------------------------------------
 * Referencia: beautifului.dev (Turbo, MIT) — "Crafted primitives for AI-native
 * interfaces", 21 componentes. Miguel, 29 sep 2026: *"recheck and rework the
 * native interfaces que tenemos en bridgebi utilizando los copy prompts y todo
 * diseños de esta página"*. El código de cada uno se bajó del propio sitio (el
 * botón "Copy code" entrega el .tsx completo) y se leyó antes de portarlo.
 *
 * Lo que se trajo es la GEOMETRÍA y el RITMO, no la paleta:
 *   - su vocabulario de tokens (`--ink`, `--ink-2`, `--ink-3`, `--line`,
 *     `--surface`, `--inset`, `--field`, `--hover-2`, `--accent`, sombras
 *     `hairline/card/overlay`) es casi uno a uno el nuestro, así que cada regla
 *     de aquí usa `--bb-*` y el tema oscuro sale gratis;
 *   - su curva principal es cubic-bezier(.23,1,.32,1) — que YA es
 *     `--bb-ease-strong`. 48 de sus 58 transiciones la usan;
 *   - su escala de texto: 13px cuerpo, 12.5px filas, 11.5px metadatos, mono
 *     tabular para todo lo que cuenta. La mono de la casa es `--bb-mono`
 *     (ver ../DESIGN.md), NUNCA una familia escrita a mano.
 *
 * Este archivo es REAL del app, no del catálogo (misma regla que bbbar.css):
 * `/ui` lo enseña junto a lo que hay hoy, Miguel escoge, y la página que adopte
 * un default importa ESTE archivo. Prefijo `bbai-` para que no pueda tocar nada
 * de agent.css / index.html por accidente.
 *
 * `bbai-`, NUNCA `bba-`: el primer corte (29 sep 2026) salió con `bba-` y
 * announce.css (el pop-up de Anuncios) ya era dueño de ese prefijo — `.bba-card`,
 * `.bba-foot`, `.bba-x` chocaban en las dos direcciones: el bloque de código de
 * una respuesta salió a opacidad 0 con blur(8px) (el estado de ENTRADA del
 * pop-up) y el pop-up heredaba el pie y la X de aquí. Antes de estrenar un
 * prefijo: `grep -rn "\.<prefijo>-" *.css *.js`.
 *
 * Movimiento: un solo `@media (prefers-reduced-motion)` al pie congela TODO lo
 * que se repite (la rejilla, el brillo, los anillos). El reloj sigue corriendo
 * — un tiempo que avanza es información, no decoración.
 * -------------------------------------------------------------------------*/

.bbai { font-family: var(--bb-display); color: var(--bb-ink); font-size: 13px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; }
.bbai *, .bbai *::before, .bbai *::after { box-sizing: border-box; }
/* No `width` here: this reset outranks every single-class component rule
   (.bbai-mi, .bbai-opt …) on specificity, and a `width:auto` in it silently
   shrank every full-width row to its content. */
.bbai button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0;
  cursor: pointer; overflow: visible; text-transform: none; letter-spacing: normal; box-shadow: none;
  min-height: 0; }
.bbai svg { max-width: none; flex: none; }
.bbai .n { font-family: var(--bb-mono); font-variant-numeric: tabular-nums; }

/* Tarjeta base — la `primitive-card` de la referencia: superficie, radio de
   tarjeta, sombra de tarjeta, pie separado por una línea. */
.bbai-card { background: var(--bb-surface); border-radius: var(--bb-r-card); box-shadow: var(--bb-sh-card);
  overflow: hidden; position: relative; }
.bbai-pad { padding: 14px 16px; }
.bbai-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 10px 8px 16px; border-top: 1px solid var(--bb-line); background: var(--bb-surface); }
.bbai-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; border-bottom: 1px solid var(--bb-line); }
.bbai-t { font-size: 14px; font-weight: 600; color: var(--bb-ink); letter-spacing: -.005em; }
.bbai-s { font-size: 11.5px; color: var(--bb-ink-3); }

/* Botones de la tarjeta: uno oscuro (la acción) y uno callado. */
.bbai-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: var(--bb-r-control); font-size: 12.5px; font-weight: 600; color: var(--bb-ink);
  background: var(--bb-surface); box-shadow: var(--bb-sh-btn);
  transition: background var(--bb-t-base) var(--bb-ease-strong), transform var(--bb-t-fast); }
.bbai .bbai-btn { box-shadow: var(--bb-sh-btn); }
.bbai-btn:hover { background: var(--bb-hover); }
.bbai-btn:active { transform: scale(.97); }
.bbai .bbai-btn.go { background: var(--bb-accent); color: #fff; box-shadow: none; }
.bbai .bbai-btn.go:hover { background: var(--bb-accent-ink); }
.bbai .bbai-btn.go:disabled { opacity: .35; cursor: default; }
.bbai .bbai-btn.pill { border-radius: 999px; }
.bbai-btn kbd { font: 500 10.5px var(--bb-mono); opacity: .7; }
.bbai-ghost { font-size: 12px; font-weight: 600; color: var(--bb-ink-3);
  transition: color var(--bb-t-base); }
.bbai-ghost:hover { color: var(--bb-ink); }

/* Estado en pastilla — completado / falló / corriendo. 6px de radio en la casa
   (DESIGN.md: "flag tags NOT pill-shaped"), aunque la referencia usa píldora. */
.bbai-st { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: var(--bb-r-chip); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.bbai-st.ok { background: var(--bb-green-tint); color: var(--bb-green); }
.bbai-st.bad { background: var(--bb-red-tint); color: var(--bb-red); }
.bbai-st.run { background: var(--bb-field); color: var(--bb-ink-2); }
.bbai-st.warn { background: var(--bb-orange-tint); color: var(--bb-orange); }

/* Girador de 12px: anillo gris con la tapa oscura — el mismo en cinco piezas. */
.bbai-spin { width: 12px; height: 12px; border-radius: 50%; flex: none;
  border: 1.5px solid var(--bb-line-strong); border-top-color: var(--bb-ink-2);
  animation: bbai-spin .7s linear infinite; }
.bbai-check { width: 14px; height: 14px; flex: none; color: var(--bb-ink-3); }

/* El rótulo que brilla: gris → tinta → gris, 1.4s. Sólo mientras algo corre. */
.bbai-shimmer { background-image: linear-gradient(90deg, var(--bb-ink-3) 35%, var(--bb-ink) 50%, var(--bb-ink-3) 65%);
  background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: bbai-shimmer 1.4s linear infinite; }

/* Filas que se despliegan: `grid-template-rows: 0fr → 1fr` anima una altura
   desconocida sin medirla. El hijo necesita `min-height:0` o no encoge. */
.bbai-fold { display: grid; grid-template-rows: 0fr; opacity: 0;
  transition: grid-template-rows var(--bb-t-slow) var(--bb-ease-strong), opacity var(--bb-t-slow); }
.bbai-fold > * { min-height: 0; overflow: hidden; }
.is-open > .bbai-fold, .bbai-fold.is-open { grid-template-rows: 1fr; opacity: 1; }
.bbai-caret { width: 12px; height: 12px; color: var(--bb-ink-3); transition: transform .2s var(--bb-ease-strong); }
.is-open > * > .bbai-caret, .is-open > .bbai-caret { transform: rotate(90deg); }

/* =========================== 01 · CARGANDO ================================ */
/* Rejilla de 3×3 píxeles de 4px. Cada celda enciende con un retraso: el
   frente en chevron (Drive/Dots) dura 650ms, más corto que el barrido, así que
   siempre hay DOS frentes en vuelo; Orbit es un cometa por el perímetro. Los
   retrasos van en `--d` por celda (bbai.js) y las celdas apagadas llevan
   `.off` — nunca un `animation-delay` escalonado sobre un loop infinito sin
   que el retraso sea parte del patrón (css-stagger-delay-infinite-loop: aquí
   ES el patrón, y todas comparten la misma duración, así que no derivan). */
.bbai-load { display: inline-flex; align-items: center; gap: 10px; }
.bbai-grid { display: grid; grid-template-columns: repeat(3, 4px); gap: 1.5px; flex: none; }
.bbai-grid i { width: 4px; height: 4px; border-radius: 1px; background: var(--bb-ink); opacity: .15;
  animation: bbai-pixel var(--dur, 650ms) ease-in-out var(--d, 0ms) infinite; }
.bbai-grid.round i { border-radius: 50%; }
.bbai-grid i.off { opacity: .07; animation: none; }
.bbai-grid.lg { grid-template-columns: repeat(3, 6px); gap: 2px; }
.bbai-grid.lg i { width: 6px; height: 6px; }
.bbai-load-l { font-size: 13px; font-weight: 500; }
.bbai-clock { font: 500 12px var(--bb-mono); font-variant-numeric: tabular-nums; color: var(--bb-ink-3); }

/* =========================== 02 · TRAZA ==================================== */
.bbai-trace { max-width: 380px; }
.bbai-trace-h { display: inline-flex; align-items: center; gap: 8px; margin: 0 -6px; padding: 4px 6px;
  border-radius: var(--bb-r-control); font-size: 13px; font-weight: 500; color: var(--bb-ink-2);
  transition: background var(--bb-t-fast); }
.bbai-trace-h:hover { background: var(--bb-hover); }
.bbai-trace-h .ico { width: 14px; height: 14px; color: var(--bb-ink-3); }
.bbai-trace.is-run .bbai-trace-h .ico { color: var(--bb-ink-2); }
.bbai-trace-b { position: relative; margin: 4px 0 0 5px; padding-left: 16px; }
.bbai-trace-b::before { content: ''; position: absolute; left: 3px; top: 6px; bottom: 6px; width: 1px;
  background: var(--bb-line); }
.bbai-trace-rows { display: flex; flex-direction: column; gap: 4px; padding: 4px 0; }
.bbai-trace-r { display: flex; align-items: center; gap: 8px; min-height: 24px; padding: 0 6px;
  border-radius: var(--bb-r-control); animation: bbai-up .3s var(--bb-ease-strong) both; }
.bbai-trace-r .p { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px; font-weight: 500; color: var(--bb-ink); }
.bbai-trace-r .p.prose { white-space: normal; font-weight: 400; color: var(--bb-ink-2); line-height: 1.55; }
.bbai-trace-r .m { flex: none; font-size: 11.5px; color: var(--bb-ink-3); }
.bbai-trace-r .m.n { font-size: 11px; }
.bbai-trace-r .add { color: var(--bb-green); }
.bbai-trace-r .del { color: var(--bb-red); }
.bbai-trace-r.q .p { font-weight: 400; color: var(--bb-ink-2); }

/* =========================== 03 · STREAMING =============================== */
/* Las palabras salen del desenfoque: 6px → 0 y opacidad 0 → 1 en 420ms, con el
   retraso por palabra en `--w`. Es UNA sola entrada, nunca un loop. */
.bbai-stream { max-width: 520px; font-size: 13.5px; line-height: 1.65; color: var(--bb-ink); }
.bbai-stream .w { display: inline; animation: bbai-unblur .42s var(--bb-ease-strong) calc(var(--w, 0) * 38ms) both; }
.bbai-stream .caret { display: inline-block; width: 2px; height: 13px; margin-left: 2px; border-radius: 2px;
  background: var(--bb-ink); transform: translateY(2px); animation: bbai-blink 1s steps(2) infinite; }
.bbai-cite { display: inline-flex; align-items: center; gap: 4px; height: 19px; padding: 0 6px 0 3px;
  margin: 0 1px; border-radius: 5px; background: var(--bb-field); color: var(--bb-ink-2);
  font: 600 11px var(--bb-display); vertical-align: 1px; transition: background var(--bb-t-fast); }
.bbai-cite:hover { background: var(--bb-hover-2); color: var(--bb-ink); }
.bbai-src-ico { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 4px;
  font: 700 8.5px var(--bb-display); color: #fff; background: var(--bb-accent); flex: none; }
/* Una familia por ORIGEN del dato (sourceFamily() en agent.js): Velocify,
   las plataformas de anuncios, los workbooks, BESC, y el propio app. */
.bbai-src-ico.crm { background: var(--bb-gold-ink); }
.bbai-src-ico.ads { background: #1D4ED8; }
.bbai-src-ico.wb { background: var(--bb-violet); }
.bbai-src-ico.besc { background: var(--bb-cyan); }
.bbai-src-ico.app { background: var(--bb-accent); font-size: 7px; letter-spacing: -.02em; }
.bbai-stack { display: inline-flex; }
.bbai-stack .bbai-src-ico { box-shadow: 0 0 0 1.5px var(--bb-surface); border-radius: 50%; }
.bbai-stack .bbai-src-ico + .bbai-src-ico { margin-left: -4px; }
.bbai-acts { display: flex; align-items: center; gap: 2px; margin-top: 8px; }
.bbai-act { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--bb-r-control);
  color: var(--bb-ink-3); transition: background var(--bb-t-fast), color var(--bb-t-fast); }
.bbai-act:hover { background: var(--bb-hover); color: var(--bb-ink); }
.bbai-act svg { width: 15px; height: 15px; }
.bbai-srcbtn { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; padding: 2px 6px;
  border-radius: var(--bb-r-chip); font-size: 12px; font-weight: 500; color: var(--bb-ink-2); }
.bbai-srcbtn:hover { background: var(--bb-hover); }
.bbai-srcs { margin-top: 6px; padding: 4px; border-radius: var(--bb-r-card); background: var(--bb-inset);
  box-shadow: var(--bb-sh-hairline); display: flex; flex-direction: column; }
.bbai-srcs a { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: var(--bb-r-chip);
  font-size: 12px; color: var(--bb-ink-2); text-decoration: none; }
.bbai-srcs a:hover { background: var(--bb-hover); color: var(--bb-ink); }
.bbai-srcs a .n { margin-left: auto; font-size: 10.5px; color: var(--bb-ink-3); }
.bbai-fu { margin-top: 12px; }
.bbai-fu-h { font-size: 12px; font-weight: 600; color: var(--bb-ink-2); margin-bottom: 2px; }
.bbai-fu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 6px;
  border-radius: var(--bb-r-chip); font-size: 12.5px; color: var(--bb-ink-2); text-align: left; }
.bbai-fu button:hover { background: var(--bb-hover); color: var(--bb-ink); }
.bbai-fu button svg { width: 13px; height: 13px; color: var(--bb-ink-3); }
.bbai-stream .late { opacity: 0; transition: opacity .4s; }
.bbai-stream.is-done .late { opacity: 1; }

/* =========================== 04 · APROBACIÓN ============================== */
.bbai-ask { max-width: 380px; }
.bbai-ask-view { overflow: hidden; transition: height .32s var(--bb-ease-strong); }
.bbai-ask-track { transition: transform .32s var(--bb-ease-strong); }
.bbai-ask-q { padding: 14px 16px 12px; }
.bbai-ask-q h4 { margin: 0 28px 0 0; font-size: 14px; font-weight: 600; color: var(--bb-ink); }
.bbai-ask-opts { margin-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.bbai-opt { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px 6px 4px;
  border-radius: var(--bb-r-control); font-size: 13px; color: var(--bb-ink); text-align: left;
  transition: background var(--bb-t-fast); }
.bbai-opt:hover { background: var(--bb-hover); }
.bbai-opt .dot { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; flex: none;
  box-shadow: inset 0 0 0 1.5px var(--bb-line-strong); transition: background .2s, box-shadow .2s; }
.bbai-opt.multi .dot { border-radius: 5px; }
.bbai-opt .dot::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--bb-surface);
  transform: scale(0); transition: transform .2s var(--bb-ease-strong); }
.bbai-opt.multi .dot::after { width: 8px; height: 5px; border-radius: 0; background: none;
  border: solid #fff; border-width: 0 0 1.8px 1.8px; transform: rotate(-45deg) scale(0); margin-top: -2px; }
.bbai-opt.is-on .dot { background: var(--bb-accent); box-shadow: none; }
.bbai-opt.is-on .dot::after { transform: scale(1); }
.bbai-opt.multi.is-on .dot::after { transform: rotate(-45deg) scale(1); }
.bbai-opt .why { margin-left: auto; font-size: 11.5px; color: var(--bb-ink-3); }
.bbai-ask-step { display: inline-flex; align-items: center; gap: 4px; color: var(--bb-ink-3); font-size: 12px; }
.bbai-ask-step button { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; }
.bbai-ask-step button:hover:not(:disabled) { color: var(--bb-ink); }
.bbai-ask-step button:disabled { opacity: .3; cursor: default; }
.bbai-odo { display: inline-block; height: 16px; overflow: hidden; vertical-align: -3px; }
.bbai-odo span { display: block; transition: transform .3s var(--bb-ease-strong); }
.bbai-odo b { display: block; height: 16px; line-height: 16px; font-weight: 600; color: var(--bb-ink); }
.bbai-x { position: absolute; top: 10px; right: 10px; z-index: 2; display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: var(--bb-r-chip); color: var(--bb-ink-3); }
.bbai-x:hover { background: var(--bb-hover); color: var(--bb-ink); }
.bbai-ask-done { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 16px; }
.bbai-okpill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 999px;
  background: var(--bb-green-tint); color: var(--bb-green); font-size: 12.5px; font-weight: 600; }
.bbai-okpill i { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  background: var(--bb-green); color: #fff; font-style: normal; }

/* =========================== 05 · HERRAMIENTAS ============================ */
.bbai-run { max-width: 440px; }
.bbai-run-h { display: inline-flex; align-items: center; gap: 6px; margin: 0 -6px; padding: 4px 6px;
  border-radius: var(--bb-r-control); font-size: 12.5px; color: var(--bb-ink-2); }
.bbai-run-h:hover { background: var(--bb-hover-2); }
.bbai-tool { margin: 0 -3px; }
.bbai-tool-r { display: flex; align-items: center; gap: 8px; width: calc(100% + 6px); height: 28px; min-width: 0;
  padding: 0 3px; border-radius: var(--bb-r-control); text-align: left; font-size: 12.5px;
  transition: background var(--bb-t-fast); }
.bbai-tool-r:hover { background: var(--bb-hover-2); }
.bbai-tool-r .ico { position: relative; display: grid; place-items: center; width: 16px; height: 16px;
  color: var(--bb-ink-3); flex: none; }
.bbai-tool-r .ico svg { width: 14px; height: 14px; transition: opacity .15s; }
.bbai-tool-r .ico .bbai-caret { position: absolute; inset: 2px; opacity: 0; }
.bbai-tool-r:hover .ico svg:first-child { opacity: 0; }
.bbai-tool-r:hover .ico .bbai-caret { opacity: 1; }
.bbai-tool-r .v { flex: none; font-weight: 500; color: var(--bb-ink); }
.bbai-tool-r .a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--bb-ink-2); }
.bbai-tool-r .r { margin-left: auto; flex: none; font: 500 11.5px var(--bb-mono); color: var(--bb-ink-3); }
.bbai-tool-d { margin: 2px 0 4px 8px; padding: 2px 0 2px 14px; border-left: 1px solid var(--bb-line);
  font: 11px/1.8 var(--bb-code); color: var(--bb-ink-2); }
.bbai-tool-d .k { color: var(--bb-ink-3); }
.bbai-tool.is-open .ico svg:first-child { opacity: 0; }
.bbai-tool.is-open .ico .bbai-caret { opacity: 1; transform: rotate(90deg); }
.bbai-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--bb-line); }
.bbai-file { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: var(--bb-r-chip);
  background: var(--bb-inset); box-shadow: var(--bb-sh-hairline); font-size: 12px; color: var(--bb-ink); }
.bbai-file .add { color: var(--bb-green); font: 500 11px var(--bb-mono); }
.bbai-file .del { color: var(--bb-red); font: 500 11px var(--bb-mono); }

/* =========================== 06 · TAREAS ================================== */
.bbai-tasks { display: flex; flex-direction: column; gap: 6px; max-width: 460px; }
.bbai-task { background: var(--bb-surface); border-radius: var(--bb-r-card); box-shadow: var(--bb-sh-card);
  animation: bbai-up .36s var(--bb-ease-strong) calc(var(--i, 0) * 80ms) both; }
.bbai-task-r { display: flex; align-items: center; gap: 10px; width: 100%; height: 44px; padding: 0 10px; text-align: left; }
.bbai-task-r .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px; font-weight: 500; color: var(--bb-ink); }
.bbai-task-r .c { font: 500 11.5px var(--bb-mono); color: var(--bb-ink-3); }
.bbai-ring { position: relative; display: grid; place-items: center; width: 24px; height: 24px; flex: none; }
.bbai-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.bbai-ring .tr { stroke: var(--bb-line); }
.bbai-ring .fg { stroke: var(--bb-accent); transition: stroke-dashoffset .9s var(--bb-ease-strong); }
.bbai-ring b { position: relative; font: 600 8.5px var(--bb-mono); color: var(--bb-ink); }
.bbai-ring.done { background: var(--bb-green); border-radius: 50%; color: #fff; }
.bbai-ring.fail { background: var(--bb-red); border-radius: 50%; color: #fff; }
.bbai-ring.done svg, .bbai-ring.fail svg { position: static; transform: none; width: 12px; height: 12px; }
.bbai-task-sub { display: grid; grid-template-columns: 24px 1fr; gap: 10px; padding: 0 10px 10px; }
.bbai-task-sub .rail { width: 1px; margin: 0 auto; background: var(--bb-line); }
.bbai-task-sub ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bbai-task-sub li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--bb-ink-2); }
.bbai-task-sub li .n { margin-left: auto; font-size: 11.5px; color: var(--bb-ink-3); }
.bbai-retry { font-size: 11.5px; font-weight: 600; color: var(--bb-ink-2); padding: 2px 6px; border-radius: var(--bb-r-chip); }
.bbai-retry:hover { background: var(--bb-hover); color: var(--bb-ink); }

/* Variante cápsula: las mismas tareas como una fila de fichas. */
.bbai-caps { display: flex; flex-wrap: wrap; gap: 6px; }
.bbai-cap { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px 0 4px;
  border-radius: 999px; background: var(--bb-surface); box-shadow: var(--bb-sh-card); font-size: 12.5px; font-weight: 500; }
.bbai-cap .bbai-ring { width: 22px; height: 22px; }

/* =========================== 07 · CHAT ==================================== */
.bbai-chat { display: flex; flex-direction: column; max-width: 460px; height: 360px; }
.bbai-tabs { display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--bb-line); }
.bbai-tab { position: relative; padding: 6px 10px 8px; font-size: 12.5px; font-weight: 500; color: var(--bb-ink-3); }
.bbai-tab:hover { color: var(--bb-ink-2); }
.bbai-tab.is-on { color: var(--bb-ink); }
.bbai-tab.is-on::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px;
  border-radius: 2px; background: var(--bb-ink); }
.bbai-chat-log { flex: 1; overflow: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 10px; }
.bbai-me { align-self: flex-end; max-width: 78%; padding: 7px 12px; border-radius: 14px 14px 4px 14px;
  background: var(--bb-field); font-size: 13px; animation: bbai-up .3s var(--bb-ease-strong) both; }
.bbai-reply { display: flex; flex-direction: column; gap: 4px; animation: bbai-up .3s var(--bb-ease-strong) both; }
.bbai-reply-h { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--bb-ink-3); }
.bbai-reply-h b { font-weight: 600; color: var(--bb-ink-2); }
.bbai-reply p { margin: 0; font-size: 13px; color: var(--bb-ink); }
.bbai-chat-form { padding: 8px 10px 10px; }

/* =========================== 08 · BARRA DE PREGUNTA ======================= */
.bbai-pb { position: relative; max-width: 560px; }
.bbai-pb-box { background: var(--bb-surface); border-radius: 14px; box-shadow: var(--bb-sh-raised);
  padding: 10px 10px 8px 12px; transition: box-shadow var(--bb-t-base); }
.bbai-pb-box:focus-within { box-shadow: var(--bb-sh-raised), 0 0 0 3px color-mix(in srgb, var(--bb-accent) 14%, transparent); }
.bbai-pb.pill .bbai-pb-box { border-radius: 999px; display: flex; align-items: center; gap: 6px; padding: 5px 5px 5px 8px; }
.bbai-pb textarea { display: block; width: 100%; min-height: 22px; max-height: 120px; resize: none; border: 0; outline: 0;
  background: transparent; font: 400 13.5px/1.5 var(--bb-display); color: var(--bb-ink); padding: 2px 2px 8px; box-shadow: none; }
.bbai-pb.pill textarea { padding: 4px 2px; height: 24px; flex: 1; }
.bbai-pb textarea::placeholder { color: var(--bb-ink-3); }
.bbai-pb-row { display: flex; align-items: center; gap: 4px; }
.bbai-pb-row .sp { flex: 1; }
.bbai-ib { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 999px; color: var(--bb-ink-2);
  transition: background var(--bb-t-fast), color var(--bb-t-fast); }
.bbai-ib:hover { background: var(--bb-hover); color: var(--bb-ink); }
.bbai-ib svg { width: 16px; height: 16px; }
.bbai-send { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 999px;
  background: var(--bb-accent); color: #fff; transition: opacity .15s, transform .12s; }
.bbai-send:disabled { opacity: .3; cursor: default; }
.bbai-send:active:not(:disabled) { transform: scale(.94); }
.bbai-send svg { width: 15px; height: 15px; }
.bbai-model { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; color: var(--bb-ink-2); }
.bbai-model:hover { background: var(--bb-hover); color: var(--bb-ink); }
.bbai-model svg { width: 11px; height: 11px; }
.bbai-pchip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 6px 0 4px; margin: 0 4px 6px 0;
  border-radius: var(--bb-r-chip); background: var(--bb-accent-tint); color: var(--bb-accent-ink); font-size: 12px; font-weight: 600; }
.bbai-pchip button { display: grid; place-items: center; width: 14px; height: 14px; border-radius: 3px; opacity: .6; }
.bbai-pchip button:hover { opacity: 1; }
.bbai-menu { position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 20; width: 280px; max-height: 300px; overflow: auto;
  padding: 4px; border-radius: 12px; background: var(--bb-surface); box-shadow: var(--bb-sh-overlay);
  transform-origin: bottom left; animation: bbai-pop .18s var(--bb-ease-link) both; }
.bbai-menu.right { left: auto; right: 0; transform-origin: bottom right; width: 220px; }
.bbai-menu-g { padding: 6px 8px 3px; font-size: 11px; font-weight: 600; color: var(--bb-ink-3); }
.bbai-mi { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 8px; border-radius: var(--bb-r-control);
  text-align: left; font-size: 13px; color: var(--bb-ink); }
.bbai-mi.is-act, .bbai-mi:hover { background: var(--bb-hover); }
.bbai-mi .d { font-size: 11.5px; color: var(--bb-ink-3); }
.bbai-mi .tx { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.bbai-mi .k { margin-left: auto; font: 500 11px var(--bb-mono); color: var(--bb-ink-3); }
.bbai-mi .ok { margin-left: auto; width: 14px; height: 14px; color: var(--bb-accent); }
.bbai-mi-ico { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: var(--bb-inset); box-shadow: var(--bb-sh-hairline); color: var(--bb-ink-2); }
.bbai-mi-ico svg { width: 14px; height: 14px; }
.bbai-menu-foot { margin: 4px -4px -4px; padding: 7px 12px; border-top: 1px solid var(--bb-line);
  font-size: 11.5px; color: var(--bb-ink-3); }
.bbai-rec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bb-red); animation: bbai-breathe 1.2s ease-in-out infinite; }

/* =========================== 09 · RECOMENDACIÓN =========================== */
.bbai-rec { max-width: 380px; }
.bbai-rec p { margin: 6px 0 0; min-height: 44px; font-size: 13px; line-height: 1.6; color: var(--bb-ink-2); }
.bbai-rec p b { font-weight: 600; color: var(--bb-ink); }
.bbai-rec-ent { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--bb-ink); }
.bbai-conf { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; color: var(--bb-ink-2); }
.bbai-meter { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.bbai-meter i { width: 4px; border-radius: 2px; background: var(--bb-line-strong); transition: background .3s; }
.bbai-meter i:nth-child(1) { height: 5px; } .bbai-meter i:nth-child(2) { height: 8px; }
.bbai-meter i:nth-child(3) { height: 10px; } .bbai-meter i:nth-child(4) { height: 12px; }
.bbai-meter.hi i { background: var(--bb-green); }
.bbai-meter.mid i:nth-child(-n+3) { background: var(--bb-orange); }
.bbai-meter.lo i:nth-child(-n+1) { background: var(--bb-red); }
/* Counted levels, no colour judgement: how many of the four steps are MEASURED
   (the Report Card simulator's hard/strong/estimate/suggestion). Navy, because a
   less-certain recommendation is not a worse one — orange/red would say it was. */
.bbai-meter.n1 i:nth-child(-n+1), .bbai-meter.n2 i:nth-child(-n+2),
.bbai-meter.n3 i:nth-child(-n+3), .bbai-meter.n4 i { background: var(--bb-accent); }
.bbai-alts { border-top: 1px solid var(--bb-line); padding: 8px; background: var(--bb-surface); }
.bbai-alts-h { padding: 0 6px 4px; font-size: 11px; font-weight: 600; color: var(--bb-ink-3); }
.bbai-alt { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px; border-radius: var(--bb-r-control); text-align: left; }
.bbai-alt:hover { background: var(--bb-hover); }
.bbai-alt .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--bb-ink); }
.bbai-alt .s { flex: none; font-size: 11px; color: var(--bb-ink-3); }

/* =========================== 10 · CONTEXTO ================================ */
.bbai-ctx { display: flex; flex-direction: column; gap: 8px; max-width: 440px; }
.bbai-ctx-h { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--bb-ink-2); }
.bbai-ctx-h .n { font-size: 11.5px; color: var(--bb-ink-3); font-weight: 500; }
.bbai-chunk { padding: 12px 14px; background: var(--bb-surface); border-radius: var(--bb-r-card); box-shadow: var(--bb-sh-card);
  animation: bbai-up .36s var(--bb-ease-strong) calc(var(--i, 0) * 90ms) both; transition: box-shadow var(--bb-t-base); }
.bbai-chunk:hover { box-shadow: var(--bb-sh-raised); }
.bbai-chunk-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.bbai-chunk-h b { font-size: 13px; font-weight: 600; color: var(--bb-ink); }
.bbai-chunk-h .n { font-size: 11px; color: var(--bb-ink-3); }
.bbai-chunk p { margin: 4px 0 10px; font-size: 12.5px; line-height: 1.55; color: var(--bb-ink-2); }
.bbai-chunk-src { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--bb-ink-2); }
.bbai-ft { display: inline-grid; place-items: center; height: 16px; padding: 0 4px; border-radius: 4px;
  font: 700 8.5px var(--bb-mono); letter-spacing: .03em; color: #fff; background: var(--bb-red); }
.bbai-ft.xlsx { background: var(--bb-green); }
.bbai-ft.csv { background: var(--bb-cyan); }
.bbai-ft.api { background: var(--bb-accent); }

/* =========================== 11 · CAMBIOS PROPUESTOS ====================== */
.bbai-diff { max-width: 560px; }
.bbai-diff table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.bbai-diff th { padding: 7px 12px; text-align: left; font-size: 12px; font-weight: 500; color: var(--bb-ink-3);
  border-bottom: 1px solid var(--bb-line); background: none; text-transform: none; letter-spacing: 0; }
.bbai-diff td { padding: 7px 12px; font-size: 13px; color: var(--bb-ink); border-bottom: 1px solid var(--bb-line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background .2s, color .2s, opacity .2s; }
.bbai-diff td.n { font-size: 12.5px; text-align: right; }
.bbai-diff tr:last-child td { border-bottom: 0; }
.bbai-diff tr[data-chg] { cursor: pointer; }
.bbai-diff tr.del td { background: var(--bb-red-tint); color: var(--bb-red); text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--bb-red) 55%, transparent); }
.bbai-diff tr.add td { background: var(--bb-green-tint); color: var(--bb-green); }
.bbai-diff tr.del td:first-child { box-shadow: inset 2px 0 var(--bb-red); }
.bbai-diff tr.add td:first-child { box-shadow: inset 2px 0 var(--bb-green); }
.bbai-diff tr.is-skip td { background: none; color: var(--bb-ink-3); text-decoration: none; box-shadow: none; opacity: .55; }
.bbai-diff tr[data-chg]:hover td { filter: brightness(.98); }
.bbai-diff .chg { font-size: 12.5px; color: var(--bb-ink-2); }
.bbai-diff .chg b { font-weight: 600; }
.bbai-diff .chg .add { color: var(--bb-green); } .bbai-diff .chg .del { color: var(--bb-red); }
.bbai-tag { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: var(--bb-r-chip);
  background: var(--bb-inset); box-shadow: var(--bb-sh-hairline); font-size: 11.5px; font-weight: 500; color: inherit; }

/* =========================== 12 · FILTRO POR ESTADO ======================= */
.bbai-ft-chips { display: flex; gap: 4px; margin-bottom: 8px; overflow-x: auto; padding: 2px; }
.bbai-fchip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; color: var(--bb-ink-2); white-space: nowrap;
  transition: background var(--bb-t-base), color var(--bb-t-base), box-shadow var(--bb-t-base); }
.bbai-fchip:hover { background: var(--bb-hover); color: var(--bb-ink); }
.bbai-fchip.is-on { background: var(--bb-surface); color: var(--bb-ink); box-shadow: var(--bb-sh-btn); }
.bbai-fchip .dot { width: 6px; height: 6px; border-radius: 50%; }
.bbai-fchip .n { font-size: 11.5px; color: var(--bb-ink-3); }
.bbai-dot-ok { background: var(--bb-green); } .bbai-dot-bad { background: var(--bb-red); }
.bbai-dot-warn { background: var(--bb-orange); } .bbai-dot-mute { background: var(--bb-ink-3); }
.bbai-grid-t { overflow-x: auto; background: var(--bb-surface); border-radius: var(--bb-r-card); box-shadow: var(--bb-sh-card); }
.bbai-grid-t .row { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,.6fr) minmax(0,.8fr) minmax(0,.9fr);
  min-width: 440px; border-bottom: 1px solid var(--bb-line); font-size: 12.5px; }
.bbai-grid-t .row:last-child { border-bottom: 0; }
.bbai-grid-t .row > span { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 8px 12px;
  border-right: 1px solid var(--bb-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--bb-ink-2); }
.bbai-grid-t .row > span:last-child { border-right: 0; }
.bbai-grid-t .row > span:first-child { font-weight: 500; color: var(--bb-ink); }
.bbai-grid-t .hd > span { font-weight: 500; color: var(--bb-ink-3); }
.bbai-grid-t .row.in { animation: bbai-up .28s var(--bb-ease-strong) both; }

/* =========================== 13 · BÚSQUEDA ================================ */
.bbai-search { max-width: 340px; min-height: 250px; }
.bbai-search-in { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-bottom: 1px solid var(--bb-line); }
.bbai-search-in svg { width: 15px; height: 15px; color: var(--bb-ink-3); }
.bbai-search-in input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; box-shadow: none; padding: 0; height: auto;
  font: 400 13px var(--bb-display); color: var(--bb-ink); }
.bbai-search-in input::placeholder { color: var(--bb-ink-3); }
.bbai-search-in kbd { font: 500 10.5px var(--bb-mono); color: var(--bb-ink-3); padding: 1px 5px; border-radius: 4px; box-shadow: var(--bb-sh-hairline); }
.bbai-res { position: relative; padding: 4px; display: flex; flex-direction: column; gap: 1px; }
.bbai-res-hl { position: absolute; left: 4px; right: 4px; height: 32px; border-radius: 6px; background: var(--bb-hover);
  transition: transform .18s var(--bb-ease-strong), opacity .15s; pointer-events: none; }
.bbai-res-i { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px;
  border-radius: 6px; text-align: left; font-size: 13px; color: var(--bb-ink); }
.bbai-res-i mark { background: none; color: var(--bb-ink); font-weight: 600; }
.bbai-res-i .ty { margin-left: auto; font-size: 11px; color: var(--bb-ink-3); }
.bbai-res-i svg { width: 14px; height: 14px; color: var(--bb-ink-3); }
.bbai-empty { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 32px 16px; text-align: center; }
.bbai-empty .ic { display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 6px; border-radius: var(--bb-r-control);
  background: var(--bb-inset); box-shadow: var(--bb-sh-hairline); color: var(--bb-ink-3); }
.bbai-empty b { font-size: 13px; font-weight: 600; }
.bbai-empty span { font-size: 12px; color: var(--bb-ink-3); }

/* =========================== 14 · NAVEGACIÓN ============================== */
/* El resaltado VIAJA entre filas en vez de encenderse en cada una — un solo
   elemento que se traslada (transform), así que no hay repintado por fila. */
.bbai-nav { width: 232px; padding: 8px; background: var(--bb-canvas); border-radius: var(--bb-r-card); box-shadow: var(--bb-sh-hairline); }
.bbai-nav-ws { display: flex; align-items: center; gap: 8px; padding: 6px 8px 10px; }
.bbai-nav-ws img { width: 22px; height: 22px; border-radius: 6px; }
.bbai-nav-ws b { font-size: 13px; font-weight: 600; }
.bbai-nav-list { position: relative; display: flex; flex-direction: column; gap: 1px; }
.bbai-nav-hl { position: absolute; left: 0; right: 0; top: 0; height: 32px; border-radius: var(--bb-r-control);
  background: var(--bb-hover-2); opacity: 0; transition: transform .2s var(--bb-ease-strong), opacity .15s; pointer-events: none; }
.bbai-nav-list:hover .bbai-nav-hl { opacity: 1; }
.bbai-nav-i { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 8px;
  border-radius: var(--bb-r-control); font-size: 13px; font-weight: 500; color: var(--bb-ink-2); text-align: left; width: 100%; }
.bbai-nav-i svg { width: 16px; height: 16px; opacity: .8; }
.bbai-nav-i.is-on { background: var(--bb-surface); color: var(--bb-ink); box-shadow: var(--bb-sh-card); }
.bbai-nav-i .n { margin-left: auto; font-size: 11px; color: var(--bb-ink-3); }
.bbai-nav-sec { display: flex; align-items: center; gap: 6px; padding: 12px 8px 4px; font-size: 11.5px; font-weight: 600; color: var(--bb-ink-3); }

/* =========================== 15 · HALLAZGOS =============================== */
.bbai-ins { max-width: 360px; padding: 12px; background: var(--bb-surface); border-radius: var(--bb-r-card); box-shadow: var(--bb-sh-hairline); }
.bbai-ins-h { display: flex; align-items: center; justify-content: space-between; }
.bbai-ins-h b { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.bbai-ins-h b .c { display: grid; place-items: center; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--bb-orange); color: #fff; font: 700 9px var(--bb-mono); }
.bbai-ins-nav { display: flex; gap: 2px; }
.bbai-ins-nav button { display: grid; place-items: center; width: 24px; height: 24px; border-radius: var(--bb-r-chip); color: var(--bb-ink-3); }
.bbai-ins-nav button:hover { background: var(--bb-hover); color: var(--bb-ink); }
.bbai-ins-view { overflow: hidden; }
.bbai-ins-track { display: flex; transition: transform .42s var(--bb-ease-strong); }
.bbai-ins-p { flex: 0 0 100%; min-width: 0; padding-top: 6px; }
.bbai-ins-p > p { margin: 0 0 10px; font-size: 12.5px; line-height: 1.55; color: var(--bb-ink-2); }
.bbai-ins-p > p b { color: var(--bb-ink); font-weight: 600; }
.bbai-ins-kpis { display: flex; gap: 16px; }
.bbai-ins-kpis div { display: flex; flex-direction: column; }
.bbai-ins-kpis .l { font-size: 11.5px; color: var(--bb-ink-2); }
.bbai-ins-kpis .v { margin-top: 2px; font-size: 20px; font-weight: 600; letter-spacing: -.01em; color: var(--bb-ink); }
.bbai-ins-kpis .d { font-size: 11.5px; font-weight: 600; }
.bbai-ins-chart { position: relative; margin-top: 10px; border-radius: var(--bb-r-control); background: var(--bb-inset); box-shadow: var(--bb-sh-hairline); }
.bbai-ins-chart svg { display: block; width: 100%; height: 120px; }
.bbai-ins-chart .ln { fill: none; stroke: var(--bb-accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bbai-ins-chart .ar { fill: color-mix(in srgb, var(--bb-accent) 9%, transparent); stroke: none; }
.bbai-ins-chart .py { fill: none; stroke: var(--bb-ink-3); stroke-width: 1.2; stroke-dasharray: 3 3; }
.bbai-ins-chart .cur { stroke: var(--bb-ink-3); stroke-width: 1; opacity: 0; }
.bbai-ins-chart .dotp { fill: var(--bb-accent); stroke: var(--bb-surface); stroke-width: 2; opacity: 0; }
.bbai-ins-chart:hover .cur, .bbai-ins-chart:hover .dotp { opacity: 1; }
.bbai-ins-tip { position: absolute; top: 6px; padding: 3px 7px; border-radius: 6px; background: var(--bb-tip-bg); color: var(--bb-tip-fg);
  font: 500 11px var(--bb-mono); pointer-events: none; opacity: 0; transform: translateX(-50%); white-space: nowrap; }
.bbai-ins-chart:hover .bbai-ins-tip { opacity: 1; }
.bbai-ins-ask { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12.5px; font-weight: 500; color: var(--bb-ink-2); }
.bbai-ins-ask:hover { color: var(--bb-ink); }
.bbai-ins-dots { display: flex; justify-content: center; gap: 4px; margin-top: 10px; }
.bbai-ins-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--bb-line-strong); transition: width .3s var(--bb-ease-strong), background .3s; }
.bbai-ins-dots i.is-on { width: 14px; border-radius: 3px; background: var(--bb-ink-2); }

/* =========================== 16 · CÓDIGO ================================== */
.bbai-code { max-width: 560px; }
.bbai-code-bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--bb-line); }
.bbai-code-bar .f { font: 500 12px var(--bb-code); color: var(--bb-ink-2); }
.bbai-code-bar .sp { flex: 1; }
.bbai-seg { display: inline-flex; padding: 2px; border-radius: 7px; background: var(--bb-field); }
.bbai-seg button { height: 22px; padding: 0 8px; border-radius: 5px; font-size: 11.5px; font-weight: 500; color: var(--bb-ink-3); }
.bbai-seg button.is-on { background: var(--bb-surface); color: var(--bb-ink); box-shadow: var(--bb-sh-btn); }
.bbai-pre { margin: 0; padding: 8px 0; overflow-x: auto; font: 12px/1.7 var(--bb-code); color: var(--bb-ink); background: var(--bb-surface); }
.bbai-ln { display: grid; grid-template-columns: 38px 1fr; }
.bbai-ln.dual { grid-template-columns: 30px 30px 14px 1fr; }
.bbai-ln .g { padding-right: 10px; text-align: right; color: var(--bb-ink-3); user-select: none; font-variant-numeric: tabular-nums; }
.bbai-ln .s { user-select: none; color: var(--bb-ink-3); }
.bbai-ln code { white-space: pre; padding-right: 14px; font: inherit; background: none; }
.bbai-ln.add { background: var(--bb-green-tint); box-shadow: inset 2px 0 var(--bb-green); }
.bbai-ln.del { background: var(--bb-red-tint); box-shadow: inset 2px 0 var(--bb-red); }
.bbai-ln.add .s { color: var(--bb-green); } .bbai-ln.del .s { color: var(--bb-red); }
.bbai-ln ins { text-decoration: none; background: color-mix(in srgb, var(--bb-green) 22%, transparent); border-radius: 2px; }
.bbai-ln del { text-decoration: none; background: color-mix(in srgb, var(--bb-red) 20%, transparent); border-radius: 2px; }
.bbai-code .kw { color: var(--bb-violet); } .bbai-code .st { color: var(--bb-green); }
.bbai-code .nu { color: var(--bb-orange); } .bbai-code .cm { color: var(--bb-ink-3); font-style: italic; }
.bbai-code .fn { color: var(--bb-accent); }

/* =========================== 17 · SELECCIÓN =============================== */
.bbai-sel { position: relative; max-width: 460px; padding-bottom: 52px; user-select: text; }
.bbai-sel p { margin: 0; font-size: 13px; line-height: 1.7; color: var(--bb-ink); }
.bbai-sel mark { background: color-mix(in srgb, var(--bb-accent) 14%, var(--bb-surface)); color: var(--bb-ink);
  border-radius: 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.bbai-selbar { position: absolute; left: 0; top: 0; z-index: 5; display: flex; align-items: center; gap: 2px; height: 36px; padding: 4px;
  border-radius: 999px; background: var(--bb-surface); box-shadow: var(--bb-sh-overlay); animation: bbai-pop .2s var(--bb-ease-link) both; }
.bbai-selbar[hidden] { display: none; }
.bbai-selbar .sp { width: 1px; height: 16px; margin: 0 2px; background: var(--bb-line-strong); }
.bbai-selbar button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; color: var(--bb-ink-2); white-space: nowrap; transition: background var(--bb-t-fast); }
.bbai-selbar button:hover { background: var(--bb-hover); color: var(--bb-ink); }
.bbai-selbar button.ai { width: 28px; padding: 0; justify-content: center; background: var(--bb-accent); color: #fff; }
.bbai-selbar button svg { width: 14px; height: 14px; }

/* ============================ keyframes =================================== */
@keyframes bbai-spin { to { transform: rotate(360deg); } }
@keyframes bbai-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes bbai-pixel { 0%, 100% { opacity: .15; } 35% { opacity: 1; } }
@keyframes bbai-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes bbai-unblur { from { opacity: 0; filter: blur(6px); } to { opacity: 1; filter: blur(0); } }
@keyframes bbai-blink { to { visibility: hidden; } }
@keyframes bbai-pop { from { opacity: 0; transform: scale(.96) translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes bbai-breathe { 50% { opacity: .35; } }

@media (prefers-reduced-motion: reduce) {
  .bbai-grid i { animation: none; }
  .bbai-shimmer { animation: none; color: var(--bb-ink-2); background: none; }
  .bbai-spin, .bbai-rec-dot, .bbai-stream .caret { animation: none; }
  .bbai-stream .w, .bbai-trace-r, .bbai-task, .bbai-chunk, .bbai-me, .bbai-reply, .bbai-grid-t .row.in { animation: none; }
}
