.pm-ai-widget {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1050;
    font-family: inherit;
}

.pm-ai-toggle {
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, #0b86d1, #32c58d);
    box-shadow: 0 18px 36px rgba(10, 65, 118, .28);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}

.pm-ai-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 42px rgba(10, 65, 118, .34);
}

.pm-ai-toggle:focus {
    outline: 3px solid rgba(11, 134, 209, .24);
    outline-offset: 3px;
}

.pm-ai-toggle svg {
    width: 28px;
    height: 28px;
}

.pm-ai-panel {
    position: absolute;
    right: 0;
    bottom: 74px;
    width: min(440px, calc(100vw - 32px));
    max-height: min(680px, calc(100vh - 118px));
    background: #fff;
    border: 1px solid #dfe8f3;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(15, 31, 53, .22);
    overflow: hidden;
    display: none;
}

.pm-ai-widget.is-open .pm-ai-panel {
    display: flex;
    flex-direction: column;
}

.pm-ai-header {
    padding: 16px 18px;
    border-bottom: 1px solid #e7eef7;
    background: #f8fbff;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.pm-ai-avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, #0b86d1, #32c58d);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-weight: 800;
}

.pm-ai-title {
    margin: 0;
    color: #07152d;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.25;
}

.pm-ai-subtitle {
    color: #687895;
    font-size: 12px;
    line-height: 1.4;
    margin-top: 3px;
}

.pm-ai-close {
    margin-left: auto;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #627089;
    cursor: pointer;
}

.pm-ai-close:hover {
    background: #eaf2fb;
    color: #07152d;
}

.pm-ai-messages {
    padding: 16px;
    overflow: auto;
    min-height: 210px;
    max-height: 390px;
    background: #fff;
}

.pm-ai-message {
    margin-bottom: 12px;
    display: flex;
}

.pm-ai-message.user {
    justify-content: flex-end;
}

.pm-ai-bubble {
    max-width: 92%;
    padding: 11px 13px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.55;
    white-space: normal;
}

.pm-ai-message.assistant .pm-ai-bubble {
    background: #f3f7fc;
    color: #15223a;
    border: 1px solid #e4edf8;
}

.pm-ai-message.user .pm-ai-bubble {
    background: #0b86d1;
    color: #fff;
}

.pm-ai-result-list {
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
}

.pm-ai-result-item {
    border: 1px solid #e1e9f3;
    border-radius: 10px;
    background: #fff;
    padding: 9px 10px;
    margin-top: 7px;
}

.pm-ai-result-title {
    color: #07152d;
    font-weight: 800;
    margin-bottom: 4px;
}

.pm-ai-result-meta {
    color: #637089;
    font-size: 12px;
}

.pm-ai-table-wrap {
    margin-top: 10px;
    overflow: auto;
    border: 1px solid #e1e9f3;
    border-radius: 10px;
    background: #fff;
}

.pm-ai-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
    font-size: 12px;
}

.pm-ai-table th,
.pm-ai-table td {
    padding: 8px 9px;
    border-bottom: 1px solid #edf2f7;
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}

.pm-ai-table th {
    color: #17233d;
    background: #f4f8fc;
    font-weight: 800;
}

.pm-ai-table tr:last-child td {
    border-bottom: 0;
}

.pm-ai-table .pm-ai-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.pm-ai-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.pm-ai-interpretation {
    margin-top: 8px;
    padding: 8px 10px;
    border-left: 3px solid #0b86d1;
    background: #f3f8fd;
    color: #33445f;
    font-size: 12px;
}

.pm-ai-filter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 7px;
}

.pm-ai-filter {
    border: 1px solid #d7e2ee;
    border-radius: 999px;
    background: #fff;
    padding: 3px 7px;
    color: #52627c;
    font-size: 11px;
}

.pm-ai-source {
    margin-top: 9px;
    padding-top: 7px;
    border-top: 1px solid #eef3f8;
}

.pm-ai-action {
    border: 1px solid #d7e2ee;
    border-radius: 10px;
    background: #fff;
    color: #223252;
    padding: 8px 11px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.pm-ai-action:hover {
    border-color: #0b86d1;
    color: #0b86d1;
    background: #f3f9ff;
}

.pm-ai-action:disabled {
    cursor: wait;
    opacity: .68;
}

.pm-ai-action-primary {
    border-color: #0b86d1;
    color: #fff;
    background: #0b86d1;
}

.pm-ai-action-primary:hover {
    color: #fff;
    background: #0874b5;
}

.pm-ai-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px 0;
    border-top: 1px solid #eef3f8;
}

.pm-ai-chip {
    border: 1px solid #d7e2ee;
    border-radius: 999px;
    background: #fff;
    color: #223252;
    padding: 7px 10px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
}

.pm-ai-chip:hover {
    border-color: #0b86d1;
    color: #0b86d1;
    background: #f3f9ff;
}

.pm-ai-input-row {
    display: flex;
    gap: 8px;
    padding: 12px 16px 16px;
}

.pm-ai-input {
    flex: 1;
    min-width: 0;
    border: 1px solid #d7e2ee;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 13px;
    color: #15223a;
}

.pm-ai-input:focus {
    border-color: #0b86d1;
    box-shadow: 0 0 0 3px rgba(11, 134, 209, .12);
    outline: none;
}

.pm-ai-send {
    width: 44px;
    border: 0;
    border-radius: 12px;
    color: #fff;
    background: #0b86d1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pm-ai-send:hover {
    background: #0874b5;
}

.pm-ai-chart-wrap {
    height: 230px;
    margin-top: 10px;
}

.pm-ai-fallback-bars {
    margin-top: 10px;
}

.pm-ai-fallback-bar {
    display: grid;
    grid-template-columns: 92px 1fr 64px;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
}

.pm-ai-fallback-track {
    height: 10px;
    background: #e7eef7;
    border-radius: 999px;
    overflow: hidden;
}

.pm-ai-fallback-fill {
    height: 100%;
    background: #0b86d1;
}

.pm-ai-highlight-row {
    outline: 2px solid rgba(11, 134, 209, .34);
    outline-offset: -2px;
    background: #f0f8ff !important;
}

@media (max-width: 576px) {
    .pm-ai-widget {
        right: 14px;
        bottom: 14px;
    }

    .pm-ai-panel {
        right: -2px;
        bottom: 68px;
        width: calc(100vw - 24px);
        max-height: calc(100vh - 96px);
    }

    .pm-ai-messages {
        max-height: calc(100vh - 330px);
    }
}
