#egmicro-ant-chat-root {
    --egx-primary: #4f46e5;
    --egx-primary-2: #2563eb;
    --egx-ink: #18213a;
    --egx-muted: #6b7280;
    --egx-border: #e7eaf3;
    font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.egx-launcher {
    position: fixed;
    top: 50%;
    right: 24px;
    bottom: auto;
    z-index: 10002;
    display: grid;
    width: 78px;
    height: 78px;
    place-items: center;
    overflow: visible;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    box-shadow: 0 14px 34px rgba(44, 65, 190, .28), 0 3px 10px rgba(31, 41, 83, .16);
    transform: translateY(-50%);
    transition: transform .22s ease, box-shadow .22s ease;
}

.egx-launcher:hover {
    transform: translateY(calc(-50% - 3px)) scale(1.04);
    box-shadow: 0 20px 44px rgba(44, 65, 190, .42), 0 5px 14px rgba(31, 41, 83, .22);
}

.egx-launcher:focus-visible {
    outline: 3px solid rgba(79, 70, 229, .25);
    outline-offset: 4px;
}

.egx-launcher-avatar.ant-avatar {
    flex: 0 0 auto;
    width: 100%;
    height: 100%;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.egx-launcher-avatar img {
    object-fit: cover;
}

.egx-launcher-pulse {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #22c55e;
}

.egx-launcher-pulse::after {
    position: absolute;
    inset: -6px;
    content: "";
    border: 1px solid rgba(34, 197, 94, .5);
    border-radius: inherit;
    animation: egx-pulse 1.8s ease-out infinite;
}

@keyframes egx-pulse {
    from { opacity: .8; transform: scale(.65); }
    to { opacity: 0; transform: scale(1.45); }
}

.egx-panel {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    z-index: 10001;
    display: flex;
    width: min(700px, calc(100vw - 84px));
    height: 90dvh;
    min-height: 560px;
    overflow: visible;
    flex-direction: column;
    color: var(--egx-ink);
    border: 0;
    border-radius: 22px 0 0 0;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 28px 80px rgba(30, 42, 87, .22), 0 7px 26px rgba(30, 42, 87, .1);
    transform: none;
    transform-origin: right bottom;
    animation: egx-panel-in .24s cubic-bezier(.2, .75, .3, 1);
    backdrop-filter: blur(16px);
}

.egx-panel.is-minimized {
    display: none;
}

.egx-resize-handle {
    position: absolute;
    z-index: 5;
    touch-action: none;
}

.egx-resize-top {
    top: 0;
    right: 0;
    left: 18px;
    height: 8px;
    cursor: ns-resize;
}

.egx-resize-corner {
    top: 0;
    left: 0;
    width: 30px;
    height: 30px;
    cursor: nwse-resize;
    background: transparent;
}

.egx-resize-left {
    top: 50%;
    right: 100%;
    bottom: auto;
    left: auto;
    display: grid;
    width: 30px;
    height: 72px;
    place-items: center;
    color: #fff;
    font-size: 16px;
    cursor: ew-resize;
    border: 1px solid rgba(255, 255, 255, .82);
    border-right: 0;
    border-radius: 15px 0 0 15px;
    background: linear-gradient(180deg, rgba(85, 86, 233, .92), rgba(37, 99, 235, .92));
    box-shadow: 5px 5px 18px rgba(30, 42, 87, .2);
    transform: translateY(-50%);
    transition: width .18s ease, background .18s ease, box-shadow .18s ease;
}

.egx-resize-left:hover {
    width: 34px;
    background: linear-gradient(180deg, #5556e9, #2563eb);
    box-shadow: 6px 6px 22px rgba(30, 42, 87, .28);
}

body.egx-is-resizing {
    user-select: none;
}

body.egx-is-resizing-left { cursor: ew-resize; }
body.egx-is-resizing-top { cursor: ns-resize; }
body.egx-is-resizing-corner { cursor: nwse-resize; }

@keyframes egx-panel-in {
    from { opacity: 0; transform: translateY(14px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.egx-header {
    position: relative;
    display: flex;
    min-height: 84px;
    align-items: center;
    justify-content: space-between;
    padding: 15px 14px 14px 18px;
    color: #fff;
    border-radius: 22px 0 0 0;
    background:
        radial-gradient(circle at 86% -30%, rgba(255, 255, 255, .32), transparent 44%),
        linear-gradient(118deg, #5556e9 0%, #3e59e7 47%, #1677ff 100%);
}

.egx-header::after {
    position: absolute;
    right: 82px;
    bottom: -22px;
    width: 110px;
    height: 70px;
    content: "";
    pointer-events: none;
    opacity: .2;
    border: 1px solid #fff;
    border-radius: 50%;
}

.egx-brand,
.egx-header-actions {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
}

.egx-brand {
    min-width: 0;
    gap: 11px;
}

.egx-brand .ant-avatar {
    flex: 0 0 auto;
    border: 2px solid rgba(255, 255, 255, .88);
    background: #fff;
    box-shadow: 0 5px 14px rgba(18, 29, 93, .18);
}

.egx-brand > div {
    min-width: 0;
}

.egx-brand strong {
    display: block;
    overflow: hidden;
    margin-bottom: 3px;
    font-size: 16px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.egx-brand span {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, .82);
    font-size: 12px;
    gap: 6px;
}

.egx-brand span i {
    width: 7px;
    height: 7px;
    border: 1px solid rgba(255, 255, 255, .85);
    border-radius: 50%;
    background: #31d583;
    box-shadow: 0 0 0 3px rgba(49, 213, 131, .16);
}

.egx-header-actions {
    gap: 1px;
}

.egx-header-actions .ant-btn {
    color: rgba(255, 255, 255, .9);
}

.egx-header-actions .ant-btn:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, .15) !important;
}

.egx-body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    background: #f7f8fc;
}

.egx-body .ant-bubble-list {
    height: 100%;
    padding: 34px 34px 24px;
    overflow: hidden;
    scrollbar-color: #c8ccda transparent;
    scrollbar-width: thin;
}

.egx-body .ant-bubble-list-scroll-box {
    height: 100%;
    overscroll-behavior-y: contain;
}

#egmicro-ant-chat-root .egx-body .ant-bubble-list .ant-bubble-start {
    padding-inline-end: 0;
}

.egx-body .ant-bubble + .ant-bubble {
    margin-top: 24px;
}

.egx-body .ant-bubble-content {
    max-width: min(560px, calc(100% - 62px));
    padding: 13px 17px;
    font-size: 15px;
    line-height: 1.72;
}

.egx-body .ant-bubble-end .ant-bubble-content {
    color: #fff;
    background: linear-gradient(135deg, #5556e9, #3972ee);
    box-shadow: 0 6px 16px rgba(64, 85, 222, .16);
}

.egx-body .ant-bubble-start .ant-bubble-content {
    border: 1px solid var(--egx-border);
    background: #fff;
    box-shadow: 0 5px 18px rgba(40, 51, 93, .06);
}

.egx-body .ant-bubble-start {
    align-items: flex-start;
}

.egx-body .ant-bubble-start .ant-bubble-body {
    min-width: 0;
    width: calc(100% - 46px);
    max-width: calc(100% - 46px);
}

.egx-body .ant-bubble-start .ant-bubble-content {
    width: 100%;
    max-width: 100%;
}

.egx-body .ant-bubble-end .ant-bubble-body {
    width: max-content;
    max-width: min(520px, calc(100% - 50px));
}

.egx-body .ant-bubble-end .ant-bubble-content {
    width: max-content;
    max-width: 100%;
}

.egx-body .ant-bubble-footer {
    margin-top: 2px;
}

.egx-message-action.ant-btn {
    color: #8990a4;
}

.egx-message-action.ant-btn:hover {
    color: var(--egx-primary) !important;
    background: #eef0ff !important;
}

.egx-empty {
    height: 100%;
    padding: 78px 46px 40px;
    overflow-y: auto;
}

.egx-prompt-section {
    max-width: 540px;
}

.egx-prompt-heading {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    color: #4a5268;
    font-size: 15px;
    font-weight: 650;
    gap: 8px;
}

.egx-prompt-heading .anticon {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    color: var(--egx-primary);
    border-radius: 9px;
    background: #e9ebff;
}

.egx-empty .ant-prompts-list {
    gap: 14px;
    overflow: visible;
}

.egx-empty .ant-prompts-item {
    min-height: 50px;
    padding: 12px 16px;
    border: 1px solid var(--egx-border);
    border-radius: 13px;
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 4px 12px rgba(49, 58, 97, .035);
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.egx-empty .ant-prompts-item:hover {
    border-color: #bcc4ff;
    background: #fff;
    box-shadow: 0 8px 20px rgba(66, 77, 171, .08);
}

.egx-empty .ant-prompts-item-icon {
    color: var(--egx-primary);
}

.egx-composer {
    flex: 0 0 auto;
    padding: 16px 20px 12px;
    border-top: 1px solid #eef0f5;
    background: #fff;
}

.egx-composer .ant-sender {
    min-height: 58px;
    border-color: #dfe3ef;
    border-radius: 16px;
    box-shadow: 0 7px 22px rgba(37, 48, 89, .06);
}

.egx-composer .ant-sender:focus-within {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .09), 0 8px 24px rgba(37, 48, 89, .08);
}

.egx-disclaimer {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 9px;
    color: #9aa0af;
    font-size: 10px;
    gap: 5px;
}

.egx-markdown {
    min-width: 0;
    max-width: 100%;
    text-align: left;
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
}

.egx-markdown > :first-child { margin-top: 0; }
.egx-markdown > :last-child { margin-bottom: 0; }
.egx-markdown p { margin: 0 0 12px; }
.egx-markdown ul,
.egx-markdown ol { margin: 8px 0 10px; padding-left: 22px; }
.egx-markdown li { margin: 5px 0; padding-left: 2px; }
.egx-markdown h1,
.egx-markdown h2,
.egx-markdown h3,
.egx-markdown h4 {
    margin: 16px 0 8px;
    color: #202a4c;
    font-size: 1.05em;
    line-height: 1.5;
}
.egx-markdown strong { color: #27315a; }
.egx-markdown a { color: #3f51d9; text-decoration: underline; }
.egx-markdown code {
    padding: 2px 5px;
    color: #a33c53;
    border-radius: 5px;
    background: #f5f1f6;
    font-family: Consolas, Monaco, monospace;
    font-size: .9em;
}
.egx-markdown pre {
    overflow-x: auto;
    padding: 10px 12px;
    border-radius: 9px;
    background: #1e2434;
}
.egx-markdown pre code { padding: 0; color: #eef1f8; background: transparent; }

.egx-markdown .egx-table-scroll {
    width: 100%;
    max-width: 100%;
    margin: 16px 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    border: 1px solid #dfe4f0;
    border-radius: 10px;
    background: #fff;
    scrollbar-width: thin;
    scrollbar-color: #b7c0db #f3f5fa;
}

.egx-markdown .egx-table-scroll:focus-visible {
    outline: 2px solid #818cf8;
    outline-offset: 2px;
}

.egx-markdown .egx-table-scroll table {
    width: 100%;
    min-width: var(--egx-table-min-width, 480px);
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
    color: #263148;
    font-size: 13px;
    line-height: 1.65;
    word-break: normal;
    overflow-wrap: normal;
}

.egx-markdown .egx-table-scroll th,
.egx-markdown .egx-table-scroll td {
    min-width: 80px;
    padding: 11px 13px;
    vertical-align: top;
    border: 0;
    border-bottom: 1px solid #e8ecf4;
    border-right: 1px solid #e8ecf4;
    white-space: normal;
    word-break: normal;
    overflow-wrap: normal;
}

.egx-markdown .egx-table-scroll th {
    color: #29375c;
    font-weight: 650;
    white-space: nowrap;
    background: #eef2fb;
}

.egx-markdown .egx-table-scroll td:first-child {
    white-space: nowrap;
}

.egx-markdown .egx-table-scroll tbody tr:nth-child(even) {
    background: #f8faff;
}

.egx-markdown .egx-table-scroll tr > :last-child {
    border-right: 0;
}

.egx-markdown .egx-table-scroll tbody tr:last-child td {
    border-bottom: 0;
}

.egx-markdown blockquote {
    margin: 14px 0;
    padding: 10px 14px;
    color: #4b5870;
    border-left: 3px solid #a5b4fc;
    border-radius: 0 6px 6px 0;
    background: #f5f7fd;
}

.egx-markdown blockquote > :last-child { margin-bottom: 0; }
.egx-markdown hr { margin: 18px 0; border: 0; border-top: 1px solid #e7eaf3; }

@media (max-width: 768px) {
    .egx-launcher {
        top: auto;
        right: 16px;
        bottom: 18px;
        width: 66px;
        height: 66px;
        font-size: 28px;
        border-radius: 22px;
        transform: none;
    }

    .egx-launcher:hover {
        transform: translateY(-3px) scale(1.03);
    }

    .egx-panel {
        top: 0;
        right: 0;
        bottom: 0;
        width: 100vw !important;
        height: 100dvh !important;
        min-height: 420px;
        border-radius: 0;
        transform: none;
        animation: egx-panel-in-mobile .22s ease-out;
    }

    .egx-resize-handle {
        display: none;
    }

    .egx-header {
        min-height: 72px;
        padding: 12px 8px 12px 14px;
    }

    .egx-header-actions .ant-btn {
        width: 34px;
        padding-inline: 0;
    }

    .egx-body .ant-bubble-content {
        max-width: calc(100vw - 104px);
    }

    .egx-empty {
        padding: 24px 18px 16px;
    }

    .egx-body .ant-bubble-list {
        padding: 18px 14px 12px;
    }

    .egx-composer {
        padding: 12px 12px 9px;
    }
}

@keyframes egx-panel-in-mobile {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .egx-panel,
    .egx-launcher,
    .egx-launcher-pulse::after {
        animation: none;
        transition: none;
    }
}
