.aat-widget {
    position: fixed;
    right: 18px;
    bottom: 96px;
    z-index: 9999;
    font-family: Arial, Helvetica, sans-serif;
}

.aat-widget__toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: 999px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #0f5a97, #0d2f4f);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(13, 47, 79, .28);
    font-weight: 700;
}

.aat-widget__toggle-icon {
    font-size: 18px;
}

.aat-widget__panel {
    width: min(390px, calc(100vw - 24px));
    height: min(640px, calc(100vh - 90px));
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 20px 50px rgba(13, 47, 79, .22);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(15, 90, 151, .12);
}

.aat-widget.is-open .aat-widget__panel,
.aat-widget--page .aat-widget__panel {
    display: flex;
}

.aat-widget.is-open .aat-widget__toggle {
    display: none;
}

.aat-widget__panel--page {
    width: 100%;
    max-width: 900px;
    height: 72vh;
    display: flex;
    margin: 0 auto;
}

.aat-widget__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    background: linear-gradient(135deg, #0f5a97, #0d2f4f);
    color: #fff;
}

.aat-widget__header strong {
    display: block;
    font-size: 16px;
}

.aat-widget__header small {
    display: block;
    opacity: .9;
    margin-top: 4px;
}

.aat-widget__close {
    background: rgba(255,255,255,.16);
    color: #fff;
    border: 0;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    font-size: 24px;
    cursor: pointer;
}

.aat-widget__messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f4f7fb;
}

.aat-bubble {
    max-width: 88%;
    margin-bottom: 88px;
    border-radius: 18px;
    padding: 12px 14px;
    box-shadow: 0 8px 18px rgba(18, 52, 86, .08);
    line-height: 1.6;
    font-size: 14px;
}

.aat-bubble--assistant {
    background: #fff;
    color: #17324d;
}

.aat-bubble--user {
    margin-left: auto;
    background: #0f5a97;
    color: #fff;
}

.aat-bubble__label {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
    opacity: .78;
}

.aat-bubble__sources {
    margin-top: 10px;
    border-top: 1px solid rgba(0,0,0,.08);
    padding-top: 10px;
}

.aat-bubble__sources strong {
    display: block;
    font-size: 12px;
    margin-bottom: 6px;
}

.aat-bubble__sources a {
    display: block;
    color: inherit;
    text-decoration: none;
    margin-top: 4px;
    font-size: 12px;
    opacity: .9;
}

.aat-widget__form {
    border-top: 1px solid rgba(15, 90, 151, .12);
    padding: 14px;
    background: #fff;
}

.aat-widget__form textarea {
    width: 100%;
    border: 1px solid #c6d7e8;
    border-radius: 14px;
    padding: 12px 14px;
    resize: none;
    font: inherit;
    min-height: 54px;
    box-sizing: border-box;
}

.aat-widget__form-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-top: 10px;
}

.aat-widget__hint {
    color: #61788d;
    font-size: 12px;
}

.aat-widget__send {
    border: 0;
    border-radius: 12px;
    background: #0f5a97;
    color: #fff;
    font-weight: 700;
    padding: 12px 18px;
    cursor: pointer;
}

.aat-widget__send[disabled] {
    opacity: .7;
    cursor: wait;
}

.aat-page {
    padding: 10px 0 30px;
}

.aat-page__hero {
    margin-bottom: 16px;
}

.aat-page__hero h1 {
    margin: 0 0 8px;
    color: #0d2f4f;
}

.aat-page__hero p {
    margin: 0;
    color: #5a7187;
}

@media (max-width: 640px) {
    .aat-widget {
        right: 12px;
        left: 12px;
        bottom: 12px;
    }

    .aat-widget__toggle {
        width: 100%;
        justify-content: center;
    }

    .aat-widget__panel {
        width: 100%;
        height: calc(100vh - 24px);
    }

    .aat-widget__panel--page {
        height: calc(100vh - 180px);
    }
}
