.nsi-chat {
    --nsi-gold: #b58b3a;
    --nsi-ink: #19222c;
    --nsi-paper: #fff;
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 999999;
    color: var(--nsi-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

.nsi-chat *,
.nsi-chat *::before,
.nsi-chat *::after {
    box-sizing: border-box;
}

.nsi-chat__launcher {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 48px;
    margin: 0;
    border: 0;
    border-radius: 999px;
    padding: 11px 17px;
    color: #fff;
    background: var(--nsi-ink);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
    font: 700 14px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
}

.nsi-chat__launcher-icon {
    color: #f2cf79;
    font-size: 17px;
}

.nsi-chat__panel {
    position: absolute;
    right: 0;
    bottom: 60px;
    display: flex;
    flex-direction: column;
    width: min(460px, calc(100vw - 28px));
    height: min(720px, calc(100vh - 100px));
    min-height: 460px;
    overflow: hidden;
    border: 1px solid rgba(25, 34, 44, .16);
    border-radius: 18px;
    background: var(--nsi-paper);
    box-shadow: 0 18px 60px rgba(0, 0, 0, .25);
}

.nsi-chat__panel[hidden] {
    display: none !important;
}

.nsi-chat__header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 122px;
    padding: 12px 16px;
    color: #fff;
    background: var(--nsi-ink);
}

.nsi-chat__nobly {
    flex: 0 0 96px;
    display: block;
    width: 96px;
    height: 96px;
    border: 2px solid rgba(242, 207, 121, .7);
    border-radius: 50%;
    object-fit: cover;
    background: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .22);
}

.nsi-chat__header-copy {
    flex: 1 1 auto;
    min-width: 0;
}

.nsi-chat__header strong {
    display: block;
    margin: 0 0 3px;
    color: inherit;
    font: 750 17px/1.25 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

.nsi-chat__header small {
    display: block;
    margin: 0;
    color: inherit;
    opacity: .88;
    font: 600 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

.nsi-chat__close {
    flex: 0 0 32px;
    min-width: 32px;
    min-height: 32px;
    margin: 0 -5px 0 0;
    border: 0;
    padding: 0;
    color: #fff;
    background: transparent;
    font: 400 27px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    cursor: pointer;
}

.nsi-chat__messages {
    flex: 1 1 auto;
    min-height: 190px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 18px;
    background: #f4f3f0;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
}

.nsi-chat__message {
    display: block;
    width: fit-content;
    max-width: 84%;
    margin: 0 0 11px;
    padding: 10px 12px;
    border-radius: 13px 13px 13px 4px;
    color: var(--nsi-ink);
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
    font: 400 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.nsi-chat__message a {
    color: inherit;
    font-weight: 650;
    text-decoration: underline;
    overflow-wrap: anywhere;
    word-break: break-all;
}

.nsi-chat__message--visitor {
    margin-left: auto;
    border-radius: 13px 13px 4px 13px;
    color: #fff;
    background: var(--nsi-gold);
}

.nsi-chat__typing {
    display: flex;
    width: fit-content;
    gap: 4px;
    margin: 2px 0 10px;
    border-radius: 13px 13px 13px 4px;
    padding: 12px 14px;
    background: #fff;
}

.nsi-chat__typing[hidden] {
    display: none;
}

.nsi-chat__typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8b9095;
    animation: nsi-chat-bounce 1.1s infinite ease-in-out;
}

.nsi-chat__typing span:nth-child(2) { animation-delay: .15s; }
.nsi-chat__typing span:nth-child(3) { animation-delay: .3s; }

.nsi-chat__handoff {
    display: flex;
    gap: 8px;
    margin: 2px 0 14px;
}

.nsi-chat__handoff[hidden] {
    display: none !important;
}

.nsi-chat__handoff button {
    border: 1px solid var(--nsi-gold);
    border-radius: 999px;
    padding: 8px 13px;
    color: var(--nsi-ink);
    background: #fff;
    font: 700 12px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    cursor: pointer;
}

.nsi-chat__handoff button:first-child {
    color: #fff;
    background: var(--nsi-gold);
}

.nsi-chat__handoff button:disabled {
    opacity: .55;
    cursor: wait;
}

@keyframes nsi-chat-bounce {
    0%, 70%, 100% { transform: translateY(0); opacity: .45; }
    35% { transform: translateY(-4px); opacity: 1; }
}

.nsi-chat__form {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 8px;
    max-height: 48%;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 12px 14px 13px;
    background: #fff;
    overscroll-behavior: contain;
}

.nsi-chat__contact,
.nsi-chat__status,
.nsi-chat__privacy {
    grid-column: 1 / -1;
}

.nsi-chat__contact.is-collapsed {
    display: none;
}

.nsi-chat__contact.is-required {
    border: 1px solid #dba617;
    border-radius: 9px;
    padding: 10px;
    background: #fff8e5;
}

.nsi-chat__contact-intro {
    margin: 0 0 8px;
    color: #62686d;
    font: 400 11px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

.nsi-chat__contact-fields {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
}

.nsi-chat__field.nsi-chat__email-field {
    display: none;
}

.nsi-chat__contact.is-required .nsi-chat__field.nsi-chat__email-field {
    display: block;
}

.nsi-chat__contact.is-required em {
    display: none;
}

.nsi-chat__field {
    display: block;
    min-width: 0;
    margin: 0;
}

.nsi-chat__field > span {
    display: block;
    margin: 0 0 3px;
    color: var(--nsi-ink);
    font: 700 11px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

.nsi-chat__field em {
    color: #74797e;
    font-style: normal;
    font-weight: 400;
}

.nsi-chat__field input,
.nsi-chat__field textarea {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    border: 1px solid #c9cdd1 !important;
    border-radius: 8px !important;
    padding: 8px 9px !important;
    color: var(--nsi-ink) !important;
    background: #fff !important;
    box-shadow: none !important;
    font: 400 14px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

.nsi-chat__field input {
    height: 38px !important;
}

.nsi-chat__field textarea {
    height: 62px !important;
    min-height: 62px !important;
    max-height: 110px !important;
    resize: vertical;
}

.nsi-chat__field input:focus,
.nsi-chat__field textarea:focus {
    outline: 2px solid rgba(181, 139, 58, .3) !important;
    border-color: var(--nsi-gold) !important;
}

.nsi-chat__field--message {
    grid-column: 1 / -1;
}

.nsi-chat__website {
    position: absolute !important;
    left: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
}

.nsi-chat__status {
    min-height: 0;
    color: #287a3e;
    font: 400 11px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

.nsi-chat__status:empty {
    display: none;
}

.nsi-chat__status.is-error {
    color: #b32d2e;
}

.nsi-chat__send {
    grid-column: 2;
    justify-self: end;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 42px;
    min-width: 48px;
    min-height: 42px;
    margin: 0;
    border: 0;
    border-radius: 8px;
    padding: 5px;
    color: #fff;
    background: var(--nsi-ink);
    font: 700 22px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
}

.nsi-chat__send span {
    display: block;
    width: 24px;
    overflow: hidden;
    color: inherit;
    font: inherit;
    line-height: 1;
    text-align: center;
}

.nsi-chat__send:disabled {
    opacity: .55;
    cursor: wait;
}

.nsi-chat__privacy {
    display: block;
    margin: 0;
    color: #73777c;
    font: 400 10px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    text-align: center;
}

@media (max-width: 560px) {
    .nsi-chat {
        right: 12px;
        bottom: 12px;
    }

    .nsi-chat__panel {
        position: fixed;
        top: 10px;
        right: 10px;
        bottom: 70px;
        left: 10px;
        width: auto;
        height: auto;
        min-height: 0;
        max-height: none;
    }

    .nsi-chat__header {
        min-height: 94px;
        padding: 10px 13px;
    }

    .nsi-chat__nobly {
        flex-basis: 74px;
        width: 74px;
        height: 74px;
    }

    .nsi-chat__header small {
        font-size: 13px;
    }

    .nsi-chat__header strong {
        font-size: 15px;
    }

    .nsi-chat__messages {
        min-height: 130px;
        padding: 14px;
    }

    .nsi-chat__form {
        max-height: 52%;
        padding: 10px 11px 11px;
    }
}

@media (max-width: 380px) {
    .nsi-chat__contact-fields {
        grid-template-columns: 1fr;
    }
}

@media (max-height: 580px) {
    .nsi-chat__panel {
        height: calc(100vh - 82px);
        min-height: 0;
    }

    .nsi-chat__header {
        min-height: 64px;
        padding: 10px 14px;
    }

    .nsi-chat__messages {
        min-height: 90px;
    }

    .nsi-chat__form {
        max-height: 60%;
    }
}
