/* ═══════════════════════════════════════════════════════════════
   Easy Softwares — Chat en direct (widget public + console NOURA)
   Charte officielle · responsive · RTL · prefers-reduced-motion
   ═══════════════════════════════════════════════════════════════ */

:root {
    --chat-navy: #071A36;
    --chat-blue: #176BFF;
    --chat-cyan: #17C3E5;
    --chat-gold: #F3B63A;
    --chat-ink: #17233B;
    --chat-surface: #F3F7FC;
    --chat-border: #E3EAF4;
    --chat-muted: #64748B;
    --chat-success: #10B981;
    --chat-shadow: 0 24px 70px rgba(7, 26, 54, .28);
}

/* ══════════════════ Composants partagés ══════════════════ */

/* — Fil de discussion — */
.es-thread {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding: 1rem;
    overflow-y: auto;
    scroll-behavior: smooth;
    background:
        radial-gradient(circle at 12% 8%, rgba(23, 107, 255, .05), transparent 42%),
        radial-gradient(circle at 88% 92%, rgba(23, 195, 229, .06), transparent 45%),
        var(--chat-surface);
}
.es-thread::-webkit-scrollbar { width: 8px; }
.es-thread::-webkit-scrollbar-track { background: transparent; }
.es-thread::-webkit-scrollbar-thumb { background: rgba(7, 26, 54, .14); border-radius: 8px; }
.es-thread::-webkit-scrollbar-thumb:hover { background: rgba(7, 26, 54, .24); }

/* Séparateur de journée */
.es-day {
    align-self: center;
    margin: .85rem 0 .6rem;
    padding: .22rem .85rem;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--chat-muted);
    background: rgba(255, 255, 255, .9);
    border: 1px solid var(--chat-border);
    border-radius: 999px;
    text-transform: uppercase;
}

/* — Ligne de message — */
.es-msg {
    display: flex;
    align-items: flex-end;
    gap: .5rem;
    max-width: 84%;
    margin-bottom: .35rem;
    animation: esMsgIn .28s cubic-bezier(.4, 0, .2, 1);
}
.es-msg.out { margin-inline-start: auto; flex-direction: row-reverse; }
.es-msg.in { margin-inline-end: auto; }
.es-msg.system {
    max-width: 100%;
    align-self: center;
    justify-content: center;
    margin: .5rem 0;
}
@keyframes esMsgIn {
    from { opacity: 0; transform: translateY(10px) scale(.97); }
    to { opacity: 1; transform: none; }
}

.es-msg .avatar {
    width: 30px; height: 30px; border-radius: 50%; flex: none;
    display: flex; align-items: center; justify-content: center;
    font-size: .72rem; font-weight: 800; color: #fff;
    background: linear-gradient(135deg, var(--chat-navy), #0B2A55);
    box-shadow: 0 2px 8px rgba(7, 26, 54, .22);
}
.es-msg.out .avatar { background: linear-gradient(135deg, var(--chat-blue), var(--chat-cyan)); }
/* L'avatar n'apparaît que sur le dernier message d'un groupe */
.es-msg.grouped .avatar { visibility: hidden; }

.es-bubble {
    position: relative;
    padding: .58rem .85rem;
    border-radius: 16px;
    font-size: .875rem;
    line-height: 1.55;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    box-shadow: 0 2px 10px rgba(7, 26, 54, .07);
}
.es-msg.in .es-bubble {
    background: #fff;
    color: var(--chat-ink);
    border: 1px solid var(--chat-border);
    border-end-start-radius: 5px;
}
.es-msg.out .es-bubble {
    background: linear-gradient(135deg, var(--chat-blue), #2E7BFF);
    color: #fff;
    border-end-end-radius: 5px;
}
.es-msg.note .es-bubble {
    background: rgba(243, 182, 58, .16);
    border: 1px dashed var(--chat-gold);
    color: #7A5210;
}
.es-msg.system .es-bubble {
    background: rgba(255, 255, 255, .85);
    border: 1px solid var(--chat-border);
    color: var(--chat-muted);
    font-size: .78rem;
    text-align: center;
    box-shadow: none;
    border-radius: 12px;
    white-space: normal;
}
.es-bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
.es-msg.in .es-bubble a { color: var(--chat-blue); }

/* Méta (heure + accusé de lecture) */
.es-meta {
    display: flex; align-items: center; gap: .25rem;
    margin-top: .18rem;
    font-size: .65rem;
    color: var(--chat-muted);
    opacity: .85;
}
.es-msg.out .es-meta { justify-content: flex-end; }
.es-meta .tick { font-size: .72rem; }
.es-meta .tick.read { color: var(--chat-cyan); }

/* — Pièces jointes — */
.es-attach-img {
    display: block;
    max-width: 240px;
    max-height: 220px;
    width: auto;
    border-radius: 12px;
    margin-top: .35rem;
    cursor: zoom-in;
    border: 2px solid rgba(255, 255, 255, .7);
    transition: transform .2s ease;
}
.es-attach-img:hover { transform: scale(1.02); }
.es-msg.in .es-attach-img { border-color: var(--chat-border); }

.es-attach-file {
    display: flex; align-items: center; gap: .6rem;
    margin-top: .35rem;
    padding: .5rem .7rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .3);
    text-decoration: none;
    color: inherit;
    transition: background .2s;
}
.es-msg.in .es-attach-file { background: var(--chat-surface); border-color: var(--chat-border); }
.es-attach-file:hover { background: rgba(255, 255, 255, .3); color: inherit; }
.es-msg.in .es-attach-file:hover { background: #E9F1FB; }
.es-attach-file i { font-size: 1.3rem; flex: none; }
.es-attach-file .name { font-size: .8rem; font-weight: 600; line-height: 1.25; word-break: break-all; }
.es-attach-file .size { font-size: .68rem; opacity: .75; }

/* — Indicateur de saisie — */
.es-typing {
    display: flex; align-items: center; gap: .5rem;
    padding: 0 1rem .5rem;
    font-size: .74rem;
    color: var(--chat-muted);
}
.es-typing .dots { display: inline-flex; gap: 3px; }
.es-typing .dots span {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--chat-blue);
    animation: esTyping 1.3s infinite ease-in-out;
}
.es-typing .dots span:nth-child(2) { animation-delay: .18s; }
.es-typing .dots span:nth-child(3) { animation-delay: .36s; }
@keyframes esTyping {
    0%, 60%, 100% { transform: translateY(0); opacity: .45; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* — Composeur — */
.es-composer {
    border-top: 1px solid var(--chat-border);
    background: #fff;
    padding: .6rem .7rem;
}
.es-composer-row {
    display: flex; align-items: flex-end; gap: .4rem;
    background: var(--chat-surface);
    border: 1px solid var(--chat-border);
    border-radius: 16px;
    padding: .3rem .35rem .3rem .6rem;
    transition: border-color .2s, box-shadow .2s;
}
.es-composer-row:focus-within {
    border-color: var(--chat-blue);
    box-shadow: 0 0 0 3px rgba(23, 107, 255, .13);
}
.es-composer textarea {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    outline: none;
    font-size: .87rem;
    line-height: 1.5;
    padding: .45rem .1rem;
    max-height: 132px;
    color: var(--chat-ink);
    font-family: inherit;
}
.es-composer textarea::placeholder { color: #94A3B8; }

.es-tool {
    width: 34px; height: 34px; flex: none;
    border: none; background: transparent;
    border-radius: 10px;
    color: var(--chat-muted);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.05rem; cursor: pointer;
    transition: background .18s, color .18s, transform .18s;
}
.es-tool:hover { background: rgba(23, 107, 255, .1); color: var(--chat-blue); }
.es-tool:active { transform: scale(.92); }
.es-send {
    width: 36px; height: 36px; flex: none;
    border: none; border-radius: 12px;
    background: linear-gradient(135deg, var(--chat-blue), var(--chat-cyan));
    color: #fff; font-size: 1rem; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 14px rgba(23, 107, 255, .35);
    transition: transform .18s, box-shadow .18s, opacity .18s;
}
.es-send:hover { transform: translateY(-1px); box-shadow: 0 7px 20px rgba(23, 107, 255, .45); }
.es-send:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

/* Aperçu de la pièce jointe en attente */
.es-pending {
    display: none;
    align-items: center; gap: .55rem;
    margin-bottom: .45rem;
    padding: .45rem .6rem;
    background: rgba(23, 107, 255, .07);
    border: 1px dashed rgba(23, 107, 255, .4);
    border-radius: 12px;
    font-size: .78rem;
}
.es-pending.show { display: flex; }
.es-pending img { width: 38px; height: 38px; object-fit: cover; border-radius: 8px; flex: none; }
.es-pending .info { flex: 1; min-width: 0; }
.es-pending .info .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.es-pending .info .s { color: var(--chat-muted); font-size: .7rem; }

/* — Sélecteur d'émojis — */
.es-emoji {
    position: absolute;
    inset-block-end: 100%;
    inset-inline-start: .7rem;
    width: min(310px, calc(100% - 1.4rem));
    margin-bottom: .5rem;
    background: #fff;
    border: 1px solid var(--chat-border);
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(7, 26, 54, .22);
    overflow: hidden;
    display: none;
    z-index: 30;
}
.es-emoji.show { display: block; animation: esPopIn .18s ease; }
@keyframes esPopIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.es-emoji-tabs {
    display: flex; gap: 2px; padding: .4rem .45rem 0;
    border-bottom: 1px solid var(--chat-border);
    overflow-x: auto;
}
.es-emoji-tabs button {
    border: none; background: transparent; cursor: pointer;
    font-size: 1.05rem; padding: .25rem .42rem;
    border-radius: 8px 8px 0 0; opacity: .55;
    transition: opacity .15s, background .15s;
}
.es-emoji-tabs button.active { opacity: 1; background: rgba(23, 107, 255, .1); }
.es-emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 1px;
    padding: .5rem;
    max-height: 196px;
    overflow-y: auto;
}
.es-emoji-grid button {
    border: none; background: transparent; cursor: pointer;
    font-size: 1.22rem; line-height: 1; padding: .28rem 0;
    border-radius: 8px;
    transition: background .12s, transform .12s;
}
.es-emoji-grid button:hover { background: var(--chat-surface); transform: scale(1.22); }

/* — Visionneuse d'image — */
.es-lightbox {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(7, 26, 54, .93);
    display: none; align-items: center; justify-content: center;
    padding: 4vh 4vw;
    backdrop-filter: blur(4px);
}
.es-lightbox.show { display: flex; animation: esFade .2s ease; }
@keyframes esFade { from { opacity: 0; } to { opacity: 1; } }
.es-lightbox img { max-width: 100%; max-height: 84vh; border-radius: 14px; box-shadow: 0 30px 90px rgba(0, 0, 0, .6); }
.es-lightbox .close-x {
    position: absolute; top: 18px; inset-inline-end: 22px;
    width: 42px; height: 42px; border-radius: 50%;
    border: none; background: rgba(255, 255, 255, .14); color: #fff;
    font-size: 1.2rem; cursor: pointer;
}
.es-lightbox .close-x:hover { background: rgba(255, 255, 255, .26); }
.es-lightbox .dl {
    position: absolute; bottom: 22px; inset-inline-start: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, .14); color: #fff;
    border-radius: 999px; padding: .5rem 1.2rem;
    font-size: .82rem; text-decoration: none; font-weight: 600;
}
.es-lightbox .dl:hover { background: var(--chat-blue); color: #fff; }

/* ══════════════════ Widget public ══════════════════ */

#esChat {
    position: fixed;
    inset-block-end: 22px;
    inset-inline-end: 22px;
    z-index: 1055;
    font-family: 'Inter', system-ui, sans-serif;
}

#esChatToggle {
    position: relative;
    width: 60px; height: 60px;
    border-radius: 50%; border: none; cursor: pointer;
    background: linear-gradient(135deg, var(--chat-blue), var(--chat-cyan));
    color: #fff; font-size: 1.55rem;
    box-shadow: 0 12px 34px rgba(23, 107, 255, .45);
    display: flex; align-items: center; justify-content: center;
    transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), box-shadow .25s;
}
#esChatToggle:hover { transform: scale(1.08) rotate(-4deg); box-shadow: 0 16px 42px rgba(23, 107, 255, .55); }
#esChatToggle::after {
    content: ''; position: absolute; inset: -5px;
    border-radius: 50%; border: 2px solid rgba(23, 195, 229, .55);
    animation: esPulse 2.6s ease-out infinite;
}
@keyframes esPulse {
    0% { transform: scale(.92); opacity: .8; }
    70% { transform: scale(1.28); opacity: 0; }
    100% { opacity: 0; }
}
#esChatToggle .icon-close { display: none; }
#esChat.open #esChatToggle .icon-open { display: none; }
#esChat.open #esChatToggle .icon-close { display: block; }
#esChat.open #esChatToggle::after { display: none; }

#esChatBadge {
    position: absolute; top: -2px; inset-inline-end: -2px;
    min-width: 22px; height: 22px; padding: 0 6px;
    background: #EF4444; color: #fff;
    border: 2px solid #fff; border-radius: 999px;
    font-size: .68rem; font-weight: 800;
    display: none; align-items: center; justify-content: center;
}
#esChatBadge.show { display: flex; }

/* Bulle d'invitation */
#esChatTeaser {
    position: absolute;
    inset-block-end: 74px;
    inset-inline-end: 4px;
    width: 250px;
    background: #fff;
    border: 1px solid var(--chat-border);
    border-radius: 16px;
    padding: .8rem .9rem;
    box-shadow: 0 16px 40px rgba(7, 26, 54, .18);
    font-size: .82rem;
    color: var(--chat-ink);
    display: none;
    animation: esMsgIn .35s ease;
}
#esChatTeaser.show { display: block; }
#esChatTeaser .t { font-weight: 700; margin-bottom: .15rem; }
#esChatTeaser .x {
    position: absolute; top: 4px; inset-inline-end: 6px;
    border: none; background: none; color: var(--chat-muted);
    cursor: pointer; font-size: .9rem; line-height: 1;
}

#esChatPanel {
    position: absolute;
    inset-block-end: 76px;
    inset-inline-end: 0;
    width: min(384px, calc(100vw - 32px));
    height: min(620px, calc(100vh - 130px));
    background: #fff;
    border-radius: 22px;
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    animation: esPanelIn .3s cubic-bezier(.34, 1.4, .64, 1);
}
[dir="rtl"] #esChatPanel { transform-origin: bottom left; }
@keyframes esPanelIn {
    from { opacity: 0; transform: translateY(18px) scale(.94); }
    to { opacity: 1; transform: none; }
}
#esChatPanel[hidden] { display: none; }

.es-chat-head {
    position: relative;
    background:
        radial-gradient(circle at 88% -10%, rgba(23, 195, 229, .5), transparent 55%),
        linear-gradient(135deg, var(--chat-navy) 0%, #0B2A55 100%);
    color: #fff;
    padding: .9rem 1rem;
    display: flex; align-items: center; gap: .7rem;
}
.es-chat-head::after {
    content: ''; position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px);
    background-size: 18px 18px; pointer-events: none;
}
.es-chat-head .brand-avatar {
    width: 42px; height: 42px; border-radius: 14px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .2);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem; color: var(--chat-cyan); flex: none;
    position: relative; z-index: 1;
}
.es-chat-head .title { flex: 1; min-width: 0; position: relative; z-index: 1; }
.es-chat-head .title .n { font-weight: 700; font-size: .95rem; font-family: 'Montserrat', sans-serif; }
.es-chat-head .title .s { font-size: .72rem; opacity: .85; display: flex; align-items: center; gap: .32rem; }
.es-chat-head .dot {
    width: 7px; height: 7px; border-radius: 50%; background: #94A3B8; flex: none;
}
.es-chat-head .dot.on { background: var(--chat-success); box-shadow: 0 0 0 3px rgba(16, 185, 129, .25); }
.es-chat-head .acts { display: flex; gap: .15rem; position: relative; z-index: 1; }
.es-chat-head .acts button {
    width: 30px; height: 30px; border-radius: 9px;
    border: none; background: rgba(255, 255, 255, .1); color: #fff;
    cursor: pointer; font-size: .82rem;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .18s;
}
.es-chat-head .acts button:hover { background: rgba(255, 255, 255, .22); }

/* Corps : formulaire d'accueil */
.es-chat-body { flex: 1; overflow-y: auto; }
.es-intro { padding: 1.15rem 1.15rem 1.3rem; }
.es-intro-hero { text-align: center; margin-bottom: 1.1rem; }
.es-intro-hero .wave { font-size: 2rem; display: block; margin-bottom: .2rem; animation: esWave 2.4s ease-in-out infinite; transform-origin: 70% 70%; }
@keyframes esWave {
    0%, 60%, 100% { transform: rotate(0); }
    10%, 30% { transform: rotate(14deg); }
    20% { transform: rotate(-8deg); }
}
.es-intro-hero h3 {
    font-family: 'Montserrat', sans-serif; font-weight: 800;
    font-size: 1.08rem; color: var(--chat-navy); margin: 0 0 .25rem;
}
.es-intro-hero p { font-size: .8rem; color: var(--chat-muted); margin: 0; line-height: 1.5; }

.es-field { margin-bottom: .6rem; }
.es-field label {
    display: block; font-size: .74rem; font-weight: 700;
    color: var(--chat-ink); margin-bottom: .22rem;
}
.es-field .ctrl { position: relative; }
.es-field .ctrl > i {
    position: absolute; inset-inline-start: .7rem; top: 50%;
    transform: translateY(-50%); color: #94A3B8; font-size: .9rem; pointer-events: none;
}
.es-field input {
    width: 100%; box-sizing: border-box;
    padding: .58rem .75rem .58rem 2.15rem;
    border: 1px solid var(--chat-border); border-radius: 11px;
    font-size: .85rem; color: var(--chat-ink); background: #fff;
    transition: border-color .18s, box-shadow .18s;
    font-family: inherit;
}
[dir="rtl"] .es-field input { padding: .58rem 2.15rem .58rem .75rem; }
.es-field input:focus {
    outline: none; border-color: var(--chat-blue);
    box-shadow: 0 0 0 3px rgba(23, 107, 255, .13);
}
.es-field input.invalid { border-color: #EF4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .12); }
.es-field .err { font-size: .7rem; color: #EF4444; margin-top: .18rem; display: none; }
.es-field .err.show { display: block; }

.es-consent {
    display: flex; gap: .5rem; align-items: flex-start;
    font-size: .72rem; color: var(--chat-muted); line-height: 1.45;
    margin: .5rem 0 .9rem;
}
.es-consent input { margin-top: .12rem; accent-color: var(--chat-blue); flex: none; }

.es-btn-primary {
    width: 100%; border: none; cursor: pointer;
    padding: .72rem 1rem; border-radius: 12px;
    background: linear-gradient(135deg, var(--chat-blue), var(--chat-cyan));
    color: #fff; font-weight: 700; font-size: .88rem;
    display: flex; align-items: center; justify-content: center; gap: .45rem;
    box-shadow: 0 8px 24px rgba(23, 107, 255, .32);
    transition: transform .2s, box-shadow .2s, opacity .2s;
    font-family: inherit;
}
.es-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(23, 107, 255, .42); }
.es-btn-primary:disabled { opacity: .6; cursor: wait; transform: none; }

.es-trust {
    display: flex; align-items: center; justify-content: center; gap: .35rem;
    margin-top: .75rem; font-size: .68rem; color: var(--chat-muted);
}

/* Pied de widget */
.es-chat-foot {
    padding: .3rem .8rem .5rem;
    text-align: center;
    font-size: .64rem;
    color: #94A3B8;
    background: #fff;
}
.es-chat-foot strong { color: var(--chat-blue); }

/* Évaluation de fin */
.es-rating { padding: 1rem; text-align: center; }
.es-rating .stars { display: flex; justify-content: center; gap: .3rem; margin: .6rem 0 .8rem; }
.es-rating .stars button {
    border: none; background: none; cursor: pointer;
    font-size: 1.55rem; color: #CBD5E1; padding: 0;
    transition: transform .15s, color .15s;
}
.es-rating .stars button:hover, .es-rating .stars button.on { color: var(--chat-gold); transform: scale(1.15); }

/* Responsive : plein écran sur mobile */
@media (max-width: 575.98px) {
    #esChat { inset-block-end: 16px; inset-inline-end: 16px; }
    #esChatPanel {
        position: fixed;
        inset: 0;
        width: 100vw; height: 100dvh;
        border-radius: 0;
    }
    #esChatTeaser { display: none !important; }
    .es-msg { max-width: 90%; }
}

@media (prefers-reduced-motion: reduce) {
    #esChatToggle, #esChatPanel, .es-msg, .es-emoji, #esChatTeaser,
    .es-intro-hero .wave, #esChatToggle::after { animation: none !important; transition: none !important; }
    .es-thread { scroll-behavior: auto; }
}

/* ══════════════════ Console NOURA ══════════════════ */

.n-messenger {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr) 290px;
    gap: 1rem;
    height: calc(100vh - 150px);
    min-height: 520px;
}
.n-messenger > section {
    background: #fff;
    border: 1px solid var(--chat-border);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(7, 26, 54, .06), 0 4px 16px rgba(7, 26, 54, .05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Colonne file d'attente */
.n-queue-head {
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--chat-border);
    display: flex; align-items: center; justify-content: space-between;
}
.n-queue-head h3 { font-size: .9rem; font-weight: 700; margin: 0; color: var(--chat-navy); }
.n-queue-list { overflow-y: auto; flex: 1; }
.n-queue-item {
    display: flex; gap: .65rem; align-items: flex-start;
    padding: .7rem .9rem;
    border-bottom: 1px solid #EEF3F9;
    text-decoration: none; color: inherit;
    transition: background .15s;
    position: relative;
}
.n-queue-item:hover { background: #F8FAFD; color: inherit; }
.n-queue-item.active { background: rgba(23, 107, 255, .07); }
.n-queue-item.active::before {
    content: ''; position: absolute; inset-block: 0; inset-inline-start: 0;
    width: 3px; background: var(--chat-blue);
}
.n-queue-item .av {
    width: 38px; height: 38px; border-radius: 50%; flex: none;
    background: linear-gradient(135deg, var(--chat-blue), var(--chat-cyan));
    color: #fff; font-weight: 700; font-size: .8rem;
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
.n-queue-item .av .pres {
    position: absolute; inset-block-end: -1px; inset-inline-end: -1px;
    width: 11px; height: 11px; border-radius: 50%;
    background: #CBD5E1; border: 2px solid #fff;
}
.n-queue-item .av .pres.on { background: var(--chat-success); }
.n-queue-item .txt { flex: 1; min-width: 0; }
.n-queue-item .txt .n { font-size: .82rem; font-weight: 600; color: var(--chat-navy); }
.n-queue-item .txt .m {
    font-size: .73rem; color: var(--chat-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.n-queue-item .side { text-align: end; flex: none; }
.n-queue-item .side .t { font-size: .65rem; color: #94A3B8; }
.n-queue-item .side .u {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px; margin-top: .2rem;
    background: #EF4444; color: #fff; border-radius: 999px;
    font-size: .64rem; font-weight: 800;
}

/* Colonne conversation */
.n-conv-head {
    padding: .7rem 1rem;
    border-bottom: 1px solid var(--chat-border);
    display: flex; align-items: center; gap: .7rem;
    background: #fff;
}
.n-conv-head .av {
    width: 42px; height: 42px; border-radius: 50%; flex: none;
    background: linear-gradient(135deg, var(--chat-navy), #0B2A55);
    color: #fff; font-weight: 700; font-size: .9rem;
    display: flex; align-items: center; justify-content: center;
}
.n-conv-head .who { flex: 1; min-width: 0; }
.n-conv-head .who .n { font-weight: 700; font-size: .95rem; color: var(--chat-navy); }
.n-conv-head .who .s { font-size: .72rem; color: var(--chat-muted); display: flex; align-items: center; gap: .3rem; }
.n-conv-head .who .s .dot { width: 7px; height: 7px; border-radius: 50%; background: #CBD5E1; }
.n-conv-head .who .s .dot.on { background: var(--chat-success); box-shadow: 0 0 0 3px rgba(16, 185, 129, .2); }

.n-conv-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.n-conv-body .es-thread { flex: 1; }

/* Panneau visiteur */
.n-info { overflow-y: auto; }
.n-info-block { padding: .9rem 1rem; border-bottom: 1px solid #EEF3F9; }
.n-info-block h4 {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .1em;
    color: var(--chat-muted); font-weight: 800; margin: 0 0 .5rem;
}
.n-info-row { display: flex; justify-content: space-between; gap: .5rem; font-size: .79rem; padding: .18rem 0; }
.n-info-row .k { color: var(--chat-muted); flex: none; }
.n-info-row .v { text-align: end; word-break: break-word; font-weight: 500; }

.n-canned-btn {
    display: block; width: 100%; text-align: start;
    border: 1px solid var(--chat-border); background: #fff;
    border-radius: 10px; padding: .45rem .6rem; margin-bottom: .35rem;
    font-size: .76rem; cursor: pointer;
    transition: border-color .15s, background .15s;
}
.n-canned-btn:hover { border-color: var(--chat-blue); background: rgba(23, 107, 255, .05); }
.n-canned-btn code { color: var(--chat-blue); font-size: .72rem; }

/* Le panneau visiteur s'appuie sur l'offcanvas responsive de Bootstrap
   (.offcanvas-xxl) : colonne fixe au-delà de 1400 px, tiroir latéral en
   dessous — backdrop, Échap et RTL gérés nativement par le framework. */
.n-info-toggle { display: none; }

@media (max-width: 1399.98px) {
    .n-messenger { grid-template-columns: 270px minmax(0, 1fr); }
    .n-info-toggle { display: inline-flex; }
    /* En mode tiroir, la carte occupe toute la hauteur sans bordure arrondie */
    .n-messenger > .n-info.offcanvas-xxl {
        border-radius: 0;
        border-block: none;
        width: min(340px, 92vw);
    }
}

@media (max-width: 991.98px) {
    .n-messenger { grid-template-columns: minmax(0, 1fr); height: auto; }
    .n-messenger > .n-queue { max-height: 300px; }
    .n-messenger > .n-conv { height: 72vh; }
}
