.cs-widget-toggle {
    position: fixed;
    right: 16px;
    bottom: 86px;
    z-index: 999;
    border: 0;
    border-radius: 999px;
    background: #de2f2f;
    color: #fff;
    width: 54px;
    height: 54px;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    cursor: pointer;
}

.cs-widget-toggle.has-unread {
    box-shadow: 0 8px 24px rgba(222, 47, 47, 0.36);
}

.cs-widget-unread {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    border: 2px solid #fff;
    border-radius: 999px;
    padding: 0 5px;
    background: #ff2f2f;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 14px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(255, 47, 47, .34);
}

.cs-widget-panel {
    position: fixed;
    right: 12px;
    bottom: 146px;
    z-index: 1000;
    width: min(520px, calc(100vw - 32px));
    height: min(720px, calc(100vh - 166px));
    min-height: min(540px, calc(100vh - 166px));
    max-height: calc(100vh - 166px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cs-widget-panel[hidden] {
    display: none !important;
}

.cs-widget-head {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}

.cs-widget-head button {
    border: 0;
    background: transparent;
    color: #666;
}

.cs-widget-head strong {
    margin-right: auto;
}

.cs-widget-sound {
    min-width: 56px;
    height: 28px;
    border-radius: 999px !important;
    background: #f5f5f5 !important;
    color: #333 !important;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.cs-widget-sound[data-muted="1"] {
    color: #999 !important;
}

.cs-widget-volume {
    width: 74px;
    accent-color: #de2f2f;
    cursor: pointer;
}

.cs-widget-status {
    padding: 8px 12px;
    font-size: 12px;
    color: #666;
    background: #fafafa;
}

.cs-widget-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding: 14px 16px;
    background: #f8f8f8;
    min-height: 360px;
}

.cs-bubble {
    width: fit-content;
    max-width: 80%;
    margin: 0 auto 0 0;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.cs-bubble.user {
    margin-left: auto;
    margin-right: 0;
    background: #de2f2f;
    color: #fff;
}

.cs-bubble.agent {
    margin-right: auto;
    background: #fff;
    border: 1px solid #eee;
}

.support-scheme-card {
    display: flex;
    width: min(300px, 100%);
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    border: 1px solid #e1e7ee;
    border-radius: 12px;
    background: #fff;
    color: #24344b;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(28, 42, 63, .08);
}

.cs-bubble.user .support-scheme-card {
    border-color: rgba(255, 255, 255, .42);
}

.support-scheme-card:hover {
    border-color: #b89051;
}

.support-scheme-card-label {
    color: #a8752e;
    font-size: 11px;
    font-weight: 800;
}

.support-scheme-card-title {
    font-size: 14px;
    line-height: 1.45;
}

.support-scheme-card-meta {
    color: #78869a;
    font-size: 12px;
}

.support-scheme-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
    color: #738096;
    font-size: 11px;
}

.support-scheme-card-footer b {
    color: #b05f35;
    font-size: 14px;
}

.cs-message-agent-label {
    display: block;
    margin-bottom: 4px;
    color: #92703a;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: .02em;
}

.cs-bubble.cs-bubble-image {
    padding: 4px;
    background: transparent;
    border: 0;
}

.cs-bubble.cs-bubble-image .support-message-image {
    max-width: min(240px, 100%);
    max-height: 240px;
}

.cs-bubble.cs-bubble-file {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.cs-bubble.cs-bubble-file .support-message-file-link {
    min-width: 190px;
    max-width: min(280px, 100%);
}

.cs-widget-form {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: stretch;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #eee;
    background: #fff;
}

.cs-widget-input {
    resize: none;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px;
    min-width: 0;
}

.cs-widget-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cs-widget-form button {
    border: 0;
    border-radius: 8px;
    background: #111;
    color: #fff;
    min-width: 46px;
    min-height: 34px;
    padding: 0 10px;
    font-size: 13px;
}

.cs-widget-form button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

@media (max-width: 620px) {
    .cs-widget-panel {
        right: 8px;
        bottom: 76px;
        width: calc(100vw - 16px);
        height: calc(100vh - 92px);
        min-height: 0;
        max-height: none;
        border-radius: 16px;
    }

    .cs-widget-messages {
        min-height: 0;
    }
}

.cs-widget-image-btn {
    background: #666 !important;
}

/* Shared customer-facing widget polish. */
.cs-widget-toggle {
    width: 58px;
    height: 58px;
    border: 3px solid rgba(255, 255, 255, .86);
    background: linear-gradient(145deg, #d7ab64 0%, #a8752e 100%);
    color: #fff;
    box-shadow: 0 12px 26px rgba(96, 66, 27, .28);
    transition: transform .2s ease, box-shadow .2s ease;
}

.cs-widget-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(96, 66, 27, .34);
}

.cs-widget-panel {
    border: 1px solid rgba(28, 42, 63, .1);
    border-radius: 18px;
    box-shadow: 0 20px 55px rgba(28, 42, 63, .2);
}

.cs-widget-head {
    min-height: 58px;
    padding: 11px 14px;
    border-bottom-color: rgba(255, 255, 255, .12);
    background: linear-gradient(135deg, #17263d 0%, #294563 100%);
    color: #fff;
}

.cs-widget-head button {
    color: #d4deea;
}

.cs-widget-head strong {
    color: #fff;
    font-size: 14px;
}

.cs-widget-status {
    padding: 9px 14px;
    background: #f4f7fa;
    color: #728096;
}

.cs-widget-messages {
    gap: 10px;
    padding: 16px 14px;
    background: #f5f7f9;
}

.cs-bubble {
    padding: 10px 12px;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(28, 42, 63, .05);
}

.cs-bubble.user {
    background: linear-gradient(145deg, #b89051 0%, #9e7132 100%);
}

.cs-bubble.agent {
    border-color: #e4eaf0;
}

.cs-widget-form {
    padding: 12px;
    border-top-color: #e7edf2;
}

.cs-widget-input {
    border-color: #dce4eb;
    border-radius: 11px;
    background: #fbfcfd;
    outline: 0;
}

.cs-widget-input:focus {
    border-color: #b9c9d8;
    box-shadow: 0 0 0 3px rgba(102, 137, 169, .1);
}

.cs-widget-form button {
    border-radius: 10px;
    background: #17263d;
}

.cs-widget-file-btn {
    background: #4f6a86 !important;
}

@media (max-width: 620px) {
    .cs-widget-toggle {
        width: 54px;
        height: 54px;
    }
}
