/* ============================================================
   Agente IA de CodexWeb — FAB flotante global + panel de chat.
   Identidad: light "home banking", azul accent, monospace para montos.
   Versión funcional; el pulido fino lo hace codexer-designer.
   ============================================================ */

.codex-agente-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1400;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--accent, #1e40af);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(30, 64, 175, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.codex-agente-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(30, 64, 175, 0.45); }
.codex-agente-fab--open { background: #334155; }
.codex-agente-fab-icon { font-size: 24px; line-height: 1; }

/* ── Flyout (panel lateral) ──────────────────────────────── */
.codex-agente-flyout {
    position: fixed;
    right: 24px;
    bottom: 92px;
    z-index: 1399;
    width: 420px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px) scale(.98);
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}
.codex-agente-flyout--open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.codex-agente-flyout-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--accent, #1e40af);
    color: #fff;
}
.codex-agente-flyout-title { display: flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: .3px; }
.codex-agente-star { color: #fbbf24; font-size: 16px; }
.codex-agente-empresa {
    font-size: 11px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.18);
    padding: 2px 8px;
    border-radius: 999px;
    letter-spacing: .5px;
}
.codex-agente-flyout-actions { display: flex; gap: 4px; }
.codex-agente-flyout-btn {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 15px;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    transition: background .12s ease;
}
.codex-agente-flyout-btn:hover { background: rgba(255, 255, 255, 0.18); }

/* ── Panel interno (chat) ────────────────────────────────── */
.codex-agente-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; background: #f8fafc; }

.codex-agente-unavail { padding: 24px; color: var(--text-muted, #64748b); font-size: 13px; text-align: center; }

.codex-agente-chat { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }

.codex-agente-hint {
    color: var(--text-muted, #64748b);
    font-size: 12.5px;
    line-height: 1.6;
    background: #fff;
    border: 1px dashed var(--border, #e2e8f0);
    border-radius: 10px;
    padding: 12px;
}

.codex-agente-msg {
    max-width: 88%;
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}
.codex-agente-msg--user {
    align-self: flex-end;
    background: var(--accent, #1e40af);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.codex-agente-msg--assistant {
    align-self: flex-start;
    background: #fff;
    color: var(--text-primary, #0f172a);
    border: 1px solid var(--border, #e2e8f0);
    border-bottom-left-radius: 4px;
}
/* Montos/códigos legibles en monospace si el modelo los envuelve */
.codex-agente-msg--assistant code { font-family: var(--font-mono, ui-monospace, monospace); }
.codex-agente-pensando { color: var(--text-muted, #64748b); font-style: italic; }

/* ── Input ───────────────────────────────────────────────── */
.codex-agente-input-row {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 10px;
    border-top: 1px solid var(--border, #e2e8f0);
    background: #fff;
}
.codex-agente-textarea {
    flex: 1;
    resize: none;
    max-height: 120px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    padding: 9px 11px;
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    transition: border-color .12s ease;
}
.codex-agente-textarea:focus { border-color: var(--accent, #1e40af); }
.codex-agente-mic, .codex-agente-send {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border, #e2e8f0);
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.codex-agente-mic:hover { background: #f1f5f9; }
.codex-agente-mic--activo { background: #fee2e2; border-color: #ef4444; color: #ef4444; }
.codex-agente-send { background: var(--accent, #1e40af); color: #fff; border-color: var(--accent, #1e40af); }
.codex-agente-send:disabled, .codex-agente-mic:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 520px) {
    .codex-agente-flyout { right: 12px; left: 12px; width: auto; bottom: 84px; }
    .codex-agente-fab { right: 16px; bottom: 16px; }
}
