:root {
    --chat--color--primary: #245cff;
    --chat--color-primary: #245cff;
    --chat--color--primary-shade-50: #1949d9;
    --chat--color-primary-shade-50: #1949d9;
    --chat--color--primary--shade-100: #173ea9;
    --chat--color-primary-shade-100: #173ea9;
    --chat--color--secondary: #12b8a5;
    --chat--color-secondary: #12b8a5;
    --chat--color-secondary-shade-50: #0f8b7f;
    --chat--color-white: #ffffff;
    --chat--color-light: #f3f6fb;
    --chat--color-light-shade-50: #e9eef7;
    --chat--color-light-shade-100: #dbe7ff;
    --chat--color-medium: #91a0bd;
    --chat--color-dark: #111a36;
    --chat--color-disabled: #94a3b8;
    --chat--color-typing: #334155;
    --chat--font-family: 'Manrope', sans-serif;
    --chat--spacing: 1rem;
    --chat--border-radius: 0.85rem;
    --chat--transition-duration: 180ms;
    --chat--window--width: min(26rem, calc(100vw - 2rem));
    --chat--window--height: min(42rem, calc(100vh - 6rem));
    --chat--window--bottom: 1rem;
    --chat--window--right: 1rem;
    --chat--window--z-index: 10000;
    --chat--window--border: 1px solid rgba(17, 26, 54, 0.12);
    --chat--window--border-radius: 1.25rem;
    --chat--header--background: #10245e;
    --chat--header--color: #ffffff;
    --chat--heading--font-size: 1.2rem;
    --chat--subtitle--font-size: 0.875rem;
    --chat--message--font-size: 0.95rem;
    --chat--message--border-radius: 1rem;
    --chat--message--bot--background: #ffffff;
    --chat--message--bot--color: #111a36;
    --chat--message--user--background: #245cff;
    --chat--message--user--color: #ffffff;
    --chat--toggle--size: 4.25rem;
    --chat--toggle--border-radius: 999px;
    --chat--toggle--background: #245cff;
    --chat--toggle--hover--background: #1949d9;
    --chat--toggle--active--background: #173ea9;
    --chat--toggle--color: #ffffff;
    --chat--input--text-color: #111a36;
    --chat--input--border-active: 1px solid #245cff;
    --chat--footer--background: #f8faff;
}

#n8n-chat {
    position: relative;
    z-index: var(--chat--window--z-index);
}

#n8n-chat .chat-window {
    box-shadow: 0 28px 80px -34px rgba(16, 36, 94, 0.55);
}

#n8n-chat .chat-window-toggle.clarix-chat-toggle {
    position: relative;
    border: 1px solid rgba(36, 92, 255, 0.18);
    box-shadow:
        0 16px 34px -12px rgba(36, 92, 255, 0.58),
        0 4px 12px rgba(16, 36, 94, 0.14);
}

#n8n-chat .chat-window-toggle.clarix-chat-toggle:not(.is-open) {
    background:
        url('../images/clarix-chat-pet.png') center / 84% no-repeat,
        linear-gradient(145deg, #ffffff 5%, #eef4ff 58%, #dff7f4 100%);
}

#n8n-chat .chat-window-toggle.clarix-chat-toggle:not(.is-open):hover,
#n8n-chat .chat-window-toggle.clarix-chat-toggle:not(.is-open):focus-visible {
    background:
        url('../images/clarix-chat-pet.png') center / 88% no-repeat,
        linear-gradient(145deg, #ffffff 5%, #e5edff 58%, #d4f5ef 100%);
    transform: translateY(-2px) scale(1.025);
}

#n8n-chat .chat-window-toggle.clarix-chat-toggle:not(.is-open) > svg {
    display: none;
}

#n8n-chat .chat-window-toggle.clarix-chat-toggle:not(.is-open)::after {
    position: absolute;
    top: 0.2rem;
    right: 0.2rem;
    width: 0.7rem;
    height: 0.7rem;
    border: 2px solid #ffffff;
    border-radius: 999px;
    background: #12b8a5;
    box-shadow: 0 0 0 3px rgba(18, 184, 165, 0.16);
    content: '';
}

#n8n-chat .chat-window-toggle.clarix-chat-toggle.is-open {
    border-color: rgba(255, 255, 255, 0.18);
    background: #10245e;
}

#n8n-chat .chat-window-toggle.clarix-chat-toggle:focus-visible {
    outline: 3px solid rgba(36, 92, 255, 0.32);
    outline-offset: 3px;
}

#n8n-chat .clarix-chat-invitation {
    position: relative;
    display: flex;
    width: min(18.5rem, calc(100vw - 2rem));
    margin: 0 0 0.8rem auto;
    border: 1px solid rgba(36, 92, 255, 0.14);
    border-radius: 1rem 1rem 0.3rem 1rem;
    background: rgba(255, 255, 255, 0.97);
    box-shadow:
        0 20px 46px -24px rgba(16, 36, 94, 0.52),
        0 8px 20px -14px rgba(17, 26, 54, 0.24);
    opacity: 0;
    visibility: hidden;
    transform: translateY(0.55rem) scale(0.97);
    transform-origin: bottom right;
    transition:
        opacity 220ms ease,
        transform 220ms ease,
        visibility 220ms ease;
    pointer-events: none;
}

#n8n-chat .clarix-chat-invitation[hidden] {
    display: none;
}

#n8n-chat .clarix-chat-invitation::after {
    position: absolute;
    right: 1.45rem;
    bottom: -0.38rem;
    width: 0.75rem;
    height: 0.75rem;
    border-right: 1px solid rgba(36, 92, 255, 0.14);
    border-bottom: 1px solid rgba(36, 92, 255, 0.14);
    background: #ffffff;
    content: '';
    transform: rotate(45deg);
}

#n8n-chat .clarix-chat-invitation.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

#n8n-chat .clarix-chat-invitation-action {
    width: 100%;
    border: 0;
    border-radius: inherit;
    padding: 0.85rem 2.5rem 0.85rem 1rem;
    background: transparent;
    color: #111a36;
    cursor: pointer;
    font: 650 0.9rem/1.45 'Manrope', sans-serif;
    text-align: left;
}

#n8n-chat .clarix-chat-invitation-action:hover,
#n8n-chat .clarix-chat-invitation-action:focus-visible {
    color: #1949d9;
}

#n8n-chat .clarix-chat-invitation-action:focus-visible,
#n8n-chat .clarix-chat-invitation-dismiss:focus-visible {
    outline: 2px solid rgba(36, 92, 255, 0.38);
    outline-offset: -3px;
}

#n8n-chat .clarix-chat-invitation-dismiss {
    position: absolute;
    top: 0.48rem;
    right: 0.48rem;
    display: grid;
    width: 1.65rem;
    height: 1.65rem;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: #eef4ff;
    color: #52617d;
    cursor: pointer;
    font: 600 1.1rem/1 'Manrope', sans-serif;
}

#n8n-chat .clarix-chat-invitation-dismiss:hover {
    background: #dbe7ff;
    color: #173ea9;
}

#n8n-chat .chat-message {
    box-sizing: border-box;
    max-width: 92%;
}

#n8n-chat .chat-message-from-user {
    max-width: 88%;
}

#n8n-chat .chat-message-markdown {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

#n8n-chat .chat-message-markdown ul,
#n8n-chat .chat-message-markdown ol {
    margin-block: 0.65rem;
    padding-inline-start: 1.4rem;
    padding-inline-end: 0.35rem;
    list-style-position: outside;
}

#n8n-chat .chat-message-markdown ul {
    list-style-type: disc;
}

#n8n-chat .chat-message-markdown ol {
    list-style-type: decimal;
}

#n8n-chat .chat-message-markdown li {
    margin-block: 0.32rem;
    padding-inline-start: 0.2rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

#n8n-chat .chat-message-markdown li::marker {
    color: #245cff;
    font-weight: 700;
}

#n8n-chat .chat-message-from-user .chat-message-markdown li::marker {
    color: rgba(255, 255, 255, 0.86);
}

#n8n-chat .chat-message-markdown li > ul,
#n8n-chat .chat-message-markdown li > ol {
    margin-block: 0.3rem;
    padding-inline-start: 1.1rem;
}

@media (max-width: 480px) {
    :root {
        --chat--window--width: calc(100vw - 1rem);
        --chat--window--height: calc(100vh - 5rem);
        --chat--window--bottom: 0.5rem;
        --chat--window--right: 0.5rem;
        --chat--toggle--size: 4rem;
    }

    #n8n-chat .clarix-chat-invitation {
        width: min(17rem, calc(100vw - 1rem));
        margin-bottom: 0.7rem;
    }

    #n8n-chat .clarix-chat-invitation-action {
        padding-block: 0.75rem;
        font-size: 0.84rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --chat--transition-duration: 0ms;
    }

    #n8n-chat .clarix-chat-invitation {
        transition: none;
    }
}
