.crm-ai-page {
    min-height: calc(100vh - 160px);
}

.crm-ai-shell {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e7eaec;
    border-radius: 8px;
    min-height: 560px;
    max-height: calc(100vh - 200px);
}

.crm-ai-shell-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid #e7eaec;
}

.crm-ai-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.crm-ai-shell-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.crm-ai-ollama {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.crm-ai-lamp {
    margin-right: 8px;
    font-size: 14px;
    vertical-align: middle;
    text-shadow: 0 0 8px currentColor;
}

.crm-ai-ollama.is-on {
    color: #1ab394;
}

.crm-ai-ollama.is-off {
    color: #ed5565;
}

.crm-ai-fab-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 12px;
    text-shadow: 0 0 6px currentColor;
}

.crm-ai-shell-header p {
    margin: 0;
    color: #676a6c;
    font-size: 12px;
}

.crm-ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    background: #f8f9fb;
}

.crm-ai-msg-text {
    white-space: pre-wrap;
}

.crm-ai-excel {
    margin-top: 8px;
}

.crm-ai-msg {
    max-width: 92%;
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13px;
    line-height: 1.5;
}

.crm-ai-page .crm-ai-msg.crm-ai-msg-user,
.crm-ai-float .crm-ai-msg.crm-ai-msg-user,
.crm-ai-msg-user {
    margin-left: auto;
    background: #eef1f4 !important;
    color: #2f4050 !important;
    border: 1px solid #e2e6ea !important;
}

.crm-ai-msg-assistant {
    background: #fff;
    border: 1px solid #e7eaec;
    color: #2f4050;
}

.crm-ai-msg-error {
    background: #fff3f3;
    border: 1px solid #ed5565;
    color: #a94442;
}

.crm-ai-chips {
    padding: 8px 20px 0;
}

.crm-ai-chip {
    display: inline-block;
    margin: 0 6px 8px 0;
    padding: 4px 10px;
    font-size: 12px;
    border: 1px solid #dce0e4;
    border-radius: 16px;
    background: #fff;
    cursor: pointer;
}

.crm-ai-chip:hover {
    border-color: #1ab394;
    color: #1ab394;
}

.crm-ai-composer {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e7eaec;
    background: #fff;
}

.crm-ai-composer textarea {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    resize: vertical;
    border: 1px solid #e5e6e7;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
}

.crm-ai-composer .btn {
    align-self: flex-end;
}

.crm-ai-fab {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1060;
    width: 52px;
    height: 52px;
    border: 0;
    border-radius: 50%;
    background: #1ab394;
    color: #fff;
    box-shadow: 0 6px 16px rgba(26, 179, 148, 0.35);
    font-size: 20px;
}

.crm-ai-fab:hover,
.crm-ai-fab:focus {
    background: #18a689;
    color: #fff;
}

.crm-ai-float {
    position: fixed;
    right: 22px;
    bottom: 84px;
    z-index: 1060;
    width: 400px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e7eaec;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.crm-ai-float .crm-ai-shell {
    border: 0;
    min-height: 0;
    max-height: none;
    height: 100%;
    border-radius: 10px;
}

.crm-ai-float-close {
    float: right;
    border: 0;
    background: transparent;
    color: #676a6c;
    font-size: 16px;
}

body.dx-dark-mode .crm-ai-shell,
body.dx-dark-mode .crm-ai-float,
body.dx-dark-mode .crm-ai-composer,
body.dx-dark-mode .crm-ai-chip {
    background: #1f2937;
    border-color: #374151;
    color: #e5e7eb;
}

body.dx-dark-mode .crm-ai-messages {
    background: #111827;
}

body.dx-dark-mode .crm-ai-msg-assistant,
body.dx-dark-mode .crm-ai-msg-user {
    background: #1f2937;
    border-color: #374151;
    color: #e5e7eb;
}

body.dx-dark-mode .crm-ai-composer textarea {
    background: #111827;
    border-color: #374151;
    color: #e5e7eb;
}
