:root{
    --fegi-chat-red:#C40101;
    --fegi-chat-red-dark:#8F0000;
    --fegi-chat-dark:#111827;
    --fegi-chat-muted:#64748b;
    --fegi-chat-border:#e2e8f0;
    --fegi-chat-bg:#ffffff;
    --fegi-chat-soft:#f8fafc;
}

#fegiWebChatLauncher{
    position:fixed;
    right:max(16px, env(safe-area-inset-right));
    bottom:94px;
    z-index:100020;
    width:58px;
    height:58px;
    border:0;
    border-radius:999px;
    display:grid;
    place-items:center;
    background:linear-gradient(135deg,var(--fegi-chat-red),#ef2d2d);
    color:#fff;
    box-shadow:0 18px 44px rgba(0,0,0,.22);
    cursor:pointer;
}

#fegiWebChatLauncher:hover{
    transform:translateY(-2px);
}

#fegiWebChatLauncher .fegi-chat-dot{
    width:22px;
    height:18px;
    border:2px solid #fff;
    border-radius:7px;
    position:relative;
}

#fegiWebChatLauncher .fegi-chat-dot::after{
    content:"";
    position:absolute;
    left:3px;
    bottom:-6px;
    width:7px;
    height:7px;
    border-left:2px solid #fff;
    transform:skew(-25deg);
}

#fegiWebChatBox{
    position:fixed;
    right:max(16px, env(safe-area-inset-right));
    bottom:166px;
    z-index:100021;
    width:min(390px, calc(100vw - 24px));
    height:min(620px, calc(100vh - 190px));
    display:none;
    flex-direction:column;
    overflow:hidden;
    border:1px solid rgba(15,23,42,.10);
    border-radius:24px;
    background:var(--fegi-chat-bg);
    box-shadow:0 28px 70px rgba(15,23,42,.24);
}

#fegiWebChatBox.is-open{
    display:flex;
}

.fegi-chat-head{
    display:flex;
    align-items:center;
    gap:11px;
    padding:14px 15px;
    background:linear-gradient(135deg,#151515,#320606);
    color:#fff;
}

.fegi-chat-logo{
    width:42px;
    height:42px;
    border-radius:12px;
    background:#fff;
    display:grid;
    place-items:center;
    overflow:hidden;
}

.fegi-chat-logo img{
    width:100%;
    height:100%;
    object-fit:contain;
}

.fegi-chat-head-copy{
    min-width:0;
    flex:1;
}

.fegi-chat-head-copy strong{
    display:block;
    font-size:14px;
}

.fegi-chat-head-copy span{
    display:block;
    margin-top:3px;
    font-size:10px;
    color:rgba(255,255,255,.66);
}

.fegi-chat-close{
    width:36px;
    height:36px;
    border:0;
    border-radius:10px;
    background:rgba(255,255,255,.1);
    color:#fff;
    font-size:20px;
    cursor:pointer;
}

.fegi-chat-messages{
    flex:1;
    overflow:auto;
    padding:14px;
    background:
        radial-gradient(circle at top left, rgba(196,1,1,.04), transparent 30%),
        var(--fegi-chat-soft);
}

.fegi-chat-row{
    display:flex;
    margin:8px 0;
}

.fegi-chat-row.bot{
    justify-content:flex-start;
}

.fegi-chat-row.user{
    justify-content:flex-end;
}

.fegi-chat-bubble{
    max-width:84%;
    padding:10px 11px;
    border-radius:14px;
    font-size:13px;
    line-height:1.45;
    box-shadow:0 3px 10px rgba(15,23,42,.04);
}

.bot .fegi-chat-bubble{
    background:#fff;
    border:1px solid var(--fegi-chat-border);
    color:var(--fegi-chat-dark);
}

.user .fegi-chat-bubble{
    background:var(--fegi-chat-red);
    color:#fff;
}

.fegi-chat-quick{
    display:flex;
    flex-wrap:wrap;
    gap:7px;
    margin-top:9px;
}

.fegi-chat-chip{
    border:1px solid #d9e1e8;
    border-radius:999px;
    padding:7px 9px;
    background:#fff;
    color:#334155;
    font-size:11px;
    font-weight:700;
    cursor:pointer;
}

.fegi-chat-chip:hover{
    border-color:rgba(196,1,1,.35);
    color:var(--fegi-chat-red);
}

.fegi-chat-actions{
    display:flex;
    flex-wrap:wrap;
    gap:7px;
    margin-top:8px;
}

.fegi-chat-action{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:36px;
    padding:7px 10px;
    border-radius:10px;
    background:#111827;
    color:#fff;
    text-decoration:none;
    font-size:11px;
    font-weight:800;
}

.fegi-chat-footer{
    padding:10px;
    border-top:1px solid var(--fegi-chat-border);
    background:#fff;
}

.fegi-chat-form{
    display:flex;
    gap:8px;
}

.fegi-chat-input{
    flex:1;
    min-width:0;
    border:1px solid var(--fegi-chat-border);
    border-radius:12px;
    padding:10px 11px;
    font:inherit;
    font-size:13px;
    outline:none;
}

.fegi-chat-input:focus{
    border-color:rgba(196,1,1,.55);
    box-shadow:0 0 0 3px rgba(196,1,1,.08);
}

.fegi-chat-send{
    min-width:48px;
    border:0;
    border-radius:12px;
    background:var(--fegi-chat-red);
    color:#fff;
    font-weight:900;
    cursor:pointer;
}

.fegi-chat-status{
    margin-top:6px;
    color:var(--fegi-chat-muted);
    font-size:9px;
    text-align:center;
}

@media(max-width:480px){
    #fegiWebChatLauncher{
        right:max(10px, env(safe-area-inset-right));
        bottom:80px;
        width:54px;
        height:54px;
    }

    #fegiWebChatBox{
        right:10px;
        left:10px;
        width:auto;
        bottom:145px;
        height:min(68vh,620px);
        border-radius:20px;
    }
}


/* FEGI WebChat v1.1 - conversación guiada */
.fegi-chat-bubble{white-space:pre-line}
.fegi-chat-bubble .fegi-chat-quick,
.fegi-chat-bubble .fegi-chat-actions{white-space:normal}
.fegi-chat-action:hover{
    background:#C40101;
    color:#fff;
    transform:translateY(-1px)
}
.fegi-chat-chip:hover{background:#fff7f7}



/* FEGI WebChat v1.2 - Captura de lead */
.fegi-chat-lead-trigger{
    border:0;
    cursor:pointer;
    background:#C40101;
}

.fegi-chat-lead-form-wrap{
    margin-top:12px;
    padding-top:12px;
    border-top:1px solid #e2e8f0;
}

.fegi-chat-lead-title{
    display:block;
    font-size:12px;
    color:#111827;
}

.fegi-chat-lead-note{
    margin:4px 0 9px;
    color:#64748b;
    font-size:10px;
    line-height:1.4;
}

.fegi-chat-lead-form{
    display:grid;
    gap:8px;
}

.fegi-chat-lead-input{
    width:100%;
    border:1px solid #dbe3ea;
    border-radius:10px;
    padding:9px 10px;
    background:#fff;
    color:#111827;
    font:inherit;
    font-size:11px;
    outline:none;
}

.fegi-chat-lead-input:focus{
    border-color:rgba(196,1,1,.55);
    box-shadow:0 0 0 3px rgba(196,1,1,.08);
}

.fegi-chat-privacy{
    display:flex;
    gap:7px;
    align-items:flex-start;
    color:#64748b;
    font-size:9px;
    line-height:1.4;
    cursor:pointer;
}

.fegi-chat-privacy input{
    margin-top:2px;
    flex:0 0 auto;
}

.fegi-chat-privacy a{
    color:#9E0101;
    font-weight:700;
}

.fegi-chat-lead-submit{
    border:0;
    border-radius:10px;
    min-height:38px;
    padding:8px 11px;
    background:#111827;
    color:#fff;
    font-size:11px;
    font-weight:800;
    cursor:pointer;
}

.fegi-chat-lead-submit:disabled{
    opacity:.65;
    cursor:wait;
}

.fegi-chat-lead-status{
    min-height:14px;
    font-size:9px;
    line-height:1.35;
}

.fegi-chat-lead-status.is-success{
    color:#267451;
}

.fegi-chat-lead-status.is-error{
    color:#9E3340;
}