.scdev-chat-widget {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9999;
    width: min(360px, calc(100vw - 24px));
    font-family: Arial, sans-serif;
    display: none !important;
    flex-direction: column;
    align-items: flex-end;
}

.scdev-chat-staff-launcher {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9999;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 50%;
    background: #131d2d;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 16px 36px rgba(19, 29, 45, 0.28);
}

.scdev-chat-staff-launcher__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.scdev-chat-staff-launcher__icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.scdev-chat-staff-launcher__count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 10px;
    height: 14px;
    padding: 0 6px;
    border-radius: 999px;
    background: #d63638;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

.scdev-chat-toggle {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: #2f6fdb;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 16px 36px rgba(47, 111, 219, 0.3);
}

.scdev-chat-toggle__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.scdev-chat-panel {
    margin-top: 8px;
    background: #fff;
    border: 1px solid #d9e2f2;
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
    overflow-y: auto;
    width: 100%;
    height: 340px;
    max-height: 340px;
    display: flex;
    flex-direction: column;
}

.scdev-chat-panel[hidden] {
    display: none !important;
}

.scdev-chat-header {
    padding: 9px 14px 7px;
    background: linear-gradient(180deg, #eaf2ff 0%, #ffffff 100%);
}

.scdev-chat-header h3 {
    margin: 0 0 2px;
    font-size: 14px;
    color: #132238;
}

.scdev-chat-messages {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 6px;
    max-height: 110px;
    min-height: 50px;
    overflow-y: auto;
    padding: 6px 12px;
    background: #f8fbff;
}

.scdev-chat-empty {
    margin: auto 0;
    text-align: center;
    color: #667085;
    font-size: 13px;
}

.scdev-chat-bubble {
    max-width: 82%;
    padding: 10px 12px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.scdev-chat-bubble.is-visitor {
    align-self: flex-end;
    background: #2f6fdb;
    color: #fff;
    border-bottom-right-radius: 6px;
}

.scdev-chat-bubble.is-admin {
    align-self: flex-start;
    background: #fff;
    color: #17212f;
    border: 1px solid #d9e2f2;
    border-bottom-left-radius: 6px;
}

.scdev-chat-meta {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    opacity: 0.8;
}

.scdev-chat-text {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 14px;
    line-height: 1.45;
}

.scdev-chat-attachment {
    margin-top: 10px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: inherit;
    padding: 7px 11px;
    font-size: 12px;
    cursor: pointer;
}

.scdev-chat-bubble.is-admin .scdev-chat-attachment {
    border-color: #d9e2f2;
    background: #f8fbff;
    color: #1d2327;
}

.scdev-chat-form {
    display: grid;
    gap: 6px;
    padding: 10px 12px;
    flex: 0 0 auto;
    background: #fff;
}

.scdev-chat-identity {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
}

.scdev-chat-identity label {
    flex: 0 0 auto;
    white-space: nowrap;
}

.scdev-chat-identity input {
    flex: 1 1 auto;
}

.scdev-chat-form label {
    font-size: 12px;
    font-weight: 600;
    color: #344054;
}

.scdev-chat-form input,
.scdev-chat-form textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #c7d3e3;
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 13px;
    line-height: 1.0;
    background: #fff;
}

#scdev-chat-attachment {
    padding: 5px 8px;
    font-size: 12px;
}

.scdev-chat-form textarea {
    min-height: 52px;
    resize: vertical;
}

.scdev-chat-form input:focus,
.scdev-chat-form textarea:focus {
    outline: none;
    border-color: #2f6fdb;
    box-shadow: 0 0 0 3px rgba(47, 111, 219, 0.12);
}

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

.scdev-chat-actions {
    display: grid;
    gap: 2px;
    margin-bottom: 2px;
}

.scdev-chat-submit {
    border: 0;
    border-radius: 10px;
    background: #131d2d;
    color: #fff;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.0;
    cursor: pointer;
}

.scdev-chat-submit[disabled] {
    opacity: 0.75;
    cursor: wait;
}

.scdev-chat-status {
    min-height: 18px;
    margin: 0;
    color: #516074;
    font-size: 13px;
}

.scdev-chat-status:empty {
    display: none;
}

.scdev-chat-status.is-error {
    color: #b42318;
}

.scdev-chat-status.is-success {
    color: #027a48;
}

.scdev-chat-identity.is-hidden {
    display: none;
}

.scdev-chat-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(15, 23, 42, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.scdev-chat-lightbox[hidden] {
    display: none !important;
}

.scdev-chat-lightbox__dialog {
    position: relative;
    width: min(880px, 100%);
    max-height: 86vh;
    overflow: auto;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

.scdev-chat-lightbox__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: #131d2d;
    color: #fff;
    cursor: pointer;
}

.scdev-chat-lightbox__body {
    padding: 24px;
}

.scdev-chat-lightbox__body img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: 16px;
}

.scdev-chat-lightbox__body pre {
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    font-family: Consolas, monospace;
}

@media (max-width: 480px) {
    .scdev-chat-widget {
        right: 12px;
        bottom: 12px;
        width: calc(100vw - 24px);
    }

    .scdev-chat-panel {
        max-height: calc(100vh - 24px);
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .scdev-chat-staff-launcher {
        right: 12px;
        bottom: 62px;
    }

    .scdev-chat-messages {
        max-height: 200px;
    }
}
