/* ============================================================================
 * Breiko Fleet · Asistente IA (js/asistente.js)
 * Usa las variables de portal.css para seguir el tema del portal.
 * ==========================================================================*/

.ia-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 20px;
    height: calc(100vh - var(--topbar-height) - 64px);
    min-height: 480px;
}

/* ── Chat ─────────────────────────────────────────────────────────────── */
.ia-chat {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 14px;
    overflow: hidden;
}
.ia-mensajes {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.ia-msg { display: flex; flex-direction: column; max-width: 860px; }
.ia-usuario { align-self: flex-end; align-items: flex-end; max-width: 75%; }
.ia-asistente { align-self: flex-start; width: 100%; }
.ia-burbuja {
    padding: 11px 15px;
    border-radius: 14px;
    font-size: var(--letra-md);
    line-height: 1.55;
    color: var(--text-primary);
    word-wrap: break-word;
}
.ia-usuario .ia-burbuja {
    background: var(--accent-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.ia-asistente .ia-burbuja {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-bottom-left-radius: 4px;
    max-width: 760px;
}
.ia-burbuja p { margin: 0; }
.ia-burbuja ul { margin: 4px 0; padding-left: 20px; }
.ia-burbuja li { margin: 2px 0; }
.ia-burbuja strong { color: var(--text-primary); font-weight: 600; }
.ia-sep { height: 8px; }

.ia-pensando { display: inline-flex; gap: 5px; padding: 14px 16px; width: auto; }
.ia-pensando span {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--text-muted);
    animation: iaPunto 1.2s infinite ease-in-out;
}
.ia-pensando span:nth-child(2) { animation-delay: .15s; }
.ia-pensando span:nth-child(3) { animation-delay: .3s; }
@keyframes iaPunto { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* ── Bienvenida ───────────────────────────────────────────────────────── */
.ia-bienvenida { margin: auto; max-width: 560px; text-align: center; padding: 24px 8px; }
.ia-logo { font-size: var(--letra-4xl); margin-bottom: 8px; }
.ia-bienvenida h3 { margin: 0 0 8px; font-size: var(--letra-xl); color: var(--text-primary); }
.ia-bienvenida p { margin: 0 0 18px; color: var(--text-secondary); font-size: var(--letra-md); line-height: 1.55; }
.ia-sugerencias { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ia-sugerencias button {
    background: var(--accent-primary-dim);
    color: var(--text-primary);
    border: 1px solid var(--border-accent);
    border-radius: 18px;
    padding: 7px 14px;
    font-size: var(--letra-sm);
    cursor: pointer;
    font-family: inherit;
}
.ia-sugerencias button:hover { border-color: var(--accent-primary); }

/* ── Entrada ──────────────────────────────────────────────────────────── */
.ia-entrada {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    padding: 14px 16px 8px;
    border-top: 1px solid var(--border-subtle);
}
.ia-entrada textarea {
    flex: 1;
    resize: none;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 11px 14px;
    font-size: var(--letra-md);
    font-family: inherit;
    line-height: 1.45;
    max-height: 160px;
    outline: none;
}
.ia-entrada textarea:focus { border-color: var(--accent-primary); }
.ia-enviar { padding: 11px 20px; }
.ia-aviso { padding: 0 16px 12px; font-size: var(--letra-2xs); color: var(--text-muted); }

/* ── Tarjetas ─────────────────────────────────────────────────────────── */
.ia-tarjetas { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; max-width: 760px; }
.ia-tarjeta {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 12px 14px;
}
.ia-t-titulo { font-size: var(--letra-xs); font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.ia-t-vacia, .ia-t-pie { font-size: var(--letra-sm); color: var(--text-muted); }
.ia-t-pie { margin-top: 6px; font-size: var(--letra-xs); }
.ia-tabla-scroll { overflow-x: auto; max-height: 320px; overflow-y: auto; }
.ia-tabla { width: 100%; border-collapse: collapse; font-size: var(--letra-sm); }
.ia-tabla th {
    text-align: left; font-weight: 600; color: var(--text-muted); font-size: var(--letra-2xs);
    padding: 6px 10px 6px 0;
    border-bottom: 1px solid var(--border-card); position: sticky; top: 0; background: var(--bg-surface);
}
.ia-tabla td { padding: 7px 10px 7px 0; color: var(--text-primary); border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.ia-tabla tr:last-child td { border-bottom: none; }
.ia-grafico { position: relative; height: 220px; }
/* Mapa de calor de zonas (06/10/2026) */
.ia-tarjeta-mapa { max-width: 640px; }
.ia-mapa { height: 300px; border-radius: 10px; overflow: hidden; margin-top: 6px; background: var(--bg-tertiary, #0F172A); }
.ia-zonas { margin: 10px 0 0; padding: 0; list-style: none; counter-reset: z; display: grid; gap: 4px; }
.ia-zonas li { counter-increment: z; display: flex; justify-content: space-between; gap: 12px; font-size: var(--letra-sm); padding: 4px 8px; border-radius: 6px; background: var(--bg-tertiary, rgba(255,255,255,.04)); }
.ia-zonas li span::before { content: counter(z) ". "; color: var(--text-secondary, #94a3b8); }
.ia-zonas li span { flex: 1; min-width: 0; }
.ia-zonas li em { font-style: normal; color: var(--text-secondary, #94a3b8); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ia-zonas li b { font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }

.ia-propuesta { border-left: 3px solid var(--accent-primary); }
.ia-p-estado { font-size: var(--letra-2xs); font-weight: 600; color: var(--accent-primary); margin-bottom: 4px; }
.ia-p-titulo { font-size: var(--letra-md); color: var(--text-primary); line-height: 1.45; }
.ia-p-botones { display: flex; gap: 8px; margin-top: 10px; }
.ia-p-detalle {
    display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px;
    margin: 10px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--bg-card); font-size: var(--letra-sm);
}
.ia-p-detalle dt { color: var(--text-muted); }
.ia-p-detalle dd { margin: 0; color: var(--text-primary); word-break: break-word; }
@media (max-width: 520px) { .ia-p-detalle { grid-template-columns: 1fr; } .ia-p-detalle dd { margin-bottom: 4px; } }
.ia-estado-ejecutada { border-left-color: var(--accent-green); }
.ia-estado-ejecutada .ia-p-estado { color: var(--accent-green); }
.ia-estado-rechazada, .ia-estado-caducada, .ia-estado-deshecha { border-left-color: var(--text-muted); opacity: .75; }
.ia-estado-rechazada .ia-p-estado, .ia-estado-caducada .ia-p-estado, .ia-estado-deshecha .ia-p-estado { color: var(--text-muted); }
.ia-estado-error { border-left-color: var(--accent-red); }
.ia-estado-error .ia-p-estado { color: var(--accent-red); }

/* ── Panel lateral ────────────────────────────────────────────────────── */
.ia-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 14px;
    overflow: hidden;
}
.ia-tabs { display: flex; border-bottom: 1px solid var(--border-subtle); }
.ia-tabs button {
    flex: 1; background: none; border: none; color: var(--text-secondary);
    padding: 12px 6px; font-size: var(--letra-sm); cursor: pointer; font-family: inherit;
    border-bottom: 2px solid transparent;
}
.ia-tabs button.activa { color: var(--accent-primary); border-bottom-color: var(--accent-primary); }
.ia-panel-cuerpo { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.ia-panel-intro { margin: 0 0 6px; font-size: var(--letra-xs); color: var(--text-muted); line-height: 1.5; }
.ia-item {
    display: flex; gap: 10px; align-items: center; justify-content: space-between;
    background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 10px; padding: 10px 12px;
}
.ia-item-texto { font-size: var(--letra-sm); color: var(--text-primary); line-height: 1.4; }
.ia-item-meta { font-size: var(--letra-2xs); color: var(--text-muted); margin-top: 4px; }
.ia-quitar { background: none; border: none; color: var(--text-muted); font-size: var(--letra-xl); cursor: pointer; line-height: 1; }
.ia-quitar:hover { color: var(--accent-red); }
.ia-permiso { flex-direction: column; align-items: stretch; cursor: default; }
.ia-permiso select {
    background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border-card);
    border-radius: 8px; padding: 7px 8px; font-size: var(--letra-sm); font-family: inherit;
}
.ia-chip { display: inline-block; padding: 1px 7px; border-radius: 8px; font-size: var(--letra-2xs); font-weight: 600; background: var(--bg-elevated); color: var(--text-secondary); }
.ia-chip-ejecutada { background: var(--accent-green-dim); color: var(--accent-green); }
.ia-chip-propuesta { background: var(--accent-primary-dim); color: var(--accent-primary); }
.ia-chip-error { background: var(--accent-red-dim); color: var(--accent-red); }
.ia-vacio { font-size: var(--letra-sm); color: var(--text-muted); text-align: center; padding: 16px 0; }

.nav-beta {
    margin-left: auto; font-size: var(--letra-2xs); font-weight: 700; letter-spacing: .05em;
    padding: 2px 6px; border-radius: 6px; background: var(--accent-primary-dim); color: var(--accent-primary);
}

@media (max-width: 1100px) {
    .ia-layout { grid-template-columns: 1fr; height: auto; }
    .ia-chat { height: calc(100vh - var(--topbar-height) - 64px); min-height: 460px; }
    .ia-panel { max-height: 420px; }
}
@media (max-width: 768px) {
    .ia-mensajes { padding: 14px; }
    .ia-usuario { max-width: 90%; }
    .ia-chat { height: calc(100vh - var(--topbar-height) - 32px); }
}

/* ── Adjuntar archivos (importador) ───────────────────────────────────── */
.ia-adjuntar {
    background: var(--bg-input);
    border: 1px solid var(--border-card);
    color: var(--text-secondary);
    border-radius: 12px;
    width: 44px;
    height: 44px;
    font-size: var(--letra-xl);
    cursor: pointer;
    flex-shrink: 0;
}
.ia-adjuntar:hover { border-color: var(--accent-primary); color: var(--accent-primary); }

/* ============================================================================
 * Chat estilo ChatGPT (06/10/2026)
 * Barra lateral con conversaciones · columna central de 760 px · respuestas
 * sin burbuja con avatar · caja de texto redondeada flotante · streaming.
 * ==========================================================================*/
.page-content:has(> .ia2) { padding: 0; }
.ia2 {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    height: calc(100vh - var(--topbar-height));
    min-height: 480px;
    position: relative;
    background: var(--bg-base);
}

/* ── Barra lateral ── */
.ia2-lateral {
    display: flex; flex-direction: column; gap: 6px; min-height: 0;
    padding: 12px 10px; background: rgba(2, 6, 23, .55); border-right: 1px solid var(--border-subtle);
}
.ia2-nueva, .ia2-ajustes {
    display: flex; align-items: center; gap: 10px; width: 100%;
    background: transparent; border: 1px solid var(--border-card); color: var(--text-primary);
    border-radius: 12px; padding: 10px 12px; font-family: inherit; font-size: var(--letra-md); font-weight: 500; line-height: 1.2; cursor: pointer; text-align: left;
    transition: background var(--transition-fast);
}
.ia2-nueva:hover, .ia2-ajustes:hover { background: var(--bg-surface); }
.ia2-ajustes { border-color: transparent; color: var(--text-secondary); margin-top: 4px; }
.ia2-lista { flex: 1; overflow-y: auto; margin: 8px -4px 0; padding: 0 4px; }
.ia2-lista-vacia { color: var(--text-muted); font-size: var(--letra-sm); padding: 12px 8px; }
.ia2-grupo { font-size: var(--letra-2xs); font-weight: 600; color: var(--text-muted); padding: 14px 10px 6px; }
.ia2-conv {
    display: block; width: 100%; text-align: left; background: none; border: none; color: var(--text-secondary);
    padding: 8px 10px; border-radius: 9px; font-family: inherit; font-size: var(--letra-md); line-height: 1.3; cursor: pointer;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ia2-conv:hover { background: var(--bg-surface); color: var(--text-primary); }
.ia2-conv.activa { background: var(--bg-elevated); color: var(--text-primary); }

/* ── Principal ── */
.ia2-principal { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.ia2-cabecera {
    display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 16px;
    border-bottom: 1px solid var(--border-subtle);
}
.ia2-titulo { flex: 1; font-weight: 600; font-size: var(--letra-lg); color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ia2-scroll { flex: 1; overflow-y: auto; scroll-behavior: auto; }
.ia2-columna { max-width: 780px; margin: 0 auto; padding: 28px 24px 12px; display: flex; flex-direction: column; gap: 26px; }

.ia2-boton-icono {
    display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
    border-radius: 50%; border: none; background: transparent; color: var(--text-secondary); cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.ia2-boton-icono:hover { background: var(--bg-elevated); color: var(--text-primary); }
.ia2-solo-movil { display: none; }
.ia2-solo-escritorio { display: inline-flex; margin-left: -8px; }
.ia2 { transition: grid-template-columns .25s ease; }
.ia2.ia2-sin-lista { grid-template-columns: 0 minmax(0, 1fr); }
.ia2.ia2-sin-lista .ia2-lateral { visibility: hidden; padding: 0; border: none; overflow: hidden; }
.ia2.ia2-sin-lista.ia2-vacia .ia2-cabecera { left: 0; }

/* ── Mensajes ── */
.ia2-msg { display: flex; gap: 14px; }
@keyframes ia2Entrar { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ia2-usuario { justify-content: flex-end; }
.ia2-usuario .ia2-burbuja {
    max-width: 78%; background: var(--bg-surface); color: var(--text-primary);
    padding: 10px 16px; border-radius: 20px; font-size: var(--letra-lg); line-height: 1.55; word-wrap: break-word;
}
.ia2-avatar { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(255,255,255,.08); }
.ia2-contenido { flex: 1; min-width: 0; padding-top: 3px; }
.ia2-texto { font-size: var(--letra-lg); line-height: 1.7; color: var(--text-primary); word-wrap: break-word; }
.ia2-texto p { margin: 0 0 12px; }
.ia2-texto p:last-child, .ia2-texto ul:last-child, .ia2-texto ol:last-child { margin-bottom: 0; }
.ia2-texto ul, .ia2-texto ol { margin: 0 0 12px; padding-left: 22px; }
.ia2-texto li { margin: 4px 0; }
.ia2-texto h4 { margin: 16px 0 8px; font-size: var(--letra-lg); }
.ia2-texto strong { font-weight: 600; color: #fff; }
.ia2-texto code { background: var(--bg-surface); padding: 1px 6px; border-radius: 6px; font-size: var(--letra-sm); }
/* Cursor mientras escribe */
.ia2-escribiendo > :last-child::after, .ia2-escribiendo:empty::after {
    content: ''; display: inline-block; width: 9px; height: 9px; margin-left: 4px; border-radius: 50%;
    background: var(--text-primary); vertical-align: middle; animation: ia2Latido 1s infinite ease-in-out;
}
@keyframes ia2Latido { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }
/* «Buscando la dirección…» con brillo que recorre el texto */
.ia2-estado span {
    font-size: var(--letra-lg); font-weight: 500;
    color: var(--text-secondary);
    animation: ia2Pulso 1.6s ease-in-out infinite;
}
@keyframes ia2Pulso { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ia2-estado span { animation: none; } }

.ia2-acciones { display: flex; gap: 2px; margin-top: 8px; opacity: 0; transition: opacity var(--transition-fast); }
.ia2-msg:hover .ia2-acciones, .ia2-acciones.siempre { opacity: 1; }
.ia2-acciones button {
    width: 30px; height: 30px; border: none; border-radius: 8px; background: transparent;
    color: var(--text-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.ia2-acciones button svg { width: 16px; height: 16px; }
.ia2-acciones button:hover { background: var(--bg-surface); color: var(--text-primary); }
.ia2-acciones button.marcado { color: var(--accent-primary); }

.ia2 .ia-tarjetas { max-width: 100%; margin-top: 14px; }
.ia2 .ia-tarjeta { background: var(--bg-surface); border-radius: 14px; }

/* ── Bienvenida (conversación vacía: la caja sube al centro, como ChatGPT) ── */
.ia2-bienvenida { text-align: center; padding: 6vh 0 0; }
.ia2-logo { width: 64px; height: 64px; border-radius: 50%; margin-bottom: 14px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35); }
.ia2-bienvenida h2 { font-size: var(--letra-3xl); font-weight: 600; margin: 0 0 22px; color: var(--text-primary); letter-spacing: -.01em; }
.ia2-sugerencias { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 640px; margin: 0 auto; }
.ia2-sugerencias button {
    text-align: left; background: transparent; border: 1px solid var(--border-card); color: var(--text-secondary);
    border-radius: 14px; padding: 12px 14px; font-family: inherit; font-size: var(--letra-md); line-height: 1.4; cursor: pointer; transition: var(--transicion-ui);
}
.ia2-sugerencias button:hover { background: var(--bg-surface); color: var(--text-primary); }
.ia2-vacia .ia2-scroll { flex: 0 1 auto; }
.ia2-vacia .ia2-principal { justify-content: center; }
.ia2-vacia .ia2-cabecera { position: absolute; top: 0; left: 264px; right: 0; border: none; }

/* ── Caja de texto ── */
.ia2-pie { padding: 8px 24px 14px; }
.ia2-caja {
    max-width: 780px; margin: 0 auto; background: var(--bg-surface); border: 1px solid var(--border-card);
    border-radius: 26px; padding: 12px 12px 8px 18px; box-shadow: var(--shadow-md); transition: border-color var(--transition-fast);
}
.ia2-caja:focus-within { border-color: rgba(255,255,255,.22); }
.ia2-caja textarea {
    width: 100%; resize: none; border: none; outline: none; background: transparent; color: var(--text-primary);
    font-family: inherit; font-size: var(--letra-lg); line-height: 1.5; max-height: 200px; padding: 2px 0 6px;
}
.ia2-caja textarea::placeholder { color: var(--text-muted); }
.ia2-caja-botones { display: flex; align-items: center; gap: 4px; margin-left: -8px; }
.ia2-hueco { flex: 1; }
.ia2-enviar {
    width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer;
    background: var(--text-primary); color: var(--bg-base); display: inline-flex; align-items: center; justify-content: center;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.ia2-enviar:disabled { opacity: .3; cursor: default; }
.ia2-enviar:not(:disabled):hover { transform: scale(1.05); }
#ia-mic.grabando { color: #fff; background: var(--accent-red); animation: ia2Pulso 1.2s infinite; }
@keyframes ia2Pulso { 0% { box-shadow: 0 0 0 0 rgba(239,83,80,.55); } 70% { box-shadow: 0 0 0 10px rgba(239,83,80,0); } 100% { box-shadow: 0 0 0 0 rgba(239,83,80,0); } }
.ia2-aviso { text-align: center; font-size: var(--letra-2xs); color: var(--text-muted); margin-top: 8px; }

/* ── Cajón de ajustes (normas, acciones, permisos) ── */
.ia2-cajon { position: fixed; inset: 0; z-index: 1200; pointer-events: none; display: none; }
.ia2-cajon.visible { display: block; }
.ia2-cajon-fondo { position: absolute; inset: 0; background: rgba(0,0,0,.45); opacity: 0; transition: opacity var(--transition-normal); }
.ia2-cajon-panel {
    position: absolute; top: 0; right: 0; bottom: 0; width: min(400px, 100%); background: var(--bg-base);
    border-left: 1px solid var(--border-card); display: flex; flex-direction: column;
    transform: translateX(100%); transition: transform var(--transition-normal);
}
.ia2-cajon.abierto { pointer-events: auto; }
.ia2-cajon.abierto .ia2-cajon-fondo { opacity: 1; }
.ia2-cajon.abierto .ia2-cajon-panel { transform: none; }
.ia2-cajon-cab { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border-subtle); }

/* ── Móvil ── */
.ia2-velo { display: none; }
@media (max-width: 1100px) {
    .ia2 { grid-template-columns: minmax(0, 1fr); height: calc(100vh - var(--topbar-height)); }
    .ia2-lateral {
        position: absolute; z-index: 30; top: 0; bottom: 0; left: 0; width: 280px; background: var(--bg-base);
        transform: translateX(-100%); transition: transform var(--transition-normal);
    }
    .ia2-menu-abierto .ia2-lateral { transform: none; box-shadow: var(--shadow-lg); }
    .ia2-menu-abierto .ia2-velo { display: block; position: absolute; inset: 0; z-index: 20; background: rgba(0,0,0,.4); }
    .ia2-solo-movil { display: inline-flex; }
    .ia2-solo-escritorio { display: none; }
    .ia2.ia2-sin-lista { grid-template-columns: minmax(0, 1fr); }
    .ia2.ia2-sin-lista .ia2-lateral { visibility: visible; padding: 12px 10px; }
    .ia2-vacia .ia2-cabecera { left: 0; }
    .ia2-columna { padding: 18px 14px 8px; }
    .ia2-pie { padding: 6px 10px 10px; }
    .ia2-sugerencias { grid-template-columns: 1fr; }
    .ia2-bienvenida h2 { font-size: var(--letra-xl); }
    .ia2-usuario .ia2-burbuja { max-width: 88%; }
    .ia2-avatar { display: none; }
    .ia2-acciones { opacity: 1; }
}

/* Fuentes de internet bajo la respuesta (07/10/2026) */
.ia2-fuentes { margin-top: 10px; }
.ia2-fuentes-tit { font-size: var(--letra-xs); font-weight: 600; color: var(--text-secondary, #8291a8); margin-bottom: 6px; }
.ia2-fuentes-lista { display: flex; flex-wrap: wrap; gap: 8px; }
.ia2-fuente { display: flex; align-items: center; gap: 8px; max-width: 260px; padding: 6px 10px; border-radius: 10px;
  border: 1px solid var(--border-subtle, rgba(255,255,255,.1)); background: rgba(255,255,255,.04); color: inherit; text-decoration: none; transition: background .15s, border-color .15s; }
.ia2-fuente:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.22); }
.ia2-fuente-ini { flex: 0 0 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: var(--letra-2xs); font-weight: 700;
  background: rgba(0,159,227,.18); color: #7dd3fc; }
.ia2-fuente-txt { display: flex; flex-direction: column; min-width: 0; }
.ia2-fuente-txt b { font-size: var(--letra-xs); font-weight: 600; }
.ia2-fuente-txt span { font-size: var(--letra-2xs); color: var(--text-secondary, #8291a8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Archivos adjuntos (13/10/2026): se preparan encima de la caja y se envían con el mensaje */
.ia2-adjuntos { display: flex; flex-wrap: wrap; gap: 6px; }
.ia2-adjuntos:not(:empty) { margin: 0 0 8px -6px; }
.ia2-adjuntos.enviados { justify-content: flex-end; margin: 0 0 6px; }
.ia2-adjunto { display: inline-flex; align-items: center; gap: 6px; max-width: 260px; padding: 6px 8px 6px 10px; border-radius: 12px;
  background: var(--bg-elevated); border: 1px solid var(--border-card); color: var(--text-primary); font-size: var(--letra-sm); }
.ia2-adjunto svg { width: 16px; height: 16px; flex: 0 0 16px; color: var(--text-secondary); }
.ia2-adjunto span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ia2-adjunto button { border: none; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: var(--letra-lg); line-height: 1; padding: 0 2px; }
.ia2-adjunto button:hover { color: var(--text-primary); }
.ia2-usuario { flex-direction: column; align-items: flex-end; }
.ia2-reloj { color: var(--text-muted); font-variant-numeric: tabular-nums; }
/* Tablas que escribe el asistente en markdown */
.ia2-tabla-md { overflow-x: auto; margin: 10px 0 14px; border: 1px solid var(--border-card); border-radius: 12px; }
.ia2-tabla-md table { width: 100%; border-collapse: collapse; font-size: var(--letra-md); }
.ia2-tabla-md th { text-align: left; font-weight: 600; color: var(--text-secondary); background: var(--bg-surface); padding: 8px 12px; border-bottom: 1px solid var(--border-card); white-space: nowrap; }
.ia2-tabla-md td { padding: 8px 12px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.ia2-tabla-md tr:last-child td { border-bottom: none; }
.ia2-tabla-md .der { text-align: right; }

/* ============================================================================
 * BreikIA (15/10/2026): uso gratuito del mes, tarjeta de Pro, ventana de
 * novedad y panel de consumo de la administración.
 * ==========================================================================*/
.ia2-sub { max-width: 560px; margin: -12px auto 22px; font-size: var(--letra-md); line-height: 1.5; color: var(--text-secondary); }

/* Barra de uso bajo la caja de texto */
.ia2-uso { max-width: 780px; margin: 8px auto 0; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; font-size: var(--letra-xs); color: var(--text-muted); }
.ia2-uso:empty { display: none; }
.ia2-uso-barra { width: 140px; height: 6px; border-radius: 3px; background: var(--border-card); overflow: hidden; display: inline-block; }
.ia2-uso-barra > span { display: block; height: 100%; border-radius: 3px; background: var(--accent-primary); transition: width .4s ease; }
.ia2-uso-medio .ia2-uso-barra > span { background: #F5A100; }
.ia2-uso-alto .ia2-uso-barra > span { background: var(--accent-red, #EF5350); }
.ia2-uso-pct { font-variant-numeric: tabular-nums; min-width: 34px; }
.ia2-uso-enlace { background: none; border: none; padding: 0; color: var(--accent-primary); font: inherit; font-weight: 600; cursor: pointer; }
.ia2-uso-enlace:hover { text-decoration: underline; }
.ia2-uso-lleno { color: var(--text-secondary); }
.ia2-uso-boton { border: none; border-radius: 999px; padding: 6px 14px; font: inherit; font-weight: 700; cursor: pointer; color: #fff; background: var(--accent-primary); }
.ia2-uso-pro-chip { font-weight: 700; color: var(--text-secondary); }

/* Tarjeta de BreikIA Pro (al acabarse el uso gratuito) */
.ia-tarjeta.bk-pro { border: 1px solid var(--border-accent); background: var(--bg-surface); padding: 16px 18px; }
.bk-pro-cab { font-size: var(--letra-lg); font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.bk-pro-lista { margin: 0 0 14px; padding-left: 18px; font-size: var(--letra-md); line-height: 1.6; color: var(--text-secondary); }
.bk-pro-botones { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.bk-pro-botones .btn-primary { background: var(--accent-primary); border: none; }

/* Ventana de novedad */
.bk-nov { text-align: center; padding: 8px 6px 2px; max-width: 460px; margin: 0 auto; }
.bk-nov-logo { width: 64px; height: 64px; border-radius: 50%; }
.bk-nov h2 { margin: 14px 0 10px; font-size: var(--letra-xl); line-height: 1.3; color: var(--text-primary); }
.bk-nov p { margin: 0 0 22px; font-size: var(--letra-lg); line-height: 1.55; color: var(--text-secondary); }
.bk-nov-boton { padding: 12px 28px; font-size: var(--letra-lg); font-weight: 700; border-radius: 12px; border: none; background: var(--accent-primary); }
.bk-nov-check { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; font-size: var(--letra-sm); color: var(--text-muted); cursor: pointer; }
.bk-nov-check input { width: auto; margin: 0; }

/* Administración · uso de BreikIA de una empresa */
.bka-caja { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md, 12px); padding: 16px 18px; margin-bottom: 20px; }
.bka-cargando, .bka-gris { color: var(--text-muted); font-size: var(--letra-sm); }
.bka-cab { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.bka-chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: var(--letra-2xs); font-weight: 600; background: var(--bg-input); color: var(--text-secondary); border: 1px solid var(--border-subtle); }
.bka-chip-pro { background: var(--accent-primary-dim); color: var(--accent-primary); border-color: var(--border-accent); }
.bka-enganche { margin-left: 4px; }
.bka-rojo { color: var(--accent-red, #EF5350); font-weight: 700; }
.bka-naranja { color: #F5A100; font-weight: 700; }
.bka-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.bka-kpis > div { background: var(--bg-input); border-radius: var(--radius-sm, 8px); padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bka-kpis small { font-size: var(--letra-2xs); color: var(--text-muted); }
.bka-kpis b { font-size: var(--letra-xl); color: var(--text-primary); font-variant-numeric: tabular-nums; }
.bka-barra { height: 6px; border-radius: 3px; background: var(--border-subtle); overflow: hidden; margin-top: 4px; }
.bka-barra > span { display: block; height: 100%; background: var(--accent-primary); }
.bka-barra > span.bka-tope { background: var(--accent-red, #EF5350); }
.bka-sec { margin: 16px 0 8px; font-size: var(--letra-2xs); font-weight: 700; color: var(--text-muted); }
.bka-graf { position: relative; display: flex; align-items: flex-end; gap: 6px; height: 92px; margin-bottom: 22px; border-bottom: 1px solid var(--border-subtle); }
.bka-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; min-width: 0; }
.bka-col span { position: absolute; bottom: -17px; font-size: var(--letra-2xs); color: var(--text-muted); }
.bka-barra-v { width: 100%; max-width: 26px; background: var(--accent-primary); border-radius: 4px 4px 0 0; }
.bka-barra-v.bka-tope { background: var(--accent-red, #EF5350); }
.bka-linea-tope { position: absolute; left: 0; right: 0; border-top: 1px dashed rgba(239,83,80,.6); pointer-events: none; }
.bka-convs { max-height: 260px; overflow-y: auto; }
.bka-conv { border-bottom: 1px solid var(--border-subtle); padding: 6px 0; font-size: var(--letra-sm); }
.bka-conv summary { cursor: pointer; color: var(--text-primary); }
.bka-conv ul { margin: 6px 0 2px; padding-left: 18px; color: var(--text-secondary); line-height: 1.5; }
.bka-chip + .mono { margin-left: 2px; }
@media (max-width: 768px) {
    .bka-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ia2-uso-barra { width: 100px; }
}

/* Planes y precios · BreikIA Pro: sin bloque propio desde el 07/11/2026 (va incluido en Breiko PRO). */
