.hilag-chat-launcher {
    position: fixed;
    right: 16px;
    bottom: 16px;
    width: 126px;
    min-height: 46px;
    z-index: 1100;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #24543a 0%, #3d7a56 100%);
    color: #fff;
    padding: 10px 14px;
    font: inherit;
    font-size: 14px;
    line-height: 1.2;
    font-weight: 600;
    box-shadow: 0 14px 34px rgba(24, 52, 36, 0.28);
    cursor: pointer;
    animation: hilag-chat-launcher-pop 700ms ease-out 350ms 2;
}

.hilag-chat-nudge {
    position: fixed;
    right: 16px;
    bottom: 72px;
    max-width: min(270px, calc(100vw - 32px));
    z-index: 1101;
    border-radius: 14px;
    background: #fff;
    color: #183425;
    padding: 11px 14px;
    font-size: 13px;
    line-height: 1.4;
    box-shadow: 0 8px 24px rgba(22, 42, 28, 0.18);
    opacity: 1;
    transform: translateY(0);
    transition: opacity 180ms ease, transform 180ms ease;
    animation: hilag-chat-nudge-in 220ms ease-out;
}

.hilag-chat-nudge::after {
    position: absolute;
    right: 26px;
    bottom: -6px;
    width: 12px;
    height: 12px;
    background: #fff;
    content: "";
    transform: rotate(45deg);
}

.hilag-chat-nudge.is-hidden {
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
}

@keyframes hilag-chat-launcher-pop {
    0%, 100% {
        transform: scale(1);
    }
    45% {
        transform: scale(1.06);
        box-shadow: 0 18px 38px rgba(24, 52, 36, 0.36);
    }
}

@keyframes hilag-chat-nudge-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hilag-chat-panel {
    position: fixed;
    right: 16px;
    bottom: 76px;
    width: min(380px, calc(100vw - 24px));
    max-height: min(72vh, 680px);
    display: none;
    flex-direction: column;
    background: #fff;
    border: 1px solid rgba(36, 84, 58, 0.14);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(22, 42, 28, 0.24);
    overflow: hidden;
    z-index: 1100;
}

.hilag-chat-panel.is-open {
    display: flex;
}

.hilag-chat-header {
    padding: 16px 18px 12px;
    background: linear-gradient(180deg, #eff7f1 0%, #ffffff 100%);
    border-bottom: 1px solid rgba(36, 84, 58, 0.1);
}

.hilag-chat-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.hilag-chat-title {
    margin: 0;
    font-size: 18px;
    color: #183425;
}

.hilag-chat-context {
    margin: 6px 0 0;
    font-size: 12px;
    color: #4f6b5b;
}

.hilag-chat-close {
    border: 0;
    background: transparent;
    color: #375644;
    font: inherit;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.hilag-chat-status {
    padding: 10px 16px;
    font-size: 13px;
    color: #4a5d51;
    background: #f8fbf8;
    border-bottom: 1px solid rgba(36, 84, 58, 0.08);
}

.hilag-chat-status.is-error {
    color: #8d2f2f;
    background: #fff1f1;
}

.hilag-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: linear-gradient(180deg, #fbfdfb 0%, #f5f8f6 100%);
}

.hilag-chat-message {
    max-width: 86%;
    margin-bottom: 12px;
    padding: 11px 13px;
    border-radius: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
}

.hilag-chat-message.assistant {
    background: #ffffff;
    border: 1px solid rgba(36, 84, 58, 0.12);
    color: #21352a;
}

.hilag-chat-message.user {
    margin-left: auto;
    background: #2f6a49;
    color: #fff;
}

.hilag-chat-message a {
    color: #1f5535;
    text-decoration: underline;
    word-break: break-word;
}

.hilag-chat-message.user a {
    color: #ffffff;
}

.hilag-chat-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 14px;
    border-top: 1px solid rgba(36, 84, 58, 0.08);
    background: #fff;
}

.hilag-chat-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 0 14px 14px;
    background: #fff;
}

.hilag-chat-secondary {
    border: 1px solid rgba(36, 84, 58, 0.18);
    border-radius: 10px;
    background: #fff;
    color: #24543a;
    padding: 8px 12px;
    font: inherit;
    cursor: pointer;
}

.hilag-chat-hint {
    font-size: 12px;
    color: #5d6f63;
}

.hilag-chat-input {
    min-height: 44px;
    max-height: 120px;
    resize: vertical;
    border: 1px solid rgba(36, 84, 58, 0.18);
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
    color: #1b3126;
}

.hilag-chat-submit {
    align-self: end;
    border: 0;
    border-radius: 12px;
    background: #24543a;
    color: #fff;
    padding: 0 16px;
    min-height: 44px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.hilag-chat-submit:disabled,
.hilag-chat-input:disabled,
.hilag-chat-launcher:disabled,
.hilag-chat-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 640px) {
    .hilag-chat-launcher {
        right: 12px;
        left: auto;
        bottom: 12px;
        width: 126px;
        min-height: 46px;
        padding: 10px 14px;
        text-align: center;
    }

    .hilag-chat-nudge {
        right: 12px;
        bottom: 68px;
        max-width: min(270px, calc(100vw - 24px));
    }

    .hilag-chat-panel {
        right: 12px;
        left: 12px;
        bottom: 72px;
        width: auto;
        max-height: 76vh;
    }

    .hilag-chat-form {
        grid-template-columns: 1fr;
    }

    .hilag-chat-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hilag-chat-launcher,
    .hilag-chat-nudge {
        animation: none;
        transition: none;
    }
}
