.wa-chat,
.wa-chat * {
    box-sizing: border-box;
}

.wa-chat {
    --wa-hijau: #1f7a4d;
    --wa-tua: #135c39;
    --wa-muda: #eaf5ee;
    --wa-garis: #dfe7e1;
    --wa-redup: #6c7b71;
    --wa-merah: #b42318;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: #17211b;
}

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

.wa-chat-fab {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1035;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(145deg, #2bb673, #128c5e);
    color: #fff;
    box-shadow: 0 10px 28px rgba(15, 92, 57, .32), 0 2px 6px rgba(0, 0, 0, .16);
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}

.wa-chat-fab:hover,
.wa-chat-fab:focus {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(15, 92, 57, .38), 0 3px 8px rgba(0, 0, 0, .18);
    outline: none;
}

.wa-chat-fab svg {
    width: 27px;
    height: 27px;
    fill: currentColor;
}

.wa-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 21px;
    height: 21px;
    padding: 0 5px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #d92d20;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
}

.wa-chat-panel {
    position: fixed;
    right: 22px;
    bottom: 92px;
    z-index: 1036;
    display: flex;
    flex-direction: column;
    width: 376px;
    max-width: calc(100vw - 24px);
    height: 580px;
    max-height: calc(100vh - 118px);
    overflow: hidden;
    border: 1px solid rgba(19, 92, 57, .14);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 48, 30, .26), 0 4px 16px rgba(0, 0, 0, .12);
}

.wa-chat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
    gap: 12px;
    padding: 13px 14px;
    background: linear-gradient(135deg, #1f7a4d, #135c39);
    color: #fff;
}

.wa-chat-title {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
}

.wa-chat-title strong,
.wa-chat-title small {
    display: block;
}

.wa-chat-title strong {
    max-width: 230px;
    overflow: hidden;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wa-chat-title small {
    margin-top: 2px;
    color: rgba(255, 255, 255, .74);
    font-size: 11px;
}

.wa-chat-dot {
    display: inline-block;
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #7cf0a8;
    box-shadow: 0 0 0 3px rgba(124, 240, 168, .18);
}

.wa-chat-close,
.wa-admin-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 24px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
}

.wa-chat-close:hover,
.wa-chat-close:focus {
    background: rgba(255, 255, 255, .2);
    color: #fff;
    outline: none;
}

.wa-chat-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    background: #f7faf8;
}

.wa-chat-start {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 18px;
}

.wa-chat-welcome {
    padding: 4px 0 16px;
    text-align: center;
}

.wa-chat-avatar {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    margin: 0 auto 10px;
    border-radius: 50%;
    background: var(--wa-muda);
    color: var(--wa-hijau);
}

.wa-chat-avatar svg {
    width: 27px;
    height: 27px;
    fill: currentColor;
}

.wa-chat-welcome h3 {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.35;
}

.wa-chat-welcome p {
    margin: 0;
    color: var(--wa-redup);
    font-size: 12px;
    line-height: 1.6;
}

.wa-chat-form label {
    display: block;
    margin: 0 0 5px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.wa-chat-form input,
.wa-chat-form textarea {
    width: 100%;
    margin: 0 0 12px;
    padding: 10px 11px;
    border: 1px solid #cbd8ce;
    border-radius: 9px;
    background: #fff;
    color: #17211b;
    font: inherit;
    font-size: 13px;
}

.wa-chat-form input:focus,
.wa-chat-form textarea:focus {
    border-color: var(--wa-hijau);
    outline: 3px solid rgba(31, 122, 77, .13);
}

.wa-chat-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 9px;
    background: var(--wa-hijau);
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.wa-chat-primary:hover,
.wa-chat-primary:focus {
    background: var(--wa-tua);
    color: #fff;
    outline: none;
}

.wa-chat-primary:disabled {
    opacity: .6;
    cursor: wait;
}

.wa-chat-note {
    margin: 9px 0 0;
    color: var(--wa-redup);
    font-size: 10.5px;
    line-height: 1.5;
    text-align: center;
}

.wa-chat-conversation {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

.wa-chat-messages {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    padding: 14px;
    background-color: #efeae2;
    background-image: radial-gradient(rgba(31, 122, 77, .055) 1px, transparent 1px);
    background-size: 16px 16px;
}

.wa-chat-msg {
    display: flex;
    justify-content: flex-start;
    width: 100%;
    margin: 0 0 7px;
}

.wa-chat-msg:last-child {
    margin-bottom: 0;
}

.wa-chat-bubble {
    max-width: 84%;
    padding: 8px 10px;
    border-radius: 10px 10px 10px 2px;
    background: #fff;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .1);
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.wa-chat-msg.out {
    justify-content: flex-end;
}

.wa-chat-msg.out .wa-chat-bubble {
    border-radius: 10px 10px 2px 10px;
    background: #dcf8c6;
}

.wa-chat-msg.system {
    justify-content: center;
}

.wa-chat-msg.system .wa-chat-bubble {
    max-width: 94%;
    border-radius: 8px;
    background: rgba(255, 255, 255, .72);
    color: #5f7065;
    font-size: 11.5px;
    line-height: 1.5;
    text-align: center;
}

.wa-chat-bubble.has-image {
    padding: 4px;
}

.wa-chat-image-link {
    display: block;
    margin-bottom: 4px;
    line-height: 0;
}

.wa-chat-image {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 280px;
    border-radius: 7px;
    object-fit: contain;
    background: #e7efe9;
}

.wa-chat-bubble.has-image .wa-chat-text,
.wa-chat-bubble.has-image .wa-chat-meta {
    margin-right: 5px;
    margin-left: 5px;
}

.wa-chat-attachment {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 9px;
    padding: 8px 10px;
    border-top: 1px solid var(--wa-garis);
    background: #f4faf6;
}

.wa-chat-attachment img {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    object-fit: cover;
    background: #e7efe9;
}

.wa-chat-attachment span {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    color: var(--wa-redup);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wa-chat-attachment button {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #e3eee7;
    color: var(--wa-tua);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.wa-chat-attachment button:hover,
.wa-chat-attachment button:focus {
    background: #d6e7dd;
    outline: none;
}

.wa-chat-meta {
    display: block;
    margin-top: 3px;
    color: #718177;
    font-size: 9.5px;
    line-height: 1.2;
    text-align: right;
}

.wa-chat-msg.out .wa-chat-meta {
    color: #547a5e;
}

.wa-chat-composer {
    display: flex;
    align-items: flex-end;
    flex: 0 0 auto;
    gap: 8px;
    padding: 9px 10px;
    border-top: 1px solid var(--wa-garis);
    background: #fff;
}

.wa-chat-composer textarea {
    flex: 1 1 auto;
    min-width: 0;
    max-height: 104px;
    margin: 0;
    padding: 9px 12px;
    border: 1px solid #cbd8ce;
    border-radius: 19px;
    color: #17211b;
    font: inherit;
    font-size: 13px;
    line-height: 1.4;
    resize: none;
}

.wa-chat-composer textarea:focus {
    border-color: var(--wa-hijau);
    outline: 3px solid rgba(31, 122, 77, .13);
}

.wa-chat-attach {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #eef5f0;
    color: var(--wa-hijau);
    cursor: pointer;
}

.wa-chat-attach:hover,
.wa-chat-attach:focus {
    background: #e1efe6;
    color: var(--wa-tua);
    outline: none;
}

.wa-chat-attach:disabled {
    opacity: .55;
    cursor: wait;
}

.wa-chat-attach svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

.wa-chat-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--wa-hijau);
    color: #fff;
    cursor: pointer;
}

.wa-chat-send:hover,
.wa-chat-send:focus {
    background: var(--wa-tua);
    color: #fff;
    outline: none;
}

.wa-chat-send:disabled {
    opacity: .55;
    cursor: wait;
}

.wa-chat-send svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.wa-chat-error {
    padding: 0 12px 9px;
    color: var(--wa-merah);
    font-size: 11px;
    line-height: 1.45;
}

.wa-chat-foot {
    flex: 0 0 auto;
    padding: 6px 10px 8px;
    border-top: 1px solid #f0f3f0;
    background: #fff;
    color: #8a978f;
    font-size: 9.5px;
    text-align: center;
}

.wa-chat-loading {
    padding: 26px 10px;
    color: var(--wa-redup);
    font-size: 12px;
    text-align: center;
}

/* Inbox admin */
.wa-admin-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 9px;
    background: #f7faf8;
}

.wa-chat-list-note {
    padding: 2px 4px 9px;
    color: var(--wa-redup);
    font-size: 10.5px;
    line-height: 1.5;
}

.wa-chat-thread-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 6px;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: #fff;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}

.wa-chat-thread-item:hover,
.wa-chat-thread-item:focus {
    border-color: #cfe2d6;
    background: #f4faf6;
    outline: none;
}

.wa-chat-thread-item.unread {
    border-color: #c4e3d0;
    background: #f0faf4;
}

.wa-chat-avatar.small {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    margin: 0;
    border-radius: 50%;
    background: #e4f2e9;
    color: var(--wa-hijau);
    font-size: 12px;
    font-weight: 800;
}

.wa-chat-thread-main {
    flex: 1 1 auto;
    min-width: 0;
}

.wa-chat-thread-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.wa-chat-thread-name {
    overflow: hidden;
    font-size: 12.5px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wa-chat-thread-time {
    flex: 0 0 auto;
    color: #89978e;
    font-size: 9.5px;
}

.wa-chat-thread-last {
    overflow: hidden;
    margin-top: 2px;
    color: var(--wa-redup);
    font-size: 11px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wa-chat-thread-unread {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 18px;
    height: 18px;
    margin-left: 4px;
    padding: 0 5px;
    border-radius: 999px;
    background: #d92d20;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
}

.wa-admin-thread {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

.wa-admin-thread-head {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--wa-garis);
    background: #fff;
}

.wa-admin-back {
    background: #eef5f0;
    color: var(--wa-tua);
    font-size: 20px;
}

.wa-admin-back:hover,
.wa-admin-back:focus {
    background: #e1efe6;
    color: var(--wa-tua);
}

.wa-admin-thread-head strong,
.wa-admin-thread-head small {
    display: block;
}

.wa-admin-thread-head strong {
    font-size: 12.5px;
    line-height: 1.3;
}

.wa-admin-thread-head small {
    color: var(--wa-redup);
    font-size: 10px;
}

.wa-admin-thread .wa-chat-messages {
    padding: 12px;
}

.wa-chat-note-line {
    padding: 7px 12px;
    border-top: 1px solid #f0f3f0;
    background: #fff;
    color: var(--wa-redup);
    font-size: 10px;
    line-height: 1.45;
}

.wa-chat-note-line.warn {
    color: #8a5a00;
    background: #fff9ea;
}

@media (max-width: 640px) {
    .wa-chat-fab {
        right: 16px;
        bottom: 16px;
        width: 54px;
        height: 54px;
    }

    .wa-chat-panel {
        right: 10px;
        bottom: 82px;
        left: 10px;
        width: auto;
        height: calc(100vh - 102px);
        max-height: none;
        border-radius: 14px;
    }

    .wa-chat-admin .wa-chat-fab {
        bottom: 64px;
    }

    .wa-chat-admin .wa-chat-panel {
        bottom: 126px;
        height: calc(100vh - 142px);
    }

    .wa-chat-title strong {
        max-width: 190px;
    }
}

/* Halaman inbox chat penuh */
.wa-inbox [hidden] {
    display: none !important;
}

.wa-inbox {
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);
    height: calc(100vh - 250px);
    min-height: 520px;
    overflow: hidden;
    border: 1px solid var(--wa-garis);
    border-radius: 12px;
    background: #fff;
}

.wa-inbox-side {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-right: 1px solid var(--wa-garis);
    background: #fbfdfb;
}

.wa-inbox-side-head {
    flex: 0 0 auto;
    padding: 14px;
    border-bottom: 1px solid var(--wa-garis);
}

.wa-inbox-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 800;
}

.wa-inbox-title .wa-badge {
    font-size: 10px;
    font-weight: 700;
}

.wa-inbox-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 8px;
}

.wa-inbox-list .wa-chat-thread-item {
    margin-bottom: 6px;
}

.wa-inbox-list .wa-empty {
    padding: 30px 12px;
}

.wa-chat-thread-item.active {
    border-color: #b9dcc7;
    background: #edf8f1;
}

.wa-inbox-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: #fff;
}

.wa-inbox-empty {
    display: grid;
    flex: 1 1 auto;
    place-items: center;
    padding: 30px;
    color: var(--wa-redup);
    text-align: center;
}

.wa-inbox-empty-icon {
    display: grid;
    place-items: center;
    width: 70px;
    height: 70px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: var(--wa-muda);
    color: var(--wa-hijau);
}

.wa-inbox-empty-icon svg {
    width: 34px;
    height: 34px;
    fill: currentColor;
}

.wa-inbox-empty h3 {
    margin: 0 0 5px;
    color: #17211b;
    font-size: 18px;
    font-weight: 800;
}

.wa-inbox-empty p {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
}

.wa-inbox-thread {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

.wa-inbox-thread-head {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--wa-garis);
    background: #fff;
}

.wa-inbox-thread-title {
    min-width: 0;
}

.wa-inbox-thread-title strong,
.wa-inbox-thread-title small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wa-inbox-thread-title strong {
    font-size: 14px;
    font-weight: 800;
}

.wa-inbox-thread-title small {
    margin-top: 2px;
    color: var(--wa-redup);
    font-size: 11px;
}

.wa-inbox-thread-head > .wa-badge {
    margin-left: auto;
    white-space: nowrap;
}

.wa-inbox-back {
    display: none;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #eef5f0;
    color: var(--wa-tua);
    font-size: 18px;
    cursor: pointer;
}

.wa-inbox-back:hover,
.wa-inbox-back:focus {
    background: #e1efe6;
    outline: none;
}

.wa-inbox-messages {
    flex: 1 1 auto;
    min-height: 0;
    padding: 18px;
}

.wa-inbox-messages .wa-chat-bubble {
    max-width: min(520px, 80%);
}

.wa-inbox-composer {
    padding: 12px 16px;
}

.wa-inbox-composer textarea {
    max-height: 140px;
}

.wa-inbox-thread > .wa-chat-error {
    padding: 0 16px 8px;
}

.wa-inbox-thread > .wa-chat-note-line {
    padding: 8px 16px;
}

@media (max-width: 800px) {
    .wa-inbox {
        grid-template-columns: 1fr;
        height: calc(100vh - 230px);
        min-height: 500px;
    }

    .wa-inbox-side {
        border-right: 0;
    }

    .wa-inbox-main {
        display: none;
    }

    .wa-inbox.thread-open .wa-inbox-side {
        display: none;
    }

    .wa-inbox.thread-open .wa-inbox-main {
        display: flex;
    }

    .wa-inbox-back {
        display: inline-flex;
    }

    .wa-inbox-messages {
        padding: 12px;
    }

    .wa-inbox-composer {
        padding: 9px 10px;
    }
}
