/* Whiteblock Assistant — modal full-screen estilo claude.ai/chatgpt.
   v2: multi-conversación, sidebar, copy/regenerate por mensaje,
   markdown completo, auto-scroll inteligente, atajos de teclado. */

/* ── Botón flotante en chrome ───────────────────────────────────── */
.wb-ai-btn{ position:relative; }
.wb-ai-btn::after{
  content:''; position:absolute; top:6px; right:6px; width:6px; height:6px;
  border-radius:50%; background:var(--accent); opacity:0; transition:opacity .15s;
}
.wb-ai-btn.has-activity::after{ opacity:1; }

/* ── Modal container ────────────────────────────────────────────── */
#wb-ai-panel {
  position: fixed; inset: 0;
  z-index: 2147483200;
  display: none;
  align-items: center; justify-content: center;
}
#wb-ai-panel.open { display: flex; animation: wb-ai-fade-in .18s ease-out; }

.wb-ai-backdrop {
  position: absolute; inset: 0;
  background: var(--modal-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.wb-ai-card {
  position: relative;
  width: 96vw;
  height: 95vh;
  max-width: 1600px;
  max-height: 1200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--wb-radius-2xl);
  box-shadow: 0 40px 80px rgba(0, 0, 0, .55);
  display: flex;
  overflow: hidden;
  animation: wb-ai-scale-in .22s cubic-bezier(.2, .9, .3, 1);
}

@keyframes wb-ai-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes wb-ai-scale-in {
  from { opacity: 0; transform: translateY(8px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* Mobile: ocupa todo */
@media (max-width: 760px) {
  .wb-ai-card { width: 100vw; height: 100vh; max-height: none; border-radius: 0; border: none; }
}

/* ── Sidebar (lista de conversaciones) ─────────────────────────── */
.wb-ai-side {
  width: 268px; flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, .015);
  display: flex; flex-direction: column;
  transition: width .22s cubic-bezier(.2, .9, .3, 1), opacity .18s;
}
.wb-ai-card.side-collapsed .wb-ai-side {
  width: 0; opacity: 0; pointer-events: none; border-right: none;
}

/* Scrim para drawer mobile — click cierra el lateral.
   La clase `.side-open` sólo se añade en viewports ≤760px (vía JS),
   así que tener la regla fuera del @media es seguro y más robusto contra
   caches de CSS antiguos. Sin backdrop-filter (evita freeze de Chrome
   al seleccionar texto sobre elementos con blur). */
.wb-ai-side-scrim {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.5);
  opacity: 0;
  pointer-events: none;
  z-index: 3;
  transition: opacity .22s;
}
.wb-ai-card.side-open .wb-ai-side-scrim { opacity: 1; pointer-events: auto; }

@media (max-width: 760px) {
  .wb-ai-side {
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 86%; max-width: 320px;
    z-index: 4;
    background: var(--surface);
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.2, .9, .3, 1);
    box-shadow: 4px 0 30px rgba(0,0,0,.4);
  }
  .wb-ai-card.side-open .wb-ai-side { transform: translateX(0); }
}

.wb-ai-side-head {
  display: flex; gap: 6px; padding: 12px 12px 8px;
}
.wb-ai-side-head .wb-ai-new {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 12px;
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--wb-radius-lg);
  font-size: var(--wb-text-sm); font-weight: 600; cursor: pointer;
  font-family: inherit;
  transition: opacity .12s, transform .12s;
}
.wb-ai-side-head .wb-ai-new:hover { opacity: .92; }
.wb-ai-side-head .wb-ai-new:active { transform: scale(.97); }
.wb-ai-side-head .wb-ai-side-collapse {
  width: 36px; height: 36px;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--wb-radius-lg);
  color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color .12s, border-color .12s;
}
.wb-ai-side-head .wb-ai-side-collapse:hover { color: var(--text); border-color: var(--accent); }

.wb-ai-search {
  padding: 4px 12px 8px;
}
.wb-ai-search input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--wb-radius-lg);
  padding: 7px 10px;
  font-family: inherit; font-size: var(--wb-text-sm);
  color: var(--text);
  outline: none;
  transition: border-color .12s;
}
.wb-ai-search input:focus { border-color: var(--accent); }
.wb-ai-search input::placeholder { color: var(--muted); }

.wb-ai-conv-list {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 4px 8px 8px;
}
.wb-ai-conv-list::-webkit-scrollbar { width: 6px; }
.wb-ai-conv-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.06); border-radius: var(--wb-radius-sm); }

.wb-ai-conv-group-label {
  font-size: var(--wb-text-xs); text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); font-weight: 700;
  padding: 10px 8px 4px;
}
.wb-ai-conv-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: var(--wb-radius-lg);
  cursor: pointer;
  margin-bottom: 2px;
  transition: background .12s;
  position: relative;
}
.wb-ai-conv-item:hover { background: var(--surface2); }
.wb-ai-conv-item.active { background: rgba(23, 0, 255, .14); }
.wb-ai-conv-item.active .wb-ai-conv-title { color: var(--text); }
.wb-ai-conv-title {
  flex: 1; min-width: 0;
  font-size: var(--wb-text-base); line-height: 1.3;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wb-ai-conv-actions {
  display: none;
  gap: 2px;
}
.wb-ai-conv-item:hover .wb-ai-conv-actions { display: inline-flex; }
.wb-ai-conv-actions button {
  width: 22px; height: 22px;
  background: transparent; border: none; border-radius: var(--wb-radius-sm);
  color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--wb-text-xs);
  transition: background .12s, color .12s;
}
.wb-ai-conv-actions button:hover { background: rgba(255,255,255,.08); color: var(--text); }
.wb-ai-conv-empty {
  text-align: center; padding: 30px 16px;
  color: var(--muted); font-size: var(--wb-text-sm); line-height: 1.5;
}

.wb-ai-side-foot {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  font-size: var(--wb-text-xs); color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.wb-ai-side-foot .wb-ai-conn-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.wb-ai-side-foot.connected .wb-ai-conn-dot { background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,.6); }

/* ── Main pane ─────────────────────────────────────────────────── */
.wb-ai-main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  position: relative;
}

/* Header */
.wb-ai-head {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.025), transparent);
  flex-shrink: 0;
}
.wb-ai-head-side-toggle {
  width: 36px; height: 36px;
  background: transparent; border: none; border-radius: var(--wb-radius-lg);
  color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
.wb-ai-head-side-toggle:hover { background: var(--surface2); color: var(--text); }
.wb-ai-head-title {
  flex: 1; min-width: 0;
  font-size: var(--wb-text-md); font-weight: 600;
  color: var(--text);
  display: inline-flex; align-items: center; gap: 8px;
  cursor: text;
  padding: 4px 8px;
  border-radius: var(--wb-radius-md);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .12s;
}
.wb-ai-head-title:hover { background: var(--surface2); }
.wb-ai-head-title i { color: var(--accent); flex-shrink: 0; }
.wb-ai-head-title-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.wb-ai-head-title input {
  flex: 1;
  background: transparent; border: 1px solid var(--accent);
  border-radius: var(--wb-radius-md); padding: 4px 8px;
  font-family: inherit; font-size: var(--wb-text-md); font-weight: 600;
  color: var(--text); outline: none;
}

.wb-ai-head-actions { display: flex; gap: 2px; }
.wb-ai-head-actions button {
  width: 34px; height: 34px;
  background: transparent; border: none;
  border-radius: var(--wb-radius-lg);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
.wb-ai-head-actions button:hover {
  background: var(--surface2);
  color: var(--text);
}

/* ── Body (mensajes) ────────────────────────────────────────────── */
.wb-ai-body {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  scroll-behavior: smooth;
  padding: 28px 0 24px;
  position: relative;
}
.wb-ai-body::-webkit-scrollbar { width: 10px; }
.wb-ai-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.06); border-radius: var(--wb-radius-sm); border: 2px solid transparent; background-clip: padding-box; }
.wb-ai-body::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.14); border: 2px solid transparent; background-clip: padding-box; }

.wb-ai-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 32px);
}

/* Botón flotante "ir al fondo" cuando el user scrolleó arriba */
.wb-ai-jump {
  position: absolute;
  bottom: 12px; left: 50%; transform: translateX(-50%) translateY(8px);
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 3;
  font-size: var(--wb-text-base);
  backdrop-filter: blur(8px);
}
.wb-ai-jump.visible {
  opacity: 1; pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* Empty state */
.wb-ai-empty {
  text-align: center;
  color: var(--muted);
  padding: 30px 12px;
}
.wb-ai-empty-icon {
  width: 78px; height: 78px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #6a4bff 50%, #b18bff 100%);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
  box-shadow:
    0 8px 30px rgba(23, 0, 255, .35),
    inset 0 1px 0 rgba(255,255,255,.25);
}
.wb-ai-empty-icon i { font-size: var(--wb-text-3xl); color: #fff; }
.wb-ai-empty-title {
  font-size: 26px; font-weight: 400; color: var(--text);
  margin-bottom: 6px;
  font-family: 'Cossette Titre', system-ui, sans-serif;
  letter-spacing: -.5px;
}
.wb-ai-empty-sub {
  font-size: var(--wb-text-md); line-height: 1.55;
  color: var(--muted);
  margin: 0 auto 28px;
  max-width: 460px;
}

.wb-ai-ex {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  max-width: 720px;
  margin: 0 auto;
}
.wb-ai-ex button {
  padding: 14px 14px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--wb-radius-xl);
  color: var(--text);
  font-family: inherit;
  font-size: var(--wb-text-sm); text-align: left;
  cursor: pointer;
  line-height: 1.4;
  display: flex; flex-direction: column; gap: 6px;
  transition: background .14s, border-color .14s, transform .14s;
}
.wb-ai-ex button:hover {
  background: var(--surface2);
  border-color: rgba(23, 0, 255, .5);
  transform: translateY(-1px);
}
.wb-ai-ex-ico {
  width: 30px; height: 30px; border-radius: var(--wb-radius-lg);
  background: rgba(23, 0, 255, .12);
  color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--wb-text-base);
}
.wb-ai-ex-title { font-weight: 600; font-size: var(--wb-text-base); color: var(--text); }
.wb-ai-ex-desc { font-size: var(--wb-text-xs); color: var(--muted); }

/* Color por categoría para los iconos de las example cards */
.wb-ai-ex-card.tone-leads    .wb-ai-ex-ico { background: rgba(34, 197, 94, .15);  color: var(--green); }
.wb-ai-ex-card.tone-today    .wb-ai-ex-ico { background: rgba(245, 158, 11, .15); color: var(--orange); }
.wb-ai-ex-card.tone-money    .wb-ai-ex-ico { background: rgba(234, 179, 8, .15);  color: var(--yellow); }
.wb-ai-ex-card.tone-invoices .wb-ai-ex-ico { background: rgba(14, 165, 233, .15); color: #0ea5e9; }
.wb-ai-ex-card.tone-team     .wb-ai-ex-ico { background: rgba(168, 85, 247, .15); color: var(--purple); }
.wb-ai-ex-card.tone-action   .wb-ai-ex-ico { background: rgba(23, 0, 255, .15);   color: var(--accent); }

/* ── Mensajes ───────────────────────────────────────────────────── */
.wb-ai-msg {
  display: flex; gap: 12px;
  margin-bottom: 22px;
  align-items: flex-start;
}
.wb-ai-msg.user { flex-direction: row-reverse; }

.wb-ai-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--wb-text-sm); font-weight: 700;
  color: #fff;
  letter-spacing: .3px;
}
.wb-ai-msg.assistant .wb-ai-avatar {
  background: linear-gradient(135deg, var(--accent), #4a2dff);
}
.wb-ai-msg.user .wb-ai-avatar {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.wb-ai-msg-content {
  flex: 1; min-width: 0;
  max-width: calc(100% - 42px);
}
.wb-ai-msg.user .wb-ai-msg-content { display: flex; flex-direction: column; align-items: flex-end; }

.wb-ai-bubble {
  padding: 11px 16px;
  border-radius: var(--wb-radius-xl);
  font-size: var(--wb-text-md); line-height: 1.6;
  color: var(--text);
  word-wrap: break-word;
  white-space: normal;
}
.wb-ai-msg.user .wb-ai-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: var(--wb-radius-sm);
  max-width: 90%;
}
.wb-ai-msg.assistant .wb-ai-bubble {
  background: transparent;
  border: none;
  padding: 4px 0;
}

/* Markdown */
.wb-ai-bubble > *:first-child { margin-top: 0; }
.wb-ai-bubble > *:last-child  { margin-bottom: 0; }
.wb-ai-bubble p { margin: 0 0 10px; }
.wb-ai-bubble h1, .wb-ai-bubble h2, .wb-ai-bubble h3 {
  font-family: inherit;
  font-weight: 700;
  margin: 18px 0 8px;
  line-height: 1.3;
}
.wb-ai-bubble h1 { font-size: var(--wb-text-xl); }
.wb-ai-bubble h2 { font-size: var(--wb-text-lg); }
.wb-ai-bubble h3 { font-size: var(--wb-text-md); }
.wb-ai-bubble strong { font-weight: 700; }
.wb-ai-bubble em { font-style: italic; }
.wb-ai-bubble a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.wb-ai-bubble a:hover { opacity: .85; }
.wb-ai-bubble ul, .wb-ai-bubble ol {
  margin: 6px 0 12px;
  padding-left: 22px;
}
.wb-ai-bubble li { margin: 3px 0; }
.wb-ai-bubble blockquote {
  margin: 8px 0;
  padding: 6px 14px;
  border-left: 3px solid var(--accent);
  background: rgba(23, 0, 255, .06);
  border-radius: 0 var(--wb-radius-md) var(--wb-radius-md) 0;
  color: var(--text);
  font-style: italic;
}
.wb-ai-bubble code {
  background: rgba(255,255,255,.08);
  padding: 2px 6px; border-radius: var(--wb-radius-sm);
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: var(--wb-text-sm);
}
.wb-ai-msg.user .wb-ai-bubble code { background: rgba(255,255,255,.15); }
.wb-ai-bubble pre {
  background: rgba(0,0,0,.32);
  padding: 12px 14px;
  border-radius: var(--wb-radius-lg);
  overflow-x: auto;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: var(--wb-text-sm);
  line-height: 1.55;
  margin: 10px 0;
  border: 1px solid var(--border);
}
.wb-ai-bubble pre code { background: transparent; padding: 0; font-size: inherit; }
.wb-ai-bubble table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--wb-text-sm);
  margin: 10px 0;
}
.wb-ai-bubble th, .wb-ai-bubble td {
  padding: 7px 10px;
  border: 1px solid var(--border);
  text-align: left;
}
.wb-ai-bubble th {
  background: rgba(255,255,255,.04);
  font-weight: 700;
  font-size: var(--wb-text-xs);
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--muted);
}

.wb-ai-err {
  color: #fca5a5;
  background: var(--red-bg);
  border: 1px solid rgba(239, 68, 68, .3);
  padding: 8px 12px; border-radius: var(--wb-radius-lg);
  font-size: var(--wb-text-base);
}

/* Acciones por mensaje (asistente): copy, regenerate */
.wb-ai-msg-actions {
  display: flex; gap: 3px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity .15s;
}
.wb-ai-msg:hover .wb-ai-msg-actions,
.wb-ai-msg.assistant.last .wb-ai-msg-actions { opacity: 1; }
.wb-ai-msg-actions button {
  width: 26px; height: 26px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--wb-radius-md);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--wb-text-xs);
  transition: background .12s, color .12s, border-color .12s;
}
.wb-ai-msg-actions button:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border);
}
.wb-ai-msg-actions button.copied { color: var(--green); }

/* Thinking dots */
.wb-ai-thinking {
  display: inline-flex; gap: 4px; padding: 8px 0;
}
.wb-ai-thinking .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted);
  animation: wb-ai-thinking-pulse 1.2s ease-in-out infinite;
}
.wb-ai-thinking .dot:nth-child(2) { animation-delay: .2s; }
.wb-ai-thinking .dot:nth-child(3) { animation-delay: .4s; }
@keyframes wb-ai-thinking-pulse {
  0%, 80%, 100% { opacity: .3; transform: scale(.85); }
  40% { opacity: 1; transform: scale(1); }
}

/* Traces (tool calls) */
.wb-ai-traces {
  margin-top: 8px;
  display: flex; flex-wrap: wrap; gap: 5px;
}
.wb-ai-trace {
  font-size: var(--wb-text-xs);
  padding: 4px 9px;
  border-radius: var(--wb-radius-pill);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  display: inline-flex; align-items: center; gap: 5px;
  font-family: 'SF Mono', Menlo, monospace;
}
.wb-ai-trace.running {
  color: #b1a5ff;
  border-color: rgba(23, 0, 255, .55);
  background: rgba(23, 0, 255, .14);
}
.wb-ai-trace.done {
  color: #86efac;
  border-color: rgba(34, 197, 94, .45);
  background: rgba(34, 197, 94, .08);
}
.wb-ai-trace i { font-size: 9px; }

/* ── Footer (input) ─────────────────────────────────────────────── */
.wb-ai-foot {
  padding: 12px clamp(16px, 4vw, 32px) 16px;
  border-top: 1px solid var(--border);
  background: linear-gradient(0deg, rgba(255,255,255,.025), transparent);
  flex-shrink: 0;
}
.wb-ai-foot-inner {
  max-width: 820px;
  margin: 0 auto;
}
.wb-ai-input-wrap {
  display: flex; gap: 8px; align-items: flex-end;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--wb-radius-xl);
  padding: 8px 8px 8px 14px;
  transition: border-color .15s, box-shadow .15s;
}
.wb-ai-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 0, 255, .12);
}
.wb-ai-input-wrap textarea {
  flex: 1; min-height: 26px; max-height: 220px;
  background: transparent;
  border: none; outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: var(--wb-text-md); line-height: 1.55;
  resize: none;
  padding: 5px 0;
}
.wb-ai-input-wrap textarea::placeholder { color: var(--muted); }
.wb-ai-send-stop {
  width: 36px; height: 36px;
  background: var(--accent);
  color: #fff; border: none;
  border-radius: var(--wb-radius-lg);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--wb-text-base);
  flex-shrink: 0;
  transition: opacity .12s, transform .12s, background .12s;
}
.wb-ai-send-stop:hover:not(:disabled) { transform: scale(1.06); }
.wb-ai-send-stop:disabled { opacity: .4; cursor: not-allowed; }
.wb-ai-send-stop.stop {
  background: var(--red);
}

.wb-ai-foot-meta {
  display: flex; align-items: center; gap: 12px;
  margin-top: 10px;
  font-size: var(--wb-text-xs);
  color: var(--muted);
  min-height: 24px;
}
.wb-ai-engine {
  display: inline-flex; align-items: center; gap: 5px;
  flex-shrink: 0;
}
.wb-ai-engine i { font-size: var(--wb-text-xs); }
.wb-ai-hint {
  flex: 1; min-width: 0;
  text-align: center;
  color: var(--muted);
  font-size: var(--wb-text-xs);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wb-ai-hint kbd {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--wb-radius-sm);
  padding: 1px 5px;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: var(--wb-text-xs);
}
/* En pantallas medianas/pequeñas, ocultamos el hint para no apretar el chip */
@media (max-width: 980px) {
  .wb-ai-hint { display: none; }
}
.wb-ai-foot-meta > .wb-ai-claude-chip { margin-left: auto; }

/* Chip "Continuar en Claude" — solo si hay OAuth activo */
.wb-ai-claude-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(23, 0, 255, .12);
  border: 1px solid rgba(23, 0, 255, .35);
  color: var(--accent);
  font-size: var(--wb-text-xs); font-weight: 600;
  padding: 5px 12px; border-radius: var(--wb-radius-pill);
  cursor: pointer;
  font-family: inherit;
  transition: background .12s, border-color .12s;
}
.wb-ai-claude-chip:hover {
  background: rgba(23, 0, 255, .2);
  border-color: var(--accent);
}
.wb-ai-claude-chip[hidden] { display: none !important; }

/* ── Banda CTA "Conectar Claude vía MCP" ───────────────────────── */
.wb-ai-mcp-cta {
  margin-top: 10px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: rgba(23, 0, 255, .07);
  border: 1px solid rgba(23, 0, 255, .25);
  border-radius: var(--wb-radius-xl);
  padding: 9px 12px;
  font-size: var(--wb-text-sm);
  color: var(--text);
}
.wb-ai-mcp-cta[hidden] { display: none !important; }
.wb-ai-mcp-cta .wb-ai-mcp-ico {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(23, 0, 255, .18);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
.wb-ai-mcp-cta .wb-ai-mcp-text {
  flex: 1; min-width: 200px;
  line-height: 1.4;
}
.wb-ai-mcp-cta .wb-ai-mcp-text strong { font-weight: 700; }
.wb-ai-mcp-cta .wb-ai-mcp-url {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: var(--wb-text-xs);
  background: rgba(0,0,0,.25);
  padding: 3px 8px; border-radius: var(--wb-radius-md);
  user-select: all;
  border: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}
.wb-ai-mcp-cta .wb-ai-mcp-actions { display: inline-flex; gap: 6px; flex-shrink: 0; }
.wb-ai-mcp-cta button {
  font-size: var(--wb-text-xs); font-weight: 600;
  padding: 5px 10px; border-radius: var(--wb-radius-lg);
  cursor: pointer; font-family: inherit;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  display: inline-flex; align-items: center; gap: 5px;
  transition: background .12s, border-color .12s;
}
.wb-ai-mcp-cta button:hover { background: var(--surface2); border-color: var(--accent); }
.wb-ai-mcp-cta button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.wb-ai-mcp-cta button.primary:hover { opacity: .92; }

/* Panel inline con instrucciones MCP */
.wb-ai-mcp-help {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 22px clamp(20px, 4vw, 56px);
  max-height: 78%; overflow-y: auto;
  transform: translateY(100%);
  transition: transform .25s cubic-bezier(.2, .9, .3, 1);
  z-index: 5;
  box-shadow: 0 -20px 40px rgba(0,0,0,.5);
}
.wb-ai-mcp-help.open { transform: translateY(0); }
.wb-ai-mcp-help-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.wb-ai-mcp-help-head h3 {
  margin: 0; font-size: var(--wb-text-lg); font-weight: 400;
  display: inline-flex; align-items: center; gap: 8px;
  font-family: 'Cossette Titre', system-ui, sans-serif;
}
.wb-ai-mcp-help-head h3 i { color: var(--accent); }
.wb-ai-mcp-help-close {
  width: 32px; height: 32px;
  background: transparent; border: none; border-radius: var(--wb-radius-lg);
  color: var(--muted); cursor: pointer;
}
.wb-ai-mcp-help-close:hover { background: var(--surface2); color: var(--text); }
.wb-ai-mcp-help p { font-size: var(--wb-text-base); line-height: 1.5; color: var(--text); margin: 0 0 12px; }
.wb-ai-mcp-help h4 { margin: 14px 0 6px; font-size: var(--wb-text-sm); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.wb-ai-mcp-help ol { font-size: var(--wb-text-base); line-height: 1.6; padding-left: 18px; margin: 0 0 12px; color: var(--text); }
.wb-ai-mcp-help code { font-family: 'SF Mono', Menlo, monospace; font-size: var(--wb-text-xs); background: rgba(255,255,255,.08); padding: 2px 6px; border-radius: var(--wb-radius-sm); }
.wb-ai-mcp-help .wb-ai-mcp-url-block {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--wb-radius-lg);
  padding: 10px 12px;
  margin: 6px 0 14px;
  display: flex; align-items: center; gap: 10px;
}
.wb-ai-mcp-help .wb-ai-mcp-url-block code {
  flex: 1; background: transparent; padding: 0;
  font-size: var(--wb-text-sm); color: var(--text);
  word-break: break-all; user-select: all;
}
.wb-ai-mcp-help-note {
  background: rgba(23, 0, 255, .08);
  border-left: 3px solid var(--accent);
  padding: 10px 12px; border-radius: var(--wb-radius-md);
  font-size: var(--wb-text-sm); line-height: 1.5;
  margin-top: 14px;
}

/* ── Light theme overrides ──────────────────────────────────────── */
[data-theme="light"] .wb-ai-card { background: var(--surface); }
[data-theme="light"] .wb-ai-side { background: #fafafa; }
[data-theme="light"] .wb-ai-bubble code { background: rgba(0,0,0,.06); }
[data-theme="light"] .wb-ai-bubble pre { background: #f6f6f6; border-color: #e5e5e5; }
[data-theme="light"] .wb-ai-msg.user .wb-ai-bubble code { background: rgba(255,255,255,.25); }
[data-theme="light"] .wb-ai-msg.assistant .wb-ai-avatar { box-shadow: 0 4px 14px rgba(23,0,255,.25); }
[data-theme="light"] .wb-ai-input-wrap { background: #f6f6f6; }
[data-theme="light"] .wb-ai-input-wrap textarea { color: #111; }
[data-theme="light"] .wb-ai-empty-title { color: #111; }
[data-theme="light"] .wb-ai-ex button { color: #111; background: #f6f6f6; border-color: #e5e5e5; }
[data-theme="light"] .wb-ai-conv-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,.1); }
[data-theme="light"] .wb-ai-search input { color: #111; background: #f6f6f6; border-color: #e5e5e5; }
[data-theme="light"] .wb-ai-jump { background: #fff; color: #111; border-color: #e5e5e5; }
[data-theme="light"] .wb-ai-bubble blockquote { background: rgba(23,0,255,.05); }
[data-theme="light"] .wb-ai-bubble th { background: #f6f6f6; color: #555; }

/* Body lock cuando el modal está abierto */
body.wb-ai-open { overflow: hidden; }
