.emx-widget,
.emx-widget * {
    box-sizing: border-box;
}

.emx-widget {
    --emx-navy: #123b5d;
    --emx-blue: #1678b8;
    --emx-ink: #172b3c;
    --emx-muted: #617487;
    --emx-border: #dce5ec;
    --emx-bg: #f4f8fb;
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 99990;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--emx-ink);
}

.emx-widget [hidden] {
    display: none !important;
}

.emx-launcher {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: 999px;
    padding: 10px 17px 10px 10px;
    color: #fff;
    background: var(--emx-navy);
    box-shadow: 0 9px 28px rgba(12, 39, 61, .24);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}

.emx-launcher:hover,
.emx-launcher:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(12, 39, 61, .3);
}

.emx-launcher__mark,
.emx-brand__mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: #fff;
    background: var(--emx-blue);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .03em;
}

.emx-panel {
    position: absolute;
    right: 0;
    bottom: 68px;
    display: flex;
    flex-direction: column;
    width: min(370px, calc(100vw - 28px));
    height: min(590px, calc(100dvh - 112px));
    min-height: 380px;
    overflow: hidden;
    border: 1px solid rgba(18, 59, 93, .12);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 18px 56px rgba(15, 37, 55, .24);
}

.emx-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    padding: 12px 15px;
    color: #fff;
    background: var(--emx-navy);
}

.emx-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.emx-brand__mark {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, .16);
}

.emx-brand strong,
.emx-brand small {
    display: block;
}

.emx-brand strong {
    font-size: 14px;
    line-height: 1.3;
}

.emx-brand small {
    margin-top: 2px;
    color: #d0e0ec;
    font-size: 11px;
}

.emx-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 9px;
    color: #fff;
    background: transparent;
    font: inherit;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.emx-close:hover,
.emx-close:focus-visible {
    background: rgba(255, 255, 255, .14);
}

.emx-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    padding: 14px;
    background: var(--emx-bg);
}

.emx-messages {
    flex: 1;
    min-height: 90px;
    overflow-y: auto;
    padding: 2px 2px 10px;
    scroll-behavior: smooth;
}

.emx-message {
    width: fit-content;
    max-width: 92%;
    margin: 0 0 10px;
    padding: 10px 12px;
    border: 1px solid var(--emx-border);
    border-radius: 13px 13px 13px 4px;
    color: var(--emx-ink);
    background: #fff;
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.emx-message p {
    margin: 0;
}

.emx-message--user {
    margin-left: auto;
    border-color: var(--emx-blue);
    border-radius: 13px 13px 4px 13px;
    color: #fff;
    background: var(--emx-blue);
}

.emx-message__links {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 9px;
}

.emx-message__links a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid #b9d8ea;
    border-radius: 8px;
    color: #0b5c8d;
    background: #f3faff;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.emx-message__links a:hover,
.emx-message__links a:focus-visible {
    border-color: var(--emx-blue);
    background: #e6f4fc;
}

.emx-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding-top: 10px;
    border-top: 1px solid var(--emx-border);
}

.emx-topics button {
    min-height: 32px;
    padding: 6px 9px;
    border: 1px solid #cbd9e3;
    border-radius: 999px;
    color: var(--emx-navy);
    background: #fff;
    font: inherit;
    font-size: 11px;
    font-weight: 650;
    cursor: pointer;
}

.emx-topics button:hover,
.emx-topics button:focus-visible {
    border-color: var(--emx-blue);
    background: #edf7fc;
}

.emx-form {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--emx-border);
    background: #fff;
}

.emx-form input {
    flex: 1;
    min-width: 0;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid #bdccd7;
    border-radius: 9px;
    color: var(--emx-ink);
    background: #fff;
    font: inherit;
    font-size: 13px;
}

.emx-form input:focus {
    border-color: var(--emx-blue);
    outline: 2px solid rgba(22, 120, 184, .15);
}

.emx-form button {
    min-width: 64px;
    padding: 0 12px;
    border: 0;
    border-radius: 9px;
    color: #fff;
    background: var(--emx-blue);
    font: inherit;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
}

.emx-form button:hover,
.emx-form button:focus-visible {
    background: #0e6399;
}

.emx-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid #edf1f4;
    color: var(--emx-muted);
    background: #fff;
    font-size: 10px;
    line-height: 1.4;
}

.emx-footer a {
    flex: 0 0 auto;
    color: #0b5c8d;
    font-weight: 750;
    text-decoration: none;
}

.emx-footer a:hover,
.emx-footer a:focus-visible {
    text-decoration: underline;
}

.emx-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 520px) {
    .emx-widget {
        right: 12px;
        bottom: 12px;
    }

    .emx-panel {
        right: 0;
        bottom: 62px;
        width: min(370px, calc(100vw - 24px));
        height: min(600px, calc(100dvh - 88px));
        min-height: 330px;
        border-radius: 16px;
    }

    .emx-launcher {
        font-size: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .emx-widget *,
    .emx-widget *::before,
    .emx-widget *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
