/* Estilos propios del CRM van Beek (encima de Bootstrap 5.3). */

:root {
    --crm-sidebar-ancho: 240px;
    --crm-topbar-alto: 52px;
}

body {
    background-color: var(--bs-tertiary-bg);
}

/* ---------- Estructura ---------- */
.crm-app {
    height: 100vh;
    height: 100dvh;
}

.crm-main {
    min-width: 0;
}

.crm-topbar {
    height: var(--crm-topbar-alto);
    flex-shrink: 0;
}

.crm-contenido {
    min-height: 0;
    overflow: auto;
}

/* ---------- Menú lateral ---------- */
@media (min-width: 992px) {
    .crm-sidebar {
        width: var(--crm-sidebar-ancho);
        flex-shrink: 0;
    }
}

.crm-sidebar-marca {
    height: var(--crm-topbar-alto);
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.crm-nav-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .75rem;
    border-radius: .375rem;
    color: rgba(255, 255, 255, .75);
    text-decoration: none;
}

.crm-nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, .08);
}

.crm-nav-link.active {
    color: #fff;
    background-color: var(--bs-primary);
}

.crm-nav-link.disabled {
    color: rgba(255, 255, 255, .4);
    cursor: default;
}

.crm-nav-link.disabled:hover {
    background-color: transparent;
}

/* ---------- Bandeja ---------- */
.crm-bandeja-lista {
    width: 100%;
}

@media (min-width: 768px) {
    .crm-bandeja-lista {
        width: 340px;
        flex-shrink: 0;
    }
}

/* En celular se ve la lista o el chat, no ambos. */
.crm-bandeja-chat {
    display: none;
}

.crm-chat-abierto .crm-bandeja-chat {
    display: flex;
}

.crm-chat-abierto .crm-bandeja-lista {
    display: none !important;
}

@media (min-width: 768px) {
    .crm-bandeja-chat {
        display: flex;
    }

    .crm-chat-abierto .crm-bandeja-lista {
        display: flex !important;
    }
}

.min-w-0 {
    min-width: 0;
}

.crm-punto {
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    display: inline-block;
}

.crm-conv {
    background: transparent;
    color: inherit;
}

.crm-conv:hover {
    background-color: var(--bs-tertiary-bg);
}

.crm-conv.active {
    background-color: var(--bs-primary-bg-subtle);
}

.crm-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    font-weight: 600;
    color: #fff;
    background-color: #6c8ebf;
}

/* ---------- Chat (estilo WhatsApp) ---------- */
.crm-mensajes {
    background-color: #efeae2;
}

.crm-burbuja {
    max-width: min(75%, 560px);
    padding: .35rem .6rem .25rem;
    border-radius: .5rem;
    box-shadow: 0 1px .5px rgba(0, 0, 0, .13);
    color: #111b21;
}

.crm-entrante {
    background-color: #fff;
    border-top-left-radius: 0;
}

.crm-saliente {
    background-color: #d9fdd3;
    border-top-right-radius: 0;
}

.crm-texto {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.crm-meta {
    display: flex;
    justify-content: flex-end;
    gap: .3rem;
    font-size: .7rem;
    color: #667781;
    margin-top: .1rem;
}

.crm-leido {
    color: #53bdeb;
}

.crm-dia {
    display: inline-block;
    font-size: .75rem;
    padding: .2rem .6rem;
    border-radius: .5rem;
    background-color: #fff;
    color: #54656f;
    box-shadow: 0 1px .5px rgba(0, 0, 0, .13);
}

.crm-bandeja-chat textarea {
    resize: none;
}

/* ---------- Login ---------- */
.crm-login-card {
    max-width: 400px;
}

/* Nota del sistema en el chat (asignaciones) */
.crm-nota-sistema {
    display: inline-block;
    font-size: .75rem;
    padding: .2rem .6rem;
    border-radius: .5rem;
    background-color: #fff5c4;
    color: #54656f;
    box-shadow: 0 1px .5px rgba(0, 0, 0, .13);
}

/* Punto de estado chico (equipo) */
.crm-punto-sm {
    display: inline-block;
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
}

/* ---------- Archivos en el chat ---------- */
.crm-adjunto + .crm-adjunto,
.crm-adjunto + .crm-texto {
    margin-top: .35rem;
}
.crm-adj-img {
    display: block;
    max-width: min(320px, 100%);
    max-height: 320px;
    border-radius: .4rem;
    object-fit: contain;
    background: rgba(0, 0, 0, .04);
}
.crm-adj-sticker {
    max-width: 140px;
    background: transparent;
}
.crm-adj-audio {
    width: 260px;
    max-width: 100%;
}
.crm-adj-doc {
    display: flex;
    align-items: center;
    gap: .5rem;
    max-width: 320px;
    padding: .5rem .6rem;
    border-radius: .4rem;
    background: rgba(0, 0, 0, .05);
    color: inherit;
    text-decoration: none;
}
.crm-adj-doc:hover {
    background: rgba(0, 0, 0, .09);
}
.crm-adj-pendiente {
    padding: .5rem .6rem;
    border-radius: .4rem;
    background: rgba(0, 0, 0, .05);
    color: #54656f;
}
.crm-adj-elegido {
    padding: .35rem .6rem;
    border-radius: .4rem;
    background: var(--bs-secondary-bg);
}

/* ---------- Alertas (campana) ---------- */
.crm-alertas-menu {
    width: min(340px, 92vw);
    max-height: 70vh;
    overflow-y: auto;
}

/* ---------- Plantillas ---------- */
.crm-plantillas {
    background: var(--bs-tertiary-bg);
    max-height: 55vh;
    overflow-y: auto;
}
.crm-plantillas-lista {
    max-height: 240px;
    overflow-y: auto;
}
.crm-plantilla-previa {
    background-color: #efeae2;
}
.crm-plantilla-previa .crm-burbuja {
    max-width: 100%;
}
.crm-plantilla-tag {
    font-size: .7rem;
    color: #667781;
    margin-bottom: .15rem;
}
.crm-plantilla-pie {
    font-size: .75rem;
    color: #667781;
    margin-top: .2rem;
}
.crm-plantilla-botones {
    display: flex;
    flex-direction: column;
    margin-top: .35rem;
    border-top: 1px solid rgba(0, 0, 0, .08);
}
.crm-plantilla-botones span {
    padding: .3rem 0 .1rem;
    text-align: center;
    font-size: .85rem;
    color: #027eb5;
}
.crm-plantilla-botones span + span {
    border-top: 1px solid rgba(0, 0, 0, .08);
}

/* ---------- Atribución (llegó desde un anuncio) ---------- */
.crm-origen {
    font-size: .75rem;
    color: #54656f;
    background: rgba(83, 189, 235, .15);
    border-radius: .35rem;
    padding: .15rem .45rem;
    margin-bottom: .3rem;
}
