.docs-chat,
.docs-chat * {
    box-sizing: border-box;
    letter-spacing: 0;
}

.docs-chat {
    --chat-text: #d1d5db;
    --chat-muted: #a5acb8;
    --chat-accent: #50d199;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1200;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
}

.docs-chat button {
    font: inherit;
    cursor: pointer;
}

.docs-chat-icon,
.docs-chat-icon svg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
}

.docs-chat-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 12px 16px;
    color: #101416;
    background: linear-gradient(135deg, #50d199, #3ec8c0);
    border: 0;
    border-radius: 8px;
    box-shadow: 0 10px 30px #0005;
}

.docs-chat-trigger span:last-child {
    font-weight: 700;
}

.docs-chat-trigger[hidden],
.docs-chat-panel:not([open]) {
    display: none;
}

.docs-chat-panel {
    position: fixed;
    inset: auto 24px 82px auto;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(420px, calc(100vw - 32px));
    height: min(640px, calc(100dvh - 112px));
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    color: var(--chat-text);
    background: #17191d;
    border: 1px solid #ffffff24;
    border-radius: 8px;
    box-shadow: 0 22px 60px #0008;
    font: inherit;
}

.docs-chat-header {
    position: static;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: auto;
    padding: 12px 16px;
    background: #202329;
    border-bottom: 1px solid #ffffff1a;
    box-shadow: none;
}

.docs-chat-title {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.docs-chat-title strong {
    color: #f3f4f6;
    font-size: 16px;
}

.docs-chat-title span {
    color: var(--chat-muted);
    font-size: 12px;
}

.docs-chat-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.docs-chat-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    color: var(--chat-muted);
    background: transparent;
    border: 0;
    border-radius: 6px;
}

.docs-chat-actions button:hover {
    color: #fff;
    background: #ffffff12;
}

.docs-chat button:focus-visible,
.docs-chat a:focus-visible,
.docs-chat-table:focus-visible {
    outline: 2px solid var(--chat-accent);
    outline-offset: 2px;
}

.docs-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    min-height: 0;
    padding: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: #59616d #17191d;
}

.docs-chat-message {
    flex: 0 0 auto;
    align-self: flex-start;
    min-width: 0;
    max-width: 94%;
    padding: 12px 14px;
    color: var(--chat-text);
    background: #26292f;
    border: 1px solid #ffffff14;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.docs-chat-welcome {
    display: grid;
    gap: 6px;
    width: min(100%, 620px);
    margin: auto;
    padding: 28px;
    text-align: center;
}

.docs-chat-welcome strong {
    color: #f3f4f6;
    font-size: 20px;
}

.docs-chat-welcome > span {
    color: var(--chat-muted);
}

.docs-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.docs-chat-suggestions button {
    padding: 9px 12px;
    color: var(--chat-text);
    background: #26292f;
    border: 1px solid #ffffff1f;
    border-radius: 6px;
}

.docs-chat-suggestions button:hover {
    color: var(--chat-accent);
    border-color: #50d19970;
    background: #50d19912;
}

.docs-chat-message.user {
    align-self: flex-end;
    color: #f3f4f6;
    background: #50d1991f;
    border-color: #50d19952;
}

.docs-chat-message.pending {
    color: var(--chat-muted);
}

.docs-chat-message.error {
    color: #fecaca;
    border-color: #ef444459;
}

.docs-chat-message.formatted {
    white-space: normal;
}

.docs-chat-message :is(p, ul, ol, pre, blockquote, .docs-chat-table) {
    margin: 0 0 12px;
}

.docs-chat-message :is(h1, h2, h3, h4, h5, h6) {
    margin: 16px 0 8px;
    padding: 0;
    color: #f3f4f6;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    text-align: left;
    border: 0;
}

.docs-chat-message > :first-child {
    margin-top: 0;
}

.docs-chat-message > :last-child,
.docs-chat-message li > :last-child {
    margin-bottom: 0;
}

.docs-chat-message :is(ul, ol) {
    padding-left: 22px;
}

.docs-chat-message li + li {
    margin-top: 5px;
}

.docs-chat-message code {
    padding: 2px 4px;
    color: #93e5be;
    background: #14171b;
    border-radius: 3px;
    font-family: Consolas, monospace;
    font-size: 13px;
}

.docs-chat-message pre {
    position: relative;
    max-width: 100%;
    padding: 48px 12px 12px;
    overflow: hidden;
    background: #14171b;
    border: 1px solid #ffffff14;
    border-radius: 6px;
    white-space: pre;
    overflow-wrap: normal;
}

.docs-chat-message pre code {
    display: block;
    padding: 0;
    overflow-x: auto;
    color: #e5e7eb;
    background: transparent;
}

.docs-chat-copy {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    color: var(--chat-muted);
    background: #26292f;
    border: 1px solid #ffffff24;
    border-radius: 6px;
}

.docs-chat-copy:hover {
    color: var(--chat-accent);
    background: #30343b;
}

.docs-chat-message blockquote {
    padding-left: 12px;
    color: var(--chat-muted);
    border-left: 3px solid var(--chat-accent);
}

.docs-chat-message a {
    color: var(--chat-accent);
    text-decoration: underline;
}

.docs-chat-message hr {
    margin: 16px 0;
    border: 0;
    border-top: 1px solid #ffffff24;
}

.docs-chat-table {
    max-width: 100%;
    overflow-x: auto;
}

.docs-chat-message table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.docs-chat-message :is(th, td) {
    padding: 8px;
    border: 1px solid #ffffff24;
    text-align: left;
}

.docs-chat-message th {
    color: #f3f4f6;
    background: #1c1f24;
}

.docs-chat-sources {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #ffffff1a;
    color: var(--chat-muted);
    font-size: 12px;
    white-space: normal;
}

.docs-chat-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    gap: 10px;
    margin: 0;
    padding: 12px;
    background: #202329;
    border-top: 1px solid #ffffff1a;
}

.docs-chat-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.docs-chat-form textarea {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    max-height: 120px;
    margin: 0;
    padding: 10px 12px;
    resize: vertical;
    color: #f3f4f6;
    background: #15171a;
    border: 1px solid #4b5563;
    border-radius: 6px;
    font: inherit;
    line-height: 1.4;
}

.docs-chat-form textarea:focus {
    outline: 2px solid #50d19959;
    border-color: var(--chat-accent);
}

.docs-chat-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    align-self: end;
    padding: 0;
    color: #101416;
    background: var(--chat-accent);
    border: 0;
    border-radius: 6px;
}

.docs-chat-form button:disabled {
    opacity: 0.5;
    cursor: wait;
}

.docs-chat-full-window {
    overflow: hidden;
}

.docs-chat-panel.is-expanded {
    inset: 0;
    width: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
}

.docs-chat-panel.is-expanded .docs-chat-messages,
.docs-chat-panel.is-expanded .docs-chat-form {
    padding-inline: max(16px, calc((100% - 960px) / 2));
}

@media (max-width: 600px) {
    .docs-chat {
        right: 12px;
        bottom: 12px;
    }

    .docs-chat-panel {
        inset: auto 8px 70px 8px;
        width: auto;
        height: min(640px, calc(100dvh - 90px));
    }

    .docs-chat-header {
        padding: 10px 12px;
    }

    .docs-chat-form textarea {
        font-size: 16px;
    }
}

.docs-chat-page {
    position: static;
    height: 100%;
    width: 100%;
}

.docs-chat-page .docs-chat-panel {
    position: relative;
    inset: auto;
    display: grid;
    grid-template-rows: auto auto;
    align-content: center;
    gap: 22px;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    overflow: hidden;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.docs-chat-transfer-actions {
    position: absolute;
    top: 18px;
    right: 22px;
    z-index: 2;
    display: flex;
    gap: 4px;
}

.docs-chat-transfer-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    color: var(--chat-muted);
    background: transparent;
    border: 0;
    border-radius: 50%;
}

.docs-chat-transfer-actions button:hover:not(:disabled) {
    color: #fff;
    background: #ffffff12;
}

.docs-chat-transfer-actions button:disabled {
    opacity: 0.35;
    cursor: default;
}

.docs-chat-transfer-status {
    position: absolute;
    top: 22px;
    left: 50%;
    z-index: 2;
    padding: 6px 10px;
    color: var(--chat-text);
    background: #2f2f2f;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%);
    transition: opacity 0.2s;
}

.docs-chat-transfer-status:not(:empty) {
    opacity: 1;
}

.docs-chat-transfer-status.error {
    color: #fecaca;
}

.docs-chat-page .docs-chat-panel.has-conversation {
    grid-template-rows: minmax(0, 1fr) auto;
    align-content: stretch;
    gap: 0;
}

.docs-chat-page .docs-chat-header {
    display: none;
}

.docs-chat-page .docs-chat-messages {
    padding: 0 20px;
    scrollbar-color: #4d4d4d transparent;
}

.docs-chat-page .has-conversation .docs-chat-messages {
    gap: 24px;
    padding-block: 36px;
}

.docs-chat-page .docs-chat-welcome {
    width: min(100%, 760px);
    margin: 0 auto;
    padding: 0 20px;
}

.docs-chat-page .docs-chat-welcome strong {
    font-size: 26px;
    font-weight: 600;
}

.docs-chat-page .docs-chat-suggestions button {
    background: transparent;
    border-color: #ffffff26;
    border-radius: 20px;
}

.docs-chat-page .docs-chat-message {
    width: min(100%, 760px);
    max-width: 760px;
    margin-inline: auto;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    font-size: 15px;
}

.docs-chat-page .docs-chat-message.user {
    width: auto;
    max-width: min(70%, 620px);
    margin-right: max(20px, calc((100% - 760px) / 2));
    padding: 10px 16px;
    background: #303030;
    border: 0;
    border-radius: 18px;
}

.docs-chat-page .docs-chat-form {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    width: min(calc(100% - 40px), 760px);
    margin: 0 auto;
    padding: 8px;
    background: #2f2f2f;
    border: 1px solid #ffffff14;
    border-radius: 24px;
    box-shadow: 0 8px 28px #0004;
}

.docs-chat-page .has-conversation .docs-chat-form {
    margin-bottom: 24px;
}

.docs-chat-page .docs-chat-form textarea {
    min-height: 36px;
    padding: 8px 0;
    resize: none;
    background: transparent;
    border: 0;
}

.docs-chat-page .docs-chat-form textarea:focus {
    outline: 0;
}

.docs-chat-page .docs-chat-form button {
    width: 36px;
    height: 36px;
    align-self: center;
    border-radius: 50%;
}

@media (max-width: 600px) {
    .docs-chat-page {
        right: auto;
        bottom: auto;
    }

    .docs-chat-page .docs-chat-panel {
        inset: auto;
        width: 100%;
        height: 100%;
        min-height: 0;
    }

    .docs-chat-transfer-actions {
        top: 10px;
        right: 10px;
    }

    .docs-chat-transfer-status {
        top: 52px;
        max-width: calc(100% - 24px);
        text-align: center;
    }

    .docs-chat-page .docs-chat-welcome strong {
        font-size: 22px;
    }

    .docs-chat-page .docs-chat-suggestions {
        display: grid;
    }

    .docs-chat-page .docs-chat-form {
        width: calc(100% - 24px);
    }

    .docs-chat-page .has-conversation .docs-chat-form {
        margin-bottom: 12px;
    }

    .docs-chat-page .docs-chat-message.user {
        max-width: 82%;
        margin-right: 12px;
    }
}

.docs-chat-page .docs-chat-form button[data-chat-result-attach] {
    color: var(--chat-muted);
    background: transparent;
}

.docs-chat-page .docs-chat-form button[data-chat-result-attach]:hover {
    color: #fff;
    background: #ffffff12;
}

.docs-chat-result-file {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 4px 8px;
    color: var(--chat-muted);
    font-size: 12px;
}

.docs-chat-result-file[hidden] {
    display: none;
}

.docs-chat-result-file > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.docs-chat-page .docs-chat-form .docs-chat-result-file button {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    color: var(--chat-muted);
    background: transparent;
}