.public-grace-ai {
    bottom: 94px !important;
    font-family: Lato, Arial, sans-serif;
    left: auto !important;
    position: fixed !important;
    right: 24px !important;
    top: auto !important;
    z-index: 9998 !important;
}

.public-grace-ai-toggle,
.public-grace-ai-form button,
.public-grace-ai-close {
    align-items: center;
    border: 0;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
}

.public-grace-ai-toggle {
    background: #035b7f;
    border-radius: 50px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    color: #fff;
    gap: 8px;
    min-height: 52px;
    padding: 0 22px;
    position: relative;
    transition: background 0.2s ease, transform 0.2s ease;
}

.public-grace-ai-toggle:hover,
.public-grace-ai-toggle:focus {
    background: #024e6d;
    color: #fff;
    transform: translateY(-1px);
}

.public-grace-ai-panel {
    background: #fff;
    border: 1px solid #d9e6ec;
    border-radius: 8px;
    bottom: 66px;
    box-shadow: 0 14px 40px rgba(3, 91, 127, 0.22);
    display: flex;
    flex-direction: column;
    height: min(504px, calc(100vh - 140px));
    overflow: hidden;
    left: auto !important;
    position: absolute !important;
    right: 0 !important;
    width: min(342px, calc(100vw - 32px));
}

.public-grace-ai-panel[hidden] {
    display: none !important;
}

.public-grace-ai-header {
    align-items: center;
    background: #035b7f;
    color: #fff;
    display: flex;
    justify-content: space-between;
    padding: 16px 18px;
}

.public-grace-ai-header h2,
.public-grace-ai-header p {
    margin: 0;
}

.public-grace-ai-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.public-grace-ai-header p {
    font-size: 13px;
    opacity: 0.9;
}

.public-grace-ai-close {
    background: transparent;
    color: #fff;
    font-size: 18px;
    height: 36px;
    position: relative;
    width: 36px;
    z-index: 2;
}

.public-grace-ai-messages {
    background: #f7fafb;
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.public-grace-ai-message {
    display: flex;
    margin-bottom: 12px;
}

.public-grace-ai-message.is-user {
    justify-content: flex-end;
}

.public-grace-ai-bubble {
    background: #fff;
    border: 1px solid #deebef;
    border-radius: 8px;
    color: #26363d;
    font-size: 14px;
    line-height: 1.45;
    max-width: 82%;
    padding: 10px 12px;
    white-space: pre-wrap;
}

.public-grace-ai-message.is-user .public-grace-ai-bubble {
    background: #03a84e;
    border-color: #03a84e;
    color: #fff;
}

.public-grace-ai-typing {
    align-items: center;
    background: #f7fafb;
    gap: 5px;
    padding: 0 16px 12px;
}

.public-grace-ai-typing span {
    animation: public-grace-pulse 1s infinite ease-in-out;
    background: #7f99a5;
    border-radius: 50%;
    display: block;
    height: 7px;
    width: 7px;
}

.public-grace-ai-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.public-grace-ai-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

.public-grace-ai-form {
    align-items: center;
    background: #fff;
    border-top: 1px solid #deebef;
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 12px;
}

.public-grace-ai-form input {
    border: 1px solid #c9dce4;
    border-radius: 8px;
    color: #26363d;
    flex: 1;
    font-size: 14px;
    height: 42px;
    min-width: 0;
    padding: 0 12px;
}

.public-grace-ai-form button {
    background: #03a84e;
    border-radius: 8px;
    color: #fff;
    flex: 0 0 42px;
    height: 42px;
}

.public-grace-ai-form button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

@keyframes public-grace-pulse {
    0%,
    80%,
    100% {
        opacity: 0.35;
        transform: scale(0.9);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 600px) {
    .public-grace-ai {
        bottom: 74px !important;
        right: 10px !important;
    }

    .public-grace-ai-toggle {
        min-height: 48px;
        padding: 0 16px;
    }

    .public-grace-ai-panel {
        bottom: 58px;
        height: min(468px, calc(100vh - 92px));
        width: min(342px, calc(100vw - 20px));
    }
}
