.nocx-webchat,
.nocx-webchat * {
    box-sizing: border-box;
}

.nocx-webchat {
    --nocx-chat-navy: #101a2b;
    --nocx-chat-navy-soft: #17243c;
    --nocx-chat-blue: #246cff;
    --nocx-chat-ink: #17233b;
    --nocx-chat-muted: #68778d;
    --nocx-chat-line: #dce3ec;
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 999999;
    color: var(--nocx-chat-ink);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

.nocx-webchat button,
.nocx-webchat input,
.nocx-webchat textarea {
    font: inherit;
}

.nocx-webchat-launcher {
    min-width: 58px;
    height: 58px;
    padding: 0 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: linear-gradient(135deg, var(--nocx-chat-navy), #223656);
    color: #fff;
    box-shadow: 0 14px 34px rgba(12, 26, 48, 0.28);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 750;
    letter-spacing: 0.01em;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.nocx-webchat-launcher:hover {
    transform: translateY(-1px);
    box-shadow: 0 17px 38px rgba(12, 26, 48, 0.34);
}

.nocx-webchat-launcher:focus-visible,
.nocx-webchat button:focus-visible,
.nocx-webchat input:focus-visible,
.nocx-webchat textarea:focus-visible,
.nocx-webchat summary:focus-visible {
    outline: 3px solid rgba(36, 108, 255, 0.32);
    outline-offset: 2px;
}

.nocx-webchat-launcher svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    flex: 0 0 auto;
}

.nocx-webchat-panel {
    position: absolute;
    right: 0;
    bottom: 70px;
    width: min(390px, calc(100vw - 28px));
    height: min(590px, calc(100dvh - 104px));
    min-height: 420px;
    border: 1px solid rgba(16, 42, 74, 0.14);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 64px rgba(15, 28, 49, 0.24);
    display: none;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    overflow: hidden;
    isolation: isolate;
}

.nocx-webchat.is-open .nocx-webchat-panel {
    display: grid;
}

.nocx-webchat-panel[hidden] {
    display: none !important;
}

.nocx-webchat-header {
    min-height: 68px;
    padding: 11px 12px 11px 14px;
    background: linear-gradient(135deg, var(--nocx-chat-navy), var(--nocx-chat-navy-soft));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.nocx-webchat-brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nocx-webchat-brand-logo {
    width: 88px;
    height: 30px;
    object-fit: contain;
    object-position: left center;
    display: block;
    flex: 0 0 auto;
}

.nocx-webchat-brand strong {
    display: block;
    overflow: hidden;
    color: #fff;
    font-size: 14px;
    font-weight: 750;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nocx-webchat-brand small {
    margin-top: 3px;
    color: #c7d3e4;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    white-space: nowrap;
}

.nocx-webchat-brand small i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #41c98a;
    box-shadow: 0 0 0 3px rgba(65, 201, 138, 0.14);
}

.nocx-webchat-header > button {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.nocx-webchat-details {
    border-bottom: 1px solid #e7ebf1;
    background: #f8fafc;
}

.nocx-webchat-details summary {
    min-height: 38px;
    padding: 0 13px;
    color: #4d5f77;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    list-style: none;
}

.nocx-webchat-details summary::-webkit-details-marker {
    display: none;
}

.nocx-webchat-details summary::after {
    content: "+";
    margin-left: auto;
    color: #63758c;
    font-size: 17px;
    font-weight: 400;
}

.nocx-webchat-details[open] summary::after {
    content: "−";
}

.nocx-webchat-details summary span {
    padding: 3px 7px;
    border-radius: 999px;
    background: #e9eef5;
    color: #6c7b8e;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nocx-webchat-contact {
    padding: 0 12px 12px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.nocx-webchat-contact label {
    min-width: 0;
    color: #617087;
    font-size: 10px;
    font-weight: 650;
}

.nocx-webchat-contact label > span {
    display: block;
    margin-bottom: 4px;
}

.nocx-webchat-contact input {
    width: 100%;
    min-width: 0;
    height: 38px;
    padding: 0 10px;
    border: 1px solid var(--nocx-chat-line);
    border-radius: 9px;
    background: #fff;
    color: var(--nocx-chat-ink);
    font-size: 13px;
}

.nocx-webchat-messages {
    min-height: 0;
    padding: 15px 14px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #c8d2df transparent;
}

.nocx-webchat-msg {
    max-width: 84%;
    margin: 0 0 13px;
}

.nocx-webchat-msg small {
    display: block;
    margin: 0 0 4px;
    color: #7b899b;
    font-size: 10px;
    font-weight: 600;
}

.nocx-webchat-msg p {
    display: inline-block;
    margin: 0;
    padding: 10px 12px;
    border-radius: 5px 14px 14px 14px;
    background: #eef2f7;
    color: #27384f;
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.nocx-webchat-msg p a {
    color: #175ec7;
    font-weight: 750;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    overflow-wrap: anywhere;
}

.nocx-webchat-msg p a:hover {
    color: #0f438f;
}

.nocx-webchat-msg.visitor {
    margin-left: auto;
    text-align: right;
}

.nocx-webchat-msg.visitor p {
    border-radius: 14px 5px 14px 14px;
    background: #244e87;
    color: #fff;
    text-align: left;
}

.nocx-webchat-msg.bot p {
    background: #edf4ff;
    color: #244c84;
}

.nocx-webchat-msg.system {
    max-width: 100%;
    text-align: center;
}

.nocx-webchat-msg.system small {
    display: none;
}

.nocx-webchat-msg.system p {
    padding: 7px 10px;
    border-radius: 9px;
    background: #f5f7fa;
    color: #627187;
    font-size: 11px;
}

.nocx-webchat-compose {
    min-height: 64px;
    padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
    border-top: 1px solid #e2e7ef;
    background: #fff;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 8px;
}

.nocx-webchat-compose textarea {
    width: 100% !important;
    height: 42px !important;
    min-height: 42px !important;
    max-height: 96px !important;
    margin: 0 !important;
    padding: 10px 12px !important;
    border: 1px solid #d6dee9 !important;
    border-radius: 11px !important;
    background: #f9fbfd !important;
    color: var(--nocx-chat-ink) !important;
    resize: none !important;
    overflow-y: auto !important;
    font-size: 14px !important;
    line-height: 20px !important;
    box-shadow: none !important;
}

.nocx-webchat-compose textarea::placeholder {
    color: #8a97a7;
}

.nocx-webchat-compose button {
    height: 42px;
    min-width: 68px;
    padding: 0 13px;
    border: 0;
    border-radius: 11px;
    background: var(--nocx-chat-blue);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 750;
}

.nocx-webchat-compose button svg {
    width: 15px;
    height: 15px;
    fill: currentColor;
}

.nocx-webchat-compose > span {
    min-height: 0;
    grid-column: 1 / -1;
    color: #63738a;
    font-size: 10px;
    line-height: 1.25;
}

.nocx-webchat-compose > span:empty {
    display: none;
}

.nocx-webchat .screen-reader-text {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.nocx-webchat.is-portal-demo {
    left: 20px;
    right: auto;
}

.nocx-webchat.is-portal-demo .nocx-webchat-panel {
    left: 0;
    right: auto;
}

@media (max-width: 500px) {
    .nocx-webchat {
        right: 10px;
        bottom: calc(10px + env(safe-area-inset-bottom));
    }

    .nocx-webchat-launcher {
        width: 54px;
        min-width: 54px;
        height: 54px;
        padding: 0;
    }

    .nocx-webchat-launcher span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }

    .nocx-webchat-launcher svg {
        width: 23px;
        height: 23px;
    }

    .nocx-webchat-panel {
        right: 0;
        bottom: 64px;
        width: min(374px, calc(100vw - 20px));
        height: min(540px, calc(100dvh - 92px - env(safe-area-inset-bottom)));
        min-height: min(400px, calc(100dvh - 92px));
        border-radius: 16px;
    }

    .nocx-webchat-header {
        min-height: 62px;
        padding: 9px 10px 9px 12px;
    }

    .nocx-webchat-brand-logo {
        width: 78px;
        height: 27px;
    }

    .nocx-webchat-brand strong {
        font-size: 13px;
    }

    .nocx-webchat-brand small {
        font-size: 9px;
    }

    .nocx-webchat-details summary {
        min-height: 36px;
    }

    .nocx-webchat-contact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .nocx-webchat-contact input {
        height: 36px;
        font-size: 16px;
    }

    .nocx-webchat-messages {
        padding: 13px 12px;
    }

    .nocx-webchat-msg {
        max-width: 88%;
    }

    .nocx-webchat-msg p {
        font-size: 13px;
    }

    .nocx-webchat-compose {
        min-height: 60px;
        padding: 8px 9px calc(8px + env(safe-area-inset-bottom));
    }

    .nocx-webchat-compose textarea {
        height: 40px !important;
        min-height: 40px !important;
        padding: 9px 11px !important;
        font-size: 16px !important;
    }

    .nocx-webchat-compose button {
        width: 40px;
        min-width: 40px;
        height: 40px;
        padding: 0;
    }

    .nocx-webchat-compose button span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }

    .nocx-webchat-compose button svg {
        width: 18px;
        height: 18px;
    }

    .nocx-webchat.is-portal-demo {
        left: 10px;
        right: auto;
    }

    .nocx-webchat.is-portal-demo .nocx-webchat-panel {
        left: 0;
        right: auto;
    }
}

@media (max-height: 560px) {
    .nocx-webchat-panel {
        height: calc(100dvh - 86px - env(safe-area-inset-bottom));
        min-height: 0;
    }

    .nocx-webchat-brand small {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nocx-webchat-launcher {
        transition: none;
    }
}
