/* Atendimento público por IA */
.public-chat {
    position: fixed;
    z-index: 90;
    right: 22px;
    bottom: 22px;
    font-size: 14px;
}

.consent:not([hidden]) + .public-chat {
    bottom: 142px;
}

.public-chat-launcher {
    min-width: 220px;
    gap: 11px;
    justify-content: flex-start;
    padding: 11px 17px 11px 11px;
    color: #fff;
    background: #2c3e50;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 999px;
    box-shadow: 0 16px 42px rgba(30, 43, 56, .3);
}

.public-chat-launcher:hover {
    background: #22313f;
}

.public-chat-launcher-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    color: #513900;
    background: #f4d985;
    border-radius: 50%;
}

.public-chat-launcher > span:last-child {
    display: grid;
    text-align: left;
    line-height: 1.25;
}

.public-chat-launcher small {
    margin-top: 3px;
    color: #d8e0e7;
    font-size: 11px;
    font-weight: 600;
}

.public-chat.is-open .public-chat-launcher {
    display: none;
}

.public-chat-panel {
    width: min(390px, calc(100vw - 28px));
    height: min(610px, calc(100vh - 110px));
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    background: #fff;
    border: 1px solid #d9c98e;
    border-radius: 22px;
    box-shadow: 0 24px 70px rgba(30, 43, 56, .28);
}

.public-chat-panel[hidden] {
    display: none;
}

.public-chat-header {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 16px;
    color: #fff;
    background: #2c3e50;
}

.public-chat-avatar {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    color: #513900;
    background: #f4d985;
    border-radius: 13px;
    font-size: 20px;
    font-weight: 900;
}

.public-chat-header > div:nth-child(2) {
    display: grid;
    flex: 1;
    line-height: 1.35;
}

.public-chat-header span {
    color: #d8e0e7;
    font-size: 11px;
}

.public-chat-header i {
    width: 7px;
    height: 7px;
    display: inline-block;
    margin-right: 5px;
    background: #61c992;
    border-radius: 50%;
}

.public-chat-close {
    width: 36px;
    height: 36px;
    padding: 0;
    color: #fff;
    background: rgba(255, 255, 255, .09);
    border-radius: 50%;
    box-shadow: none;
    font-size: 25px;
    font-weight: 400;
}

.public-chat-close:hover {
    background: rgba(255, 255, 255, .17);
}

.public-chat-messages {
    overflow-y: auto;
    padding: 18px 16px;
    background: #f7f7f8;
    overscroll-behavior: contain;
}

.public-chat-message {
    width: fit-content;
    max-width: 88%;
    margin: 0 0 11px;
    padding: 11px 13px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: #2c3e50;
    background: #fff;
    border: 1px solid #e2e5e8;
    border-radius: 7px 15px 15px 15px;
    line-height: 1.5;
    box-shadow: 0 5px 15px rgba(44, 62, 80, .06);
}

.public-chat-message.user {
    margin-left: auto;
    color: #fff;
    background: #2c3e50;
    border-color: #2c3e50;
    border-radius: 15px 7px 15px 15px;
}

.public-chat-message.typing {
    color: #6b7a8d;
    font-style: italic;
}

.public-chat-message.error {
    color: #7d2b2b;
    background: #fff4f2;
    border-color: #f0c7c1;
}

.public-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 4px;
}

.public-chat-suggestions button {
    padding: 8px 10px;
    color: #745500;
    background: #fff8e5;
    border: 1px solid #e4c869;
    border-radius: 999px;
    box-shadow: none;
    font-size: 11px;
}

.public-chat-suggestions button:hover {
    color: #fff;
    background: #9c7300;
}

.public-chat-form {
    padding: 13px;
    background: #fff;
    border-top: 1px solid #e2e5e8;
}

.public-chat-form > div {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.public-chat-form textarea {
    width: 100%;
    min-height: 44px;
    max-height: 96px;
    resize: none;
    padding: 11px 12px;
    color: #2c3e50;
    background: #f7f7f8;
    border: 1px solid #cdd3d8;
    border-radius: 12px;
    font: inherit;
    line-height: 1.4;
}

.public-chat-form button {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    padding: 0;
    border-radius: 12px;
}

.public-chat-form button:disabled {
    cursor: wait;
    opacity: .55;
}

.public-chat-form > small {
    display: block;
    margin-top: 8px;
    color: #6b7a8d;
    font-size: 10px;
    line-height: 1.4;
}

.public-chat-form a {
    color: #745500;
    text-decoration: underline;
}

@media (max-width: 600px) {
    .public-chat {
        right: 14px;
        bottom: 14px;
    }

    .consent:not([hidden]) + .public-chat {
        bottom: 255px;
    }

    .public-chat-launcher {
        min-width: 0;
        padding-right: 14px;
    }

    .public-chat-panel {
        height: min(620px, calc(100dvh - 28px));
    }
}

