/* Badge global del chat en el navbar (C3). Prefijo .chbadge- */
.chbadge-pill {
    font-size: 10.5px;
    font-weight: 700;
    background: var(--secundario, #fe7800) !important;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

/* Inbox CRM omnicanal — bandeja de asesores. Prefijo .cinbox- */

.cinbox {
    display: grid;
    grid-template-columns: 320px 1fr 300px;
    gap: 0;
    height: calc(100vh - 130px);
    background: #fff;
    border: 1px solid #e0e4ec;
    border-radius: 12px;
    overflow: hidden;
}

/* ── Columna 1: lista ── */
.cinbox-list { border-right: 1px solid #eef1f6; display: flex; flex-direction: column; min-width: 0; }
.cinbox-list__head { padding: 12px 14px; border-bottom: 1px solid #eef1f6; }
.cinbox-list__title { font-weight: 600; color: #1e3a5f; font-size: 15px; margin-bottom: 8px; }
.cinbox-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.cinbox-chip {
    border: 1px solid #d7deea; background: #fff; color: #566; border-radius: 14px;
    padding: 3px 12px; font-size: 12px; cursor: pointer;
}
.cinbox-chip.on { background: #1e3a5f; color: #fff; border-color: #1e3a5f; }

.cinbox-items { flex: 1; overflow-y: auto; }
.cinbox-item {
    display: flex; gap: 10px; padding: 11px 14px; cursor: pointer;
    border-bottom: 1px solid #f4f6fa; align-items: center;
}
.cinbox-item:hover { background: #f7f9fc; }
.cinbox-item.sel { background: #eef4fb; border-left: 3px solid #1976d2; }
.cinbox-ava {
    width: 40px; height: 40px; border-radius: 50%; flex: 0 0 40px;
    display: flex; align-items: center; justify-content: center; color: #fff; font-size: 17px;
}
.cinbox-ava.wsp { background: #25d366; }
.cinbox-ava.msn { background: #0084ff; }
.cinbox-ava.ig { background: #d6249f; }
.cinbox-ava.tg { background: #29a9eb; }
.cinbox-item__body { flex: 1; min-width: 0; }
.cinbox-item__top { display: flex; justify-content: space-between; gap: 6px; }
.cinbox-item__name { font-weight: 600; color: #23324a; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cinbox-item__time { font-size: 11px; color: #9aa7b8; white-space: nowrap; }
.cinbox-item__last { font-size: 12.5px; color: #7b8798; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cinbox-badge { background: #fe7800; color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; font-weight: 600; }
.cinbox-empty { padding: 30px 16px; text-align: center; color: #9aa7b8; font-size: 13px; }

/* ── Columna 2: hilo ── */
.cinbox-chat { display: flex; flex-direction: column; min-width: 0; }
.cinbox-chat__head {
    padding: 12px 16px; border-bottom: 1px solid #eef1f6; display: flex; align-items: center; gap: 10px;
}
.cinbox-chat__head .t { font-weight: 600; color: #1e3a5f; }
.cinbox-chat__head .s { font-size: 12px; color: #8a97a8; }
.cinbox-thread { flex: 1; overflow-y: auto; padding: 16px; background: #f5f7fb; display: flex; flex-direction: column; gap: 8px; }
.cinbox-bub { max-width: 72%; padding: 8px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.4; word-wrap: break-word; }
.cinbox-bub.ent { align-self: flex-start; background: #fff; border: 1px solid #e6eaf1; border-bottom-left-radius: 4px; }
.cinbox-bub.sal { align-self: flex-end; background: #d9f3e0; border: 1px solid #bfe6ca; border-bottom-right-radius: 4px; }
.cinbox-bub.bot { align-self: flex-end; background: #eae3fb; border: 1px solid #d3c6f2; }
.cinbox-bub__meta { font-size: 10.5px; color: #9aa7b8; margin-top: 3px; text-align: right; }
.cinbox-bub.bot .cinbox-bub__meta::before { content: "🤖 bot · "; }

.cinbox-compose { border-top: 1px solid #eef1f6; padding: 10px 14px; display: flex; gap: 8px; align-items: center; }
.cinbox-compose input {
    flex: 1; border: 1px solid #d7deea; border-radius: 20px; padding: 9px 16px; font-size: 13.5px; outline: none;
}
.cinbox-compose input:focus { border-color: #1976d2; }
.cinbox-send {
    width: 40px; height: 40px; border-radius: 50%; border: none; background: #1e3a5f; color: #fff;
    cursor: pointer; font-size: 15px;
}
.cinbox-send:disabled { opacity: .5; cursor: default; }

.cinbox-nochat { flex: 1; display: flex; align-items: center; justify-content: center; color: #9aa7b8; font-size: 14px; flex-direction: column; gap: 10px; }
.cinbox-nochat i { font-size: 40px; opacity: .4; }

/* ── Columna 3: ficha ── */
.cinbox-ficha { border-left: 1px solid #eef1f6; padding: 16px; overflow-y: auto; }
.cinbox-ficha h4 { font-size: 13px; color: #1e3a5f; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .3px; }
.cinbox-ficha .row { font-size: 13px; color: #445; margin-bottom: 8px; }
.cinbox-ficha .row b { color: #23324a; display: block; font-size: 11.5px; color: #8a97a8; text-transform: uppercase; }
.cinbox-ficha__actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.cinbox-origen { background: #fff9e8; border: 1px solid #f0e0b0; border-radius: 8px; padding: 8px 10px; font-size: 12px; color: #6b5a20; }

.cinbox-conn { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: #2e7d32; }
.cinbox-conn::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #2e7d32; }
.cinbox-conn.off { color: #c77700; }
.cinbox-conn.off::before { background: #c77700; }

@media (max-width: 1100px) {
    .cinbox { grid-template-columns: 260px 1fr; }
    .cinbox-ficha { display: none; }
}

/* ══════════════════════════════════════════════════════════════════
   Dashboard CRM (/crm/dash) — pronostico de ventas + agenda del dia
   ══════════════════════════════════════════════════════════════════ */

.crmdash-card {
    background: #fff;
    border: 1px solid #e0e4ec;
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 18px;
    box-shadow: 0 1px 3px rgba(30, 58, 95, .06);
    height: 100%;
}

.crmdash-card-head {
    display: flex; align-items: center; gap: 8px;
    font-size: 15px; font-weight: 600; color: var(--primario, #1e3a5f);
    border-bottom: 2px solid var(--secundario, #fe7800);
    padding-bottom: 10px; margin-bottom: 14px;
}
.crmdash-card-head i { color: var(--secundario, #fe7800); }

.crmdash-kpis {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
    margin-bottom: 16px;
}
.crmdash-kpi {
    background: #f5f7fb; border-radius: 8px; padding: 12px 10px; text-align: center;
    border: 1px solid #e0e4ec;
}
.crmdash-kpi--acento { background: #fff8ea; border-color: #f0e0b0; }
.crmdash-kpi-val { font-size: 18px; font-weight: 700; color: var(--primario, #1e3a5f); }
.crmdash-kpi-lbl { font-size: 11.5px; color: #6b7688; margin-top: 3px; text-transform: uppercase; letter-spacing: .3px; }

.crmdash-sinfecha {
    margin-top: 12px; background: #fff9e8; border: 1px solid #f0e0b0; border-radius: 8px;
    padding: 8px 12px; font-size: 12.5px; color: #6b5a20;
}
.crmdash-sinfecha i { margin-right: 6px; color: #c77700; }

.crmdash-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: #9aa7b8; font-size: 13.5px; padding: 30px 10px; gap: 8px; text-align: center;
}
.crmdash-empty i { font-size: 32px; opacity: .4; }

.crmdash-activ-list { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; }

.crmdash-activ-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: 8px; border: 1px solid #eef1f6; background: #fbfcfe;
}

.crmdash-activ-icon {
    width: 34px; height: 34px; min-width: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px;
}
.crmdash-icon-llamada { background: #1976d2; }
.crmdash-icon-reunion { background: #7e57c2; }
.crmdash-icon-whatsapp { background: #25d366; }
.crmdash-icon-email { background: #c62828; }
.crmdash-icon-visita { background: #00897b; }
.crmdash-icon-tarea { background: #fe7800; }
.crmdash-icon-nota { background: #6b7688; }

.crmdash-activ-body { flex: 1; min-width: 0; }
.crmdash-activ-asunto { font-size: 13px; font-weight: 600; color: #23324a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crmdash-activ-oport { font-size: 11.5px; color: #6b7688; margin-top: 2px; }
.crmdash-activ-oport i { margin-right: 4px; }
.crmdash-activ-hora { font-size: 12px; font-weight: 600; color: var(--primario, #1e3a5f); white-space: nowrap; }

/* ══════════════════════════════════════════════════════════════════
   Modal Cambiar Estado de Cierre — aviso de Descartada. Prefijo .mecc-
   ══════════════════════════════════════════════════════════════════ */
.mecc-descarte-info {
    background: #f5f7fb; border: 1px solid #e0e4ec; border-left: 3px solid #6b7688;
    border-radius: 6px; padding: 8px 12px; font-size: 12.5px; color: #555; margin-bottom: 12px;
}
.mecc-descarte-info i { color: #6b7688; margin-right: 6px; }

/* ══════════════════════════════════════════════════════════════════
   Detalle de Oportunidad (potenciacion CRM, C6) — Productos / Actividades /
   Etiquetas / Adjuntos. Prefijo .crmop-
   ══════════════════════════════════════════════════════════════════ */
.crmop-panel { margin-top: 18px; }
.crmop-tabs { display: flex; gap: 4px; border-bottom: 2px solid #e0e4ec; margin-bottom: 14px; flex-wrap: wrap; }
.crmop-tab {
    padding: 8px 16px; font-size: 13px; font-weight: 600; color: #6b7688; cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .15s, border-color .15s;
    background: none; border-top: none; border-left: none; border-right: none;
}
.crmop-tab:hover { color: var(--primario, #1e3a5f); }
.crmop-tab.on { color: var(--primario, #1e3a5f); border-bottom-color: var(--secundario, #fe7800); }
.crmop-tab .badge { margin-left: 5px; }

.crmop-toolbar { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 10px; }

/* Productos */
.crmop-tbl input, .crmop-tbl select { font-size: 12.5px; }
.crmop-tbl td { vertical-align: middle; }
.crmop-row-dirty { background: #fff9e8 !important; }
.crmop-total-row td { font-weight: 700; background: #f5f7fb; }

/* Actividades — timeline */
.crmop-timeline { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.crmop-tl-item { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid #e0e4ec; border-radius: 8px; background: #fff; }
.crmop-tl-icon {
    width: 32px; height: 32px; min-width: 32px; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; color: #fff; font-size: 13px;
}
.crmop-tl-icon.t1 { background: #1976d2; } /* Llamada */
.crmop-tl-icon.t2 { background: #7e57c2; } /* Reunion */
.crmop-tl-icon.t3 { background: #25d366; } /* WhatsApp */
.crmop-tl-icon.t4 { background: #c62828; } /* Email */
.crmop-tl-icon.t5 { background: #00897b; } /* Visita */
.crmop-tl-icon.t6 { background: #fe7800; } /* Tarea */
.crmop-tl-icon.t7 { background: #6b7688; } /* Nota */
.crmop-tl-body { flex: 1; min-width: 0; }
.crmop-tl-top { display: flex; justify-content: space-between; gap: 8px; }
.crmop-tl-asunto { font-weight: 600; font-size: 13.5px; color: #23324a; }
.crmop-tl-fecha { font-size: 11.5px; color: #9aa7b8; white-space: nowrap; }
.crmop-tl-detalle { font-size: 12.5px; color: #556; margin-top: 3px; }
.crmop-tl-resultado { font-size: 12px; color: #2e7d32; margin-top: 3px; font-style: italic; }
.crmop-tl-meta { font-size: 11px; color: #8a97a8; margin-top: 4px; }
.crmop-tl-auto { background: #eae3fb; color: #6b4fa0; border-radius: 8px; padding: 1px 7px; font-size: 10px; font-weight: 700; margin-left: 6px; }
.crmop-empty { text-align: center; color: #9aa7b8; padding: 24px; font-size: 13px; }

/* Etiquetas */
.crmop-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crmop-tag {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 14px;
    font-size: 12px; font-weight: 600; color: #fff;
}
.crmop-tag .x { cursor: pointer; opacity: .8; }
.crmop-tag .x:hover { opacity: 1; }
.crmop-tag-add {
    display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
    border-radius: 50%; border: 1.5px dashed #9aa7b8; color: #9aa7b8; cursor: pointer; background: none;
}
.crmop-tag-add:hover { border-color: var(--primario, #1e3a5f); color: var(--primario, #1e3a5f); }
.crmop-tag-popover {
    position: absolute; z-index: 50; background: #fff; border: 1px solid #e0e4ec; border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,.12); padding: 8px; min-width: 200px; margin-top: 6px;
}
.crmop-tag-opt { padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.crmop-tag-opt:hover { background: #f5f7fb; }
.crmop-tag-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* Adjuntos */
.crmop-adj-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid #e0e4ec; border-radius: 8px; margin-bottom: 6px; }
.crmop-adj-icon { font-size: 18px; color: var(--primario, #1e3a5f); }
.crmop-adj-name { flex: 1; min-width: 0; font-size: 13px; color: #23324a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crmop-adj-meta { font-size: 11px; color: #9aa7b8; }

/* ── Configuración de Mensajería (Colas/Etiquetas/Plantillas). Prefijo .msgcfg- ── */

.msgcfg-banner {
    background: linear-gradient(135deg, var(--primario, #1e3a5f), #2c5282);
    color: #fff;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 16px;
    border-bottom: 3px solid var(--secundario, #d4af37);
}
.msgcfg-banner__title { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.msgcfg-banner__sub { font-size: 13px; opacity: 0.85; margin-top: 4px; }

.msgcfg-body {
    background: #fff;
    border: 1px solid #e0e4ec;
    border-radius: 10px;
    padding: 4px 16px 16px 16px;
}

.msgcfg-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin: 14px 0;
}

.msgcfg-note {
    font-size: 12.5px;
    color: #566;
    background: #f5f7fb;
    border: 1px solid #e0e4ec;
    border-radius: 8px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 560px;
}
.msgcfg-note i { color: var(--primario, #1976d2); }

.msgcfg-tablewrap { position: relative; min-height: 80px; }

.msgcfg-table thead th {
    background: #1e3a5f;
    color: #fff;
    font-weight: 600;
    font-size: 12.5px;
    border: none;
}
.msgcfg-table tbody tr:hover { background: #f7f9fc; }
.msgcfg-table td { vertical-align: middle; font-size: 13px; }

.msgcfg-colordot {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    margin-right: 6px;
    border: 1px solid rgba(0,0,0,0.15);
    vertical-align: middle;
}

.msgcfg-chip {
    color: #fff;
    border-radius: 12px;
    padding: 2px 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.msgcfg-colorinput { width: 70px; height: 32px; padding: 2px; cursor: pointer; }

/* ══════════════════════════════════════════════════════════════════════════
   V2-3 pto 3: enriquecimiento del plugin CRM del panel de contexto (chat).
   Clases .cht-crm-* del host; complementan las de la RCL (chat.css).
   ══════════════════════════════════════════════════════════════════════════ */

.cht-crm-vinc {
    border: 1px solid rgba(212, 175, 55, .45);
    background: rgba(212, 175, 55, .06);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
}

/* (2) Valor estimado */
.cht-crm-valor {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}
.cht-crm-valor__lbl {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .03em;
    color: #8b95ab;
    text-transform: uppercase;
}
.cht-crm-valor__monto {
    font-size: 22px;
    font-weight: 800;
    color: #1e3a5f;
    line-height: 1.1;
}

/* (1) Stepper de etapa */
.cht-crm-stepper {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.cht-crm-step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #e0e4ec;
    background: #fff;
    color: #56637a;
    border-radius: 999px;
    padding: 4px 10px 4px 8px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.cht-crm-step:hover:not(:disabled):not(.cht-crm-step--actual) {
    border-color: #2c5282;
    color: #2c5282;
    background: #f4f8ff;
}
.cht-crm-step:disabled { cursor: default; }
.cht-crm-step__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c3ccdd;
    flex: 0 0 auto;
}
.cht-crm-step--actual {
    background: #1e3a5f;
    border-color: #1e3a5f;
    color: #fff;
}
.cht-crm-step--actual .cht-crm-step__dot { background: #d4af37; }

/* (3) Timeline */
.cht-crm-tl-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 6px 0;
}
.cht-crm-tl-add {
    border: none;
    background: transparent;
    color: #2c5282;
    font-size: 11.5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 2px 0;
}
.cht-crm-tl-add:hover:not(:disabled) { text-decoration: underline; }
.cht-crm-tl-add:disabled { color: #a9b2c4; cursor: default; }

.cht-crm-tl-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #fff;
    border: 1px solid #e0e4ec;
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 8px;
}
.cht-crm-inp {
    border: 1px solid #dbe1ea;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 12px;
    color: #1f2937;
    background: #fff;
    width: 100%;
}
.cht-crm-inp:focus {
    outline: none;
    border-color: #2c5282;
    box-shadow: 0 0 0 2px rgba(44, 82, 130, .12);
}

.cht-crm-tl {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cht-crm-tl-item {
    display: flex;
    align-items: flex-start;
    gap: 9px;
}
.cht-crm-tl-ico {
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #eef2f9;
    color: #2c5282;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}
.cht-crm-tl-body { min-width: 0; }
.cht-crm-tl-asunto {
    font-size: 12.5px;
    font-weight: 600;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cht-crm-tl-fecha {
    font-size: 11px;
    color: #8b95ab;
    margin-top: 1px;
}

.msgcfg-modal .modal-content { border-top: 3px solid var(--secundario, #d4af37); }
