/* UNIPLIM-V3-MACRO-HF-ELISAMA-01 (A2, A3) — atividade e entrada automática. Padrão do Owner: IA pulsa azul, automação pulsa roxo. Novo padrão de movimento: registrar em DESIGN_GAPS. */
.is-activity-ai {
    --crm-activity: var(--uni-color-ai);
}
.is-activity-automation {
    --crm-activity: var(--uni-color-automation);
}

/* ── Balão "..." à direita ── */
.crm-activity-bubble { display: flex; flex-direction: column; align-items: flex-start; gap: var(--uni-space-1); min-height: 0; }
.crm-activity-bubble .crm-presence-dots i { background: var(--crm-activity); }
.crm-activity-author { display: inline-flex; align-items: center; gap: var(--uni-space-1); font-size: var(--uni-font-size-xs); font-weight: 600; color: var(--crm-activity); }

/* ── Borda e respiração: área das mensagens, campo de resposta e cartão da lista. Nada bloqueia clique. ── */
.crm-activity-surface { position: relative; }
.crm-activity-surface::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 2px; pointer-events: none; z-index: 1;
    background: linear-gradient(90deg, color-mix(in srgb, var(--crm-activity) 34%, transparent) 0%, var(--crm-activity) 22%, color-mix(in srgb, var(--crm-activity) 34%, transparent) 44%, color-mix(in srgb, var(--crm-activity) 34%, transparent) 100%);
    background-size: 220% 100%;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    animation: crm-activity-border 2.4s linear infinite;
}
.crm-message-stream-wrapper.crm-activity-surface::after {
    content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
    animation: crm-activity-received-inset 0.9s ease-out 1, crm-activity-glow-inset 2.2s ease-in-out 0.9s infinite;
}
.crm-composer.crm-activity-surface .crm-composer-row,
.crm-ticket-card.crm-activity-surface { animation: crm-activity-received 0.9s ease-out 1, crm-activity-glow 2.2s ease-in-out 0.9s infinite; }

@keyframes crm-activity-border { from { background-position: 120% 0; } to { background-position: -100% 0; } }
@keyframes crm-activity-glow { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 12px 1px color-mix(in srgb, var(--crm-activity) 26%, transparent); } }
@keyframes crm-activity-received { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--crm-activity) 55%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
@keyframes crm-activity-glow-inset { 0%, 100% { box-shadow: inset 0 0 0 0 transparent; } 50% { box-shadow: inset 0 0 26px 2px color-mix(in srgb, var(--crm-activity) 20%, transparent); } }
@keyframes crm-activity-received-inset { 0% { box-shadow: inset 0 0 0 0 color-mix(in srgb, var(--crm-activity) 60%, transparent); } 100% { box-shadow: inset 0 0 0 26px transparent; } }

/* ── Entrada e arraste automático ── */
.crm-auto-enter { animation: crm-auto-enter 400ms ease-out both; }
@keyframes crm-auto-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.crm-auto-pulse { position: relative; outline: 2px solid var(--crm-activity); outline-offset: 1px; animation: crm-activity-received 0.9s ease-out 1; }

.crm-auto-fly {
    position: fixed !important; margin: 0 !important; pointer-events: none; z-index: var(--uni-z-toast, 1100);
    outline: 2px solid var(--crm-activity); box-shadow: var(--uni-shadow-lg, 0 18px 44px rgba(0, 0, 0, .3));
    animation: crm-activity-received 0.9s ease-out 1;
}
.crm-auto-badge {
    position: absolute; top: -11px; left: var(--uni-space-3); display: inline-flex; align-items: center; height: 22px; padding: 0 var(--uni-space-2); white-space: nowrap;
    border-radius: var(--uni-radius-pill, 999px); font-size: var(--uni-font-size-xs); font-weight: 600;
    background: var(--uni-color-surface); color: var(--crm-activity); border: 1px solid var(--crm-activity);
}

/* ── Selo "IA atendendo" e faixa do resumo ── */
.crm-tag-chip-ai { color: var(--uni-color-ai); background: color-mix(in srgb, var(--uni-color-ai) 12%, transparent); }
.crm-brief-strip { background: var(--uni-color-primary-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--uni-color-primary) 28%, transparent); }
.crm-brief-strip .crm-ai-paused-strip-text { font-weight: 600; }
.brief--modal { gap: var(--uni-space-4); }
.brief--modal .brief-subject { font-size: var(--uni-font-size-md); }
.brief--modal .brief-text, .brief--modal .brief-next p, .brief--modal .brief-suggestions li { font-size: var(--uni-font-size-md); line-height: 1.5; }
.brief--modal .brief-suggestions .crm-icon { margin-top: 2px; color: var(--uni-color-primary); }

/* Redução de movimento: borda parada, sem pulso nem percurso (o voo nem começa, ver crm-auto-motion.js). */
@media (prefers-reduced-motion: reduce) {
    .crm-activity-surface::before, .crm-activity-surface::after,
    .crm-composer.crm-activity-surface .crm-composer-row, .crm-ticket-card.crm-activity-surface,
    .crm-auto-enter, .crm-auto-pulse, .crm-auto-fly { animation: none; }
    .crm-activity-surface::before { background: var(--crm-activity); }
}
