/* Chat de Bruce — formato conversación (estilo ChatGPT/Claude) con el diseño de Aurovan:
   crema + verde, Bruce grande al centro y modo voz. Carga DESPUÉS de bruce.css y lo reemplaza. */
.bruce-widget { --bc-cream: #eeeee5; --bc-paper: #fbfbf6; --bc-ink: #253c31; --bc-green: #264b39; --bc-mint: #27694d; --bc-dim: #5b6d61; --bc-line: #2a493122; }
.bruce-widget .bruce-panel {
  width: 480px; height: min(720px, calc(100dvh - 118px)); max-height: none; bottom: 78px; right: 0;
  display: flex; flex-direction: column; overflow: hidden; border-radius: 24px;
  background: var(--bc-cream); color: var(--bc-ink); border: 1px solid #ffffff70;
  box-shadow: 0 30px 80px #0006, 0 0 0 1px #00000010; backdrop-filter: none;
  animation: bruce-pop .32s cubic-bezier(.16, 1, .3, 1);
}
.bruce-widget .bruce-panel:before { display: none; }
.bruce-widget .bruce-panel[hidden] { display: none; }
@keyframes bruce-pop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }

/* Encabezado */
.bruce-top { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px 20px; flex: none; }
.bruce-av { width: 30px; height: 30px; border-radius: 50%; background: #f9f9f3; box-shadow: inset 0 0 0 1px #2a493122; display: grid; place-items: center; flex: none; }
.bruce-av > img { width: 86%; height: auto; display: block; }
.bruce-top > .bruce-av { position: relative; width: 38px; height: 38px; overflow: hidden; }
.bruce-top strong { font-weight: 500; font-size: 15px; color: var(--bc-ink); }
.bruce-status { font: 500 9px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .14em; text-transform: uppercase; color: var(--bc-mint); display: flex; align-items: center; gap: 6px; margin-left: 4px; }
.bruce-status:before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #3fae7e; box-shadow: 0 0 0 3px #3fae7e26; }
.bruce-widget .bruce-close { margin-left: auto; border: 0; background: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #55665b; font-size: 24px !important; line-height: 1; padding: 0; }
.bruce-widget .bruce-close:hover { background: #26493a12; color: var(--bc-green); }

/* Zona de mensajes */
.bruce-widget .bruce-chat { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 26px 6px; display: flex; flex-direction: column; scroll-behavior: smooth; }
.bruce-hero { margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; padding: 6px 0 18px; }
.bruce-hero-dog { position: relative; width: 116px; height: 116px; border-radius: 50%; background: #f9f9f3; display: grid; place-items: center; overflow: hidden;
  box-shadow: 0 0 0 6px #26493a0d, 0 14px 40px #26493a22, inset 0 0 0 1px #2a493118; }
.bruce-hero-dog > img { width: 84%; height: auto; display: block; }
.bruce-hero h2 { font-weight: 400; font-size: 33px; letter-spacing: -1px; line-height: 1.1; margin: 22px 0 0; color: #233a2f; }
.bruce-hero h2 b { font-weight: 400; color: var(--bc-mint); }
.bruce-hero p { color: var(--bc-dim); font-size: 15px; margin: 10px 0 0; line-height: 1.45; }
.bruce-panel.is-chat .bruce-hero { display: none; }

.bruce-msgs { display: grid; gap: 20px; align-content: start; padding-top: 10px; }
.bruce-msgs:empty { display: none; }
.bruce-widget .bruce-bubble.user { justify-self: end; background: #e0e8dc; color: #233a2f; border-radius: 20px 20px 5px 20px; padding: 12px 17px; max-width: 80%; margin: 0; font-size: 15px; line-height: 1.5; }
.bruce-msg { display: flex; gap: 12px; max-width: 98%; }
.bruce-mav { width: 28px; height: 28px; border-radius: 50%; background: #f9f9f3; box-shadow: inset 0 0 0 1px #2a493122; display: grid; place-items: center; flex: none; margin-top: 2px; }
.bruce-mav img { width: 86%; height: auto; display: block; }
.bruce-txt { font-size: 15px; line-height: 1.65; color: #253c31; min-width: 0; }
.bruce-txt p { margin: 0 0 10px; }
.bruce-txt p:last-child { margin-bottom: 0; }
.bruce-widget .bruce-msg.bruce-typing { display: flex; align-items: center; }
.bruce-msg.bruce-typing .bruce-txt { display: flex; gap: 5px; align-items: center; height: 28px; }
.bruce-widget .bruce-action { margin: 12px 8px 2px 0; padding: 11px 18px !important; border-radius: 12px !important; display: inline-flex; }

/* Sugerencias */
.bruce-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 6px 22px 12px; flex: none; }
.bruce-chips button { border: 1px solid var(--bc-line); background: #ffffff55; border-radius: 20px; padding: 9px 15px; font-size: 13px; color: #294333; display: inline-flex; gap: 8px; align-items: center; cursor: pointer; transition: background .2s, border-color .2s, transform .2s; }
.bruce-chips button:hover { background: #fff; border-color: #6b9c83; transform: translateY(-1px); }
.bruce-chips em { font: normal 500 10px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .1em; color: var(--bc-mint); }
.bruce-panel.is-chat .bruce-chips { display: none; }

/* Caja de escribir */
.bruce-compose { margin: 0 20px; border: 1px solid #284b3230; background: var(--bc-paper); border-radius: 20px; padding: 7px 7px 7px 18px; box-shadow: 0 6px 24px #26493a14; flex: none; display: flex; align-items: flex-end; gap: 10px; transition: border-color .2s, box-shadow .2s; }
.bruce-compose:focus-within { border-color: #5b8b70; box-shadow: 0 6px 28px #26493a22; }
.bruce-widget .bruce-compose textarea { flex: 1; min-width: 0; border: 0; background: transparent; padding: 7px 0; font: inherit; font-size: 14px; line-height: 22px; color: var(--bc-ink); outline: none; box-shadow: none; border-radius: 0; resize: none; overflow-y: auto; max-height: 150px; height: 36px; }
.bruce-widget .bruce-compose textarea::placeholder { color: #66776b; }
.bruce-compose .bruce-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; padding: 0; border: 0; flex: none; cursor: pointer; transition: background .2s, transform .15s; }
.bruce-compose .bruce-btn svg { width: 18px; height: 18px; display: block; }
.bruce-widget .bruce-compose .bruce-mic { background: transparent; border: 1px solid #284b3238; color: var(--bc-green); width: 36px; }
.bruce-widget .bruce-compose .bruce-mic:hover { background: #26493a10; }
.bruce-widget .bruce-compose .bruce-send { background: var(--bc-green); color: #e9f5e8; width: 36px; }
.bruce-widget .bruce-compose .bruce-send:hover { background: #3b624d; }
.bruce-widget .bruce-compose .bruce-send:disabled { opacity: .45; cursor: default; }
.bruce-widget .bruce-note { text-align: center; font: 500 9px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .14em; text-transform: uppercase; color: #5f7065; margin: 0; padding: 11px 16px 15px; flex: none; }
.bruce-panel.no-voice .bruce-mic { display: none; }

/* Modo voz */
.bruce-voice { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; background: radial-gradient(ellipse 70% 46% at 50% 34%, #fbfbf5 0, var(--bc-cream) 72%); animation: bruce-pop .28s ease; }
.bruce-voice[hidden] { display: none; }
.bruce-voice .bruce-top { align-self: stretch; }
.bruce-vstage { position: relative; margin-top: clamp(24px, 7vh, 70px); width: 200px; height: 200px; flex: none; display: grid; place-items: center; }
.bruce-vstage .r { position: absolute; border-radius: 50%; border: 1.5px solid var(--bc-mint); opacity: .5; animation: bruce-ring 2.4s ease-out infinite; }
.bruce-vstage .r:nth-child(2) { animation-delay: .8s; } .bruce-vstage .r:nth-child(3) { animation-delay: 1.6s; }
@keyframes bruce-ring { from { inset: 20px; opacity: .55; } to { inset: -34px; opacity: 0; } }
.bruce-vdog { position: relative; width: 144px; height: 144px; border-radius: 50%; background: #f9f9f3; display: grid; place-items: center; overflow: hidden;
  box-shadow: 0 0 0 8px #2f7a5a22, 0 0 0 20px #2f7a5a10, 0 20px 50px #26493a30, inset 0 0 0 1px #2a493118; }
.bruce-vdog > img { width: 84%; height: auto; display: block; }
.bruce-vstate { flex: none; margin-top: clamp(22px, 5vh, 40px); font: 500 10px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .14em; text-transform: uppercase; color: var(--bc-green); display: flex; gap: 9px; align-items: center; border: 1px solid #284b3233; background: #ffffff80; border-radius: 20px; padding: 7px 14px; }
.bruce-vstate:before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #e2554a; box-shadow: 0 0 0 3px #e2554a26; animation: bruce-blink 1.2s infinite; }
@keyframes bruce-blink { 50% { opacity: .35; } }
.bruce-wave { flex: none; display: flex; gap: 5px; align-items: center; height: 56px; margin-top: 18px; }
.bruce-wave b { width: 4px; height: 8px; border-radius: 3px; background: linear-gradient(#3b8a68, var(--bc-green)); animation: bruce-bar 1s ease-in-out infinite; }
.bruce-wave b:nth-child(3n) { animation-duration: .8s; } .bruce-wave b:nth-child(4n) { animation-duration: 1.25s; } .bruce-wave b:nth-child(5n) { animation-duration: .95s; }
.bruce-wave b:nth-child(2n) { animation-delay: -.3s; } .bruce-wave b:nth-child(3n) { animation-delay: -.6s; }
@keyframes bruce-bar { 0%, 100% { height: 8px; } 50% { height: 46px; } }
.bruce-voice.is-idle .bruce-wave b { animation-play-state: paused; height: 8px; }
.bruce-live { margin: 12px 36px 0; text-align: center; font-size: 22px; line-height: 1.35; letter-spacing: -.4px; color: #233a2f; flex: 1 1 0; min-height: 0; overflow-y: auto; width: calc(100% - 72px); }
.bruce-live em { font-style: normal; color: #66776b; }
.bruce-live.is-hint { color: #5f7065; font-size: 17px; letter-spacing: 0; }
.bruce-vctl { flex: none; padding: 14px 0 34px; display: flex; gap: 18px; align-items: center; }
.bruce-vctl button { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; border: 1px solid #284b3238; background: #ffffff90; color: var(--bc-green); cursor: pointer; padding: 0; transition: transform .15s, background .2s; }
.bruce-vctl button:hover { background: #fff; transform: translateY(-1px); }
.bruce-vctl button svg { width: 20px; height: 20px; display: block; }
.bruce-vctl .big { width: 74px; height: 74px; background: var(--bc-green); color: #e9f5e8; border-color: var(--bc-green); }
.bruce-vctl .big:hover { background: #3b624d; }

@media (prefers-reduced-motion: reduce) {
  .bruce-vstage .r, .bruce-wave b, .bruce-vstate:before { animation: none; }
  .bruce-widget .bruce-panel, .bruce-voice { animation: none; }
}
@media (max-width: 600px) {
  .bruce-widget .bruce-panel { position: fixed; left: 12px; right: 12px; top: 12px; bottom: 84px; width: auto; height: auto; border-radius: 20px; }
  .bruce-hero h2 { font-size: 29px; }
  .bruce-widget .bruce-chat { padding: 4px 18px 6px; }
  .bruce-compose { margin: 0 16px; }
  .bruce-widget .bruce-note { letter-spacing: .06em; font-size: 8.5px; }
  .bruce-vstage { margin-top: 44px; }
}

/* Un solo Bruce a la vez: al abrir (y en modo voz) el grande ya es Bruce, así que el
   encabezado queda limpio (solo estado y cerrar). Con la conversación, el encabezado lo presenta. */
.bruce-panel:not(.is-chat) > .bruce-top .bruce-av,
.bruce-panel:not(.is-chat) > .bruce-top strong,
.bruce-voice .bruce-av, .bruce-voice .bruce-top strong { display: none; }
.bruce-panel:not(.is-chat) > .bruce-top .bruce-status { margin-left: 0; }

.bruce-widget.is-open .bruce-launch { display: none; }
.bruce-widget.is-open .bruce-panel { bottom: 0; height: min(720px, calc(100dvh - 64px)); }
@media (max-width: 600px) { .bruce-widget.is-open .bruce-panel { bottom: 12px; } }

/* Nueva conversación: solo aparece cuando ya hay una conversación. */
.bruce-new { margin-left: auto; width: 34px; height: 34px; border-radius: 10px; border: 0; background: none; color: #6c7d70; display: none; place-items: center; padding: 0; cursor: pointer; }
.bruce-new svg { width: 18px; height: 18px; display: block; }
.bruce-new:hover { background: #26493a12; color: var(--bc-green); }
.bruce-panel.is-chat .bruce-new { display: grid; }
.bruce-panel.is-chat .bruce-new + .bruce-close { margin-left: 0; }

.bruce-chips:empty{display:none}
