.lm-ai-floating-button {
    position: fixed;
    right: 22px;
    bottom: var(--lm-ai-floating-button-bottom, 22px);
    z-index: 2147483000;
    min-width: 132px;
    max-width: min(220px, calc(100vw - 44px));
    height: 46px;
    border: 0;
    border-radius: 8px;
    background: #111827;
    color: #ffffff;
    font: 600 14px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
    cursor: pointer;
    padding: 0 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lm-ai-floating-button:hover,
.lm-ai-floating-button.is-open {
    background: #0f766e;
}

.lm-ai-floating-panel {
    position: fixed;
    right: 22px;
    bottom: var(--lm-ai-floating-panel-bottom, 78px);
    z-index: 2147483000;
    width: min(390px, calc(100vw - 32px));
    max-height: min(640px, calc(100vh - var(--lm-ai-floating-panel-bottom, 78px) - 26px));
}

.lm-ai-floating-panel.is-expanded {
    top: 12px;
    bottom: 12px;
    width: min(460px, calc(100vw - 32px));
    max-height: none;
}

.lm-ai-shell {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    height: min(640px, calc(100vh - 104px));
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 8px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
    overflow: hidden;
    color: #111827;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.lm-ai-floating-panel .lm-ai-shell {
    height: min(640px, calc(100vh - var(--lm-ai-floating-panel-bottom, 78px) - 26px));
}

.lm-ai-floating-panel.is-expanded .lm-ai-shell {
    height: calc(100vh - 24px);
}

.lm-ai-shell-inline {
    height: 520px;
    max-height: 72vh;
    box-shadow: none;
}

.lm-ai-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: start;
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
}

.lm-ai-header-text {
    min-width: 0;
}

.lm-ai-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lm-ai-panel-toggle {
    box-sizing: border-box;
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    color: #374151;
    cursor: pointer;
}

.lm-ai-panel-toggle:hover {
    border-color: #0f766e;
    color: #0f766e;
}

.lm-ai-panel-toggle-icon {
    display: block;
    width: 17px;
    height: 17px;
    pointer-events: none;
}

.lm-ai-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    color: #111827;
}

.lm-ai-subtitle {
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.35;
    color: #4b5563;
}

.lm-ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f8fafc;
}

.lm-ai-message {
    max-width: 86%;
    margin: 0 0 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.lm-ai-message-assistant {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #111827;
    white-space: normal;
}

.lm-ai-message-assistant.is-thinking {
    width: min(260px, 86%);
}

.lm-ai-thinking {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: center;
    min-height: 54px;
}

.lm-ai-thinking-page {
    position: relative;
    box-sizing: border-box;
    width: 38px;
    height: 46px;
    padding: 12px 7px 7px;
    border: 1px solid #dbeafe;
    border-radius: 7px;
    background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.lm-ai-thinking-page::before {
    content: "";
    position: absolute;
    top: -1px;
    right: -1px;
    width: 13px;
    height: 13px;
    border-left: 1px solid #bfdbfe;
    border-bottom: 1px solid #bfdbfe;
    border-radius: 0 6px 0 4px;
    background: #dbeafe;
}

.lm-ai-thinking-page-line {
    display: block;
    height: 3px;
    margin-bottom: 5px;
    border-radius: 999px;
    background: #93c5fd;
    animation: lm-ai-thinking-scan 1.4s ease-in-out infinite;
}

.lm-ai-thinking-page-line:nth-child(2) {
    width: 78%;
    animation-delay: 0.12s;
}

.lm-ai-thinking-page-line:nth-child(3) {
    width: 58%;
    animation-delay: 0.24s;
}

.lm-ai-thinking-spark {
    position: absolute;
    right: 7px;
    bottom: 7px;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #14b8a6;
    box-shadow: 0 0 0 5px rgba(20, 184, 166, 0.12);
    animation: lm-ai-thinking-pulse 1.25s ease-in-out infinite;
}

.lm-ai-thinking-copy {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
}

.lm-ai-thinking-dots {
    display: inline-flex;
    gap: 3px;
    align-items: center;
}

.lm-ai-thinking-dots span {
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: #0f766e;
    animation: lm-ai-thinking-dot 1s ease-in-out infinite;
}

.lm-ai-thinking-dots span:nth-child(2) {
    animation-delay: 0.14s;
}

.lm-ai-thinking-dots span:nth-child(3) {
    animation-delay: 0.28s;
}

@keyframes lm-ai-thinking-scan {
    0%, 100% {
        opacity: 0.45;
        transform: translateX(0);
    }
    50% {
        opacity: 1;
        transform: translateX(4px);
    }
}

@keyframes lm-ai-thinking-pulse {
    0%, 100% {
        transform: scale(0.86);
        opacity: 0.75;
    }
    50% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes lm-ai-thinking-dot {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.35;
    }
    50% {
        transform: translateY(-3px);
        opacity: 1;
    }
}

.lm-ai-message-assistant > :first-child {
    margin-top: 0;
}

.lm-ai-message-assistant > :last-child {
    margin-bottom: 0;
}

.lm-ai-message-assistant p,
.lm-ai-message-assistant ul,
.lm-ai-message-assistant ol,
.lm-ai-message-assistant blockquote,
.lm-ai-message-assistant pre {
    margin: 0 0 9px;
}

.lm-ai-message-assistant h1,
.lm-ai-message-assistant h2,
.lm-ai-message-assistant h3,
.lm-ai-message-assistant h4 {
    margin: 0 0 8px;
    color: #111827;
    font-weight: 700;
    line-height: 1.25;
}

.lm-ai-message-assistant h1 {
    font-size: 17px;
}

.lm-ai-message-assistant h2 {
    font-size: 16px;
}

.lm-ai-message-assistant h3,
.lm-ai-message-assistant h4 {
    font-size: 15px;
}

.lm-ai-message-assistant ul,
.lm-ai-message-assistant ol {
    padding-left: 19px;
}

.lm-ai-message-assistant li {
    margin: 3px 0;
}

.lm-ai-message-assistant blockquote {
    padding-left: 10px;
    border-left: 3px solid #cbd5e1;
    color: #475569;
}

.lm-ai-message-assistant code {
    padding: 1px 4px;
    border-radius: 5px;
    background: #f1f5f9;
    color: #0f172a;
    font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.lm-ai-message-assistant pre {
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    overflow-x: auto;
    white-space: pre;
}

.lm-ai-message-assistant pre code {
    padding: 0;
    border-radius: 0;
    background: transparent;
}

.lm-ai-message-assistant a {
    color: #0f766e;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.lm-ai-message-assistant strong {
    font-weight: 700;
}

.lm-ai-message-assistant hr {
    height: 1px;
    border: 0;
    background: #e5e7eb;
    margin: 10px 0;
}

.lm-ai-message-visitor {
    margin-left: auto;
    background: #0f766e;
    color: #ffffff;
    white-space: pre-wrap;
}

.lm-ai-starters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 12px;
}

.lm-ai-starter,
.lm-ai-lead-submit,
.lm-ai-send {
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font: 600 13px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.lm-ai-starter {
    padding: 8px 10px;
    background: #eef2ff;
    color: #1e3a8a;
}

.lm-ai-compose {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 12px;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}

.lm-ai-input {
    box-sizing: border-box;
    width: 100%;
    min-height: 42px;
    max-height: 96px;
    resize: vertical;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 11px;
    color: #111827;
    font: 14px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.lm-ai-input:focus,
.lm-ai-lead-input:focus {
    outline: 2px solid rgba(15, 118, 110, 0.25);
    border-color: #0f766e;
}

.lm-ai-send,
.lm-ai-lead-submit {
    background: #111827;
    color: #ffffff;
    padding: 0 14px;
    min-height: 42px;
}

.lm-ai-send:disabled {
    opacity: 0.55;
    cursor: wait;
}

.lm-ai-lead-form {
    display: grid;
    gap: 10px;
    padding: 12px;
    margin: 8px 0 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.lm-ai-lead-label {
    display: grid;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.lm-ai-lead-input {
    box-sizing: border-box;
    width: 100%;
    height: 38px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 10px;
    font: 14px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.lm-ai-consent {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    align-items: start;
    font-size: 12px;
    line-height: 1.35;
    color: #4b5563;
}

.lm-ai-assistant-inline-preview {
    min-height: 120px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 18px;
    background: #f8fafc;
}

.lm-ai-assistant-inline-title {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
}

.lm-ai-assistant-inline-message {
    margin-top: 6px;
    font-size: 14px;
    color: #4b5563;
}

@media (max-width: 560px) {
    .lm-ai-floating-button {
        right: 14px;
        bottom: var(--lm-ai-floating-button-bottom, 14px);
        max-width: calc(100vw - 28px);
    }

    .lm-ai-floating-panel {
        right: 14px;
        bottom: var(--lm-ai-floating-panel-bottom, 70px);
        width: calc(100vw - 28px);
        max-height: calc(100vh - var(--lm-ai-floating-panel-bottom, 70px) - 16px);
    }

    .lm-ai-floating-panel.is-expanded {
        top: 8px;
        bottom: 8px;
        max-height: none;
    }

    .lm-ai-floating-panel .lm-ai-shell {
        height: calc(100vh - var(--lm-ai-floating-panel-bottom, 70px) - 16px);
    }

    .lm-ai-floating-panel.is-expanded .lm-ai-shell {
        height: calc(100vh - 16px);
    }
}
