.hdl-ai-chat {
    bottom: var(--hdl-ai-chat-bottom, 22px);
    position: fixed;
    right: 22px;
    z-index: 900;
}

.hdl-ai-chat,
.hdl-ai-chat * {
    box-sizing: border-box;
}

.hdl-ai-chat .sr-only {
    border: 0;
    clip: rect(0, 0, 0, 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.hdl-ai-chat__launcher {
    align-items: center;
    background: linear-gradient(135deg, #2f7cff 0%, #2467f2 38%, #7c2bd6 100%);
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 999px;
    box-shadow:
        0 12px 24px rgba(78, 70, 229, 0.32),
        0 5px 12px rgba(37, 99, 235, 0.2),
        0 0 0 6px rgba(99, 102, 241, 0.07);
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    font: 800 0.88rem/1 var(--font-sans, "DM Sans", system-ui, sans-serif);
    gap: 7px;
    letter-spacing: 0;
    min-height: 44px;
    min-width: 96px;
    overflow: hidden;
    padding: 0 15px;
    position: relative;
    text-shadow: 0 1px 1px rgba(15, 23, 42, 0.2);
    transition: box-shadow 0.18s ease, filter 0.18s ease, transform 0.18s ease;
}

.hdl-ai-chat__launcher::before {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0));
    border-radius: inherit;
    content: "";
    inset: 1px 1px 50%;
    pointer-events: none;
    position: absolute;
}

.hdl-ai-chat__launcher svg,
.hdl-ai-chat__launcher span {
    position: relative;
    z-index: 1;
}

.hdl-ai-chat__launcher svg {
    flex: 0 0 auto;
    filter: drop-shadow(0 1px 3px rgba(15, 23, 42, 0.2));
    height: 18px;
    width: 18px;
}

.hdl-ai-chat__launcher:hover,
.hdl-ai-chat__launcher:focus-visible {
    box-shadow:
        0 14px 28px rgba(78, 70, 229, 0.38),
        0 7px 16px rgba(37, 99, 235, 0.24),
        0 0 0 7px rgba(99, 102, 241, 0.1);
    color: #ffffff;
    filter: saturate(1.08) brightness(1.03);
    outline: none;
    transform: translateY(-2px);
}

.hdl-ai-chat__panel {
    background: #ffffff;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    bottom: 54px;
    box-shadow: 0 22px 70px rgba(15, 23, 42, 0.24);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto auto;
    max-height: min(680px, calc(100vh - 108px));
    min-height: 460px;
    overflow: hidden;
    position: absolute;
    right: 0;
    width: min(390px, calc(100vw - 32px));
}

.hdl-ai-chat__panel[hidden] {
    display: none;
}

.hdl-ai-chat__header {
    align-items: center;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 14px 14px 13px 16px;
}

.hdl-ai-chat__header strong,
.hdl-ai-chat__header span {
    display: block;
}

.hdl-ai-chat__header strong {
    color: #0f172a;
    font-size: 0.96rem;
    line-height: 1.2;
}

.hdl-ai-chat__header span {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 700;
    margin-top: 2px;
}

.hdl-ai-chat__header-actions {
    display: flex;
    gap: 6px;
}

.hdl-ai-chat__icon-button,
.hdl-ai-chat__send {
    align-items: center;
    border: 0;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
}

.hdl-ai-chat__icon-button {
    background: transparent;
    border-radius: 8px;
    color: #64748b;
    height: 34px;
    width: 34px;
}

.hdl-ai-chat__icon-button:hover,
.hdl-ai-chat__icon-button:focus-visible {
    background: #eaf0f7;
    color: #0f172a;
    outline: none;
}

.hdl-ai-chat__messages {
    align-content: start;
    display: grid;
    gap: 10px;
    overflow-y: auto;
    padding: 16px;
}

.hdl-ai-chat__message {
    border-radius: 12px;
    color: #0f172a;
    font-size: 0.91rem;
    line-height: 1.45;
    max-width: 88%;
    padding: 10px 12px;
    white-space: pre-wrap;
}

.hdl-ai-chat__message--assistant {
    background: #f0f4f9;
    border: 1px solid #e2e8f0;
    justify-self: start;
}

.hdl-ai-chat__message--assistant a {
    color: #1d4ed8;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.hdl-ai-chat__message--user {
    background: #2563eb;
    color: #ffffff;
    justify-self: end;
}

.hdl-ai-chat__message--error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    justify-self: start;
}

.hdl-ai-chat__feedback {
    align-items: start;
    display: grid;
    gap: 8px;
    justify-self: start;
    margin-top: -4px;
    max-width: 92%;
}

.hdl-ai-chat__feedback-actions,
.hdl-ai-chat__feedback-reasons {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hdl-ai-chat__feedback-button,
.hdl-ai-chat__feedback-reason,
.hdl-ai-chat__feedback-other button {
    align-items: center;
    background: #ffffff;
    border: 1px solid #dbe3ef;
    border-radius: 999px;
    color: #475569;
    cursor: pointer;
    display: inline-flex;
    font: 800 0.72rem/1 var(--font-sans, "DM Sans", system-ui, sans-serif);
    gap: 5px;
    min-height: 28px;
    padding: 0 9px;
}

.hdl-ai-chat__feedback-button:hover,
.hdl-ai-chat__feedback-button:focus-visible,
.hdl-ai-chat__feedback-reason:hover,
.hdl-ai-chat__feedback-reason:focus-visible,
.hdl-ai-chat__feedback-other button:hover,
.hdl-ai-chat__feedback-other button:focus-visible {
    background: #f0f4f9;
    color: #1d4ed8;
    outline: none;
}

.hdl-ai-chat__feedback-button[aria-pressed="true"] {
    background: #e0f2fe;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.hdl-ai-chat__feedback button:disabled,
.hdl-ai-chat__feedback textarea:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.hdl-ai-chat__feedback-status {
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
}

.hdl-ai-chat__feedback-other {
    display: grid;
    gap: 6px;
    width: 100%;
}

.hdl-ai-chat__feedback-other[hidden] {
    display: none;
}

.hdl-ai-chat__feedback-other textarea {
    background: #ffffff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    color: #0f172a;
    font: 500 0.82rem/1.35 var(--font-sans, "DM Sans", system-ui, sans-serif);
    min-height: 58px;
    outline: none;
    padding: 8px 9px;
    resize: vertical;
    width: min(260px, 100%);
}

.hdl-ai-chat__feedback-other textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.hdl-ai-chat__followups {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    justify-self: start;
    margin-top: -3px;
    max-width: 94%;
}

.hdl-ai-chat__followup {
    align-items: center;
    background: #ffffff;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    color: #1d4ed8;
    display: inline-flex;
    font: 800 0.75rem/1 var(--font-sans, "DM Sans", system-ui, sans-serif);
    min-height: 30px;
    padding: 0 10px;
    text-decoration: none;
}

.hdl-ai-chat__followup:hover,
.hdl-ai-chat__followup:focus-visible {
    background: #eff6ff;
    color: #1e40af;
    outline: none;
    text-decoration: none;
}

.hdl-ai-chat__typing {
    align-items: center;
    display: inline-flex;
    gap: 5px;
}

.hdl-ai-chat__typing span {
    animation: hdl-ai-chat-pulse 1s infinite ease-in-out;
    background: #64748b;
    border-radius: 999px;
    display: block;
    height: 6px;
    width: 6px;
}

.hdl-ai-chat__typing span:nth-child(2) {
    animation-delay: 0.14s;
}

.hdl-ai-chat__typing span:nth-child(3) {
    animation-delay: 0.28s;
}

.hdl-ai-chat__suggestions {
    border-top: 1px solid #eef2f7;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 12px;
}

.hdl-ai-chat__suggestions[hidden] {
    display: none;
}

.hdl-ai-chat__suggestions button {
    background: #ffffff;
    border: 1px solid #dbe3ef;
    border-radius: 999px;
    color: #334155;
    cursor: pointer;
    flex: 0 0 auto;
    font: 800 0.78rem/1 var(--font-sans, "DM Sans", system-ui, sans-serif);
    min-height: 34px;
    max-width: 235px;
    padding: 0 11px;
    white-space: nowrap;
}

.hdl-ai-chat__suggestions button:hover,
.hdl-ai-chat__suggestions button:focus-visible {
    background: #f0f4f9;
    color: #2563eb;
    outline: none;
}

.hdl-ai-chat__form {
    align-items: end;
    border-top: 1px solid #e2e8f0;
    display: grid;
    gap: 9px;
    grid-template-columns: minmax(0, 1fr) 42px;
    padding: 12px;
}

.hdl-ai-chat__form textarea {
    background: #ffffff;
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    color: #0f172a;
    font: 500 0.93rem/1.4 var(--font-sans, "DM Sans", system-ui, sans-serif);
    max-height: 122px;
    min-height: 42px;
    outline: none;
    padding: 10px 11px;
    resize: none;
    width: 100%;
}

.hdl-ai-chat__form textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.hdl-ai-chat__send {
    background: #14b8a6;
    border-radius: 10px;
    color: #ffffff;
    height: 42px;
    width: 42px;
}

.hdl-ai-chat__send:hover,
.hdl-ai-chat__send:focus-visible {
    background: #0f766e;
    outline: none;
}

.hdl-ai-chat__send:disabled,
.hdl-ai-chat__form textarea:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.hdl-ai-chat--loading .hdl-ai-chat__send {
    background: #64748b;
}

.hdl-ai-chat__notice {
    border-top: 1px solid #eef2f7;
    color: #64748b;
    font-size: 0.66rem;
    line-height: 1.35;
    margin: 0;
    padding: 9px 13px 11px;
}

.hdl-ai-chat__notice span {
    display: block;
}

.hdl-ai-chat__notice a {
    color: #2563eb;
    font-weight: 800;
    text-decoration: none;
}

.hdl-ai-chat__notice a:hover,
.hdl-ai-chat__notice a:focus-visible {
    color: #1d4ed8;
    text-decoration: underline;
}

@keyframes hdl-ai-chat-pulse {
    0%,
    80%,
    100% {
        opacity: 0.35;
        transform: scale(0.82);
    }

    40% {
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 640px) {
    .hdl-ai-chat {
        bottom: var(--hdl-ai-chat-bottom-mobile, var(--hdl-ai-chat-bottom, 14px));
        right: 14px;
    }

    .hdl-ai-chat__launcher {
        font-size: 0.86rem;
        min-height: 42px;
        min-width: 94px;
        padding: 0 14px;
    }

    .hdl-ai-chat__panel {
        bottom: 52px;
        max-height: calc(100vh - 88px);
        min-height: min(520px, calc(100vh - 88px));
        width: calc(100vw - 28px);
    }

    .hdl-ai-chat__message,
    .hdl-ai-chat__feedback,
    .hdl-ai-chat__followups {
        max-width: 94%;
    }

    .hdl-ai-chat__suggestions {
        padding: 9px 10px;
    }
}

@media print {
    .hdl-ai-chat {
        display: none !important;
    }
}
