#miniIA-btn{
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #1E3A8A;
    color: #fff;
    border-radius: 50%;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size: 26px;
    cursor:pointer;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    z-index:9999;
}

#miniIA-panel{
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 320px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    display:none;
    flex-direction: column;
    overflow:hidden;
    z-index:9999;
}

.miniIA-header{
    background:#1E3A8A;
    color:#fff;
    padding:10px;
    display:flex;
    justify-content:space-between;
}

#miniIA-mensajes{
    max-height:250px;
    overflow-y:auto;
    padding:10px;
}

.msg{
    margin-bottom:8px;
    padding:8px;
    border-radius:8px;
}

.msg.ia{ background:#e5e7eb; }
.msg.user{ background:#3B82F6; color:#fff; text-align:right; }

.miniIA-quick{
    padding:5px;
    display:flex;
    flex-wrap:wrap;
    gap:5px;
}

.miniIA-quick button{
    flex:1;
    font-size:12px;
}

.miniIA-input{
    display:flex;
}

.miniIA-input input{
    flex:1;
    padding:8px;
    border:none;
}

.miniIA-input button{
    background:#1E3A8A;
    color:#fff;
    border:none;
    padding:8px 12px;
}

.miniIA-whatsapp{
    text-align:center;
    padding:8px;
}

.miniIA-whatsapp a{
    background:#25D366;
    color:#fff;
    padding:6px 12px;
    border-radius:8px;
    text-decoration:none;
}

#miniIA-btn{
    position: fixed;
    right: 22px;
    bottom: 22px;
    width: 78px;
    height: 78px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #d9b24c;
    box-shadow:
        0 14px 32px rgba(15, 23, 42, 0.18),
        0 4px 14px rgba(15, 23, 42, 0.10),
        inset 0 1px 0 rgba(255,255,255,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    overflow: hidden;
    transition: transform .25s ease, box-shadow .25s ease, opacity .25s ease;
    -webkit-tap-highlight-color: transparent;
}

#miniIA-btn:hover{
    transform: translateY(-2px) scale(1.04);
    box-shadow:
        0 18px 36px rgba(15, 23, 42, 0.22),
        0 6px 18px rgba(15, 23, 42, 0.12),
        inset 0 1px 0 rgba(255,255,255,0.95);
}

#miniIA-btn img{
    width: 88%;
    height: 88%;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

#miniIA-tooltip{
    position: fixed;
    right: 28px;
    bottom: 114px;
    max-width: 220px;
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(255,255,255,0.95);
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    border: 1px solid rgba(217,178,76,0.45);
    box-shadow:
        0 14px 32px rgba(15, 23, 42, 0.14),
        0 2px 10px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    z-index: 9998;
    animation: miniIATooltipIn .35s ease;
}

#miniIA-tooltip::after{
    content: "";
    position: absolute;
    right: 24px;
    bottom: -7px;
    width: 14px;
    height: 14px;
    background: rgba(255,255,255,0.95);
    border-right: 1px solid rgba(217,178,76,0.35);
    border-bottom: 1px solid rgba(217,178,76,0.35);
    transform: rotate(45deg);
}

#miniIA-panel{
    position: fixed;
    right: 22px;
    bottom: 116px;
    width: 360px;
    max-width: calc(100vw - 24px);
    border-radius: 24px;
    background: rgba(255,255,255,0.76);
    border: 1px solid rgba(255,255,255,0.55);
    box-shadow:
        0 26px 60px rgba(15, 23, 42, 0.20),
        0 10px 24px rgba(15, 23, 42, 0.12),
        inset 0 1px 0 rgba(255,255,255,0.65);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    overflow: hidden;
    z-index: 9999;
    display: none;
    transform: translateY(16px) scale(0.98);
    opacity: 0;
    transition: opacity .28s ease, transform .28s ease;
}

#miniIA-panel.is-open{
    display: block;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.miniIA-header{
    position: relative;
    padding: 16px 18px 14px;
    background: linear-gradient(135deg, rgba(30,58,138,0.96), rgba(59,130,246,0.92));
    color: #fff;
}

.miniIA-header::after{
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(255,255,255,0.16), transparent 45%, rgba(255,255,255,0.07));
    pointer-events: none;
}

.miniIA-header-text{
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-right: 40px;
}

.miniIA-header-text strong{
    font-size: 22px;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.miniIA-header-text span{
    font-size: 12.5px;
    line-height: 1.35;
    color: rgba(255,255,255,0.88);
}

#miniIA-close{
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.14);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease, transform .2s ease;
}

#miniIA-close:hover{
    background: rgba(255,255,255,0.24);
    transform: scale(1.05);
}

#miniIA-mensajes{
    max-height: 280px;
    overflow-y: auto;
    padding: 16px 14px 8px;
    background:
        linear-gradient(to bottom, rgba(255,255,255,0.25), rgba(255,255,255,0.08));
}

#miniIA-mensajes::-webkit-scrollbar{
    width: 8px;
}

#miniIA-mensajes::-webkit-scrollbar-thumb{
    background: rgba(30,58,138,0.18);
    border-radius: 999px;
}

.msg{
    display: block;
    width: 100%;
    margin-bottom: 10px;
    clear: both;
    background: transparent !important;
    padding: 0 !important;
}

.msg::after{
    content: "";
    display: block;
    clear: both;
}

.msg-bubble{
    display: inline-block;
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.8px;
    line-height: 1.45;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
    word-break: break-word;
    white-space: normal;
    background-clip: padding-box;
}

/* IA */
.msg.ia{
    text-align: left;
    background: transparent !important;
    padding: 0 !important;
}

.msg.ia .msg-bubble{
    background: #f1f5f9;
    color: #1f2937;
    border: 1px solid rgba(209,218,230,0.6);
    border-top-left-radius: 6px;
}

/* USUARIO */
.msg.user{
    text-align: right;
    background: transparent !important;   /* <- este quita el fondo azul grande */
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
}

.msg.user .msg-bubble{
    background: linear-gradient(135deg, #1E3A8A, #3B82F6);
    color: #fff;
    border: 0;
    border-top-right-radius: 6px;
    box-shadow: 0 6px 14px rgba(30, 58, 138, 0.18);
}

.miniIA-quick{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 14px 14px;
}

.miniIA-quick button{
    border: 1px solid rgba(30,58,138,0.10);
    background: rgba(255,255,255,0.88);
    color: #1e3a8a;
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}

.miniIA-quick button:hover{
    transform: translateY(-1px);
    background: rgba(59,130,246,0.08);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.miniIA-input-wrap{
    padding: 0 14px 14px;
}

.miniIA-input{
    display: flex;
    align-items: center;
    border-radius: 18px;
    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(209,218,230,0.82);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.95),
        0 8px 18px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.miniIA-input input{
    flex: 1;
    min-width: 0;
    height: 54px;
    border: 0;
    outline: none;
    background: transparent;
    padding: 0 16px;
    font-size: 16px;
    color: #1f2937;
}

.miniIA-input input::placeholder{
    color: #94a3b8;
}

#miniIA-enviar{
    width: 56px;
    height: 54px;
    border: 0;
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter .2s ease, transform .2s ease;
    flex-shrink: 0;
}

#miniIA-enviar:hover{
    filter: brightness(1.05);
}

#miniIA-enviar span{
    font-size: 20px;
    transform: translateX(1px);
}

@keyframes vibrar {
    0%   { transform: rotate(0deg); }
    20%  { transform: rotate(-5deg); }
    40%  { transform: rotate(5deg); }
    60%  { transform: rotate(-4deg); }
    80%  { transform: rotate(4deg); }
    100% { transform: rotate(0deg); }
}

.vibrando{
    animation: vibrar .5s ease;
}

@keyframes miniIATooltipIn{
    from{
        opacity: 0;
        transform: translateY(10px);
    }
    to{
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 575px){
    #miniIA-btn{
        width: 74px;
        height: 74px;
        right: 14px;
        bottom: 14px;
    }

    #miniIA-tooltip{
        right: 14px;
        bottom: 105px;
        max-width: 190px;
        font-size: 13px;
    }

    #miniIA-panel{
        right: 10px;
        left: 10px;
        bottom: 100px;
        width: auto;
        max-width: none;
        border-radius: 22px;
    }

    .miniIA-header-text strong{
        font-size: 20px;
    }

    .msg-bubble{
        max-width: 92%;
        font-size: 15px;
    }

    .miniIA-input input{
        font-size: 15px;
        height: 50px;
    }

    #miniIA-enviar{
        width: 54px;
        height: 50px;
    }

    .miniIA-whatsapp-btn{
        min-height: 50px;
        font-size: 16px;
    }
}

.miniIA-header-actions{
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 2;
}

.miniIA-wa-top{
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(37, 211, 102, 0.18);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform .2s ease, background .2s ease;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.22);
}

.miniIA-wa-top:hover{
    transform: scale(1.05);
    background: rgba(37, 211, 102, 0.28);
}

.miniIA-wa-top svg{
    width: 18px;
    height: 18px;
    display: block;
}