[x-cloak] {
    display: none !important;
}

@supports not selector(::-webkit-scrollbar) {
    .sb * {
        scrollbar-width: thin;
        scrollbar-color: #cfcbd8 transparent;
    }
}

.sb ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.sb ::-webkit-scrollbar-track {
    background: transparent;
}

.sb ::-webkit-scrollbar-thumb {
    background: #cfcbd8;
    border-radius: 999px;
}

.sb ::-webkit-scrollbar-thumb:hover {
    background: #a9a4b5;
}

.sb ::-webkit-scrollbar-button {
    display: none;
    height: 0;
    width: 0;
}

.sb {
    --sb-accent: #65c262;
    --sb-accent-dark: #4ea84b;
    --sb-bg: #fbf9fe;
    --sb-card: #fff;
    --sb-user: #efedf3;
    --sb-text: #1d1d1f;
    --sb-muted: #6b6b76;
    --sb-border: #e3e0ea;
    font-size: 15px;
    color: var(--sb-text);
}

.sb-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1080;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 0;
    background: var(--sb-accent);
    color: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.sb-launcher:hover {
    background: var(--sb-accent-dark);
}

.sb-panel {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1080;
    width: min(460px, calc(100vw - 48px));
    height: min(700px, calc(100vh - 48px));
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #fff 0%, var(--sb-bg) 100%);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
    overflow: hidden;
}

.sb-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 18px 18px 14px 22px;
    border-bottom: 1px solid var(--sb-border);
    background: #fff;
}

.sb-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: var(--sb-text);
}

.sb-sub {
    font-size: 13px;
    color: var(--sb-muted);
}

.sb-sub strong {
    color: var(--sb-accent-dark);
}

.sb-actions {
    display: flex;
    gap: 2px;
}

.sb-icon {
    background: none;
    border: 0;
    padding: 6px;
    border-radius: 8px;
    color: var(--sb-muted);
    cursor: pointer;
}

.sb-icon:hover,
.sb-icon:focus-visible {
    background: var(--sb-user);
    color: var(--sb-text);
}

.sb-menu-wrap {
    position: relative;
}

.sb-menu {
    position: absolute;
    right: 0;
    top: 36px;
    background: var(--sb-card);
    border: 1px solid var(--sb-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    min-width: 190px;
    padding: 4px;
    z-index: 2;
}

.sb-menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.sb-menu button:hover {
    background: var(--sb-user);
}

.sb-menu button:disabled {
    opacity: .5;
    cursor: default;
}

.sb-thread {
    flex: 1;
    overflow-y: auto;
    padding: 14px 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sb-meta {
    font-size: 12px;
    color: var(--sb-muted);
    margin: 6px 0 2px;
}

.sb-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    max-width: 92%;
    font-size: 14.5px;
    line-height: 1.55;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-wrap;
}

.sb-bot {
    background: var(--sb-card);
    border: 1px solid var(--sb-border);
    align-self: flex-start;
    white-space: normal;
    border-top-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.sb-user {
    background: var(--sb-accent);
    color: #fff;
    align-self: flex-end;
    margin-left: auto;
    border-top-right-radius: 4px;
}

.sb-md p {
    margin: 0 0 8px !important;
    padding: 0 !important;
    font-size: 14.5px !important;
    line-height: 1.55 !important;
    color: var(--sb-text) !important;
}

.sb-md> :last-child {
    margin-bottom: 0 !important;
}

.sb-md ul,
.sb-md ol {
    margin: 4px 0 10px !important;
    padding-left: 22px !important;
}

.sb-md ul {
    list-style: disc outside !important;
}

.sb-md ol {
    list-style: decimal outside !important;
}

.sb-md ul ul {
    list-style-type: circle !important;
    margin: 4px 0 4px !important;
}

.sb-md ol ul,
.sb-md ul ol {
    margin: 4px 0 4px !important;
}

.sb-md li {
    display: list-item !important;
    margin: 0 0 6px !important;
    padding: 0 0 0 2px !important;
    font-size: 14.5px !important;
    line-height: 1.55 !important;
    color: var(--sb-text) !important;
}

.sb-md li::before,
.sb-md li::after {
    content: none !important;
}

.sb-md li::marker {
    color: var(--sb-accent-dark);
    font-weight: 600;
}

.sb-md li>p {
    margin: 0 !important;
}

.sb-md strong {
    font-weight: 600;
    color: var(--sb-text);
}

.sb-md em {
    font-style: italic;
    color: var(--sb-muted);
}

.sb-md a {
    color: var(--sb-accent-dark) !important;
    text-decoration: underline;
    word-break: break-all;
}

.sb-md h1,
.sb-md h2,
.sb-md h3,
.sb-md h4 {
    font-size: 15px !important;
    font-weight: 600;
    margin: 8px 0 6px !important;
    color: var(--sb-text) !important;
    line-height: 1.4 !important;
}

.sb-md code {
    font-family: ui-monospace, monospace;
    background: var(--sb-user);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 13px;
}

.sb-hint {
    font-size: 12px;
    color: var(--sb-muted);
    margin: 6px 0 0;
}

.sb-step {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    font-size: 12.5px;
    line-height: 1;
    color: var(--sb-muted);
    background: #f3f1f7;
    border-radius: 999px;
    padding: 6px 12px 6px 6px;
    margin: 2px 0;
}

.sb-step-icon {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--sb-accent);
    color: #fff;
}

.sb-step-icon.is-error {
    background: #e5a100;
}

.sb-step.is-loading .sb-step-icon {
    background: transparent;
    border: 2px solid #d8d4e0;
    border-top-color: var(--sb-accent);
    animation: sb-spin .8s linear infinite;
}

@keyframes sb-spin {
    to {
        transform: rotate(360deg);
    }
}

.sb-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sb-quick button {
    background: var(--sb-card);
    border: 1px solid var(--sb-accent);
    color: var(--sb-accent-dark);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
}

.sb-quick button:hover {
    background: var(--sb-accent);
    color: #fff;
}

.sb-feedback {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-top: 2px;
}

.sb-feedback button {
    background: none;
    border: 0;
    opacity: .45;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
}

.sb-feedback button.on,
.sb-feedback button:hover {
    opacity: 1;
}

.sb-feedback .sb-link {
    opacity: 1;
    margin-left: 6px;
}

.sb-pending {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sb-stream:empty {
    display: none;
}

.sb-pending:has(.sb-stream:not(:empty)) .sb-typing,
.sb-pending:has(.sb-stream:not(:empty)) .sb-step.is-loading {
    display: none;
}

.sb-attach {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    cursor: pointer;
    font-size: 13px;
    color: var(--sb-accent-dark);
    border: 1px dashed var(--sb-accent);
    border-radius: 8px;
    padding: 7px 12px;
}

.sb-attach:hover {
    background: rgba(101, 194, 98, .08);
}

.sb-attach:focus-within {
    outline: 2px solid var(--sb-accent);
    outline-offset: 2px;
}

.sb-attach-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--sb-border);
    border-radius: 8px;
    padding: 6px 8px;
}

.sb-attach-preview img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
}

.sb-attach-name {
    flex: 1;
    font-size: 13px;
    color: var(--sb-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sb-attach-hint {
    font-size: 11.5px;
    color: var(--sb-muted);
}

.sb-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--sb-card);
    border: 1px solid var(--sb-border);
    border-radius: 14px;
    width: fit-content;
}

.sb-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--sb-muted);
    animation: sb-blink 1.2s infinite;
}

.sb-typing span:nth-child(2) {
    animation-delay: .2s;
}

.sb-typing span:nth-child(3) {
    animation-delay: .4s;
}

@keyframes sb-blink {

    0%,
    80%,
    100% {
        opacity: .25;
    }

    40% {
        opacity: 1;
    }
}

.sb-card {
    background: var(--sb-card);
    border: 1px solid var(--sb-border);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sb-card input {
    border: 1px solid var(--sb-border);
    border-radius: 8px;
    padding: 8px 10px;
    width: 100%;
}

.sb-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.sb-btn {
    background: var(--sb-accent);
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
}

.sb-link {
    background: none;
    border: 0;
    color: var(--sb-accent-dark);
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font-size: 13px;
}

.sb-rate {
    align-items: center;
    text-align: center;
    padding: 22px 18px;
    gap: 6px;
}

.sb-rate-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--sb-text);
}

.sb-rate-sub {
    margin: 0;
    font-size: 13px;
    color: var(--sb-muted);
}

.sb-rate-label {
    margin: 0;
    min-height: 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--sb-accent-dark);
}

.sb-rate-done {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(101, 194, 98, .15);
    color: var(--sb-accent-dark);
    margin-bottom: 4px;
}

.sb-rate-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 8px;
}

.sb-stars {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin: 8px 0 2px;
}

.sb-stars button,
.sb-stars span {
    background: none;
    border: 0;
    padding: 2px;
    font-size: 32px;
    line-height: 1;
    color: #dcd9e3;
    cursor: pointer;
    transition: color .12s, transform .12s;
}

.sb-stars button.on,
.sb-stars span.on {
    color: #f5b301;
}

.sb-stars button:hover,
.sb-stars button:focus-visible {
    transform: scale(1.15);
    outline: none;
}

.sb-stars button:disabled {
    cursor: default;
}

.sb-stars.is-static span {
    cursor: default;
    font-size: 22px;
}

.sb-btn-ghost {
    background: #fff;
    color: var(--sb-text);
    border: 1px solid var(--sb-border);
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
}

.sb-btn-ghost:hover {
    background: var(--sb-user);
}

.sb-feedback-note {
    font-size: 12px;
    color: var(--sb-muted);
    margin-left: 4px;
}

.sb-notice {
    padding: 6px 16px;
    font-size: 13px;
    color: #b54708;
    display: block;
}

.sb-input {
    display: flex;
    gap: 10px;
    padding: 12px 20px 4px;
    align-items: flex-end;
    border-top: 1px solid var(--sb-border);
    background: #fff;
}

.sb-field {
    flex: 1;
    position: relative;
}

.sb-field textarea {
    display: block;
    width: 100%;
    resize: none;
    border: 1px solid var(--sb-border) !important;
    border-radius: 12px !important;
    padding: 12px 14px !important;
    background: #fff !important;
    color: var(--sb-text) !important;
    font-size: 14.5px !important;
    font-family: inherit;
    line-height: 1.45 !important;
    min-height: 48px !important;
    height: 48px;
    max-height: 120px;
    overflow-y: auto;
    scroll-padding: 12px;
    overflow-wrap: anywhere;
    word-break: break-word;
    box-shadow: none !important;
    transition: border-color .15s, box-shadow .15s;
}

.sb-field textarea::placeholder {
    color: #9a98a3;
}

.sb .sb-field textarea {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sb .sb-field textarea::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.sb-field textarea:hover {
    border-color: #c9c5d3 !important;
}

.sb-field textarea:focus {
    outline: none;
    border-color: var(--sb-accent) !important;
    box-shadow: 0 0 0 3px rgba(101, 194, 98, .18) !important;
}

.sb-field textarea:disabled {
    background: #f6f5f9 !important;
}

.sb-count {
    position: absolute;
    right: 14px;
    bottom: -16px;
    font-size: 11px;
    color: var(--sb-muted);
}

.sb-send {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    transition: background .15s;
    border: 0;
    background: var(--sb-accent);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.sb-send:disabled {
    background: #a5a3ab;
    cursor: default;
}

.sb-disclaimer {
    font-size: 11px !important;
    line-height: 1.4 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--sb-muted);
    text-align: center;
    margin: 0 !important;
    padding: 6px 12px 12px;
    background: #fff;
}

.sb-disclaimer a {
    color: inherit;
    text-decoration: underline;
}

@media (max-width: 575px) {
    .sb-panel {
        inset: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .sb-launcher {
        right: 16px;
        bottom: 16px;
    }
}
