.oly-ai-chat-panel[data-oly-ai-chat-app] {
    width: min(410px, calc(100vw - 28px));
    gap: 11px;
    padding: 17px;
}

.oly-ai-chat-panel__status.is-ready i {
    background: #19a974;
    box-shadow: 0 0 0 5px rgba(25, 169, 116, .12);
}

.oly-ai-chat-panel__head .oly-ai-chat-panel__head-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.oly-ai-chat-panel__head {
    grid-template-columns: 36px minmax(0, 1fr) auto;
}

.oly-ai-chat-panel__clear {
    min-height: 28px;
    padding: 5px 8px;
    border: 1px solid rgba(56, 128, 162, .18);
    border-radius: 8px;
    background: #fff;
    color: var(--oly-muted);
    cursor: pointer;
    font: inherit;
    font-size: 8px;
    font-weight: 800;
    white-space: nowrap;
}

.oly-ai-chat-panel__clear:hover { color: var(--oly-navy); }
.oly-ai-chat-panel__clear:disabled { cursor: wait; opacity: .55; }

.oly-ai-chat-messages {
    display: grid;
    align-content: start;
    gap: 10px;
    min-height: 138px;
    max-height: min(390px, 48vh);
    overflow: auto;
    padding: 12px;
    border: 1px solid rgba(73, 137, 168, .15);
    border-radius: 18px 18px 18px 7px;
    background: linear-gradient(145deg, #f7fcfe, #fff);
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.oly-ai-chat-message {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    max-width: 92%;
}

.oly-ai-chat-message > span {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--oly-primary), var(--oly-blue));
    color: #fff;
    font-size: 8px;
    font-weight: 950;
    letter-spacing: .04em;
}

.oly-ai-chat-message p {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid rgba(73, 137, 168, .13);
    border-radius: 5px 15px 15px 15px;
    background: #fff;
    color: var(--oly-ink);
    font-size: 12px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.oly-ai-chat-message.is-user {
    grid-template-columns: minmax(0, 1fr);
    justify-self: end;
}

.oly-ai-chat-message.is-user p {
    border-color: color-mix(in srgb, var(--oly-primary) 25%, transparent);
    border-radius: 15px 5px 15px 15px;
    background: color-mix(in srgb, var(--oly-primary) 10%, #fff);
}

.oly-ai-chat-message.is-pending p {
    color: var(--oly-muted);
}

.oly-ai-chat-message.is-pending p::after {
    content: "…";
    animation: oly-ai-chat-pulse 1.1s ease-in-out infinite;
}

.oly-ai-chat-message__sources,
.oly-ai-chat-message__contacts {
    display: flex;
    grid-column: 2;
    flex-wrap: wrap;
    gap: 6px;
}

.oly-ai-chat-message__sources a,
.oly-ai-chat-message__contacts a,
.oly-ai-chat-contact-fallback {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 9px;
    border: 1px solid rgba(56, 128, 162, .18);
    border-radius: 10px;
    background: #fff;
    color: var(--oly-navy);
    font-size: 9px;
    font-weight: 850;
    line-height: 1.25;
    text-decoration: none;
}

.oly-ai-chat-message__contacts a {
    border-color: color-mix(in srgb, var(--oly-primary) 32%, transparent);
}

.oly-ai-chat-message__feedback {
    display: flex;
    grid-column: 2;
    align-items: center;
    gap: 5px;
    color: var(--oly-muted);
    font-size: 8px;
}

.oly-ai-chat-message__feedback button {
    min-height: 25px;
    padding: 3px 7px;
    border: 1px solid rgba(56, 128, 162, .18);
    border-radius: 8px;
    background: #fff;
    color: var(--oly-navy);
    cursor: pointer;
    font: inherit;
    font-weight: 850;
}

.oly-ai-chat-message__feedback button:disabled { cursor: wait; opacity: .55; }

.oly-ai-chat-form {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    gap: 7px;
}

.oly-ai-chat-form textarea {
    width: 100%;
    min-height: 48px;
    max-height: 118px;
    resize: vertical;
    padding: 10px 11px;
    border: 1px solid rgba(67, 132, 164, .22);
    border-radius: 14px 14px 14px 5px;
    background: #fff;
    color: var(--oly-ink);
    font: inherit;
    font-size: 12px;
    line-height: 1.4;
}

.oly-ai-chat-form textarea:focus {
    border-color: var(--oly-primary);
    outline: 3px solid color-mix(in srgb, var(--oly-primary) 15%, transparent);
}

.oly-ai-chat-form textarea:disabled {
    cursor: not-allowed;
    opacity: .62;
}

.oly-ai-chat-form button {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    align-self: end;
    border: 0;
    border-radius: 13px 13px 13px 5px;
    background: linear-gradient(135deg, var(--oly-primary), var(--oly-blue));
    box-shadow: 0 9px 20px color-mix(in srgb, var(--oly-primary) 22%, transparent);
    color: #fff;
    cursor: pointer;
}

.oly-ai-chat-form button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.oly-ai-chat-form button b {
    font-size: 18px;
}

.oly-ai-chat-form button:disabled {
    cursor: wait;
    filter: grayscale(.45);
    opacity: .58;
}

.oly-ai-chat-honeypot {
    position: absolute !important;
    left: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.oly-ai-chat-disclaimer {
    color: var(--oly-muted);
    font-size: 8px;
    line-height: 1.4;
}

.oly-ai-chat-contact-fallback {
    justify-content: center;
    min-height: 38px;
    border-color: color-mix(in srgb, var(--oly-primary) 35%, transparent);
}

@keyframes oly-ai-chat-pulse {
    50% { opacity: .25; }
}

@media (max-width: 620px) {
    .oly-ai-chat-panel[data-oly-ai-chat-app] {
        right: 10px;
        top: 68px;
        width: calc(100vw - 20px);
        max-height: calc(100vh - 82px);
        padding: 14px;
    }

    .oly-ai-chat-messages {
        max-height: min(410px, 46vh);
    }
}

@media (prefers-reduced-motion: reduce) {
    .oly-ai-chat-message.is-pending p::after { animation: none; }
}

html[dir="rtl"] .oly-ai-chat-message p { text-align: right; }
html[dir="rtl"] .oly-ai-chat-message.is-user { justify-self: start; }
html[dir="rtl"] .oly-ai-chat-message__sources,
html[dir="rtl"] .oly-ai-chat-message__contacts { grid-column: 2; }
