.ws-sai-shell {
    max-width: 840px;
    margin: 34px auto;
    font-family: inherit;
}

.ws-sai-card {
    background: #f4f3f2;
    border: 1px solid #e2ddd9;
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 10px 28px rgba(83, 65, 52, 0.06);
    color: #6f5e53;
}

.ws-sai-title {
    margin: 0 0 14px;
    color: #6f5e53;
    font-weight: 500;
    line-height: 1.2;
    font-size: 28px;
}

.ws-sai-text,
.ws-sai-card p,
.ws-sai-card div,
.ws-sai-card span,
.ws-sai-card strong {
    box-sizing: border-box;
    color: inherit;
}

.ws-sai-text {
    font-size: 16px;
    line-height: 1.55;
}

.ws-sai-message-list {
    display: grid;
    gap: 14px;
}

.ws-sai-message-item {
    padding: 18px 20px;
    border-radius: 14px;
    background: rgba(255,255,255,0.7);
    border: 1px solid #ddd4ce;
}

.ws-sai-message-item-approved {
    background: #eef7ef;
    border-color: #cfe4d3;
}

.ws-sai-message-item-rejected {
    background: #fbefef;
    border-color: #eccccc;
}

.ws-sai-headline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.ws-sai-message-date {
    margin-top: 6px;
    font-size: 14px;
    color: #9a8678;
}

.ws-sai-message-body p {
    margin: 0 0 12px;
    line-height: 1.6;
}

.ws-sai-message-body p:last-child {
    margin-bottom: 0;
}

.ws-sai-badge-new {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 13px;
    background: #efe7ff;
    color: #7352a0;
    white-space: nowrap;
}

.ws-sai-message-actions {
    margin-top: 14px;
}

.ws-sai-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    border: 0;
    border-radius: 6px;
    background: #b48f86;
    color: #ffffff;
    font-size: 15px;
    cursor: pointer;
}

.ws-sai-delete-btn:hover,
.ws-sai-delete-btn:focus {
    opacity: 0.95;
}

.ws-sai-notice {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 15px;
    line-height: 1.5;
}

.ws-sai-notice-success {
    background: #e6f3e9;
    color: #3f6a4a;
    border-color: #c3dfca;
}

.ws-sai-notice-error {
    background: #f6e4e4;
    color: #7c4343;
    border-color: #ebc5c5;
}

@media (max-width: 767px) {
    .ws-sai-shell {
        margin: 18px auto;
    }

    .ws-sai-card {
        padding: 20px;
        border-radius: 16px;
    }

    .ws-sai-title {
        font-size: 24px;
    }

    .ws-sai-headline {
        flex-direction: column;
    }
}

.ws-sai-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.ws-sai-primary-btn,
.ws-sai-secondary-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 11px 18px;
    border: 0;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.ws-sai-primary-btn {
    background: #b48f86;
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(120, 88, 74, 0.16);
}

.ws-sai-secondary-action-btn {
    background: #7fb3d2;
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(79, 126, 153, 0.16);
}

.ws-sai-primary-btn:hover,
.ws-sai-secondary-action-btn:hover,
.ws-sai-primary-btn:focus,
.ws-sai-secondary-action-btn:focus {
    opacity: 0.95;
    transform: translateY(-1px);
    color: #ffffff;
}

.ws-sai-btn-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    margin-left: 8px;
    padding: 0 6px;
    border-radius: 999px;
    background: #df5b66;
    color: #ffffff;
    font-size: 12px;
    line-height: 1;
}

.ws-sai-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
}

.ws-sai-modal.is-open {
    display: flex;
}

.ws-sai-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(49, 37, 30, 0.42);
}

.ws-sai-modal-panel {
    position: relative;
    z-index: 1;
    width: min(620px, 100%);
    max-height: calc(100vh - 44px);
    overflow: hidden;
    border-radius: 18px;
    background: #f8f3ef;
    border: 1px solid #decfc7;
    color: #6f5e53;
    box-shadow: 0 24px 70px rgba(61, 45, 35, 0.25);
    padding: 28px;
}

.ws-sai-modal-panel-wide {
    width: min(760px, 100%);
}

.ws-sai-modal-panel h3 {
    margin: 0 44px 16px 0;
    color: #6f5e53;
    font-size: 28px;
    line-height: 1.2;
    font-weight: 500;
}

.ws-sai-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(111, 94, 83, 0.22);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    color: #6f5e53;
    font-size: 25px;
    line-height: 1;
    cursor: pointer;
}

.ws-sai-modal-scroll {
    max-height: min(62vh, 560px);
    overflow-y: auto;
    padding-right: 6px;
}

.ws-sai-support-intro {
    margin: 0 0 18px;
    font-size: 16px;
    line-height: 1.55;
    color: #806b60;
}

.ws-sai-field {
    display: block;
    margin: 0 0 14px;
    color: #6f5e53;
}

.ws-sai-field span {
    display: block;
    margin-bottom: 7px;
}

.ws-sai-field input,
.ws-sai-field textarea {
    width: 100%;
    border: 1px solid #d8c7bd;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.82);
    color: #6f5e53;
    font: inherit;
    padding: 13px 15px;
    box-sizing: border-box;
}

.ws-sai-field textarea {
    min-height: 138px;
    resize: vertical;
}

.ws-sai-support-result {
    min-height: 24px;
    margin: 4px 0 12px;
    font-size: 14px;
    line-height: 1.45;
}

.ws-sai-support-result.is-success {
    color: #3f6a4a;
}

.ws-sai-support-result.is-error {
    color: #8a3f3f;
}

.ws-sai-floating-chat {
    position: fixed;
    left: 22px;
    bottom: 22px;
    z-index: 99990;
}

.ws-sai-floating-chat-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    background: #b48f86;
    color: #ffffff;
    box-shadow: 0 16px 35px rgba(84, 59, 47, 0.22);
    cursor: pointer;
}

.ws-sai-floating-chat-btn svg {
    width: 26px;
    height: 26px;
}

.ws-sai-floating-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: #df5b66;
    color: #ffffff;
    font-size: 12px;
    line-height: 22px;
    text-align: center;
    box-shadow: 0 0 0 3px #ffffff;
}

.ws-sai-floating-badge.hidden,
.ws-sai-btn-badge.hidden {
    display: none;
}

.ws-sai-support-request-list {
    display: grid;
    gap: 14px;
}

.ws-sai-support-request {
    padding: 18px 20px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid #ddd4ce;
}

.ws-sai-support-request.is-unread {
    background: #eef7ef;
    border-color: #cfe4d3;
}

.ws-sai-support-request-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.ws-sai-support-request-user {
    margin-top: 5px;
    font-size: 14px;
    color: #9a8678;
}

.ws-sai-support-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ws-sai-secondary-btn {
    background: #7fb3d2;
}

body.ws-sai-modal-open {
    overflow: hidden;
}

@media (max-width: 767px) {
    .ws-sai-card-actions {
        flex-direction: column;
    }

    .ws-sai-primary-btn,
    .ws-sai-secondary-action-btn {
        width: 100%;
    }

    .ws-sai-modal {
        padding: 14px;
    }

    .ws-sai-modal-panel {
        padding: 22px 18px;
        border-radius: 16px;
    }

    .ws-sai-modal-panel h3 {
        font-size: 23px;
    }

    .ws-sai-modal-scroll {
        max-height: 62vh;
    }

    .ws-sai-floating-chat {
        left: 16px;
        bottom: 16px;
    }

    .ws-sai-floating-chat-btn {
        width: 54px;
        height: 54px;
    }
}

.ws-sai-chat-panel {
    width: min(980px, 100%);
    padding: 24px;
}

.ws-sai-chat-layout {
    display: grid;
    grid-template-columns: minmax(220px, 31%) minmax(0, 1fr);
    gap: 16px;
    height: min(68vh, 680px);
    min-height: 520px;
    max-height: 680px;
}

.ws-sai-chat-sidebar,
.ws-sai-chat-main {
    min-width: 0;
    border: 1px solid #decfc7;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.58);
    overflow: hidden;
}

.ws-sai-chat-sidebar {
    display: flex;
    flex-direction: column;
}

.ws-sai-chat-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 14px 12px;
    border-bottom: 1px solid #eadbd2;
    color: #6f5e53;
}

.ws-sai-new-dialog-btn {
    border: 0;
    border-radius: 999px;
    padding: 8px 12px;
    background: #b48f86;
    color: #fff;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.ws-sai-dialog-list {
    display: grid;
    gap: 8px;
    padding: 10px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    align-content: start;
    grid-auto-rows: max-content;
}

.ws-sai-dialog-tab {
    position: relative;
    width: 100%;
    min-height: 78px;
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 12px 38px 12px 12px;
    background: rgba(248, 243, 239, 0.9);
    color: #6f5e53;
    text-align: left;
    cursor: pointer;
}

.ws-sai-dialog-tab.is-active,
.ws-sai-dialog-tab:hover {
    background: #f0e2dc;
    border-color: #d8c3b8;
}

.ws-sai-dialog-title,
.ws-sai-dialog-user,
.ws-sai-dialog-date {
    display: block;
}

.ws-sai-dialog-title {
    font-weight: 600;
    line-height: 1.25;
}

.ws-sai-dialog-user,
.ws-sai-dialog-date {
    margin-top: 5px;
    font-size: 13px;
    color: #9a8678;
}

.ws-sai-dialog-unread {
    position: absolute;
    top: 11px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: #df5b66;
    color: #fff;
    font-size: 12px;
}

.ws-sai-dialog-empty,
.ws-sai-chat-empty {
    margin: 0;
    color: #9a8678;
    line-height: 1.5;
}

.ws-sai-chat-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ws-sai-chat-pane,
.ws-sai-new-dialog-pane {
    display: none;
    min-height: 0;
    flex: 1;
    flex-direction: column;
}

.ws-sai-chat-pane.is-active,
.ws-sai-new-dialog-pane.is-active {
    display: flex;
}

.ws-sai-chat-head {
    padding: 15px 18px;
    border-bottom: 1px solid #eadbd2;
    background: rgba(255, 255, 255, 0.45);
    color: #6f5e53;
}

.ws-sai-chat-head strong,
.ws-sai-chat-head span {
    display: block;
}

.ws-sai-chat-head strong {
    font-size: 18px;
    line-height: 1.25;
}

.ws-sai-chat-head span {
    margin-top: 4px;
    font-size: 14px;
    color: #9a8678;
}

.ws-sai-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ws-sai-chat-bubble {
    max-width: 78%;
    border-radius: 18px;
    padding: 12px 14px;
    border: 1px solid #e2d4cc;
    background: #fff;
    color: #6f5e53;
}

.ws-sai-chat-bubble.is-user {
    align-self: flex-start;
    background: #fffaf6;
}

.ws-sai-chat-bubble.is-admin {
    align-self: flex-end;
    background: #e8f3f8;
    border-color: #c7deeb;
}

.ws-sai-chat-bubble-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
    font-size: 12px;
    color: #9a8678;
}

.ws-sai-chat-bubble-text p {
    margin: 0 0 10px;
    line-height: 1.5;
}

.ws-sai-chat-bubble-text p:last-child {
    margin-bottom: 0;
}

.ws-sai-chat-form {
    padding: 14px 16px 16px;
    border-top: 1px solid #eadbd2;
    background: rgba(255, 255, 255, 0.52);
}

.ws-sai-chat-form .ws-sai-field textarea {
    min-height: 92px;
}

.ws-sai-subject-field.is-hidden {
    display: none;
}

.ws-sai-admin-chat-card {
    max-width: none;
}

.ws-sai-support-admin-chat {
    margin-top: 14px;
}

.ws-sai-support-admin-chat .ws-sai-chat-layout {
    min-height: 620px;
}

.ws-sai-support-admin-chat.is-wp-admin .ws-sai-chat-layout {
    min-height: 600px;
}

@media (max-width: 900px) {
    .ws-sai-chat-layout {
        grid-template-columns: 1fr;
        height: auto;
        max-height: none;
    }

    .ws-sai-chat-sidebar {
        max-height: 260px;
    }

    .ws-sai-chat-main {
        height: 520px;
        min-height: 520px;
    }
}

@media (max-width: 767px) {
    .ws-sai-chat-panel {
        padding: 18px 14px;
    }

    .ws-sai-chat-layout {
        min-height: auto;
        gap: 12px;
    }

    .ws-sai-chat-main {
        height: 500px;
        min-height: 500px;
    }

    .ws-sai-chat-bubble {
        max-width: 92%;
    }
}

.ws-sai-dialog-row {
    position: relative;
    display: block;
}

.ws-sai-dialog-row.is-active .ws-sai-dialog-tab,
.ws-sai-dialog-row:hover .ws-sai-dialog-tab {
    background: #f0e2dc;
    border-color: #d8c3b8;
}

.ws-sai-dialog-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border: 1px solid rgba(111, 94, 83, 0.18);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.82);
    color: #9a756a;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.18s ease, background 0.18s ease;
}

.ws-sai-dialog-row:hover .ws-sai-dialog-delete,
.ws-sai-dialog-row:focus-within .ws-sai-dialog-delete {
    opacity: 1;
}

.ws-sai-dialog-delete:hover,
.ws-sai-dialog-delete:focus {
    background: #f7e8e5;
    color: #8a4d43;
}

.ws-sai-message-delete {
    position: absolute;
    top: 7px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: 1px solid rgba(111, 94, 83, 0.16);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.78);
    color: #9a756a;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.18s ease, background 0.18s ease;
}

.ws-sai-chat-bubble:hover .ws-sai-message-delete,
.ws-sai-chat-bubble:focus-within .ws-sai-message-delete {
    opacity: 1;
}

.ws-sai-message-delete:hover,
.ws-sai-message-delete:focus {
    background: #f7e8e5;
    color: #8a4d43;
}

.ws-sai-chat-bubble {
    position: relative;
    padding-right: 38px;
}

.ws-sai-chat-bubble.is-incoming {
    align-self: flex-start;
    background: #ffffff;
    border-color: #e2d4cc;
}

.ws-sai-chat-bubble.is-outgoing {
    align-self: flex-end;
    background: #e8f3f8;
    border-color: #c7deeb;
}

.ws-sai-chat-bubble.is-user,
.ws-sai-chat-bubble.is-admin {
    background: inherit;
}

.ws-sai-chat-bubble.is-incoming.is-user,
.ws-sai-chat-bubble.is-incoming.is-admin {
    background: #ffffff;
}

.ws-sai-chat-bubble.is-outgoing.is-user,
.ws-sai-chat-bubble.is-outgoing.is-admin {
    background: #e8f3f8;
}

.ws-sai-dialog-tab {
    padding-right: 42px;
}

.ws-sai-new-dialog-btn {
    white-space: nowrap;
}

@media (max-width: 767px) {
    .ws-sai-dialog-delete,
    .ws-sai-message-delete {
        opacity: 1;
    }
}

/* Version 1.6.5 fixes */
.ws-sai-modal,
.ws-sai-modal-panel,
.ws-sai-chat-sidebar,
.ws-sai-dialog-list,
.ws-sai-chat-main,
.ws-sai-chat-messages {
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 767px) {
    .ws-sai-modal {
        align-items: flex-start;
        overflow-y: auto;
        padding: 10px;
        touch-action: pan-y;
    }

    .ws-sai-modal-panel.ws-sai-chat-panel,
    .ws-sai-modal-panel.ws-sai-support-panel {
        width: 100%;
        max-height: none;
        overflow: visible;
        padding: 18px 12px 14px;
    }

    .ws-sai-modal-panel h3 {
        margin-right: 42px;
    }

    .ws-sai-chat-layout {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 0;
        max-height: none;
    }

    .ws-sai-chat-sidebar {
        flex: 0 0 auto;
        max-height: 220px;
        overflow: hidden;
    }

    .ws-sai-dialog-list {
        max-height: 164px;
        overflow-y: auto;
    }

    .ws-sai-chat-main {
        height: auto;
        min-height: 0;
        max-height: none;
        overflow: visible;
    }

    .ws-sai-chat-pane,
    .ws-sai-new-dialog-pane {
        min-height: 0;
        flex: none;
    }

    .ws-sai-chat-messages {
        flex: none;
        min-height: 180px;
        max-height: 34vh;
        overflow-y: auto;
    }

    .ws-sai-chat-form {
        flex: 0 0 auto;
    }

    .ws-sai-chat-form .ws-sai-field textarea {
        min-height: 86px;
        max-height: 32vh;
    }
}

/* Version 1.6.6 iPhone input and popup stability fixes */
.ws-sai-field input,
.ws-sai-field textarea,
.ws-sai-chat-form input,
.ws-sai-chat-form textarea,
.ws-sai-support-form input,
.ws-sai-support-form textarea {
    font-size: 16px !important;
    line-height: 1.45 !important;
    min-height: 48px;
    -webkit-text-size-adjust: 100%;
    -webkit-appearance: none;
    appearance: none;
    transform: translateZ(0);
}

.ws-sai-field textarea,
.ws-sai-chat-form textarea,
.ws-sai-support-form textarea {
    padding-top: 13px;
    padding-bottom: 13px;
    caret-color: #6f5e53;
}

.ws-sai-modal.is-open {
    overscroll-behavior: contain;
}

.ws-sai-chat-panel,
.ws-sai-chat-layout,
.ws-sai-chat-main,
.ws-sai-chat-form,
.ws-sai-chat-messages,
.ws-sai-dialog-list {
    -webkit-transform: translateZ(0);
}

@media (max-width: 767px) {
    body.ws-sai-modal-open {
        overflow: hidden;
        width: 100%;
        touch-action: none;
    }

    .ws-sai-modal.is-open {
        align-items: stretch;
        justify-content: center;
        overflow: hidden;
        padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    }

    .ws-sai-modal-panel.ws-sai-chat-panel,
    .ws-sai-modal-panel.ws-sai-support-panel {
        display: flex;
        flex-direction: column;
        width: 100%;
        height: calc(100vh - 20px);
        height: calc(100dvh - 20px);
        max-height: calc(100vh - 20px);
        max-height: calc(100dvh - 20px);
        overflow: hidden;
        padding: 16px 12px 12px;
    }

    .ws-sai-modal-panel h3,
    .ws-sai-support-intro {
        flex: 0 0 auto;
    }

    .ws-sai-support-intro {
        margin-bottom: 10px;
        font-size: 16px;
        line-height: 1.35;
    }

    .ws-sai-chat-layout {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
        gap: 10px;
    }

    .ws-sai-chat-sidebar {
        flex: 0 0 auto;
        max-height: 168px;
        min-height: 0;
    }

    .ws-sai-dialog-list {
        max-height: 112px;
        overflow-y: auto;
    }

    .ws-sai-chat-main {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
        height: auto;
        max-height: none;
    }

    .ws-sai-chat-pane,
    .ws-sai-new-dialog-pane {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
    }

    .ws-sai-chat-head {
        flex: 0 0 auto;
        padding: 12px 14px;
    }

    .ws-sai-chat-messages {
        flex: 1 1 auto;
        min-height: 90px;
        max-height: none;
        overflow-y: auto;
        padding: 12px;
    }

    .ws-sai-chat-form {
        flex: 0 0 auto;
        padding: 12px;
        max-height: 42vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .ws-sai-chat-form .ws-sai-field {
        margin-bottom: 10px;
    }

    .ws-sai-chat-form .ws-sai-field textarea {
        min-height: 94px;
        max-height: 24vh;
    }

    .ws-sai-primary-btn {
        min-height: 48px;
    }
}

/* Version 1.6.7 mobile dialog stability fixes */
@media (max-width: 767px) {
    .ws-sai-modal.is-open {
        align-items: stretch;
        justify-content: center;
        overflow: hidden;
    }

    .ws-sai-modal-panel.ws-sai-chat-panel,
    .ws-sai-modal-panel.ws-sai-support-panel {
        display: flex;
        flex-direction: column;
        width: 100%;
        height: calc(100svh - 20px);
        max-height: calc(100svh - 20px);
        min-height: 0;
        overflow: hidden;
        padding: 14px 10px 10px;
    }

    @supports (height: 100dvh) {
        .ws-sai-modal-panel.ws-sai-chat-panel,
        .ws-sai-modal-panel.ws-sai-support-panel {
            height: calc(100dvh - 20px);
            max-height: calc(100dvh - 20px);
        }
    }

    .ws-sai-modal-panel h3 {
        flex: 0 0 auto;
        margin: 0 44px 8px 0;
        font-size: 21px;
        line-height: 1.2;
    }

    .ws-sai-support-intro {
        flex: 0 0 auto;
        margin: 0 0 8px;
        font-size: 15px;
        line-height: 1.3;
    }

    .ws-sai-chat-layout {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        min-height: 0;
        height: auto;
        max-height: none;
        overflow: hidden;
        gap: 8px;
    }

    .ws-sai-chat-sidebar {
        flex: 0 0 auto;
        min-height: 0;
        max-height: 132px;
        overflow: hidden;
    }

    .ws-sai-chat-sidebar-head {
        padding: 10px 10px 8px;
    }

    .ws-sai-new-dialog-btn {
        padding: 7px 10px;
        font-size: 12px;
    }

    .ws-sai-dialog-list {
        max-height: 76px;
        padding: 8px;
        overflow-y: auto;
    }

    .ws-sai-dialog-tab {
        min-height: 58px;
        padding: 9px 34px 9px 10px;
    }

    .ws-sai-dialog-title {
        font-size: 14px;
    }

    .ws-sai-dialog-user,
    .ws-sai-dialog-date {
        margin-top: 3px;
        font-size: 12px;
    }

    .ws-sai-chat-main {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        min-height: 0;
        height: auto;
        max-height: none;
        overflow: hidden;
    }

    .ws-sai-chat-pane,
    .ws-sai-new-dialog-pane {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
    }

    .ws-sai-chat-head {
        flex: 0 0 auto;
        padding: 10px 12px;
    }

    .ws-sai-chat-head strong {
        font-size: 15px;
    }

    .ws-sai-chat-head span {
        font-size: 12px;
        line-height: 1.25;
    }

    .ws-sai-new-dialog-pane.is-active .ws-sai-chat-messages {
        display: none;
    }

    .ws-sai-chat-messages {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        overflow-y: auto;
        padding: 10px;
    }

    .ws-sai-chat-bubble {
        max-width: 94%;
        padding: 10px 34px 10px 12px;
        border-radius: 14px;
    }

    .ws-sai-chat-bubble-meta {
        gap: 8px;
        font-size: 11px;
        line-height: 1.25;
        flex-wrap: wrap;
    }

    .ws-sai-chat-form {
        flex: 0 0 auto;
        padding: 10px;
        max-height: 54vh;
        overflow-y: auto;
        background: rgba(255, 255, 255, 0.72);
        -webkit-overflow-scrolling: touch;
    }

    .ws-sai-chat-form .ws-sai-field {
        margin-bottom: 8px;
    }

    .ws-sai-field span {
        margin-bottom: 5px;
        font-size: 14px;
    }

    .ws-sai-field input,
    .ws-sai-field textarea,
    .ws-sai-chat-form input,
    .ws-sai-chat-form textarea,
    .ws-sai-support-form input,
    .ws-sai-support-form textarea {
        font-size: 16px !important;
        line-height: 1.4 !important;
        padding: 12px 13px !important;
        border-radius: 12px;
    }

    .ws-sai-field input,
    .ws-sai-support-form input[name="subject"] {
        height: 48px;
        min-height: 48px;
    }

    .ws-sai-chat-form .ws-sai-field textarea,
    .ws-sai-support-form textarea[name="body"] {
        min-height: 96px;
        max-height: 28vh;
    }

    .ws-sai-support-result {
        min-height: 18px;
        margin: 2px 0 8px;
        font-size: 13px;
    }

    .ws-sai-primary-btn {
        min-height: 46px;
        width: 100%;
    }
}

/* Version 1.6.8 mobile top tabs for support dialog */
@media (max-width: 767px) {
    .ws-sai-chat-layout {
        gap: 8px;
    }

    .ws-sai-chat-sidebar {
        border-radius: 14px;
        border-color: #eadbd2;
        background: rgba(255, 255, 255, 0.72);
        max-height: none;
        overflow: visible;
    }

    .ws-sai-chat-sidebar-head {
        padding: 8px 9px 6px;
        border-bottom: 0;
        align-items: center;
    }

    .ws-sai-chat-sidebar-head strong {
        font-size: 13px;
        line-height: 1.2;
    }

    .ws-sai-new-dialog-btn {
        min-height: 34px;
        padding: 8px 12px;
        font-size: 13px;
        flex: 0 0 auto;
    }

    .ws-sai-dialog-list {
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        padding: 0 9px 9px;
        max-height: none;
        min-height: 46px;
        overflow-x: auto;
        overflow-y: hidden;
        align-items: stretch;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .ws-sai-dialog-row {
        flex: 0 0 auto;
        width: 132px;
        scroll-snap-align: start;
    }

    .ws-sai-dialog-tab {
        display: flex;
        flex-direction: column;
        justify-content: center;
        width: 132px;
        min-height: 46px;
        height: 46px;
        border-radius: 999px;
        padding: 7px 30px 7px 12px;
        overflow: hidden;
        background: #f8f3ef;
    }

    .ws-sai-dialog-tab.is-active,
    .ws-sai-dialog-row.is-active .ws-sai-dialog-tab {
        background: #ead8d0;
        border-color: #d3b9ad;
    }

    .ws-sai-dialog-title,
    .ws-sai-dialog-user,
    .ws-sai-dialog-date {
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .ws-sai-dialog-title {
        font-size: 13px;
        line-height: 1.15;
    }

    .ws-sai-dialog-user,
    .ws-sai-dialog-date {
        margin-top: 2px;
        font-size: 11px;
        line-height: 1.15;
    }

    .ws-sai-dialog-unread {
        top: 5px;
        right: 5px;
        min-width: 18px;
        height: 18px;
        padding: 0 5px;
        font-size: 10px;
    }

    .ws-sai-dialog-delete {
        top: 50%;
        right: 5px;
        width: 20px;
        height: 20px;
        transform: translateY(-50%);
        font-size: 14px;
        background: rgba(255, 255, 255, 0.92);
        z-index: 2;
    }

    .ws-sai-new-dialog-temp-row .ws-sai-dialog-tab {
        background: #e8f3f8;
        border-color: #c7deeb;
    }

    .ws-sai-dialog-empty {
        flex: 0 0 auto;
        width: auto;
        padding: 10px 0;
        font-size: 13px;
    }

    .ws-sai-chat-main {
        height: auto;
        min-height: 0;
        flex: 1 1 auto;
    }

    .ws-sai-chat-head {
        padding: 9px 11px;
    }

    .ws-sai-chat-head strong {
        font-size: 14px;
    }

    .ws-sai-chat-head span {
        display: none;
    }

    .ws-sai-chat-messages {
        padding: 9px;
        gap: 9px;
    }

    .ws-sai-chat-form {
        padding: 9px;
    }
}

/* Version 1.6.9 avatars and safer message deletion */
.ws-sai-chat-message-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    width: 100%;
}

.ws-sai-chat-message-row.is-incoming {
    justify-content: flex-start;
}

.ws-sai-chat-message-row.is-outgoing {
    justify-content: flex-end;
    flex-direction: row-reverse;
}

.ws-sai-chat-message-row .ws-sai-chat-bubble {
    align-self: auto;
    max-width: calc(78% - 44px);
}

.ws-sai-chat-avatar {
    width: 36px;
    min-width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: #f0e2dc;
    border: 1px solid rgba(111, 94, 83, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ws-sai-chat-avatar img,
.ws-sai-chat-avatar .avatar,
.ws-sai-avatar-img {
    display: block;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.ws-sai-chat-message-row.is-outgoing .ws-sai-chat-avatar {
    border-color: rgba(199, 222, 235, 0.9);
    background: #e8f3f8;
}

@media (max-width: 767px) {
    .ws-sai-chat-message-row {
        gap: 7px;
    }

    .ws-sai-chat-avatar,
    .ws-sai-chat-avatar img,
    .ws-sai-chat-avatar .avatar,
    .ws-sai-avatar-img {
        width: 32px;
        min-width: 32px;
        height: 32px;
    }

    .ws-sai-chat-message-row .ws-sai-chat-bubble {
        max-width: calc(92% - 39px);
    }
}

/* Version 1.7.0 floating inbox notifications */
.ws-sai-floating-inbox {
    margin: 0 0 18px;
    padding: 14px;
    border: 1px solid rgba(111, 94, 83, 0.14);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.58);
}

.ws-sai-floating-inbox-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 10px;
    color: #6f5e53;
    font-size: 16px;
    line-height: 1.35;
}

.ws-sai-floating-inbox-list {
    max-height: 220px;
    overflow-y: auto;
    padding-right: 4px;
}

.ws-sai-floating-inbox-list .ws-sai-message-list {
    gap: 10px;
}

.ws-sai-floating-inbox-list .ws-sai-message-item {
    padding: 12px;
}

@media (max-width: 767px) {
    .ws-sai-floating-inbox {
        margin-bottom: 14px;
        padding: 12px;
    }

    .ws-sai-floating-inbox-list {
        max-height: 190px;
    }
}
/* Version 1.7.1 pinned admin notices topic */
.ws-sai-dialog-row-pinned .ws-sai-dialog-tab {
    background: #fff8f1;
    border-color: rgba(111, 94, 83, 0.18);
}

.ws-sai-dialog-row-pinned.is-active .ws-sai-dialog-tab,
.ws-sai-dialog-row-pinned:hover .ws-sai-dialog-tab {
    background: #f0e2dc;
    border-color: #d8c3b8;
}

.ws-sai-dialog-empty-support {
    margin-top: 8px;
    padding: 0 4px;
}

.ws-sai-chat-form.is-hidden-for-notices {
    display: none;
}

.ws-sai-avatar-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #6f5e53;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.ws-sai-admin-notices-pane .ws-sai-chat-bubble {
    max-width: calc(88% - 44px);
}

.ws-sai-notice-message-row .ws-sai-chat-bubble-text p:first-child {
    margin-bottom: 8px;
}

@media (max-width: 767px) {
    .ws-sai-admin-notices-pane .ws-sai-chat-bubble {
        max-width: calc(94% - 39px);
    }
}


/* Version 1.7.2 mobile support widget and stable pinned topic */
.ws-sai-dialog-empty-support {
    display: none !important;
}

@media (max-width: 767px) {
    .ws-sai-modal-panel.ws-sai-chat-panel,
    .ws-sai-modal-panel.ws-sai-support-panel {
        width: 100%;
        height: calc(100svh - 20px);
        max-height: calc(100svh - 20px);
        padding: 12px 10px 10px;
        overflow: hidden;
        box-sizing: border-box;
    }

    @supports (height: 100dvh) {
        .ws-sai-modal-panel.ws-sai-chat-panel,
        .ws-sai-modal-panel.ws-sai-support-panel {
            height: calc(100dvh - 20px);
            max-height: calc(100dvh - 20px);
        }
    }

    .ws-sai-modal-panel h3 {
        margin: 0 42px 6px 0;
        font-size: 19px;
        line-height: 1.16;
    }

    .ws-sai-support-intro {
        display: none;
    }

    .ws-sai-chat-layout,
    .ws-sai-support-admin-chat .ws-sai-chat-layout {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        min-height: 0;
        height: auto;
        max-height: none;
        overflow: hidden;
        gap: 8px;
    }

    .ws-sai-chat-sidebar {
        flex: 0 0 auto;
        min-height: 0;
        max-height: 96px;
        overflow: hidden;
        border-radius: 14px;
    }

    .ws-sai-chat-sidebar-head {
        min-height: 34px;
        padding: 6px 8px 5px;
    }

    .ws-sai-dialog-list {
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        min-height: 50px;
        max-height: 58px;
        padding: 0 8px 8px;
        overflow-x: auto;
        overflow-y: hidden;
        align-items: stretch;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .ws-sai-dialog-row {
        flex: 0 0 136px;
        width: 136px;
        min-width: 136px;
        scroll-snap-align: start;
    }

    .ws-sai-dialog-row-pinned {
        flex-basis: 184px;
        width: 184px;
        min-width: 184px;
    }

    .ws-sai-dialog-tab,
    .ws-sai-dialog-tab-pinned {
        width: 100%;
        min-height: 46px;
        height: 46px;
        padding: 7px 28px 7px 11px;
        border-radius: 999px;
        box-sizing: border-box;
    }

    .ws-sai-chat-main {
        flex: 1 1 auto;
        min-height: 0;
        height: auto;
        max-height: none;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .ws-sai-chat-pane,
    .ws-sai-new-dialog-pane {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
    }

    .ws-sai-chat-pane.is-active,
    .ws-sai-new-dialog-pane.is-active {
        display: flex;
        flex-direction: column;
    }

    .ws-sai-chat-head {
        flex: 0 0 auto;
        padding: 8px 10px;
    }

    .ws-sai-chat-messages {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        overflow-y: auto;
        padding: 9px;
        gap: 8px;
        overscroll-behavior: contain;
    }

    .ws-sai-chat-form {
        flex: 0 0 auto;
        max-height: 38vh;
        padding: 9px;
        overflow-y: auto;
    }

    .ws-sai-chat-form.is-hidden-for-notices {
        display: none !important;
    }

    .ws-sai-admin-notices-pane .ws-sai-chat-bubble,
    .ws-sai-chat-message-row .ws-sai-chat-bubble {
        max-width: calc(96% - 39px);
    }
}


.ws-sai-custom-badge-host {
    position: relative;
}

.ws-sai-custom-badge {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #c26659;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 6px 16px rgba(95, 66, 52, .22);
    pointer-events: none;
    z-index: 5;
}

.ws-sai-custom-badge[aria-hidden="true"] {
    display: none;
}


/* Version 1.8.0 desktop admin chat outgoing alignment */
@media (min-width: 768px) {
    .ws-sai-support-admin-chat .ws-sai-chat-messages .ws-sai-chat-message-row.is-outgoing,
    .ws-sai-modal-panel .ws-sai-support-admin-chat .ws-sai-chat-messages .ws-sai-chat-message-row.is-outgoing,
    .ws-sai-modal-panel .ws-sai-chat-messages .ws-sai-chat-message-row.is-outgoing {
        display: flex !important;
        flex-direction: row-reverse !important;
        justify-content: flex-start !important;
        align-items: flex-end !important;
        width: 100% !important;
    }

    .ws-sai-support-admin-chat .ws-sai-chat-messages .ws-sai-chat-message-row.is-outgoing .ws-sai-chat-bubble,
    .ws-sai-modal-panel .ws-sai-support-admin-chat .ws-sai-chat-messages .ws-sai-chat-message-row.is-outgoing .ws-sai-chat-bubble,
    .ws-sai-modal-panel .ws-sai-chat-messages .ws-sai-chat-message-row.is-outgoing .ws-sai-chat-bubble {
        align-self: auto !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .ws-sai-support-admin-chat .ws-sai-chat-messages .ws-sai-chat-message-row.is-outgoing .ws-sai-chat-avatar,
    .ws-sai-modal-panel .ws-sai-support-admin-chat .ws-sai-chat-messages .ws-sai-chat-message-row.is-outgoing .ws-sai-chat-avatar,
    .ws-sai-modal-panel .ws-sai-chat-messages .ws-sai-chat-message-row.is-outgoing .ws-sai-chat-avatar {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}


/* Version 1.8.1 mobile modal opening stability */
html.ws-sai-modal-open,
body.ws-sai-modal-open {
    overflow: hidden !important;
}

.ws-sai-modal.is-open {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 2147483000 !important;
}

.ws-sai-modal.is-open .ws-sai-modal-panel {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

@media (max-width: 767px) {
    .ws-sai-modal.is-open {
        position: fixed !important;
        inset: 0 !important;
        display: flex !important;
        align-items: flex-start !important;
        justify-content: center !important;
        overflow-y: auto !important;
        padding: 10px !important;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }

    .ws-sai-modal.is-open .ws-sai-modal-panel.ws-sai-chat-panel,
    .ws-sai-modal.is-open .ws-sai-modal-panel.ws-sai-support-panel {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        height: calc(100svh - 20px) !important;
        max-height: calc(100svh - 20px) !important;
        min-height: 0 !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }

    @supports (height: 100dvh) {
        .ws-sai-modal.is-open .ws-sai-modal-panel.ws-sai-chat-panel,
        .ws-sai-modal.is-open .ws-sai-modal-panel.ws-sai-support-panel {
            height: calc(100dvh - 20px) !important;
            max-height: calc(100dvh - 20px) !important;
        }
    }

    .ws-sai-modal.is-open .ws-sai-chat-layout,
    .ws-sai-modal.is-open .ws-sai-support-admin-chat,
    .ws-sai-modal.is-open .ws-sai-support-admin-chat .ws-sai-chat-layout {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }
}
/* Version 1.8.2 mobile chat opening and mobile outgoing alignment */
.ws-sai-floating-chat,
.ws-sai-floating-chat-btn,
[data-ws-sai-open] {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.ws-sai-modal.is-open,
.ws-sai-modal.is-open .ws-sai-modal-backdrop,
.ws-sai-modal.is-open .ws-sai-modal-panel {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

@media (max-width: 767px) {
    .ws-sai-chat-messages .ws-sai-chat-message-row.is-outgoing,
    .ws-sai-modal-panel .ws-sai-chat-messages .ws-sai-chat-message-row.is-outgoing,
    .ws-sai-support-admin-chat .ws-sai-chat-messages .ws-sai-chat-message-row.is-outgoing {
        display: flex !important;
        flex-direction: row-reverse !important;
        justify-content: flex-start !important;
        align-items: flex-end !important;
        width: 100% !important;
    }

    .ws-sai-chat-messages .ws-sai-chat-message-row.is-outgoing .ws-sai-chat-bubble,
    .ws-sai-modal-panel .ws-sai-chat-messages .ws-sai-chat-message-row.is-outgoing .ws-sai-chat-bubble,
    .ws-sai-support-admin-chat .ws-sai-chat-messages .ws-sai-chat-message-row.is-outgoing .ws-sai-chat-bubble {
        align-self: auto !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        max-width: calc(92% - 39px) !important;
    }

    .ws-sai-modal.is-open .ws-sai-modal-backdrop {
        display: block !important;
    }
}


/* Version 1.8.3 mobile opening and long message wrapping */
.ws-sai-chat-main,
.ws-sai-chat-pane,
.ws-sai-new-dialog-pane,
.ws-sai-chat-messages,
.ws-sai-chat-message-row,
.ws-sai-chat-bubble,
.ws-sai-chat-bubble-text,
.ws-sai-chat-bubble-text p,
.ws-sai-message-body,
.ws-sai-message-body p,
.ws-sai-dialog-title,
.ws-sai-chat-head strong,
.ws-sai-chat-head span {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}

.ws-sai-chat-bubble-text,
.ws-sai-message-body {
    overflow: hidden;
}

.ws-sai-chat-bubble-text a,
.ws-sai-message-body a {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.ws-sai-modal.is-open {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

@media (max-width: 767px) {
    .ws-sai-chat-messages .ws-sai-chat-message-row.is-outgoing,
    .ws-sai-support-admin-chat .ws-sai-chat-messages .ws-sai-chat-message-row.is-outgoing,
    .ws-sai-modal-panel .ws-sai-chat-messages .ws-sai-chat-message-row.is-outgoing {
        justify-content: flex-start !important;
        flex-direction: row-reverse !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .ws-sai-chat-messages .ws-sai-chat-message-row .ws-sai-chat-bubble {
        max-width: calc(100% - 42px) !important;
    }
}


/* Version 1.8.4 mobile direct modal fallback */
.ws-sai-floating-chat {
    z-index: 2147482000 !important;
    pointer-events: auto !important;
}

.ws-sai-floating-chat-btn,
[data-ws-sai-open] {
    pointer-events: auto !important;
    touch-action: manipulation;
}

.ws-sai-modal.is-open {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 2147483000 !important;
}

.ws-sai-modal.is-open .ws-sai-modal-panel {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.ws-sai-chat-message-row,
.ws-sai-chat-bubble,
.ws-sai-chat-bubble-text,
.ws-sai-chat-bubble-text p {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (max-width: 900px) {
    body.ws-sai-support-modal-open #ws-sai-support-modal.is-open,
    body.ws-sai-all-messages-modal-open #ws-sai-all-messages-modal.is-open {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    #ws-sai-support-modal.is-open,
    #ws-sai-all-messages-modal.is-open {
        position: fixed !important;
        inset: 0 !important;
        z-index: 2147483000 !important;
    }
}
