.sp-chat-dialog {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    left: auto;
    top: auto;
    margin: 0;
    width: min(26rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 0;
    box-shadow: 0 20px 40px rgb(15 23 42 / 0.18);
}

.sp-chat-dialog::backdrop {
    background: rgb(15 23 42 / 0.3);
}

.sp-chat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.5rem 0.75rem 0.5rem 1rem;
}

.sp-chat-body {
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
}

.sp-chat {
    display: grid;
    gap: 0.75rem;
    padding: 1rem;
}

.sp-chat-lead {
    font-size: 0.875rem;
    font-weight: 600;
    color: #0f172a;
}

.sp-chat-form,
.sp-chat-rate {
    display: grid;
    gap: 0.5rem;
}

.sp-chat-error {
    font-size: 0.8125rem;
    color: #b91c1c;
}

.sp-chat-state {
    font-size: 0.75rem;
    font-weight: 600;
    color: #047857;
}

.sp-chat-log {
    display: flex;
    min-height: 12rem;
    max-height: 18rem;
    flex-direction: column;
    gap: 0.375rem;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 0.5rem;
}

.sp-chat-msg {
    display: flex;
    max-width: 85%;
    flex-direction: column;
    gap: 0.125rem;
    border-radius: 0.75rem;
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
    overflow-wrap: anywhere;
}

.sp-chat-msg time {
    font-size: 0.625rem;
    color: #94a3b8;
}

.sp-chat-visitor {
    align-self: flex-end;
    background: #d1fae5;
}

.sp-chat-agent {
    align-self: flex-start;
    background: #f1f5f9;
}

.sp-chat-system {
    align-self: center;
    background: transparent;
    font-size: 0.6875rem;
    color: #64748b;
    text-align: center;
}

.sp-chat-send {
    display: flex;
    gap: 0.5rem;
}

.sp-chat-send input {
    flex: 1;
    min-width: 0;
}

.sp-chat-actions {
    display: flex;
    justify-content: flex-end;
}

.sp-console {
    display: grid;
    gap: 1rem;
}

@media (min-width: 1024px) {
    .sp-console {
        grid-template-columns: 20rem minmax(0, 1fr);
    }
}

.sp-console-list {
    display: grid;
    gap: 0.5rem;
}

.sp-console-item {
    display: block;
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 0.625rem 0.75rem;
    text-align: left;
    font-size: 0.8125rem;
}

.sp-console-item[aria-current="true"] {
    border-color: #047857;
    background: #f0fdf4;
}

.sp-online {
    display: inline-block;
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 9999px;
    background: #94a3b8;
}

.sp-online-on {
    background: #10b981;
}
