.ngl-chat {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 55;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 20px 0 16px;
    border: 0;
    border-radius: 999px;
    background: var(--color-primary-500, #224c98);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(23, 52, 102, 0.28);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.ngl-chat:hover {
    background: var(--color-primary-600, #1c3f7e);
    transform: translateY(-1px);
}

.ngl-chat:focus-visible {
    outline: 2px solid var(--color-primary-500, #224c98);
    outline-offset: 3px;
}

.ngl-chat[hidden],
.ngl-chat__dot[hidden] {
    display: none;
}

.ngl-chat svg {
    flex: none;
    width: 20px;
    height: 20px;
}

.ngl-chat.is-loading {
    opacity: 0.75;
    pointer-events: none;
}

.ngl-chat__dot {
    position: absolute;
    top: 4px;
    right: 6px;
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #d14343;
}

body:has(.pn-sn-fab) .ngl-chat,
body:has(.pn-nb-bar) .ngl-chat {
    bottom: 88px;
}

body:has([data-ngl-consent-strip]:not([hidden])) .ngl-chat {
    display: none;
}

@media (max-width: 640px) {
    .ngl-chat {
        right: 16px;
        bottom: 16px;
        justify-content: center;
        width: 52px;
        height: 52px;
        padding: 0;
    }

    .ngl-chat svg {
        width: 22px;
        height: 22px;
    }

    .ngl-chat__text {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}

.ngl-chat-panel {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 56;
    display: flex;
    flex-direction: column;
    width: 380px;
    height: min(600px, calc(100vh - 40px));
    height: min(600px, calc(100dvh - 40px));
    border: 1px solid rgba(26, 26, 28, 0.06);
    border-radius: 20px;
    background: #fff;
    color: #1a1a1c;
    font-size: 14px;
    box-shadow: 0 20px 50px rgba(23, 52, 102, 0.22);
    overflow: hidden;
}

.ngl-chat-panel[hidden],
.ngl-chat-panel__mail[hidden],
.ngl-chat-panel__info[hidden] {
    display: none;
}

body:has(.pn-sn-fab) .ngl-chat-panel,
body:has(.pn-nb-bar) .ngl-chat-panel {
    bottom: 88px;
    height: min(600px, calc(100dvh - 108px));
}

.ngl-chat-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 16px 16px 20px;
    background: var(--color-primary-500, #224c98);
    color: #fff;
}

.ngl-chat-panel__title {
    margin: 0;
    font-size: 16px;
    line-height: 22px;
    font-weight: 600;
    color: #fff;
}

.ngl-chat-panel__status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 2px 0 0;
    font-size: 12px;
    line-height: 16px;
    color: rgba(255, 255, 255, 0.82);
}

.ngl-chat-panel__light {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3ecf8e;
}

.ngl-chat-panel__status.is-off .ngl-chat-panel__light {
    background: rgba(255, 255, 255, 0.45);
}

.ngl-chat-panel__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.ngl-chat-panel__close:hover {
    background: rgba(255, 255, 255, 0.24);
}

.ngl-chat-panel__close svg {
    width: 18px;
    height: 18px;
}

.ngl-chat-panel__close:focus-visible,
.ngl-chat-panel__form button:focus-visible,
.ngl-chat-panel__mail button:focus-visible {
    outline: 2px solid var(--color-primary-500, #224c98);
    outline-offset: 2px;
}

.ngl-chat-panel__thread {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.ngl-chat-msg {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 82%;
}

.ngl-chat-msg__who {
    margin: 0 0 6px 4px;
    font-size: 12px;
    line-height: 16px;
    font-weight: 500;
    color: rgba(26, 26, 28, 0.55);
}

.ngl-chat-msg__body {
    padding: 12px 16px;
    border-radius: 6px 20px 20px 20px;
    background: rgba(26, 26, 28, 0.045);
    font-size: 14px;
    line-height: 21px;
    color: rgba(26, 26, 28, 0.86);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.ngl-chat-msg__time {
    margin: 5px 4px 0;
    font-size: 11px;
    line-height: 14px;
    color: rgba(26, 26, 28, 0.4);
}

.ngl-chat-msg--me {
    align-self: flex-end;
    align-items: flex-end;
}

.ngl-chat-msg--me .ngl-chat-msg__body {
    border-radius: 20px 6px 20px 20px;
    background: var(--color-primary-500, #224c98);
    color: #fff;
}

.ngl-chat-panel__mail {
    padding: 12px 16px;
    border-top: 1px solid rgba(26, 26, 28, 0.06);
    background: rgba(26, 26, 28, 0.025);
}

.ngl-chat-panel__mail label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 18px;
    color: rgba(26, 26, 28, 0.7);
}

.ngl-chat-panel__mailrow {
    display: flex;
    gap: 8px;
}

.ngl-chat-panel__mailrow input {
    flex: 1;
    min-width: 0;
    height: 40px;
    padding: 0 12px;
    border: 1px solid rgba(26, 26, 28, 0.12);
    border-radius: 10px;
    background: #fff;
    font: inherit;
    font-size: 14px;
    color: #1a1a1c;
}

.ngl-chat-panel__mailrow button {
    flex: none;
    height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 10px;
    background: #1a1a1c;
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.ngl-chat-panel__info {
    margin: 0;
    padding: 10px 16px;
    border-top: 1px solid rgba(26, 26, 28, 0.06);
    font-size: 13px;
    line-height: 18px;
    color: rgba(26, 26, 28, 0.7);
}

.ngl-chat-panel__form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 12px 12px 16px;
    border-top: 1px solid rgba(26, 26, 28, 0.06);
}

.ngl-chat-panel__form textarea {
    flex: 1;
    min-width: 0;
    max-height: 140px;
    padding: 10px 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 15px;
    line-height: 20px;
    color: #1a1a1c;
    resize: none;
}

.ngl-chat-panel__form textarea:focus,
.ngl-chat-panel__mailrow input:focus {
    outline: none;
}

.ngl-chat-panel__mailrow input:focus-visible {
    border-color: var(--color-primary-500, #224c98);
}

.ngl-chat-panel__form button {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: var(--color-primary-500, #224c98);
    color: #fff;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.ngl-chat-panel__form[aria-busy="true"] button {
    opacity: 0.6;
    pointer-events: none;
}

.ngl-chat-panel__form button svg {
    width: 18px;
    height: 18px;
}

.ngl-chat-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

@media (max-width: 640px) {
    .ngl-chat-panel,
    body:has(.pn-sn-fab) .ngl-chat-panel,
    body:has(.pn-nb-bar) .ngl-chat-panel {
        inset: 0;
        width: auto;
        height: auto;
        border: 0;
        border-radius: 0;
    }

    .ngl-chat-panel__form textarea {
        font-size: 16px;
    }
}

@media print {
    .ngl-chat,
    .ngl-chat-panel {
        display: none;
    }
}
