/* =========================================================================
   AgentiCuántico · componente de chat, avatar, lienzo y centro de control
   ========================================================================= */
.chat { --wave: var(--ink); position: relative; display: flex; flex-direction: column; min-height: 0; height: 100%; background: var(--surface); color: var(--ink); }
.chat[data-variant="embed"] { border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-3); overflow: hidden; }
.chat.dragging::after { content: "Soltá los archivos para adjuntarlos"; position: absolute; inset: 8px; z-index: 30; display: grid; place-items: center; border: 2px dashed var(--gold-2); border-radius: var(--r-lg); background: color-mix(in srgb, var(--surface) 88%, transparent); font-weight: 600; }

/* Encabezado */
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface); min-height: 62px; position: relative; z-index: 5; }
.chat-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-face { position: relative; flex: none; }
.chat-face img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--gold-2); }
.chat-face .dot { position: absolute; right: -1px; bottom: 0; width: 11px; height: 11px; border: 2px solid var(--surface); box-shadow: none; }
.chat-id-text { display: grid; line-height: 1.2; min-width: 0; }
.chat-id-text strong { font-family: var(--font-display); font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-status { font-size: var(--fs-xs); color: var(--ok); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.chat-participants { display: flex; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.chat-participants::-webkit-scrollbar { display: none; }
.participant { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 3px; border-radius: var(--r-pill); border: 1px solid color-mix(in srgb, var(--c) 35%, var(--line)); background: color-mix(in srgb, var(--c) 7%, var(--surface)); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.p-badge { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--c, var(--ink)); color: #fff; font-size: 10px; font-weight: 700; flex: none; letter-spacing: .02em; }
.p-badge.lg { width: 40px; height: 40px; font-size: 14px; }
.chat-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: none; }
.chat-actions .icon-btn[data-act="incognito"][aria-pressed="true"] { background: #1b1a22; color: #fff; }
.lang-menu { min-width: 250px; }
.incognito-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: #1b1a22; color: #ecebf0; font-size: var(--fs-sm); }
.incognito-bar svg { width: 18px; height: 18px; flex: none; }
.chat.is-incognito .chat-body { background: repeating-linear-gradient(135deg, transparent 0 14px, color-mix(in srgb, var(--ink) 2.2%, transparent) 14px 15px); }

/* Hilo */
.chat-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-thread { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth; padding: 18px 14px 8px; }
.chat-thread.is-empty { flex: 0 0 auto; padding: 0; }
.thread-inner { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.chat-empty { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 20px 16px; gap: 16px; text-align: center; }
.chat-greeting { font-family: var(--font-display); font-size: clamp(1.3rem, 1.1rem + 1vw, 1.8rem); font-weight: 600; letter-spacing: -.02em; margin: 0; }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: min(100%, 640px); }
.suggestion { display: flex; align-items: center; gap: 10px; text-align: left; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.35; transition: border-color var(--t-fast), background var(--t-fast); }
.suggestion:hover { border-color: var(--gold-2); background: var(--gold-soft); color: var(--ink); }
.suggestion span { display: inline-grid; color: var(--gold); flex: none; }
.suggestion svg { width: 18px; height: 18px; }
@media (max-width: 520px) { .suggestions { grid-template-columns: 1fr; } .suggestion:nth-child(n+4) { display: none; } }
.scroll-down { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); z-index: 4; }

/* Mensajes */
.msg { display: flex; flex-direction: column; gap: 6px; min-width: 0; animation: rise .25s var(--ease); }
.msg.user { align-items: flex-end; }
.msg.user .bubble { max-width: min(88%, 620px); background: var(--surface-3); padding: 10px 14px; border-radius: 20px 20px 6px 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 88%; }
.msg-thumb { width: 120px; height: 90px; object-fit: cover; border-radius: var(--r-md); border: 1px solid var(--line); }
.msg-files .chip svg { width: 14px; height: 14px; }
.msg-who { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); }
.msg-who img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.msg.by-agent .msg-body { border-left: 3px solid var(--c); padding-left: 12px; }
.msg-body { min-width: 0; padding-left: 32px; }
.msg-notice { align-self: center; font-size: var(--fs-xs); color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); padding: 5px 12px; border-radius: var(--r-pill); text-align: center; max-width: 92%; }
.msg-notice.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; border-radius: var(--r-md); }
.msg-actions { display: flex; gap: 2px; padding-left: 28px; opacity: .75; }
.msg-actions:hover { opacity: 1; }
.typing { display: inline-flex; gap: 4px; padding: 8px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Markdown */
.md { font-size: .97rem; line-height: 1.65; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .75em; }
.md h2, .md h3, .md h4, .md h5 { font-size: 1.05rem; margin: 1.1em 0 .5em; }
.md ul, .md ol { margin: 0 0 .8em; padding-left: 1.3em; }
.md li + li { margin-top: .25em; }
.md code { font-family: var(--font-mono); font-size: .88em; background: var(--surface-3); padding: .12em .38em; border-radius: 6px; }
.md a { color: var(--info); }
.md blockquote { margin: 0 0 .8em; padding: 6px 14px; border-left: 3px solid var(--gold-2); color: var(--ink-2); background: var(--gold-soft); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.md hr { border: 0; height: 1px; background: var(--line); margin: 1em 0; }
.md-table { overflow-x: auto; margin: 0 0 .8em; border: 1px solid var(--line); border-radius: var(--r-md); }
.md table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.md th, .md td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.md th { background: var(--surface-2); font-weight: 650; }
.md tr:last-child td { border-bottom: 0; }
.code-block { margin: 0 0 .9em; border-radius: var(--r-md); overflow: hidden; border: 1px solid #23222b; background: #15141b; color: #e8e6ef; }
.code-block figcaption { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 6px 12px; font-size: 12px; color: #a9a7b3; background: #1d1c25; }
.code-actions { display: flex; gap: 4px; }
.code-btn { border: 0; background: transparent; color: #d6d4df; font-size: 12px; padding: 4px 8px; border-radius: 6px; }
.code-btn:hover { background: #2b2a35; color: #fff; }
.code-block pre { margin: 0; padding: 12px 14px; overflow-x: auto; font: 13px/1.55 var(--font-mono); }
.code-block code { background: none; padding: 0; font-size: inherit; color: inherit; }

/* Notas de voz */
.bubble.voice { padding: 8px 12px 8px 8px !important; min-width: 220px; white-space: normal !important; }
.vb-row { display: flex; align-items: center; gap: 10px; }
.vb-play { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; flex: none; }
.vb-play svg { width: 16px; height: 16px; }
.vb-play[disabled] { opacity: .45; }
.vb-wave { display: flex; align-items: center; gap: 2px; height: 30px; flex: 1; min-width: 110px; }
.vb-wave i { flex: 1; min-width: 2px; max-width: 4px; border-radius: 2px; background: color-mix(in srgb, var(--ink) 35%, transparent); }
.vb-wave i.on { background: var(--gold); }
.vb-time { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.vb-transcript { margin-top: 6px; font-size: var(--fs-xs); color: var(--muted); }
.vb-transcript summary { cursor: pointer; list-style: none; font-weight: 600; }
.vb-transcript summary::-webkit-details-marker { display: none; }
.vb-transcript summary::before { content: "▸ "; }
.vb-transcript[open] summary::before { content: "▾ "; }
.vb-transcript p { margin: 4px 0 0; font-size: .82rem; color: var(--ink-2); white-space: pre-wrap; }

/* Línea de tiempo del agente */
.timeline { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px; margin-bottom: 12px; background: linear-gradient(180deg, var(--gold-soft), var(--surface) 70%); }
.tl-head { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); }
.tl-head svg { width: 18px; height: 18px; color: var(--gold); }
.tl-count { margin-left: auto; color: var(--muted); font-size: var(--fs-xs); }
.tl-progress { height: 4px; border-radius: 99px; background: var(--surface-3); margin: 10px 0; overflow: hidden; }
.tl-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width .4s var(--ease); }
.tl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tl-step { display: grid; grid-template-columns: 20px 1fr; gap: 2px 10px; align-items: center; font-size: var(--fs-sm); color: var(--muted); }
.tl-dot { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; }
.tl-dot svg { width: 12px; height: 12px; }
.tl-step.running { color: var(--ink); font-weight: 600; }
.tl-step.running .tl-dot { border-color: var(--gold); border-top-color: transparent; animation: spin .9s linear infinite; }
.tl-step.done { color: var(--ink-2); }
.tl-step.done .tl-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.tl-step[data-phase="agent"] .tl-title::before { content: "👤 "; }
.tl-step[data-phase="confirm"] .tl-title::before { content: "✋ "; }
.tl-log { grid-column: 2; font-size: var(--fs-xs); }
.tl-log summary { cursor: pointer; color: var(--muted); }
.tl-log pre { white-space: pre-wrap; margin: 4px 0 0; font: 12px/1.5 var(--font-mono); color: var(--ink-2); background: var(--surface-2); padding: 8px; border-radius: var(--r-sm); max-height: 180px; overflow: auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.vm { margin-top: 10px; border-radius: var(--r-md); overflow: hidden; border: 1px solid #23222b; }
.vm summary { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 7px 10px; background: #1d1c25; color: #d6d4df; font-size: 12px; list-style: none; }
.vm summary::-webkit-details-marker { display: none; }
.vm summary svg { width: 15px; height: 15px; }
.vm-screen { margin: 0; padding: 10px 12px; background: #0f0e14; color: #b7f171; font: 12px/1.55 var(--font-mono); white-space: pre-wrap; max-height: 220px; overflow: auto; }
.confirm-card { border: 1px solid var(--gold-2); background: var(--gold-soft); border-radius: var(--r-md); padding: 12px 14px; margin: 10px 0; font-size: var(--fs-sm); }
.confirm-card p { margin-bottom: 10px; }
.artifact { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); margin-top: 10px; flex-wrap: wrap; }
.artifact-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--gold); }
.artifact-icon svg { width: 18px; height: 18px; }
.artifact-meta { display: grid; line-height: 1.25; flex: 1; min-width: 120px; }
.artifact-meta small { color: var(--muted); }

/* Composer */
.composer { padding: 8px 12px 10px; background: var(--surface); position: relative; z-index: 3; }
.composer-box { position: relative; max-width: 820px; margin: 0 auto; border: 1px solid var(--line-2); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow-2); padding: 8px 8px 6px; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.composer-box:focus-within { border-color: var(--ink-2); }
.composer textarea { display: block; width: 100%; border: 0; outline: none; resize: none; background: transparent; padding: 6px 8px 4px; font-size: 1rem; line-height: 1.5; max-height: 240px; min-height: 28px; }
.composer textarea::placeholder { color: var(--faint); }
.composer-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 4px; }
.composer-left, .composer-right { display: flex; align-items: center; gap: 4px; min-width: 0; }
.composer-left { position: relative; flex: 1 1 auto; }
.composer-right { flex: none; }
.icon-btn.round { border: 1px solid var(--line); width: 38px; height: 38px; }
.mode-btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 10px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); min-width: 0; }
.mode-btn svg { width: 17px; height: 17px; flex: none; }
.mode-btn > svg:last-child { width: 13px; height: 13px; color: var(--muted); }
.mode-btn[data-mode="auto"] { border-color: var(--gold-2); background: var(--gold-soft); color: var(--ink); }
.mode-btn[data-mode="auto"] span svg { color: var(--gold); }
.mode-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.send-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; flex: none; transition: transform var(--t-fast); }
.send-btn:hover { transform: scale(1.04); }
.send-btn svg { width: 19px; height: 19px; }
.send-btn.stop { background: var(--ink); }
.chat.hands-free [data-act="handsfree"] { background: var(--gold); color: #1d1606; box-shadow: 0 0 0 4px var(--gold-soft); animation: breathe 1.6s infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--gold-2) 25%, transparent); } }
.composer-note { max-width: 820px; margin: 6px auto 0; font-size: 11px; color: #71717a; text-align: center; }
.composer-note a { color: inherit; }
.chat[data-variant="embed"] .composer-note { display: none; }
.composer-files { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; }
.file-chip { display: flex; align-items: center; gap: 8px; padding: 6px 4px 6px 8px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); font-size: var(--fs-xs); max-width: 240px; flex: none; }
.file-chip.error { border-color: var(--danger); }
.file-chip.loading { opacity: .7; }
.fc-icon svg { width: 18px; height: 18px; color: var(--gold); }
.fc-thumb { width: 34px; height: 34px; object-fit: cover; border-radius: 8px; }
.fc-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.file-chip small { color: var(--muted); white-space: nowrap; }

/* Grabación */
.recording { position: absolute; inset: 0; display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--surface); border-radius: 24px; z-index: 2; touch-action: pan-y; transition: transform .1s; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; flex: none; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; font-size: var(--fs-sm); min-width: 36px; }
.rec-wave { flex: 1; height: 34px; min-width: 40px; }
.rec-hint { position: absolute; left: 92px; right: 60px; bottom: 2px; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }

/* Teléfonos: el compositor no desborda entre 320 y 430 px */
@media (max-width: 480px) {
  .chat-head { padding: 8px 8px 8px 10px; gap: 6px; min-height: 56px; }
  .chat-face img { width: 34px; height: 34px; }
  .chat-participants { display: none; }
  .lang-btn { padding: 0 6px 0 4px; height: 36px; gap: 4px; }
  .lang-btn span { display: none; }
  .chat-actions .icon-btn { width: 36px; height: 36px; }
  .chat-thread { padding: 14px 10px 6px; }
  .msg-body { padding-left: 0; }
  .msg-actions { padding-left: 0; }
  .composer { padding: 6px 8px 8px; }
  .composer-box { border-radius: 22px; padding: 6px 6px 5px; }
  .icon-btn.round, .send-btn { width: 36px; height: 36px; }
  .mode-btn { height: 36px; padding: 0 8px; gap: 4px; }
  .mode-label { max-width: none; overflow: visible; }
}
@media (max-width: 360px) {
  .mode-btn { padding: 0 7px; gap: 3px; }
  .mode-btn > svg:last-child { display: none; }
  .chat-id-text strong { font-size: .95rem; }
  .composer-left, .composer-right { gap: 3px; }
}

/* Avatar */
.avatar-stage { position: relative; overflow: hidden; isolation: isolate; background: radial-gradient(120% 90% at 50% 18%, #fffaf0 0%, #f6efe2 45%, #ece5d8 100%); }
[data-theme="dark-off"] .avatar-stage { background: radial-gradient(120% 90% at 50% 18%, #2a2418 0%, #18161d 60%, #121117 100%); }
.avatar-canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; z-index: 2; }
.avatar-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; z-index: 1; transition: opacity .6s; }
.avatar-stage[data-mode="3d"] .avatar-poster { opacity: 0; }
.avatar-aura { position: absolute; z-index: 0; left: 50%; top: 22%; width: 70%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, rgba(243, 209, 128, .55), rgba(243, 209, 128, 0) 65%); filter: blur(10px); transition: opacity .4s, transform .6s; opacity: .7; }
.avatar-stage[data-state="thinking"] .avatar-aura { opacity: 1; transform: translate(-50%, -50%) scale(1.15); animation: auraPulse 1.2s ease-in-out infinite; }
.avatar-stage[data-state="talking"] .avatar-aura { opacity: .95; }
@keyframes auraPulse { 50% { transform: translate(-50%, -50%) scale(1.28); opacity: .8; } }
.avatar-stage.pulse .avatar-aura { animation: auraHit .6s var(--ease); }
@keyframes auraHit { 30% { transform: translate(-50%, -50%) scale(1.25); opacity: 1; } }
.avatar-status { position: absolute; z-index: 3; left: 12px; bottom: 12px; padding: 5px 10px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--surface) 80%, transparent); backdrop-filter: blur(8px); font-size: var(--fs-xs); font-weight: 650; color: var(--ink-2); }
.avatar-status:empty { display: none; }
.avatar-stage[data-mode="loading"]::after { content: ""; position: absolute; z-index: 3; left: 20%; right: 20%; bottom: 14px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--gold) calc(var(--load, 0) * 100%), color-mix(in srgb, var(--ink) 12%, transparent) 0); }
.avatar-load { position: absolute; z-index: 4; left: 50%; bottom: 16px; transform: translateX(-50%); }

/* Lienzo */
.canvas { display: grid; gap: 10px; }
.canvas-tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: var(--r-pill); width: max-content; }
.canvas-tabs button { border: 0; background: none; padding: 6px 14px; border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.canvas-tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.canvas-code { width: 100%; min-height: min(60vh, 520px); font: 13px/1.55 var(--font-mono); background: #15141b; color: #e8e6ef; border-radius: var(--r-md); padding: 14px; border: 0; resize: vertical; }
.canvas-preview { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: #fff; }
.canvas-frame { width: 100%; height: min(62vh, 560px); border: 0; display: block; }

/* Cámara */
.cam { display: grid; gap: 10px; }
.cam-video { width: 100%; max-height: 62vh; border-radius: var(--r-md); background: #000; object-fit: contain; }

/* Paywall */
.paywall-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.pw-plan { display: grid; gap: 4px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); }
.pw-plan.featured { border-color: var(--gold-2); box-shadow: var(--glow-gold); }
.pw-price { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; }
.pw-price small { font-size: .8rem; color: var(--muted); font-weight: 500; }
.pw-plan ul { margin: 6px 0 0; padding-left: 1.1em; font-size: var(--fs-xs); color: var(--ink-2); }
@media (max-width: 520px) { .paywall-plans { grid-template-columns: 1fr; } }

/* Centro de control */
.hub { display: grid; grid-template-columns: 200px 1fr; gap: 20px; min-height: 420px; }
.hub-tabs { display: grid; align-content: start; gap: 2px; }
.hub-tabs button { display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left; padding: 9px 10px; border-radius: var(--r-md); font-size: var(--fs-sm); font-weight: 550; color: var(--ink-2); }
.hub-tabs button svg { width: 18px; height: 18px; }
.hub-tabs button[aria-selected="true"] { background: var(--surface-3); color: var(--ink); }
.hub-pane { min-width: 0; }
/* Red de seguridad: ningún ícono del Centro de control puede crecer sin tamaño (antes un candado ocupaba media pantalla). */
.hub-pane svg { max-width: 48px; max-height: 48px; }
.hub-list { display: grid; gap: 8px; }
.hub-item { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.hub-item > div { flex: 1; min-width: 0; }
.hub-item p { margin: 2px 0 0; }
.hub-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--gold-soft); color: var(--gold); flex: none; }
.hub-ic svg { width: 18px; height: 18px; }
.hub-form { margin-top: 16px; }
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.agent-card { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); border-top: 3px solid var(--c); }
.agent-card small { display: block; }
.agent-skills { display: flex; flex-wrap: wrap; gap: 4px; }
@media (max-width: 720px) {
  .hub { grid-template-columns: 1fr; }
  .hub-tabs { display: flex; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .hub-tabs button { white-space: nowrap; border: 1px solid var(--line); }
  .hub-item { flex-wrap: wrap; }
}

/* Impresión (exportar PDF) */
@media print {
  body.print-chat > *:not(.print-host) { display: none !important; }
  body.print-chat .print-target { display: block !important; position: static; border: 0; box-shadow: none; height: auto; }
  body.print-chat .print-target .chat-head, body.print-chat .print-target .composer, body.print-chat .print-target .msg-actions, body.print-chat .print-target .chat-empty, body.print-chat .print-target .scroll-down { display: none !important; }
  body.print-chat .print-target .chat-thread { overflow: visible; height: auto; }
}

/* Selector de modos: fila propia, deslizable, preparada para más modos (Investigar, Imagen, Código…) */
.mode-strip-wrap { position: relative; max-width: 820px; margin: 0 auto 6px; min-width: 0; }
.mode-strip { display: flex; gap: 6px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 2px 2px; scroll-padding-inline: 12px; touch-action: pan-x; }
.mode-strip::-webkit-scrollbar { display: none; }
.mode-chip { flex: none; scroll-snap-align: start; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; cursor: pointer; transition: background var(--t) var(--ease), border-color var(--t) var(--ease), color var(--t) var(--ease); }
.mode-chip svg { width: 16px; height: 16px; flex: none; }
.mode-chip:hover { border-color: var(--line-2); color: var(--ink); }
.mode-chip[aria-checked="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.mode-chip[data-mode="auto"][aria-checked="true"] { background: var(--gold-soft); border-color: var(--gold-2); color: var(--ink); }
.mode-chip[data-mode="auto"] svg { color: var(--gold); }
.mode-chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.mode-strip-wrap::before, .mode-strip-wrap::after { content: ""; position: absolute; top: 0; bottom: 0; width: 28px; pointer-events: none; opacity: 0; transition: opacity var(--t) var(--ease); z-index: 1; }
.mode-strip-wrap::before { left: 0; background: linear-gradient(90deg, var(--surface), transparent); }
.mode-strip-wrap::after { right: 0; background: linear-gradient(270deg, var(--surface), transparent); }
.mode-strip-wrap.fade-l::before, .mode-strip-wrap.fade-r::after { opacity: 1; }
.composer-row { flex-wrap: nowrap; }
.composer-right { flex: none; position: relative; z-index: 2; }
.composer-left { overflow: hidden; }
.composer { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
@media (max-width: 420px) { .mode-chip { height: 32px; padding: 0 11px; } }

/* Navegador del agente */
.ab-chip { display: inline-flex; align-items: center; gap: 8px; margin: 0 auto 6px; padding: 5px 12px; border-radius: var(--r-pill); background: #16151a; color: #f2f1ee; font-size: var(--fs-xs); font-weight: 600; max-width: 820px; }
.composer > .ab-chip { display: flex; width: max-content; max-width: 100%; }
.ab-spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #55545e; border-top-color: #e6c579; animation: ab-rot .8s linear infinite; flex: none; }
.ab-card { margin: 10px 0 14px; background: #16151a; color: #f2f1ee; border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-2); border: 1px solid #26252c; max-width: 100%; }
.ab-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; min-width: 0; }
.ab-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; font-size: var(--fs-sm); white-space: nowrap; }
.ab-title svg { width: 16px; height: 16px; color: #e6c579; }
.ab-pill { display: inline-flex; align-items: center; gap: 6px; min-width: 0; flex: 1 1 auto; padding: 4px 10px; border-radius: var(--r-pill); background: #23222a; font-size: var(--fs-xs); color: #d9d8de; }
.ab-pill-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-dot { width: 7px; height: 7px; border-radius: 50%; background: #e6c579; flex: none; animation: ab-pulse 1.4s ease-in-out infinite; }
.ab-pill[data-kind="ok"] .ab-dot { background: #4ade80; animation: none; }
.ab-pill[data-kind="off"] .ab-dot { background: #6b6a73; animation: none; }
.ab-pill[data-kind="err"] .ab-dot { background: #f87171; animation: none; }
.ab-actions { display: inline-flex; gap: 2px; flex: none; }
.ab-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; border: 0; background: transparent; color: #c9c8ce; cursor: pointer; }
.ab-btn:hover { background: #26252c; color: #fff; }
.ab-btn svg { width: 16px; height: 16px; }
.ab-btn:focus-visible { outline: 2px solid #e6c579; outline-offset: 1px; }
.ab-view { position: relative; margin: 0 10px; border-radius: 14px; background: #0e0e12; aspect-ratio: 16 / 10; overflow: hidden; display: grid; place-items: center; }
.ab-frame { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.ab-loader { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 16px; }
.ab-loader p { margin: 0; font-weight: 600; font-size: var(--fs-sm); background: linear-gradient(90deg, #8d8c95, #f2f1ee, #8d8c95); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: ab-shine 1.8s linear infinite; }
.ab-loader small { color: #8d8c95; }
.ab-orbit { position: relative; width: 44px; height: 44px; }
.ab-orbit i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid transparent; border-top-color: #e6c579; animation: ab-rot 1.2s cubic-bezier(.5, .1, .5, .9) infinite; }
.ab-orbit i:nth-child(2) { inset: 7px; border-top-color: #b8892f; animation-duration: 1.6s; animation-direction: reverse; }
.ab-orbit i:nth-child(3) { inset: 15px; background: #e6c579; border: 0; animation: ab-pulse 1.4s ease-in-out infinite; }
.ab-off { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 18px; max-width: 460px; }
.ab-off-ic svg { width: 28px; height: 28px; color: #e6c579; }
.ab-off strong { font-size: var(--fs-sm); }
.ab-off p { margin: 0; color: #b9b8c0; font-size: var(--fs-xs); line-height: 1.5; }
.ab-off .btn { margin-top: 6px; --b-bg: #fff; --b-fg: #16151a; --b-line: #fff; }
.ab-timeline { margin: 8px 10px 0; font-size: var(--fs-xs); color: #c9c8ce; }
.ab-timeline summary { cursor: pointer; padding: 6px 4px; }
.ab-steps { list-style: none; margin: 0; padding: 0 4px 6px; display: grid; gap: 6px; }
.ab-steps li { display: flex; gap: 8px; align-items: center; }
.st-ic { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #55545e; flex: none; }
.st-done .st-ic { background: #4ade80; border-color: #4ade80; }
.st-running .st-ic { border-color: #e6c579; border-top-color: transparent; animation: ab-rot .9s linear infinite; }
.st-error .st-ic { background: #f87171; border-color: #f87171; }
.ab-approvals:empty, .ab-result[hidden] { display: none; }
.ab-approvals { padding: 8px 10px 0; display: grid; gap: 8px; }
.ab-approval { background: #fff; color: var(--ink); border-radius: 14px; padding: 12px; display: grid; gap: 6px; font-size: var(--fs-sm); }
.ab-approval p { margin: 0; }
.ab-approval .ap-head { display: flex; gap: 6px; align-items: center; } .ab-approval .ap-head svg { width: 16px; height: 16px; color: var(--gold); }
.ab-result { margin: 8px 10px 0; padding: 10px 12px; border-radius: 12px; background: #23222a; font-size: var(--fs-sm); }
.ab-result p { margin: 4px 0 0; color: #c9c8ce; }
.ab-card > :last-child { margin-bottom: 10px; }
.ab-card.is-min .ab-view, .ab-card.is-min .ab-timeline, .ab-card.is-min .ab-result { display: none; }
.ab-card.is-min .ab-btn:first-child svg { transform: rotate(180deg); }
.ab-card.is-full { position: fixed; inset: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)); z-index: 1200; margin: 0; display: flex; flex-direction: column; overflow: auto; }
.ab-card.is-full .ab-view { aspect-ratio: auto; flex: 1 1 auto; min-height: 50vh; }
body.ab-lock { overflow: hidden; }
@media (max-width: 380px) { .ab-title span { display: none; } .ab-head { padding-left: 10px; } }
@keyframes ab-rot { to { transform: rotate(360deg); } }
@keyframes ab-pulse { 50% { opacity: .35; transform: scale(.85); } }
@keyframes ab-shine { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .ab-orbit i, .ab-spin, .ab-dot, .st-running .st-ic, .ab-loader p { animation: none !important; } }
.ab-view:has(.ab-off) { aspect-ratio: auto; }
@media (max-width: 400px) { .chat-actions [data-act="incognito"] { display: none; } .chat-head .chat-id-text strong { font-size: .92rem; } }
@media (max-width: 380px) { .mode-strip { gap: 4px; } .mode-chip { padding: 0 9px; gap: 4px; font-size: .8125rem; height: 32px; } .mode-chip svg { width: 15px; height: 15px; } }

/* Retrato de AgentiCuántico (cerebro dorado) — reemplaza al avatar 3D */
.portrait-stage { --lvl: 0; position: relative; overflow: hidden; isolation: isolate; background: radial-gradient(120% 90% at 50% 25%, #fffaf0 0%, #f3ead8 55%, #e6dcc6 100%); }
.portrait-zoom { position: absolute; inset: 0; transform: scale(calc(1.02 + var(--lvl) * .045)); transform-origin: 50% 35%; transition: transform .12s linear; animation: portraitBreath 6s ease-in-out infinite; }
.portrait-zoom picture, .portrait-img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; object-position: 50% 30%; }
.portrait-img { filter: saturate(calc(1 + var(--lvl) * .25)) brightness(calc(1 + var(--lvl) * .08)); }
.portrait-canvas { position: absolute; inset: 0; width: 100%; height: 100%; mix-blend-mode: screen; pointer-events: none; }
.portrait-glow { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(42% 32% at 60% 26%, rgba(255, 200, 90, calc(.05 + var(--lvl) * .45)), transparent 70%); mix-blend-mode: screen; }
.portrait-stage[data-state="thinking"] .portrait-glow { background: radial-gradient(42% 32% at 60% 26%, rgba(190, 130, 255, .35), transparent 70%); }
.portrait-stage[data-state="listening"] .portrait-glow { background: radial-gradient(42% 32% at 60% 26%, rgba(159, 255, 0, .22), transparent 70%); }
.portrait-stage .avatar-status { position: absolute; z-index: 3; left: 14px; bottom: 14px; padding: 6px 14px; border-radius: 999px; background: rgba(22, 21, 26, .78); color: #fff; font-weight: 700; font-size: 14px; backdrop-filter: blur(6px); }
.portrait-stage .avatar-status:empty { display: none; }
@keyframes portraitBreath { 50% { transform: scale(calc(1.035 + var(--lvl) * .045)); } }
@media (prefers-reduced-motion: reduce) { .portrait-zoom { animation: none; } }

/* ===== Avatar 3D (v7): retrato como póster, 3D encima cuando está listo ===== */
.agent-av { position: relative; overflow: hidden; isolation: isolate; background: radial-gradient(120% 90% at 50% 22%, #fffaf0 0%, #f4ecdc 52%, #e7dcc5 100%); }
.agent-av > .agent-av-poster { position: absolute; inset: 0; transition: opacity .7s ease; }
.agent-av > .agent-av-poster .avatar-status { display: none; }
.agent-av > .agent-av-3d { position: absolute; inset: 0; opacity: 0; transition: opacity .7s ease; }
.agent-av > .agent-av-3d canvas { display: block; width: 100%; height: 100%; }
.agent-av.is-3d > .agent-av-3d { opacity: 1; }
.agent-av.is-3d > .agent-av-poster { opacity: 0; pointer-events: none; }
.agent-av-status { position: absolute; z-index: 3; left: 10px; bottom: 10px; padding: 5px 12px; border-radius: 999px; background: rgba(22, 21, 26, .78); color: #fff; font-weight: 700; font-size: 13px; backdrop-filter: blur(6px); }
.agent-av-status:empty { display: none; }
.agent-av[data-state="thinking"] .agent-av-status { background: linear-gradient(90deg, #6b4a12, #c99a3c); }
.agent-av-load { position: absolute; z-index: 3; right: 10px; top: 10px; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.85); color: #3f3a30; font-size: 11.5px; font-weight: 650; }

/* ===== Videollamada flotante ===== */
.agent-pip { position: fixed; z-index: 900; right: 20px; bottom: 20px; width: 300px; height: 420px; display: grid; grid-template-rows: auto 1fr auto; grid-template-columns: minmax(0, 1fr); border-radius: 22px; overflow: hidden; background: #16151a; color: #f4f1ea; box-shadow: 0 0 0 2px rgba(214,178,106,.8), 0 28px 70px -18px rgba(24,20,10,.55); opacity: 0; transform: translateY(12px) scale(.96); transition: opacity .25s ease, transform .25s ease; }
.agent-pip.is-open { opacity: 1; transform: none; }
.agent-pip[hidden] { display: none; }
.agent-pip-bar { min-width: 0; display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 12px; background: #16151a; cursor: grab; touch-action: none; user-select: none; }
.agent-pip-title { display: flex; align-items: center; gap: 7px; min-width: 0; flex: 1; font-size: 13px; line-height: 1.1; }
.agent-pip-title strong { font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.agent-pip-title small { color: #d9b25f; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-pip-led { width: 8px; height: 8px; border-radius: 50%; background: #a3e635; flex: none; }
.agent-pip[data-state="thinking"] .agent-pip-led { background: #e7c26a; animation: pipLed 1s ease-in-out infinite; }
@keyframes pipLed { 50% { opacity: .35; } }
.agent-pip-actions { display: flex; gap: 4px; flex: none; }
.agent-pip-btn { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 0; background: #26252d; color: #f4f1ea; cursor: pointer; }
.agent-pip-btn:hover { background: #34333c; }
.agent-pip-btn[aria-pressed="true"] { background: #f4f1ea; color: #16151a; }
.agent-pip-btn svg { width: 16px; height: 16px; }
.agent-pip-stage { position: relative; min-height: 0; }
.agent-pip-stage.agent-av { position: relative; }
.agent-pip-foot { padding: 7px 12px 9px; background: #16151a; text-align: center; }
.agent-pip-link { color: #e7c26a; font-size: 12.5px; font-weight: 650; text-decoration: none; }
.agent-pip-link:hover { text-decoration: underline; }
.agent-pip.is-full { inset: 0 !important; width: auto; height: auto; border-radius: 0; box-shadow: none; z-index: 1000; }
.agent-pip.is-full .agent-pip-bar { cursor: default; padding-top: max(8px, env(safe-area-inset-top)); }
.agent-pip.is-full .agent-pip-foot { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
html.agent-pip-lock, html.agent-pip-lock body { overflow: hidden; }
@media (max-width: 640px) {
  .agent-pip { right: 10px; bottom: auto; top: calc(env(safe-area-inset-top) + 64px); width: min(52vw, 220px); height: min(40vh, 300px); border-radius: 18px; }
  .agent-pip-title small { display: none; }
  .agent-pip-btn { width: 28px; height: 28px; }
  .agent-pip-bar { gap: 4px; padding: 6px 6px 6px 10px; }
  .agent-pip-actions { gap: 3px; }
  .agent-pip-btn svg { width: 15px; height: 15px; }
  .agent-pip-foot { display: none; }
  .agent-pip.is-full .agent-pip-foot { display: block; }
  .agent-pip .agent-av-status { font-size: 11.5px; padding: 4px 9px; left: 6px; bottom: 6px; }
}
@media (max-width: 380px) { .agent-pip-title strong { font-size: 12px; } }
@media (prefers-reduced-motion: reduce) { .agent-pip { transition: none; } }
/* v7: menús del chat opacos y por encima de la cabecera */
.chat .popover { background: #fff; z-index: 120; isolation: isolate; -webkit-overflow-scrolling: touch; }
.chat .popover .menu-item { background-color: #fff; }
.chat .popover .menu-item:hover, .chat .popover .menu-item:focus-visible { background-color: #f3f1ec; }
/* v7: Centro de control en pantallas angostas */
@media (max-width: 560px) {
  .hub { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .hub-tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; gap: 6px; padding: 2px 2px 6px; margin: 0 -2px; scroll-snap-type: x proximity; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
  .hub-tabs button { flex: none; white-space: nowrap; scroll-snap-align: start; }
  .hub-item { flex-wrap: wrap; align-items: flex-start; row-gap: 8px; }
  .hub-item > div { flex: 1 1 calc(100% - 52px); min-width: 0; }
  .hub-item > div strong { display: block; white-space: normal; word-break: normal; overflow-wrap: anywhere; }
  .hub-item > .chip, .hub-item > .btn, .hub-item > .switch, .hub-item > button { margin-left: 48px; }
  .hub-item > .chip + .btn, .hub-item > .chip + button { margin-left: 0; }
}

/* ---- Computadora del agente v2: vista en vivo, plan, aprobación y control manual ---- */
.ab-clock { display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 4px 8px; border-radius: var(--r-pill); background: #23222a; font-size: var(--fs-xs); color: #d9d8de; font-variant-numeric: tabular-nums; }
.ab-clock svg { width: 13px; height: 13px; }
.ab-clock.low { background: #3a1d1d; color: #fecaca; }
.ab-pill[data-kind="wait"] .ab-dot { background: #fbbf24; }
.ab-pill[data-kind="you"] .ab-dot { background: #9fff00; animation: none; }
.ab-btn.ab-stop svg { width: 14px; height: 14px; color: #f87171; }
.ab-addr { display: flex; align-items: center; gap: 6px; margin: 0 10px 6px; padding: 5px 10px; border-radius: 10px; background: #0e0e12; color: #a7a6ae; font-size: var(--fs-xs); min-width: 0; }
.ab-addr svg { width: 12px; height: 12px; flex: none; color: #4ade80; }
.ab-addr-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-view.is-live { aspect-ratio: var(--ab-ar, 16 / 10); max-height: 70vh; place-items: stretch; }
.ab-view.is-live[data-device="mobile"] { max-width: 420px; margin-inline: auto; width: calc(100% - 20px); max-height: 78vh; }
.ab-view.is-live .ab-frame { object-fit: contain; object-position: top center; background: #fff; }
.ab-scan { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, transparent, #e6c579, transparent); opacity: 0; pointer-events: none; }
.ab-view.is-busy .ab-scan { opacity: 1; animation: ab-scan 1.6s linear infinite; }
@keyframes ab-scan { from { transform: translateY(0); } to { transform: translateY(calc(70vh - 3px)); } }
.ab-view.is-takeover { outline: 2px solid #9fff00; outline-offset: -2px; }
.ab-view.is-takeover .ab-frame { cursor: crosshair; }
.ab-tap { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; border: 2px solid #9fff00; pointer-events: none; animation: ab-tap .6s ease-out forwards; }
@keyframes ab-tap { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.ab-controls { display: flex; gap: 8px; padding: 8px 10px 0; flex-wrap: wrap; }
.ab-tbtn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid #34333b; background: #23222a; color: #f2f1ee; font-size: var(--fs-xs); font-weight: 650; cursor: pointer; }
.ab-tbtn svg { width: 15px; height: 15px; }
.ab-tbtn:hover { background: #2d2c35; }
.ab-tbtn.on { background: #9fff00; color: #16151a; border-color: #9fff00; }
.ab-tbtn-stop { margin-left: auto; color: #fecaca; border-color: #4a2a2a; }
.ab-tbtn-stop svg { color: #f87171; }
.ab-tbtn:focus-visible, .ab-key:focus-visible { outline: 2px solid #e6c579; outline-offset: 1px; }
.ab-kb { margin: 8px 10px 0; padding: 10px; border-radius: 14px; background: #0e0e12; display: grid; gap: 8px; }
.ab-kb[hidden] { display: none; }
.ab-kb-tip { margin: 0; display: flex; gap: 6px; align-items: flex-start; font-size: var(--fs-xs); color: #b9b8c0; line-height: 1.45; }
.ab-kb-tip svg { width: 13px; height: 13px; flex: none; margin-top: 2px; color: #4ade80; }
.ab-kb-row { display: flex; gap: 6px; }
.ab-kb-in { flex: 1 1 auto; min-width: 0; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid #34333b; background: #16151a; color: #fff; font-size: 16px; }
.ab-kb-in:focus { outline: 2px solid #9fff00; outline-offset: 0; }
.ab-kb-eye { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; border: 1px solid #34333b; background: #16151a; color: #c9c8ce; cursor: pointer; }
.ab-kb-eye svg { width: 16px; height: 16px; }
.ab-kb-send { flex: none; }
.ab-kb-keys { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ab-key { min-width: 40px; height: 34px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid #34333b; background: #23222a; color: #e4e3e8; font-size: var(--fs-xs); font-weight: 600; cursor: pointer; }
.ab-key svg { width: 15px; height: 15px; }
.ab-key-down svg { transform: rotate(180deg); }
.ab-kb-back { margin-left: auto; --b-bg: #9fff00; --b-fg: #16151a; --b-line: #9fff00; }
.ab-notice { margin: 8px 10px 0; padding: 10px 12px; border-radius: 12px; display: flex; gap: 8px; align-items: flex-start; background: #23222a; font-size: var(--fs-sm); flex-wrap: wrap; }
.ab-notice[hidden] { display: none; }
.ab-notice > span svg { width: 16px; height: 16px; color: #e6c579; }
.ab-notice p { margin: 0; flex: 1 1 200px; color: #e4e3e8; line-height: 1.45; }
.ab-notice[data-kind="help"] { background: #fff7e0; color: #16151a; }
.ab-notice[data-kind="help"] p { color: #3b3a40; }
.ab-notice .btn { --b-bg: #16151a; --b-fg: #fff; --b-line: #16151a; }
.ab-approval .ap-why { margin: 0; }
.ab-plan { margin: 8px 10px 0; padding: 10px 12px; border-radius: 12px; background: #1d1c23; }
.ab-plan[hidden] { display: none; }
.ab-plan-h { display: flex; justify-content: space-between; align-items: center; font-size: var(--fs-xs); margin-bottom: 6px; }
.ab-plan-h .muted { color: #8d8c95; font-variant-numeric: tabular-nums; }
.ab-plan ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: var(--fs-sm); }
.ab-plan li { display: flex; gap: 8px; align-items: flex-start; color: #a7a6ae; line-height: 1.35; }
.ab-plan li.ok { color: #f2f1ee; }
.ab-plan li.cur { color: #fff; font-weight: 600; }
.ab-ck { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 1.5px solid #4a4952; display: grid; place-items: center; margin-top: 1px; }
.ab-plan li.ok .ab-ck { background: #4ade80; border-color: #4ade80; color: #0b2a16; }
.ab-plan li.cur .ab-ck { border-color: #e6c579; animation: ab-pulse 1.4s ease-in-out infinite; }
.ab-ck svg { width: 12px; height: 12px; }
.ab-res-h { display: flex; gap: 6px; align-items: center; }
.ab-res-h svg { width: 16px; height: 16px; color: #4ade80; }
.ab-result small { display: block; margin-top: 6px; color: #8d8c95; }
.ab-card.is-full .ab-view.is-live { max-height: none; flex: 1 1 auto; aspect-ratio: auto; min-height: 45vh; }
@media (max-width: 520px) {
  .ab-clock { padding: 4px 6px; }
  .ab-tbtn { flex: 1 1 auto; justify-content: center; }
  .ab-tbtn-stop { margin-left: 0; }
  .ab-kb-back { margin-left: 0; flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) { .ab-scan, .ab-tap, .ab-plan li.cur .ab-ck { animation: none !important; } }
/* Personaje animado 2.5D (2026-11-09): poses que se funden + capas de boca/ojos/cejas sincronizadas con la voz */
.char-stage { --lvl: 0; position: relative; overflow: hidden; isolation: isolate; background: radial-gradient(120% 85% at 50% 55%, #d6d9e3 0%, #cdd1dc 45%, #b9bdcd 100%); }
.char-stage .ch-body { position: absolute; inset: 0; transform-origin: 50% 100%; will-change: transform; }
.char-stage .ch-figure { position: absolute; left: 0; top: 0; }
.char-stage .ch-pose { position: absolute; inset: 0; opacity: 0; transition: opacity .32s cubic-bezier(.4, 0, .2, 1); }
.char-stage .ch-pose[data-on] { opacity: 1; }
.char-stage .ch-pose img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: fill; user-select: none; -webkit-user-drag: none; }
.char-stage .ch-face { position: absolute; inset: 0; pointer-events: none; }
.char-stage .ch-layer { position: absolute; display: block; opacity: 0; pointer-events: none; user-select: none; }
.char-stage .avatar-status { position: absolute; z-index: 3; left: 12px; bottom: 12px; padding: 5px 12px; border-radius: 999px; background: rgba(22, 21, 26, .78); color: #fff; font-weight: 700; font-size: 13px; backdrop-filter: blur(6px); }
.char-stage .avatar-status:empty { display: none; }
.char-stage[data-state="listening"] { box-shadow: inset 0 0 0 2px rgba(159, 255, 0, .55); }
.char-stage[data-state="thinking"] { box-shadow: inset 0 0 0 2px rgba(196, 140, 255, .45); }
.agent-av:not(.is-3d) { background: #cdd1dc; }
@media (prefers-reduced-motion: reduce) { .char-stage .ch-pose { transition-duration: .01s; } }
/* Miradas del personaje (seguimiento del cursor en la portada) */
.char-stage .ch-look { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; user-select: none; -webkit-user-drag: none; }
/* Personaje con manos por capas (2026-11-09): cuerpo fijo + antebrazos que siempre están y se mueven con transformaciones */
.char-stage .ch-arms { position: absolute; inset: 0; pointer-events: none; }
.char-stage .ch-armb, .char-stage .ch-armh { position: absolute; display: block; pointer-events: none; user-select: none; -webkit-user-drag: none; will-change: transform, opacity; backface-visibility: hidden; }
.char-stage .ch-mouth { transform-origin: 50% 0; will-change: opacity, transform; }
.char-rig.ch-narrow .ch-figure { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 3%, #000 97%, transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 3%, #000 97%, transparent 100%); }
.char-rig .avatar-status { top: 10px; bottom: auto; left: 10px; }
.agent-av .agent-av-status { top: 10px; bottom: auto; }
.char-rig.ch-short .ch-figure { -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 5%); mask-image: linear-gradient(180deg, transparent 0, #000 5%); }
.char-rig.ch-short.ch-narrow .ch-figure { -webkit-mask-image: none; mask-image: none; }
