.afe-chat-widget {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1080;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.afe-chat-widget__launcher {
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(135deg, var(--afe-primary, #0f172a), var(--afe-accent, #2563eb));
    box-shadow: 0 20px 45px rgba(15, 23, 42, .25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.afe-chat-widget__launcher svg { width: 25px; height: 25px; }
.afe-chat-widget__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 24px;
    height: 24px;
    padding: 0 .4rem;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: .75rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}
.afe-chat-widget__panel {
    position: absolute;
    right: 0;
    bottom: 72px;
    width: min(860px, calc(100vw - 2rem));
    height: min(680px, calc(100vh - 7rem));
    background: #fff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .22);
    border: 1px solid rgba(15, 23, 42, .08);
}
.afe-chat-widget__header {
    height: 72px;
    padding: 1rem 1.25rem;
    color: #fff;
    background: linear-gradient(135deg, var(--afe-primary, #0f172a), var(--afe-secondary, #111827));
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.afe-chat-widget__body {
    height: calc(100% - 72px);
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 0;
}
.afe-chat-widget__list {
    border-right: 1px solid rgba(15, 23, 42, .08);
    overflow: auto;
    background: #f8fafc;
}
.afe-chat-widget__thread {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 0;
}
.afe-chat-widget__thread-title {
    padding: .95rem 1rem;
    border-bottom: 1px solid rgba(15, 23, 42, .08);
    font-weight: 800;
}
.afe-chat-widget__messages {
    overflow: auto;
    padding: 1rem;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}
.afe-chat-item {
    border: 0;
    border-radius: 14px;
    background: #fff;
    padding: .7rem .8rem;
    text-align: left;
    width: 100%;
    box-shadow: 0 1px 0 rgba(15, 23, 42, .05);
}
.afe-chat-item.is-active { background: #111827; color: #fff; }
.afe-chat-item small {
    display: -webkit-box;
    opacity: .75;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.25;
    max-height: 2.5em;
}
.afe-chat-item strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.afe-chat-bubble {
    max-width: 82%;
    padding: .75rem .85rem;
    border-radius: 18px;
    background: #f1f5f9;
    color: #0f172a;
    align-self: flex-start;
    overflow-wrap: anywhere;
}
.afe-chat-bubble.is-mine {
    background: #111827;
    color: #fff;
    align-self: flex-end;
}
.afe-chat-bubble__meta {
    font-size: .72rem;
    opacity: .82;
    margin-bottom: .25rem;
    display: flex;
    justify-content: space-between;
    gap: .6rem;
    align-items: center;
}
.afe-chat-bubble__body p { margin-bottom: .35rem; }
.afe-chat-bubble__body p:last-child { margin-bottom: 0; }
.afe-chat-attachment {
    display: inline-flex;
    gap: .4rem;
    align-items: center;
    margin-top: .45rem;
    padding: .35rem .55rem;
    border-radius: 999px;
    border: 1px solid currentColor;
    color: inherit;
    text-decoration: none;
    font-size: .78rem;
    background: rgba(255,255,255,.12);
}
.afe-chat-reactions {
    display: flex;
    gap: .25rem;
    margin-top: .45rem;
    flex-wrap: wrap;
}
.afe-chat-reactions button,
.afe-chat-widget__tools button,
.afe-chat-widget__tools label {
    border: 1px solid rgba(15, 23, 42, .12);
    background: #fff;
    border-radius: 999px;
    height: 28px;
    min-width: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 .45rem;
    font-size: .78rem;
    cursor: pointer;
}
.afe-chat-reply-action {
    gap: .25rem;
    min-width: auto !important;
    padding: 0 .7rem !important;
    font-weight: 800;
}
.afe-chat-bubble.is-mine .afe-chat-reply-action {
    border-color: rgba(255,255,255,.18);
}
.afe-chat-widget__composer {
    border-top: 1px solid rgba(15, 23, 42, .08);
    padding: .75rem;
    display: grid;
    gap: .5rem;
    background: #f8fafc;
}
.afe-chat-widget__tools {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
}
.afe-chat-widget__editor {
    min-height: 62px;
    max-height: 130px;
    overflow: auto;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .12);
    border-radius: 14px;
    padding: .7rem .8rem;
    outline: none;
}
.afe-chat-widget__editor:empty::before {
    content: 'Escriba su mensaje...';
    color: #94a3b8;
}
@media (max-width: 767.98px) {
    .afe-chat-widget { right: .75rem; bottom: .75rem; }
    .afe-chat-widget__panel {
        width: calc(100vw - 1rem);
        height: calc(100vh - 6rem);
        right: -.25rem;
    }
    .afe-chat-widget__body { grid-template-columns: 1fr; }
    .afe-chat-widget__list { max-height: 190px; border-right: 0; border-bottom: 1px solid rgba(15, 23, 42, .08); }
    .afe-chat-bubble { max-width: 92%; }
}
.afe-chat-widget__visibility,
.afe-chat-widget__privacy-badge {
    border: 1px solid rgba(15, 23, 42, .12);
    background: #fff;
    border-radius: 999px;
    height: 28px;
    padding: 0 .55rem;
    font-size: .78rem;
    outline: none;
}
.afe-chat-image {
    display: inline-flex;
    flex-direction: column;
    gap: .35rem;
    margin-top: .55rem;
    color: inherit;
    text-decoration: none;
    max-width: min(260px, 100%);
}
.afe-chat-image img {
    width: 100%;
    max-height: 190px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,.28);
    background: rgba(255,255,255,.08);
}
.afe-chat-image span {
    font-size: .74rem;
    opacity: .8;
}
.afe-chat-widget__thread-title small.text-success,
.afe-chat-item small.text-success {
    color: #16a34a !important;
}


.chat-admin-sidebar-col {
    align-self: flex-start;
}
.chat-admin-card,
.chat-admin-main-card {
    height: auto;
}
.chat-admin-main-card .card-body {
    min-height: auto;
}
.chat-admin-list-card {
    min-height: 0;
    max-height: 560px;
    overflow: auto;
}
.chat-admin-members-scroll {
    max-height: 220px;
    overflow: auto;
}
.chat-admin-groups-card {
    margin-top: 0 !important;
}
@media (min-width: 1200px) {
    .chat-admin-main-card {
        min-height: 0;
    }
}


.afe-chat-widget__privacy-badge {
    display: inline-flex;
    align-items: center;
    font-weight: 800;
    color: #0f172a;
}
.afe-chat-widget__reply-preview {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    align-items: flex-start;
    border: 1px solid rgba(15, 23, 42, .12);
    background: #fff;
    border-radius: 14px;
    padding: .55rem .65rem;
}
.afe-chat-widget__reply-preview strong {
    display: block;
    font-size: .78rem;
    color: #0f172a;
}
.afe-chat-widget__reply-preview small {
    display: block;
    color: #64748b;
    line-height: 1.25;
}
.afe-chat-widget__reply-preview button {
    border: 0;
    background: transparent;
    color: #64748b;
    font-weight: 900;
    line-height: 1;
    padding: .1rem .2rem;
}
.afe-chat-bubble__reply {
    border-left: 3px solid rgba(37, 99, 235, .45);
    padding: .45rem .6rem;
    background: rgba(255, 255, 255, .5);
    border-radius: 12px;
    margin: .25rem 0 .45rem;
    display: grid;
    gap: .12rem;
}
.afe-chat-bubble.is-mine .afe-chat-bubble__reply {
    background: rgba(255, 255, 255, .12);
    border-left-color: rgba(255, 255, 255, .65);
}
.afe-chat-bubble__reply strong {
    font-size: .74rem;
}
.afe-chat-bubble__reply span {
    font-size: .78rem;
    opacity: .82;
}
.afe-chat-reply-btn {
    border: 0;
    background: transparent;
    color: inherit;
    opacity: .72;
    font-weight: 800;
    padding: 0;
    white-space: nowrap;
    font-size: .72rem;
}
.afe-chat-reply-btn:hover {
    opacity: 1;
    text-decoration: underline;
}


.afe-chat-actions {
    display: inline-flex;
    align-items: center;
    gap: .28rem;
    margin-top: .45rem;
    flex-wrap: wrap;
}
.afe-chat-actions button,
.afe-chat-reply-action {
    border: 1px solid rgba(15, 23, 42, .10);
    background: #fff;
    color: #0f172a;
    border-radius: 999px;
    width: 30px;
    height: 30px;
    min-width: 30px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    font-size: .82rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
}
.afe-chat-actions button:hover,
.afe-chat-reply-action:hover {
    transform: translateY(-1px);
}
.afe-chat-bubble.is-mine .afe-chat-actions button,
.afe-chat-bubble.is-mine .afe-chat-reply-action {
    border-color: rgba(255,255,255,.18);
}
.afe-chat-actions .badge {
    height: 28px;
    display: inline-flex;
    align-items: center;
    background: #f8fafc !important;
    color: #0f172a !important;
    border: 1px solid rgba(15, 23, 42, .08);
}
.afe-chat-reactions {
    display: none;
}
.afe-chat-bubble__reply {
    width: 100%;
    border: 0;
    border-left: 3px solid rgba(37, 99, 235, .45);
    text-align: left;
    color: inherit;
    cursor: pointer;
}
.afe-chat-bubble__reply:hover {
    filter: brightness(.97);
}
.afe-chat-widget__reply-preview {
    cursor: pointer;
}
.afe-chat-bubble.is-target {
    outline: 3px solid rgba(37, 99, 235, .35);
    outline-offset: 3px;
    animation: afeChatTargetPulse 1.4s ease;
}
@keyframes afeChatTargetPulse {
    0%, 100% { transform: translateY(0); }
    35% { transform: translateY(-2px); }
}

.afe-chat-actions-toggle span {
    display: inline-block;
    font-size: 1rem;
    line-height: 1;
    transform: translateY(-1px);
}
.afe-chat-reactions-menu {
    display: none;
    align-items: center;
    gap: .28rem;
}
.afe-chat-actions.is-open .afe-chat-reactions-menu {
    display: inline-flex;
}
