/* Widget flutuante */
.aia-chat-widget{position:fixed;right:24px;bottom:24px;z-index:999999;font-family:inherit}
.aia-chat-toggle{display:flex;align-items:center;gap:9px;padding:13px 18px;border:0;border-radius:999px;background:#0e25ae;color:#fff;box-shadow:0 6px 22px rgba(0,0,0,.22);cursor:pointer;font:inherit;font-weight:600;transition:transform .15s ease,box-shadow .15s ease}
.aia-chat-toggle:hover{transform:translateY(-2px);box-shadow:0 9px 28px rgba(0,0,0,.26)}
.aia-chat-toggle__icon{font-size:21px;line-height:1}.aia-chat-toggle__label{font-size:14px}
.aia-chat{position:absolute;right:0;bottom:64px;width:360px;max-width:calc(100vw - 32px);border:1px solid #dbe4f0;border-radius:16px;overflow:hidden;background:#fff;box-shadow:0 12px 40px rgba(0,0,0,.2);font-family:inherit}
.aia-chat__header{padding:14px 16px;background:#072954;display:flex;justify-content:space-between;align-items:center;gap:12px}.aia-chat__status{display:block;font-size:11px;opacity:.65;margin-top:3px}.aia-chat__close{padding:0!important;border:0!important;background:transparent!important;color:#29496f!important;font-size:26px!important;line-height:1;cursor:pointer}.aia-chat__messages{height:350px;overflow:auto;padding:16px;background:#fbfbfb}.aia-msg{max-width:82%;padding:10px 13px;margin:8px 0;border-radius:14px;line-height:1.45;white-space:pre-wrap}.aia-msg--bot{background:#eef3fb;margin-right:auto}.aia-msg--user{background:#0e25ae;color:#fff;margin-left:auto}.aia-chat__form{display:flex;gap:8px;padding:12px;border-top:1px solid #dbe4f0}.aia-chat__form input{flex:1;min-width:0}.aia-chat input,.aia-chat button{padding:10px;border-radius:8px;border:1px solid #c9d5e5}.aia-chat button{cursor:pointer;background:#0e25ae;color:#fff;border:0}.aia-chat__fallback{padding:12px;border-top:1px solid #dbe4f0;background:#fff}
.aia-chat__fallback p{margin:0 0 10px;font-size:13px}
.aia-chat__fallback-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.aia-chat__fallback-actions button:first-child{background:#fff;color:#0e25ae;border:1px solid #0e25ae}
.aia-chat__ticket{padding:12px;border-top:1px solid #dbe4f0;display:grid;gap:8px}
.aia-chat__ticket p{margin:0;font-size:13px}
.aia-chat__ticket textarea{width:100%;box-sizing:border-box;resize:vertical;font:inherit}
.aia-chat__ticket-actions{display:flex;gap:8px}
.aia-chat__ticket-actions button:first-child{background:#fff;color:#29496f;border:1px solid #c9d5e5}
.aia-chat[hidden]{display:none!important}
@media (max-width:480px){.aia-chat__fallback-actions{grid-template-columns:1fr}.aia-chat__ticket-actions{flex-direction:column}}
.aia-admin-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:16px;margin-top:20px}.aia-card{background:#fff;border:1px solid #dbe4f0;padding:20px;border-radius:8px}.aia-card h2{margin-top:0;font-size:15px}.aia-card strong{font-size:28px}
@media (max-width:480px){.aia-chat-widget{right:14px;bottom:14px}.aia-chat{right:0;bottom:62px;width:calc(100vw - 28px)}.aia-chat__messages{height:45vh;min-height:260px;max-height:380px}.aia-chat-toggle__label{display:none}.aia-chat-toggle{width:54px;height:54px;padding:0;justify-content:center}.aia-chat-toggle__icon{font-size:23px}}

.aia-attendant-button{display:block;width:calc(100% - 24px);margin:0 12px 12px;padding:9px 12px;border:1px solid #0e25ae!important;border-radius:8px;background:#fff!important;color:#0e25ae!important;font:inherit;font-weight:600;cursor:pointer}
.aia-attendant-button:hover{background:#edf3ff!important}
.aia-chat__fallback{padding:12px;border-top:1px solid #dbe4f0;background:#fff}
.aia-chat__fallback p{margin:0 0 10px;font-size:13px}
.aia-chat__fallback-actions{display:flex;gap:8px;flex-wrap:wrap}
.aia-chat__secondary{padding:8px 10px!important;border:1px solid #0e25ae!important;border-radius:8px!important;background:#fff!important;color:#0e25ae!important;font:inherit;font-size:12px;cursor:pointer}
.aia-chat__secondary:hover{background:#edf3ff!important}
.aia-chat__ticket-actions{display:flex;gap:8px}
.aia-chat__ticket-actions button:first-child{background:#fff!important;color:#0e25ae!important;border:1px solid #0e25ae!important}
.aia-chat__ticket textarea{width:100%;box-sizing:border-box;resize:vertical;font:inherit}
.aia-chat__ticket[hidden],.aia-chat__fallback[hidden]{display:none!important}

.aia-chat__fallback{padding:12px;border-top:1px solid #dbe4f0;background:#eef3fb}.aia-chat__fallback p{margin:0 0 10px}.aia-chat__fallback-actions{display:flex;gap:8px;flex-direction:column}.aia-chat__fallback-actions button{width:100%}.aia-chat__ticket textarea{width:100%;box-sizing:border-box;resize:vertical}.aia-chat__ticket-actions{display:flex;gap:8px}.aia-chat__ticket-actions button{flex:1}


/* Paleta GuiaCont */
.aia-chat{
    border-color:#245194;
    background:#fbfbfb;
}
.aia-chat__header{
    background:#072954;
    color:#fff;
}
.aia-chat__header strong{
    color:#fff;
}
.aia-chat__status{
    color:#dbe8ff;
    opacity:1;
}
.aia-chat__close{
    color:#fff!important;
}
.aia-chat__messages{
    background:#fbfbfb;
}
.aia-msg--bot{
    background:#eef3fb;
    color:#072954;
}
.aia-msg--user{
    background:#0e25ae;
    color:#fff;
}
.aia-chat__form{
    background:#fff;
    border-top-color:#dbe4f0;
}
.aia-chat__form input,
.aia-chat__ticket input,
.aia-chat__ticket textarea{
    border-color:#c9d5e5;
    background:#fff;
    color:#072954;
}
.aia-chat__form input:focus,
.aia-chat__ticket input:focus,
.aia-chat__ticket textarea:focus{
    outline:2px solid #2669c6;
    outline-offset:1px;
    border-color:#2669c6;
}
.aia-chat button,
.aia-chat-toggle{
    background:#0e25ae;
    color:#fff;
}
.aia-chat-toggle{
    box-shadow:0 7px 24px rgba(7,41,84,.28);
}
.aia-chat-toggle:hover{
    background:#245194;
}
.aia-chat__fallback{
    background:#eef3fb;
    border-top-color:#dbe4f0;
}
.aia-chat__fallback-actions button:first-child,
.aia-chat__secondary,
.aia-chat__ticket-actions button:first-child{
    background:#fff!important;
    color:#0e25ae!important;
    border-color:#0e25ae!important;
}
.aia-chat__fallback-actions button:last-child,
.aia-chat__ticket-actions button:last-child{
    background:#0e25ae!important;
    color:#fff!important;
}
.aia-chat__ticket{
    background:#fbfbfb;
    border-top-color:#dbe4f0;
}


/* Modo compacto para janelas menores */
@media (max-width: 1200px), (max-height: 780px) {
    .aia-chat{
        width:320px;
        bottom:58px;
        border-radius:14px;
    }

    .aia-chat__header{
        padding:10px 12px;
    }

    .aia-chat__messages{
        height:260px;
        padding:12px;
    }

    .aia-msg{
        padding:8px 10px;
        margin:6px 0;
        font-size:14px;
    }

    .aia-chat__form{
        padding:9px;
        gap:6px;
    }

    .aia-chat input,
    .aia-chat button{
        padding:8px;
        font-size:13px;
    }

    .aia-chat__ticket{
        padding:9px;
        gap:6px;
    }

    .aia-chat__fallback{
        padding:9px;
    }

    .aia-chat-toggle{
        padding:11px 15px;
    }
}

/* Para janelas bem baixas, evita que o chat ocupe quase toda a tela */
@media (max-height: 650px) and (min-width: 481px) {
    .aia-chat{
        width:300px;
    }

    .aia-chat__messages{
        height:190px;
    }

    .aia-chat__header{
        padding:8px 10px;
    }

    .aia-chat__form{
        padding:8px;
    }
}


/* Impede mensagens, links e e-mails longos de criarem scroll horizontal */
.aia-chat,
.aia-chat *{
    box-sizing:border-box;
}

.aia-chat{
    overflow:hidden;
}

.aia-chat__messages{
    overflow-x:hidden;
}

.aia-msg{
    max-width:82%;
    min-width:0;
    overflow-wrap:anywhere;
    word-break:break-word;
    white-space:pre-wrap;
}

.aia-msg a,
.aia-chat a,
.aia-chat p,
.aia-chat span,
.aia-chat div{
    overflow-wrap:anywhere;
    word-break:break-word;
}

.aia-chat__form input,
.aia-chat__ticket input,
.aia-chat__ticket textarea{
    min-width:0;
    max-width:100%;
}

.aia-chat__fallback,
.aia-chat__ticket,
.aia-chat__form{
    min-width:0;
    max-width:100%;
}
