.ecosystem-ai-widget-root {
    --ecosystem-ai-header-bg: #1a1a1a;
    --ecosystem-ai-header-text: #ffffff;
    --ecosystem-ai-panel-bg: #ffffff;
    --ecosystem-ai-panel-text: #111111;
    --ecosystem-ai-bubble-bg: #f4f6f8;
    --ecosystem-ai-bubble-text: #111111;
    --ecosystem-ai-action-bg: #ffffff;
    --ecosystem-ai-action-text: #1a1a1a;
    --ecosystem-ai-border: #d9dde3;

    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: var(--ecosystem-ai-panel-text);
}

.ecosystem-ai-widget-launcher {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: none;
    border-radius: 999px;
    padding: 14px 22px;
    background: var(--ecosystem-ai-header-bg);
    color: var(--ecosystem-ai-header-text);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
    max-width: min(320px, calc(100vw - 32px));
}

.ecosystem-ai-widget-launcher-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
}

.ecosystem-ai-widget-launcher-icon::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
}

.ecosystem-ai-widget-launcher-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ecosystem-ai-widget-launcher:hover {
    filter: brightness(1.15);
}

.ecosystem-ai-widget-launcher:focus-visible,
.ecosystem-ai-widget-panel button:focus-visible,
.ecosystem-ai-widget-panel a:focus-visible,
.ecosystem-ai-widget-input:focus-visible {
    outline: 2px solid var(--ecosystem-ai-header-bg);
    outline-offset: 2px;
}

.ecosystem-ai-widget-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 12px);
    width: 380px;
    max-width: calc(100vw - 32px);
    max-height: min(640px, 80vh);
    display: flex;
    flex-direction: column;
    background: var(--ecosystem-ai-panel-bg);
    color: var(--ecosystem-ai-panel-text);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
    overflow: hidden;
}

.ecosystem-ai-widget-panel[hidden] {
    display: none;
}

.ecosystem-ai-widget-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
    background: var(--ecosystem-ai-header-bg);
    color: var(--ecosystem-ai-header-text);
    flex: 0 0 auto;
}

.ecosystem-ai-widget-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.ecosystem-ai-widget-header-row-bottom {
    justify-content: flex-end;
}

.ecosystem-ai-widget-title-group {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
}

.ecosystem-ai-widget-title {
    flex: 0 0 auto;
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
}

.ecosystem-ai-widget-subtitle {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12px;
    font-weight: 400;
    color: var(--ecosystem-ai-header-text);
    opacity: 0.75;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ecosystem-ai-widget-new-conversation {
    flex: 0 0 auto;
    border: 1px solid var(--ecosystem-ai-border);
    background: transparent;
    color: var(--ecosystem-ai-header-text);
    opacity: 0.75;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
}

.ecosystem-ai-widget-new-conversation:hover {
    opacity: 1;
}

.ecosystem-ai-widget-icon-button {
    flex: 0 0 auto;
    border: 1px solid var(--ecosystem-ai-border);
    background: transparent;
    color: var(--ecosystem-ai-header-text);
    cursor: pointer;
    padding: 4px 7px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1;
}

.ecosystem-ai-widget-icon-button:hover {
    background: rgba(255, 255, 255, 0.15);
}

.ecosystem-ai-widget-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 12px 16px;
    background: var(--ecosystem-ai-panel-bg);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ecosystem-ai-widget-message {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 10px;
    white-space: pre-wrap;
    word-break: break-word;
}

.ecosystem-ai-widget-message-assistant {
    align-self: flex-start;
    background: var(--ecosystem-ai-bubble-bg);
    border: 1px solid var(--ecosystem-ai-border);
    color: var(--ecosystem-ai-bubble-text);
}

.ecosystem-ai-widget-message-user {
    align-self: flex-end;
    background: var(--ecosystem-ai-header-bg);
    color: var(--ecosystem-ai-header-text);
}

.ecosystem-ai-widget-message-status {
    align-self: flex-start;
    color: #666666;
    font-style: italic;
}

.ecosystem-ai-widget-message-error {
    align-self: flex-start;
    background: #fdecea;
    border: 1px solid #f4b5ae;
    color: #7a1f16;
}

.ecosystem-ai-widget-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-self: stretch;
}

.ecosystem-ai-widget-quick-action {
    border: 1px solid var(--ecosystem-ai-border);
    background: var(--ecosystem-ai-action-bg);
    color: var(--ecosystem-ai-action-text);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: normal;
}

.ecosystem-ai-widget-quick-action:hover:not(:disabled) {
    filter: brightness(0.95);
}

.ecosystem-ai-widget-quick-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ecosystem-ai-widget-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-self: stretch;
}

.ecosystem-ai-widget-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--ecosystem-ai-border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--ecosystem-ai-panel-bg);
    color: var(--ecosystem-ai-panel-text);
}

.ecosystem-ai-widget-card-selected {
    border-color: var(--ecosystem-ai-header-bg);
    box-shadow: 0 0 0 1px var(--ecosystem-ai-header-bg);
}

.ecosystem-ai-widget-card-media {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #eeeeef;
    overflow: hidden;
}

.ecosystem-ai-widget-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ecosystem-ai-widget-card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
}

.ecosystem-ai-widget-card-title {
    font-weight: 600;
    font-size: 14px;
}

.ecosystem-ai-widget-card-price {
    font-weight: 700;
    font-size: 15px;
    color: var(--ecosystem-ai-header-bg);
}

.ecosystem-ai-widget-card-specs,
.ecosystem-ai-widget-card-mileage {
    font-size: 12px;
    color: #555555;
}

.ecosystem-ai-widget-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.ecosystem-ai-widget-card-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid var(--ecosystem-ai-border);
}

.ecosystem-ai-widget-card-cta-view {
    background: transparent;
    border-color: var(--ecosystem-ai-header-bg);
    color: var(--ecosystem-ai-header-bg);
}

.ecosystem-ai-widget-card-cta-view:hover {
    background: var(--ecosystem-ai-header-bg);
    color: var(--ecosystem-ai-header-text);
}

.ecosystem-ai-widget-card-cta-interest {
    background: var(--ecosystem-ai-action-bg);
    color: var(--ecosystem-ai-action-text);
    border-color: var(--ecosystem-ai-action-text);
}

.ecosystem-ai-widget-card-cta-interest:hover:not(:disabled) {
    filter: brightness(0.95);
}

.ecosystem-ai-widget-card-cta-interest:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ecosystem-ai-widget-footer {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    background: var(--ecosystem-ai-panel-bg);
    border-top: 1px solid var(--ecosystem-ai-border);
}

.ecosystem-ai-widget-input {
    flex: 1 1 auto;
    resize: none;
    max-height: 96px;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--ecosystem-ai-border);
    border-radius: 8px;
    font: inherit;
    color: var(--ecosystem-ai-panel-text);
    background: var(--ecosystem-ai-panel-bg);
}

.ecosystem-ai-widget-input:disabled {
    background: #f0f0f0;
    color: #888888;
}

.ecosystem-ai-widget-send {
    flex: 0 0 auto;
    border: none;
    border-radius: 8px;
    padding: 9px 14px;
    background: var(--ecosystem-ai-header-bg);
    color: var(--ecosystem-ai-header-text);
    font-weight: 600;
    cursor: pointer;
}

.ecosystem-ai-widget-send:disabled {
    background: #9a9a9a;
    cursor: not-allowed;
}

.ecosystem-ai-widget-send:hover:not(:disabled) {
    filter: brightness(1.2);
}

@media (max-width: 480px) {
    .ecosystem-ai-widget-root {
        right: 8px;
        bottom: 8px;
    }

    .ecosystem-ai-widget-launcher {
        padding: 12px 18px;
        font-size: 14px;
    }

    .ecosystem-ai-widget-panel {
        width: calc(100vw - 16px);
        max-height: min(560px, 75vh);
    }

    .ecosystem-ai-widget-title-group {
        gap: 6px;
    }

    .ecosystem-ai-widget-subtitle {
        font-size: 11px;
    }

    .ecosystem-ai-widget-card-actions {
        flex-direction: column;
        align-items: stretch;
    }
}
